| Previous | 15994 Revisions | Next |
| r5933 Thursday 1st October, 2009 at 06:42:46 UTC by Fabio Priuli |
|---|
| Run srcclean on the rest of the source (feel free to revert single files if they conflict with any wip code you have) |
| [src/mess/audio] | cdp1863.c cdp1863.h channelf.c dai.c dave.c gb.c lmc1992.c lmc1992.h lynx.c mac.c mea8000.c sblaster.c socrates.c spchroms.c svision.c t6721.c ted7360.c vic6560.c vp550.c vp550.h vp595.c vp595.h |
| [src/mess/drivers] | 4004clk.c a2600.c a310.c a51xx.c abc80.c abc80x.c ac1.c act.c adam.c advision.c aim65.c ami1200.c amico2k.c amiga.c amstrad.c apexc.c apf.c apogee.c apple2.c apple2gs.c apple3.c aquarius.c arcadia.c astrocde.c at.c atari.c atarist.c atm.c b2m.c bbc.c bbcbc.c bcs3.c bebox.c beehive.c beta.c bob85.c busicom.c bw12.c bw2.c c80.c camplynx.c cat.c cdi.c cgenie.c coco.c coleco.c compis.c comx35.c comxpl80.c concept.c cpschngr.c crvision.c dc.c dectalk.c dgn_beta.c ec65.c einstein.c electron.c elf.c elwro800.c enterp.c esq1.c et3400.c exidy.c exp85.c fk1.c fm7.c fmtowns.c galaxy.c gb.c gba.c geneve.c gp2x.c gp32.c h19.c hec2hrp.c homelab.c huebler.c hx20.c interact.c intv.c ip22.c jaguar.c jr200.c jtc.c junior.c jupiter.c kaypro.c kc.c kim1.c kyocera.c lc80.c lisa.c llc.c lynx.c m20.c mac.c mbee.c mc1000.c mc80.c mekd2.c microtan.c mikro80.c mikromik.c mk85.c mmd1.c msx.c mz80.c nakajies.c nanos.c nascom1.c nc.c newbrain.c ng_aes.c odyssey2.c ondra.c oric.c orion.c osborne1.c osi.c p2000t.c p8k.c palm.c partner.c pc.c pc8401a.c pc8801.c pc98.c pce.c pcm.c pcw.c pecom.c pentagon.c pippin.c pk8000.c pk8020.c pmd85.c pocketc.c pockstat.c poly88.c poly880.c pp01.c primo.c prof80.c psx.c ptcsol.c px4.c pyl601.c ql.c qx10.c radio86.c samcoupe.c sapi1.c saturn.c scorpion.c sdk86.c sg1000.c sms.c socrates.c sord.c spec128.c special.c specpls3.c spectrum.c studio2.c super80.c svi318.c svision.c tec1.c ti85.c ti89.c ti990_4.c ti99_4p.c ti99_4x.c ti99_8.c tiki100.c timex.c tm990189.c tmc1800.c tmc2000e.c tmc600.c trs80.c tutor.c tvc.c uknc.c unior.c univac.c v1050.c vboy.c vc4000.c vcs80.c vector06.c vectrex.c vg5k.c vip.c vk100.c votrpss.c votrtnt.c vt100.c vt220.c vt320.c vt520.c vtech1.c vtech2.c wswan.c x1.c x68k.c xerox820.c xor100.c z1013.c z9001.c zrt80.c zx.c |
| [src/mess/includes] | abc80x.h apple2gs.h apple3.h b2m.h bebox.h c128.h c64.h cbm.h cgenie.h coco.h cybiko.h electron.h fm7.h genesis.h kyocera.h lisa.h mac.h mz80.h orion.h pecom.h vc1541.h vectrex.h |
| [src/mess/machine] | 3do.c 6525tpi.c 6551.c 6551.h 6883sam.c 6883sam.h 68901mfp.c 68901mfp.h 8530scc.c 8530scc.h 990_dk.c 990_dk.h 990_hd.c 990_hd.h 990_tap.c 990_tap.h 994x_ser.c 99_dsk.c 99_hsgpl.c 99_ide.c 99_peb.c 99_peb.h 99_usbsm.c a7800.c abcbus.c abcbus.h ac1.c adam.c adc080x.h advision.c amigacd.c amigacrt.c amigafdc.c amigakbd.c amstr_pc.c amstrad.c ap2_lang.c ap2_lang.h ap2_slot.c ap2_slot.h apple1.c apple2.c apple2gs.c apple3.c applefdc.c applefdc.h at.c at29040.c at45dbxx.c at45dbxx.h ataricrt.c ataridev.h atarifdc.c atom.c ay31015.c ay31015.h ay3600.c ay3600.h b2m.c bbc.c bebox.c beta.c beta.h bk.c cdp1871.c cdp1871.h cgenie.c coco.c com8116.c com8116.h compis.c comx35.c concept.c conkort.c corvushd.c cybiko.c dai.c dc.c dgn_beta.c ds1315.c ds1315.h electron.c europc.c exidy.c galaxy.c galeb.c gamecom.c gamepock.c gb.c gdrom.c genesis.c geneve.c hd63450.c hd63450.h homelab.c hp48.c i8155.c i8155.h i8212.c i8212.h i8214.c i8214.h i82439tx.c i82439tx.h i8271.c i8355.c i8355.h ibmpc.c ins8154.h ins8250.c ins8250.h intv.c jupiter.c kay_kbd.c kaypro.c kb3600.c kb3600.h kc.c lisa.c llc.c lynx.c mac.c matsucd.c matsucd.h mbee.c mc6843.c mc6846.c mc6854.c mc80.c mekd2.c microtan.c mm58274c.c mm58274c.h mm74c922.c mm74c922.h mockngbd.c mockngbd.h mpc105.c mpc105.h msm58321.c msm58321.h msm8251.c msm8251.h msx.c msx_slot.c mz700.c mz80.c nascom1.c ncr5380.c nec765.c nec765.h odyssey2.c ondra.c orao.c oric.c orion.c osborne1.c p2000t.c partner.c pc.c pc1251.c pc1350.c pc1401.c pc1403.c pc8801.c pc_fdc.c pc_fdc.h pc_hdc.c pc_ide.c pc_joy.c pc_joy.h pc_mouse.c pc_turbo.c pc_turbo.h pce.c pcf8593.c pcf8593.h pdp1.c pecom.c pk8020.c pmd85.c pokemini.c poly88.c pp01.c primo.c ps2.c radio86.c rp5c01a.c rp5c01a.h rp5c15.c serial.c sgi.c sgi.h smartmed.c smartmed.h smc92x4.c smc92x4.h sms.c snescart.c snescart.h special.c spectrum.c sst39vfx.c sst39vfx.h strata.c strata.h super80.c svi318.c sym1.c tandy1t.c tc8521.c tc8521.h ti85.c ti990.c ti990.h ti99_4x.c ti99_4x.h ti99pcod.c ti99pcod.h tms5501.c tms5501.h tms9901.c tms9901.h tms9902.c trs80.c tx0.c upd1990a.c upd1990a.h upd7002.c upd7201.c upd7201.h ut88.c vector06.c vectrex.c vtech2.c wd17xx.c wswan.c x68k_hdc.c x68k_hdc.h z1013.c z80dart.c z80dart.h z80sti.c z80sti.h zx.c zx8302.c zx8302.h |
| [src/mess/tools/castool] | castool.mak main.c |
| [src/mess/tools/dat2html] | dat2html.mak |
| [src/mess/tools/imgtool] | filtbas.c filteoln.c filter.c filter.h iflopimg.c iflopimg.h imghd.c imghd.h imgterrs.c imgterrs.h imgtool.c imgtool.h imgtoolx.h library.c main.c modules.c modules.h stream.c stream.h |
| [src/mess/tools/imgtool/modules] | amiga.c concept.c crt.c cybiko.c d64.c fat.c fmsx_cas.c lynx.c mac.c macbin.c macutil.c macutil.h nccard.c os9.c pc_flop.c pc_hard.c prodos.c rom16.c rsdos.c svi_cas.c t64.c thomson.c ti99.c ti990hd.c vmsx_tap.c vzdos.c xsa.c |
| [src/mess/tools/imgtool/windows] | assocdlg.c hexview.c hexview.h secview.c secview.h wimgtool.c wimgtool.h wmain.c |
| [src/mess/tools/messdocs] | messdocs.mak |
| [src/mess/tools/messtest] | core.c core.h main.c testimgt.c testimgt.h testmess.c testmess.h testzpth.c testzpth.h tststubs.c tstutils.c |
| [src/mess/video] | 733_asr.c 911_chr.h 911_key.h 911_vdt.c a7800.c abc80.c abc800.c abc802.c abc806.c ac1.c advision.c apple1.c apple2.c apple2gs.c apple3.c arcadia.c atarist.c b2m.c bbc.c bbctext.h border.c busicom.c cbmb.c cdp1861.h cdp1862.c cdp1862.h cgenie.c channelf.c cirrus.c cirrus.h coco.c coco3.c comx35.c cpschngr.c crt.c crtc6845.c crtc_ega.c dai.c dgn_beta.c dm9368.h electron.c epnick.c fm7.c galaxy.c galeb.c gb.c hd44102.c hd61830.c hd66421.c hd66421.h homelab.c hp48.c i82720.c i82720.h i82720cm.h i8275.c i8275.h intv.c irisha.c k1ge.c kaypro.c kc.c kramermc.c kyocera.c llc.c m6845.c m6845.h m6847.c m6847.h mac.c mbee.c mc80.c mekd2.c microtan.c mikro80.c msm6255.c msm6255.h mz700.c mz80.c newport.c newport.h odyssey2.c orao.c oric.c orion.c osi.c p2000m.c pc1251.c pc1401.c pc1403.c pc8401a.c pc_aga.c pc_aga.h pc_cga.c pc_cga.h pc_ega.c pc_mda.c pc_t1t.c pc_vga.c pc_vga.h pc_video.c pc_video.h pcw16.c pdp1.c pecom.c pk8020.c pocketc.c poly88.c pp01.c radio86.c saa505x.c saa505x.h sapi1.c sed1330.c smsvdp.c special.c spectrum.c ssystem3.c super80.c ted7360.c thomson.c timex.c tms3556.c tms3556.h trs80.c tx0.c upd7220.c ut88.c v1050.c vc4000.c vector06.c vectrex.c vic4567.c vic6567.c vic6567.h vtech2.c vtvideo.c vtvideo.h wswan.c x68k.c z1013.c z88.c zx.c zx8301.c zx8301.h |
| r5932 | r5933 | |
|---|---|---|
| 31 | 31 | #------------------------------------------------- |
| 32 | 32 | # rules for building the dat2html executable |
| 33 | 33 | #------------------------------------------------- |
| 34 | ||
| 34 | ||
| 35 | 35 | $(DAT2HTML): $(DAT2HTML_OBJS) $(LIBUTIL) $(ZLIB) $(LIBOCORE) |
| 36 | 36 | @echo Linking $@... |
| 37 | 37 | $(LD) $(LDFLAGS) $^ $(LIBS) -o $@ |
| r5932 | r5933 | |
|---|---|---|
| 12 | 12 | |
| 13 | 13 | # messdocs will create this file |
| 14 | 14 | HELPOBJ = $(OBJ)/help |
| 15 | MESSHELP = mess.chm | |
| 15 | MESSHELP = mess.chm | |
| 16 | 16 | |
| 17 | 17 | # add our stuff to the global variables |
| 18 | 18 | OBJDIRS += $(MESSOBJ)/tools/messdocs |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | main.c | |
| 4 | 4 | |
| 5 | Castool command line front end | |
| 6 | ||
| 7 | 27/03/2009 Initial version by Miodrag Milanovic | |
| 5 | Castool command line front end | |
| 8 | 6 | |
| 7 | 27/03/2009 Initial version by Miodrag Milanovic | |
| 8 | ||
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | #include <stdio.h> |
| r5932 | r5933 | |
| 24 | 24 | |
| 25 | 25 | #include "devices/cassette.h" |
| 26 | 26 | |
| 27 | #include "formats/a26_cas.h" | |
| 28 | #include "formats/apf_apt.h" | |
| 29 | #include "formats/cbm_tap.h" | |
| 30 | #include "formats/cgen_cas.h" | |
| 31 | #include "formats/coco_cas.h" | |
| 32 | #include "formats/csw_cas.h" | |
| 33 | #include "formats/fmsx_cas.h" | |
| 34 | #include "formats/gtp_cas.h" | |
| 35 | #include "formats/jupi_tap.h" | |
| 36 | #include "formats/kim1_cas.h" | |
| 37 | #include "formats/lviv_lvt.h" | |
| 38 | #include "formats/mz_cas.h" | |
| 39 | #include "formats/orao_cas.h" | |
| 40 | #include "formats/oric_tap.h" | |
| 41 | #include "formats/pmd_pmd.h" | |
| 42 | #include "formats/primoptp.h" | |
| 43 | #include "formats/rk_cas.h" | |
| 44 | #include "formats/sord_cas.h" | |
| 45 | #include "formats/svi_cas.h" | |
| 46 | #include "formats/trs_cas.h" | |
| 47 | #include "formats/tzx_cas.h" | |
| 48 | #include "formats/uef_cas.h" | |
| 49 | #include "formats/vt_cas.h" | |
| 50 | #include "formats/zx81_p.h" | |
| 27 | #include "formats/a26_cas.h" | |
| 28 | #include "formats/apf_apt.h" | |
| 29 | #include "formats/cbm_tap.h" | |
| 30 | #include "formats/cgen_cas.h" | |
| 31 | #include "formats/coco_cas.h" | |
| 32 | #include "formats/csw_cas.h" | |
| 33 | #include "formats/fmsx_cas.h" | |
| 34 | #include "formats/gtp_cas.h" | |
| 35 | #include "formats/jupi_tap.h" | |
| 36 | #include "formats/kim1_cas.h" | |
| 37 | #include "formats/lviv_lvt.h" | |
| 38 | #include "formats/mz_cas.h" | |
| 39 | #include "formats/orao_cas.h" | |
| 40 | #include "formats/oric_tap.h" | |
| 41 | #include "formats/pmd_pmd.h" | |
| 42 | #include "formats/primoptp.h" | |
| 43 | #include "formats/rk_cas.h" | |
| 44 | #include "formats/sord_cas.h" | |
| 45 | #include "formats/svi_cas.h" | |
| 46 | #include "formats/trs_cas.h" | |
| 47 | #include "formats/tzx_cas.h" | |
| 48 | #include "formats/uef_cas.h" | |
| 49 | #include "formats/vt_cas.h" | |
| 50 | #include "formats/zx81_p.h" | |
| 51 | 51 | |
| 52 | 52 | struct SupportedCassetteFormats |
| 53 | 53 | { |
| r5932 | r5933 | |
| 56 | 56 | const char *desc; |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | const struct SupportedCassetteFormats formats[] = { | |
| 59 | const struct SupportedCassetteFormats formats[] = { | |
| 60 | 60 | {"a26", a26_cassette_formats ,"Atari 2600"}, |
| 61 | 61 | {"apf", apf_cassette_formats ,"APF Imagination Machine"}, |
| 62 | 62 | {"cbm", cbm_cassette_formats ,"Commodore"}, |
| r5932 | r5933 | |
| 93 | 93 | {"zx81_p", zx81_p_format ,"Sinclair ZX81"}, |
| 94 | 94 | {"zx80_o", zx80_o_format ,"Sinclair ZX80"}, |
| 95 | 95 | {NULL,NULL,NULL} |
| 96 | }; | |
| 96 | }; | |
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | static const char *get_extension(const char *name) |
| r5932 | r5933 | |
| 128 | 128 | #else |
| 129 | 129 | int CLIB_DECL main(int argc, char *argv[]) |
| 130 | 130 | #endif |
| 131 | { | |
| 131 | { | |
| 132 | 132 | int i; |
| 133 | 133 | int found =0; |
| 134 | 134 | const struct CassetteFormat * const *selected_formats = NULL; |
| r5932 | r5933 | |
| 139 | 139 | #endif /* WIN32 */ |
| 140 | 140 | |
| 141 | 141 | |
| 142 | init_resource_tracking(); | |
| 142 | init_resource_tracking(); | |
| 143 | 143 | begin_resource_tracking(); |
| 144 | 144 | |
| 145 | 145 | if (argc > 1) |
| r5932 | r5933 | |
| 156 | 156 | if (mame_stricmp(formats[i].name,argv[2])==0) { |
| 157 | 157 | selected_formats = formats[i].formats; |
| 158 | 158 | found = 1; |
| 159 | } | |
| 159 | } | |
| 160 | 160 | } |
| 161 | 161 | if (found==0) { |
| 162 | 162 | fprintf(stderr, "Wrong format name.\n\n"); |
| 163 | 163 | display_usage(); |
| 164 | 164 | fprintf(stderr, "\n"); |
| 165 | 165 | display_formats(); |
| 166 | return -1; | |
| 167 | } | |
| 168 | ||
| 169 | f = fopen(argv[3], "rb"); | |
| 166 | return -1; | |
| 167 | } | |
| 168 | ||
| 169 | f = fopen(argv[3], "rb"); | |
| 170 | 170 | if (!f) { |
| 171 | 171 | fprintf(stderr, "File %s not found.\n",argv[3]); |
| 172 | 172 | return -1; |
| 173 | 173 | } |
| 174 | ||
| 174 | ||
| 175 | 175 | if (cassette_open_choices(NULL, f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, CASSETTE_FLAG_READONLY, &cassette)) { |
| 176 | fprintf(stderr, "Invalid format of input file.\n"); | |
| 176 | fprintf(stderr, "Invalid format of input file.\n"); | |
| 177 | 177 | return -1; |
| 178 | 178 | } |
| 179 | ||
| 179 | ||
| 180 | 180 | cassette_dump(cassette,argv[4]); |
| 181 | 181 | cassette_close(cassette); |
| 182 | 182 | goto theend; |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | } | |
| 185 | } | |
| 186 | 186 | |
| 187 | 187 | /* Usage */ |
| 188 | 188 | fprintf(stderr, "castool - Generic cassette manipulation tool for use with MESS\n\n"); |
| r5932 | r5933 | |
| 190 | 190 | fprintf(stderr, "\n"); |
| 191 | 191 | display_formats(); |
| 192 | 192 | fprintf(stderr, "\nExample usage:\n"); |
| 193 | fprintf(stderr, " castool.exe convert tzx game.tzx game.wav\n\n"); | |
| 193 | fprintf(stderr, " castool.exe convert tzx game.tzx game.wav\n\n"); | |
| 194 | 194 | |
| 195 | 195 | theend : |
| 196 | 196 | /* clean up our tracked resources */ |
| r5932 | r5933 | |
|---|---|---|
| 62 | 62 | $(MESS_FORMATS)/ioprocs.o \ |
| 63 | 63 | $(MESS_FORMATS)/cassimg.o \ |
| 64 | 64 | $(MESS_FORMATS)/wavfile.o \ |
| 65 | ||
| 66 | 65 | |
| 66 | ||
| 67 | 67 | $(LIBCASTOOL): $(CASTOOL_LIB_OBJS) |
| 68 | 68 | |
| 69 | 69 | CASTOOL_OBJS = \ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | testimgt.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Imgtool testing code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | main.c | |
| 4 | 4 | |
| 5 | ||
| 5 | MESS testing main module | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 34 | 34 | |
| 35 | 35 | /************************************* |
| 36 | 36 | * |
| 37 | * | |
| 37 | * Main and argument parsing/handling | |
| 38 | 38 | * |
| 39 | 39 | *************************************/ |
| 40 | 40 | |
| r5932 | r5933 | |
| 100 | 100 | /* run MAME's validity checks; if these fail cop out now */ |
| 101 | 101 | /* NPW 16-Sep-2006 - commenting this out because this cannot be run outside of MAME */ |
| 102 | 102 | //if (mame_validitychecks(-1)) |
| 103 | // | |
| 103 | // goto done; | |
| 104 | 104 | /* run Imgtool's validity checks; if these fail cop out now */ |
| 105 | 105 | if (imgtool_validitychecks()) |
| 106 | 106 | goto done; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | testimgt.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Imgtool testing code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | testzpth.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for testing zip paths | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 12 | 12 | |
| 13 | 13 | /*------------------------------------------------- |
| 14 | 14 | dir_entry_type_string - gets a string |
| 15 | ||
| 15 | representation of a osd_dir_entry_type | |
| 16 | 16 | -------------------------------------------------*/ |
| 17 | 17 | |
| 18 | 18 | static const char *dir_entry_type_string(osd_dir_entry_type type) |
| r5932 | r5933 | |
| 105 | 105 | { |
| 106 | 106 | report_message(MSG_FAILURE, "File sizes match, but contents do not"); |
| 107 | 107 | goto done; |
| 108 | } | |
| 108 | } | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /* try doing a directory listing */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | testmess.c | |
| 4 | 4 | |
| 5 | ||
| 5 | MESS testing code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | /* very dirty hack - we unload the image because we cannot access it |
| 916 | ||
| 916 | * because the file is locked */ | |
| 917 | 917 | strcpy(filename_buf, filename); |
| 918 | 918 | image_unload(image); |
| 919 | 919 | filename = filename_buf; |
| r5932 | r5933 | |
| 1074 | 1074 | if (state == STATE_READY) |
| 1075 | 1075 | { |
| 1076 | 1076 | /* if we are at the end, and we are dumping screenshots, and we didn't |
| 1077 | * just dump a screenshot, dump one now | |
| 1078 | */ | |
| 1077 | * just dump a screenshot, dump one now | |
| 1078 | */ | |
| 1079 | 1079 | if ((test_flags & MESSTEST_ALWAYS_DUMP_SCREENSHOT) && |
| 1080 | 1080 | (current_command[0].command_type != MESSTEST_COMMAND_SCREENSHOT) && |
| 1081 | 1081 | (current_command[1].command_type == MESSTEST_COMMAND_END)) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | core.c | |
| 4 | 4 | |
| 5 | ||
| 5 | MESS testing code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 365 | 365 | |
| 366 | 366 | /* this external entity handler allows us to do things like this: |
| 367 | 367 | * |
| 368 | * <!DOCTYPE tests | |
| 369 | * [ | |
| 370 | * <!ENTITY mamekey_esc SYSTEM "http://www.mess.org/messtest/"> | |
| 371 | * ]> | |
| 368 | * <!DOCTYPE tests | |
| 369 | * [ | |
| 370 | * <!ENTITY mamekey_esc SYSTEM "http://www.mess.org/messtest/"> | |
| 371 | * ]> | |
| 372 | 372 | */ |
| 373 | 373 | static int external_entity_handler(XML_Parser parser, |
| 374 | 374 | const XML_Char *context, |
| r5932 | r5933 | |
| 616 | 616 | while(buf[i++]); |
| 617 | 617 | |
| 618 | 618 | /* did we abort? */ |
| 619 | /* if ((msgtype == MSG_FAILURE) && (state != STATE_ABORTED)) | |
| 620 | { | |
| 621 | state = STATE_ABORTED; | |
| 622 | final_time = timer_get_time(machine); | |
| 623 | if (final_time > 0.0) | |
| 624 | dump_screenshot(); | |
| 625 | } | |
| 619 | /* if ((msgtype == MSG_FAILURE) && (state != STATE_ABORTED)) | |
| 620 | { | |
| 621 | state = STATE_ABORTED; | |
| 622 | final_time = timer_get_time(machine); | |
| 623 | if (final_time > 0.0) | |
| 624 | dump_screenshot(); | |
| 625 | } | |
| 626 | 626 | */ |
| 627 | 627 | } |
| 628 | 628 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | testzpth.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for testing zip paths | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | //============================================================ |
| 27 | // | |
| 27 | // osd_alloc_executable | |
| 28 | 28 | //============================================================ |
| 29 | 29 | |
| 30 | 30 | void *osd_alloc_executable(size_t size) |
| r5932 | r5933 | |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | //============================================================ |
| 42 | // | |
| 42 | // osd_free_executable | |
| 43 | 43 | //============================================================ |
| 44 | 44 | |
| 45 | 45 | void osd_free_executable(void *ptr, size_t size) |
| r5932 | r5933 | |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | //============================================================ |
| 57 | // | |
| 57 | // osd_is_bad_read_ptr | |
| 58 | 58 | //============================================================ |
| 59 | 59 | |
| 60 | 60 | int osd_is_bad_read_ptr(const void *ptr, size_t size) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | tstutils.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Utility code for testing | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | testmess.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for testing MESS | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | core.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Automated testing for MAME/MESS | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 17 | 17 | |
| 18 | 18 | /*************************************************************************** |
| 19 | 19 | |
| 20 | ||
| 20 | Type definitions | |
| 21 | 21 | |
| 22 | 22 | ***************************************************************************/ |
| 23 | 23 | |
| r5932 | r5933 | |
| 55 | 55 | |
| 56 | 56 | /*************************************************************************** |
| 57 | 57 | |
| 58 | ||
| 58 | Prototypes | |
| 59 | 59 | |
| 60 | 60 | ***************************************************************************/ |
| 61 | 61 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | stream.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for implementing Imgtool streams | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | imgterrs.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Imgtool errors | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | library.c | |
| 4 | 4 | |
| 5 | Code relevant to the Imgtool library; analgous to the MESS/MAME driver | |
| 6 | list. | |
| 5 | Code relevant to the Imgtool library; analgous to the MESS/MAME driver | |
| 6 | list. | |
| 7 | 7 | |
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | iflopimg.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Bridge code for Imgtool into the standard floppy code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | /********************************************************************* |
| 42 | ||
| 42 | Imgtool ioprocs | |
| 43 | 43 | *********************************************************************/ |
| 44 | 44 | |
| 45 | 45 | static void imgtool_floppy_closeproc(void *file) |
| r5932 | r5933 | |
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | /********************************************************************* |
| 93 | ||
| 93 | Imgtool handlers | |
| 94 | 94 | *********************************************************************/ |
| 95 | 95 | |
| 96 | 96 | struct imgtool_floppy_image |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | imgtoolx.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Internal headers for Imgtool core | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | modules.c | |
| 4 | 4 | |
| 5 | ||
| 5 | List of Imgtool modules | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | // | |
| 3 | // wimgtool.c - Win32 Imgtool File Association Dialog | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | // | |
| 3 | // wimgtool.c - Win32 GUI Imgtool | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | // | |
| 3 | // secview.c - A Win32 sector editor dialog | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | // | |
| 3 | // wimgtool.h - Win32 GUI Imgtool | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | // | |
| 3 | // secview.h - A Win32 sector editor dialog | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | // | |
| 3 | // wmain.h - Win32 GUI Imgtool main code | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | // | |
| 3 | // hexview.c - A Win32 hex editor control | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | // | |
| 3 | // hexview.h - A Win32 hex editor control | |
| 4 | 4 | // |
| 5 | 5 | //============================================================ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | imgtool.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Core code for Imgtool | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 91 | 91 | |
| 92 | 92 | /*************************************************************************** |
| 93 | 93 | |
| 94 | ||
| 94 | Imgtool initialization and basics | |
| 95 | 95 | |
| 96 | 96 | ***************************************************************************/ |
| 97 | 97 | |
| r5932 | r5933 | |
| 127 | 127 | |
| 128 | 128 | /*------------------------------------------------- |
| 129 | 129 | internal_error - debug function for raising |
| 130 | ||
| 130 | internal errors | |
| 131 | 131 | -------------------------------------------------*/ |
| 132 | 132 | |
| 133 | 133 | static void internal_error(const imgtool_module *module, const char *message) |
| r5932 | r5933 | |
| 204 | 204 | |
| 205 | 205 | /*------------------------------------------------- |
| 206 | 206 | imgtool_get_module_features - retrieves a |
| 207 | structure identifying this module's features | |
| 208 | associated with an image | |
| 207 | structure identifying this module's features | |
| 208 | associated with an image | |
| 209 | 209 | -------------------------------------------------*/ |
| 210 | 210 | |
| 211 | 211 | imgtool_module_features imgtool_get_module_features(const imgtool_module *module) |
| r5932 | r5933 | |
| 248 | 248 | |
| 249 | 249 | /*------------------------------------------------- |
| 250 | 250 | evaluate_module - evaluates a single file to |
| 251 | ||
| 251 | determine what module can best handle a file | |
| 252 | 252 | -------------------------------------------------*/ |
| 253 | 253 | |
| 254 | 254 | static imgtoolerr_t evaluate_module(const char *fname, |
| r5932 | r5933 | |
| 312 | 312 | |
| 313 | 313 | /*------------------------------------------------- |
| 314 | 314 | imgtool_partition_image - retrieves the image |
| 315 | ||
| 315 | associated with this partition | |
| 316 | 316 | -------------------------------------------------*/ |
| 317 | 317 | |
| 318 | 318 | imgtool_image *imgtool_partition_image(imgtool_partition *partition) |
| r5932 | r5933 | |
| 324 | 324 | |
| 325 | 325 | /*------------------------------------------------- |
| 326 | 326 | imgtool_identify_file - attempts to determine the module |
| 327 | ||
| 327 | for any given image | |
| 328 | 328 | -------------------------------------------------*/ |
| 329 | 329 | |
| 330 | 330 | imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules, size_t count) |
| r5932 | r5933 | |
| 401 | 401 | |
| 402 | 402 | /*------------------------------------------------- |
| 403 | 403 | imgtool_image_get_sector_size - gets the size |
| 404 | ||
| 404 | of a particular sector on an image | |
| 405 | 405 | -------------------------------------------------*/ |
| 406 | 406 | |
| 407 | 407 | imgtoolerr_t imgtool_image_get_sector_size(imgtool_image *image, UINT32 track, UINT32 head, |
| r5932 | r5933 | |
| 418 | 418 | |
| 419 | 419 | /*------------------------------------------------- |
| 420 | 420 | imgtool_image_get_geometry - gets the geometry |
| 421 | of an image; note that this may disagree with | |
| 422 | particular sectors; this is a common copy | |
| 423 | protection scheme | |
| 421 | of an image; note that this may disagree with | |
| 422 | particular sectors; this is a common copy | |
| 423 | protection scheme | |
| 424 | 424 | -------------------------------------------------*/ |
| 425 | 425 | |
| 426 | 426 | imgtoolerr_t imgtool_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors) |
| r5932 | r5933 | |
| 481 | 481 | |
| 482 | 482 | /*------------------------------------------------- |
| 483 | 483 | imgtool_image_get_block_size - gets the size of |
| 484 | ||
| 484 | a standard block on an image | |
| 485 | 485 | -------------------------------------------------*/ |
| 486 | 486 | |
| 487 | 487 | imgtoolerr_t imgtool_image_get_block_size(imgtool_image *image, UINT32 *length) |
| r5932 | r5933 | |
| 498 | 498 | |
| 499 | 499 | /*------------------------------------------------- |
| 500 | 500 | imgtool_image_read_block - reads a standard |
| 501 | ||
| 501 | block on an image | |
| 502 | 502 | -------------------------------------------------*/ |
| 503 | 503 | |
| 504 | 504 | imgtoolerr_t imgtool_image_read_block(imgtool_image *image, UINT64 block, void *buffer) |
| r5932 | r5933 | |
| 514 | 514 | |
| 515 | 515 | /*------------------------------------------------- |
| 516 | 516 | imgtool_image_write_block - writes a standard |
| 517 | ||
| 517 | block on an image | |
| 518 | 518 | -------------------------------------------------*/ |
| 519 | 519 | |
| 520 | 520 | imgtoolerr_t imgtool_image_write_block(imgtool_image *image, UINT64 block, const void *buffer) |
| r5932 | r5933 | |
| 530 | 530 | |
| 531 | 531 | /*------------------------------------------------- |
| 532 | 532 | imgtool_image_clear_block - clears a standard |
| 533 | ||
| 533 | block on an image | |
| 534 | 534 | -------------------------------------------------*/ |
| 535 | 535 | |
| 536 | 536 | imgtoolerr_t imgtool_image_clear_block(imgtool_image *image, UINT64 block, UINT8 data) |
| r5932 | r5933 | |
| 565 | 565 | |
| 566 | 566 | /*------------------------------------------------- |
| 567 | 567 | imgtool_image_list_partitions - lists the |
| 568 | ||
| 568 | partitions on an image | |
| 569 | 569 | -------------------------------------------------*/ |
| 570 | 570 | |
| 571 | 571 | imgtoolerr_t imgtool_image_list_partitions(imgtool_image *image, imgtool_partition_info *partitions, size_t len) |
| r5932 | r5933 | |
| 582 | 582 | |
| 583 | 583 | /*------------------------------------------------- |
| 584 | 584 | imgtool_image_malloc - allocates memory associated with an |
| 585 | ||
| 585 | image | |
| 586 | 586 | -------------------------------------------------*/ |
| 587 | 587 | |
| 588 | 588 | void *imgtool_image_malloc(imgtool_image *image, size_t size) |
| r5932 | r5933 | |
| 594 | 594 | |
| 595 | 595 | /*------------------------------------------------- |
| 596 | 596 | imgtool_image_module - returns the module associated with |
| 597 | ||
| 597 | this image | |
| 598 | 598 | -------------------------------------------------*/ |
| 599 | 599 | |
| 600 | 600 | const imgtool_module *imgtool_image_module(imgtool_image *img) |
| r5932 | r5933 | |
| 637 | 637 | |
| 638 | 638 | /*************************************************************************** |
| 639 | 639 | |
| 640 | ||
| 640 | Imgtool partition management | |
| 641 | 641 | |
| 642 | 642 | ***************************************************************************/ |
| 643 | 643 | |
| r5932 | r5933 | |
| 784 | 784 | |
| 785 | 785 | /*************************************************************************** |
| 786 | 786 | |
| 787 | ||
| 787 | Imgtool partition operations | |
| 788 | 788 | |
| 789 | 789 | ***************************************************************************/ |
| 790 | 790 | |
| 791 | 791 | /*------------------------------------------------- |
| 792 | 792 | imgtool_partition_get_attribute_name - retrieves the human readable |
| 793 | ||
| 793 | name for an attribute | |
| 794 | 794 | -------------------------------------------------*/ |
| 795 | 795 | |
| 796 | 796 | void imgtool_partition_get_attribute_name(imgtool_partition *partition, UINT32 attribute, const imgtool_attribute *attr_value, |
| r5932 | r5933 | |
| 866 | 866 | |
| 867 | 867 | /*------------------------------------------------- |
| 868 | 868 | imgtool_validitychecks - checks the validity |
| 869 | ||
| 869 | of the imgtool modules | |
| 870 | 870 | -------------------------------------------------*/ |
| 871 | 871 | |
| 872 | 872 | int imgtool_validitychecks(void) |
| r5932 | r5933 | |
| 1013 | 1013 | |
| 1014 | 1014 | /*------------------------------------------------- |
| 1015 | 1015 | imgtool_temp_str - provides a temporary string |
| 1016 | ||
| 1016 | buffer used for string passing | |
| 1017 | 1017 | -------------------------------------------------*/ |
| 1018 | 1018 | |
| 1019 | 1019 | char *imgtool_temp_str(void) |
| r5932 | r5933 | |
| 1027 | 1027 | |
| 1028 | 1028 | /*************************************************************************** |
| 1029 | 1029 | |
| 1030 | ||
| 1030 | Image handling functions | |
| 1031 | 1031 | |
| 1032 | 1032 | ***************************************************************************/ |
| 1033 | 1033 | |
| r5932 | r5933 | |
| 1206 | 1206 | |
| 1207 | 1207 | /*------------------------------------------------- |
| 1208 | 1208 | imgtool_image_info - returns format specific information |
| 1209 | ||
| 1209 | about an image | |
| 1210 | 1210 | -------------------------------------------------*/ |
| 1211 | 1211 | |
| 1212 | 1212 | imgtoolerr_t imgtool_image_info(imgtool_image *image, char *string, size_t len) |
| r5932 | r5933 | |
| 1228 | 1228 | |
| 1229 | 1229 | /*------------------------------------------------- |
| 1230 | 1230 | cannonicalize_path - normalizes a path string |
| 1231 | ||
| 1231 | into a NUL delimited list | |
| 1232 | 1232 | -------------------------------------------------*/ |
| 1233 | 1233 | |
| 1234 | 1234 | static imgtoolerr_t cannonicalize_path(imgtool_partition *partition, UINT32 flags, |
| r5932 | r5933 | |
| 1333 | 1333 | |
| 1334 | 1334 | /*------------------------------------------------- |
| 1335 | 1335 | imgtool_partition_get_directory_entry - retrieves |
| 1336 | ||
| 1336 | the nth directory entry within a partition | |
| 1337 | 1337 | -------------------------------------------------*/ |
| 1338 | 1338 | |
| 1339 | 1339 | imgtoolerr_t imgtool_partition_get_directory_entry(imgtool_partition *partition, const char *path, int index, imgtool_dirent *ent) |
| r5932 | r5933 | |
| 1377 | 1377 | |
| 1378 | 1378 | /*------------------------------------------------- |
| 1379 | 1379 | imgtool_partition_get_file_size - returns free |
| 1380 | ||
| 1380 | space on a partition, in bytes | |
| 1381 | 1381 | -------------------------------------------------*/ |
| 1382 | 1382 | |
| 1383 | 1383 | imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const char *fname, UINT64 *filesize) |
| r5932 | r5933 | |
| 1422 | 1422 | |
| 1423 | 1423 | /*------------------------------------------------- |
| 1424 | 1424 | imgtool_partition_list_file_attributes - identifies |
| 1425 | ||
| 1425 | all attributes on a file | |
| 1426 | 1426 | -------------------------------------------------*/ |
| 1427 | 1427 | |
| 1428 | 1428 | imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len) |
| r5932 | r5933 | |
| 1469 | 1469 | |
| 1470 | 1470 | /*------------------------------------------------- |
| 1471 | 1471 | imgtool_partition_get_file_attributes - retrieves |
| 1472 | ||
| 1472 | attributes on a file | |
| 1473 | 1473 | -------------------------------------------------*/ |
| 1474 | 1474 | |
| 1475 | 1475 | imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values) |
| r5932 | r5933 | |
| 1514 | 1514 | |
| 1515 | 1515 | /*------------------------------------------------- |
| 1516 | 1516 | imgtool_partition_put_file_attributes - sets |
| 1517 | ||
| 1517 | attributes on a file | |
| 1518 | 1518 | -------------------------------------------------*/ |
| 1519 | 1519 | |
| 1520 | 1520 | imgtoolerr_t imgtool_partition_put_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values) |
| r5932 | r5933 | |
| 1547 | 1547 | |
| 1548 | 1548 | /*------------------------------------------------- |
| 1549 | 1549 | imgtool_partition_get_file_attributes - retrieves |
| 1550 | ||
| 1550 | an attribute on a single file | |
| 1551 | 1551 | -------------------------------------------------*/ |
| 1552 | 1552 | |
| 1553 | 1553 | imgtoolerr_t imgtool_partition_get_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute *value) |
| r5932 | r5933 | |
| 1562 | 1562 | |
| 1563 | 1563 | /*------------------------------------------------- |
| 1564 | 1564 | imgtool_partition_put_file_attribute - sets |
| 1565 | ||
| 1565 | attributes on a single file | |
| 1566 | 1566 | -------------------------------------------------*/ |
| 1567 | 1567 | |
| 1568 | 1568 | imgtoolerr_t imgtool_partition_put_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute value) |
| r5932 | r5933 | |
| 1577 | 1577 | |
| 1578 | 1578 | /*------------------------------------------------- |
| 1579 | 1579 | imgtool_partition_get_icon_info - retrieves the |
| 1580 | ||
| 1580 | icon for a file stored on a partition | |
| 1581 | 1581 | -------------------------------------------------*/ |
| 1582 | 1582 | |
| 1583 | 1583 | imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo) |
| r5932 | r5933 | |
| 1623 | 1623 | |
| 1624 | 1624 | /*------------------------------------------------- |
| 1625 | 1625 | imgtool_partition_suggest_file_filters - suggests |
| 1626 | a list of filters appropriate for a file on a | |
| 1627 | partition | |
| 1626 | a list of filters appropriate for a file on a | |
| 1627 | partition | |
| 1628 | 1628 | -------------------------------------------------*/ |
| 1629 | 1629 | |
| 1630 | 1630 | imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition, const char *path, |
| r5932 | r5933 | |
| 1656 | 1656 | goto done; |
| 1657 | 1657 | |
| 1658 | 1658 | /* Loop on resulting suggestions, and do the following: |
| 1659 | * 1. Call check_stream if present, and remove disqualified streams | |
| 1660 | * 2. Fill in missing descriptions | |
| 1661 | */ | |
| 1659 | * 1. Call check_stream if present, and remove disqualified streams | |
| 1660 | * 2. Fill in missing descriptions | |
| 1661 | */ | |
| 1662 | 1662 | i = j = 0; |
| 1663 | 1663 | while(suggestions[i].viability) |
| 1664 | 1664 | { |
| r5932 | r5933 | |
| 1707 | 1707 | |
| 1708 | 1708 | /*------------------------------------------------- |
| 1709 | 1709 | imgtool_partition_get_chain - retrieves the block |
| 1710 | ||
| 1710 | chain for a file or directory on a partition | |
| 1711 | 1711 | -------------------------------------------------*/ |
| 1712 | 1712 | |
| 1713 | 1713 | imgtoolerr_t imgtool_partition_get_chain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size) |
| r5932 | r5933 | |
| 1733 | 1733 | |
| 1734 | 1734 | /*------------------------------------------------- |
| 1735 | 1735 | imgtool_partition_get_chain_string - retrieves |
| 1736 | the block chain for a file or directory on a | |
| 1737 | partition | |
| 1736 | the block chain for a file or directory on a | |
| 1737 | partition | |
| 1738 | 1738 | -------------------------------------------------*/ |
| 1739 | 1739 | |
| 1740 | 1740 | imgtoolerr_t imgtool_partition_get_chain_string(imgtool_partition *partition, const char *path, char *buffer, size_t buffer_len) |
| r5932 | r5933 | |
| 1804 | 1804 | |
| 1805 | 1805 | /*------------------------------------------------- |
| 1806 | 1806 | imgtool_partition_get_free_space - returns the |
| 1807 | ||
| 1807 | amount of free space on a partition | |
| 1808 | 1808 | -------------------------------------------------*/ |
| 1809 | 1809 | |
| 1810 | 1810 | imgtoolerr_t imgtool_partition_get_free_space(imgtool_partition *partition, UINT64 *sz) |
| r5932 | r5933 | |
| 1828 | 1828 | |
| 1829 | 1829 | /*------------------------------------------------- |
| 1830 | 1830 | imgtool_partition_read_file - starts reading |
| 1831 | ||
| 1831 | from a file on a partition with a stream | |
| 1832 | 1832 | -------------------------------------------------*/ |
| 1833 | 1833 | |
| 1834 | 1834 | imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter) |
| r5932 | r5933 | |
| 1893 | 1893 | |
| 1894 | 1894 | /*------------------------------------------------- |
| 1895 | 1895 | imgtool_partition_write_file - starts writing |
| 1896 | ||
| 1896 | to a new file on an image with a stream | |
| 1897 | 1897 | -------------------------------------------------*/ |
| 1898 | 1898 | |
| 1899 | 1899 | imgtoolerr_t imgtool_partition_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts, filter_getinfoproc filter) |
| r5932 | r5933 | |
| 2015 | 2015 | |
| 2016 | 2016 | /*------------------------------------------------- |
| 2017 | 2017 | imgtool_partition_get_file - read a file from |
| 2018 | ||
| 2018 | an image, storing it into a native file | |
| 2019 | 2019 | -------------------------------------------------*/ |
| 2020 | 2020 | |
| 2021 | 2021 | imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char *filename, const char *fork, |
| r5932 | r5933 | |
| 2085 | 2085 | |
| 2086 | 2086 | /*------------------------------------------------- |
| 2087 | 2087 | imgtool_partition_put_file - read a native file |
| 2088 | ||
| 2088 | and store it on a partition | |
| 2089 | 2089 | -------------------------------------------------*/ |
| 2090 | 2090 | |
| 2091 | 2091 | imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char *newfname, const char *fork, |
| r5932 | r5933 | |
| 2132 | 2132 | |
| 2133 | 2133 | /*------------------------------------------------- |
| 2134 | 2134 | imgtool_partition_delete_file - delete a file |
| 2135 | ||
| 2135 | on a partition | |
| 2136 | 2136 | -------------------------------------------------*/ |
| 2137 | 2137 | |
| 2138 | 2138 | imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const char *fname) |
| r5932 | r5933 | |
| 2180 | 2180 | |
| 2181 | 2181 | /*------------------------------------------------- |
| 2182 | 2182 | imgtool_partition_list_file_forks - lists all |
| 2183 | ||
| 2183 | forks on an image | |
| 2184 | 2184 | -------------------------------------------------*/ |
| 2185 | 2185 | |
| 2186 | 2186 | imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len) |
| r5932 | r5933 | |
| 2225 | 2225 | |
| 2226 | 2226 | /*------------------------------------------------- |
| 2227 | 2227 | imgtool_partition_create_directory - creates a |
| 2228 | ||
| 2228 | directory on a partition | |
| 2229 | 2229 | -------------------------------------------------*/ |
| 2230 | 2230 | |
| 2231 | 2231 | imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, const char *path) |
| r5932 | r5933 | |
| 2271 | 2271 | |
| 2272 | 2272 | /*------------------------------------------------- |
| 2273 | 2273 | imgtool_partition_delete_directory - deletes a |
| 2274 | ||
| 2274 | directory on a partition | |
| 2275 | 2275 | -------------------------------------------------*/ |
| 2276 | 2276 | |
| 2277 | 2277 | imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, const char *path) |
| r5932 | r5933 | |
| 2317 | 2317 | |
| 2318 | 2318 | /*------------------------------------------------- |
| 2319 | 2319 | imgtool_partition_get_block_size - gets the |
| 2320 | ||
| 2320 | size of a standard block on a partition | |
| 2321 | 2321 | -------------------------------------------------*/ |
| 2322 | 2322 | |
| 2323 | 2323 | imgtoolerr_t imgtool_partition_get_block_size(imgtool_partition *partition, UINT32 *length) |
| r5932 | r5933 | |
| 2329 | 2329 | |
| 2330 | 2330 | /*------------------------------------------------- |
| 2331 | 2331 | imgtool_partition_read_block - reads a standard |
| 2332 | ||
| 2332 | block on a partition | |
| 2333 | 2333 | -------------------------------------------------*/ |
| 2334 | 2334 | |
| 2335 | 2335 | imgtoolerr_t imgtool_partition_read_block(imgtool_partition *partition, UINT64 block, void *buffer) |
| r5932 | r5933 | |
| 2343 | 2343 | |
| 2344 | 2344 | /*------------------------------------------------- |
| 2345 | 2345 | imgtool_partition_write_block - writes a |
| 2346 | ||
| 2346 | standard block on a partition | |
| 2347 | 2347 | -------------------------------------------------*/ |
| 2348 | 2348 | |
| 2349 | 2349 | imgtoolerr_t imgtool_partition_write_block(imgtool_partition *partition, UINT64 block, const void *buffer) |
| r5932 | r5933 | |
| 2357 | 2357 | |
| 2358 | 2358 | /*------------------------------------------------- |
| 2359 | 2359 | imgtool_partition_get_features - retrieves a |
| 2360 | structure identifying this partition's features | |
| 2361 | associated with an image | |
| 2360 | structure identifying this partition's features | |
| 2361 | associated with an image | |
| 2362 | 2362 | -------------------------------------------------*/ |
| 2363 | 2363 | |
| 2364 | 2364 | imgtool_partition_features imgtool_partition_get_features(imgtool_partition *partition) |
| r5932 | r5933 | |
| 2393 | 2393 | |
| 2394 | 2394 | /*------------------------------------------------- |
| 2395 | 2395 | imgtool_partition_get_info_ptr - retrieves a |
| 2396 | ||
| 2396 | pointer associated with a partition's format | |
| 2397 | 2397 | -------------------------------------------------*/ |
| 2398 | 2398 | |
| 2399 | 2399 | void *imgtool_partition_get_info_ptr(imgtool_partition *partition, UINT32 state) |
| r5932 | r5933 | |
| 2405 | 2405 | |
| 2406 | 2406 | /*------------------------------------------------- |
| 2407 | 2407 | imgtool_partition_get_info_string - retrieves a |
| 2408 | ||
| 2408 | string associated with a partition's format | |
| 2409 | 2409 | -------------------------------------------------*/ |
| 2410 | 2410 | |
| 2411 | 2411 | const char *imgtool_partition_get_info_string(imgtool_partition *partition, UINT32 state) |
| r5932 | r5933 | |
| 2417 | 2417 | |
| 2418 | 2418 | /*------------------------------------------------- |
| 2419 | 2419 | imgtool_partition_get_info_int - retrieves a |
| 2420 | ||
| 2420 | pointer associated with a partition's format | |
| 2421 | 2421 | -------------------------------------------------*/ |
| 2422 | 2422 | |
| 2423 | 2423 | UINT64 imgtool_partition_get_info_int(imgtool_partition *partition, UINT32 state) |
| r5932 | r5933 | |
| 2429 | 2429 | |
| 2430 | 2430 | /*------------------------------------------------- |
| 2431 | 2431 | imgtool_partition_extra_bytes - returns extra |
| 2432 | ||
| 2432 | bytes on a partition | |
| 2433 | 2433 | -------------------------------------------------*/ |
| 2434 | 2434 | |
| 2435 | 2435 | void *imgtool_partition_extra_bytes(imgtool_partition *partition) |
| r5932 | r5933 | |
| 2456 | 2456 | |
| 2457 | 2457 | /*************************************************************************** |
| 2458 | 2458 | |
| 2459 | ||
| 2459 | Path handling functions | |
| 2460 | 2460 | |
| 2461 | 2461 | ***************************************************************************/ |
| 2462 | 2462 | |
| 2463 | 2463 | /*------------------------------------------------- |
| 2464 | 2464 | imgtool_partition_get_root_path - retrieves |
| 2465 | ||
| 2465 | the path root of this partition | |
| 2466 | 2466 | -------------------------------------------------*/ |
| 2467 | 2467 | |
| 2468 | 2468 | const char *imgtool_partition_get_root_path(imgtool_partition *partition) |
| r5932 | r5933 | |
| 2486 | 2486 | |
| 2487 | 2487 | /*------------------------------------------------- |
| 2488 | 2488 | imgtool_partition_path_concatenate - retrieves |
| 2489 | ||
| 2489 | a pointer associated with a partition's format | |
| 2490 | 2490 | -------------------------------------------------*/ |
| 2491 | 2491 | |
| 2492 | 2492 | const char *imgtool_partition_path_concatenate(imgtool_partition *partition, const char *path1, const char *path2) |
| r5932 | r5933 | |
| 2535 | 2535 | |
| 2536 | 2536 | /*------------------------------------------------- |
| 2537 | 2537 | imgtool_partition_get_base_name - retrieves |
| 2538 | ||
| 2538 | a base name for a partition specific path | |
| 2539 | 2539 | -------------------------------------------------*/ |
| 2540 | 2540 | |
| 2541 | 2541 | const char *imgtool_partition_get_base_name(imgtool_partition *partition, const char *path) |
| r5932 | r5933 | |
| 2558 | 2558 | |
| 2559 | 2559 | /*************************************************************************** |
| 2560 | 2560 | |
| 2561 | ||
| 2561 | Directory handling functions | |
| 2562 | 2562 | |
| 2563 | 2563 | ***************************************************************************/ |
| 2564 | 2564 | |
| 2565 | 2565 | /*------------------------------------------------- |
| 2566 | 2566 | imgtool_directory_open - begins |
| 2567 | ||
| 2567 | enumerating files on a partition | |
| 2568 | 2568 | -------------------------------------------------*/ |
| 2569 | 2569 | |
| 2570 | 2570 | imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *path, imgtool_directory **outenum) |
| r5932 | r5933 | |
| 2647 | 2647 | |
| 2648 | 2648 | /*------------------------------------------------- |
| 2649 | 2649 | imgtool_directory_get_next - continues |
| 2650 | ||
| 2650 | enumerating files within a partition | |
| 2651 | 2651 | -------------------------------------------------*/ |
| 2652 | 2652 | |
| 2653 | 2653 | imgtoolerr_t imgtool_directory_get_next(imgtool_directory *directory, imgtool_dirent *ent) |
| r5932 | r5933 | |
| 2659 | 2659 | partition = imgtool_directory_partition(directory); |
| 2660 | 2660 | |
| 2661 | 2661 | /* This makes it so that drivers don't have to take care of clearing |
| 2662 | * the attributes if they don't apply | |
| 2663 | */ | |
| 2662 | * the attributes if they don't apply | |
| 2663 | */ | |
| 2664 | 2664 | memset(ent, 0, sizeof(*ent)); |
| 2665 | 2665 | |
| 2666 | 2666 | err = partition->next_enum(directory, ent); |
| r5932 | r5933 | |
| 2703 | 2703 | |
| 2704 | 2704 | /*------------------------------------------------- |
| 2705 | 2705 | imgtool_directory_module - returns the module associated |
| 2706 | ||
| 2706 | with this directory | |
| 2707 | 2707 | -------------------------------------------------*/ |
| 2708 | 2708 | |
| 2709 | 2709 | const imgtool_module *imgtool_directory_module(imgtool_directory *directory) |
| r5932 | r5933 | |
| 2715 | 2715 | |
| 2716 | 2716 | /*------------------------------------------------- |
| 2717 | 2717 | imgtool_directory_extrabytes - returns extra |
| 2718 | ||
| 2718 | bytes on a directory | |
| 2719 | 2719 | -------------------------------------------------*/ |
| 2720 | 2720 | |
| 2721 | 2721 | void *imgtool_directory_extrabytes(imgtool_directory *directory) |
| r5932 | r5933 | |
| 2728 | 2728 | |
| 2729 | 2729 | /*------------------------------------------------- |
| 2730 | 2730 | imgtool_directory_partition - returns the |
| 2731 | ||
| 2731 | partition associated with this directory | |
| 2732 | 2732 | -------------------------------------------------*/ |
| 2733 | 2733 | |
| 2734 | 2734 | imgtool_partition *imgtool_directory_partition(imgtool_directory *directory) |
| r5932 | r5933 | |
| 2740 | 2740 | |
| 2741 | 2741 | /*------------------------------------------------- |
| 2742 | 2742 | imgtool_directory_image - returns the image |
| 2743 | ||
| 2743 | associated with this directory | |
| 2744 | 2744 | -------------------------------------------------*/ |
| 2745 | 2745 | |
| 2746 | 2746 | imgtool_image *imgtool_directory_image(imgtool_directory *directory) |
| r5932 | r5933 | |
| 2752 | 2752 | |
| 2753 | 2753 | /*------------------------------------------------- |
| 2754 | 2754 | unknown_partition_get_info - represents an |
| 2755 | ||
| 2755 | unknown partition | |
| 2756 | 2756 | -------------------------------------------------*/ |
| 2757 | 2757 | |
| 2758 | 2758 | void unknown_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | iflopimg.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Bridge code for Imgtool into the standard floppy code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 15 | 15 | |
| 16 | 16 | /*************************************************************************** |
| 17 | 17 | |
| 18 | ||
| 18 | Prototypes | |
| 19 | 19 | |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | filteoln.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Native end-of-line filter | |
| 6 | 6 | |
| 7 | 7 | *****************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | modules.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Code that creates the "canonical" Imgtool library | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | imgtool.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Main headers for Imgtool core | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | filtbas.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Filter for Microsoft-style tokenized BASIC files | |
| 6 | 6 | |
| 7 | ||
| 7 | BASIC files typically follow the following format: | |
| 8 | 8 | |
| 9 | int8 $ff | |
| 10 | int16 <TOTAL LENGTH> | |
| 11 | ... | |
| 9 | int8 $ff | |
| 10 | int16 <TOTAL LENGTH> | |
| 11 | ... | |
| 12 | 12 | int16 <PTR_NEXT_LINE> |
| 13 | 13 | int16 <LINE_NUM> |
| 14 | 14 | int8[] <TOKENISED_DATA> |
| r5932 | r5933 | |
| 66 | 66 | |
| 67 | 67 | /*------------------------------------------------- |
| 68 | 68 | basic_readfile - reads a file and decodes |
| 69 | ||
| 69 | BASIC tokens into ASCII text | |
| 70 | 70 | -------------------------------------------------*/ |
| 71 | 71 | |
| 72 | 72 | static imgtoolerr_t basic_readfile(const basictokens *tokens, |
| r5932 | r5933 | |
| 169 | 169 | |
| 170 | 170 | /*------------------------------------------------- |
| 171 | 171 | basic_writefile - translates ASCII text to |
| 172 | ||
| 172 | BASIC tokens and writes it to a file | |
| 173 | 173 | -------------------------------------------------*/ |
| 174 | 174 | |
| 175 | 175 | static imgtoolerr_t basic_writefile(const basictokens *tokens, |
| r5932 | r5933 | |
| 234 | 234 | line_number *= 10; |
| 235 | 235 | line_number += (buf[pos++] - '0'); |
| 236 | 236 | } |
| 237 | ||
| 237 | ||
| 238 | 238 | /* determine address */ |
| 239 | 239 | if (tokens->baseaddress != 0) |
| 240 | 240 | { |
| r5932 | r5933 | |
| 257 | 257 | place_integer_be(line_header, 0, 2, address); |
| 258 | 258 | place_integer_be(line_header, 2, 2, line_number); |
| 259 | 259 | } |
| 260 | ||
| 260 | ||
| 261 | 261 | /* emit line header */ |
| 262 | 262 | stream_write(mem_stream, line_header, sizeof(line_header)); |
| 263 | 263 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | main.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Imgtool command line front end | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /* ugh I hate the way this function is set up, this is because the |
| 348 | * arguments depend on the partition; something that requires some | |
| 349 | * rudimentary parsing */ | |
| 348 | * arguments depend on the partition; something that requires some | |
| 349 | * rudimentary parsing */ | |
| 350 | 350 | if (argc >= 2) |
| 351 | 351 | { |
| 352 | 352 | /* open up the image */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | filter.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Imgtool filters | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Handlers for ti99 disk images | |
| 3 | 3 | |
| 4 | We support the following types of image: | |
| 5 | * floppy disks ("DSK format") in v9t9, pc99 and old mess image format | |
| 6 | * hard disks ("WIN format") in MAME harddisk format (256-byte sectors only, | |
| 7 | i.e. no SCSI) | |
| 8 | Files are extracted in TIFILES format. There is a compile-time option to | |
| 9 | extract text files in flat format instead, but I need to re-implement it | |
| 10 | properly (using filters comes to mind). | |
| 4 | We support the following types of image: | |
| 5 | * floppy disks ("DSK format") in v9t9, pc99 and old mess image format | |
| 6 | * hard disks ("WIN format") in MAME harddisk format (256-byte sectors only, | |
| 7 | i.e. no SCSI) | |
| 8 | Files are extracted in TIFILES format. There is a compile-time option to | |
| 9 | extract text files in flat format instead, but I need to re-implement it | |
| 10 | properly (using filters comes to mind). | |
| 11 | 11 | |
| 12 | ||
| 12 | Raphael Nabet, 2002-2004 | |
| 13 | 13 | |
| 14 | TODO: | |
| 15 | - finish and test hd support ***test sibling FDR support*** | |
| 16 | - check allocation bitmap against corruption when an image is opened | |
| 14 | TODO: | |
| 15 | - finish and test hd support ***test sibling FDR support*** | |
| 16 | - check allocation bitmap against corruption when an image is opened | |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | #include <limits.h> |
| r5932 | r5933 | |
| 28 | 28 | #include "imghd.h" |
| 29 | 29 | |
| 30 | 30 | /* |
| 31 | Concepts shared by both disk structures: | |
| 32 | ---------------------------------------- | |
| 31 | Concepts shared by both disk structures: | |
| 32 | ---------------------------------------- | |
| 33 | 33 | |
| 34 | In both formats, the entire disk surface is split into physical records, | |
| 35 | each 256-byte-long. For best efficiency, the sector size is usually 256 | |
| 36 | bytes so that one sector is equivalent to a physical record (this is true | |
| 37 | with floppies and HFDC hard disks). If the sector size is not 256 bytes | |
| 38 | (e.g. 512 bytes with SCSI hard disks, possibly 128 bytes on a TI-99 | |
| 39 | simulator running on TI-990), sectors are grouped or split to form 256-byte | |
| 40 | physical records. Physical records are numbered from 0, with the first | |
| 41 | starting on sector 0 track 0. To avoid confusion with physical records in | |
| 42 | files, such physical records will be called "absolute physical records", | |
| 43 | abbreviated as "absolute physrecs" or "aphysrecs". | |
| 34 | In both formats, the entire disk surface is split into physical records, | |
| 35 | each 256-byte-long. For best efficiency, the sector size is usually 256 | |
| 36 | bytes so that one sector is equivalent to a physical record (this is true | |
| 37 | with floppies and HFDC hard disks). If the sector size is not 256 bytes | |
| 38 | (e.g. 512 bytes with SCSI hard disks, possibly 128 bytes on a TI-99 | |
| 39 | simulator running on TI-990), sectors are grouped or split to form 256-byte | |
| 40 | physical records. Physical records are numbered from 0, with the first | |
| 41 | starting on sector 0 track 0. To avoid confusion with physical records in | |
| 42 | files, such physical records will be called "absolute physical records", | |
| 43 | abbreviated as "absolute physrecs" or "aphysrecs". | |
| 44 | 44 | |
| 45 | Disk space is allocated in units referred to as AUs. Each AU represents an | |
| 46 | integral number of 256-byte physical records. The number of physrecs per | |
| 47 | AU varies depending on the disk format and size. AUs are numbered from 0, | |
| 48 | with the first starting with absolute physrec 0. | |
| 45 | Disk space is allocated in units referred to as AUs. Each AU represents an | |
| 46 | integral number of 256-byte physical records. The number of physrecs per | |
| 47 | AU varies depending on the disk format and size. AUs are numbered from 0, | |
| 48 | with the first starting with absolute physrec 0. | |
| 49 | 49 | |
| 50 | Absolute physrec 0 contains a 256-byte record with volume information, | |
| 51 | which is called "Volume Information Block", abbreviated as "vib". | |
| 50 | Absolute physrec 0 contains a 256-byte record with volume information, | |
| 51 | which is called "Volume Information Block", abbreviated as "vib". | |
| 52 | 52 | |
| 53 | To keep track of which areas on the disk are allocated and which are free, | |
| 54 | disk managers maintain a bit map of allocated AUs (called "allocation | |
| 55 | bitmap", abbreviated as "abm"). Each bit in the allocation bitmap | |
| 56 | represents an AU: if a bit is 0, the AU is free; if a bit is 1, the AU is | |
| 57 | allocated (or possibly bad if the disk manager can track bad sectors). | |
| 58 | Where on the disk the abm is located depends on the disk structure (see | |
| 59 | structure-specific description for details). | |
| 53 | To keep track of which areas on the disk are allocated and which are free, | |
| 54 | disk managers maintain a bit map of allocated AUs (called "allocation | |
| 55 | bitmap", abbreviated as "abm"). Each bit in the allocation bitmap | |
| 56 | represents an AU: if a bit is 0, the AU is free; if a bit is 1, the AU is | |
| 57 | allocated (or possibly bad if the disk manager can track bad sectors). | |
| 58 | Where on the disk the abm is located depends on the disk structure (see | |
| 59 | structure-specific description for details). | |
| 60 | 60 | |
| 61 | Files are implemented as a succession of 256-byte physical records. To | |
| 62 | avoid confusion with absolute physical records, these physical records will | |
| 63 | be called "file physical records", abbreviated as "file physrecs" or | |
| 64 | "fphysrecs". | |
| 61 | Files are implemented as a succession of 256-byte physical records. To | |
| 62 | avoid confusion with absolute physical records, these physical records will | |
| 63 | be called "file physical records", abbreviated as "file physrecs" or | |
| 64 | "fphysrecs". | |
| 65 | 65 | |
| 66 | Programs do normally not access file physical records directly. They may | |
| 67 | call high-level file routines that enable to create either fixed-lenght | |
| 68 | logical records of any size from 1 through 255, or variable-lenght records | |
| 69 | of any size from 0 through 254: logical records are grouped by file | |
| 70 | managers into 256-byte physical records. Some disk managers (HFDC and | |
| 71 | SCSI) allow programs to create fixed-lenght records larger than 255 bytes, | |
| 72 | too, but few programs use this possibility. Additionally, program files | |
| 73 | can be created: program files do not implement any logical record, and can | |
| 74 | be seen as a flat byte stream, not unlike files under MSDOS, UNIX and the C | |
| 75 | standard library. (Unfortunately, the API for program files lacks | |
| 76 | flexibility, and most programs that need to process a flat byte stream | |
| 77 | will use fixed-size records of 128 bytes.) | |
| 66 | Programs do normally not access file physical records directly. They may | |
| 67 | call high-level file routines that enable to create either fixed-lenght | |
| 68 | logical records of any size from 1 through 255, or variable-lenght records | |
| 69 | of any size from 0 through 254: logical records are grouped by file | |
| 70 | managers into 256-byte physical records. Some disk managers (HFDC and | |
| 71 | SCSI) allow programs to create fixed-lenght records larger than 255 bytes, | |
| 72 | too, but few programs use this possibility. Additionally, program files | |
| 73 | can be created: program files do not implement any logical record, and can | |
| 74 | be seen as a flat byte stream, not unlike files under MSDOS, UNIX and the C | |
| 75 | standard library. (Unfortunately, the API for program files lacks | |
| 76 | flexibility, and most programs that need to process a flat byte stream | |
| 77 | will use fixed-size records of 128 bytes.) | |
| 78 | 78 | |
| 79 | Fixed-length records (reclen < 256) are grouped like this: | |
| 80 | fphysrec 0 fphysrec 1 | |
| 81 | _______________ _______________ | |
| 82 | |R0 |R1 |R2 |X| |R3 |R4 |R5 |X| | |
| 83 | --------------- --------------- | |
| 84 | \_/ \_/ | |
| 85 | unused unused | |
| 86 | (size < reclen) (size < reclen) | |
| 79 | Fixed-length records (reclen < 256) are grouped like this: | |
| 80 | fphysrec 0 fphysrec 1 | |
| 81 | _______________ _______________ | |
| 82 | |R0 |R1 |R2 |X| |R3 |R4 |R5 |X| | |
| 83 | --------------- --------------- | |
| 84 | \_/ \_/ | |
| 85 | unused unused | |
| 86 | (size < reclen) (size < reclen) | |
| 87 | 87 | |
| 88 | Fixed-length records (reclen > 256) are grouped like this: | |
| 89 | fphysrec 0 fphysrec 1 fphysrec 2 fphysrec 3 ... | |
| 90 | _________________ _________________ _________________ _________________ | |
| 91 | | R0 (#0-255) | | R0 (#256-511) | |R0 (#512-end)|X| | R1 (#0-255) | ... | |
| 92 | ----------------- ----------------- ----------------- ----------------- | |
| 93 | \_/ | |
| 94 | unused | |
| 88 | Fixed-length records (reclen > 256) are grouped like this: | |
| 89 | fphysrec 0 fphysrec 1 fphysrec 2 fphysrec 3 ... | |
| 90 | _________________ _________________ _________________ _________________ | |
| 91 | | R0 (#0-255) | | R0 (#256-511) | |R0 (#512-end)|X| | R1 (#0-255) | ... | |
| 92 | ----------------- ----------------- ----------------- ----------------- | |
| 93 | \_/ | |
| 94 | unused | |
| 95 | 95 | |
| 96 | Variable lenght records are grouped like this: | |
| 97 | fphysrec 0: | |
| 98 | byte: | |
| 99 | ------------------------------ | |
| 100 | 0 |l0 = lenght of record 0 data| | |
| 101 | |----------------------------| | |
| 102 | 1 | | | |
| 103 | | | | |
| 104 | : | record 0 data | | |
| 105 | | | | |
| 106 | l0 | | | |
| 107 | |----------------------------| | |
| 108 | l0+1 |l1 = lenght of record 1 data| | |
| 109 | |----------------------------| | |
| 110 | l0+2 | | | |
| 111 | | | | |
| 112 | : | record 1 data | | |
| 113 | | | | |
| 114 | l0+l1+1 | | | |
| 115 | |----------------------------| | |
| 116 | : : : | |
| 117 | : : : | |
| 118 | |----------------------------| | |
| 119 | n |lm = lenght of record m data| | |
| 120 | |----------------------------| | |
| 121 | n+1 | | | |
| 122 | | | | |
| 123 | : | record m data | | |
| 124 | | | | |
| 125 | n+lm | | | |
| 126 | |----------------------------| | |
| 127 | n+lm+1 |>ff: EOR mark | | |
| 128 | |----------------------------| | |
| 129 | n+lm+2 | | | |
| 130 | | | | |
| 131 | : | unused | | |
| 132 | : |(we should have size < lm+1)| | |
| 133 | | | | |
| 134 | 255 | | | |
| 135 | ------------------------------ | |
| 96 | Variable lenght records are grouped like this: | |
| 97 | fphysrec 0: | |
| 98 | byte: | |
| 99 | ------------------------------ | |
| 100 | 0 |l0 = lenght of record 0 data| | |
| 101 | |----------------------------| | |
| 102 | 1 | | | |
| 103 | | | | |
| 104 | : | record 0 data | | |
| 105 | | | | |
| 106 | l0 | | | |
| 107 | |----------------------------| | |
| 108 | l0+1 |l1 = lenght of record 1 data| | |
| 109 | |----------------------------| | |
| 110 | l0+2 | | | |
| 111 | | | | |
| 112 | : | record 1 data | | |
| 113 | | | | |
| 114 | l0+l1+1 | | | |
| 115 | |----------------------------| | |
| 116 | : : : | |
| 117 | : : : | |
| 118 | |----------------------------| | |
| 119 | n |lm = lenght of record m data| | |
| 120 | |----------------------------| | |
| 121 | n+1 | | | |
| 122 | | | | |
| 123 | : | record m data | | |
| 124 | | | | |
| 125 | n+lm | | | |
| 126 | |----------------------------| | |
| 127 | n+lm+1 |>ff: EOR mark | | |
| 128 | |----------------------------| | |
| 129 | n+lm+2 | | | |
| 130 | | | | |
| 131 | : | unused | | |
| 132 | : |(we should have size < lm+1)| | |
| 133 | | | | |
| 134 | 255 | | | |
| 135 | ------------------------------ | |
| 136 | 136 | |
| 137 | fphysrec 1: | |
| 138 | byte: | |
| 139 | ------------------------------ | |
| 140 | 0 |lm+1=lenght of record 0 data| | |
| 141 | |----------------------------| | |
| 142 | 1 | | | |
| 143 | | | | |
| 144 | : | record m+1 data | | |
| 145 | | | | |
| 146 | lm+1 | | | |
| 147 | |----------------------------| | |
| 148 | : : : | |
| 149 | : : : | |
| 137 | fphysrec 1: | |
| 138 | byte: | |
| 139 | ------------------------------ | |
| 140 | 0 |lm+1=lenght of record 0 data| | |
| 141 | |----------------------------| | |
| 142 | 1 | | | |
| 143 | | | | |
| 144 | : | record m+1 data | | |
| 145 | | | | |
| 146 | lm+1 | | | |
| 147 | |----------------------------| | |
| 148 | : : : | |
| 149 | : : : | |
| 150 | 150 | |
| 151 | I think the EOR mark is not required if all 256 bytes of a physical | |
| 152 | record are used by logical records. | |
| 151 | I think the EOR mark is not required if all 256 bytes of a physical | |
| 152 | record are used by logical records. | |
| 153 | 153 | |
| 154 | 154 | |
| 155 | All files are associated with a "file descriptor record" ("fdr") that holds | |
| 156 | file information (name, format, length) and points to the data AUs. The WIN | |
| 157 | disk structure also supports sibling FDRs, in case a file is so fragmented | |
| 158 | that all the data pointers cannot fit in one FDR; the DSK disk structure | |
| 159 | does not implement any such feature, and you may be unable to append data | |
| 160 | to an existing file if it is too fragmented, even though the disk is not | |
| 161 | full. | |
| 155 | All files are associated with a "file descriptor record" ("fdr") that holds | |
| 156 | file information (name, format, length) and points to the data AUs. The WIN | |
| 157 | disk structure also supports sibling FDRs, in case a file is so fragmented | |
| 158 | that all the data pointers cannot fit in one FDR; the DSK disk structure | |
| 159 | does not implement any such feature, and you may be unable to append data | |
| 160 | to an existing file if it is too fragmented, even though the disk is not | |
| 161 | full. | |
| 162 | 162 | |
| 163 | 163 | |
| 164 | DSK disk structure: | |
| 165 | ------------------- | |
| 164 | DSK disk structure: | |
| 165 | ------------------- | |
| 166 | 166 | |
| 167 | The DSK disk structure is used for floppy disks, and a few RAMDISKs as | |
| 168 | well. It supports 1600 AUs and 16 MBytes at most (the 16 MByte value is a | |
| 169 | theorical maximum, as I doubt anyone has ever created so big a DSK volume). | |
| 167 | The DSK disk structure is used for floppy disks, and a few RAMDISKs as | |
| 168 | well. It supports 1600 AUs and 16 MBytes at most (the 16 MByte value is a | |
| 169 | theorical maximum, as I doubt anyone has ever created so big a DSK volume). | |
| 170 | 170 | |
| 171 | The disk sector size is always 256 bytes (the only potential exceptions are | |
| 172 | the SCSI floppy disk units and the TI-99 simulator on TI-990, but I don't | |
| 173 | know anything about either). | |
| 171 | The disk sector size is always 256 bytes (the only potential exceptions are | |
| 172 | the SCSI floppy disk units and the TI-99 simulator on TI-990, but I don't | |
| 173 | know anything about either). | |
| 174 | 174 | |
| 175 | For some reason, the number of physrecs per AU is always a power of 2. | |
| 176 | Originally, AUs always were one physical record each. However, since the | |
| 177 | allocation bitmap cannot support more than 1600 AUs, disks larger than | |
| 178 | 400kbytes need to have several physical records per AU. Note that | |
| 179 | relatively few disk controllers implement AUs that span multiple physical | |
| 180 | records (IIRC, these are Myarc's HFDC, SCSI DSR with floppy disk interface, | |
| 181 | and some upgraded Myarc and Corcomp DD floppy controllers). | |
| 175 | For some reason, the number of physrecs per AU is always a power of 2. | |
| 176 | Originally, AUs always were one physical record each. However, since the | |
| 177 | allocation bitmap cannot support more than 1600 AUs, disks larger than | |
| 178 | 400kbytes need to have several physical records per AU. Note that | |
| 179 | relatively few disk controllers implement AUs that span multiple physical | |
| 180 | records (IIRC, these are Myarc's HFDC, SCSI DSR with floppy disk interface, | |
| 181 | and some upgraded Myarc and Corcomp DD floppy controllers). | |
| 182 | 182 | |
| 183 | The allocation bitmap is located in the VIB. It is 200 bytes long, and | |
| 184 | supports 1600 AUs at most. | |
| 183 | The allocation bitmap is located in the VIB. It is 200 bytes long, and | |
| 184 | supports 1600 AUs at most. | |
| 185 | 185 | |
| 186 | Directories are implemented with a "File Descriptor Index Record" (FDIR) | |
| 187 | for each directory. The FDIR is array of 0 through 128 words, containing | |
| 188 | the aphysrec address of each fdr in the directory, sorted by ascending file | |
| 189 | name, terminated with a 0. Note that, while we should be prepared to read | |
| 190 | images images with 128 entries, I think (not 100% sure) that we should | |
| 191 | write no more than 127 for compatibility with some existing disk managers. | |
| 186 | Directories are implemented with a "File Descriptor Index Record" (FDIR) | |
| 187 | for each directory. The FDIR is array of 0 through 128 words, containing | |
| 188 | the aphysrec address of each fdr in the directory, sorted by ascending file | |
| 189 | name, terminated with a 0. Note that, while we should be prepared to read | |
| 190 | images images with 128 entries, I think (not 100% sure) that we should | |
| 191 | write no more than 127 for compatibility with some existing disk managers. | |
| 192 | 192 | |
| 193 | Originally, the DSK structure only supported one directory level (i.e. the | |
| 194 | root directory level). The FDIR record for the root directory is always | |
| 195 | located in aphysrec 1. Moreover, Myarc extended the DSK structure to | |
| 196 | support up to 3 subdirectories in the root directory (note that there is no | |
| 197 | support for more subdirs, or for subdirs located in subdirs). To do so, | |
| 198 | they used an unused field of the VIB to hold the 10-char name of each | |
| 199 | directory and the aphysrec address of the associated FDIR record. | |
| 193 | Originally, the DSK structure only supported one directory level (i.e. the | |
| 194 | root directory level). The FDIR record for the root directory is always | |
| 195 | located in aphysrec 1. Moreover, Myarc extended the DSK structure to | |
| 196 | support up to 3 subdirectories in the root directory (note that there is no | |
| 197 | support for more subdirs, or for subdirs located in subdirs). To do so, | |
| 198 | they used an unused field of the VIB to hold the 10-char name of each | |
| 199 | directory and the aphysrec address of the associated FDIR record. | |
| 200 | 200 | |
| 201 | aphysrec 0: Volume Information Block (VIB): see below | |
| 202 | aphysrec 1: FDIR for root directory | |
| 203 | Remaining AUs are used for fdr and data (and subdirectory FDIR if | |
| 204 | applicable). There is one FDIR record per directory; the FDIR points to | |
| 205 | the FDR for each file in the directory. The FDR (File Descriptor Record) | |
| 206 | contains the file information (name, format, lenght, pointers to data | |
| 207 | physrecs/AUs, etc). | |
| 201 | aphysrec 0: Volume Information Block (VIB): see below | |
| 202 | aphysrec 1: FDIR for root directory | |
| 203 | Remaining AUs are used for fdr and data (and subdirectory FDIR if | |
| 204 | applicable). There is one FDIR record per directory; the FDIR points to | |
| 205 | the FDR for each file in the directory. The FDR (File Descriptor Record) | |
| 206 | contains the file information (name, format, lenght, pointers to data | |
| 207 | physrecs/AUs, etc). | |
| 208 | 208 | |
| 209 | 209 | |
| 210 | WIN disk structure: | |
| 211 | ------------------- | |
| 210 | WIN disk structure: | |
| 211 | ------------------- | |
| 212 | 212 | |
| 213 | The WIN disk structure is used for hard disks. It supports 65535 AUs and | |
| 214 | 256 MBytes at most. | |
| 213 | The WIN disk structure is used for hard disks. It supports 65535 AUs and | |
| 214 | 256 MBytes at most. | |
| 215 | 215 | |
| 216 | The disk sector size is 256 bytes on HFDC, 512 bytes on SCSI. 512-byte | |
| 217 | sectors are split into 256-byte physical records. | |
| 216 | The disk sector size is 256 bytes on HFDC, 512 bytes on SCSI. 512-byte | |
| 217 | sectors are split into 256-byte physical records. | |
| 218 | 218 | |
| 219 | We may have from 1 through 16 physrecs per AUs. Since we cannot have more | |
| 220 | than 65535 AUs, we need to have several physical records per AU in disks | |
| 221 | larger than 16 Mbytes. | |
| 219 | We may have from 1 through 16 physrecs per AUs. Since we cannot have more | |
| 220 | than 65535 AUs, we need to have several physical records per AU in disks | |
| 221 | larger than 16 Mbytes. | |
| 222 | 222 | |
| 223 | Contrary to the DSK disk structure, the WIN disk structure supports | |
| 224 | hierarchic subdirectories, with a limit of 114 subdirectories and 127 files | |
| 225 | per directory. Each directory is associated with both a "Directory | |
| 226 | Descriptor Record" (DDR) and a "File Descriptor Index Record" (FDIR). The | |
| 227 | only exception is the root directory, which uses the VIB instead of a DDR | |
| 228 | (the VIB includes all the important fields of the DDR). The DDR contains | |
| 229 | some directory info (name, number of files and subdirectories directly | |
| 230 | enclosed in the directory, AU address of the FDIR of the parent directory, | |
| 231 | etc), the AU address of the associated FDIR, and the AU address of the DDR | |
| 232 | of up to 114 subdirectories, sorted by ascending directory name. The WIN | |
| 233 | FDIR is similar to, yet different from, the DSK FDIR: it contains up to 127 | |
| 234 | (vs. 128) AU address (vs. aphysrec address) of each fdr in the directory, | |
| 235 | sorted by ascending file name. Additionally, it includes the AU address of | |
| 236 | the associated DDR. | |
| 223 | Contrary to the DSK disk structure, the WIN disk structure supports | |
| 224 | hierarchic subdirectories, with a limit of 114 subdirectories and 127 files | |
| 225 | per directory. Each directory is associated with both a "Directory | |
| 226 | Descriptor Record" (DDR) and a "File Descriptor Index Record" (FDIR). The | |
| 227 | only exception is the root directory, which uses the VIB instead of a DDR | |
| 228 | (the VIB includes all the important fields of the DDR). The DDR contains | |
| 229 | some directory info (name, number of files and subdirectories directly | |
| 230 | enclosed in the directory, AU address of the FDIR of the parent directory, | |
| 231 | etc), the AU address of the associated FDIR, and the AU address of the DDR | |
| 232 | of up to 114 subdirectories, sorted by ascending directory name. The WIN | |
| 233 | FDIR is similar to, yet different from, the DSK FDIR: it contains up to 127 | |
| 234 | (vs. 128) AU address (vs. aphysrec address) of each fdr in the directory, | |
| 235 | sorted by ascending file name. Additionally, it includes the AU address of | |
| 236 | the associated DDR. | |
| 237 | 237 | |
| 238 | When a file has more than 54 data fragments, the disk manager creates | |
| 239 | sibling FDRs that hold additional fragments. (Sibling FDRs are called | |
| 240 | offspring FDRs in most existing documentation, but I prefer "sibling FDRs" | |
| 241 | as "offspring FDRs" wrongly suggests a directory-like hierarchy. | |
| 242 | Incidentally, I cannot really figure out why they chose to duplicate the | |
| 243 | FDR rather than create a file extension record, but there must be a | |
| 244 | reason.) Note that sibling FDRs usually fill unused physrecs in the AU | |
| 245 | allocated for the eldest FDR, and a new AU is allocated for new sibling | |
| 246 | FDRs only when the first AU is full. | |
| 238 | When a file has more than 54 data fragments, the disk manager creates | |
| 239 | sibling FDRs that hold additional fragments. (Sibling FDRs are called | |
| 240 | offspring FDRs in most existing documentation, but I prefer "sibling FDRs" | |
| 241 | as "offspring FDRs" wrongly suggests a directory-like hierarchy. | |
| 242 | Incidentally, I cannot really figure out why they chose to duplicate the | |
| 243 | FDR rather than create a file extension record, but there must be a | |
| 244 | reason.) Note that sibling FDRs usually fill unused physrecs in the AU | |
| 245 | allocated for the eldest FDR, and a new AU is allocated for new sibling | |
| 246 | FDRs only when the first AU is full. | |
| 247 | 247 | |
| 248 | aphysrec 0: Volume Information Block (VIB): see below | |
| 249 | aphysrec 1-n (where n = 1+SUP(number_of_AUs/2048)): Volume bitmap | |
| 250 | Remaining AUs are used for ddr, fdir, fdr and data. | |
| 248 | aphysrec 0: Volume Information Block (VIB): see below | |
| 249 | aphysrec 1-n (where n = 1+SUP(number_of_AUs/2048)): Volume bitmap | |
| 250 | Remaining AUs are used for ddr, fdir, fdr and data. | |
| 251 | 251 | */ |
| 252 | 252 | |
| 253 | 253 | /* Since string length is encoded with a byte, the maximum length of a string |
| r5932 | r5933 | |
| 265 | 265 | #endif |
| 266 | 266 | |
| 267 | 267 | /* |
| 268 | ||
| 268 | Miscellaneous utilities that are used to handle TI data types | |
| 269 | 269 | */ |
| 270 | 270 | |
| 271 | 271 | typedef struct UINT16BE |
| r5932 | r5933 | |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /* |
| 304 | ||
| 304 | Convert a C string to a 10-character file name (padded with spaces if necessary) | |
| 305 | 305 | |
| 306 | dst (O): destination 10-character array | |
| 307 | src (I): source C string | |
| 306 | dst (O): destination 10-character array | |
| 307 | src (I): source C string | |
| 308 | 308 | */ |
| 309 | 309 | static void str_to_fname(char dst[10], const char *src) |
| 310 | 310 | { |
| r5932 | r5933 | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /* |
| 333 | ||
| 333 | Convert a 10-character file name to a C string (removing trailing spaces if necessary) | |
| 334 | 334 | |
| 335 | dst (O): destination C string | |
| 336 | src (I): source 10-character array | |
| 337 | n (I): lenght of dst buffer (string may be truncated if less than 11) | |
| 335 | dst (O): destination C string | |
| 336 | src (I): source 10-character array | |
| 337 | n (I): lenght of dst buffer (string may be truncated if less than 11) | |
| 338 | 338 | */ |
| 339 | 339 | static void fname_to_str(char *dst, const char src[10], int n) |
| 340 | 340 | { |
| r5932 | r5933 | |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /* |
| 366 | ||
| 366 | Check a 10-character file name. | |
| 367 | 367 | |
| 368 | ||
| 368 | filename (I): 10-character array with file name | |
| 369 | 369 | |
| 370 | ||
| 370 | Return non-zero if the file name is invalid. | |
| 371 | 371 | */ |
| 372 | 372 | static int check_fname(const char filename[10]) |
| 373 | 373 | { |
| r5932 | r5933 | |
| 387 | 387 | return 1; |
| 388 | 388 | case ' ': |
| 389 | 389 | /* illegal in a file name, but file names shorter than 10 |
| 390 | ||
| 390 | characters are padded with spaces */ | |
| 391 | 391 | space_found_flag = TRUE; |
| 392 | 392 | break; |
| 393 | 393 | default: |
| 394 | 394 | /* all other characters are legal (though non-ASCII characters, |
| 395 | control characters and even lower-case characters are not | |
| 396 | recommended) */ | |
| 395 | control characters and even lower-case characters are not | |
| 396 | recommended) */ | |
| 397 | 397 | if (space_found_flag) |
| 398 | 398 | return 1; |
| 399 | 399 | break; |
| r5932 | r5933 | |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /* |
| 407 | ||
| 407 | Check a file path. | |
| 408 | 408 | |
| 409 | ||
| 409 | fpath (I): C string with file path | |
| 410 | 410 | |
| 411 | ||
| 411 | Return non-zero if the file path is invalid. | |
| 412 | 412 | */ |
| 413 | 413 | static int check_fpath(const char *fpath) |
| 414 | 414 | { |
| r5932 | r5933 | |
| 417 | 417 | |
| 418 | 418 | |
| 419 | 419 | /* first check that the path is not too long and that there is no space |
| 420 | ||
| 420 | character */ | |
| 421 | 421 | if ((strlen(fpath) > MAX_PATH_LEN) || strchr(fpath, ' ')) |
| 422 | 422 | return 1; |
| 423 | 423 | |
| r5932 | r5933 | |
| 448 | 448 | #endif |
| 449 | 449 | |
| 450 | 450 | /* |
| 451 | Level 1 deals with accessing the disk hardware (in our case, the raw disk | |
| 452 | image). | |
| 451 | Level 1 deals with accessing the disk hardware (in our case, the raw disk | |
| 452 | image). | |
| 453 | 453 | |
| 454 | Higher level routines will only know the disk as a succession of | |
| 455 | 256-byte-long physical records addressed by a linear address. | |
| 454 | Higher level routines will only know the disk as a succession of | |
| 455 | 256-byte-long physical records addressed by a linear address. | |
| 456 | 456 | */ |
| 457 | 457 | |
| 458 | 458 | /* |
| 459 | ||
| 459 | Disk geometry | |
| 460 | 460 | */ |
| 461 | 461 | typedef struct ti99_geometry |
| 462 | 462 | { |
| r5932 | r5933 | |
| 466 | 466 | } ti99_geometry; |
| 467 | 467 | |
| 468 | 468 | /* |
| 469 | ||
| 469 | Physical sector address | |
| 470 | 470 | */ |
| 471 | 471 | typedef struct ti99_sector_address |
| 472 | 472 | { |
| r5932 | r5933 | |
| 476 | 476 | } ti99_sector_address; |
| 477 | 477 | |
| 478 | 478 | /* |
| 479 | ||
| 479 | Time stamp (used in fdr, and WIN VIB/DDR) | |
| 480 | 480 | */ |
| 481 | 481 | typedef struct ti99_date_time |
| 482 | 482 | { |
| r5932 | r5933 | |
| 485 | 485 | } ti99_date_time; |
| 486 | 486 | |
| 487 | 487 | /* |
| 488 | ||
| 488 | Subdirectory descriptor (HFDC only) | |
| 489 | 489 | |
| 490 | ||
| 490 | The HFDC supports up to 3 subdirectories. | |
| 491 | 491 | */ |
| 492 | 492 | typedef struct dsk_subdir |
| 493 | 493 | { |
| r5932 | r5933 | |
| 496 | 496 | } dsk_subdir; |
| 497 | 497 | |
| 498 | 498 | /* |
| 499 | ||
| 499 | DSK VIB record | |
| 500 | 500 | |
| 501 | Most fields in this record are only revelant to level 2 routines, but level | |
| 502 | 1 routines need the disk geometry information extracted from the VIB. | |
| 501 | Most fields in this record are only revelant to level 2 routines, but level | |
| 502 | 1 routines need the disk geometry information extracted from the VIB. | |
| 503 | 503 | */ |
| 504 | 504 | typedef struct dsk_vib |
| 505 | 505 | { |
| r5932 | r5933 | |
| 540 | 540 | } ti99_img_format; |
| 541 | 541 | |
| 542 | 542 | /* |
| 543 | ||
| 543 | level-1 disk image descriptor | |
| 544 | 544 | */ |
| 545 | 545 | typedef struct ti99_lvl1_imgref |
| 546 | 546 | { |
| r5932 | r5933 | |
| 553 | 553 | } ti99_lvl1_imgref; |
| 554 | 554 | |
| 555 | 555 | /* |
| 556 | ||
| 556 | calculate CRC for data address marks or sector data | |
| 557 | 557 | |
| 558 | crc (I/O): current CRC value to be updated (initialize to 0xffff before | |
| 559 | calling this function for the first time) | |
| 560 | value: new byte of data to update the CRC with | |
| 558 | crc (I/O): current CRC value to be updated (initialize to 0xffff before | |
| 559 | calling this function for the first time) | |
| 560 | value: new byte of data to update the CRC with | |
| 561 | 561 | */ |
| 562 | 562 | static void calc_crc(UINT16 *crc, UINT8 value) |
| 563 | 563 | { |
| r5932 | r5933 | |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /* |
| 585 | ||
| 585 | Parse a PC99 disk image | |
| 586 | 586 | |
| 587 | file_handle (I/O): imgtool file handle | |
| 588 | fm_format (I): if true, the image is in FM format, otherwise it is in MFM | |
| 589 | format | |
| 590 | pass (I): 0 for first pass, 1 for second pass | |
| 591 | vib (O): buffer where the vib should be stored (first pass) | |
| 592 | geometry (O): disk image geometry (second pass) | |
| 593 | data_offset_array (O): array of data offset to generate (second pass) | |
| 594 | out_track_len (O): track lenght is returned there | |
| 587 | file_handle (I/O): imgtool file handle | |
| 588 | fm_format (I): if true, the image is in FM format, otherwise it is in MFM | |
| 589 | format | |
| 590 | pass (I): 0 for first pass, 1 for second pass | |
| 591 | vib (O): buffer where the vib should be stored (first pass) | |
| 592 | geometry (O): disk image geometry (second pass) | |
| 593 | data_offset_array (O): array of data offset to generate (second pass) | |
| 594 | out_track_len (O): track lenght is returned there | |
| 595 | 595 | |
| 596 | ||
| 596 | Return imgtool error code | |
| 597 | 597 | */ |
| 598 | 598 | #define MAX_TRACK_LEN 6872 |
| 599 | 599 | #define DATA_OFFSET_NONE 0xffffffff |
| r5932 | r5933 | |
| 763 | 763 | |
| 764 | 764 | /* CRC seems to be completely hosed */ |
| 765 | 765 | /*if (crc) |
| 766 | ||
| 766 | printf("aargh!");*/ | |
| 767 | 767 | if ((seclen != 256) || (crc1 != 0xf7) || (crc2 != 0xf7) |
| 768 | 768 | || (cylinder != expected_cylinder) || (head != expected_head) |
| 769 | 769 | || ((pass == 1) && ((cylinder >= geometry->cylinders) |
| r5932 | r5933 | |
| 861 | 861 | |
| 862 | 862 | /* CRC seems to be completely hosed */ |
| 863 | 863 | /*if (crc) |
| 864 | ||
| 864 | printf("aargh!");*/ | |
| 865 | 865 | if ((crc1 != 0xf7) || (crc2 != 0xf7)) |
| 866 | 866 | continue; |
| 867 | 867 | |
| r5932 | r5933 | |
| 912 | 912 | |
| 913 | 913 | |
| 914 | 914 | /* |
| 915 | Read the volume information block (aphysrec 0) assuming no geometry | |
| 916 | information. (Called when an image is opened to figure out the | |
| 917 | geometry information.) | |
| 915 | Read the volume information block (aphysrec 0) assuming no geometry | |
| 916 | information. (Called when an image is opened to figure out the | |
| 917 | geometry information.) | |
| 918 | 918 | |
| 919 | file_handle (I/O): imgtool file handle | |
| 920 | img_format (I): image format (MESS, V9T9 or PC99) | |
| 921 | dest (O): pointer to 256-byte destination buffer | |
| 919 | file_handle (I/O): imgtool file handle | |
| 920 | img_format (I): image format (MESS, V9T9 or PC99) | |
| 921 | dest (O): pointer to 256-byte destination buffer | |
| 922 | 922 | |
| 923 | ||
| 923 | Return imgtool error code | |
| 924 | 924 | */ |
| 925 | 925 | static int read_image_vib_no_geometry(imgtool_stream *file_handle, ti99_img_format img_format, dsk_vib *dest) |
| 926 | 926 | { |
| r5932 | r5933 | |
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | /* |
| 956 | ||
| 956 | Open a disk image at level 1 | |
| 957 | 957 | |
| 958 | file_handle (I/O): imgtool file handle | |
| 959 | img_format (I): image format (MESS, V9T9, PC99, or MAME harddisk) | |
| 960 | l1_img (O): level-1 image handle | |
| 961 | vib (O): buffer where the vib should be stored (floppy images only) | |
| 958 | file_handle (I/O): imgtool file handle | |
| 959 | img_format (I): image format (MESS, V9T9, PC99, or MAME harddisk) | |
| 960 | l1_img (O): level-1 image handle | |
| 961 | vib (O): buffer where the vib should be stored (floppy images only) | |
| 962 | 962 | |
| 963 | ||
| 963 | Return imgtool error code | |
| 964 | 964 | */ |
| 965 | 965 | static imgtoolerr_t open_image_lvl1(imgtool_stream *file_handle, ti99_img_format img_format, ti99_lvl1_imgref *l1_img, dsk_vib *vib) |
| 966 | 966 | { |
| r5932 | r5933 | |
| 992 | 992 | |
| 993 | 993 | /* read vib */ |
| 994 | 994 | /*reply = read_absolute_physrec(l1_img, 0, vib); |
| 995 | if (reply) | |
| 996 | return reply;*/ | |
| 995 | if (reply) | |
| 996 | return reply;*/ | |
| 997 | 997 | } |
| 998 | 998 | else |
| 999 | 999 | { |
| r5932 | r5933 | |
| 1008 | 1008 | l1_img->geometry.secspertrack = vib->secspertrack; |
| 1009 | 1009 | if (l1_img->geometry.secspertrack == 0) |
| 1010 | 1010 | /* Some images might be like this, because the original SSSD TI |
| 1011 | ||
| 1011 | controller always assumes 9. */ | |
| 1012 | 1012 | l1_img->geometry.secspertrack = 9; |
| 1013 | 1013 | l1_img->geometry.cylinders = vib->cylinders; |
| 1014 | 1014 | if (l1_img->geometry.cylinders == 0) |
| 1015 | 1015 | /* Some images are like this, because the original SSSD TI |
| 1016 | ||
| 1016 | controller always assumes 40. */ | |
| 1017 | 1017 | l1_img->geometry.cylinders = 40; |
| 1018 | 1018 | l1_img->geometry.heads = vib->heads; |
| 1019 | 1019 | if (l1_img->geometry.heads == 0) |
| 1020 | 1020 | /* Some images are like this, because the original SSSD TI |
| 1021 | ||
| 1021 | controller always assumes that tracks beyond 40 are on side 2. */ | |
| 1022 | 1022 | l1_img->geometry.heads = totphysrecs / (l1_img->geometry.secspertrack * l1_img->geometry.cylinders); |
| 1023 | 1023 | |
| 1024 | 1024 | /* check information */ |
| r5932 | r5933 | |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | /* |
| 1050 | ||
| 1050 | Close a disk image at level 1 | |
| 1051 | 1051 | |
| 1052 | ||
| 1052 | l1_img (I/O): level-1 image handle | |
| 1053 | 1053 | |
| 1054 | ||
| 1054 | Return imgtool error code | |
| 1055 | 1055 | */ |
| 1056 | 1056 | static void close_image_lvl1(ti99_lvl1_imgref *l1_img) |
| 1057 | 1057 | { |
| r5932 | r5933 | |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | /* |
| 1070 | Convert physical sector address to offset in disk image (old MESS and V9T9 | |
| 1071 | formats only) | |
| 1070 | Convert physical sector address to offset in disk image (old MESS and V9T9 | |
| 1071 | formats only) | |
| 1072 | 1072 | |
| 1073 | l1_img (I/O): level-1 image handle | |
| 1074 | address (I): physical sector address | |
| 1073 | l1_img (I/O): level-1 image handle | |
| 1074 | address (I): physical sector address | |
| 1075 | 1075 | |
| 1076 | ||
| 1076 | Return offset in image | |
| 1077 | 1077 | */ |
| 1078 | 1078 | INLINE int sector_address_to_image_offset(const ti99_lvl1_imgref *l1_img, const ti99_sector_address *address) |
| 1079 | 1079 | { |
| r5932 | r5933 | |
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | /* |
| 1111 | ||
| 1111 | Read one 256-byte sector from a disk image | |
| 1112 | 1112 | |
| 1113 | l1_img (I/O): level-1 image handle | |
| 1114 | address (I): physical sector address | |
| 1115 | dest (O): pointer to 256-byte destination buffer | |
| 1113 | l1_img (I/O): level-1 image handle | |
| 1114 | address (I): physical sector address | |
| 1115 | dest (O): pointer to 256-byte destination buffer | |
| 1116 | 1116 | |
| 1117 | ||
| 1117 | Return non-zero on error | |
| 1118 | 1118 | */ |
| 1119 | 1119 | static int read_sector(ti99_lvl1_imgref *l1_img, const ti99_sector_address *address, void *dest) |
| 1120 | 1120 | { |
| r5932 | r5933 | |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | /* |
| 1191 | ||
| 1191 | Write one 256-byte sector to a disk image | |
| 1192 | 1192 | |
| 1193 | l1_img (I/O): level-1 image handle | |
| 1194 | address (I): physical sector address | |
| 1195 | src (I): pointer to 256-byte source buffer | |
| 1193 | l1_img (I/O): level-1 image handle | |
| 1194 | address (I): physical sector address | |
| 1195 | src (I): pointer to 256-byte source buffer | |
| 1196 | 1196 | |
| 1197 | ||
| 1197 | Return non-zero on error | |
| 1198 | 1198 | */ |
| 1199 | 1199 | static int write_sector(ti99_lvl1_imgref *l1_img, const ti99_sector_address *address, const void *src) |
| 1200 | 1200 | { |
| r5932 | r5933 | |
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | /* |
| 1271 | ||
| 1271 | Convert physical record address to sector address (DSK format) | |
| 1272 | 1272 | |
| 1273 | aphysrec (I): absolute physrec address | |
| 1274 | geometry (I): disk image geometry | |
| 1275 | address (O): physical sector address | |
| 1273 | aphysrec (I): absolute physrec address | |
| 1274 | geometry (I): disk image geometry | |
| 1275 | address (O): physical sector address | |
| 1276 | 1276 | */ |
| 1277 | 1277 | static void dsk_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address) |
| 1278 | 1278 | { |
| r5932 | r5933 | |
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | /* |
| 1289 | ||
| 1289 | Convert physical record address to sector address (WIN format for HFDC) | |
| 1290 | 1290 | |
| 1291 | ||
| 1291 | Note that physical address translation makes sense for HFDC, but not SCSI. | |
| 1292 | 1292 | |
| 1293 | aphysrec (I): absolute physrec address | |
| 1294 | geometry (I): disk image geometry | |
| 1295 | address (O): physical sector address | |
| 1293 | aphysrec (I): absolute physrec address | |
| 1294 | geometry (I): disk image geometry | |
| 1295 | address (O): physical sector address | |
| 1296 | 1296 | */ |
| 1297 | 1297 | /*static void win_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address) |
| 1298 | 1298 | { |
| 1299 | address.sector = aphysrec % l1_img->geometry.secspertrack; | |
| 1300 | aphysrec /= l1_img->geometry.secspertrack; | |
| 1301 | address.side = aphysrec % l1_img->geometry.heads; | |
| 1302 | address.cylinder = aphysrec / l1_img->geometry.heads; | |
| 1299 | address.sector = aphysrec % l1_img->geometry.secspertrack; | |
| 1300 | aphysrec /= l1_img->geometry.secspertrack; | |
| 1301 | address.side = aphysrec % l1_img->geometry.heads; | |
| 1302 | address.cylinder = aphysrec / l1_img->geometry.heads; | |
| 1303 | 1303 | }*/ |
| 1304 | 1304 | |
| 1305 | 1305 | /* |
| 1306 | ||
| 1306 | Read one 256-byte physical record from a disk image | |
| 1307 | 1307 | |
| 1308 | l1_img (I/O): level-1 image handle | |
| 1309 | aphysrec (I): absolute physrec address | |
| 1310 | dest (O): pointer to 256-byte destination buffer | |
| 1308 | l1_img (I/O): level-1 image handle | |
| 1309 | aphysrec (I): absolute physrec address | |
| 1310 | dest (O): pointer to 256-byte destination buffer | |
| 1311 | 1311 | |
| 1312 | ||
| 1312 | Return non-zero on error | |
| 1313 | 1313 | */ |
| 1314 | 1314 | static int read_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, void *dest) |
| 1315 | 1315 | { |
| r5932 | r5933 | |
| 1320 | 1320 | { |
| 1321 | 1321 | /*win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); |
| 1322 | 1322 | |
| 1323 | ||
| 1323 | return read_sector(l1_img, & address, dest);*/ | |
| 1324 | 1324 | |
| 1325 | 1325 | return imghd_read(&l1_img->harddisk_handle, aphysrec, dest) != IMGTOOLERR_SUCCESS; |
| 1326 | 1326 | } |
| r5932 | r5933 | |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | /* |
| 1336 | ||
| 1336 | Write one 256-byte physical record to a disk image | |
| 1337 | 1337 | |
| 1338 | l1_img (I/O): level-1 image handle | |
| 1339 | aphysrec (I): absolute physrec address | |
| 1340 | src (I): pointer to 256-byte source buffer | |
| 1338 | l1_img (I/O): level-1 image handle | |
| 1339 | aphysrec (I): absolute physrec address | |
| 1340 | src (I): pointer to 256-byte source buffer | |
| 1341 | 1341 | |
| 1342 | ||
| 1342 | Return non-zero on error | |
| 1343 | 1343 | */ |
| 1344 | 1344 | static int write_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, const void *src) |
| 1345 | 1345 | { |
| r5932 | r5933 | |
| 1350 | 1350 | { |
| 1351 | 1351 | /*win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address); |
| 1352 | 1352 | |
| 1353 | ||
| 1353 | return write_sector(l1_img, & address, dest);*/ | |
| 1354 | 1354 | |
| 1355 | 1355 | return imghd_write(&l1_img->harddisk_handle, aphysrec, src) != IMGTOOLERR_SUCCESS; |
| 1356 | 1356 | } |
| r5932 | r5933 | |
| 1368 | 1368 | #endif |
| 1369 | 1369 | |
| 1370 | 1370 | /* |
| 1371 | ||
| 1371 | Level 2 implements files as a succession of 256-byte-long physical records. | |
| 1372 | 1372 | |
| 1373 | ||
| 1373 | Level 2 implements allocation bitmap (and AU), disk catalog, etc. | |
| 1374 | 1374 | */ |
| 1375 | 1375 | |
| 1376 | 1376 | /* |
| 1377 | ||
| 1377 | WIN VIB/DDR record | |
| 1378 | 1378 | */ |
| 1379 | 1379 | typedef struct win_vib_ddr |
| 1380 | 1380 | { |
| r5932 | r5933 | |
| 1432 | 1432 | } win_vib_ddr; |
| 1433 | 1433 | |
| 1434 | 1434 | /* |
| 1435 | ||
| 1435 | AU format | |
| 1436 | 1436 | */ |
| 1437 | 1437 | typedef struct ti99_AUformat |
| 1438 | 1438 | { |
| r5932 | r5933 | |
| 1441 | 1441 | } ti99_AUformat; |
| 1442 | 1442 | |
| 1443 | 1443 | /* |
| 1444 | DSK directory reference: 0 for root, 1 for 1st subdir, 2 for 2nd subdir, 3 | |
| 1445 | for 3rd subdir | |
| 1444 | DSK directory reference: 0 for root, 1 for 1st subdir, 2 for 2nd subdir, 3 | |
| 1445 | for 3rd subdir | |
| 1446 | 1446 | */ |
| 1447 | 1447 | /*typedef int dir_ref;*/ |
| 1448 | 1448 | |
| 1449 | 1449 | /* |
| 1450 | ||
| 1450 | catalog entry (used for in-memory catalog) | |
| 1451 | 1451 | */ |
| 1452 | 1452 | typedef struct dir_entry |
| 1453 | 1453 | { |
| r5932 | r5933 | |
| 1472 | 1472 | } ti99_catalog; |
| 1473 | 1473 | |
| 1474 | 1474 | /* |
| 1475 | ||
| 1475 | level-2 disk image descriptor | |
| 1476 | 1476 | */ |
| 1477 | 1477 | typedef struct ti99_lvl2_imgref_dsk |
| 1478 | 1478 | { |
| 1479 | 1479 | UINT16 totphysrecs; /* total number of aphysrecs (extracted from vib record in aphysrec 0) */ |
| 1480 | 1480 | ti99_catalog catalogs[4]; /* catalog of root directory and up to 3 subdirectories */ |
| 1481 | 1481 | UINT16 fdir_aphysrec[4]; /* fdir aphysrec address for root directory |
| 1482 | ||
| 1482 | and up to 3 subdirectories */ | |
| 1483 | 1483 | } ti99_lvl2_imgref_dsk; |
| 1484 | 1484 | |
| 1485 | 1485 | typedef struct ti99_lvl2_imgref_win |
| r5932 | r5933 | |
| 1496 | 1496 | ti99_lvl1_imgref l1_img;/* image format, imgtool image handle, image geometry */ |
| 1497 | 1497 | ti99_AUformat AUformat; /* AU format */ |
| 1498 | 1498 | int data_offset; /* In order to reduce seek times when searching the |
| 1499 | disk for a given file name, fdr (and ddr, and | |
| 1500 | fdir) records are preferentially allocated in | |
| 1501 | AUs n to data_offset, whereas data records are | |
| 1502 | preferentially allocated in AUs starting at | |
| 1503 | data_offset. */ | |
| 1499 | disk for a given file name, fdr (and ddr, and | |
| 1500 | fdir) records are preferentially allocated in | |
| 1501 | AUs n to data_offset, whereas data records are | |
| 1502 | preferentially allocated in AUs starting at | |
| 1503 | data_offset. */ | |
| 1504 | 1504 | /* With the DSK disk structure, n is always 2 (if 1 |
| 1505 | physrec per AU) or 1 (if 2 physrecs per AU or | |
| 1506 | more), and data_offset is arbitrarily chosen as | |
| 1507 | 34. */ | |
| 1505 | physrec per AU) or 1 (if 2 physrecs per AU or | |
| 1506 | more), and data_offset is arbitrarily chosen as | |
| 1507 | 34. */ | |
| 1508 | 1508 | /* With the WIN disk structure, n depends on the |
| 1509 | size of the volume bitmap, which itself depends | |
| 1510 | on the number of AUs on disk (we always have n | |
| 1511 | <= 33), and data_offset is read from the vib | |
| 1512 | record (except with the obsolete v1 VIB, where | |
| 1513 | we use a default value of 64). */ | |
| 1509 | size of the volume bitmap, which itself depends | |
| 1510 | on the number of AUs on disk (we always have n | |
| 1511 | <= 33), and data_offset is read from the vib | |
| 1512 | record (except with the obsolete v1 VIB, where | |
| 1513 | we use a default value of 64). */ | |
| 1514 | 1514 | char vol_name[10]; /* cached volume name (extracted from vib record in aphysrec 0) */ |
| 1515 | 1515 | |
| 1516 | 1516 | UINT8 abm[8192]; /* allocation bitmap */ |
| r5932 | r5933 | |
| 1529 | 1529 | } ti99_lvl2_imgref; |
| 1530 | 1530 | |
| 1531 | 1531 | /* |
| 1532 | ||
| 1532 | file flags found in fdr (and tifiles) | |
| 1533 | 1533 | */ |
| 1534 | 1534 | enum |
| 1535 | 1535 | { |
| 1536 | 1536 | fdr99_f_program = 0x01, /* set for program files */ |
| 1537 | 1537 | fdr99_f_int = 0x02, /* set for binary files */ |
| 1538 | 1538 | fdr99_f_wp = 0x08, /* set if file is write-protected */ |
| 1539 | /*fdr99_f_backup = 0x10,*/ /* set if file has been modified since last backup */ | |
| 1540 | /*fdr99_f_dskimg = 0x20,*/ /* set if file is a DSK image (HFDC HD only) */ | |
| 1539 | /*fdr99_f_backup = 0x10,*/ /* set if file has been modified since last backup */ | |
| 1540 | /*fdr99_f_dskimg = 0x20,*/ /* set if file is a DSK image (HFDC HD only) */ | |
| 1541 | 1541 | fdr99_f_var = 0x80 /* set if file uses variable-length records*/ |
| 1542 | 1542 | }; |
| 1543 | 1543 | |
| 1544 | 1544 | /* |
| 1545 | ||
| 1545 | DSK FDR record | |
| 1546 | 1546 | */ |
| 1547 | 1547 | typedef struct dsk_fdr |
| 1548 | 1548 | { |
| r5932 | r5933 | |
| 1588 | 1588 | } dsk_fdr; |
| 1589 | 1589 | |
| 1590 | 1590 | /* |
| 1591 | ||
| 1591 | WIN FDR record | |
| 1592 | 1592 | */ |
| 1593 | 1593 | typedef struct win_fdr |
| 1594 | 1594 | { |
| r5932 | r5933 | |
| 1650 | 1650 | } win_fdr; |
| 1651 | 1651 | |
| 1652 | 1652 | /* |
| 1653 | ||
| 1653 | tifile header: stand-alone file | |
| 1654 | 1654 | */ |
| 1655 | 1655 | typedef struct tifile_header |
| 1656 | 1656 | { |
| r5932 | r5933 | |
| 1690 | 1690 | } tifile_header; |
| 1691 | 1691 | |
| 1692 | 1692 | /* |
| 1693 | ||
| 1693 | level-2 file descriptor | |
| 1694 | 1694 | */ |
| 1695 | 1695 | typedef struct ti99_lvl2_fileref_dsk |
| 1696 | 1696 | { |
| r5932 | r5933 | |
| 1733 | 1733 | |
| 1734 | 1734 | |
| 1735 | 1735 | /* |
| 1736 | ||
| 1736 | Compare two (possibly empty) catalog entry for qsort | |
| 1737 | 1737 | */ |
| 1738 | 1738 | static int cat_file_compare_qsort(const void *p1, const void *p2) |
| 1739 | 1739 | { |
| r5932 | r5933 | |
| 1766 | 1766 | } |
| 1767 | 1767 | |
| 1768 | 1768 | /* |
| 1769 | ||
| 1769 | Read a directory catalog from disk image | |
| 1770 | 1770 | |
| 1771 | l2_img: image reference | |
| 1772 | aphysrec: physical record address of the FDIR | |
| 1773 | dest: pointer to the destination buffer where the catalog should be written | |
| 1771 | l2_img: image reference | |
| 1772 | aphysrec: physical record address of the FDIR | |
| 1773 | dest: pointer to the destination buffer where the catalog should be written | |
| 1774 | 1774 | |
| 1775 | ||
| 1775 | Return an error code if there was an error, 0 otherwise. | |
| 1776 | 1776 | */ |
| 1777 | 1777 | static int dsk_read_catalog(ti99_lvl2_imgref *l2_img, int aphysrec, ti99_catalog *dest) |
| 1778 | 1778 | { |
| r5932 | r5933 | |
| 1837 | 1837 | } |
| 1838 | 1838 | |
| 1839 | 1839 | /* |
| 1840 | ||
| 1840 | Read a directory catalog from disk image | |
| 1841 | 1841 | |
| 1842 | l2_img: image reference | |
| 1843 | DDR_AU: AU address of the VIB/DDR | |
| 1844 | dest: pointer to the destination buffer where the catalog should be written | |
| 1842 | l2_img: image reference | |
| 1843 | DDR_AU: AU address of the VIB/DDR | |
| 1844 | dest: pointer to the destination buffer where the catalog should be written | |
| 1845 | 1845 | |
| 1846 | ||
| 1846 | Return an error code if there was an error, 0 otherwise. | |
| 1847 | 1847 | */ |
| 1848 | 1848 | static int win_read_catalog(ti99_lvl2_imgref *l2_img, int DDR_AU, ti99_catalog *dest) |
| 1849 | 1849 | { |
| r5932 | r5933 | |
| 1958 | 1958 | } |
| 1959 | 1959 | |
| 1960 | 1960 | /* |
| 1961 | ||
| 1961 | Search for a file path on a floppy image | |
| 1962 | 1962 | |
| 1963 | l2_img: image reference | |
| 1964 | fpath: path of the file to search | |
| 1965 | parent_ref_valid: set to TRUE if either the file was found or the file was | |
| 1966 | not found but its parent dir was | |
| 1967 | parent_ref: reference to parent dir (0 for root) | |
| 1968 | out_is_dir: TRUE if element is a directory | |
| 1969 | catalog_index: on output, index of file catalog entry (may be NULL) | |
| 1963 | l2_img: image reference | |
| 1964 | fpath: path of the file to search | |
| 1965 | parent_ref_valid: set to TRUE if either the file was found or the file was | |
| 1966 | not found but its parent dir was | |
| 1967 | parent_ref: reference to parent dir (0 for root) | |
| 1968 | out_is_dir: TRUE if element is a directory | |
| 1969 | catalog_index: on output, index of file catalog entry (may be NULL) | |
| 1970 | 1970 | */ |
| 1971 | 1971 | static int dsk_find_catalog_entry(ti99_lvl2_imgref *l2_img, const char *fpath, int *parent_ref_valid, int *parent_ref, int *out_is_dir, int *catalog_index) |
| 1972 | 1972 | { |
| r5932 | r5933 | |
| 2057 | 2057 | } |
| 2058 | 2058 | |
| 2059 | 2059 | /* |
| 2060 | ||
| 2060 | Search for a file path on a harddisk image | |
| 2061 | 2061 | |
| 2062 | l2_img: image reference | |
| 2063 | fpath: path of the file to search | |
| 2064 | parent_ref_valid: set to TRUE if either the file was found or the file was | |
| 2065 | not found but its parent dir was | |
| 2066 | parent_ddr_AU: parent DDR AU address (0 for root) | |
| 2067 | parent_catalog: catalog of parent dir (cannot be NULL) | |
| 2068 | out_is_dir: TRUE if element is a directory | |
| 2069 | catalog_index: on output, index of file catalog entry (may be NULL) | |
| 2062 | l2_img: image reference | |
| 2063 | fpath: path of the file to search | |
| 2064 | parent_ref_valid: set to TRUE if either the file was found or the file was | |
| 2065 | not found but its parent dir was | |
| 2066 | parent_ddr_AU: parent DDR AU address (0 for root) | |
| 2067 | parent_catalog: catalog of parent dir (cannot be NULL) | |
| 2068 | out_is_dir: TRUE if element is a directory | |
| 2069 | catalog_index: on output, index of file catalog entry (may be NULL) | |
| 2070 | 2070 | */ |
| 2071 | 2071 | static int win_find_catalog_entry(ti99_lvl2_imgref *l2_img, const char *fpath, |
| 2072 | 2072 | int *parent_ref_valid, int *parent_ddr_AU, ti99_catalog *parent_catalog, |
| r5932 | r5933 | |
| 2163 | 2163 | } |
| 2164 | 2164 | |
| 2165 | 2165 | /* |
| 2166 | ||
| 2166 | Allocate one AU on disk, for use as a fdr record | |
| 2167 | 2167 | |
| 2168 | l2_img: image reference | |
| 2169 | fdr_AU: on output, address of allocated AU | |
| 2168 | l2_img: image reference | |
| 2169 | fdr_AU: on output, address of allocated AU | |
| 2170 | 2170 | */ |
| 2171 | 2171 | static int alloc_fdr_AU(ti99_lvl2_imgref *l2_img, unsigned *fdr_AU) |
| 2172 | 2172 | { |
| r5932 | r5933 | |
| 2282 | 2282 | } |
| 2283 | 2283 | |
| 2284 | 2284 | /* |
| 2285 | ||
| 2285 | Advance to next sibling FDR | |
| 2286 | 2286 | */ |
| 2287 | 2287 | static int win_goto_next_sibFDR(ti99_lvl2_fileref_win *win_file) |
| 2288 | 2288 | { |
| r5932 | r5933 | |
| 2297 | 2297 | } |
| 2298 | 2298 | |
| 2299 | 2299 | /* |
| 2300 | ||
| 2300 | Back to previous sibling FDR | |
| 2301 | 2301 | */ |
| 2302 | 2302 | static int win_goto_prev_sibFDR(ti99_lvl2_fileref_win *win_file) |
| 2303 | 2303 | { |
| r5932 | r5933 | |
| 2312 | 2312 | } |
| 2313 | 2313 | |
| 2314 | 2314 | /* |
| 2315 | ||
| 2315 | Append a new sibling FDR at the end of the sibling FDR list, and open it. | |
| 2316 | 2316 | |
| 2317 | ||
| 2317 | You must have gone to the end of the list. | |
| 2318 | 2318 | */ |
| 2319 | 2319 | static int win_alloc_sibFDR(ti99_lvl2_fileref_win *win_file) |
| 2320 | 2320 | { |
| r5932 | r5933 | |
| 2377 | 2377 | } |
| 2378 | 2378 | |
| 2379 | 2379 | /* |
| 2380 | ||
| 2380 | Extend a file with nb_alloc_physrecs extra physrecs | |
| 2381 | 2381 | |
| 2382 | dsk_file: file reference | |
| 2383 | nb_alloc_physrecs: number of physical records to allocate | |
| 2382 | dsk_file: file reference | |
| 2383 | nb_alloc_physrecs: number of physical records to allocate | |
| 2384 | 2384 | */ |
| 2385 | 2385 | static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc_physrecs) |
| 2386 | 2386 | { |
| r5932 | r5933 | |
| 2565 | 2565 | } |
| 2566 | 2566 | |
| 2567 | 2567 | /* |
| 2568 | ||
| 2568 | Extend a file with nb_alloc_physrecs extra physrecs | |
| 2569 | 2569 | |
| 2570 | win_file: file reference | |
| 2571 | nb_alloc_physrecs: number of physical records to allocate | |
| 2570 | win_file: file reference | |
| 2571 | nb_alloc_physrecs: number of physical records to allocate | |
| 2572 | 2572 | */ |
| 2573 | 2573 | static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc_physrecs) |
| 2574 | 2574 | { |
| r5932 | r5933 | |
| 2607 | 2607 | } |
| 2608 | 2608 | if ((get_UINT16BE(win_file->curfdr.clusters[0][0]) == 0) && (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) != 0)) |
| 2609 | 2609 | { /* this is annoying: we have found a sibling FDR filled with 0s: rewind |
| 2610 | ||
| 2610 | to last non-empty sibling if applicable */ | |
| 2611 | 2611 | errorcode = win_goto_prev_sibFDR(win_file); |
| 2612 | 2612 | if (errorcode) |
| 2613 | 2613 | return errorcode; |
| r5932 | r5933 | |
| 2782 | 2782 | } |
| 2783 | 2783 | |
| 2784 | 2784 | /* |
| 2785 | ||
| 2785 | Allocate a new (empty) file | |
| 2786 | 2786 | */ |
| 2787 | 2787 | static int new_file_lvl2_dsk(ti99_lvl2_imgref *l2_img, int parent_ref, char filename[10], ti99_lvl2_fileref *l2_file) |
| 2788 | 2788 | { |
| r5932 | r5933 | |
| 2796 | 2796 | if (catalog->num_files >= 127) |
| 2797 | 2797 | /* if num_files == 128, catalog is full */ |
| 2798 | 2798 | /* if num_files == 127, catalog is not full, but we don't want to write |
| 2799 | a 128th entry for compatibility with some existing DSRs that detect the | |
| 2800 | end of the FDIR array with a 0 entry (and do not check that the index | |
| 2801 | has not reached 128) */ | |
| 2799 | a 128th entry for compatibility with some existing DSRs that detect the | |
| 2800 | end of the FDIR array with a 0 entry (and do not check that the index | |
| 2801 | has not reached 128) */ | |
| 2802 | 2802 | return IMGTOOLERR_NOSPACE; |
| 2803 | 2803 | |
| 2804 | 2804 | /* find insertion point in catalog */ |
| r5932 | r5933 | |
| 2840 | 2840 | } |
| 2841 | 2841 | |
| 2842 | 2842 | /* |
| 2843 | ||
| 2843 | Allocate a new (empty) file | |
| 2844 | 2844 | */ |
| 2845 | 2845 | static int new_file_lvl2_win(ti99_lvl2_imgref *l2_img, ti99_catalog *parent_catalog, char filename[10], ti99_lvl2_fileref *l2_file) |
| 2846 | 2846 | { |
| r5932 | r5933 | |
| 2894 | 2894 | } |
| 2895 | 2895 | |
| 2896 | 2896 | /* |
| 2897 | ||
| 2897 | Allocate a new (empty) file | |
| 2898 | 2898 | */ |
| 2899 | 2899 | static int new_file_lvl2_tifiles(imgtool_stream *file_handle, ti99_lvl2_fileref *l2_file) |
| 2900 | 2900 | { |
| r5932 | r5933 | |
| 2915 | 2915 | } |
| 2916 | 2916 | |
| 2917 | 2917 | /* |
| 2918 | ||
| 2918 | Open an existing file on a floppy image | |
| 2919 | 2919 | |
| 2920 | l2_img: level 2 image the file is located on | |
| 2921 | fpath: access path to the file | |
| 2922 | file: set up if open is successful | |
| 2920 | l2_img: level 2 image the file is located on | |
| 2921 | fpath: access path to the file | |
| 2922 | file: set up if open is successful | |
| 2923 | 2923 | */ |
| 2924 | 2924 | static int open_file_lvl2_dsk(ti99_lvl2_imgref *l2_img, const char *fpath, ti99_lvl2_fileref *l2_file) |
| 2925 | 2925 | { |
| r5932 | r5933 | |
| 2945 | 2945 | } |
| 2946 | 2946 | |
| 2947 | 2947 | /* |
| 2948 | ||
| 2948 | Open an existing file on a harddisk image | |
| 2949 | 2949 | |
| 2950 | l2_img: level 2 image the file is located on | |
| 2951 | fpath: access path to the file | |
| 2952 | file: set up if open is successful | |
| 2950 | l2_img: level 2 image the file is located on | |
| 2951 | fpath: access path to the file | |
| 2952 | file: set up if open is successful | |
| 2953 | 2953 | */ |
| 2954 | 2954 | static int open_file_lvl2_win(ti99_lvl2_imgref *l2_img, const char *fpath, ti99_lvl2_fileref *l2_file) |
| 2955 | 2955 | { |
| r5932 | r5933 | |
| 2975 | 2975 | |
| 2976 | 2976 | /* check integrity of FDR sibling chain */ |
| 2977 | 2977 | /* note that as we check that the back chain is consistent with the forward |
| 2978 | chain, we will also detect any cycle in the sibling chain, so we do not | |
| 2979 | need to check against them explicitely */ | |
| 2978 | chain, we will also detect any cycle in the sibling chain, so we do not | |
| 2979 | need to check against them explicitely */ | |
| 2980 | 2980 | if (get_UINT16BE(l2_file->u.win.curfdr.prevsibFDR_AU) != 0) |
| 2981 | 2981 | return IMGTOOLERR_CORRUPTIMAGE; |
| 2982 | 2982 | |
| r5932 | r5933 | |
| 3014 | 3014 | for (; i<54; i++) |
| 3015 | 3015 | { |
| 3016 | 3016 | /*set_UINT16BE(&cur_fdr->clusters[i][0], 0); |
| 3017 | ||
| 3017 | set_UINT16BE(&cur_fdr->clusters[i][1], 0);*/ | |
| 3018 | 3018 | if ((get_UINT16BE(cur_fdr->clusters[i][0]) != 0) || (get_UINT16BE(cur_fdr->clusters[i][1]) != 0)) |
| 3019 | 3019 | return IMGTOOLERR_CORRUPTIMAGE; |
| 3020 | 3020 | } |
| r5932 | r5933 | |
| 3070 | 3070 | } |
| 3071 | 3071 | |
| 3072 | 3072 | /* |
| 3073 | ||
| 3073 | Open an existing file in TIFILES format | |
| 3074 | 3074 | */ |
| 3075 | 3075 | static int open_file_lvl2_tifiles(imgtool_stream *file_handle, ti99_lvl2_fileref *l2_file) |
| 3076 | 3076 | { |
| r5932 | r5933 | |
| 3089 | 3089 | } |
| 3090 | 3090 | |
| 3091 | 3091 | /* |
| 3092 | ||
| 3092 | compute the aphysrec address for a given file physical record (fphysrec) | |
| 3093 | 3093 | |
| 3094 | ||
| 3094 | l2_img: image where the file is located | |
| 3095 | 3095 | */ |
| 3096 | 3096 | static int dsk_fphysrec_to_aphysrec(ti99_lvl2_fileref_dsk *dsk_file, unsigned fphysrec, unsigned *aphysrec) |
| 3097 | 3097 | { |
| r5932 | r5933 | |
| 3127 | 3127 | } |
| 3128 | 3128 | |
| 3129 | 3129 | /* |
| 3130 | ||
| 3130 | compute the aphysrec address for a given file physical record (fphysrec) | |
| 3131 | 3131 | |
| 3132 | ||
| 3132 | l2_img: image where the file is located | |
| 3133 | 3133 | */ |
| 3134 | 3134 | static int win_fphysrec_to_aphysrec(ti99_lvl2_fileref_win *win_file, unsigned fphysrec, unsigned *aphysrec) |
| 3135 | 3135 | { |
| r5932 | r5933 | |
| 3196 | 3196 | } |
| 3197 | 3197 | |
| 3198 | 3198 | /* |
| 3199 | ||
| 3199 | read a 256-byte physical record from a file | |
| 3200 | 3200 | */ |
| 3201 | 3201 | static int read_file_physrec(ti99_lvl2_fileref *l2_file, unsigned fphysrec, void *dest) |
| 3202 | 3202 | { |
| r5932 | r5933 | |
| 3239 | 3239 | } |
| 3240 | 3240 | |
| 3241 | 3241 | /* |
| 3242 | ||
| 3242 | read a 256-byte physical record from a file | |
| 3243 | 3243 | */ |
| 3244 | 3244 | static int write_file_physrec(ti99_lvl2_fileref *l2_file, unsigned fphysrec, const void *src) |
| 3245 | 3245 | { |
| r5932 | r5933 | |
| 3282 | 3282 | } |
| 3283 | 3283 | |
| 3284 | 3284 | /* |
| 3285 | ||
| 3285 | Write a field in every fdr record associated to a file | |
| 3286 | 3286 | */ |
| 3287 | 3287 | /*static int set_win_fdr_field(ti99_lvl2_fileref *l2_file, size_t offset, size_t size, void *data) |
| 3288 | 3288 | { |
| 3289 | win_fdr fdr_buf; | |
| 3290 | unsigned fdr_aphysrec; | |
| 3291 | int errorcode = 0; | |
| 3289 | win_fdr fdr_buf; | |
| 3290 | unsigned fdr_aphysrec; | |
| 3291 | int errorcode = 0; | |
| 3292 | 3292 | |
| 3293 | for (fdr_aphysrec = l2_file->u.win.eldestfdr_aphysrec; | |
| 3294 | fdr_aphysrec && ((errorcode = (read_absolute_physrec(&l2_file->u.win.l2_img->l1_img, fdr_aphysrec, &fdr_buf) ? IMGTOOLERR_READERROR : 0)) == 0); | |
| 3295 | fdr_aphysrec = get_win_fdr_nextsibFDR_physrec(l2_file->u.win.l2_img, &fdr_buf)) | |
| 3296 | { | |
| 3297 | memcpy(((UINT8 *) &fdr_buf) + offset, data, size); | |
| 3298 | if (write_absolute_physrec(&l2_file->u.win.l2_img->l1_img, fdr_aphysrec, &fdr_buf)) | |
| 3299 | { | |
| 3300 | errorcode = IMGTOOLERR_WRITEERROR; | |
| 3301 | break; | |
| 3302 | } | |
| 3303 | } | |
| 3293 | for (fdr_aphysrec = l2_file->u.win.eldestfdr_aphysrec; | |
| 3294 | fdr_aphysrec && ((errorcode = (read_absolute_physrec(&l2_file->u.win.l2_img->l1_img, fdr_aphysrec, &fdr_buf) ? IMGTOOLERR_READERROR : 0)) == 0); | |
| 3295 | fdr_aphysrec = get_win_fdr_nextsibFDR_physrec(l2_file->u.win.l2_img, &fdr_buf)) | |
| 3296 | { | |
| 3297 | memcpy(((UINT8 *) &fdr_buf) + offset, data, size); | |
| 3298 | if (write_absolute_physrec(&l2_file->u.win.l2_img->l1_img, fdr_aphysrec, &fdr_buf)) | |
| 3299 | { | |
| 3300 | errorcode = IMGTOOLERR_WRITEERROR; | |
| 3301 | break; | |
| 3302 | } | |
| 3303 | } | |
| 3304 | 3304 | |
| 3305 | ||
| 3305 | return errorcode; | |
| 3306 | 3306 | }*/ |
| 3307 | 3307 | |
| 3308 | 3308 | static UINT8 get_file_flags(ti99_lvl2_fileref *l2_file) |
| r5932 | r5933 | |
| 3673 | 3673 | #endif |
| 3674 | 3674 | |
| 3675 | 3675 | /* |
| 3676 | ||
| 3676 | Level 3 implements files as a succession of logical records. | |
| 3677 | 3677 | |
| 3678 | There are three types of files: | |
| 3679 | * program files that are not implemented at level 3 (no logical record) | |
| 3680 | * files with fixed-size records (random-access files) | |
| 3681 | * files with variable-size records (sequential-access) | |
| 3678 | There are three types of files: | |
| 3679 | * program files that are not implemented at level 3 (no logical record) | |
| 3680 | * files with fixed-size records (random-access files) | |
| 3681 | * files with variable-size records (sequential-access) | |
| 3682 | 3682 | */ |
| 3683 | 3683 | |
| 3684 | 3684 | typedef struct ti99_lvl3_fileref |
| r5932 | r5933 | |
| 3692 | 3692 | |
| 3693 | 3693 | #ifdef UNUSED_FUNCTION |
| 3694 | 3694 | /* |
| 3695 | ||
| 3695 | Open a file on level 3. | |
| 3696 | 3696 | |
| 3697 | To open a file on level 3, you must open (or create) the file on level 2, | |
| 3698 | then pass the file reference to open_file_lvl3. | |
| 3697 | To open a file on level 3, you must open (or create) the file on level 2, | |
| 3698 | then pass the file reference to open_file_lvl3. | |
| 3699 | 3699 | */ |
| 3700 | 3700 | static int open_file_lvl3(ti99_lvl3_fileref *l3_file) |
| 3701 | 3701 | { |
| r5932 | r5933 | |
| 3709 | 3709 | } |
| 3710 | 3710 | |
| 3711 | 3711 | /* |
| 3712 | ||
| 3712 | Test a file for EOF | |
| 3713 | 3713 | */ |
| 3714 | 3714 | static int is_eof(ti99_lvl3_fileref *l3_file) |
| 3715 | 3715 | { |
| r5932 | r5933 | |
| 3730 | 3730 | } |
| 3731 | 3731 | |
| 3732 | 3732 | /* |
| 3733 | ||
| 3733 | Read next record from a file | |
| 3734 | 3734 | */ |
| 3735 | 3735 | static int read_next_record(ti99_lvl3_fileref *l3_file, void *dest, int *out_reclen) |
| 3736 | 3736 | { |
| r5932 | r5933 | |
| 3810 | 3810 | #endif |
| 3811 | 3811 | |
| 3812 | 3812 | /* |
| 3813 | ||
| 3813 | ti99 catalog iterator, used when imgtool reads the catalog | |
| 3814 | 3814 | */ |
| 3815 | 3815 | typedef struct dsk_iterator |
| 3816 | 3816 | { |
| r5932 | r5933 | |
| 3976 | 3976 | |
| 3977 | 3977 | |
| 3978 | 3978 | /* |
| 3979 | ||
| 3979 | Open a file as a ti99_image (common code). | |
| 3980 | 3980 | */ |
| 3981 | 3981 | static int dsk_image_init(imgtool_image *img, imgtool_stream *f, ti99_img_format img_format) |
| 3982 | 3982 | { |
| r5932 | r5933 | |
| 4017 | 4017 | |
| 4018 | 4018 | /* read and check subdirectory catalogs */ |
| 4019 | 4019 | /* Note that the reserved areas used for HFDC subdirs may be used for other |
| 4020 | purposes by other FDRs, so, if we get any error, we will assume there is no | |
| 4021 | subdir after all... */ | |
| 4020 | purposes by other FDRs, so, if we get any error, we will assume there is no | |
| 4021 | subdir after all... */ | |
| 4022 | 4022 | image->u.dsk.catalogs[0].num_subdirs = 0; |
| 4023 | 4023 | for (i=0; i<3; i++) |
| 4024 | 4024 | { |
| r5932 | r5933 | |
| 4074 | 4074 | } |
| 4075 | 4075 | |
| 4076 | 4076 | /* |
| 4077 | ||
| 4077 | Open a file as a ti99_image (MESS format). | |
| 4078 | 4078 | */ |
| 4079 | 4079 | static imgtoolerr_t dsk_image_init_mess(imgtool_image *image, imgtool_stream *f) |
| 4080 | 4080 | { |
| r5932 | r5933 | |
| 4082 | 4082 | } |
| 4083 | 4083 | |
| 4084 | 4084 | /* |
| 4085 | ||
| 4085 | Open a file as a ti99_image (V9T9 format). | |
| 4086 | 4086 | */ |
| 4087 | 4087 | static imgtoolerr_t dsk_image_init_v9t9(imgtool_image *image, imgtool_stream *f) |
| 4088 | 4088 | { |
| r5932 | r5933 | |
| 4090 | 4090 | } |
| 4091 | 4091 | |
| 4092 | 4092 | /* |
| 4093 | ||
| 4093 | Open a file as a ti99_image (PC99 FM format). | |
| 4094 | 4094 | */ |
| 4095 | 4095 | static imgtoolerr_t dsk_image_init_pc99_fm(imgtool_image *image, imgtool_stream *f) |
| 4096 | 4096 | { |
| r5932 | r5933 | |
| 4098 | 4098 | } |
| 4099 | 4099 | |
| 4100 | 4100 | /* |
| 4101 | ||
| 4101 | Open a file as a ti99_image (PC99 MFM format). | |
| 4102 | 4102 | */ |
| 4103 | 4103 | static imgtoolerr_t dsk_image_init_pc99_mfm(imgtool_image *image, imgtool_stream *f) |
| 4104 | 4104 | { |
| r5932 | r5933 | |
| 4106 | 4106 | } |
| 4107 | 4107 | |
| 4108 | 4108 | /* |
| 4109 | ||
| 4109 | Open a file as a ti99_image (harddisk format). | |
| 4110 | 4110 | */ |
| 4111 | 4111 | static imgtoolerr_t win_image_init(imgtool_image *img, imgtool_stream *f) |
| 4112 | 4112 | { |
| r5932 | r5933 | |
| 4162 | 4162 | } |
| 4163 | 4163 | |
| 4164 | 4164 | /* |
| 4165 | ||
| 4165 | close a ti99_image | |
| 4166 | 4166 | */ |
| 4167 | 4167 | static void ti99_image_exit(imgtool_image *img) |
| 4168 | 4168 | { |
| r5932 | r5933 | |
| 4172 | 4172 | } |
| 4173 | 4173 | |
| 4174 | 4174 | /* |
| 4175 | ||
| 4175 | get basic information on a ti99_image | |
| 4176 | 4176 | |
| 4177 | ||
| 4177 | Currently returns the volume name | |
| 4178 | 4178 | */ |
| 4179 | 4179 | static void ti99_image_info(imgtool_image *img, char *string, size_t len) |
| 4180 | 4180 | { |
| r5932 | r5933 | |
| 4187 | 4187 | } |
| 4188 | 4188 | |
| 4189 | 4189 | /* |
| 4190 | ||
| 4190 | Open the disk catalog for enumeration | |
| 4191 | 4191 | */ |
| 4192 | 4192 | static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 4193 | 4193 | { |
| r5932 | r5933 | |
| 4204 | 4204 | } |
| 4205 | 4205 | |
| 4206 | 4206 | /* |
| 4207 | ||
| 4207 | Enumerate disk catalog next entry | |
| 4208 | 4208 | */ |
| 4209 | 4209 | static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) |
| 4210 | 4210 | { |
| r5932 | r5933 | |
| 4260 | 4260 | |
| 4261 | 4261 | /* recurse subdirectory */ |
| 4262 | 4262 | iter->listing_subdirs = 0; /* no need to list subdirs as only the |
| 4263 | ||
| 4263 | root dir has subdirs in DSK format */ | |
| 4264 | 4264 | iter->level = 1; |
| 4265 | 4265 | iter->cur_catalog = &iter->image->u.dsk.catalogs[iter->index[0]+1]; |
| 4266 | 4266 | iter->index[iter->level] = 0; |
| r5932 | r5933 | |
| 4308 | 4308 | } |
| 4309 | 4309 | |
| 4310 | 4310 | /* |
| 4311 | ||
| 4311 | Open the disk catalog for enumeration | |
| 4312 | 4312 | */ |
| 4313 | 4313 | static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 4314 | 4314 | { |
| r5932 | r5933 | |
| 4328 | 4328 | } |
| 4329 | 4329 | |
| 4330 | 4330 | /* |
| 4331 | ||
| 4331 | Enumerate disk catalog next entry | |
| 4332 | 4332 | */ |
| 4333 | 4333 | static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) |
| 4334 | 4334 | { |
| r5932 | r5933 | |
| 4448 | 4448 | } |
| 4449 | 4449 | |
| 4450 | 4450 | /* |
| 4451 | ||
| 4451 | Compute free space on disk image (in AUs) | |
| 4452 | 4452 | */ |
| 4453 | 4453 | static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *size) |
| 4454 | 4454 | { |
| r5932 | r5933 | |
| 4470 | 4470 | } |
| 4471 | 4471 | |
| 4472 | 4472 | /* |
| 4473 | ||
| 4473 | Extract a file from a ti99_image. The file is saved in tifile format. | |
| 4474 | 4474 | */ |
| 4475 | 4475 | static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf) |
| 4476 | 4476 | { |
| r5932 | r5933 | |
| 4530 | 4530 | |
| 4531 | 4531 | get_file_creation_date(&src_file, &date_time); |
| 4532 | 4532 | /*if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) |
| 4533 | || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) | |
| 4534 | current_date_time(&date_time);*/ | |
| 4533 | || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) | |
| 4534 | current_date_time(&date_time);*/ | |
| 4535 | 4535 | set_file_creation_date(&dst_file, date_time); |
| 4536 | 4536 | |
| 4537 | 4537 | get_file_update_date(&src_file, &date_time); |
| 4538 | 4538 | /*if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) |
| 4539 | || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) | |
| 4540 | current_date_time(&date_time);*/ | |
| 4539 | || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) | |
| 4540 | current_date_time(&date_time);*/ | |
| 4541 | 4541 | set_file_update_date(&dst_file, date_time); |
| 4542 | 4542 | |
| 4543 | 4543 | if (stream_write(destf, & dst_file.u.tifiles.hdr, 128) != 128) |
| r5932 | r5933 | |
| 4608 | 4608 | } |
| 4609 | 4609 | |
| 4610 | 4610 | /* |
| 4611 | ||
| 4611 | Add a file to a ti99_image. The file must be in tifile format. | |
| 4612 | 4612 | */ |
| 4613 | 4613 | static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) |
| 4614 | 4614 | { |
| r5932 | r5933 | |
| 4695 | 4695 | |
| 4696 | 4696 | get_file_creation_date(&src_file, &date_time); |
| 4697 | 4697 | /*if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) |
| 4698 | || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) | |
| 4699 | current_date_time(&date_time);*/ | |
| 4698 | || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) | |
| 4699 | current_date_time(&date_time);*/ | |
| 4700 | 4700 | set_file_creation_date(&dst_file, date_time); |
| 4701 | 4701 | |
| 4702 | 4702 | get_file_update_date(&src_file, &date_time); |
| 4703 | 4703 | /*if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0) |
| 4704 | || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) | |
| 4705 | current_date_time(&date_time);*/ | |
| 4704 | || (date_time.date_MSB == 0) || (date_time.date_LSB == 0)) | |
| 4705 | current_date_time(&date_time);*/ | |
| 4706 | 4706 | set_file_update_date(&dst_file, date_time); |
| 4707 | 4707 | |
| 4708 | 4708 | /* alloc data physrecs */ |
| r5932 | r5933 | |
| 4830 | 4830 | } |
| 4831 | 4831 | |
| 4832 | 4832 | /* |
| 4833 | ||
| 4833 | Delete a file from a ti99_image. | |
| 4834 | 4834 | */ |
| 4835 | 4835 | static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const char *fpath) |
| 4836 | 4836 | { |
| r5932 | r5933 | |
| 4919 | 4919 | while (i<=cluster_lastfphysrec) |
| 4920 | 4920 | { |
| 4921 | 4921 | /* the condition below is an error, but it should not prevent |
| 4922 | ||
| 4922 | us from deleting the file */ | |
| 4923 | 4923 | if (cur_AU >= image->AUformat.totAUs) |
| 4924 | 4924 | /*return IMGTOOLERR_CORRUPTIMAGE;*/ |
| 4925 | 4925 | break; |
| r5932 | r5933 | |
| 4933 | 4933 | cluster_index++; |
| 4934 | 4934 | } |
| 4935 | 4935 | /* the condition below is an error, but it should not prevent us from |
| 4936 | ||
| 4936 | deleting the file */ | |
| 4937 | 4937 | /*if (i<fphysrecs) |
| 4938 | ||
| 4938 | return IMGTOOLERR_CORRUPTIMAGE;*/ | |
| 4939 | 4939 | |
| 4940 | 4940 | /* free fdr AU */ |
| 4941 | 4941 | cur_AU = catalog->files[catalog_index].fdr_ptr / image->AUformat.physrecsperAU; |
| r5932 | r5933 | |
| 5043 | 5043 | { |
| 5044 | 5044 | /* check integrity of FDR sibling chain, and go to last sibling */ |
| 5045 | 5045 | /* note that as we check that the back chain is consistent with the forward |
| 5046 | chain, we will also detect any cycle in the sibling chain, so we do not | |
| 5047 | need to check against them explicitely */ | |
| 5046 | chain, we will also detect any cycle in the sibling chain, so we do not | |
| 5047 | need to check against them explicitely */ | |
| 5048 | 5048 | { |
| 5049 | 5049 | int pastendoflist_flag; |
| 5050 | 5050 | unsigned prevfdr_aphysrec; |
| r5932 | r5933 | |
| 5114 | 5114 | while (cur_AU<=end_AU) |
| 5115 | 5115 | { |
| 5116 | 5116 | /* the condition below is an error, but it should not prevent |
| 5117 | ||
| 5117 | us from deleting the file */ | |
| 5118 | 5118 | if (cur_AU >= image->AUformat.totAUs) |
| 5119 | 5119 | /*return IMGTOOLERR_CORRUPTIMAGE;*/ |
| 5120 | 5120 | break; |
| r5932 | r5933 | |
| 5182 | 5182 | } |
| 5183 | 5183 | |
| 5184 | 5184 | /* |
| 5185 | ||
| 5185 | Create a blank ti99_image (common code). | |
| 5186 | 5186 | |
| 5187 | ||
| 5187 | Supports MESS and V9T9 formats only | |
| 5188 | 5188 | */ |
| 5189 | 5189 | static imgtoolerr_t dsk_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions, ti99_img_format img_format) |
| 5190 | 5190 | { |
| r5932 | r5933 | |
| 5304 | 5304 | } |
| 5305 | 5305 | |
| 5306 | 5306 | /* |
| 5307 | ||
| 5307 | Create a blank ti99_image (MESS format). | |
| 5308 | 5308 | */ |
| 5309 | 5309 | static imgtoolerr_t dsk_image_create_mess(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions) |
| 5310 | 5310 | { |
| r5932 | r5933 | |
| 5312 | 5312 | } |
| 5313 | 5313 | |
| 5314 | 5314 | /* |
| 5315 | ||
| 5315 | Create a blank ti99_image (V9T9 format). | |
| 5316 | 5316 | */ |
| 5317 | 5317 | static imgtoolerr_t dsk_image_create_v9t9(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions) |
| 5318 | 5318 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | pc_hard.c | |
| 4 | 4 | |
| 5 | ||
| 5 | PC hard drives | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************** |
| 8 | 8 | |
| r5932 | r5933 | |
| 15 | 15 | 462 16 Partion #2 info |
| 16 | 16 | 478 16 Partion #3 info |
| 17 | 17 | 494 16 Partion #4 info |
| 18 | ||
| 18 | 510 2 Magic bytes (0x55 0xAA) | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | Partition info format: |
| r5932 | r5933 | |
| 23 | 23 | Offset Length Description |
| 24 | 24 | ------ ------ ----------- |
| 25 | 25 | 0 1 Bootable (0x80=bootable 0x00=not bootable) |
| 26 | 1 1 Starting head | |
| 27 | 2 1 Starting sector (bits 5-0) and high bits of starting track (bits 6-5) | |
| 28 | 3 1 Low bits of starting track | |
| 29 | 4 1 Partition type: | |
| 30 | 0x00 Unused | |
| 31 | 0x?1 FAT12 (0-15 MB) | |
| 32 | 0x?2 XENIX | |
| 33 | 0x?4 FAT16 (16-32 MB) | |
| 34 | 0x?6 FAT16` (32 MB-2 GB) | |
| 35 | 0x?7 HPFS or NTFS | |
| 36 | 0x?A Boot Manager | |
| 37 | 0x?B FAT32 (512 MB-2 TB) | |
| 38 | 0x?C FAT32 (512 MB-2 TB LBA) | |
| 39 | 0x1? OS/2 Boot manager/Win95 hidden | |
| 40 | 0xC? DR-DOS secured partition | |
| 41 | 0xD? Multiuser DOS secured partition | |
| 42 | 0xE? SpeedStor extended partition | |
| 43 | 5 1 Ending head | |
| 44 | 6 1 Ending sector (bits 5-0) and high bits of ending track (bits 6-5) | |
| 45 | 7 1 Low bits of ending track | |
| 46 | 8 4 Sector index of beginning of partition | |
| 47 | 12 4 Total sectors in partition | |
| 26 | 1 1 Starting head | |
| 27 | 2 1 Starting sector (bits 5-0) and high bits of starting track (bits 6-5) | |
| 28 | 3 1 Low bits of starting track | |
| 29 | 4 1 Partition type: | |
| 30 | 0x00 Unused | |
| 31 | 0x?1 FAT12 (0-15 MB) | |
| 32 | 0x?2 XENIX | |
| 33 | 0x?4 FAT16 (16-32 MB) | |
| 34 | 0x?6 FAT16` (32 MB-2 GB) | |
| 35 | 0x?7 HPFS or NTFS | |
| 36 | 0x?A Boot Manager | |
| 37 | 0x?B FAT32 (512 MB-2 TB) | |
| 38 | 0x?C FAT32 (512 MB-2 TB LBA) | |
| 39 | 0x1? OS/2 Boot manager/Win95 hidden | |
| 40 | 0xC? DR-DOS secured partition | |
| 41 | 0xD? Multiuser DOS secured partition | |
| 42 | 0xE? SpeedStor extended partition | |
| 43 | 5 1 Ending head | |
| 44 | 6 1 Ending sector (bits 5-0) and high bits of ending track (bits 6-5) | |
| 45 | 7 1 Low bits of ending track | |
| 46 | 8 4 Sector index of beginning of partition | |
| 47 | 12 4 Total sectors in partition | |
| 48 | 48 | |
| 49 | 49 | ****************************************************************************/ |
| 50 | 50 |
| r5932 | r5933 | |
|---|---|---|
| 7 | 7 | #include "utils.h" |
| 8 | 8 | |
| 9 | 9 | /* |
| 10 | ||
| 10 | MSX module | |
| 11 | 11 | |
| 12 | fMSX style .cas for the MSX. Converts them to .wav files. Uses the | |
| 13 | mess/formats/fmsx_cas.[ch] files, for the actual conversion. | |
| 12 | fMSX style .cas for the MSX. Converts them to .wav files. Uses the | |
| 13 | mess/formats/fmsx_cas.[ch] files, for the actual conversion. | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | typedef struct { |
| r5932 | r5933 | |
|---|---|---|
| 43 | 43 | rom16_image_beginenum, /* begin enumeration */ |
| 44 | 44 | rom16_image_nextenum, /* enumerate next */ |
| 45 | 45 | rom16_image_closeenum, /* close enumeration */ |
| 46 | NULL, //crt_image_freespace, | |
| 46 | NULL, //crt_image_freespace, /* free space on image */ | |
| 47 | 47 | rom16_image_readfile, /* read file */ |
| 48 | 48 | rom16_image_writefile, /* write file */ |
| 49 | 49 | NULL, /* delete file */ |
| 50 | NULL,// | |
| 50 | NULL,// rom16_image_create, /* create image */ | |
| 51 | 51 | NULL, |
| 52 | 52 | NULL, |
| 53 | 53 | NULL, /* file options */ |
| r5932 | r5933 | |
| 209 | 209 | #if 0 |
| 210 | 210 | static int rom16_image_create(imgtool_stream *f, const ResolvedOption *options_) |
| 211 | 211 | { |
| 212 | // | |
| 212 | // if (options_->label) strcpy(header.name, options->label); | |
| 213 | 213 | return (stream_write(f, &header, sizeof(crt_header)) == sizeof(crt_header)) |
| 214 | 214 | ? 0 : IMGTOOLERR_WRITEERROR; |
| 215 | 215 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | os9.c | |
| 4 | 4 | |
| 5 | ||
| 5 | CoCo OS-9 disk images | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 236 | 236 | |
| 237 | 237 | /*------------------------------------------------- |
| 238 | 238 | os9_decode_file_header - reads a file/directory |
| 239 | ||
| 239 | entry from an LSN, and decodes it | |
| 240 | 240 | -------------------------------------------------*/ |
| 241 | 241 | |
| 242 | 242 | static imgtoolerr_t os9_decode_file_header(imgtool_image *image, |
| r5932 | r5933 | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /* keep in mind that the sector_map might not parallel our expected |
| 404 | ||
| 404 | * current LSN count; we should tolerate this abnormality */ | |
| 405 | 405 | current_lsn_count = lsn; |
| 406 | 406 | |
| 407 | 407 | while(current_lsn_count > new_lsn_count) |
| r5932 | r5933 | |
| 477 | 477 | |
| 478 | 478 | /*------------------------------------------------- |
| 479 | 479 | os9_lookup_path - walks an OS-9 directory |
| 480 | structure to find a file, or optionally, create | |
| 481 | a file | |
| 480 | structure to find a file, or optionally, create | |
| 481 | a file | |
| 482 | 482 | -------------------------------------------------*/ |
| 483 | 483 | |
| 484 | 484 | static imgtoolerr_t os9_lookup_path(imgtool_image *img, const char *path, |
| r5932 | r5933 | |
| 551 | 551 | if (index >= dir_size) |
| 552 | 552 | { |
| 553 | 553 | /* if we're not creating, or we are creating but we have not fully |
| 554 | ||
| 554 | * transversed the directory, error out */ | |
| 555 | 555 | if (!create || path[strlen(path) + 1]) |
| 556 | 556 | { |
| 557 | 557 | err = IMGTOOLERR_PATHNOTFOUND; |
| r5932 | r5933 | |
| 914 | 914 | pick_string(dir_entry, 0, 28, filename); |
| 915 | 915 | |
| 916 | 916 | /* we have certain expectations of the directory contents; the |
| 917 | * first directory entry should be "..", the second ".", and | |
| 918 | * subsequent entries should never be "." or ".." */ | |
| 917 | * first directory entry should be "..", the second ".", and | |
| 918 | * subsequent entries should never be "." or ".." */ | |
| 919 | 919 | switch(os9enum->index) |
| 920 | 920 | { |
| 921 | 921 | case 0: |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | amiga.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Amiga floppies | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | /* if we haven't found the right filename but there are linked entries, |
| 1056 | ||
| 1056 | * walk up the chain */ | |
| 1057 | 1057 | if ((*cmp)(name, path) != 0 && hash_chain != 0) |
| 1058 | 1058 | { |
| 1059 | 1059 | *prev_block = start_block; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | Cybiko File System | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | 7 | */ |
| 8 | 8 | |
| r5932 | r5933 | |
| 541 | 541 | OPTION_GUIDE_END |
| 542 | 542 | |
| 543 | 543 | //OPTION_GUIDE_START( cybiko_image_writefile_optguide ) |
| 544 | // | |
| 544 | // OPTION_INT( 'B', "boot", "Boot Flag" ) | |
| 545 | 545 | //OPTION_GUIDE_END |
| 546 | 546 | |
| 547 | 547 | void cybiko_get_info( const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) |
| r5932 | r5933 | |
| 551 | 551 | // --- the following bits of info are returned as 64-bit signed integers --- |
| 552 | 552 | case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES : info->i = sizeof( cybiko_file_system); break; |
| 553 | 553 | case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES : info->i = sizeof( cybiko_iter); break; |
| 554 | // | |
| 554 | // case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME : info->i = 1; break; | |
| 555 | 555 | case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME : info->i = 1; break; |
| 556 | // | |
| 556 | // case IMGTOOLINFO_INT_BLOCK_SIZE : info->i = 264; break; | |
| 557 | 557 | // --- the following bits of info are returned as pointers to data or functions --- |
| 558 | 558 | case IMGTOOLINFO_PTR_OPEN : info->open = cybiko_image_open; break; |
| 559 | 559 | case IMGTOOLINFO_PTR_CREATE : info->create = cybiko_image_create; break; |
| r5932 | r5933 | |
| 566 | 566 | case IMGTOOLINFO_PTR_WRITE_FILE : info->write_file = cybiko_image_write_file; break; |
| 567 | 567 | case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = cybiko_image_delete_file; break; |
| 568 | 568 | case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE : info->createimage_optguide = cybiko_image_createimage_optguide; break; |
| 569 | // | |
| 569 | // case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE : info->writefile_optguide = cybiko_image_writefile_optguide; break; | |
| 570 | 570 | // --- the following bits of info are returned as NULL-terminated strings --- |
| 571 | 571 | case IMGTOOLINFO_STR_NAME : strcpy( info->s = imgtool_temp_str(), "cybiko"); break; |
| 572 | 572 | case IMGTOOLINFO_STR_DESCRIPTION : strcpy( info->s = imgtool_temp_str(), "Cybiko File System"); break; |
| r5932 | r5933 | |
| 574 | 574 | case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "bin,nv"); break; |
| 575 | 575 | case IMGTOOLINFO_STR_EOLN : strcpy( info->s = imgtool_temp_str(), "\r\n"); break; |
| 576 | 576 | case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "F[0]-2"); break; |
| 577 | // | |
| 577 | // case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "B[0]-1"); break; | |
| 578 | 578 | } |
| 579 | 579 | } |
| r5932 | r5933 | |
|---|---|---|
| 87 | 87 | - bytes 08-0A: file extension, padedd with whitespaces |
| 88 | 88 | - byte 0B: file type |
| 89 | 89 | . 0 = BASIC, ASCII or binary program (B) |
| 90 | . 1 = BASIC or ASCII data (D) | |
| 91 | . 2 = machine code (M) | |
| 92 | . 3 = ASCII assembler file (A) | |
| 90 | . 1 = BASIC or ASCII data (D) | |
| 91 | . 2 = machine code (M) | |
| 92 | . 3 = ASCII assembler file (A) | |
| 93 | 93 | - byte 0C: format flag |
| 94 | | |
| 94 | . 00 = binary (tokenized) | |
| 95 | 95 | . ff = ASCII |
| 96 | 96 | - byte 0D: first block |
| 97 | 97 | - bytes 0E-0F: bytes used in the last sector |
| r5932 | r5933 | |
| 1438 | 1438 | if ( stream_read( org, &c, 1 ) < 1 ) break; |
| 1439 | 1439 | if ( c == 0 ) { |
| 1440 | 1440 | /* Sometimes, linelength seems wrong and we must rely on the fact that |
| 1441 | BASIC lines are 0-terminated. | |
| 1442 | At other times, there are 0 embedded within lines or extra stuff | |
| 1443 | between the 0 and the following line, and so, we must rely | |
| 1444 | on linelength to cut the line (!) | |
| 1445 | */ | |
| 1441 | BASIC lines are 0-terminated. | |
| 1442 | At other times, there are 0 embedded within lines or extra stuff | |
| 1443 | between the 0 and the following line, and so, we must rely | |
| 1444 | on linelength to cut the line (!) | |
| 1445 | */ | |
| 1446 | 1446 | if ( linelength > 256 ) break; |
| 1447 | 1447 | } |
| 1448 | 1448 | else if ( c == 0xff && ! in_str ) in_fun = 1; /* function prefix */ |
| r5932 | r5933 | |
|---|---|---|
| 371 | 371 | static int crt_image_create(const imgtool_module *mod, imgtool_stream *f, const ResolvedOption *_options); |
| 372 | 372 | |
| 373 | 373 | /* |
| 374 | IMAGE_USES_FTYPE|IMAGE_USES_FADDR|IMAGE_USES_FBANK | |
| 375 | |IMAGE_USES_HARDWARE_TYPE|IMAGE_USES_GAME_LINE | |
| 376 | |IMAGE_USES_EXROM_LINE|IMAGE_USES_LABEL, //flags | |
| 374 | IMAGE_USES_FTYPE|IMAGE_USES_FADDR|IMAGE_USES_FBANK | |
| 375 | |IMAGE_USES_HARDWARE_TYPE|IMAGE_USES_GAME_LINE | |
| 376 | |IMAGE_USES_EXROM_LINE|IMAGE_USES_LABEL, //flags | |
| 377 | 377 | */ |
| 378 | 378 | |
| 379 | 379 | static const struct OptionTemplate c64crt_fileeopts[] = |
| r5932 | r5933 | |
| 416 | 416 | crt_image_beginenum, /* begin enumeration */ |
| 417 | 417 | crt_image_nextenum, /* enumerate next */ |
| 418 | 418 | crt_image_closeenum, /* close enumeration */ |
| 419 | NULL, //crt_image_freespace, | |
| 419 | NULL, //crt_image_freespace, /* free space on image */ | |
| 420 | 420 | crt_image_readfile, /* read file */ |
| 421 | 421 | crt_image_writefile, /* write file */ |
| 422 | 422 | crt_image_deletefile, /* delete file */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | macbin.c | |
| 4 | 4 | |
| 5 | ||
| 5 | MacBinary filter for use with Mac and ProDOS drivers | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************** |
| 8 | 8 | |
| r5932 | r5933 | |
| 11 | 11 | Offset Length Description |
| 12 | 12 | ------ ------ ----------- |
| 13 | 13 | 0 1 [I] Magic byte (0x00) |
| 14 | ||
| 14 | 1 64 [I] File name (Pascal String) | |
| 15 | 15 | 65 4 [I] File Type Code |
| 16 | 69 4 [I] File Creator Code | |
| 17 | 73 1 [I] Finder Flags (bits 15-8) | |
| 18 | 74 1 [I] Magic byte (0x00) | |
| 19 | 75 2 [I] File Vertical Position | |
| 20 | 77 2 [I] File Horizontal Position | |
| 21 | 79 2 [I] Window/Folder ID | |
| 22 | 81 1 [I] Protected (bit 0) | |
| 23 | 82 1 [I] Magic byte (0x00) | |
| 24 | 83 4 [I] Data Fork Length | |
| 25 | 87 4 [I] Resource Fork Length | |
| 26 | 91 4 [I] Creation Date | |
| 27 | 95 4 [I] Last Modified Date | |
| 28 | 99 2 [I] "Get Info" comment length | |
| 16 | 69 4 [I] File Creator Code | |
| 17 | 73 1 [I] Finder Flags (bits 15-8) | |
| 18 | 74 1 [I] Magic byte (0x00) | |
| 19 | 75 2 [I] File Vertical Position | |
| 20 | 77 2 [I] File Horizontal Position | |
| 21 | 79 2 [I] Window/Folder ID | |
| 22 | 81 1 [I] Protected (bit 0) | |
| 23 | 82 1 [I] Magic byte (0x00) | |
| 24 | 83 4 [I] Data Fork Length | |
| 25 | 87 4 [I] Resource Fork Length | |
| 26 | 91 4 [I] Creation Date | |
| 27 | 95 4 [I] Last Modified Date | |
| 28 | 99 2 [I] "Get Info" comment length | |
| 29 | 29 | 101 1 [II] Finder Flags (bits 7-0) |
| 30 | 102 4 [III] MacBinary III Signature 'mBIN' | |
| 31 | 106 1 [III] Script of Filename | |
| 32 | 107 1 [III] Extended Finder Flags | |
| 33 | 116 4 [II] Unpacked Length | |
| 34 | 120 2 [II] Secondary Header Length | |
| 35 | 122 1 [II] MacBinary II Version Number (II: 0x81, III: 0x82) | |
| 36 | 123 1 [II] Minimum Compatible MacBinary II Version Number (0x81) | |
| 37 | 124 2 [II] CRC of previous 124 bytes | |
| 30 | 102 4 [III] MacBinary III Signature 'mBIN' | |
| 31 | 106 1 [III] Script of Filename | |
| 32 | 107 1 [III] Extended Finder Flags | |
| 33 | 116 4 [II] Unpacked Length | |
| 34 | 120 2 [II] Secondary Header Length | |
| 35 | 122 1 [II] MacBinary II Version Number (II: 0x81, III: 0x82) | |
| 36 | 123 1 [II] Minimum Compatible MacBinary II Version Number (0x81) | |
| 37 | 124 2 [II] CRC of previous 124 bytes | |
| 38 | 38 | |
| 39 | ||
| 39 | For more information, consult http://www.lazerware.com/formats/macbinary.html | |
| 40 | 40 | |
| 41 | TODO: I believe that the script code is some sort of identifier identifying | |
| 42 | the character set used for the filename. If this is true, we are not | |
| 43 | handling that properly | |
| 41 | TODO: I believe that the script code is some sort of identifier identifying | |
| 42 | the character set used for the filename. If this is true, we are not | |
| 43 | handling that properly | |
| 44 | 44 | |
| 45 | 45 | *****************************************************************************/ |
| 46 | 46 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Handlers for ti990 disk images | |
| 3 | 3 | |
| 4 | ||
| 4 | Disk images are in MESS format. | |
| 5 | 5 | |
| 6 | ||
| 6 | Raphael Nabet, 2003 | |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #include <stdio.h> |
| r5932 | r5933 | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /* |
| 75 | ||
| 75 | disk image header | |
| 76 | 76 | */ |
| 77 | 77 | typedef struct disk_image_header |
| 78 | 78 | { |
| r5932 | r5933 | |
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | 90 | /* |
| 91 | ||
| 91 | Disk structure: | |
| 92 | 92 | |
| 93 | Track 0 Sector 0: see below | |
| 94 | Track 0 Sector 1: list of bad ADU | |
| 95 | Track 0 Sector 2 through N: disk allocation bitmap | |
| 96 | Track 1 Sector 0 through N-2: optional disk program image loader | |
| 97 | Track 1 Sector N-1: copy of Track 0 Sector 0 | |
| 98 | Track 1 Sector N: copy of Track 0 Sector 1 | |
| 99 | Last cylinder has disagnostic information (reported as .S$DIAG) | |
| 100 | Remaining sectors are used for fdr and data. | |
| 93 | Track 0 Sector 0: see below | |
| 94 | Track 0 Sector 1: list of bad ADU | |
| 95 | Track 0 Sector 2 through N: disk allocation bitmap | |
| 96 | Track 1 Sector 0 through N-2: optional disk program image loader | |
| 97 | Track 1 Sector N-1: copy of Track 0 Sector 0 | |
| 98 | Track 1 Sector N: copy of Track 0 Sector 1 | |
| 99 | Last cylinder has disagnostic information (reported as .S$DIAG) | |
| 100 | Remaining sectors are used for fdr and data. | |
| 101 | 101 | */ |
| 102 | 102 | |
| 103 | 103 | /* |
| 104 | ||
| 104 | SC0 record (Disk sector 0) | |
| 105 | 105 | */ |
| 106 | 106 | typedef struct ti990_sc0 |
| 107 | 107 | { |
| r5932 | r5933 | |
| 144 | 144 | UINT16BE wff; /* WCS flag switch */ |
| 145 | 145 | UINT16BE vif; /* track 1 select flag (whatever it means) volume information copied flag */ |
| 146 | 146 | UINT16BE sta; /* state of disk: */ |
| 147 | /* 1 = disk surface has not been tested for defects */ | |
| 148 | /* 2 = disk surface has been tested, but no file system has been installed */ | |
| 149 | /* 3 = a file system has been installed */ | |
| 147 | /* 1 = disk surface has not been tested for defects */ | |
| 148 | /* 2 = disk surface has been tested, but no file system has been installed */ | |
| 149 | /* 3 = a file system has been installed */ | |
| 150 | 150 | UINT16BE dct; /* disk creation time */ |
| 151 | 151 | UINT16BE fsf; /* * * RESERVED * * */ |
| 152 | 152 | /* SCOSIZ = >AA */ |
| 153 | 153 | } ti990_sc0; |
| 154 | 154 | |
| 155 | 155 | /* |
| 156 | ||
| 156 | DOR (Directory Overhead Record) | |
| 157 | 157 | */ |
| 158 | 158 | typedef struct ti990_dor |
| 159 | 159 | { |
| r5932 | r5933 | |
| 169 | 169 | } ti990_dor; |
| 170 | 170 | |
| 171 | 171 | /* |
| 172 | ||
| 172 | file flags found in fdr | |
| 173 | 173 | */ |
| 174 | 174 | enum |
| 175 | 175 | { |
| r5932 | r5933 | |
| 198 | 198 | }; |
| 199 | 199 | |
| 200 | 200 | /* |
| 201 | ||
| 201 | ACE subrecord found in FDR | |
| 202 | 202 | */ |
| 203 | 203 | typedef struct ti990_ace |
| 204 | 204 | { |
| r5932 | r5933 | |
| 207 | 207 | } ti990_ace; |
| 208 | 208 | |
| 209 | 209 | /* |
| 210 | ||
| 210 | FDR record | |
| 211 | 211 | */ |
| 212 | 212 | typedef struct ti990_fdr |
| 213 | 213 | { |
| r5932 | r5933 | |
| 248 | 248 | } ti990_fdr; |
| 249 | 249 | |
| 250 | 250 | /* |
| 251 | ||
| 251 | ADR record: variant of FDR for Aliases | |
| 252 | 252 | |
| 253 | The fields marked here with *** are in the ADR template to maintain | |
| 254 | compatability with the FDR template. | |
| 253 | The fields marked here with *** are in the ADR template to maintain | |
| 254 | compatability with the FDR template. | |
| 255 | 255 | */ |
| 256 | 256 | typedef struct ti990_adr |
| 257 | 257 | { |
| r5932 | r5933 | |
| 271 | 271 | } ti990_adr; |
| 272 | 272 | |
| 273 | 273 | /* |
| 274 | ||
| 274 | CDR record: variant of FDR for Channel | |
| 275 | 275 | |
| 276 | The CDR is the permanent record of a channel. It is carried as an alias | |
| 277 | of the program file in which the channel owner task resides. | |
| 276 | The CDR is the permanent record of a channel. It is carried as an alias | |
| 277 | of the program file in which the channel owner task resides. | |
| 278 | 278 | */ |
| 279 | 279 | typedef struct ti990_cdr |
| 280 | 280 | { |
| r5932 | r5933 | |
| 300 | 300 | } ti990_cdr; |
| 301 | 301 | |
| 302 | 302 | /* |
| 303 | Based on contents of the flags field, catalog entries may be either an FDR, | |
| 304 | an ADR or a CDR. | |
| 303 | Based on contents of the flags field, catalog entries may be either an FDR, | |
| 304 | an ADR or a CDR. | |
| 305 | 305 | |
| 306 | They may be a KDR, too, but confusion is impossible because the KDR FILL00 | |
| 307 | field starts at offset 4, and therefore if we try to interpret a KDR as an | |
| 308 | FDR (or ADR, CDR), we will find fnm[0] and assume the FDR is empty. | |
| 306 | They may be a KDR, too, but confusion is impossible because the KDR FILL00 | |
| 307 | field starts at offset 4, and therefore if we try to interpret a KDR as an | |
| 308 | FDR (or ADR, CDR), we will find fnm[0] and assume the FDR is empty. | |
| 309 | 309 | */ |
| 310 | 310 | typedef union directory_entry |
| 311 | 311 | { |
| r5932 | r5933 | |
| 317 | 317 | #if 0 |
| 318 | 318 | |
| 319 | 319 | /* |
| 320 | ||
| 320 | tifile header: stand-alone file | |
| 321 | 321 | */ |
| 322 | 322 | typedef struct tifile_header |
| 323 | 323 | { |
| r5932 | r5933 | |
| 335 | 335 | |
| 336 | 336 | |
| 337 | 337 | /* |
| 338 | ||
| 338 | catalog entry (used for in-memory catalog) | |
| 339 | 339 | */ |
| 340 | 340 | typedef struct catalog_entry |
| 341 | 341 | { |
| r5932 | r5933 | |
| 346 | 346 | #endif |
| 347 | 347 | |
| 348 | 348 | /* |
| 349 | ||
| 349 | Disk geometry | |
| 350 | 350 | */ |
| 351 | 351 | typedef struct ti990_geometry |
| 352 | 352 | { |
| r5932 | r5933 | |
| 354 | 354 | } ti990_geometry; |
| 355 | 355 | |
| 356 | 356 | /* |
| 357 | ||
| 357 | Physical sector address | |
| 358 | 358 | */ |
| 359 | 359 | typedef struct ti990_phys_sec_address |
| 360 | 360 | { |
| r5932 | r5933 | |
| 364 | 364 | } ti990_phys_sec_address; |
| 365 | 365 | |
| 366 | 366 | /* |
| 367 | ||
| 367 | ti99 disk image descriptor | |
| 368 | 368 | */ |
| 369 | 369 | typedef struct ti990_image |
| 370 | 370 | { |
| r5932 | r5933 | |
| 374 | 374 | } ti990_image; |
| 375 | 375 | |
| 376 | 376 | /* |
| 377 | ||
| 377 | ti990 catalog iterator, used when imgtool reads the catalog | |
| 378 | 378 | */ |
| 379 | 379 | typedef struct ti990_iterator |
| 380 | 380 | { |
| r5932 | r5933 | |
| 410 | 410 | }; |
| 411 | 411 | |
| 412 | 412 | static OPTION_GUIDE_START( ti990_create_optionguide ) |
| 413 | /*OPTION_STRING(ti990_createopts_volname, "label", | |
| 413 | /*OPTION_STRING(ti990_createopts_volname, "label", "Volume name" )*/ | |
| 414 | 414 | OPTION_INT(ti990_createopts_cylinders, "cylinders", "Cylinders" ) |
| 415 | 415 | OPTION_INT(ti990_createopts_heads, "heads", "Heads" ) |
| 416 | 416 | OPTION_INT(ti990_createopts_sectors, "sectors", "Sectors" ) |
| r5932 | r5933 | |
| 449 | 449 | |
| 450 | 450 | #ifdef UNUSED_FUNCTION |
| 451 | 451 | /* |
| 452 | ||
| 452 | Convert a C string to a 8-character file name (padded with spaces if necessary) | |
| 453 | 453 | */ |
| 454 | 454 | static void str_to_fname(char dst[8], const char *src) |
| 455 | 455 | { |
| r5932 | r5933 | |
| 476 | 476 | #endif |
| 477 | 477 | |
| 478 | 478 | /* |
| 479 | ||
| 479 | Convert a 8-character file name to a C string (removing trailing spaces if necessary) | |
| 480 | 480 | */ |
| 481 | 481 | static void fname_to_str(char *dst, const char src[8], int n) |
| 482 | 482 | { |
| r5932 | r5933 | |
| 510 | 510 | #endif |
| 511 | 511 | |
| 512 | 512 | /* |
| 513 | ||
| 513 | Convert physical sector address to offset | |
| 514 | 514 | */ |
| 515 | 515 | static unsigned phys_address_to_offset(const ti990_phys_sec_address *address, const ti990_geometry *geometry) |
| 516 | 516 | { |
| r5932 | r5933 | |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | /* |
| 526 | ||
| 526 | Read one sector from a disk image | |
| 527 | 527 | |
| 528 | file_handle: imgtool file handle | |
| 529 | address: physical sector address | |
| 530 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 531 | dest: pointer to destination buffer | |
| 532 | len: lenght of data to read | |
| 528 | file_handle: imgtool file handle | |
| 529 | address: physical sector address | |
| 530 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 531 | dest: pointer to destination buffer | |
| 532 | len: lenght of data to read | |
| 533 | 533 | */ |
| 534 | 534 | static int read_sector_physical_len(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest, int len) |
| 535 | 535 | { |
| r5932 | r5933 | |
| 552 | 552 | |
| 553 | 553 | #ifdef UNUSED_FUNCTION |
| 554 | 554 | /* |
| 555 | ||
| 555 | Read one sector from a disk image | |
| 556 | 556 | |
| 557 | file_handle: imgtool file handle | |
| 558 | address: physical sector address | |
| 559 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 560 | dest: pointer to a destination buffer of geometry->bytes_per_sector bytes | |
| 557 | file_handle: imgtool file handle | |
| 558 | address: physical sector address | |
| 559 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 560 | dest: pointer to a destination buffer of geometry->bytes_per_sector bytes | |
| 561 | 561 | */ |
| 562 | 562 | static int read_sector_physical(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest) |
| 563 | 563 | { |
| r5932 | r5933 | |
| 566 | 566 | #endif |
| 567 | 567 | |
| 568 | 568 | /* |
| 569 | ||
| 569 | Write one sector to a disk image | |
| 570 | 570 | |
| 571 | file_handle: imgtool file handle | |
| 572 | address: physical sector address | |
| 573 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 574 | src: pointer to source buffer | |
| 575 | len: lenght of source buffer | |
| 571 | file_handle: imgtool file handle | |
| 572 | address: physical sector address | |
| 573 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 574 | src: pointer to source buffer | |
| 575 | len: lenght of source buffer | |
| 576 | 576 | */ |
| 577 | 577 | 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) |
| 578 | 578 | { |
| r5932 | r5933 | |
| 603 | 603 | |
| 604 | 604 | #ifdef UNUSED_FUNCTION |
| 605 | 605 | /* |
| 606 | ||
| 606 | Write one sector to a disk image | |
| 607 | 607 | |
| 608 | file_handle: imgtool file handle | |
| 609 | address: physical sector address | |
| 610 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 611 | dest: pointer to a source buffer of geometry->bytes_per_sector bytes | |
| 608 | file_handle: imgtool file handle | |
| 609 | address: physical sector address | |
| 610 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 611 | dest: pointer to a source buffer of geometry->bytes_per_sector bytes | |
| 612 | 612 | */ |
| 613 | 613 | static int write_sector_physical(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src) |
| 614 | 614 | { |
| r5932 | r5933 | |
| 617 | 617 | #endif |
| 618 | 618 | |
| 619 | 619 | /* |
| 620 | ||
| 620 | Convert logical sector address to physical sector address | |
| 621 | 621 | */ |
| 622 | 622 | static void log_address_to_phys_address(int secnum, const ti990_geometry *geometry, ti990_phys_sec_address *address) |
| 623 | 623 | { |
| r5932 | r5933 | |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | /* |
| 631 | ||
| 631 | Read one sector from a disk image | |
| 632 | 632 | |
| 633 | file_handle: imgtool file handle | |
| 634 | secnum: logical sector address | |
| 635 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 636 | dest: pointer to destination buffer | |
| 637 | len: lenght of data to read | |
| 633 | file_handle: imgtool file handle | |
| 634 | secnum: logical sector address | |
| 635 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 636 | dest: pointer to destination buffer | |
| 637 | len: lenght of data to read | |
| 638 | 638 | */ |
| 639 | 639 | static int read_sector_logical_len(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest, int len) |
| 640 | 640 | { |
| r5932 | r5933 | |
| 648 | 648 | |
| 649 | 649 | #ifdef UNUSED_FUNCTION |
| 650 | 650 | /* |
| 651 | ||
| 651 | Read one sector from a disk image | |
| 652 | 652 | |
| 653 | file_handle: imgtool file handle | |
| 654 | secnum: logical sector address | |
| 655 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 656 | dest: pointer to a destination buffer of geometry->bytes_per_sector bytes | |
| 653 | file_handle: imgtool file handle | |
| 654 | secnum: logical sector address | |
| 655 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 656 | dest: pointer to a destination buffer of geometry->bytes_per_sector bytes | |
| 657 | 657 | */ |
| 658 | 658 | static int read_sector_logical(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest) |
| 659 | 659 | { |
| r5932 | r5933 | |
| 662 | 662 | #endif |
| 663 | 663 | |
| 664 | 664 | /* |
| 665 | ||
| 665 | Write one sector to a disk image | |
| 666 | 666 | |
| 667 | file_handle: imgtool file handle | |
| 668 | secnum: logical sector address | |
| 669 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 670 | src: pointer to source buffer | |
| 671 | len: lenght of source buffer | |
| 667 | file_handle: imgtool file handle | |
| 668 | secnum: logical sector address | |
| 669 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 670 | src: pointer to source buffer | |
| 671 | len: lenght of source buffer | |
| 672 | 672 | */ |
| 673 | 673 | static int write_sector_logical_len(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, const void *src, int len) |
| 674 | 674 | { |
| r5932 | r5933 | |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /* |
| 684 | ||
| 684 | Write one sector to a disk image | |
| 685 | 685 | |
| 686 | file_handle: imgtool file handle | |
| 687 | secnum: logical sector address | |
| 688 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 689 | dest: pointer to a source buffer of geometry->bytes_per_sector bytes | |
| 686 | file_handle: imgtool file handle | |
| 687 | secnum: logical sector address | |
| 688 | geometry: disk geometry (sectors per track, tracks per side, sides) | |
| 689 | dest: pointer to a source buffer of geometry->bytes_per_sector bytes | |
| 690 | 690 | */ |
| 691 | 691 | static int write_sector_logical(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, const void *src) |
| 692 | 692 | { |
| r5932 | r5933 | |
| 700 | 700 | |
| 701 | 701 | #ifdef UNUSED_FUNCTION |
| 702 | 702 | /* |
| 703 | ||
| 703 | Find the catalog entry and fdr record associated with a file name | |
| 704 | 704 | |
| 705 | image: ti990_image image record | |
| 706 | fpath: path of the file to search | |
| 707 | fdr: pointer to buffer where the fdr record should be stored (may be NULL) | |
| 708 | catalog_index: on output, index of file catalog entry (may be NULL) | |
| 709 | out_fdr_secnum: on output, sector address of the fdr (may be NULL) | |
| 710 | out_parent_fdr_secnum: on output, sector offset of the fdr for the parent | |
| 711 | directory fdr (-1 if root) (may be NULL) | |
| 705 | image: ti990_image image record | |
| 706 | fpath: path of the file to search | |
| 707 | fdr: pointer to buffer where the fdr record should be stored (may be NULL) | |
| 708 | catalog_index: on output, index of file catalog entry (may be NULL) | |
| 709 | out_fdr_secnum: on output, sector address of the fdr (may be NULL) | |
| 710 | out_parent_fdr_secnum: on output, sector offset of the fdr for the parent | |
| 711 | directory fdr (-1 if root) (may be NULL) | |
| 712 | 712 | */ |
| 713 | 713 | 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) |
| 714 | 714 | { |
| r5932 | r5933 | |
| 836 | 836 | |
| 837 | 837 | #if 0 |
| 838 | 838 | /* |
| 839 | ||
| 839 | Allocate one sector on disk, for use as a fdr record | |
| 840 | 840 | |
| 841 | image: ti99_image image record | |
| 842 | fdr_secnum: on output, logical address of a free sector | |
| 841 | image: ti99_image image record | |
| 842 | fdr_secnum: on output, logical address of a free sector | |
| 843 | 843 | */ |
| 844 | 844 | static int alloc_fdr_sector(ti99_image *image, int *fdr_secnum) |
| 845 | 845 | { |
| r5932 | r5933 | |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | 864 | /* |
| 865 | ||
| 865 | Extend a file with nb_alloc_sectors extra sectors | |
| 866 | 866 | |
| 867 | image: ti99_image image record | |
| 868 | fdr: file fdr record | |
| 869 | nb_alloc_sectors: number of sectors to allocate | |
| 867 | image: ti99_image image record | |
| 868 | fdr: file fdr record | |
| 869 | nb_alloc_sectors: number of sectors to allocate | |
| 870 | 870 | */ |
| 871 | 871 | static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sectors) |
| 872 | 872 | { |
| r5932 | r5933 | |
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | /* |
| 1035 | ||
| 1035 | Allocate a new (empty) file | |
| 1036 | 1036 | */ |
| 1037 | 1037 | static int new_file(ti99_image *image, char filename[10], int *out_fdr_secnum/*, ti99_fdr *fdr,*/) |
| 1038 | 1038 | { |
| r5932 | r5933 | |
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | /* |
| 1088 | ||
| 1088 | Compare two (possibly empty) catalog entry for qsort | |
| 1089 | 1089 | */ |
| 1090 | 1090 | static int qsort_catalog_compare(const void *p1, const void *p2) |
| 1091 | 1091 | { |
| r5932 | r5933 | |
| 1104 | 1104 | #endif |
| 1105 | 1105 | |
| 1106 | 1106 | /* |
| 1107 | ||
| 1107 | Open a file as a ti990_image. | |
| 1108 | 1108 | */ |
| 1109 | 1109 | static imgtoolerr_t ti990_image_init(imgtool_image *img, imgtool_stream *f) |
| 1110 | 1110 | { |
| r5932 | r5933 | |
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | 1162 | /* |
| 1163 | ||
| 1163 | close a ti990_image | |
| 1164 | 1164 | */ |
| 1165 | 1165 | static void ti990_image_exit(imgtool_image *img) |
| 1166 | 1166 | { |
| r5932 | r5933 | |
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | /* |
| 1172 | ||
| 1172 | get basic information on a ti990_image | |
| 1173 | 1173 | |
| 1174 | ||
| 1174 | Currently returns the volume name | |
| 1175 | 1175 | */ |
| 1176 | 1176 | static void ti990_image_info(imgtool_image *img, char *string, size_t len) |
| 1177 | 1177 | { |
| r5932 | r5933 | |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /* |
| 1187 | ||
| 1187 | Open the disk catalog for enumeration | |
| 1188 | 1188 | */ |
| 1189 | 1189 | static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 1190 | 1190 | { |
| r5932 | r5933 | |
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | /* |
| 1213 | ||
| 1213 | Enumerate disk catalog next entry | |
| 1214 | 1214 | */ |
| 1215 | 1215 | static imgtoolerr_t ti990_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) |
| 1216 | 1216 | { |
| r5932 | r5933 | |
| 1390 | 1390 | iter->nrc[iter->level] = get_UINT16BE(dor.nrc)/*get_UINT32BE(iter->fdr[iter->level-1].eom)-1*/; |
| 1391 | 1391 | iter->index[iter->level] = 0; |
| 1392 | 1392 | /*if (get_UINT16BE(dor.nrc) != (get_UINT32BE(iter->xdr[iter->level-1].fdr.eom)-1)) |
| 1393 | ||
| 1393 | printf("hiha");*/ | |
| 1394 | 1394 | } |
| 1395 | 1395 | |
| 1396 | 1396 | /* go to upper level if applicable */ |
| r5932 | r5933 | |
| 1402 | 1402 | } |
| 1403 | 1403 | |
| 1404 | 1404 | /* |
| 1405 | ||
| 1405 | Free enumerator | |
| 1406 | 1406 | */ |
| 1407 | 1407 | static void ti990_image_closeenum(imgtool_directory *enumeration) |
| 1408 | 1408 | { |
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | 1411 | /* |
| 1412 | ||
| 1412 | Compute free space on disk image (in ADUs) | |
| 1413 | 1413 | */ |
| 1414 | 1414 | static imgtoolerr_t ti990_image_freespace(imgtool_partition *partition, UINT64 *size) |
| 1415 | 1415 | { |
| r5932 | r5933 | |
| 1449 | 1449 | |
| 1450 | 1450 | #ifdef UNUSED_FUNCTION |
| 1451 | 1451 | /* |
| 1452 | ||
| 1452 | Extract a file from a ti990_image. | |
| 1453 | 1453 | */ |
| 1454 | 1454 | static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const char *fpath, imgtool_stream *destf) |
| 1455 | 1455 | { |
| r5932 | r5933 | |
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | 1548 | /* |
| 1549 | ||
| 1549 | Add a file to a ti990_image. | |
| 1550 | 1550 | */ |
| 1551 | 1551 | static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const char *fpath, imgtool_stream *sourcef, option_resolution *writeoptions) |
| 1552 | 1552 | { |
| r5932 | r5933 | |
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | /* |
| 1673 | ||
| 1673 | Delete a file from a ti990_image. | |
| 1674 | 1674 | */ |
| 1675 | 1675 | static imgtoolerr_t ti990_image_deletefile(imgtool_partition *partition, const char *fpath) |
| 1676 | 1676 | { |
| r5932 | r5933 | |
| 1760 | 1760 | #endif |
| 1761 | 1761 | |
| 1762 | 1762 | /* |
| 1763 | ||
| 1763 | Create a blank ti990_image. | |
| 1764 | 1764 | */ |
| 1765 | 1765 | static imgtoolerr_t ti990_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions) |
| 1766 | 1766 | { |
| r5932 | r5933 | |
|---|---|---|
| 44 | 44 | ) |
| 45 | 45 | |
| 46 | 46 | /* |
| 47 | ||
| 47 | NC PCMCIA RAM Card uses a FAT-like filesystem | |
| 48 | 48 | |
| 49 | ||
| 49 | Blocks are fixed at 256 bytes in size. | |
| 50 | 50 | |
| 51 | ||
| 51 | Block 0 and Block 1 are reserved for a boot program. | |
| 52 | 52 | |
| 53 | ||
| 53 | Block 2 is reserved for root directory. | |
| 54 | 54 | |
| 55 | ||
| 55 | Block 3..(3+num_fat_blocks-1) are reserved for fat table. | |
| 56 | 56 | |
| 57 | ||
| 57 | Block (3+num_fat_blocks).. are used for data storage. | |
| 58 | 58 | |
| 59 | ||
| 59 | The FAT table uses two bytes for each entry. | |
| 60 | 60 | |
| 61 | The blocks used by a file are stored in the table in a link-list | |
| 62 | structure. | |
| 61 | The blocks used by a file are stored in the table in a link-list | |
| 62 | structure. | |
| 63 | 63 | |
| 64 | The index of the first block is stored in the directory entry. | |
| 65 | This entry is looked up in the FAT table. If the entry contains | |
| 66 | another number (other than 0x0ffff and 0x0fffe), this is the next | |
| 67 | block used by the file. If the number is 0x0ffff this means this | |
| 68 | block is the last used by the file. | |
| 64 | The index of the first block is stored in the directory entry. | |
| 65 | This entry is looked up in the FAT table. If the entry contains | |
| 66 | another number (other than 0x0ffff and 0x0fffe), this is the next | |
| 67 | block used by the file. If the number is 0x0ffff this means this | |
| 68 | block is the last used by the file. | |
| 69 | 69 | |
| 70 | ||
| 70 | 0x0fffe indicates a reserved block. | |
| 71 | 71 | |
| 72 | The maximum supported PCMCIA Ram card size is 1mb, and there are | |
| 73 | 4096 256-byte blocks on each card. Therefore a FAT entry uses 12-bits | |
| 74 | to store the block index, leaving the top 4-bits as a status?? | |
| 72 | The maximum supported PCMCIA Ram card size is 1mb, and there are | |
| 73 | 4096 256-byte blocks on each card. Therefore a FAT entry uses 12-bits | |
| 74 | to store the block index, leaving the top 4-bits as a status?? | |
| 75 | 75 | |
| 76 | ||
| 76 | Maximum size of a file on the PCMCIA Ram card is 65536 bytes. | |
| 77 | 77 | */ |
| 78 | 78 | struct nc_card_dir_entry |
| 79 | 79 | { |
| r5932 | r5933 | |
| 90 | 90 | /* format unknown */ |
| 91 | 91 | unsigned char packed_date[4]; |
| 92 | 92 | /* 2-byte block index. first block used by file, other blocks |
| 93 | ||
| 93 | found in fat table */ | |
| 94 | 94 | unsigned char first_block_low; |
| 95 | 95 | unsigned char first_block_high; |
| 96 | 96 | /* unused?? */ |
| r5932 | r5933 | |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /* out of entries within current blocks occupied by directory. |
| 235 | ||
| 235 | try to expand directory by one more block */ | |
| 236 | 236 | |
| 237 | 237 | current_block = memcard_fat_get_free_block(memcard); |
| 238 | 238 | |
| r5932 | r5933 | |
| 259 | 259 | |
| 260 | 260 | /* clear block */ |
| 261 | 261 | /* only really necessary to clear first byte of each dir entry - but I'll clear |
| 262 | ||
| 262 | it all to give decent compressable cards */ | |
| 263 | 263 | memset(&memcard->memcard_data[block_offset], 0, NC_BLOCK_SIZE); |
| 264 | 264 | |
| 265 | 265 | /* setup fat */ |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | count of entries |
| 19 | 19 | name 0x13 |
| 20 | string blocks 0x13 | |
| 21 | char type 0x13 | |
| 22 | string bytes_in_last_block 0x13 | |
| 20 | string blocks 0x13 | |
| 21 | char type 0x13 | |
| 22 | string bytes_in_last_block 0x13 | |
| 23 | 23 | |
| 24 | 24 | data for the entries |
| 25 | 25 | filled up to 254 byte blocks |
| r5932 | r5933 | |
| 65 | 65 | 0, /* flags */ |
| 66 | 66 | lynx_image_init, /* init function */ |
| 67 | 67 | lynx_image_exit, /* exit function */ |
| 68 | NULL,//lynx_image_info, | |
| 68 | NULL,//lynx_image_info, /* info function */ | |
| 69 | 69 | lynx_image_beginenum, /* begin enumeration */ |
| 70 | 70 | lynx_image_nextenum, /* enumerate next */ |
| 71 | 71 | lynx_image_closeenum, /* close enumeration */ |
| r5932 | r5933 | |
|---|---|---|
| 850 | 850 | ent->eof=0; |
| 851 | 851 | |
| 852 | 852 | while ((iter->track >= 1) && (iter->track <= iter->image->tracks)) //safer |
| 853 | // | |
| 853 | // while (iter->track != 0) | |
| 854 | 854 | { |
| 855 | 855 | pos = iter->image->get_offset(iter->track, iter->sector); |
| 856 | 856 | for (; iter->offset<256; iter->offset += 32) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | macutil.c | |
| 4 | 4 | |
| 5 | Imgtool Utility code for manipulating certain Apple/Mac data structures | |
| 6 | and conventions | |
| 5 | Imgtool Utility code for manipulating certain Apple/Mac data structures | |
| 6 | and conventions | |
| 7 | 7 | |
| 8 | 8 | *****************************************************************************/ |
| 9 | 9 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | mac.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Handlers for Classic MacOS images (MFS and HFS formats). | |
| 6 | 6 | |
| 7 | ||
| 7 | Raphael Nabet, 2003 | |
| 8 | 8 | |
| 9 | TODO: | |
| 10 | * add support for HFS write | |
| 9 | TODO: | |
| 10 | * add support for HFS write | |
| 11 | 11 | |
| 12 | 12 | ***************************************************************************** |
| 13 | 13 | |
| 14 | terminology: | |
| 15 | disk block: 512-byte logical block. With sectors of 512 bytes, one logical | |
| 16 | block is equivalent to one sector; when the sector size is not 512 | |
| 17 | bytes, sectors are split or grouped to make 512-byte disk blocks. | |
| 18 | allocation block: The File Manager always allocates logical disk blocks to | |
| 19 | a file in groups called allocation blocks; an allocation block is | |
| 20 | simply a group of consecutive logical blocks. The size of a volume's | |
| 21 | allocation blocks depends on the capacity of the volume; there can be | |
| 22 | at most 4094 (MFS) or 65535 (HFS) allocation blocks on a volume. | |
| 23 | MFS (Macintosh File System): File system used by the early Macintosh. This | |
| 24 | File system does not support folders (you may create folders on a MFS | |
| 25 | disk, but such folders are not implemented on File System level but in | |
| 26 | the Desktop file, and they are just a hint of how programs should list | |
| 27 | files, i.e. you can't have two files with the same name on a volume | |
| 28 | even if they are in two different folders), and it is not adequate for | |
| 29 | large volumes. | |
| 30 | HFS (Hierarchical File System): File system introduced with the HD20 | |
| 31 | harddisk, the Macintosh Plus ROMs, and system 3.2 (IIRC). Contrary to | |
| 32 | MFS, it supports hierarchical folders. Also, it is suitable for larger | |
| 33 | volumes. | |
| 34 | HFS+ (HFS Plus): New file system introduced with MacOS 8.1. It has a lot | |
| 35 | in common with HFS, but it supports more allocation blocks (up to 4 | |
| 36 | billions IIRC), and many extra features, including longer file names | |
| 37 | (up to 255 UTF-16 Unicode chars). | |
| 38 | tag data: with the GCR encoding, each disk block is associated with a 12 | |
| 39 | (3.5" floppies) or 20 (HD20) byte tag record. This tag record contains | |
| 40 | information on the block allocation status (whether it is allocated | |
| 41 | in a file or free, which file is it belongs to, what offset the block | |
| 42 | has in the file). This enables to recover all files whose data blocks | |
| 43 | are still on the disk surface even if the disk catalog has been trashed | |
| 44 | completely (though most file properties, like the name, type and | |
| 45 | logical EOF, are not saved in the tag record and cannot be recovered). | |
| 14 | terminology: | |
| 15 | disk block: 512-byte logical block. With sectors of 512 bytes, one logical | |
| 16 | block is equivalent to one sector; when the sector size is not 512 | |
| 17 | bytes, sectors are split or grouped to make 512-byte disk blocks. | |
| 18 | allocation block: The File Manager always allocates logical disk blocks to | |
| 19 | a file in groups called allocation blocks; an allocation block is | |
| 20 | simply a group of consecutive logical blocks. The size of a volume's | |
| 21 | allocation blocks depends on the capacity of the volume; there can be | |
| 22 | at most 4094 (MFS) or 65535 (HFS) allocation blocks on a volume. | |
| 23 | MFS (Macintosh File System): File system used by the early Macintosh. This | |
| 24 | File system does not support folders (you may create folders on a MFS | |
| 25 | disk, but such folders are not implemented on File System level but in | |
| 26 | the Desktop file, and they are just a hint of how programs should list | |
| 27 | files, i.e. you can't have two files with the same name on a volume | |
| 28 | even if they are in two different folders), and it is not adequate for | |
| 29 | large volumes. | |
| 30 | HFS (Hierarchical File System): File system introduced with the HD20 | |
| 31 | harddisk, the Macintosh Plus ROMs, and system 3.2 (IIRC). Contrary to | |
| 32 | MFS, it supports hierarchical folders. Also, it is suitable for larger | |
| 33 | volumes. | |
| 34 | HFS+ (HFS Plus): New file system introduced with MacOS 8.1. It has a lot | |
| 35 | in common with HFS, but it supports more allocation blocks (up to 4 | |
| 36 | billions IIRC), and many extra features, including longer file names | |
| 37 | (up to 255 UTF-16 Unicode chars). | |
| 38 | tag data: with the GCR encoding, each disk block is associated with a 12 | |
| 39 | (3.5" floppies) or 20 (HD20) byte tag record. This tag record contains | |
| 40 | information on the block allocation status (whether it is allocated | |
| 41 | in a file or free, which file is it belongs to, what offset the block | |
| 42 | has in the file). This enables to recover all files whose data blocks | |
| 43 | are still on the disk surface even if the disk catalog has been trashed | |
| 44 | completely (though most file properties, like the name, type and | |
| 45 | logical EOF, are not saved in the tag record and cannot be recovered). | |
| 46 | 46 | |
| 47 | ||
| 47 | Organization of an MFS volume: | |
| 48 | 48 | |
| 49 | Logical Contents Allocation block | |
| 50 | block | |
| 49 | Logical Contents Allocation block | |
| 50 | block | |
| 51 | 51 | |
| 52 | 0 - 1: System startup information | |
| 53 | 2 - m: Master directory block (MDB) | |
| 54 | + allocation block link pointers | |
| 55 | m+1 - n: Directory file | |
| 56 | n+1 - p-2: Other files and free space 0 - ((p-2)-(n+1))/k | |
| 57 | p-1: Alternate MDB | |
| 58 | p: Not used | |
| 59 | usually, k = 2, m = 3, n = 16, p = 799 (SSDD 3.5" floppy) | |
| 60 | with DSDD 3.5" floppy, I assume that p = 1599, but I don't know the other | |
| 61 | values | |
| 52 | 0 - 1: System startup information | |
| 53 | 2 - m: Master directory block (MDB) | |
| 54 | + allocation block link pointers | |
| 55 | m+1 - n: Directory file | |
| 56 | n+1 - p-2: Other files and free space 0 - ((p-2)-(n+1))/k | |
| 57 | p-1: Alternate MDB | |
| 58 | p: Not used | |
| 59 | usually, k = 2, m = 3, n = 16, p = 799 (SSDD 3.5" floppy) | |
| 60 | with DSDD 3.5" floppy, I assume that p = 1599, but I don't know the other | |
| 61 | values | |
| 62 | 62 | |
| 63 | 63 | |
| 64 | ||
| 64 | Master Directory Block: | |
| 65 | 65 | |
| 66 | Offset Length Description | |
| 67 | ------ ------ ----------- | |
| 68 | 0 2 Volume Signature | |
| 69 | 2 4 Creation Date | |
| 70 | 6 4 Last Modification Date | |
| 71 | 10 2 Volume Attributes | |
| 72 | 12 2 Number of Files In Root Directory | |
| 73 | 14 2 First Block of Volume Bitmap | |
| 74 | ... | |
| 66 | Offset Length Description | |
| 67 | ------ ------ ----------- | |
| 68 | 0 2 Volume Signature | |
| 69 | 2 4 Creation Date | |
| 70 | 6 4 Last Modification Date | |
| 71 | 10 2 Volume Attributes | |
| 72 | 12 2 Number of Files In Root Directory | |
| 73 | 14 2 First Block of Volume Bitmap | |
| 74 | ... | |
| 75 | 75 | |
| 76 | Links: | |
| 77 | http://developer.apple.com/documentation/mac/Files/Files-99.html | |
| 78 | http://developer.apple.com/documentation/mac/Files/Files-100.html | |
| 79 | http://developer.apple.com/documentation/mac/Files/Files-101.html | |
| 80 | http://developer.apple.com/documentation/mac/Files/Files-102.html | |
| 81 | http://developer.apple.com/documentation/mac/Files/Files-103.html | |
| 82 | http://developer.apple.com/documentation/mac/Files/Files-104.html | |
| 83 | http://developer.apple.com/documentation/mac/Files/Files-105.html | |
| 84 | http://developer.apple.com/documentation/mac/Files/Files-106.html | |
| 85 | http://developer.apple.com/documentation/mac/Devices/Devices-121.html#MARKER-2-169 | |
| 86 | http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html | |
| 76 | Links: | |
| 77 | http://developer.apple.com/documentation/mac/Files/Files-99.html | |
| 78 | http://developer.apple.com/documentation/mac/Files/Files-100.html | |
| 79 | http://developer.apple.com/documentation/mac/Files/Files-101.html | |
| 80 | http://developer.apple.com/documentation/mac/Files/Files-102.html | |
| 81 | http://developer.apple.com/documentation/mac/Files/Files-103.html | |
| 82 | http://developer.apple.com/documentation/mac/Files/Files-104.html | |
| 83 | http://developer.apple.com/documentation/mac/Files/Files-105.html | |
| 84 | http://developer.apple.com/documentation/mac/Files/Files-106.html | |
| 85 | http://developer.apple.com/documentation/mac/Devices/Devices-121.html#MARKER-2-169 | |
| 86 | http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html | |
| 87 | 87 | |
| 88 | 88 | *****************************************************************************/ |
| 89 | 89 | |
| r5932 | r5933 | |
| 100 | 100 | #include "formats/ap_dsk35.h" |
| 101 | 101 | |
| 102 | 102 | /* if 1, check consistency of B-Tree (most of the checks will eventually be |
| 103 | suppressed when the image is opened as read-only and only enabled when | |
| 104 | the image is opened as read/write) */ | |
| 103 | suppressed when the image is opened as read-only and only enabled when | |
| 104 | the image is opened as read/write) */ | |
| 105 | 105 | #define BTREE_CHECKS 1 |
| 106 | 106 | /* if 1, check consistency of tag data when we are at risk of corrupting the |
| 107 | ||
| 107 | disk (file write and allocation) */ | |
| 108 | 108 | #define TAG_CHECKS 1 |
| 109 | 109 | /* if 1, check consistency of tag data when reading files (not recommended |
| 110 | ||
| 110 | IMHO) */ | |
| 111 | 111 | #define TAG_EXTRA_CHECKS 0 |
| 112 | 112 | |
| 113 | 113 | #if 0 |
| r5932 | r5933 | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /* |
| 169 | ||
| 169 | Macintosh string: first byte is length | |
| 170 | 170 | */ |
| 171 | 171 | typedef UINT8 mac_str27[28]; |
| 172 | 172 | typedef UINT8 mac_str31[32]; |
| r5932 | r5933 | |
| 174 | 174 | typedef UINT8 mac_str255[256]; |
| 175 | 175 | |
| 176 | 176 | /* |
| 177 | ||
| 177 | Macintosh type/creator code: 4 char value | |
| 178 | 178 | */ |
| 179 | 179 | typedef UINT32BE mac_type; |
| 180 | 180 | |
| 181 | 181 | /* |
| 182 | ||
| 182 | point record, with the y and x coordinates | |
| 183 | 183 | */ |
| 184 | 184 | typedef struct mac_point |
| 185 | 185 | { |
| r5932 | r5933 | |
| 188 | 188 | } mac_point; |
| 189 | 189 | |
| 190 | 190 | /* |
| 191 | ||
| 191 | rect record, with the corner coordinates | |
| 192 | 192 | */ |
| 193 | 193 | typedef struct mac_rect |
| 194 | 194 | { |
| r5932 | r5933 | |
| 199 | 199 | } mac_rect; |
| 200 | 200 | |
| 201 | 201 | /* |
| 202 | ||
| 202 | FInfo (Finder file info) record | |
| 203 | 203 | */ |
| 204 | 204 | typedef struct mac_FInfo |
| 205 | 205 | { |
| r5932 | r5933 | |
| 208 | 208 | UINT16BE flags; /* Finder flags */ |
| 209 | 209 | mac_point location; /* file's location in window */ |
| 210 | 210 | /* If set to {0, 0}, and the inited flag is |
| 211 | clear, the Finder will place the item | |
| 212 | automatically */ | |
| 211 | clear, the Finder will place the item | |
| 212 | automatically */ | |
| 213 | 213 | UINT16BE fldr; /* MFS: window that contains file */ |
| 214 | 214 | /* -3: trash */ |
| 215 | 215 | /* -2: desktop */ |
| r5932 | r5933 | |
| 217 | 217 | /* 0: disk window ("root") */ |
| 218 | 218 | /* > 0: specific folder, index of FOBJ resource??? */ |
| 219 | 219 | /* The FOBJ resource contains some folder info; |
| 220 | ||
| 220 | the name of the resource is the folder name. */ | |
| 221 | 221 | /* HFS & HFS+: |
| 222 | System 7: The window in which the file’s icon appears | |
| 223 | System 8: reserved (set to 0) */ | |
| 222 | System 7: The window in which the file???s icon appears | |
| 223 | System 8: reserved (set to 0) */ | |
| 224 | 224 | } mac_FInfo; |
| 225 | 225 | |
| 226 | 226 | /* |
| 227 | ||
| 227 | FXInfo (Finder extended file info) record -- not found in MFS | |
| 228 | 228 | */ |
| 229 | 229 | typedef struct mac_FXInfo |
| 230 | 230 | { |
| 231 | UINT16BE iconID; /* System 7: An ID number for the file’s icon; the | |
| 232 | numbers that identify icons are assigned by the | |
| 233 | Finder */ | |
| 231 | UINT16BE iconID; /* System 7: An ID number for the file???s icon; the | |
| 232 | numbers that identify icons are assigned by the | |
| 233 | Finder */ | |
| 234 | 234 | /* System 8: Reserved (set to 0) */ |
| 235 | 235 | UINT16BE reserved[3]; /* Reserved (set to 0) */ |
| 236 | 236 | UINT8 script; /* System 7: if high-bit is set, the script code |
| 237 | ||
| 237 | for displaying the file name; ignored otherwise */ | |
| 238 | 238 | /* System 8: Extended flags MSB(?) */ |
| 239 | 239 | UINT8 XFlags; /* Extended flags */ |
| 240 | 240 | UINT16BE comment; /* System 7: Comment ID if high-bit is clear */ |
| 241 | 241 | /* System 8: Reserved (set to 0) */ |
| 242 | 242 | UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the |
| 243 | file onto the desktop, the directory ID of the | |
| 244 | folder from which the user moves the file is | |
| 245 | saved here) */ | |
| 243 | file onto the desktop, the directory ID of the | |
| 244 | folder from which the user moves the file is | |
| 245 | saved here) */ | |
| 246 | 246 | } mac_FXInfo; |
| 247 | 247 | |
| 248 | 248 | /* |
| 249 | ||
| 249 | DInfo (Finder folder info) record -- not found in MFS | |
| 250 | 250 | */ |
| 251 | 251 | typedef struct mac_DInfo |
| 252 | 252 | { |
| r5932 | r5933 | |
| 254 | 254 | UINT16BE flags; /* Finder flags, e.g. kIsInvisible, kNameLocked, etc */ |
| 255 | 255 | mac_point location; /* Location of the folder in parent window */ |
| 256 | 256 | /* If set to {0, 0}, and the initied flag is |
| 257 | clear, the Finder will place the item | |
| 258 | automatically */ | |
| 257 | clear, the Finder will place the item | |
| 258 | automatically */ | |
| 259 | 259 | UINT16BE view; /* System 7: The manner in which folders are |
| 260 | ||
| 260 | displayed */ | |
| 261 | 261 | /* System 8: reserved (set to 0) */ |
| 262 | 262 | } mac_DInfo; |
| 263 | 263 | |
| 264 | 264 | /* |
| 265 | ||
| 265 | DXInfo (Finder extended folder info) record -- not found in MFS | |
| 266 | 266 | */ |
| 267 | 267 | typedef struct mac_DXInfo |
| 268 | 268 | { |
| r5932 | r5933 | |
| 270 | 270 | UINT32BE openChain; /* System 7: chain of directory IDs for open folders */ |
| 271 | 271 | /* System 8: reserved (set to 0) */ |
| 272 | 272 | UINT8 script; /* System 7: if high-bit is set, the script code |
| 273 | ||
| 273 | for displaying the folder name; ignored otherwise */ | |
| 274 | 274 | /* System 8: Extended flags MSB(?) */ |
| 275 | 275 | UINT8 XFlags; /* Extended flags */ |
| 276 | 276 | UINT16BE comment; /* System 7: Comment ID if high-bit is clear */ |
| 277 | 277 | /* System 8: Reserved (set to 0) */ |
| 278 | 278 | UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the |
| 279 | folder onto the desktop, the directory ID of | |
| 280 | the folder from which the user moves it is | |
| 281 | saved here) */ | |
| 279 | folder onto the desktop, the directory ID of | |
| 280 | the folder from which the user moves it is | |
| 281 | saved here) */ | |
| 282 | 282 | } mac_DXInfo; |
| 283 | 283 | |
| 284 | 284 | /* |
| 285 | ||
| 285 | defines for FInfo & DInfo flags fields | |
| 286 | 286 | */ |
| 287 | 287 | enum |
| 288 | 288 | { |
| r5932 | r5933 | |
| 302 | 302 | /* resource */ |
| 303 | 303 | /* Otherwise, set to 0. */ |
| 304 | 304 | fif_hasBeenInited = 0x0100, /* System 6: The Finder has recorded information from |
| 305 | the file’s bundle resource into the desktop | |
| 306 | database and given the file or folder a | |
| 307 | position on the desktop. */ | |
| 305 | the file???s bundle resource into the desktop | |
| 306 | database and given the file or folder a | |
| 307 | position on the desktop. */ | |
| 308 | 308 | /* System 7? 8?: Clear if the file contains desktop database */ |
| 309 | 309 | /* resources ('BNDL', 'FREF', 'open', 'kind'...) */ |
| 310 | 310 | /* that have not been added yet. Set only by the Finder */ |
| 311 | 311 | /* Reserved for folders - make sure this bit is cleared for folders */ |
| 312 | 312 | |
| 313 | 313 | /* bit 0x0200 was at a point (AOCE for system 7.x?) the letter bit for |
| 314 | AOCE, but was reserved before and it is reserved again in recent MacOS | |
| 315 | releases. */ | |
| 314 | AOCE, but was reserved before and it is reserved again in recent MacOS | |
| 315 | releases. */ | |
| 316 | 316 | |
| 317 | 317 | fif_hasCustomIcon = 0x0400, /* (files and folders) */ |
| 318 | 318 | fif_isStationery = 0x0800, /* System 7: (files only) */ |
| r5932 | r5933 | |
| 323 | 323 | }; |
| 324 | 324 | |
| 325 | 325 | /* |
| 326 | ||
| 326 | mac_to_c_strncpy() | |
| 327 | 327 | |
| 328 | Encode a macintosh string as a C string. The NUL character is escaped, | |
| 329 | using the "%00" sequence. To avoid any ambiguity, '%' is escaped with | |
| 330 | '%25'. | |
| 328 | Encode a macintosh string as a C string. The NUL character is escaped, | |
| 329 | using the "%00" sequence. To avoid any ambiguity, '%' is escaped with | |
| 330 | '%25'. | |
| 331 | 331 | |
| 332 | dst (O): C string | |
| 333 | n (I): length of buffer pointed to by dst | |
| 334 | src (I): macintosh string (first byte is length) | |
| 332 | dst (O): C string | |
| 333 | n (I): length of buffer pointed to by dst | |
| 334 | src (I): macintosh string (first byte is length) | |
| 335 | 335 | */ |
| 336 | 336 | static void mac_to_c_strncpy(char *dst, int n, UINT8 *src) |
| 337 | 337 | { |
| r5932 | r5933 | |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /* |
| 378 | ||
| 378 | c_to_mac_strncpy() | |
| 379 | 379 | |
| 380 | Decode a C string to a macintosh string. The NUL character is escaped, | |
| 381 | using the "%00" sequence. To avoid any ambiguity, '%' is escaped with | |
| 382 | '%25'. | |
| 380 | Decode a C string to a macintosh string. The NUL character is escaped, | |
| 381 | using the "%00" sequence. To avoid any ambiguity, '%' is escaped with | |
| 382 | '%25'. | |
| 383 | 383 | |
| 384 | dst (O): macintosh string (first byte is length) | |
| 385 | src (I): C string | |
| 386 | n (I): length of string pointed to by src | |
| 384 | dst (O): macintosh string (first byte is length) | |
| 385 | src (I): C string | |
| 386 | n (I): length of string pointed to by src | |
| 387 | 387 | */ |
| 388 | 388 | static void c_to_mac_strncpy(mac_str255 dst, const char *src, int n) |
| 389 | 389 | { |
| r5932 | r5933 | |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /* |
| 424 | ||
| 424 | mac_strcmp() | |
| 425 | 425 | |
| 426 | ||
| 426 | Compare two macintosh strings | |
| 427 | 427 | |
| 428 | s1 (I): the string to compare | |
| 429 | s2 (I): the comparison string | |
| 428 | s1 (I): the string to compare | |
| 429 | s2 (I): the comparison string | |
| 430 | 430 | |
| 431 | Return a zero if s1 and s2 are equal, a negative value if s1 is less than | |
| 432 | s2, and a positive value if s1 is greater than s2. | |
| 431 | Return a zero if s1 and s2 are equal, a negative value if s1 is less than | |
| 432 | s2, and a positive value if s1 is greater than s2. | |
| 433 | 433 | */ |
| 434 | 434 | /*static int mac_strcmp(const UINT8 *s1, const UINT8 *s2) |
| 435 | 435 | { |
| 436 | ||
| 436 | size_t common_len; | |
| 437 | 437 | |
| 438 | ||
| 438 | common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0]; | |
| 439 | 439 | |
| 440 | ||
| 440 | return memcmp(s1+1, s2+1, common_len) || ((int)s1[0] - s2[0]); | |
| 441 | 441 | }*/ |
| 442 | 442 | |
| 443 | 443 | /* |
| 444 | ||
| 444 | mac_stricmp() | |
| 445 | 445 | |
| 446 | Compare two macintosh strings in a manner compatible with the macintosh HFS | |
| 447 | file system. | |
| 446 | Compare two macintosh strings in a manner compatible with the macintosh HFS | |
| 447 | file system. | |
| 448 | 448 | |
| 449 | This functions emulates the way HFS (and MFS???) sorts string: this is | |
| 450 | equivalent to the RelString macintosh toolbox call with the caseSensitive | |
| 451 | parameter as false and the diacSensitive parameter as true. | |
| 449 | This functions emulates the way HFS (and MFS???) sorts string: this is | |
| 450 | equivalent to the RelString macintosh toolbox call with the caseSensitive | |
| 451 | parameter as false and the diacSensitive parameter as true. | |
| 452 | 452 | |
| 453 | s1 (I): the string to compare | |
| 454 | s2 (I): the comparison string | |
| 453 | s1 (I): the string to compare | |
| 454 | s2 (I): the comparison string | |
| 455 | 455 | |
| 456 | Return a zero if s1 and s2 are equal, a negative value if s1 is less than | |
| 457 | s2, and a positive value if s1 is greater than s2. | |
| 456 | Return a zero if s1 and s2 are equal, a negative value if s1 is less than | |
| 457 | s2, and a positive value if s1 is greater than s2. | |
| 458 | 458 | |
| 459 | 459 | Known issues: |
| 460 | Using this function makes sense with the MacRoman encoding, as it means the | |
| 461 | computer will regard "DeskTop File", "Desktop File", "Desktop file", etc, | |
| 462 | as the same file. (UNIX users will probably regard this as an heresy, but | |
| 463 | you must consider that, unlike UNIX, the Macintosh was not designed for | |
| 464 | droids, but error-prone human beings that may forget about case.) | |
| 460 | Using this function makes sense with the MacRoman encoding, as it means the | |
| 461 | computer will regard "DeskTop File", "Desktop File", "Desktop file", etc, | |
| 462 | as the same file. (UNIX users will probably regard this as an heresy, but | |
| 463 | you must consider that, unlike UNIX, the Macintosh was not designed for | |
| 464 | droids, but error-prone human beings that may forget about case.) | |
| 465 | 465 | |
| 466 | (Also, letters with diatrical signs follow the corresponding letters | |
| 467 | without diacritical signs in the HFS catalog file. This does not matter, | |
| 468 | though, since the Finder will not display files in the HFS catalog order, | |
| 469 | but it will instead sort files according to whatever order is currently | |
| 470 | selected in the View menu.) | |
| 466 | (Also, letters with diatrical signs follow the corresponding letters | |
| 467 | without diacritical signs in the HFS catalog file. This does not matter, | |
| 468 | though, since the Finder will not display files in the HFS catalog order, | |
| 469 | but it will instead sort files according to whatever order is currently | |
| 470 | selected in the View menu.) | |
| 471 | 471 | |
| 472 | However, with other text encodings, the behavior will be completely absurd. | |
| 473 | For instance, with the Greek encoding, it will think that the degree symbol | |
| 474 | is the same letter (with different case) as the upper-case Psi, so that if | |
| 475 | a program asks for a file called "90°" on a greek HFS volume, and there is | |
| 476 | a file called "90Ψ" on this volume, file "90Ψ" will be opened. | |
| 477 | Results will probably be even weirder with 2-byte scripts like Japanese or | |
| 478 | Chinese. Of course, we are not going to fix this issue, since doing so | |
| 479 | would break the compatibility with the original Macintosh OS. | |
| 472 | However, with other text encodings, the behavior will be completely absurd. | |
| 473 | For instance, with the Greek encoding, it will think that the degree symbol | |
| 474 | is the same letter (with different case) as the upper-case Psi, so that if | |
| 475 | a program asks for a file called "90??" on a greek HFS volume, and there is | |
| 476 | a file called "90??" on this volume, file "90??" will be opened. | |
| 477 | Results will probably be even weirder with 2-byte scripts like Japanese or | |
| 478 | Chinese. Of course, we are not going to fix this issue, since doing so | |
| 479 | would break the compatibility with the original Macintosh OS. | |
| 480 | 480 | */ |
| 481 | 481 | |
| 482 | 482 | static int mac_stricmp(const UINT8 *s1, const UINT8 *s2) |
| 483 | 483 | { |
| 484 | 484 | static const unsigned char mac_char_sort_table[256] = |
| 485 | 485 | { |
| 486 | /* | |
| 486 | /* \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 */ | |
| 487 | 487 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 488 | /* | |
| 488 | /* \x08 \x09 \x0a \x0b \x0c \x0d \x0e \x0f */ | |
| 489 | 489 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 490 | /* | |
| 490 | /* \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 */ | |
| 491 | 491 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 492 | /* | |
| 492 | /* \x18 \x19 \x1a \x1b \x1c \x1d \x1e \x1f */ | |
| 493 | 493 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, |
| 494 | /* | |
| 494 | /* \x20 \x21 \x22 \x23 \x24 \x25 \x26 \x27 */ | |
| 495 | 495 | 0x20, 0x21, 0x22, 0x27, 0x28, 0x29, 0x2a, 0x2b, |
| 496 | /* | |
| 496 | /* \x28 \x29 \x2a \x2b \x2c \x2d \x2e \x2f */ | |
| 497 | 497 | 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, |
| 498 | /* | |
| 498 | /* \x30 \x31 \x32 \x33 \x34 \x35 \x36 \x37 */ | |
| 499 | 499 | 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, |
| 500 | /* | |
| 500 | /* \x38 \x39 \x3a \x3b \x3c \x3d \x3e \x3f */ | |
| 501 | 501 | 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, |
| 502 | /* | |
| 502 | /* \x40 \x41 \x42 \x43 \x44 \x45 \x46 \x47 */ | |
| 503 | 503 | 0x46, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b, |
| 504 | /* | |
| 504 | /* \x48 \x49 \x4a \x4b \x4c \x4d \x4e \x4f */ | |
| 505 | 505 | 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68, |
| 506 | /* | |
| 506 | /* \x50 \x51 \x52 \x53 \x54 \x55 \x56 \x57 */ | |
| 507 | 507 | 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d, |
| 508 | /* | |
| 508 | /* \x58 \x59 \x5a \x5b \x5c \x5d \x5e \x5f */ | |
| 509 | 509 | 0x7e, 0x7f, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, |
| 510 | /* | |
| 510 | /* \x60 \x61 \x62 \x63 \x64 \x65 \x66 \x67 */ | |
| 511 | 511 | 0x4d, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b, |
| 512 | /* | |
| 512 | /* \x68 \x69 \x6a \x6b \x6c \x6d \x6e \x6f */ | |
| 513 | 513 | 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68, |
| 514 | /* | |
| 514 | /* \x70 \x71 \x72 \x73 \x74 \x75 \x76 \x77 */ | |
| 515 | 515 | 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d, |
| 516 | /* | |
| 516 | /* \x78 \x79 \x7a \x7b \x7c \x7d \x7e \x7f */ | |
| 517 | 517 | 0x7e, 0x7f, 0x81, 0x87, 0x88, 0x89, 0x8a, 0x8b, |
| 518 | /* | |
| 518 | /* \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 */ | |
| 519 | 519 | 0x49, 0x4b, 0x53, 0x56, 0x67, 0x69, 0x78, 0x4e, |
| 520 | /* | |
| 520 | /* \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f */ | |
| 521 | 521 | 0x48, 0x4f, 0x49, 0x4a, 0x4b, 0x53, 0x56, 0x57, |
| 522 | /* | |
| 522 | /* \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97 */ | |
| 523 | 523 | 0x58, 0x59, 0x5e, 0x5f, 0x60, 0x61, 0x67, 0x6d, |
| 524 | /* | |
| 524 | /* \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f */ | |
| 525 | 525 | 0x6e, 0x6f, 0x69, 0x6a, 0x79, 0x7a, 0x7b, 0x78, |
| 526 | /* | |
| 526 | /* \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 */ | |
| 527 | 527 | 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x75, |
| 528 | /* | |
| 528 | /* \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf */ | |
| 529 | 529 | 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x4c, 0x6b, |
| 530 | /* | |
| 530 | /* \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 */ | |
| 531 | 531 | 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, |
| 532 | /* | |
| 532 | /* \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf */ | |
| 533 | 533 | 0xa1, 0xa2, 0xa3, 0x50, 0x70, 0xa4, 0x4c, 0x6b, |
| 534 | /* | |
| 534 | /* \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 */ | |
| 535 | 535 | 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0x25, |
| 536 | /* | |
| 536 | /* \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf */ | |
| 537 | 537 | 0x26, 0xac, 0x20, 0x48, 0x4a, 0x6a, 0x6c, 0x6c, |
| 538 | /* | |
| 538 | /* \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 */ | |
| 539 | 539 | 0xad, 0xae, 0x23, 0x24, 0x2c, 0x2d, 0xaf, 0xb0, |
| 540 | /* | |
| 540 | /* \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf */ | |
| 541 | 541 | 0x80, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, |
| 542 | /* | |
| 542 | /* \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 */ | |
| 543 | 543 | 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, |
| 544 | /* | |
| 544 | /* \xe8 \xe9 \xea \xeb \xec \xed \xee \xef */ | |
| 545 | 545 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, |
| 546 | /* | |
| 546 | /* \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 */ | |
| 547 | 547 | 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, |
| 548 | /* | |
| 548 | /* \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff */ | |
| 549 | 549 | 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7 |
| 550 | 550 | }; |
| 551 | 551 | |
| r5932 | r5933 | |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | /* |
| 570 | ||
| 570 | mac_strcpy() | |
| 571 | 571 | |
| 572 | ||
| 572 | Copy a macintosh string | |
| 573 | 573 | |
| 574 | dst (O): dest macintosh string | |
| 575 | src (I): source macintosh string (first byte is length) | |
| 574 | dst (O): dest macintosh string | |
| 575 | src (I): source macintosh string (first byte is length) | |
| 576 | 576 | |
| 577 | Return a zero if s1 and s2 are equal, a negative value if s1 is less than | |
| 578 | s2, and a positive value if s1 is greater than s2. | |
| 577 | Return a zero if s1 and s2 are equal, a negative value if s1 is less than | |
| 578 | s2, and a positive value if s1 is greater than s2. | |
| 579 | 579 | */ |
| 580 | 580 | INLINE void mac_strcpy(UINT8 *dest, const UINT8 *src) |
| 581 | 581 | { |
| r5932 | r5933 | |
| 584 | 584 | |
| 585 | 585 | #ifdef UNUSED_FUNCTION |
| 586 | 586 | /* |
| 587 | ||
| 587 | mac_strncpy() | |
| 588 | 588 | |
| 589 | ||
| 589 | Copy a macintosh string | |
| 590 | 590 | |
| 591 | dst (O): dest macintosh string | |
| 592 | n (I): max string length for dest (range 0-255, buffer length + 1) | |
| 593 | src (I): source macintosh string (first byte is length) | |
| 591 | dst (O): dest macintosh string | |
| 592 | n (I): max string length for dest (range 0-255, buffer length + 1) | |
| 593 | src (I): source macintosh string (first byte is length) | |
| 594 | 594 | */ |
| 595 | 595 | static void mac_strncpy(UINT8 *dest, int n, const UINT8 *src) |
| 596 | 596 | { |
| r5932 | r5933 | |
| 605 | 605 | #endif |
| 606 | 606 | |
| 607 | 607 | /* |
| 608 | ||
| 608 | disk image reference | |
| 609 | 609 | */ |
| 610 | 610 | typedef struct mac_l1_imgref |
| 611 | 611 | { |
| r5932 | r5933 | |
| 634 | 634 | |
| 635 | 635 | |
| 636 | 636 | /* |
| 637 | ||
| 637 | image_read_block() | |
| 638 | 638 | |
| 639 | ||
| 639 | Read one 512-byte block of data from a macintosh disk image | |
| 640 | 640 | |
| 641 | image (I/O): level-1 image reference | |
| 642 | block (I): address of block to read | |
| 643 | dest (O): buffer where block data should be stored | |
| 641 | image (I/O): level-1 image reference | |
| 642 | block (I): address of block to read | |
| 643 | dest (O): buffer where block data should be stored | |
| 644 | 644 | |
| 645 | ||
| 645 | Return imgtool error code | |
| 646 | 646 | */ |
| 647 | 647 | static imgtoolerr_t image_read_block(mac_l1_imgref *image, UINT32 block, void *dest) |
| 648 | 648 | { |
| r5932 | r5933 | |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | /* |
| 665 | ||
| 665 | image_write_block() | |
| 666 | 666 | |
| 667 | ||
| 667 | Read one 512-byte block of data from a macintosh disk image | |
| 668 | 668 | |
| 669 | image (I/O): level-1 image reference | |
| 670 | block (I): address of block to write | |
| 671 | src (I): buffer with the block data | |
| 669 | image (I/O): level-1 image reference | |
| 670 | block (I): address of block to write | |
| 671 | src (I): buffer with the block data | |
| 672 | 672 | |
| 673 | ||
| 673 | Return imgtool error code | |
| 674 | 674 | */ |
| 675 | 675 | static imgtoolerr_t image_write_block(mac_l1_imgref *image, UINT32 block, const void *src) |
| 676 | 676 | { |
| r5932 | r5933 | |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | /* |
| 693 | ||
| 693 | image_get_tag_len() | |
| 694 | 694 | |
| 695 | ||
| 695 | Get length of tag data (12 for GCR floppies, 20 for HD20, 0 otherwise) | |
| 696 | 696 | |
| 697 | ||
| 697 | image (I/O): level-1 image reference | |
| 698 | 698 | |
| 699 | ||
| 699 | Return tag length | |
| 700 | 700 | */ |
| 701 | 701 | INLINE int image_get_tag_len(mac_l1_imgref *image) |
| 702 | 702 | { |
| r5932 | r5933 | |
| 706 | 706 | |
| 707 | 707 | |
| 708 | 708 | /* |
| 709 | ||
| 709 | image_read_tag() | |
| 710 | 710 | |
| 711 | ||
| 711 | Read a 12- or 20-byte tag record associated with a disk block | |
| 712 | 712 | |
| 713 | image (I/O): level-1 image reference | |
| 714 | block (I): address of block to read | |
| 715 | dest (O): buffer where tag data should be stored | |
| 713 | image (I/O): level-1 image reference | |
| 714 | block (I): address of block to read | |
| 715 | dest (O): buffer where tag data should be stored | |
| 716 | 716 | |
| 717 | ||
| 717 | Return imgtool error code | |
| 718 | 718 | */ |
| 719 | 719 | static imgtoolerr_t image_read_tag(mac_l1_imgref *image, UINT32 block, void *dest) |
| 720 | 720 | { |
| r5932 | r5933 | |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | /* |
| 725 | ||
| 725 | image_write_tag() | |
| 726 | 726 | |
| 727 | ||
| 727 | Write a 12- or 20-byte tag record associated with a disk block | |
| 728 | 728 | |
| 729 | image (I/O): level-1 image reference | |
| 730 | block (I): address of block to write | |
| 731 | src (I): buffer with the tag data | |
| 729 | image (I/O): level-1 image reference | |
| 730 | block (I): address of block to write | |
| 731 | src (I): buffer with the tag data | |
| 732 | 732 | |
| 733 | ||
| 733 | Return imgtool error code | |
| 734 | 734 | */ |
| 735 | 735 | static imgtoolerr_t image_write_tag(mac_l1_imgref *image, UINT32 block, const void *src) |
| 736 | 736 | { |
| r5932 | r5933 | |
| 753 | 753 | typedef struct mac_l2_imgref mac_l2_imgref; |
| 754 | 754 | |
| 755 | 755 | /* |
| 756 | ||
| 756 | MFS image ref | |
| 757 | 757 | */ |
| 758 | 758 | typedef struct mfs_l2_imgref |
| 759 | 759 | { |
| r5932 | r5933 | |
| 770 | 770 | } mfs_l2_imgref; |
| 771 | 771 | |
| 772 | 772 | /* |
| 773 | ||
| 773 | HFS extent descriptor | |
| 774 | 774 | */ |
| 775 | 775 | typedef struct hfs_extent |
| 776 | 776 | { |
| r5932 | r5933 | |
| 779 | 779 | } hfs_extent; |
| 780 | 780 | |
| 781 | 781 | /* |
| 782 | HFS likes to group extents by 3 (it is 8 with HFS+), so we create a | |
| 783 | specific type. | |
| 782 | HFS likes to group extents by 3 (it is 8 with HFS+), so we create a | |
| 783 | specific type. | |
| 784 | 784 | */ |
| 785 | 785 | typedef hfs_extent hfs_extent_3[3]; |
| 786 | 786 | |
| 787 | 787 | /* |
| 788 | ||
| 788 | MFS open file ref | |
| 789 | 789 | */ |
| 790 | 790 | typedef struct mfs_fileref |
| 791 | 791 | { |
| r5932 | r5933 | |
| 793 | 793 | } mfs_fileref; |
| 794 | 794 | |
| 795 | 795 | /* |
| 796 | ||
| 796 | HFS open file ref | |
| 797 | 797 | */ |
| 798 | 798 | typedef struct hfs_fileref |
| 799 | 799 | { |
| r5932 | r5933 | |
| 804 | 804 | } hfs_fileref; |
| 805 | 805 | |
| 806 | 806 | /* |
| 807 | ||
| 807 | MFS/HFS open file ref | |
| 808 | 808 | */ |
| 809 | 809 | typedef struct mac_fileref |
| 810 | 810 | { |
| r5932 | r5933 | |
| 830 | 830 | } mac_fileref; |
| 831 | 831 | |
| 832 | 832 | /* |
| 833 | ||
| 833 | open BT ref | |
| 834 | 834 | */ |
| 835 | 835 | typedef struct mac_BTref |
| 836 | 836 | { |
| r5932 | r5933 | |
| 850 | 850 | } mac_BTref; |
| 851 | 851 | |
| 852 | 852 | /* |
| 853 | ||
| 853 | Constants for BTHeaderRec attributes field | |
| 854 | 854 | */ |
| 855 | 855 | enum |
| 856 | 856 | { |
| r5932 | r5933 | |
| 860 | 860 | }; |
| 861 | 861 | |
| 862 | 862 | /* |
| 863 | ||
| 863 | HFS image ref | |
| 864 | 864 | */ |
| 865 | 865 | typedef struct hfs_l2_imgref |
| 866 | 866 | { |
| r5932 | r5933 | |
| 877 | 877 | } hfs_l2_imgref; |
| 878 | 878 | |
| 879 | 879 | /* |
| 880 | ||
| 880 | MFS/HFS image ref | |
| 881 | 881 | */ |
| 882 | 882 | struct mac_l2_imgref |
| 883 | 883 | { |
| r5932 | r5933 | |
| 899 | 899 | }; |
| 900 | 900 | |
| 901 | 901 | /* |
| 902 | ||
| 902 | MFS Master Directory Block | |
| 903 | 903 | */ |
| 904 | 904 | typedef struct mfs_mdb |
| 905 | 905 | { |
| r5932 | r5933 | |
| 915 | 915 | UINT16BE nmAlBlks; /* number of allocation blocks in volume (0x0187) */ |
| 916 | 916 | UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks (0x00000400) */ |
| 917 | 917 | UINT32BE clpSiz; /* default clump size - number of bytes to allocate |
| 918 | ||
| 918 | when a file grows (0x00002000) */ | |
| 919 | 919 | UINT16BE alBlSt; /* first allocation block in volume (0x0010) */ |
| 920 | 920 | |
| 921 | 921 | UINT32BE nxtFNum; /* next unused file number */ |
| r5932 | r5933 | |
| 924 | 924 | mac_str27 VN; /* volume name */ |
| 925 | 925 | |
| 926 | 926 | UINT8 ABlink[512-64];/* Link array for file ABs. Array of nmAlBlks |
| 927 | 12-bit-long entries, indexed by AB address. If an | |
| 928 | AB belongs to no file, the entry is 0; if an AB is | |
| 929 | the last in any file, the entry is 1; if an AB | |
| 930 | belongs to a file and is not the last one, the | |
| 931 | entry is the AB address of the next file AB plus 1. | |
| 932 | Note that the array extends on as many consecutive | |
| 933 | disk blocks as needed (usually the MDB block plus | |
| 934 | the next one). Incidentally, this array is not | |
| 935 | saved in the secondary MDB: presumably, the idea | |
| 936 | was that the disk utility could rely on the tag | |
| 937 | data to rebuild the link array if it should ever | |
| 938 | be corrupted. */ | |
| 927 | 12-bit-long entries, indexed by AB address. If an | |
| 928 | AB belongs to no file, the entry is 0; if an AB is | |
| 929 | the last in any file, the entry is 1; if an AB | |
| 930 | belongs to a file and is not the last one, the | |
| 931 | entry is the AB address of the next file AB plus 1. | |
| 932 | Note that the array extends on as many consecutive | |
| 933 | disk blocks as needed (usually the MDB block plus | |
| 934 | the next one). Incidentally, this array is not | |
| 935 | saved in the secondary MDB: presumably, the idea | |
| 936 | was that the disk utility could rely on the tag | |
| 937 | data to rebuild the link array if it should ever | |
| 938 | be corrupted. */ | |
| 939 | 939 | } mfs_mdb; |
| 940 | 940 | |
| 941 | 941 | /* |
| 942 | ||
| 942 | HFS Master Directory Block | |
| 943 | 943 | */ |
| 944 | 944 | typedef struct hfs_mdb |
| 945 | 945 | { |
| r5932 | r5933 | |
| 956 | 956 | UINT16BE nmAlBlks; /* number of allocation blocks in volume */ |
| 957 | 957 | UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks */ |
| 958 | 958 | UINT32BE clpSiz; /* default clump size - number of bytes to allocate |
| 959 | ||
| 959 | when a file grows */ | |
| 960 | 960 | UINT16BE alBlSt; /* first allocation block in volume (0x0010) */ |
| 961 | 961 | UINT32BE nxtCNID; /* next unused catalog node ID */ |
| 962 | 962 | UINT16BE freeABs; /* number of unused allocation blocks */ |
| r5932 | r5933 | |
| 1004 | 1004 | } img_open_buf; |
| 1005 | 1005 | |
| 1006 | 1006 | /* |
| 1007 | ||
| 1007 | Information extracted from catalog/directory | |
| 1008 | 1008 | */ |
| 1009 | 1009 | typedef struct mac_dirent |
| 1010 | 1010 | { |
| r5932 | r5933 | |
| 1027 | 1027 | } mac_dirent; |
| 1028 | 1028 | |
| 1029 | 1029 | /* |
| 1030 | ||
| 1030 | Tag record for GCR floppies (12 bytes) | |
| 1031 | 1031 | |
| 1032 | ||
| 1032 | And, no, I don't know the format of the 20-byte tag record of the HD20 | |
| 1033 | 1033 | */ |
| 1034 | 1034 | typedef struct floppy_tag_record |
| 1035 | 1035 | { |
| r5932 | r5933 | |
| 1037 | 1037 | /* a value of 1 seems to be the default for non-AB blocks, but this is not consistent */ |
| 1038 | 1038 | UINT8 ftype; /* bit 1 = 1 if resource fork */ |
| 1039 | 1039 | /* bit 0 = 1 if block is allocated to user file (i.e. it is not |
| 1040 | in HFS extent & catalog, and not in non-AB blocks such | |
| 1041 | as MDB and MFS directory)??? */ | |
| 1040 | in HFS extent & catalog, and not in non-AB blocks such | |
| 1041 | as MDB and MFS directory)??? */ | |
| 1042 | 1042 | /* bit 7 seems to be used, but I don't know what it means */ |
| 1043 | 1043 | /* a value of $FF seems to be the default for non-AB blocks, but this is not consistent */ |
| 1044 | 1044 | UINT8 fattr; /* bit 0 = 1 if locked(?) */ |
| r5932 | r5933 | |
| 1046 | 1046 | UINT16BE fblock; /* relative file block number (enough for any volume up to 32 MBytes in size) */ |
| 1047 | 1047 | UINT32BE wrCnt; /* MFS: date and time of last write */ |
| 1048 | 1048 | /* HFS: seems related to the wrCnt field in the mdb, i.e. |
| 1049 | each time a volume is written to, the current value of | |
| 1050 | wrCnt is written in the tag field, then it is incremented */ | |
| 1049 | each time a volume is written to, the current value of | |
| 1050 | wrCnt is written in the tag field, then it is incremented */ | |
| 1051 | 1051 | /* (DV17 says "disk block number", but it cannot be true) */ |
| 1052 | 1052 | } floppy_tag_record; |
| 1053 | 1053 | |
| r5932 | r5933 | |
| 1071 | 1071 | |
| 1072 | 1072 | #ifdef UNUSED_FUNCTION |
| 1073 | 1073 | /* |
| 1074 | ||
| 1074 | mac_image_close | |
| 1075 | 1075 | |
| 1076 | ||
| 1076 | Close a macintosh image. | |
| 1077 | 1077 | |
| 1078 | ||
| 1078 | l2_img (I/O): level-2 image reference | |
| 1079 | 1079 | */ |
| 1080 | 1080 | static void mac_image_close(mac_l2_imgref *l2_img) |
| 1081 | 1081 | { |
| r5932 | r5933 | |
| 1092 | 1092 | #endif |
| 1093 | 1093 | |
| 1094 | 1094 | /* |
| 1095 | ||
| 1095 | mac_lookup_path | |
| 1096 | 1096 | |
| 1097 | Resolve a file path, and translate it to a parID + filename pair that enables | |
| 1098 | to do an efficient file search on a HFS volume (and an inefficient one on | |
| 1099 | MFS, but it is not an issue as MFS volumes typically have a few dozens | |
| 1100 | files, vs. possibly thousands with HFS volumes). | |
| 1097 | Resolve a file path, and translate it to a parID + filename pair that enables | |
| 1098 | to do an efficient file search on a HFS volume (and an inefficient one on | |
| 1099 | MFS, but it is not an issue as MFS volumes typically have a few dozens | |
| 1100 | files, vs. possibly thousands with HFS volumes). | |
| 1101 | 1101 | |
| 1102 | l2_img (I/O): level-2 image reference | |
| 1103 | fpath (I): file path (C string) | |
| 1104 | parID (O): set to the CNID of the parent directory if the volume is in HFS | |
| 1105 | format (reserved for MFS volumes) | |
| 1106 | filename (O): set to the actual name of the file, with capitalization matching | |
| 1107 | the one on the volume rather than the one in the fpath parameter (Mac | |
| 1108 | string) | |
| 1109 | cat_info (O): catalog info for this file extracted from the catalog file | |
| 1110 | (may be NULL) | |
| 1102 | l2_img (I/O): level-2 image reference | |
| 1103 | fpath (I): file path (C string) | |
| 1104 | parID (O): set to the CNID of the parent directory if the volume is in HFS | |
| 1105 | format (reserved for MFS volumes) | |
| 1106 | filename (O): set to the actual name of the file, with capitalization matching | |
| 1107 | the one on the volume rather than the one in the fpath parameter (Mac | |
| 1108 | string) | |
| 1109 | cat_info (O): catalog info for this file extracted from the catalog file | |
| 1110 | (may be NULL) | |
| 1111 | 1111 | |
| 1112 | ||
| 1112 | Return imgtool error code | |
| 1113 | 1113 | */ |
| 1114 | 1114 | static imgtoolerr_t mac_lookup_path(mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info, int create_it) |
| 1115 | 1115 | { |
| r5932 | r5933 | |
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | 1132 | /* |
| 1133 | ||
| 1133 | mac_file_open | |
| 1134 | 1134 | |
| 1135 | ||
| 1135 | Open a file located on a macintosh image | |
| 1136 | 1136 | |
| 1137 | l2_img (I/O): level-2 image reference | |
| 1138 | parID (I): CNID of the parent directory if the volume is in HFS format | |
| 1139 | (reserved for MFS volumes) | |
| 1140 | filename (I): name of the file (Mac string) | |
| 1141 | mac_forkID (I): tells which fork should be opened | |
| 1142 | fileref (O): mac file reference to open | |
| 1137 | l2_img (I/O): level-2 image reference | |
| 1138 | parID (I): CNID of the parent directory if the volume is in HFS format | |
| 1139 | (reserved for MFS volumes) | |
| 1140 | filename (I): name of the file (Mac string) | |
| 1141 | mac_forkID (I): tells which fork should be opened | |
| 1142 | fileref (O): mac file reference to open | |
| 1143 | 1143 | |
| 1144 | ||
| 1144 | Return imgtool error code | |
| 1145 | 1145 | */ |
| 1146 | 1146 | static imgtoolerr_t mac_file_open(mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, mac_fileref *fileref) |
| 1147 | 1147 | { |
| r5932 | r5933 | |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | /* |
| 1161 | ||
| 1161 | mac_file_read | |
| 1162 | 1162 | |
| 1163 | ||
| 1163 | Read data from an open mac file, starting at current position in file | |
| 1164 | 1164 | |
| 1165 | fileref (I/O): mac file reference | |
| 1166 | len (I): number of bytes to read | |
| 1167 | dest (O): destination buffer | |
| 1165 | fileref (I/O): mac file reference | |
| 1166 | len (I): number of bytes to read | |
| 1167 | dest (O): destination buffer | |
| 1168 | 1168 | |
| 1169 | ||
| 1169 | Return imgtool error code | |
| 1170 | 1170 | */ |
| 1171 | 1171 | static imgtoolerr_t mac_file_read(mac_fileref *fileref, UINT32 len, void *dest) |
| 1172 | 1172 | { |
| r5932 | r5933 | |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | 1236 | /* |
| 1237 | ||
| 1237 | mac_file_write | |
| 1238 | 1238 | |
| 1239 | ||
| 1239 | Write data to an open mac file, starting at current position in file | |
| 1240 | 1240 | |
| 1241 | fileref (I/O): mac file reference | |
| 1242 | len (I): number of bytes to read | |
| 1243 | dest (O): destination buffer | |
| 1241 | fileref (I/O): mac file reference | |
| 1242 | len (I): number of bytes to read | |
| 1243 | dest (O): destination buffer | |
| 1244 | 1244 | |
| 1245 | ||
| 1245 | Return imgtool error code | |
| 1246 | 1246 | */ |
| 1247 | 1247 | static imgtoolerr_t mac_file_write(mac_fileref *fileref, UINT32 len, const void *src) |
| 1248 | 1248 | { |
| r5932 | r5933 | |
| 1340 | 1340 | |
| 1341 | 1341 | #ifdef UNUSED_FUNCTION |
| 1342 | 1342 | /* |
| 1343 | ||
| 1343 | mac_file_tell | |
| 1344 | 1344 | |
| 1345 | ||
| 1345 | Get current position in an open mac file | |
| 1346 | 1346 | |
| 1347 | fileref (I/O): mac file reference | |
| 1348 | filePos (O): current position in file | |
| 1347 | fileref (I/O): mac file reference | |
| 1348 | filePos (O): current position in file | |
| 1349 | 1349 | |
| 1350 | ||
| 1350 | Return imgtool error code | |
| 1351 | 1351 | */ |
| 1352 | 1352 | static imgtoolerr_t mac_file_tell(mac_fileref *fileref, UINT32 *filePos) |
| 1353 | 1353 | { |
| r5932 | r5933 | |
| 1358 | 1358 | #endif |
| 1359 | 1359 | |
| 1360 | 1360 | /* |
| 1361 | ||
| 1361 | mac_file_seek | |
| 1362 | 1362 | |
| 1363 | ||
| 1363 | Set current position in an open mac file | |
| 1364 | 1364 | |
| 1365 | fileref (I/O): mac file reference | |
| 1366 | filePos (I): new position in file | |
| 1365 | fileref (I/O): mac file reference | |
| 1366 | filePos (I): new position in file | |
| 1367 | 1367 | |
| 1368 | ||
| 1368 | Return imgtool error code | |
| 1369 | 1369 | */ |
| 1370 | 1370 | static imgtoolerr_t mac_file_seek(mac_fileref *fileref, UINT32 filePos) |
| 1371 | 1371 | { |
| r5932 | r5933 | |
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | /* |
| 1381 | ||
| 1381 | mac_file_seteof | |
| 1382 | 1382 | |
| 1383 | ||
| 1383 | Set the position of the EOF in an open mac file | |
| 1384 | 1384 | |
| 1385 | fileref (I/O): mac file reference | |
| 1386 | newEof (I): new position of EOF in file | |
| 1385 | fileref (I/O): mac file reference | |
| 1386 | newEof (I): new position of EOF in file | |
| 1387 | 1387 | |
| 1388 | ||
| 1388 | Return imgtool error code | |
| 1389 | 1389 | */ |
| 1390 | 1390 | static imgtoolerr_t mac_file_seteof(mac_fileref *fileref, UINT32 newEof) |
| 1391 | 1391 | { |
| r5932 | r5933 | |
| 1395 | 1395 | newABEof = (newEof + fileref->l2_img->blocksperAB * 512 - 1) / (fileref->l2_img->blocksperAB * 512); |
| 1396 | 1396 | |
| 1397 | 1397 | /*if (fileref->pLen % (fileref->l2_img->blocksperAB * 512)) |
| 1398 | ||
| 1398 | return IMGTOOLERR_CORRUPTIMAGE;*/ | |
| 1399 | 1399 | |
| 1400 | 1400 | if (newEof < fileref->eof) |
| 1401 | 1401 | fileref->eof = newEof; |
| r5932 | r5933 | |
| 1421 | 1421 | |
| 1422 | 1422 | /* update current pos if beyond new EOF */ |
| 1423 | 1423 | /*if (fileref->crPs > newEof) |
| 1424 | { | |
| 1425 | if ((fileref->crPs / 512) != (newEof / 512)) | |
| 1426 | fileref->reload_buf = TRUE; | |
| 1424 | { | |
| 1425 | if ((fileref->crPs / 512) != (newEof / 512)) | |
| 1426 | fileref->reload_buf = TRUE; | |
| 1427 | 1427 | |
| 1428 | fileref->crPs = newEof; | |
| 1429 | }*/ | |
| 1428 | fileref->crPs = newEof; | |
| 1429 | }*/ | |
| 1430 | 1430 | |
| 1431 | 1431 | return IMGTOOLERR_SUCCESS; |
| 1432 | 1432 | } |
| r5932 | r5933 | |
| 1437 | 1437 | #endif |
| 1438 | 1438 | |
| 1439 | 1439 | /* |
| 1440 | ||
| 1440 | directory entry for use in the directory file | |
| 1441 | 1441 | |
| 1442 | Note the structure is variable length. It is always word-aligned, and | |
| 1443 | cannot cross block boundaries. | |
| 1442 | Note the structure is variable length. It is always word-aligned, and | |
| 1443 | cannot cross block boundaries. | |
| 1444 | 1444 | |
| 1445 | Note that the directory does not seem to be sorted: the order in which | |
| 1446 | files appear does not match file names, and it does not always match file | |
| 1447 | IDs. | |
| 1445 | Note that the directory does not seem to be sorted: the order in which | |
| 1446 | files appear does not match file names, and it does not always match file | |
| 1447 | IDs. | |
| 1448 | 1448 | */ |
| 1449 | 1449 | typedef struct mfs_dir_entry |
| 1450 | 1450 | { |
| 1451 | 1451 | UINT8 flags; /* bit 7=1 if entry used, bit 0=1 if file locked */ |
| 1452 | 1452 | /* 0x00 means end of block: if we are not done |
| 1453 | with reading the directory, the remnants will | |
| 1454 | be read from next block */ | |
| 1453 | with reading the directory, the remnants will | |
| 1454 | be read from next block */ | |
| 1455 | 1455 | UINT8 flVersNum; /* version number (usually 0x00, but I don't |
| 1456 | ||
| 1456 | have the IM volume that describes it) */ | |
| 1457 | 1457 | mac_FInfo flFinderInfo; /* information used by the Finder */ |
| 1458 | 1458 | |
| 1459 | 1459 | UINT32BE fileID; /* file ID */ |
| r5932 | r5933 | |
| 1471 | 1471 | UINT8 name[1]; /* first char is length of file name */ |
| 1472 | 1472 | /* next chars are file name - 255 chars at most */ |
| 1473 | 1473 | /* IIRC, Finder 7 only supports 31 chars, |
| 1474 | ||
| 1474 | wheareas earlier versions support 63 chars */ | |
| 1475 | 1475 | } mfs_dir_entry; |
| 1476 | 1476 | |
| 1477 | 1477 | /* |
| 1478 | FOBJ desktop resource: describes a folder, or the location of the volume | |
| 1479 | icon. | |
| 1478 | FOBJ desktop resource: describes a folder, or the location of the volume | |
| 1479 | icon. | |
| 1480 | 1480 | |
| 1481 | In typical Apple manner, this resource is not documented. However, I have | |
| 1482 | managed to reverse engineer some parts of it. | |
| 1481 | In typical Apple manner, this resource is not documented. However, I have | |
| 1482 | managed to reverse engineer some parts of it. | |
| 1483 | 1483 | */ |
| 1484 | 1484 | typedef struct mfs_FOBJ |
| 1485 | 1485 | { |
| r5932 | r5933 | |
| 1502 | 1502 | struct |
| 1503 | 1503 | { |
| 1504 | 1504 | UINT16BE item_count; /* number of items (folders and files) in |
| 1505 | ||
| 1505 | this folder */ | |
| 1506 | 1506 | UINT32BE item_descs[1]; /* this variable-length array has |
| 1507 | ||
| 1507 | item_count entries - meaning of entry is unknown */ | |
| 1508 | 1508 | } v1; |
| 1509 | 1509 | struct |
| 1510 | 1510 | { |
| 1511 | 1511 | UINT16BE zerofill; /* always 0? */ |
| 1512 | 1512 | UINT16BE unknown0; /* always 0??? */ |
| 1513 | 1513 | UINT16BE item_count; /* number of items (folders and files) in |
| 1514 | ||
| 1514 | this folder */ | |
| 1515 | 1515 | UINT8 unknown1[20]; /* ??? */ |
| 1516 | 1516 | UINT8 name[1]; /* variable-length macintosh string */ |
| 1517 | 1517 | } v2; |
| r5932 | r5933 | |
| 1519 | 1519 | } mfs_FOBJ; |
| 1520 | 1520 | |
| 1521 | 1521 | /* |
| 1522 | ||
| 1522 | MFS open dir ref | |
| 1523 | 1523 | */ |
| 1524 | 1524 | typedef struct mfs_dirref |
| 1525 | 1525 | { |
| r5932 | r5933 | |
| 1585 | 1585 | |
| 1586 | 1586 | |
| 1587 | 1587 | /* |
| 1588 | ||
| 1588 | mfs_image_open | |
| 1589 | 1589 | |
| 1590 | Open a MFS image. Image must already be open on level 1. This function | |
| 1591 | should not be called directly: call mac_image_open() instead. | |
| 1590 | Open a MFS image. Image must already be open on level 1. This function | |
| 1591 | should not be called directly: call mac_image_open() instead. | |
| 1592 | 1592 | |
| 1593 | l2_img (I/O): level-2 image reference to open (l1_img and format fields | |
| 1594 | must be initialized) | |
| 1595 | img_open_buf (I): buffer with the MDB block | |
| 1593 | l2_img (I/O): level-2 image reference to open (l1_img and format fields | |
| 1594 | must be initialized) | |
| 1595 | img_open_buf (I): buffer with the MDB block | |
| 1596 | 1596 | |
| 1597 | ||
| 1597 | Return imgtool error code | |
| 1598 | 1598 | */ |
| 1599 | 1599 | static imgtoolerr_t mfs_image_open(imgtool_image *image, imgtool_stream *stream) |
| 1600 | 1600 | { |
| r5932 | r5933 | |
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | 1682 | /* |
| 1683 | ||
| 1683 | mfs_update_mdb | |
| 1684 | 1684 | |
| 1685 | ||
| 1685 | Update MDB on disk | |
| 1686 | 1686 | |
| 1687 | ||
| 1687 | l2_img (I/O): level-2 image reference | |
| 1688 | 1688 | |
| 1689 | ||
| 1689 | Return imgtool error code | |
| 1690 | 1690 | */ |
| 1691 | 1691 | static imgtoolerr_t mfs_update_mdb(mac_l2_imgref *l2_img) |
| 1692 | 1692 | { |
| r5932 | r5933 | |
| 1775 | 1775 | } |
| 1776 | 1776 | |
| 1777 | 1777 | /* |
| 1778 | ||
| 1778 | mfs_dir_open | |
| 1779 | 1779 | |
| 1780 | ||
| 1780 | Open the directory file | |
| 1781 | 1781 | |
| 1782 | l2_img (I/O): level-2 image reference | |
| 1783 | dirref (O): open directory file reference | |
| 1782 | l2_img (I/O): level-2 image reference | |
| 1783 | dirref (O): open directory file reference | |
| 1784 | 1784 | |
| 1785 | ||
| 1785 | Return imgtool error code | |
| 1786 | 1786 | */ |
| 1787 | 1787 | static imgtoolerr_t mfs_dir_open(mac_l2_imgref *l2_img, const char *path, mfs_dirref *dirref) |
| 1788 | 1788 | { |
| r5932 | r5933 | |
| 1806 | 1806 | } |
| 1807 | 1807 | |
| 1808 | 1808 | /* |
| 1809 | ||
| 1809 | mfs_dir_read | |
| 1810 | 1810 | |
| 1811 | ||
| 1811 | Read one entry of directory file | |
| 1812 | 1812 | |
| 1813 | dirref (I/O): open directory file reference | |
| 1814 | dir_entry (O): set to point to the entry read: set to NULL if EOF or error | |
| 1813 | dirref (I/O): open directory file reference | |
| 1814 | dir_entry (O): set to point to the entry read: set to NULL if EOF or error | |
| 1815 | 1815 | |
| 1816 | ||
| 1816 | Return imgtool error code | |
| 1817 | 1817 | */ |
| 1818 | 1818 | static imgtoolerr_t mfs_dir_read(mfs_dirref *dirref, mfs_dir_entry **dir_entry) |
| 1819 | 1819 | { |
| r5932 | r5933 | |
| 1866 | 1866 | } |
| 1867 | 1867 | |
| 1868 | 1868 | /* |
| 1869 | ||
| 1869 | mfs_dir_insert | |
| 1870 | 1870 | |
| 1871 | ||
| 1871 | Add an entry in the directory file | |
| 1872 | 1872 | |
| 1873 | l2_img (I/O): level-2 image reference | |
| 1874 | dirref (I/O): open directory file reference | |
| 1875 | filename (I): name of the file for which an entry is created (Mac string) | |
| 1876 | dir_entry (O): set to point to the created entry: set to NULL if EOF or | |
| 1877 | error | |
| 1873 | l2_img (I/O): level-2 image reference | |
| 1874 | dirref (I/O): open directory file reference | |
| 1875 | filename (I): name of the file for which an entry is created (Mac string) | |
| 1876 | dir_entry (O): set to point to the created entry: set to NULL if EOF or | |
| 1877 | error | |
| 1878 | 1878 | |
| 1879 | ||
| 1879 | Return imgtool error code | |
| 1880 | 1880 | */ |
| 1881 | 1881 | static imgtoolerr_t mfs_dir_insert(mac_l2_imgref *l2_img, mfs_dirref *dirref, const UINT8 *new_fname, mfs_dir_entry **dir_entry) |
| 1882 | 1882 | { |
| r5932 | r5933 | |
| 1961 | 1961 | } |
| 1962 | 1962 | |
| 1963 | 1963 | /* |
| 1964 | ||
| 1964 | mfs_dir_update | |
| 1965 | 1965 | |
| 1966 | ||
| 1966 | Update one entry of directory file | |
| 1967 | 1967 | |
| 1968 | ||
| 1968 | fileref (I/O): open file reference | |
| 1969 | 1969 | |
| 1970 | ||
| 1970 | Return imgtool error code | |
| 1971 | 1971 | */ |
| 1972 | 1972 | static imgtoolerr_t mfs_dir_update(mac_fileref *fileref) |
| 1973 | 1973 | { |
| r5932 | r5933 | |
| 2029 | 2029 | |
| 2030 | 2030 | |
| 2031 | 2031 | /* |
| 2032 | ||
| 2032 | mfs_find_dir_entry | |
| 2033 | 2033 | |
| 2034 | ||
| 2034 | Find a file in an MFS directory | |
| 2035 | 2035 | |
| 2036 | dirref (I/O): open directory file reference | |
| 2037 | filename (I): file name (Mac string) | |
| 2038 | dir_entry (O): set to point to the entry read: set to NULL if EOF or error | |
| 2036 | dirref (I/O): open directory file reference | |
| 2037 | filename (I): file name (Mac string) | |
| 2038 | dir_entry (O): set to point to the entry read: set to NULL if EOF or error | |
| 2039 | 2039 | |
| 2040 | ||
| 2040 | Return imgtool error code | |
| 2041 | 2041 | */ |
| 2042 | 2042 | static imgtoolerr_t mfs_find_dir_entry(mfs_dirref *dirref, const mac_str255 filename, mfs_dir_entry **dir_entry) |
| 2043 | 2043 | { |
| r5932 | r5933 | |
| 2070 | 2070 | } |
| 2071 | 2071 | |
| 2072 | 2072 | /* |
| 2073 | ||
| 2073 | mfs_lookup_path | |
| 2074 | 2074 | |
| 2075 | Resolve a file path for MFS volumes. This function should not be called | |
| 2076 | directly: call mac_lookup_path instead. | |
| 2075 | Resolve a file path for MFS volumes. This function should not be called | |
| 2076 | directly: call mac_lookup_path instead. | |
| 2077 | 2077 | |
| 2078 | l2_img (I/O): level-2 image reference | |
| 2079 | fpath (I): file path (C string) | |
| 2080 | filename (O): set to the actual name of the file, with capitalization matching | |
| 2081 | the one on the volume rather than the one in the fpath parameter (Mac | |
| 2082 | string) | |
| 2083 | cat_info (I/O): on output, catalog info for this file extracted from the | |
| 2084 | catalog file (may be NULL) | |
| 2085 | If create_it is TRUE, created info will first be set according to the | |
| 2086 | data from cat_info | |
| 2087 | create_it (I): TRUE if entry should be created if not found | |
| 2078 | l2_img (I/O): level-2 image reference | |
| 2079 | fpath (I): file path (C string) | |
| 2080 | filename (O): set to the actual name of the file, with capitalization matching | |
| 2081 | the one on the volume rather than the one in the fpath parameter (Mac | |
| 2082 | string) | |
| 2083 | cat_info (I/O): on output, catalog info for this file extracted from the | |
| 2084 | catalog file (may be NULL) | |
| 2085 | If create_it is TRUE, created info will first be set according to the | |
| 2086 | data from cat_info | |
| 2087 | create_it (I): TRUE if entry should be created if not found | |
| 2088 | 2088 | |
| 2089 | ||
| 2089 | Return imgtool error code | |
| 2090 | 2090 | */ |
| 2091 | 2091 | static imgtoolerr_t mfs_lookup_path(mac_l2_imgref *l2_img, const char *fpath, mac_str255 filename, mac_dirent *cat_info, int create_it) |
| 2092 | 2092 | { |
| r5932 | r5933 | |
| 2145 | 2145 | } |
| 2146 | 2146 | |
| 2147 | 2147 | /* |
| 2148 | ||
| 2148 | mfs_file_open_internal | |
| 2149 | 2149 | |
| 2150 | Open a file fork, given its directory entry. This function should not be | |
| 2151 | called directly: call mfs_file_open instead. | |
| 2150 | Open a file fork, given its directory entry. This function should not be | |
| 2151 | called directly: call mfs_file_open instead. | |
| 2152 | 2152 | |
| 2153 | l2_img (I/O): level-2 image reference | |
| 2154 | dir_entry (I): directory entry for the file to open | |
| 2155 | mac_forkID (I): tells which fork should be opened | |
| 2156 | fileref (O): mac file reference to open | |
| 2153 | l2_img (I/O): level-2 image reference | |
| 2154 | dir_entry (I): directory entry for the file to open | |
| 2155 | mac_forkID (I): tells which fork should be opened | |
| 2156 | fileref (O): mac file reference to open | |
| 2157 | 2157 | |
| 2158 | ||
| 2158 | Return imgtool error code | |
| 2159 | 2159 | */ |
| 2160 | 2160 | static imgtoolerr_t mfs_file_open_internal(mac_l2_imgref *l2_img, const mfs_dir_entry *dir_entry, mac_forkID fork, mac_fileref *fileref) |
| 2161 | 2161 | { |
| r5932 | r5933 | |
| 2189 | 2189 | } |
| 2190 | 2190 | |
| 2191 | 2191 | /* |
| 2192 | ||
| 2192 | mfs_file_open | |
| 2193 | 2193 | |
| 2194 | Open a file located on a MFS volume. This function should not be called | |
| 2195 | directly: call mac_file_open instead. | |
| 2194 | Open a file located on a MFS volume. This function should not be called | |
| 2195 | directly: call mac_file_open instead. | |
| 2196 | 2196 | |
| 2197 | l2_img (I/O): level-2 image reference | |
| 2198 | filename (I): name of the file (Mac string) | |
| 2199 | mac_forkID (I): tells which fork should be opened | |
| 2200 | fileref (O): mac file reference to open | |
| 2197 | l2_img (I/O): level-2 image reference | |
| 2198 | filename (I): name of the file (Mac string) | |
| 2199 | mac_forkID (I): tells which fork should be opened | |
| 2200 | fileref (O): mac file reference to open | |
| 2201 | 2201 | |
| 2202 | ||
| 2202 | Return imgtool error code | |
| 2203 | 2203 | */ |
| 2204 | 2204 | static imgtoolerr_t mfs_file_open(mac_l2_imgref *l2_img, const mac_str255 filename, mac_forkID fork, mac_fileref *fileref) |
| 2205 | 2205 | { |
| r5932 | r5933 | |
| 2220 | 2220 | } |
| 2221 | 2221 | |
| 2222 | 2222 | /* |
| 2223 | ||
| 2223 | mfs_get_ABlink | |
| 2224 | 2224 | |
| 2225 | ||
| 2225 | Read one entry of the Allocation Bitmap link array, on an MFS volume. | |
| 2226 | 2226 | |
| 2227 | l2_img (I/O): level-2 image reference | |
| 2228 | AB_address (I): index in the array, which is an AB address | |
| 2227 | l2_img (I/O): level-2 image reference | |
| 2228 | AB_address (I): index in the array, which is an AB address | |
| 2229 | 2229 | |
| 2230 | ||
| 2230 | Returns the 12-bit value read in array. | |
| 2231 | 2231 | */ |
| 2232 | 2232 | static UINT16 mfs_get_ABlink(mac_l2_imgref *l2_img, UINT16 AB_address) |
| 2233 | 2233 | { |
| r5932 | r5933 | |
| 2247 | 2247 | } |
| 2248 | 2248 | |
| 2249 | 2249 | /* |
| 2250 | ||
| 2250 | mfs_set_ABlink | |
| 2251 | 2251 | |
| 2252 | ||
| 2252 | Set one entry of the Allocation Bitmap link array, on an MFS volume. | |
| 2253 | 2253 | |
| 2254 | l2_img (I/O): level-2 image reference | |
| 2255 | AB_address (I): index in the array, which is an AB address | |
| 2256 | data (I): 12-bit value to write in array | |
| 2254 | l2_img (I/O): level-2 image reference | |
| 2255 | AB_address (I): index in the array, which is an AB address | |
| 2256 | data (I): 12-bit value to write in array | |
| 2257 | 2257 | */ |
| 2258 | 2258 | static void mfs_set_ABlink(mac_l2_imgref *l2_img, UINT16 AB_address, UINT16 data) |
| 2259 | 2259 | { |
| r5932 | r5933 | |
| 2282 | 2282 | } |
| 2283 | 2283 | |
| 2284 | 2284 | /* |
| 2285 | ||
| 2285 | mfs_file_get_nth_block_address | |
| 2286 | 2286 | |
| 2287 | Get the disk block address of a given block in an open file on a MFS image. | |
| 2288 | Called by macintosh file code. | |
| 2287 | Get the disk block address of a given block in an open file on a MFS image. | |
| 2288 | Called by macintosh file code. | |
| 2289 | 2289 | |
| 2290 | fileref (I/O): open mac file reference | |
| 2291 | block_num (I): file block index | |
| 2292 | block_address (O): disk block address for the file block | |
| 2290 | fileref (I/O): open mac file reference | |
| 2291 | block_num (I): file block index | |
| 2292 | block_address (O): disk block address for the file block | |
| 2293 | 2293 | |
| 2294 | ||
| 2294 | Return imgtool error code | |
| 2295 | 2295 | */ |
| 2296 | 2296 | static imgtoolerr_t mfs_file_get_nth_block_address(mac_fileref *fileref, UINT32 block_num, UINT32 *block_address) |
| 2297 | 2297 | { |
| r5932 | r5933 | |
| 2316 | 2316 | AB_address = mfs_get_ABlink(fileref->l2_img, AB_address); |
| 2317 | 2317 | if ((AB_address == 0) || (AB_address >= fileref->l2_img->numABs+2)) |
| 2318 | 2318 | /* 0 -> empty block: there is no way an empty block could make it |
| 2319 | ||
| 2319 | into the link chain!!! */ | |
| 2320 | 2320 | return IMGTOOLERR_CORRUPTIMAGE; |
| 2321 | 2321 | if (AB_address == 1) |
| 2322 | 2322 | /* EOF */ |
| r5932 | r5933 | |
| 2331 | 2331 | } |
| 2332 | 2332 | |
| 2333 | 2333 | /* |
| 2334 | ||
| 2334 | mfs_file_allocABs | |
| 2335 | 2335 | |
| 2336 | ||
| 2336 | Allocate a chunk of ABs | |
| 2337 | 2337 | |
| 2338 | fileref (I/O): open mac file reference | |
| 2339 | lastAB (I): AB address on disk of last file AB (only if | |
| 2340 | fileref->u.mfs.stBlk != 1) | |
| 2341 | allocABs (I): number of ABs to allocate in addition to the current file | |
| 2342 | allocation | |
| 2343 | fblock (I): first file block to allocate (used for tag data) | |
| 2338 | fileref (I/O): open mac file reference | |
| 2339 | lastAB (I): AB address on disk of last file AB (only if | |
| 2340 | fileref->u.mfs.stBlk != 1) | |
| 2341 | allocABs (I): number of ABs to allocate in addition to the current file | |
| 2342 | allocation | |
| 2343 | fblock (I): first file block to allocate (used for tag data) | |
| 2344 | 2344 | |
| 2345 | ||
| 2345 | Return imgtool error code | |
| 2346 | 2346 | */ |
| 2347 | 2347 | static imgtoolerr_t mfs_file_allocABs(mac_fileref *fileref, UINT16 lastAB, UINT32 allocABs, UINT32 fblock) |
| 2348 | 2348 | { |
| r5932 | r5933 | |
| 2575 | 2575 | } |
| 2576 | 2576 | |
| 2577 | 2577 | /* |
| 2578 | ||
| 2578 | mfs_file_setABeof | |
| 2579 | 2579 | |
| 2580 | ||
| 2580 | Set physical file EOF in ABs | |
| 2581 | 2581 | |
| 2582 | fileref (I/O): open mac file reference | |
| 2583 | newABeof (I): desired number of allocated ABs for this file | |
| 2582 | fileref (I/O): open mac file reference | |
| 2583 | newABeof (I): desired number of allocated ABs for this file | |
| 2584 | 2584 | |
| 2585 | ||
| 2585 | Return imgtool error code | |
| 2586 | 2586 | */ |
| 2587 | 2587 | static imgtoolerr_t mfs_file_setABeof(mac_fileref *fileref, UINT32 newABeof) |
| 2588 | 2588 | { |
| r5932 | r5933 | |
| 2607 | 2607 | AB_link = mfs_get_ABlink(fileref->l2_img, AB_address); |
| 2608 | 2608 | if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2)) |
| 2609 | 2609 | /* 0 -> empty block: there is no way an empty block could make it |
| 2610 | ||
| 2610 | into the link chain!!! */ | |
| 2611 | 2611 | return IMGTOOLERR_CORRUPTIMAGE; |
| 2612 | 2612 | |
| 2613 | 2613 | if (TAG_CHECKS) |
| r5932 | r5933 | |
| 2650 | 2650 | AB_link = mfs_get_ABlink(fileref->l2_img, AB_address); |
| 2651 | 2651 | if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2)) |
| 2652 | 2652 | { /* 0 -> empty block: there is no way an empty block could make |
| 2653 | ||
| 2653 | it into the link chain!!! */ | |
| 2654 | 2654 | if (MDB_dirty) |
| 2655 | 2655 | { /* update MDB (freeABs field) and ABLink array */ |
| 2656 | 2656 | err = mfs_update_mdb(fileref->l2_img); |
| r5932 | r5933 | |
| 2720 | 2720 | |
| 2721 | 2721 | #ifdef UNUSED_FUNCTION |
| 2722 | 2722 | /* |
| 2723 | ||
| 2723 | mfs_hashString | |
| 2724 | 2724 | |
| 2725 | Hash a string: under MFS, this provides the resource ID of the comment | |
| 2726 | resource associated with the file whose name is provided (FCMT resource | |
| 2727 | type). | |
| 2725 | Hash a string: under MFS, this provides the resource ID of the comment | |
| 2726 | resource associated with the file whose name is provided (FCMT resource | |
| 2727 | type). | |
| 2728 | 2728 | |
| 2729 | ||
| 2729 | Ripped from Apple technote TB06 (converted from 68k ASM to C) | |
| 2730 | 2730 | |
| 2731 | ||
| 2731 | string (I): string to hash | |
| 2732 | 2732 | |
| 2733 | ||
| 2733 | Returns hash value | |
| 2734 | 2734 | */ |
| 2735 | 2735 | static int mfs_hashString(const mac_str255 string) |
| 2736 | 2736 | { |
| r5932 | r5933 | |
| 2762 | 2762 | #endif |
| 2763 | 2763 | |
| 2764 | 2764 | /* |
| 2765 | ||
| 2765 | HFS extents B-tree key | |
| 2766 | 2766 | */ |
| 2767 | 2767 | typedef struct hfs_extentKey |
| 2768 | 2768 | { |
| r5932 | r5933 | |
| 2777 | 2777 | }; |
| 2778 | 2778 | |
| 2779 | 2779 | /* |
| 2780 | ||
| 2780 | HFS catalog B-tree key | |
| 2781 | 2781 | */ |
| 2782 | 2782 | typedef struct hfs_catKey |
| 2783 | 2783 | { |
| r5932 | r5933 | |
| 2786 | 2786 | UINT32BE parID; /* parent directory ID */ |
| 2787 | 2787 | mac_str31 cName; /* catalog node name */ |
| 2788 | 2788 | /* note that in index nodes, it is a mac_str31, but |
| 2789 | ||
| 2789 | in leaf keys it's a variable-length string */ | |
| 2790 | 2790 | } hfs_catKey; |
| 2791 | 2791 | |
| 2792 | 2792 | /* |
| 2793 | ||
| 2793 | HFS catalog data record for a folder - 70 bytes | |
| 2794 | 2794 | */ |
| 2795 | 2795 | typedef struct hfs_catFolderData |
| 2796 | 2796 | { |
| r5932 | r5933 | |
| 2807 | 2807 | } hfs_catFolderData; |
| 2808 | 2808 | |
| 2809 | 2809 | /* |
| 2810 | ||
| 2810 | HFS catalog data record for a file - 102 bytes | |
| 2811 | 2811 | */ |
| 2812 | 2812 | typedef struct hfs_catFileData |
| 2813 | 2813 | { |
| r5932 | r5933 | |
| 2833 | 2833 | } hfs_catFileData; |
| 2834 | 2834 | |
| 2835 | 2835 | /* |
| 2836 | ||
| 2836 | HFS catalog data record for a thread - 46 bytes | |
| 2837 | 2837 | |
| 2838 | The key for a thread record features the CNID of the item and an empty | |
| 2839 | name, instead of the CNID of the parent and the item name. | |
| 2838 | The key for a thread record features the CNID of the item and an empty | |
| 2839 | name, instead of the CNID of the parent and the item name. | |
| 2840 | 2840 | */ |
| 2841 | 2841 | typedef struct hfs_catThreadData |
| 2842 | 2842 | { |
| r5932 | r5933 | |
| 2847 | 2847 | } hfs_catThreadData; |
| 2848 | 2848 | |
| 2849 | 2849 | /* |
| 2850 | ||
| 2850 | union for all types at once | |
| 2851 | 2851 | */ |
| 2852 | 2852 | typedef union hfs_catData |
| 2853 | 2853 | { |
| r5932 | r5933 | |
| 2858 | 2858 | } hfs_catData; |
| 2859 | 2859 | |
| 2860 | 2860 | /* |
| 2861 | ||
| 2861 | HFS catalog record types | |
| 2862 | 2862 | */ |
| 2863 | 2863 | enum |
| 2864 | 2864 | { |
| r5932 | r5933 | |
| 2869 | 2869 | }; |
| 2870 | 2870 | |
| 2871 | 2871 | /* |
| 2872 | ||
| 2872 | Catalog file record flags | |
| 2873 | 2873 | |
| 2874 | This is similar to the MFS catalog flag field, but the "thread exists" flag | |
| 2875 | (0x02) is specific to HFS/HFS+, whereas the "Record in use" flag (0x80) is | |
| 2876 | only used by MFS. | |
| 2874 | This is similar to the MFS catalog flag field, but the "thread exists" flag | |
| 2875 | (0x02) is specific to HFS/HFS+, whereas the "Record in use" flag (0x80) is | |
| 2876 | only used by MFS. | |
| 2877 | 2877 | */ |
| 2878 | 2878 | enum |
| 2879 | 2879 | { |
| r5932 | r5933 | |
| 2882 | 2882 | }; |
| 2883 | 2883 | |
| 2884 | 2884 | /* |
| 2885 | ||
| 2885 | BT functions used by HFS functions | |
| 2886 | 2886 | */ |
| 2887 | 2887 | typedef struct BT_leaf_rec_enumerator |
| 2888 | 2888 | { |
| r5932 | r5933 | |
| 2909 | 2909 | } hfs_cat_enumerator; |
| 2910 | 2910 | |
| 2911 | 2911 | /* |
| 2912 | ||
| 2912 | hfs_open_extents_file | |
| 2913 | 2913 | |
| 2914 | ||
| 2914 | Open the file extents B-tree file | |
| 2915 | 2915 | |
| 2916 | l2_img (I/O): level-2 image reference | |
| 2917 | mdb (I): copy of the MDB block | |
| 2918 | fileref (O): mac open file reference | |
| 2916 | l2_img (I/O): level-2 image reference | |
| 2917 | mdb (I): copy of the MDB block | |
| 2918 | fileref (O): mac open file reference | |
| 2919 | 2919 | |
| 2920 | ||
| 2920 | Return imgtool error code | |
| 2921 | 2921 | */ |
| 2922 | 2922 | static imgtoolerr_t hfs_open_extents_file(mac_l2_imgref *l2_img, const hfs_mdb *mdb, mac_fileref *fileref) |
| 2923 | 2923 | { |
| r5932 | r5933 | |
| 2939 | 2939 | } |
| 2940 | 2940 | |
| 2941 | 2941 | /* |
| 2942 | ||
| 2942 | hfs_open_cat_file | |
| 2943 | 2943 | |
| 2944 | ||
| 2944 | Open the disk catalog B-tree file | |
| 2945 | 2945 | |
| 2946 | l2_img (I/O): level-2 image reference | |
| 2947 | mdb (I): copy of the MDB block | |
| 2948 | fileref (O): mac open file reference | |
| 2946 | l2_img (I/O): level-2 image reference | |
| 2947 | mdb (I): copy of the MDB block | |
| 2948 | fileref (O): mac open file reference | |
| 2949 | 2949 | |
| 2950 | ||
| 2950 | Return imgtool error code | |
| 2951 | 2951 | */ |
| 2952 | 2952 | static imgtoolerr_t hfs_open_cat_file(mac_l2_imgref *l2_img, const hfs_mdb *mdb, mac_fileref *fileref) |
| 2953 | 2953 | { |
| r5932 | r5933 | |
| 2969 | 2969 | } |
| 2970 | 2970 | |
| 2971 | 2971 | /* |
| 2972 | ||
| 2972 | hfs_extentKey_compare | |
| 2973 | 2973 | |
| 2974 | ||
| 2974 | key compare function for file extents B-tree | |
| 2975 | 2975 | |
| 2976 | p1 (I): pointer to first key | |
| 2977 | p2 (I): pointer to second key | |
| 2976 | p1 (I): pointer to first key | |
| 2977 | p2 (I): pointer to second key | |
| 2978 | 2978 | |
| 2979 | Return a zero the two keys are equal, a negative value if the key pointed | |
| 2980 | to by p1 is less than the key pointed to by p2, and a positive value if the | |
| 2981 | key pointed to by p1 is greater than the key pointed to by p2. | |
| 2979 | Return a zero the two keys are equal, a negative value if the key pointed | |
| 2980 | to by p1 is less than the key pointed to by p2, and a positive value if the | |
| 2981 | key pointed to by p1 is greater than the key pointed to by p2. | |
| 2982 | 2982 | */ |
| 2983 | 2983 | static int hfs_extentKey_compare(const void *p1, const void *p2) |
| 2984 | 2984 | { |
| r5932 | r5933 | |
| 2990 | 2990 | } |
| 2991 | 2991 | |
| 2992 | 2992 | /* |
| 2993 | ||
| 2993 | hfs_catKey_compare | |
| 2994 | 2994 | |
| 2995 | ||
| 2995 | key compare function for disk catalog B-tree | |
| 2996 | 2996 | |
| 2997 | p1 (I): pointer to first key | |
| 2998 | p2 (I): pointer to second key | |
| 2997 | p1 (I): pointer to first key | |
| 2998 | p2 (I): pointer to second key | |
| 2999 | 2999 | |
| 3000 | Return a zero the two keys are equal, a negative value if the key pointed | |
| 3001 | to by p1 is less than the key pointed to by p2, and a positive value if the | |
| 3002 | key pointed to by p1 is greater than the key pointed to by p2. | |
| 3000 | Return a zero the two keys are equal, a negative value if the key pointed | |
| 3001 | to by p1 is less than the key pointed to by p2, and a positive value if the | |
| 3002 | key pointed to by p1 is greater than the key pointed to by p2. | |
| 3003 | 3003 | */ |
| 3004 | 3004 | static int hfs_catKey_compare(const void *p1, const void *p2) |
| 3005 | 3005 | { |
| r5932 | r5933 | |
| 3013 | 3013 | } |
| 3014 | 3014 | |
| 3015 | 3015 | /* |
| 3016 | ||
| 3016 | hfs_image_open | |
| 3017 | 3017 | |
| 3018 | ||
| 3018 | Open a HFS image. Image must already be open on level 1. | |
| 3019 | 3019 | |
| 3020 | l2_img (I/O): level-2 image reference to open (l1_img and format fields | |
| 3021 | must be initialized) | |
| 3022 | img_open_buf (I): buffer with the MDB block | |
| 3020 | l2_img (I/O): level-2 image reference to open (l1_img and format fields | |
| 3021 | must be initialized) | |
| 3022 | img_open_buf (I): buffer with the MDB block | |
| 3023 | 3023 | |
| 3024 | ||
| 3024 | Return imgtool error code | |
| 3025 | 3025 | */ |
| 3026 | 3026 | static imgtoolerr_t hfs_image_open(imgtool_image *image, imgtool_stream *stream) |
| 3027 | 3027 | { |
| r5932 | r5933 | |
| 3072 | 3072 | || (l2_img->u.hfs.extents_BT.maxKeyLength != 7)) |
| 3073 | 3073 | { /* This is not supported by the HFS format */ |
| 3074 | 3074 | /* Variable Index keys are not supported either, but hopefully it will |
| 3075 | not break this imgtool module if it set (though it would probably break | |
| 3076 | a real macintosh) */ | |
| 3075 | not break this imgtool module if it set (though it would probably break | |
| 3076 | a real macintosh) */ | |
| 3077 | 3077 | BT_close(&l2_img->u.hfs.extents_BT); |
| 3078 | 3078 | return IMGTOOLERR_CORRUPTIMAGE; |
| 3079 | 3079 | } |
| r5932 | r5933 | |
| 3093 | 3093 | || (l2_img->u.hfs.cat_BT.maxKeyLength != 37)) |
| 3094 | 3094 | { /* This is not supported by the HFS format */ |
| 3095 | 3095 | /* Variable Index keys are not supported either, but hopefully it will |
| 3096 | not break this imgtool module if it set (though it would probably break | |
| 3097 | a real macintosh) */ | |
| 3096 | not break this imgtool module if it set (though it would probably break | |
| 3097 | a real macintosh) */ | |
| 3098 | 3098 | BT_close(&l2_img->u.hfs.extents_BT); |
| 3099 | 3099 | BT_close(&l2_img->u.hfs.cat_BT); |
| 3100 | 3100 | return IMGTOOLERR_CORRUPTIMAGE; |
| r5932 | r5933 | |
| 3125 | 3125 | |
| 3126 | 3126 | #ifdef UNUSED_FUNCTION |
| 3127 | 3127 | /* |
| 3128 | ||
| 3128 | hfs_image_close | |
| 3129 | 3129 | |
| 3130 | ||
| 3130 | Close a HFS image. | |
| 3131 | 3131 | |
| 3132 | ||
| 3132 | l2_img (I/O): level-2 image reference | |
| 3133 | 3133 | */ |
| 3134 | 3134 | static void hfs_image_close(mac_l2_imgref *l2_img) |
| 3135 | 3135 | { |
| r5932 | r5933 | |
| 3141 | 3141 | #endif |
| 3142 | 3142 | |
| 3143 | 3143 | /* |
| 3144 | ||
| 3144 | hfs_get_cat_record_data | |
| 3145 | 3145 | |
| 3146 | ||
| 3146 | extract data from a catalog B-tree leaf record | |
| 3147 | 3147 | |
| 3148 | l2_img (I/O): level-2 image reference | |
| 3149 | rec_raw (I): pointer to record key and data, as returned by | |
| 3150 | BT_node_get_keyed_record | |
| 3151 | rec_len (I): total length of record, as returned by | |
| 3152 | BT_node_get_keyed_record | |
| 3153 | rec_key (O): set to point to record key | |
| 3154 | rec_data (O): set to point to record data | |
| 3148 | l2_img (I/O): level-2 image reference | |
| 3149 | rec_raw (I): pointer to record key and data, as returned by | |
| 3150 | BT_node_get_keyed_record | |
| 3151 | rec_len (I): total length of record, as returned by | |
| 3152 | BT_node_get_keyed_record | |
| 3153 | rec_key (O): set to point to record key | |
| 3154 | rec_data (O): set to point to record data | |
| 3155 | 3155 | |
| 3156 | ||
| 3156 | Return imgtool error code | |
| 3157 | 3157 | */ |
| 3158 | 3158 | static imgtoolerr_t hfs_get_cat_record_data(mac_l2_imgref *l2_img, void *rec_raw, int rec_len, hfs_catKey **rec_key, hfs_catData **rec_data) |
| 3159 | 3159 | { |
| r5932 | r5933 | |
| 3216 | 3216 | } |
| 3217 | 3217 | |
| 3218 | 3218 | /* |
| 3219 | ||
| 3219 | hfs_cat_open | |
| 3220 | 3220 | |
| 3221 | ||
| 3221 | Open an enumerator on the disk catalog | |
| 3222 | 3222 | |
| 3223 | l2_img (I/O): level-2 image reference | |
| 3224 | enumerator (O): open catalog enumerator reference | |
| 3223 | l2_img (I/O): level-2 image reference | |
| 3224 | enumerator (O): open catalog enumerator reference | |
| 3225 | 3225 | |
| 3226 | ||
| 3226 | Return imgtool error code | |
| 3227 | 3227 | */ |
| 3228 | 3228 | static imgtoolerr_t hfs_cat_open(mac_l2_imgref *l2_img, const char *path, hfs_cat_enumerator *enumerator) |
| 3229 | 3229 | { |
| r5932 | r5933 | |
| 3248 | 3248 | } |
| 3249 | 3249 | |
| 3250 | 3250 | /* |
| 3251 | ||
| 3251 | hfs_cat_read | |
| 3252 | 3252 | |
| 3253 | ||
| 3253 | Enumerate the disk catalog | |
| 3254 | 3254 | |
| 3255 | enumerator (I/O): open catalog enumerator reference | |
| 3256 | rec_key (O): set to point to record key | |
| 3257 | rec_data (O): set to point to record data | |
| 3255 | enumerator (I/O): open catalog enumerator reference | |
| 3256 | rec_key (O): set to point to record key | |
| 3257 | rec_data (O): set to point to record data | |
| 3258 | 3258 | |
| 3259 | ||
| 3259 | Return imgtool error code | |
| 3260 | 3260 | */ |
| 3261 | 3261 | static imgtoolerr_t hfs_cat_read(hfs_cat_enumerator *enumerator, hfs_catKey **rec_key, hfs_catData **rec_data) |
| 3262 | 3262 | { |
| r5932 | r5933 | |
| 3286 | 3286 | } |
| 3287 | 3287 | |
| 3288 | 3288 | /* |
| 3289 | ||
| 3289 | hfs_cat_search | |
| 3290 | 3290 | |
| 3291 | ||
| 3291 | Search the catalog for a given file | |
| 3292 | 3292 | |
| 3293 | l2_img (I/O): level-2 image reference | |
| 3294 | parID (I): CNID of file parent directory | |
| 3295 | cName (I): file name | |
| 3296 | rec_key (O): set to point to record key | |
| 3297 | rec_data (O): set to point to record data | |
| 3293 | l2_img (I/O): level-2 image reference | |
| 3294 | parID (I): CNID of file parent directory | |
| 3295 | cName (I): file name | |
| 3296 | rec_key (O): set to point to record key | |
| 3297 | rec_data (O): set to point to record data | |
| 3298 | 3298 | |
| 3299 | ||
| 3299 | Return imgtool error code | |
| 3300 | 3300 | */ |
| 3301 | 3301 | static imgtoolerr_t hfs_cat_search(mac_l2_imgref *l2_img, UINT32 parID, const mac_str31 cName, hfs_catKey **rec_key, hfs_catData **rec_data) |
| 3302 | 3302 | { |
| r5932 | r5933 | |
| 3312 | 3312 | |
| 3313 | 3313 | /* generate search key */ |
| 3314 | 3314 | search_key.keyLen = search_key.resrv1 = 0; /* these fields do not matter |
| 3315 | to the compare function, so we | |
| 3316 | don't fill them */ | |
| 3315 | to the compare function, so we | |
| 3316 | don't fill them */ | |
| 3317 | 3317 | set_UINT32BE(&search_key.parID, parID); |
| 3318 | 3318 | mac_strcpy(search_key.cName, cName); |
| 3319 | 3319 | |
| r5932 | r5933 | |
| 3331 | 3331 | } |
| 3332 | 3332 | |
| 3333 | 3333 | /* |
| 3334 | ||
| 3334 | hfs_lookup_path | |
| 3335 | 3335 | |
| 3336 | ||
| 3336 | Resolve a file path | |
| 3337 | 3337 | |
| 3338 | l2_img (I/O): level-2 image reference | |
| 3339 | fpath (I): file path (C string) | |
| 3340 | parID (O): set to the CNID of the file parent directory | |
| 3341 | filename (O): set to the actual name of the file, with capitalization matching | |
| 3342 | the one on the volume rather than the one in the fpath parameter (Mac | |
| 3343 | string) | |
| 3344 | cat_info (O): catalog info for this file extracted from the catalog file | |
| 3345 | (may be NULL) | |
| 3338 | l2_img (I/O): level-2 image reference | |
| 3339 | fpath (I): file path (C string) | |
| 3340 | parID (O): set to the CNID of the file parent directory | |
| 3341 | filename (O): set to the actual name of the file, with capitalization matching | |
| 3342 | the one on the volume rather than the one in the fpath parameter (Mac | |
| 3343 | string) | |
| 3344 | cat_info (O): catalog info for this file extracted from the catalog file | |
| 3345 | (may be NULL) | |
| 3346 | 3346 | |
| 3347 | ||
| 3347 | Return imgtool error code | |
| 3348 | 3348 | */ |
| 3349 | 3349 | static imgtoolerr_t hfs_lookup_path(mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info) |
| 3350 | 3350 | { |
| r5932 | r5933 | |
| 3418 | 3418 | } |
| 3419 | 3419 | |
| 3420 | 3420 | /* |
| 3421 | ||
| 3421 | hfs_file_open_internal | |
| 3422 | 3422 | |
| 3423 | Open a file fork, given its catalog entry. This function should not be | |
| 3424 | called directly: call hfs_file_open instead. | |
| 3423 | Open a file fork, given its catalog entry. This function should not be | |
| 3424 | called directly: call hfs_file_open instead. | |
| 3425 | 3425 | |
| 3426 | l2_img (I/O): level-2 image reference | |
| 3427 | file_rec (I): catalog entry for the file to open | |
| 3428 | mac_forkID (I): tells which fork should be opened | |
| 3429 | fileref (O): mac file reference to open | |
| 3426 | l2_img (I/O): level-2 image reference | |
| 3427 | file_rec (I): catalog entry for the file to open | |
| 3428 | mac_forkID (I): tells which fork should be opened | |
| 3429 | fileref (O): mac file reference to open | |
| 3430 | 3430 | |
| 3431 | ||
| 3431 | Return imgtool error code | |
| 3432 | 3432 | */ |
| 3433 | 3433 | static imgtoolerr_t hfs_file_open_internal(mac_l2_imgref *l2_img, const hfs_catFileData *file_rec, mac_forkID fork, mac_fileref *fileref) |
| 3434 | 3434 | { |
| r5932 | r5933 | |
| 3462 | 3462 | } |
| 3463 | 3463 | |
| 3464 | 3464 | /* |
| 3465 | ||
| 3465 | hfs_file_open | |
| 3466 | 3466 | |
| 3467 | Open a file located on a HFS volume. This function should not be called | |
| 3468 | directly: call mac_file_open instead. | |
| 3467 | Open a file located on a HFS volume. This function should not be called | |
| 3468 | directly: call mac_file_open instead. | |
| 3469 | 3469 | |
| 3470 | l2_img (I/O): level-2 image reference | |
| 3471 | parID (I): CNID of file parent directory | |
| 3472 | filename (I): name of the file (Mac string) | |
| 3473 | mac_forkID (I): tells which fork should be opened | |
| 3474 | fileref (O): mac file reference to open | |
| 3470 | l2_img (I/O): level-2 image reference | |
| 3471 | parID (I): CNID of file parent directory | |
| 3472 | filename (I): name of the file (Mac string) | |
| 3473 | mac_forkID (I): tells which fork should be opened | |
| 3474 | fileref (O): mac file reference to open | |
| 3475 | 3475 | |
| 3476 | ||
| 3476 | Return imgtool error code | |
| 3477 | 3477 | */ |
| 3478 | 3478 | static imgtoolerr_t hfs_file_open(mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, mac_fileref *fileref) |
| 3479 | 3479 | { |
| r5932 | r5933 | |
| 3501 | 3501 | } |
| 3502 | 3502 | |
| 3503 | 3503 | /* |
| 3504 | ||
| 3504 | hfs_file_get_nth_block_address | |
| 3505 | 3505 | |
| 3506 | Get the disk block address of a given block in an open file on a MFS image. | |
| 3507 | Called by macintosh file code. | |
| 3506 | Get the disk block address of a given block in an open file on a MFS image. | |
| 3507 | Called by macintosh file code. | |
| 3508 | 3508 | |
| 3509 | fileref (I/O): open mac file reference | |
| 3510 | block_num (I): file block index | |
| 3511 | block_address (O): disk block address for the file block | |
| 3509 | fileref (I/O): open mac file reference | |
| 3510 | block_num (I): file block index | |
| 3511 | block_address (O): disk block address for the file block | |
| 3512 | 3512 | |
| 3513 | ||
| 3513 | Return imgtool error code | |
| 3514 | 3514 | */ |
| 3515 | 3515 | static imgtoolerr_t hfs_file_get_nth_block_address(mac_fileref *fileref, UINT32 block_num, UINT32 *block_address) |
| 3516 | 3516 | { |
| r5932 | r5933 | |
| 3550 | 3550 | set_UINT16BE(&search_key.startBlock, AB_num); |
| 3551 | 3551 | |
| 3552 | 3552 | /* search for the record with the largest key lower than or equal to |
| 3553 | search_key. The keys are constructed in such a way that, if a record | |
| 3554 | includes AB_num, it is that one. */ | |
| 3553 | search_key. The keys are constructed in such a way that, if a record | |
| 3554 | includes AB_num, it is that one. */ | |
| 3555 | 3555 | err = BT_search_leaf_rec(&fileref->l2_img->u.hfs.extents_BT, &search_key, |
| 3556 | 3556 | NULL, NULL, &extents_BT_rec, &extents_BT_rec_len, |
| 3557 | 3557 | FALSE, NULL); |
| r5932 | r5933 | |
| 3606 | 3606 | #endif |
| 3607 | 3607 | |
| 3608 | 3608 | /* |
| 3609 | B-tree (Balanced search tree) files are used by the HFS and HFS+ file | |
| 3610 | systems: the Extents and Catalog files are both B-Tree. | |
| 3609 | B-tree (Balanced search tree) files are used by the HFS and HFS+ file | |
| 3610 | systems: the Extents and Catalog files are both B-Tree. | |
| 3611 | 3611 | |
| 3612 | Note that these B-trees are B+-trees: data is only on the leaf level, and | |
| 3613 | nodes located on the same level are also linked sequentially, which allows | |
| 3614 | fast sequenctial access to the catalog file. | |
| 3612 | Note that these B-trees are B+-trees: data is only on the leaf level, and | |
| 3613 | nodes located on the same level are also linked sequentially, which allows | |
| 3614 | fast sequenctial access to the catalog file. | |
| 3615 | 3615 | |
| 3616 | These files are normal files, except for the fact that they are not | |
| 3617 | referenced from the catalog but the MDB. They are allocated in fixed-size | |
| 3618 | records of 512 bytes (HFS). (HFS+ supports any power of two from 512 | |
| 3619 | through 32768, and uses a default of 1024 for Extents, and 4096 for both | |
| 3620 | Catalog and Attributes.) | |
| 3616 | These files are normal files, except for the fact that they are not | |
| 3617 | referenced from the catalog but the MDB. They are allocated in fixed-size | |
| 3618 | records of 512 bytes (HFS). (HFS+ supports any power of two from 512 | |
| 3619 | through 32768, and uses a default of 1024 for Extents, and 4096 for both | |
| 3620 | Catalog and Attributes.) | |
| 3621 | 3621 | |
| 3622 | Nodes can contain any number of records. The nodes can be of any of four | |
| 3623 | types: header node (unique node with b-tree information, pointer to root | |
| 3624 | node and start of the node allocation bitmap), map nodes (which are created | |
| 3625 | when the node allocation bitmap outgrows the header node), index nodes | |
| 3626 | (root and branch node that enable to efficiently search the leaf nodes for | |
| 3627 | a specific key value), and leaf nodes (which hold the actual user data | |
| 3628 | records with keys and data). The first node is always a header node. | |
| 3629 | Other nodes can be of any of the 3 other type, or they can be free. | |
| 3622 | Nodes can contain any number of records. The nodes can be of any of four | |
| 3623 | types: header node (unique node with b-tree information, pointer to root | |
| 3624 | node and start of the node allocation bitmap), map nodes (which are created | |
| 3625 | when the node allocation bitmap outgrows the header node), index nodes | |
| 3626 | (root and branch node that enable to efficiently search the leaf nodes for | |
| 3627 | a specific key value), and leaf nodes (which hold the actual user data | |
| 3628 | records with keys and data). The first node is always a header node. | |
| 3629 | Other nodes can be of any of the 3 other type, or they can be free. | |
| 3630 | 3630 | */ |
| 3631 | 3631 | |
| 3632 | 3632 | /* |
| 3633 | ||
| 3633 | BTNodeHeader | |
| 3634 | 3634 | |
| 3635 | ||
| 3635 | Header of a node record | |
| 3636 | 3636 | */ |
| 3637 | 3637 | typedef struct BTNodeHeader |
| 3638 | 3638 | { |
| r5932 | r5933 | |
| 3640 | 3640 | UINT32BE bLink; /* (index of) previous node at this level */ |
| 3641 | 3641 | UINT8 kind; /* kind of node (leaf, index, header, map) */ |
| 3642 | 3642 | UINT8 height; /* zero for header, map; 1 for leaf, 2 through |
| 3643 | treeDepth for index (child is one LESS than | |
| 3644 | parent, whatever IM says) */ | |
| 3643 | treeDepth for index (child is one LESS than | |
| 3644 | parent, whatever IM says) */ | |
| 3645 | 3645 | UINT16BE numRecords; /* number of records in this node */ |
| 3646 | 3646 | UINT16BE reserved; /* reserved; set to zero */ |
| 3647 | 3647 | } BTNodeHeader; |
| 3648 | 3648 | |
| 3649 | 3649 | /* |
| 3650 | ||
| 3650 | Constants for BTNodeHeader kind field | |
| 3651 | 3651 | */ |
| 3652 | 3652 | enum |
| 3653 | 3653 | { |
| 3654 | 3654 | btnk_leafNode = 0xff, /* leaf nodes hold the actual user data records |
| 3655 | ||
| 3655 | with keys and data */ | |
| 3656 | 3656 | btnk_indexNode = 0, /* root and branch node that enable to efficiently |
| 3657 | ||
| 3657 | search the leaf nodes for a specific key value */ | |
| 3658 | 3658 | btnk_headerNode = 1, /* unique node with b-tree information, pointer to |
| 3659 | root node and start of the node allocation | |
| 3660 | bitmap */ | |
| 3659 | root node and start of the node allocation | |
| 3660 | bitmap */ | |
| 3661 | 3661 | btnk_mapNode = 2 /* map nodes are created when the node allocation |
| 3662 | ||
| 3662 | bitmap outgrows the header node */ | |
| 3663 | 3663 | }; |
| 3664 | 3664 | |
| 3665 | 3665 | /* |
| 3666 | BTHeaderRecord: first record of a B-tree header node (second record is | |
| 3667 | unused, and third is node allocation bitmap). | |
| 3666 | BTHeaderRecord: first record of a B-tree header node (second record is | |
| 3667 | unused, and third is node allocation bitmap). | |
| 3668 | 3668 | */ |
| 3669 | 3669 | typedef struct BTHeaderRecord |
| 3670 | 3670 | { |
| r5932 | r5933 | |
| 3675 | 3675 | UINT32BE lastLeafNode; /* node number of last leaf node */ |
| 3676 | 3676 | UINT16BE nodeSize; /* size of a node, in bytes */ |
| 3677 | 3677 | UINT16BE maxKeyLength; /* maximum length of data (index + leaf) record keys; |
| 3678 | length of all index record keys if | |
| 3679 | btha_variableIndexKeysMask attribute flag is not set */ | |
| 3678 | length of all index record keys if | |
| 3679 | btha_variableIndexKeysMask attribute flag is not set */ | |
| 3680 | 3680 | UINT32BE totalNodes; /* total number of nodes in tree */ |
| 3681 | 3681 | UINT32BE freeNodes; /* number of unused (free) nodes in tree */ |
| 3682 | 3682 | |
| 3683 | 3683 | UINT16BE reserved1; /* unused */ |
| 3684 | 3684 | UINT32BE clumpSize; /* used in some HFS implementations? (reserved in |
| 3685 | ||
| 3685 | early HFS implementations, and in HFS Plus) */ | |
| 3686 | 3686 | UINT8 btreeType; /* reserved - set to 0 */ |
| 3687 | 3687 | UINT8 reserved2; /* reserved */ |
| 3688 | 3688 | UINT32BE attributes; /* persistent attributes about the tree */ |
| r5932 | r5933 | |
| 3692 | 3692 | static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent); |
| 3693 | 3693 | |
| 3694 | 3694 | /* |
| 3695 | ||
| 3695 | BT_open | |
| 3696 | 3696 | |
| 3697 | Open a file as a B-tree. The file must be already open as a macintosh | |
| 3698 | file. | |
| 3697 | Open a file as a B-tree. The file must be already open as a macintosh | |
| 3698 | file. | |
| 3699 | 3699 | |
| 3700 | BTref (I/O): B-tree file handle to open (BTref->fileref must have been | |
| 3701 | open previously) | |
| 3702 | key_compare_func (I): function that compares two keys | |
| 3703 | is_extent (I): TRUE if we are opening the extent B-tree (we want to do | |
| 3704 | extra checks in this case because the extent B-Tree may include extent | |
| 3705 | records for the extent B-tree itself, and if an extent record for the | |
| 3706 | extent B-tree is located in an extent that has not been defined by | |
| 3707 | previous extent records, then we can never retreive this extent record) | |
| 3700 | BTref (I/O): B-tree file handle to open (BTref->fileref must have been | |
| 3701 | open previously) | |
| 3702 | key_compare_func (I): function that compares two keys | |
| 3703 | is_extent (I): TRUE if we are opening the extent B-tree (we want to do | |
| 3704 | extra checks in this case because the extent B-Tree may include extent | |
| 3705 | records for the extent B-tree itself, and if an extent record for the | |
| 3706 | extent B-tree is located in an extent that has not been defined by | |
| 3707 | previous extent records, then we can never retreive this extent record) | |
| 3708 | 3708 | |
| 3709 | ||
| 3709 | Return imgtool error code | |
| 3710 | 3710 | */ |
| 3711 | 3711 | static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void *key1, const void *key2), int is_extent) |
| 3712 | 3712 | { |
| r5932 | r5933 | |
| 3729 | 3729 | return IMGTOOLERR_CORRUPTIMAGE; /* right??? */ |
| 3730 | 3730 | |
| 3731 | 3731 | /* CHEESY HACK: we assume that the header record immediately follows the |
| 3732 | node header. This is because we need to know the node length to know where | |
| 3733 | the record pointers are located, but we need to read the header record to | |
| 3734 | know the node length. */ | |
| 3732 | node header. This is because we need to know the node length to know where | |
| 3733 | the record pointers are located, but we need to read the header record to | |
| 3734 | know the node length. */ | |
| 3735 | 3735 | err = mac_file_read(&BTref->fileref, sizeof(header_rec), &header_rec); |
| 3736 | 3736 | if (err) |
| 3737 | 3737 | return err; |
| r5932 | r5933 | |
| 3761 | 3761 | } |
| 3762 | 3762 | |
| 3763 | 3763 | /* |
| 3764 | ||
| 3764 | BT_close | |
| 3765 | 3765 | |
| 3766 | ||
| 3766 | Close a B-tree | |
| 3767 | 3767 | |
| 3768 | ||
| 3768 | BTref (I/O): open B-tree file handle | |
| 3769 | 3769 | */ |
| 3770 | 3770 | static void BT_close(mac_BTref *BTref) |
| 3771 | 3771 | { |
| r5932 | r5933 | |
| 3773 | 3773 | } |
| 3774 | 3774 | |
| 3775 | 3775 | /* |
| 3776 | ||
| 3776 | BT_read_node | |
| 3777 | 3777 | |
| 3778 | ||
| 3778 | Read a node from a B-tree | |
| 3779 | 3779 | |
| 3780 | BTref (I/O): open B-tree file handle | |
| 3781 | node_ID (I): index of the node to read | |
| 3782 | expected_kind (I): kind of the node to read | |
| 3783 | expected_depth (I): depth of the node to read | |
| 3784 | dest (O): destination buffer | |
| 3780 | BTref (I/O): open B-tree file handle | |
| 3781 | node_ID (I): index of the node to read | |
| 3782 | expected_kind (I): kind of the node to read | |
| 3783 | expected_depth (I): depth of the node to read | |
| 3784 | dest (O): destination buffer | |
| 3785 | 3785 | |
| 3786 | ||
| 3786 | Return imgtool error code | |
| 3787 | 3787 | */ |
| 3788 | 3788 | static imgtoolerr_t BT_read_node(mac_BTref *BTref, UINT32 node_ID, int expected_kind, int expected_depth, void *dest) |
| 3789 | 3789 | { |
| r5932 | r5933 | |
| 3808 | 3808 | } |
| 3809 | 3809 | |
| 3810 | 3810 | /* |
| 3811 | ||
| 3811 | BT_node_get_record | |
| 3812 | 3812 | |
| 3813 | ||
| 3813 | Extract a raw record from a B-tree node | |
| 3814 | 3814 | |
| 3815 | BTref (I/O): open B-tree file handle | |
| 3816 | node_buf (I): buffer with the node the record should be extracted from | |
| 3817 | recnum (I): index of record to read | |
| 3818 | rec_ptr (O): set to point to start of record (key + data) | |
| 3819 | rec_len (O): set to total length of record (key + data) | |
| 3815 | BTref (I/O): open B-tree file handle | |
| 3816 | node_buf (I): buffer with the node the record should be extracted from | |
| 3817 | recnum (I): index of record to read | |
| 3818 | rec_ptr (O): set to point to start of record (key + data) | |
| 3819 | rec_len (O): set to total length of record (key + data) | |
| 3820 | 3820 | |
| 3821 | ||
| 3821 | Return imgtool error code | |
| 3822 | 3822 | */ |
| 3823 | 3823 | static imgtoolerr_t BT_node_get_record(mac_BTref *BTref, void *node_buf, unsigned recnum, void **rec_ptr, int *rec_len) |
| 3824 | 3824 | { |
| r5932 | r5933 | |
| 3845 | 3845 | } |
| 3846 | 3846 | |
| 3847 | 3847 | /* |
| 3848 | ||
| 3848 | BT_node_get_keyed_record | |
| 3849 | 3849 | |
| 3850 | Extract a keyed record from a B-tree node. Equivalent to | |
| 3851 | BT_node_get_record, only we do extra checks. | |
| 3850 | Extract a keyed record from a B-tree node. Equivalent to | |
| 3851 | BT_node_get_record, only we do extra checks. | |
| 3852 | 3852 | |
| 3853 | BTref (I/O): open B-tree file handle | |
| 3854 | node_buf (I): buffer with the node the record should be extracted from | |
| 3855 | node_is_index (I): TRUE if node is index node | |
| 3856 | recnum (I): index of record to read | |
| 3857 | rec_ptr (O): set to point to start of record (key + data) | |
| 3858 | rec_len (O): set to total length of record (key + data) | |
| 3853 | BTref (I/O): open B-tree file handle | |
| 3854 | node_buf (I): buffer with the node the record should be extracted from | |
| 3855 | node_is_index (I): TRUE if node is index node | |
| 3856 | recnum (I): index of record to read | |
| 3857 | rec_ptr (O): set to point to start of record (key + data) | |
| 3858 | rec_len (O): set to total length of record (key + data) | |
| 3859 | 3859 | |
| 3860 | ||
| 3860 | Return imgtool error code | |
| 3861 | 3861 | */ |
| 3862 | 3862 | 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) |
| 3863 | 3863 | { |
| r5932 | r5933 | |
| 3896 | 3896 | } |
| 3897 | 3897 | |
| 3898 | 3898 | /* |
| 3899 | ||
| 3899 | BT_get_keyed_record_data | |
| 3900 | 3900 | |
| 3901 | ||
| 3901 | extract data from a keyed record | |
| 3902 | 3902 | |
| 3903 | BTref (I/O): open B-tree file handle | |
| 3904 | rec_ptr (I): point to start of record (key + data) | |
| 3905 | rec_len (I): total length of record (key + data) | |
| 3906 | data_ptr (O): set to point to record data | |
| 3907 | data_len (O): set to length of record data | |
| 3903 | BTref (I/O): open B-tree file handle | |
| 3904 | rec_ptr (I): point to start of record (key + data) | |
| 3905 | rec_len (I): total length of record (key + data) | |
| 3906 | data_ptr (O): set to point to record data | |
| 3907 | data_len (O): set to length of record data | |
| 3908 | 3908 | |
| 3909 | ||
| 3909 | Return imgtool error code | |
| 3910 | 3910 | */ |
| 3911 | 3911 | static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, int rec_len, void **data_ptr, int *data_len) |
| 3912 | 3912 | { |
| r5932 | r5933 | |
| 3936 | 3936 | } |
| 3937 | 3937 | |
| 3938 | 3938 | /* |
| 3939 | ||
| 3939 | BT_check | |
| 3940 | 3940 | |
| 3941 | ||
| 3941 | Check integrity of a complete B-tree | |
| 3942 | 3942 | |
| 3943 | BTref (I/O): open B-tree file handle | |
| 3944 | is_extent (I): TRUE if we are opening the extent B-tree (we want to do | |
| 3945 | extra checks in this case because the extent B-Tree may include extent | |
| 3946 | records for the extent B-tree itself, and if an extent record for the | |
| 3947 | extent B-tree is located in an extent that has not been defined by | |
| 3948 | previous extent records, then we can never retreive this extent record) | |
| 3943 | BTref (I/O): open B-tree file handle | |
| 3944 | is_extent (I): TRUE if we are opening the extent B-tree (we want to do | |
| 3945 | extra checks in this case because the extent B-Tree may include extent | |
| 3946 | records for the extent B-tree itself, and if an extent record for the | |
| 3947 | extent B-tree is located in an extent that has not been defined by | |
| 3948 | previous extent records, then we can never retreive this extent record) | |
| 3949 | 3949 | |
| 3950 | ||
| 3950 | Return imgtool error code | |
| 3951 | 3951 | */ |
| 3952 | 3952 | static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent) |
| 3953 | 3953 | { |
| r5932 | r5933 | |
| 4085 | 4085 | } |
| 4086 | 4086 | /* check that node has not been used for another purpose */ |
| 4087 | 4087 | /* this check is unecessary because the current consistency checks |
| 4088 | that forward and back linking match and that node height is correct | |
| 4089 | are enough to detect such errors */ | |
| 4088 | that forward and back linking match and that node height is correct | |
| 4089 | are enough to detect such errors */ | |
| 4090 | 4090 | /*if (bitmap[cur_node >> 3] & (0x80 >> (cur_node & 7))) |
| 4091 | { | |
| 4092 | err = IMGTOOLERR_CORRUPTIMAGE; | |
| 4093 | goto bail; | |
| 4094 | }*/ | |
| 4091 | { | |
| 4092 | err = IMGTOOLERR_CORRUPTIMAGE; | |
| 4093 | goto bail; | |
| 4094 | }*/ | |
| 4095 | 4095 | /* add node in bitmap */ |
| 4096 | 4096 | bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7)); |
| 4097 | 4097 | /* read node */ |
| r5932 | r5933 | |
| 4142 | 4142 | } |
| 4143 | 4143 | |
| 4144 | 4144 | /* check that a) the root node has no successor, and b) that we have really |
| 4145 | ||
| 4145 | read the first leaf node */ | |
| 4146 | 4146 | if (get_UINT32BE(((BTNodeHeader *) data_nodes[BTref->treeDepth-1].buf)->fLink) |
| 4147 | 4147 | || (cur_node != BTref->firstLeafNode)) |
| 4148 | 4148 | { |
| r5932 | r5933 | |
| 4200 | 4200 | goto bail; |
| 4201 | 4201 | } |
| 4202 | 4202 | /* next test is not necessary because we have checked that |
| 4203 | ||
| 4203 | the root node has no successor */ | |
| 4204 | 4204 | /*if (i < BTref->treeDepth-1) |
| 4205 | ||
| 4205 | {*/ | |
| 4206 | 4206 | data_nodes[i+1].cur_rec++; |
| 4207 | 4207 | /*} |
| 4208 | else | |
| 4209 | { | |
| 4210 | err = IMGTOOLERR_CORRUPTIMAGE; | |
| 4211 | goto bail; | |
| 4212 | }*/ | |
| 4208 | else | |
| 4209 | { | |
| 4210 | err = IMGTOOLERR_CORRUPTIMAGE; | |
| 4211 | goto bail; | |
| 4212 | }*/ | |
| 4213 | 4213 | } |
| 4214 | 4214 | i++; |
| 4215 | 4215 | } |
| r5932 | r5933 | |
| 4217 | 4217 | if (is_extent && !extentEOL) |
| 4218 | 4218 | { |
| 4219 | 4219 | /* extract current leaf record and update maxExtentAB and |
| 4220 | ||
| 4220 | maxExtentNode */ | |
| 4221 | 4221 | hfs_extentKey *extentKey; |
| 4222 | 4222 | hfs_extent *extentData; |
| 4223 | 4223 | |
| r5932 | r5933 | |
| 4230 | 4230 | if ((extentKey->keyLength < 7) || (extentKey->forkType != 0) || (get_UINT32BE(extentKey->fileID) != 3) |
| 4231 | 4231 | || (get_UINT16BE(extentKey->startBlock) != maxExtentAB)) |
| 4232 | 4232 | /* the key is corrupt or does not concern the extent |
| 4233 | B-tree: set the extentEOL flag so that we stop looking for | |
| 4234 | further extent records for the extent B-tree */ | |
| 4233 | B-tree: set the extentEOL flag so that we stop looking for | |
| 4234 | further extent records for the extent B-tree */ | |
| 4235 | 4235 | extentEOL = TRUE; |
| 4236 | 4236 | else |
| 4237 | 4237 | { /* this key concerns the extent B-tree: update maxExtentAB |
| 4238 | ||
| 4238 | and maxExtentNode */ | |
| 4239 | 4239 | /* extract record data ptr */ |
| 4240 | 4240 | err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len); |
| 4241 | 4241 | if (err) |
| 4242 | 4242 | goto bail; |
| 4243 | 4243 | if (rec1_data_len < sizeof(hfs_extent)*3) |
| 4244 | 4244 | /* the record is corrupt: set the extentEOL flag so |
| 4245 | that we stop looking for further extent records for the | |
| 4246 | extent B-tree */ | |
| 4245 | that we stop looking for further extent records for the | |
| 4246 | extent B-tree */ | |
| 4247 | 4247 | extentEOL = TRUE; |
| 4248 | 4248 | else |
| 4249 | 4249 | { |
| r5932 | r5933 | |
| 4327 | 4327 | cur_node = get_UINT32BE(* (UINT32BE *)rec1_data); |
| 4328 | 4328 | |
| 4329 | 4329 | /* compare node index with data of current record of upper |
| 4330 | ||
| 4330 | level */ | |
| 4331 | 4331 | if (cur_node != data_nodes[i].node_num) |
| 4332 | 4332 | { |
| 4333 | 4333 | err = IMGTOOLERR_CORRUPTIMAGE; |
| r5932 | r5933 | |
| 4380 | 4380 | prev_node = cur_node; |
| 4381 | 4381 | /* check that node has not been used for another purpose */ |
| 4382 | 4382 | /* this check is unecessary because the current consistency checks that |
| 4383 | forward and back linking match and that node height is correct are | |
| 4384 | enough to detect such errors */ | |
| 4383 | forward and back linking match and that node height is correct are | |
| 4384 | enough to detect such errors */ | |
| 4385 | 4385 | /*if (bitmap[cur_node >> 3] & (0x80 >> (cur_node & 7))) |
| 4386 | { | |
| 4387 | err = IMGTOOLERR_CORRUPTIMAGE; | |
| 4388 | goto bail; | |
| 4389 | }*/ | |
| 4386 | { | |
| 4387 | err = IMGTOOLERR_CORRUPTIMAGE; | |
| 4388 | goto bail; | |
| 4389 | }*/ | |
| 4390 | 4390 | /* add node in bitmap */ |
| 4391 | 4391 | bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7)); |
| 4392 | 4392 | /* read map node */ |
| r5932 | r5933 | |
| 4482 | 4482 | } |
| 4483 | 4483 | |
| 4484 | 4484 | /* |
| 4485 | ||
| 4485 | BT_search_leaf_rec | |
| 4486 | 4486 | |
| 4487 | Search for a given key in a B-Tree. If exact match found, returns | |
| 4488 | corresponding leaf record. Otherwise, may return the greatest record less | |
| 4489 | than the requested key (of course, this will fail if the key is lower than | |
| 4490 | all keys in the B-Tree). | |
| 4487 | Search for a given key in a B-Tree. If exact match found, returns | |
| 4488 | corresponding leaf record. Otherwise, may return the greatest record less | |
| 4489 | than the requested key (of course, this will fail if the key is lower than | |
| 4490 | all keys in the B-Tree). | |
| 4491 | 4491 | |
| 4492 | BTref (I/O): open B-tree file handle | |
| 4493 | search_key (I): key to search the B-Tree for | |
| 4494 | node_ID (O): set to the node ID of the node the record is located in (may | |
| 4495 | be NULL) | |
| 4496 | record_ID (O): set to the index of the record in the node (may be NULL) | |
| 4497 | record_ptr (O): set to point to record in node buffer (may be NULL) | |
| 4498 | record_len (O): set to total record len (may be NULL) | |
| 4499 | search_exact_match (I): if TRUE, the function will search for a record | |
| 4500 | equal to search_key; if FALSE, the function will search for the | |
| 4501 | greatest record less than or equal to search_key | |
| 4502 | match_found (O): set to TRUE if an exact match for search_key has been | |
| 4503 | found (only makes sense if search_exact_match is FALSE) (may be NULL) | |
| 4492 | BTref (I/O): open B-tree file handle | |
| 4493 | search_key (I): key to search the B-Tree for | |
| 4494 | node_ID (O): set to the node ID of the node the record is located in (may | |
| 4495 | be NULL) | |
| 4496 | record_ID (O): set to the index of the record in the node (may be NULL) | |
| 4497 | record_ptr (O): set to point to record in node buffer (may be NULL) | |
| 4498 | record_len (O): set to total record len (may be NULL) | |
| 4499 | search_exact_match (I): if TRUE, the function will search for a record | |
| 4500 | equal to search_key; if FALSE, the function will search for the | |
| 4501 | greatest record less than or equal to search_key | |
| 4502 | match_found (O): set to TRUE if an exact match for search_key has been | |
| 4503 | found (only makes sense if search_exact_match is FALSE) (may be NULL) | |
| 4504 | 4504 | |
| 4505 | ||
| 4505 | Return imgtool error code | |
| 4506 | 4506 | */ |
| 4507 | 4507 | static imgtoolerr_t BT_search_leaf_rec(mac_BTref *BTref, const void *search_key, |
| 4508 | 4508 | UINT32 *node_ID, int *record_ID, |
| r5932 | r5933 | |
| 4559 | 4559 | |
| 4560 | 4560 | if (! last_rec) |
| 4561 | 4561 | { /* all keys are greater than the search key: the search key is |
| 4562 | ||
| 4562 | nowhere in the tree */ | |
| 4563 | 4563 | if (search_exact_match) |
| 4564 | 4564 | return IMGTOOLERR_FILENOTFOUND; |
| 4565 | 4565 | |
| r5932 | r5933 | |
| 4618 | 4618 | } |
| 4619 | 4619 | |
| 4620 | 4620 | /* |
| 4621 | ||
| 4621 | BT_leaf_rec_enumerator_open | |
| 4622 | 4622 | |
| 4623 | ||
| 4623 | Open enumerator for leaf records of a B-Tree | |
| 4624 | 4624 | |
| 4625 | BTref (I/O): open B-tree file handle | |
| 4626 | enumerator (O): B-Tree enumerator to open | |
| 4625 | BTref (I/O): open B-tree file handle | |
| 4626 | enumerator (O): B-Tree enumerator to open | |
| 4627 | 4627 | |
| 4628 | ||
| 4628 | Return imgtool error code | |
| 4629 | 4629 | */ |
| 4630 | 4630 | static imgtoolerr_t BT_leaf_rec_enumerator_open(mac_BTref *BTref, BT_leaf_rec_enumerator *enumerator) |
| 4631 | 4631 | { |
| r5932 | r5933 | |
| 4637 | 4637 | } |
| 4638 | 4638 | |
| 4639 | 4639 | /* |
| 4640 | ||
| 4640 | BT_leaf_rec_enumerator_read | |
| 4641 | 4641 | |
| 4642 | ||
| 4642 | Read next leaf record of a B-Tree | |
| 4643 | 4643 | |
| 4644 | ||
| 4644 | enumerator (I/O): open B-Tree enumerator | |
| 4645 | 4645 | |
| 4646 | ||
| 4646 | Return imgtool error code | |
| 4647 | 4647 | */ |
| 4648 | 4648 | static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerator, void **record_ptr, int *rec_len) |
| 4649 | 4649 | { |
| r5932 | r5933 | |
| 4689 | 4689 | enumerator->cur_rec++; |
| 4690 | 4690 | if (enumerator->cur_rec >= node_numRecords) |
| 4691 | 4691 | { /* iterate to next node if last record (not required, but will improve |
| 4692 | ||
| 4692 | performance on next iteration) */ | |
| 4693 | 4693 | enumerator->cur_node = get_UINT32BE(((BTNodeHeader *) enumerator->BTref->node_buf)->fLink); |
| 4694 | 4694 | enumerator->cur_rec = 0; |
| 4695 | 4695 | } |
| r5932 | r5933 | |
| 4697 | 4697 | } |
| 4698 | 4698 | |
| 4699 | 4699 | /* |
| 4700 | B-Tree extend EOF algorithm: | |
| 4701 | * see if the bitmap will need to be extended | |
| 4702 | * extend EOF by min 1 (if bitmap is large engough) or 2 (if bitmap needs | |
| 4703 | to be extended) and max ClumpSiz (see extClpSiz and ctClpSiz in MDB) | |
| 4704 | ***If we are extending the extent B-Tree, we need to defer the possible | |
| 4705 | creation of an additional extent record, or we might enter an endless | |
| 4706 | recursion loop*** | |
| 4700 | B-Tree extend EOF algorithm: | |
| 4701 | * see if the bitmap will need to be extended | |
| 4702 | * extend EOF by min 1 (if bitmap is large engough) or 2 (if bitmap needs | |
| 4703 | to be extended) and max ClumpSiz (see extClpSiz and ctClpSiz in MDB) | |
| 4704 | ***If we are extending the extent B-Tree, we need to defer the possible | |
| 4705 | creation of an additional extent record, or we might enter an endless | |
| 4706 | recursion loop*** | |
| 4707 | 4707 | |
| 4708 | ||
| 4708 | Empty node alloc algorithm: | |
| 4709 | 4709 | |
| 4710 | * see if there is any free node in B-tree bitmap | |
| 4711 | * optionally, try to compact the B-tree if file is full | |
| 4712 | * if file is still full, extend EOF and try again | |
| 4713 | * mark new block as used and return its index | |
| 4710 | * see if there is any free node in B-tree bitmap | |
| 4711 | * optionally, try to compact the B-tree if file is full | |
| 4712 | * if file is still full, extend EOF and try again | |
| 4713 | * mark new block as used and return its index | |
| 4714 | 4714 | |
| 4715 | 4715 | |
| 4716 | ||
| 4716 | Empty node delete algorithm: | |
| 4717 | 4717 | |
| 4718 | * remove node from link list | |
| 4719 | * mark node as free in the B-tree bitmap | |
| 4720 | * optionally, if more than N% of the B-tree is free, compact the B-tree and | |
| 4721 | free some disk space | |
| 4722 | * Count nodes on this level; if there is only one left, delete parent index | |
| 4723 | node and mark the relaining node as root; if it was the last leaf node, | |
| 4724 | update header node with an empty B-tree; in either case, decrement tree | |
| 4725 | depth | |
| 4718 | * remove node from link list | |
| 4719 | * mark node as free in the B-tree bitmap | |
| 4720 | * optionally, if more than N% of the B-tree is free, compact the B-tree and | |
| 4721 | free some disk space | |
| 4722 | * Count nodes on this level; if there is only one left, delete parent index | |
| 4723 | node and mark the relaining node as root; if it was the last leaf node, | |
| 4724 | update header node with an empty B-tree; in either case, decrement tree | |
| 4725 | depth | |
| 4726 | 4726 | |
| 4727 | 4727 | |
| 4728 | ||
| 4728 | Record shifting algorithm: | |
| 4729 | 4729 | |
| 4730 | ||
| 4730 | For a given node and its first non-empty successor node: | |
| 4731 | 4731 | |
| 4732 | * compute how much free room there is in the node | |
| 4733 | * see if the first record of the first non-empty successor can fit | |
| 4734 | * if so, move it (i.e. delete the first record of the later node, and add a | |
| 4735 | copy of it to the end of the former) | |
| 4732 | * compute how much free room there is in the node | |
| 4733 | * see if the first record of the first non-empty successor can fit | |
| 4734 | * if so, move it (i.e. delete the first record of the later node, and add a | |
| 4735 | copy of it to the end of the former) | |
| 4736 | 4736 | |
| 4737 | 4737 | |
| 4738 | ||
| 4738 | Node merging algorithm | |
| 4739 | 4739 | |
| 4740 | * Consider node and its predecessor. If there is room, shift all records | |
| 4741 | from later to former, then delete empty later node, and delete later | |
| 4742 | record from parent index node. | |
| 4740 | * Consider node and its predecessor. If there is room, shift all records | |
| 4741 | from later to former, then delete empty later node, and delete later | |
| 4742 | record from parent index node. | |
| 4743 | 4743 | |
| 4744 | 4744 | |
| 4745 | ||
| 4745 | Node splitting algorithm (non-first) | |
| 4746 | 4746 | |
| 4747 | * Consider node and its predecessor. Create new middle node and split | |
| 4748 | records in 3 even sets. Update record for last node and insert record | |
| 4749 | for middle node in parent index node. | |
| 4747 | * Consider node and its predecessor. Create new middle node and split | |
| 4748 | records in 3 even sets. Update record for last node and insert record | |
| 4749 | for middle node in parent index node. | |
| 4750 | 4750 | |
| 4751 | 4751 | |
| 4752 | ||
| 4752 | Node splitting algorithm (first node) | |
| 4753 | 4753 | |
| 4754 | * Create new successor node, and split records in 2 1/3 and 2/3 sets. | |
| 4755 | Insert record for later node in parent index node. | |
| 4754 | * Create new successor node, and split records in 2 1/3 and 2/3 sets. | |
| 4755 | Insert record for later node in parent index node. | |
| 4756 | 4756 | |
| 4757 | 4757 | |
| 4758 | ||
| 4758 | Record delete algorithm: | |
| 4759 | 4759 | |
| 4760 | * remove record from node | |
| 4761 | * if record was first in node, test if node is now empty | |
| 4762 | * if node is not empty, substitute key of deleted record with key of | |
| 4763 | new head record in index tree | |
| 4764 | * if node is empty, delete key of deleted record in index tree, then | |
| 4765 | delete empty node | |
| 4766 | * optionally, look the predecessor node. Merge the two nodes if possible. | |
| 4760 | * remove record from node | |
| 4761 | * if record was first in node, test if node is now empty | |
| 4762 | * if node is not empty, substitute key of deleted record with key of | |
| 4763 | new head record in index tree | |
| 4764 | * if node is empty, delete key of deleted record in index tree, then | |
| 4765 | delete empty node | |
| 4766 | * optionally, look the predecessor node. Merge the two nodes if possible. | |
| 4767 | 4767 | |
| 4768 | 4768 | |
| 4769 | ||
| 4769 | Record insert algorithm: | |
| 4770 | 4770 | |
| 4771 | * if there room, just insert new record in node; if new record is in first | |
| 4772 | position, update record in parent index node | |
| 4773 | * else consider predecessor: see if we can make enough room by shifting | |
| 4774 | records. If so, do shift records, insert new record, update record in | |
| 4775 | parent index node | |
| 4776 | * else split the nodes and insert record | |
| 4771 | * if there room, just insert new record in node; if new record is in first | |
| 4772 | position, update record in parent index node | |
| 4773 | * else consider predecessor: see if we can make enough room by shifting | |
| 4774 | records. If so, do shift records, insert new record, update record in | |
| 4775 | parent index node | |
| 4776 | * else split the nodes and insert record | |
| 4777 | 4777 | */ |
| 4778 | 4778 | /* |
| 4779 | ||
| 4779 | Possible additions: | |
| 4780 | 4780 | |
| 4781 | ||
| 4781 | Node compaction algorithm: | |
| 4782 | 4782 | |
| 4783 | This algorithm can be executed with a specific start point and max number | |
| 4784 | of nodes, or with all nodes on a level. | |
| 4783 | This algorithm can be executed with a specific start point and max number | |
| 4784 | of nodes, or with all nodes on a level. | |
| 4785 | 4785 | |
| 4786 | * see how many nodes we can save by shifting records left | |
| 4787 | * if we will save at least one node, do shift as many records as possible | |
| 4788 | (try to leave free space split homogeneously???) | |
| 4786 | * see how many nodes we can save by shifting records left | |
| 4787 | * if we will save at least one node, do shift as many records as possible | |
| 4788 | (try to leave free space split homogeneously???) | |
| 4789 | 4789 | */ |
| 4790 | 4790 | |
| 4791 | 4791 | /*static void*/ |
| r5932 | r5933 | |
| 4796 | 4796 | #endif |
| 4797 | 4797 | |
| 4798 | 4798 | /* |
| 4799 | ||
| 4799 | Resource manager | |
| 4800 | 4800 | |
| 4801 | The resource manager stores arbitrary chunks of data (resource) identified | |
| 4802 | by a type/id pair. The resource type is a 4-char code, which generally | |
| 4803 | implies the format of the data (e.g. 'PICT' is for a quickdraw picture, | |
| 4804 | 'STR ' for a macintosh string, 'CODE' for 68k machine code, etc). The | |
| 4805 | resource id is a signed 16-bit number that uniquely identifies each | |
| 4806 | resource of a given type. Note that, with most resource types, resources | |
| 4807 | with id < 128 are system resources that are available to all applications, | |
| 4808 | whereas resources with id >= 128 are application resources visible only to | |
| 4809 | the application that defines them. | |
| 4801 | The resource manager stores arbitrary chunks of data (resource) identified | |
| 4802 | by a type/id pair. The resource type is a 4-char code, which generally | |
| 4803 | implies the format of the data (e.g. 'PICT' is for a quickdraw picture, | |
| 4804 | 'STR ' for a macintosh string, 'CODE' for 68k machine code, etc). The | |
| 4805 | resource id is a signed 16-bit number that uniquely identifies each | |
| 4806 | resource of a given type. Note that, with most resource types, resources | |
| 4807 | with id < 128 are system resources that are available to all applications, | |
| 4808 | whereas resources with id >= 128 are application resources visible only to | |
| 4809 | the application that defines them. | |
| 4810 | 4810 | |
| 4811 | Each resource can optionally have a resource name, which is a macintosh | |
| 4812 | string of 255 chars at most. | |
| 4811 | Each resource can optionally have a resource name, which is a macintosh | |
| 4812 | string of 255 chars at most. | |
| 4813 | 4813 | |
| 4814 | Limits: | |
| 4815 | 16MBytes of data | |
| 4816 | 64kbytes of type+reference lists | |
| 4817 | 64kbytes of resource names | |
| 4814 | Limits: | |
| 4815 | 16MBytes of data | |
| 4816 | 64kbytes of type+reference lists | |
| 4817 | 64kbytes of resource names | |
| 4818 | 4818 | |
| 4819 | The Macintosh toolbox can open several resource files simulteanously to | |
| 4820 | overcome these restrictions. | |
| 4819 | The Macintosh toolbox can open several resource files simulteanously to | |
| 4820 | overcome these restrictions. | |
| 4821 | 4821 | |
| 4822 | Resources are used virtually everywhere in the Macintosh Toolbox, so it is | |
| 4823 | no surprise that file comments and MFS folders are stored in resource files. | |
| 4822 | Resources are used virtually everywhere in the Macintosh Toolbox, so it is | |
| 4823 | no surprise that file comments and MFS folders are stored in resource files. | |
| 4824 | 4824 | */ |
| 4825 | 4825 | |
| 4826 | 4826 | /* |
| 4827 | ||
| 4827 | Resource header | |
| 4828 | 4828 | */ |
| 4829 | 4829 | typedef struct rsrc_header |
| 4830 | 4830 | { |
| r5932 | r5933 | |
| 4835 | 4835 | } rsrc_header; |
| 4836 | 4836 | |
| 4837 | 4837 | /* |
| 4838 | Resource data: each data entry is preceded by its len (UINT32BE) | |
| 4839 | Offset to specific data fields are gotten from the resource map | |
| 4838 | Resource data: each data entry is preceded by its len (UINT32BE) | |
| 4839 | Offset to specific data fields are gotten from the resource map | |
| 4840 | 4840 | */ |
| 4841 | 4841 | |
| 4842 | 4842 | /* |
| 4843 | ||
| 4843 | Resource map: | |
| 4844 | 4844 | */ |
| 4845 | 4845 | typedef struct rsrc_map_header |
| 4846 | 4846 | { |
| r5932 | r5933 | |
| 4856 | 4856 | } rsrc_map_header; |
| 4857 | 4857 | |
| 4858 | 4858 | /* |
| 4859 | ||
| 4859 | Resource type list entry | |
| 4860 | 4860 | */ |
| 4861 | 4861 | typedef struct rsrc_type_entry |
| 4862 | 4862 | { |
| r5932 | r5933 | |
| 4866 | 4866 | } rsrc_type_entry; |
| 4867 | 4867 | |
| 4868 | 4868 | /* |
| 4869 | ||
| 4869 | Resource reference list entry | |
| 4870 | 4870 | */ |
| 4871 | 4871 | typedef struct rsrc_ref_entry |
| 4872 | 4872 | { |
| r5932 | r5933 | |
| 4879 | 4879 | } rsrc_ref_entry; |
| 4880 | 4880 | |
| 4881 | 4881 | /* |
| 4882 | ||
| 4882 | Resource name list entry: this is just a standard macintosh string | |
| 4883 | 4883 | */ |
| 4884 | 4884 | |
| 4885 | 4885 | typedef struct mac_resfileref |
| 4886 | 4886 | { |
| 4887 | 4887 | mac_fileref fileref; /* open resource fork ref (you may open resources |
| 4888 | files in data fork, too, if you ever need to, | |
| 4889 | but Classic MacOS never does such a thing | |
| 4890 | (MacOS X often does so, though)) */ | |
| 4888 | files in data fork, too, if you ever need to, | |
| 4889 | but Classic MacOS never does such a thing | |
| 4890 | (MacOS X often does so, though)) */ | |
| 4891 | 4891 | UINT32 data_offs; /* Offset from beginning of resource file to resource data */ |
| 4892 | 4892 | UINT32 map_offs; /* Offset from beginning of resource file to resource data */ |
| 4893 | 4893 | |
| r5932 | r5933 | |
| 4899 | 4899 | |
| 4900 | 4900 | #ifdef UNUSED_FUNCTION |
| 4901 | 4901 | /* |
| 4902 | ||
| 4902 | resfile_open | |
| 4903 | 4903 | |
| 4904 | Open a file as a resource file. The file must be already open as a | |
| 4905 | macintosh file. | |
| 4904 | Open a file as a resource file. The file must be already open as a | |
| 4905 | macintosh file. | |
| 4906 | 4906 | |
| 4907 | resfileref (I/O): resource file handle to open (resfileref->fileref must | |
| 4908 | have been opened previously) | |
| 4907 | resfileref (I/O): resource file handle to open (resfileref->fileref must | |
| 4908 | have been opened previously) | |
| 4909 | 4909 | |
| 4910 | ||
| 4910 | Return imgtool error code | |
| 4911 | 4911 | */ |
| 4912 | 4912 | static imgtoolerr_t resfile_open(mac_resfileref *resfileref) |
| 4913 | 4913 | { |
| r5932 | r5933 | |
| 4944 | 4944 | } |
| 4945 | 4945 | |
| 4946 | 4946 | /* |
| 4947 | ||
| 4947 | resfile_get_entry | |
| 4948 | 4948 | |
| 4949 | Get the resource entry in the resource map associated with a given type/id | |
| 4950 | pair. | |
| 4949 | Get the resource entry in the resource map associated with a given type/id | |
| 4950 | pair. | |
| 4951 | 4951 | |
| 4952 | resfileref (I/O): open resource file handle | |
| 4953 | type (I): type of the resource | |
| 4954 | id (I): id of the resource | |
| 4955 | entry (O): resource entry that has been read | |
| 4952 | resfileref (I/O): open resource file handle | |
| 4953 | type (I): type of the resource | |
| 4954 | id (I): id of the resource | |
| 4955 | entry (O): resource entry that has been read | |
| 4956 | 4956 | |
| 4957 | ||
| 4957 | Return imgtool error code | |
| 4958 | 4958 | */ |
| 4959 | 4959 | static imgtoolerr_t resfile_get_entry(mac_resfileref *resfileref, UINT32 type, UINT16 id, rsrc_ref_entry *entry) |
| 4960 | 4960 | { |
| r5932 | r5933 | |
| 5012 | 5012 | } |
| 5013 | 5013 | |
| 5014 | 5014 | /* |
| 5015 | ||
| 5015 | resfile_get_resname | |
| 5016 | 5016 | |
| 5017 | ||
| 5017 | Get the name of a resource. | |
| 5018 | 5018 | |
| 5019 | resfileref (I/O): open resource file handle | |
| 5020 | entry (I): resource entry in the resource map (returned by | |
| 5021 | resfile_get_entry) | |
| 5022 | string (O): resource name | |
| 5019 | resfileref (I/O): open resource file handle | |
| 5020 | entry (I): resource entry in the resource map (returned by | |
| 5021 | resfile_get_entry) | |
| 5022 | string (O): resource name | |
| 5023 | 5023 | |
| 5024 | ||
| 5024 | Return imgtool error code | |
| 5025 | 5025 | */ |
| 5026 | 5026 | static imgtoolerr_t resfile_get_resname(mac_resfileref *resfileref, const rsrc_ref_entry *entry, mac_str255 string) |
| 5027 | 5027 | { |
| r5932 | r5933 | |
| 5056 | 5056 | } |
| 5057 | 5057 | |
| 5058 | 5058 | /* |
| 5059 | ||
| 5059 | resfile_get_reslen | |
| 5060 | 5060 | |
| 5061 | ||
| 5061 | Get the data length for a given resource. | |
| 5062 | 5062 | |
| 5063 | resfileref (I/O): open resource file handle | |
| 5064 | entry (I): resource entry in the resource map (returned by | |
| 5065 | resfile_get_entry) | |
| 5066 | len (O): resource length | |
| 5063 | resfileref (I/O): open resource file handle | |
| 5064 | entry (I): resource entry in the resource map (returned by | |
| 5065 | resfile_get_entry) | |
| 5066 | len (O): resource length | |
| 5067 | 5067 | |
| 5068 | ||
| 5068 | Return imgtool error code | |
| 5069 | 5069 | */ |
| 5070 | 5070 | static imgtoolerr_t resfile_get_reslen(mac_resfileref *resfileref, const rsrc_ref_entry *entry, UINT32 *len) |
| 5071 | 5071 | { |
| r5932 | r5933 | |
| 5091 | 5091 | } |
| 5092 | 5092 | |
| 5093 | 5093 | /* |
| 5094 | ||
| 5094 | resfile_get_resdata | |
| 5095 | 5095 | |
| 5096 | ||
| 5096 | Get the data for a given resource. | |
| 5097 | 5097 | |
| 5098 | resfileref (I/O): open resource file handle | |
| 5099 | entry (I): resource entry in the resource map (returned by | |
| 5100 | resfile_get_entry) | |
| 5101 | offset (I): offset the data should be read from, usually 0 | |
| 5102 | len (I): length of the data to read, usually the value returned by | |
| 5103 | resfile_get_reslen | |
| 5104 | dest (O): resource data | |
| 5098 | resfileref (I/O): open resource file handle | |
| 5099 | entry (I): resource entry in the resource map (returned by | |
| 5100 | resfile_get_entry) | |
| 5101 | offset (I): offset the data should be read from, usually 0 | |
| 5102 | len (I): length of the data to read, usually the value returned by | |
| 5103 | resfile_get_reslen | |
| 5104 | dest (O): resource data | |
| 5105 | 5105 | |
| 5106 | ||
| 5106 | Return imgtool error code | |
| 5107 | 5107 | */ |
| 5108 | 5108 | static imgtoolerr_t resfile_get_resdata(mac_resfileref *resfileref, const rsrc_ref_entry *entry, UINT32 offset, UINT32 len, void *dest) |
| 5109 | 5109 | { |
| r5932 | r5933 | |
| 5148 | 5148 | #pragma mark DESKTOP FILE IMPLEMENTATION |
| 5149 | 5149 | #endif |
| 5150 | 5150 | /* |
| 5151 | All macintosh volumes have information stored in the desktop file or the | |
| 5152 | desktop database. | |
| 5151 | All macintosh volumes have information stored in the desktop file or the | |
| 5152 | desktop database. | |
| 5153 | 5153 | |
| 5154 | Such information include file comments, copy of BNDL and FREF resources | |
| 5155 | that describes supported file types for each application on the volume, | |
| 5156 | copy of icons for each file type registered by each application on the | |
| 5157 | volume, etc. On MFS volumes, the list of folders is stored in the desktop | |
| 5158 | file as well. | |
| 5154 | Such information include file comments, copy of BNDL and FREF resources | |
| 5155 | that describes supported file types for each application on the volume, | |
| 5156 | copy of icons for each file type registered by each application on the | |
| 5157 | volume, etc. On MFS volumes, the list of folders is stored in the desktop | |
| 5158 | file as well. | |
| 5159 | 5159 | |
| 5160 | 5160 | |
| 5161 | ||
| 5161 | There have been two implementations of the desktop metadata: | |
| 5162 | 5162 | |
| 5163 | * The original desktop file. The database is stored in the resource fork | |
| 5164 | of a (usually invisible) file called "Desktop" (case may change | |
| 5165 | according to system versions), located at the root of the volume. The | |
| 5166 | desktop file is used by System 6 and earlier for all volumes (unless | |
| 5167 | Appleshare 2 is installed and the volume is shared IIRC), and by System | |
| 5168 | 7 and later for volumes smaller than 2MBytes (so that floppy disks | |
| 5169 | remain fully compatible with earlier versions of system). The desktop | |
| 5170 | file is incompletely documented by Apple technote TB06. | |
| 5163 | * The original desktop file. The database is stored in the resource fork | |
| 5164 | of a (usually invisible) file called "Desktop" (case may change | |
| 5165 | according to system versions), located at the root of the volume. The | |
| 5166 | desktop file is used by System 6 and earlier for all volumes (unless | |
| 5167 | Appleshare 2 is installed and the volume is shared IIRC), and by System | |
| 5168 | 7 and later for volumes smaller than 2MBytes (so that floppy disks | |
| 5169 | remain fully compatible with earlier versions of system). The desktop | |
| 5170 | file is incompletely documented by Apple technote TB06. | |
| 5171 | 5171 | |
| 5172 | * The desktop database. The database is stored in the resource fork is | |
| 5173 | stored in the data fork of two (usually invisible) files called | |
| 5174 | "Desktop DF" and "Desktop DF". The desktop database is used for | |
| 5175 | volumes shared by Appleshare 2, and for most volumes under System 7 and | |
| 5176 | later. The format of these file is not documented AFAIK. | |
| 5172 | * The desktop database. The database is stored in the resource fork is | |
| 5173 | stored in the data fork of two (usually invisible) files called | |
| 5174 | "Desktop DF" and "Desktop DF". The desktop database is used for | |
| 5175 | volumes shared by Appleshare 2, and for most volumes under System 7 and | |
| 5176 | later. The format of these file is not documented AFAIK. | |
| 5177 | 5177 | |
| 5178 | 5178 | |
| 5179 | The reasons for the introduction of the desktop database were: | |
| 5180 | * the macintosh resource manager cannot share resource files, which was | |
| 5181 | a problem for Appleshare | |
| 5182 | * the macintosh resource manager is pretty limited (+/-16MByte of data and | |
| 5183 | 2727 resources at most), which was a problem for large hard disks with | |
| 5184 | many programs/comments | |
| 5179 | The reasons for the introduction of the desktop database were: | |
| 5180 | * the macintosh resource manager cannot share resource files, which was | |
| 5181 | a problem for Appleshare | |
| 5182 | * the macintosh resource manager is pretty limited (+/-16MByte of data and | |
| 5183 | 2727 resources at most), which was a problem for large hard disks with | |
| 5184 | many programs/comments | |
| 5185 | 5185 | */ |
| 5186 | 5186 | |
| 5187 | 5187 | #ifdef UNUSED_FUNCTION |
| 5188 | 5188 | /* |
| 5189 | ||
| 5189 | get_comment | |
| 5190 | 5190 | |
| 5191 | ||
| 5191 | Get a comment from the Desktop file | |
| 5192 | 5192 | |
| 5193 | l2_img (I): macintosh image the data should be read from | |
| 5194 | id (I): comment id (from mfs_hashString(), or HFS FXInfo/DXInfo records) | |
| 5195 | comment (O): comment that has been read | |
| 5193 | l2_img (I): macintosh image the data should be read from | |
| 5194 | id (I): comment id (from mfs_hashString(), or HFS FXInfo/DXInfo records) | |
| 5195 | comment (O): comment that has been read | |
| 5196 | 5196 | |
| 5197 | ||
| 5197 | Return imgtool error code | |
| 5198 | 5198 | */ |
| 5199 | 5199 | static imgtoolerr_t get_comment(mac_l2_imgref *l2_img, UINT16 id, mac_str255 comment) |
| 5200 | 5200 | { |
| r5932 | r5933 | |
| 5230 | 5230 | /* hurk */ |
| 5231 | 5231 | /*return IMGTOOLERR_CORRUPTIMAGE;*/ |
| 5232 | 5232 | /* people willing to extend the MFM comment field (you know, the kind |
| 5233 | of masochists that try to support 20-year-old OSes) might append extra | |
| 5234 | fields, so we just truncate the resource */ | |
| 5233 | of masochists that try to support 20-year-old OSes) might append extra | |
| 5234 | fields, so we just truncate the resource */ | |
| 5235 | 5235 | reslen = 256; |
| 5236 | 5236 | |
| 5237 | 5237 | /* extract comment data */ |
| r5932 | r5933 | |
| 5261 | 5261 | |
| 5262 | 5262 | #ifdef UNUSED_FUNCTION |
| 5263 | 5263 | /* |
| 5264 | ||
| 5264 | close a mfs/hfs image | |
| 5265 | 5265 | */ |
| 5266 | 5266 | static void mac_image_exit(imgtool_image *img) |
| 5267 | 5267 | { |
| r5932 | r5933 | |
| 5272 | 5272 | #endif |
| 5273 | 5273 | |
| 5274 | 5274 | /* |
| 5275 | ||
| 5275 | get basic information on a mfs/hfs image | |
| 5276 | 5276 | |
| 5277 | ||
| 5277 | Currently returns the volume name | |
| 5278 | 5278 | */ |
| 5279 | 5279 | static void mac_image_info(imgtool_image *img, char *string, size_t len) |
| 5280 | 5280 | { |
| r5932 | r5933 | |
| 5293 | 5293 | } |
| 5294 | 5294 | |
| 5295 | 5295 | /* |
| 5296 | ||
| 5296 | MFS/HFS catalog iterator, used when imgtool reads the catalog | |
| 5297 | 5297 | */ |
| 5298 | 5298 | typedef struct mac_iterator |
| 5299 | 5299 | { |
| r5932 | r5933 | |
| 5313 | 5313 | } mac_iterator; |
| 5314 | 5314 | |
| 5315 | 5315 | /* |
| 5316 | ||
| 5316 | Open the disk catalog for enumeration | |
| 5317 | 5317 | */ |
| 5318 | 5318 | static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 5319 | 5319 | { |
| r5932 | r5933 | |
| 5342 | 5342 | } |
| 5343 | 5343 | |
| 5344 | 5344 | /* |
| 5345 | ||
| 5345 | Enumerate disk catalog next entry (MFS) | |
| 5346 | 5346 | */ |
| 5347 | 5347 | static imgtoolerr_t mfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent) |
| 5348 | 5348 | { |
| r5932 | r5933 | |
| 5379 | 5379 | |
| 5380 | 5380 | #if 0 |
| 5381 | 5381 | /* |
| 5382 | ||
| 5382 | Concatenate path elements in the reverse order | |
| 5383 | 5383 | |
| 5384 | dest (O): destination buffer | |
| 5385 | dest_cur_pos (I/O): current position in destination buffer (buffer is | |
| 5386 | filled from end to start) | |
| 5387 | dest_max_len (I): length of destination buffer (use length minus one if you | |
| 5388 | want to preserve a trailing NUL character) | |
| 5389 | src (I): source C string | |
| 5384 | dest (O): destination buffer | |
| 5385 | dest_cur_pos (I/O): current position in destination buffer (buffer is | |
| 5386 | filled from end to start) | |
| 5387 | dest_max_len (I): length of destination buffer (use length minus one if you | |
| 5388 | want to preserve a trailing NUL character) | |
| 5389 | src (I): source C string | |
| 5390 | 5390 | */ |
| 5391 | 5391 | static void concat_fname(char *dest, int *dest_cur_pos, int dest_max_len, const char *src) |
| 5392 | 5392 | { |
| r5932 | r5933 | |
| 5410 | 5410 | #endif |
| 5411 | 5411 | |
| 5412 | 5412 | /* |
| 5413 | ||
| 5413 | Enumerate disk catalog next entry (HFS) | |
| 5414 | 5414 | */ |
| 5415 | 5415 | static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent) |
| 5416 | 5416 | { |
| r5932 | r5933 | |
| 5419 | 5419 | UINT16 dataRecType; |
| 5420 | 5420 | imgtoolerr_t err; |
| 5421 | 5421 | /* currently, the mac->C conversion transcodes one mac char with at most 3 |
| 5422 | ||
| 5422 | C chars */ | |
| 5423 | 5423 | int cur_name_head; |
| 5424 | 5424 | |
| 5425 | 5425 | assert(iter->format == L2I_HFS); |
| r5932 | r5933 | |
| 5471 | 5471 | |
| 5472 | 5472 | /* insert folder/file name in buffer */ |
| 5473 | 5473 | mac_to_c_strncpy(ent->filename, sizeof(ent->filename) / sizeof(ent->filename[0]), catrec_key->cName); |
| 5474 | // | |
| 5474 | // concat_fname(ent->filename, &cur_name_head, sizeof(ent->filename) / sizeof(ent->filename[0]) - 1, buf); | |
| 5475 | 5475 | |
| 5476 | 5476 | #if 0 |
| 5477 | 5477 | /* extract parent directory ID */ |
| 5478 | 5478 | parID = get_UINT32BE(catrec_key->parID); |
| 5479 | 5479 | |
| 5480 | 5480 | /* looping while (parID != 1) will display the volume name; looping while |
| 5481 | ||
| 5481 | (parID != 2) won't */ | |
| 5482 | 5482 | while (parID != /*1*/2) |
| 5483 | 5483 | { |
| 5484 | 5484 | /* search catalog for folder thread */ |
| r5932 | r5933 | |
| 5508 | 5508 | } |
| 5509 | 5509 | |
| 5510 | 5510 | /* got folder thread record: insert the folder name at the start of |
| 5511 | ||
| 5511 | file path, then iterate */ | |
| 5512 | 5512 | mac_to_c_strncpy(buf, sizeof(buf), catrec_data->thread.nodeName); |
| 5513 | 5513 | concat_fname(ent->filename, &cur_name_head, sizeof(ent->filename) / sizeof(ent->filename[0]) - 1, ":"); |
| 5514 | 5514 | concat_fname(ent->filename, &cur_name_head, sizeof(ent->filename) / sizeof(ent->filename[0]) - 1, buf); |
| r5932 | r5933 | |
| 5522 | 5522 | } |
| 5523 | 5523 | |
| 5524 | 5524 | /* |
| 5525 | ||
| 5525 | Enumerate disk catalog next entry | |
| 5526 | 5526 | */ |
| 5527 | 5527 | static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) |
| 5528 | 5528 | { |
| r5932 | r5933 | |
| 5548 | 5548 | } |
| 5549 | 5549 | |
| 5550 | 5550 | /* |
| 5551 | ||
| 5551 | Compute free space on disk image in bytes | |
| 5552 | 5552 | */ |
| 5553 | 5553 | static imgtoolerr_t mac_image_freespace(imgtool_partition *partition, UINT64 *size) |
| 5554 | 5554 | { |
| r5932 | r5933 | |
| 5575 | 5575 | |
| 5576 | 5576 | case L2I_HFS: |
| 5577 | 5577 | /* This is the way to get Finder comments in system <= 7. Attached |
| 5578 | ||
| 5578 | comments use another method, and Finder 8 uses yet another one. */ | |
| 5579 | 5579 | commentID = get_UINT16BE(cat_info->flXFinderInfo.comment); |
| 5580 | 5580 | if (commentID) |
| 5581 | 5581 | err = get_comment(image, commentID, comment); |
| r5932 | r5933 | |
| 5587 | 5587 | |
| 5588 | 5588 | |
| 5589 | 5589 | /* |
| 5590 | ||
| 5590 | Extract a file from a disk image. | |
| 5591 | 5591 | */ |
| 5592 | 5592 | static imgtoolerr_t mac_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf) |
| 5593 | 5593 | { |
| r5932 | r5933 | |
| 5638 | 5638 | } |
| 5639 | 5639 | |
| 5640 | 5640 | /* |
| 5641 | ||
| 5641 | Add a file to a disk image. | |
| 5642 | 5642 | */ |
| 5643 | 5643 | static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) |
| 5644 | 5644 | { |
| r5932 | r5933 | |
| 5650 | 5650 | mac_fileref fileref; |
| 5651 | 5651 | UINT32 fork_len; |
| 5652 | 5652 | /*UINT16 commentID; |
| 5653 | ||
| 5653 | mac_str255 comment;*/ | |
| 5654 | 5654 | UINT8 buf[512]; |
| 5655 | 5655 | UINT32 i, run_len; |
| 5656 | 5656 | imgtoolerr_t err; |
| r5932 | r5933 | |
| 5666 | 5666 | return err; |
| 5667 | 5667 | |
| 5668 | 5668 | /*if (header.version_old != 0) |
| 5669 | ||
| 5669 | return IMGTOOLERR_UNIMPLEMENTED;*/ | |
| 5670 | 5670 | /*mac_strcpy(filename, header.filename);*/ |
| 5671 | 5671 | memset(&cat_info, 0, sizeof(cat_info)); |
| 5672 | 5672 | set_UINT32BE(&cat_info.flFinderInfo.type, 0x3F3F3F3F); |
| r5932 | r5933 | |
| 5674 | 5674 | fork_len = stream_size(sourcef); |
| 5675 | 5675 | /*comment[0] = get_UINT16BE(header.comment_len);*/ /* comment length */ |
| 5676 | 5676 | /* Next two fields are set to 0 with MFS volumes. IIRC, 0 normally |
| 5677 | means system script: I don't think MFS stores the file name script code | |
| 5678 | anywhere on disk, so it should be a reasonable approximation. */ | |
| 5677 | means system script: I don't think MFS stores the file name script code | |
| 5678 | anywhere on disk, so it should be a reasonable approximation. */ | |
| 5679 | 5679 | |
| 5680 | 5680 | /* create file */ |
| 5681 | 5681 | /* clear inited flag and file location in window */ |
| r5932 | r5933 | |
| 6178 | 6178 | finder_flags = (UINT32) attr_values[2].i; |
| 6179 | 6179 | |
| 6180 | 6180 | /* check the bundle bit; if clear (and the type is not 'APPL'), use the |
| 6181 | ||
| 6181 | * desktop file */ | |
| 6182 | 6182 | if (!(finder_flags & 0x2000) && (type_code != /* APPL */ 0x4150504C)) |
| 6183 | 6183 | path = "Desktop\0"; |
| 6184 | 6184 |
| r5932 | r5933 | |
|---|---|---|
| 18 | 18 | is an INFO block which lists all files in the archive. The TAPE block |
| 19 | 19 | contains the actual data. |
| 20 | 20 | |
| 21 | ||
| 21 | Original code in Virtual MSX: | |
| 22 | 22 | |
| 23 | ||
| 23 | ftp://ftp.komkon.org/pub/EMUL8/MSX/Emulators/VMSX1SRC.zip | |
| 24 | 24 | |
| 25 | ||
| 25 | It's in the file TAPE.C. | |
| 26 | 26 | |
| 27 | ||
| 27 | RIFF format specs: | |
| 28 | 28 | |
| 29 | ||
| 29 | http://www.saettler.com/RIFFMCI/riffmci.html | |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | This module converts the files to .cas files. Implemented are: |
| r5932 | r5933 | |
| 36 | 36 | get - gets one file. If "getall" fails, due to characters in the |
| 37 | 37 | filename your FS/OS doesn't support, use: |
| 38 | 38 | |
| 39 | ||
| 39 | imgtool get vmsx_tap monmsx.tap monmsx-binary.cas monmsx.cas | |
| 40 | 40 | |
| 41 | 41 | for example. |
| 42 | 42 | |
| 43 | ||
| 43 | Sean Young | |
| 44 | 44 | */ |
| 45 | 45 | |
| 46 | 46 | #include "osdepend.h" |
| r5932 | r5933 | |
| 197 | 197 | return IMGTOOLERR_CORRUPTIMAGE; |
| 198 | 198 | |
| 199 | 199 | /* OK we've got the right data chunk. Now we can start looking for |
| 200 | ||
| 200 | the blocks */ | |
| 201 | 201 | pos = 0; |
| 202 | 202 | while ( (pos + 8) < size) |
| 203 | 203 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | macutil.h | |
| 4 | 4 | |
| 5 | Imgtool Utility code for manipulating certain Apple/Mac data structures | |
| 6 | and conventions | |
| 5 | Imgtool Utility code for manipulating certain Apple/Mac data structures | |
| 6 | and conventions | |
| 7 | 7 | |
| 8 | 8 | *****************************************************************************/ |
| 9 | 9 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | vzdos.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Laser/VZ disk images | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 65 | 65 | }; |
| 66 | 66 | |
| 67 | 67 | /********************************************************************* |
| 68 | ||
| 68 | Internal functions | |
| 69 | 69 | *********************************************************************/ |
| 70 | 70 | |
| 71 | 71 | /* get length of filename without trailing spaces */ |
| r5932 | r5933 | |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | /********************************************************************* |
| 386 | ||
| 386 | Imgtool module code | |
| 387 | 387 | *********************************************************************/ |
| 388 | 388 | |
| 389 | 389 | static imgtoolerr_t vzdos_diskimage_beginenum(imgtool_directory *enumeration, const char *path) |
| r5932 | r5933 | |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | /********************************************************************* |
| 817 | ||
| 817 | Imgtool vz filter code | |
| 818 | 818 | *********************************************************************/ |
| 819 | 819 | |
| 820 | 820 | static imgtoolerr_t vzsnapshot_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) |
| r5932 | r5933 | |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | /********************************************************************* |
| 912 | ||
| 912 | Imgtool module declaration | |
| 913 | 913 | *********************************************************************/ |
| 914 | 914 | |
| 915 | 915 | static OPTION_GUIDE_START(vzdos_writefile_optionguide) |
| r5932 | r5933 | |
| 925 | 925 | OPTION_GUIDE_END |
| 926 | 926 | |
| 927 | 927 | /* |
| 928 | T Basic Editor File | |
| 929 | B Binary File | |
| 930 | D Sequential Access Program Data File | |
| 931 | F Quickwrite Document | |
| 932 | A Russell Harrison's Edit Ass. File | |
| 933 | S Dave Mitchell/Mark Hardwood Edit Ass. File Start Addr A280H | |
| 934 | S Quickwrite/Diskops System File/Label Except Above | |
| 935 | W Edit Ass. with Diskops File Start Addr A813H | |
| 936 | W E & F Word Pro with Patch 3.3 File End Addr D000H | |
| 937 | W Russell Harrison Word Pro File Except above two | |
| 928 | T Basic Editor File | |
| 929 | B Binary File | |
| 930 | D Sequential Access Program Data File | |
| 931 | F Quickwrite Document | |
| 932 | A Russell Harrison's Edit Ass. File | |
| 933 | S Dave Mitchell/Mark Hardwood Edit Ass. File Start Addr A280H | |
| 934 | S Quickwrite/Diskops System File/Label Except Above | |
| 935 | W Edit Ass. with Diskops File Start Addr A813H | |
| 936 | W E & F Word Pro with Patch 3.3 File End Addr D000H | |
| 937 | W Russell Harrison Word Pro File Except above two | |
| 938 | 938 | */ |
| 939 | 939 | |
| 940 | 940 | void vzdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | prodos.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple II ProDOS disk images | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************** |
| 8 | 8 | |
| r5932 | r5933 | |
| 27 | 27 | Offset Length Description |
| 28 | 28 | ------ ------ ----------- |
| 29 | 29 | 0 1 Storage type (bits 7-4) |
| 30 | 10 - Seedling File (1 block) | |
| 31 | 20 - Sapling File (2-256 blocks) | |
| 32 | 30 - Tree File (257-32768 blocks) | |
| 33 | 40 - Pascal Areas on ProFile HDs (???) | |
| 34 | 50 - GS/OS Extended File (data and rsrc fork) | |
| 35 | E0 - Subdirectory Header | |
| 36 | F0 - Volume Header | |
| 30 | 10 - Seedling File (1 block) | |
| 31 | 20 - Sapling File (2-256 blocks) | |
| 32 | 30 - Tree File (257-32768 blocks) | |
| 33 | 40 - Pascal Areas on ProFile HDs (???) | |
| 34 | 50 - GS/OS Extended File (data and rsrc fork) | |
| 35 | E0 - Subdirectory Header | |
| 36 | F0 - Volume Header | |
| 37 | 37 | 1 15 File name (NUL padded) |
| 38 | 38 | 16 1 File type |
| 39 | 39 | 17 2 Key pointer |
| r5932 | r5933 | |
| 58 | 58 | |
| 59 | 59 | ProDOS dates are 32-bit little endian values |
| 60 | 60 | |
| 61 | bits 0- 4 Day | |
| 62 | bits 5- 8 Month (0-11) | |
| 63 | bits 9-15 Year (0-49 is 2000-2049, 50-99 is 1950-1999) | |
| 64 | bits 16-21 Minute | |
| 65 | bits 24-28 Hour | |
| 61 | bits 0- 4 Day | |
| 62 | bits 5- 8 Month (0-11) | |
| 63 | bits 9-15 Year (0-49 is 2000-2049, 50-99 is 1950-1999) | |
| 64 | bits 16-21 Minute | |
| 65 | bits 24-28 Hour | |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | ProDOS directory and volume headers have this information: |
| r5932 | r5933 | |
| 70 | 70 | Offset Length Description |
| 71 | 71 | ------ ------ ----------- |
| 72 | 72 | 31 1 Length of the entry; generally is 39 |
| 73 | 32 1 Number of entries per block; generally is 13 | |
| 74 | 33 2 Active entry count in directory | |
| 75 | 35 2 Volume bitmap block number | |
| 76 | 37 2 Total blocks on volume | |
| 73 | 32 1 Number of entries per block; generally is 13 | |
| 74 | 33 2 Active entry count in directory | |
| 75 | 35 2 Volume bitmap block number | |
| 76 | 37 2 Total blocks on volume | |
| 77 | 77 | |
| 78 | 78 | GS/OS Extended Files (storage type $5) point to an extended key block that |
| 79 | 79 | contains information about the two forks. The first half of the extended |
| r5932 | r5933 | |
| 83 | 83 | Offset Length Description |
| 84 | 84 | ------ ------ ----------- |
| 85 | 85 | 0 1 Storage type (bits 3-0, unlike the directory entry) |
| 86 | 1 2 Key pointer | |
| 87 | 3 2 Blocks used | |
| 88 | 5 3 File size | |
| 89 | 8 1 Size of secondary info #1 (must be 18 to be valid) | |
| 90 | 9 1 Secondary info #1 type (1=FInfo 2=xFInfo) | |
| 91 | 10 16 FInfo or xFInfo | |
| 92 | 26 1 Size of secondary info #2 (must be 18 to be valid) | |
| 93 | 27 1 Secondary info #2 type (1=FInfo 2=xFInfo) | |
| 94 | 28 16 FInfo or xFInfo | |
| 86 | 1 2 Key pointer | |
| 87 | 3 2 Blocks used | |
| 88 | 5 3 File size | |
| 89 | 8 1 Size of secondary info #1 (must be 18 to be valid) | |
| 90 | 9 1 Secondary info #1 type (1=FInfo 2=xFInfo) | |
| 91 | 10 16 FInfo or xFInfo | |
| 92 | 26 1 Size of secondary info #2 (must be 18 to be valid) | |
| 93 | 27 1 Secondary info #2 type (1=FInfo 2=xFInfo) | |
| 94 | 28 16 FInfo or xFInfo | |
| 95 | 95 | |
| 96 | 96 | FInfo format: |
| 97 | 97 | |
| 98 | 98 | Offset Length Description |
| 99 | 99 | ------ ------ ----------- |
| 100 | 100 | 0 4 File type |
| 101 | 4 4 File creator | |
| 102 | 8 2 Finder flags | |
| 101 | 4 4 File creator | |
| 102 | 8 2 Finder flags | |
| 103 | 103 | 10 2 X Coordinate |
| 104 | 12 2 Y Coordinate | |
| 105 | 14 2 Finder folder | |
| 104 | 12 2 Y Coordinate | |
| 105 | 14 2 Finder folder | |
| 106 | 106 | |
| 107 | 107 | xFInfo format: |
| 108 | 108 | |
| 109 | 109 | Offset Length Description |
| 110 | 110 | ------ ------ ----------- |
| 111 | 111 | 0 2 Icon ID |
| 112 | 2 6 Reserved | |
| 113 | 8 1 Script Code | |
| 114 | 9 1 Extended flags | |
| 112 | 2 6 Reserved | |
| 113 | 8 1 Script Code | |
| 114 | 9 1 Extended flags | |
| 115 | 115 | 10 2 Comment ID |
| 116 | ||
| 116 | 12 4 Put Away Directory | |
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | For more info, consult ProDOS technical note #25 |
| 120 | ||
| 120 | (http://web.pdx.edu/~heiss/technotes/pdos/tn.pdos.25.html) | |
| 121 | 121 | |
| 122 | 122 | *****************************************************************************/ |
| 123 | 123 | |
| r5932 | r5933 | |
| 839 | 839 | if (is_extendedfile_storagetype(ent->storage_type)) |
| 840 | 840 | { |
| 841 | 841 | /* this is a ProDOS extended file; we need to get the extended info |
| 842 | ||
| 842 | * block */ | |
| 843 | 843 | ent->extkey_pointer = pick_integer_le(appleenum->block_data, offset + 17, 2); |
| 844 | 844 | |
| 845 | 845 | err = prodos_load_block(image, ent->extkey_pointer, buffer); |
| r5932 | r5933 | |
| 1595 | 1595 | for (i = 0; i < 256; i++) |
| 1596 | 1596 | { |
| 1597 | 1597 | /* retrieve the block pointer; the two bytes are on either half |
| 1598 | ||
| 1598 | * of the block */ | |
| 1599 | 1599 | sub_block = buffer[i + 256]; |
| 1600 | 1600 | sub_block <<= 8; |
| 1601 | 1601 | sub_block |= buffer[i + 0]; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | fat.c | |
| 4 | 4 | |
| 5 | ||
| 5 | PC FAT disk images | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************** |
| 8 | 8 | |
| r5932 | r5933 | |
| 15 | 15 | 462 16 Partion #2 info |
| 16 | 16 | 478 16 Partion #3 info |
| 17 | 17 | 494 16 Partion #4 info |
| 18 | ||
| 18 | 510 2 Magic bytes (0x55 0xAA) | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | Partition info format: |
| r5932 | r5933 | |
| 23 | 23 | Offset Length Description |
| 24 | 24 | ------ ------ ----------- |
| 25 | 25 | 0 1 Active byte (0x80=active 0x00=inactive) |
| 26 | 1 1 Starting head | |
| 27 | 2 1 Starting sector (bits 5-0) and high bits of starting track (bits 6-5) | |
| 28 | 3 1 Low bits of starting track | |
| 29 | 4 1 Partition type: | |
| 30 | 0x00 Unused | |
| 31 | 0x?1 FAT12 (0-15 MB) | |
| 32 | 0x?2 XENIX | |
| 33 | 0x?4 FAT16 (16-32 MB) | |
| 34 | 0x?6 FAT16` (32 MB-2 GB) | |
| 35 | 0x?7 HPFS or NTFS | |
| 36 | 0x?A Boot Manager | |
| 37 | 0x?B FAT32 (512 MB-2 TB) | |
| 38 | 0x?C FAT32 (512 MB-2 TB LBA) | |
| 39 | 0x1? OS/2 Boot manager/Win95 hidden | |
| 40 | 0xC? DR-DOS secured partition | |
| 41 | 0xD? Multiuser DOS secured partition | |
| 42 | 0xE? SpeedStor extended partition | |
| 43 | 5 1 Ending head | |
| 44 | 6 1 Ending sector (bits 5-0) and high bits of ending track (bits 6-5) | |
| 45 | 7 1 Low bits of ending track | |
| 46 | 8 4 Sector index of beginning of partition | |
| 47 | 12 4 Total sectors in partition | |
| 26 | 1 1 Starting head | |
| 27 | 2 1 Starting sector (bits 5-0) and high bits of starting track (bits 6-5) | |
| 28 | 3 1 Low bits of starting track | |
| 29 | 4 1 Partition type: | |
| 30 | 0x00 Unused | |
| 31 | 0x?1 FAT12 (0-15 MB) | |
| 32 | 0x?2 XENIX | |
| 33 | 0x?4 FAT16 (16-32 MB) | |
| 34 | 0x?6 FAT16` (32 MB-2 GB) | |
| 35 | 0x?7 HPFS or NTFS | |
| 36 | 0x?A Boot Manager | |
| 37 | 0x?B FAT32 (512 MB-2 TB) | |
| 38 | 0x?C FAT32 (512 MB-2 TB LBA) | |
| 39 | 0x1? OS/2 Boot manager/Win95 hidden | |
| 40 | 0xC? DR-DOS secured partition | |
| 41 | 0xD? Multiuser DOS secured partition | |
| 42 | 0xE? SpeedStor extended partition | |
| 43 | 5 1 Ending head | |
| 44 | 6 1 Ending sector (bits 5-0) and high bits of ending track (bits 6-5) | |
| 45 | 7 1 Low bits of ending track | |
| 46 | 8 4 Sector index of beginning of partition | |
| 47 | 12 4 Total sectors in partition | |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | Boot sector format: |
| r5932 | r5933 | |
| 52 | 52 | Offset Length Description |
| 53 | 53 | ------ ------ ----------- |
| 54 | 54 | 0 3 Jump instruction (to skip over header on boot) |
| 55 | ||
| 55 | 3 8 OEM Name | |
| 56 | 56 | 11 2 Bytes per sector |
| 57 | 13 1 Sectors per cluster | |
| 58 | 14 2 Reserved sector count (including boot sector) | |
| 59 | 16 1 Number of FATs (file allocation tables) | |
| 60 | 17 2 Number of root directory entries | |
| 61 | 19 2 Total sectors (bits 0-15) | |
| 62 | 21 1 Media descriptor | |
| 63 | 22 2 Sectors per FAT | |
| 64 | 24 2 Sectors per track | |
| 65 | 26 2 Number of heads | |
| 66 | 28 4 Hidden sectors | |
| 67 | 32 4 Total sectors (bits 16-47) | |
| 68 | 36 1 Physical drive number | |
| 57 | 13 1 Sectors per cluster | |
| 58 | 14 2 Reserved sector count (including boot sector) | |
| 59 | 16 1 Number of FATs (file allocation tables) | |
| 60 | 17 2 Number of root directory entries | |
| 61 | 19 2 Total sectors (bits 0-15) | |
| 62 | 21 1 Media descriptor | |
| 63 | 22 2 Sectors per FAT | |
| 64 | 24 2 Sectors per track | |
| 65 | 26 2 Number of heads | |
| 66 | 28 4 Hidden sectors | |
| 67 | 32 4 Total sectors (bits 16-47) | |
| 68 | 36 1 Physical drive number | |
| 69 | 69 | 37 1 Current head |
| 70 | 38 1 Signature | |
| 71 | 39 4 ID | |
| 72 | 43 11 Volume Label | |
| 73 | 54 8 FAT file system type | |
| 74 | 62 448 Boot machine code | |
| 75 | 510 2 Magic bytes (0x55 0xAA) | |
| 70 | 38 1 Signature | |
| 71 | 39 4 ID | |
| 72 | 43 11 Volume Label | |
| 73 | 54 8 FAT file system type | |
| 74 | 62 448 Boot machine code | |
| 75 | 510 2 Magic bytes (0x55 0xAA) | |
| 76 | 76 | |
| 77 | 77 | For more information: |
| 78 | ||
| 78 | http://support.microsoft.com/kb/q140418/ | |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | Directory Entry Format: |
| r5932 | r5933 | |
| 83 | 83 | Offset Length Description |
| 84 | 84 | ------ ------ ----------- |
| 85 | 85 | 0 8 DOS File Name (padded with spaces) |
| 86 | 8 3 DOS File Extension (padded with spaces) | |
| 87 | 11 1 File Attributes | |
| 88 | 12 2 Unknown | |
| 89 | 14 4 Time of Creation | |
| 90 | 18 2 Last Access Time | |
| 91 | 20 2 EA-Index (OS/2 stuff) | |
| 92 | 22 4 Last Modified Time | |
| 93 | 26 2 First Cluster | |
| 94 | 28 4 File Size | |
| 86 | 8 3 DOS File Extension (padded with spaces) | |
| 87 | 11 1 File Attributes | |
| 88 | 12 2 Unknown | |
| 89 | 14 4 Time of Creation | |
| 90 | 18 2 Last Access Time | |
| 91 | 20 2 EA-Index (OS/2 stuff) | |
| 92 | 22 4 Last Modified Time | |
| 93 | 26 2 First Cluster | |
| 94 | 28 4 File Size | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | Dates and times are stored in separate words; when together, the time is |
| 98 | 98 | first and the date is second. |
| 99 | 99 | |
| 100 | Time: | |
| 101 | bits 15-11 Hour | |
| 102 | bits 10- 5 Minute | |
| 103 | bits 4- 0 Second / 2 | |
| 100 | Time: | |
| 101 | bits 15-11 Hour | |
| 102 | bits 10- 5 Minute | |
| 103 | bits 4- 0 Second / 2 | |
| 104 | 104 | |
| 105 | Date: | |
| 106 | bits 15- 9 Year - 1980 | |
| 107 | bits 8- 5 Month | |
| 108 | bits 4- 0 Day | |
| 105 | Date: | |
| 106 | bits 15- 9 Year - 1980 | |
| 107 | bits 8- 5 Month | |
| 108 | bits 4- 0 Day | |
| 109 | 109 | |
| 110 | 110 | LFN Entry Format: |
| 111 | 111 | |
| 112 | 112 | Offset Length Description |
| 113 | 113 | ------ ------ ----------- |
| 114 | 114 | 0 1 Sequence Number (bit 6 is set on highest sequence) |
| 115 | 1 10 Name characters (five UTF-16LE chars) | |
| 116 | 11 1 Attributes (always 0x0F) | |
| 117 | 12 1 Reserved (always 0x00) | |
| 118 | 13 1 Checksum of short filename entry | |
| 119 | 14 12 Name characters (six UTF-16LE chars) | |
| 120 | 26 2 Entry Cluster (always 0x00) | |
| 121 | 28 4 Name characters (two UTF-16LE chars) | |
| 115 | 1 10 Name characters (five UTF-16LE chars) | |
| 116 | 11 1 Attributes (always 0x0F) | |
| 117 | 12 1 Reserved (always 0x00) | |
| 118 | 13 1 Checksum of short filename entry | |
| 119 | 14 12 Name characters (six UTF-16LE chars) | |
| 120 | 26 2 Entry Cluster (always 0x00) | |
| 121 | 28 4 Name characters (two UTF-16LE chars) | |
| 122 | 122 | |
| 123 | 123 | Valid characters in DOS file names: |
| 124 | - Upper case letters A-Z | |
| 125 | - Numbers 0-9 | |
| 126 | - Space (though there is no way to identify a trailing space) | |
| 127 | - ! # $ % & ( ) - @ ^ _ ` { } ~ | |
| 128 | - Characters 128-255 (though the code page is indeterminate) | |
| 124 | - Upper case letters A-Z | |
| 125 | - Numbers 0-9 | |
| 126 | - Space (though there is no way to identify a trailing space) | |
| 127 | - ! # $ % & ( ) - @ ^ _ ` { } ~ | |
| 128 | - Characters 128-255 (though the code page is indeterminate) | |
| 129 | 129 | |
| 130 | 130 | For more information: |
| 131 | ||
| 131 | http://en.wikipedia.org/wiki/File_Allocation_Table | |
| 132 | 132 | |
| 133 | 133 | ****************************************************************************/ |
| 134 | 134 | |
| r5932 | r5933 | |
| 1295 | 1295 | disk_info = fat_get_partition_info(partition); |
| 1296 | 1296 | |
| 1297 | 1297 | /* The first eight bytes of a FAT directory entry is a blank padded name |
| 1298 | * | |
| 1299 | * The first byte can be special: | |
| 1300 | * 0x00 - entry is available and no further entry is used | |
| 1301 | * 0x05 - first character is actually 0xe5 | |
| 1302 | * 0x2E - dot entry; either '.' or '..' | |
| 1303 | * 0xE5 - entry has been erased and is available | |
| 1304 | * | |
| 1305 | * Byte 11 is the attributes; and 0x0F denotes a LFN entry | |
| 1306 | */ | |
| 1298 | * | |
| 1299 | * The first byte can be special: | |
| 1300 | * 0x00 - entry is available and no further entry is used | |
| 1301 | * 0x05 - first character is actually 0xe5 | |
| 1302 | * 0x2E - dot entry; either '.' or '..' | |
| 1303 | * 0xE5 - entry has been erased and is available | |
| 1304 | * | |
| 1305 | * Byte 11 is the attributes; and 0x0F denotes a LFN entry | |
| 1306 | */ | |
| 1307 | 1307 | do |
| 1308 | 1308 | { |
| 1309 | 1309 | entry_index = file->index; |
| r5932 | r5933 | |
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | 1652 | /* since we changed the short file name, we need to recalc the checksums |
| 1653 | ||
| 1653 | * in the LFN entries */ | |
| 1654 | 1654 | fat_calc_dirent_lfnchecksum(entry, entry_len); |
| 1655 | 1655 | } |
| 1656 | 1656 |
| r5932 | r5933 | |
|---|---|---|
| 139 | 139 | t64_image_beginenum, /* begin enumeration */ |
| 140 | 140 | t64_image_nextenum, /* enumerate next */ |
| 141 | 141 | t64_image_closeenum, /* close enumeration */ |
| 142 | NULL, //t64_image_freespace, | |
| 142 | NULL, //t64_image_freespace, /* free space on image */ | |
| 143 | 143 | t64_image_readfile, /* read file */ |
| 144 | 144 | t64_image_writefile, /* write file */ |
| 145 | 145 | t64_image_deletefile, /* delete file */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | pc_flop.c | |
| 4 | 4 | |
| 5 | ||
| 5 | PC floppies | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 7 | 7 | #include "utils.h" |
| 8 | 8 | |
| 9 | 9 | /* |
| 10 | ||
| 10 | SVI module | |
| 11 | 11 | |
| 12 | SVI style .cas for the svi-318 and svi-328. Converts them to .wav files. | |
| 13 | Uses the mess/formats/svi_cas.[ch] files, for the actual conversion. | |
| 12 | SVI style .cas for the svi-318 and svi-328. Converts them to .wav files. | |
| 13 | Uses the mess/formats/svi_cas.[ch] files, for the actual conversion. | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | typedef struct { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | rsdos.c | |
| 4 | 4 | |
| 5 | ||
| 5 | CoCo RS-DOS disk images | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | /********************************************************************* |
| 45 | ||
| 45 | Imgtool module code | |
| 46 | 46 | *********************************************************************/ |
| 47 | 47 | |
| 48 | 48 | #define MAX_DIRENTS ((18-2)*(256/32)) |
| r5932 | r5933 | |
| 480 | 480 | while(sz > 0); |
| 481 | 481 | |
| 482 | 482 | /* Now that we are done with the file, we need to specify the final entry |
| 483 | * in the file allocation table | |
| 484 | */ | |
| 483 | * in the file allocation table | |
| 484 | */ | |
| 485 | 485 | *gptr = 0xc0 + ((i + 255) / 256); |
| 486 | 486 | |
| 487 | 487 | /* Now we need to find an empty directory entry */ |
| r5932 | r5933 | |
| 578 | 578 | |
| 579 | 579 | |
| 580 | 580 | /********************************************************************* |
| 581 | ||
| 581 | Imgtool module declaration | |
| 582 | 582 | *********************************************************************/ |
| 583 | 583 | |
| 584 | 584 | static OPTION_GUIDE_START( coco_rsdos_writefile_optionguide ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Handlers for concept floppy images | |
| 3 | 3 | |
| 4 | ||
| 4 | Disk images are in MESS format. | |
| 5 | 5 | |
| 6 | ||
| 6 | Raphael Nabet, 2003 | |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #include <stdio.h> |
| r5932 | r5933 | |
| 20 | 20 | } UINT16xE; |
| 21 | 21 | |
| 22 | 22 | /* |
| 23 | ||
| 23 | get_UINT16xE | |
| 24 | 24 | |
| 25 | ||
| 25 | Read a 16-bit word, whether it is little-endian or big-endian | |
| 26 | 26 | |
| 27 | little_endian (I): non-zero if word is little-endian, zero if word is | |
| 28 | big-endian | |
| 29 | word (I): pointer to word to read | |
| 27 | little_endian (I): non-zero if word is little-endian, zero if word is | |
| 28 | big-endian | |
| 29 | word (I): pointer to word to read | |
| 30 | 30 | |
| 31 | ||
| 31 | Returns value of word in native format | |
| 32 | 32 | */ |
| 33 | 33 | INLINE UINT16 get_UINT16xE(int little_endian, UINT16xE word) |
| 34 | 34 | { |
| r5932 | r5933 | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /* |
| 39 | ||
| 39 | set_UINT16xE | |
| 40 | 40 | |
| 41 | ||
| 41 | Write a 16-bit word, whether it is little-endian or big-endian | |
| 42 | 42 | |
| 43 | little_endian (I): non-zero if word is little-endian, zero if word is | |
| 44 | big-endian | |
| 45 | word (O): pointer to word to write | |
| 46 | data (I): value to write in word, in native format | |
| 43 | little_endian (I): non-zero if word is little-endian, zero if word is | |
| 44 | big-endian | |
| 45 | word (O): pointer to word to write | |
| 46 | data (I): value to write in word, in native format | |
| 47 | 47 | */ |
| 48 | 48 | INLINE void set_UINT16xE(int little_endian, UINT16xE *word, UINT16 data) |
| 49 | 49 | { |
| r5932 | r5933 | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /* |
| 63 | ||
| 63 | Disk structure: | |
| 64 | 64 | |
| 65 | Track 0 Sector 0 & 1: bootstrap loader | |
| 66 | Track 0 Sector 2 through 5: disk directory | |
| 67 | Remaining sectors are used for data. | |
| 65 | Track 0 Sector 0 & 1: bootstrap loader | |
| 66 | Track 0 Sector 2 through 5: disk directory | |
| 67 | Remaining sectors are used for data. | |
| 68 | 68 | */ |
| 69 | 69 | |
| 70 | 70 | /* |
| 71 | ||
| 71 | device directory record (Disk sector 2-5) | |
| 72 | 72 | */ |
| 73 | 73 | |
| 74 | 74 | typedef struct concept_vol_hdr_entry |
| r5932 | r5933 | |
| 106 | 106 | } concept_dev_dir; |
| 107 | 107 | |
| 108 | 108 | /* |
| 109 | ||
| 109 | concept disk image descriptor | |
| 110 | 110 | */ |
| 111 | 111 | typedef struct concept_image |
| 112 | 112 | { |
| r5932 | r5933 | |
| 115 | 115 | } concept_image; |
| 116 | 116 | |
| 117 | 117 | /* |
| 118 | ||
| 118 | concept catalog iterator, used when imgtool reads the catalog | |
| 119 | 119 | */ |
| 120 | 120 | typedef struct concept_iterator |
| 121 | 121 | { |
| r5932 | r5933 | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /* |
| 169 | ||
| 169 | read_physical_record | |
| 170 | 170 | |
| 171 | ||
| 171 | Read one 512-byte physical record from a disk image | |
| 172 | 172 | |
| 173 | file_handle: imgtool file handle | |
| 174 | secnum: physical record address | |
| 175 | dest: pointer to destination buffer | |
| 173 | file_handle: imgtool file handle | |
| 174 | secnum: physical record address | |
| 175 | dest: pointer to destination buffer | |
| 176 | 176 | |
| 177 | ||
| 177 | Return non-zero on error | |
| 178 | 178 | */ |
| 179 | 179 | static int read_physical_record(imgtool_stream *file_handle, int secnum, void *dest) |
| 180 | 180 | { |
| r5932 | r5933 | |
| 194 | 194 | |
| 195 | 195 | #ifdef UNUSED_FUNCTION |
| 196 | 196 | /* |
| 197 | ||
| 197 | write_physical_record | |
| 198 | 198 | |
| 199 | ||
| 199 | Write one 512-byte physical record to a disk image | |
| 200 | 200 | |
| 201 | file_handle: imgtool file handle | |
| 202 | secnum: logical sector address | |
| 203 | src: pointer to source buffer | |
| 201 | file_handle: imgtool file handle | |
| 202 | secnum: logical sector address | |
| 203 | src: pointer to source buffer | |
| 204 | 204 | |
| 205 | ||
| 205 | Return non-zero on error | |
| 206 | 206 | */ |
| 207 | 207 | static int write_physical_record(imgtool_stream *file_handle, int secnum, const void *src) |
| 208 | 208 | { |
| r5932 | r5933 | |
| 222 | 222 | #endif |
| 223 | 223 | |
| 224 | 224 | /* |
| 225 | ||
| 225 | Search for a file name on a concept_image | |
| 226 | 226 | |
| 227 | image (I): image reference | |
| 228 | filename (I): name of the file to search | |
| 229 | entry_index (O): index of file in disk catalog | |
| 227 | image (I): image reference | |
| 228 | filename (I): name of the file to search | |
| 229 | entry_index (O): index of file in disk catalog | |
| 230 | 230 | |
| 231 | ||
| 231 | Return non-zero on error | |
| 232 | 232 | */ |
| 233 | 233 | static int get_catalog_entry(concept_image *image, const unsigned char *filename, int *entry_index) |
| 234 | 234 | { |
| r5932 | r5933 | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /* |
| 257 | ||
| 257 | Open a file as a concept_image. | |
| 258 | 258 | */ |
| 259 | 259 | static imgtoolerr_t concept_image_init(imgtool_image *img, imgtool_stream *f) |
| 260 | 260 | { |
| r5932 | r5933 | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /* |
| 292 | ||
| 292 | close a concept_image | |
| 293 | 293 | */ |
| 294 | 294 | static void concept_image_exit(imgtool_image *img) |
| 295 | 295 | { |
| r5932 | r5933 | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /* |
| 300 | ||
| 300 | get basic information on a concept_image | |
| 301 | 301 | |
| 302 | ||
| 302 | Currently returns the volume name | |
| 303 | 303 | */ |
| 304 | 304 | static void concept_image_info(imgtool_image *img, char *string, size_t len) |
| 305 | 305 | { |
| r5932 | r5933 | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /* |
| 316 | ||
| 316 | Open the disk catalog for enumeration | |
| 317 | 317 | */ |
| 318 | 318 | static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path) |
| 319 | 319 | { |
| r5932 | r5933 | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /* |
| 329 | ||
| 329 | Enumerate disk catalog next entry | |
| 330 | 330 | */ |
| 331 | 331 | static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent) |
| 332 | 332 | { |
| r5932 | r5933 | |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /* |
| 390 | ||
| 390 | Free enumerator | |
| 391 | 391 | */ |
| 392 | 392 | static void concept_image_closeenum(imgtool_directory *enumeration) |
| 393 | 393 | { |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /* |
| 397 | ||
| 397 | Compute free space on disk image | |
| 398 | 398 | */ |
| 399 | 399 | static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64 *size) |
| 400 | 400 | { |
| r5932 | r5933 | |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /* |
| 423 | ||
| 423 | Extract a file from a concept_image. | |
| 424 | 424 | */ |
| 425 | 425 | static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf) |
| 426 | 426 | { |
| r5932 | r5933 | |
| 457 | 457 | |
| 458 | 458 | #if 0 |
| 459 | 459 | /* |
| 460 | ||
| 460 | Add a file to a concept_image. | |
| 461 | 461 | */ |
| 462 | 462 | static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions) |
| 463 | 463 | { |
| r5932 | r5933 | |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /* |
| 470 | ||
| 470 | Delete a file from a concept_image. | |
| 471 | 471 | */ |
| 472 | 472 | static imgtoolerr_t concept_image_deletefile(imgtool_partition *partition, const char *filename) |
| 473 | 473 | { |
| r5932 | r5933 | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /* |
| 480 | ||
| 480 | Create a blank concept_image. | |
| 481 | 481 | */ |
| 482 | 482 | static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool_stream *f, option_resolution *createoptions) |
| 483 | 483 | { |
| r5932 | r5933 | |
|---|---|---|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | /****************************************************************/ |
| 184 | /* LZ77 data decompression */ | |
| 185 | /* Copyright (c) 1994 by XelaSoft */ | |
| 186 | /* version history: */ | |
| 187 | /* version 0.9, start date: 11-27-1994 */ | |
| 184 | /* LZ77 data decompression */ | |
| 185 | /* Copyright (c) 1994 by XelaSoft */ | |
| 186 | /* version history: */ | |
| 187 | /* version 0.9, start date: 11-27-1994 */ | |
| 188 | 188 | /****************************************************************/ |
| 189 | 189 | |
| 190 | 190 | #define SHORT unsigned |
| r5932 | r5933 | |
| 204 | 204 | } huf_node; |
| 205 | 205 | |
| 206 | 206 | /****************************************************************/ |
| 207 | /* global vars | |
| 207 | /* global vars */ | |
| 208 | 208 | /****************************************************************/ |
| 209 | 209 | static unsigned updhufcnt; |
| 210 | 210 | static unsigned cpdist[tblsize+1]; |
| r5932 | r5933 | |
| 217 | 217 | static huf_node huftbl[2*tblsize-1]; |
| 218 | 218 | |
| 219 | 219 | /****************************************************************/ |
| 220 | /* maak de huffman codeer informatie | |
| 220 | /* maak de huffman codeer informatie */ | |
| 221 | 221 | /****************************************************************/ |
| 222 | 222 | static void mkhuftbl( void ) |
| 223 | 223 | { |
| r5932 | r5933 | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /****************************************************************/ |
| 288 | /* global vars | |
| 288 | /* global vars */ | |
| 289 | 289 | /****************************************************************/ |
| 290 | 290 | static imgtool_stream *in_stream, *out_stream; |
| 291 | 291 | |
| r5932 | r5933 | |
| 301 | 301 | #define outbufsize (slwinsize+4096) |
| 302 | 302 | |
| 303 | 303 | /****************************************************************/ |
| 304 | /* The function prototypes | |
| 304 | /* The function prototypes */ | |
| 305 | 305 | /****************************************************************/ |
| 306 | 306 | static void unlz77( void ); /* perform the real decompression */ |
| 307 | 307 | static void charout(UINT8); /* put a character in the output stream */ |
| r5932 | r5933 | |
| 312 | 312 | static UINT8 bitin( void ); /* read a bit */ |
| 313 | 313 | |
| 314 | 314 | /****************************************************************/ |
| 315 | /* de hoofdlus | |
| 315 | /* de hoofdlus */ | |
| 316 | 316 | /****************************************************************/ |
| 317 | 317 | static int xsa_extract (imgtool_stream *in, imgtool_stream *out) |
| 318 | 318 | { |
| r5932 | r5933 | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /****************************************************************/ |
| 349 | /* the actual decompression algorithm itself | |
| 349 | /* the actual decompression algorithm itself */ | |
| 350 | 350 | /****************************************************************/ |
| 351 | 351 | static void unlz77( void ) |
| 352 | 352 | { |
| r5932 | r5933 | |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /****************************************************************/ |
| 407 | /* read string length | |
| 407 | /* read string length */ | |
| 408 | 408 | /****************************************************************/ |
| 409 | 409 | static unsigned rdstrlen( void ) |
| 410 | 410 | { |
| r5932 | r5933 | |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /****************************************************************/ |
| 432 | /* read string pos | |
| 432 | /* read string pos */ | |
| 433 | 433 | /****************************************************************/ |
| 434 | 434 | static unsigned rdstrpos( void ) |
| 435 | 435 | { |
| r5932 | r5933 | |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /****************************************************************/ |
| 474 | /* read a bit from the input file | |
| 474 | /* read a bit from the input file */ | |
| 475 | 475 | /****************************************************************/ |
| 476 | 476 | static UINT8 bitin( void ) |
| 477 | 477 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Code to interface the MESS image code with MAME's harddisk core. | |
| 3 | 3 | |
| 4 | We do not support diff files as it will involve some changes in the MESS | |
| 5 | image code. | |
| 4 | We do not support diff files as it will involve some changes in the MESS | |
| 5 | image code. | |
| 6 | 6 | |
| 7 | ||
| 7 | Raphael Nabet 2003 | |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | /*#include "imgtool.h"*/ |
| r5932 | r5933 | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | /* |
| 45 | ||
| 45 | imghd_create() | |
| 46 | 46 | |
| 47 | ||
| 47 | Create a MAME HD image | |
| 48 | 48 | */ |
| 49 | 49 | imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 hunksize, UINT32 cylinders, UINT32 heads, UINT32 sectors, UINT32 seclen) |
| 50 | 50 | { |
| r5932 | r5933 | |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | /* |
| 136 | ||
| 136 | imghd_open() | |
| 137 | 137 | |
| 138 | ||
| 138 | Open stream as a MAME HD image | |
| 139 | 139 | */ |
| 140 | 140 | imgtoolerr_t imghd_open(imgtool_stream *stream, struct mess_hard_disk_file *hard_disk) |
| 141 | 141 | { |
| r5932 | r5933 | |
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | /* |
| 172 | ||
| 172 | imghd_close() | |
| 173 | 173 | |
| 174 | ||
| 174 | Close MAME HD image | |
| 175 | 175 | */ |
| 176 | 176 | void imghd_close(struct mess_hard_disk_file *disk) |
| 177 | 177 | { |
| r5932 | r5933 | |
| 192 | 192 | |
| 193 | 193 | |
| 194 | 194 | /* |
| 195 | ||
| 195 | imghd_read() | |
| 196 | 196 | |
| 197 | ||
| 197 | Read sector(s) from MAME HD image | |
| 198 | 198 | */ |
| 199 | 199 | imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, UINT32 lbasector, void *buffer) |
| 200 | 200 | { |
| r5932 | r5933 | |
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | /* |
| 209 | ||
| 209 | imghd_write() | |
| 210 | 210 | |
| 211 | ||
| 211 | Write sector(s) from MAME HD image | |
| 212 | 212 | */ |
| 213 | 213 | imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, UINT32 lbasector, const void *buffer) |
| 214 | 214 | { |
| r5932 | r5933 | |
| 220 | 220 | |
| 221 | 221 | |
| 222 | 222 | /* |
| 223 | ||
| 223 | imghd_get_header() | |
| 224 | 224 | |
| 225 | ||
| 225 | Return pointer to the header of MAME HD image | |
| 226 | 226 | */ |
| 227 | 227 | const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk) |
| 228 | 228 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | filter.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Imgtool filters | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | stream.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for implementing Imgtool streams | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 453 | 453 | if (!ptr) |
| 454 | 454 | return IMGTOOLERR_OUTOFMEMORY; |
| 455 | 455 | stream_seek(s, 0, SEEK_SET); |
| 456 | if (stream_read(s, ptr, sz) != sz) | |
| 456 | if (stream_read(s, ptr, sz) != sz) | |
| 457 | 457 | { |
| 458 | 458 | free(ptr); |
| 459 | 459 | return IMGTOOLERR_READERROR; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | imgterrs.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Imgtool errors | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | imghd.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Bridge between Imgtool and CHD hard disk images | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 143 | 143 | |
| 144 | 144 | lmc1992->intf = device->static_config; |
| 145 | 145 | |
| 146 | // | |
| 146 | // assert(lmc1992->intf != NULL); | |
| 147 | 147 | |
| 148 | 148 | /* register for state saving */ |
| 149 | 149 |
| r5932 | r5933 | |
|---|---|---|
| 234 | 234 | channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, vic6560_update); |
| 235 | 235 | |
| 236 | 236 | /* buffer for fastest played sample for 5 second |
| 237 | ||
| 237 | * so we have enough data for min 5 second */ | |
| 238 | 238 | noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC; |
| 239 | 239 | noise = auto_alloc_array(device->machine, INT8, noisesize); |
| 240 | 240 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | LMC1992 Digitally-Controlled Stereo Tone and Volume | |
| 4 | Circuit with Four-Channel Input-Selector | |
| 3 | LMC1992 Digitally-Controlled Stereo Tone and Volume | |
| 4 | Circuit with Four-Channel Input-Selector | |
| 5 | 5 | |
| 6 | ________________ | |
| 7 | Data 1 ---| \/ |--- 28 V+ | |
| 8 | Clock 2 ---| |--- 27 Bypass | |
| 9 | Enable 3 ---| |--- 26 Right Input 1 | |
| 10 | Left Input 1 4 ---| |--- 25 Right Input 2 | |
| 11 | Left Input 2 5 ---| |--- 24 Right Input 3 | |
| 12 | Left Input 3 6 ---| |--- 23 Right Input 4 | |
| 13 | Left Input 4 7 ---| LMC1992 |--- 22 Right Select Out | |
| 14 | Left Select Out 8 ---| top view |--- 21 Right Select In | |
| 15 | Left Select In 9 ---| |--- 20 Right Tone In | |
| 16 | Left Tone In 10 ---| |--- 19 Right Tone Out | |
| 17 | Left Tone Out 11 ---| |--- 18 Right Op Amp Out | |
| 18 | Left Op Amp Out 12 ---| |--- 17 Right Rear Out | |
| 19 | Left Rear Out 13 ---| |--- 16 Right Front Out | |
| 20 | Left Front Out 14 ---|________________|--- 15 Ground | |
| 6 | ________________ | |
| 7 | Data 1 ---| \/ |--- 28 V+ | |
| 8 | Clock 2 ---| |--- 27 Bypass | |
| 9 | Enable 3 ---| |--- 26 Right Input 1 | |
| 10 | Left Input 1 4 ---| |--- 25 Right Input 2 | |
| 11 | Left Input 2 5 ---| |--- 24 Right Input 3 | |
| 12 | Left Input 3 6 ---| |--- 23 Right Input 4 | |
| 13 | Left Input 4 7 ---| LMC1992 |--- 22 Right Select Out | |
| 14 | Left Select Out 8 ---| top view |--- 21 Right Select In | |
| 15 | Left Select In 9 ---| |--- 20 Right Tone In | |
| 16 | Left Tone In 10 ---| |--- 19 Right Tone Out | |
| 17 | Left Tone Out 11 ---| |--- 18 Right Op Amp Out | |
| 18 | Left Op Amp Out 12 ---| |--- 17 Right Rear Out | |
| 19 | Left Rear Out 13 ---| |--- 16 Right Front Out | |
| 20 | Left Front Out 14 ---|________________|--- 15 Ground | |
| 21 | 21 | |
| 22 | 22 | */ |
| 23 | 23 |
| r5932 | r5933 | |
|---|---|---|
| 91 | 91 | rate = device->machine->sample_rate; |
| 92 | 92 | |
| 93 | 93 | /* |
| 94 | * 2V = 1000Hz ~= 3579535/224/16 | |
| 95 | * Note 2V on the schematic is not the 2V scanline counter - | |
| 96 | * it is the 2V vertical pixel counter | |
| 97 | * 1 pixel = 4 scanlines high | |
| 98 | * | |
| 94 | * 2V = 1000Hz ~= 3579535/224/16 | |
| 95 | * Note 2V on the schematic is not the 2V scanline counter - | |
| 96 | * it is the 2V vertical pixel counter | |
| 97 | * 1 pixel = 4 scanlines high | |
| 99 | 98 | * |
| 100 | * This is a convenient way to generate the relevant frequencies, | |
| 101 | * using a DDS (Direct Digital Synthesizer) | |
| 102 | * | |
| 103 | * Essentially, you want a counter to overflow some bit position | |
| 104 | * at a fixed rate. So, you figure out a number which you can add | |
| 105 | * to the counter at every sample, so that you will achieve this | |
| 106 | * | |
| 107 | * In this case, we want to overflow bit 16 and the 2V rate, 1000Hz. | |
| 108 | * This means we also get bit 17 = 4V, bit 18 = 8V, etc. | |
| 109 | */ | |
| 99 | * | |
| 100 | * This is a convenient way to generate the relevant frequencies, | |
| 101 | * using a DDS (Direct Digital Synthesizer) | |
| 102 | * | |
| 103 | * Essentially, you want a counter to overflow some bit position | |
| 104 | * at a fixed rate. So, you figure out a number which you can add | |
| 105 | * to the counter at every sample, so that you will achieve this | |
| 106 | * | |
| 107 | * In this case, we want to overflow bit 16 and the 2V rate, 1000Hz. | |
| 108 | * This means we also get bit 17 = 4V, bit 18 = 8V, etc. | |
| 109 | */ | |
| 110 | 110 | |
| 111 | 111 | /* This is the proper value to add per sample */ |
| 112 | 112 | incr = 65536.0/(rate/1000.0/2.0); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | audio/sblaster.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Soundblaster code | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 55 | 55 | typedef enum { OFF, INPUT, OUTPUT } MODE; |
| 56 | 56 | static struct { |
| 57 | 57 | SOUNDBLASTER_CONFIG config; |
| 58 | // | |
| 58 | // int channel; | |
| 59 | 59 | |
| 60 | 60 | MODE mode; |
| 61 | 61 | int on; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | toshiba 6721a chip approximation | |
| 4 | (voice output) | |
| 3 | toshiba 6721a chip approximation | |
| 4 | (voice output) | |
| 5 | 5 | |
| 6 | ||
| 6 | not really working | |
| 7 | 7 | communication with c364 works, no speech synthesis |
| 8 | ||
| 8 | includes c364 interface hardware | |
| 9 | 9 | |
| 10 | ||
| 10 | PeT mess@utanet.at | |
| 11 | 11 | documentation |
| 12 | | |
| 12 | www.funet.fi | |
| 13 | 13 | |
| 14 | 14 | ***************************************************************************/ |
| 15 | 15 |
| r5932 | r5933 | |
|---|---|---|
| 85 | 85 | size = channel->reg[0] | ((channel->reg[1] & 7) << 8); |
| 86 | 86 | if (size) |
| 87 | 87 | { |
| 88 | // | |
| 88 | // channel->size=(int)(machine->sample_rate*(size<<5)/4e6); | |
| 89 | 89 | channel->size= (int) (machine->sample_rate * (size << 5) / cputag_get_clock(machine, "maincpu")); |
| 90 | 90 | } |
| 91 | 91 | else |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /* |
| 20 | AUDIO_A EQU $FD20 | |
| 21 | AUDIO_B EQU $FD28 | |
| 22 | AUDIO_C EQU $FD30 | |
| 23 | AUDIO_D EQU $FD38 | |
| 20 | AUDIO_A EQU $FD20 | |
| 21 | AUDIO_B EQU $FD28 | |
| 22 | AUDIO_C EQU $FD30 | |
| 23 | AUDIO_D EQU $FD38 | |
| 24 | 24 | |
| 25 | VOLUME_CNTRL EQU 0 | |
| 26 | FEEDBACK_ENABLE EQU 1 ; enables 11/10/5..0 | |
| 27 | OUTPUT_VALUE EQU 2 | |
| 28 | SHIFTER_L EQU 3 | |
| 29 | AUD_BAKUP EQU 4 | |
| 30 | AUD_CNTRL1 EQU 5 | |
| 31 | AUD_COUNT EQU 6 | |
| 32 | AUD_CNTRL2 EQU 7 | |
| 25 | VOLUME_CNTRL EQU 0 | |
| 26 | FEEDBACK_ENABLE EQU 1 ; enables 11/10/5..0 | |
| 27 | OUTPUT_VALUE EQU 2 | |
| 28 | SHIFTER_L EQU 3 | |
| 29 | AUD_BAKUP EQU 4 | |
| 30 | AUD_CNTRL1 EQU 5 | |
| 31 | AUD_COUNT EQU 6 | |
| 32 | AUD_CNTRL2 EQU 7 | |
| 33 | 33 | |
| 34 | 34 | ; AUD_CNTRL1 |
| 35 | FEEDBACK_7 EQU %10000000 | |
| 36 | AUD_RESETDONE EQU %01000000 | |
| 37 | AUD_INTEGRATE EQU %00100000 | |
| 38 | AUD_RELOAD EQU %00010000 | |
| 39 | AUD_CNTEN EQU %00001000 | |
| 40 | AUD_LINK EQU %00000111 | |
| 35 | FEEDBACK_7 EQU %10000000 | |
| 36 | AUD_RESETDONE EQU %01000000 | |
| 37 | AUD_INTEGRATE EQU %00100000 | |
| 38 | AUD_RELOAD EQU %00010000 | |
| 39 | AUD_CNTEN EQU %00001000 | |
| 40 | AUD_LINK EQU %00000111 | |
| 41 | 41 | ; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1 |
| 42 | AUD_64us EQU %00000110 | |
| 43 | AUD_32us EQU %00000101 | |
| 44 | AUD_16us EQU %00000100 | |
| 45 | AUD_8us EQU %00000011 | |
| 46 | AUD_4us EQU %00000010 | |
| 47 | AUD_2us EQU %00000001 | |
| 48 | AUD_1us EQU %00000000 | |
| 42 | AUD_64us EQU %00000110 | |
| 43 | AUD_32us EQU %00000101 | |
| 44 | AUD_16us EQU %00000100 | |
| 45 | AUD_8us EQU %00000011 | |
| 46 | AUD_4us EQU %00000010 | |
| 47 | AUD_2us EQU %00000001 | |
| 48 | AUD_1us EQU %00000000 | |
| 49 | 49 | |
| 50 | 50 | ; AUD_CNTRL2 (read only) |
| 51 | ; B7..B4 ; shifter bits 11..8 | |
| 52 | ; B3 ; who knows | |
| 53 | ; B2 ; last clock state (0->1 causes count) | |
| 54 | ; B1 ; borrow in (1 causes count) | |
| 55 | ; B0 ; borrow out (count EQU 0 and borrow in) | |
| 51 | ; B7..B4 ; shifter bits 11..8 | |
| 52 | ; B3 ; who knows | |
| 53 | ; B2 ; last clock state (0->1 causes count) | |
| 54 | ; B1 ; borrow in (1 causes count) | |
| 55 | ; B0 ; borrow out (count EQU 0 and borrow in) | |
| 56 | 56 | |
| 57 | ATTEN_A EQU $FD40 | |
| 58 | ATTEN_B EQU $FD41 | |
| 59 | ATTEN_C EQU $FD42 | |
| 60 | ATTEN_D EQU $FD43 | |
| 57 | ATTEN_A EQU $FD40 | |
| 58 | ATTEN_B EQU $FD41 | |
| 59 | ATTEN_C EQU $FD42 | |
| 60 | ATTEN_D EQU $FD43 | |
| 61 | 61 | ; B7..B4 attenuation left ear (0 silent ..15/16 volume) |
| 62 | 62 | ; B3..B0 " right ear |
| 63 | 63 | |
| 64 | MPAN | |
| 64 | MPAN EQU $FD44 | |
| 65 | 65 | ; B7..B4 left ear |
| 66 | 66 | ; B3..B0 right ear |
| 67 | 67 | ; B7/B3 EQU Audio D |
| 68 | 68 | ; a 1 enables attenuation for channel and side |
| 69 | 69 | |
| 70 | 70 | |
| 71 | MSTEREO EQU $FD50 ; a 1 disables audio connection | |
| 72 | AUD_D_LEFT EQU %10000000 | |
| 73 | AUD_C_LEFT EQU %01000000 | |
| 74 | AUD_B_LEFT EQU %00100000 | |
| 75 | AUD_A_LEFT EQU %00010000 | |
| 76 | AUD_D_RIGHT EQU %00001000 | |
| 77 | AUD_C_RIGHT EQU %00000100 | |
| 78 | AUD_B_RIGHT EQU %00000010 | |
| 79 | AUD_A_RIGHT EQU %00000001 | |
| 71 | MSTEREO EQU $FD50 ; a 1 disables audio connection | |
| 72 | AUD_D_LEFT EQU %10000000 | |
| 73 | AUD_C_LEFT EQU %01000000 | |
| 74 | AUD_B_LEFT EQU %00100000 | |
| 75 | AUD_A_LEFT EQU %00010000 | |
| 76 | AUD_D_RIGHT EQU %00001000 | |
| 77 | AUD_C_RIGHT EQU %00000100 | |
| 78 | AUD_B_RIGHT EQU %00000010 | |
| 79 | AUD_A_RIGHT EQU %00000001 | |
| 80 | 80 | |
| 81 | 81 | */ |
| 82 | 82 | static sound_stream *mixer_channel; |
| r5932 | r5933 | |
| 209 | 209 | |
| 210 | 210 | void lynx_audio_write(int offset, UINT8 data) |
| 211 | 211 | { |
| 212 | // | |
| 212 | // logerror("%.6f audio write %.2x %.2x\n", timer_get_time(machine), offset, data); | |
| 213 | 213 | LYNX_AUDIO *channel=lynx_audio+((offset>>3)&3); |
| 214 | 214 | stream_update(mixer_channel); |
| 215 | 215 | switch (offset) { |
| r5932 | r5933 | |
|---|---|---|
| 160 | 160 | channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, ted7360_update); |
| 161 | 161 | |
| 162 | 162 | /* buffer for fastest played sample for 5 second |
| 163 | ||
| 163 | * so we have enough data for min 5 second */ | |
| 164 | 164 | noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC; |
| 165 | 165 | noise = auto_alloc_array(device->machine, UINT8, noisesize); |
| 166 | 166 |
| r5932 | r5933 | |
|---|---|---|
| 45 | 45 | dai_input[0] = dai_input[1] = dai_input[2] = 0; |
| 46 | 46 | |
| 47 | 47 | mixer_channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, dai_sh_update); |
| 48 | ||
| 48 | ||
| 49 | 49 | logerror ("sample rate: %d\n", device->machine->sample_rate); |
| 50 | 50 | } |
| 51 | 51 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | spchroms.c - This is an emulator for "typical" speech ROMs from TI, as used by TI99/4(a). | |
| 3 | 3 | |
| 4 | In order to support its speech processor, TI designed some ROMs with a 1-bit data bus | |
| 5 | and 4-bit address bus (multiplexed 5 times to provide a 18-bit address). | |
| 6 | A fairly complete description of such a ROM (tms6100) is found in the tms5220 datasheet. | |
| 4 | In order to support its speech processor, TI designed some ROMs with a 1-bit data bus | |
| 5 | and 4-bit address bus (multiplexed 5 times to provide a 18-bit address). | |
| 6 | A fairly complete description of such a ROM (tms6100) is found in the tms5220 datasheet. | |
| 7 | 7 | |
| 8 | ||
| 8 | One notable thing is that the address is a byte address (*NOT* a bit address). | |
| 9 | 9 | |
| 10 | This file is designed to be interfaced with the tms5220 core. | |
| 11 | Interfacing it with the tms5110 would make sense, too. | |
| 10 | This file is designed to be interfaced with the tms5220 core. | |
| 11 | Interfacing it with the tms5110 would make sense, too. | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | #include "driver.h" |
| r5932 | r5933 | |
| 22 | 22 | static int ROM_bits_count; /* current bit position in ROM */ |
| 23 | 23 | |
| 24 | 24 | /* |
| 25 | ||
| 25 | set the speech ROMs | |
| 26 | 26 | */ |
| 27 | 27 | void spchroms_config(running_machine *machine, const spchroms_interface *intf) |
| 28 | 28 | { |
| r5932 | r5933 | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /* |
| 43 | ||
| 43 | Read 'count' bits serially from speech ROM | |
| 44 | 44 | */ |
| 45 | 45 | int spchroms_read(const device_config *device, int count) |
| 46 | 46 | { |
| r5932 | r5933 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /* |
| 81 | ||
| 81 | Write an address nibble to speech ROM | |
| 82 | 82 | */ |
| 83 | 83 | void spchroms_load_address(const device_config *device, int data) |
| 84 | 84 | { |
| 85 | 85 | /* tms5220 data sheet says that if we load only one 4-bit nibble, it won't work. |
| 86 | ||
| 86 | This code does not care about this. */ | |
| 87 | 87 | speechROMaddr = ( (speechROMaddr & ~(0xf << load_pointer)) |
| 88 | 88 | | (((unsigned long) (data & 0xf)) << load_pointer) ) & TMS5220_ADDRESS_MASK; |
| 89 | 89 | load_pointer += 4; |
| r5932 | r5933 | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /* |
| 94 | ||
| 94 | Perform a read and branch command | |
| 95 | 95 | */ |
| 96 | 96 | void spchroms_read_and_branch(const device_config *device) |
| 97 | 97 | { |
| 98 | 98 | /* tms5220 data sheet says that if more than one speech ROM (tms6100) is present, |
| 99 | ||
| 99 | there is a bus contention. This code does not care about this. */ | |
| 100 | 100 | if (speechROMaddr < speechROMlen-1) |
| 101 | 101 | speechROMaddr = (speechROMaddr & 0x3c000UL) |
| 102 | 102 | | (((((unsigned long) speechrom_data[speechROMaddr]) << 8) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | mac.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Sound handler | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | /* |
| 114 | ||
| 114 | Set the sound enable flag (VIA port line) | |
| 115 | 115 | */ |
| 116 | 116 | void mac_enable_sound(const device_config *device, int on) |
| 117 | 117 | { |
| r5932 | r5933 | |
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | /* |
| 125 | ||
| 125 | Set the current sound buffer (one VIA port line) | |
| 126 | 126 | */ |
| 127 | 127 | void mac_set_sound_buffer(const device_config *device, int buffer) |
| 128 | 128 | { |
| r5932 | r5933 | |
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | /* |
| 140 | ||
| 140 | Set the current sound volume (3 VIA port line) | |
| 141 | 141 | */ |
| 142 | 142 | void mac_set_volume(const device_config *device, int volume) |
| 143 | 143 | { |
| r5932 | r5933 | |
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | ||
| 154 | Fetch one byte from sound buffer and put it to sound output (called every scanline) | |
| 155 | 155 | */ |
| 156 | 156 | void mac_sh_updatebuffer(const device_config *device) |
| 157 | 157 | { |
| r5932 | r5933 | |
|---|---|---|
| 121 | 121 | #define SAMPLING ATTOTIME_IN_HZ((SUPERSAMPLING*F0)) |
| 122 | 122 | |
| 123 | 123 | |
| 124 | INLINE mea8000_t* get_safe_token( const device_config *device ) | |
| 124 | INLINE mea8000_t* get_safe_token( const device_config *device ) | |
| 125 | 125 | { |
| 126 | 126 | assert( device != NULL ); |
| 127 | 127 | assert( device->token != NULL ); |
| r5932 | r5933 | |
| 202 | 202 | { |
| 203 | 203 | mea8000_t* mea8000 = get_safe_token( device ); |
| 204 | 204 | /* actually, req pulses less than 3us for each new byte, |
| 205 | it goes back up if there space left in the buffer, or stays low if the | |
| 206 | buffer contains a complete frame and the CPU nees to wait for the next | |
| 207 | frame end to compose a new frame. | |
| 208 | */ | |
| 205 | it goes back up if there space left in the buffer, or stays low if the | |
| 206 | buffer contains a complete frame and the CPU nees to wait for the next | |
| 207 | frame end to compose a new frame. | |
| 208 | */ | |
| 209 | 209 | if (mea8000->iface->req_out_func) |
| 210 | 210 | mea8000->iface->req_out_func( device, 0, mea8000_accept_byte( mea8000 ) ); |
| 211 | 211 | } |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | "Dave" Sound Chip |
| 4 | 4 | |
| 5 | ||
| 5 | DAVE SOUND CHIP FOUND IN ENTERPRISE | |
| 6 | 6 | |
| 7 | ||
| 7 | working: | |
| 8 | 8 | |
| 9 | - pure tone | |
| 10 | - sampled sounds | |
| 11 | - 1 kHz, 50 Hz and 1 Hz ints | |
| 12 | - external ints (int1 and int2) - not correct speed yet | |
| 9 | - pure tone | |
| 10 | - sampled sounds | |
| 11 | - 1 kHz, 50 Hz and 1 Hz ints | |
| 12 | - external ints (int1 and int2) - not correct speed yet | |
| 13 | 13 | |
| 14 | 14 | **********************************************************************/ |
| 15 | 15 | |
| r5932 | r5933 | |
| 72 | 72 | |
| 73 | 73 | /* these are used to force channels on/off */ |
| 74 | 74 | /* if one of the or values is 0x0ff, this means |
| 75 | the volume will be forced on,else it is dependant on | |
| 76 | the state of the wave */ | |
| 75 | the volume will be forced on,else it is dependant on | |
| 76 | the state of the wave */ | |
| 77 | 77 | int level_or[8]; |
| 78 | 78 | /* if one of the values is 0x00, this means the |
| 79 | ||
| 79 | volume is forced off, else it is dependant on the wave */ | |
| 80 | 80 | int level_and[8]; |
| 81 | 81 | |
| 82 | 82 | /* these are the current channel volumes in MAME form */ |
| r5932 | r5933 | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /* dave has 3 tone channels and 1 noise channel. |
| 168 | ||
| 168 | the volumes are mixed internally and output as left and right volume */ | |
| 169 | 169 | |
| 170 | 170 | /* 3 tone channels + 1 noise channel */ |
| 171 | 171 | dave->sound_stream = stream_create(device, 0, 2, device->machine->sample_rate, NULL, dave_update_sound); |
| r5932 | r5933 | |
| 321 | 321 | dave_t *dave = get_token(device); |
| 322 | 322 | stream_sample_t *buffer1, *buffer2; |
| 323 | 323 | /* 0 = channel 0 left volume, 1 = channel 0 right volume, |
| 324 | 2 = channel 1 left volume, 3 = channel 1 right volume, | |
| 325 | 4 = channel 2 left volume, 5 = channel 2 right volume | |
| 326 | 6 = noise channel left volume, 7 = noise channel right volume */ | |
| 324 | 2 = channel 1 left volume, 3 = channel 1 right volume, | |
| 325 | 4 = channel 2 left volume, 5 = channel 2 right volume | |
| 326 | 6 = noise channel left volume, 7 = noise channel right volume */ | |
| 327 | 327 | int output_volumes[8]; |
| 328 | 328 | int left_volume; |
| 329 | 329 | int right_volume; |
| r5932 | r5933 | |
| 403 | 403 | |
| 404 | 404 | /*------------------------------------------------- |
| 405 | 405 | dave_sound_w - used to update sound output |
| 406 | ||
| 406 | based on data writes | |
| 407 | 407 | -------------------------------------------------*/ |
| 408 | 408 | |
| 409 | 409 | static WRITE8_DEVICE_HANDLER(dave_sound_w) |
| r5932 | r5933 | |
| 485 | 485 | |
| 486 | 486 | case 7: |
| 487 | 487 | { |
| 488 | /* force => the value of this register is forced regardless of the wave | |
| 489 | state, | |
| 490 | remove => this value is force to zero so that it has no influence over | |
| 491 | the final volume calculation, regardless of wave state | |
| 492 | use => the volume value is dependant on the wave state and is included | |
| 493 | in the final volume calculation */ | |
| 488 | /* force => the value of this register is forced regardless of the wave | |
| 489 | state, | |
| 490 | remove => this value is force to zero so that it has no influence over | |
| 491 | the final volume calculation, regardless of wave state | |
| 492 | use => the volume value is dependant on the wave state and is included | |
| 493 | in the final volume calculation */ | |
| 494 | 494 | |
| 495 | 495 | logerror("selectable int "); |
| 496 | 496 | switch ((data>>5) & 0x03) |
| r5932 | r5933 | |
| 719 | 719 | |
| 720 | 720 | /*------------------------------------------------- |
| 721 | 721 | dave_set_external_int_state - negative edge |
| 722 | ||
| 722 | triggered | |
| 723 | 723 | -------------------------------------------------*/ |
| 724 | 724 | |
| 725 | 725 | static void dave_set_external_int_state(const device_config *device, int IntID, int State) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | RCA VP550 - VIP Super Sound System emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - tempo control | |
| 15 | - mono/stereo mode | |
| 16 | - VP551 memory map | |
| 14 | - tempo control | |
| 15 | - mono/stereo mode | |
| 16 | - VP551 memory map | |
| 17 | 17 | |
| 18 | 18 | */ |
| 19 | 19 | |
| r5932 | r5933 | |
| 138 | 138 | { |
| 139 | 139 | //float gain = 0.625f * (data & 0x0f); |
| 140 | 140 | |
| 141 | // | |
| 141 | // sound_set_output_gain(device, 0, gain); | |
| 142 | 142 | |
| 143 | 143 | if (LOG) logerror("VP550 '%s' Volume: %u\n", device->tag, data & 0x0f); |
| 144 | 144 | } |
| r5932 | r5933 | |
| 150 | 150 | static WRITE8_DEVICE_HANDLER( vp550_sync_w ) |
| 151 | 151 | { |
| 152 | 152 | timer_device_enable(device, BIT(data, 0)); |
| 153 | ||
| 153 | ||
| 154 | 154 | if (LOG) logerror("VP550 Interrupt Enable: %u\n", BIT(data, 0)); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /*------------------------------------------------- |
| 158 | 158 | vp550_install_readwrite_handler - install |
| 159 | ||
| 159 | or uninstall write handlers | |
| 160 | 160 | -------------------------------------------------*/ |
| 161 | 161 | |
| 162 | 162 | void vp550_install_write_handlers(const device_config *device, const address_space *program, int enabled) |
| r5932 | r5933 | |
| 185 | 185 | |
| 186 | 186 | /*------------------------------------------------- |
| 187 | 187 | vp551_install_readwrite_handler - install |
| 188 | ||
| 188 | or uninstall write handlers | |
| 189 | 189 | -------------------------------------------------*/ |
| 190 | 190 | |
| 191 | 191 | void vp551_install_write_handlers(const device_config *device, const address_space *program, int enabled) |
| r5932 | r5933 | |
| 199 | 199 | static TIMER_DEVICE_CALLBACK( sync_tick ) |
| 200 | 200 | { |
| 201 | 201 | cpu_set_input_line(timer->machine->firstcpu, CDP1802_INPUT_LINE_INT, ASSERT_LINE); |
| 202 | ||
| 202 | ||
| 203 | 203 | if (LOG) logerror("VP550 Interrupt\n"); |
| 204 | 204 | } |
| 205 | 205 |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | #include "streams.h" |
| 12 | 12 | #include "socrates.h" |
| 13 | 13 | |
| 14 | typedef struct | |
| 14 | typedef struct | |
| 15 | 15 | { |
| 16 | sound_stream *stream; | |
| 16 | sound_stream *stream; | |
| 17 | 17 | UINT8 freq[2]; /* channel 1,2 frequencies */ |
| 18 | 18 | UINT8 vol[2]; /* channel 1,2 volume */ |
| 19 | 19 | UINT8 enable[2]; /* channel 1,2 enable */ |
| r5932 | r5933 | |
| 86 | 86 | outputs[0][i] = ((int)chip->DAC_output<<4); |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | ||
| 90 | 89 | |
| 91 | 90 | |
| 91 | ||
| 92 | 92 | /************************************* |
| 93 | 93 | * |
| 94 | 94 | * Sound handler start |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | RCA VP550 - VIP Super Sound System emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | * |
| 18 | 18 | * Changes: |
| 19 | 19 | * |
| 20 | * 10/2/2002 AK - Preliminary sound code. | |
| 21 | * 13/2/2002 AK - Added a hack for mode 4, other fixes. | |
| 22 | * 23/2/2002 AK - Use lookup tables, added sweep to mode 1. Re-wrote the square | |
| 23 | * wave generation. | |
| 24 | * 13/3/2002 AK - Added mode 3, better lookup tables, other adjustments. | |
| 25 | * 15/3/2002 AK - Mode 4 can now change frequencies. | |
| 26 | * 31/3/2002 AK - Accidently forgot to handle counter/consecutive for mode 1. | |
| 27 | * 3/4/2002 AK - Mode 1 sweep can still occur if shift is 0. Don't let frequency | |
| 28 | * go past the maximum allowed value. Fixed Mode 3 length table. | |
| 29 | * Slight adjustment to Mode 4's period table generation. | |
| 30 | * 5/4/2002 AK - Mode 4 is done correctly, using a polynomial counter instead | |
| 31 | * of being a total hack. | |
| 32 | * 6/4/2002 AK - Slight tweak to mode 3's frequency calculation. | |
| 33 | * 13/4/2002 AK - Reset envelope value when sound is initialized. | |
| 34 | * 21/4/2002 AK - Backed out the mode 3 frequency calculation change. | |
| 35 | * Merged init functions into gameboy_sound_w(). | |
| 36 | * 14/5/2002 AK - Removed magic numbers in the fixed point math. | |
| 37 | * 12/6/2002 AK - Merged SOUNDx structs into one SOUND struct. | |
| 38 | * 26/10/2002 AK - Finally fixed channel 3! | |
| 20 | * 10/2/2002 AK - Preliminary sound code. | |
| 21 | * 13/2/2002 AK - Added a hack for mode 4, other fixes. | |
| 22 | * 23/2/2002 AK - Use lookup tables, added sweep to mode 1. Re-wrote the square | |
| 23 | * wave generation. | |
| 24 | * 13/3/2002 AK - Added mode 3, better lookup tables, other adjustments. | |
| 25 | * 15/3/2002 AK - Mode 4 can now change frequencies. | |
| 26 | * 31/3/2002 AK - Accidently forgot to handle counter/consecutive for mode 1. | |
| 27 | * 3/4/2002 AK - Mode 1 sweep can still occur if shift is 0. Don't let frequency | |
| 28 | * go past the maximum allowed value. Fixed Mode 3 length table. | |
| 29 | * Slight adjustment to Mode 4's period table generation. | |
| 30 | * 5/4/2002 AK - Mode 4 is done correctly, using a polynomial counter instead | |
| 31 | * of being a total hack. | |
| 32 | * 6/4/2002 AK - Slight tweak to mode 3's frequency calculation. | |
| 33 | * 13/4/2002 AK - Reset envelope value when sound is initialized. | |
| 34 | * 21/4/2002 AK - Backed out the mode 3 frequency calculation change. | |
| 35 | * Merged init functions into gameboy_sound_w(). | |
| 36 | * 14/5/2002 AK - Removed magic numbers in the fixed point math. | |
| 37 | * 12/6/2002 AK - Merged SOUNDx structs into one SOUND struct. | |
| 38 | * 26/10/2002 AK - Finally fixed channel 3! | |
| 39 | 39 | * |
| 40 | 40 | ***************************************************************************************/ |
| 41 | 41 | |
| r5932 | r5933 | |
| 382 | 382 | break; |
| 383 | 383 | case NR52: /* Sound On/Off (R/W) */ |
| 384 | 384 | /* Only bit 7 is writable, writing to bits 0-3 does NOT enable or |
| 385 | ||
| 385 | disable sound. They are read-only */ | |
| 386 | 386 | gb->snd_control.on = (data & 0x80) >> 7; |
| 387 | 387 | if( !gb->snd_control.on ) |
| 388 | 388 | { |
| r5932 | r5933 | |
| 391 | 391 | gb_sound_w_internal( device, NR12, 0x00 ); |
| 392 | 392 | gb_sound_w_internal( device, NR13, 0xFE ); |
| 393 | 393 | gb_sound_w_internal( device, NR14, 0xBF ); |
| 394 | // | |
| 394 | // gb_sound_w_internal( device, NR20, 0xFF ); | |
| 395 | 395 | gb_sound_w_internal( device, NR21, 0x3F ); |
| 396 | 396 | gb_sound_w_internal( device, NR22, 0x00 ); |
| 397 | 397 | gb_sound_w_internal( device, NR23, 0xFF ); |
| r5932 | r5933 | |
| 401 | 401 | gb_sound_w_internal( device, NR32, 0x9F ); |
| 402 | 402 | gb_sound_w_internal( device, NR33, 0xFF ); |
| 403 | 403 | gb_sound_w_internal( device, NR34, 0xBF ); |
| 404 | // | |
| 404 | // gb_sound_w_internal( device, NR40, 0xFF ); | |
| 405 | 405 | gb_sound_w_internal( device, NR41, 0xFF ); |
| 406 | 406 | gb_sound_w_internal( device, NR42, 0x00 ); |
| 407 | 407 | gb_sound_w_internal( device, NR43, 0x00 ); |
| r5932 | r5933 | |
| 567 | 567 | if( gb->snd_3.on ) |
| 568 | 568 | { |
| 569 | 569 | /* NOTE: This is extremely close, but not quite right. |
| 570 | The problem is for GB frequencies above 2000 the frequency gets | |
| 571 | clipped. This is caused because gb->snd_3.pos is never 0 at the test.*/ | |
| 570 | The problem is for GB frequencies above 2000 the frequency gets | |
| 571 | clipped. This is caused because gb->snd_3.pos is never 0 at the test.*/ | |
| 572 | 572 | sample = gb->snd_regs[AUD3W0 + (gb->snd_3.offset/2)]; |
| 573 | 573 | if( !(gb->snd_3.offset % 2) ) |
| 574 | 574 | { |
| r5932 | r5933 | |
| 624 | 624 | if( gb->snd_4.pos == (gb->snd_4.period >> (FIXED_POINT + 1)) ) |
| 625 | 625 | { |
| 626 | 626 | /* Using a Polynomial Counter (aka Linear Feedback Shift Register) |
| 627 | Mode 4 has a 7 bit and 15 bit counter so we need to shift the | |
| 628 | bits around accordingly */ | |
| 627 | Mode 4 has a 7 bit and 15 bit counter so we need to shift the | |
| 628 | bits around accordingly */ | |
| 629 | 629 | mode4_mask = (((gb->snd_4.ply_value & 0x2) >> 1) ^ (gb->snd_4.ply_value & 0x1)) << (gb->snd_4.ply_step ? 6 : 14); |
| 630 | 630 | gb->snd_4.ply_value >>= 1; |
| 631 | 631 | gb->snd_4.ply_value |= mode4_mask; |
| r5932 | r5933 | |
| 721 | 721 | for( J = 0; J < 16; J++ ) |
| 722 | 722 | { |
| 723 | 723 | /* I is the dividing ratio of frequencies |
| 724 | ||
| 724 | J is the shift clock frequency */ | |
| 725 | 725 | gb->period_mode4_table[I][J] = ((1 << FIXED_POINT) / (524288 / ((I == 0)?0.5:I) / (1 << (J + 1)))) * gb->rate; |
| 726 | 726 | } |
| 727 | 727 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | TODO: | |
| 4 | 4 | |
| 5 | - what happens if you connect both clocks? | |
| 6 | - convert to sound device when possible | |
| 5 | - what happens if you connect both clocks? | |
| 6 | - convert to sound device when possible | |
| 7 | 7 | |
| 8 | 8 | */ |
| 9 | 9 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | RCA VP595 - VIP Simple Sound System emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| r5932 | r5933 | |
| 70 | 70 | |
| 71 | 71 | /*------------------------------------------------- |
| 72 | 72 | vp595_install_readwrite_handler - install |
| 73 | ||
| 73 | or uninstall write handlers | |
| 74 | 74 | -------------------------------------------------*/ |
| 75 | 75 | |
| 76 | 76 | void vp595_install_write_handlers(const device_config *device, const address_space *io, int enabled) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | CDP1863 CMOS 8-Bit Programmable Frequency Generator | |
| 4 | 4 | |
| 5 | ________________ | |
| 6 | _RESET 1 ---| \/ |--- 16 Vdd | |
| 7 | CLK 2 2 ---| |--- 15 OE | |
| 8 | CLK 1 3 ---| |--- 14 OUT | |
| 9 | STR 4 ---| CDP1863C |--- 13 DI7 | |
| 10 | DI0 5 ---| |--- 12 DI6 | |
| 11 | DI1 6 ---| |--- 11 DI5 | |
| 12 | DI2 7 ---| |--- 10 DI4 | |
| 13 | Vss 8 ---|________________|--- 9 DI3 | |
| 5 | ________________ | |
| 6 | _RESET 1 ---| \/ |--- 16 Vdd | |
| 7 | CLK 2 2 ---| |--- 15 OE | |
| 8 | CLK 1 3 ---| |--- 14 OUT | |
| 9 | STR 4 ---| CDP1863C |--- 13 DI7 | |
| 10 | DI0 5 ---| |--- 12 DI6 | |
| 11 | DI1 6 ---| |--- 11 DI5 | |
| 12 | DI2 7 ---| |--- 10 DI4 | |
| 13 | Vss 8 ---|________________|--- 9 DI3 | |
| 14 | 14 | |
| 15 | 15 | */ |
| 16 | 16 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | RCA VP595 - VIP Simple Sound System emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 223 | 223 | if ( x_offset >= 0 && x_offset < WSWAN_X_PIXELS ) { |
| 224 | 224 | if ( wswan_vdp.colors_16 ) { |
| 225 | 225 | if ( col ) { |
| 226 | // | |
| 226 | // if ( wswan_vdp.color_mode ) { | |
| 227 | 227 | wswan_plot_pixel( x_offset, wswan_vdp.current_line, pal[tile_palette][col] ); |
| 228 | // } else { | |
| 229 | // /* Hmmmm, what should we do here... Is this correct?? */ | |
| 230 | // wswan_plot_pixel( x_offset, wswan_vdp.current_line, pal[tile_palette][col] ); | |
| 231 | // } | |
| 228 | // } else { | |
| 229 | // /* Hmmmm, what should we do here... Is this correct?? */ | |
| 230 | // wswan_plot_pixel( x_offset, wswan_vdp.current_line, pal[tile_palette][col] ); | |
| 231 | // } | |
| 232 | 232 | } |
| 233 | 233 | } else { |
| 234 | 234 | if ( col || !(tile_palette & 4 ) ) { |
| r5932 | r5933 | |
| 507 | 507 | } |
| 508 | 508 | } else { |
| 509 | 509 | if ( x_offset < wswan_vdp.window_sprites_left || x_offset > wswan_vdp.window_sprites_right ) { |
| 510 | // | |
| 510 | // continue; | |
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | } |
| r5932 | r5933 | |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | /* |
| 561 | * Draw background layer | |
| 562 | */ | |
| 561 | * Draw background layer | |
| 562 | */ | |
| 563 | 563 | if ( wswan_vdp.layer_bg_enable ) { |
| 564 | 564 | wswan_draw_background(); |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | /* |
| 568 | * Draw sprites between background and foreground layers | |
| 569 | */ | |
| 568 | * Draw sprites between background and foreground layers | |
| 569 | */ | |
| 570 | 570 | if ( wswan_vdp.sprites_enable ) { |
| 571 | 571 | wswan_handle_sprites( 0 ); |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /* |
| 575 | * Draw foreground layer, taking window settings into account | |
| 576 | */ | |
| 575 | * Draw foreground layer, taking window settings into account | |
| 576 | */ | |
| 577 | 577 | if ( wswan_vdp.layer_fg_enable ) { |
| 578 | 578 | switch( wswan_vdp.window_fg_mode ) { |
| 579 | 579 | case 0: /* FG inside & outside window area */ |
| r5932 | r5933 | |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | /* |
| 601 | * Draw sprites in front of foreground layer | |
| 602 | */ | |
| 601 | * Draw sprites in front of foreground layer | |
| 602 | */ | |
| 603 | 603 | if ( wswan_vdp.sprites_enable ) { |
| 604 | 604 | wswan_handle_sprites( 0x2000 ); |
| 605 | 605 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | zx.c | |
| 3 | 3 | |
| 4 | 4 | video hardware |
| 5 | ||
| 5 | Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999 | |
| 6 | 6 | |
| 7 | The ZX has a very unorthodox video RAM system. To start a scanline, | |
| 8 | the CPU must jump to video RAM at 0xC000, which is a mirror of the | |
| 9 | RAM at 0x4000. The video chip (ULA?) pulls a switcharoo and changes | |
| 10 | the video bytes as they are fetched by the CPU. | |
| 7 | The ZX has a very unorthodox video RAM system. To start a scanline, | |
| 8 | the CPU must jump to video RAM at 0xC000, which is a mirror of the | |
| 9 | RAM at 0x4000. The video chip (ULA?) pulls a switcharoo and changes | |
| 10 | the video bytes as they are fetched by the CPU. | |
| 11 | 11 | |
| 12 | The video chip draws the scanline until a HALT instruction (0x76) is | |
| 13 | reached, which indicates no further video RAM for this scanline. Any | |
| 14 | other video byte is used to generate a tile and at the same time, | |
| 15 | appears to the CPU as a NOP (0x00) instruction. | |
| 12 | The video chip draws the scanline until a HALT instruction (0x76) is | |
| 13 | reached, which indicates no further video RAM for this scanline. Any | |
| 14 | other video byte is used to generate a tile and at the same time, | |
| 15 | appears to the CPU as a NOP (0x00) instruction. | |
| 16 | 16 | |
| 17 | 17 | ****************************************************************************/ |
| 18 | 18 | |
| r5932 | r5933 | |
| 57 | 57 | |
| 58 | 58 | new_y = video_screen_get_vpos(machine->primary_screen); |
| 59 | 59 | new_x = video_screen_get_hpos(machine->primary_screen); |
| 60 | /* | |
| 60 | /* logerror("zx_ula_bkgnd: %3d,%3d - %3d,%3d\n", old_x, old_y, new_x, new_y);*/ | |
| 61 | 61 | y = old_y; |
| 62 | 62 | for (;;) |
| 63 | 63 | { |
| r5932 | r5933 | |
| 88 | 88 | |
| 89 | 89 | /* |
| 90 | 90 | * PAL: 310 total lines, |
| 91 | * 0.. 55 vblank | |
| 92 | * 56..247 192 visible lines | |
| 93 | * 248..303 vblank | |
| 94 | * 304... vsync | |
| 91 | * 0.. 55 vblank | |
| 92 | * 56..247 192 visible lines | |
| 93 | * 248..303 vblank | |
| 94 | * 304... vsync | |
| 95 | 95 | * NTSC: 262 total lines |
| 96 | * 0.. 31 vblank | |
| 97 | * 32..223 192 visible lines | |
| 98 | * 224..233 vblank | |
| 96 | * 0.. 31 vblank | |
| 97 | * 32..223 192 visible lines | |
| 98 | * 224..233 vblank | |
| 99 | 99 | */ |
| 100 | 100 | static TIMER_CALLBACK(zx_ula_nmi) |
| 101 | 101 | { |
| 102 | 102 | /* |
| 103 | * An NMI is issued on the ZX81 every 64us for the blanked | |
| 104 | * scanlines at the top and bottom of the display. | |
| 105 | */ | |
| 103 | * An NMI is issued on the ZX81 every 64us for the blanked | |
| 104 | * scanlines at the top and bottom of the display. | |
| 105 | */ | |
| 106 | 106 | const device_config *screen = video_screen_first(machine->config); |
| 107 | 107 | int height = video_screen_get_height(screen); |
| 108 | 108 | rectangle r = *video_screen_get_visible_area(screen); |
| r5932 | r5933 | |
| 110 | 110 | |
| 111 | 111 | r.min_y = r.max_y = ula_scanline_count; |
| 112 | 112 | bitmap_fill(bitmap, &r, 1); |
| 113 | // | |
| 113 | // logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", video_screen_get_vpos(machine->primary_screen), ula_scancode_count, (unsigned) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_R), (unsigned) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC)); | |
| 114 | 114 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 115 | 115 | if (++ula_scanline_count == height) |
| 116 | 116 | ula_scanline_count = 0; |
| r5932 | r5933 | |
| 120 | 120 | { |
| 121 | 121 | |
| 122 | 122 | /* |
| 123 | * An IRQ is issued on the ZX80/81 whenever the R registers | |
| 124 | * bit 6 goes low. In MESS this IRQ timed from the first read | |
| 125 | * from the copy of the DFILE in the upper 32K in zx_ula_r(). | |
| 126 | */ | |
| 123 | * An IRQ is issued on the ZX80/81 whenever the R registers | |
| 124 | * bit 6 goes low. In MESS this IRQ timed from the first read | |
| 125 | * from the copy of the DFILE in the upper 32K in zx_ula_r(). | |
| 126 | */ | |
| 127 | 127 | if (ula_irq_active) |
| 128 | 128 | { |
| 129 | // | |
| 129 | // logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", video_screen_get_vpos(machine->primary_screen), ula_scancode_count, (unsigned) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_R), (unsigned) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC)); | |
| 130 | 130 | |
| 131 | 131 | ula_irq_active = 0; |
| 132 | 132 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | video/dgn_beta.c | |
| 3 | 3 | |
| 4 | 4 | The Dragon Beta uses a 68B45 for it's display generation, this is used in the |
| 5 | 5 | conventional wat with a character generator ROM in the two text modes, which are |
| r5932 | r5933 | |
| 9 | 9 | |
| 10 | 10 | The attributes decode as follows :- |
| 11 | 11 | |
| 12 | 7-6-5-4-3-2-1-0 | |
| 13 | f-u-F-F-F-B-B-B | |
| 12 | 7-6-5-4-3-2-1-0 | |
| 13 | f-u-F-F-F-B-B-B | |
| 14 | 14 | |
| 15 | f=flash | |
| 16 | u=underline | |
| 15 | f=flash | |
| 16 | u=underline | |
| 17 | 17 | |
| 18 | FFF = foreground colour | |
| 19 | BBB = bakcground colour | |
| 18 | FFF = foreground colour | |
| 19 | BBB = bakcground colour | |
| 20 | 20 | |
| 21 | 000 black | |
| 22 | 001 red | |
| 23 | 010 green | |
| 24 | 011 yellow | |
| 25 | 100 blue | |
| 26 | 101 magenta | |
| 27 | 110 cyan | |
| 28 | 111 white | |
| 21 | 000 black | |
| 22 | 001 red | |
| 23 | 010 green | |
| 24 | 011 yellow | |
| 25 | 100 blue | |
| 26 | 101 magenta | |
| 27 | 110 cyan | |
| 28 | 111 white | |
| 29 | 29 | |
| 30 | ||
| 30 | If flash is true, foreground and background colours will be exchanged. | |
| 31 | 31 | |
| 32 | 32 | It is interesting to note that the 6845 uses 16 bit wide access to the ram, in contrast |
| 33 | 33 | to the 8 bit accesses from the CPUs, this allows each increment of the MA lines to move |
| r5932 | r5933 | |
| 51 | 51 | However the modes supported are :- |
| 52 | 52 | |
| 53 | 53 | Text Modes |
| 54 | width height colours | |
| 55 | 40 25 8 | |
| 56 | 80 25 8 | |
| 54 | width height colours | |
| 55 | 40 25 8 | |
| 56 | 80 25 8 | |
| 57 | 57 | Graphics modes |
| 58 | 320 256 4 | |
| 59 | 320 256 16 | |
| 60 | 640 512 4 | |
| 61 | 640 256 4** | |
| 62 | 640 512 2 | |
| 58 | 320 256 4 | |
| 59 | 320 256 16 | |
| 60 | 640 512 4 | |
| 61 | 640 256 4** | |
| 62 | 640 512 2 | |
| 63 | 63 | |
| 64 | 64 | Looking at the parts of the circuit sheet that I have seen it looks like the graphics modes |
| 65 | 65 | are driven using a combination of the 6845 MA and RA lines to address more than 64K or memory |
| r5932 | r5933 | |
| 203 | 203 | |
| 204 | 204 | /* Set video control register from I28 port B, the control register is laid out as */ |
| 205 | 205 | /* follows :- */ |
| 206 | /* bit function */ | |
| 207 | /* 0 WI, unknown */ | |
| 208 | /* 1 Character set select, drives A12 of character rom in text mode */ | |
| 209 | /* 2 High (1) or Low(0) resolution if in graphics mode. */ | |
| 210 | /* 3 Text (1) or Graphics(0) mode */ | |
| 211 | /* 4 Control bit, Selects between colour palate and drirect drive */ | |
| 212 | /* 5 F/S bit, 1=80 bytes/line, 0=40bytes/line */ | |
| 213 | /* 6 Effective A14, to ram, in text mode */ | |
| 214 | /* 7 Effective A15, to ram, in text mode */ | |
| 206 | /* bit function */ | |
| 207 | /* 0 WI, unknown */ | |
| 208 | /* 1 Character set select, drives A12 of character rom in text mode */ | |
| 209 | /* 2 High (1) or Low(0) resolution if in graphics mode. */ | |
| 210 | /* 3 Text (1) or Graphics(0) mode */ | |
| 211 | /* 4 Control bit, Selects between colour palate and drirect drive */ | |
| 212 | /* 5 F/S bit, 1=80 bytes/line, 0=40bytes/line */ | |
| 213 | /* 6 Effective A14, to ram, in text mode */ | |
| 214 | /* 7 Effective A15, to ram, in text mode */ | |
| 215 | 215 | /* the top two address lines for the video ram, are supplied by the BB6 and PB7 on */ |
| 216 | 216 | /* 6821-I28, this allows the 6845 to access the full 64K address range, however */ |
| 217 | 217 | /* since the ram data is addressed as a 16bit wide unit, this allows the 6845 */ |
| r5932 | r5933 | |
| 257 | 257 | int HW=m6845_get_register(H_SYNC_WIDTH)&0xF; // Hsync width (in chars) |
| 258 | 258 | |
| 259 | 259 | beta_scr_y++; |
| 260 | // | |
| 260 | // beta_scr_x=0-(((HT-HS)-HW)*8); // Number of dots after HS to wait before start of next line | |
| 261 | 261 | beta_scr_x=0-((HT-(HS+HW))*Dots); |
| 262 | 262 | |
| 263 | 263 | //debug_console_printf(machine, "HT=%d, HS=%d, HW=%d, (HS+HW)=%d, HT-(HS+HW)=%d\n",HT,HS,HW,(HS+HW),(HT-(HS+HW))); |
| r5932 | r5933 | |
| 288 | 288 | else if (DrawInterlace==INTERLACE_ON) |
| 289 | 289 | { |
| 290 | 290 | Field=(Field+1) & 0x01; /* Invert field */ |
| 291 | // | |
| 291 | // debug_console_printf(machine, "Invert field=%d\n",Field); | |
| 292 | 292 | } |
| 293 | 293 | VSyncMin=beta_scr_y; |
| 294 | 294 | } |
| r5932 | r5933 | |
| 498 | 498 | { |
| 499 | 499 | PlotY=(y*2);//+Field; |
| 500 | 500 | DoubleY=0; |
| 501 | // | |
| 501 | // debug_console_printf(machine, "Field=%d\n",Field); | |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | /* Error check, make sure we're drawing on the actual bitmap ! */ |
| r5932 | r5933 | |
| 601 | 601 | Colour=ColourRAM[((Word&0x8000)>>15)]; |
| 602 | 602 | plot_gfx_pixel(x,y,Dot,Colour,bitmap); |
| 603 | 603 | |
| 604 | // Colour=ColourRAM[((Word&0x0080)>>7)]; | |
| 605 | // plot_gfx_pixel(x,y,Dot+1,Colour,bitmap); | |
| 604 | // Colour=ColourRAM[((Word&0x0080)>>7)]; | |
| 605 | // plot_gfx_pixel(x,y,Dot+1,Colour,bitmap); | |
| 606 | 606 | |
| 607 | 607 | Hi=Word&0x8000; |
| 608 | 608 | Word=((Word<<1)&0xFFFE) | (Hi>>15); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | video/pdp1.c | |
| 3 | 3 | |
| 4 | ||
| 4 | PDP1 video emulation. | |
| 5 | 5 | |
| 6 | We emulate three display devices: | |
| 7 | * CRT screen | |
| 8 | * control panel | |
| 9 | * typewriter output | |
| 6 | We emulate three display devices: | |
| 7 | * CRT screen | |
| 8 | * control panel | |
| 9 | * typewriter output | |
| 10 | 10 | |
| 11 | For the actual emulation of these devices look at the machine/pdp1.c. This | |
| 12 | file only includes the display routines. | |
| 11 | For the actual emulation of these devices look at the machine/pdp1.c. This | |
| 12 | file only includes the display routines. | |
| 13 | 13 | |
| 14 | Raphael Nabet 2002-2004 | |
| 15 | Based on earlier work by Chris Salomon | |
| 14 | Raphael Nabet 2002-2004 | |
| 15 | Based on earlier work by Chris Salomon | |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | #include <math.h> |
| r5932 | r5933 | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /* |
| 54 | ||
| 54 | video init | |
| 55 | 55 | */ |
| 56 | 56 | VIDEO_START( pdp1 ) |
| 57 | 57 | { |
| r5932 | r5933 | |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | /* |
| 73 | ||
| 73 | schedule a pixel to be plotted | |
| 74 | 74 | */ |
| 75 | 75 | void pdp1_plot(int x, int y) |
| 76 | 76 | { |
| r5932 | r5933 | |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | /* |
| 85 | ||
| 85 | video_update_pdp1: effectively redraw the screen | |
| 86 | 86 | */ |
| 87 | 87 | VIDEO_UPDATE( pdp1 ) |
| 88 | 88 | { |
| r5932 | r5933 | |
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | /* |
| 103 | ||
| 103 | Operator control panel code | |
| 104 | 104 | */ |
| 105 | 105 | |
| 106 | 106 | enum |
| r5932 | r5933 | |
| 247 | 247 | |
| 248 | 248 | |
| 249 | 249 | /* |
| 250 | ||
| 250 | draw the operator control panel (fixed backdrop) | |
| 251 | 251 | */ |
| 252 | 252 | static void pdp1_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap) |
| 253 | 253 | { |
| r5932 | r5933 | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /* |
| 301 | ||
| 301 | draw the operator control panel (dynamic elements) | |
| 302 | 302 | */ |
| 303 | 303 | static void pdp1_draw_panel(running_machine *machine, bitmap_t *bitmap) |
| 304 | 304 | { |
| r5932 | r5933 | |
| 342 | 342 | |
| 343 | 343 | |
| 344 | 344 | /* |
| 345 | ||
| 345 | Typewriter code | |
| 346 | 346 | */ |
| 347 | 347 | |
| 348 | 348 | |
| r5932 | r5933 | |
| 493 | 493 | |
| 494 | 494 | |
| 495 | 495 | /* |
| 496 | ||
| 496 | lightpen code | |
| 497 | 497 | */ |
| 498 | 498 | |
| 499 | 499 | void pdp1_update_lightpen_state(const lightpen_t *new_state) |
| r5932 | r5933 | |
| 574 | 574 | if (previous_lightpen_state.active) |
| 575 | 575 | { |
| 576 | 576 | /*if (previous_lightpen_state.x>0) |
| 577 | pdp1_plot_pixel(bitmap, previous_lightpen_state.x/2-1, previous_lightpen_state.y/2, pen_black); | |
| 578 | if (previous_lightpen_state.x<1023) | |
| 579 | pdp1_plot_pixel(bitmap, previous_lightpen_state.x/2+1, previous_lightpen_state.y/2, pen_black); | |
| 580 | if (previous_lightpen_state.y>0) | |
| 581 | pdp1_plot_pixel(bitmap, previous_lightpen_state.x/2, previous_lightpen_state.y/2-1, pen_black); | |
| 582 | if (previous_lightpen_state.y<1023) | |
| 583 | pdp1_plot_pixel(bitmap, previous_lightpen_state.x/2, previous_lightpen_state.y/2+1, pen_black);*/ | |
| 577 | pdp1_plot_pixel(bitmap, previous_lightpen_state.x/2-1, previous_lightpen_state.y/2, pen_black); | |
| 578 | if (previous_lightpen_state.x<1023) | |
| 579 | pdp1_plot_pixel(bitmap, previous_lightpen_state.x/2+1, previous_lightpen_state.y/2, pen_black); | |
| 580 | if (previous_lightpen_state.y>0) | |
| 581 | pdp1_plot_pixel(bitmap, previous_lightpen_state.x/2, previous_lightpen_state.y/2-1, pen_black); | |
| 582 | if (previous_lightpen_state.y<1023) | |
| 583 | pdp1_plot_pixel(bitmap, previous_lightpen_state.x/2, previous_lightpen_state.y/2+1, pen_black);*/ | |
| 584 | 584 | pdp1_draw_circle(bitmap, previous_lightpen_state.x, previous_lightpen_state.y, previous_lightpen_state.radius, pen_black); |
| 585 | 585 | } |
| 586 | 586 | } |
| r5932 | r5933 | |
| 591 | 591 | { |
| 592 | 592 | int color_ = lightpen_state.down ? pen_lightpen_pressed : pen_lightpen_nonpressed; |
| 593 | 593 | /*if (lightpen_state.x>0) |
| 594 | pdp1_plot_pixel(bitmap, lightpen_state.x/2-1, lightpen_state.y/2, color); | |
| 595 | if (lightpen_state.x<1023) | |
| 596 | pdp1_plot_pixel(bitmap, lightpen_state.x/2+1, lightpen_state.y/2, color); | |
| 597 | if (lightpen_state.y>0) | |
| 598 | pdp1_plot_pixel(bitmap, lightpen_state.x/2, lightpen_state.y/2-1, color); | |
| 599 | if (lightpen_state.y<1023) | |
| 600 | pdp1_plot_pixel(bitmap, lightpen_state.x/2, lightpen_state.y/2+1, color);*/ | |
| 594 | pdp1_plot_pixel(bitmap, lightpen_state.x/2-1, lightpen_state.y/2, color); | |
| 595 | if (lightpen_state.x<1023) | |
| 596 | pdp1_plot_pixel(bitmap, lightpen_state.x/2+1, lightpen_state.y/2, color); | |
| 597 | if (lightpen_state.y>0) | |
| 598 | pdp1_plot_pixel(bitmap, lightpen_state.x/2, lightpen_state.y/2-1, color); | |
| 599 | if (lightpen_state.y<1023) | |
| 600 | pdp1_plot_pixel(bitmap, lightpen_state.x/2, lightpen_state.y/2+1, color);*/ | |
| 601 | 601 | pdp1_draw_circle(bitmap, lightpen_state.x, lightpen_state.y, lightpen_state.radius, color_); |
| 602 | 602 | } |
| 603 | 603 | previous_lightpen_state = lightpen_state; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Homelab video driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 31/08/2008 Preliminary driver. | |
| 6 | ||
| 5 | 31/08/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "includes/homelab.h" |
| 12 | ||
| 13 | 12 | |
| 13 | ||
| 14 | 14 | VIDEO_START( homelab ) |
| 15 | 15 | { |
| 16 | 16 | } |
| 17 | ||
| 17 | ||
| 18 | 18 | VIDEO_UPDATE( homelab ) |
| 19 | 19 | { |
| 20 | 20 | int x,y,j,b; |
| r5932 | r5933 | |
| 25 | 25 | { |
| 26 | 26 | for(x = 0; x < 40; x++ ) |
| 27 | 27 | { |
| 28 | int code = memory_read_byte(space, 0xc000 + x + y*40); | |
| 28 | int code = memory_read_byte(space, 0xc000 + x + y*40); | |
| 29 | 29 | for(j = 0; j < 8; j++ ) |
| 30 | 30 | { |
| 31 | 31 | for(b = 0; b < 8; b++ ) |
| r5932 | r5933 | |
| 48 | 48 | { |
| 49 | 49 | for(x = 0; x < 80; x++ ) |
| 50 | 50 | { |
| 51 | int code = memory_read_byte(space, 0xf000 + x + y * 80); | |
| 51 | int code = memory_read_byte(space, 0xf000 + x + y * 80); | |
| 52 | 52 | for(j = 0; j < 8; j++ ) |
| 53 | 53 | { |
| 54 | 54 | for(b = 0; b < 8; b++ ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | CPS Changer | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | pocketc_draw_special(bitmap, RIGHT+149, DOWN+24, line, | |
| 161 | pocketc_draw_special(bitmap, RIGHT+149, DOWN+24, line, | |
| 162 | 162 | pc1401_lcd.reg[0x3c] & 0x08 ? color[1] : color[0]); |
| 163 | ||
| 164 | pocketc_draw_special(bitmap, RIGHT, DOWN-10, busy, | |
| 163 | ||
| 164 | pocketc_draw_special(bitmap, RIGHT, DOWN-10, busy, | |
| 165 | 165 | pc1401_lcd.reg[0x3d] & 0x01 ? color[1] : color[0]); |
| 166 | 166 | |
| 167 | 167 | pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, def, |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | video/apple2gs.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple IIgs video code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 107 | 107 | /* Machine Drivers */ |
| 108 | 108 | |
| 109 | 109 | MACHINE_DRIVER_START( pc8401a_video ) |
| 110 | // MDRV_DEFAULT_LAYOUT(layout_pc8401a) | |
| 111 | ||
| 110 | // MDRV_DEFAULT_LAYOUT(layout_pc8401a) | |
| 111 | ||
| 112 | 112 | MDRV_PALETTE_LENGTH(2) |
| 113 | 113 | MDRV_PALETTE_INIT(pc8401a) |
| 114 | 114 | |
| r5932 | r5933 | |
| 125 | 125 | |
| 126 | 126 | MACHINE_DRIVER_START( pc8500_video ) |
| 127 | 127 | MDRV_DEFAULT_LAYOUT(layout_pc8500) |
| 128 | ||
| 128 | ||
| 129 | 129 | MDRV_PALETTE_LENGTH(2+8) |
| 130 | 130 | MDRV_PALETTE_INIT(pc8401a) |
| 131 | 131 |
| r5932 | r5933 | |
|---|---|---|
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | The LCD is 131x64 pixels and has two components: |
| 89 | - a main screen | |
| 90 | - a menu screen | |
| 89 | - a main screen | |
| 90 | - a menu screen | |
| 91 | 91 | |
| 92 | The main height (M) and the menu height (m) can be changed with the constraints: | |
| 93 | - m+M=64 | |
| 94 | - M>=2 | |
| 92 | The main height (M) and the menu height (m) can be changed with the constraints: | |
| 93 | - m+M=64 | |
| 94 | - M>=2 | |
| 95 | 95 | |
| 96 | ||
| 96 | Pixels are 1-bit, packed in memory. | |
| 97 | 97 | |
| 98 | The start address of both screens can be changed independently | |
| 99 | (this allows smooth, pixel-precise vertical scrooling of both parts). | |
| 100 | They must be even addresses (in nibbles). | |
| 98 | The start address of both screens can be changed independently | |
| 99 | (this allows smooth, pixel-precise vertical scrooling of both parts). | |
| 100 | They must be even addresses (in nibbles). | |
| 101 | 101 | |
| 102 | The stride (offset in nibbles between two scanlines) can be changed for the main screen. | |
| 103 | It must be even. | |
| 104 | It is fixed to 34 for the menu screen. | |
| 105 | ||
| 106 | The bit offset for the first column of the main screen can be changed | |
| 107 | (this allows smooth, pixel-precise horizontal scrooling). | |
| 108 | It is always 0 for the menu screen. | |
| 102 | The stride (offset in nibbles between two scanlines) can be changed for the main screen. | |
| 103 | It must be even. | |
| 104 | It is fixed to 34 for the menu screen. | |
| 109 | 105 | |
| 110 | Above the LCD, there are 6 annonciators that can be independently turned | |
| 111 | on and off (and independetly from the LCD). | |
| 112 | They are not handled here, but through output_set_value. | |
| 106 | The bit offset for the first column of the main screen can be changed | |
| 107 | (this allows smooth, pixel-precise horizontal scrooling). | |
| 108 | It is always 0 for the menu screen. | |
| 109 | ||
| 110 | Above the LCD, there are 6 annonciators that can be independently turned | |
| 111 | on and off (and independetly from the LCD). | |
| 112 | They are not handled here, but through output_set_value. | |
| 113 | 113 | */ |
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | /* |
| 117 | 117 | In theory, the LCD is monorchrome, with a global adjustable contrast (32 levels). |
| 118 | However, by switching between screens at each refresh (64 Hz), one can achieve the | |
| 119 | illusion of grayscale, with moderate flickering. | |
| 120 | This technique was very widespread. | |
| 121 | We emulate it by simply averaging between the last few (HP48_NB_SCREENS) frames. | |
| 122 | ||
| 123 | HP48_NB_SCREENS should be a multiple of the period of screen flips to avoid | |
| 124 | flickering in the emulation. | |
| 118 | However, by switching between screens at each refresh (64 Hz), one can achieve the | |
| 119 | illusion of grayscale, with moderate flickering. | |
| 120 | This technique was very widespread. | |
| 121 | We emulate it by simply averaging between the last few (HP48_NB_SCREENS) frames. | |
| 122 | ||
| 123 | HP48_NB_SCREENS should be a multiple of the period of screen flips to avoid | |
| 124 | flickering in the emulation. | |
| 125 | 125 | */ |
| 126 | 126 | |
| 127 | 127 | |
| r5932 | r5933 | |
| 151 | 151 | |
| 152 | 152 | LOG(( "%f hp48 video_update called: ", attotime_to_double(timer_get_time(screen->machine)) )); |
| 153 | 153 | |
| 154 | if ( !display || refresh ) | |
| 155 | { | |
| 154 | if ( !display || refresh ) | |
| 155 | { | |
| 156 | 156 | LOG(( "display off\n" )); |
| 157 | 157 | bitmap_fill( bitmap, NULL, 0 ); |
| 158 | return 0; | |
| 158 | return 0; | |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /* correcting factors */ |
| 162 | 162 | if ( right_margin & 0x800 ) right_margin -= 0x1000; |
| 163 | 163 | if ( last_line <= 1 ) last_line = 0x3f; |
| 164 | 164 | |
| 165 | LOG(( "on=%i lmargin=%i rmargin=%i contrast=%i start=%05x lline=%i menu=%05x\n", | |
| 166 | display, left_margin, right_margin, contrast, bitmap_start, last_line, menu_start )); | |
| 165 | LOG(( "on=%i lmargin=%i rmargin=%i contrast=%i start=%05x lline=%i menu=%05x\n", | |
| 166 | display, left_margin, right_margin, contrast, bitmap_start, last_line, menu_start )); | |
| 167 | 167 | |
| 168 | 168 | /* draw main bitmap */ |
| 169 | 169 | addr = bitmap_start; |
| 170 | for ( y = 0; y <= last_line; y++ ) | |
| 170 | for ( y = 0; y <= last_line; y++ ) | |
| 171 | 171 | { |
| 172 | 172 | xp = -left_margin; |
| 173 | 173 | for ( x = 0; x < 34; x++, addr++ ) |
| r5932 | r5933 | |
| 179 | 179 | |
| 180 | 180 | /* draw menu bitmap */ |
| 181 | 181 | addr = menu_start; |
| 182 | for ( ; y <= 0x3f; y++ ) | |
| 182 | for ( ; y <= 0x3f; y++ ) | |
| 183 | 183 | { |
| 184 | 184 | xp = 0; |
| 185 | 185 | for ( x = 0; x < 34; x++, addr++ ) |
| r5932 | r5933 | |
| 200 | 200 | } |
| 201 | 201 | acc = (acc * 255) / (33 * HP48_NB_SCREENS); |
| 202 | 202 | *BITMAP_ADDR16( bitmap, y, x ) = acc; |
| 203 | } | |
| 203 | } | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | hp48_cur_screen = (hp48_cur_screen + 1) % HP48_NB_SCREENS; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | video/apple3.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple /// | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - 4 bit mode | |
| 15 | - busy flag | |
| 16 | - reset flag | |
| 14 | - 4 bit mode | |
| 15 | - busy flag | |
| 16 | - reset flag | |
| 17 | 17 | |
| 18 | 18 | */ |
| 19 | 19 | |
| r5932 | r5933 | |
| 224 | 224 | if ((sy >= cliprect->min_y) && (sy <= cliprect->max_y) && (sx >= cliprect->min_x) && (sx <= cliprect->max_x)) |
| 225 | 225 | { |
| 226 | 226 | int color = (hd44102->status & HD44102_STATUS_DISPLAY_OFF) ? 0 : BIT(data, z % 8); |
| 227 | ||
| 227 | ||
| 228 | 228 | *BITMAP_ADDR16(bitmap, sy, sx) = color; |
| 229 | 229 | } |
| 230 | 230 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | TI 911 VDT core. To be operated with the TI 990 line of computers (can be connected to | |
| 3 | any model, as communication uses the CRU bus). | |
| 2 | TI 911 VDT core. To be operated with the TI 990 line of computers (can be connected to | |
| 3 | any model, as communication uses the CRU bus). | |
| 4 | 4 | |
| 5 | ||
| 5 | Raphael Nabet 2002 | |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | * add more flexibility, so that we can create multiple-terminal configurations. | |
| 9 | * support test mode??? | |
| 8 | * add more flexibility, so that we can create multiple-terminal configurations. | |
| 9 | * support test mode??? | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | |
| r5932 | r5933 | |
| 111 | 111 | static vdt_t vdt[MAX_VDT]; |
| 112 | 112 | |
| 113 | 113 | /* |
| 114 | ||
| 114 | Macros for model features | |
| 115 | 115 | */ |
| 116 | 116 | /* TRUE for japanese and arabic terminals, which use 8-bit charcodes and keyboard shift modes */ |
| 117 | 117 | #define USES_8BIT_CHARCODES(unit) ((vdt[unit].model == vdt911_model_Japanese) /*|| (vdt[unit].model == vdt911_model_Arabic)*/) |
| 118 | 118 | /* TRUE for keyboards which have this extra key (on the left of TAB/SKIP) |
| 119 | ||
| 119 | (Most localized keyboards have it) */ | |
| 120 | 120 | #define HAS_EXTRA_KEY_67(unit) (! ((vdt[unit].model == vdt911_model_US) || (vdt[unit].model == vdt911_model_UK) || (vdt[unit].model == vdt911_model_French))) |
| 121 | 121 | /* TRUE for keyboards which have this extra key (on the right of space), |
| 122 | ||
| 122 | AND do not use it as a modifier */ | |
| 123 | 123 | #define HAS_EXTRA_KEY_91(unit) ((vdt[unit].model == vdt911_model_German) || (vdt[unit].model == vdt911_model_Swedish) || (vdt[unit].model == vdt911_model_Norwegian)) |
| 124 | 124 | |
| 125 | 125 | static TIMER_CALLBACK(blink_callback); |
| 126 | 126 | static TIMER_CALLBACK(beep_callback); |
| 127 | 127 | |
| 128 | 128 | /* |
| 129 | ||
| 129 | Initialize vdt911 palette | |
| 130 | 130 | */ |
| 131 | 131 | PALETTE_INIT( vdt911 ) |
| 132 | 132 | { |
| r5932 | r5933 | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /* |
| 148 | ||
| 148 | Copy a character bitmap array to another location in memory | |
| 149 | 149 | */ |
| 150 | 150 | static void copy_character_matrix_array(const UINT8 char_array[128][10], UINT8 *dest) |
| 151 | 151 | { |
| r5932 | r5933 | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /* |
| 160 | ||
| 160 | Patch a character bitmap array according to an array of char_override_t | |
| 161 | 161 | */ |
| 162 | 162 | static void apply_char_overrides(int nb_char_overrides, const char_override_t char_overrides[], UINT8 *dest) |
| 163 | 163 | { |
| r5932 | r5933 | |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /* |
| 174 | ||
| 174 | Initialize the 911 vdt core | |
| 175 | 175 | */ |
| 176 | 176 | void vdt911_init(running_machine *machine) |
| 177 | 177 | { |
| r5932 | r5933 | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /* |
| 237 | ||
| 237 | Initialize one 911 vdt controller/terminal | |
| 238 | 238 | */ |
| 239 | 239 | void vdt911_init_term(running_machine *machine,int unit, const vdt911_init_params_t *params) |
| 240 | 240 | { |
| r5932 | r5933 | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /* |
| 260 | ||
| 260 | Reset the controller board | |
| 261 | 261 | */ |
| 262 | 262 | void vdt911_reset(void) |
| 263 | 263 | { |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /* |
| 267 | ||
| 267 | timer callback to toggle blink state | |
| 268 | 268 | */ |
| 269 | 269 | static TIMER_CALLBACK(blink_callback) |
| 270 | 270 | { |
| r5932 | r5933 | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /* |
| 276 | ||
| 276 | timer callback to stop beep generator | |
| 277 | 277 | */ |
| 278 | 278 | static TIMER_CALLBACK(beep_callback) |
| 279 | 279 | { |
| r5932 | r5933 | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /* |
| 284 | ||
| 284 | CRU interface read | |
| 285 | 285 | */ |
| 286 | 286 | static int vdt911_cru_r(int offset, int unit) |
| 287 | 287 | { |
| r5932 | r5933 | |
| 317 | 317 | if (vdt[unit].keyboard_data & 0x80) |
| 318 | 318 | reply |= 0x08; |
| 319 | 319 | /*if (! vdt[unit].terminal_ready) |
| 320 | ||
| 320 | reply |= 0x10;*/ | |
| 321 | 321 | if (vdt[unit].previous_word_select) |
| 322 | 322 | reply |= 0x20; |
| 323 | 323 | /*if (vdt[unit].keyboard_parity_error) |
| 324 | ||
| 324 | reply |= 0x40;*/ | |
| 325 | 325 | if (vdt[unit].keyboard_data_ready) |
| 326 | 326 | reply |= 0x80; |
| 327 | 327 | break; |
| r5932 | r5933 | |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /* |
| 335 | ||
| 335 | CRU interface write | |
| 336 | 336 | */ |
| 337 | 337 | static void vdt911_cru_w(const address_space *space, int offset, int data, int unit) |
| 338 | 338 | { |
| r5932 | r5933 | |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /* |
| 477 | ||
| 477 | Video refresh | |
| 478 | 478 | */ |
| 479 | 479 | void vdt911_refresh(running_machine *machine, bitmap_t *bitmap, int unit, int x, int y) |
| 480 | 480 | { |
| r5932 | r5933 | |
| 487 | 487 | int color; |
| 488 | 488 | |
| 489 | 489 | /*if (use_8bit_charcodes) |
| 490 | ||
| 490 | color = vdt[unit].dual_intensity_enable ? 1 : 0;*/ | |
| 491 | 491 | |
| 492 | 492 | if (! vdt[unit].display_enable) |
| 493 | 493 | { |
| r5932 | r5933 | |
| 548 | 548 | }; |
| 549 | 549 | |
| 550 | 550 | /* |
| 551 | keyboard handler: should be called regularly by machine code, for instance | |
| 552 | every Video Blank Interrupt. | |
| 551 | keyboard handler: should be called regularly by machine code, for instance | |
| 552 | every Video Blank Interrupt. | |
| 553 | 553 | */ |
| 554 | 554 | void vdt911_keyboard(running_machine *machine, int unit) |
| 555 | 555 | { |
| r5932 | r5933 | |
| 595 | 595 | } |
| 596 | 596 | else |
| 597 | 597 | { /* we are using a western keyboard, or a katakana/arabic keyboard in |
| 598 | ||
| 598 | romaji/latin mode */ | |
| 599 | 599 | foreign_mode = FALSE; |
| 600 | 600 | |
| 601 | 601 | if (key_buf[3] & 0x0040) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | |
| 3 | compis_gdc.c | |
| 4 | Video driver for the Intel 82720 and NEC uPD7220 GDC. | |
| 3 | compis_gdc.c | |
| 4 | Video driver for the Intel 82720 and NEC uPD7220 GDC. | |
| 5 | 5 | |
| 6 | Per Ola Ingvarsson | |
| 7 | Tomas Karlsson | |
| 6 | Per Ola Ingvarsson | |
| 7 | Tomas Karlsson | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 |
| r5932 | r5933 | |
|---|---|---|
| 22 | 22 | |
| 23 | 23 | const unsigned char dai_palette[16*3] = |
| 24 | 24 | { |
| 25 | 0x00, 0x00, 0x00, /* 0 Black */ | |
| 26 | 0x00, 0x00, 0x8b, /* 1 Dark Blue */ | |
| 27 | 0xb1, 0x00, 0x95, /* 2 Purple Red */ | |
| 28 | 0xff, 0x00, 0x00, /* 3 Red */ | |
| 29 | 0x75, 0x2e, 0x50, /* 4 Purple Brown */ | |
| 30 | 0x00, 0xb2, 0x38, /* 5 Emerald Green */ | |
| 31 | 0x98, 0x62, 0x00, /* 6 Kakhi Brown */ | |
| 32 | 0xae, 0x7a, 0x00, /* 7 Mustard Brown */ | |
| 33 | 0x89, 0x89, 0x89, /* 8 Grey */ | |
| 34 | 0xa1, 0x6f, 0xff, /* 9 Middle Blue */ | |
| 35 | 0xff, 0xa5, 0x00, /* 10 Orange */ | |
| 36 | 0xff, 0x99, 0xff, /* 11 Pink */ | |
| 37 | 0x9e, 0xf4, 0xff, /* 12 Light Blue */ | |
| 38 | 0xb3, 0xff, 0xbb, /* 13 Light Green */ | |
| 39 | 0xff, 0xff, 0x28, /* 14 Light Yellow */ | |
| 40 | 0xff, 0xff, 0xff, /* 15 White */ | |
| 25 | 0x00, 0x00, 0x00, /* 0 Black */ | |
| 26 | 0x00, 0x00, 0x8b, /* 1 Dark Blue */ | |
| 27 | 0xb1, 0x00, 0x95, /* 2 Purple Red */ | |
| 28 | 0xff, 0x00, 0x00, /* 3 Red */ | |
| 29 | 0x75, 0x2e, 0x50, /* 4 Purple Brown */ | |
| 30 | 0x00, 0xb2, 0x38, /* 5 Emerald Green */ | |
| 31 | 0x98, 0x62, 0x00, /* 6 Kakhi Brown */ | |
| 32 | 0xae, 0x7a, 0x00, /* 7 Mustard Brown */ | |
| 33 | 0x89, 0x89, 0x89, /* 8 Grey */ | |
| 34 | 0xa1, 0x6f, 0xff, /* 9 Middle Blue */ | |
| 35 | 0xff, 0xa5, 0x00, /* 10 Orange */ | |
| 36 | 0xff, 0x99, 0xff, /* 11 Pink */ | |
| 37 | 0x9e, 0xf4, 0xff, /* 12 Light Blue */ | |
| 38 | 0xb3, 0xff, 0xbb, /* 13 Light Green */ | |
| 39 | 0xff, 0xff, 0x28, /* 14 Light Yellow */ | |
| 40 | 0xff, 0xff, 0xff, /* 15 White */ | |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | 43 | static unsigned short dai_4_colours_palette[4]; |
| r5932 | r5933 | |
| 46 | 46 | { |
| 47 | 47 | int i; |
| 48 | 48 | |
| 49 | for ( i = 0; i < sizeof(dai_palette) / 3; i++ ) | |
| 49 | for ( i = 0; i < sizeof(dai_palette) / 3; i++ ) | |
| 50 | 50 | { |
| 51 | 51 | palette_set_color_rgb(machine, i, dai_palette[i * 3], dai_palette[i * 3 + 1], dai_palette[i * 3 + 2]); |
| 52 | 52 | } |
| r5932 | r5933 | |
| 71 | 71 | UINT16 current_video_memory_address = dai_video_memory_start; |
| 72 | 72 | |
| 73 | 73 | UINT8 mode; /* mode byte of line |
| 74 | bits 0-3 - line repeat count | |
| 75 | bits 4-5 - resolution control | |
| 76 | bits 6-7 - display mode control */ | |
| 74 | bits 0-3 - line repeat count | |
| 75 | bits 4-5 - resolution control | |
| 76 | bits 6-7 - display mode control */ | |
| 77 | 77 | UINT8 colour; /* colour byte of line |
| 78 | bits 0-3 - one of 16 colours | |
| 79 | bits 4-5 - colour register for update | |
| 80 | bit 6 - if unset force 'unit colour mode' | |
| 81 | bit 7 - enable coulor change | |
| 82 | if unset bits 0-5 are ignored */ | |
| 78 | bits 0-3 - one of 16 colours | |
| 79 | bits 4-5 - colour register for update | |
| 80 | bit 6 - if unset force 'unit colour mode' | |
| 81 | bit 7 - enable coulor change | |
| 82 | if unset bits 0-5 are ignored */ | |
| 83 | 83 | UINT8 line_repeat_count; /* number of horizontalraster scans |
| 84 | for which same data will be displayed | |
| 85 | 0000 - 2 lines | |
| 86 | each additional repeat adds 2 scans */ | |
| 84 | for which same data will be displayed | |
| 85 | 0000 - 2 lines | |
| 86 | each additional repeat adds 2 scans */ | |
| 87 | 87 | UINT8 horizontal_resolution; /* number of blobs per line |
| 88 | 00 - 88 (low resolution graphics) | |
| 89 | 01 - 176 (medium resolution graphics) | |
| 90 | 10 - 352 (high resolution graphics) | |
| 91 | 11 - 528 (text with 66 chars per line) */ | |
| 88 | 00 - 88 (low resolution graphics) | |
| 89 | 01 - 176 (medium resolution graphics) | |
| 90 | 10 - 352 (high resolution graphics) | |
| 91 | 11 - 528 (text with 66 chars per line) */ | |
| 92 | 92 | UINT8 display_mode; /* determine how data will be used |
| 93 | to generate the picture | |
| 94 | 00 - four colour graphics | |
| 95 | 01 - four colour characters | |
| 96 | 10 - sixteen colour graphics | |
| 97 | 11 - sixteen colour characters */ | |
| 93 | to generate the picture | |
| 94 | 00 - four colour graphics | |
| 95 | 01 - four colour characters | |
| 96 | 10 - sixteen colour graphics | |
| 97 | 11 - sixteen colour characters */ | |
| 98 | 98 | UINT8 unit_mode; |
| 99 | 99 | |
| 100 | 100 | UINT8 current_data_1, current_data_2; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | i82720.h | |
| 4 | 4 | |
| 5 | Video driver for the Intel 82720 and NEC uPD7220 GDC. | |
| 6 | Per Ola Ingvarsson | |
| 7 | Tomas Karlsson | |
| 5 | Video driver for the Intel 82720 and NEC uPD7220 GDC. | |
| 6 | Per Ola Ingvarsson | |
| 7 | Tomas Karlsson | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | video/mac.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Macintosh video hardware | |
| 6 | 6 | |
| 7 | Emulates the video hardware for compact Macintosh series (original | |
| 8 | Macintosh (128k, 512k, 512ke), Macintosh Plus, Macintosh SE, Macintosh | |
| 9 | Classic) | |
| 7 | Emulates the video hardware for compact Macintosh series (original | |
| 8 | Macintosh (128k, 512k, 512ke), Macintosh Plus, Macintosh SE, Macintosh | |
| 9 | Classic) | |
| 10 | 10 | |
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 |
| r5932 | r5933 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | VIDEO_START( cbm700 ) |
| 50 | 50 | { |
| 51 | int i; | |
| 51 | int i; | |
| 52 | 52 | |
| 53 | 53 | /* remove pixel column 9 for character codes 0 - 175 and 224 - 255 */ |
| 54 | for( i = 0; i < 256; i++) | |
| 54 | for( i = 0; i < 256; i++) | |
| 55 | 55 | { |
| 56 | // | |
| 56 | // if( i < 176 || i > 223 ) | |
| 57 | 57 | { |
| 58 | 58 | int y; |
| 59 | 59 | for( y = 0; y < machine->gfx[0]->height; y++ ) { |
| r5932 | r5933 | |
|---|---|---|
| 30 | 30 | { |
| 31 | 31 | int x,y; |
| 32 | 32 | const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 33 | ||
| 33 | ||
| 34 | 34 | for(y = 0; y < 16; y++ ) |
| 35 | 35 | { |
| 36 | 36 | for(x = 0; x < 64; x++ ) |
| r5932 | r5933 | |
| 46 | 46 | { |
| 47 | 47 | int x,y; |
| 48 | 48 | const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 49 | ||
| 49 | ||
| 50 | 50 | for(y = 0; y < 32; y++ ) |
| 51 | 51 | { |
| 52 | 52 | for(x = 0; x < 64; x++ ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | video/cirrus.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Cirrus SVGA card emulation (preliminary) | |
| 6 | 6 | |
| 7 | Cirrus has the following additional registers that are not present in | |
| 8 | conventional VGA: | |
| 7 | Cirrus has the following additional registers that are not present in | |
| 8 | conventional VGA: | |
| 9 | 9 | |
| 10 | SEQ 06h: Unlock Cirrus registers; write 12h to unlock registers, | |
| 11 | and read 12h back to confirm Cirrus presence. | |
| 12 | SEQ 07h | |
| 13 | bit 3-1: Pixel depth | |
| 14 | 0x00 8 bpp | |
| 15 | 0x02 16 bpp (double vert clock) | |
| 16 | 0x04 24 bpp | |
| 17 | 0x06 16 bpp | |
| 18 | 0x08 32 bpp | |
| 19 | bit 0: VGA/SVGA (0=VGA, 1=SVGA) | |
| 20 | SEQ 0Fh | |
| 21 | bit 7: Bankswitch enable | |
| 22 | bits 4-3: Memory size | |
| 23 | 0x00 256K | |
| 24 | 0x08 512K | |
| 25 | 0x10 1M | |
| 26 | 0x18 2M | |
| 27 | SEQ 12h: Hardware Cursor | |
| 10 | SEQ 06h: Unlock Cirrus registers; write 12h to unlock registers, | |
| 11 | and read 12h back to confirm Cirrus presence. | |
| 12 | SEQ 07h | |
| 13 | bit 3-1: Pixel depth | |
| 14 | 0x00 8 bpp | |
| 15 | 0x02 16 bpp (double vert clock) | |
| 16 | 0x04 24 bpp | |
| 17 | 0x06 16 bpp | |
| 18 | 0x08 32 bpp | |
| 19 | bit 0: VGA/SVGA (0=VGA, 1=SVGA) | |
| 20 | SEQ 0Fh | |
| 21 | bit 7: Bankswitch enable | |
| 22 | bits 4-3: Memory size | |
| 23 | 0x00 256K | |
| 24 | 0x08 512K | |
| 25 | 0x10 1M | |
| 26 | 0x18 2M | |
| 27 | SEQ 12h: Hardware Cursor | |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | |
| 32 | GC 09h: Set 64k bank (bits 3-0 only) | |
| 33 | GC 20h: Blit Width (bits 7-0) | |
| 34 | GC 21h: Blit Width (bits 12-8) | |
| 35 | GC 22h: Blit Height (bits 7-0) | |
| 36 | GC 23h: Blit Height (bits 12-8) | |
| 37 | GC 24h: Blit Destination Pitch (bits 7-0) | |
| 38 | GC 25h: Blit Destination Pitch (bits 12-8) | |
| 39 | GC 26h: Blit Source Pitch (bits 7-0) | |
| 40 | GC 27h: Blit Source Pitch (bits 12-8) | |
| 41 | GC 28h: Blit Destination Address (bits 7-0) | |
| 42 | GC 29h: Blit Destination Address (bits 15-8) | |
| 43 | GC 2Ah: Blit Destination Address (bits 21-16) | |
| 44 | GC 2Ch: Blit Source Address (bits 7-0) | |
| 45 | GC 2Dh: Blit Source Address (bits 15-8) | |
| 46 | GC 2Eh: Blit Source Address (bits 21-16) | |
| 47 | GC 2Fh: Blit Write Mask | |
| 48 | GC 30h: Blit Mode | |
| 49 | GC 31h: Blit Status | |
| 50 | bit 7 - Autostart | |
| 51 | bit 4 - FIFO Used | |
| 52 | bit 2 - Blit Reset | |
| 53 | bit 1 - Blit Started | |
| 54 | bit 0 - Blit Busy | |
| 55 | GC 32h: Raster Operation | |
| 56 | GC 33h: Blit Mode Extension | |
| 57 | GC 34h: Blit Transparent Color (bits 7-0) | |
| 58 | GC 35h: Blit Transparent Color (bits 15-8) | |
| 59 | GC 38h: Blit Transparent Color Mask (bits 7-0) | |
| 60 | GC 39h: Blit Transparent Color Mask (bits 15-8) | |
| 32 | GC 09h: Set 64k bank (bits 3-0 only) | |
| 33 | GC 20h: Blit Width (bits 7-0) | |
| 34 | GC 21h: Blit Width (bits 12-8) | |
| 35 | GC 22h: Blit Height (bits 7-0) | |
| 36 | GC 23h: Blit Height (bits 12-8) | |
| 37 | GC 24h: Blit Destination Pitch (bits 7-0) | |
| 38 | GC 25h: Blit Destination Pitch (bits 12-8) | |
| 39 | GC 26h: Blit Source Pitch (bits 7-0) | |
| 40 | GC 27h: Blit Source Pitch (bits 12-8) | |
| 41 | GC 28h: Blit Destination Address (bits 7-0) | |
| 42 | GC 29h: Blit Destination Address (bits 15-8) | |
| 43 | GC 2Ah: Blit Destination Address (bits 21-16) | |
| 44 | GC 2Ch: Blit Source Address (bits 7-0) | |
| 45 | GC 2Dh: Blit Source Address (bits 15-8) | |
| 46 | GC 2Eh: Blit Source Address (bits 21-16) | |
| 47 | GC 2Fh: Blit Write Mask | |
| 48 | GC 30h: Blit Mode | |
| 49 | GC 31h: Blit Status | |
| 50 | bit 7 - Autostart | |
| 51 | bit 4 - FIFO Used | |
| 52 | bit 2 - Blit Reset | |
| 53 | bit 1 - Blit Started | |
| 54 | bit 0 - Blit Busy | |
| 55 | GC 32h: Raster Operation | |
| 56 | GC 33h: Blit Mode Extension | |
| 57 | GC 34h: Blit Transparent Color (bits 7-0) | |
| 58 | GC 35h: Blit Transparent Color (bits 15-8) | |
| 59 | GC 38h: Blit Transparent Color Mask (bits 7-0) | |
| 60 | GC 39h: Blit Transparent Color Mask (bits 15-8) | |
| 61 | 61 | |
| 62 | 62 | ***************************************************************************/ |
| 63 | 63 | |
| r5932 | r5933 | |
| 146 | 146 | |
| 147 | 147 | /************************************* |
| 148 | 148 | * |
| 149 | * | |
| 149 | * PCI card interface | |
| 150 | 150 | * |
| 151 | 151 | *************************************/ |
| 152 | 152 | |
| r5932 | r5933 | |
| 193 | 193 | |
| 194 | 194 | /************************************* |
| 195 | 195 | * |
| 196 | * | |
| 196 | * Ports | |
| 197 | 197 | * |
| 198 | 198 | *************************************/ |
| 199 | 199 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | MC-80.xx video by Miodrag Milanovic | |
| 3 | MC-80.xx video by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 5 | 15/05/2009 Initial implementation |
| 6 | 6 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 22 | 22 | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E |
| 23 | 23 | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F |
| 24 | 24 | 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G |
| 25 | ||
| 25 | ||
| 26 | 26 | 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H |
| 27 | 27 | 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I |
| 28 | 28 | 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J |
| r5932 | r5933 | |
| 31 | 31 | 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M |
| 32 | 32 | 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N |
| 33 | 33 | 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O |
| 34 | ||
| 34 | ||
| 35 | 35 | 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P |
| 36 | 36 | 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q |
| 37 | 37 | 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R |
| r5932 | r5933 | |
| 40 | 40 | 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U |
| 41 | 41 | 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V |
| 42 | 42 | 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W |
| 43 | ||
| 43 | ||
| 44 | 44 | 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X |
| 45 | 45 | 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y |
| 46 | 46 | 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z |
| r5932 | r5933 | |
| 49 | 49 | 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ] |
| 50 | 50 | 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^ |
| 51 | 51 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _ |
| 52 | ||
| 53 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // | |
| 52 | ||
| 53 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // | |
| 54 | 54 | 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // ! |
| 55 | 55 | 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // " |
| 56 | 56 | 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // # |
| 57 | 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // | |
| 57 | 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // | |
| 58 | 58 | 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // % |
| 59 | 59 | 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // & |
| 60 | 60 | 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // ' |
| 61 | ||
| 61 | ||
| 62 | 62 | 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // ( |
| 63 | 63 | 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // ) |
| 64 | 64 | 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // * |
| r5932 | r5933 | |
| 67 | 67 | 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // - |
| 68 | 68 | 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // . |
| 69 | 69 | 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // / |
| 70 | ||
| 70 | ||
| 71 | 71 | 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0 |
| 72 | 72 | 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1 |
| 73 | 73 | 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2 |
| r5932 | r5933 | |
| 76 | 76 | 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5 |
| 77 | 77 | 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6 |
| 78 | 78 | 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7 |
| 79 | ||
| 79 | ||
| 80 | 80 | 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8 |
| 81 | 81 | 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9 |
| 82 | 82 | 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // : |
| r5932 | r5933 | |
| 103 | 103 | int x,y,j,b; |
| 104 | 104 | UINT16 addr; |
| 105 | 105 | int xpos; |
| 106 | ||
| 106 | ||
| 107 | 107 | for(y = 0; y < 8; y++ ) |
| 108 | 108 | { |
| 109 | 109 | addr = y*32; |
| 110 | 110 | xpos = 0; |
| 111 | 111 | for(x = 0; x < 32; x++ ) |
| 112 | 112 | { |
| 113 | UINT8 code = mc8020_video_ram[addr + x] & 0x3f; | |
| 113 | UINT8 code = mc8020_video_ram[addr + x] & 0x3f; | |
| 114 | 114 | for(j = 0; j < 8; j++ ) |
| 115 | { | |
| 115 | { | |
| 116 | 116 | for(b = 0; b < 6; b++ ) |
| 117 | 117 | { |
| 118 | 118 | *BITMAP_ADDR16(bitmap, y*16+j, xpos+b ) = (prom[code*8 + j] >> (5-b)) & 1; |
| 119 | } | |
| 119 | } | |
| 120 | 120 | } |
| 121 | 121 | xpos += 6; |
| 122 | 122 | } |
| r5932 | r5933 | |
| 139 | 139 | { |
| 140 | 140 | UINT8 code; |
| 141 | 141 | int y, x, b; |
| 142 | ||
| 143 | int addr = 0; | |
| 142 | ||
| 143 | int addr = 0; | |
| 144 | 144 | for (y = 0; y < 256; y++) |
| 145 | 145 | { |
| 146 | 146 | int horpos = 0; |
| 147 | 147 | for (x = 0; x < 64; x++) |
| 148 | { | |
| 148 | { | |
| 149 | 149 | code = mc8030_video_mem[addr++]; |
| 150 | 150 | for (b = 0; b < 8; b++) |
| 151 | { | |
| 151 | { | |
| 152 | 152 | *BITMAP_ADDR16(bitmap, 255-y, horpos++) = (code >> b) & 0x01; |
| 153 | 153 | } |
| 154 | 154 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | microbee.c | |
| 3 | 3 | |
| 4 | 4 | video hardware |
| 5 | ||
| 5 | Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999 | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 125 | 125 | crt.lpen_lo = offs & 0xff; |
| 126 | 126 | crt.lpen_hi = (offs >> 8) & 0x03; |
| 127 | 127 | crt.lpen_strobe = 1; |
| 128 | // | |
| 128 | // logerror("mbee keyboard_matrix_r $%03X (port:%d bit:%d) = %d\n", offs, port, bit, data); | |
| 129 | 129 | } |
| 130 | 130 | return data; |
| 131 | 131 | } |
| r5932 | r5933 | |
| 158 | 158 | |
| 159 | 159 | WRITE8_HANDLER( mbee_1c_w ) |
| 160 | 160 | { |
| 161 | /* d7 extended graphics - not emulated | |
| 162 | d5 bankswitch basic rom | |
| 163 | d4 select attribute ram - not emulated | |
| 164 | d3..d0 select videoram bank - not emulated */ | |
| 161 | /* d7 extended graphics - not emulated | |
| 162 | d5 bankswitch basic rom | |
| 163 | d4 select attribute ram - not emulated | |
| 164 | d3..d0 select videoram bank - not emulated */ | |
| 165 | 165 | |
| 166 | 166 | memory_set_bank(space->machine, 6, (data & 0x20) ? 1 : 0); |
| 167 | 167 | } |
| r5932 | r5933 | |
| 184 | 184 | { |
| 185 | 185 | /*int data = */keyboard_matrix_r(machine, param); |
| 186 | 186 | crt.update_strobe = 1; |
| 187 | // if( data ) | |
| 188 | // logerror("6545 update_strobe_cb $%04X = $%02X\n", param, data); | |
| 187 | // if( data ) | |
| 188 | // logerror("6545 update_strobe_cb $%04X = $%02X\n", param, data); | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | READ8_HANDLER ( m6545_status_r ) |
| r5932 | r5933 | |
| 202 | 202 | data |= 0x40; /* lpen register full */ |
| 203 | 203 | if( crt.update_strobe ) |
| 204 | 204 | data |= 0x80; /* update strobe has occured */ |
| 205 | // | |
| 205 | // logerror("6545 status_r $%02X\n", data); | |
| 206 | 206 | return data; |
| 207 | 207 | } |
| 208 | 208 | |
| r5932 | r5933 | |
| 250 | 250 | data = crt.cursor_address_lo; |
| 251 | 251 | break; |
| 252 | 252 | case 16: |
| 253 | // | |
| 253 | // logerror("6545 lpen_hi_r $%02X (lpen:%d upd:%d)\n", crt.lpen_hi, crt.lpen_strobe, crt.update_strobe); | |
| 254 | 254 | crt.lpen_strobe = 0; |
| 255 | 255 | crt.update_strobe = 0; |
| 256 | 256 | data = crt.lpen_hi; |
| 257 | 257 | break; |
| 258 | 258 | case 17: |
| 259 | // | |
| 259 | // logerror("6545 lpen_lo_r $%02X (lpen:%d upd:%d)\n", crt.lpen_lo, crt.lpen_strobe, crt.update_strobe); | |
| 260 | 260 | crt.lpen_strobe = 0; |
| 261 | 261 | crt.update_strobe = 0; |
| 262 | 262 | data = crt.lpen_lo; |
| 263 | 263 | break; |
| 264 | 264 | case 18: |
| 265 | // | |
| 265 | // logerror("6545 transp_hi_r $%02X\n", crt.transp_hi); | |
| 266 | 266 | data = crt.transp_hi; |
| 267 | 267 | break; |
| 268 | 268 | case 19: |
| 269 | // | |
| 269 | // logerror("6545 transp_lo_r $%02X\n", crt.transp_lo); | |
| 270 | 270 | data = crt.transp_lo; |
| 271 | 271 | break; |
| 272 | 272 | case 31: |
| 273 | 273 | /* shared memory latch */ |
| 274 | 274 | addr = (crt.transp_hi << 8) | crt.transp_lo; |
| 275 | // | |
| 275 | // logerror("6545 transp_latch $%04X\n", addr); | |
| 276 | 276 | m6545_update_strobe(space->machine, addr); |
| 277 | 277 | break; |
| 278 | 278 | default: |
| r5932 | r5933 | |
| 383 | 383 | case 18: |
| 384 | 384 | data &= 63; |
| 385 | 385 | crt.transp_hi = data; |
| 386 | // | |
| 386 | // logerror("6545 transp_hi_w $%02X\n", data); | |
| 387 | 387 | break; |
| 388 | 388 | case 19: |
| 389 | 389 | crt.transp_lo = data; |
| 390 | // | |
| 390 | // logerror("6545 transp_lo_w $%02X\n", data); | |
| 391 | 391 | break; |
| 392 | 392 | case 31: |
| 393 | 393 | /* shared memory latch */ |
| 394 | 394 | addr = (crt.transp_hi << 8) | crt.transp_lo; |
| 395 | // | |
| 395 | // logerror("6545 transp_latch $%04X\n", addr); | |
| 396 | 396 | m6545_update_strobe(space->machine, addr); |
| 397 | 397 | break; |
| 398 | 398 | default: |
| r5932 | r5933 | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | /* The 6845 can produce a variety of cursor shapes - all are emulated here |
| 404 | ||
| 404 | Need to find out if the 6545 works the same way */ | |
| 405 | 405 | static void mc6845_cursor_configure(void) |
| 406 | 406 | { |
| 407 | 407 | UINT8 i,curs_type=0,r9,r10,r11; |
| 408 | 408 | |
| 409 | 409 | /* curs_type holds the general cursor shape to be created |
| 410 | 0 = no cursor | |
| 411 | 1 = partial cursor (only shows on a block of scan lines) | |
| 412 | 2 = full cursor | |
| 413 | 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ | |
| 410 | 0 = no cursor | |
| 411 | 1 = partial cursor (only shows on a block of scan lines) | |
| 412 | 2 = full cursor | |
| 413 | 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ | |
| 414 | 414 | |
| 415 | 415 | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) mc6845_cursor[i] = 0; // prepare cursor by erasing old one |
| 416 | 416 | |
| r5932 | r5933 | |
| 432 | 432 | if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(mc6845_cursor);i++) mc6845_cursor[i]=0xff; // turn on full cursor |
| 433 | 433 | |
| 434 | 434 | if (curs_type == 1) for (i = r10;i < r11;i++) mc6845_cursor[i]=0xff; // for each line that should show, turn on that scan line |
| 435 | ||
| 435 | ||
| 436 | 436 | if (curs_type == 3) for (i = r11; i < r10;i++) mc6845_cursor[i]=0; // now take a bite out of the middle |
| 437 | 437 | } |
| 438 | 438 | |
| r5932 | r5933 | |
| 445 | 445 | UINT16 height = crt.vertical_displayed*(crt.scan_lines+1)-1; // height in pixels |
| 446 | 446 | UINT16 bytes = crt.horizontal_displayed*crt.vertical_displayed-1; // video ram needed |
| 447 | 447 | |
| 448 | if (width > 0x27f) width=0x27f; | |
| 448 | if (width > 0x27f) width=0x27f; | |
| 449 | 449 | if (height > 0x10f) height=0x10f; |
| 450 | 450 | |
| 451 | 451 | /* Resize the screen */ |
| r5932 | r5933 | |
| 575 | 575 | PALETTE_INIT( mbeeic ) |
| 576 | 576 | { |
| 577 | 577 | UINT16 i; |
| 578 | UINT8 r, b, g, k; | |
| 578 | UINT8 r, b, g, k; | |
| 579 | 579 | UINT8 level[] = { 0, 0x80, 0xff, 0xff }; /* off, half, full intensity */ |
| 580 | 580 | |
| 581 | 581 | /* set up background palette (00-63) */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | video/cirrus.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Cirrus SVGA card emulation (preliminary) | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 495 | 495 | static DEVICE_START( i8275 ) |
| 496 | 496 | { |
| 497 | 497 | i8275_t *i8275 = get_safe_token(device); |
| 498 | ||
| 498 | ||
| 499 | 499 | /* validate arguments */ |
| 500 | 500 | assert(device != NULL); |
| 501 | 501 | assert(device->tag != NULL); |
| r5932 | r5933 | |
|---|---|---|
| 34 | 34 | const char *screen_tag; /* screen we are acting on */ |
| 35 | 35 | int width; /* char width in pixels */ |
| 36 | 36 | int char_delay; /* delay of display char */ |
| 37 | ||
| 37 | ||
| 38 | 38 | devcb_write_line out_drq_func; |
| 39 | 39 | |
| 40 | 40 | devcb_write_line out_irq_func; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Video hardware for CoCo/Dragon family | |
| 4 | 4 | |
| 5 | ||
| 5 | driver by Nathan Woods | |
| 6 | 6 | |
| 7 | ||
| 7 | See mess/machine/coco.c for references | |
| 8 | 8 | |
| 9 | TODO: Determine how the CoCo 2B (which used the M6847T1 was hooked up | |
| 10 | to the M6847T1 chip to generate its text video modes. My best guess is as | |
| 11 | follows: | |
| 9 | TODO: Determine how the CoCo 2B (which used the M6847T1 was hooked up | |
| 10 | to the M6847T1 chip to generate its text video modes. My best guess is as | |
| 11 | follows: | |
| 12 | 12 | |
| 13 | GM0 would enable lowercase if INV is off, and force INV on by default | |
| 14 | GM1 would toggle INV | |
| 15 | GM2 enables an alternate border | |
| 13 | GM0 would enable lowercase if INV is off, and force INV on by default | |
| 14 | GM1 would toggle INV | |
| 15 | GM2 enables an alternate border | |
| 16 | 16 | |
| 17 | 17 | ***************************************************************************/ |
| 18 | 18 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /************************************************************************ |
| 2 | 2 | SAA505X Teletext |
| 3 | 3 | |
| 4 | Variant Character set | |
| 5 | 5050 English | |
| 6 | 5051 German | |
| 7 | 5052 Swedish | |
| 8 | 5053 Italian | |
| 9 | 5054 Belgian | |
| 10 | 5055 US ASCII | |
| 11 | 5056 Hebrew | |
| 12 | 5057 Cyrillic | |
| 4 | Variant Character set | |
| 5 | 5050 English | |
| 6 | 5051 German | |
| 7 | 5052 Swedish | |
| 8 | 5053 Italian | |
| 9 | 5054 Belgian | |
| 10 | 5055 US ASCII | |
| 11 | 5056 Hebrew | |
| 12 | 5057 Cyrillic | |
| 13 | 13 | |
| 14 | 14 | Pins |
| 15 | 1 Vss ground | |
| 16 | 18 Vdd positive supply | |
| 17 | 17 NC not connected | |
| 15 | 1 Vss ground | |
| 16 | 18 Vdd positive supply | |
| 17 | 17 NC not connected | |
| 18 | 18 | |
| 19 | 19 | Data In |
| 20 | 20 | -------- |
| 21 | 4-10 | |
| 21 | 4-10 D1 to D7 in character data inputs | |
| 22 | 22 | |
| 23 | 16 | |
| 23 | 16 ~TLC out transmitted large character | |
| 24 | 24 | |
| 25 | 25 | Colour Our |
| 26 | 26 | ---------- |
| 27 | 21 Y out monochrome video output | |
| 28 | 22 Blue out blue video output | |
| 29 | 23 Green out green video output | |
| 30 | 24 Red out red video output | |
| 31 | 25 BLAN out blanking output | |
| 27 | 21 Y out monochrome video output | |
| 28 | 22 Blue out blue video output | |
| 29 | 23 Green out green video output | |
| 30 | 24 Red out red video output | |
| 31 | 25 BLAN out blanking output | |
| 32 | 32 | |
| 33 | 33 | Display Control |
| 34 | 34 | --------------- |
| 35 | 27 PO in picture on in[ut | |
| 36 | 28 DE in display enable input | |
| 35 | 27 PO in picture on in[ut | |
| 36 | 28 DE in display enable input | |
| 37 | 37 | |
| 38 | 38 | Remote Control Data Decoder and Store |
| 39 | 39 | ------------------------------------- |
| 40 | 2 ~SI in/out superimposer | |
| 41 | 3 ~DATA in remote control data | |
| 42 | 11 DLIM in remote control data clock | |
| 43 | 12 ~GLR in general line reset | |
| 40 | 2 ~SI in/out superimposer | |
| 41 | 3 ~DATA in remote control data | |
| 42 | 11 DLIM in remote control data clock | |
| 43 | 12 ~GLR in general line reset | |
| 44 | 44 | |
| 45 | 45 | Timing Generator/Flash Counter |
| 46 | 46 | ------------------------------ |
| 47 | 13 DEW in data entry window | |
| 48 | 19 TR6 in 6MHz input | |
| 49 | 20 F1 in 1MHz input | |
| 50 | 26 LOSE in load output shift register enable | |
| 47 | 13 DEW in data entry window | |
| 48 | 19 TR6 in 6MHz input | |
| 49 | 20 F1 in 1MHz input | |
| 50 | 26 LOSE in load output shift register enable | |
| 51 | 51 | |
| 52 | 52 | Character Rounding |
| 53 | 53 | ------------------ |
| 54 | 14 CRS in character rounding select | |
| 55 | 15 ~BCS in big character select | |
| 54 | 14 CRS in character rounding select | |
| 55 | 15 ~BCS in big character select | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | |
| r5932 | r5933 | |
| 1810 | 1810 | 0,0,0,0,0,0, |
| 1811 | 1811 | 0,0,0,0,0,0, |
| 1812 | 1812 | 0,0,0,0,0,0 |
| 1813 | , // 0x5c ' | |
| 1813 | , // 0x5c '?' | |
| 1814 | 1814 | 0,0,0,0,0,0, |
| 1815 | 1815 | 0,1,0,0,0,0, |
| 1816 | 1816 | 0,1,0,0,0,0, |
| r5932 | r5933 | |
| 3463 | 3463 | tt_flash=0; |
| 3464 | 3464 | break; |
| 3465 | 3465 | |
| 3466 | // 0x0a | |
| 3466 | // 0x0a End Box NOT USED | |
| 3467 | 3467 | // 0x0b Start Box NOT USED |
| 3468 | 3468 | |
| 3469 | 3469 | case 0x0c: // Normal Height |
| r5932 | r5933 | |
| 3476 | 3476 | tt_start_line=tt_double_height_offset; |
| 3477 | 3477 | break; |
| 3478 | 3478 | |
| 3479 | // 0x0e S0 NOT USED | |
| 3480 | // 0x0f S1 NOT USED | |
| 3481 | // 0x10 DLE NOT USED | |
| 3479 | // 0x0e S0 NOT USED | |
| 3480 | // 0x0f S1 NOT USED | |
| 3481 | // 0x10 DLE NOT USED | |
| 3482 | 3482 | |
| 3483 | 3483 | case 0x11: case 0x12: case 0x13: case 0x14: |
| 3484 | 3484 | case 0x15: case 0x16: case 0x17: |
| r5932 | r5933 | |
| 3486 | 3486 | tt_colour=code&0x07; |
| 3487 | 3487 | break; |
| 3488 | 3488 | |
| 3489 | // 0x18 | |
| 3489 | // 0x18 Conceal Display | |
| 3490 | 3490 | |
| 3491 | 3491 | case 0x19: // Contiguois Graphics |
| 3492 | 3492 | tt_graphics=teletext_graphics; |
| r5932 | r5933 | |
| 3499 | 3499 | tt_lookup=tt_graphics; |
| 3500 | 3500 | break; |
| 3501 | 3501 | |
| 3502 | // 0x1b | |
| 3502 | // 0x1b ESC NOT USED | |
| 3503 | 3503 | |
| 3504 | 3504 | case 0x1c: // Black Background |
| 3505 | 3505 | tt_bgcolour=0; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | key translation table for both US and UK terminals | |
| 3 | 3 | |
| 4 | ||
| 4 | The only difference is that the US # character is a Pound character in UK. | |
| 5 | 5 | */ |
| 6 | 6 | static const unsigned char US_key_translate[4][91] = |
| 7 | 7 | { |
| r5932 | r5933 | |
| 449 | 449 | |
| 450 | 450 | |
| 451 | 451 | /* |
| 452 | ||
| 452 | key translation table for French terminals | |
| 453 | 453 | */ |
| 454 | 454 | static const unsigned char French_key_translate[4][91] = |
| 455 | 455 | { |
| r5932 | r5933 | |
| 897 | 897 | |
| 898 | 898 | |
| 899 | 899 | /* |
| 900 | ||
| 900 | key translation table for German terminals | |
| 901 | 901 | */ |
| 902 | 902 | static const unsigned char German_key_translate[4][91] = |
| 903 | 903 | { |
| r5932 | r5933 | |
| 1345 | 1345 | |
| 1346 | 1346 | |
| 1347 | 1347 | /* |
| 1348 | ||
| 1348 | key translation table for Swedish/Finnish terminals | |
| 1349 | 1349 | */ |
| 1350 | 1350 | static const unsigned char Swedish_key_translate[4][91] = |
| 1351 | 1351 | { |
| r5932 | r5933 | |
| 1793 | 1793 | |
| 1794 | 1794 | |
| 1795 | 1795 | /* |
| 1796 | ||
| 1796 | key translation table for Norwegian/Danish terminals | |
| 1797 | 1797 | */ |
| 1798 | 1798 | static const unsigned char Norwegian_key_translate[4][91] = |
| 1799 | 1799 | { |
| r5932 | r5933 | |
| 2241 | 2241 | |
| 2242 | 2242 | |
| 2243 | 2243 | /* |
| 2244 | ||
| 2244 | key translation table for Japanese katakana terminals | |
| 2245 | 2245 | */ |
| 2246 | 2246 | static const unsigned char Japanese_key_translate[6][91] = |
| 2247 | 2247 | { |
| r5932 | r5933 | |
| 2910 | 2910 | |
| 2911 | 2911 | #if 0 |
| 2912 | 2912 | /* |
| 2913 | ||
| 2913 | key translation table for Arabic terminals | |
| 2914 | 2914 | */ |
| 2915 | 2915 | static const unsigned char Arabic_key_translate[6][91] = |
| 2916 | 2916 | { |
| r5932 | r5933 | |
| 3579 | 3579 | |
| 3580 | 3580 | |
| 3581 | 3581 | /* |
| 3582 | ||
| 3582 | key translation table for French word-processing terminals | |
| 3583 | 3583 | */ |
| 3584 | 3584 | static const unsigned char FrenchWP_key_translate[4][91] = |
| 3585 | 3585 | { |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | TODO: |
| 13 | 13 | |
| 14 | ||
| 14 | - calculate colors from luminance/chrominance resistors | |
| 15 | 15 | |
| 16 | 16 | */ |
| 17 | 17 |
| r5932 | r5933 | |
|---|---|---|
| 49 | 49 | static UINT8 gb_vid_regs[_NR_GB_VID_REGS]; |
| 50 | 50 | static UINT16 cgb_bpal[32]; /* CGB current background palette table */ |
| 51 | 51 | static UINT16 cgb_spal[32]; /* CGB current background palette table */ |
| 52 | static UINT8 gb_bpal[4]; /* Background palette */ | |
| 53 | static UINT8 gb_spal0[4]; /* Sprite 0 palette */ | |
| 54 | static UINT8 gb_spal1[4]; /* Sprite 1 palette */ | |
| 52 | static UINT8 gb_bpal[4]; /* Background palette */ | |
| 53 | static UINT8 gb_spal0[4]; /* Sprite 0 palette */ | |
| 54 | static UINT8 gb_spal1[4]; /* Sprite 1 palette */ | |
| 55 | 55 | static UINT8 *gb_oam; |
| 56 | 56 | UINT8 *gb_vram; |
| 57 | 57 | static UINT8 *gb_vram_ptr; |
| r5932 | r5933 | |
| 117 | 117 | static const unsigned char palette[] = |
| 118 | 118 | { |
| 119 | 119 | /* Simple black and white palette */ |
| 120 | /* 0xFF,0xFF,0xFF, | |
| 121 | 0xB0,0xB0,0xB0, | |
| 122 | 0x60,0x60,0x60, | |
| 123 | 0x00,0x00,0x00 */ | |
| 120 | /* 0xFF,0xFF,0xFF, | |
| 121 | 0xB0,0xB0,0xB0, | |
| 122 | 0x60,0x60,0x60, | |
| 123 | 0x00,0x00,0x00 */ | |
| 124 | 124 | |
| 125 | 125 | /* Possibly needs a little more green in it */ |
| 126 | 126 | 0xFF,0xFB,0x87, /* Background */ |
| r5932 | r5933 | |
| 140 | 140 | }; |
| 141 | 141 | |
| 142 | 142 | /* Initialise the palettes */ |
| 143 | PALETTE_INIT( gb ) | |
| 143 | PALETTE_INIT( gb ) | |
| 144 | 144 | { |
| 145 | 145 | int ii; |
| 146 | for( ii = 0; ii < 4; ii++) | |
| 146 | for( ii = 0; ii < 4; ii++) | |
| 147 | 147 | { |
| 148 | 148 | palette_set_color_rgb(machine, ii, palette[ii*3+0], palette[ii*3+1], palette[ii*3+2]); |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | PALETTE_INIT( gbp ) | |
| 152 | PALETTE_INIT( gbp ) | |
| 153 | 153 | { |
| 154 | 154 | int ii; |
| 155 | for( ii = 0; ii < 4; ii++) | |
| 155 | for( ii = 0; ii < 4; ii++) | |
| 156 | 156 | { |
| 157 | 157 | palette_set_color_rgb(machine, ii, palette[(ii + 4)*3+0], palette[(ii + 4)*3+1], palette[(ii + 4)*3+2]); |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | PALETTE_INIT( sgb ) | |
| 161 | PALETTE_INIT( sgb ) | |
| 162 | 162 | { |
| 163 | 163 | int ii, r, g, b; |
| 164 | 164 | |
| 165 | for( ii = 0; ii < 32768; ii++ ) | |
| 165 | for( ii = 0; ii < 32768; ii++ ) | |
| 166 | 166 | { |
| 167 | 167 | r = (ii & 0x1F) << 3; |
| 168 | 168 | g = ((ii >> 5) & 0x1F) << 3; |
| r5932 | r5933 | |
| 180 | 180 | sgb_pal[ii] = 0; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | PALETTE_INIT( gbc ) | |
| 183 | PALETTE_INIT( gbc ) | |
| 184 | 184 | { |
| 185 | 185 | int ii, r, g, b; |
| 186 | 186 | |
| 187 | for( ii = 0; ii < 32768; ii++ ) | |
| 187 | for( ii = 0; ii < 32768; ii++ ) | |
| 188 | 188 | { |
| 189 | 189 | r = (ii & 0x1F) << 3; |
| 190 | 190 | g = ((ii >> 5) & 0x1F) << 3; |
| r5932 | r5933 | |
| 200 | 200 | cgb_spal[ii] = 0; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | PALETTE_INIT( megaduck ) | |
| 203 | PALETTE_INIT( megaduck ) | |
| 204 | 204 | { |
| 205 | 205 | int ii; |
| 206 | for( ii = 0; ii < 4; ii++) | |
| 206 | for( ii = 0; ii < 4; ii++) | |
| 207 | 207 | { |
| 208 | 208 | palette_set_color_rgb(machine, ii, palette_megaduck[ii*3+0], palette_megaduck[ii*3+1], palette_megaduck[ii*3+2]); |
| 209 | 209 | } |
| r5932 | r5933 | |
| 219 | 219 | Select which sprites should be drawn for the current scanline and return the |
| 220 | 220 | number of sprites selected. |
| 221 | 221 | */ |
| 222 | static void gb_select_sprites( void ) | |
| 222 | static void gb_select_sprites( void ) | |
| 223 | 223 | { |
| 224 | 224 | int i, /*yindex,*/ line, height; |
| 225 | 225 | UINT8 *oam = gb_oam + 39 * 4; |
| r5932 | r5933 | |
| 227 | 227 | gb_lcd.sprCount = 0; |
| 228 | 228 | |
| 229 | 229 | /* If video hardware is enabled and sprites are enabled */ |
| 230 | if ( ( LCDCONT & 0x80 ) && ( LCDCONT & 0x02 ) ) | |
| 230 | if ( ( LCDCONT & 0x80 ) && ( LCDCONT & 0x02 ) ) | |
| 231 | 231 | { |
| 232 | 232 | /* Check for stretched sprites */ |
| 233 | if ( LCDCONT & 0x04 ) | |
| 233 | if ( LCDCONT & 0x04 ) | |
| 234 | 234 | { |
| 235 | 235 | height = 16; |
| 236 | } | |
| 237 | else | |
| 236 | } | |
| 237 | else | |
| 238 | 238 | { |
| 239 | 239 | height = 8; |
| 240 | 240 | } |
| r5932 | r5933 | |
| 242 | 242 | //yindex = gb_lcd.current_line; |
| 243 | 243 | line = gb_lcd.current_line + 16; |
| 244 | 244 | |
| 245 | for( i = 39; i >= 0; i-- ) | |
| 245 | for( i = 39; i >= 0; i-- ) | |
| 246 | 246 | { |
| 247 | if ( line >= oam[0] && line < ( oam[0] + height ) && oam[1] && oam[1] < 168 ) | |
| 247 | if ( line >= oam[0] && line < ( oam[0] + height ) && oam[1] && oam[1] < 168 ) | |
| 248 | 248 | { |
| 249 | 249 | /* We limit the sprite count to max 10 here; |
| 250 | proper games should not exceed this... */ | |
| 251 | if ( gb_lcd.sprCount < 10 ) | |
| 250 | proper games should not exceed this... */ | |
| 251 | if ( gb_lcd.sprCount < 10 ) | |
| 252 | 252 | { |
| 253 | 253 | gb_lcd.sprite[gb_lcd.sprCount] = i; |
| 254 | 254 | gb_lcd.sprCount++; |
| r5932 | r5933 | |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | static void gb_update_scanline( running_machine *machine ) | |
| 349 | static void gb_update_scanline( running_machine *machine ) | |
| 350 | 350 | { |
| 351 | 351 | bitmap_t *bitmap = tmpbitmap; |
| 352 | 352 | |
| 353 | 353 | profiler_mark_start(PROFILER_VIDEO); |
| 354 | 354 | |
| 355 | 355 | /* Make sure we're in mode 3 */ |
| 356 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) | |
| 356 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) | |
| 357 | 357 | { |
| 358 | 358 | /* Calculate number of pixels to render based on time still left on the timer */ |
| 359 | 359 | UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) ); |
| 360 | 360 | int l = 0; |
| 361 | 361 | |
| 362 | if ( gb_lcd.start_x < 0 ) | |
| 362 | if ( gb_lcd.start_x < 0 ) | |
| 363 | 363 | { |
| 364 | 364 | /* Window is enabled if the hardware says so AND the current scanline is |
| 365 | ||
| 365 | * within the window AND the window X coordinate is <=166 */ | |
| 366 | 366 | gb_lcd.layer[1].enabled = ( ( LCDCONT & 0x20 ) && ( gb_lcd.current_line >= WNDPOSY ) && ( WNDPOSX <= 166 ) ) ? 1 : 0; |
| 367 | 367 | |
| 368 | 368 | /* BG is enabled if the hardware says so AND (window_off OR (window_on |
| 369 | | |
| 369 | * AND window's X position is >=7 ) ) */ | |
| 370 | 370 | gb_lcd.layer[0].enabled = ( ( LCDCONT & 0x01 ) && ( ( ! gb_lcd.layer[1].enabled ) || ( gb_lcd.layer[1].enabled && ( WNDPOSX >= 7 ) ) ) ) ? 1 : 0; |
| 371 | 371 | |
| 372 | if ( gb_lcd.layer[0].enabled ) | |
| 372 | if ( gb_lcd.layer[0].enabled ) | |
| 373 | 373 | { |
| 374 | 374 | gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF; |
| 375 | 375 | gb_lcd.layer[0].bg_map = gb_bgdtab; |
| r5932 | r5933 | |
| 380 | 380 | gb_lcd.layer[0].xend = 160; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | if ( gb_lcd.layer[1].enabled ) | |
| 383 | if ( gb_lcd.layer[1].enabled ) | |
| 384 | 384 | { |
| 385 | 385 | int xpos; |
| 386 | 386 | |
| r5932 | r5933 | |
| 400 | 400 | gb_lcd.start_x = 0; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | if ( cycles_to_go < 160 ) | |
| 403 | if ( cycles_to_go < 160 ) | |
| 404 | 404 | { |
| 405 | 405 | gb_lcd.end_x = MIN(160 - cycles_to_go,160); |
| 406 | 406 | /* Draw empty pixels when the background is disabled */ |
| 407 | if ( ! ( LCDCONT & 0x01 ) ) | |
| 407 | if ( ! ( LCDCONT & 0x01 ) ) | |
| 408 | 408 | { |
| 409 | 409 | rectangle r; |
| 410 | 410 | r.min_y = r.max_y = gb_lcd.current_line; |
| r5932 | r5933 | |
| 412 | 412 | r.max_x = gb_lcd.end_x - 1; |
| 413 | 413 | bitmap_fill( bitmap, &r , gb_bpal[0]); |
| 414 | 414 | } |
| 415 | while ( l < 2 ) | |
| 415 | while ( l < 2 ) | |
| 416 | 416 | { |
| 417 | 417 | UINT8 xindex, *map, *tiles; |
| 418 | 418 | UINT16 data; |
| 419 | 419 | int i, tile_index; |
| 420 | 420 | |
| 421 | if ( ! gb_lcd.layer[l].enabled ) | |
| 421 | if ( ! gb_lcd.layer[l].enabled ) | |
| 422 | 422 | { |
| 423 | 423 | l++; |
| 424 | 424 | continue; |
| r5932 | r5933 | |
| 437 | 437 | data = tiles[ tile_index ] | ( tiles[ tile_index+1 ] << 8 ); |
| 438 | 438 | data <<= gb_lcd.layer[l].xshift; |
| 439 | 439 | |
| 440 | while ( i > 0 ) | |
| 440 | while ( i > 0 ) | |
| 441 | 441 | { |
| 442 | while ( ( gb_lcd.layer[l].xshift < 8 ) && i ) | |
| 442 | while ( ( gb_lcd.layer[l].xshift < 8 ) && i ) | |
| 443 | 443 | { |
| 444 | 444 | register int colour = ( ( data & 0x8000 ) ? 2 : 0 ) | ( ( data & 0x0080 ) ? 1 : 0 ); |
| 445 | 445 | gb_plot_pixel( bitmap, xindex, gb_lcd.current_line, gb_bpal[ colour ] ); |
| r5932 | r5933 | |
| 449 | 449 | gb_lcd.layer[l].xshift++; |
| 450 | 450 | i--; |
| 451 | 451 | } |
| 452 | if ( gb_lcd.layer[l].xshift == 8 ) | |
| 452 | if ( gb_lcd.layer[l].xshift == 8 ) | |
| 453 | 453 | { |
| 454 | 454 | /* Take possible changes to SCROLLY into account */ |
| 455 | if ( l == 0 ) | |
| 455 | if ( l == 0 ) | |
| 456 | 456 | { |
| 457 | 457 | gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF; |
| 458 | 458 | map = gb_lcd.layer[l].bg_map + ( ( gb_lcd.layer[l].bgline << 2 ) & 0x3E0 ); |
| r5932 | r5933 | |
| 467 | 467 | } |
| 468 | 468 | l++; |
| 469 | 469 | } |
| 470 | if ( gb_lcd.end_x == 160 && LCDCONT & 0x02 ) | |
| 470 | if ( gb_lcd.end_x == 160 && LCDCONT & 0x02 ) | |
| 471 | 471 | { |
| 472 | 472 | gb_update_sprites(); |
| 473 | 473 | } |
| 474 | 474 | gb_lcd.start_x = gb_lcd.end_x; |
| 475 | 475 | } |
| 476 | } | |
| 477 | else | |
| 476 | } | |
| 477 | else | |
| 478 | 478 | { |
| 479 | if ( ! ( LCDCONT & 0x80 ) ) | |
| 479 | if ( ! ( LCDCONT & 0x80 ) ) | |
| 480 | 480 | { |
| 481 | 481 | /* Draw an empty line when LCD is disabled */ |
| 482 | if ( gb_lcd.previous_line != gb_lcd.current_line ) | |
| 482 | if ( gb_lcd.previous_line != gb_lcd.current_line ) | |
| 483 | 483 | { |
| 484 | if ( gb_lcd.current_line < 144 ) | |
| 484 | if ( gb_lcd.current_line < 144 ) | |
| 485 | 485 | { |
| 486 | 486 | const device_config *screen = video_screen_first(machine->config); |
| 487 | 487 | rectangle r = *video_screen_get_visible_area(screen); |
| r5932 | r5933 | |
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | static void sgb_refresh_border(void) | |
| 596 | static void sgb_refresh_border(void) | |
| 597 | 597 | { |
| 598 | 598 | UINT16 data, data2; |
| 599 | 599 | UINT16 yidx, xidx, xindex; |
| r5932 | r5933 | |
| 603 | 603 | |
| 604 | 604 | map = sgb_tile_map - 64; |
| 605 | 605 | |
| 606 | for( yidx = 0; yidx < 224; yidx++ ) | |
| 606 | for( yidx = 0; yidx < 224; yidx++ ) | |
| 607 | 607 | { |
| 608 | 608 | xindex = 0; |
| 609 | 609 | map += (yidx % 8) ? 0 : 64; |
| 610 | for( xidx = 0; xidx < 64; xidx+=2 ) | |
| 610 | for( xidx = 0; xidx < 64; xidx+=2 ) | |
| 611 | 611 | { |
| 612 | 612 | if( map[xidx+1] & 0x80 ) /* Vertical flip */ |
| 613 | 613 | tiles = sgb_tile_data + ( ( 7 - ( yidx % 8 ) ) << 1 ); |
| r5932 | r5933 | |
| 620 | 620 | pal = 1; |
| 621 | 621 | pal <<= 4; |
| 622 | 622 | |
| 623 | if( sgb_hack ) | |
| 623 | if( sgb_hack ) | |
| 624 | 624 | { /* A few games do weird stuff */ |
| 625 | 625 | UINT8 tileno = map[xidx]; |
| 626 | 626 | if( tileno >= 128 ) tileno = ((64 + tileno) % 128) + 128; |
| 627 | 627 | else tileno = (64 + tileno) % 128; |
| 628 | 628 | data = tiles[ tileno * 32 ] | ( tiles[ ( tileno * 32 ) + 1 ] << 8 ); |
| 629 | 629 | data2 = tiles2[ tileno * 32 ] | ( tiles2[ ( tileno * 32 ) + 1 ] << 8 ); |
| 630 | } | |
| 631 | else | |
| 630 | } | |
| 631 | else | |
| 632 | 632 | { |
| 633 | 633 | data = tiles[ map[xidx] * 32 ] | ( tiles[ (map[xidx] * 32 ) + 1 ] << 8 ); |
| 634 | 634 | data2 = tiles2[ map[xidx] * 32 ] | ( tiles2[ (map[xidx] * 32 ) + 1 ] << 8 ); |
| 635 | 635 | } |
| 636 | 636 | |
| 637 | for( i = 0; i < 8; i++ ) | |
| 637 | for( i = 0; i < 8; i++ ) | |
| 638 | 638 | { |
| 639 | 639 | register UINT8 colour; |
| 640 | 640 | if( (map[xidx+1] & 0x40) ) /* Horizontal flip */ |
| r5932 | r5933 | |
| 643 | 643 | ((data2 & 0x0001) ? 4 : 0) | ((data2 & 0x0100) ? 8 : 0); |
| 644 | 644 | data >>= 1; |
| 645 | 645 | data2 >>= 1; |
| 646 | } | |
| 646 | } | |
| 647 | 647 | else /* No horizontal flip */ |
| 648 | 648 | { |
| 649 | 649 | colour = ((data & 0x0080) ? 1 : 0) | ((data & 0x8000) ? 2 : 0) | |
| r5932 | r5933 | |
| 652 | 652 | data2 <<= 1; |
| 653 | 653 | } |
| 654 | 654 | /* A slight hack below so we don't draw over the GB screen. |
| 655 | * Drawing there is allowed, but due to the way we draw the | |
| 656 | * scanline, it can obscure the screen even when it shouldn't. | |
| 657 | */ | |
| 655 | * Drawing there is allowed, but due to the way we draw the | |
| 656 | * scanline, it can obscure the screen even when it shouldn't. | |
| 657 | */ | |
| 658 | 658 | if( !((yidx >= SGB_YOFFSET && yidx < SGB_YOFFSET + 144) && |
| 659 | (xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160)) ) | |
| 659 | (xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160)) ) | |
| 660 | 660 | { |
| 661 | 661 | gb_plot_pixel(bitmap, xindex, yidx, sgb_pal[pal + colour]); |
| 662 | 662 | } |
| r5932 | r5933 | |
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | static void sgb_update_scanline( running_machine *machine ) | |
| 669 | static void sgb_update_scanline( running_machine *machine ) | |
| 670 | 670 | { |
| 671 | 671 | bitmap_t *bitmap = tmpbitmap; |
| 672 | 672 | |
| 673 | 673 | profiler_mark_start(PROFILER_VIDEO); |
| 674 | 674 | |
| 675 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) | |
| 675 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) | |
| 676 | 676 | { |
| 677 | 677 | /* Calcuate number of pixels to render based on time still left on the timer */ |
| 678 | 678 | UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) ); |
| 679 | 679 | int l = 0; |
| 680 | 680 | |
| 681 | if ( gb_lcd.start_x < 0 ) | |
| 681 | if ( gb_lcd.start_x < 0 ) | |
| 682 | 682 | { |
| 683 | 683 | /* Window is enabled if the hardware says so AND the current scanline is |
| 684 | ||
| 684 | * within the window AND the window X coordinate is <=166 */ | |
| 685 | 685 | gb_lcd.layer[1].enabled = ((LCDCONT & 0x20) && gb_lcd.current_line >= WNDPOSY && WNDPOSX <= 166) ? 1 : 0; |
| 686 | 686 | |
| 687 | 687 | /* BG is enabled if the hardware says so AND (window_off OR (window_on |
| 688 | ||
| 688 | * AND window's X position is >=7 ) ) */ | |
| 689 | 689 | gb_lcd.layer[0].enabled = ((LCDCONT & 0x01) && ((!gb_lcd.layer[1].enabled) || (gb_lcd.layer[1].enabled && WNDPOSX >= 7))) ? 1 : 0; |
| 690 | 690 | |
| 691 | if ( gb_lcd.layer[0].enabled ) | |
| 691 | if ( gb_lcd.layer[0].enabled ) | |
| 692 | 692 | { |
| 693 | 693 | gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF; |
| 694 | 694 | gb_lcd.layer[0].bg_map = gb_bgdtab; |
| r5932 | r5933 | |
| 699 | 699 | gb_lcd.layer[0].xend = 160; |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | if ( gb_lcd.layer[1].enabled ) | |
| 702 | if ( gb_lcd.layer[1].enabled ) | |
| 703 | 703 | { |
| 704 | 704 | int xpos; |
| 705 | 705 | |
| r5932 | r5933 | |
| 720 | 720 | gb_lcd.start_x = 0; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | if ( cycles_to_go == 0 ) | |
| 723 | if ( cycles_to_go == 0 ) | |
| 724 | 724 | { |
| 725 | 725 | |
| 726 | 726 | /* Does this belong here? or should it be moved to the else block */ |
| 727 | 727 | /* Handle SGB mask */ |
| 728 | switch( sgb_window_mask ) | |
| 728 | switch( sgb_window_mask ) | |
| 729 | 729 | { |
| 730 | 730 | case 1: /* Freeze screen */ |
| 731 | 731 | return; |
| r5932 | r5933 | |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | /* Draw the "border" if we're on the first line */ |
| 755 | if ( gb_lcd.current_line == 0 ) | |
| 755 | if ( gb_lcd.current_line == 0 ) | |
| 756 | 756 | { |
| 757 | 757 | sgb_refresh_border(); |
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | if ( cycles_to_go < 160 ) | |
| 760 | if ( cycles_to_go < 160 ) | |
| 761 | 761 | { |
| 762 | 762 | gb_lcd.end_x = MIN(160 - cycles_to_go,160); |
| 763 | 763 | |
| 764 | 764 | /* if background or screen disabled clear line */ |
| 765 | if ( ! ( LCDCONT & 0x01 ) ) | |
| 765 | if ( ! ( LCDCONT & 0x01 ) ) | |
| 766 | 766 | { |
| 767 | 767 | const device_config *screen = video_screen_first(machine->config); |
| 768 | 768 | rectangle r = *video_screen_get_visible_area(screen); |
| r5932 | r5933 | |
| 771 | 771 | r.min_y = r.max_y = gb_lcd.current_line + SGB_YOFFSET; |
| 772 | 772 | bitmap_fill( bitmap, &r , 0); |
| 773 | 773 | } |
| 774 | while( l < 2 ) | |
| 774 | while( l < 2 ) | |
| 775 | 775 | { |
| 776 | 776 | UINT8 xindex, sgb_palette, *map, *tiles; |
| 777 | 777 | UINT16 data; |
| 778 | 778 | int i, tile_index; |
| 779 | 779 | |
| 780 | if ( ! gb_lcd.layer[l].enabled ) | |
| 780 | if ( ! gb_lcd.layer[l].enabled ) | |
| 781 | 781 | { |
| 782 | 782 | l++; |
| 783 | 783 | continue; |
| r5932 | r5933 | |
| 799 | 799 | /* Figure out which palette we're using */ |
| 800 | 800 | sgb_palette = sgb_pal_map[ ( gb_lcd.end_x - i ) >> 3 ][ gb_lcd.current_line >> 3 ] << 2; |
| 801 | 801 | |
| 802 | while( i > 0 ) | |
| 802 | while( i > 0 ) | |
| 803 | 803 | { |
| 804 | while( ( gb_lcd.layer[l].xshift < 8 ) && i ) | |
| 804 | while( ( gb_lcd.layer[l].xshift < 8 ) && i ) | |
| 805 | 805 | { |
| 806 | 806 | register int colour = ( ( data & 0x8000 ) ? 2 : 0 ) | ( ( data & 0x0080 ) ? 1 : 0 ); |
| 807 | 807 | gb_plot_pixel( bitmap, xindex + SGB_XOFFSET, gb_lcd.current_line + SGB_YOFFSET, sgb_pal[ sgb_palette + gb_bpal[colour]] ); |
| r5932 | r5933 | |
| 811 | 811 | gb_lcd.layer[l].xshift++; |
| 812 | 812 | i--; |
| 813 | 813 | } |
| 814 | if ( gb_lcd.layer[l].xshift == 8 ) | |
| 814 | if ( gb_lcd.layer[l].xshift == 8 ) | |
| 815 | 815 | { |
| 816 | 816 | /* Take possible changes to SCROLLY into account */ |
| 817 | if ( l == 0 ) | |
| 817 | if ( l == 0 ) | |
| 818 | 818 | { |
| 819 | 819 | gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF; |
| 820 | 820 | map = gb_lcd.layer[l].bg_map + ( ( gb_lcd.layer[l].bgline << 2 ) & 0x3E0 ); |
| r5932 | r5933 | |
| 830 | 830 | } |
| 831 | 831 | l++; |
| 832 | 832 | } |
| 833 | if ( ( gb_lcd.end_x == 160 ) && ( LCDCONT & 0x02 ) ) | |
| 833 | if ( ( gb_lcd.end_x == 160 ) && ( LCDCONT & 0x02 ) ) | |
| 834 | 834 | { |
| 835 | 835 | sgb_update_sprites(); |
| 836 | 836 | } |
| 837 | 837 | gb_lcd.start_x = gb_lcd.end_x; |
| 838 | 838 | } |
| 839 | } | |
| 840 | else | |
| 839 | } | |
| 840 | else | |
| 841 | 841 | { |
| 842 | if ( ! ( LCDCONT * 0x80 ) ) | |
| 842 | if ( ! ( LCDCONT * 0x80 ) ) | |
| 843 | 843 | { |
| 844 | 844 | /* if screen disabled clear line */ |
| 845 | if ( gb_lcd.previous_line != gb_lcd.current_line ) | |
| 845 | if ( gb_lcd.previous_line != gb_lcd.current_line ) | |
| 846 | 846 | { |
| 847 | 847 | /* Also refresh border here??? */ |
| 848 | if ( gb_lcd.current_line < 144 ) | |
| 848 | if ( gb_lcd.current_line < 144 ) | |
| 849 | 849 | { |
| 850 | 850 | const device_config *screen = video_screen_first(machine->config); |
| 851 | 851 | rectangle r = *video_screen_get_visible_area(screen); |
| r5932 | r5933 | |
| 864 | 864 | |
| 865 | 865 | /* --- Game Boy Color Specific --- */ |
| 866 | 866 | |
| 867 | INLINE void cgb_update_sprites ( running_machine *machine ) | |
| 867 | INLINE void cgb_update_sprites ( running_machine *machine ) | |
| 868 | 868 | { |
| 869 | 869 | bitmap_t *bitmap = tmpbitmap; |
| 870 | 870 | UINT8 height, tilemask, line, *oam; |
| r5932 | r5933 | |
| 976 | 976 | } |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | static void cgb_update_scanline ( running_machine *machine ) | |
| 979 | static void cgb_update_scanline ( running_machine *machine ) | |
| 980 | 980 | { |
| 981 | 981 | bitmap_t *bitmap = tmpbitmap; |
| 982 | 982 | |
| 983 | 983 | profiler_mark_start(PROFILER_VIDEO); |
| 984 | 984 | |
| 985 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) | |
| 985 | if ( ( LCDSTAT & 0x03 ) == 0x03 ) | |
| 986 | 986 | { |
| 987 | 987 | /* Calcuate number of pixels to render based on time still left on the timer */ |
| 988 | 988 | UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) ); |
| 989 | 989 | int l = 0; |
| 990 | 990 | |
| 991 | if ( gb_lcd.start_x < 0 ) | |
| 991 | if ( gb_lcd.start_x < 0 ) | |
| 992 | 992 | { |
| 993 | 993 | /* Window is enabled if the hardware says so AND the current scanline is |
| 994 | ||
| 994 | * within the window AND the window X coordinate is <=166 */ | |
| 995 | 995 | gb_lcd.layer[1].enabled = ( ( LCDCONT & 0x20 ) && ( gb_lcd.current_line >= WNDPOSY ) && ( WNDPOSX <= 166 ) ) ? 1 : 0; |
| 996 | 996 | |
| 997 | 997 | /* BG is enabled if the hardware says so AND (window_off OR (window_on |
| 998 | ||
| 998 | * AND window's X position is >=7 ) ) */ | |
| 999 | 999 | gb_lcd.layer[0].enabled = ( ( LCDCONT & 0x01 ) && ( ( ! gb_lcd.layer[1].enabled ) || ( gb_lcd.layer[1].enabled && ( WNDPOSX >= 7 ) ) ) ) ? 1 : 0; |
| 1000 | 1000 | |
| 1001 | if ( gb_lcd.layer[0].enabled ) | |
| 1001 | if ( gb_lcd.layer[0].enabled ) | |
| 1002 | 1002 | { |
| 1003 | 1003 | gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF; |
| 1004 | 1004 | gb_lcd.layer[0].bg_map = gb_bgdtab; |
| r5932 | r5933 | |
| 1009 | 1009 | gb_lcd.layer[0].xend = 160; |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | if ( gb_lcd.layer[1].enabled ) | |
| 1012 | if ( gb_lcd.layer[1].enabled ) | |
| 1013 | 1013 | { |
| 1014 | 1014 | int xpos; |
| 1015 | 1015 | |
| r5932 | r5933 | |
| 1030 | 1030 | gb_lcd.start_x = 0; |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | if ( cycles_to_go < 160 ) | |
| 1033 | if ( cycles_to_go < 160 ) | |
| 1034 | 1034 | { |
| 1035 | 1035 | gb_lcd.end_x = MIN(160 - cycles_to_go,160); |
| 1036 | 1036 | /* Draw empty line when the background is disabled */ |
| 1037 | if ( ! ( LCDCONT & 0x01 ) ) | |
| 1037 | if ( ! ( LCDCONT & 0x01 ) ) | |
| 1038 | 1038 | { |
| 1039 | 1039 | const device_config *screen = video_screen_first(machine->config); |
| 1040 | 1040 | rectangle r = *video_screen_get_visible_area(screen); |
| r5932 | r5933 | |
| 1043 | 1043 | r.max_x = gb_lcd.end_x - 1; |
| 1044 | 1044 | bitmap_fill( bitmap, &r , ( ! gb_lcd.gbc_mode ) ? 0 : 32767); |
| 1045 | 1045 | } |
| 1046 | while ( l < 2 ) | |
| 1046 | while ( l < 2 ) | |
| 1047 | 1047 | { |
| 1048 | 1048 | UINT8 xindex, *map, *tiles, *gbcmap; |
| 1049 | 1049 | UINT16 data; |
| 1050 | 1050 | int i, tile_index; |
| 1051 | 1051 | |
| 1052 | if ( ! gb_lcd.layer[l].enabled ) | |
| 1052 | if ( ! gb_lcd.layer[l].enabled ) | |
| 1053 | 1053 | { |
| 1054 | 1054 | l++; |
| 1055 | 1055 | continue; |
| r5932 | r5933 | |
| 1059 | 1059 | tiles = ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x08 ) ? gbc_chrgen : gb_chrgen; |
| 1060 | 1060 | |
| 1061 | 1061 | /* Check for vertical flip */ |
| 1062 | if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x40 ) | |
| 1062 | if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x40 ) | |
| 1063 | 1063 | { |
| 1064 | 1064 | tiles += ( ( 7 - ( gb_lcd.layer[l].bgline & 0x07 ) ) << 1 ); |
| 1065 | } | |
| 1066 | else | |
| 1065 | } | |
| 1066 | else | |
| 1067 | 1067 | { |
| 1068 | 1068 | tiles += ( ( gb_lcd.layer[l].bgline & 0x07 ) << 1 ); |
| 1069 | 1069 | } |
| r5932 | r5933 | |
| 1078 | 1078 | tile_index = ( map[ gb_lcd.layer[l].xindex ] ^ gb_tile_no_mod ) * 16; |
| 1079 | 1079 | data = tiles[ tile_index ] | ( tiles[ tile_index + 1 ] << 8 ); |
| 1080 | 1080 | /* Check for horinzontal flip */ |
| 1081 | if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x20 ) | |
| 1081 | if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x20 ) | |
| 1082 | 1082 | { |
| 1083 | 1083 | data >>= gb_lcd.layer[l].xshift; |
| 1084 | } | |
| 1085 | else | |
| 1084 | } | |
| 1085 | else | |
| 1086 | 1086 | { |
| 1087 | 1087 | data <<= gb_lcd.layer[l].xshift; |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | while ( i > 0 ) | |
| 1090 | while ( i > 0 ) | |
| 1091 | 1091 | { |
| 1092 | while ( ( gb_lcd.layer[l].xshift < 8 ) && i ) | |
| 1092 | while ( ( gb_lcd.layer[l].xshift < 8 ) && i ) | |
| 1093 | 1093 | { |
| 1094 | 1094 | int colour; |
| 1095 | 1095 | /* Check for horinzontal flip */ |
| 1096 | if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x20 ) | |
| 1096 | if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x20 ) | |
| 1097 | 1097 | { |
| 1098 | 1098 | colour = ( ( data & 0x0100 ) ? 2 : 0 ) | ( ( data & 0x0001 ) ? 1 : 0 ); |
| 1099 | 1099 | data >>= 1; |
| 1100 | } | |
| 1101 | else | |
| 1100 | } | |
| 1101 | else | |
| 1102 | 1102 | { |
| 1103 | 1103 | colour = ( ( data & 0x8000 ) ? 2 : 0 ) | ( ( data & 0x0080 ) ? 1 : 0 ); |
| 1104 | 1104 | data <<= 1; |
| r5932 | r5933 | |
| 1109 | 1109 | gb_lcd.layer[l].xshift++; |
| 1110 | 1110 | i--; |
| 1111 | 1111 | } |
| 1112 | if ( gb_lcd.layer[l].xshift == 8 ) | |
| 1112 | if ( gb_lcd.layer[l].xshift == 8 ) | |
| 1113 | 1113 | { |
| 1114 | 1114 | /* Take possible changes to SCROLLY into account */ |
| 1115 | if ( l == 0 ) | |
| 1115 | if ( l == 0 ) | |
| 1116 | 1116 | { |
| 1117 | 1117 | gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF; |
| 1118 | 1118 | map = gb_lcd.layer[l].bg_map + ( ( gb_lcd.layer[l].bgline << 2 ) & 0x3E0 ); |
| r5932 | r5933 | |
| 1124 | 1124 | tiles = ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x08 ) ? gbc_chrgen : gb_chrgen; |
| 1125 | 1125 | |
| 1126 | 1126 | /* Check for vertical flip */ |
| 1127 | if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x40 ) | |
| 1127 | if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x40 ) | |
| 1128 | 1128 | { |
| 1129 | 1129 | tiles += ( ( 7 - ( gb_lcd.layer[l].bgline & 0x07 ) ) << 1 ); |
| 1130 | } | |
| 1131 | else | |
| 1130 | } | |
| 1131 | else | |
| 1132 | 1132 | { |
| 1133 | 1133 | tiles += ( ( gb_lcd.layer[l].bgline & 0x07 ) << 1 ); |
| 1134 | 1134 | } |
| r5932 | r5933 | |
| 1138 | 1138 | } |
| 1139 | 1139 | l++; |
| 1140 | 1140 | } |
| 1141 | if ( gb_lcd.end_x == 160 && ( LCDCONT & 0x02 ) ) | |
| 1141 | if ( gb_lcd.end_x == 160 && ( LCDCONT & 0x02 ) ) | |
| 1142 | 1142 | { |
| 1143 | 1143 | cgb_update_sprites( machine ); |
| 1144 | 1144 | } |
| 1145 | 1145 | gb_lcd.start_x = gb_lcd.end_x; |
| 1146 | 1146 | } |
| 1147 | } | |
| 1148 | else | |
| 1147 | } | |
| 1148 | else | |
| 1149 | 1149 | { |
| 1150 | if ( ! ( LCDCONT & 0x80 ) ) | |
| 1150 | if ( ! ( LCDCONT & 0x80 ) ) | |
| 1151 | 1151 | { |
| 1152 | 1152 | /* Draw an empty line when LCD is disabled */ |
| 1153 | if ( gb_lcd.previous_line != gb_lcd.current_line ) | |
| 1153 | if ( gb_lcd.previous_line != gb_lcd.current_line ) | |
| 1154 | 1154 | { |
| 1155 | if ( gb_lcd.current_line < 144 ) | |
| 1155 | if ( gb_lcd.current_line < 144 ) | |
| 1156 | 1156 | { |
| 1157 | 1157 | const device_config *screen = video_screen_first(machine->config); |
| 1158 | 1158 | rectangle r = *video_screen_get_visible_area(screen); |
| r5932 | r5933 | |
| 1237 | 1237 | /* |
| 1238 | 1238 | For an AGS in CGB mode this data is: |
| 1239 | 1239 | static const UINT8 abs_oam_fingerprint[0x100] = { |
| 1240 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1241 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1242 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1244 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1245 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1246 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1247 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1248 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1249 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1250 | 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, | |
| 1251 | 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, | |
| 1252 | 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, | |
| 1253 | 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, | |
| 1254 | 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, | |
| 1255 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF | |
| 1240 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1241 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1242 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1244 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1245 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1246 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1247 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1248 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1249 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
| 1250 | 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, | |
| 1251 | 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, | |
| 1252 | 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, | |
| 1253 | 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, | |
| 1254 | 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, | |
| 1255 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF | |
| 1256 | 1256 | }; |
| 1257 | 1257 | */ |
| 1258 | 1258 | |
| r5932 | r5933 | |
| 1279 | 1279 | cputag_set_input_line( machine, "maincpu", VBL_INT, ASSERT_LINE ); |
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | void gb_video_init( running_machine *machine, int mode ) | |
| 1282 | void gb_video_init( running_machine *machine, int mode ) | |
| 1283 | 1283 | { |
| 1284 | 1284 | int i; |
| 1285 | 1285 | int vram_size = 0x2000; |
| r5932 | r5933 | |
| 1298 | 1298 | gb_wndtab = gb_vram + 0x1C00; |
| 1299 | 1299 | |
| 1300 | 1300 | gb_vid_regs[0x06] = 0xFF; |
| 1301 | for( i = 0x0c; i < _NR_GB_VID_REGS; i++ ) | |
| 1301 | for( i = 0x0c; i < _NR_GB_VID_REGS; i++ ) | |
| 1302 | 1302 | { |
| 1303 | 1303 | gb_vid_regs[i] = 0xFF; |
| 1304 | 1304 | } |
| r5932 | r5933 | |
| 1311 | 1311 | WNDPOSX = WNDPOSY = 0x00; |
| 1312 | 1312 | |
| 1313 | 1313 | /* Initialize palette arrays */ |
| 1314 | for( i = 0; i < 4; i++ ) | |
| 1314 | for( i = 0; i < 4; i++ ) | |
| 1315 | 1315 | { |
| 1316 | 1316 | gb_bpal[i] = gb_spal0[i] = gb_spal1[i] = i; |
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | switch( mode ) | |
| 1319 | switch( mode ) | |
| 1320 | 1320 | { |
| 1321 | 1321 | case GB_VIDEO_DMG: |
| 1322 | 1322 | gb_lcd.lcd_timer = timer_alloc(machine, gb_lcd_timer_proc , NULL); |
| r5932 | r5933 | |
| 1334 | 1334 | /* set the scanline update function */ |
| 1335 | 1335 | update_scanline = gb_update_scanline; |
| 1336 | 1336 | /* Initialize part of VRAM. This code must be deleted when we have added the bios dump */ |
| 1337 | for( i = 1; i < 0x0D; i++ ) | |
| 1337 | for( i = 1; i < 0x0D; i++ ) | |
| 1338 | 1338 | { |
| 1339 | 1339 | gb_vram[ 0x1903 + i ] = i; |
| 1340 | 1340 | gb_vram[ 0x1923 + i ] = i + 0x0C; |
| r5932 | r5933 | |
| 1389 | 1389 | } |
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | static void gbc_hdma(running_machine *machine, UINT16 length) | |
| 1392 | static void gbc_hdma(running_machine *machine, UINT16 length) | |
| 1393 | 1393 | { |
| 1394 | 1394 | UINT16 src, dst; |
| 1395 | 1395 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r5932 | r5933 | |
| 1397 | 1397 | src = ((UINT16)HDMA1 << 8) | (HDMA2 & 0xF0); |
| 1398 | 1398 | dst = ((UINT16)(HDMA3 & 0x1F) << 8) | (HDMA4 & 0xF0); |
| 1399 | 1399 | dst |= 0x8000; |
| 1400 | while( length > 0 ) | |
| 1400 | while( length > 0 ) | |
| 1401 | 1401 | { |
| 1402 | 1402 | memory_write_byte( space, dst++, memory_read_byte( space, src++ ) ); |
| 1403 | 1403 | length--; |
| r5932 | r5933 | |
| 1407 | 1407 | HDMA3 = 0x1f & (dst >> 8); |
| 1408 | 1408 | HDMA4 = dst & 0xF0; |
| 1409 | 1409 | HDMA5--; |
| 1410 | if( (HDMA5 & 0x7f) == 0x7f ) | |
| 1410 | if( (HDMA5 & 0x7f) == 0x7f ) | |
| 1411 | 1411 | { |
| 1412 | 1412 | HDMA5 = 0xff; |
| 1413 | 1413 | gb_lcd.hdma_enabled = 0; |
| 1414 | 1414 | } |
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | static void gb_increment_scanline( void ) | |
| 1417 | static void gb_increment_scanline( void ) | |
| 1418 | 1418 | { |
| 1419 | 1419 | gb_lcd.current_line = ( gb_lcd.current_line + 1 ) % 154; |
| 1420 | if ( LCDCONT & 0x80 ) | |
| 1420 | if ( LCDCONT & 0x80 ) | |
| 1421 | 1421 | { |
| 1422 | 1422 | CURLINE = gb_lcd.current_line; |
| 1423 | 1423 | } |
| 1424 | if ( gb_lcd.current_line == 0 ) | |
| 1424 | if ( gb_lcd.current_line == 0 ) | |
| 1425 | 1425 | { |
| 1426 | 1426 | gb_lcd.window_lines_drawn = 0; |
| 1427 | 1427 | } |
| r5932 | r5933 | |
| 1433 | 1433 | |
| 1434 | 1434 | gb_lcd.state = param; |
| 1435 | 1435 | |
| 1436 | if ( LCDCONT & 0x80 ) | |
| 1436 | if ( LCDCONT & 0x80 ) | |
| 1437 | 1437 | { |
| 1438 | switch( gb_lcd.state ) | |
| 1438 | switch( gb_lcd.state ) | |
| 1439 | 1439 | { |
| 1440 | 1440 | case GB_LCD_STATE_LYXX_PRE_M0: /* Just before switching to mode 0 */ |
| 1441 | 1441 | gb_lcd.mode = 0; |
| 1442 | if ( LCDSTAT & 0x08 ) | |
| 1442 | if ( LCDSTAT & 0x08 ) | |
| 1443 | 1443 | { |
| 1444 | if ( ! gb_lcd.mode_irq ) | |
| 1444 | if ( ! gb_lcd.mode_irq ) | |
| 1445 | 1445 | { |
| 1446 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) | |
| 1446 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) | |
| 1447 | 1447 | { |
| 1448 | 1448 | gb_lcd.mode_irq = 1; |
| 1449 | 1449 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1450 | 1450 | } |
| 1451 | } | |
| 1452 | else | |
| 1451 | } | |
| 1452 | else | |
| 1453 | 1453 | { |
| 1454 | 1454 | gb_lcd.mode_irq = 0; |
| 1455 | 1455 | } |
| r5932 | r5933 | |
| 1460 | 1460 | /* update current scanline */ |
| 1461 | 1461 | update_scanline( machine ); |
| 1462 | 1462 | /* Increment the number of window lines drawn if enabled */ |
| 1463 | if ( gb_lcd.layer[1].enabled ) | |
| 1463 | if ( gb_lcd.layer[1].enabled ) | |
| 1464 | 1464 | { |
| 1465 | 1465 | gb_lcd.window_lines_drawn++; |
| 1466 | 1466 | } |
| r5932 | r5933 | |
| 1471 | 1471 | gb_lcd.oam_locked = UNLOCKED; |
| 1472 | 1472 | gb_lcd.vram_locked = UNLOCKED; |
| 1473 | 1473 | /* |
| 1474 | There seems to a kind of feature in the Game Boy hardware when the lowest bits of the | |
| 1475 | SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later | |
| 1476 | than usual. | |
| 1477 | The SGB probably has the same bug. | |
| 1478 | */ | |
| 1479 | if ( ( SCROLLX & 0x03 ) == 0x03 ) | |
| 1474 | There seems to a kind of feature in the Game Boy hardware when the lowest bits of the | |
| 1475 | SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later | |
| 1476 | than usual. | |
| 1477 | The SGB probably has the same bug. | |
| 1478 | */ | |
| 1479 | if ( ( SCROLLX & 0x03 ) == 0x03 ) | |
| 1480 | 1480 | { |
| 1481 | 1481 | gb_lcd.scrollx_adjust += 4; |
| 1482 | 1482 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_SCX3); |
| r5932 | r5933 | |
| 1485 | 1485 | case GB_LCD_STATE_LYXX_M0_SCX3: |
| 1486 | 1486 | /* Generate lcd interrupt if requested */ |
| 1487 | 1487 | if ( ! gb_lcd.mode_irq && ( LCDSTAT & 0x08 ) && |
| 1488 | ( ( ! gb_lcd.line_irq && gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) | |
| 1488 | ( ( ! gb_lcd.line_irq && gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) | |
| 1489 | 1489 | { |
| 1490 | 1490 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1491 | 1491 | } |
| 1492 | 1492 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 196 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); |
| 1493 | 1493 | break; |
| 1494 | 1494 | case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ |
| 1495 | if ( CURLINE < 143 ) | |
| 1495 | if ( CURLINE < 143 ) | |
| 1496 | 1496 | { |
| 1497 | 1497 | gb_lcd.mode = 2; |
| 1498 | 1498 | gb_lcd.triggering_mode_irq = ( LCDSTAT & 0x20 ) ? 1 : 0; |
| 1499 | if ( gb_lcd.triggering_mode_irq ) | |
| 1499 | if ( gb_lcd.triggering_mode_irq ) | |
| 1500 | 1500 | { |
| 1501 | if ( ! gb_lcd.mode_irq ) | |
| 1501 | if ( ! gb_lcd.mode_irq ) | |
| 1502 | 1502 | { |
| 1503 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) | |
| 1503 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) | |
| 1504 | 1504 | { |
| 1505 | 1505 | gb_lcd.mode_irq = 1; |
| 1506 | 1506 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1507 | 1507 | } |
| 1508 | } | |
| 1509 | else | |
| 1508 | } | |
| 1509 | else | |
| 1510 | 1510 | { |
| 1511 | 1511 | gb_lcd.mode_irq = 0; |
| 1512 | 1512 | } |
| r5932 | r5933 | |
| 1519 | 1519 | gb_lcd.delayed_line_irq = gb_lcd.line_irq; |
| 1520 | 1520 | gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; |
| 1521 | 1521 | gb_lcd.line_irq = 0; |
| 1522 | if ( ! gb_lcd.mode_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! gb_lcd.triggering_mode_irq ) | |
| 1522 | if ( ! gb_lcd.mode_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! gb_lcd.triggering_mode_irq ) | |
| 1523 | 1523 | { |
| 1524 | 1524 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1525 | 1525 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 1527 | 1527 | /* Reset LY==LYC STAT bit */ |
| 1528 | 1528 | LCDSTAT &= 0xFB; |
| 1529 | 1529 | /* Check if we're going into VBlank next */ |
| 1530 | if ( CURLINE == 144 ) | |
| 1530 | if ( CURLINE == 144 ) | |
| 1531 | 1531 | { |
| 1532 | 1532 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1); |
| 1533 | } | |
| 1534 | else | |
| 1533 | } | |
| 1534 | else | |
| 1535 | 1535 | { |
| 1536 | 1536 | /* Internally switch to mode 2 */ |
| 1537 | 1537 | gb_lcd.mode = 2; |
| 1538 | 1538 | /* Generate lcd interrupt if requested */ |
| 1539 | 1539 | if ( ! gb_lcd.mode_irq && gb_lcd.triggering_mode_irq && |
| 1540 | ( ( ! gb_lcd.triggering_line_irq && ! gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) | |
| 1540 | ( ( ! gb_lcd.triggering_line_irq && ! gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) | |
| 1541 | 1541 | { |
| 1542 | 1542 | gb_lcd.mode_irq = 1; |
| 1543 | 1543 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 1566 | 1566 | gb_lcd.oam_locked = LOCKED; |
| 1567 | 1567 | /* Generate lcd interrupt if requested */ |
| 1568 | 1568 | if ( ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) || |
| 1569 | ( ! gb_lcd.mode_irq && ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_mode_irq ) ) | |
| 1569 | ( ! gb_lcd.mode_irq && ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_mode_irq ) ) | |
| 1570 | 1570 | { |
| 1571 | 1571 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1572 | 1572 | } |
| 1573 | 1573 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1574 | 1574 | gb_lcd.triggering_mode_irq = 0; |
| 1575 | 1575 | /* Check if LY==LYC STAT bit should be set */ |
| 1576 | if ( CURLINE == CMPLINE ) | |
| 1576 | if ( CURLINE == CMPLINE ) | |
| 1577 | 1577 | { |
| 1578 | 1578 | LCDSTAT |= 0x04; |
| 1579 | 1579 | } |
| r5932 | r5933 | |
| 1595 | 1595 | gb_lcd.start_x = -1; |
| 1596 | 1596 | break; |
| 1597 | 1597 | case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ |
| 1598 | if ( CURLINE == 144 ) | |
| 1598 | if ( CURLINE == 144 ) | |
| 1599 | 1599 | { |
| 1600 | 1600 | /* Trigger VBlank interrupt */ |
| 1601 | 1601 | cputag_set_input_line( machine, "maincpu", VBL_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 1603 | 1603 | gb_lcd.mode = 1; |
| 1604 | 1604 | LCDSTAT = (LCDSTAT & 0xFC) | 0x01; |
| 1605 | 1605 | /* Trigger LCD interrupt if requested */ |
| 1606 | if ( LCDSTAT & 0x10 ) | |
| 1606 | if ( LCDSTAT & 0x10 ) | |
| 1607 | 1607 | { |
| 1608 | 1608 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1609 | 1609 | } |
| 1610 | 1610 | } |
| 1611 | 1611 | /* Check if LY==LYC STAT bit should be set */ |
| 1612 | if ( CURLINE == CMPLINE ) | |
| 1612 | if ( CURLINE == CMPLINE ) | |
| 1613 | 1613 | { |
| 1614 | 1614 | LCDSTAT |= 0x04; |
| 1615 | 1615 | } |
| 1616 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1616 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1617 | 1617 | { |
| 1618 | 1618 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1619 | 1619 | } |
| r5932 | r5933 | |
| 1624 | 1624 | gb_lcd.delayed_line_irq = gb_lcd.line_irq; |
| 1625 | 1625 | gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; |
| 1626 | 1626 | gb_lcd.line_irq = 0; |
| 1627 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1627 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1628 | 1628 | { |
| 1629 | 1629 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1630 | 1630 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1631 | 1631 | } |
| 1632 | 1632 | /* Reset LY==LYC STAT bit */ |
| 1633 | 1633 | LCDSTAT &= 0xFB; |
| 1634 | if ( gb_lcd.current_line == 153 ) | |
| 1634 | if ( gb_lcd.current_line == 153 ) | |
| 1635 | 1635 | { |
| 1636 | 1636 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1); |
| 1637 | } | |
| 1638 | else | |
| 1637 | } | |
| 1638 | else | |
| 1639 | 1639 | { |
| 1640 | 1640 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1); |
| 1641 | 1641 | } |
| 1642 | 1642 | break; |
| 1643 | 1643 | case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ |
| 1644 | 1644 | /* Check LY=LYC for line #153 */ |
| 1645 | if ( gb_lcd.delayed_line_irq ) | |
| 1645 | if ( gb_lcd.delayed_line_irq ) | |
| 1646 | 1646 | { |
| 1647 | if ( gb_lcd.triggering_line_irq ) | |
| 1647 | if ( gb_lcd.triggering_line_irq ) | |
| 1648 | 1648 | { |
| 1649 | 1649 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1650 | 1650 | } |
| 1651 | 1651 | } |
| 1652 | 1652 | gb_lcd.delayed_line_irq = gb_lcd.delayed_line_irq | gb_lcd.line_irq; |
| 1653 | if ( CURLINE == CMPLINE ) | |
| 1653 | if ( CURLINE == CMPLINE ) | |
| 1654 | 1654 | { |
| 1655 | 1655 | LCDSTAT |= 0x04; |
| 1656 | 1656 | } |
| r5932 | r5933 | |
| 1661 | 1661 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4/*8*/), GB_LCD_STATE_LY00_M1_1); |
| 1662 | 1662 | break; |
| 1663 | 1663 | case GB_LCD_STATE_LY00_M1_1: |
| 1664 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1664 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1665 | 1665 | { |
| 1666 | 1666 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1667 | 1667 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 1669 | 1669 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_2); |
| 1670 | 1670 | break; |
| 1671 | 1671 | case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ |
| 1672 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1672 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1673 | 1673 | { |
| 1674 | 1674 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1675 | 1675 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1676 | 1676 | } |
| 1677 | if ( CURLINE == CMPLINE ) | |
| 1677 | if ( CURLINE == CMPLINE ) | |
| 1678 | 1678 | { |
| 1679 | 1679 | LCDSTAT |= 0x04; |
| 1680 | 1680 | } |
| r5932 | r5933 | |
| 1687 | 1687 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M2); |
| 1688 | 1688 | break; |
| 1689 | 1689 | } |
| 1690 | } | |
| 1691 | else | |
| 1690 | } | |
| 1691 | else | |
| 1692 | 1692 | { |
| 1693 | 1693 | gb_increment_scanline(); |
| 1694 | if ( gb_lcd.current_line < 144 ) | |
| 1694 | if ( gb_lcd.current_line < 144 ) | |
| 1695 | 1695 | { |
| 1696 | 1696 | update_scanline( machine ); |
| 1697 | 1697 | } |
| r5932 | r5933 | |
| 1705 | 1705 | |
| 1706 | 1706 | gb_lcd.state = param; |
| 1707 | 1707 | |
| 1708 | if ( LCDCONT & 0x80 ) | |
| 1708 | if ( LCDCONT & 0x80 ) | |
| 1709 | 1709 | { |
| 1710 | switch( gb_lcd.state ) | |
| 1710 | switch( gb_lcd.state ) | |
| 1711 | 1711 | { |
| 1712 | 1712 | case GB_LCD_STATE_LYXX_PRE_M0: /* Just before switching to mode 0 */ |
| 1713 | 1713 | gb_lcd.mode = 0; |
| 1714 | if ( LCDSTAT & 0x08 ) | |
| 1714 | if ( LCDSTAT & 0x08 ) | |
| 1715 | 1715 | { |
| 1716 | if ( ! gb_lcd.mode_irq ) | |
| 1716 | if ( ! gb_lcd.mode_irq ) | |
| 1717 | 1717 | { |
| 1718 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) | |
| 1718 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) | |
| 1719 | 1719 | { |
| 1720 | 1720 | gb_lcd.mode_irq = 1; |
| 1721 | 1721 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1722 | 1722 | } |
| 1723 | } | |
| 1724 | else | |
| 1723 | } | |
| 1724 | else | |
| 1725 | 1725 | { |
| 1726 | 1726 | gb_lcd.mode_irq = 0; |
| 1727 | 1727 | } |
| r5932 | r5933 | |
| 1732 | 1732 | /* update current scanline */ |
| 1733 | 1733 | update_scanline( machine ); |
| 1734 | 1734 | /* Increment the number of window lines drawn if enabled */ |
| 1735 | if ( gb_lcd.layer[1].enabled ) | |
| 1735 | if ( gb_lcd.layer[1].enabled ) | |
| 1736 | 1736 | { |
| 1737 | 1737 | gb_lcd.window_lines_drawn++; |
| 1738 | 1738 | } |
| r5932 | r5933 | |
| 1743 | 1743 | gb_lcd.oam_locked = UNLOCKED; |
| 1744 | 1744 | gb_lcd.vram_locked = UNLOCKED; |
| 1745 | 1745 | /* |
| 1746 | There seems to a kind of feature in the Game Boy hardware when the lowest bits of the | |
| 1747 | SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later | |
| 1748 | than usual. | |
| 1749 | The SGB probably has the same bug. | |
| 1750 | */ | |
| 1746 | There seems to a kind of feature in the Game Boy hardware when the lowest bits of the | |
| 1747 | SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later | |
| 1748 | than usual. | |
| 1749 | The SGB probably has the same bug. | |
| 1750 | */ | |
| 1751 | 1751 | gb_lcd.triggering_mode_irq = ( LCDSTAT & 0x08 ) ? 1 : 0; |
| 1752 | if ( ( SCROLLX & 0x03 ) == 0x03 ) | |
| 1752 | if ( ( SCROLLX & 0x03 ) == 0x03 ) | |
| 1753 | 1753 | { |
| 1754 | 1754 | gb_lcd.scrollx_adjust += 4; |
| 1755 | 1755 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_SCX3); |
| r5932 | r5933 | |
| 1758 | 1758 | case GB_LCD_STATE_LYXX_M0_SCX3: |
| 1759 | 1759 | /* Generate lcd interrupt if requested */ |
| 1760 | 1760 | if ( ! gb_lcd.mode_irq && gb_lcd.triggering_mode_irq && |
| 1761 | ( ( ! gb_lcd.line_irq && gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) | |
| 1761 | ( ( ! gb_lcd.line_irq && gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) | |
| 1762 | 1762 | { |
| 1763 | 1763 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1764 | 1764 | gb_lcd.triggering_mode_irq = 0; |
| 1765 | 1765 | } |
| 1766 | if ( ( SCROLLX & 0x03 ) == 0x03 ) | |
| 1766 | if ( ( SCROLLX & 0x03 ) == 0x03 ) | |
| 1767 | 1767 | { |
| 1768 | 1768 | gb_lcd.pal_locked = UNLOCKED; |
| 1769 | 1769 | } |
| r5932 | r5933 | |
| 1772 | 1772 | case GB_LCD_STATE_LYXX_M0_GBC_PAL: |
| 1773 | 1773 | gb_lcd.pal_locked = UNLOCKED; |
| 1774 | 1774 | /* Check for HBLANK DMA */ |
| 1775 | if( gb_lcd.hdma_enabled ) | |
| 1775 | if( gb_lcd.hdma_enabled ) | |
| 1776 | 1776 | { |
| 1777 | 1777 | gbc_hdma(machine, 0x10); |
| 1778 | // cpunum_set_reg( 0, LR35902_DMA_CYCLES, 36 ); | |
| 1779 | } | |
| 1780 | else | |
| 1778 | // cpunum_set_reg( 0, LR35902_DMA_CYCLES, 36 ); | |
| 1779 | } | |
| 1780 | else | |
| 1781 | 1781 | { |
| 1782 | 1782 | gb_lcd.hdma_possible = 1; |
| 1783 | 1783 | } |
| r5932 | r5933 | |
| 1785 | 1785 | break; |
| 1786 | 1786 | case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ |
| 1787 | 1787 | gb_lcd.cmp_line = CMPLINE; |
| 1788 | if ( CURLINE < 143 ) | |
| 1788 | if ( CURLINE < 143 ) | |
| 1789 | 1789 | { |
| 1790 | 1790 | gb_lcd.mode = 2; |
| 1791 | if ( LCDSTAT & 0x20 ) | |
| 1791 | if ( LCDSTAT & 0x20 ) | |
| 1792 | 1792 | { |
| 1793 | if ( ! gb_lcd.mode_irq ) | |
| 1793 | if ( ! gb_lcd.mode_irq ) | |
| 1794 | 1794 | { |
| 1795 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) | |
| 1795 | if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq ) | |
| 1796 | 1796 | { |
| 1797 | 1797 | gb_lcd.mode_irq = 1; |
| 1798 | 1798 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1799 | 1799 | } |
| 1800 | } | |
| 1801 | else | |
| 1800 | } | |
| 1801 | else | |
| 1802 | 1802 | { |
| 1803 | 1803 | gb_lcd.mode_irq = 0; |
| 1804 | 1804 | } |
| r5932 | r5933 | |
| 1811 | 1811 | gb_lcd.delayed_line_irq = gb_lcd.line_irq; |
| 1812 | 1812 | gb_lcd.triggering_line_irq = ( ( gb_lcd.cmp_line == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; |
| 1813 | 1813 | gb_lcd.line_irq = 0; |
| 1814 | if ( ! gb_lcd.mode_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) | |
| 1814 | if ( ! gb_lcd.mode_irq && ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) | |
| 1815 | 1815 | { |
| 1816 | 1816 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1817 | 1817 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1818 | 1818 | } |
| 1819 | 1819 | gb_lcd.hdma_possible = 0; |
| 1820 | 1820 | /* Check if we're going into VBlank next */ |
| 1821 | if ( CURLINE == 144 ) | |
| 1821 | if ( CURLINE == 144 ) | |
| 1822 | 1822 | { |
| 1823 | 1823 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1); |
| 1824 | } | |
| 1825 | else | |
| 1824 | } | |
| 1825 | else | |
| 1826 | 1826 | { |
| 1827 | 1827 | /* Internally switch to mode 2 */ |
| 1828 | 1828 | gb_lcd.mode = 2; |
| 1829 | 1829 | /* Generate lcd interrupt if requested */ |
| 1830 | 1830 | if ( ! gb_lcd.mode_irq && ( LCDSTAT & 0x20 ) && |
| 1831 | ( ( ! gb_lcd.triggering_line_irq && ! gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) | |
| 1831 | ( ( ! gb_lcd.triggering_line_irq && ! gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) | |
| 1832 | 1832 | { |
| 1833 | 1833 | gb_lcd.mode_irq = 1; |
| 1834 | 1834 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 1842 | 1842 | LCDSTAT = ( LCDSTAT & 0xFC ) | 0x02; |
| 1843 | 1843 | gb_lcd.oam_locked = LOCKED; |
| 1844 | 1844 | /* Generate lcd interrupt if requested */ |
| 1845 | if ( ( LCDSTAT & 0x20 ) && ! gb_lcd.line_irq && ! gb_lcd.line_irq ) | |
| 1845 | if ( ( LCDSTAT & 0x20 ) && ! gb_lcd.line_irq && ! gb_lcd.line_irq ) | |
| 1846 | 1846 | { |
| 1847 | 1847 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1848 | 1848 | } |
| r5932 | r5933 | |
| 1857 | 1857 | gb_lcd.oam_locked = LOCKED; |
| 1858 | 1858 | /* Generate lcd interrupt if requested */ |
| 1859 | 1859 | if ( ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) || |
| 1860 | ( !gb_lcd.mode_irq && ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq && ( LCDSTAT & 0x20 ) ) ) | |
| 1860 | ( !gb_lcd.mode_irq && ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq && ( LCDSTAT & 0x20 ) ) ) | |
| 1861 | 1861 | { |
| 1862 | 1862 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1863 | 1863 | } |
| 1864 | 1864 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1865 | 1865 | /* Check if LY==LYC STAT bit should be set */ |
| 1866 | if ( CURLINE == CMPLINE ) | |
| 1866 | if ( CURLINE == CMPLINE ) | |
| 1867 | 1867 | { |
| 1868 | 1868 | LCDSTAT |= 0x04; |
| 1869 | } | |
| 1870 | else | |
| 1869 | } | |
| 1870 | else | |
| 1871 | 1871 | { |
| 1872 | 1872 | LCDSTAT &= ~0x04; |
| 1873 | 1873 | } |
| r5932 | r5933 | |
| 1890 | 1890 | gb_lcd.start_x = -1; |
| 1891 | 1891 | break; |
| 1892 | 1892 | case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ |
| 1893 | if ( CURLINE == 144 ) | |
| 1893 | if ( CURLINE == 144 ) | |
| 1894 | 1894 | { |
| 1895 | 1895 | /* Trigger VBlank interrupt */ |
| 1896 | 1896 | cputag_set_input_line( machine, "maincpu", VBL_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 1898 | 1898 | gb_lcd.mode = 1; |
| 1899 | 1899 | LCDSTAT = (LCDSTAT & 0xFC) | 0x01; |
| 1900 | 1900 | /* Trigger LCD interrupt if requested */ |
| 1901 | if ( LCDSTAT & 0x10 ) | |
| 1901 | if ( LCDSTAT & 0x10 ) | |
| 1902 | 1902 | { |
| 1903 | 1903 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1904 | } | |
| 1904 | } | |
| 1905 | 1905 | } |
| 1906 | 1906 | /* Check if LY==LYC STAT bit should be set */ |
| 1907 | if ( CURLINE == CMPLINE ) | |
| 1907 | if ( CURLINE == CMPLINE ) | |
| 1908 | 1908 | { |
| 1909 | 1909 | LCDSTAT |= 0x04; |
| 1910 | } | |
| 1911 | else | |
| 1910 | } | |
| 1911 | else | |
| 1912 | 1912 | { |
| 1913 | 1913 | LCDSTAT &= ~0x04; |
| 1914 | 1914 | } |
| 1915 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1915 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1916 | 1916 | { |
| 1917 | 1917 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1918 | 1918 | } |
| r5932 | r5933 | |
| 1923 | 1923 | gb_lcd.delayed_line_irq = gb_lcd.line_irq; |
| 1924 | 1924 | gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; |
| 1925 | 1925 | gb_lcd.line_irq = 0; |
| 1926 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1926 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1927 | 1927 | { |
| 1928 | 1928 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1929 | 1929 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1930 | 1930 | } |
| 1931 | if ( gb_lcd.current_line == 153 ) | |
| 1931 | if ( gb_lcd.current_line == 153 ) | |
| 1932 | 1932 | { |
| 1933 | 1933 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1); |
| 1934 | } | |
| 1935 | else | |
| 1934 | } | |
| 1935 | else | |
| 1936 | 1936 | { |
| 1937 | 1937 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1); |
| 1938 | 1938 | } |
| 1939 | 1939 | break; |
| 1940 | 1940 | case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ |
| 1941 | 1941 | /* Check LY=LYC for line #153 */ |
| 1942 | if ( gb_lcd.delayed_line_irq ) | |
| 1942 | if ( gb_lcd.delayed_line_irq ) | |
| 1943 | 1943 | { |
| 1944 | if ( gb_lcd.triggering_line_irq ) | |
| 1944 | if ( gb_lcd.triggering_line_irq ) | |
| 1945 | 1945 | { |
| 1946 | 1946 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1947 | 1947 | } |
| 1948 | 1948 | } |
| 1949 | 1949 | gb_lcd.delayed_line_irq = gb_lcd.delayed_line_irq | gb_lcd.line_irq; |
| 1950 | if ( CURLINE == CMPLINE ) | |
| 1950 | if ( CURLINE == CMPLINE ) | |
| 1951 | 1951 | { |
| 1952 | 1952 | LCDSTAT |= 0x04; |
| 1953 | } | |
| 1954 | else | |
| 1953 | } | |
| 1954 | else | |
| 1955 | 1955 | { |
| 1956 | 1956 | LCDSTAT &= ~0x04; |
| 1957 | 1957 | } |
| r5932 | r5933 | |
| 1962 | 1962 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_1); |
| 1963 | 1963 | break; |
| 1964 | 1964 | case GB_LCD_STATE_LY00_M1_1: |
| 1965 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1965 | if ( ! gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1966 | 1966 | { |
| 1967 | 1967 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1968 | 1968 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 1970 | 1970 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_2); |
| 1971 | 1971 | break; |
| 1972 | 1972 | case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ |
| 1973 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1973 | if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq ) | |
| 1974 | 1974 | { |
| 1975 | 1975 | gb_lcd.line_irq = gb_lcd.triggering_line_irq; |
| 1976 | 1976 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 1977 | 1977 | } |
| 1978 | if ( CURLINE == CMPLINE ) | |
| 1978 | if ( CURLINE == CMPLINE ) | |
| 1979 | 1979 | { |
| 1980 | 1980 | LCDSTAT |= 0x04; |
| 1981 | } | |
| 1982 | else | |
| 1981 | } | |
| 1982 | else | |
| 1983 | 1983 | { |
| 1984 | 1984 | LCDSTAT &= ~0x04; |
| 1985 | 1985 | } |
| r5932 | r5933 | |
| 1991 | 1991 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M2); |
| 1992 | 1992 | break; |
| 1993 | 1993 | } |
| 1994 | } | |
| 1995 | else | |
| 1994 | } | |
| 1995 | else | |
| 1996 | 1996 | { |
| 1997 | 1997 | gb_increment_scanline(); |
| 1998 | if ( gb_lcd.current_line < 144 ) | |
| 1998 | if ( gb_lcd.current_line < 144 ) | |
| 1999 | 1999 | { |
| 2000 | 2000 | update_scanline( machine ); |
| 2001 | 2001 | } |
| r5932 | r5933 | |
| 2003 | 2003 | } |
| 2004 | 2004 | } |
| 2005 | 2005 | |
| 2006 | static void gb_lcd_switch_on( running_machine *machine ) | |
| 2006 | static void gb_lcd_switch_on( running_machine *machine ) | |
| 2007 | 2007 | { |
| 2008 | 2008 | gb_lcd.current_line = 0; |
| 2009 | 2009 | gb_lcd.previous_line = 153; |
| r5932 | r5933 | |
| 2013 | 2013 | gb_lcd.mode = 0; |
| 2014 | 2014 | gb_lcd.oam_locked = LOCKED; /* TODO: Investigate whether this OAM locking is correct. */ |
| 2015 | 2015 | /* Check for LY=LYC coincidence */ |
| 2016 | if ( CURLINE == CMPLINE ) | |
| 2016 | if ( CURLINE == CMPLINE ) | |
| 2017 | 2017 | { |
| 2018 | 2018 | LCDSTAT |= 0x04; |
| 2019 | 2019 | /* Generate lcd interrupt if requested */ |
| 2020 | if ( LCDSTAT & 0x40 ) | |
| 2020 | if ( LCDSTAT & 0x40 ) | |
| 2021 | 2021 | { |
| 2022 | 2022 | cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 2023 | 2023 | } |
| r5932 | r5933 | |
| 2026 | 2026 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 80), GB_LCD_STATE_LYXX_M3); |
| 2027 | 2027 | } |
| 2028 | 2028 | |
| 2029 | READ8_HANDLER( gb_video_r ) | |
| 2029 | READ8_HANDLER( gb_video_r ) | |
| 2030 | 2030 | { |
| 2031 | 2031 | return gb_vid_regs[offset]; |
| 2032 | 2032 | } |
| 2033 | 2033 | |
| 2034 | READ8_HANDLER( gb_vram_r ) | |
| 2034 | READ8_HANDLER( gb_vram_r ) | |
| 2035 | 2035 | { |
| 2036 | 2036 | return ( gb_lcd.vram_locked == LOCKED ) ? 0xFF : gb_vram_ptr[offset]; |
| 2037 | 2037 | } |
| 2038 | 2038 | |
| 2039 | WRITE8_HANDLER( gb_vram_w ) | |
| 2039 | WRITE8_HANDLER( gb_vram_w ) | |
| 2040 | 2040 | { |
| 2041 | if ( gb_lcd.vram_locked == LOCKED ) | |
| 2041 | if ( gb_lcd.vram_locked == LOCKED ) | |
| 2042 | 2042 | { |
| 2043 | 2043 | return; |
| 2044 | 2044 | } |
| 2045 | 2045 | gb_vram_ptr[offset] = data; |
| 2046 | 2046 | } |
| 2047 | 2047 | |
| 2048 | READ8_HANDLER( gb_oam_r ) | |
| 2048 | READ8_HANDLER( gb_oam_r ) | |
| 2049 | 2049 | { |
| 2050 | 2050 | return ( gb_lcd.oam_locked == LOCKED ) ? 0xFF : gb_oam[offset]; |
| 2051 | 2051 | } |
| 2052 | 2052 | |
| 2053 | WRITE8_HANDLER( gb_oam_w ) | |
| 2053 | WRITE8_HANDLER( gb_oam_w ) | |
| 2054 | 2054 | { |
| 2055 | if ( gb_lcd.oam_locked == LOCKED || offset >= 0xa0 ) | |
| 2055 | if ( gb_lcd.oam_locked == LOCKED || offset >= 0xa0 ) | |
| 2056 | 2056 | { |
| 2057 | 2057 | return; |
| 2058 | 2058 | } |
| 2059 | 2059 | gb_oam[offset] = data; |
| 2060 | 2060 | } |
| 2061 | 2061 | |
| 2062 | WRITE8_HANDLER ( gb_video_w ) | |
| 2062 | WRITE8_HANDLER ( gb_video_w ) | |
| 2063 | 2063 | { |
| 2064 | switch (offset) | |
| 2064 | switch (offset) | |
| 2065 | 2065 | { |
| 2066 | 2066 | case 0x00: /* LCDC - LCD Control */ |
| 2067 | 2067 | gb_chrgen = gb_vram + ((data & 0x10) ? 0x0000 : 0x0800); |
| r5932 | r5933 | |
| 2069 | 2069 | gb_bgdtab = gb_vram + ((data & 0x08) ? 0x1C00 : 0x1800 ); |
| 2070 | 2070 | gb_wndtab = gb_vram + ((data & 0x40) ? 0x1C00 : 0x1800 ); |
| 2071 | 2071 | /* if LCD controller is switched off, set STAT and LY to 00 */ |
| 2072 | if ( ! ( data & 0x80 ) ) | |
| 2072 | if ( ! ( data & 0x80 ) ) | |
| 2073 | 2073 | { |
| 2074 | 2074 | LCDSTAT &= ~0x03; |
| 2075 | 2075 | CURLINE = 0; |
| r5932 | r5933 | |
| 2077 | 2077 | gb_lcd.vram_locked = UNLOCKED; |
| 2078 | 2078 | } |
| 2079 | 2079 | /* If LCD is being switched on */ |
| 2080 | if ( !( LCDCONT & 0x80 ) && ( data & 0x80 ) ) | |
| 2080 | if ( !( LCDCONT & 0x80 ) && ( data & 0x80 ) ) | |
| 2081 | 2081 | { |
| 2082 | 2082 | gb_lcd_switch_on( space->machine ); |
| 2083 | 2083 | } |
| r5932 | r5933 | |
| 2085 | 2085 | case 0x01: /* STAT - LCD Status */ |
| 2086 | 2086 | data = 0x80 | (data & 0x78) | (LCDSTAT & 0x07); |
| 2087 | 2087 | /* |
| 2088 | Check for the STAT bug: | |
| 2089 | Writing to STAT when the LCD controller is active causes a STAT | |
| 2090 | interrupt to be triggered. | |
| 2091 | */ | |
| 2092 | if ( LCDCONT & 0x80 ) | |
| 2088 | Check for the STAT bug: | |
| 2089 | Writing to STAT when the LCD controller is active causes a STAT | |
| 2090 | interrupt to be triggered. | |
| 2091 | */ | |
| 2092 | if ( LCDCONT & 0x80 ) | |
| 2093 | 2093 | { |
| 2094 | 2094 | /* Triggers seen so far: |
| 2095 | - 0x40 -> 0x00 - trigger | |
| 2096 | - 0x00 -> 0x08 - trigger | |
| 2097 | - 0x08 -> 0x00 - don't trigger | |
| 2098 | - 0x00 -> 0x20 (mode 3) - trigger | |
| 2099 | - 0x00 -> 0x60 (mode 2) - don't trigger | |
| 2100 | - 0x20 -> 0x60 (mode 3) - trigger | |
| 2101 | - 0x20 -> 0x40 (mode 3) - trigger | |
| 2102 | - 0x40 -> 0x20 (mode 2) - don't trigger | |
| 2103 | - 0x40 -> 0x08 (mode 0) - don't trigger | |
| 2104 | - 0x00 -> 0x40 - trigger only if LY==LYC | |
| 2105 | - 0x20 -> 0x00/0x08/0x10/0x20/0x40 (mode 2, after m2int) - don't trigger | |
| 2106 | - 0x20 -> 0x00/0x08/0x10/0x20/0x40 (mode 3, after m2int) - don't trigger | |
| 2107 | */ | |
| 2095 | - 0x40 -> 0x00 - trigger | |
| 2096 | - 0x00 -> 0x08 - trigger | |
| 2097 | - 0x08 -> 0x00 - don't trigger | |
| 2098 | - 0x00 -> 0x20 (mode 3) - trigger | |
| 2099 | - 0x00 -> 0x60 (mode 2) - don't trigger | |
| 2100 | - 0x20 -> 0x60 (mode 3) - trigger | |
| 2101 | - 0x20 -> 0x40 (mode 3) - trigger | |
| 2102 | - 0x40 -> 0x20 (mode 2) - don't trigger | |
| 2103 | - 0x40 -> 0x08 (mode 0) - don't trigger | |
| 2104 | - 0x00 -> 0x40 - trigger only if LY==LYC | |
| 2105 | - 0x20 -> 0x00/0x08/0x10/0x20/0x40 (mode 2, after m2int) - don't trigger | |
| 2106 | - 0x20 -> 0x00/0x08/0x10/0x20/0x40 (mode 3, after m2int) - don't trigger | |
| 2107 | */ | |
| 2108 | 2108 | if ( ! gb_lcd.mode_irq && ( ( gb_lcd.mode == 1 ) || |
| 2109 | 2109 | ( ( LCDSTAT & 0x40 ) && ! ( data & 0x68 ) ) || |
| 2110 | 2110 | ( ! ( LCDSTAT & 0x40 ) && ( data & 0x40 ) && ( LCDSTAT & 0x04 ) ) || |
| 2111 | 2111 | ( ! ( LCDSTAT & 0x48 ) && ( data & 0x08 ) ) || |
| 2112 | 2112 | ( ( LCDSTAT & 0x60 ) == 0x00 && ( data & 0x60 ) == 0x20 ) || |
| 2113 | 2113 | ( ( LCDSTAT & 0x60 ) == 0x20 && ( data & 0x40 ) ) |
| 2114 | ) ) | |
| 2114 | ) ) | |
| 2115 | 2115 | { |
| 2116 | 2116 | cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 2117 | 2117 | } |
| 2118 | 2118 | /* |
| 2119 | - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger | |
| 2120 | - 0x20 -> 0x00/0x10/0x20/0x40 (mode 0, after m2int) - trigger (stat bug) | |
| 2121 | - 0x00 -> 0xXX (mode 0) - trigger stat bug | |
| 2122 | */ | |
| 2123 | if ( gb_lcd.mode_irq && gb_lcd.mode == 0 ) | |
| 2119 | - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger | |
| 2120 | - 0x20 -> 0x00/0x10/0x20/0x40 (mode 0, after m2int) - trigger (stat bug) | |
| 2121 | - 0x00 -> 0xXX (mode 0) - trigger stat bug | |
| 2122 | */ | |
| 2123 | if ( gb_lcd.mode_irq && gb_lcd.mode == 0 ) | |
| 2124 | 2124 | { |
| 2125 | 2125 | cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 2126 | 2126 | } |
| r5932 | r5933 | |
| 2129 | 2129 | case 0x04: /* LY - LCD Y-coordinate */ |
| 2130 | 2130 | return; |
| 2131 | 2131 | case 0x05: /* LYC */ |
| 2132 | if ( CMPLINE != data ) | |
| 2132 | if ( CMPLINE != data ) | |
| 2133 | 2133 | { |
| 2134 | if ( CURLINE == data ) | |
| 2134 | if ( CURLINE == data ) | |
| 2135 | 2135 | { |
| 2136 | if ( gb_lcd.state != GB_LCD_STATE_LYXX_M0_INC && gb_lcd.state != GB_LCD_STATE_LY9X_M1_INC ) | |
| 2136 | if ( gb_lcd.state != GB_LCD_STATE_LYXX_M0_INC && gb_lcd.state != GB_LCD_STATE_LY9X_M1_INC ) | |
| 2137 | 2137 | { |
| 2138 | 2138 | LCDSTAT |= 0x04; |
| 2139 | 2139 | /* Generate lcd interrupt if requested */ |
| 2140 | if ( LCDSTAT & 0x40 ) | |
| 2140 | if ( LCDSTAT & 0x40 ) | |
| 2141 | 2141 | { |
| 2142 | 2142 | cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 2143 | 2143 | } |
| 2144 | 2144 | } |
| 2145 | } | |
| 2146 | else | |
| 2145 | } | |
| 2146 | else | |
| 2147 | 2147 | { |
| 2148 | 2148 | LCDSTAT &= 0xFB; |
| 2149 | 2149 | gb_lcd.triggering_line_irq = 0; |
| r5932 | r5933 | |
| 2166 | 2166 | gb_bpal[3] = (data & 0xC0) >> 6; |
| 2167 | 2167 | break; |
| 2168 | 2168 | case 0x08: /* OBP0 - Object Palette 0 */ |
| 2169 | // | |
| 2169 | // update_scanline( machine ); | |
| 2170 | 2170 | gb_spal0[0] = data & 0x3; |
| 2171 | 2171 | gb_spal0[1] = (data & 0xC) >> 2; |
| 2172 | 2172 | gb_spal0[2] = (data & 0x30) >> 4; |
| 2173 | 2173 | gb_spal0[3] = (data & 0xC0) >> 6; |
| 2174 | 2174 | break; |
| 2175 | 2175 | case 0x09: /* OBP1 - Object Palette 1 */ |
| 2176 | // | |
| 2176 | // update_scanline( machine ); | |
| 2177 | 2177 | gb_spal1[0] = data & 0x3; |
| 2178 | 2178 | gb_spal1[1] = (data & 0xC) >> 2; |
| 2179 | 2179 | gb_spal1[2] = (data & 0x30) >> 4; |
| r5932 | r5933 | |
| 2191 | 2191 | gb_vid_regs[ offset ] = data; |
| 2192 | 2192 | } |
| 2193 | 2193 | |
| 2194 | READ8_HANDLER( gbc_video_r ) | |
| 2194 | READ8_HANDLER( gbc_video_r ) | |
| 2195 | 2195 | { |
| 2196 | switch( offset ) | |
| 2196 | switch( offset ) | |
| 2197 | 2197 | { |
| 2198 | 2198 | case 0x11: /* FF51 */ |
| 2199 | 2199 | case 0x12: /* FF52 */ |
| r5932 | r5933 | |
| 2202 | 2202 | return 0xFF; |
| 2203 | 2203 | case 0x29: /* FF69 */ |
| 2204 | 2204 | case 0x2B: /* FF6B */ |
| 2205 | if ( gb_lcd.pal_locked == LOCKED ) | |
| 2205 | if ( gb_lcd.pal_locked == LOCKED ) | |
| 2206 | 2206 | { |
| 2207 | 2207 | return 0xFF; |
| 2208 | 2208 | } |
| r5932 | r5933 | |
| 2211 | 2211 | return gb_vid_regs[offset]; |
| 2212 | 2212 | } |
| 2213 | 2213 | |
| 2214 | WRITE8_HANDLER ( gbc_video_w ) | |
| 2214 | WRITE8_HANDLER ( gbc_video_w ) | |
| 2215 | 2215 | { |
| 2216 | 2216 | static UINT16 BP = 0, OP = 0; |
| 2217 | 2217 | |
| 2218 | switch( offset ) | |
| 2218 | switch( offset ) | |
| 2219 | 2219 | { |
| 2220 | 2220 | case 0x00: /* LCDC - LCD Control */ |
| 2221 | 2221 | gb_chrgen = gb_vram + ((data & 0x10) ? 0x0000 : 0x0800); |
| r5932 | r5933 | |
| 2226 | 2226 | gb_wndtab = gb_vram + ((data & 0x40) ? 0x1C00 : 0x1800); |
| 2227 | 2227 | gbc_wndtab = gb_vram + ((data & 0x40) ? 0x3C00 : 0x3800); |
| 2228 | 2228 | /* if LCD controller is switched off, set STAT to 00 */ |
| 2229 | if ( ! ( data & 0x80 ) ) | |
| 2229 | if ( ! ( data & 0x80 ) ) | |
| 2230 | 2230 | { |
| 2231 | 2231 | LCDSTAT &= ~0x03; |
| 2232 | 2232 | CURLINE = 0; |
| r5932 | r5933 | |
| 2235 | 2235 | gb_lcd.pal_locked = UNLOCKED; |
| 2236 | 2236 | } |
| 2237 | 2237 | /* If LCD is being switched on */ |
| 2238 | if ( !( LCDCONT & 0x80 ) && ( data & 0x80 ) ) | |
| 2238 | if ( !( LCDCONT & 0x80 ) && ( data & 0x80 ) ) | |
| 2239 | 2239 | { |
| 2240 | 2240 | gb_lcd_switch_on( space->machine ); |
| 2241 | 2241 | } |
| 2242 | 2242 | break; |
| 2243 | 2243 | case 0x01: /* STAT - LCD Status */ |
| 2244 | 2244 | data = 0x80 | (data & 0x78) | (LCDSTAT & 0x07); |
| 2245 | if ( LCDCONT & 0x80 ) | |
| 2245 | if ( LCDCONT & 0x80 ) | |
| 2246 | 2246 | { |
| 2247 | 2247 | /* |
| 2248 | - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger | |
| 2249 | */ | |
| 2250 | if ( gb_lcd.mode_irq && gb_lcd.mode == 0 && ( LCDSTAT & 0x28 ) == 0x20 && ( data & 0x08 ) ) | |
| 2248 | - 0x20 -> 0x08/0x18/0x28/0x48 (mode 0, after m2int) - trigger | |
| 2249 | */ | |
| 2250 | if ( gb_lcd.mode_irq && gb_lcd.mode == 0 && ( LCDSTAT & 0x28 ) == 0x20 && ( data & 0x08 ) ) | |
| 2251 | 2251 | { |
| 2252 | 2252 | cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 2253 | 2253 | } |
| 2254 | 2254 | /* Check if line irqs are being disabled */ |
| 2255 | if ( ! ( data & 0x40 ) ) | |
| 2255 | if ( ! ( data & 0x40 ) ) | |
| 2256 | 2256 | { |
| 2257 | 2257 | gb_lcd.delayed_line_irq = 0; |
| 2258 | 2258 | } |
| 2259 | 2259 | /* Check if line irqs are being enabled */ |
| 2260 | if ( ! ( LCDSTAT & 0x40 ) && ( data & 0x40 ) ) | |
| 2260 | if ( ! ( LCDSTAT & 0x40 ) && ( data & 0x40 ) ) | |
| 2261 | 2261 | { |
| 2262 | if ( CMPLINE == CURLINE ) | |
| 2262 | if ( CMPLINE == CURLINE ) | |
| 2263 | 2263 | { |
| 2264 | 2264 | gb_lcd.line_irq = 1; |
| 2265 | 2265 | cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 2268 | 2268 | } |
| 2269 | 2269 | break; |
| 2270 | 2270 | case 0x05: /* LYC */ |
| 2271 | if ( CMPLINE != data ) | |
| 2271 | if ( CMPLINE != data ) | |
| 2272 | 2272 | { |
| 2273 | 2273 | if ( ( gb_lcd.state != GB_LCD_STATE_LYXX_M0_PRE_INC && CURLINE == data ) || |
| 2274 | ( gb_lcd.state == GB_LCD_STATE_LYXX_M0_INC && gb_lcd.triggering_line_irq ) ) | |
| 2274 | ( gb_lcd.state == GB_LCD_STATE_LYXX_M0_INC && gb_lcd.triggering_line_irq ) ) | |
| 2275 | 2275 | { |
| 2276 | 2276 | LCDSTAT |= 0x04; |
| 2277 | 2277 | /* Generate lcd interrupt if requested */ |
| 2278 | if ( LCDSTAT & 0x40 ) | |
| 2278 | if ( LCDSTAT & 0x40 ) | |
| 2279 | 2279 | { |
| 2280 | 2280 | cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE ); |
| 2281 | 2281 | } |
| 2282 | } | |
| 2283 | else | |
| 2282 | } | |
| 2283 | else | |
| 2284 | 2284 | { |
| 2285 | 2285 | LCDSTAT &= 0xFB; |
| 2286 | 2286 | gb_lcd.triggering_line_irq = 0; |
| r5932 | r5933 | |
| 2337 | 2337 | { |
| 2338 | 2338 | /* General DMA */ |
| 2339 | 2339 | gbc_hdma( space->machine, ((data & 0x7F) + 1) * 0x10 ); |
| 2340 | // | |
| 2340 | // cpunum_set_reg( 0, LR35902_DMA_CYCLES, 4 + ( ( ( data & 0x7F ) + 1 ) * 32 ) ); | |
| 2341 | 2341 | data = 0xff; |
| 2342 | 2342 | } |
| 2343 | 2343 | } |
| r5932 | r5933 | |
| 2348 | 2348 | data &= 0x7f; |
| 2349 | 2349 | gb_vid_regs[offset] = data; |
| 2350 | 2350 | /* Check if HDMA should be immediately performed */ |
| 2351 | if ( gb_lcd.hdma_possible ) | |
| 2351 | if ( gb_lcd.hdma_possible ) | |
| 2352 | 2352 | { |
| 2353 | 2353 | gbc_hdma( space->machine, 0x10 ); |
| 2354 | // | |
| 2354 | // cpunum_set_reg( 0, LR35902_DMA_CYCLES, 36 ); | |
| 2355 | 2355 | gb_lcd.hdma_possible = 0; |
| 2356 | 2356 | } |
| 2357 | 2357 | } |
| r5932 | r5933 | |
| 2359 | 2359 | case 0x28: /* BCPS - Background palette specification */ |
| 2360 | 2360 | break; |
| 2361 | 2361 | case 0x29: /* BCPD - background palette data */ |
| 2362 | if ( gb_lcd.pal_locked == LOCKED ) | |
| 2362 | if ( gb_lcd.pal_locked == LOCKED ) | |
| 2363 | 2363 | { |
| 2364 | 2364 | return; |
| 2365 | 2365 | } |
| r5932 | r5933 | |
| 2378 | 2378 | case 0x2A: /* OCPS - Object palette specification */ |
| 2379 | 2379 | break; |
| 2380 | 2380 | case 0x2B: /* OCPD - Object palette data */ |
| 2381 | if ( gb_lcd.pal_locked == LOCKED ) | |
| 2381 | if ( gb_lcd.pal_locked == LOCKED ) | |
| 2382 | 2382 | { |
| 2383 | 2383 | return; |
| 2384 | 2384 | } |
| r5932 | r5933 | |
|---|---|---|
| 31 | 31 | |
| 32 | 32 | PALETTE_INIT( pocketc ) |
| 33 | 33 | { |
| 34 | UINT8 i=0, r, b, g, color_count = 6; | |
| 34 | UINT8 i=0, r, b, g, color_count = 6; | |
| 35 | 35 | |
| 36 | 36 | machine->colortable = colortable_alloc(machine, color_count); |
| 37 | 37 |
| r5932 | r5933 | |
|---|---|---|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | // if (byte1 & Z88_SCR_HW_FLS) | |
| 205 | // { | |
| 206 | // if (flash_invert) | |
| 207 | // { | |
| 208 | // pen1 = pen0; | |
| 209 | // } | |
| 210 | // } | |
| 204 | // if (byte1 & Z88_SCR_HW_FLS) | |
| 205 | // { | |
| 206 | // if (flash_invert) | |
| 207 | // { | |
| 208 | // pen1 = pen0; | |
| 209 | // } | |
| 210 | // } | |
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | /* hi-res? */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | |
| 2 | 2 | /************************************************************************ |
| 3 | ||
| 3 | saa505x | |
| 4 | 4 | |
| 5 | ||
| 5 | MESS Driver By: | |
| 6 | 6 | |
| 7 | Gordon Jefferyes | |
| 8 | mess_bbc@gjeffery.dircon.co.uk | |
| 7 | Gordon Jefferyes | |
| 8 | mess_bbc@gjeffery.dircon.co.uk | |
| 9 | 9 | |
| 10 | 10 | ************************************************************************/ |
| 11 | 11 |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _______ _______ | |
| 10 | RD 1 ---| \/ |--- 24 Vdd | |
| 11 | _RESET 2 ---| |--- 23 R LUM | |
| 12 | _CON 3 ---| |--- 22 G LUM | |
| 13 | B CHR 4 ---| |--- 21 GD | |
| 14 | B LUM 5 ---| |--- 20 BLG LUM | |
| 15 | BKG 6 ---| CDP1862C |--- 19 G CHR | |
| 16 | _LD CLK 7 ---| top view |--- 18 R CHR | |
| 17 | STP 8 ---| |--- 17 BKG CHR | |
| 18 | CLK OUT 9 ---| |--- 16 BD | |
| 19 | _SYNC 10 ---| |--- 15 BURST | |
| 20 | LUM IN 11 ---| |--- 14 _XTAL | |
| 21 | Vss 12 ---|________________|--- 13 XTAL | |
| 9 | _______ _______ | |
| 10 | RD 1 ---| \/ |--- 24 Vdd | |
| 11 | _RESET 2 ---| |--- 23 R LUM | |
| 12 | _CON 3 ---| |--- 22 G LUM | |
| 13 | B CHR 4 ---| |--- 21 GD | |
| 14 | B LUM 5 ---| |--- 20 BLG LUM | |
| 15 | BKG 6 ---| CDP1862C |--- 19 G CHR | |
| 16 | _LD CLK 7 ---| top view |--- 18 R CHR | |
| 17 | STP 8 ---| |--- 17 BKG CHR | |
| 18 | CLK OUT 9 ---| |--- 16 BD | |
| 19 | _SYNC 10 ---| |--- 15 BURST | |
| 20 | LUM IN 11 ---| |--- 14 _XTAL | |
| 21 | Vss 12 ---|________________|--- 13 XTAL | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | ||
| 24 | http://homepage.mac.com/ruske/cosmacelf/cdp1862.pdf | |
| 25 | 25 | |
| 26 | 26 | **********************************************************************/ |
| 27 | 27 | |
| r5932 | r5933 | |
| 62 | 62 | double lum_b; /* blue luminance resistor value */ |
| 63 | 63 | double lum_g; /* green luminance resistor value */ |
| 64 | 64 | double lum_bkg; /* background luminance resistor value */ |
| 65 | ||
| 65 | ||
| 66 | 66 | double chr_r; /* red chrominance resistor value */ |
| 67 | 67 | double chr_b; /* blue chrominance resistor value */ |
| 68 | 68 | double chr_g; /* green chrominance resistor value */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | SGI "Newport" graphics board used in the Indy and some Indigo2s | |
| 3 | 3 | |
| 4 | Newport is modular, consisting of the following custom chips: | |
| 5 | - REX3: Raster Engine, which is basically a blitter which can also draw antialiased lines. | |
| 6 | REX also acts as the interface to the rest of the system - all the other chips on | |
| 7 | a Newport board are accessed through it. | |
| 8 | - RB2: Frame buffer input controller | |
| 9 | - RO1: Frame buffer output controller | |
| 10 | - XMAP9: Final display generator | |
| 11 | - CMAP: Palette mapper | |
| 12 | - VC2: Video timing controller / CRTC | |
| 4 | Newport is modular, consisting of the following custom chips: | |
| 5 | - REX3: Raster Engine, which is basically a blitter which can also draw antialiased lines. | |
| 6 | REX also acts as the interface to the rest of the system - all the other chips on | |
| 7 | a Newport board are accessed through it. | |
| 8 | - RB2: Frame buffer input controller | |
| 9 | - RO1: Frame buffer output controller | |
| 10 | - XMAP9: Final display generator | |
| 11 | - CMAP: Palette mapper | |
| 12 | - VC2: Video timing controller / CRTC | |
| 13 | 13 | |
| 14 | Taken from the Linux Newport driver, slave addresses for Newport devices are: | |
| 15 | VC2 0 | |
| 16 | Both CMAPs 1 | |
| 17 | CMAP 0 2 | |
| 18 | CMAP 1 3 | |
| 19 | Both XMAPs 4 | |
| 20 | XMAP 0 5 | |
| 21 | XMAP 1 6 | |
| 22 | RAMDAC 7 | |
| 23 | VIDEO (CC1) 8 | |
| 24 | VIDEO (AB1) 9 | |
| 14 | Taken from the Linux Newport driver, slave addresses for Newport devices are: | |
| 15 | VC2 0 | |
| 16 | Both CMAPs 1 | |
| 17 | CMAP 0 2 | |
| 18 | CMAP 1 3 | |
| 19 | Both XMAPs 4 | |
| 20 | XMAP 0 5 | |
| 21 | XMAP 1 6 | |
| 22 | RAMDAC 7 | |
| 23 | VIDEO (CC1) 8 | |
| 24 | VIDEO (AB1) 9 | |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | #include "driver.h" |
| r5932 | r5933 | |
| 589 | 589 | UINT32 nTemp; |
| 590 | 590 | running_machine *machine = space->machine; |
| 591 | 591 | |
| 592 | // if( offset >= ( 0x0800 / 4 ) ) | |
| 593 | // { | |
| 594 | // verboselog(machine, 2, "%08x:\n", 0xbf0f0000 + ( offset << 2 ) ); | |
| 595 | // } | |
| 592 | // if( offset >= ( 0x0800 / 4 ) ) | |
| 593 | // { | |
| 594 | // verboselog(machine, 2, "%08x:\n", 0xbf0f0000 + ( offset << 2 ) ); | |
| 595 | // } | |
| 596 | 596 | switch( offset ) |
| 597 | 597 | { |
| 598 | 598 | case 0x0000/4: |
| r5932 | r5933 | |
| 894 | 894 | nX = nStartX; |
| 895 | 895 | nY = nStartY; |
| 896 | 896 | verboselog(machine, 3, "Tux Logo Draw: %04x, %04x = %08x\n", nX, nY, nCMAP0_Palette[ ( nREX3_HostDataPortMSW & 0xff000000 ) >> 24 ] ); |
| 897 | // | |
| 897 | // nREX3_Kludge_SkipLine = 1; | |
| 898 | 898 | nREX3_BresOctInc1 = 0; |
| 899 | 899 | video_base[ nY*(1280+64) + nX ] = nCMAP0_Palette[ ( nREX3_HostDataPortMSW & 0xff000000 ) >> 24 ]; |
| 900 | 900 | nX++; |
| r5932 | r5933 | |
| 1143 | 1143 | break; |
| 1144 | 1144 | } |
| 1145 | 1145 | nREX3_DrawMode1 = data; |
| 1146 | // if( offset >= ( 0x800 / 4 ) ) | |
| 1147 | // { | |
| 1148 | // DoREX3Command(); | |
| 1149 | // } | |
| 1146 | // if( offset >= ( 0x800 / 4 ) ) | |
| 1147 | // { | |
| 1148 | // DoREX3Command(); | |
| 1149 | // } | |
| 1150 | 1150 | break; |
| 1151 | 1151 | case 0x0004/4: |
| 1152 | 1152 | verboselog(machine, 2, "REX3 Draw Mode 0 Write: %08x\n", data ); |
| r5932 | r5933 | |
| 1563 | 1563 | } |
| 1564 | 1564 | verboselog(machine, 2, " DCB Reg Select Adr: %d\n", ( data & 0x00000070 ) >> 4 ); |
| 1565 | 1565 | verboselog(machine, 2, " DCB Slave Address: %d\n", ( data & 0x00000780 ) >> 7 ); |
| 1566 | // verboselog(machine, 2, " Use Sync XFer ACK: %d\n", ( data & 0x00000800 ) >> 11 ); | |
| 1567 | // verboselog(machine, 2, " Use Async XFer ACK: %d\n", ( data & 0x00001000 ) >> 12 ); | |
| 1568 | // verboselog(machine, 2, " GIO CLK Cycle Width: %d\n", ( data & 0x0003e000 ) >> 13 ); | |
| 1569 | // verboselog(machine, 2, " GIO CLK Cycle Hold: %d\n", ( data & 0x007c0000 ) >> 18 ); | |
| 1570 | // verboselog(machine, 2, " GIO CLK Cycle Setup: %d\n", ( data & 0x0f800000 ) >> 23 ); | |
| 1571 | // verboselog(machine, 2, " Swap Byte Ordering: %d\n", ( data & 0x10000000 ) >> 28 ); | |
| 1566 | // verboselog(machine, 2, " Use Sync XFer ACK: %d\n", ( data & 0x00000800 ) >> 11 ); | |
| 1567 | // verboselog(machine, 2, " Use Async XFer ACK: %d\n", ( data & 0x00001000 ) >> 12 ); | |
| 1568 | // verboselog(machine, 2, " GIO CLK Cycle Width: %d\n", ( data & 0x0003e000 ) >> 13 ); | |
| 1569 | // verboselog(machine, 2, " GIO CLK Cycle Hold: %d\n", ( data & 0x007c0000 ) >> 18 ); | |
| 1570 | // verboselog(machine, 2, " GIO CLK Cycle Setup: %d\n", ( data & 0x0f800000 ) >> 23 ); | |
| 1571 | // verboselog(machine, 2, " Swap Byte Ordering: %d\n", ( data & 0x10000000 ) >> 28 ); | |
| 1572 | 1572 | nREX3_DCBRegSelect = ( data & 0x00000070 ) >> 4; |
| 1573 | 1573 | nREX3_DCBSlvSelect = ( data & 0x00000780 ) >> 7; |
| 1574 | 1574 | nREX3_DCBMode = data & 0x1fffffff; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Video Graphics Adapter (VGA) section | |
| 4 | 4 | |
| 5 | Nathan Woods npwoods@mess.org | |
| 6 | Peter Trauner PeT mess@utanet.at | |
| 5 | Nathan Woods npwoods@mess.org | |
| 6 | Peter Trauner PeT mess@utanet.at | |
| 7 | 7 | |
| 8 | This code takes care of installing the various VGA memory and port | |
| 9 | handlers | |
| 8 | This code takes care of installing the various VGA memory and port | |
| 9 | handlers | |
| 10 | 10 | |
| 11 | The VGA standard is compatible with MDA, CGA, Hercules, EGA | |
| 12 | (mda, cga, hercules not real register compatible) | |
| 13 | several vga cards drive also mda, cga, ega monitors | |
| 14 | some vga cards have register compatible mda, cga, hercules modes | |
| 11 | The VGA standard is compatible with MDA, CGA, Hercules, EGA | |
| 12 | (mda, cga, hercules not real register compatible) | |
| 13 | several vga cards drive also mda, cga, ega monitors | |
| 14 | some vga cards have register compatible mda, cga, hercules modes | |
| 15 | 15 | |
| 16 | ega/vga | |
| 17 | 64k (early ega 16k) words of 32 bit memory | |
| 16 | ega/vga | |
| 17 | 64k (early ega 16k) words of 32 bit memory | |
| 18 | 18 | |
| 19 | 19 | |
| 20 | ||
| 20 | ROM declarations: | |
| 21 | 21 | |
| 22 | ||
| 22 | (oti 037 chip) | |
| 23 | 23 | ROM_LOAD("oakvga.bin", 0xc0000, 0x8000, 0x318c5f43) |
| 24 | ||
| 24 | (tseng labs famous et4000 isa vga card (oem)) | |
| 25 | 25 | ROM_LOAD("et4000b.bin", 0xc0000, 0x8000, 0xa903540d) |
| 26 | ||
| 26 | (tseng labs famous et4000 isa vga card) | |
| 27 | 27 | ROM_LOAD("et4000.bin", 0xc0000, 0x8000, 0xf01e4be0) |
| 28 | 28 | |
| 29 | 29 | ***************************************************************************/ |
| r5932 | r5933 | |
| 37 | 37 | |
| 38 | 38 | /*************************************************************************** |
| 39 | 39 | |
| 40 | ||
| 40 | Static declarations | |
| 41 | 41 | |
| 42 | 42 | ***************************************************************************/ |
| 43 | 43 | |
| r5932 | r5933 | |
| 56 | 56 | |
| 57 | 57 | /*************************************************************************** |
| 58 | 58 | |
| 59 | ||
| 59 | MachineDriver stuff | |
| 60 | 60 | |
| 61 | 61 | ***************************************************************************/ |
| 62 | 62 |
| r5932 | r5933 | |
|---|---|---|
| 1723 | 1723 | 0,0,0,0,0,0, |
| 1724 | 1724 | 0,0,0,0,0,0, |
| 1725 | 1725 | 0,0,0,0,0,0 |
| 1726 | , // 0x5c ' | |
| 1726 | , // 0x5c '?' | |
| 1727 | 1727 | 0,0,0,0,0,0, |
| 1728 | 1728 | 0,1,0,0,0,0, |
| 1729 | 1729 | 0,1,0,0,0,0, |
| r5932 | r5933 | |
|---|---|---|
| 157 | 157 | ***************************************************************************/ |
| 158 | 158 | VIDEO_UPDATE( pcw16 ) |
| 159 | 159 | { |
| 160 | unsigned char *pScanLine = (unsigned char *)mess_ram + 0x0fc00; //0x03c00; | |
| 160 | unsigned char *pScanLine = (unsigned char *)mess_ram + 0x0fc00; //0x03c00; //0x020FC00; | |
| 161 | 161 | |
| 162 | 162 | int y; |
| 163 | 163 | int x; |
| r5932 | r5933 | |
| 170 | 170 | if (pcw16_video_control & (1<<7)) |
| 171 | 171 | { |
| 172 | 172 | /* colour 0 and colour 1 need to be inverted? - what happens in mode 1 and 2 - ignored? or is bit 1 toggled, |
| 173 | ||
| 173 | or is whole lot toggled? */ | |
| 174 | 174 | |
| 175 | 175 | /* force border to be colour 1 */ |
| 176 | 176 | border_colour = pcw16_colour_palette[1]; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | SGI "Newport" graphics board used in the Indy and some Indigo2s | |
| 3 | 3 | |
| 4 | 4 | */ |
| 5 | 5 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | pc_vga.h | |
| 4 | 4 | |
| 5 | ||
| 5 | PC standard VGA adaptor | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 73 | 73 | (mda/hgc lines bit 8 not identical to ega/vga) |
| 74 | 74 | |
| 75 | 75 | standard ega/vga dipswitches |
| 76 | 00000000 320x200 | |
| 77 | 00000001 640x200 hanging | |
| 78 | 00000010 640x200 hanging | |
| 79 | 00000011 640x200 hanging | |
| 76 | 00000000 320x200 | |
| 77 | 00000001 640x200 hanging | |
| 78 | 00000010 640x200 hanging | |
| 79 | 00000011 640x200 hanging | |
| 80 | 80 | |
| 81 | 00000100 640x350 hanging | |
| 82 | 00000101 640x350 hanging EGA mono | |
| 83 | 00000110 320x200 | |
| 84 | 00000111 640x200 | |
| 81 | 00000100 640x350 hanging | |
| 82 | 00000101 640x350 hanging EGA mono | |
| 83 | 00000110 320x200 | |
| 84 | 00000111 640x200 | |
| 85 | 85 | |
| 86 | 00001000 640x200 | |
| 87 | 00001001 640x200 | |
| 88 | 00001010 720x350 partial visible | |
| 89 | 00001011 720x350 partial visible | |
| 86 | 00001000 640x200 | |
| 87 | 00001001 640x200 | |
| 88 | 00001010 720x350 partial visible | |
| 89 | 00001011 720x350 partial visible | |
| 90 | 90 | |
| 91 | 00001100 320x200 | |
| 92 | 00001101 320x200 | |
| 93 | 00001110 320x200 | |
| 94 | 00001111 320x200 | |
| 91 | 00001100 320x200 | |
| 92 | 00001101 320x200 | |
| 93 | 00001110 320x200 | |
| 94 | 00001111 320x200 | |
| 95 | 95 | |
| 96 | 96 | */ |
| 97 | 97 |
| r5932 | r5933 | |
|---|---|---|
| 222 | 222 | |
| 223 | 223 | Nick_CalcVisibleClocks(ENTERPRISE_SCREEN_WIDTH); |
| 224 | 224 | |
| 225 | // Nick.BORDER = 0; | |
| 226 | // Nick.FIXBIAS = 0; | |
| 225 | // Nick.BORDER = 0; | |
| 226 | // Nick.FIXBIAS = 0; | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /* write border colour */ |
| r5932 | r5933 | |
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | // if (Nick.LPT.RM & NICK_RM_ALTIND0) | |
| 385 | // { | |
| 386 | // if (Data & 0x040) | |
| 387 | // { | |
| 388 | // PenOffset|=0x04; | |
| 389 | // } | |
| 390 | // } | |
| 384 | // if (Nick.LPT.RM & NICK_RM_ALTIND0) | |
| 385 | // { | |
| 386 | // if (Data & 0x040) | |
| 387 | // { | |
| 388 | // PenOffset|=0x04; | |
| 389 | // } | |
| 390 | // } | |
| 391 | 391 | |
| 392 | 392 | |
| 393 | 393 | |
| r5932 | r5933 | |
| 536 | 536 | } |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | // if (Nick.LPT.RM & NICK_RM_ALTIND0) | |
| 540 | // { | |
| 541 | // if (Data & 0x040) | |
| 542 | // { | |
| 543 | // PenOffset|=0x04; | |
| 544 | // } | |
| 545 | // } | |
| 539 | // if (Nick.LPT.RM & NICK_RM_ALTIND0) | |
| 540 | // { | |
| 541 | // if (Data & 0x040) | |
| 542 | // { | |
| 543 | // PenOffset|=0x04; | |
| 544 | // } | |
| 545 | // } | |
| 546 | 546 | |
| 547 | 547 | |
| 548 | 548 | |
| r5932 | r5933 | |
| 934 | 934 | /* scan line count for this LPT */ |
| 935 | 935 | ScanLineCount = ((~Nick.LPT.SC)+1) & 0x0ff; |
| 936 | 936 | |
| 937 | // | |
| 937 | // printf("ScanLineCount %02x\r\n",ScanLineCount); | |
| 938 | 938 | |
| 939 | 939 | /* update count of scanlines done so far */ |
| 940 | 940 | Nick.ScanLineCount++; |
| r5932 | r5933 | |
|---|---|---|
| 103 | 103 | for( x = (framecount % 2) * 128; x < (framecount % 2) * 128+128; x++ ) |
| 104 | 104 | { |
| 105 | 105 | UINT8 *led = &state->display[x]; |
| 106 | ||
| 106 | ||
| 107 | 107 | for( y = 0; y < 8; y++ ) |
| 108 | 108 | { |
| 109 | 109 | for( bit = 0; bit < 8; bit++ ) |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | #include "video/i8275.h" |
| 12 | 12 | #include "includes/radio86.h" |
| 13 | 13 | |
| 14 | I8275_DISPLAY_PIXELS(radio86_display_pixels) | |
| 14 | I8275_DISPLAY_PIXELS(radio86_display_pixels) | |
| 15 | 15 | { |
| 16 | 16 | int i; |
| 17 | 17 | bitmap_t *bitmap = tmpbitmap; |
| r5932 | r5933 | |
| 26 | 26 | if (rvv) { |
| 27 | 27 | pixels ^= 0xff; |
| 28 | 28 | } |
| 29 | for(i=0;i<6;i++) { | |
| 29 | for(i=0;i<6;i++) { | |
| 30 | 30 | *BITMAP_ADDR16(bitmap, y, x + i) = (pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0; |
| 31 | 31 | } |
| 32 | 32 | } |
| r5932 | r5933 | |
| 104 | 104 | static const rgb_t radio86_palette[3] = { |
| 105 | 105 | MAKE_RGB(0x00, 0x00, 0x00), // black |
| 106 | 106 | MAKE_RGB(0xa0, 0xa0, 0xa0), // white |
| 107 | MAKE_RGB(0xff, 0xff, 0xff) // highlight | |
| 107 | MAKE_RGB(0xff, 0xff, 0xff) // highlight | |
| 108 | 108 | }; |
| 109 | 109 | |
| 110 | 110 | PALETTE_INIT( radio86 ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | * | |
| 2 | * Sharp MZ700 | |
| 3 | 3 | * |
| 4 | * | |
| 4 | * video hardware | |
| 5 | 5 | * |
| 6 | * | |
| 6 | * Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000 | |
| 7 | 7 | * |
| 8 | * | |
| 8 | * Reference: http://sharpmz.computingmuseum.com | |
| 9 | 9 | * |
| 10 | 10 | ***************************************************************************/ |
| 11 | 11 |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | /* |
| 8 | 8 | |
| 9 | ||
| 9 | TODO: | |
| 10 | 10 | |
| 11 | ||
| 11 | - abc800c | |
| 12 | 12 | |
| 13 | 13 | */ |
| 14 | 14 | |
| r5932 | r5933 | |
| 76 | 76 | abc800_state *state = device->machine->driver_data; |
| 77 | 77 | |
| 78 | 78 | int column; |
| 79 | ||
| 79 | ||
| 80 | 80 | /* prevent wraparound */ |
| 81 | 81 | if (y >= 240) return; |
| 82 | ||
| 82 | ||
| 83 | 83 | y += 29; |
| 84 | 84 | |
| 85 | 85 | for (column = 0; column < x_count; column++) |
| r5932 | r5933 | |
| 202 | 202 | static VIDEO_START( abc800m ) |
| 203 | 203 | { |
| 204 | 204 | abc800_state *state = machine->driver_data; |
| 205 | ||
| 205 | ||
| 206 | 206 | /* allocate memory */ |
| 207 | 207 | |
| 208 | 208 | state->charram = auto_alloc_array(machine, UINT8, ABC800M_CHAR_RAM_SIZE); |
| r5932 | r5933 | |
| 228 | 228 | static VIDEO_START( abc800c ) |
| 229 | 229 | { |
| 230 | 230 | abc800_state *state = machine->driver_data; |
| 231 | ||
| 231 | ||
| 232 | 232 | /* allocate memory */ |
| 233 | 233 | |
| 234 | 234 | state->charram = auto_alloc_array(machine, UINT8, ABC800C_CHAR_RAM_SIZE); |
| r5932 | r5933 | |
| 261 | 261 | |
| 262 | 262 | /* draw HR graphics */ |
| 263 | 263 | abc800m_hr_update(screen->machine, bitmap, cliprect); |
| 264 | ||
| 264 | ||
| 265 | 265 | if (!BIT(state->fgctl, 7)) |
| 266 | 266 | { |
| 267 | 267 | /* draw text */ |
| 268 | 268 | mc6845_update(state->mc6845, bitmap, cliprect); |
| 269 | 269 | } |
| 270 | ||
| 270 | ||
| 271 | 271 | return 0; |
| 272 | 272 | } |
| 273 | 273 | |
| r5932 | r5933 | |
| 280 | 280 | |
| 281 | 281 | /* draw HR graphics */ |
| 282 | 282 | abc800c_hr_update(screen->machine, bitmap, cliprect); |
| 283 | ||
| 283 | ||
| 284 | 284 | if (!BIT(state->fgctl, 7)) |
| 285 | 285 | { |
| 286 | 286 | /* draw text */ |
| 287 | 287 | abc800c_update(screen->machine, bitmap, cliprect); |
| 288 | 288 | } |
| 289 | ||
| 289 | ||
| 290 | 290 | return 0; |
| 291 | 291 | } |
| 292 | 292 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | |
| 3 | i82720cm.h | |
| 4 | Video driver for the Intel 82720 and NEC uPD7220 GDC. | |
| 3 | i82720cm.h | |
| 4 | Video driver for the Intel 82720 and NEC uPD7220 GDC. | |
| 5 | 5 | |
| 6 | Per Ola Ingvarsson | |
| 7 | Tomas Karlsson | |
| 6 | Per Ola Ingvarsson | |
| 7 | Tomas Karlsson | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 51 | 51 | |
| 52 | 52 | /* Status register flags */ |
| 53 | 53 | |
| 54 | GDC_DATA_READY = 0x01, /* Data ready | |
| 54 | GDC_DATA_READY = 0x01, /* Data ready */ | |
| 55 | 55 | |
| 56 | GDC_FIFO_FULL = 0x02, /* FIFO full | |
| 56 | GDC_FIFO_FULL = 0x02, /* FIFO full */ | |
| 57 | 57 | |
| 58 | GDC_FIFO_EMPTY = 0x04, /* FIFO empty | |
| 58 | GDC_FIFO_EMPTY = 0x04, /* FIFO empty */ | |
| 59 | 59 | |
| 60 | GDC_DRAWING = 0x08, /* Drawing in progress | |
| 60 | GDC_DRAWING = 0x08, /* Drawing in progress */ | |
| 61 | 61 | |
| 62 | GDC_DMA_EXEC = 0x10, /* DMA execute | |
| 62 | GDC_DMA_EXEC = 0x10, /* DMA execute */ | |
| 63 | 63 | |
| 64 | GDC_VSYNC = 0x20, /* Vertical sync active | |
| 64 | GDC_VSYNC = 0x20, /* Vertical sync active */ | |
| 65 | 65 | |
| 66 | GDC_HBLANK = 0x40, /* Horizontal blanking active | |
| 66 | GDC_HBLANK = 0x40, /* Horizontal blanking active */ | |
| 67 | 67 | |
| 68 | GDC_LIGHT_PEN = 0x80 /* Light pen detect | |
| 68 | GDC_LIGHT_PEN = 0x80 /* Light pen detect */ | |
| 69 | 69 | |
| 70 | 70 | }; |
| 71 | 71 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Bashkiria-2M video driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 28/03/2008 Preliminary driver. | |
| 6 | ||
| 5 | 28/03/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "includes/b2m.h" |
| 12 | ||
| 12 | ||
| 13 | 13 | VIDEO_START( b2m ) |
| 14 | 14 | { |
| 15 | 15 | } |
| 16 | ||
| 16 | ||
| 17 | 17 | VIDEO_UPDATE( b2m ) |
| 18 | 18 | { |
| 19 | 19 | UINT8 code1; |
| r5932 | r5933 | |
| 21 | 21 | UINT8 col; |
| 22 | 22 | int y, x, b; |
| 23 | 23 | b2m_state *state = screen->machine->driver_data; |
| 24 | ||
| 24 | ||
| 25 | 25 | for (x = 0; x < 48; x++) |
| 26 | { | |
| 26 | { | |
| 27 | 27 | for (y = 0; y < 256; y++) |
| 28 | 28 | { |
| 29 | 29 | if (state->b2m_video_page==0) { |
| r5932 | r5933 | |
| 32 | 32 | } else { |
| 33 | 33 | code1 = mess_ram[0x19000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; |
| 34 | 34 | code2 = mess_ram[0x1d000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)]; |
| 35 | } | |
| 35 | } | |
| 36 | 36 | for (b = 7; b >= 0; b--) |
| 37 | { | |
| 37 | { | |
| 38 | 38 | col = (((code2 >> b) & 0x01)<<1) + ((code1 >> b) & 0x01); |
| 39 | 39 | *BITMAP_ADDR16(bitmap, y, x*8+b) = col; |
| 40 | 40 | } |
| 41 | } | |
| 41 | } | |
| 42 | 42 | } |
| 43 | ||
| 43 | ||
| 44 | 44 | return 0; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | static const rgb_t b2m_palette[4] = { |
| 48 | 48 | MAKE_RGB(0x00, 0x00, 0x00), // 0 |
| 49 | 49 | MAKE_RGB(0x00, 0x00, 0x00), // 1 |
| 50 | MAKE_RGB(0x00, 0x00, 0x00), // 2 | |
| 51 | MAKE_RGB(0x00, 0x00, 0x00), // 3 | |
| 50 | MAKE_RGB(0x00, 0x00, 0x00), // 2 | |
| 51 | MAKE_RGB(0x00, 0x00, 0x00), // 3 | |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | 54 | PALETTE_INIT( b2m ) |
| r5932 | r5933 | |
|---|---|---|
| 135 | 135 | return via_r(via, offset); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | WRITE8_HANDLER(vectrex_via_w) | |
| 139 | { | |
| 138 | WRITE8_HANDLER(vectrex_via_w) | |
| 139 | { | |
| 140 | 140 | const device_config *via = devtag_get_device(space->machine, "via6522_0"); |
| 141 | 141 | attotime period; |
| 142 | 142 | |
| r5932 | r5933 | |
| 160 | 160 | period); |
| 161 | 161 | break; |
| 162 | 162 | } |
| 163 | via_w(via, offset, data); | |
| 163 | via_w(via, offset, data); | |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
| r5932 | r5933 | |
| 173 | 173 | static TIMER_CALLBACK(vectrex_refresh) |
| 174 | 174 | { |
| 175 | 175 | /* Refresh only marks the range of vectors which will be drawn |
| 176 | ||
| 176 | * during the next VIDEO_UPDATE. */ | |
| 177 | 177 | display_start = display_end; |
| 178 | 178 | display_end = vectrex_point_index; |
| 179 | 179 | } |
| r5932 | r5933 | |
| 187 | 187 | |
| 188 | 188 | /* start black */ |
| 189 | 189 | vector_add_point(screen->machine, |
| 190 | vectrex_points[display_start].x, | |
| 191 | vectrex_points[display_start].y, | |
| 190 | vectrex_points[display_start].x, | |
| 191 | vectrex_points[display_start].y, | |
| 192 | 192 | vectrex_points[display_start].col, |
| 193 | 193 | 0); |
| 194 | 194 | |
| r5932 | r5933 | |
| 230 | 230 | void vectrex_add_point_stereo(int x, int y, rgb_t color, int intensity) |
| 231 | 231 | { |
| 232 | 232 | if (vectrex_imager_status == 2) /* left = 1, right = 2 */ |
| 233 | vectrex_add_point ((int)(y * M_SQRT1_2)+ x_center, | |
| 234 | (int)(((x_max - x) * M_SQRT1_2)), | |
| 235 | color, | |
| 233 | vectrex_add_point ((int)(y * M_SQRT1_2)+ x_center, | |
| 234 | (int)(((x_max - x) * M_SQRT1_2)), | |
| 235 | color, | |
| 236 | 236 | intensity); |
| 237 | 237 | else |
| 238 | 238 | vectrex_add_point ((int)(y * M_SQRT1_2), |
| r5932 | r5933 | |
| 266 | 266 | |
| 267 | 267 | if (!ramp) |
| 268 | 268 | { |
| 269 | length = cputag_get_clock(machine, "maincpu") * INT_PER_CLOCK | |
| 269 | length = cputag_get_clock(machine, "maincpu") * INT_PER_CLOCK | |
| 270 | 270 | * attotime_to_double(attotime_sub(timer_get_time(machine), vector_start_time)); |
| 271 | 271 | |
| 272 | 272 | x_int += length * (analog[A_X] + analog[A_ZR]); |
| r5932 | r5933 | |
| 306 | 306 | vectrex_imager_freq = 1; |
| 307 | 307 | |
| 308 | 308 | vectrex_imager_timer = timer_alloc(machine, vectrex_imager_eye, NULL); |
| 309 | timer_adjust_periodic(vectrex_imager_timer, | |
| 309 | timer_adjust_periodic(vectrex_imager_timer, | |
| 310 | 310 | ATTOTIME_IN_HZ(vectrex_imager_freq), |
| 311 | 311 | 2, |
| 312 | 312 | ATTOTIME_IN_HZ(vectrex_imager_freq)); |
| r5932 | r5933 | |
| 348 | 348 | if (lightpen_down) |
| 349 | 349 | { |
| 350 | 350 | /* Simple lin. algebra to check if pen is near |
| 351 | * the line defined by (A_X,A_Y). | |
| 352 | * If that is the case, set a timer which goes | |
| 353 | * off when the beam reaches the pen. Exact | |
| 354 | * timing is important here. | |
| 355 | * | |
| 356 | * lightpen | |
| 357 | * ^ | |
| 358 | * _ /| | |
| 359 | * b / | | |
| 360 | * / | | |
| 361 | * / |d | |
| 362 | * / | | |
| 363 | * / | | |
| 364 | * ------+---------> beam path | |
| 365 | * l | _ | |
| 366 | * a | |
| 367 | */ | |
| 351 | * the line defined by (A_X,A_Y). | |
| 352 | * If that is the case, set a timer which goes | |
| 353 | * off when the beam reaches the pen. Exact | |
| 354 | * timing is important here. | |
| 355 | * | |
| 356 | * lightpen | |
| 357 | * ^ | |
| 358 | * _ /| | |
| 359 | * b / | | |
| 360 | * / | | |
| 361 | * / |d | |
| 362 | * / | | |
| 363 | * / | | |
| 364 | * ------+---------> beam path | |
| 365 | * l | _ | |
| 366 | * a | |
| 367 | */ | |
| 368 | 368 | double a2, b2, ab, d2; |
| 369 | 369 | ab = (pen_x - x_int) * analog[A_X] |
| 370 | 370 | +(pen_y - y_int) * analog[A_Y]; |
| r5932 | r5933 | |
| 447 | 447 | if (vectrex_lightpen_port != 0) |
| 448 | 448 | { |
| 449 | 449 | lightpen_down = input_port_read(device->machine, "LPENCONF") & 0x10; |
| 450 | ||
| 450 | ||
| 451 | 451 | if (lightpen_down) |
| 452 | 452 | { |
| 453 | 453 | pen_x = input_port_read(device->machine, "LPENX") * (x_max / 0xff); |
| 454 | 454 | pen_y = input_port_read(device->machine, "LPENY") * (y_max / 0xff); |
| 455 | ||
| 455 | ||
| 456 | 456 | dx = abs(pen_x - x_int); |
| 457 | 457 | dy = abs(pen_y - y_int); |
| 458 | 458 | if (dx < 500000 && dy < 500000 && data > 0) |
| r5932 | r5933 | |
|---|---|---|
| 83 | 83 | Calculation of sound frequency is done as follows |
| 84 | 84 | 1/Freq = 2 (pitch +1) * (horizontal line period) |
| 85 | 85 | |
| 86 | ||
| 86 | ||
| 87 | 87 | 4. Sprites |
| 88 | 88 | |
| 89 | 89 | Sprite pointers are at 18F0..18F7 (there are four of them). The graphics |
| r5932 | r5933 | |
| 101 | 101 | by which colours are allocated. There are 8 colours, information is coded |
| 102 | 102 | 3 bits per colour (usually 2 colours per byte) |
| 103 | 103 | |
| 104 | Colour Code Name | |
| 105 | ------ ----- ------- | |
| 106 | 7 111 Black | |
| 107 | 6 110 Blue | |
| 108 | 5 101 Red | |
| 109 | 4 100 Magenta | |
| 110 | 3 011 Green | |
| 111 | 2 010 Cyan | |
| 112 | 1 001 Yellow | |
| 113 | 0 000 White | |
| 104 | Colour Code Name | |
| 105 | ------ ----- ------- | |
| 106 | 7 111 Black | |
| 107 | 6 110 Blue | |
| 108 | 5 101 Red | |
| 109 | 4 100 Magenta | |
| 110 | 3 011 Green | |
| 111 | 2 010 Cyan | |
| 112 | 1 001 Yellow | |
| 113 | 0 000 White | |
| 114 | 114 | |
| 115 | 115 | Bits 0..2 of $19F9 are the screen colour |
| 116 | 116 | Bits 3..5 of $19F9 are the colours of characters |
| r5932 | r5933 | |
| 139 | 139 | bit 4 is sprite 1 / 3 collision (guess) |
| 140 | 140 | bit 5 is sprite 2 / 3 collision (guess) |
| 141 | 141 | |
| 142 | ||
| 142 | ||
| 143 | 143 | 7. Graphic Mode |
| 144 | 144 | 19f8 bit 7 graphics mode on (lower 6 bits descripe rectangles) |
| 145 | 145 | 0xc0 in line switches to graphics mode in this line |
| r5932 | r5933 | |
| 156 | 156 | 8. Memory Map |
| 157 | 157 | The offsets in the following memory Map are from the view of the UVI. |
| 158 | 158 | In the arcadia and compatibles the base offset is $1800 thats how the CPU sees the UVI |
| 159 | ||
| 160 | 0000 - 00FF external RAM | |
| 161 | 0000 - 00CF upper screen character/graphics codes organised as 16 char x 13 rows | |
| 162 | 00D0 - 00EF RAM (not used by UVI, can be used by CPU) | |
| 163 | 00F0 vertical offset object 0 | |
| 164 | 00F1 horizontal offset object 0 | |
| 165 | 00F2 vertical offset object 1 | |
| 166 | 00F3 horizontal offset object 1 | |
| 167 | 00F4 vertical offset object 2 | |
| 168 | 00F5 horizontal offset object 2 | |
| 169 | 00F6 vertical offset object 3 | |
| 170 | 00F7 horizontal offset object 3 | |
| 171 | 00F8 - 00FB RAM (not used by UVI, can be used by CPU) | |
| 172 | 00FC complement number of rows from the trailing edge of VRST | |
| 173 | to the start of character display | |
| 174 | 00FD bit0 - 6 sound frequeny, bit 7 color mode | |
| 175 | 00FE bit0 - 2 loudness, bit 3 sound enable when set, bit 4 random noise enable when set | |
| 176 | bit 5 - 7 delay for row of characters | |
| 177 | 00FF bit 0 - 3 DMA number, bit 4 - 7 unused | |
| 178 | 0100 - 017F CE area. In arcadia used for keypad. | |
| 179 | 0180 - 01FF internal UVI registers | |
| 180 | 0180 - 0187 image of object 0 or UDC-code $38 | |
| 181 | 0188 - 018F image of object 1 or UDC-code $39 | |
| 182 | 0190 - 0197 image of object 2 or UDC-code $3A | |
| 183 | 0198 - 019F image of object 3 or UDC-code $3B | |
| 184 | 01A0 - 01A7 image of UDC-code $3C | |
| 185 | 01A8 - 01AF image of UDC-code $3D | |
| 186 | 01B0 - 01B7 image of UDC-code $3E | |
| 187 | 01B8 - 01BF image of UDC-code $3F | |
| 188 | 01C0 - 01F7 unused | |
| 189 | 01F8 bit 0 - 2 alternate screen color, bit 3 - 5 alternate character color | |
| 190 | bit 6 Refresh mode when set entire character field will be display twice | |
| 191 | bit 7 Grahics mode | |
| 192 | 01F9 bit 0 - 2 screen color, bit 3 - 5 character color | |
| 193 | bit 6 poti mux control | |
| 194 | bit 7 character size when set size=8x8 else size=8x16 | |
| 195 | 01FA bit 0 - 2 color of object 3, bit 3 - 5 color of object 2 | |
| 196 | bit 6 size of object 3 when set size=8x8 else size=8x16 | |
| 197 | bit 7 size of object 2 when set size=8x8 else size=8x16 | |
| 198 | 01FB bit 0 - 2 color of object 1, bit 3 - 5 color of object 0 | |
| 199 | bit 6 size of object 1 when set size=8x8 else size=8x16 | |
| 200 | bit 7 size of object 0 when set size=8x8 else size=8x16 | |
| 201 | 01FC object - character collision bits | |
| 202 | bit 0 when low object 0 collided with character | |
| 203 | bit 1 when low object 1 collided with character | |
| 204 | bit 2 when low object 2 collided with character | |
| 205 | bit 3 when low object 3 collided with character | |
| 206 | bit 4 - 7 unused set to high | |
| 207 | 01FD inter object collision | |
| 208 | bit 0 - when low object 1 and 2 collide | |
| 209 | bit 1 - when low object 1 and 3 collide | |
| 210 | bit 2 - when low object 1 and 4 collide | |
| 211 | bit 3 - when low object 2 and 3 collide | |
| 212 | bit 4 - when low object 2 and 4 collide | |
| 213 | bit 5 - when low object 3 and 4 collide | |
| 214 | bit 6 - 7 unused set to high | |
| 215 | 01FE digital value of POT1 or POT3 input. Valid only during VRST | |
| 216 | 01FF digital value of POT2 or POT4 input. Valid only furing VRST | |
| 217 | 0200 - 02FF 2nd external RAM | |
| 218 | 0200 - 02CF lower screen character/graphics codes organised as 16 char x 13 rows | |
| 219 | 02D0 - 02FF RAM (not used by UVI, can be used by CPU) | |
| 159 | ||
| 160 | 0000 - 00FF external RAM | |
| 161 | 0000 - 00CF upper screen character/graphics codes organised as 16 char x 13 rows | |
| 162 | 00D0 - 00EF RAM (not used by UVI, can be used by CPU) | |
| 163 | 00F0 vertical offset object 0 | |
| 164 | 00F1 horizontal offset object 0 | |
| 165 | 00F2 vertical offset object 1 | |
| 166 | 00F3 horizontal offset object 1 | |
| 167 | 00F4 vertical offset object 2 | |
| 168 | 00F5 horizontal offset object 2 | |
| 169 | 00F6 vertical offset object 3 | |
| 170 | 00F7 horizontal offset object 3 | |
| 171 | 00F8 - 00FB RAM (not used by UVI, can be used by CPU) | |
| 172 | 00FC complement number of rows from the trailing edge of VRST | |
| 173 | to the start of character display | |
| 174 | 00FD bit0 - 6 sound frequeny, bit 7 color mode | |
| 175 | 00FE bit0 - 2 loudness, bit 3 sound enable when set, bit 4 random noise enable when set | |
| 176 | bit 5 - 7 delay for row of characters | |
| 177 | 00FF bit 0 - 3 DMA number, bit 4 - 7 unused | |
| 178 | 0100 - 017F CE area. In arcadia used for keypad. | |
| 179 | 0180 - 01FF internal UVI registers | |
| 180 | 0180 - 0187 image of object 0 or UDC-code $38 | |
| 181 | 0188 - 018F image of object 1 or UDC-code $39 | |
| 182 | 0190 - 0197 image of object 2 or UDC-code $3A | |
| 183 | 0198 - 019F image of object 3 or UDC-code $3B | |
| 184 | 01A0 - 01A7 image of UDC-code $3C | |
| 185 | 01A8 - 01AF image of UDC-code $3D | |
| 186 | 01B0 - 01B7 image of UDC-code $3E | |
| 187 | 01B8 - 01BF image of UDC-code $3F | |
| 188 | 01C0 - 01F7 unused | |
| 189 | 01F8 bit 0 - 2 alternate screen color, bit 3 - 5 alternate character color | |
| 190 | bit 6 Refresh mode when set entire character field will be display twice | |
| 191 | bit 7 Grahics mode | |
| 192 | 01F9 bit 0 - 2 screen color, bit 3 - 5 character color | |
| 193 | bit 6 poti mux control | |
| 194 | bit 7 character size when set size=8x8 else size=8x16 | |
| 195 | 01FA bit 0 - 2 color of object 3, bit 3 - 5 color of object 2 | |
| 196 | bit 6 size of object 3 when set size=8x8 else size=8x16 | |
| 197 | bit 7 size of object 2 when set size=8x8 else size=8x16 | |
| 198 | 01FB bit 0 - 2 color of object 1, bit 3 - 5 color of object 0 | |
| 199 | bit 6 size of object 1 when set size=8x8 else size=8x16 | |
| 200 | bit 7 size of object 0 when set size=8x8 else size=8x16 | |
| 201 | 01FC object - character collision bits | |
| 202 | bit 0 when low object 0 collided with character | |
| 203 | bit 1 when low object 1 collided with character | |
| 204 | bit 2 when low object 2 collided with character | |
| 205 | bit 3 when low object 3 collided with character | |
| 206 | bit 4 - 7 unused set to high | |
| 207 | 01FD inter object collision | |
| 208 | bit 0 - when low object 1 and 2 collide | |
| 209 | bit 1 - when low object 1 and 3 collide | |
| 210 | bit 2 - when low object 1 and 4 collide | |
| 211 | bit 3 - when low object 2 and 3 collide | |
| 212 | bit 4 - when low object 2 and 4 collide | |
| 213 | bit 5 - when low object 3 and 4 collide | |
| 214 | bit 6 - 7 unused set to high | |
| 215 | 01FE digital value of POT1 or POT3 input. Valid only during VRST | |
| 216 | 01FF digital value of POT2 or POT4 input. Valid only furing VRST | |
| 217 | 0200 - 02FF 2nd external RAM | |
| 218 | 0200 - 02CF lower screen character/graphics codes organised as 16 char x 13 rows | |
| 219 | 02D0 - 02FF RAM (not used by UVI, can be used by CPU) | |
| 220 | 220 | */ |
| 221 | 221 | |
| 222 | 222 | #include "driver.h" |
| r5932 | r5933 | |
| 376 | 376 | data=input_port_read(space->machine, "controller1_joy_x")<<3; |
| 377 | 377 | break; |
| 378 | 378 | case 0x1ff: |
| 379 | if (arcadia_video.ad_select) | |
| 379 | if (arcadia_video.ad_select) | |
| 380 | 380 | data=input_port_read(space->machine, "controller2_joy_y")<<3; |
| 381 | else | |
| 381 | else | |
| 382 | 382 | data=input_port_read(space->machine, "controller2_joy_x")<<3; |
| 383 | 383 | break; |
| 384 | 384 | #else |
| r5932 | r5933 | |
| 456 | 456 | int y, int x) |
| 457 | 457 | { |
| 458 | 458 | int k,b,cc,sc, colour; |
| 459 | if (arcadia_video.multicolor) | |
| 459 | if (arcadia_video.multicolor) | |
| 460 | 460 | { |
| 461 | 461 | if (charcode&0x40) |
| 462 | 462 | cc=((arcadia_video.reg.d.pal[1]>>3)&7); |
| r5932 | r5933 | |
| 468 | 468 | else |
| 469 | 469 | sc=(arcadia_video.reg.d.pal[0]&7); |
| 470 | 470 | |
| 471 | } | |
| 471 | } | |
| 472 | 472 | else |
| 473 | 473 | { |
| 474 | 474 | cc=((arcadia_video.reg.d.pal[1]>>3)&1)|((charcode>>5)&6); |
| r5932 | r5933 | |
| 517 | 517 | |
| 518 | 518 | if (bitmap->height-arcadia_video.line<h) |
| 519 | 519 | h=bitmap->height-arcadia_video.line; |
| 520 | ||
| 520 | ||
| 521 | 521 | plot_box(bitmap, 0, y, bitmap->width, h, (arcadia_video.reg.d.pal[1]&7)); |
| 522 | 522 | memset(arcadia_video.bg[y], 0, sizeof(arcadia_video.bg[0])*h); |
| 523 | ||
| 523 | ||
| 524 | 524 | for (x=XPOS+arcadia_video.shift, j=0; j<16;j++,x+=8) |
| 525 | 525 | { |
| 526 | 526 | ch=chars1[j]; |
| r5932 | r5933 | |
| 531 | 531 | switch (ch) { |
| 532 | 532 | case 0xc0: graphics=TRUE;break; |
| 533 | 533 | case 0x40: graphics=FALSE;break; |
| 534 | // case 0x80: | |
| 535 | // alien invaders shields are empty 0x80 | |
| 536 | // popmessage(5, "graphics code 0x80 used"); | |
| 534 | // case 0x80: | |
| 535 | // alien invaders shields are empty 0x80 | |
| 536 | // popmessage(5, "graphics code 0x80 used"); | |
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | 539 | if (graphics) |
| r5932 | r5933 | |
| 666 | 666 | |
| 667 | 667 | if (arcadia_video.charline<13) |
| 668 | 668 | { |
| 669 | if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0) | |
| 669 | if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0) | |
| 670 | 670 | { |
| 671 | 671 | arcadia_vh_draw_line(device->machine, arcadia_video.bitmap, arcadia_video.charline*h+arcadia_video.ypos, |
| 672 | 672 | arcadia_video.reg.d.chars1[arcadia_video.charline]); |
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | else | |
| 675 | else | |
| 676 | 676 | if (arcadia_video.lines26 && (arcadia_video.charline<26)) |
| 677 | 677 | { |
| 678 | 678 | if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0) |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | m6847.c |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of Motorola 6847 video hardware chip | |
| 6 | 6 | |
| 7 | Sources: | |
| 8 | M6847 data sheet | |
| 9 | M6847T1 info from Rainbow magazine (10/1986-12/1986) | |
| 7 | Sources: | |
| 8 | M6847 data sheet | |
| 9 | M6847T1 info from Rainbow magazine (10/1986-12/1986) | |
| 10 | 10 | |
| 11 | 11 | |
| 12 | AG AS INTEXT INV GM2 GM1 GM0 | |
| 13 | -- -- ------ --- --- --- --- | |
| 14 | 0 0 0 0 X X X Internal Alphanumerics | |
| 15 | 0 0 0 1 X X X Internal Alphanumerics Inverted | |
| 16 | 0 0 1 0 X X X External Alphanumerics | |
| 17 | 0 0 1 1 X X X External Alphanumerics Inverted | |
| 18 | 0 1 0 X X X X Semigraphics 4 | |
| 19 | 0 1 1 X X X X Semigraphics 6 | |
| 20 | 1 X X X 0 0 0 Graphics CG1 (64x64x4) (16 bpr) | |
| 21 | 1 X X X 0 0 1 Graphics RG1 (128x64x2) (16 bpr) | |
| 22 | 1 X X X 0 1 0 Graphics CG2 (128x64x4) (32 bpr) | |
| 23 | 1 X X X 0 1 1 Graphics RG2 (128x96x2) (16 bpr) | |
| 24 | 1 X X X 1 0 0 Graphics CG3 (128x96x4) (32 bpr) | |
| 25 | 1 X X X 1 0 1 Graphics RG3 (128x192x2) (16 bpr) | |
| 26 | 1 X X X 1 1 0 Graphics CG6 (128x192x4) (32 bpr) | |
| 27 | 1 X X X 1 1 1 Graphics RG6 (256x192x2) (32 bpr) | |
| 12 | AG AS INTEXT INV GM2 GM1 GM0 | |
| 13 | -- -- ------ --- --- --- --- | |
| 14 | 0 0 0 0 X X X Internal Alphanumerics | |
| 15 | 0 0 0 1 X X X Internal Alphanumerics Inverted | |
| 16 | 0 0 1 0 X X X External Alphanumerics | |
| 17 | 0 0 1 1 X X X External Alphanumerics Inverted | |
| 18 | 0 1 0 X X X X Semigraphics 4 | |
| 19 | 0 1 1 X X X X Semigraphics 6 | |
| 20 | 1 X X X 0 0 0 Graphics CG1 (64x64x4) (16 bpr) | |
| 21 | 1 X X X 0 0 1 Graphics RG1 (128x64x2) (16 bpr) | |
| 22 | 1 X X X 0 1 0 Graphics CG2 (128x64x4) (32 bpr) | |
| 23 | 1 X X X 0 1 1 Graphics RG2 (128x96x2) (16 bpr) | |
| 24 | 1 X X X 1 0 0 Graphics CG3 (128x96x4) (32 bpr) | |
| 25 | 1 X X X 1 0 1 Graphics RG3 (128x192x2) (16 bpr) | |
| 26 | 1 X X X 1 1 0 Graphics CG6 (128x192x4) (32 bpr) | |
| 27 | 1 X X X 1 1 1 Graphics RG6 (256x192x2) (32 bpr) | |
| 28 | 28 | |
| 29 | Note: The M6847 relies on an external source (typically a 6883 SAM chip) | |
| 30 | to feed it bytes; so the BPR (bytes per row) figures are effectively | |
| 31 | suggestions. Mismatching modes is responsible for the semigraphic modes | |
| 32 | on the CoCo. | |
| 29 | Note: The M6847 relies on an external source (typically a 6883 SAM chip) | |
| 30 | to feed it bytes; so the BPR (bytes per row) figures are effectively | |
| 31 | suggestions. Mismatching modes is responsible for the semigraphic modes | |
| 32 | on the CoCo. | |
| 33 | 33 | |
| 34 | Timing: | |
| 35 | (source Motorola M6847 Manual) | |
| 34 | Timing: | |
| 35 | (source Motorola M6847 Manual) | |
| 36 | 36 | |
| 37 | Horizontal Sync: Total Period: 227.5 clock cycles | |
| 38 | @ CLK(0) + DHS_F - falling edge (high to low) | |
| 39 | @ CLK(16.5) + DHS_R - rising edge (low to high) | |
| 40 | @ CLK(42) - left border start | |
| 41 | @ CLK(71.5) - body start | |
| 42 | @ CLK(199.5) - right border start | |
| 43 | @ CLK(227.5) + DHS_F - falling edge (high to low) | |
| 44 | ... | |
| 37 | Horizontal Sync: Total Period: 227.5 clock cycles | |
| 38 | @ CLK(0) + DHS_F - falling edge (high to low) | |
| 39 | @ CLK(16.5) + DHS_R - rising edge (low to high) | |
| 40 | @ CLK(42) - left border start | |
| 41 | @ CLK(71.5) - body start | |
| 42 | @ CLK(199.5) - right border start | |
| 43 | @ CLK(227.5) + DHS_F - falling edge (high to low) | |
| 44 | ... | |
| 45 | 45 | |
| 46 | Field Sync: Total Period 262*227.5 clock cycles | |
| 47 | @ CLK(0) + DFS_F - falling edge (high to low) | |
| 48 | @ CLK(32*227.5) + DFS_R - rising edge (low to high) | |
| 49 | @ CLK(262*227.5) + DFS_F - falling edge (high to low) (262.5 for the M6847Y) | |
| 46 | Field Sync: Total Period 262*227.5 clock cycles | |
| 47 | @ CLK(0) + DFS_F - falling edge (high to low) | |
| 48 | @ CLK(32*227.5) + DFS_R - rising edge (low to high) | |
| 49 | @ CLK(262*227.5) + DFS_F - falling edge (high to low) (262.5 for the M6847Y) | |
| 50 | 50 | |
| 51 | DHS_F: 550ns | |
| 52 | DHS_R: 740ns | |
| 53 | DFS_F: 520ns | |
| 54 | DFS_R: 500ns | |
| 51 | DHS_F: 550ns | |
| 52 | DHS_R: 740ns | |
| 53 | DFS_F: 520ns | |
| 54 | DFS_R: 500ns | |
| 55 | 55 | |
| 56 | The M6847T1 is a later variant of the M6847 chip that implements lower | |
| 57 | case support and some other nifty features. This chip is in the CoCo 2B. | |
| 58 | I have not been able to find a pinout diagram for this chip so I am | |
| 59 | assuming that the extra text modes on the CoCo 2B are activated by the | |
| 60 | GM2-0 pins. This needs to be confirmed. | |
| 56 | The M6847T1 is a later variant of the M6847 chip that implements lower | |
| 57 | case support and some other nifty features. This chip is in the CoCo 2B. | |
| 58 | I have not been able to find a pinout diagram for this chip so I am | |
| 59 | assuming that the extra text modes on the CoCo 2B are activated by the | |
| 60 | GM2-0 pins. This needs to be confirmed. | |
| 61 | 61 | |
| 62 | ||
| 62 | TODO: Implement PAL support | |
| 63 | 63 | |
| 64 | 64 | **********************************************************************/ |
| 65 | 65 | |
| r5932 | r5933 | |
| 176 | 176 | unsigned int text_offset : 2; /* needed for CoCo 3 */ |
| 177 | 177 | |
| 178 | 178 | /* video state; every scanline the video state for the scanline is copied |
| 179 | ||
| 179 | * here and only rendered in VIDEO_UPDATE */ | |
| 180 | 180 | int dirty; |
| 181 | 181 | int using_custom; |
| 182 | 182 | UINT32 border[384]; |
| r5932 | r5933 | |
| 2020 | 2020 | static void apply_artifacts(running_machine *machine, UINT32 *line) |
| 2021 | 2021 | { |
| 2022 | 2022 | /* Boy this code sucks; this code was adapted from the old M6847 |
| 2023 | * artifacting implmentation. The only reason that it didn't look as | |
| 2024 | * horrible was because the code around it sucked as well. Now that I | |
| 2025 | * have cleaned everything up, the ugliness is much more prominent. | |
| 2026 | * | |
| 2027 | * Hopefully we will have a generic artifacting algorithm that plugs into | |
| 2028 | * the MESS/MAME core directly so we can chuck this hack */ | |
| 2023 | * artifacting implmentation. The only reason that it didn't look as | |
| 2024 | * horrible was because the code around it sucked as well. Now that I | |
| 2025 | * have cleaned everything up, the ugliness is much more prominent. | |
| 2026 | * | |
| 2027 | * Hopefully we will have a generic artifacting algorithm that plugs into | |
| 2028 | * the MESS/MAME core directly so we can chuck this hack */ | |
| 2029 | 2029 | static const double artifact_colors[14*3] = |
| 2030 | 2030 | { |
| 2031 | 2031 | 0.157, 0.000, 0.157, /* [ 1] - dk purple (reverse 2) */ |
| r5932 | r5933 | |
| 2136 | 2136 | static INPUT_CHANGED( artifacting_changed ) |
| 2137 | 2137 | { |
| 2138 | 2138 | /* TODO: not sure how to do this with a device... */ |
| 2139 | // | |
| 2139 | // set_dirty(); | |
| 2140 | 2140 | } |
| 2141 | 2141 | |
| 2142 | 2142 |
| r5932 | r5933 | |
|---|---|---|
| 314 | 314 | { |
| 315 | 315 | /* between left and right border */ |
| 316 | 316 | /* NOTE: this makes the lower right part of the color picker blink |
| 317 | in the TO8/TO9/TO9+, which actually happens on the real computer! | |
| 318 | */ | |
| 317 | in the TO8/TO9/TO9+, which actually happens on the real computer! | |
| 318 | */ | |
| 319 | 319 | thom_border_r[ y ] = color; |
| 320 | 320 | thom_border_l[ y + 1 ] = color; |
| 321 | 321 | } |
| r5932 | r5933 | |
|---|---|---|
| 255 | 255 | cursor = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 256 | 256 | |
| 257 | 257 | /* |
| 258 | * for every character in the Video RAM, check if it has been modified since | |
| 259 | * last time and update it accordingly. | |
| 260 | */ | |
| 258 | * for every character in the Video RAM, check if it has been modified since | |
| 259 | * last time and update it accordingly. | |
| 260 | */ | |
| 261 | 261 | for( address = 0; address < size; address++ ) |
| 262 | 262 | { |
| 263 | 263 | i = (offset + address) & 0x3fff; |
| r5932 | r5933 | |
| 280 | 280 | { |
| 281 | 281 | /* get character code */ |
| 282 | 282 | code = videoram[i]; |
| 283 | ||
| 283 | ||
| 284 | 284 | /* translate defined character sets */ |
| 285 | 285 | code += cgenie_font_offset[(code >> 6) & 3]; |
| 286 | 286 | drawgfx_opaque(bitmap, &r, machine->gfx[0], code, colorram[i&0x3ff], |
| r5932 | r5933 | |
| 304 | 304 | crt.cursor_phase++; |
| 305 | 305 | crt.cursor_visible = (crt.cursor_phase >> 3) & 1; |
| 306 | 306 | } |
| 307 | ||
| 307 | ||
| 308 | 308 | if( !crt.cursor_visible ) |
| 309 | 309 | continue; |
| 310 | ||
| 310 | ||
| 311 | 311 | rc.min_x = r.min_x; |
| 312 | 312 | rc.max_x = r.max_x; |
| 313 | 313 | rc.min_y = r.min_y + (crt.cursor_top & 15); |
| r5932 | r5933 | |
| 334 | 334 | cursor = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 335 | 335 | |
| 336 | 336 | /* |
| 337 | * for every character in the Video RAM, check if it has been modified since | |
| 338 | * last time and update it accordingly. | |
| 339 | */ | |
| 337 | * for every character in the Video RAM, check if it has been modified since | |
| 338 | * last time and update it accordingly. | |
| 339 | */ | |
| 340 | 340 | for( address = 0; address < size; address++ ) |
| 341 | 341 | { |
| 342 | 342 | i = (offset + address) & 0x3fff; |
| r5932 | r5933 | |
| 361 | 361 | { |
| 362 | 362 | /* get character code */ |
| 363 | 363 | code = videoram[i]; |
| 364 | ||
| 364 | ||
| 365 | 365 | /* translate defined character sets */ |
| 366 | 366 | code += cgenie_font_offset[(code >> 6) & 3]; |
| 367 | 367 | drawgfx_opaque(tmpbitmap, &r, machine->gfx[0], code, colorram[i&0x3ff] + 16, |
| r5932 | r5933 | |
| 387 | 387 | crt.cursor_phase++; |
| 388 | 388 | crt.cursor_visible = (crt.cursor_phase >> 3) & 1; |
| 389 | 389 | } |
| 390 | ||
| 390 | ||
| 391 | 391 | if( !crt.cursor_visible ) |
| 392 | 392 | continue; |
| 393 | ||
| 393 | ||
| 394 | 394 | rc.min_x = r.min_x; |
| 395 | 395 | rc.max_x = r.max_x; |
| 396 | 396 | rc.min_y = r.min_y + (crt.cursor_top & 15); |
| 397 | 397 | rc.max_y = r.min_y + (crt.cursor_bottom & 15); |
| 398 | ||
| 398 | ||
| 399 | 399 | drawgfx_opaque(tmpbitmap, &rc, machine->gfx[0], 0x7f, colorram[i&0x3ff] + 16, |
| 400 | 400 | 0, 0, rc.min_x, rc.min_y); |
| 401 | 401 | drawgfx_opaque(dlybitmap, &rc, machine->gfx[0], 0x7f, colorram[i&0x3ff] + 32, |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | m6847.h |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of Motorola 6847 video hardware chip | |
| 6 | 6 | |
| 7 | 7 | **********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 107 | 107 | UINT8 data = 0; |
| 108 | 108 | int cursor, blank, tecken, graf, versal; |
| 109 | 109 | int bit; |
| 110 | ||
| 110 | ||
| 111 | 111 | if (hsync_data & ABC80_K5_LINE_END) |
| 112 | 112 | c = 0; |
| 113 | 113 | |
| r5932 | r5933 | |
| 116 | 116 | |
| 117 | 117 | /* |
| 118 | 118 | |
| 119 | ||
| 119 | Video RAM Addressing Scheme | |
| 120 | 120 | |
| 121 | A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 | |
| 122 | R2 R1 R0 xx xx xx xx C2 C1 C0 | |
| 121 | A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 | |
| 122 | R2 R1 R0 xx xx xx xx C2 C1 C0 | |
| 123 | 123 | |
| 124 | ||
| 124 | A6 A5 A4 A3 = 00 C5 C4 C3 + R4 R3 R4 R3 | |
| 125 | 125 | |
| 126 | */ | |
| 127 | ||
| 126 | */ | |
| 127 | ||
| 128 | 128 | videoram_addr = ((r & 0x07) << 7) | ((((c >> 3) & 0x07) + ((r >> 3) | (r >> 1))) & 0x0f) | (c & 0x07); |
| 129 | 129 | videoram_data = videoram[videoram_addr]; |
| 130 | 130 | attr_addr = ((dh & dv) << 7) & (data & 0x7f); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | Sharp X68000 video functions | |
| 4 | driver by Barry Rodewald | |
| 3 | Sharp X68000 video functions | |
| 4 | driver by Barry Rodewald | |
| 5 | 5 | |
| 6 | X68000 video hardware (there are some minor revisions to these custom chips across various X680x0 models): | |
| 7 | Custom sprite controller "Cynthia" | |
| 8 | Custom CRT controller "Vinas / Vicon" | |
| 9 | Custom video controller "VSOP / VIPS" | |
| 10 | Custom video data selector "Cathy" | |
| 6 | X68000 video hardware (there are some minor revisions to these custom chips across various X680x0 models): | |
| 7 | Custom sprite controller "Cynthia" | |
| 8 | Custom CRT controller "Vinas / Vicon" | |
| 9 | Custom video controller "VSOP / VIPS" | |
| 10 | Custom video data selector "Cathy" | |
| 11 | 11 | |
| 12 | In general terms: | |
| 13 | 1 "Text" layer - effectively a 4bpp bitmap split into 4 planes at 1bpp each | |
| 14 | 512kB "text" VRAM | |
| 15 | can write to multiple planes at once | |
| 16 | can copy one character line to another character line | |
| 17 | is 1024x1024 in size | |
| 18 | Up to 4 graphic layers - can be 4 layers with a 16 colour palette, 2 layers with a 256 colour palette, | |
| 19 | or 1 layer at 16-bit RGB. | |
| 20 | 512k graphic VRAM | |
| 21 | all layers are 512x512, but at 16 colours, the 4 layers can be combined into 1 1024x1024 layer | |
| 22 | one or more layers can be cleared at once quickly with a simple hardware function | |
| 23 | 2 tilemapped layers - can be 8x8 or 16x16, 16 colours per tile, max 256 colours overall | |
| 24 | 1 sprite layer - up to 128 16x16 sprites, 16 colours per sprite, maximum 16 sprites per scanline (not yet implemented). | |
| 12 | In general terms: | |
| 13 | 1 "Text" layer - effectively a 4bpp bitmap split into 4 planes at 1bpp each | |
| 14 | 512kB "text" VRAM | |
| 15 | can write to multiple planes at once | |
| 16 | can copy one character line to another character line | |
| 17 | is 1024x1024 in size | |
| 18 | Up to 4 graphic layers - can be 4 layers with a 16 colour palette, 2 layers with a 256 colour palette, | |
| 19 | or 1 layer at 16-bit RGB. | |
| 20 | 512k graphic VRAM | |
| 21 | all layers are 512x512, but at 16 colours, the 4 layers can be combined into 1 1024x1024 layer | |
| 22 | one or more layers can be cleared at once quickly with a simple hardware function | |
| 23 | 2 tilemapped layers - can be 8x8 or 16x16, 16 colours per tile, max 256 colours overall | |
| 24 | 1 sprite layer - up to 128 16x16 sprites, 16 colours per sprite, maximum 16 sprites per scanline (not yet implemented). | |
| 25 | 25 | |
| 26 | 26 | */ |
| 27 | 27 | |
| r5932 | r5933 | |
| 128 | 128 | |
| 129 | 129 | static void x68k_crtc_refresh_mode(running_machine *machine) |
| 130 | 130 | { |
| 131 | // rectangle rect; | |
| 132 | // double scantime; | |
| 131 | // rectangle rect; | |
| 132 | // double scantime; | |
| 133 | 133 | rectangle scr,visiblescr; |
| 134 | 134 | int length; |
| 135 | 135 | |
| r5932 | r5933 | |
| 181 | 181 | if(visiblescr.max_y >= scr.max_y - 1) |
| 182 | 182 | visiblescr.max_y = scr.max_y - 2; |
| 183 | 183 | |
| 184 | // logerror("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i\n",x68k_sys.crtc.reg[0],x68k_sys.crtc.reg[1],x68k_sys.crtc.reg[2],x68k_sys.crtc.reg[3], | |
| 185 | // x68k_sys.crtc.reg[4],x68k_sys.crtc.reg[5],x68k_sys.crtc.reg[6],x68k_sys.crtc.reg[7],x68k_sys.crtc.reg[8],x68k_sys.crtc.reg[9]); | |
| 184 | // logerror("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i\n",x68k_sys.crtc.reg[0],x68k_sys.crtc.reg[1],x68k_sys.crtc.reg[2],x68k_sys.crtc.reg[3], | |
| 185 | // x68k_sys.crtc.reg[4],x68k_sys.crtc.reg[5],x68k_sys.crtc.reg[6],x68k_sys.crtc.reg[7],x68k_sys.crtc.reg[8],x68k_sys.crtc.reg[9]); | |
| 186 | 186 | logerror("video_screen_configure(machine->primary_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); |
| 187 | 187 | video_screen_configure(machine->primary_screen,scr.max_x,scr.max_y,&visiblescr,HZ_TO_ATTOSECONDS(55.45)); |
| 188 | 188 | } |
| r5932 | r5933 | |
| 233 | 233 | { |
| 234 | 234 | if(oddscanline == 1) |
| 235 | 235 | { |
| 236 | int scan = video_screen_get_vpos(machine->primary_screen); | |
| 236 | int scan = video_screen_get_vpos(machine->primary_screen); | |
| 237 | 237 | if(scan > x68k_sys.crtc.vend) |
| 238 | 238 | scan = x68k_sys.crtc.vbegin; |
| 239 | 239 | else |
| r5932 | r5933 | |
| 271 | 271 | { |
| 272 | 272 | hsync_time = video_screen_get_time_until_pos(machine->primary_screen,video_screen_get_vpos(machine->primary_screen)+1,x68k_sys.crtc.hbegin); |
| 273 | 273 | timer_adjust_oneshot(x68k_scanline_timer, hsync_time, 1); |
| 274 | // if(!(x68k_sys.mfp.gpio & 0x40)) // if GPIP6 is active, clear it | |
| 275 | // x68k_sys.mfp.gpio |= 0x40; | |
| 274 | // if(!(x68k_sys.mfp.gpio & 0x40)) // if GPIP6 is active, clear it | |
| 275 | // x68k_sys.mfp.gpio |= 0x40; | |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | } |
| r5932 | r5933 | |
| 480 | 480 | memset(x68k_gvram+0x30000,0,0x20000); |
| 481 | 481 | } |
| 482 | 482 | timer_set(space->machine, ATTOTIME_IN_MSEC(10), NULL, 0x02,x68k_crtc_operation_end); // time taken to do operation is a complete guess. |
| 483 | // | |
| 483 | // popmessage("CRTC: High-speed gfx screen clear [0x%02x]",x68k_sys.crtc.reg[21] & 0x0f); | |
| 484 | 484 | } |
| 485 | 485 | break; |
| 486 | 486 | } |
| 487 | // | |
| 487 | // logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")),data,offset); | |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | READ16_HANDLER( x68k_crtc_r ) |
| 491 | 491 | { |
| 492 | /* switch(offset) | |
| 493 | { | |
| 494 | default: | |
| 495 | logerror("CRTC: [%08x] Read from CRTC register %i\n",activecpu_get_pc(),offset); | |
| 496 | return 0xff; | |
| 497 | }*/ | |
| 492 | /* switch(offset) | |
| 493 | { | |
| 494 | default: | |
| 495 | logerror("CRTC: [%08x] Read from CRTC register %i\n",activecpu_get_pc(),offset); | |
| 496 | return 0xff; | |
| 497 | }*/ | |
| 498 | 498 | if(offset < 24) |
| 499 | 499 | { |
| 500 | // | |
| 500 | // logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")),x68k_sys.crtc.reg[offset],offset); | |
| 501 | 501 | switch(offset) |
| 502 | 502 | { |
| 503 | 503 | case 9: |
| r5932 | r5933 | |
| 520 | 520 | } |
| 521 | 521 | if(offset == 576) // operation port, operation bits are set to 0 when operation is complete |
| 522 | 522 | return x68k_sys.crtc.operation; |
| 523 | // | |
| 523 | // logerror("CRTC: [%08x] Read from unknown CRTC register %i\n",activecpu_get_pc(),offset); | |
| 524 | 524 | return 0xffff; |
| 525 | 525 | } |
| 526 | 526 | |
| r5932 | r5933 | |
| 528 | 528 | { |
| 529 | 529 | int xloc,yloc,pageoffset; |
| 530 | 530 | /* |
| 531 | ||
| 531 | G-VRAM usage is determined by colour depth and "real" screen size. | |
| 532 | 532 | |
| 533 | For screen size of 1024x1024, all G-VRAM space is used, in one big page. | |
| 534 | At 1024x1024 real screen size, colour depth is always 4bpp, and ranges from | |
| 535 | 0xc00000-0xdfffff. | |
| 533 | For screen size of 1024x1024, all G-VRAM space is used, in one big page. | |
| 534 | At 1024x1024 real screen size, colour depth is always 4bpp, and ranges from | |
| 535 | 0xc00000-0xdfffff. | |
| 536 | 536 | |
| 537 | For screen size of 512x512, the colour depth determines the page usage. | |
| 538 | 16 colours = 4 pages | |
| 539 | 256 colours = 2 pages | |
| 540 | 65,536 colours = 1 page | |
| 541 | Page 1 - 0xc00000-0xc7ffff Page 2 - 0xc80000-0xcfffff | |
| 542 | Page 3 - 0xd00000-0xd7ffff Page 4 - 0xd80000-0xdfffff | |
| 543 | */ | |
| 544 | ||
| 537 | For screen size of 512x512, the colour depth determines the page usage. | |
| 538 | 16 colours = 4 pages | |
| 539 | 256 colours = 2 pages | |
| 540 | 65,536 colours = 1 page | |
| 541 | Page 1 - 0xc00000-0xc7ffff Page 2 - 0xc80000-0xcfffff | |
| 542 | Page 3 - 0xd00000-0xd7ffff Page 4 - 0xd80000-0xdfffff | |
| 543 | */ | |
| 544 | ||
| 545 | 545 | // handle different G-VRAM page setups |
| 546 | 546 | if(x68k_sys.crtc.reg[20] & 0x08) // G-VRAM set to buffer |
| 547 | 547 | { |
| r5932 | r5933 | |
| 588 | 588 | logerror("G-VRAM written while layer setup is undefined.\n"); |
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | ||
| 591 | ||
| 592 | 592 | pageoffset = offset & 0xfffff; |
| 593 | 593 | xloc = pageoffset % 1024; |
| 594 | 594 | yloc = pageoffset / 1024; |
| r5932 | r5933 | |
| 662 | 662 | |
| 663 | 663 | if(x68k_sys.crtc.reg[20] & 0x08) // G-VRAM set to buffer |
| 664 | 664 | return x68k_gvram[offset]; |
| 665 | ||
| 665 | ||
| 666 | 666 | switch(x68k_sys.crtc.reg[20] & 0x0300) // colour setup determines G-VRAM use |
| 667 | 667 | { |
| 668 | 668 | case 0x0300: // 65,536 colour (RGB) - 16-bits per word |
| r5932 | r5933 | |
| 693 | 693 | logerror("G-VRAM read while layer setup is undefined.\n"); |
| 694 | 694 | ret = 0xffff; |
| 695 | 695 | } |
| 696 | ||
| 696 | ||
| 697 | 697 | return ret; |
| 698 | 698 | } |
| 699 | 699 | |
| r5932 | r5933 | |
| 750 | 750 | COMBINE_DATA(x68k_spriteram+offset); |
| 751 | 751 | x68k_sys.video.tile8_dirty[offset / 16] = 1; |
| 752 | 752 | x68k_sys.video.tile16_dirty[offset / 64] = 1; |
| 753 | if(offset < 0x2000) | |
| 754 | { | |
| 755 | tilemap_mark_all_tiles_dirty(x68k_bg1_8); | |
| 756 | tilemap_mark_all_tiles_dirty(x68k_bg1_16); | |
| 757 | tilemap_mark_all_tiles_dirty(x68k_bg0_8); | |
| 758 | tilemap_mark_all_tiles_dirty(x68k_bg0_16); | |
| 759 | } | |
| 760 | if(offset >= 0x2000 && offset < 0x3000) | |
| 761 | { | |
| 762 | tilemap_mark_tile_dirty(x68k_bg1_8,offset & 0x0fff); | |
| 763 | tilemap_mark_tile_dirty(x68k_bg1_16,offset & 0x0fff); | |
| 764 | } | |
| 765 | if(offset >= 0x3000) | |
| 766 | { | |
| 767 | tilemap_mark_tile_dirty(x68k_bg0_8,offset & 0x0fff); | |
| 768 | tilemap_mark_tile_dirty(x68k_bg0_16,offset & 0x0fff); | |
| 769 | } | |
| 753 | if(offset < 0x2000) | |
| 754 | { | |
| 755 | tilemap_mark_all_tiles_dirty(x68k_bg1_8); | |
| 756 | tilemap_mark_all_tiles_dirty(x68k_bg1_16); | |
| 757 | tilemap_mark_all_tiles_dirty(x68k_bg0_8); | |
| 758 | tilemap_mark_all_tiles_dirty(x68k_bg0_16); | |
| 759 | } | |
| 760 | if(offset >= 0x2000 && offset < 0x3000) | |
| 761 | { | |
| 762 | tilemap_mark_tile_dirty(x68k_bg1_8,offset & 0x0fff); | |
| 763 | tilemap_mark_tile_dirty(x68k_bg1_16,offset & 0x0fff); | |
| 764 | } | |
| 765 | if(offset >= 0x3000) | |
| 766 | { | |
| 767 | tilemap_mark_tile_dirty(x68k_bg0_8,offset & 0x0fff); | |
| 768 | tilemap_mark_tile_dirty(x68k_bg0_16,offset & 0x0fff); | |
| 769 | } | |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | READ16_HANDLER( x68k_spriteram_r ) |
| r5932 | r5933 | |
| 780 | 780 | UINT32 loc; // location in TVRAM |
| 781 | 781 | UINT32 colour; |
| 782 | 782 | int bit; |
| 783 | ||
| 783 | ||
| 784 | 784 | for(line=rect.min_y;line<=rect.max_y;line++) // per scanline |
| 785 | 785 | { |
| 786 | 786 | // adjust for scroll registers |
| r5932 | r5933 | |
| 823 | 823 | |
| 824 | 824 | if(x68k_sys.crtc.reg[20] & 0x0800) // if graphic layers are set to buffer, then they aren't visible |
| 825 | 825 | return; |
| 826 | ||
| 826 | ||
| 827 | 827 | for(priority=3;priority>=0;priority--) |
| 828 | 828 | { |
| 829 | 829 | if(x68k_sys.crtc.reg[20] & 0x0400) // 1024x1024 "real" screen size - use 1024x1024 16-colour gfx layer |
| r5932 | r5933 | |
| 872 | 872 | yscr = x68k_sys.crtc.vbegin-(x68k_sys.crtc.reg[13 + (gpage*2)] & 0x1ff); |
| 873 | 873 | copyscrollbitmap_trans(bitmap, x68k_get_gfx_page(gpage,GFX256), 1, &xscr, 1, &yscr, &cliprect,0); |
| 874 | 874 | } |
| 875 | } | |
| 875 | } | |
| 876 | 876 | break; |
| 877 | 877 | case 0x00: |
| 878 | 878 | // 16 colour gfx screen |
| r5932 | r5933 | |
| 897 | 897 | static void x68k_draw_sprites(running_machine *machine, bitmap_t* bitmap, int priority, rectangle cliprect) |
| 898 | 898 | { |
| 899 | 899 | /* |
| 900 | 0xeb0000 - 0xeb07ff - Sprite registers (up to 128) | |
| 901 | + 00 : b9-0, Sprite X position | |
| 902 | + 02 : b9-0, Sprite Y position | |
| 903 | + 04 : b15, Vertical Reversing (flipping?) | |
| 904 | b14, Horizontal Reversing | |
| 905 | b11-8, Sprite colour | |
| 906 | b7-0, Sprite tile code (in PCG) | |
| 907 | + 06 : b1-0, Priority | |
| 908 | 00 = Sprite not displayed | |
| 900 | 0xeb0000 - 0xeb07ff - Sprite registers (up to 128) | |
| 901 | + 00 : b9-0, Sprite X position | |
| 902 | + 02 : b9-0, Sprite Y position | |
| 903 | + 04 : b15, Vertical Reversing (flipping?) | |
| 904 | b14, Horizontal Reversing | |
| 905 | b11-8, Sprite colour | |
| 906 | b7-0, Sprite tile code (in PCG) | |
| 907 | + 06 : b1-0, Priority | |
| 908 | 00 = Sprite not displayed | |
| 909 | 909 | |
| 910 | 0xeb0800 - BG0 X Scroll (10-bit) | |
| 911 | 0xeb0802 - BG0 Y Scroll | |
| 912 | 0xeb0804 - BG1 X Scroll | |
| 913 | 0xeb0806 - BG1 Y Scroll | |
| 914 | 0xeb0808 - BG control | |
| 915 | b9, BG/Sprite display (RAM and register access is faster if 1) | |
| 916 | b4, PCG area 1 available | |
| 917 | b3, BG1 display enable | |
| 918 | b1, PCG area 0 available | |
| 919 | b0, BG0 display enable | |
| 920 | 0xeb080a - Horizontal total (like CRTC reg 0 - is 0xff if in 256x256?) | |
| 921 | 0xeb080c - Horizontal display position (like CRTC reg 2 - +4) | |
| 922 | 0xeb080e - Vertical display position (like CRTC reg 6) | |
| 923 | 0xeb0810 - Resolution setting | |
| 924 | b4, "L/H" (apparently 15kHz/31kHz switch for sprites/BG?) | |
| 925 | b3-2, V-Res | |
| 926 | b1-0, H-Res (0 = 8x8 tilemaps, 1 = 16x16 tilemaps, 2 or 3 = unknown) | |
| 927 | */ | |
| 910 | 0xeb0800 - BG0 X Scroll (10-bit) | |
| 911 | 0xeb0802 - BG0 Y Scroll | |
| 912 | 0xeb0804 - BG1 X Scroll | |
| 913 | 0xeb0806 - BG1 Y Scroll | |
| 914 | 0xeb0808 - BG control | |
| 915 | b9, BG/Sprite display (RAM and register access is faster if 1) | |
| 916 | b4, PCG area 1 available | |
| 917 | b3, BG1 display enable | |
| 918 | b1, PCG area 0 available | |
| 919 | b0, BG0 display enable | |
| 920 | 0xeb080a - Horizontal total (like CRTC reg 0 - is 0xff if in 256x256?) | |
| 921 | 0xeb080c - Horizontal display position (like CRTC reg 2 - +4) | |
| 922 | 0xeb080e - Vertical display position (like CRTC reg 6) | |
| 923 | 0xeb0810 - Resolution setting | |
| 924 | b4, "L/H" (apparently 15kHz/31kHz switch for sprites/BG?) | |
| 925 | b3-2, V-Res | |
| 926 | b1-0, H-Res (0 = 8x8 tilemaps, 1 = 16x16 tilemaps, 2 or 3 = unknown) | |
| 927 | */ | |
| 928 | 928 | int ptr,pri; |
| 929 | 929 | |
| 930 | 930 | for(ptr=508;ptr>=0;ptr-=4) // stepping through sprites |
| r5932 | r5933 | |
| 1068 | 1068 | tilemap_set_transparent_pen(x68k_bg0_16,0); |
| 1069 | 1069 | tilemap_set_transparent_pen(x68k_bg1_16,0); |
| 1070 | 1070 | |
| 1071 | // | |
| 1071 | // timer_adjust_periodic(x68k_scanline_timer, attotime_zero, 0, ATTOTIME_IN_HZ(55.45)/568); | |
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | VIDEO_UPDATE( x68000 ) |
| r5932 | r5933 | |
| 1091 | 1091 | x68k_bg0 = x68k_bg0_16; |
| 1092 | 1092 | x68k_bg1 = x68k_bg1_16; |
| 1093 | 1093 | } |
| 1094 | // rect.max_x=x68k_sys.crtc.width; | |
| 1095 | // rect.max_y=x68k_sys.crtc.height; | |
| 1094 | // rect.max_x=x68k_sys.crtc.width; | |
| 1095 | // rect.max_y=x68k_sys.crtc.height; | |
| 1096 | 1096 | bitmap_fill(bitmap,cliprect,0); |
| 1097 | 1097 | |
| 1098 | 1098 | if(x68k_sys.sysport.contrast == 0) // if monitor contrast is 0, then don't bother displaying anything |
| r5932 | r5933 | |
| 1100 | 1100 | |
| 1101 | 1101 | rect.min_x=x68k_sys.crtc.hbegin; |
| 1102 | 1102 | rect.min_y=x68k_sys.crtc.vbegin; |
| 1103 | // rect.max_x=rect.min_x + x68k_sys.crtc.visible_width-1; | |
| 1104 | // rect.max_y=rect.min_y + x68k_sys.crtc.visible_height-1; | |
| 1103 | // rect.max_x=rect.min_x + x68k_sys.crtc.visible_width-1; | |
| 1104 | // rect.max_y=rect.min_y + x68k_sys.crtc.visible_height-1; | |
| 1105 | 1105 | rect.max_x=x68k_sys.crtc.hend; |
| 1106 | 1106 | rect.max_y=x68k_sys.crtc.vend; |
| 1107 | 1107 | |
| r5932 | r5933 | |
| 1185 | 1185 | { |
| 1186 | 1186 | x68k_sys.mfp.isra = 0; |
| 1187 | 1187 | x68k_sys.mfp.isrb = 0; |
| 1188 | // mfp_trigger_irq(MFP_IRQ_GPIP6); | |
| 1189 | // cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x43); | |
| 1188 | // mfp_trigger_irq(MFP_IRQ_GPIP6); | |
| 1189 | // cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x43); | |
| 1190 | 1190 | } |
| 1191 | 1191 | if(input_code_pressed(screen->machine,KEYCODE_9)) |
| 1192 | 1192 | { |
| r5932 | r5933 | |
| 1202 | 1202 | #endif |
| 1203 | 1203 | |
| 1204 | 1204 | #ifdef MAME_DEBUG |
| 1205 | // popmessage("Layer priorities [%04x] - Txt: %i Spr: %i Gfx: %i Layer Pri0-3: %i %i %i %i",x68k_sys.video.reg[1],x68k_sys.video.text_pri,x68k_sys.video.sprite_pri, | |
| 1206 | // x68k_sys.video.gfx_pri,x68k_sys.video.gfxlayer_pri[0],x68k_sys.video.gfxlayer_pri[1],x68k_sys.video.gfxlayer_pri[2],x68k_sys.video.gfxlayer_pri[3]); | |
| 1207 | // popmessage("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i",x68k_sys.crtc.reg[0],x68k_sys.crtc.reg[1],x68k_sys.crtc.reg[2],x68k_sys.crtc.reg[3], | |
| 1208 | // x68k_sys.crtc.reg[4],x68k_sys.crtc.reg[5],x68k_sys.crtc.reg[6],x68k_sys.crtc.reg[7],x68k_sys.crtc.reg[8],x68k_sys.crtc.reg[9]); | |
| 1209 | // popmessage("Visible resolution = %ix%i (%s) Screen size = %ix%i",x68k_sys.crtc.visible_width,x68k_sys.crtc.visible_height,x68k_sys.crtc.interlace ? "Interlaced" : "Non-interlaced",x68k_sys.crtc.video_width,x68k_sys.crtc.video_height); | |
| 1210 | // popmessage("VBlank : x68k_scanline = %i",x68k_scanline); | |
| 1211 | // popmessage("CRTC/BG compare H-TOTAL %i/%i H-DISP %i/%i V-DISP %i/%i BG Res %02x",x68k_sys.crtc.reg[0],x68k_spritereg[0x405],x68k_sys.crtc.reg[2],x68k_spritereg[0x406], | |
| 1212 | // x68k_sys.crtc.reg[6],x68k_spritereg[0x407],x68k_spritereg[0x408]); | |
| 1213 | // popmessage("IER %02x %02x IPR %02x %02x ISR %02x %02x IMR %02x %02x", x68k_sys.mfp.iera,x68k_sys.mfp.ierb,x68k_sys.mfp.ipra,x68k_sys.mfp.iprb, | |
| 1214 | // x68k_sys.mfp.isra,x68k_sys.mfp.isrb,x68k_sys.mfp.imra,x68k_sys.mfp.imrb); | |
| 1215 | // popmessage("BG Scroll - BG0 X %i Y %i BG1 X %i Y %i",x68k_spriteram[0x400],x68k_spriteram[0x401],x68k_spriteram[0x402],x68k_spriteram[0x403]); | |
| 1216 | // popmessage("Keyboard buffer position = %i",x68k_sys.keyboard.headpos); | |
| 1217 | // popmessage("IERA = 0x%02x, IERB = 0x%02x",x68k_sys.mfp.iera,x68k_sys.mfp.ierb); | |
| 1218 | // popmessage("IPRA = 0x%02x, IPRB = 0x%02x",x68k_sys.mfp.ipra,x68k_sys.mfp.iprb); | |
| 1219 | // popmessage("uPD72065 status = %02x",nec765_status_r(machine, 0)); | |
| 1220 | // popmessage("Layer enable - 0x%02x",x68k_sys.video.reg[2] & 0xff); | |
| 1221 | // popmessage("Graphic layer scroll - %i, %i - %i, %i - %i, %i - %i, %i", | |
| 1222 | // x68k_sys.crtc.reg[12],x68k_sys.crtc.reg[13],x68k_sys.crtc.reg[14],x68k_sys.crtc.reg[15],x68k_sys.crtc.reg[16],x68k_sys.crtc.reg[17],x68k_sys.crtc.reg[18],x68k_sys.crtc.reg[19]); | |
| 1223 | // popmessage("IOC IRQ status - %02x",x68k_sys.ioc.irqstatus); | |
| 1224 | // popmessage("RAM: mouse data - %02x %02x %02x %02x",mess_ram[0x931],mess_ram[0x930],mess_ram[0x933],mess_ram[0x932]); | |
| 1205 | // popmessage("Layer priorities [%04x] - Txt: %i Spr: %i Gfx: %i Layer Pri0-3: %i %i %i %i",x68k_sys.video.reg[1],x68k_sys.video.text_pri,x68k_sys.video.sprite_pri, | |
| 1206 | // x68k_sys.video.gfx_pri,x68k_sys.video.gfxlayer_pri[0],x68k_sys.video.gfxlayer_pri[1],x68k_sys.video.gfxlayer_pri[2],x68k_sys.video.gfxlayer_pri[3]); | |
| 1207 | // popmessage("CRTC regs - %i %i %i %i - %i %i %i %i - %i - %i",x68k_sys.crtc.reg[0],x68k_sys.crtc.reg[1],x68k_sys.crtc.reg[2],x68k_sys.crtc.reg[3], | |
| 1208 | // x68k_sys.crtc.reg[4],x68k_sys.crtc.reg[5],x68k_sys.crtc.reg[6],x68k_sys.crtc.reg[7],x68k_sys.crtc.reg[8],x68k_sys.crtc.reg[9]); | |
| 1209 | // popmessage("Visible resolution = %ix%i (%s) Screen size = %ix%i",x68k_sys.crtc.visible_width,x68k_sys.crtc.visible_height,x68k_sys.crtc.interlace ? "Interlaced" : "Non-interlaced",x68k_sys.crtc.video_width,x68k_sys.crtc.video_height); | |
| 1210 | // popmessage("VBlank : x68k_scanline = %i",x68k_scanline); | |
| 1211 | // popmessage("CRTC/BG compare H-TOTAL %i/%i H-DISP %i/%i V-DISP %i/%i BG Res %02x",x68k_sys.crtc.reg[0],x68k_spritereg[0x405],x68k_sys.crtc.reg[2],x68k_spritereg[0x406], | |
| 1212 | // x68k_sys.crtc.reg[6],x68k_spritereg[0x407],x68k_spritereg[0x408]); | |
| 1213 | // popmessage("IER %02x %02x IPR %02x %02x ISR %02x %02x IMR %02x %02x", x68k_sys.mfp.iera,x68k_sys.mfp.ierb,x68k_sys.mfp.ipra,x68k_sys.mfp.iprb, | |
| 1214 | // x68k_sys.mfp.isra,x68k_sys.mfp.isrb,x68k_sys.mfp.imra,x68k_sys.mfp.imrb); | |
| 1215 | // popmessage("BG Scroll - BG0 X %i Y %i BG1 X %i Y %i",x68k_spriteram[0x400],x68k_spriteram[0x401],x68k_spriteram[0x402],x68k_spriteram[0x403]); | |
| 1216 | // popmessage("Keyboard buffer position = %i",x68k_sys.keyboard.headpos); | |
| 1217 | // popmessage("IERA = 0x%02x, IERB = 0x%02x",x68k_sys.mfp.iera,x68k_sys.mfp.ierb); | |
| 1218 | // popmessage("IPRA = 0x%02x, IPRB = 0x%02x",x68k_sys.mfp.ipra,x68k_sys.mfp.iprb); | |
| 1219 | // popmessage("uPD72065 status = %02x",nec765_status_r(machine, 0)); | |
| 1220 | // popmessage("Layer enable - 0x%02x",x68k_sys.video.reg[2] & 0xff); | |
| 1221 | // popmessage("Graphic layer scroll - %i, %i - %i, %i - %i, %i - %i, %i", | |
| 1222 | // x68k_sys.crtc.reg[12],x68k_sys.crtc.reg[13],x68k_sys.crtc.reg[14],x68k_sys.crtc.reg[15],x68k_sys.crtc.reg[16],x68k_sys.crtc.reg[17],x68k_sys.crtc.reg[18],x68k_sys.crtc.reg[19]); | |
| 1223 | // popmessage("IOC IRQ status - %02x",x68k_sys.ioc.irqstatus); | |
| 1224 | // popmessage("RAM: mouse data - %02x %02x %02x %02x",mess_ram[0x931],mess_ram[0x930],mess_ram[0x933],mess_ram[0x932]); | |
| 1225 | 1225 | #endif |
| 1226 | 1226 | return 0; |
| 1227 | 1227 | } |
| r5932 | r5933 | |
|---|---|---|
| 31 | 31 | { |
| 32 | 32 | int x,y; |
| 33 | 33 | const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 34 | ||
| 34 | ||
| 35 | 35 | for(y = 0; y < 16; y++ ) |
| 36 | 36 | { |
| 37 | 37 | for(x = 0; x < 64; x++ ) |
| r5932 | r5933 | |
|---|---|---|
| 31 | 31 | { |
| 32 | 32 | spectrum_frame_number = 0; |
| 33 | 33 | spectrum_flash_invert = 0; |
| 34 | ||
| 34 | ||
| 35 | 35 | EventList_Initialise(machine, 30000); |
| 36 | 36 | |
| 37 | 37 | retrace_cycles = SPEC_RETRACE_CYCLES; |
| 38 | ||
| 38 | ||
| 39 | 39 | spectrum_screen_location = spectrum_video_ram; |
| 40 | 40 | } |
| 41 | 41 | |
| r5932 | r5933 | |
| 45 | 45 | spectrum_flash_invert = 0; |
| 46 | 46 | |
| 47 | 47 | EventList_Initialise(machine, 30000); |
| 48 | ||
| 48 | ||
| 49 | 49 | retrace_cycles = SPEC128_RETRACE_CYCLES; |
| 50 | 50 | } |
| 51 | 51 | |
| r5932 | r5933 | |
| 170 | 170 | static const rgb_t spectrum_palette[16] = { |
| 171 | 171 | MAKE_RGB(0x00, 0x00, 0x00), |
| 172 | 172 | MAKE_RGB(0x00, 0x00, 0xbf), |
| 173 | MAKE_RGB(0xbf, 0x00, 0x00), | |
| 173 | MAKE_RGB(0xbf, 0x00, 0x00), | |
| 174 | 174 | MAKE_RGB(0xbf, 0x00, 0xbf), |
| 175 | MAKE_RGB(0x00, 0xbf, 0x00), | |
| 175 | MAKE_RGB(0x00, 0xbf, 0x00), | |
| 176 | 176 | MAKE_RGB(0x00, 0xbf, 0xbf), |
| 177 | MAKE_RGB(0xbf, 0xbf, 0x00), | |
| 177 | MAKE_RGB(0xbf, 0xbf, 0x00), | |
| 178 | 178 | MAKE_RGB(0xbf, 0xbf, 0xbf), |
| 179 | 179 | MAKE_RGB(0x00, 0x00, 0x00), |
| 180 | 180 | MAKE_RGB(0x00, 0x00, 0xff), |
| r5932 | r5933 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | /*********************************************************** |
| 16 | 16 | |
| 17 | ||
| 17 | Video | |
| 18 | 18 | |
| 19 | 19 | ************************************************************/ |
| 20 | 20 | |
| 21 | 21 | PALETTE_INIT( kaypro ) |
| 22 | 22 | { |
| 23 | 23 | palette_set_color(machine, 0, RGB_BLACK); /* black */ |
| 24 | palette_set_color(machine, 1, MAKE_RGB(0, 220, 0)); /* green */ | |
| 25 | palette_set_color(machine, 2, MAKE_RGB(0, 110, 0)); /* low intensity green */ | |
| 24 | palette_set_color(machine, 1, MAKE_RGB(0, 220, 0)); /* green */ | |
| 25 | palette_set_color(machine, 2, MAKE_RGB(0, 110, 0)); /* low intensity green */ | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | VIDEO_UPDATE( kayproii ) |
| 29 | 29 | { |
| 30 | 30 | /* The display consists of 80 columns and 24 rows. Each row is allocated 128 bytes of ram, |
| 31 | but only the first 80 are used. The total video ram therefore is 0x0c00 bytes. | |
| 32 | There is one video attribute: bit 7 causes blinking. The first half of the | |
| 33 | character generator is blank, with the visible characters in the 2nd half. | |
| 34 | During the "off" period of blanking, the first half is used. Only 5 pixels are | |
| 35 | connected from the rom to the shift register, the remaining pixels are held high. | |
| 36 | A high pixel is black and a low pixel is green. */ | |
| 31 | but only the first 80 are used. The total video ram therefore is 0x0c00 bytes. | |
| 32 | There is one video attribute: bit 7 causes blinking. The first half of the | |
| 33 | character generator is blank, with the visible characters in the 2nd half. | |
| 34 | During the "off" period of blanking, the first half is used. Only 5 pixels are | |
| 35 | connected from the rom to the shift register, the remaining pixels are held high. | |
| 36 | A high pixel is black and a low pixel is green. */ | |
| 37 | 37 | |
| 38 | 38 | static UINT8 framecnt=0; |
| 39 | 39 | UINT8 y,ra,chr,gfx; |
| r5932 | r5933 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /* bit 6 of kaypro2x_system_port selects alternate characters (A12 on character generator rom). |
| 136 | The diagram specifies a 2732 with 28 pins, and more address pins. Possibly a 2764 or 27128. | |
| 137 | Since our dump only goes up to A11, the alternate character set doesn't exist. | |
| 136 | The diagram specifies a 2732 with 28 pins, and more address pins. Possibly a 2764 or 27128. | |
| 137 | Since our dump only goes up to A11, the alternate character set doesn't exist. | |
| 138 | 138 | |
| 139 | 0000-07FF of videoram is memory-mapped characters; 0800-0FFF is equivalent attribute bytes. | |
| 140 | d3 Underline | |
| 141 | d2 blinking (at unknown rate) | |
| 142 | d1 low intensity | |
| 143 | d0 reverse video | |
| 139 | 0000-07FF of videoram is memory-mapped characters; 0800-0FFF is equivalent attribute bytes. | |
| 140 | d3 Underline | |
| 141 | d2 blinking (at unknown rate) | |
| 142 | d1 low intensity | |
| 143 | d0 reverse video | |
| 144 | 144 | |
| 145 | ||
| 145 | Not sure how the attributes interact, for example does an underline blink? */ | |
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | MC6845_UPDATE_ROW( kaypro2x_update_row ) |
| r5932 | r5933 | |
| 152 | 152 | for (x = 0; x < x_count; x++) // for each character |
| 153 | 153 | { |
| 154 | 154 | UINT8 inv=0; |
| 155 | // | |
| 155 | // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ | |
| 156 | 156 | mem = (ma + x) & 0x7ff; |
| 157 | 157 | chr = videoram[mem]; |
| 158 | 158 | attr = videoram[mem | 0x800]; |
| r5932 | r5933 | |
| 217 | 217 | UINT8 i,curs_type=0,r9,r10,r11; |
| 218 | 218 | |
| 219 | 219 | /* curs_type holds the general cursor shape to be created |
| 220 | 0 = no cursor | |
| 221 | 1 = partial cursor (only shows on a block of scan lines) | |
| 222 | 2 = full cursor | |
| 223 | 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ | |
| 220 | 0 = no cursor | |
| 221 | 1 = partial cursor (only shows on a block of scan lines) | |
| 222 | 2 = full cursor | |
| 223 | 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ | |
| 224 | 224 | |
| 225 | 225 | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) mc6845_cursor[i] = 0; // prepare cursor by erasing old one |
| 226 | 226 | |
| r5932 | r5933 | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /* Resize the screen within the limits of the hardware. Expand the image to fill the screen area. |
| 250 | ||
| 250 | Standard screen is 640 x 400 = 0x7d0 bytes. */ | |
| 251 | 251 | |
| 252 | 252 | static void mc6845_screen_configure(running_machine *machine) |
| 253 | 253 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* Super80.c written by Robbbert, 2005-2009. See the MESS wiki for documentation. */ |
| 2 | 2 | |
| 3 | 3 | /* Notes on using MAME MC6845 Device (MMD). |
| 4 | 1. Speed of MMD is about 20% slower than pre-MMD coding | |
| 5 | 2. Undocumented cursor start and end-lines is not supported by MMD, so we do it here | |
| 6 | 3. MMD doesn't support auto-screen-resize, so we do it here. */ | |
| 4 | 1. Speed of MMD is about 20% slower than pre-MMD coding | |
| 5 | 2. Undocumented cursor start and end-lines is not supported by MMD, so we do it here | |
| 6 | 3. MMD doesn't support auto-screen-resize, so we do it here. */ | |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| r5932 | r5933 | |
| 25 | 25 | |
| 26 | 26 | static const UINT8 super80_rgb_palette[16*3] = |
| 27 | 27 | { |
| 28 | 0x00, 0x00, 0x00, /* 0 Black */ | |
| 29 | 0x00, 0x00, 0x00, /* 1 Black */ | |
| 30 | 0x00, 0x00, 0x7f, /* 2 Blue */ | |
| 31 | 0x00, 0x00, 0xff, /* 3 Light Blue */ | |
| 32 | 0x00, 0x7f, 0x00, /* 4 Green */ | |
| 33 | 0x00, 0xff, 0x00, /* 5 Bright Green */ | |
| 34 | 0x00, 0x7f, 0x7f, /* 6 Cyan */ | |
| 35 | 0x00, 0xff, 0xff, /* 7 Turquoise */ | |
| 36 | 0x7f, 0x00, 0x00, /* 8 Dark Red */ | |
| 37 | 0xff, 0x00, 0x00, /* 9 Red */ | |
| 38 | 0x7f, 0x00, 0x7f, /* 10 Purple */ | |
| 39 | 0xff, 0x00, 0xff, /* 11 Magenta */ | |
| 40 | 0x7f, 0x7f, 0x00, /* 12 Lime */ | |
| 41 | 0xff, 0xff, 0x00, /* 13 Yellow */ | |
| 42 | 0xbf, 0xbf, 0xbf, /* 14 Off White */ | |
| 43 | 0xff, 0xff, 0xff, /* 15 White */ | |
| 28 | 0x00, 0x00, 0x00, /* 0 Black */ | |
| 29 | 0x00, 0x00, 0x00, /* 1 Black */ | |
| 30 | 0x00, 0x00, 0x7f, /* 2 Blue */ | |
| 31 | 0x00, 0x00, 0xff, /* 3 Light Blue */ | |
| 32 | 0x00, 0x7f, 0x00, /* 4 Green */ | |
| 33 | 0x00, 0xff, 0x00, /* 5 Bright Green */ | |
| 34 | 0x00, 0x7f, 0x7f, /* 6 Cyan */ | |
| 35 | 0x00, 0xff, 0xff, /* 7 Turquoise */ | |
| 36 | 0x7f, 0x00, 0x00, /* 8 Dark Red */ | |
| 37 | 0xff, 0x00, 0x00, /* 9 Red */ | |
| 38 | 0x7f, 0x00, 0x7f, /* 10 Purple */ | |
| 39 | 0xff, 0x00, 0xff, /* 11 Magenta */ | |
| 40 | 0x7f, 0x7f, 0x00, /* 12 Lime */ | |
| 41 | 0xff, 0xff, 0x00, /* 13 Yellow */ | |
| 42 | 0xbf, 0xbf, 0xbf, /* 14 Off White */ | |
| 43 | 0xff, 0xff, 0xff, /* 15 White */ | |
| 44 | 44 | }; |
| 45 | 45 | |
| 46 | 46 | static const UINT8 super80_comp_palette[16*3] = |
| 47 | 47 | { |
| 48 | 0x00, 0x00, 0x00, /* 0 Black */ | |
| 49 | 0x80, 0x80, 0x80, /* 1 Grey */ | |
| 50 | 0x00, 0x00, 0xff, /* 2 Blue */ | |
| 51 | 0xff, 0xff, 0x80, /* 3 Light Yellow */ | |
| 52 | 0x00, 0xff, 0x00, /* 4 Green */ | |
| 53 | 0xff, 0x80, 0xff, /* 5 Light Magenta */ | |
| 54 | 0x00, 0xff, 0xff, /* 6 Cyan */ | |
| 55 | 0xff, 0x40, 0x40, /* 7 Light Red */ | |
| 56 | 0xff, 0x00, 0x00, /* 8 Red */ | |
| 57 | 0x00, 0x80, 0x80, /* 9 Dark Cyan */ | |
| 58 | 0xff, 0x00, 0xff, /* 10 Magenta */ | |
| 59 | 0x80, 0xff, 0x80, /* 11 Light Green */ | |
| 60 | 0xff, 0xff, 0x00, /* 12 Yellow */ | |
| 61 | 0x00, 0x00, 0x80, /* 13 Dark Blue */ | |
| 62 | 0xff, 0xff, 0xff, /* 14 White */ | |
| 63 | 0x00, 0x00, 0x00, /* 15 Black */ | |
| 48 | 0x00, 0x00, 0x00, /* 0 Black */ | |
| 49 | 0x80, 0x80, 0x80, /* 1 Grey */ | |
| 50 | 0x00, 0x00, 0xff, /* 2 Blue */ | |
| 51 | 0xff, 0xff, 0x80, /* 3 Light Yellow */ | |
| 52 | 0x00, 0xff, 0x00, /* 4 Green */ | |
| 53 | 0xff, 0x80, 0xff, /* 5 Light Magenta */ | |
| 54 | 0x00, 0xff, 0xff, /* 6 Cyan */ | |
| 55 | 0xff, 0x40, 0x40, /* 7 Light Red */ | |
| 56 | 0xff, 0x00, 0x00, /* 8 Red */ | |
| 57 | 0x00, 0x80, 0x80, /* 9 Dark Cyan */ | |
| 58 | 0xff, 0x00, 0xff, /* 10 Magenta */ | |
| 59 | 0x80, 0xff, 0x80, /* 11 Light Green */ | |
| 60 | 0xff, 0xff, 0x00, /* 12 Yellow */ | |
| 61 | 0x00, 0x00, 0x80, /* 13 Dark Blue */ | |
| 62 | 0xff, 0xff, 0xff, /* 14 White */ | |
| 63 | 0x00, 0x00, 0x00, /* 15 Black */ | |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | 66 | static void palette_set_colors_rgb(running_machine *machine, const UINT8 *colors) |
| r5932 | r5933 | |
| 289 | 289 | |
| 290 | 290 | /*--------------------------------------------------------------- |
| 291 | 291 | |
| 292 | ||
| 292 | Super-80R and Super-80V | |
| 293 | 293 | |
| 294 | 294 | ---------------------------------------------------------------*/ |
| 295 | 295 | |
| r5932 | r5933 | |
| 348 | 348 | UINT8 i,curs_type=0,r9,r10,r11; |
| 349 | 349 | |
| 350 | 350 | /* curs_type holds the general cursor shape to be created |
| 351 | 0 = no cursor | |
| 352 | 1 = partial cursor (only shows on a block of scan lines) | |
| 353 | 2 = full cursor | |
| 354 | 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ | |
| 351 | 0 = no cursor | |
| 352 | 1 = partial cursor (only shows on a block of scan lines) | |
| 353 | 2 = full cursor | |
| 354 | 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ | |
| 355 | 355 | |
| 356 | 356 | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) mc6845_cursor[i] = 0; // prepare cursor by erasing old one |
| 357 | 357 | |
| r5932 | r5933 | |
| 419 | 419 | for (x = 0; x < x_count; x++) // for each character |
| 420 | 420 | { |
| 421 | 421 | UINT8 inv=0; |
| 422 | // | |
| 422 | // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ | |
| 423 | 423 | mem = (ma + x) & 0xfff; |
| 424 | 424 | chr = videoram[mem]; |
| 425 | 425 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | IBM EGA CRT Controller emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | This controller is very loosely based on the mc6845. | |
| 6 | 6 | |
| 7 | 7 | **********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 220 | 220 | default: break; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | // /* display message if the Mode Control register is not zero */ | |
| 224 | // if ((crtc_ega->register_address_latch == 0x08) && (crtc_ega->mode_control != 0)) | |
| 225 | // popmessage("Mode Control %02X is not supported!!!", crtc_ega->mode_control); | |
| 223 | // /* display message if the Mode Control register is not zero */ | |
| 224 | // if ((crtc_ega->register_address_latch == 0x08) && (crtc_ega->mode_control != 0)) | |
| 225 | // popmessage("Mode Control %02X is not supported!!!", crtc_ega->mode_control); | |
| 226 | 226 | |
| 227 | 227 | recompute_parameters(crtc_ega, FALSE); |
| 228 | 228 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | TODO: | |
| 4 | 4 | |
| 5 | - double screen width to allow for medium resolution | |
| 6 | - STe pixelofs | |
| 7 | - blitter hog | |
| 8 | - high resolution | |
| 5 | - double screen width to allow for medium resolution | |
| 6 | - STe pixelofs | |
| 7 | - blitter hog | |
| 8 | - high resolution | |
| 9 | 9 | |
| 10 | 10 | */ |
| 11 | 11 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | TX-0 | |
| 3 | 3 | |
| 4 | ||
| 4 | Raphael Nabet, 2004 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| r5932 | r5933 | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | /* |
| 40 | ||
| 40 | video init | |
| 41 | 41 | */ |
| 42 | 42 | VIDEO_START( tx0 ) |
| 43 | 43 | { |
| r5932 | r5933 | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | /* |
| 59 | ||
| 59 | schedule a pixel to be plotted | |
| 60 | 60 | */ |
| 61 | 61 | void tx0_plot(int x, int y) |
| 62 | 62 | { |
| r5932 | r5933 | |
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | /* |
| 71 | ||
| 71 | VIDEO_UPDATE( tx0 ): effectively redraw the screen | |
| 72 | 72 | */ |
| 73 | 73 | VIDEO_UPDATE( tx0 ) |
| 74 | 74 | { |
| r5932 | r5933 | |
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | /* |
| 87 | ||
| 87 | Operator control panel code | |
| 88 | 88 | */ |
| 89 | 89 | |
| 90 | 90 | enum |
| r5932 | r5933 | |
| 237 | 237 | #endif |
| 238 | 238 | |
| 239 | 239 | /* |
| 240 | ||
| 240 | draw the operator control panel (fixed backdrop) | |
| 241 | 241 | */ |
| 242 | 242 | static void tx0_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap) |
| 243 | 243 | { |
| r5932 | r5933 | |
| 284 | 284 | |
| 285 | 285 | |
| 286 | 286 | /* |
| 287 | ||
| 287 | draw the operator control panel (dynamic elements) | |
| 288 | 288 | */ |
| 289 | 289 | static void tx0_draw_panel(running_machine *machine, bitmap_t *bitmap) |
| 290 | 290 | { |
| r5932 | r5933 | |
| 326 | 326 | |
| 327 | 327 | |
| 328 | 328 | /* |
| 329 | ||
| 329 | Typewriter code | |
| 330 | 330 | */ |
| 331 | 331 | |
| 332 | 332 | |
| r5932 | r5933 | |
| 420 | 420 | case 020: |
| 421 | 421 | /* color shift */ |
| 422 | 422 | /*color = color_typewriter_black; |
| 423 | ||
| 423 | color = color_typewriter_red;*/ | |
| 424 | 424 | break; |
| 425 | 425 | |
| 426 | 426 | case 043: |
| r5932 | r5933 | |
|---|---|---|
| 64 | 64 | |
| 65 | 65 | for (Count = 0; Count < NumItems; Count++) |
| 66 | 66 | { |
| 67 | // | |
| 67 | // logerror ("Event no %05d, ID = %04x, data = %04x, time = %ld\n", Count, pItem[Count].Event_ID, pItem[Count].Event_Data, (long) pItem[Count].Event_Time); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /* Find the first and second events with the correct ID */ |
| r5932 | r5933 | |
| 85 | 85 | else if (NextItem >= NumItems) |
| 86 | 86 | { |
| 87 | 87 | /* Single border colour - this is not strictly correct as the |
| 88 | colour change may have occurred midway through the frame | |
| 89 | or after the last visible border line however the whole | |
| 90 | border would be redrawn in the correct colour during the | |
| 91 | next frame anyway! */ | |
| 88 | colour change may have occurred midway through the frame | |
| 89 | or after the last visible border line however the whole | |
| 90 | border would be redrawn in the correct colour during the | |
| 91 | next frame anyway! */ | |
| 92 | 92 | r.min_x = 0; |
| 93 | 93 | r.max_x = TotalScreenWidth-1; |
| 94 | 94 | r.min_y = 0; |
| r5932 | r5933 | |
| 111 | 111 | r.max_y = TotalScreenHeight-1; |
| 112 | 112 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 113 | 113 | |
| 114 | // | |
| 114 | // logerror ("Setting border colour to %d (Last = %d, Full Refresh = %d)\n", CurrBorderColor, LastDisplayedBorderColor, full_refresh); | |
| 115 | 115 | LastDisplayedBorderColor = CurrBorderColor; |
| 116 | 116 | } |
| 117 | 117 | else |
| r5932 | r5933 | |
| 336 | 336 | /* Set value to ensure redraw on next frame */ |
| 337 | 337 | LastDisplayedBorderColor = -1; |
| 338 | 338 | |
| 339 | // | |
| 339 | // logerror ("Multi coloured border drawn (last colour = %d)\n", CurrBorderColor); | |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /* Assume all other routines have processed their data from the list */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Motorola 6845 CRT controller and emulation | |
| 4 | 4 | |
| 5 | This code emulates the functionality of the 6845 chip, and also | |
| 6 | supports the functionality of chips related to the 6845 | |
| 5 | This code emulates the functionality of the 6845 chip, and also | |
| 6 | supports the functionality of chips related to the 6845 | |
| 7 | 7 | |
| 8 | Peter Trauner | |
| 9 | Nathan Woods | |
| 8 | Peter Trauner | |
| 9 | Nathan Woods | |
| 10 | 10 | |
| 11 | Registers | |
| 12 | 00 - Horiz. total characters | |
| 13 | 01 - Horiz. displayed characters per line | |
| 14 | 02 - Horiz. synch position | |
| 15 | 03 - Horiz. synch width in characters | |
| 16 | 04 - Vert. total lines | |
| 17 | 05 - Vert. total adjust (scan lines) | |
| 18 | 06 - Vert. displayed rows | |
| 19 | 07 - Vert. synch position (character rows) | |
| 20 | 08 - Interlace mode | |
| 21 | 09 - Maximum scan line address | |
| 22 | 0A - Cursor start (scan line) | |
| 23 | 0B - Cursor end (scan line) | |
| 24 | 0C - Start address (MSB) | |
| 25 | 0D - Start address (LSB) | |
| 26 | 0E - Cursor address (MSB) (read/write) | |
| 27 | 0F - Cursor address (LSB) (read/write) | |
| 28 | 10 - Light pen (MSB) (read only) | |
| 29 | 11 - Light pen (LSB) (read only) | |
| 11 | Registers | |
| 12 | 00 - Horiz. total characters | |
| 13 | 01 - Horiz. displayed characters per line | |
| 14 | 02 - Horiz. synch position | |
| 15 | 03 - Horiz. synch width in characters | |
| 16 | 04 - Vert. total lines | |
| 17 | 05 - Vert. total adjust (scan lines) | |
| 18 | 06 - Vert. displayed rows | |
| 19 | 07 - Vert. synch position (character rows) | |
| 20 | 08 - Interlace mode | |
| 21 | 09 - Maximum scan line address | |
| 22 | 0A - Cursor start (scan line) | |
| 23 | 0B - Cursor end (scan line) | |
| 24 | 0C - Start address (MSB) | |
| 25 | 0D - Start address (LSB) | |
| 26 | 0E - Cursor address (MSB) (read/write) | |
| 27 | 0F - Cursor address (LSB) (read/write) | |
| 28 | 10 - Light pen (MSB) (read only) | |
| 29 | 11 - Light pen (LSB) (read only) | |
| 30 | 30 | |
| 31 | 31 | ***************************************************************************/ |
| 32 | 32 | |
| r5932 | r5933 | |
| 37 | 37 | |
| 38 | 38 | /*************************************************************************** |
| 39 | 39 | |
| 40 | ||
| 40 | Type definitions | |
| 41 | 41 | |
| 42 | 42 | ***************************************************************************/ |
| 43 | 43 | |
| r5932 | r5933 | |
| 60 | 60 | |
| 61 | 61 | /*************************************************************************** |
| 62 | 62 | |
| 63 | ||
| 63 | Local variables | |
| 64 | 64 | |
| 65 | 65 | ***************************************************************************/ |
| 66 | 66 | |
| 67 | 67 | /*------------------------------------------------- |
| 68 | mscrtc6845_reg_mask - an array specifying how | |
| 69 | much of any given register "registers", per | |
| 70 | m6845 personality | |
| 68 | mscrtc6845_reg_mask - an array specifying how | |
| 69 | much of any given register "registers", per | |
| 70 | m6845 personality | |
| 71 | 71 | -------------------------------------------------*/ |
| 72 | 72 | |
| 73 | 73 | static const struct reg_mask mscrtc6845_reg_mask[2][18] = |
| r5932 | r5933 | |
| 99 | 99 | |
| 100 | 100 | /*************************************************************************** |
| 101 | 101 | |
| 102 | ||
| 102 | Functions | |
| 103 | 103 | |
| 104 | 104 | ***************************************************************************/ |
| 105 | 105 | |
| r5932 | r5933 | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /* since the PC1512 does not support the number of lines register directly, |
| 285 | * this value is keyed off of register 9 | |
| 286 | */ | |
| 285 | * this value is keyed off of register 9 | |
| 286 | */ | |
| 287 | 287 | if ((crtc->config.personality == M6845_PERSONALITY_PC1512) && (idx == 9)) |
| 288 | 288 | { |
| 289 | 289 | UINT8 char_height; |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | timex.c |
| 4 | 4 | |
| 5 | Functions to emulate the video hardware of the Timex ZX Spectrum clones. | |
| 5 | Functions to emulate the video hardware of the Timex ZX Spectrum clones. | |
| 6 | 6 | |
| 7 | 7 | Changes: |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | pc_video.c | |
| 4 | 4 | |
| 5 | ||
| 5 | PC Video code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 15 | 15 | |
| 16 | 16 | /*************************************************************************** |
| 17 | 17 | |
| 18 | ||
| 18 | Local variables | |
| 19 | 19 | |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | |
| r5932 | r5933 | |
| 143 | 143 | |
| 144 | 144 | /************************************* |
| 145 | 145 | * |
| 146 | * | |
| 146 | * Graphics renderers | |
| 147 | 147 | * |
| 148 | 148 | *************************************/ |
| 149 | 149 |
| r5932 | r5933 | |
|---|---|---|
| 174 | 174 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 175 | 175 | MDRV_SCREEN_SIZE(64*8, 16*16) |
| 176 | 176 | MDRV_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) |
| 177 | ||
| 177 | ||
| 178 | 178 | MDRV_PALETTE_LENGTH(2) |
| 179 | 179 | MDRV_PALETTE_INIT(black_and_white) |
| 180 | 180 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | video/oric.c | |
| 4 | 4 | |
| 5 | All graphic effects are supported including mid-line changes. | |
| 6 | There may be some small bugs. | |
| 5 | All graphic effects are supported including mid-line changes. | |
| 6 | There may be some small bugs. | |
| 7 | 7 | |
| 8 | TODO: | |
| 9 | - speed up this code a bit? | |
| 8 | TODO: | |
| 9 | - speed up this code a bit? | |
| 10 | 10 | |
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 | |
| r5932 | r5933 | |
| 24 | 24 | { |
| 25 | 25 | /* foreground and background colour used for rendering */ |
| 26 | 26 | /* if flash attribute is set, these two will both be equal |
| 27 | ||
| 27 | to background colour */ | |
| 28 | 28 | int active_foreground_colour; |
| 29 | 29 | int active_background_colour; |
| 30 | 30 | /* current foreground and background colour */ |
| r5932 | r5933 | |
| 159 | 159 | |
| 160 | 160 | /* a different charset base is used depending on the video mode */ |
| 161 | 161 | /* hires takes all the data from 0x0a000 through to about 0x0bf68, |
| 162 | ||
| 162 | so the charset is moved to 0x09800 */ | |
| 163 | 163 | /* text mode starts at 0x0bb80 and so the charset is in a different location */ |
| 164 | 164 | if (vh_state.mode & (1<<2)) |
| 165 | 165 | { |
| r5932 | r5933 | |
| 171 | 171 | vh_state.char_base = memory_get_read_ptr(space, 0x09800); |
| 172 | 172 | |
| 173 | 173 | /* changing the mode also changes the position of the standard charset |
| 174 | ||
| 174 | and alternative charset */ | |
| 175 | 175 | oric_refresh_charset(); |
| 176 | 176 | } |
| 177 | 177 | else |
| r5932 | r5933 | |
| 184 | 184 | vh_state.char_base = memory_get_read_ptr(space, 0x0b400); |
| 185 | 185 | |
| 186 | 186 | /* changing the mode also changes the position of the standard charset |
| 187 | ||
| 187 | and alternative charset */ | |
| 188 | 188 | oric_refresh_charset(); |
| 189 | 189 | } |
| 190 | 190 | } |
| r5932 | r5933 | |
| 277 | 277 | if (y<200) |
| 278 | 278 | { |
| 279 | 279 | /* calculate fetch address based on current line and |
| 280 | ||
| 280 | current mode */ | |
| 281 | 281 | if (hires_active) |
| 282 | 282 | { |
| 283 | 283 | read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(y*40); |
| r5932 | r5933 | |
| 347 | 347 | if (vh_state.text_attributes & (1<<1)) |
| 348 | 348 | { |
| 349 | 349 | /* if char line is even, top half of character is displayed, |
| 350 | ||
| 350 | if char line is odd, bottom half of character is displayed */ | |
| 351 | 351 | int double_height_flag = ((y>>3) & 0x01); |
| 352 | 352 | |
| 353 | 353 | /* calculate line to fetch */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | pc_video.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Refactoring of code common to PC video implementations | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Orao video driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 01/03/2008 Updated to work with latest SVN code | |
| 6 | 22/02/2008 Preliminary driver. | |
| 7 | ||
| 5 | 01/03/2008 Updated to work with latest SVN code | |
| 6 | 22/02/2008 Preliminary driver. | |
| 7 | ||
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "includes/orao.h" |
| 12 | 12 | |
| 13 | 13 | UINT8 *orao_video_ram; |
| 14 | ||
| 14 | ||
| 15 | 15 | VIDEO_START( orao ) |
| 16 | 16 | { |
| 17 | 17 | } |
| 18 | ||
| 18 | ||
| 19 | 19 | VIDEO_UPDATE( orao ) |
| 20 | 20 | { |
| 21 | 21 | UINT8 code; |
| 22 | 22 | int y, x, b; |
| 23 | ||
| 24 | int addr = 0; | |
| 23 | ||
| 24 | int addr = 0; | |
| 25 | 25 | for (y = 0; y < 256; y++) |
| 26 | 26 | { |
| 27 | 27 | int horpos = 0; |
| 28 | 28 | for (x = 0; x < 32; x++) |
| 29 | { | |
| 29 | { | |
| 30 | 30 | code = orao_video_ram[addr++]; |
| 31 | 31 | for (b = 0; b < 8; b++) |
| 32 | { | |
| 32 | { | |
| 33 | 33 | *BITMAP_ADDR16(bitmap, y, horpos++) = (code >> b) & 0x01; |
| 34 | 34 | } |
| 35 | 35 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | ||
| 2 | Motorola Evaluation Kit 6800 D2 | |
| 3 | 3 | MEK6800D2 |
| 4 | 4 | |
| 5 | 5 | video driver |
| 6 | 6 | |
| 7 | ||
| 7 | Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000 | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 19 | 19 | |
| 20 | 20 | for (i = 0; i < 16; i++) |
| 21 | 21 | colortable_palette_set_color(machine->colortable, i, MAKE_RGB(24 + (i + 1) * (i + 1) - 1, (i + 1) * (i + 1) / 4, 0)); |
| 22 | ||
| 22 | ||
| 23 | 23 | colortable_palette_set_color(machine->colortable, 16, MAKE_RGB(0, 0, 0)); |
| 24 | 24 | colortable_palette_set_color(machine->colortable, 17, MAKE_RGB(30, 30, 30)); |
| 25 | 25 | colortable_palette_set_color(machine->colortable, 18, MAKE_RGB(90, 90, 90)); |
| r5932 | r5933 | |
|---|---|---|
| 49 | 49 | devcb_resolved_write_line out_vsync_func; |
| 50 | 50 | devcb_resolved_write_line out_blank_func; |
| 51 | 51 | |
| 52 | int clock; | |
| 52 | int clock; | |
| 53 | 53 | |
| 54 | 54 | UINT8 ra[16]; /* parameter RAM */ |
| 55 | 55 | |
| r5932 | r5933 | |
| 76 | 76 | UINT32 ead; /* execute word address */ |
| 77 | 77 | UINT16 dad; /* dot address within the word */ |
| 78 | 78 | UINT32 lad; /* light pen address */ |
| 79 | ||
| 79 | ||
| 80 | 80 | int disp; /* display zoom factor */ |
| 81 | 81 | int gchr; /* zoom factor for graphics character writing and area filling */ |
| 82 | 82 | UINT16 mask; /* mask register */ |
| r5932 | r5933 | |
| 122 | 122 | ***************************************************************************/ |
| 123 | 123 | |
| 124 | 124 | /*------------------------------------------------- |
| 125 | recompute_parameters - | |
| 125 | recompute_parameters - | |
| 126 | 126 | -------------------------------------------------*/ |
| 127 | 127 | #ifdef UNUSED_FUNCTION |
| 128 | 128 | static void recompute_parameters(upd7220_t *upd7220) |
| r5932 | r5933 | |
| 143 | 143 | } |
| 144 | 144 | #endif |
| 145 | 145 | /*------------------------------------------------- |
| 146 | update_vsync_timer - | |
| 146 | update_vsync_timer - | |
| 147 | 147 | -------------------------------------------------*/ |
| 148 | 148 | |
| 149 | 149 | static void update_vsync_timer(upd7220_t *upd7220, int state) |
| r5932 | r5933 | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /*------------------------------------------------- |
| 173 | update_hsync_timer - | |
| 173 | update_hsync_timer - | |
| 174 | 174 | -------------------------------------------------*/ |
| 175 | 175 | |
| 176 | 176 | static void update_hsync_timer(upd7220_t *upd7220, int state) |
| r5932 | r5933 | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /*------------------------------------------------- |
| 203 | update_blank_timer - | |
| 203 | update_blank_timer - | |
| 204 | 204 | -------------------------------------------------*/ |
| 205 | 205 | |
| 206 | 206 | static void update_blank_timer(upd7220_t *upd7220, int state) |
| r5932 | r5933 | |
|---|---|---|
| 849 | 849 | if (c64_pal) |
| 850 | 850 | { |
| 851 | 851 | if (vic2.on) vic2_drawlines (device->machine, vic2.lastline, vic2.lines, VIC2_STARTVISIBLECOLUMNS + 32, VIC2_STARTVISIBLECOLUMNS + 32 + columns + 16 - 1); |
| 852 | } | |
| 852 | } | |
| 853 | 853 | else |
| 854 | 854 | { |
| 855 | 855 | if (vic2.on) vic2_drawlines (device->machine, vic2.lastline, vic2.lines, VIC2_STARTVISIBLECOLUMNS + 34, VIC2_STARTVISIBLECOLUMNS + 34 + columns + 16 - 1); |
| r5932 | r5933 | |
| 875 | 875 | if (c64_pal) |
| 876 | 876 | { |
| 877 | 877 | if (vic2.on) vic2_drawlines (device->machine, vic2.rasterline-1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS + 32, VIC2_STARTVISIBLECOLUMNS + 32 + columns + 16 - 1); |
| 878 | } | |
| 878 | } | |
| 879 | 879 | else |
| 880 | 880 | { |
| 881 | 881 | if (vic2.on) vic2_drawlines (device->machine, vic2.rasterline-1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS + 34, VIC2_STARTVISIBLECOLUMNS + 34 + columns + 16 - 1); |
| r5932 | r5933 | |
|---|---|---|
| 20 | 20 | UINT8 col; |
| 21 | 21 | int y, x, b,draw_y; |
| 22 | 22 | |
| 23 | int width = (vector_video_mode==0x00) ? 256 : 512; | |
| 23 | int width = (vector_video_mode==0x00) ? 256 : 512; | |
| 24 | 24 | rectangle screen_area = {0,width+64-1,0,256+64-1}; |
| 25 | 25 | // fill border color |
| 26 | 26 | bitmap_fill(bitmap, &screen_area, vector_color_index); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Galeb video driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 01/03/2008 Updated to work with latest SVN code | |
| 6 | 22/02/2008 Preliminary driver. | |
| 7 | ||
| 5 | 01/03/2008 Updated to work with latest SVN code | |
| 6 | 22/02/2008 Preliminary driver. | |
| 7 | ||
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "includes/galeb.h" |
| 13 | ||
| 13 | ||
| 14 | 14 | UINT8 *galeb_video_ram; |
| 15 | ||
| 15 | ||
| 16 | 16 | const gfx_layout galeb_charlayout = |
| 17 | 17 | { |
| 18 | 18 | 8, 8, /* 8x8 characters */ |
| r5932 | r5933 | |
| 27 | 27 | VIDEO_START( galeb ) |
| 28 | 28 | { |
| 29 | 29 | } |
| 30 | ||
| 30 | ||
| 31 | 31 | VIDEO_UPDATE( galeb ) |
| 32 | 32 | { |
| 33 | 33 | int x,y; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | * pc1403.c | |
| 4 | * portable sharp pc1403 video emulator interface | |
| 3 | * pc1403.c | |
| 4 | * portable sharp pc1403 video emulator interface | |
| 5 | 5 | * (sharp pocket computers) |
| 6 | 6 | * |
| 7 | * | |
| 7 | * Copyright (c) 2001 Peter Trauner, all rights reserved. | |
| 8 | 8 | * |
| 9 | * - This source code is released as freeware for non-commercial purposes. | |
| 10 | * - You are free to use and redistribute this code in modified or | |
| 11 | * unmodified form, provided you list me in the credits. | |
| 12 | * - If you modify this source code, you must add a notice to each modified | |
| 13 | * source file that it has been changed. If you're a nice person, you | |
| 14 | * will clearly mark each change too. :) | |
| 15 | * - If you wish to use this for commercial purposes, please contact me at | |
| 16 | * peter.trauner@jk.uni-linz.ac.at | |
| 17 | * - The author of this copywritten work reserves the right to change the | |
| 18 | * terms of its usage and license at any time, including retroactively | |
| 19 | * - This entire notice must remain in the source code. | |
| 9 | * - This source code is released as freeware for non-commercial purposes. | |
| 10 | * - You are free to use and redistribute this code in modified or | |
| 11 | * unmodified form, provided you list me in the credits. | |
| 12 | * - If you modify this source code, you must add a notice to each modified | |
| 13 | * source file that it has been changed. If you're a nice person, you | |
| 14 | * will clearly mark each change too. :) | |
| 15 | * - If you wish to use this for commercial purposes, please contact me at | |
| 16 | * peter.trauner@jk.uni-linz.ac.at | |
| 17 | * - The author of this copywritten work reserves the right to change the | |
| 18 | * terms of its usage and license at any time, including retroactively | |
| 19 | * - This entire notice must remain in the source code. | |
| 20 | 20 | * |
| 21 | 21 | * History of changes: |
| 22 | 22 | * 21.07.2001 Several changes listed below were made by Mario Konegger |
| 23 | 23 | * (konegger@itp.tu-graz.ac.at) |
| 24 | * Placed the grafical symbols onto the right place and added | |
| 25 | * some symbols, so the display is correct rebuit. | |
| 26 | * Added a strange behaviour of the display concerning the on/off | |
| 27 | * state and the BUSY-symbol, which I found out with experiments | |
| 28 | * with my own pc1403. | |
| 24 | * Placed the grafical symbols onto the right place and added | |
| 25 | * some symbols, so the display is correct rebuit. | |
| 26 | * Added a strange behaviour of the display concerning the on/off | |
| 27 | * state and the BUSY-symbol, which I found out with experiments | |
| 28 | * with my own pc1403. | |
| 29 | 29 | *****************************************************************************/ |
| 30 | 30 | |
| 31 | 31 | #include "driver.h" |
| r5932 | r5933 | |
| 165 | 165 | color[2] = pocketc_colortable[CONTRAST][1]; |
| 166 | 166 | color[1] = (pc1403_portc & 1) ? color[2] : color[0]; |
| 167 | 167 | |
| 168 | if (pc1403_portc & 1) | |
| 168 | if (pc1403_portc & 1) | |
| 169 | 169 | { |
| 170 | 170 | for (x=RIGHT, y=DOWN, i=0; i<6*5; x+=2) { |
| 171 | 171 | for (j=0; j<5; j++, i++, x+=2) |
| 172 | 172 | drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0, |
| 173 | 173 | x,y); |
| 174 | 174 | } |
| 175 | for (i=9*5; i<12*5; x+=2) | |
| 175 | for (i=9*5; i<12*5; x+=2) | |
| 176 | 176 | { |
| 177 | 177 | for (j=0; j<5; j++, i++, x+=2) |
| 178 | 178 | drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0, |
| 179 | 179 | x,y); |
| 180 | 180 | } |
| 181 | for (i=6*5; i<9*5; x+=2) | |
| 181 | for (i=6*5; i<9*5; x+=2) | |
| 182 | 182 | { |
| 183 | 183 | for (j=0; j<5; j++, i++, x+=2) |
| 184 | 184 | drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0, |
| 185 | 185 | x,y); |
| 186 | 186 | } |
| 187 | for (i=0x7b-3*5; i>0x7b-6*5; x+=2) | |
| 187 | for (i=0x7b-3*5; i>0x7b-6*5; x+=2) | |
| 188 | 188 | { |
| 189 | 189 | for (j=0; j<5; j++, i--, x+=2) |
| 190 | 190 | drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0, |
| 191 | 191 | x,y); |
| 192 | 192 | } |
| 193 | for (i=0x7b; i>0x7b-3*5; x+=2) | |
| 193 | for (i=0x7b; i>0x7b-3*5; x+=2) | |
| 194 | 194 | { |
| 195 | 195 | for (j=0; j<5; j++, i--, x+=2) |
| 196 | 196 | drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0, |
| 197 | 197 | x,y); |
| 198 | 198 | } |
| 199 | for (i=0x7b-6*5; i>0x7b-12*5; x+=2) | |
| 199 | for (i=0x7b-6*5; i>0x7b-12*5; x+=2) | |
| 200 | 200 | { |
| 201 | 201 | for (j=0; j<5; j++, i--, x+=2) |
| 202 | 202 | drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0, |
| r5932 | r5933 | |
| 207 | 207 | /* But if computer is off, busy is hidden. */ |
| 208 | 208 | if(!(pc1403_portc&8)) |
| 209 | 209 | { |
| 210 | if (pc1403_portc&1) | |
| 210 | if (pc1403_portc&1) | |
| 211 | 211 | pocketc_draw_special(bitmap, RIGHT, DOWN-13, busy, |
| 212 | 212 | pc1403_lcd.reg[0x3d] & 1 ? color[2] : color[0]); |
| 213 | 213 |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | |
| 7 | ||
| 7 | TODO: | |
| 8 | 8 | |
| 9 | ||
| 9 | - bright in reverse video | |
| 10 | 10 | |
| 11 | 11 | */ |
| 12 | 12 | |
| r5932 | r5933 | |
| 102 | 102 | v1050_set_int(device->machine, INT_VSYNC, state); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | static const mc6845_interface v1050_mc6845_intf = | |
| 105 | static const mc6845_interface v1050_mc6845_intf = | |
| 106 | 106 | { |
| 107 | 107 | SCREEN_TAG, |
| 108 | 108 | 8, |
| r5932 | r5933 | |
| 130 | 130 | static VIDEO_START( v1050 ) |
| 131 | 131 | { |
| 132 | 132 | v1050_state *state = machine->driver_data; |
| 133 | ||
| 133 | ||
| 134 | 134 | /* find devices */ |
| 135 | 135 | state->mc6845 = devtag_get_device(machine, H46505_TAG); |
| 136 | 136 | |
| r5932 | r5933 | |
| 149 | 149 | v1050_state *state = screen->machine->driver_data; |
| 150 | 150 | |
| 151 | 151 | mc6845_update(state->mc6845, bitmap, cliprect); |
| 152 | ||
| 152 | ||
| 153 | 153 | return 0; |
| 154 | 154 | } |
| 155 | 155 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | ||
| 2 | Acorn Electron driver | |
| 3 | 3 | |
| 4 | ||
| 4 | MESS Driver By: | |
| 5 | 5 | |
| 6 | ||
| 6 | Wilbert Pol | |
| 7 | 7 | |
| 8 | 8 | ******************************************************************************/ |
| 9 | 9 | |
| r5932 | r5933 | |
| 252 | 252 | } |
| 253 | 253 | break; |
| 254 | 254 | } |
| 255 | ||
| 255 | ||
| 256 | 256 | return 0; |
| 257 | 257 | } |
| 258 | 258 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | 911_chr.h: character definitions for 911_vdt.c | |
| 3 | 3 | |
| 4 | ||
| 4 | We define the character matrix for each character. | |
| 5 | 5 | |
| 6 | The US terminal uses the standard 7-bit ASCII character set, with | |
| 7 | additional graphic characters in the 32 first positions. | |
| 6 | The US terminal uses the standard 7-bit ASCII character set, with | |
| 7 | additional graphic characters in the 32 first positions. | |
| 8 | 8 | |
| 9 | The various European terminals use variants of the 7-bit ASCII character | |
| 10 | set with national characters instead of various punctuation characters. | |
| 11 | I think these national character sets were standardized at a point, but | |
| 12 | I don't know how close to this standard the character sets used by the | |
| 13 | 911 VDT are. | |
| 9 | The various European terminals use variants of the 7-bit ASCII character | |
| 10 | set with national characters instead of various punctuation characters. | |
| 11 | I think these national character sets were standardized at a point, but | |
| 12 | I don't know how close to this standard the character sets used by the | |
| 13 | 911 VDT are. | |
| 14 | 14 | |
| 15 | The japanese terminal uses 8-bit character codes. The 128 first characters | |
| 16 | are identical to the US character set (except that '\' is replaced by the | |
| 17 | Yen symbol), and the next 128 characters include the katakana syllabus. | |
| 18 | Kanji ideograms are not supported in this scheme. | |
| 15 | The japanese terminal uses 8-bit character codes. The 128 first characters | |
| 16 | are identical to the US character set (except that '\' is replaced by the | |
| 17 | Yen symbol), and the next 128 characters include the katakana syllabus. | |
| 18 | Kanji ideograms are not supported in this scheme. | |
| 19 | 19 | |
| 20 | The arabic terminal uses 8-bit character codes, too. It requires | |
| 21 | additional code in the TI990 OS for correct operation, as the keyboard | |
| 22 | returns codes for isolated characters (i.e. without ligatures), which need | |
| 23 | to be substituted with codes with correct context-dependent ligatures. | |
| 24 | And both OS and application programs need to support the fact that the | |
| 25 | writing direction can be either right-to-left or left-to-right, according | |
| 26 | to whether the characters are latin or arabic. | |
| 20 | The arabic terminal uses 8-bit character codes, too. It requires | |
| 21 | additional code in the TI990 OS for correct operation, as the keyboard | |
| 22 | returns codes for isolated characters (i.e. without ligatures), which need | |
| 23 | to be substituted with codes with correct context-dependent ligatures. | |
| 24 | And both OS and application programs need to support the fact that the | |
| 25 | writing direction can be either right-to-left or left-to-right, according | |
| 26 | to whether the characters are latin or arabic. | |
| 27 | 27 | |
| 28 | As the original ROMs have not been dumped yet, I recreated the matrices | |
| 29 | from various matrix printouts in TI documentation. | |
| 28 | As the original ROMs have not been dumped yet, I recreated the matrices | |
| 29 | from various matrix printouts in TI documentation. | |
| 30 | 30 | */ |
| 31 | 31 | /* |
| 32 | The arabic character set is not implemented, because documentation is ambiguous | |
| 33 | (it says there are 115 characters, but I can hardly see 80 characters in the | |
| 34 | attached table), and the character matrices are not documented. | |
| 32 | The arabic character set is not implemented, because documentation is ambiguous | |
| 33 | (it says there are 115 characters, but I can hardly see 80 characters in the | |
| 34 | attached table), and the character matrices are not documented. | |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | /* |
| 39 | ||
| 39 | Offsets in the char_defs array | |
| 40 | 40 | */ |
| 41 | 41 | enum |
| 42 | 42 | { |
| r5932 | r5933 | |
| 147 | 147 | }; |
| 148 | 148 | |
| 149 | 149 | /* |
| 150 | ||
| 150 | char_defs array: character matrices for each character | |
| 151 | 151 | */ |
| 152 | 152 | static const UINT8 char_defs[char_defs_count][10] = |
| 153 | 153 | { |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - use resnet for colors | |
| 15 | - proper video timing | |
| 14 | - use resnet for colors | |
| 15 | - proper video timing | |
| 16 | 16 | |
| 17 | 17 | */ |
| 18 | 18 | |
| r5932 | r5933 | |
| 170 | 170 | |
| 171 | 171 | /*------------------------------------------------- |
| 172 | 172 | zx8301_draw_line_mode4 - high resolution |
| 173 | ||
| 173 | line drawing routine | |
| 174 | 174 | -------------------------------------------------*/ |
| 175 | 175 | |
| 176 | 176 | static void zx8301_draw_line_mode4(const device_config *device, bitmap_t *bitmap, int y, UINT16 da) |
| r5932 | r5933 | |
| 200 | 200 | |
| 201 | 201 | /*------------------------------------------------- |
| 202 | 202 | zx8301_draw_line_mode4 - low resolution |
| 203 | ||
| 203 | line drawing routine | |
| 204 | 204 | -------------------------------------------------*/ |
| 205 | 205 | |
| 206 | 206 | static void zx8301_draw_line_mode8(const device_config *device, bitmap_t *bitmap, int y, UINT16 da) |
| r5932 | r5933 | |
| 331 | 331 | |
| 332 | 332 | static DEVICE_RESET( zx8301 ) |
| 333 | 333 | { |
| 334 | // | |
| 334 | // zx8301_t *zx8301 = get_safe_token(device); | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /*------------------------------------------------- |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | { |
| 10 | 10 | MAKE_RGB(0x10, 0x10, 0x10), /* black */ |
| 11 | 11 | MAKE_RGB(0xfd, 0xfd, 0xfd), /* white */ |
| 12 | MAKE_RGB(0xff, 0x31, 0x53), /* red | |
| 12 | MAKE_RGB(0xff, 0x31, 0x53), /* red */ | |
| 13 | 13 | MAKE_RGB(0x02, 0xcc, 0x5d), /* green */ |
| 14 | 14 | MAKE_RGB(0x4b, 0x3f, 0xf3), /* blue */ |
| 15 | 15 | MAKE_RGB(0xe0, 0xe0, 0xe0), /* ltgray */ |
| r5932 | r5933 | |
|---|---|---|
| 21 | 21 | UINT8 col; |
| 22 | 22 | int y, x, b; |
| 23 | 23 | const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 24 | ||
| 24 | ||
| 25 | 25 | // draw image |
| 26 | 26 | for (y = 0; y < 200; y++) |
| 27 | 27 | { |
| r5932 | r5933 | |
|---|---|---|
| 20 | 20 | #define VERBOSE 0 |
| 21 | 21 | |
| 22 | 22 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 23 | ||
| 23 | ||
| 24 | 24 | /*************************************************************************** |
| 25 | 25 | TYPE DEFINITIONS |
| 26 | 26 | ***************************************************************************/ |
| r5932 | r5933 | |
| 33 | 33 | |
| 34 | 34 | const device_config *screen; /* screen */ |
| 35 | 35 | UINT8 *gfx; /* content of char rom */ |
| 36 | ||
| 36 | ||
| 37 | 37 | int lba7; |
| 38 | ||
| 38 | ||
| 39 | 39 | // dc012 attributes |
| 40 | 40 | UINT8 scroll_latch; |
| 41 | 41 | UINT8 blink_flip_flop; |
| r5932 | r5933 | |
| 44 | 44 | // dc011 attributes |
| 45 | 45 | UINT8 columns; |
| 46 | 46 | UINT8 height; |
| 47 | UINT8 skip_lines; | |
| 47 | UINT8 skip_lines; | |
| 48 | 48 | UINT8 frequency; |
| 49 | 49 | UINT8 interlaced; |
| 50 | 50 | }; |
| r5932 | r5933 | |
| 64 | 64 | INLINE const vt_video_interface *get_interface(const device_config *device) |
| 65 | 65 | { |
| 66 | 66 | assert(device != NULL); |
| 67 | // | |
| 67 | // assert((device->type == dc012)); | |
| 68 | 68 | return (const vt_video_interface *) device->static_config; |
| 69 | 69 | } |
| 70 | 70 | |
| r5932 | r5933 | |
| 81 | 81 | WRITE8_DEVICE_HANDLER( dc012_w ) |
| 82 | 82 | { |
| 83 | 83 | vt_video_t *vt = get_safe_token(device); |
| 84 | ||
| 84 | ||
| 85 | 85 | if ((data & 0x08)==0) { |
| 86 | 86 | if ((data & 0x04)==0) { |
| 87 | 87 | // set lower part scroll |
| r5932 | r5933 | |
| 103 | 103 | case 0x0A: |
| 104 | 104 | // set reverse field on |
| 105 | 105 | vt->reverse_field = 1; |
| 106 | break; | |
| 106 | break; | |
| 107 | 107 | case 0x0B: |
| 108 | 108 | // set reverse field off |
| 109 | 109 | vt->reverse_field = 0; |
| r5932 | r5933 | |
| 146 | 146 | vt->frequency = 50; |
| 147 | 147 | vt->skip_lines = 5; |
| 148 | 148 | } |
| 149 | vt->interlaced = 0; | |
| 149 | vt->interlaced = 0; | |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| r5932 | r5933 | |
| 155 | 155 | //palette_set_color_rgb(device->machine, 1, data, data, data); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | static void vt_video_display_char(const device_config *device,bitmap_t *bitmap, UINT8 code, | |
| 159 | int x, int y,UINT8 scroll_region,UINT8 display_type) | |
| 160 | { | |
| 158 | static void vt_video_display_char(const device_config *device,bitmap_t *bitmap, UINT8 code, | |
| 159 | int x, int y,UINT8 scroll_region,UINT8 display_type) | |
| 160 | { | |
| 161 | 161 | UINT8 line=0; |
| 162 | 162 | int i,b,bit=0,j; |
| 163 | 163 | int double_width = (display_type==2) ? 1 : 0; |
| r5932 | r5933 | |
| 165 | 165 | |
| 166 | 166 | for (i = 0; i < 10; i++) |
| 167 | 167 | { |
| 168 | ||
| 168 | ||
| 169 | 169 | switch(display_type) { |
| 170 | 170 | case 0 : // bottom half, double height |
| 171 | 171 | j = (i >> 1)+5; break; |
| 172 | 172 | case 1 : // top half, double height |
| 173 | 173 | j = (i >> 1); break; |
| 174 | case 2 : // double width | |
| 174 | case 2 : // double width | |
| 175 | 175 | case 3 : // normal |
| 176 | 176 | j = i; break; |
| 177 | 177 | default : j = 0; break; |
| 178 | 178 | } |
| 179 | 179 | // modify line since that is how it is stored in rom |
| 180 | 180 | if (j==0) j=15; else j=j-1; |
| 181 | ||
| 181 | ||
| 182 | 182 | line = vt->gfx[(code & 0x7f)*16 + j]; |
| 183 | 183 | if (vt->basic_attribute==1) { |
| 184 | 184 | if ((code & 0x80)==0x80) { |
| 185 | 185 | line = line ^ 0xff; |
| 186 | } | |
| 187 | } | |
| 188 | ||
| 186 | } | |
| 187 | } | |
| 188 | ||
| 189 | 189 | for (b = 0; b < 8; b++) |
| 190 | 190 | { |
| 191 | 191 | bit = ((line << b) & 0x80) ? 1 : 0; |
| r5932 | r5933 | |
| 222 | 222 | UINT8 scroll_region = 1; // binary 1 |
| 223 | 223 | UINT8 display_type = 3; // binary 11 |
| 224 | 224 | UINT16 temp =0; |
| 225 | ||
| 225 | ||
| 226 | 226 | if (devcb_call_read8(&vt->in_ram_func, 0) !=0x7f) return; |
| 227 | ||
| 227 | ||
| 228 | 228 | while(line < (vt->height + vt->skip_lines)) { |
| 229 | 229 | code = devcb_call_read8(&vt->in_ram_func, addr + xpos); |
| 230 | 230 | if (code == 0x7f) { |
| r5932 | r5933 | |
| 234 | 234 | { |
| 235 | 235 | vt_video_display_char(device,bitmap,code,x,ypos,scroll_region,display_type); |
| 236 | 236 | } |
| 237 | } | |
| 238 | // move to new data | |
| 237 | } | |
| 238 | // move to new data | |
| 239 | 239 | temp = devcb_call_read8(&vt->in_ram_func, addr+xpos+1)*256 + devcb_call_read8(&vt->in_ram_func, addr+xpos+2); |
| 240 | 240 | addr = (temp) & 0x1fff; |
| 241 | 241 | // if A12 is 1 then it is 0x2000 block, if 0 then 0x4000 (AVO) |
| r5932 | r5933 | |
| 246 | 246 | ypos++; |
| 247 | 247 | } |
| 248 | 248 | xpos=0; |
| 249 | line++; | |
| 249 | line++; | |
| 250 | 250 | } else { |
| 251 | 251 | // display regular char |
| 252 | 252 | if (line >= vt->skip_lines) { |
| 253 | 253 | vt_video_display_char(device,bitmap,code,xpos,ypos,scroll_region,display_type); |
| 254 | } | |
| 254 | } | |
| 255 | 255 | xpos++; |
| 256 | 256 | if (xpos > vt->columns) { |
| 257 | line++; | |
| 257 | line++; | |
| 258 | 258 | xpos=0; |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | ||
| 262 | ||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /*------------------------------------------------- |
| r5932 | r5933 | |
| 273 | 273 | |
| 274 | 274 | /* resolve callbacks */ |
| 275 | 275 | devcb_resolve_read8(&vt->in_ram_func, &intf->in_ram_func, device); |
| 276 | devcb_resolve_write8(&vt->clear_video_interrupt, &intf->clear_video_interrupt, device); | |
| 276 | devcb_resolve_write8(&vt->clear_video_interrupt, &intf->clear_video_interrupt, device); | |
| 277 | 277 | |
| 278 | 278 | /* get the screen device */ |
| 279 | 279 | vt->screen = devtag_get_device(device->machine, intf->screen_tag); |
| 280 | 280 | assert(vt->screen != NULL); |
| 281 | ||
| 281 | ||
| 282 | 282 | vt->gfx = memory_region(device->machine, intf->char_rom_region_tag); |
| 283 | 283 | assert(vt->gfx != NULL); |
| 284 | ||
| 284 | ||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | static TIMER_CALLBACK(lba7_change) |
| r5932 | r5933 | |
| 315 | 315 | vt->interlaced = 1; |
| 316 | 316 | vt->skip_lines = 2; // for 60Hz |
| 317 | 317 | // LBA7 is scan line frequency update |
| 318 | timer_pulse(device->machine, ATTOTIME_IN_NSEC(31778), (void *) device, 0, lba7_change); | |
| 318 | timer_pulse(device->machine, ATTOTIME_IN_NSEC(31778), (void *) device, 0, lba7_change); | |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /*------------------------------------------------- |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | DTACKL 1 |* \_/ | 40 WEL | |
| 11 | A17 2 | | 39 PCENL | |
| 12 | A16 3 | | 38 VDA | |
| 13 | RDWL 4 | | 37 ROWL | |
| 14 | DSMCL 5 | | 36 TX0EL | |
| 15 | VCC 6 | | 35 XTAL2 | |
| 16 | CLKCPU 7 | | 34 XTAL1 | |
| 17 | RASL 8 | | 33 ROM0EH | |
| 18 | CAS0L 9 | | 32 BLUE | |
| 19 | CAS1L 10 | ZX8301 | 31 GREEN | |
| 20 | VSYNCH 11 | ULA | 30 RED | |
| 21 | CSYNCL 12 | | 29 DB7 | |
| 22 | DA0 13 | | 28 DA7 | |
| 23 | DB0 14 | | 27 DA6 | |
| 24 | VDD 15 | | 26 DB6 | |
| 25 | DB1 16 | | 25 DB5 | |
| 26 | DA1 17 | | 24 DA5 | |
| 27 | DA2 18 | | 23 DB4 | |
| 28 | DB2 19 | | 22 DA4 | |
| 29 | DA3 20 |_____________| 21 DB3 | |
| 9 | _____ _____ | |
| 10 | DTACKL 1 |* \_/ | 40 WEL | |
| 11 | A17 2 | | 39 PCENL | |
| 12 | A16 3 | | 38 VDA | |
| 13 | RDWL 4 | | 37 ROWL | |
| 14 | DSMCL 5 | | 36 TX0EL | |
| 15 | VCC 6 | | 35 XTAL2 | |
| 16 | CLKCPU 7 | | 34 XTAL1 | |
| 17 | RASL 8 | | 33 ROM0EH | |
| 18 | CAS0L 9 | | 32 BLUE | |
| 19 | CAS1L 10 | ZX8301 | 31 GREEN | |
| 20 | VSYNCH 11 | ULA | 30 RED | |
| 21 | CSYNCL 12 | | 29 DB7 | |
| 22 | DA0 13 | | 28 DA7 | |
| 23 | DB0 14 | | 27 DA6 | |
| 24 | VDD 15 | | 26 DB6 | |
| 25 | DB1 16 | | 25 DB5 | |
| 26 | DA1 17 | | 24 DA5 | |
| 27 | DA2 18 | | 23 DB4 | |
| 28 | DB2 19 | | 22 DA4 | |
| 29 | DA3 20 |_____________| 21 DB3 | |
| 30 | 30 | |
| 31 | 31 | **********************************************************************/ |
| 32 | 32 |
| r5932 | r5933 | |
|---|---|---|
| 103 | 103 | int cursor_x, cursor_y; |
| 104 | 104 | |
| 105 | 105 | /* While CLEAR SCREEN is being held down, the hardware is forced |
| 106 | ||
| 106 | to clear the video memory, so video writes have no effect. */ | |
| 107 | 107 | if (apple1_vh_clrscrn_pressed) |
| 108 | 108 | return; |
| 109 | 109 | |
| r5932 | r5933 | |
| 114 | 114 | |
| 115 | 115 | if (data == '\r') { |
| 116 | 116 | /* Carriage-return moves the cursor to the start of the next |
| 117 | ||
| 117 | line. */ | |
| 118 | 118 | cursor_x = 0; |
| 119 | 119 | cursor_y++; |
| 120 | 120 | } |
| 121 | 121 | else if (data < ' ') { |
| 122 | 122 | /* Except for carriage-return, the video hardware completely |
| 123 | ||
| 123 | ignores all control characters. */ | |
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | 126 | else { |
| 127 | 127 | /* For visible characters, only 6 bits of the ASCII code are |
| 128 | used, because the 2513 character generator ROM only | |
| 129 | contains 64 symbols. The low 5 bits of the ASCII code are | |
| 130 | used directly. Bit 6 is ignored, since it is the same for | |
| 131 | all the available characters in the ROM. Bit 7 is inverted | |
| 132 | before being used as the high bit of the 6-bit ROM symbol | |
| 133 | index, because the block of 32 ASCII symbols containing the | |
| 134 | uppercase letters comes first in the ROM. */ | |
| 128 | used, because the 2513 character generator ROM only | |
| 129 | contains 64 symbols. The low 5 bits of the ASCII code are | |
| 130 | used directly. Bit 6 is ignored, since it is the same for | |
| 131 | all the available characters in the ROM. Bit 7 is inverted | |
| 132 | before being used as the high bit of the 6-bit ROM symbol | |
| 133 | index, because the block of 32 ASCII symbols containing the | |
| 134 | uppercase letters comes first in the ROM. */ | |
| 135 | 135 | |
| 136 | 136 | int romindx = (data & 0x1f) | (((data ^ 0x40) & 0x40) >> 1); |
| 137 | 137 | |
| r5932 | r5933 | |
| 184 | 184 | double cursor_hfrac; |
| 185 | 185 | |
| 186 | 186 | /* The video hardware refreshes the screen by reading the |
| 187 | character codes from its circulating shift-register memory. | |
| 188 | Because of the way this memory works, a new character can only | |
| 189 | be written into the cursor location at the moment this location | |
| 190 | is about to be read. This happens during the first scanline of | |
| 191 | the cursor's character line, when the beam reaches the cursor's | |
| 192 | horizontal position. */ | |
| 187 | character codes from its circulating shift-register memory. | |
| 188 | Because of the way this memory works, a new character can only | |
| 189 | be written into the cursor location at the moment this location | |
| 190 | is about to be read. This happens during the first scanline of | |
| 191 | the cursor's character line, when the beam reaches the cursor's | |
| 192 | horizontal position. */ | |
| 193 | 193 | |
| 194 | 194 | terminal_getcursor(apple1_terminal, &cursor_x, &cursor_y); |
| 195 | 195 | cursor_scanline = cursor_y * apple1_charlayout.height; |
| 196 | 196 | |
| 197 | 197 | /* Each scanline is composed of 455 pixel times. The first 175 of |
| 198 | these are the horizontal blanking period; the remaining 280 are | |
| 199 | for the visible part of the scanline. */ | |
| 198 | these are the horizontal blanking period; the remaining 280 are | |
| 199 | for the visible part of the scanline. */ | |
| 200 | 200 | cursor_hfrac = (175 + cursor_x * apple1_charlayout.width) / 455; |
| 201 | 201 | |
| 202 | 202 | if (video_screen_get_vpos(machine->primary_screen) == cursor_scanline) { |
| 203 | 203 | /* video_screen_get_hpos() doesn't account for the horizontal |
| 204 | blanking interval; it acts as if the scanline period is | |
| 205 | entirely composed of visible pixel times. However, we can | |
| 206 | still use it to find what fraction of the current scanline | |
| 207 | period has elapsed. */ | |
| 204 | blanking interval; it acts as if the scanline period is | |
| 205 | entirely composed of visible pixel times. However, we can | |
| 206 | still use it to find what fraction of the current scanline | |
| 207 | period has elapsed. */ | |
| 208 | 208 | double current_hfrac = video_screen_get_hpos(machine->primary_screen) / |
| 209 | 209 | video_screen_get_width(video_screen_first(machine->config)); |
| 210 | 210 | if (current_hfrac < cursor_hfrac) |
| r5932 | r5933 | |
| 223 | 223 | int new_blink_on; |
| 224 | 224 | |
| 225 | 225 | /* The cursor is on for 2/3 of its blink period and off for 1/3. |
| 226 | This is most easily handled by dividing the total elapsed time | |
| 227 | by the length of the off-portion of the cycle, giving us the | |
| 228 | number of one-third-cycles elapsed, then checking the result | |
| 229 | modulo 3. */ | |
| 226 | This is most easily handled by dividing the total elapsed time | |
| 227 | by the length of the off-portion of the cycle, giving us the | |
| 228 | number of one-third-cycles elapsed, then checking the result | |
| 229 | modulo 3. */ | |
| 230 | 230 | |
| 231 | 231 | if (((int) (attotime_to_double(timer_get_time(machine)) / CURSOR_OFF_LENGTH)) % 3 < 2) |
| 232 | 232 | new_blink_on = 1; |
| r5932 | r5933 | |
|---|---|---|
| 317 | 317 | |
| 318 | 318 | |
| 319 | 319 | /* |
| 320 | * | |
| 320 | * rW MDA mode control register (see #P138) | |
| 321 | 321 | */ |
| 322 | 322 | static void mda_mode_control_w(running_machine *machine, int data) |
| 323 | 323 | { |
| r5932 | r5933 | |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | |
| 342 | /* R- CRT status register (see #P139) | |
| 343 | * (EGA/VGA) input status 1 register | |
| 344 | * 7 HGC vertical sync in progress | |
| 345 | * 6-4 adapter 000 hercules | |
| 346 | * 001 hercules+ | |
| 347 | * 101 hercules InColor | |
| 348 | * else unknown | |
| 349 | * 3 pixel stream (0 black, 1 white) | |
| 350 | * 2-1 reserved | |
| 351 | * 0 horizontal drive enable | |
| 342 | /* R- CRT status register (see #P139) | |
| 343 | * (EGA/VGA) input status 1 register | |
| 344 | * 7 HGC vertical sync in progress | |
| 345 | * 6-4 adapter 000 hercules | |
| 346 | * 001 hercules+ | |
| 347 | * 101 hercules InColor | |
| 348 | * else unknown | |
| 349 | * 3 pixel stream (0 black, 1 white) | |
| 350 | * 2-1 reserved | |
| 351 | * 0 horizontal drive enable | |
| 352 | 352 | */ |
| 353 | 353 | static int pc_mda_status_r(void) |
| 354 | 354 | { |
| r5932 | r5933 | |
| 359 | 359 | |
| 360 | 360 | /************************************************************************* |
| 361 | 361 | * |
| 362 | * MDA | |
| 363 | * monochrome display adapter | |
| 362 | * MDA | |
| 363 | * monochrome display adapter | |
| 364 | 364 | * |
| 365 | 365 | *************************************************************************/ |
| 366 | 366 | WRITE8_HANDLER ( pc_MDA_w ) |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | [ DC012 and DC011 emulation ] |
| 5 | 5 | |
| 6 | 6 | 01/05/2009 Initial implementation [Miodrag Milanovic] |
| 7 | ||
| 7 | ||
| 8 | 8 | Copyright MESS Team. |
| 9 | 9 | Visit http://mamedev.org for licensing and usage restrictions. |
| 10 | 10 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Orion video driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 22/04/2008 Orion Pro added | |
| 6 | 02/04/2008 Preliminary driver. | |
| 7 | ||
| 5 | 22/04/2008 Orion Pro added | |
| 6 | 02/04/2008 Preliminary driver. | |
| 7 | ||
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "includes/orion.h" |
| 13 | ||
| 14 | 13 | |
| 14 | ||
| 15 | 15 | VIDEO_START( orion128 ) |
| 16 | 16 | { |
| 17 | 17 | } |
| 18 | ||
| 18 | ||
| 19 | 19 | VIDEO_UPDATE( orion128 ) |
| 20 | 20 | { |
| 21 | 21 | UINT8 code1,code2,code3,code4,color,val; |
| r5932 | r5933 | |
| 23 | 23 | int orionproshift = (orion128_video_mode & 0x10) ? 1 : 0; |
| 24 | 24 | int part1addr = (3-((orion128_video_page & 3) | orionproshift)) * 0x4000; |
| 25 | 25 | |
| 26 | int part2addr = part1addr + 0x10000; | |
| 26 | int part2addr = part1addr + 0x10000; | |
| 27 | 27 | int video_mode = orion128_video_mode & orion_video_mode_mask; |
| 28 | 28 | for (x = 0; x < orion128_video_width; x++) |
| 29 | { | |
| 29 | { | |
| 30 | 30 | for (y = 0; y < 256; y++) |
| 31 | 31 | { |
| 32 | code1 = mess_ram[part1addr + y + x*256]; | |
| 32 | code1 = mess_ram[part1addr + y + x*256]; | |
| 33 | 33 | code2 = mess_ram[part2addr + y + x*256]; |
| 34 | 34 | code3 = mess_ram[part1addr + y + x*256 + 0x4000]; |
| 35 | 35 | code4 = mess_ram[part2addr + y + x*256 + 0x4000]; |
| r5932 | r5933 | |
| 37 | 37 | code2 = orionpro_pseudo_color; |
| 38 | 38 | } |
| 39 | 39 | color = 0; |
| 40 | for (b = 7; b >= 0; b--) | |
| 41 | { | |
| 40 | for (b = 7; b >= 0; b--) | |
| 41 | { | |
| 42 | 42 | switch(orion128_video_mode & orion_video_mode_mask) { |
| 43 | 43 | case 0 : color = ((code1 >> b) & 0x01) ? 10 : 0; break; |
| 44 | 44 | case 1 : color = ((code1 >> b) & 0x01) ? 17 : 16; break; |
| r5932 | r5933 | |
| 49 | 49 | case 2 : color = 2; break; // green |
| 50 | 50 | case 3 : color = 1; break; // blue |
| 51 | 51 | } |
| 52 | break; | |
| 52 | break; | |
| 53 | 53 | case 5 : val = (((code1 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); |
| 54 | 54 | switch(val) { |
| 55 | 55 | case 0 : color = 7; break; // white |
| r5932 | r5933 | |
| 57 | 57 | case 2 : color = 2; break; // green |
| 58 | 58 | case 3 : color = 1; break; // blue |
| 59 | 59 | } |
| 60 | break; | |
| 61 | case 6 : | |
| 60 | break; | |
| 61 | case 6 : | |
| 62 | 62 | case 7 : |
| 63 | 63 | case 14 : |
| 64 | 64 | case 15 : |
| 65 | color = ((code1 >> b) & 0x01) ? (code2 & 0x0f) : (code2 >> 4); break; | |
| 66 | ||
| 65 | color = ((code1 >> b) & 0x01) ? (code2 & 0x0f) : (code2 >> 4); break; | |
| 66 | ||
| 67 | 67 | default: |
| 68 | switch(orion128_video_mode & orion_video_mode_mask & 20) { | |
| 69 | case 16 : | |
| 68 | switch(orion128_video_mode & orion_video_mode_mask & 20) { | |
| 69 | case 16 : | |
| 70 | 70 | color = (((code1 >> b) & 0x01) << 2) + (((code3 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); |
| 71 | break; | |
| 71 | break; | |
| 72 | 72 | case 20 : |
| 73 | 73 | color = (((code1 >> b) & 0x01) << 2) + (((code3 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01); |
| 74 | 74 | if ((((code4 >> b) & 0x01)==1) && (color!=0)) { |
| 75 | 75 | color += 8; |
| 76 | 76 | } |
| 77 | 77 | break; |
| 78 | } | |
| 78 | } | |
| 79 | 79 | } |
| 80 | 80 | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = color; |
| 81 | 81 | } |
| 82 | } | |
| 82 | } | |
| 83 | 83 | } |
| 84 | ||
| 84 | ||
| 85 | 85 | return 0; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | static const rgb_t orion128_palette[18] = { |
| 89 | 89 | MAKE_RGB(0x00, 0x00, 0x00), // 0 |
| 90 | 90 | MAKE_RGB(0x00, 0x00, 0xc0), // 1 |
| 91 | MAKE_RGB(0x00, 0xc0, 0x00), // 2 | |
| 92 | MAKE_RGB(0x00, 0xc0, 0xc0), // 3 | |
| 93 | MAKE_RGB(0xc0, 0x00, 0x00), // 4 | |
| 94 | MAKE_RGB(0xc0, 0x00, 0xc0), // 5 | |
| 95 | MAKE_RGB(0xc0, 0xc0, 0x00), // 6 | |
| 96 | MAKE_RGB(0xc0, 0xc0, 0xc0), // 7 | |
| 97 | MAKE_RGB(0x80, 0x80, 0x80), // 8 | |
| 98 | MAKE_RGB(0x00, 0x00, 0xff), // 9 | |
| 99 | MAKE_RGB(0x00, 0xff, 0x00), // A | |
| 100 | MAKE_RGB(0x00, 0xff, 0xff), // B | |
| 101 | MAKE_RGB(0xff, 0x00, 0x00), // C | |
| 102 | MAKE_RGB(0xff, 0x00, 0xff), // D | |
| 103 | MAKE_RGB(0xff, 0xff, 0x00), // E | |
| 104 | MAKE_RGB(0xff, 0xff, 0xff), // F | |
| 105 | MAKE_RGB(0xc8, 0xb4, 0x28), // 10 | |
| 106 | MAKE_RGB(0x32, 0xfa, 0xfa) // 11 | |
| 91 | MAKE_RGB(0x00, 0xc0, 0x00), // 2 | |
| 92 | MAKE_RGB(0x00, 0xc0, 0xc0), // 3 | |
| 93 | MAKE_RGB(0xc0, 0x00, 0x00), // 4 | |
| 94 | MAKE_RGB(0xc0, 0x00, 0xc0), // 5 | |
| 95 | MAKE_RGB(0xc0, 0xc0, 0x00), // 6 | |
| 96 | MAKE_RGB(0xc0, 0xc0, 0xc0), // 7 | |
| 97 | MAKE_RGB(0x80, 0x80, 0x80), // 8 | |
| 98 | MAKE_RGB(0x00, 0x00, 0xff), // 9 | |
| 99 | MAKE_RGB(0x00, 0xff, 0x00), // A | |
| 100 | MAKE_RGB(0x00, 0xff, 0xff), // B | |
| 101 | MAKE_RGB(0xff, 0x00, 0x00), // C | |
| 102 | MAKE_RGB(0xff, 0x00, 0xff), // D | |
| 103 | MAKE_RGB(0xff, 0xff, 0x00), // E | |
| 104 | MAKE_RGB(0xff, 0xff, 0xff), // F | |
| 105 | MAKE_RGB(0xc8, 0xb4, 0x28), // 10 | |
| 106 | MAKE_RGB(0x32, 0xfa, 0xfa) // 11 | |
| 107 | 107 | }; |
| 108 | 108 | |
| 109 | 109 | PALETTE_INIT( orion128 ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | IBM PC junior | |
| 4 | Tandy 1000 Graphics Adapter (T1T) section | |
| 3 | IBM PC junior | |
| 4 | Tandy 1000 Graphics Adapter (T1T) section | |
| 5 | 5 | |
| 6 | Note that in the IBM PC Junior world, the term 'vga' is not the 'vga' that | |
| 7 | most people think of | |
| 6 | Note that in the IBM PC Junior world, the term 'vga' is not the 'vga' that | |
| 7 | most people think of | |
| 8 | 8 | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 16 | 16 | |
| 17 | 17 | /*************************************************************************** |
| 18 | 18 | |
| 19 | ||
| 19 | Static declarations | |
| 20 | 20 | |
| 21 | 21 | ***************************************************************************/ |
| 22 | 22 | |
| r5932 | r5933 | |
| 88 | 88 | |
| 89 | 89 | /*************************************************************************** |
| 90 | 90 | |
| 91 | ||
| 91 | Methods | |
| 92 | 92 | |
| 93 | 93 | ***************************************************************************/ |
| 94 | 94 | |
| r5932 | r5933 | |
| 124 | 124 | UINT8 index; |
| 125 | 125 | UINT8 data[0x20]; |
| 126 | 126 | /* see vgadoc |
| 127 | 0 mode control 1 | |
| 128 | 1 palette mask | |
| 129 | 2 border color | |
| 130 | 3 mode control 2 | |
| 131 | 4 reset | |
| 132 | 0x10-0x1f palette registers | |
| 133 | */ | |
| 127 | 0 mode control 1 | |
| 128 | 1 palette mask | |
| 129 | 2 border color | |
| 130 | 3 mode control 2 | |
| 131 | 4 reset | |
| 132 | 0x10-0x1f palette registers | |
| 133 | */ | |
| 134 | 134 | } reg; |
| 135 | 135 | |
| 136 | 136 | UINT8 bank; |
| r5932 | r5933 | |
| 318 | 318 | UINT8 data0 = vid[ offset ]; |
| 319 | 319 | UINT8 data1 = vid[ offset + 1 ]; |
| 320 | 320 | |
| 321 | *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x80 ) >> 7 ) | ( ( data1 & 0x80 ) >> 6 ) ) ]; p++; | |
| 321 | *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x80 ) >> 7 ) | ( ( data1 & 0x80 ) >> 6 ) ) ]; p++; | |
| 322 | 322 | *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x40 ) >> 6 ) | ( ( data1 & 0x40 ) >> 5 ) ) ]; p++; |
| 323 | 323 | *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x20 ) >> 5 ) | ( ( data1 & 0x20 ) >> 4 ) ) ]; p++; |
| 324 | 324 | *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x10 ) >> 4 ) | ( ( data1 & 0x10 ) >> 3 ) ) ]; p++; |
| r5932 | r5933 | |
| 332 | 332 | |
| 333 | 333 | static MC6845_UPDATE_ROW( t1000_gfx_2bpp_tga_update_row ) |
| 334 | 334 | { |
| 335 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); | |
| 335 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); | |
| 336 | 336 | UINT8 *vid = pcjr.displayram + ( ra << 13 ); |
| 337 | int i; | |
| 337 | int i; | |
| 338 | 338 | |
| 339 | 339 | if ( y == 0 ) logerror("t1000_gfx_2bpp_tga_update_row\n"); |
| 340 | 340 | for ( i = 0; i < x_count; i++ ) |
| 341 | 341 | { |
| 342 | 342 | UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff; |
| 343 | UINT8 data = vid[ offset ]; | |
| 343 | UINT8 data = vid[ offset ]; | |
| 344 | 344 | UINT16 data2 = ( vid[ offset + 1 ] ) << 1; |
| 345 | ||
| 345 | ||
| 346 | 346 | *p = pcjr.reg.data[ 0x10 + ( ( ( data2 & 0x100 ) | ( data & 0x80 ) ) >> 7 ) ]; p++; |
| 347 | 347 | *p = pcjr.reg.data[ 0x10 + ( ( ( data2 & 0x80 ) | ( data & 0x40 ) ) >> 6 ) ]; p++; |
| 348 | 348 | *p = pcjr.reg.data[ 0x10 + ( ( ( data2 & 0x40 ) | ( data & 0x20 ) ) >> 5 ) ]; p++; |
| r5932 | r5933 | |
| 540 | 540 | |
| 541 | 541 | |
| 542 | 542 | /* |
| 543 | * 3d8 rW | |
| 543 | * 3d8 rW T1T mode control register (see #P138) | |
| 544 | 544 | */ |
| 545 | 545 | static void pc_t1t_mode_control_w(int data) |
| 546 | 546 | { |
| r5932 | r5933 | |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /* |
| 559 | * 3d9 ?W | |
| 559 | * 3d9 ?W color select register on color adapter | |
| 560 | 560 | */ |
| 561 | 561 | static void pc_t1t_color_select_w(int data) |
| 562 | 562 | { |
| r5932 | r5933 | |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | /* |
| 600 | * 3db -W | |
| 600 | * 3db -W light pen strobe reset (on any value) | |
| 601 | 601 | */ |
| 602 | 602 | static void pc_t1t_lightpen_strobe_w(int data) |
| 603 | 603 | { |
| 604 | // | |
| 604 | // pc_port[0x3db] = data; | |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | |
| 608 | 608 | /* |
| 609 | * 3da -W (mono EGA/mono VGA) feature control register | |
| 610 | * (see PORT 03DAh-W for details; VGA, see PORT 03CAh-R) | |
| 609 | * 3da -W (mono EGA/mono VGA) feature control register | |
| 610 | * (see PORT 03DAh-W for details; VGA, see PORT 03CAh-R) | |
| 611 | 611 | */ |
| 612 | 612 | static void pc_t1t_vga_index_w(int data) |
| 613 | 613 | { |
| r5932 | r5933 | |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | /* |
| 707 | * 3df RW display bank, access bank, mode | |
| 708 | * bit 0-2 Identifies the page of main memory being displayed in units of 16K. | |
| 709 | * 0: 0K, 1: 16K...7: 112K. In 32K modes (bits 6-7 = 2) only 0,2,4 and | |
| 710 | * 6 are valid, as the next page will also be used. | |
| 711 | * 3-5 Identifies the page of main memory that can be read/written at B8000h | |
| 712 | * in units of 16K. 0: 0K, 1: 16K...7: 112K. In 32K modes (bits 6-7 = 2) | |
| 713 | * only 0,2,4 and 6 are valid, as the next page will also be used. | |
| 714 | * 6-7 Display mode. 0: Text, 1: 16K graphics mode (4,5,6,8) | |
| 715 | * 2: 32K graphics mode (9,Ah) | |
| 707 | * 3df RW display bank, access bank, mode | |
| 708 | * bit 0-2 Identifies the page of main memory being displayed in units of 16K. | |
| 709 | * 0: 0K, 1: 16K...7: 112K. In 32K modes (bits 6-7 = 2) only 0,2,4 and | |
| 710 | * 6 are valid, as the next page will also be used. | |
| 711 | * 3-5 Identifies the page of main memory that can be read/written at B8000h | |
| 712 | * in units of 16K. 0: 0K, 1: 16K...7: 112K. In 32K modes (bits 6-7 = 2) | |
| 713 | * only 0,2,4 and 6 are valid, as the next page will also be used. | |
| 714 | * 6-7 Display mode. 0: Text, 1: 16K graphics mode (4,5,6,8) | |
| 715 | * 2: 32K graphics mode (9,Ah) | |
| 716 | 716 | */ |
| 717 | 717 | static void pc_t1t_bank_w(running_machine *machine, int data) |
| 718 | 718 | { |
| r5932 | r5933 | |
| 775 | 775 | |
| 776 | 776 | /************************************************************************* |
| 777 | 777 | * |
| 778 | * T1T | |
| 779 | * Tandy 1000 / PCjr | |
| 778 | * T1T | |
| 779 | * Tandy 1000 / PCjr | |
| 780 | 780 | * |
| 781 | 781 | *************************************************************************/ |
| 782 | 782 | |
| r5932 | r5933 | |
| 826 | 826 | |
| 827 | 827 | switch( offset ) |
| 828 | 828 | { |
| 829 | case 0: case 4: | |
| 829 | case 0: case 4: | |
| 830 | 830 | devconf = devtag_get_device(space->machine, T1000_MC6845_NAME); |
| 831 | 831 | mc6845_address_w( devconf, offset, data ); |
| 832 | 832 | break; |
| r5932 | r5933 | |
|---|---|---|
| 5 | 5 | Routines to control the Atari 7800 video hardware |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | ||
| 8 | precise DMA cycle stealing | |
| 9 | 9 | |
| 10 | ||
| 10 | 2003-06-23 ericball Kangaroo mode & 320 mode & other stuff | |
| 11 | 11 | |
| 12 | ||
| 12 | 2002-05-14 kubecj vblank dma stop fix | |
| 13 | 13 | |
| 14 | 2002-05-13 kubecj fixed 320C mode (displayed 2 pixels instead of one!) | |
| 15 | noticed that Jinks uses 0x02-320D mode | |
| 16 | implemented the mode - completely unsure if good! | |
| 17 | implemented some Maria CTRL variables | |
| 14 | 2002-05-13 kubecj fixed 320C mode (displayed 2 pixels instead of one!) | |
| 15 | noticed that Jinks uses 0x02-320D mode | |
| 16 | implemented the mode - completely unsure if good! | |
| 17 | implemented some Maria CTRL variables | |
| 18 | 18 | |
| 19 | ||
| 19 | 2002-05-12 kubecj added cases for 0x01-160A, 0x05-160B as stated by docs | |
| 20 | 20 | |
| 21 | 21 | ***************************************************************************/ |
| 22 | 22 | |
| r5932 | r5933 | |
| 341 | 341 | int frame_scanline; |
| 342 | 342 | UINT8 *ROM = memory_region(device->machine, "maincpu"); |
| 343 | 343 | const address_space* space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 344 | ||
| 344 | ||
| 345 | 345 | maria_scanline++; |
| 346 | 346 | |
| 347 | 347 | /* why + 1? */ |
| r5932 | r5933 | |
| 372 | 372 | maria_offset = READ_MEM(maria_dll) & 0x0f; |
| 373 | 373 | maria_holey = (READ_MEM(maria_dll) & 0x60) >> 5; |
| 374 | 374 | maria_dli = READ_MEM(maria_dll) & 0x80; |
| 375 | /* logerror("DLL=%x\n",maria_dll); */ | |
| 376 | /* logerror("DLL: DL = %x dllctrl = %x\n",maria_dl,ROM[maria_dll]); */ | |
| 375 | /* logerror("DLL=%x\n",maria_dll); */ | |
| 376 | /* logerror("DLL: DL = %x dllctrl = %x\n",maria_dl,ROM[maria_dll]); */ | |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | /*logerror( "vblank end on line %d\n", frame_scanline );*/ |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | /* moved start of vblank up (to prevent dma/dli happen on line -4) | |
| 383 | this fix made PR Baseball happy | |
| 384 | Kung-Fu Master looks worse | |
| 385 | don't know about others yet */ | |
| 382 | /* moved start of vblank up (to prevent dma/dli happen on line -4) | |
| 383 | this fix made PR Baseball happy | |
| 384 | Kung-Fu Master looks worse | |
| 385 | don't know about others yet */ | |
| 386 | 386 | if( frame_scanline == ( a7800_lines - 4 ) ) |
| 387 | 387 | { |
| 388 | 388 | /* vblank starts 4 scanlines before end of screen */ |
| r5932 | r5933 | |
| 390 | 390 | maria_vblank = 0x80; |
| 391 | 391 | |
| 392 | 392 | /* fixed 2002/05/14 kubecj |
| 393 | when going vblank, dma must be stopped | |
| 394 | otherwise system tries to read past end of dll | |
| 395 | causing false dlis to occur, mainly causing wild | |
| 396 | screen flickering | |
| 393 | when going vblank, dma must be stopped | |
| 394 | otherwise system tries to read past end of dll | |
| 395 | causing false dlis to occur, mainly causing wild | |
| 396 | screen flickering | |
| 397 | 397 | |
| 398 | games fixed: | |
| 399 | Ace of Aces | |
| 400 | Mean 18 | |
| 401 | Ninja Golf (end of levels) | |
| 402 | Choplifter | |
| 403 | Impossible Mission | |
| 404 | Jinks | |
| 405 | */ | |
| 398 | games fixed: | |
| 399 | Ace of Aces | |
| 400 | Mean 18 | |
| 401 | Ninja Golf (end of levels) | |
| 402 | Choplifter | |
| 403 | Impossible Mission | |
| 404 | Jinks | |
| 405 | */ | |
| 406 | 406 | |
| 407 | 407 | maria_dodma = 0; |
| 408 | 408 | /*logerror( "vblank on line %d\n\n", frame_scanline );*/ |
| r5932 | r5933 | |
| 578 | 578 | maria_rm = data & 0x03; |
| 579 | 579 | |
| 580 | 580 | /*logerror( "MARIA CTRL: CK:%d DMA:%d CW:%d BC:%d KM:%d RM:%d\n", |
| 581 | maria_color_kill ? 1 : 0, | |
| 582 | ( data & 0x60 ) >> 5, | |
| 583 | maria_cwidth ? 1 : 0, | |
| 584 | maria_bcntl ? 1 : 0, | |
| 585 | maria_kangaroo ? 1 : 0, | |
| 586 | maria_rm );*/ | |
| 581 | maria_color_kill ? 1 : 0, | |
| 582 | ( data & 0x60 ) >> 5, | |
| 583 | maria_cwidth ? 1 : 0, | |
| 584 | maria_bcntl ? 1 : 0, | |
| 585 | maria_kangaroo ? 1 : 0, | |
| 586 | maria_rm );*/ | |
| 587 | 587 | |
| 588 | 588 | break; |
| 589 | 589 | case 0x1D: |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | A1 1 |* \_/ | 16 Vcc | |
| 11 | A2 2 | | 15 F | |
| 12 | _LE 3 | | 14 G | |
| 13 | _RBO 4 | DM9368 | 13 A | |
| 14 | _RBI 5 | | 12 B | |
| 15 | A3 6 | | 11 C | |
| 16 | A0 7 | | 10 D | |
| 17 | GND 8 |_____________| 9 E | |
| 9 | _____ _____ | |
| 10 | A1 1 |* \_/ | 16 Vcc | |
| 11 | A2 2 | | 15 F | |
| 12 | _LE 3 | | 14 G | |
| 13 | _RBO 4 | DM9368 | 13 A | |
| 14 | _RBI 5 | | 12 B | |
| 15 | A3 6 | | 11 C | |
| 16 | A0 7 | | 10 D | |
| 17 | GND 8 |_____________| 9 E | |
| 18 | 18 | |
| 19 | 19 | **********************************************************************/ |
| 20 | 20 | |
| r5932 | r5933 | |
| 43 | 43 | struct _dm9368_config |
| 44 | 44 | { |
| 45 | 45 | const char *rbo_tag; /* device to connect RBO pin to */ |
| 46 | ||
| 46 | ||
| 47 | 47 | int digit; /* output digit */ |
| 48 | 48 | }; |
| 49 | 49 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | CoCo 3 Video Hardware | |
| 4 | 4 | |
| 5 | TODO: | |
| 6 | - Implement "burst phase invert" (it switches the artifact colors) | |
| 7 | - Figure out what Bit 3 of $FF98 is and implement it | |
| 8 | - Learn more about the "mystery" CoCo 3 video modes | |
| 9 | - Support the VSC register | |
| 5 | TODO: | |
| 6 | - Implement "burst phase invert" (it switches the artifact colors) | |
| 7 | - Figure out what Bit 3 of $FF98 is and implement it | |
| 8 | - Learn more about the "mystery" CoCo 3 video modes | |
| 9 | - Support the VSC register | |
| 10 | 10 | |
| 11 | 11 | |
| 12 | Mid frame raster effects (source John Kowalski) | |
| 13 | Here are the things that get changed mid-frame: | |
| 14 | -palette registers ($ffb0-$ffbf) | |
| 15 | -horizontal resolution (switches between 256 and 320 pixels, $ff99) | |
| 16 | -horizontal scroll position (bits 0-6 $ff9f) | |
| 17 | -horizontal virtual screen (bit 7 $ff9f) | |
| 18 | -pixel height (bits 0-2 $ff98) | |
| 19 | -border color ($ff9a) | |
| 20 | On the positive side, you don't have to worry about registers | |
| 21 | $ff9d/ff9e being changed mid-frame. Even if they are changed | |
| 22 | mid-frame, they have no effect on the displayed image. The video | |
| 23 | address only gets latched at the top of the frame. | |
| 12 | Mid frame raster effects (source John Kowalski) | |
| 13 | Here are the things that get changed mid-frame: | |
| 14 | -palette registers ($ffb0-$ffbf) | |
| 15 | -horizontal resolution (switches between 256 and 320 pixels, $ff99) | |
| 16 | -horizontal scroll position (bits 0-6 $ff9f) | |
| 17 | -horizontal virtual screen (bit 7 $ff9f) | |
| 18 | -pixel height (bits 0-2 $ff98) | |
| 19 | -border color ($ff9a) | |
| 20 | On the positive side, you don't have to worry about registers | |
| 21 | $ff9d/ff9e being changed mid-frame. Even if they are changed | |
| 22 | mid-frame, they have no effect on the displayed image. The video | |
| 23 | address only gets latched at the top of the frame. | |
| 24 | 24 | |
| 25 | 25 | ***************************************************************************/ |
| 26 | 26 | |
| r5932 | r5933 | |
| 41 | 41 | |
| 42 | 42 | /************************************* |
| 43 | 43 | * |
| 44 | * | |
| 44 | * Global variables | |
| 45 | 45 | * |
| 46 | 46 | *************************************/ |
| 47 | 47 | |
| r5932 | r5933 | |
| 82 | 82 | UINT8 video_type; |
| 83 | 83 | |
| 84 | 84 | /* video state; every scanline the video state for the scanline is copied |
| 85 | ||
| 85 | * here and only rendered in VIDEO_UPDATE */ | |
| 86 | 86 | coco3_scanline_record scanlines[384]; |
| 87 | 87 | }; |
| 88 | 88 | |
| r5932 | r5933 | |
| 92 | 92 | |
| 93 | 93 | /************************************* |
| 94 | 94 | * |
| 95 | * | |
| 95 | * Parameters | |
| 96 | 96 | * |
| 97 | 97 | *************************************/ |
| 98 | 98 | |
| r5932 | r5933 | |
| 103 | 103 | |
| 104 | 104 | /************************************* |
| 105 | 105 | * |
| 106 | * | |
| 106 | * Video rendering | |
| 107 | 107 | * |
| 108 | 108 | *************************************/ |
| 109 | 109 | |
| r5932 | r5933 | |
| 134 | 134 | if (is_black_white) |
| 135 | 135 | { |
| 136 | 136 | /* We are on a composite monitor/TV and the monochrome phase invert |
| 137 | * flag is on in the GIME. This means we have to average out all | |
| 138 | * colors | |
| 139 | */ | |
| 137 | * flag is on in the GIME. This means we have to average out all | |
| 138 | * colors | |
| 139 | */ | |
| 140 | 140 | UINT32 red = ((c & 0xFF0000) >> 16); |
| 141 | 141 | UINT32 green = ((c & 0x00FF00) >> 8); |
| 142 | 142 | UINT32 blue = ((c & 0x0000FF) >> 0); |
| r5932 | r5933 | |
| 181 | 181 | if (attr & 0x40) |
| 182 | 182 | { |
| 183 | 183 | /* to quote SockMaster: |
| 184 | * | |
| 185 | * The underline attribute will light up the bottom scan line of the character | |
| 186 | * if the lines are set to 8 or 9. Not appear at all when less, or appear on | |
| 187 | * the 2nd to bottom scan line if set higher than 9. Further exception being | |
| 188 | * the $x7 setting where the whole screen is filled with only one line of data | |
| 189 | * - but it's glitched - the line repeats over and over again every 16 scan | |
| 190 | * lines.. Nobody will use this mode, but that's what happens if you want to | |
| 191 | * make things really authentic :) | |
| 192 | */ | |
| 184 | * | |
| 185 | * The underline attribute will light up the bottom scan line of the character | |
| 186 | * if the lines are set to 8 or 9. Not appear at all when less, or appear on | |
| 187 | * the 2nd to bottom scan line if set higher than 9. Further exception being | |
| 188 | * the $x7 setting where the whole screen is filled with only one line of data | |
| 189 | * - but it's glitched - the line repeats over and over again every 16 scan | |
| 190 | * lines.. Nobody will use this mode, but that's what happens if you want to | |
| 191 | * make things really authentic :) | |
| 192 | */ | |
| 193 | 193 | switch(scanline_record->ff98 & 0x07) |
| 194 | 194 | { |
| 195 | 195 | case 0x03: /* 8 scanlines per row */ |
| r5932 | r5933 | |
| 457 | 457 | |
| 458 | 458 | /************************************* |
| 459 | 459 | * |
| 460 | * | |
| 460 | * Miscellaneous | |
| 461 | 461 | * |
| 462 | 462 | *************************************/ |
| 463 | 463 | |
| r5932 | r5933 | |
| 573 | 573 | video_data_size = sizeof(scanline_record->data); |
| 574 | 574 | |
| 575 | 575 | /* FF9F offsets wrap around every 256 bytes, even if bit 7 is not set. |
| 576 | ||
| 576 | * Therefore, we must split things up into two separate segments */ | |
| 577 | 577 | segment_length = MIN(video_data_size, 256 - video_offset); |
| 578 | 578 | memcpy_dirty(&dirty, scanline_record->data, video_data + video_offset, segment_length); |
| 579 | 579 | memcpy_dirty(&dirty, scanline_record->data + segment_length, video_data, video_data_size - segment_length); |
| r5932 | r5933 | |
| 644 | 644 | UINT32 coco3_get_video_base(UINT8 ff9d_mask, UINT8 ff9e_mask) |
| 645 | 645 | { |
| 646 | 646 | /* The purpose of the ff9d_mask and ff9e_mask is to mask out bits that are |
| 647 | * ignored in lo-res mode. Specifically, $FF9D is masked with $E0, and | |
| 648 | * $FF9E is masked with $3F | |
| 649 | * | |
| 650 | * John Kowalski confirms this behavior | |
| 651 | */ | |
| 647 | * ignored in lo-res mode. Specifically, $FF9D is masked with $E0, and | |
| 648 | * $FF9E is masked with $3F | |
| 649 | * | |
| 650 | * John Kowalski confirms this behavior | |
| 651 | */ | |
| 652 | 652 | return ((offs_t) (coco3_gimereg[14] & ff9e_mask) * 0x00008) |
| 653 | 653 | | ((offs_t) (coco3_gimereg[13] & ff9d_mask) * 0x00800) |
| 654 | 654 | | ((offs_t) (coco3_gimereg[11] & 0x03) * 0x80000); |
| r5932 | r5933 | |
| 665 | 665 | |
| 666 | 666 | /************************************* |
| 667 | 667 | * |
| 668 | * | |
| 668 | * Initialization | |
| 669 | 669 | * |
| 670 | 670 | *************************************/ |
| 671 | 671 | |
| 672 | 672 | static UINT32 get_composite_color(int color) |
| 673 | 673 | { |
| 674 | 674 | /* CMP colors |
| 675 | * | |
| 676 | * These colors are of the format IICCCC, where II is the intensity and | |
| 677 | * CCCC is the base color. There is some weirdness because intensity | |
| 678 | * is often different for each base color. | |
| 679 | * | |
| 680 | * The code below is based on an algorithm specified in the following | |
| 681 | * CoCo BASIC program was used to approximate composite colors. | |
| 682 | * (Program by SockMaster): | |
| 683 | * | |
| 684 | * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 | |
| 685 | * 20 SAT=92:CON=70:BRI=-50:L(0)=0:L(1)=47:L(2)=120:L(3)=255 | |
| 686 | * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 | |
| 687 | * 40 BRI=BRI+CON:FORG=1TO15:R(P)=COS(A)*SAT+BRI | |
| 688 | * 50 G(P)=(COS(S)*SAT)*1+BRI:B(P)=(COS(D)*SAT)*1+BRI:P=P+1 | |
| 689 | * 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) | |
| 690 | * 60 NEXT:R(63)=R(48):G(63)=G(48):B(63)=B(48) | |
| 691 | * 70 FORH=0TO63STEP1:R=INT(R(H)):G=INT(G(H)):B=INT(B(H)):IFR<0THENR=0 | |
| 692 | * 80 IFG<0THENG=0 | |
| 693 | * 90 IFB<0THENB=0 | |
| 694 | * 91 IFR>255THENR=255 | |
| 695 | * 92 IFG>255THENG=255 | |
| 696 | * 93 IFB>255THENB=255 | |
| 697 | * 100 PRINTRIGHT$(STR$(H),2);" $";:R=R+256:G=G+256:B=B+256 | |
| 698 | * 110 PRINTRIGHT$(HEX$(R),2);",$";RIGHT$(HEX$(G),2);",$";RIGHT$(HEX$(B),2) | |
| 699 | * 115 IF(H AND15)=15 THENIFINKEY$=""THEN115ELSEPRINT | |
| 700 | * 120 NEXT | |
| 701 | * | |
| 702 | * At one point, we used a different SockMaster program, but the colors | |
| 703 | * produced were too dark for people's taste | |
| 704 | * | |
| 705 | * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 | |
| 706 | * 20 SAT=92:CON=53:BRI=-16:L(0)=0:L(1)=47:L(2)=120:L(3)=255 | |
| 707 | * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 | |
| 708 | * 40 BRI=BRI+CON:FORG=1TO15:R(P)=COS(A)*SAT+BRI | |
| 709 | * 50 G(P)=(COS(S)*SAT)*.50+BRI:B(P)=(COS(D)*SAT)*1.9+BRI:P=P+1 | |
| 710 | * 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) | |
| 711 | * 60 NEXT:R(63)=R(48):G(63)=G(48):B(63)=B(48) | |
| 712 | * 70 FORH=0TO63STEP1:R=INT(R(H)):G=INT(G(H)):B=INT(B(H)):IFR<0THENR=0 | |
| 713 | * 80 IFG<0THENG=0 | |
| 714 | * 90 IFB<0THENB=0 | |
| 715 | * 91 IFR>255THENR=255 | |
| 716 | * 92 IFG>255THENG=255 | |
| 717 | * 93 IFB>255THENB=255 | |
| 718 | * 100 PRINTRIGHT$(STR$(H),2);" $";:R=R+256:G=G+256:B=B+256 | |
| 719 | * 110 PRINTRIGHT$(HEX$(R),2);",$";RIGHT$(HEX$(G),2);",$";RIGHT$(HEX$(B),2) | |
| 720 | * 115 IF(H AND15)=15 THENIFINKEY$=""THEN115ELSEPRINT | |
| 721 | * 120 NEXT | |
| 722 | */ | |
| 675 | * | |
| 676 | * These colors are of the format IICCCC, where II is the intensity and | |
| 677 | * CCCC is the base color. There is some weirdness because intensity | |
| 678 | * is often different for each base color. | |
| 679 | * | |
| 680 | * The code below is based on an algorithm specified in the following | |
| 681 | * CoCo BASIC program was used to approximate composite colors. | |
| 682 | * (Program by SockMaster): | |
| 683 | * | |
| 684 | * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 | |
| 685 | * 20 SAT=92:CON=70:BRI=-50:L(0)=0:L(1)=47:L(2)=120:L(3)=255 | |
| 686 | * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 | |
| 687 | * 40 BRI=BRI+CON:FORG=1TO15:R(P)=COS(A)*SAT+BRI | |
| 688 | * 50 G(P)=(COS(S)*SAT)*1+BRI:B(P)=(COS(D)*SAT)*1+BRI:P=P+1 | |
| 689 | * 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) | |
| 690 | * 60 NEXT:R(63)=R(48):G(63)=G(48):B(63)=B(48) | |
| 691 | * 70 FORH=0TO63STEP1:R=INT(R(H)):G=INT(G(H)):B=INT(B(H)):IFR<0THENR=0 | |
| 692 | * 80 IFG<0THENG=0 | |
| 693 | * 90 IFB<0THENB=0 | |
| 694 | * 91 IFR>255THENR=255 | |
| 695 | * 92 IFG>255THENG=255 | |
| 696 | * 93 IFB>255THENB=255 | |
| 697 | * 100 PRINTRIGHT$(STR$(H),2);" $";:R=R+256:G=G+256:B=B+256 | |
| 698 | * 110 PRINTRIGHT$(HEX$(R),2);",$";RIGHT$(HEX$(G),2);",$";RIGHT$(HEX$(B),2) | |
| 699 | * 115 IF(H AND15)=15 THENIFINKEY$=""THEN115ELSEPRINT | |
| 700 | * 120 NEXT | |
| 701 | * | |
| 702 | * At one point, we used a different SockMaster program, but the colors | |
| 703 | * produced were too dark for people's taste | |
| 704 | * | |
| 705 | * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1 | |
| 706 | * 20 SAT=92:CON=53:BRI=-16:L(0)=0:L(1)=47:L(2)=120:L(3)=255 | |
| 707 | * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1 | |
| 708 | * 40 BRI=BRI+CON:FORG=1TO15:R(P)=COS(A)*SAT+BRI | |
| 709 | * 50 G(P)=(COS(S)*SAT)*.50+BRI:B(P)=(COS(D)*SAT)*1.9+BRI:P=P+1 | |
| 710 | * 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) | |
| 711 | * 60 NEXT:R(63)=R(48):G(63)=G(48):B(63)=B(48) | |
| 712 | * 70 FORH=0TO63STEP1:R=INT(R(H)):G=INT(G(H)):B=INT(B(H)):IFR<0THENR=0 | |
| 713 | * 80 IFG<0THENG=0 | |
| 714 | * 90 IFB<0THENB=0 | |
| 715 | * 91 IFR>255THENR=255 | |
| 716 | * 92 IFG>255THENG=255 | |
| 717 | * 93 IFB>255THENB=255 | |
| 718 | * 100 PRINTRIGHT$(STR$(H),2);" $";:R=R+256:G=G+256:B=B+256 | |
| 719 | * 110 PRINTRIGHT$(HEX$(R),2);",$";RIGHT$(HEX$(G),2);",$";RIGHT$(HEX$(B),2) | |
| 720 | * 115 IF(H AND15)=15 THENIFINKEY$=""THEN115ELSEPRINT | |
| 721 | * 120 NEXT | |
| 722 | */ | |
| 723 | 723 | |
| 724 | 724 | double saturation, brightness, contrast; |
| 725 | 725 | int offset; |
| r5932 | r5933 | |
|---|---|---|
| 417 | 417 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 418 | 418 | int i; |
| 419 | 419 | |
| 420 | // | |
| 420 | // if ( y == 0 ) logerror("cga_gfx_2bpp_update_row\n"); | |
| 421 | 421 | for ( i = 0; i < x_count; i++ ) { |
| 422 | 422 | UINT16 offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 ); |
| 423 | 423 | UINT8 data = videoram[ offset ]; |
| r5932 | r5933 | |
| 470 | 470 | |
| 471 | 471 | /************************************* |
| 472 | 472 | * |
| 473 | * | |
| 473 | * AGA MDA/CGA read/write handlers | |
| 474 | 474 | * |
| 475 | 475 | *************************************/ |
| 476 | 476 | |
| r5932 | r5933 | |
| 817 | 817 | switch(offset) { |
| 818 | 818 | case 4: |
| 819 | 819 | pc200.portd |= 0x20; |
| 820 | // | |
| 820 | // pc_cga8_w(space, offset,data); | |
| 821 | 821 | break; |
| 822 | 822 | case 8: |
| 823 | 823 | pc200.port8 = data; |
| 824 | 824 | pc200.portd |= 0x80; |
| 825 | // | |
| 825 | // pc_cga8_w(space, offset,data); | |
| 826 | 826 | break; |
| 827 | 827 | case 0xe: |
| 828 | 828 | pc200.portd = 0x1f; |
| r5932 | r5933 | |
| 847 | 847 | break; |
| 848 | 848 | |
| 849 | 849 | default: |
| 850 | // | |
| 850 | // pc_cga8_w(space, offset,data); | |
| 851 | 851 | break; |
| 852 | 852 | } |
| 853 | 853 | } |
| r5932 | r5933 | |
| 874 | 874 | break; |
| 875 | 875 | |
| 876 | 876 | default: |
| 877 | // | |
| 877 | // result = pc_cga8_r(space, offset); | |
| 878 | 878 | break; |
| 879 | 879 | } |
| 880 | 880 | return result; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | * | |
| 2 | * Microtan 65 | |
| 3 | 3 | * |
| 4 | * | |
| 4 | * video hardware | |
| 5 | 5 | * |
| 6 | * | |
| 6 | * Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000 | |
| 7 | 7 | * |
| 8 | * | |
| 8 | * Thanks go to Geoff Macdonald <mail@geoff.org.uk> | |
| 9 | 9 | * for his site http:://www.geo255.redhotant.com |
| 10 | * and to Fabrice Frances <frances@ensica.fr> | |
| 11 | * for his site http://www.ifrance.com/oric/microtan.html | |
| 10 | * and to Fabrice Frances <frances@ensica.fr> | |
| 11 | * for his site http://www.ifrance.com/oric/microtan.html | |
| 12 | 12 | * |
| 13 | 13 | ***************************************************************************/ |
| 14 | 14 |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Notes on Port 3D8 |
| 7 | 7 | (http://www.clipx.net/ng/interrupts_and_ports/ng2d045.php) |
| 8 | 8 | |
| 9 | ||
| 9 | Port 3D8 - Color/VGA Mode control register | |
| 10 | 10 | |
| 11 | xx1x xxxx Attribute bit 7. 0=blink, 1=Intesity | |
| 12 | xxx1 xxxx 640x200 mode | |
| 13 | xxxx 1xxx Enable video signal | |
| 14 | xxxx x1xx Select B/W mode | |
| 15 | xxxx xx1x Select graphics | |
| 16 | xxxx xxx1 80x25 text | |
| 11 | xx1x xxxx Attribute bit 7. 0=blink, 1=Intesity | |
| 12 | xxx1 xxxx 640x200 mode | |
| 13 | xxxx 1xxx Enable video signal | |
| 14 | xxxx x1xx Select B/W mode | |
| 15 | xxxx xx1x Select graphics | |
| 16 | xxxx xxx1 80x25 text | |
| 17 | 17 | |
| 18 | 18 | |
| 19 | The usage of the above control register for various modes is: | |
| 20 | xx10 1100 40x25 alpha B/W | |
| 21 | xx10 1000 40x25 alpha color | |
| 22 | xx10 1101 80x25 alpha B/W | |
| 23 | xx10 1001 80x25 alpha color | |
| 24 | xxx0 1110 320x200 graph B/W | |
| 25 | xxx0 1010 320x200 graph color | |
| 26 | xxx1 1110 640x200 graph B/W | |
| 19 | The usage of the above control register for various modes is: | |
| 20 | xx10 1100 40x25 alpha B/W | |
| 21 | xx10 1000 40x25 alpha color | |
| 22 | xx10 1101 80x25 alpha B/W | |
| 23 | xx10 1001 80x25 alpha color | |
| 24 | xxx0 1110 320x200 graph B/W | |
| 25 | xxx0 1010 320x200 graph color | |
| 26 | xxx1 1110 640x200 graph B/W | |
| 27 | 27 | |
| 28 | 28 | |
| 29 | ||
| 29 | PC1512 display notes | |
| 30 | 30 | |
| 31 | The PC1512 built-in display adaptor is an emulation of IBM's CGA. Unlike a | |
| 32 | real CGA, it is not built around a real MC6845 controller, and so attempts | |
| 33 | to get custom video modes out of it may not work as expected. Its 640x200 | |
| 34 | CGA mode can be set up to be a 16-color mode rather than mono. | |
| 31 | The PC1512 built-in display adaptor is an emulation of IBM's CGA. Unlike a | |
| 32 | real CGA, it is not built around a real MC6845 controller, and so attempts | |
| 33 | to get custom video modes out of it may not work as expected. Its 640x200 | |
| 34 | CGA mode can be set up to be a 16-color mode rather than mono. | |
| 35 | 35 | |
| 36 | If you program it with BIOS calls, the PC1512 behaves just like a real CGA, | |
| 37 | except: | |
| 36 | If you program it with BIOS calls, the PC1512 behaves just like a real CGA, | |
| 37 | except: | |
| 38 | 38 | |
| 39 | - The 'greyscale' text modes (0 and 2) behave just like the 'color' | |
| 40 | ones (1 and 3). On a color monitor both are in color; on a mono | |
| 41 | monitor both are in greyscale. | |
| 42 | - Mode 5 (the 'greyscale' graphics mode) displays in color, using | |
| 43 | an alternative color palette: Cyan, Red and White. | |
| 44 | - The undocumented 160x100x16 "graphics" mode works correctly. | |
| 39 | - The 'greyscale' text modes (0 and 2) behave just like the 'color' | |
| 40 | ones (1 and 3). On a color monitor both are in color; on a mono | |
| 41 | monitor both are in greyscale. | |
| 42 | - Mode 5 (the 'greyscale' graphics mode) displays in color, using | |
| 43 | an alternative color palette: Cyan, Red and White. | |
| 44 | - The undocumented 160x100x16 "graphics" mode works correctly. | |
| 45 | 45 | |
| 46 | ||
| 46 | (source John Elliott http://www.seasip.info/AmstradXT/pc1512disp.html) | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | Cursor signal handling: |
| r5932 | r5933 | |
| 97 | 97 | |
| 98 | 98 | /*************************************************************************** |
| 99 | 99 | |
| 100 | ||
| 100 | Static declarations | |
| 101 | 101 | |
| 102 | 102 | ***************************************************************************/ |
| 103 | 103 | |
| r5932 | r5933 | |
| 230 | 230 | |
| 231 | 231 | /*************************************************************************** |
| 232 | 232 | |
| 233 | ||
| 233 | Local variables and declarations | |
| 234 | 234 | |
| 235 | 235 | ***************************************************************************/ |
| 236 | 236 | |
| r5932 | r5933 | |
| 416 | 416 | |
| 417 | 417 | /*************************************************************************** |
| 418 | 418 | |
| 419 | ||
| 419 | Methods | |
| 420 | 420 | |
| 421 | 421 | ***************************************************************************/ |
| 422 | 422 | |
| r5932 | r5933 | |
| 471 | 471 | const address_space *spaceio = cpu_get_address_space(machine->firstcpu, ADDRESS_SPACE_IO); |
| 472 | 472 | |
| 473 | 473 | /* Changed video RAM size to full 32k, for cards which support the |
| 474 | * Plantronics chipset. | |
| 475 | * TODO: Cards which don't support Plantronics should repeat at | |
| 476 | * BC000h */ | |
| 474 | * Plantronics chipset. | |
| 475 | * TODO: Cards which don't support Plantronics should repeat at | |
| 476 | * BC000h */ | |
| 477 | 477 | buswidth = cpu_get_databus_width(machine->firstcpu, ADDRESS_SPACE_PROGRAM); |
| 478 | 478 | switch(buswidth) |
| 479 | 479 | { |
| r5932 | r5933 | |
| 897 | 897 | int b = ( ntsc_decoded[samp_index+2] + ntsc_decoded[samp_index+5] ) / 2; |
| 898 | 898 | *p = 0x8000 + ( ( ( r & 0xF8 ) << 7 ) | ( ( g & 0xF8 ) << 2 ) | ( ( b & 0xF8 ) >> 3 ) ); |
| 899 | 899 | p++; |
| 900 | samp_index +=6; | |
| 900 | samp_index +=6; | |
| 901 | 901 | } |
| 902 | 902 | } |
| 903 | 903 | } |
| r5932 | r5933 | |
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | /* |
| 1043 | * | |
| 1043 | * rW CGA mode control register (see #P138) | |
| 1044 | 1044 | * |
| 1045 | 1045 | * x x x 0 1 0 0 0 - 320x200, 40x25 text. Colour on RGB and composite monitors. |
| 1046 | 1046 | * x x x 0 1 0 0 1 - 640x200, 80x25 text. Colour on RGB and composite monitors. |
| r5932 | r5933 | |
| 1162 | 1162 | |
| 1163 | 1163 | |
| 1164 | 1164 | /* |
| 1165 | * | |
| 1165 | * ?W reserved for color select register on color adapter | |
| 1166 | 1166 | */ |
| 1167 | 1167 | static void pc_cga_color_select_w(running_machine *machine, int data) |
| 1168 | 1168 | { |
| r5932 | r5933 | |
| 1192 | 1192 | |
| 1193 | 1193 | /************************************************************************* |
| 1194 | 1194 | * |
| 1195 | * CGA | |
| 1196 | * color graphics adapter | |
| 1195 | * CGA | |
| 1196 | * color graphics adapter | |
| 1197 | 1197 | * |
| 1198 | 1198 | *************************************************************************/ |
| 1199 | 1199 | |
| r5932 | r5933 | |
| 1265 | 1265 | // |
| 1266 | 1266 | |
| 1267 | 1267 | //INLINE void pgfx_plot_unit_4bpp(bitmap_t *bitmap, |
| 1268 | // | |
| 1268 | // int x, int y, int offs) | |
| 1269 | 1269 | //{ |
| 1270 | // int color, values[2]; | |
| 1271 | // int i; | |
| 1270 | // int color, values[2]; | |
| 1271 | // int i; | |
| 1272 | 1272 | // |
| 1273 | // if (cga.plantronics & 0x40) | |
| 1274 | // { | |
| 1275 | // values[0] = videoram[offs | 0x4000]; | |
| 1276 | // values[1] = videoram[offs]; | |
| 1277 | // } | |
| 1278 | // else | |
| 1279 | // { | |
| 1280 | // values[0] = videoram[offs]; | |
| 1281 | // values[1] = videoram[offs | 0x4000]; | |
| 1282 | // } | |
| 1283 | // for (i=3; i>=0; i--) | |
| 1284 | // { | |
| 1285 | // color = ((values[0] & 0x3) << 1) | | |
| 1286 | // ((values[1] & 2) >> 1) | | |
| 1287 | // ((values[1] & 1) << 3); | |
| 1288 | // *BITMAP_ADDR16(bitmap, y, x+i) = Machine->pens[color]; | |
| 1289 | // values[0]>>=2; | |
| 1290 | // values[1]>>=2; | |
| 1291 | // } | |
| 1273 | // if (cga.plantronics & 0x40) | |
| 1274 | // { | |
| 1275 | // values[0] = videoram[offs | 0x4000]; | |
| 1276 | // values[1] = videoram[offs]; | |
| 1277 | // } | |
| 1278 | // else | |
| 1279 | // { | |
| 1280 | // values[0] = videoram[offs]; | |
| 1281 | // values[1] = videoram[offs | 0x4000]; | |
| 1282 | // } | |
| 1283 | // for (i=3; i>=0; i--) | |
| 1284 | // { | |
| 1285 | // color = ((values[0] & 0x3) << 1) | | |
| 1286 | // ((values[1] & 2) >> 1) | | |
| 1287 | // ((values[1] & 1) << 3); | |
| 1288 | // *BITMAP_ADDR16(bitmap, y, x+i) = Machine->pens[color]; | |
| 1289 | // values[0]>>=2; | |
| 1290 | // values[1]>>=2; | |
| 1291 | // } | |
| 1292 | 1292 | //} |
| 1293 | 1293 | // |
| 1294 | 1294 | // |
| r5932 | r5933 | |
| 1301 | 1301 | // |
| 1302 | 1302 | //static void cga_pgfx_4bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc) |
| 1303 | 1303 | //{ |
| 1304 | // int i, sx, sy, sh; | |
| 1305 | // int offs = mscrtc6845_get_start(crtc)*2; | |
| 1306 | // int lines = mscrtc6845_get_char_lines(crtc); | |
| 1307 | // int height = mscrtc6845_get_char_height(crtc); | |
| 1308 | // int columns = mscrtc6845_get_char_columns(crtc)*2; | |
| 1304 | // int i, sx, sy, sh; | |
| 1305 | // int offs = mscrtc6845_get_start(crtc)*2; | |
| 1306 | // int lines = mscrtc6845_get_char_lines(crtc); | |
| 1307 | // int height = mscrtc6845_get_char_height(crtc); | |
| 1308 | // int columns = mscrtc6845_get_char_columns(crtc)*2; | |
| 1309 | 1309 | // |
| 1310 | // for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) | |
| 1311 | // { | |
| 1312 | // for (sh=0; sh<height; sh++, offs|=0x2000) | |
| 1313 | // { | |
| 1314 | // // char line 0 used as a12 line in graphic mode | |
| 1315 | // if (!(sh & 1)) | |
| 1316 | // { | |
| 1317 | // for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 1318 | // { | |
| 1319 | // pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); | |
| 1320 | // } | |
| 1321 | // } | |
| 1322 | // else | |
| 1323 | // { | |
| 1324 | // for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 1325 | // { | |
| 1326 | // pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); | |
| 1327 | // } | |
| 1328 | // } | |
| 1329 | // } | |
| 1330 | // } | |
| 1310 | // for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) | |
| 1311 | // { | |
| 1312 | // for (sh=0; sh<height; sh++, offs|=0x2000) | |
| 1313 | // { | |
| 1314 | // // char line 0 used as a12 line in graphic mode | |
| 1315 | // if (!(sh & 1)) | |
| 1316 | // { | |
| 1317 | // for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 1318 | // { | |
| 1319 | // pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); | |
| 1320 | // } | |
| 1321 | // } | |
| 1322 | // else | |
| 1323 | // { | |
| 1324 | // for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 1325 | // { | |
| 1326 | // pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); | |
| 1327 | // } | |
| 1328 | // } | |
| 1329 | // } | |
| 1330 | // } | |
| 1331 | 1331 | //} |
| 1332 | 1332 | // |
| 1333 | 1333 | // |
| 1334 | 1334 | // |
| 1335 | 1335 | //INLINE void pgfx_plot_unit_2bpp(bitmap_t *bitmap, |
| 1336 | // | |
| 1336 | // int x, int y, const UINT16 *palette, int offs) | |
| 1337 | 1337 | //{ |
| 1338 | // int i; | |
| 1339 | // UINT8 bmap[2], values[2]; | |
| 1340 | // UINT16 *dest; | |
| 1338 | // int i; | |
| 1339 | // UINT8 bmap[2], values[2]; | |
| 1340 | // UINT16 *dest; | |
| 1341 | 1341 | // |
| 1342 | // if (cga.plantronics & 0x40) | |
| 1343 | // { | |
| 1344 | // values[0] = videoram[offs]; | |
| 1345 | // values[1] = videoram[offs | 0x4000]; | |
| 1346 | // } | |
| 1347 | // else | |
| 1348 | // { | |
| 1349 | // values[0] = videoram[offs | 0x4000]; | |
| 1350 | // values[1] = videoram[offs]; | |
| 1351 | // } | |
| 1352 | // bmap[0] = bmap[1] = 0; | |
| 1353 | // for (i=3; i>=0; i--) | |
| 1354 | // { | |
| 1355 | // bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1; | |
| 1356 | // bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1; | |
| 1357 | // bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1; | |
| 1358 | // bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1; | |
| 1359 | // values[0] = values[0] << 1; | |
| 1360 | // values[1] = values[1] << 1; | |
| 1361 | // } | |
| 1342 | // if (cga.plantronics & 0x40) | |
| 1343 | // { | |
| 1344 | // values[0] = videoram[offs]; | |
| 1345 | // values[1] = videoram[offs | 0x4000]; | |
| 1346 | // } | |
| 1347 | // else | |
| 1348 | // { | |
| 1349 | // values[0] = videoram[offs | 0x4000]; | |
| 1350 | // values[1] = videoram[offs]; | |
| 1351 | // } | |
| 1352 | // bmap[0] = bmap[1] = 0; | |
| 1353 | // for (i=3; i>=0; i--) | |
| 1354 | // { | |
| 1355 | // bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1; | |
| 1356 | // bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1; | |
| 1357 | // bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1; | |
| 1358 | // bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1; | |
| 1359 | // values[0] = values[0] << 1; | |
| 1360 | // values[1] = values[1] << 1; | |
| 1361 | // } | |
| 1362 | 1362 | // |
| 1363 | // dest = BITMAP_ADDR16(bitmap, y, x); | |
| 1364 | // *(dest++) = palette[(bmap[0] >> 6) & 0x03]; | |
| 1365 | // *(dest++) = palette[(bmap[0] >> 4) & 0x03]; | |
| 1366 | // *(dest++) = palette[(bmap[0] >> 2) & 0x03]; | |
| 1367 | // *(dest++) = palette[(bmap[0] >> 0) & 0x03]; | |
| 1368 | // *(dest++) = palette[(bmap[1] >> 6) & 0x03]; | |
| 1369 | // *(dest++) = palette[(bmap[1] >> 4) & 0x03]; | |
| 1370 | // *(dest++) = palette[(bmap[1] >> 2) & 0x03]; | |
| 1371 | // *(dest++) = palette[(bmap[1] >> 0) & 0x03]; | |
| 1363 | // dest = BITMAP_ADDR16(bitmap, y, x); | |
| 1364 | // *(dest++) = palette[(bmap[0] >> 6) & 0x03]; | |
| 1365 | // *(dest++) = palette[(bmap[0] >> 4) & 0x03]; | |
| 1366 | // *(dest++) = palette[(bmap[0] >> 2) & 0x03]; | |
| 1367 | // *(dest++) = palette[(bmap[0] >> 0) & 0x03]; | |
| 1368 | // *(dest++) = palette[(bmap[1] >> 6) & 0x03]; | |
| 1369 | // *(dest++) = palette[(bmap[1] >> 4) & 0x03]; | |
| 1370 | // *(dest++) = palette[(bmap[1] >> 2) & 0x03]; | |
| 1371 | // *(dest++) = palette[(bmap[1] >> 0) & 0x03]; | |
| 1372 | 1372 | //} |
| 1373 | 1373 | // |
| 1374 | 1374 | // |
| r5932 | r5933 | |
| 1381 | 1381 | // |
| 1382 | 1382 | //static void cga_pgfx_2bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc) |
| 1383 | 1383 | //{ |
| 1384 | // int i, sx, sy, sh; | |
| 1385 | // int offs = mscrtc6845_get_start(crtc)*2; | |
| 1386 | // int lines = mscrtc6845_get_char_lines(crtc); | |
| 1387 | // int height = mscrtc6845_get_char_height(crtc); | |
| 1388 | // int columns = mscrtc6845_get_char_columns(crtc)*2; | |
| 1389 | // int colorset = cga.color_select & 0x3F; | |
| 1390 | // const UINT16 *palette; | |
| 1384 | // int i, sx, sy, sh; | |
| 1385 | // int offs = mscrtc6845_get_start(crtc)*2; | |
| 1386 | // int lines = mscrtc6845_get_char_lines(crtc); | |
| 1387 | // int height = mscrtc6845_get_char_height(crtc); | |
| 1388 | // int columns = mscrtc6845_get_char_columns(crtc)*2; | |
| 1389 | // int colorset = cga.color_select & 0x3F; | |
| 1390 | // const UINT16 *palette; | |
| 1391 | 1391 | // |
| 1392 | // /* Most chipsets use bit 2 of the mode control register to | |
| 1393 | // * access a third palette. But not consistently. */ | |
| 1394 | // pc_cga_check_palette(); | |
| 1395 | // switch(CGA_CHIPSET) | |
| 1396 | // { | |
| 1397 | // /* The IBM Professional Graphics Controller behaves like | |
| 1398 | // * the PC1512, btw. */ | |
| 1399 | // case CGA_CHIPSET_PC1512: | |
| 1400 | // if ((colorset < 32) && (cga.mode_control & 4)) colorset += 64; | |
| 1401 | // break; | |
| 1392 | // /* Most chipsets use bit 2 of the mode control register to | |
| 1393 | // * access a third palette. But not consistently. */ | |
| 1394 | // pc_cga_check_palette(); | |
| 1395 | // switch(CGA_CHIPSET) | |
| 1396 | // { | |
| 1397 | // /* The IBM Professional Graphics Controller behaves like | |
| 1398 | // * the PC1512, btw. */ | |
| 1399 | // case CGA_CHIPSET_PC1512: | |
| 1400 | // if ((colorset < 32) && (cga.mode_control & 4)) colorset += 64; | |
| 1401 | // break; | |
| 1402 | 1402 | // |
| 1403 | // case CGA_CHIPSET_IBM: | |
| 1404 | // case CGA_CHIPSET_PC200: | |
| 1405 | // case CGA_CHIPSET_ATI: | |
| 1406 | // case CGA_CHIPSET_PARADISE: | |
| 1407 | // if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64; | |
| 1408 | // break; | |
| 1409 | // } | |
| 1403 | // case CGA_CHIPSET_IBM: | |
| 1404 | // case CGA_CHIPSET_PC200: | |
| 1405 | // case CGA_CHIPSET_ATI: | |
| 1406 | // case CGA_CHIPSET_PARADISE: | |
| 1407 | // if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64; | |
| 1408 | // break; | |
| 1409 | // } | |
| 1410 | 1410 | // |
| 1411 | 1411 | // |
| 1412 | // /* The fact that our palette is located in cga_colortable is a vestigial | |
| 1413 | // * aspect from when we were doing that ugly trick where drawgfx() would | |
| 1414 | // * handle graphics drawing. Truthfully, we should probably be using | |
| 1415 | // * palette_set_color_rgb() here and not doing the palette lookup in the loop | |
| 1416 | // */ | |
| 1417 | // palette = &cga_colortable[256*2 + 16*2] + colorset * 4; | |
| 1412 | // /* The fact that our palette is located in cga_colortable is a vestigial | |
| 1413 | // * aspect from when we were doing that ugly trick where drawgfx() would | |
| 1414 | // * handle graphics drawing. Truthfully, we should probably be using | |
| 1415 | // * palette_set_color_rgb() here and not doing the palette lookup in the loop | |
| 1416 | // */ | |
| 1417 | // palette = &cga_colortable[256*2 + 16*2] + colorset * 4; | |
| 1418 | 1418 | // |
| 1419 | // | |
| 1419 | // for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) { | |
| 1420 | 1420 | // |
| 1421 | // for (sh=0; sh<height; sh++) | |
| 1422 | // { | |
| 1423 | // if (!(sh&1)) { // char line 0 used as a12 line in graphic mode | |
| 1424 | // for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 1425 | // { | |
| 1426 | // pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); | |
| 1427 | // } | |
| 1428 | // } | |
| 1429 | // else | |
| 1430 | // { | |
| 1431 | // for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 1432 | // { | |
| 1433 | // pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); | |
| 1434 | // } | |
| 1435 | // } | |
| 1436 | // } | |
| 1437 | // } | |
| 1421 | // for (sh=0; sh<height; sh++) | |
| 1422 | // { | |
| 1423 | // if (!(sh&1)) { // char line 0 used as a12 line in graphic mode | |
| 1424 | // for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) | |
| 1425 | // { | |
| 1426 | // pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); | |
| 1427 | // } | |
| 1428 | // } | |
| 1429 | // else | |
| 1430 | // { | |
| 1431 | // for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) | |
| 1432 | // { | |
| 1433 | // pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); | |
| 1434 | // } | |
| 1435 | // } | |
| 1436 | // } | |
| 1437 | // } | |
| 1438 | 1438 | //} |
| 1439 | 1439 | |
| 1440 | 1440 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | For more information, please see: | |
| 3 | - http://cgfm2.emuviews.com/txt/msvdp.txt | |
| 4 | - http://www.smspower.org/forums/viewtopic.php?p=44198 | |
| 2 | For more information, please see: | |
| 3 | - http://cgfm2.emuviews.com/txt/msvdp.txt | |
| 4 | - http://www.smspower.org/forums/viewtopic.php?p=44198 | |
| 5 | 5 | |
| 6 | 6 | A scanline contains the following sections: |
| 7 | 7 | - horizontal sync 1 ED => HSYNC high/increment line counter/generate interrupts/etc |
| r5932 | r5933 | |
| 101 | 101 | UINT8 *collision_buffer; |
| 102 | 102 | |
| 103 | 103 | /* lineBuffer will be used to hold 5 lines of line data. Line #0 is the regular blitting area. |
| 104 | Lines #1-#4 will be used as a kind of cache to be used for vertical scaling in the gamegear | |
| 105 | sms compatibility mode. | |
| 106 | */ | |
| 104 | Lines #1-#4 will be used as a kind of cache to be used for vertical scaling in the gamegear | |
| 105 | sms compatibility mode. | |
| 106 | */ | |
| 107 | 107 | int *line_buffer; |
| 108 | 108 | int current_palette[32]; |
| 109 | 109 | void (*int_callback)(running_machine*,int); |
| r5932 | r5933 | |
| 150 | 150 | smsvdp.vdp_mode = 0; |
| 151 | 151 | } |
| 152 | 152 | else |
| 153 | // if ( M1 && ! M2 && ! M3 ) | |
| 154 | // { | |
| 155 | // smsvdp.vdp_mode = 1; | |
| 156 | // } | |
| 157 | // else | |
| 153 | // if ( M1 && ! M2 && ! M3 ) | |
| 154 | // { | |
| 155 | // smsvdp.vdp_mode = 1; | |
| 156 | // } | |
| 157 | // else | |
| 158 | 158 | if ( ! M1 && M2 && ! M3 ) |
| 159 | 159 | { |
| 160 | 160 | smsvdp.vdp_mode = 2; |
| 161 | // } | |
| 162 | // else | |
| 163 | // if ( ! M1 && ! M2 && M3 ) | |
| 164 | // { | |
| 165 | // smsvdp.vdp_mode = 3; | |
| 161 | // } | |
| 162 | // else | |
| 163 | // if ( ! M1 && ! M2 && M3 ) | |
| 164 | // { | |
| 165 | // smsvdp.vdp_mode = 3; | |
| 166 | 166 | } |
| 167 | 167 | else |
| 168 | 168 | { |
| r5932 | r5933 | |
| 218 | 218 | smsvdp.int_callback = config->int_callback; |
| 219 | 219 | |
| 220 | 220 | /* Allocate video RAM |
| 221 | In theory the driver could have a "gfx1" and/or "gfx2" memory region | |
| 222 | of it's own. So this code could potentially cause a clash. | |
| 223 | */ | |
| 221 | In theory the driver could have a "gfx1" and/or "gfx2" memory region | |
| 222 | of it's own. So this code could potentially cause a clash. | |
| 223 | */ | |
| 224 | 224 | smsvdp.VRAM = memory_region_alloc( machine, "gfx1", VRAM_SIZE, ROM_REQUIRED ); |
| 225 | 225 | smsvdp.CRAM = memory_region_alloc( machine, "gfx2", MAX_CRAM_SIZE, ROM_REQUIRED ); |
| 226 | 226 | smsvdp.line_buffer = auto_alloc_array(machine, int, 256 * 5); |
| r5932 | r5933 | |
| 659 | 659 | pixelPlotX = (0 - (xScroll & 0x07) + (tileColumn << 3) + pixelPlotX); |
| 660 | 660 | if (pixelPlotX >= 0 && pixelPlotX < 256) |
| 661 | 661 | { |
| 662 | // | |
| 662 | // logerror("%x %x\n", pixelPlotX + pixelOffsetX, pixelPlotY); | |
| 663 | 663 | lineBuffer[pixelPlotX] = smsvdp.current_palette[penSelected]; |
| 664 | 664 | prioritySelected[pixelPlotX] = prioritySelect | ( penSelected & 0x0F ); |
| 665 | 665 | } |
| r5932 | r5933 | |
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | /* Do vertical scaling for a screen with 192 or 224 lines |
| 1238 | Lines 0-2 and 221-223 have no effect on the output on the GG screen. | |
| 1239 | We will calculate the gamegear lines as follows: | |
| 1240 | GG_0 = 1/6 * SMS_3 + 1/3 * SMS_4 + 1/3 * SMS_5 + 1/6 * SMS_6 | |
| 1241 | GG_1 = 1/6 * SMS_4 + 1/3 * SMS_5 + 1/3 * SMS_6 + 1/6 * SMS_7 | |
| 1242 | GG_2 = 1/6 * SMS_6 + 1/3 * SMS_7 + 1/3 * SMS_8 + 1/6 * SMS_9 | |
| 1243 | GG_3 = 1/6 * SMS_7 + 1/3 * SMS_8 + 1/3 * SMS_9 + 1/6 * SMS_10 | |
| 1244 | GG_4 = 1/6 * SMS_9 + 1/3 * SMS_10 + 1/3 * SMS_11 + 1/6 * SMS_12 | |
| 1245 | ..... | |
| 1246 | GG_142 = 1/6 * SMS_216 + 1/3 * SMS_217 + 1/3 * SMS_218 + 1/6 * SMS_219 | |
| 1247 | GG_143 = 1/6 * SMS_217 + 1/3 * SMS_218 + 1/3 * SMS_219 + 1/6 * SMS_220 | |
| 1248 | */ | |
| 1238 | Lines 0-2 and 221-223 have no effect on the output on the GG screen. | |
| 1239 | We will calculate the gamegear lines as follows: | |
| 1240 | GG_0 = 1/6 * SMS_3 + 1/3 * SMS_4 + 1/3 * SMS_5 + 1/6 * SMS_6 | |
| 1241 | GG_1 = 1/6 * SMS_4 + 1/3 * SMS_5 + 1/3 * SMS_6 + 1/6 * SMS_7 | |
| 1242 | GG_2 = 1/6 * SMS_6 + 1/3 * SMS_7 + 1/3 * SMS_8 + 1/6 * SMS_9 | |
| 1243 | GG_3 = 1/6 * SMS_7 + 1/3 * SMS_8 + 1/3 * SMS_9 + 1/6 * SMS_10 | |
| 1244 | GG_4 = 1/6 * SMS_9 + 1/3 * SMS_10 + 1/3 * SMS_11 + 1/6 * SMS_12 | |
| 1245 | ..... | |
| 1246 | GG_142 = 1/6 * SMS_216 + 1/3 * SMS_217 + 1/3 * SMS_218 + 1/6 * SMS_219 | |
| 1247 | GG_143 = 1/6 * SMS_217 + 1/3 * SMS_218 + 1/3 * SMS_219 + 1/6 * SMS_220 | |
| 1248 | */ | |
| 1249 | 1249 | { |
| 1250 | 1250 | int ggLine; |
| 1251 | 1251 | int myLine = pixelPlotY + line - ( TBORDER_START + NTSC_224_TBORDER_Y_PIXELS ); |
| r5932 | r5933 | |
|---|---|---|
| 19 | 19 | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E |
| 20 | 20 | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F |
| 21 | 21 | 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G |
| 22 | ||
| 22 | ||
| 23 | 23 | 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H |
| 24 | 24 | 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I |
| 25 | 25 | 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J |
| r5932 | r5933 | |
| 28 | 28 | 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M |
| 29 | 29 | 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N |
| 30 | 30 | 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O |
| 31 | ||
| 31 | ||
| 32 | 32 | 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P |
| 33 | 33 | 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q |
| 34 | 34 | 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R |
| r5932 | r5933 | |
| 37 | 37 | 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U |
| 38 | 38 | 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V |
| 39 | 39 | 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W |
| 40 | ||
| 40 | ||
| 41 | 41 | 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X |
| 42 | 42 | 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y |
| 43 | 43 | 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z |
| r5932 | r5933 | |
| 46 | 46 | 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ] |
| 47 | 47 | 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^ |
| 48 | 48 | 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _ |
| 49 | ||
| 50 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // | |
| 49 | ||
| 50 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // | |
| 51 | 51 | 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // ! |
| 52 | 52 | 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // " |
| 53 | 53 | 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // # |
| 54 | 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // | |
| 54 | 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // | |
| 55 | 55 | 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // % |
| 56 | 56 | 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // & |
| 57 | 57 | 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // ' |
| 58 | ||
| 58 | ||
| 59 | 59 | 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // ( |
| 60 | 60 | 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // ) |
| 61 | 61 | 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // * |
| r5932 | r5933 | |
| 64 | 64 | 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // - |
| 65 | 65 | 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // . |
| 66 | 66 | 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // / |
| 67 | ||
| 67 | ||
| 68 | 68 | 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0 |
| 69 | 69 | 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1 |
| 70 | 70 | 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2 |
| r5932 | r5933 | |
| 73 | 73 | 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5 |
| 74 | 74 | 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6 |
| 75 | 75 | 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7 |
| 76 | ||
| 76 | ||
| 77 | 77 | 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8 |
| 78 | 78 | 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9 |
| 79 | 79 | 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // : |
| r5932 | r5933 | |
| 97 | 97 | int x,y,j,b; |
| 98 | 98 | UINT16 addr; |
| 99 | 99 | int xpos; |
| 100 | ||
| 100 | ||
| 101 | 101 | for(y = 0; y < 24; y++ ) |
| 102 | 102 | { |
| 103 | 103 | addr = y*64; |
| r5932 | r5933 | |
| 106 | 106 | { |
| 107 | 107 | UINT8 code = sapi_video_ram[addr + x]; |
| 108 | 108 | UINT8 attr = (code >> 6) & 3; |
| 109 | code &= 0x3f; | |
| 109 | code &= 0x3f; | |
| 110 | 110 | for(j = 0; j < 9; j++ ) |
| 111 | { | |
| 111 | { | |
| 112 | 112 | for(b = 0; b < 6; b++ ) |
| 113 | 113 | { |
| 114 | 114 | UINT8 val; |
| r5932 | r5933 | |
| 117 | 117 | val = (refresh_counter & 0x20) ? 1 : 0; |
| 118 | 118 | } else { |
| 119 | 119 | val = 0; |
| 120 | } | |
| 121 | } else { | |
| 120 | } | |
| 121 | } else { | |
| 122 | 122 | val = (MHB2501[code*8 + j] >> (5-b)) & 1; |
| 123 | 123 | if (attr==1) { |
| 124 | 124 | val = (refresh_counter & 0x20) ? val : 0; |
| r5932 | r5933 | |
| 130 | 130 | } else { |
| 131 | 131 | *BITMAP_ADDR16(bitmap, y*9+j, xpos+b ) = val; |
| 132 | 132 | } |
| 133 | } | |
| 133 | } | |
| 134 | 134 | } |
| 135 | 135 | xpos+= (attr==3) ? 12 : 6; |
| 136 | 136 | if (xpos>=6*40) break; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | p2000m.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Functions to emulate video hardware of the p2000m | |
| 6 | 6 | |
| 7 | 7 | **********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 27 | 27 | { |
| 28 | 28 | sy = (offs / 80) * 10; |
| 29 | 29 | sx = (offs % 80) * 6; |
| 30 | ||
| 30 | ||
| 31 | 31 | if ((frame_count > 25) && (videoram[offs + 2048] & 0x40)) |
| 32 | 32 | code = 32; |
| 33 | 33 | else |
| r5932 | r5933 | |
|---|---|---|
| 380 | 380 | msm6255_t *msm6255 = get_safe_token(device); |
| 381 | 381 | |
| 382 | 382 | /* resolve callbacks */ |
| 383 | msm6255->intf = device->static_config; | |
| 384 | assert(msm6255->intf->char_ram_r != NULL); | |
| 383 | msm6255->intf = device->static_config; | |
| 384 | assert(msm6255->intf->char_ram_r != NULL); | |
| 385 | 385 | |
| 386 | 386 | /* get the screen */ |
| 387 | 387 | msm6255->screen = devtag_get_device(device->machine, msm6255->intf->screen_tag); |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | "Regular" register on an EGA graphics card: |
| 8 | 8 | |
| 9 | 3C2 - 7 6 5 4 3 2 1 0 - Misc Output Register - Write Only | |
| 10 | | | | | | | | | | |
| 11 | | | | | | | | +-- 3Bx/3Dx I/O port select | |
| 12 | | | | | | | | 0 = 3Bx for CRTC I/O, 3BA for status reg 1 | |
| 13 | | | | | | | | 1 = 3Dx for CRTC I/O, 3DA for status reg 1 | |
| 14 | | | | | | | +---- enable ram | |
| 15 | | | | | | | 0 = disable ram from the processor | |
| 16 | | | | | | | 1 = enable ram to respond to addresses | |
| 17 | | | | | | | designated by the Control Data Select | |
| 18 | | | | | | | value in the Graphics Controllers. | |
| 19 | | | | | | +------ clock select bit 0 | |
| 20 | | | | | +-------- clock select bit 1 | |
| 21 | | | | | 00 = 14MHz from Processor I/O channel | |
| 22 | | | | | 01 = 16MHz on-bord clock | |
| 23 | | | | | 10 = External clock from feature connector | |
| 24 | | | | | 11 = reserved/unused | |
| 25 | | | | +---------- disable video drivers | |
| 26 | | | | 0 = activate internal video drivers | |
| 27 | | | | 1 = disable internal video drivers | |
| 28 | | | +------------ page bit for odd/even. Selects between 2 pages | |
| 29 | | | of 64KB of memory when in odd/even mode. | |
| 30 | | | 0 = select low page | |
| 31 | | | 1 = select high page | |
| 32 | | +-------------- horizontal retrace polarity | |
| 33 | | 0 = select positive | |
| 34 | | 1 = select negative | |
| 35 | +---------------- vertical retrace polarity | |
| 36 | 0 = select positive | |
| 37 | 1 = select negative | |
| 9 | 3C2 - 7 6 5 4 3 2 1 0 - Misc Output Register - Write Only | |
| 10 | | | | | | | | | | |
| 11 | | | | | | | | +-- 3Bx/3Dx I/O port select | |
| 12 | | | | | | | | 0 = 3Bx for CRTC I/O, 3BA for status reg 1 | |
| 13 | | | | | | | | 1 = 3Dx for CRTC I/O, 3DA for status reg 1 | |
| 14 | | | | | | | +---- enable ram | |
| 15 | | | | | | | 0 = disable ram from the processor | |
| 16 | | | | | | | 1 = enable ram to respond to addresses | |
| 17 | | | | | | | designated by the Control Data Select | |
| 18 | | | | | | | value in the Graphics Controllers. | |
| 19 | | | | | | +------ clock select bit 0 | |
| 20 | | | | | +-------- clock select bit 1 | |
| 21 | | | | | 00 = 14MHz from Processor I/O channel | |
| 22 | | | | | 01 = 16MHz on-bord clock | |
| 23 | | | | | 10 = External clock from feature connector | |
| 24 | | | | | 11 = reserved/unused | |
| 25 | | | | +---------- disable video drivers | |
| 26 | | | | 0 = activate internal video drivers | |
| 27 | | | | 1 = disable internal video drivers | |
| 28 | | | +------------ page bit for odd/even. Selects between 2 pages | |
| 29 | | | of 64KB of memory when in odd/even mode. | |
| 30 | | | 0 = select low page | |
| 31 | | | 1 = select high page | |
| 32 | | +-------------- horizontal retrace polarity | |
| 33 | | 0 = select positive | |
| 34 | | 1 = select negative | |
| 35 | +---------------- vertical retrace polarity | |
| 36 | 0 = select positive | |
| 37 | 1 = select negative | |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 3C2 - 7 6 5 4 3 2 1 0 - Input Status Reg 0 - Read Only | |
| 41 | | | | | | | | | | |
| 42 | | | | | | | | +-- reserved/unused | |
| 43 | | | | | | | +---- reserved/unused | |
| 44 | | | | | | +------ reserved/unused | |
| 45 | | | | | +-------- reserved/unused | |
| 46 | | | | +---------- switch sense | |
| 47 | | | | 0 = switch is closed | |
| 48 | | | | 1 = allows processor to read the 4 config switches | |
| 49 | | | | on the EGA adapter. The setting of CLKSEL determines | |
| 50 | | | | switch to read. | |
| 51 | | | +------------ input from FEAT0 on the feature connector | |
| 52 | | +-------------- input from FEAT1 on the feature connector | |
| 53 | +---------------- CRT Interrupt | |
| 54 | 0 = vertical retrace if occuring | |
| 55 | 1 = video is being displayed | |
| 40 | 3C2 - 7 6 5 4 3 2 1 0 - Input Status Reg 0 - Read Only | |
| 41 | | | | | | | | | | |
| 42 | | | | | | | | +-- reserved/unused | |
| 43 | | | | | | | +---- reserved/unused | |
| 44 | | | | | | +------ reserved/unused | |
| 45 | | | | | +-------- reserved/unused | |
| 46 | | | | +---------- switch sense | |
| 47 | | | | 0 = switch is closed | |
| 48 | | | | 1 = allows processor to read the 4 config switches | |
| 49 | | | | on the EGA adapter. The setting of CLKSEL determines | |
| 50 | | | | switch to read. | |
| 51 | | | +------------ input from FEAT0 on the feature connector | |
| 52 | | +-------------- input from FEAT1 on the feature connector | |
| 53 | +---------------- CRT Interrupt | |
| 54 | 0 = vertical retrace if occuring | |
| 55 | 1 = video is being displayed | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | Configuration switches | |
| 59 | SW1 SW2 SW3 SW4 | |
| 60 | OFF OFF OFF ON - EGA, Color 80x25 (5153) | |
| 61 | - EGA (primary) + MDA, Color 80x25 + Monochrome | |
| 62 | OFF OFF ON OFF - EGA, Monochrome (5151) | |
| 63 | - EGA (primary) + CGA, Monochrome + Color 80x25 | |
| 64 | OFF OFF ON ON - EGA + MDA (primary), 5154 + Enhanced Monochrome | |
| 65 | OFF ON OFF ON - EGA + CGA (primary), Monochrome + Color 80x25 | |
| 66 | OFF ON ON OFF - EGA, Enhanced Color - Enhanced Mode (5154) | |
| 67 | - EGA (primary) + MDA, 5154 monitor + Enhanced Monochrome | |
| 68 | OFF ON ON ON - EGA + MDA (primary), Color 80x25 + Monochrome | |
| 69 | ON OFF OFF ON - EGA, Color 40x25 (5153) | |
| 70 | - EGA (primary) + MDA, Color 40x25 + Monochrome | |
| 71 | ON OFF ON OFF - EGA (primary) + CGA, Monochrome + Color 40x25 | |
| 72 | ON OFF ON ON - EGA + MDA (primary), 5154 + Normal Monochrome | |
| 73 | ON ON OFF ON - EGA + CGA (primary), Monochrome + Color 40x25 | |
| 74 | ON ON ON OFF - EGA, Enhanced Color - Enhanced Mode (5154) | |
| 75 | - EGA (primary) + MDA, 5154 monitor + Normal Monochrome | |
| 76 | ON ON ON ON - EGA + MDA (primary), Color 40x25 + Monochrome | |
| 58 | Configuration switches | |
| 59 | SW1 SW2 SW3 SW4 | |
| 60 | OFF OFF OFF ON - EGA, Color 80x25 (5153) | |
| 61 | - EGA (primary) + MDA, Color 80x25 + Monochrome | |
| 62 | OFF OFF ON OFF - EGA, Monochrome (5151) | |
| 63 | - EGA (primary) + CGA, Monochrome + Color 80x25 | |
| 64 | OFF OFF ON ON - EGA + MDA (primary), 5154 + Enhanced Monochrome | |
| 65 | OFF ON OFF ON - EGA + CGA (primary), Monochrome + Color 80x25 | |
| 66 | OFF ON ON OFF - EGA, Enhanced Color - Enhanced Mode (5154) | |
| 67 | - EGA (primary) + MDA, 5154 monitor + Enhanced Monochrome | |
| 68 | OFF ON ON ON - EGA + MDA (primary), Color 80x25 + Monochrome | |
| 69 | ON OFF OFF ON - EGA, Color 40x25 (5153) | |
| 70 | - EGA (primary) + MDA, Color 40x25 + Monochrome | |
| 71 | ON OFF ON OFF - EGA (primary) + CGA, Monochrome + Color 40x25 | |
| 72 | ON OFF ON ON - EGA + MDA (primary), 5154 + Normal Monochrome | |
| 73 | ON ON OFF ON - EGA + CGA (primary), Monochrome + Color 40x25 | |
| 74 | ON ON ON OFF - EGA, Enhanced Color - Enhanced Mode (5154) | |
| 75 | - EGA (primary) + MDA, 5154 monitor + Normal Monochrome | |
| 76 | ON ON ON ON - EGA + MDA (primary), Color 40x25 + Monochrome | |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 3XA - 7 6 5 4 3 2 1 0 - Feature Control Register - Write Only | |
| 80 | | | | | | | | | | |
| 81 | | | | | | | | +-- output to FEAT0 of the feature connector | |
| 82 | | | | | | | +---- output to FEAT1 of the feature connector | |
| 83 | | | | | | +------ reserved/unused | |
| 84 | | | | | +-------- reserved/unused | |
| 85 | | | | +---------- reserved/unused | |
| 86 | | | +------------ reserved/unused | |
| 87 | | +-------------- reserved/unused | |
| 88 | +---------------- reserved/unused | |
| 79 | 3XA - 7 6 5 4 3 2 1 0 - Feature Control Register - Write Only | |
| 80 | | | | | | | | | | |
| 81 | | | | | | | | +-- output to FEAT0 of the feature connector | |
| 82 | | | | | | | +---- output to FEAT1 of the feature connector | |
| 83 | | | | | | +------ reserved/unused | |
| 84 | | | | | +-------- reserved/unused | |
| 85 | | | | +---------- reserved/unused | |
| 86 | | | +------------ reserved/unused | |
| 87 | | +-------------- reserved/unused | |
| 88 | +---------------- reserved/unused | |
| 89 | 89 | |
| 90 | 3XA - 7 6 5 4 3 2 1 0 - Input Status Reg 1 - Read Only | |
| 91 | | | | | | | | | | |
| 92 | | | | | | | | +-- display enable | |
| 93 | | | | | | | | 0 = indicates the CRT raster is in a horizontal or vertical retrace | |
| 94 | | | | | | | | 1 = otherwise | |
| 95 | | | | | | | +---- light pen strobe | |
| 96 | | | | | | | 0 = light pen trigger has not been set | |
| 97 | | | | | | | 1 = light pen trigger has been set | |
| 98 | | | | | | +------ light pen switch | |
| 99 | | | | | | 0 = switch is closed | |
| 100 | | | | | | 1 = switch is open | |
| 101 | | | | | +-------- vertical blank | |
| 102 | | | | | 0 = video information is being displayed | |
| 103 | | | | | 1 = CRT is in vertical blank | |
| 104 | | | | +---------- diagnostic usage, output depends on AR12 video status mux bits | |
| 105 | | | | mux bits - output | |
| 106 | | | | 00 - blue | |
| 107 | | | | 01 - I blue | |
| 108 | | | | 10 - I red | |
| 109 | | | | 11 - unknown | |
| 110 | | | +------------ diagnostic usage, output depends on AR12 video status mux bits | |
| 111 | | | mux bits - output | |
| 112 | | | 00 - red | |
| 113 | | | 01 - green | |
| 114 | | | 10 - I green | |
| 115 | | | 11 - unknown | |
| 116 | | +-------------- reserved/unused | |
| 117 | +---------------- reserved/unused | |
| 90 | 3XA - 7 6 5 4 3 2 1 0 - Input Status Reg 1 - Read Only | |
| 91 | | | | | | | | | | |
| 92 | | | | | | | | +-- display enable | |
| 93 | | | | | | | | 0 = indicates the CRT raster is in a horizontal or vertical retrace | |
| 94 | | | | | | | | 1 = otherwise | |
| 95 | | | | | | | +---- light pen strobe | |
| 96 | | | | | | | 0 = light pen trigger has not been set | |
| 97 | | | | | | | 1 = light pen trigger has been set | |
| 98 | | | | | | +------ light pen switch | |
| 99 | | | | | | 0 = switch is closed | |
| 100 | | | | | | 1 = switch is open | |
| 101 | | | | | +-------- vertical blank | |
| 102 | | | | | 0 = video information is being displayed | |
| 103 | | | | | 1 = CRT is in vertical blank | |
| 104 | | | | +---------- diagnostic usage, output depends on AR12 video status mux bits | |
| 105 | | | | mux bits - output | |
| 106 | | | | 00 - blue | |
| 107 | | | | 01 - I blue | |
| 108 | | | | 10 - I red | |
| 109 | | | | 11 - unknown | |
| 110 | | | +------------ diagnostic usage, output depends on AR12 video status mux bits | |
| 111 | | | mux bits - output | |
| 112 | | | 00 - red | |
| 113 | | | 01 - green | |
| 114 | | | 10 - I green | |
| 115 | | | 11 - unknown | |
| 116 | | +-------------- reserved/unused | |
| 117 | +---------------- reserved/unused | |
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | |
| r5932 | r5933 | |
| 132 | 132 | write to I/O port 0x3C0 sets the index register. The next write to I/O port |
| 133 | 133 | 0x3C0 actually sets the data to the indexed register. |
| 134 | 134 | |
| 135 | 3C0 - 7 6 5 4 3 2 1 0 - Attribute Access Register | |
| 136 | | | | | | | | | | |
| 137 | | | | | | | | +-- index bit 0 | |
| 138 | | | | | | | +---- index bit 1 | |
| 139 | | | | | | +------ index bit 2 | |
| 140 | | | | | +-------- index bit 3 | |
| 141 | | | | +---------- index bit 4 | |
| 142 | | | +------------ palette source | |
| 143 | | +-------------- reserved/unused | |
| 144 | +---------------- reserved/unused | |
| 135 | 3C0 - 7 6 5 4 3 2 1 0 - Attribute Access Register | |
| 136 | | | | | | | | | | |
| 137 | | | | | | | | +-- index bit 0 | |
| 138 | | | | | | | +---- index bit 1 | |
| 139 | | | | | | +------ index bit 2 | |
| 140 | | | | | +-------- index bit 3 | |
| 141 | | | | +---------- index bit 4 | |
| 142 | | | +------------ palette source | |
| 143 | | +-------------- reserved/unused | |
| 144 | +---------------- reserved/unused | |
| 145 | 145 | |
| 146 | 146 | |
| 147 | AR00-AR0F - 7 6 5 4 3 2 1 0 - Palette Register #00 - #0F | |
| 148 | | | | | | | | | | |
| 149 | | | | | | | | +-- MSB B | |
| 150 | | | | | | | +---- MSB G | |
| 151 | | | | | | +------ MSB R | |
| 152 | | | | | +-------- LSB B | |
| 153 | | | | +---------- LSB G | |
| 154 | | | +------------ LSB R | |
| 155 | | +-------------- reserved/unused | |
| 156 | +---------------- reserved/unused | |
| 147 | AR00-AR0F - 7 6 5 4 3 2 1 0 - Palette Register #00 - #0F | |
| 148 | | | | | | | | | | |
| 149 | | | | | | | | +-- MSB B | |
| 150 | | | | | | | +---- MSB G | |
| 151 | | | | | | +------ MSB R | |
| 152 | | | | | +-------- LSB B | |
| 153 | | | | +---------- LSB G | |
| 154 | | | +------------ LSB R | |
| 155 | | +-------------- reserved/unused | |
| 156 | +---------------- reserved/unused | |
| 157 | 157 | |
| 158 | 158 | |
| 159 | AR10 - 7 6 5 4 3 2 1 0 - Mode Control Register | |
| 160 | | | | | | | | | | |
| 161 | | | | | | | | +-- Text/Graphics select | |
| 162 | | | | | | | +---- Monochrome/Color select | |
| 163 | | | | | | +------ 9th dot setting | |
| 164 | | | | | +-------- Blink Enable | |
| 165 | | | | +---------- reserved/unsued | |
| 166 | | | +------------ 0 = line compare does not affect pixel output | |
| 167 | | | 1 = line compare does affect pixel output | |
| 168 | | +-------------- 0 = pixel changes every dot clock | |
| 169 | | 1 = pixel changes every other dot clock | |
| 170 | +---------------- reserved/unused | |
| 159 | AR10 - 7 6 5 4 3 2 1 0 - Mode Control Register | |
| 160 | | | | | | | | | | |
| 161 | | | | | | | | +-- Text/Graphics select | |
| 162 | | | | | | | +---- Monochrome/Color select | |
| 163 | | | | | | +------ 9th dot setting | |
| 164 | | | | | +-------- Blink Enable | |
| 165 | | | | +---------- reserved/unsued | |
| 166 | | | +------------ 0 = line compare does not affect pixel output | |
| 167 | | | 1 = line compare does affect pixel output | |
| 168 | | +-------------- 0 = pixel changes every dot clock | |
| 169 | | 1 = pixel changes every other dot clock | |
| 170 | +---------------- reserved/unused | |
| 171 | 171 | |
| 172 | 172 | |
| 173 | AR11 - 7 6 5 4 3 2 1 0 - Overscan Color Register | |
| 174 | | | | | | | | | | |
| 175 | | | | | | | | +-- MSB B | |
| 176 | | | | | | | +---- MSB G | |
| 177 | | | | | | +------ MSB R | |
| 178 | | | | | +-------- LSB B | |
| 179 | | | | +---------- LSB G | |
| 180 | | | +------------ LSB R | |
| 181 | | +-------------- reserved/unused | |
| 182 | +---------------- reserved/unused | |
| 173 | AR11 - 7 6 5 4 3 2 1 0 - Overscan Color Register | |
| 174 | | | | | | | | | | |
| 175 | | | | | | | | +-- MSB B | |
| 176 | | | | | | | +---- MSB G | |
| 177 | | | | | | +------ MSB R | |
| 178 | | | | | +-------- LSB B | |
| 179 | | | | +---------- LSB G | |
| 180 | | | +------------ LSB R | |
| 181 | | +-------------- reserved/unused | |
| 182 | +---------------- reserved/unused | |
| 183 | 183 | |
| 184 | 184 | |
| 185 | AR12 - 7 6 5 4 3 2 1 0 - Color Plane Enable Register | |
| 186 | | | | | | | | | | |
| 187 | | | | | | | | +-- Enable plane 0 | |
| 188 | | | | | | | +---- Enable plane 1 | |
| 189 | | | | | | +------ Enable plane 2 | |
| 190 | | | | | +-------- Enable plane 3 | |
| 191 | | | | +---------- Video Status Mux bit 0 | |
| 192 | | | +------------ Video Status Mux bit 1 | |
| 193 | | +-------------- reserved/unused | |
| 194 | +---------------- reserved/unused | |
| 185 | AR12 - 7 6 5 4 3 2 1 0 - Color Plane Enable Register | |
| 186 | | | | | | | | | | |
| 187 | | | | | | | | +-- Enable plane 0 | |
| 188 | | | | | | | +---- Enable plane 1 | |
| 189 | | | | | | +------ Enable plane 2 | |
| 190 | | | | | +-------- Enable plane 3 | |
| 191 | | | | +---------- Video Status Mux bit 0 | |
| 192 | | | +------------ Video Status Mux bit 1 | |
| 193 | | +-------------- reserved/unused | |
| 194 | +---------------- reserved/unused | |
| 195 | 195 | |
| 196 | 196 | |
| 197 | AR13 - 7 6 5 4 3 2 1 0 - Horizontal Panning Register | |
| 198 | | | | | | | | | | |
| 199 | | | | | | | | +-- Pixel left shift bit 0 | |
| 200 | | | | | | | +---- Pixel left shift bit 1 | |
| 201 | | | | | | +------ Pixel left shift bit 2 | |
| 202 | | | | | +-------- Pixel left shift bit 3 | |
| 203 | | | | +---------- reserved/unused | |
| 204 | | | +------------ reserved/unused | |
| 205 | | +-------------- reserved/unused | |
| 206 | +---------------- reserved/unused | |
| 197 | AR13 - 7 6 5 4 3 2 1 0 - Horizontal Panning Register | |
| 198 | | | | | | | | | | |
| 199 | | | | | | | | +-- Pixel left shift bit 0 | |
| 200 | | | | | | | +---- Pixel left shift bit 1 | |
| 201 | | | | | | +------ Pixel left shift bit 2 | |
| 202 | | | | | +-------- Pixel left shift bit 3 | |
| 203 | | | | +---------- reserved/unused | |
| 204 | | | +------------ reserved/unused | |
| 205 | | +-------------- reserved/unused | |
| 206 | +---------------- reserved/unused | |
| 207 | 207 | |
| 208 | 208 | |
| 209 | 209 | Sequencer Registers SR00 - SR04 |
| r5932 | r5933 | |
| 211 | 211 | The Sequencer Registers are accessed through an index register located at I/O |
| 212 | 212 | port 0x3C4, and a data register located at I/O port 0x3C5. |
| 213 | 213 | |
| 214 | 3C4 - 7 6 5 4 3 2 1 0 - Sequencer Index Register - Write Only | |
| 215 | | | | | | | | | | |
| 216 | | | | | | | | +-- index bit 0 | |
| 217 | | | | | | | +---- index bit 1 | |
| 218 | | | | | | +------ index bit 2 | |
| 219 | | | | | +-------- reserved/unused | |
| 220 | | | | +---------- reserved/unused | |
| 221 | | | +------------ reserved/unused | |
| 222 | | +-------------- reserved/unused | |
| 223 | +---------------- reserved/unused | |
| 214 | 3C4 - 7 6 5 4 3 2 1 0 - Sequencer Index Register - Write Only | |
| 215 | | | | | | | | | | |
| 216 | | | | | | | | +-- index bit 0 | |
| 217 | | | | | | | +---- index bit 1 | |
| 218 | | | | | | +------ index bit 2 | |
| 219 | | | | | +-------- reserved/unused | |
| 220 | | | | +---------- reserved/unused | |
| 221 | | | +------------ reserved/unused | |
| 222 | | +-------------- reserved/unused | |
| 223 | +---------------- reserved/unused | |
| 224 | 224 | |
| 225 | 225 | |
| 226 | 3C5 - 7 6 5 4 3 2 1 0 - Sequencer Data Register - Write Only | |
| 227 | | | | | | | | | | |
| 228 | | | | | | | | +-- data bit 0 | |
| 229 | | | | | | | +---- data bit 1 | |
| 230 | | | | | | +------ data bit 2 | |
| 231 | | | | | +-------- data bit 3 | |
| 232 | | | | +---------- data bit 4 | |
| 233 | | | +------------ data bit 5 | |
| 234 | | +-------------- data bit 6 | |
| 235 | +---------------- data bit 7 | |
| 226 | 3C5 - 7 6 5 4 3 2 1 0 - Sequencer Data Register - Write Only | |
| 227 | | | | | | | | | | |
| 228 | | | | | | | | +-- data bit 0 | |
| 229 | | | | | | | +---- data bit 1 | |
| 230 | | | | | | +------ data bit 2 | |
| 231 | | | | | +-------- data bit 3 | |
| 232 | | | | +---------- data bit 4 | |
| 233 | | | +------------ data bit 5 | |
| 234 | | +-------------- data bit 6 | |
| 235 | +---------------- data bit 7 | |
| 236 | 236 | |
| 237 | 237 | |
| 238 | SR00 - 7 6 5 4 3 2 1 0 - Reset Control Register | |
| 239 | | | | | | | | | | |
| 240 | | | | | | | | +-- Must be 1 for normal operation | |
| 241 | | | | | | | +---- Must be 1 for normal operation | |
| 242 | | | | | | +------ reserved/unused | |
| 243 | | | | | +-------- reserved/unused | |
| 244 | | | | +---------- reserved/unused | |
| 245 | | | +------------ reserved/unused | |
| 246 | | +-------------- reserved/unused | |
| 247 | +---------------- reserved/unused | |
| 238 | SR00 - 7 6 5 4 3 2 1 0 - Reset Control Register | |
| 239 | | | | | | | | | | |
| 240 | | | | | | | | +-- Must be 1 for normal operation | |
| 241 | | | | | | | +---- Must be 1 for normal operation | |
| 242 | | | | | | +------ reserved/unused | |
| 243 | | | | | +-------- reserved/unused | |
| 244 | | | | +---------- reserved/unused | |
| 245 | | | +------------ reserved/unused | |
| 246 | | +-------------- reserved/unused | |
| 247 | +---------------- reserved/unused | |
| 248 | 248 | |
| 249 | 249 | |
| 250 | SR01 - 7 6 5 4 3 2 1 0 - Clocking Mode | |
| 251 | | | | | | | | | | |
| 252 | | | | | | | | +-- 0 = 9 dots per char, 1 = 8 dots per char | |
| 253 | | | | | | | +---- clock frequency, 0 = 4 out of 5 memory cycles, 1 = 2 out of 5 memory cycles | |
| 254 | | | | | | +------ shift load | |
| 255 | | | | | +-------- 0 = normal dot clock, 1 = master dot clock / 2 | |
| 256 | | | | +---------- reserved/unused | |
| 257 | | | +------------ reserved/unused | |
| 258 | | +-------------- reserved/unused | |
| 259 | +---------------- reserved/unused | |
| 250 | SR01 - 7 6 5 4 3 2 1 0 - Clocking Mode | |
| 251 | | | | | | | | | | |
| 252 | | | | | | | | +-- 0 = 9 dots per char, 1 = 8 dots per char | |
| 253 | | | | | | | +---- clock frequency, 0 = 4 out of 5 memory cycles, 1 = 2 out of 5 memory cycles | |
| 254 | | | | | | +------ shift load | |
| 255 | | | | | +-------- 0 = normal dot clock, 1 = master dot clock / 2 | |
| 256 | | | | +---------- reserved/unused | |
| 257 | | | +------------ reserved/unused | |
| 258 | | +-------------- reserved/unused | |
| 259 | +---------------- reserved/unused | |
| 260 | 260 | |
| 261 | 261 | |
| 262 | SR02 - 7 6 5 4 3 2 1 0 - Map Mask | |
| 263 | | | | | | | | | | |
| 264 | | | | | | | | +-- 1 = enable map 0 for writing | |
| 265 | | | | | | | +---- 1 = enable map 1 for writing | |
| 266 | | | | | | +------ 1 = enable map 2 for writing | |
| 267 | | | | | +-------- 1 = enable map 3 for writing | |
| 268 | | | | +---------- reserved/unused | |
| 269 | | | +------------ reserved/unused | |
| 270 | | +-------------- reserved/unused | |
| 271 | +---------------- reserved/unused | |
| 262 | SR02 - 7 6 5 4 3 2 1 0 - Map Mask | |
| 263 | | | | | | | | | | |
| 264 | | | | | | | | +-- 1 = enable map 0 for writing | |
| 265 | | | | | | | +---- 1 = enable map 1 for writing | |
| 266 | | | | | | +------ 1 = enable map 2 for writing | |
| 267 | | | | | +-------- 1 = enable map 3 for writing | |
| 268 | | | | +---------- reserved/unused | |
| 269 | | | +------------ reserved/unused | |
| 270 | | +-------------- reserved/unused | |
| 271 | +---------------- reserved/unused | |
| 272 | 272 | |
| 273 | 273 | |
| 274 | SR03 - 7 6 5 4 3 2 1 0 - Character Map Select | |
| 275 | | | | | | | | | | |
| 276 | | | | | | | | +-- character map select B bit 0 | |
| 277 | | | | | | | +---- character map select B bit 1 | |
| 278 | | | | | | | Selects the map used to generate alpha characters when | |
| 279 | | | | | | | attribute bit 3 is set to 0 | |
| 280 | | | | | | | 00 = map 0 - 1st 8KB of plane 2 bank 0 | |
| 281 | | | | | | | 01 = map 1 - 2nd 8KB of plane 2 bank 1 | |
| 282 | | | | | | | 10 = map 2 - 3rd 8KB of plane 2 bank 2 | |
| 283 | | | | | | | 11 = map 3 - 4th 8KB of plane 2 bank 3 | |
| 284 | | | | | | +------ character map select A bit 0 | |
| 285 | | | | | +-------- character map select A bit 1 | |
| 286 | | | | | Selects the map used to generate alpha characters when | |
| 287 | | | | | attribute bit 3 is set to 1 | |
| 288 | | | | | 00 = map 0 - 1st 8KB of plane 2 bank 0 | |
| 289 | | | | | 01 = map 1 - 2nd 8KB of plane 2 bank 1 | |
| 290 | | | | | 10 = map 2 - 3rd 8KB of plane 2 bank 2 | |
| 291 | | | | | 11 = map 3 - 4th 8KB of plane 2 bank 3 | |
| 292 | | | | +---------- reserved/unused | |
| 293 | | | +------------ reserved/unused | |
| 294 | | +-------------- reserved/unused | |
| 295 | +---------------- reserved/unused | |
| 274 | SR03 - 7 6 5 4 3 2 1 0 - Character Map Select | |
| 275 | | | | | | | | | | |
| 276 | | | | | | | | +-- character map select B bit 0 | |
| 277 | | | | | | | +---- character map select B bit 1 | |
| 278 | | | | | | | Selects the map used to generate alpha characters when | |
| 279 | | | | | | | attribute bit 3 is set to 0 | |
| 280 | | | | | | | 00 = map 0 - 1st 8KB of plane 2 bank 0 | |
| 281 | | | | | | | 01 = map 1 - 2nd 8KB of plane 2 bank 1 | |
| 282 | | | | | | | 10 = map 2 - 3rd 8KB of plane 2 bank 2 | |
| 283 | | | | | | | 11 = map 3 - 4th 8KB of plane 2 bank 3 | |
| 284 | | | | | | +------ character map select A bit 0 | |
| 285 | | | | | +-------- character map select A bit 1 | |
| 286 | | | | | Selects the map used to generate alpha characters when | |
| 287 | | | | | attribute bit 3 is set to 1 | |
| 288 | | | | | 00 = map 0 - 1st 8KB of plane 2 bank 0 | |
| 289 | | | | | 01 = map 1 - 2nd 8KB of plane 2 bank 1 | |
| 290 | | | | | 10 = map 2 - 3rd 8KB of plane 2 bank 2 | |
| 291 | | | | | 11 = map 3 - 4th 8KB of plane 2 bank 3 | |
| 292 | | | | +---------- reserved/unused | |
| 293 | | | +------------ reserved/unused | |
| 294 | | +-------------- reserved/unused | |
| 295 | +---------------- reserved/unused | |
| 296 | 296 | |
| 297 | 297 | |
| 298 | SR04 - 7 6 5 4 3 2 1 0 - Memory Mode Register | |
| 299 | | | | | | | | | | |
| 300 | | | | | | | | +-- 0 = graphics mode, 1 = text mode | |
| 301 | | | | | | | +---- 0 = no memory extension, 1 = memory extension | |
| 302 | | | | | | +------ 0 = odd/even storage, 1 = sequential storage | |
| 303 | | | | | +-------- reserved/unused | |
| 304 | | | | +---------- reserved/unused | |
| 305 | | | +------------ reserved/unused | |
| 306 | | +-------------- reserved/unused | |
| 307 | +---------------- reserved/unused | |
| 298 | SR04 - 7 6 5 4 3 2 1 0 - Memory Mode Register | |
| 299 | | | | | | | | | | |
| 300 | | | | | | | | +-- 0 = graphics mode, 1 = text mode | |
| 301 | | | | | | | +---- 0 = no memory extension, 1 = memory extension | |
| 302 | | | | | | +------ 0 = odd/even storage, 1 = sequential storage | |
| 303 | | | | | +-------- reserved/unused | |
| 304 | | | | +---------- reserved/unused | |
| 305 | | | +------------ reserved/unused | |
| 306 | | +-------------- reserved/unused | |
| 307 | +---------------- reserved/unused | |
| 308 | 308 | |
| 309 | 309 | |
| 310 | 310 | Graphics Controller Registers GR00 - GR08 |
| r5932 | r5933 | |
| 312 | 312 | The Graphics Controller Registers are accessed through an index register |
| 313 | 313 | located at I/O port 0x3CE, and a data register located at I/O port 0x3CF. |
| 314 | 314 | |
| 315 | GR00 - 7 6 5 4 3 2 1 0 - Set/Reset Register | |
| 316 | | | | | | | | | | |
| 317 | | | | | | | | +-- set/reset for plane 0 | |
| 318 | | | | | | | +---- set/reset for plane 1 | |
| 319 | | | | | | +------ set/reset for plane 2 | |
| 320 | | | | | +-------- set/reset for plane 3 | |
| 321 | | | | +---------- reserved/unused | |
| 322 | | | +------------ reserved/unused | |
| 323 | | +-------------- reserved/unused | |
| 324 | +---------------- reserved/unused | |
| 315 | GR00 - 7 6 5 4 3 2 1 0 - Set/Reset Register | |
| 316 | | | | | | | | | | |
| 317 | | | | | | | | +-- set/reset for plane 0 | |
| 318 | | | | | | | +---- set/reset for plane 1 | |
| 319 | | | | | | +------ set/reset for plane 2 | |
| 320 | | | | | +-------- set/reset for plane 3 | |
| 321 | | | | +---------- reserved/unused | |
| 322 | | | +------------ reserved/unused | |
| 323 | | +-------------- reserved/unused | |
| 324 | +---------------- reserved/unused | |
| 325 | 325 | |
| 326 | 326 | |
| 327 | GR01 - 7 6 5 4 3 2 1 0 - Enable Set/Reset Register | |
| 328 | | | | | | | | | | |
| 329 | | | | | | | | +-- enable set/reset for plane 0 | |
| 330 | | | | | | | +---- enable set/reset for plane 1 | |
| 331 | | | | | | +------ enable set/reset for plane 2 | |
| 332 | | | | | +-------- enable set/reset for plane 3 | |
| 333 | | | | +---------- reserved/unused | |
| 334 | | | +------------ reserved/unused | |
| 335 | | +-------------- reserved/unused | |
| 336 | +---------------- reserved/unused | |
| 327 | GR01 - 7 6 5 4 3 2 1 0 - Enable Set/Reset Register | |
| 328 | | | | | | | | | | |
| 329 | | | | | | | | +-- enable set/reset for plane 0 | |
| 330 | | | | | | | +---- enable set/reset for plane 1 | |
| 331 | | | | | | +------ enable set/reset for plane 2 | |
| 332 | | | | | +-------- enable set/reset for plane 3 | |
| 333 | | | | +---------- reserved/unused | |
| 334 | | | +------------ reserved/unused | |
| 335 | | +-------------- reserved/unused | |
| 336 | +---------------- reserved/unused | |
| 337 | 337 | |
| 338 | 338 | |
| 339 | GR02 - 7 6 5 4 3 2 1 0 - Color Compare Register | |
| 340 | | | | | | | | | | |
| 341 | | | | | | | | +-- color compare 0 | |
| 342 | | | | | | | +---- color compare 1 | |
| 343 | | | | | | +------ color compare 2 | |
| 344 | | | | | +-------- color compare 3 | |
| 345 | | | | +---------- reserved/unused | |
| 346 | | | +------------ reserved/unused | |
| 347 | | +-------------- reserved/unused | |
| 348 | +---------------- reserved/unused | |
| 339 | GR02 - 7 6 5 4 3 2 1 0 - Color Compare Register | |
| 340 | | | | | | | | | | |
| 341 | | | | | | | | +-- color compare 0 | |
| 342 | | | | | | | +---- color compare 1 | |
| 343 | | | | | | +------ color compare 2 | |
| 344 | | | | | +-------- color compare 3 | |
| 345 | | | | +---------- reserved/unused | |
| 346 | | | +------------ reserved/unused | |
| 347 | | +-------------- reserved/unused | |
| 348 | +---------------- reserved/unused | |
| 349 | 349 | |
| 350 | 350 | |
| 351 | GR03 - 7 6 5 4 3 2 1 0 - Data Rotate Register | |
| 352 | | | | | | | | | | |
| 353 | | | | | | | | +-- number of positions to rotate bit 0 | |
| 354 | | | | | | | +---- number of positions to rotate bit 1 | |
| 355 | | | | | | +------ number of positions to rotate bit 2 | |
| 356 | | | | | +-------- function select bit 0 | |
| 357 | | | | +---------- function select bit 1 | |
| 358 | | | | 00 = data overwrites in specified color | |
| 359 | | | | 01 = data ANDed with latched data | |
| 360 | | | | 10 = data ORed with latched data | |
| 361 | | | | 11 = data XORed with latched data | |
| 362 | | | +------------ reserved/unused | |
| 363 | | +-------------- reserved/unused | |
| 364 | +---------------- reserved/unused | |
| 351 | GR03 - 7 6 5 4 3 2 1 0 - Data Rotate Register | |
| 352 | | | | | | | | | | |
| 353 | | | | | | | | +-- number of positions to rotate bit 0 | |
| 354 | | | | | | | +---- number of positions to rotate bit 1 | |
| 355 | | | | | | +------ number of positions to rotate bit 2 | |
| 356 | | | | | +-------- function select bit 0 | |
| 357 | | | | +---------- function select bit 1 | |
| 358 | | | | 00 = data overwrites in specified color | |
| 359 | | | | 01 = data ANDed with latched data | |
| 360 | | | | 10 = data ORed with latched data | |
| 361 | | | | 11 = data XORed with latched data | |
| 362 | | | +------------ reserved/unused | |
| 363 | | +-------------- reserved/unused | |
| 364 | +---------------- reserved/unused | |
| 365 | 365 | |
| 366 | 366 | |
| 367 | GR04 - 7 6 5 4 3 2 1 0 - Read Map Select Register | |
| 368 | | | | | | | | | | |
| 369 | | | | | | | | +-- plane select bit 0 | |
| 370 | | | | | | | +---- plane select bit 1 | |
| 371 | | | | | | +------ plane select bit 2 | |
| 372 | | | | | +-------- reserved/unused | |
| 373 | | | | +---------- reserved/unused | |
| 374 | | | +------------ reserved/unused | |
| 375 | | +-------------- reserved/unused | |
| 376 | +---------------- reserved/unused | |
| 367 | GR04 - 7 6 5 4 3 2 1 0 - Read Map Select Register | |
| 368 | | | | | | | | | | |
| 369 | | | | | | | | +-- plane select bit 0 | |
| 370 | | | | | | | +---- plane select bit 1 | |
| 371 | | | | | | +------ plane select bit 2 | |
| 372 | | | | | +-------- reserved/unused | |
| 373 | | | | +---------- reserved/unused | |
| 374 | | | +------------ reserved/unused | |
| 375 | | +-------------- reserved/unused | |
| 376 | +---------------- reserved/unused | |
| 377 | 377 | |
| 378 | 378 | |
| 379 | GR05 - 7 6 5 4 3 2 1 0 - Mode Register | |
| 380 | | | | | | | | | | |
| 381 | | | | | | | | +-- write mode bit 0 | |
| 382 | | | | | | | +---- write mode bit 1 | |
| 383 | | | | | | | 00 = write 8 bits of value in set/reset register if enabled, | |
| 384 | | | | | | | otherwise write rotated processor data | |
| 385 | | | | | | | 01 = write with contents of processor latches | |
| 386 | | | | | | | 10 = memory plane 0-3 filled with 8 bits of value of data bit 0-3 | |
| 387 | | | | | | | 11 = reserved/unused | |
| 388 | | | | | | +------ test condition | |
| 389 | | | | | | 0 = normal operation | |
| 390 | | | | | | 1 = put outputs in high impedance state | |
| 391 | | | | | +-------- read mode | |
| 392 | | | | | 0 = read from plane selected by GR04 | |
| 393 | | | | | 1 = do color compare | |
| 394 | | | | +---------- odd/even addressing mode | |
| 395 | | | +------------ shift register mode | |
| 396 | | | 0 = sequential | |
| 397 | | | 1 = even bits from even maps, odd bits from odd maps | |
| 398 | | +-------------- reserved/unused | |
| 399 | +---------------- reserved/unused | |
| 379 | GR05 - 7 6 5 4 3 2 1 0 - Mode Register | |
| 380 | | | | | | | | | | |
| 381 | | | | | | | | +-- write mode bit 0 | |
| 382 | | | | | | | +---- write mode bit 1 | |
| 383 | | | | | | | 00 = write 8 bits of value in set/reset register if enabled, | |
| 384 | | | | | | | otherwise write rotated processor data | |
| 385 | | | | | | | 01 = write with contents of processor latches | |
| 386 | | | | | | | 10 = memory plane 0-3 filled with 8 bits of value of data bit 0-3 | |
| 387 | | | | | | | 11 = reserved/unused | |
| 388 | | | | | | +------ test condition | |
| 389 | | | | | | 0 = normal operation | |
| 390 | | | | | | 1 = put outputs in high impedance state | |
| 391 | | | | | +-------- read mode | |
| 392 | | | | | 0 = read from plane selected by GR04 | |
| 393 | | | | | 1 = do color compare | |
| 394 | | | | +---------- odd/even addressing mode | |
| 395 | | | +------------ shift register mode | |
| 396 | | | 0 = sequential | |
| 397 | | | 1 = even bits from even maps, odd bits from odd maps | |
| 398 | | +-------------- reserved/unused | |
| 399 | +---------------- reserved/unused | |
| 400 | 400 | |
| 401 | 401 | |
| 402 | GR06 - 7 6 5 4 3 2 1 0 - Miscellaneous Register | |
| 403 | | | | | | | | | | |
| 404 | | | | | | | | +-- 0 = text mode, 1 = graphics mode | |
| 405 | | | | | | | +---- chain odd maps to even | |
| 406 | | | | | | +------ memory map bit 0 | |
| 407 | | | | | +-------- memory map bit 1 | |
| 408 | | | | | 00 = 0xA0000, 128KB | |
| 409 | | | | | 01 = 0xA0000, 64KB | |
| 410 | | | | | 10 = 0xB0000, 32KB | |
| 411 | | | | | 11 = 0xB8000, 32KB | |
| 412 | | | | +---------- reserved/unused | |
| 413 | | | +------------ reserved/unused | |
| 414 | | +-------------- reserved/unused | |
| 415 | +---------------- reserved/unused | |
| 402 | GR06 - 7 6 5 4 3 2 1 0 - Miscellaneous Register | |
| 403 | | | | | | | | | | |
| 404 | | | | | | | | +-- 0 = text mode, 1 = graphics mode | |
| 405 | | | | | | | +---- chain odd maps to even | |
| 406 | | | | | | +------ memory map bit 0 | |
| 407 | | | | | +-------- memory map bit 1 | |
| 408 | | | | | 00 = 0xA0000, 128KB | |
| 409 | | | | | 01 = 0xA0000, 64KB | |
| 410 | | | | | 10 = 0xB0000, 32KB | |
| 411 | | | | | 11 = 0xB8000, 32KB | |
| 412 | | | | +---------- reserved/unused | |
| 413 | | | +------------ reserved/unused | |
| 414 | | +-------------- reserved/unused | |
| 415 | +---------------- reserved/unused | |
| 416 | 416 | |
| 417 | 417 | |
| 418 | GR07 - 7 6 5 4 3 2 1 0 - Color Plane Ignore Register | |
| 419 | | | | | | | | | | |
| 420 | | | | | | | | +-- ignore color plane 0 | |
| 421 | | | | | | | +---- ignore color plane 1 | |
| 422 | | | | | | +------ ignore color plane 2 | |
| 423 | | | | | +-------- ignore color plane 3 | |
| 424 | | | | +---------- reserved/unused | |
| 425 | | | +------------ reserved/unused | |
| 426 | | +-------------- reserved/unused | |
| 427 | +---------------- reserved/unused | |
| 418 | GR07 - 7 6 5 4 3 2 1 0 - Color Plane Ignore Register | |
| 419 | | | | | | | | | | |
| 420 | | | | | | | | +-- ignore color plane 0 | |
| 421 | | | | | | | +---- ignore color plane 1 | |
| 422 | | | | | | +------ ignore color plane 2 | |
| 423 | | | | | +-------- ignore color plane 3 | |
| 424 | | | | +---------- reserved/unused | |
| 425 | | | +------------ reserved/unused | |
| 426 | | +-------------- reserved/unused | |
| 427 | +---------------- reserved/unused | |
| 428 | 428 | |
| 429 | 429 | |
| 430 | GR08 - 7 6 5 4 3 2 1 0 - Bit Mask Register | |
| 431 | | | | | | | | | | |
| 432 | | | | | | | | +-- write enable bit 0 | |
| 433 | | | | | | | +---- write enable bit 1 | |
| 434 | | | | | | +------ write enable bit 2 | |
| 435 | | | | | +-------- write enable bit 3 | |
| 436 | | | | +---------- write enable bit 4 | |
| 437 | | | +------------ write enable bit 5 | |
| 438 | | +-------------- write enable bit 6 | |
| 439 | +---------------- write enable bit 7 | |
| 430 | GR08 - 7 6 5 4 3 2 1 0 - Bit Mask Register | |
| 431 | | | | | | | | | | |
| 432 | | | | | | | | +-- write enable bit 0 | |
| 433 | | | | | | | +---- write enable bit 1 | |
| 434 | | | | | | +------ write enable bit 2 | |
| 435 | | | | | +-------- write enable bit 3 | |
| 436 | | | | +---------- write enable bit 4 | |
| 437 | | | +------------ write enable bit 5 | |
| 438 | | +-------------- write enable bit 6 | |
| 439 | +---------------- write enable bit 7 | |
| 440 | 440 | |
| 441 | 441 | |
| 442 | 442 | ***************************************************************************/ |
| r5932 | r5933 | |
| 469 | 469 | UINT8 misc_output; |
| 470 | 470 | UINT8 feature_control; |
| 471 | 471 | |
| 472 | /* Attribute registers AR00 - AR14 | |
| 473 | */ | |
| 472 | /* Attribute registers AR00 - AR14 | |
| 473 | */ | |
| 474 | 474 | struct { |
| 475 | 475 | UINT8 index; |
| 476 | 476 | UINT8 data[32]; |
| r5932 | r5933 | |
| 478 | 478 | } attribute; |
| 479 | 479 | |
| 480 | 480 | /* Sequencer registers SR00 - SR04 |
| 481 | ||
| 481 | */ | |
| 482 | 482 | struct { |
| 483 | 483 | UINT8 index; |
| 484 | 484 | UINT8 data[8]; |
| 485 | 485 | } sequencer; |
| 486 | 486 | |
| 487 | 487 | /* Graphics controller registers GR00 - GR08 |
| 488 | ||
| 488 | */ | |
| 489 | 489 | struct { |
| 490 | 490 | UINT8 index; |
| 491 | 491 | UINT8 data[16]; |
| r5932 | r5933 | |
| 499 | 499 | |
| 500 | 500 | |
| 501 | 501 | /* |
| 502 | ||
| 502 | Prototypes | |
| 503 | 503 | */ |
| 504 | 504 | static VIDEO_START( pc_ega ); |
| 505 | 505 | static VIDEO_UPDATE( pc_ega ); |
| r5932 | r5933 | |
| 738 | 738 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 739 | 739 | int i; |
| 740 | 740 | |
| 741 | // | |
| 741 | // logerror( "pc_ega_graphics: y = %d, x_count = %d, ma = %d, ra = %d\n", y, x_count, ma, ra ); | |
| 742 | 742 | |
| 743 | 743 | for ( i = 0; i < x_count; i++ ) |
| 744 | 744 | { |
| r5932 | r5933 | |
| 752 | 752 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 753 | 753 | int i; |
| 754 | 754 | |
| 755 | // | |
| 755 | // logerror( "pc_ega_text: y = %d, x_count = %d, ma = %d, ra = %d\n", y, x_count, ma, ra ); | |
| 756 | 756 | |
| 757 | 757 | for ( i = 0; i < x_count; i++ ) |
| 758 | 758 | { |
| r5932 | r5933 | |
| 963 | 963 | 1000 - 40x25 |
| 964 | 964 | 1001 - no diplsay (text at a0000) |
| 965 | 965 | 1010 - 40x25 |
| 966 | 1011 - | |
| 966 | 1011 - | |
| 967 | 967 | 1100 - 40x25 |
| 968 | 968 | 1101 - |
| 969 | 969 | 1110 - 40x25 |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | commodore pc10 320x200 in 16 colors |
| 9 | 9 | |
| 10 | 10 | |
| 11 | // aga | |
| 12 | // 256 8x8 thick chars | |
| 13 | // 256 8x8 thin chars | |
| 14 | // 256 9x14 in 8x16 chars, line 3 is connected to a10 | |
| 11 | // aga | |
| 12 | // 256 8x8 thick chars | |
| 13 | // 256 8x8 thin chars | |
| 14 | // 256 9x14 in 8x16 chars, line 3 is connected to a10 | |
| 15 | 15 | ROM_LOAD("aga.chr", 0x00000, 0x02000, CRC(aca81498)) |
| 16 | ||
| 16 | // hercules font of above | |
| 17 | 17 | ROM_LOAD("hercules.chr", 0x00000, 0x1000, CRC(7e8c9d76)) |
| 18 | 18 | |
| 19 | 19 | */ |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | /* |
| 19 | 19 | for (i = 0; i < 8; i++) { |
| 20 | ||
| 20 | struct intv_sprite_type* s = &intv_sprite[i]; | |
| 21 | 21 | s->visible = 0; |
| 22 | 22 | s->xpos = 0; |
| 23 | 23 | s->ypos = 0; |
| r5932 | r5933 | |
| 41 | 41 | } |
| 42 | 42 | intv_collision_registers[i] = 0; |
| 43 | 43 | } |
| 44 | ||
| 44 | for(i = 0; i < 4; i++) { | |
| 45 | 45 | intv_color_stack[i] = 0; |
| 46 | 46 | } |
| 47 | 47 | intv_color_stack_mode = 0; |
| r5932 | r5933 | |
| 54 | 54 | intv_top_edge_inhibit = 0; |
| 55 | 55 | |
| 56 | 56 | intv_gramdirty = 1; |
| 57 | ||
| 57 | for(i=0;i<64;i++) { | |
| 58 | 58 | intv_gram[i] = 0; |
| 59 | ||
| 59 | intv_gramdirtybytes[i] = 1; | |
| 60 | 60 | } |
| 61 | 61 | */ |
| 62 | 62 | } |
| r5932 | r5933 | |
| 592 | 592 | /* |
| 593 | 593 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, int behind_foreground) |
| 594 | 594 | { |
| 595 | int i; | |
| 596 | int code; | |
| 595 | int i; | |
| 596 | int code; | |
| 597 | 597 | |
| 598 | for(i=7;i>=0;--i) | |
| 599 | { | |
| 600 | struct intv_sprite_type *s = &intv_sprite[i]; | |
| 601 | if (s->visible && (s->behind_foreground == behind_foreground)) | |
| 602 | { | |
| 603 | code = s->card; | |
| 604 | if (!s->grom) | |
| 605 | { | |
| 606 | code %= 64; // keep from going outside the array | |
| 607 | if (s->yres == 1) | |
| 608 | { | |
| 609 | //if (intv_gramdirtybytes[code] == 1) | |
| 610 | { | |
| 611 | decodechar(machine->gfx[1], | |
| 612 | code, | |
| 613 | intv_gram, | |
| 614 | machine->config->gfxdecodeinfo[1].gfxlayout); | |
| 615 | intv_gramdirtybytes[code] = 0; | |
| 616 | } | |
| 617 | // Draw GRAM char | |
| 618 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[1], | |
| 619 | code, | |
| 620 | s->color, | |
| 621 | s->xflip,s->yflip, | |
| 622 | s->xpos*2-16,s->ypos*2-16, | |
| 623 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 624 | } | |
| 625 | else | |
| 626 | { | |
| 627 | //if ((intv_gramdirtybytes[code] == 1) || (intv_gramdirtybytes[code+1] == 1)) | |
| 628 | { | |
| 629 | decodechar(machine->gfx[1], | |
| 630 | code, | |
| 631 | intv_gram, | |
| 632 | machine->config->gfxdecodeinfo[1].gfxlayout); | |
| 633 | decodechar(machine->gfx[1], | |
| 634 | code+1, | |
| 635 | intv_gram, | |
| 636 | machine->config->gfxdecodeinfo[1].gfxlayout); | |
| 637 | intv_gramdirtybytes[code] = 0; | |
| 638 | intv_gramdirtybytes[code+1] = 0; | |
| 639 | } | |
| 640 | // Draw GRAM char | |
| 641 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[1], | |
| 642 | code, | |
| 643 | s->color, | |
| 644 | s->xflip,s->yflip, | |
| 645 | s->xpos*2-16,s->ypos*2-16+(s->yflip)*s->ysize*8, | |
| 646 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 647 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[1], | |
| 648 | code+1, | |
| 649 | s->color, | |
| 650 | s->xflip,s->yflip, | |
| 651 | s->xpos*2-16,s->ypos*2-16+(1-s->yflip)*s->ysize*8, | |
| 652 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 653 | } | |
| 654 | } | |
| 655 | else | |
| 656 | { | |
| 657 | if (s->yres == 1) | |
| 658 | { | |
| 659 | // Draw GROM char | |
| 660 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[0], | |
| 661 | code, | |
| 662 | s->color, | |
| 663 | s->xflip,s->yflip, | |
| 664 | s->xpos*2-16,s->ypos*2-16, | |
| 665 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 666 | } | |
| 667 | else | |
| 668 | { | |
| 669 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[0], | |
| 670 | code, | |
| 671 | s->color, | |
| 672 | s->xflip,s->yflip, | |
| 673 | s->xpos*2-16,s->ypos*2-16+(s->yflip)*s->ysize*8, | |
| 674 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 675 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[0], | |
| 676 | code+1, | |
| 677 | s->color, | |
| 678 | s->xflip,s->yflip, | |
| 679 | s->xpos*2-16,s->ypos*2-16+(1-s->yflip)*s->ysize*8, | |
| 680 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 681 | } | |
| 682 | } | |
| 683 | } | |
| 684 | } | |
| 598 | for(i=7;i>=0;--i) | |
| 599 | { | |
| 600 | struct intv_sprite_type *s = &intv_sprite[i]; | |
| 601 | if (s->visible && (s->behind_foreground == behind_foreground)) | |
| 602 | { | |
| 603 | code = s->card; | |
| 604 | if (!s->grom) | |
| 605 | { | |
| 606 | code %= 64; // keep from going outside the array | |
| 607 | if (s->yres == 1) | |
| 608 | { | |
| 609 | //if (intv_gramdirtybytes[code] == 1) | |
| 610 | { | |
| 611 | decodechar(machine->gfx[1], | |
| 612 | code, | |
| 613 | intv_gram, | |
| 614 | machine->config->gfxdecodeinfo[1].gfxlayout); | |
| 615 | intv_gramdirtybytes[code] = 0; | |
| 616 | } | |
| 617 | // Draw GRAM char | |
| 618 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[1], | |
| 619 | code, | |
| 620 | s->color, | |
| 621 | s->xflip,s->yflip, | |
| 622 | s->xpos*2-16,s->ypos*2-16, | |
| 623 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 624 | } | |
| 625 | else | |
| 626 | { | |
| 627 | //if ((intv_gramdirtybytes[code] == 1) || (intv_gramdirtybytes[code+1] == 1)) | |
| 628 | { | |
| 629 | decodechar(machine->gfx[1], | |
| 630 | code, | |
| 631 | intv_gram, | |
| 632 | machine->config->gfxdecodeinfo[1].gfxlayout); | |
| 633 | decodechar(machine->gfx[1], | |
| 634 | code+1, | |
| 635 | intv_gram, | |
| 636 | machine->config->gfxdecodeinfo[1].gfxlayout); | |
| 637 | intv_gramdirtybytes[code] = 0; | |
| 638 | intv_gramdirtybytes[code+1] = 0; | |
| 639 | } | |
| 640 | // Draw GRAM char | |
| 641 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[1], | |
| 642 | code, | |
| 643 | s->color, | |
| 644 | s->xflip,s->yflip, | |
| 645 | s->xpos*2-16,s->ypos*2-16+(s->yflip)*s->ysize*8, | |
| 646 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 647 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[1], | |
| 648 | code+1, | |
| 649 | s->color, | |
| 650 | s->xflip,s->yflip, | |
| 651 | s->xpos*2-16,s->ypos*2-16+(1-s->yflip)*s->ysize*8, | |
| 652 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 653 | } | |
| 654 | } | |
| 655 | else | |
| 656 | { | |
| 657 | if (s->yres == 1) | |
| 658 | { | |
| 659 | // Draw GROM char | |
| 660 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[0], | |
| 661 | code, | |
| 662 | s->color, | |
| 663 | s->xflip,s->yflip, | |
| 664 | s->xpos*2-16,s->ypos*2-16, | |
| 665 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 666 | } | |
| 667 | else | |
| 668 | { | |
| 669 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[0], | |
| 670 | code, | |
| 671 | s->color, | |
| 672 | s->xflip,s->yflip, | |
| 673 | s->xpos*2-16,s->ypos*2-16+(s->yflip)*s->ysize*8, | |
| 674 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 675 | drawgfxzoom_transpen(bitmap,&machine->screen[0].visarea,machine->gfx[0], | |
| 676 | code+1, | |
| 677 | s->color, | |
| 678 | s->xflip,s->yflip, | |
| 679 | s->xpos*2-16,s->ypos*2-16+(1-s->yflip)*s->ysize*8, | |
| 680 | 0x8000*s->xsize, 0x8000*s->ysize,0); | |
| 681 | } | |
| 682 | } | |
| 683 | } | |
| 684 | } | |
| 685 | 685 | } |
| 686 | 686 | */ |
| 687 | 687 | |
| r5932 | r5933 | |
| 783 | 783 | { |
| 784 | 784 | int x,y,offs; |
| 785 | 785 | int current_row; |
| 786 | // | |
| 786 | // char c; | |
| 787 | 787 | |
| 788 | 788 | /* Draw the underlying INTV screen first */ |
| 789 | 789 | VIDEO_UPDATE_CALL(generic_bitmapped); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Specialist video driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 15/03/2008 Preliminary driver. | |
| 6 | ||
| 5 | 15/03/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "includes/special.h" |
| 12 | ||
| 12 | ||
| 13 | 13 | UINT8 *specialist_video_ram; |
| 14 | 14 | //UINT8 erik_page_active; |
| 15 | 15 | UINT8 *erik_video_ram_page_1; |
| r5932 | r5933 | |
| 19 | 19 | VIDEO_START( special ) |
| 20 | 20 | { |
| 21 | 21 | } |
| 22 | ||
| 22 | ||
| 23 | 23 | VIDEO_UPDATE( special ) |
| 24 | 24 | { |
| 25 | 25 | UINT8 code; |
| 26 | 26 | int y, x, b; |
| 27 | ||
| 27 | ||
| 28 | 28 | for (x = 0; x < 48; x++) |
| 29 | { | |
| 29 | { | |
| 30 | 30 | for (y = 0; y < 256; y++) |
| 31 | 31 | { |
| 32 | 32 | code = specialist_video_ram[y + x*256]; |
| 33 | 33 | for (b = 7; b >= 0; b--) |
| 34 | { | |
| 34 | { | |
| 35 | 35 | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = (code >> b) & 0x01; |
| 36 | 36 | } |
| 37 | } | |
| 37 | } | |
| 38 | 38 | } |
| 39 | 39 | return 0; |
| 40 | 40 | } |
| 41 | 41 | VIDEO_START( specialp ) |
| 42 | 42 | { |
| 43 | 43 | } |
| 44 | ||
| 44 | ||
| 45 | 45 | VIDEO_UPDATE( specialp ) |
| 46 | 46 | { |
| 47 | 47 | UINT8 code; |
| 48 | 48 | int y, x, b; |
| 49 | ||
| 49 | ||
| 50 | 50 | for (x = 0; x < 64; x++) |
| 51 | { | |
| 51 | { | |
| 52 | 52 | for (y = 0; y < 256; y++) |
| 53 | 53 | { |
| 54 | 54 | code = specialist_video_ram[y + x*256]; |
| 55 | 55 | for (b = 7; b >= 0; b--) |
| 56 | { | |
| 56 | { | |
| 57 | 57 | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = (code >> b) & 0x01; |
| 58 | 58 | } |
| 59 | } | |
| 59 | } | |
| 60 | 60 | } |
| 61 | 61 | return 0; |
| 62 | 62 | } |
| r5932 | r5933 | |
| 65 | 65 | const rgb_t specimx_palette[16] = { |
| 66 | 66 | MAKE_RGB(0x00, 0x00, 0x00), // 0 |
| 67 | 67 | MAKE_RGB(0x00, 0x00, 0xaa), // 1 |
| 68 | MAKE_RGB(0x00, 0xaa, 0x00), // 2 | |
| 69 | MAKE_RGB(0x00, 0xaa, 0xaa), // 3 | |
| 70 | MAKE_RGB(0xaa, 0x00, 0x00), // 4 | |
| 71 | MAKE_RGB(0xaa, 0x00, 0xaa), // 5 | |
| 72 | MAKE_RGB(0xaa, 0x55, 0x00), // 6 | |
| 73 | MAKE_RGB(0xaa, 0xaa, 0xaa), // 7 | |
| 74 | MAKE_RGB(0x55, 0x55, 0x55), // 8 | |
| 75 | MAKE_RGB(0x55, 0x55, 0xff), // 9 | |
| 76 | MAKE_RGB(0x55, 0xff, 0x55), // A | |
| 77 | MAKE_RGB(0x55, 0xff, 0xff), // B | |
| 78 | MAKE_RGB(0xff, 0x55, 0x55), // C | |
| 79 | MAKE_RGB(0xff, 0x55, 0xff), // D | |
| 80 | MAKE_RGB(0xff, 0xff, 0x55), // E | |
| 81 | MAKE_RGB(0xff, 0xff, 0xff) // F | |
| 68 | MAKE_RGB(0x00, 0xaa, 0x00), // 2 | |
| 69 | MAKE_RGB(0x00, 0xaa, 0xaa), // 3 | |
| 70 | MAKE_RGB(0xaa, 0x00, 0x00), // 4 | |
| 71 | MAKE_RGB(0xaa, 0x00, 0xaa), // 5 | |
| 72 | MAKE_RGB(0xaa, 0x55, 0x00), // 6 | |
| 73 | MAKE_RGB(0xaa, 0xaa, 0xaa), // 7 | |
| 74 | MAKE_RGB(0x55, 0x55, 0x55), // 8 | |
| 75 | MAKE_RGB(0x55, 0x55, 0xff), // 9 | |
| 76 | MAKE_RGB(0x55, 0xff, 0x55), // A | |
| 77 | MAKE_RGB(0x55, 0xff, 0xff), // B | |
| 78 | MAKE_RGB(0xff, 0x55, 0x55), // C | |
| 79 | MAKE_RGB(0xff, 0x55, 0xff), // D | |
| 80 | MAKE_RGB(0xff, 0xff, 0x55), // E | |
| 81 | MAKE_RGB(0xff, 0xff, 0xff) // F | |
| 82 | 82 | }; |
| 83 | 83 | |
| 84 | 84 | PALETTE_INIT( specimx ) |
| r5932 | r5933 | |
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | VIDEO_START( specimx ) |
| 91 | { | |
| 91 | { | |
| 92 | 92 | specimx_colorram = auto_alloc_array(machine, UINT8, 0x3000); |
| 93 | 93 | memset(specimx_colorram,0x70,0x3000); |
| 94 | } | |
| 94 | } | |
| 95 | 95 | |
| 96 | 96 | VIDEO_UPDATE( specimx ) |
| 97 | 97 | { |
| 98 | 98 | UINT8 code,color; |
| 99 | 99 | int y, x, b; |
| 100 | ||
| 100 | ||
| 101 | 101 | for (x = 0; x < 48; x++) |
| 102 | { | |
| 102 | { | |
| 103 | 103 | for (y = 0; y < 256; y++) |
| 104 | 104 | { |
| 105 | 105 | code = mess_ram[0x9000 + y + x*256]; |
| 106 | 106 | color = specimx_colorram[y + x*256]; |
| 107 | 107 | for (b = 7; b >= 0; b--) |
| 108 | { | |
| 109 | ||
| 108 | { | |
| 109 | ||
| 110 | 110 | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = ((code >> b) & 0x01)==0 ? color & 0x0f : (color >> 4)& 0x0f ; |
| 111 | 111 | } |
| 112 | } | |
| 112 | } | |
| 113 | 113 | } |
| 114 | 114 | return 0; |
| 115 | 115 | } |
| r5932 | r5933 | |
| 117 | 117 | static const rgb_t erik_palette[8] = { |
| 118 | 118 | MAKE_RGB(0x00, 0x00, 0x00), // 0 |
| 119 | 119 | MAKE_RGB(0x00, 0x00, 0xff), // 1 |
| 120 | MAKE_RGB(0xff, 0x00, 0x00), // 2 | |
| 121 | MAKE_RGB(0xff, 0x00, 0xff), // 3 | |
| 122 | MAKE_RGB(0x00, 0xff, 0x00), // 4 | |
| 123 | MAKE_RGB(0x00, 0xff, 0xff), // 5 | |
| 124 | MAKE_RGB(0xff, 0xff, 0x00), // 6 | |
| 125 | MAKE_RGB(0xff, 0xff, 0xff) // 7 | |
| 120 | MAKE_RGB(0xff, 0x00, 0x00), // 2 | |
| 121 | MAKE_RGB(0xff, 0x00, 0xff), // 3 | |
| 122 | MAKE_RGB(0x00, 0xff, 0x00), // 4 | |
| 123 | MAKE_RGB(0x00, 0xff, 0xff), // 5 | |
| 124 | MAKE_RGB(0xff, 0xff, 0x00), // 6 | |
| 125 | MAKE_RGB(0xff, 0xff, 0xff) // 7 | |
| 126 | 126 | }; |
| 127 | 127 | |
| 128 | 128 | PALETTE_INIT( erik ) |
| r5932 | r5933 | |
| 135 | 135 | UINT8 erik_background; |
| 136 | 136 | |
| 137 | 137 | VIDEO_START( erik ) |
| 138 | { | |
| 139 | } | |
| 138 | { | |
| 139 | } | |
| 140 | 140 | |
| 141 | 141 | VIDEO_UPDATE( erik ) |
| 142 | 142 | { |
| r5932 | r5933 | |
| 146 | 146 | int y, x, b; |
| 147 | 147 | UINT8 *erik_video_ram_p1; |
| 148 | 148 | UINT8 *erik_video_ram_p2; |
| 149 | ||
| 149 | ||
| 150 | 150 | erik_video_ram_p1 = mess_ram + 0x9000; |
| 151 | 151 | erik_video_ram_p2 = mess_ram + 0xd000; |
| 152 | ||
| 152 | ||
| 153 | 153 | for (x = 0; x < 48; x++) |
| 154 | { | |
| 154 | { | |
| 155 | 155 | for (y = 0; y < 256; y++) |
| 156 | 156 | { |
| 157 | 157 | code1 = erik_video_ram_p1[y + x*256]; |
| 158 | 158 | code2 = erik_video_ram_p2[y + x*256]; |
| 159 | ||
| 159 | ||
| 160 | 160 | for (b = 7; b >= 0; b--) |
| 161 | { | |
| 161 | { | |
| 162 | 162 | color1 = ((code1 >> b) & 0x01)==0 ? erik_background : erik_color_1; |
| 163 | 163 | color2 = ((code2 >> b) & 0x01)==0 ? erik_background : erik_color_2; |
| 164 | 164 | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = color1 | color2; |
| 165 | 165 | } |
| 166 | } | |
| 167 | } | |
| 166 | } | |
| 167 | } | |
| 168 | 168 | return 0; |
| 169 | 169 | } |
| 170 | 170 |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | #include "video/pc_video.h" |
| 3 | 3 | |
| 4 | 4 | #define CGA_PALETTE_SETS 83 /* one for colour, one for mono, |
| 5 | ||
| 5 | * 81 for colour composite */ | |
| 6 | 6 | |
| 7 | 7 | #define CGA_SCREEN_NAME "cga_screen" |
| 8 | 8 | #define CGA_MC6845_NAME "mc6845_cga" |
| r5932 | r5933 | |
|---|---|---|
| 39 | 39 | struct _msm6255_interface |
| 40 | 40 | { |
| 41 | 41 | const char *screen_tag; /* screen we are acting on */ |
| 42 | ||
| 42 | ||
| 43 | 43 | int character_clock; /* the character clock of the chip */ |
| 44 | 44 | |
| 45 | 45 | /* ROM/RAM data read function */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Mikro-80 video driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 10/03/2008 Preliminary driver. | |
| 6 | ||
| 5 | 10/03/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "includes/mikro80.h" |
| 12 | ||
| 12 | ||
| 13 | 13 | UINT8 *mikro80_video_ram; |
| 14 | 14 | UINT8 *mikro80_cursor_ram; |
| 15 | ||
| 15 | ||
| 16 | 16 | VIDEO_START( mikro80 ) |
| 17 | 17 | { |
| 18 | 18 | } |
| 19 | ||
| 19 | ||
| 20 | 20 | VIDEO_UPDATE( mikro80 ) |
| 21 | 21 | { |
| 22 | 22 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| r5932 | r5933 | |
| 30 | 30 | UINT8 code = gfx[mikro80_video_ram [addr]*8+ (y % 8)]; |
| 31 | 31 | UINT8 attr = mikro80_cursor_ram[addr+1] & 0x80 ? 1 : 0; |
| 32 | 32 | for (b = 7; b >= 0; b--) |
| 33 | { | |
| 33 | { | |
| 34 | 34 | UINT8 col = (code >> b) & 0x01; |
| 35 | 35 | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = attr ? col ^ 1 : col; |
| 36 | 36 | } |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | #include "includes/ssystem3.h" |
| 7 | 7 | |
| 8 | 8 | static struct { |
| 9 | UINT8 data[5]; | |
| 9 | UINT8 data[5]; | |
| 10 | 10 | int clock; |
| 11 | 11 | int count; |
| 12 | 12 | } ssystem3_lcd; |
| 13 | 13 | |
| 14 | void ssystem3_lcd_reset(void) | |
| 14 | void ssystem3_lcd_reset(void) | |
| 15 | 15 | { |
| 16 | 16 | ssystem3_lcd.count=0; ssystem3_lcd.clock=1; |
| 17 | 17 | } |
| r5932 | r5933 | |
| 214 | 214 | 0, // empty |
| 215 | 215 | 1, // bauer |
| 216 | 216 | 3, // springer |
| 217 | 0x11, // l | |
| 217 | 0x11, // l??ufer | |
| 218 | 218 | 7, // turm |
| 219 | 219 | 0x1f, // dame |
| 220 | 0x17, // k | |
| 220 | 0x17, // k??nig | |
| 221 | 221 | 0 |
| 222 | 222 | }; |
| 223 | 223 | int y, x; |
| r5932 | r5933 | |
| 226 | 226 | int figure, black; |
| 227 | 227 | int xp=263+x*22; |
| 228 | 228 | int yp=55+(y^7)*28; |
| 229 | ssystem3_playfield_getfigure(x, y, &figure, &black); | |
| 229 | ssystem3_playfield_getfigure(x, y, &figure, &black); | |
| 230 | 230 | ssystem3_draw_led(bitmap, lcd_signs_on[figure]&1?1:0, xp, yp, '6'); |
| 231 | 231 | ssystem3_draw_led(bitmap, lcd_signs_on[figure]&2?1:0, xp, yp, '8'); |
| 232 | 232 | ssystem3_draw_led(bitmap, lcd_signs_on[figure]&4?1:0, xp, yp, '9'); |
| 233 | 233 | ssystem3_draw_led(bitmap, lcd_signs_on[figure]&8?1:0, xp, yp, 'b'); |
| 234 | 234 | ssystem3_draw_led(bitmap, lcd_signs_on[figure]&0x10?1:0, xp, yp, 'c'); |
| 235 | 235 | ssystem3_draw_led(bitmap, figure!=0 && black?1:0, xp, yp, '7'); |
| 236 | ||
| 236 | ||
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | } |
| r5932 | r5933 | |
|---|---|---|
| 177 | 177 | MDRV_HD44102_ADD( "m9", SCREEN_TAG, 150, 32) |
| 178 | 178 | MDRV_HD44102_ADD("m10", SCREEN_TAG, 200, 32) |
| 179 | 179 | |
| 180 | // MDRV_HD44103_MASTER_ADD("m11", SCREEN_TAG, CAP_P(18), RES_K(100), HD44103_FS_HIGH, HD44103_DUTY_1_32) | |
| 181 | // MDRV_HD44103_SLAVE_ADD( "m12", "m11", SCREEN_TAG, HD44103_FS_HIGH, HD44103_DUTY_1_32) | |
| 180 | // MDRV_HD44103_MASTER_ADD("m11", SCREEN_TAG, CAP_P(18), RES_K(100), HD44103_FS_HIGH, HD44103_DUTY_1_32) | |
| 181 | // MDRV_HD44103_SLAVE_ADD( "m12", "m11", SCREEN_TAG, HD44103_FS_HIGH, HD44103_DUTY_1_32) | |
| 182 | 182 | MACHINE_DRIVER_END |
| 183 | 183 | |
| 184 | 184 | MACHINE_DRIVER_START( tandy200_video ) |
| r5932 | r5933 | |
|---|---|---|
| 42 | 42 | { |
| 43 | 43 | int x,y; |
| 44 | 44 | const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 45 | mz80k_vertical = mz80k_vertical ? 0 : 1; | |
| 45 | mz80k_vertical = mz80k_vertical ? 0 : 1; | |
| 46 | 46 | mz80k_cursor_cnt++; |
| 47 | 47 | if (mz80k_cursor_cnt==64) mz80k_cursor_cnt = 0; |
| 48 | ||
| 48 | ||
| 49 | 49 | for(y = 0; y < 25; y++ ) |
| 50 | 50 | { |
| 51 | 51 | for(x = 0; x < 40; x++ ) |
| 52 | 52 | { |
| 53 | int code = memory_read_byte(space,0xD000 + x + y*40); | |
| 53 | int code = memory_read_byte(space,0xD000 + x + y*40); | |
| 54 | 54 | drawgfx_opaque(bitmap, NULL, screen->machine->gfx[0], code , 0, 0,0, x*8,y*8); |
| 55 | 55 | } |
| 56 | 56 | } |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | UINT8* poly_video_ram; |
| 13 | 13 | |
| 14 | static UINT8 mcm6571a[] = | |
| 14 | static UINT8 mcm6571a[] = | |
| 15 | 15 | { |
| 16 | 16 | 0x00,0x00,0x00,0x00,0x31,0x4A,0x44,0x4A,0x31,// 0 |
| 17 | 17 | 0x3C,0x22,0x3C,0x22,0x22,0x3C,0x20,0x20,0x40,// 1 |
| r5932 | r5933 | |
| 154 | 154 | 1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0 |
| 155 | 155 | }; |
| 156 | 156 | |
| 157 | static UINT8 get_mcm6571a_line(UINT8 code, UINT8 line) | |
| 157 | static UINT8 get_mcm6571a_line(UINT8 code, UINT8 line) | |
| 158 | 158 | { |
| 159 | 159 | if (mcm6571a_shift[code]==0) { |
| 160 | 160 | if (line < 9) { |
| 161 | 161 | return mcm6571a[code*9 + line]; |
| 162 | 162 | } else { |
| 163 | 163 | return 0; |
| 164 | } | |
| 164 | } | |
| 165 | 165 | } else { |
| 166 | 166 | if (line < 3) { |
| 167 | 167 | return 0; |
| 168 | } else | |
| 168 | } else | |
| 169 | 169 | if (line <12) { |
| 170 | 170 | return mcm6571a[code*9 + line - 3]; |
| 171 | 171 | } else { |
| 172 | 172 | return 0; |
| 173 | } | |
| 173 | } | |
| 174 | 174 | } |
| 175 | 175 | return 0; |
| 176 | ||
| 176 | ||
| 177 | 177 | } |
| 178 | 178 | VIDEO_START( poly88 ) |
| 179 | 179 | { |
| r5932 | r5933 | |
| 183 | 183 | { |
| 184 | 184 | int x,y,j,b; |
| 185 | 185 | UINT16 addr; |
| 186 | int xpos; | |
| 186 | int xpos; | |
| 187 | 187 | UINT8 l,r; |
| 188 | ||
| 188 | ||
| 189 | 189 | for(y = 0; y < 16; y++ ) |
| 190 | 190 | { |
| 191 | 191 | addr = y*64; |
| r5932 | r5933 | |
| 195 | 195 | UINT8 code = poly_video_ram[addr + x]; |
| 196 | 196 | if ((code & 0x80)==0) { |
| 197 | 197 | for(j = 0; j < 15; j++ ) |
| 198 | { | |
| 199 | l = j/5; | |
| 198 | { | |
| 199 | l = j/5; | |
| 200 | 200 | for(b = 0; b < 10; b++ ) |
| 201 | 201 | { |
| 202 | 202 | r = b/5; |
| r5932 | r5933 | |
| 218 | 218 | if (l==2 && r==1) { |
| 219 | 219 | *BITMAP_ADDR16(bitmap, y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; |
| 220 | 220 | } |
| 221 | ||
| 222 | ||
| 223 | } | |
| 221 | ||
| 222 | ||
| 223 | } | |
| 224 | 224 | } |
| 225 | 225 | } else { |
| 226 | 226 | for(j = 0; j < 15; j++ ) |
| r5932 | r5933 | |
| 229 | 229 | for(b = 0; b < 7; b++ ) |
| 230 | 230 | { |
| 231 | 231 | *BITMAP_ADDR16(bitmap, y*15+j, xpos+b ) = (l >> (6-b)) & 1; |
| 232 | } | |
| 232 | } | |
| 233 | 233 | *BITMAP_ADDR16(bitmap, y*15+j, xpos+7 ) = 0; |
| 234 | 234 | *BITMAP_ADDR16(bitmap, y*15+j, xpos+8 ) = 0; |
| 235 | 235 | *BITMAP_ADDR16(bitmap, y*15+j, xpos+9 ) = 0; |
| 236 | ||
| 236 | ||
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | xpos += 10; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | UT88 video driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 06/03/2008 Preliminary driver. | |
| 6 | ||
| 5 | 06/03/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "includes/ut88.h" |
| 12 | ||
| 12 | ||
| 13 | 13 | UINT8 *ut88_video_ram; |
| 14 | ||
| 14 | ||
| 15 | 15 | const gfx_layout ut88_charlayout = |
| 16 | 16 | { |
| 17 | 17 | 8, 8, /* 8x8 characters */ |
| 18 | 18 | 256, /* 256 characters */ |
| 19 | 19 | 1, /* 1 bits per pixel */ |
| 20 | {0}, /* no bitplanes; 1 bit per pixel */ | |
| 20 | {0}, /* no bitplanes; 1 bit per pixel */ | |
| 21 | 21 | {0, 1, 2, 3, 4, 5, 6, 7}, |
| 22 | 22 | {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8}, |
| 23 | 23 | 8*8 /* size of one char */ |
| r5932 | r5933 | |
| 26 | 26 | VIDEO_START( ut88 ) |
| 27 | 27 | { |
| 28 | 28 | } |
| 29 | ||
| 29 | ||
| 30 | 30 | VIDEO_UPDATE( ut88 ) |
| 31 | 31 | { |
| 32 | 32 | int x,y; |
| r5932 | r5933 | |
| 35 | 35 | { |
| 36 | 36 | for(x = 0; x < 64; x++ ) |
| 37 | 37 | { |
| 38 | int code = ut88_video_ram[ x + y*64 ] & 0x7f; | |
| 38 | int code = ut88_video_ram[ x + y*64 ] & 0x7f; | |
| 39 | 39 | int attr = ut88_video_ram[ x+1 + y*64 ] & 0x80; |
| 40 | 40 | drawgfx_opaque(bitmap, NULL, screen->machine->gfx[0], code | attr, 0, 0,0, x*8,y*8); |
| 41 | 41 | } |
| 42 | } | |
| 42 | } | |
| 43 | 43 | return 0; |
| 44 | 44 | } |
| 45 | 45 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | Video Interface Chip (6567R8 for NTSC system and 6569 for PAL system) | |
| 4 | PeT mess@utanet.at | |
| 3 | Video Interface Chip (6567R8 for NTSC system and 6569 for PAL system) | |
| 4 | PeT mess@utanet.at | |
| 5 | 5 | |
| 6 | A part of the code (cycle routine and drawing routines) is a modified version of the vic ii emulation used in | |
| 7 | commodore 64 emulator "frodo" by Christian Bauer | |
| 6 | A part of the code (cycle routine and drawing routines) is a modified version of the vic ii emulation used in | |
| 7 | commodore 64 emulator "frodo" by Christian Bauer | |
| 8 | 8 | |
| 9 | http://frodo.cebix.net/ | |
| 10 | The rights on the source code remain at the author. | |
| 11 | It may not - not even in parts - used for commercial purposes without explicit written permission by the author. | |
| 12 | Permission to use it for non-commercial purposes is hereby granted als long as my copyright notice remains in the program. | |
| 13 | You are not allowed to use the source to create and distribute a modified version of Frodo. | |
| 9 | http://frodo.cebix.net/ | |
| 10 | The rights on the source code remain at the author. | |
| 11 | It may not - not even in parts - used for commercial purposes without explicit written permission by the author. | |
| 12 | Permission to use it for non-commercial purposes is hereby granted als long as my copyright notice remains in the program. | |
| 13 | You are not allowed to use the source to create and distribute a modified version of Frodo. | |
| 14 | 14 | |
| 15 | 15 | ***************************************************************************/ |
| 16 | 16 | /* mos videochips |
| r5932 | r5933 | |
| 328 | 328 | vic2.dma_read_color = dma_read_color; |
| 329 | 329 | vic2.interrupt = irq; |
| 330 | 330 | vic2.vic2e = chip_vic2e; |
| 331 | ||
| 331 | ||
| 332 | 332 | vic2.on = TRUE; |
| 333 | 333 | } |
| 334 | 334 | |
| r5932 | r5933 | |
| 881 | 881 | vic2.rasterline = 0; // VIC2_LINES - 1; |
| 882 | 882 | |
| 883 | 883 | // from 1 to 63 (PAL) or from 1 to 65 (NTSC) |
| 884 | vic2.rasterX = 63; | |
| 884 | vic2.rasterX = 63; | |
| 885 | 885 | |
| 886 | 886 | // immediately call the timer to handle the first line |
| 887 | 887 | if (vic2.pal) |
| r5932 | r5933 | |
| 1554 | 1554 | |
| 1555 | 1555 | default: |
| 1556 | 1556 | vic2.rasterX++; |
| 1557 | ||
| 1557 | ||
| 1558 | 1558 | break; |
| 1559 | 1559 | } |
| 1560 | 1560 | |
| r5932 | r5933 | |
| 2352 | 2352 | ResumeCPU |
| 2353 | 2353 | |
| 2354 | 2354 | vic2.cycle++; |
| 2355 | break; | |
| 2355 | break; | |
| 2356 | 2356 | |
| 2357 | 2357 | // Refresh, fetch if bad line |
| 2358 | 2358 | case 12: |
| r5932 | r5933 | |
| 2487 | 2487 | |
| 2488 | 2488 | // Graphics |
| 2489 | 2489 | |
| 2490 | case 19: | |
| 2490 | case 19: | |
| 2491 | 2491 | case 20: |
| 2492 | 2492 | case 21: |
| 2493 | 2493 | case 22: |
| r5932 | r5933 | |
| 2497 | 2497 | case 26: |
| 2498 | 2498 | case 27: |
| 2499 | 2499 | case 28: |
| 2500 | case 29: | |
| 2500 | case 29: | |
| 2501 | 2501 | case 30: |
| 2502 | 2502 | case 31: |
| 2503 | 2503 | case 32: |
| r5932 | r5933 | |
| 2910 | 2910 | ResumeCPU |
| 2911 | 2911 | |
| 2912 | 2912 | vic2.cycle++; |
| 2913 | break; | |
| 2913 | break; | |
| 2914 | 2914 | |
| 2915 | 2915 | // Refresh, fetch if bad line |
| 2916 | 2916 | case 12: |
| r5932 | r5933 | |
| 3045 | 3045 | |
| 3046 | 3046 | // Graphics |
| 3047 | 3047 | |
| 3048 | case 19: | |
| 3048 | case 19: | |
| 3049 | 3049 | case 20: |
| 3050 | 3050 | case 21: |
| 3051 | 3051 | case 22: |
| r5932 | r5933 | |
| 3055 | 3055 | case 26: |
| 3056 | 3056 | case 27: |
| 3057 | 3057 | case 28: |
| 3058 | case 29: | |
| 3058 | case 29: | |
| 3059 | 3059 | case 30: |
| 3060 | 3060 | case 31: |
| 3061 | 3061 | case 32: |
| r5932 | r5933 | |
|---|---|---|
| 21 | 21 | UINT8 code,disp; |
| 22 | 22 | int y, x, b,c,inv; |
| 23 | 23 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 24 | ||
| 24 | ||
| 25 | 25 | for (x = 0; x < 64; x++) |
| 26 | 26 | { |
| 27 | 27 | for (y = 0; y < 16; y++) |
| 28 | 28 | { |
| 29 | 29 | code = llc_video_ram[x + y*64]; |
| 30 | 30 | inv = code & 0x80; // highest bit is invert flag |
| 31 | code &= 0x7f; | |
| 31 | code &= 0x7f; | |
| 32 | 32 | for (b = 0; b < 8; b++) |
| 33 | { | |
| 33 | { | |
| 34 | 34 | for (c = 0; c < 8; c++) |
| 35 | 35 | { |
| 36 | 36 | disp = gfx[code + b*0x80]; |
| r5932 | r5933 | |
| 52 | 52 | UINT8 code,disp; |
| 53 | 53 | int y, x, b,c; |
| 54 | 54 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 55 | ||
| 55 | ||
| 56 | 56 | for (x = 0; x < 64; x++) |
| 57 | 57 | { |
| 58 | 58 | for (y = 0; y < 32; y++) |
| 59 | 59 | { |
| 60 | 60 | code = llc_video_ram[x + y*64]; |
| 61 | 61 | for (b = 0; b < 8; b++) |
| 62 | { | |
| 62 | { | |
| 63 | 63 | disp = gfx[code * 8 + b]; |
| 64 | 64 | for (c = 0; c < 8; c++) |
| 65 | { | |
| 65 | { | |
| 66 | 66 | *BITMAP_ADDR16(bitmap, y*8+b, x*8+c) = ((disp<< c) & 0x80) ? 1 : 0; |
| 67 | 67 | } |
| 68 | 68 | } |
| r5932 | r5933 | |
|---|---|---|
| 130 | 130 | else |
| 131 | 131 | { |
| 132 | 132 | const device_config *mc6845 = devtag_get_device(screen->machine, MC6845_TAG); |
| 133 | ||
| 133 | ||
| 134 | 134 | mc6845_update(mc6845, bitmap, cliprect); |
| 135 | 135 | } |
| 136 | 136 |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | * |
| 12 | 12 | ****************************************************************************/ |
| 13 | 13 | |
| 14 | // there're many chips; we use for PAL: 6569 and for NTSC 6567R8 | |
| 14 | // there're many chips; we use for PAL: 6569 and for NTSC 6567R8 | |
| 15 | 15 | |
| 16 | 16 | #ifndef VIC6567_H_ |
| 17 | 17 | #define VIC6567_H_ |
| r5932 | r5933 | |
|---|---|---|
| 21 | 21 | UINT8 code, line; |
| 22 | 22 | int y, x, b,i; |
| 23 | 23 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 24 | ||
| 24 | ||
| 25 | 25 | for(y = 0; y < 32; y++ ) |
| 26 | 26 | { |
| 27 | 27 | for(x = 0; x < 32; x++ ) |
| r5932 | r5933 | |
|---|---|---|
| 31 | 31 | { |
| 32 | 32 | /* |
| 33 | 33 | |
| 34 | ||
| 34 | PAL16R4 equation: | |
| 35 | 35 | |
| 36 | IF (VCC) *OS = FC + RF / RC | |
| 37 | *RG: = HS / *RG + *ATE / *RG + ATD / *RG + LL / | |
| 38 | *RG + AT1 / *RG + AT0 / ATE + *ATD + *LL + | |
| 39 | *AT1 + *AT0 | |
| 40 | *RI: = *RI + *INV / *RI + LL / *INV + *LL | |
| 41 | *RF: = HS / *RF + *ATE / *RF + ATD / *RF + LL / | |
| 42 | *RF + AT1 / *RF + AT0 / ATE + *ATD + *LL + | |
| 43 | *AT1 + AT0 | |
| 44 | *RC: = HS / *RC + *ATE / *RC + *ATD / *RC + LL / | |
| 45 | *RC + *ATI / *RC + AT0 / ATE + *LL + *AT1 + | |
| 46 | *AT0 | |
| 47 | IF (VCC) *O0 = *CUR + *AT0 / *CUR + ATE | |
| 48 | *O1 = *CUR + *AT1 / *CUR + ATE | |
| 36 | IF (VCC) *OS = FC + RF / RC | |
| 37 | *RG: = HS / *RG + *ATE / *RG + ATD / *RG + LL / | |
| 38 | *RG + AT1 / *RG + AT0 / ATE + *ATD + *LL + | |
| 39 | *AT1 + *AT0 | |
| 40 | *RI: = *RI + *INV / *RI + LL / *INV + *LL | |
| 41 | *RF: = HS / *RF + *ATE / *RF + ATD / *RF + LL / | |
| 42 | *RF + AT1 / *RF + AT0 / ATE + *ATD + *LL + | |
| 43 | *AT1 + AT0 | |
| 44 | *RC: = HS / *RC + *ATE / *RC + *ATD / *RC + LL / | |
| 45 | *RC + *ATI / *RC + AT0 / ATE + *LL + *AT1 + | |
| 46 | *AT0 | |
| 47 | IF (VCC) *O0 = *CUR + *AT0 / *CUR + ATE | |
| 48 | *O1 = *CUR + *AT1 / *CUR + ATE | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | + = AND | |
| 52 | / = OR | |
| 53 | * = Inverted | |
| 51 | + = AND | |
| 52 | / = OR | |
| 53 | * = Inverted | |
| 54 | 54 | |
| 55 | ATD Attribute data | |
| 56 | ATE Attribute enable | |
| 57 | AT0,AT1 Attribute address | |
| 58 | CUR Cursor | |
| 59 | FC FLSH clock | |
| 60 | HS Horizontal sync | |
| 61 | INV Inverted signal input | |
| 62 | LL Load when Low | |
| 63 | OEL Output Enable when Low | |
| 64 | RC Row clear | |
| 65 | RF Row flash | |
| 66 | RG Row graphic | |
| 67 | RI Row inverted | |
| 55 | ATD Attribute data | |
| 56 | ATE Attribute enable | |
| 57 | AT0,AT1 Attribute address | |
| 58 | CUR Cursor | |
| 59 | FC FLSH clock | |
| 60 | HS Horizontal sync | |
| 61 | INV Inverted signal input | |
| 62 | LL Load when Low | |
| 63 | OEL Output Enable when Low | |
| 64 | RC Row clear | |
| 65 | RF Row flash | |
| 66 | RG Row graphic | |
| 67 | RI Row inverted | |
| 68 | 68 | |
| 69 | ||
| 69 | */ | |
| 70 | 70 | |
| 71 | 71 | abc802_state *state = device->machine->driver_data; |
| 72 | 72 | |
| 73 | 73 | int column; |
| 74 | 74 | int rf = 0, rc = 0, rg = 0; |
| 75 | ||
| 75 | ||
| 76 | 76 | /* prevent wraparound */ |
| 77 | 77 | if (y >= 240) return; |
| 78 | ||
| 78 | ||
| 79 | 79 | y += 29; |
| 80 | 80 | |
| 81 | 81 | for (column = 0; column < x_count; column++) |
| r5932 | r5933 | |
| 210 | 210 | static VIDEO_START( abc802 ) |
| 211 | 211 | { |
| 212 | 212 | abc802_state *state = machine->driver_data; |
| 213 | ||
| 213 | ||
| 214 | 214 | /* allocate memory */ |
| 215 | 215 | |
| 216 | 216 | state->charram = auto_alloc_array(machine, UINT8, ABC802_CHAR_RAM_SIZE); |
| r5932 | r5933 | |
| 237 | 237 | static VIDEO_UPDATE( abc802 ) |
| 238 | 238 | { |
| 239 | 239 | abc802_state *state = screen->machine->driver_data; |
| 240 | ||
| 240 | ||
| 241 | 241 | /* expand visible area to workaround MC6845 */ |
| 242 | 242 | video_screen_set_visarea(screen, 0, 767, 0, 311); |
| 243 | 243 | |
| 244 | 244 | /* draw text */ |
| 245 | 245 | mc6845_update(state->mc6845, bitmap, cliprect); |
| 246 | ||
| 246 | ||
| 247 | 247 | return 0; |
| 248 | 248 | } |
| 249 | 249 |
| r5932 | r5933 | |
|---|---|---|
| 33 | 33 | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = col; |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | } | |
| 36 | } | |
| 37 | 37 | return 0; |
| 38 | 38 | } |
| 39 | 39 |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | #include "includes/trs80.h" |
| 10 | 10 | |
| 11 | 11 | /* Bit assignment for "trs80_mode" |
| 12 | d7 Page select | |
| 13 | d6 LNW80 switch to graphics ram | |
| 14 | d5 LNW80 colour or monochrome (1=colour) | |
| 15 | d4 LNW80 lores or hires (1=hires) also does 64 or 80 chars per line | |
| 16 | d3 LNW80 invert entire screen / Model III/4 Invert characters with bit 7 set (1=invert) | |
| 17 | d2 80/40 or 64/32 characters per line (1=80) | |
| 18 | d1 7 or 8 bit video (1=requires 7-bit, 0=don't care) | |
| 19 | d0 80/64 or 40/32 characters per line (1=32) */ | |
| 12 | d7 Page select | |
| 13 | d6 LNW80 switch to graphics ram | |
| 14 | d5 LNW80 colour or monochrome (1=colour) | |
| 15 | d4 LNW80 lores or hires (1=hires) also does 64 or 80 chars per line | |
| 16 | d3 LNW80 invert entire screen / Model III/4 Invert characters with bit 7 set (1=invert) | |
| 17 | d2 80/40 or 64/32 characters per line (1=80) | |
| 18 | d1 7 or 8 bit video (1=requires 7-bit, 0=don't care) | |
| 19 | d0 80/64 or 40/32 characters per line (1=32) */ | |
| 20 | 20 | |
| 21 | 21 | static UINT16 start_address=0; |
| 22 | 22 | static UINT8 crtc_reg; |
| r5932 | r5933 | |
| 25 | 25 | WRITE8_HANDLER( trs80m4_88_w ) |
| 26 | 26 | { |
| 27 | 27 | /* This is for the programming of the CRTC registers. |
| 28 | However this CRTC is mask-programmed, and only the | |
| 29 | start address register can be used. The cursor and | |
| 30 | light-pen facilities are ignored. The character clock | |
| 31 | is changed depending on the screen size chosen. | |
| 32 | Therefore it is easier to use normal | |
| 33 | coding rather than the mc6845 device. */ | |
| 28 | However this CRTC is mask-programmed, and only the | |
| 29 | start address register can be used. The cursor and | |
| 30 | light-pen facilities are ignored. The character clock | |
| 31 | is changed depending on the screen size chosen. | |
| 32 | Therefore it is easier to use normal | |
| 33 | coding rather than the mc6845 device. */ | |
| 34 | 34 | |
| 35 | 35 | if (!offset) crtc_reg = data & 0x1f; |
| 36 | 36 | |
| r5932 | r5933 | |
| 84 | 84 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 85 | 85 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 86 | 86 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 87 | gfxbit <<= 1; | |
| 87 | gfxbit <<= 1; | |
| 88 | 88 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 89 | 89 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 90 | 90 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| r5932 | r5933 | |
| 209 | 209 | return 0; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | /* 7 or 8-bit video, 64/32 characters per line = ht1080z, ht1080z2, ht108064 */ | |
| 212 | /* 7 or 8-bit video, 64/32 characters per line = ht1080z, ht1080z2, ht108064 */ | |
| 213 | 213 | VIDEO_UPDATE( ht1080z ) |
| 214 | 214 | { |
| 215 | 215 | UINT8 y,ra,chr,gfx,gfxbit; |
| r5932 | r5933 | |
| 241 | 241 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 242 | 242 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 243 | 243 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 244 | gfxbit <<= 1; | |
| 244 | gfxbit <<= 1; | |
| 245 | 245 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 246 | 246 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| 247 | 247 | *p++ = ( chr & gfxbit ) ? 1 : 0; |
| r5932 | r5933 | |
| 276 | 276 | UINT16 sy=0,ma=0,x,y,ra; |
| 277 | 277 | UINT8 *FNT = memory_region(screen->machine, "gfx1"); |
| 278 | 278 | UINT8 cols = (trs80_mode & 0x10) ? 80 : 64; |
| 279 | ||
| 279 | ||
| 280 | 280 | /* Although the OS can select 32-character mode, it is not supported by hardware */ |
| 281 | 281 | if (trs80_mode != trs80_size_store) |
| 282 | 282 | { |
| r5932 | r5933 | |
| 310 | 310 | *p++ = ( chr & gfxbit ) ? fg : bg; |
| 311 | 311 | *p++ = ( chr & gfxbit ) ? fg : bg; |
| 312 | 312 | *p++ = ( chr & gfxbit ) ? fg : bg; |
| 313 | gfxbit <<= 1; | |
| 313 | gfxbit <<= 1; | |
| 314 | 314 | *p++ = ( chr & gfxbit ) ? fg : bg; |
| 315 | 315 | *p++ = ( chr & gfxbit ) ? fg : bg; |
| 316 | 316 | *p++ = ( chr & gfxbit ) ? fg : bg; |
| r5932 | r5933 | |
| 346 | 346 | |
| 347 | 347 | for (x = 0; x < 0x40; x++) |
| 348 | 348 | { |
| 349 | gfx = gfxram[ y | x | ra]; | |
| 349 | gfx = gfxram[ y | x | ra]; | |
| 350 | 350 | /* Display 6 pixels in normal region */ |
| 351 | 351 | *p++ = ( gfx & 0x01 ) ? fg : bg; |
| 352 | 352 | *p++ = ( gfx & 0x02 ) ? fg : bg; |
| r5932 | r5933 | |
| 358 | 358 | |
| 359 | 359 | for (x = 0; x < 0x10; x++) |
| 360 | 360 | { |
| 361 | gfx = gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; | |
| 361 | gfx = gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; | |
| 362 | 362 | /* Display 6 pixels in extended region */ |
| 363 | 363 | *p++ = ( gfx & 0x01 ) ? fg : bg; |
| 364 | 364 | *p++ = ( gfx & 0x02 ) ? fg : bg; |
| r5932 | r5933 | |
| 373 | 373 | |
| 374 | 374 | case 0x20: // MODE 2 |
| 375 | 375 | /* it seems the text video ram can have an effect in this mode, |
| 376 | ||
| 376 | not explained clearly, so not emulated */ | |
| 377 | 377 | for (y = 0; y < 0x400; y+=0x40) |
| 378 | 378 | { |
| 379 | 379 | for (ra = 0; ra < 0x3000; ra+=0x400) |
| r5932 | r5933 | |
| 382 | 382 | |
| 383 | 383 | for (x = 0; x < 0x40; x++) |
| 384 | 384 | { |
| 385 | gfx = gfxram[ y | x | ra]; | |
| 385 | gfx = gfxram[ y | x | ra]; | |
| 386 | 386 | /* Display 6 pixels in normal region */ |
| 387 | 387 | fg = (gfx & 0x38) >> 3; |
| 388 | 388 | *p++ = fg; |
| r5932 | r5933 | |
| 399 | 399 | |
| 400 | 400 | case 0x30: // MODE 3 |
| 401 | 401 | /* the manual does not explain at all how colour is determined |
| 402 | for the extended area. Further, the background colour | |
| 403 | is not mentioned anywhere. Black is assumed. */ | |
| 402 | for the extended area. Further, the background colour | |
| 403 | is not mentioned anywhere. Black is assumed. */ | |
| 404 | 404 | for (y = 0; y < 0x400; y+=0x40) |
| 405 | 405 | { |
| 406 | 406 | for (ra = 0; ra < 0x3000; ra+=0x400) |
| r5932 | r5933 | |
| 410 | 410 | for (x = 0; x < 0x40; x++) |
| 411 | 411 | { |
| 412 | 412 | gfx = gfxram[ y | x | ra]; |
| 413 | fg = (videoram[ 0x3c00 | x | y ] & 0x38) >> 3; | |
| 413 | fg = (videoram[ 0x3c00 | x | y ] & 0x38) >> 3; | |
| 414 | 414 | /* Display 6 pixels in normal region */ |
| 415 | 415 | *p++ = ( gfx & 0x01 ) ? fg : bg; |
| 416 | 416 | *p++ = ( gfx & 0x02 ) ? fg : bg; |
| 417 | 417 | *p++ = ( gfx & 0x04 ) ? fg : bg; |
| 418 | fg = videoram[ 0x3c00 | x | y ] & 0x07; | |
| 418 | fg = videoram[ 0x3c00 | x | y ] & 0x07; | |
| 419 | 419 | *p++ = ( gfx & 0x08 ) ? fg : bg; |
| 420 | 420 | *p++ = ( gfx & 0x10 ) ? fg : bg; |
| 421 | 421 | *p++ = ( gfx & 0x20 ) ? fg : bg; |
| r5932 | r5933 | |
| 423 | 423 | |
| 424 | 424 | for (x = 0; x < 0x10; x++) |
| 425 | 425 | { |
| 426 | gfx = gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; | |
| 427 | fg = (gfxram[ 0x3c00 | x | y ] & 0x38) >> 3; | |
| 426 | gfx = gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; | |
| 427 | fg = (gfxram[ 0x3c00 | x | y ] & 0x38) >> 3; | |
| 428 | 428 | /* Display 6 pixels in extended region */ |
| 429 | 429 | *p++ = ( gfx & 0x01 ) ? fg : bg; |
| 430 | 430 | *p++ = ( gfx & 0x02 ) ? fg : bg; |
| 431 | 431 | *p++ = ( gfx & 0x04 ) ? fg : bg; |
| 432 | fg = gfxram[ 0x3c00 | x | y ] & 0x07; | |
| 432 | fg = gfxram[ 0x3c00 | x | y ] & 0x07; | |
| 433 | 433 | *p++ = ( gfx & 0x08 ) ? fg : bg; |
| 434 | 434 | *p++ = ( gfx & 0x10 ) ? fg : bg; |
| 435 | 435 | *p++ = ( gfx & 0x20 ) ? fg : bg; |
| r5932 | r5933 | |
|---|---|---|
| 174 | 174 | { |
| 175 | 175 | int i; |
| 176 | 176 | |
| 177 | for ( i = 0; i < 24; i++ ) | |
| 177 | for ( i = 0; i < 24; i++ ) | |
| 178 | 178 | { |
| 179 | 179 | palette_set_color_rgb( machine, i, odyssey2_colors[i*3], odyssey2_colors[i*3+1], odyssey2_colors[i*3+2] ); |
| 180 | 180 | } |
| r5932 | r5933 | |
| 191 | 191 | iff = 0; |
| 192 | 192 | cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); |
| 193 | 193 | control_status &= ~ 0x08; |
| 194 | if ( video_screen_get_hpos( space->machine->primary_screen ) < I824X_START_ACTIVE_SCAN || video_screen_get_hpos( space->machine->primary_screen ) > I824X_END_ACTIVE_SCAN ) | |
| 194 | if ( video_screen_get_hpos( space->machine->primary_screen ) < I824X_START_ACTIVE_SCAN || video_screen_get_hpos( space->machine->primary_screen ) > I824X_END_ACTIVE_SCAN ) | |
| 195 | 195 | { |
| 196 | 196 | data |= 1; |
| 197 | 197 | } |
| r5932 | r5933 | |
| 216 | 216 | |
| 217 | 217 | case 0xa5: |
| 218 | 218 | |
| 219 | if ((o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY)) | |
| 219 | if ((o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY)) | |
| 220 | 220 | { |
| 221 | 221 | x_beam_pos = video_screen_get_hpos( space->machine->primary_screen ); |
| 222 | if ( x_beam_pos < I824X_START_ACTIVE_SCAN ) | |
| 222 | if ( x_beam_pos < I824X_START_ACTIVE_SCAN ) | |
| 223 | 223 | { |
| 224 | 224 | x_beam_pos = x_beam_pos - I824X_START_ACTIVE_SCAN + I824X_LINE_CLOCKS; |
| 225 | } | |
| 226 | else | |
| 225 | } | |
| 226 | else | |
| 227 | 227 | { |
| 228 | 228 | x_beam_pos = x_beam_pos - I824X_START_ACTIVE_SCAN; |
| 229 | 229 | } |
| r5932 | r5933 | |
| 253 | 253 | { |
| 254 | 254 | /* Toggling strobe bit, tuck away values */ |
| 255 | 255 | x_beam_pos = video_screen_get_hpos( space->machine->primary_screen ); |
| 256 | if ( x_beam_pos < I824X_START_ACTIVE_SCAN ) | |
| 256 | if ( x_beam_pos < I824X_START_ACTIVE_SCAN ) | |
| 257 | 257 | { |
| 258 | 258 | x_beam_pos = x_beam_pos - I824X_START_ACTIVE_SCAN + 228; |
| 259 | } | |
| 260 | else | |
| 259 | } | |
| 260 | else | |
| 261 | 261 | { |
| 262 | 262 | x_beam_pos = x_beam_pos - I824X_START_ACTIVE_SCAN; |
| 263 | 263 | } |
| r5932 | r5933 | |
| 277 | 277 | o2_vdc.reg[offset] = data; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | WRITE8_HANDLER ( odyssey2_lum_w ) | |
| 280 | WRITE8_HANDLER ( odyssey2_lum_w ) | |
| 281 | 281 | { |
| 282 | 282 | lum = data; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | READ8_HANDLER( odyssey2_t1_r ) |
| 286 | 286 | { |
| 287 | if ( video_screen_get_vpos( space->machine->primary_screen ) > start_vpos && video_screen_get_vpos( space->machine->primary_screen ) < start_vblank ) | |
| 287 | if ( video_screen_get_vpos( space->machine->primary_screen ) > start_vpos && video_screen_get_vpos( space->machine->primary_screen ) < start_vblank ) | |
| 288 | 288 | { |
| 289 | if ( video_screen_get_hpos( space->machine->primary_screen ) >= I824X_START_ACTIVE_SCAN && video_screen_get_hpos( space->machine->primary_screen ) < I824X_END_ACTIVE_SCAN ) | |
| 289 | if ( video_screen_get_hpos( space->machine->primary_screen ) >= I824X_START_ACTIVE_SCAN && video_screen_get_hpos( space->machine->primary_screen ) < I824X_END_ACTIVE_SCAN ) | |
| 290 | 290 | { |
| 291 | 291 | return 1; |
| 292 | 292 | } |
| r5932 | r5933 | |
| 294 | 294 | return 0; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | static TIMER_CALLBACK( i824x_scanline_callback ) | |
| 297 | static TIMER_CALLBACK( i824x_scanline_callback ) | |
| 298 | 298 | { |
| 299 | 299 | UINT8 collision_map[160]; |
| 300 | 300 | int vpos = video_screen_get_vpos( machine->primary_screen ); |
| r5932 | r5933 | |
| 302 | 302 | if ( vpos < start_vpos ) |
| 303 | 303 | return; |
| 304 | 304 | |
| 305 | if ( vpos == start_vpos ) | |
| 305 | if ( vpos == start_vpos ) | |
| 306 | 306 | { |
| 307 | 307 | control_status &= ~0x08; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | if ( vpos < start_vblank ) | |
| 310 | if ( vpos < start_vblank ) | |
| 311 | 311 | { |
| 312 | 312 | rectangle rect; |
| 313 | 313 | int sprite_width[4] = { 8, 8, 8, 8 }; |
| r5932 | r5933 | |
| 325 | 325 | memset( collision_map, 0, sizeof( collision_map ) ); |
| 326 | 326 | |
| 327 | 327 | /* Display grid if enabled */ |
| 328 | if ( o2_vdc.s.control & 0x08 ) | |
| 328 | if ( o2_vdc.s.control & 0x08 ) | |
| 329 | 329 | { |
| 330 | 330 | UINT16 color = ( o2_vdc.s.color & 7 ) | ( ( o2_vdc.s.color >> 3 ) & 0x08 ) | ( ( lum << 3 ) ^ 0x08 ); |
| 331 | 331 | int x_grid_offset = 8; |
| r5932 | r5933 | |
| 336 | 336 | int j, k, y; |
| 337 | 337 | |
| 338 | 338 | /* Draw horizontal part of grid */ |
| 339 | for ( j = 1, y = 0; y < 9; y++, j <<= 1 ) | |
| 339 | for ( j = 1, y = 0; y < 9; y++, j <<= 1 ) | |
| 340 | 340 | { |
| 341 | if ( y_grid_offset + y * height <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y_grid_offset + y * height + 3 ) | |
| 341 | if ( y_grid_offset + y * height <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y_grid_offset + y * height + 3 ) | |
| 342 | 342 | { |
| 343 | for ( i = 0; i < 9; i++ ) | |
| 343 | for ( i = 0; i < 9; i++ ) | |
| 344 | 344 | { |
| 345 | if ( ( o2_vdc.s.hgrid[0][i] & j ) || ( o2_vdc.s.hgrid[1][i] & ( j >> 8 ) ) ) | |
| 345 | if ( ( o2_vdc.s.hgrid[0][i] & j ) || ( o2_vdc.s.hgrid[1][i] & ( j >> 8 ) ) ) | |
| 346 | 346 | { |
| 347 | for ( k = 0; k < width + 2; k++ ) | |
| 347 | for ( k = 0; k < width + 2; k++ ) | |
| 348 | 348 | { |
| 349 | 349 | int px = x_grid_offset + i * width + k; |
| 350 | 350 | collision_map[ px ] |= COLLISION_HORIZ_GRID_DOTS; |
| r5932 | r5933 | |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /* Draw vertical part of grid */ |
| 359 | for( j = 1, y = 0; y < 8; y++, j <<= 1 ) | |
| 359 | for( j = 1, y = 0; y < 8; y++, j <<= 1 ) | |
| 360 | 360 | { |
| 361 | if ( y_grid_offset + y * height <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y_grid_offset + ( y + 1 ) * height ) | |
| 361 | if ( y_grid_offset + y * height <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y_grid_offset + ( y + 1 ) * height ) | |
| 362 | 362 | { |
| 363 | for ( i = 0; i < 10; i++ ) | |
| 363 | for ( i = 0; i < 10; i++ ) | |
| 364 | 364 | { |
| 365 | if ( o2_vdc.s.vgrid[i] & j ) | |
| 365 | if ( o2_vdc.s.vgrid[i] & j ) | |
| 366 | 366 | { |
| 367 | for ( k = 0; k < w; k++ ) | |
| 367 | for ( k = 0; k < w; k++ ) | |
| 368 | 368 | { |
| 369 | 369 | int px = x_grid_offset + i * width + k; |
| 370 | 370 | |
| 371 | 371 | /* Check if we collide with an already drawn source object */ |
| 372 | if ( collision_map[ px ] & o2_vdc.s.collision ) | |
| 372 | if ( collision_map[ px ] & o2_vdc.s.collision ) | |
| 373 | 373 | { |
| 374 | 374 | collision_status |= COLLISION_VERTICAL_GRID; |
| 375 | 375 | } |
| 376 | 376 | /* Check if an already drawn object would collide with us */ |
| 377 | if ( COLLISION_VERTICAL_GRID & o2_vdc.s.collision && collision_map[ px ] ) | |
| 377 | if ( COLLISION_VERTICAL_GRID & o2_vdc.s.collision && collision_map[ px ] ) | |
| 378 | 378 | { |
| 379 | 379 | collision_status |= collision_map[ px ]; |
| 380 | 380 | } |
| r5932 | r5933 | |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | /* Display objects if enabled */ |
| 391 | if ( o2_vdc.s.control & 0x20 ) | |
| 391 | if ( o2_vdc.s.control & 0x20 ) | |
| 392 | 392 | { |
| 393 | 393 | /* Regular foreground objects */ |
| 394 | for ( i = 0; i < ARRAY_LENGTH( o2_vdc.s.foreground ); i++ ) | |
| 394 | for ( i = 0; i < ARRAY_LENGTH( o2_vdc.s.foreground ); i++ ) | |
| 395 | 395 | { |
| 396 | 396 | int y = o2_vdc.s.foreground[i].y; |
| 397 | 397 | int height = 8 - ( ( ( y >> 1 ) + o2_vdc.s.foreground[i].ptr ) & 7 ); |
| 398 | 398 | |
| 399 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 ) | |
| 399 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 ) | |
| 400 | 400 | { |
| 401 | 401 | UINT16 color = 16 + ( ( o2_vdc.s.foreground[i].color & 0x0E ) >> 1 ); |
| 402 | 402 | int offset = ( o2_vdc.s.foreground[i].ptr | ( ( o2_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( vpos - start_vpos - y ) >> 1 ); |
| r5932 | r5933 | |
| 404 | 404 | int x = o2_vdc.s.foreground[i].x; |
| 405 | 405 | UINT8 m; |
| 406 | 406 | |
| 407 | for ( m = 0x80; m > 0; m >>= 1, x++ ) | |
| 407 | for ( m = 0x80; m > 0; m >>= 1, x++ ) | |
| 408 | 408 | { |
| 409 | if ( chr & m ) | |
| 409 | if ( chr & m ) | |
| 410 | 410 | { |
| 411 | if ( x >= 0 && x < 160 ) | |
| 411 | if ( x >= 0 && x < 160 ) | |
| 412 | 412 | { |
| 413 | 413 | /* Check if we collide with an already drawn source object */ |
| 414 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 414 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 415 | 415 | { |
| 416 | 416 | collision_status |= COLLISION_CHARACTERS; |
| 417 | 417 | } |
| 418 | 418 | /* Check if an already drawn object would collide with us */ |
| 419 | if ( COLLISION_CHARACTERS & o2_vdc.s.collision && collision_map[ x ] ) | |
| 419 | if ( COLLISION_CHARACTERS & o2_vdc.s.collision && collision_map[ x ] ) | |
| 420 | 420 | { |
| 421 | 421 | collision_status |= collision_map[ x ]; |
| 422 | 422 | } |
| r5932 | r5933 | |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /* Quad objects */ |
| 432 | for ( i = 0; i < ARRAY_LENGTH( o2_vdc.s.quad ); i++ ) | |
| 432 | for ( i = 0; i < ARRAY_LENGTH( o2_vdc.s.quad ); i++ ) | |
| 433 | 433 | { |
| 434 | 434 | int y = o2_vdc.s.quad[i].single[0].y; |
| 435 | 435 | int height = 8; |
| 436 | 436 | |
| 437 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 ) | |
| 437 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 ) | |
| 438 | 438 | { |
| 439 | 439 | int x = o2_vdc.s.quad[i].single[0].x; |
| 440 | 440 | int j; |
| 441 | 441 | |
| 442 | for ( j = 0; j < ARRAY_LENGTH( o2_vdc.s.quad[0].single ); j++, x += 8 ) | |
| 442 | for ( j = 0; j < ARRAY_LENGTH( o2_vdc.s.quad[0].single ); j++, x += 8 ) | |
| 443 | 443 | { |
| 444 | 444 | int char_height = 8 - ( ( ( y >> 1 ) + o2_vdc.s.quad[i].single[j].ptr ) & 7 ); |
| 445 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + char_height * 2 ) | |
| 445 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + char_height * 2 ) | |
| 446 | 446 | { |
| 447 | 447 | UINT16 color = 16 + ( ( o2_vdc.s.quad[i].single[j].color & 0x0E ) >> 1 ); |
| 448 | 448 | int offset = ( o2_vdc.s.quad[i].single[j].ptr | ( ( o2_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( vpos - start_vpos - y ) >> 1 ); |
| 449 | 449 | UINT8 chr = ((char*)o2_shape)[ offset & 0x1FF ]; |
| 450 | 450 | UINT8 m; |
| 451 | for ( m = 0x80; m > 0; m >>= 1, x++ ) | |
| 451 | for ( m = 0x80; m > 0; m >>= 1, x++ ) | |
| 452 | 452 | { |
| 453 | if ( chr & m ) | |
| 453 | if ( chr & m ) | |
| 454 | 454 | { |
| 455 | if ( x >= 0 && x < 160 ) | |
| 455 | if ( x >= 0 && x < 160 ) | |
| 456 | 456 | { |
| 457 | 457 | /* Check if we collide with an already drawn source object */ |
| 458 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 458 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 459 | 459 | { |
| 460 | 460 | collision_status |= COLLISION_CHARACTERS; |
| 461 | 461 | } |
| 462 | 462 | /* Check if an already drawn object would collide with us */ |
| 463 | if ( COLLISION_CHARACTERS & o2_vdc.s.collision && collision_map[ x ] ) | |
| 463 | if ( COLLISION_CHARACTERS & o2_vdc.s.collision && collision_map[ x ] ) | |
| 464 | 464 | { |
| 465 | 465 | collision_status |= collision_map[ x ]; |
| 466 | 466 | } |
| r5932 | r5933 | |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | } | |
| 473 | else | |
| 472 | } | |
| 473 | else | |
| 474 | 474 | { |
| 475 | 475 | x += 8; |
| 476 | 476 | } |
| r5932 | r5933 | |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /* Sprites */ |
| 482 | for ( i = 0; i < ARRAY_LENGTH( o2_vdc.s.sprites ); i++ ) | |
| 482 | for ( i = 0; i < ARRAY_LENGTH( o2_vdc.s.sprites ); i++ ) | |
| 483 | 483 | { |
| 484 | 484 | int y = o2_vdc.s.sprites[i].y; |
| 485 | 485 | int height = 8; |
| 486 | if ( o2_vdc.s.sprites[i].color & 4 ) | |
| 486 | if ( o2_vdc.s.sprites[i].color & 4 ) | |
| 487 | 487 | { |
| 488 | 488 | /* Zoomed sprite */ |
| 489 | 489 | sprite_width[i] = 16; |
| 490 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 4 ) | |
| 490 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 4 ) | |
| 491 | 491 | { |
| 492 | 492 | UINT16 color = 16 + ( ( o2_vdc.s.sprites[i].color >> 3 ) & 0x07 ); |
| 493 | 493 | UINT8 chr = o2_vdc.s.shape[i][ ( ( vpos - start_vpos - y ) >> 2 ) ]; |
| r5932 | r5933 | |
| 496 | 496 | |
| 497 | 497 | for ( m = 0x01; m > 0; m <<= 1, x += 2 ) |
| 498 | 498 | { |
| 499 | if ( chr & m ) | |
| 499 | if ( chr & m ) | |
| 500 | 500 | { |
| 501 | if ( x >= 0 && x < 160 ) | |
| 501 | if ( x >= 0 && x < 160 ) | |
| 502 | 502 | { |
| 503 | 503 | /* Check if we collide with an already drawn source object */ |
| 504 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 504 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 505 | 505 | { |
| 506 | 506 | collision_status |= ( 1 << i ); |
| 507 | 507 | } |
| 508 | 508 | /* Check if an already drawn object would collide with us */ |
| 509 | if ( ( 1 << i ) & o2_vdc.s.collision && collision_map[ x ] ) | |
| 509 | if ( ( 1 << i ) & o2_vdc.s.collision && collision_map[ x ] ) | |
| 510 | 510 | { |
| 511 | 511 | collision_status |= collision_map[ x ]; |
| 512 | 512 | } |
| 513 | 513 | collision_map[ x ] |= ( 1 << i ); |
| 514 | 514 | *BITMAP_ADDR16( tmp_bitmap, vpos, I824X_START_ACTIVE_SCAN + x ) = color; |
| 515 | 515 | } |
| 516 | if ( x >= -1 && x < 159 ) | |
| 516 | if ( x >= -1 && x < 159 ) | |
| 517 | 517 | { |
| 518 | 518 | /* Check if we collide with an already drawn source object */ |
| 519 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 519 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 520 | 520 | { |
| 521 | 521 | collision_status |= ( 1 << i ); |
| 522 | 522 | } |
| 523 | 523 | /* Check if an already drawn object would collide with us */ |
| 524 | if ( ( 1 << i ) & o2_vdc.s.collision && collision_map[ x ] ) | |
| 524 | if ( ( 1 << i ) & o2_vdc.s.collision && collision_map[ x ] ) | |
| 525 | 525 | { |
| 526 | 526 | collision_status |= collision_map[ x ]; |
| 527 | 527 | } |
| r5932 | r5933 | |
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | } | |
| 535 | else | |
| 534 | } | |
| 535 | else | |
| 536 | 536 | { |
| 537 | 537 | /* Regular sprite */ |
| 538 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 ) | |
| 538 | if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 ) | |
| 539 | 539 | { |
| 540 | 540 | UINT16 color = 16 + ( ( o2_vdc.s.sprites[i].color >> 3 ) & 0x07 ); |
| 541 | 541 | UINT8 chr = o2_vdc.s.shape[i][ ( ( vpos - start_vpos - y ) >> 1 ) ]; |
| 542 | 542 | int x = o2_vdc.s.sprites[i].x; |
| 543 | 543 | UINT8 m; |
| 544 | 544 | |
| 545 | for ( m = 0x01; m > 0; m <<= 1, x++ ) | |
| 545 | for ( m = 0x01; m > 0; m <<= 1, x++ ) | |
| 546 | 546 | { |
| 547 | 547 | if ( chr & m ) |
| 548 | 548 | { |
| 549 | if ( x >= 0 && x < 160 ) | |
| 549 | if ( x >= 0 && x < 160 ) | |
| 550 | 550 | { |
| 551 | 551 | /* Check if we collide with an already drawn source object */ |
| 552 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 552 | if ( collision_map[ x ] & o2_vdc.s.collision ) | |
| 553 | 553 | { |
| 554 | 554 | collision_status |= ( 1 << i ); |
| 555 | 555 | } |
| 556 | 556 | /* Check if an already drawn object would collide with us */ |
| 557 | if ( ( 1 << i ) & o2_vdc.s.collision && collision_map[ x ] ) | |
| 557 | if ( ( 1 << i ) & o2_vdc.s.collision && collision_map[ x ] ) | |
| 558 | 558 | { |
| 559 | 559 | collision_status |= collision_map[ x ]; |
| 560 | 560 | } |
| r5932 | r5933 | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | /* Check for start of VBlank */ |
| 573 | if ( vpos == start_vblank ) | |
| 573 | if ( vpos == start_vblank ) | |
| 574 | 574 | { |
| 575 | 575 | control_status |= 0x08; |
| 576 | if ( ! iff ) | |
| 576 | if ( ! iff ) | |
| 577 | 577 | { |
| 578 | 578 | cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); |
| 579 | 579 | iff = 1; |
| r5932 | r5933 | |
| 581 | 581 | } |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | static TIMER_CALLBACK( i824x_hblank_callback ) | |
| 584 | static TIMER_CALLBACK( i824x_hblank_callback ) | |
| 585 | 585 | { |
| 586 | 586 | int vpos = video_screen_get_vpos( machine->primary_screen ); |
| 587 | 587 | |
| 588 | 588 | if ( vpos < start_vpos - 1 ) |
| 589 | 589 | return; |
| 590 | 590 | |
| 591 | if ( vpos < start_vblank - 1 ) | |
| 591 | if ( vpos < start_vblank - 1 ) | |
| 592 | 592 | { |
| 593 | 593 | control_status |= 0x01; |
| 594 | 594 | } |
| r5932 | r5933 | |
| 684 | 684 | } |
| 685 | 685 | /* Noise poly is : L=16 W=2 10000000000100001 */ |
| 686 | 686 | lfsr = ( lfsr >> 1 ) | ( ( ( lfsr & 0x01 ) ^ ( ( lfsr & 0x800 ) >> 11 ) ) << 15 ); |
| 687 | if ( ! lfsr ) | |
| 687 | if ( ! lfsr ) | |
| 688 | 688 | { |
| 689 | 689 | lfsr = 0xFFFF; |
| 690 | 690 | } |
| 691 | 691 | /* Check if noise should be applied */ |
| 692 | if ( o2_vdc.s.sound & 0x10 ) | |
| 692 | if ( o2_vdc.s.sound & 0x10 ) | |
| 693 | 693 | { |
| 694 | 694 | *buffer |= ( lfsr & 0x01 ); |
| 695 | 695 | } |
| r5932 | r5933 | |
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | /* |
| 722 | ||
| 722 | Thomson EF9340/EF9341 extra chips in the g7400 | |
| 723 | 723 | */ |
| 724 | 724 | |
| 725 | 725 | static struct { |
| r5932 | r5933 | |
| 734 | 734 | UINT8 ram[1024]; |
| 735 | 735 | } ef9341; |
| 736 | 736 | |
| 737 | INLINE UINT16 ef9341_get_c_addr( void ) | |
| 737 | INLINE UINT16 ef9341_get_c_addr( void ) | |
| 738 | 738 | { |
| 739 | if ( ( ef9341.Y & 0x0C ) == 0x0C ) | |
| 739 | if ( ( ef9341.Y & 0x0C ) == 0x0C ) | |
| 740 | 740 | { |
| 741 | 741 | return 0x318 | ( ( ef9341.X & 0x38 ) << 2 ) | ( ef9341.X & 0x07 ); |
| 742 | 742 | } |
| 743 | if ( ef9341.X & 0x20 ) | |
| 743 | if ( ef9341.X & 0x20 ) | |
| 744 | 744 | { |
| 745 | 745 | return 0x300 | ( ( ef9341.Y & 0x07 ) << 5 ) | ( ef9341.Y & 0x18 ) | ( ef9341.X & 0x07 ); |
| 746 | 746 | } |
| 747 | 747 | return ( ef9341.Y << 5 ) | ef9341.X; |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | INLINE void ef9341_inc_c( void ) | |
| 750 | INLINE void ef9341_inc_c( void ) | |
| 751 | 751 | { |
| 752 | 752 | ef9341.X++; |
| 753 | if ( ef9341.X >= 40 ) | |
| 753 | if ( ef9341.X >= 40 ) | |
| 754 | 754 | { |
| 755 | 755 | ef9341.Y = ( ef9341.Y + 1 ) % 24; |
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | void ef9341_w( int command, int b, UINT8 data ) | |
| 759 | void ef9341_w( int command, int b, UINT8 data ) | |
| 760 | 760 | { |
| 761 | 761 | logerror("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data ); |
| 762 | 762 | |
| 763 | if ( command ) | |
| 763 | if ( command ) | |
| 764 | 764 | { |
| 765 | if ( b ) | |
| 765 | if ( b ) | |
| 766 | 766 | { |
| 767 | 767 | ef9341.TB = data; |
| 768 | 768 | ef9341.busy = 0x80; |
| 769 | switch( ef9341.TB & 0xE0 ) | |
| 769 | switch( ef9341.TB & 0xE0 ) | |
| 770 | 770 | { |
| 771 | 771 | case 0x00: /* Begin row */ |
| 772 | 772 | ef9341.X = 0; |
| r5932 | r5933 | |
| 792 | 792 | break; |
| 793 | 793 | } |
| 794 | 794 | ef9341.busy = 0; |
| 795 | } | |
| 796 | else | |
| 795 | } | |
| 796 | else | |
| 797 | 797 | { |
| 798 | 798 | ef9341.TA = data; |
| 799 | 799 | } |
| 800 | } | |
| 801 | else | |
| 800 | } | |
| 801 | else | |
| 802 | 802 | { |
| 803 | if ( b ) | |
| 803 | if ( b ) | |
| 804 | 804 | { |
| 805 | 805 | ef9341.TB = data; |
| 806 | 806 | ef9341.busy = 0x80; |
| 807 | switch ( ef9341.M & 0xE0 ) | |
| 807 | switch ( ef9341.M & 0xE0 ) | |
| 808 | 808 | { |
| 809 | 809 | case 0x00: /* Write */ |
| 810 | 810 | ef9341.ram[ ef9341_get_c_addr() ] = ef9341.TB; |
| r5932 | r5933 | |
| 822 | 822 | break; |
| 823 | 823 | } |
| 824 | 824 | ef9341.busy = 0; |
| 825 | } | |
| 826 | else | |
| 825 | } | |
| 826 | else | |
| 827 | 827 | { |
| 828 | 828 | ef9341.TA = data; |
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | UINT8 ef9341_r( int command, int b ) | |
| 833 | UINT8 ef9341_r( int command, int b ) | |
| 834 | 834 | { |
| 835 | 835 | UINT8 data = 0xFF; |
| 836 | 836 | |
| 837 | 837 | logerror("ef9341 %s read, t%s\n", command ? "command" : "data", b ? "B" : "A" ); |
| 838 | if ( command ) | |
| 838 | if ( command ) | |
| 839 | 839 | { |
| 840 | if ( b ) | |
| 840 | if ( b ) | |
| 841 | 841 | { |
| 842 | 842 | data = 0xFF; |
| 843 | } | |
| 844 | else | |
| 843 | } | |
| 844 | else | |
| 845 | 845 | { |
| 846 | 846 | data = ef9341.busy; |
| 847 | 847 | } |
| 848 | } | |
| 849 | else | |
| 848 | } | |
| 849 | else | |
| 850 | 850 | { |
| 851 | if ( b ) | |
| 851 | if ( b ) | |
| 852 | 852 | { |
| 853 | 853 | data = ef9341.TB; |
| 854 | 854 | ef9341.busy = 0x80; |
| 855 | } | |
| 856 | else | |
| 855 | } | |
| 856 | else | |
| 857 | 857 | { |
| 858 | 858 | data = ef9341.TA; |
| 859 | 859 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /************************************************************************ |
| 2 | ||
| 2 | crct6845 | |
| 3 | 3 | |
| 4 | ||
| 4 | MESS Driver By: | |
| 5 | 5 | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 8 | 8 | |
| 9 | 9 | ************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 47 | 47 | /* *** Part not implemented *** |
| 48 | 48 | R8 interlace settings |
| 49 | 49 | Interlace mode (bits 0,1) |
| 50 | Bit 1 Bit 0 Description | |
| 51 | 0 0 Normal (non-interlaced) sync mode | |
| 52 | 1 0 Normal (non-interlaced) sync mode | |
| 53 | 0 1 Interlace sync mode | |
| 54 | 1 1 Interlace sync and video | |
| 50 | Bit 1 Bit 0 Description | |
| 51 | 0 0 Normal (non-interlaced) sync mode | |
| 52 | 1 0 Normal (non-interlaced) sync mode | |
| 53 | 0 1 Interlace sync mode | |
| 54 | 1 1 Interlace sync and video | |
| 55 | 55 | */ |
| 56 | 56 | #define R8_interlace_display_enabled crtc.registers[8] |
| 57 | 57 | /* scan lines per character -1 */ |
| 58 | 58 | #define R9_scan_lines_per_character crtc.registers[9] |
| 59 | 59 | /* *** Part not implemented yet *** |
| 60 | 60 | R10 The cursor start register |
| 61 | Bit 6 Bit 5 | |
| 62 | 0 0 Solid cursor | |
| 63 | 0 1 No cursor (This no cursor setting is working) | |
| 64 | 1 0 slow flashing cursor | |
| 65 | 1 1 fast flashing cursor | |
| 61 | Bit 6 Bit 5 | |
| 62 | 0 0 Solid cursor | |
| 63 | 0 1 No cursor (This no cursor setting is working) | |
| 64 | 1 0 slow flashing cursor | |
| 65 | 1 1 fast flashing cursor | |
| 66 | 66 | */ |
| 67 | 67 | #define R10_cursor_start crtc.registers[10] |
| 68 | 68 | /* cursor end row */ |
| r5932 | r5933 | |
| 135 | 135 | int Display_Disable_Delay; |
| 136 | 136 | |
| 137 | 137 | int Vertical_Adjust_Done; |
| 138 | // int cycles_to_vsync_start; | |
| 139 | // int cycles_to_vsync_end; | |
| 138 | // int cycles_to_vsync_start; | |
| 139 | // int cycles_to_vsync_end; | |
| 140 | 140 | } m6845_state; |
| 141 | 141 | |
| 142 | 142 | |
| r5932 | r5933 | |
| 461 | 461 | crtc.Memory_Address=(crtc.Memory_Address_of_this_Character_Row=crtc.Memory_Address_of_next_Character_Row); |
| 462 | 462 | |
| 463 | 463 | /* Character row clock pulse (R9 CO out) */ |
| 464 | /* | |
| 464 | /* crtc.Character_Row_Counter=(crtc.Character_Row_Counter+1)%128;*/ | |
| 465 | 465 | crtc.Character_Row_Counter=(crtc.Character_Row_Counter+1)&0x07f; |
| 466 | 466 | if (crtc.Character_Row_Counter_Reset) |
| 467 | 467 | { |
| 468 | 468 | crtc.Character_Row_Counter_Reset=False; |
| 469 | 469 | |
| 470 | 470 | /* if vertical adjust is set, the first time it will do the vertical, adjust, the |
| 471 | ||
| 471 | next time, it will not do it and complete the frame */ | |
| 472 | 472 | |
| 473 | 473 | /* vertical adjust set? */ |
| 474 | 474 | if (R5_vertical_total_adjust!=0) |
| r5932 | r5933 | |
| 535 | 535 | /* not active, clear counter and restart frame */ |
| 536 | 536 | crtc.Vertical_Total_Adjust_Active = False; |
| 537 | 537 | crtc.Vertical_Total_Adjust_Counter = 0; |
| 538 | // /* cause a scan-line counter reset, and a character row counter reset. | |
| 539 | // i.e. restart frame */ | |
| 540 | // crtc.Scan_Line_Counter_Reset = TRUE; | |
| 541 | // crtc.Character_Row_Counter_Reset = TRUE; | |
| 538 | // /* cause a scan-line counter reset, and a character row counter reset. | |
| 539 | // i.e. restart frame */ | |
| 540 | // crtc.Scan_Line_Counter_Reset = TRUE; | |
| 541 | // crtc.Character_Row_Counter_Reset = TRUE; | |
| 542 | 542 | |
| 543 | 543 | // KT this caused problems when R7 == 0 and R5 was set! |
| 544 | 544 | m6845_restart_frame(); |
| r5932 | r5933 | |
| 823 | 823 | int crtc_cycles_to_vsync_start; |
| 824 | 824 | |
| 825 | 825 | /* get cycles to vsync start, or if vsync cannot be reached |
| 826 | ||
| 826 | cycles will be -1 */ | |
| 827 | 827 | crtc_cycles_to_vsync_start = cycles; |
| 828 | 828 | |
| 829 | 829 | m6845_remove_vsync_set_timer(); |
| r5932 | r5933 | |
| 884 | 884 | |
| 885 | 885 | /* if we got to here the vsync has just been set, and has just started */ |
| 886 | 886 | /* the next timer will be in vsync length cycles unless it is reprogrammed as the VSYNC |
| 887 | ||
| 887 | is active, in this case, the new vsync end will be re-calculated */ | |
| 888 | 888 | |
| 889 | 889 | /* setup time for vsync clear timer */ |
| 890 | 890 | m6845_set_new_vsync_clear_time(m6845_vsync_length_in_cycles()); |
| r5932 | r5933 | |
| 897 | 897 | int cycles_to_vsync_end = m6845_cycles_to_vsync_end(); |
| 898 | 898 | |
| 899 | 899 | /* if we're in vsync, the end is important, otherwise we are waiting for the next vsync |
| 900 | ||
| 900 | to start. The start is not affected by the length of the vsync */ | |
| 901 | 901 | if (crtc.VSYNC) |
| 902 | 902 | { |
| 903 | 903 | m6845_set_new_vsync_clear_time(cycles_to_vsync_end); |
| r5932 | r5933 | |
| 909 | 909 | int cycles_to_vsync_start = m6845_cycles_to_vsync(); |
| 910 | 910 | |
| 911 | 911 | /* if we're not in vsync, the end is important, otherwise we are waiting for the end |
| 912 | ||
| 912 | of the vsync */ | |
| 913 | 913 | if (!crtc.VSYNC) |
| 914 | 914 | { |
| 915 | 915 | m6845_set_new_vsync_set_time(cycles_to_vsync_start); |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | TODO: |
| 10 | 10 | |
| 11 | ||
| 11 | - HRU II PROM reading | |
| 12 | 12 | |
| 13 | 13 | */ |
| 14 | 14 | |
| r5932 | r5933 | |
| 38 | 38 | { |
| 39 | 39 | /* |
| 40 | 40 | |
| 41 | ||
| 41 | bit signal description | |
| 42 | 42 | |
| 43 | 0 VM14 visible screen memory area bit 0 | |
| 44 | 1 VM15 visible screen memory area bit 1 | |
| 45 | 2 VM16 visible screen memory area bit 2 | |
| 46 | 3 VM17 visible screen memory area bit 3 | |
| 47 | 4 F14 cpu accessible screen memory area bit 0 | |
| 48 | 5 F15 cpu accessible screen memory area bit 1 | |
| 49 | 6 F16 cpu accessible screen memory area bit 2 | |
| 50 | 7 F17 cpu accessible screen memory area bit 3 | |
| 43 | 0 VM14 visible screen memory area bit 0 | |
| 44 | 1 VM15 visible screen memory area bit 1 | |
| 45 | 2 VM16 visible screen memory area bit 2 | |
| 46 | 3 VM17 visible screen memory area bit 3 | |
| 47 | 4 F14 cpu accessible screen memory area bit 0 | |
| 48 | 5 F15 cpu accessible screen memory area bit 1 | |
| 49 | 6 F16 cpu accessible screen memory area bit 2 | |
| 50 | 7 F17 cpu accessible screen memory area bit 3 | |
| 51 | 51 | |
| 52 | ||
| 52 | */ | |
| 53 | 53 | |
| 54 | 54 | abc806_state *state = space->machine->driver_data; |
| 55 | ||
| 55 | ||
| 56 | 56 | state->hrs = data; |
| 57 | 57 | } |
| 58 | 58 | |
| r5932 | r5933 | |
| 110 | 110 | |
| 111 | 111 | /* |
| 112 | 112 | |
| 113 | ||
| 113 | bit description | |
| 114 | 114 | |
| 115 | 0 HRU II data bit 0 | |
| 116 | 1 HRU II data bit 1 | |
| 117 | 2 HRU II data bit 2 | |
| 118 | 3 HRU II data bit 3 | |
| 119 | 4 | |
| 120 | 5 | |
| 121 | 6 | |
| 122 | 7 RTC data output | |
| 115 | 0 HRU II data bit 0 | |
| 116 | 1 HRU II data bit 1 | |
| 117 | 2 HRU II data bit 2 | |
| 118 | 3 HRU II data bit 3 | |
| 119 | 4 | |
| 120 | 5 | |
| 121 | 6 | |
| 122 | 7 RTC data output | |
| 123 | 123 | |
| 124 | ||
| 124 | */ | |
| 125 | 125 | |
| 126 | 126 | UINT16 hru2_addr = (state->hru2_a8 << 8) | (offset >> 8); |
| 127 | 127 | UINT8 data = state->hru2_prom[hru2_addr] & 0x0f; |
| r5932 | r5933 | |
| 137 | 137 | { |
| 138 | 138 | /* |
| 139 | 139 | |
| 140 | ||
| 140 | bit description | |
| 141 | 141 | |
| 142 | 0 | |
| 143 | 1 | |
| 144 | 2 | |
| 145 | 3 | |
| 146 | 4 | |
| 147 | 5 | |
| 148 | 6 | |
| 149 | 7 PROT DOUT | |
| 142 | 0 | |
| 143 | 1 | |
| 144 | 2 | |
| 145 | 3 | |
| 146 | 4 | |
| 147 | 5 | |
| 148 | 6 | |
| 149 | 7 PROT DOUT | |
| 150 | 150 | |
| 151 | ||
| 151 | */ | |
| 152 | 152 | |
| 153 | 153 | return 0x7f; |
| 154 | 154 | } |
| r5932 | r5933 | |
| 225 | 225 | if (y >= 240) return; |
| 226 | 226 | |
| 227 | 227 | y += state->sync + 27; |
| 228 | ||
| 228 | ||
| 229 | 229 | for (column = 0; column < x_count; column++) |
| 230 | 230 | { |
| 231 | 231 | UINT8 data = state->charram[(ma + column) & 0x7ff]; |
| r5932 | r5933 | |
| 312 | 312 | |
| 313 | 313 | chargen_data <<= 1; |
| 314 | 314 | } |
| 315 | ||
| 315 | ||
| 316 | 316 | if (e5 || e6) |
| 317 | 317 | { |
| 318 | 318 | column++; |
| r5932 | r5933 | |
| 425 | 425 | static VIDEO_START(abc806) |
| 426 | 426 | { |
| 427 | 427 | abc806_state *state = machine->driver_data; |
| 428 | ||
| 428 | ||
| 429 | 429 | int i; |
| 430 | 430 | |
| 431 | 431 | /* initialize variables */ |
| r5932 | r5933 | |
| 487 | 487 | |
| 488 | 488 | /* clear screen */ |
| 489 | 489 | bitmap_fill(bitmap, cliprect, 0); |
| 490 | ||
| 490 | ||
| 491 | 491 | if (!state->txoff) |
| 492 | 492 | { |
| 493 | 493 | /* draw text */ |
| r5932 | r5933 | |
| 496 | 496 | |
| 497 | 497 | /* draw HR graphics */ |
| 498 | 498 | abc806_hr_update(screen->machine, bitmap, cliprect); |
| 499 | ||
| 499 | ||
| 500 | 500 | return 0; |
| 501 | 501 | } |
| 502 | 502 |
| r5932 | r5933 | |
|---|---|---|
| 39 | 39 | #define PROFILER_VIDEOTOUCH PROFILER_USER3 |
| 40 | 40 | |
| 41 | 41 | /*************************************************************************** |
| 42 | ||
| 42 | HELPERS | |
| 43 | 43 | ***************************************************************************/ |
| 44 | 44 | |
| 45 | 45 | /*------------------------------------------------- |
| 46 | 46 | effective_a2 - calculates the effective a2 |
| 47 | ||
| 47 | register | |
| 48 | 48 | -------------------------------------------------*/ |
| 49 | 49 | |
| 50 | 50 | INLINE UINT32 effective_a2(void) |
| r5932 | r5933 | |
| 55 | 55 | |
| 56 | 56 | /*------------------------------------------------- |
| 57 | 57 | compute_video_address - performs funky Apple II |
| 58 | ||
| 58 | video address lookup | |
| 59 | 59 | -------------------------------------------------*/ |
| 60 | 60 | |
| 61 | 61 | static UINT32 compute_video_address(int col, int row) |
| r5932 | r5933 | |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | /*************************************************************************** |
| 90 | ||
| 90 | TEXT | |
| 91 | 91 | ***************************************************************************/ |
| 92 | 92 | |
| 93 | 93 | /*------------------------------------------------- |
| 94 | 94 | apple2_plot_text_character - plots a single |
| 95 | ||
| 95 | textual character | |
| 96 | 96 | -------------------------------------------------*/ |
| 97 | 97 | |
| 98 | 98 | INLINE void apple2_plot_text_character(bitmap_t *bitmap, int xpos, int ypos, int xscale, UINT32 code, |
| r5932 | r5933 | |
| 139 | 139 | |
| 140 | 140 | /*------------------------------------------------- |
| 141 | 141 | apple2_text_draw - renders text (either 40 |
| 142 | ||
| 142 | column or 80 column) | |
| 143 | 143 | -------------------------------------------------*/ |
| 144 | 144 | |
| 145 | 145 | static void apple2_text_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| r5932 | r5933 | |
| 260 | 260 | |
| 261 | 261 | |
| 262 | 262 | /*************************************************************************** |
| 263 | ||
| 263 | HIGH RESOLUTION GRAPHICS | |
| 264 | 264 | ***************************************************************************/ |
| 265 | 265 | |
| 266 | 266 | static void apple2_hires_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow) |
| r5932 | r5933 | |
| 351 | 351 | |
| 352 | 352 | |
| 353 | 353 | /*************************************************************************** |
| 354 | ||
| 354 | VIDEO CORE | |
| 355 | 355 | ***************************************************************************/ |
| 356 | 356 | |
| 357 | 357 | void apple2_video_start(running_machine *machine, const UINT8 *vram, size_t vram_size, UINT32 ignored_softswitches, int hires_modulo) |
| r5932 | r5933 | |
| 416 | 416 | int len = memory_region_length(machine, "gfx1"); |
| 417 | 417 | for (i = 0; i < len; i++) |
| 418 | 418 | { |
| 419 | apple2_font[i] = BITSWAP8(apple2_font[i], 7, 7, 6, 5, 4, 3, 2, 1); | |
| 419 | apple2_font[i] = BITSWAP8(apple2_font[i], 7, 7, 6, 5, 4, 3, 2, 1); | |
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | ||
| 422 | ||
| 423 | 423 | /* do we need to flip the gfx? */ |
| 424 | 424 | if (!strcmp(machine->gamedrv->name, "apple2") |
| 425 | 425 | || !strcmp(machine->gamedrv->name, "apple2p") |
| r5932 | r5933 | |
| 427 | 427 | || !strcmp(machine->gamedrv->name, "prav8m") |
| 428 | 428 | || !strcmp(machine->gamedrv->name, "ace100") |
| 429 | 429 | || !strcmp(machine->gamedrv->name, "apple2jp")) |
| 430 | { | |
| 430 | { | |
| 431 | 431 | int len = memory_region_length(machine, "gfx1"); |
| 432 | 432 | for (i = 0; i < len; i++) |
| 433 | 433 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | tms3556 emulation | |
| 3 | 3 | |
| 4 | TODO: | |
| 5 | * implement remaining flags in control registers | |
| 6 | * test the whole thing | |
| 7 | * find the bloody tms3556 manual. I mean the register and VRAM interfaces | |
| 8 | are mostly guesswork full of hacks, and I'd like to compare it with | |
| 9 | documentation. | |
| 4 | TODO: | |
| 5 | * implement remaining flags in control registers | |
| 6 | * test the whole thing | |
| 7 | * find the bloody tms3556 manual. I mean the register and VRAM interfaces | |
| 8 | are mostly guesswork full of hacks, and I'd like to compare it with | |
| 9 | documentation. | |
| 10 | 10 | |
| 11 | ||
| 11 | Raphael Nabet, 2004 | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | #include "driver.h" |
| r5932 | r5933 | |
| 38 | 38 | /* c/g flag (mixed mode only) */ |
| 39 | 39 | int cg_flag; |
| 40 | 40 | /* character line counter (decrements from 10, 0 when we have reached last |
| 41 | ||
| 41 | line of character row) */ | |
| 42 | 42 | int char_line_counter; |
| 43 | 43 | /* double height phase flags (one per horizontal character position) */ |
| 44 | 44 | int dbl_h_phase[40]; |
| r5932 | r5933 | |
| 68 | 68 | #pragma mark BUS INTERFACE |
| 69 | 69 | #endif |
| 70 | 70 | /* |
| 71 | ||
| 71 | bus interface | |
| 72 | 72 | */ |
| 73 | 73 | |
| 74 | 74 | /* |
| 75 | ||
| 75 | tms3556_vram_r | |
| 76 | 76 | |
| 77 | ||
| 77 | read a byte from tms3556 VRAM port | |
| 78 | 78 | */ |
| 79 | 79 | READ8_HANDLER(tms3556_vram_r) |
| 80 | 80 | { |
| r5932 | r5933 | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /* |
| 96 | ||
| 96 | tms3556_vram_w | |
| 97 | 97 | |
| 98 | ||
| 98 | write a byte to tms3556 VRAM port | |
| 99 | 99 | */ |
| 100 | 100 | WRITE8_HANDLER(tms3556_vram_w) |
| 101 | 101 | { |
| r5932 | r5933 | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /* |
| 113 | ||
| 113 | tms3556_reg_r | |
| 114 | 114 | |
| 115 | ||
| 115 | read a byte from tms3556 register port | |
| 116 | 116 | */ |
| 117 | 117 | READ8_HANDLER(tms3556_reg_r) |
| 118 | 118 | { |
| r5932 | r5933 | |
| 124 | 124 | vdp.reg_access_phase = 0; |
| 125 | 125 | } |
| 126 | 126 | /*else |
| 127 | { // ??? | |
| 128 | }*/ | |
| 127 | { // ??? | |
| 128 | }*/ | |
| 129 | 129 | |
| 130 | 130 | return reply; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /* |
| 134 | ||
| 134 | tms3556_reg_w | |
| 135 | 135 | |
| 136 | ||
| 136 | write a byte to tms3556 register port | |
| 137 | 137 | */ |
| 138 | 138 | WRITE8_HANDLER(tms3556_reg_w) |
| 139 | 139 | { |
| r5932 | r5933 | |
| 155 | 155 | } |
| 156 | 156 | else if (vdp.reg_ptr == 9) |
| 157 | 157 | { /* I don't understand what is going on, but it is the only way to |
| 158 | ||
| 158 | get this to work */ | |
| 159 | 159 | vdp.addressRegs[vdp.reg_ptr-8] = ((vdp.controlRegs[2] << 8) | vdp.controlRegs[1]) + 1; |
| 160 | 160 | vdp.reg_access_phase = 0; |
| 161 | 161 | vdp.magical_mystery_flag = 0; |
| r5932 | r5933 | |
| 187 | 187 | #pragma mark INITIALIZATION CODE |
| 188 | 188 | #endif |
| 189 | 189 | /* |
| 190 | ||
| 190 | initialization code | |
| 191 | 191 | */ |
| 192 | 192 | |
| 193 | 193 | /* |
| 194 | ||
| 194 | mdrv_tms3556 | |
| 195 | 195 | |
| 196 | ||
| 196 | machine struct initialization helper | |
| 197 | 197 | */ |
| 198 | 198 | MACHINE_DRIVER_START( tms3556 ) |
| 199 | 199 | /* video hardware */ |
| r5932 | r5933 | |
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | /* |
| 219 | ||
| 219 | PALETTE_INIT( tms3556 ) | |
| 220 | 220 | |
| 221 | ||
| 221 | Create our 8-color RGB palette | |
| 222 | 222 | */ |
| 223 | 223 | static PALETTE_INIT( tms3556 ) |
| 224 | 224 | { |
| r5932 | r5933 | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /* |
| 238 | ||
| 238 | tms3556_init | |
| 239 | 239 | |
| 240 | ||
| 240 | tms3556 core init (called at video init time) | |
| 241 | 241 | */ |
| 242 | 242 | void tms3556_init(running_machine *machine, int vram_size) |
| 243 | 243 | { |
| r5932 | r5933 | |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /* |
| 259 | ||
| 259 | tms3556_reset | |
| 260 | 260 | |
| 261 | ||
| 261 | tms3556 reset (should be called at machine init time) | |
| 262 | 262 | */ |
| 263 | 263 | void tms3556_reset(void) |
| 264 | 264 | { |
| r5932 | r5933 | |
| 283 | 283 | #pragma mark REDRAW CODE |
| 284 | 284 | #endif |
| 285 | 285 | /* |
| 286 | ||
| 286 | redraw code | |
| 287 | 287 | */ |
| 288 | 288 | |
| 289 | 289 | /* |
| 290 | ||
| 290 | tms3556_draw_line_empty | |
| 291 | 291 | |
| 292 | ||
| 292 | draw an empty line (used for top and bottom borders, and screen off mode) | |
| 293 | 293 | */ |
| 294 | 294 | static void tms3556_draw_line_empty(UINT16 *ln) |
| 295 | 295 | { |
| r5932 | r5933 | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /* |
| 306 | ||
| 306 | tms3556_draw_line_text_common | |
| 307 | 307 | |
| 308 | draw a line of text (called by tms3556_draw_line_text and | |
| 309 | tms3556_draw_line_mixed) | |
| 308 | draw a line of text (called by tms3556_draw_line_text and | |
| 309 | tms3556_draw_line_mixed) | |
| 310 | 310 | */ |
| 311 | 311 | static void tms3556_draw_line_text_common(UINT16 *ln) |
| 312 | 312 | { |
| r5932 | r5933 | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | /* |
| 420 | ||
| 420 | tms3556_draw_line_bitmap_common | |
| 421 | 421 | |
| 422 | draw a line of bitmap (called by tms3556_draw_line_bitmap and | |
| 423 | tms3556_draw_line_mixed) | |
| 422 | draw a line of bitmap (called by tms3556_draw_line_bitmap and | |
| 423 | tms3556_draw_line_mixed) | |
| 424 | 424 | */ |
| 425 | 425 | static void tms3556_draw_line_bitmap_common(UINT16 *ln) |
| 426 | 426 | { |
| r5932 | r5933 | |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | /* |
| 467 | ||
| 467 | tms3556_draw_line_text | |
| 468 | 468 | |
| 469 | ||
| 469 | draw a line in text mode | |
| 470 | 470 | */ |
| 471 | 471 | static void tms3556_draw_line_text(UINT16 *ln) |
| 472 | 472 | { |
| r5932 | r5933 | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /* |
| 480 | ||
| 480 | tms3556_draw_line_bitmap | |
| 481 | 481 | |
| 482 | ||
| 482 | draw a line in bitmap mode | |
| 483 | 483 | */ |
| 484 | 484 | static void tms3556_draw_line_bitmap(UINT16 *ln) |
| 485 | 485 | { |
| r5932 | r5933 | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | /* |
| 496 | ||
| 496 | tms3556_draw_line_mixed | |
| 497 | 497 | |
| 498 | ||
| 498 | draw a line in mixed mode | |
| 499 | 499 | */ |
| 500 | 500 | static void tms3556_draw_line_mixed(UINT16 *ln) |
| 501 | 501 | { |
| r5932 | r5933 | |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /* |
| 530 | ||
| 530 | tms3556_draw_line | |
| 531 | 531 | |
| 532 | ||
| 532 | draw a line. If non-interlaced mode, duplicate the line. | |
| 533 | 533 | */ |
| 534 | 534 | static void tms3556_draw_line(bitmap_t *bmp, int line) |
| 535 | 535 | { |
| r5932 | r5933 | |
| 539 | 539 | double_lines = 0; |
| 540 | 540 | |
| 541 | 541 | /*if (vdp.controlRegs[4] & 0x??) |
| 542 | { // interlaced mode | |
| 543 | ln = BITMAP_ADDR16(bmp, line, vdp.field); | |
| 544 | } | |
| 545 | else*/ | |
| 542 | { // interlaced mode | |
| 543 | ln = BITMAP_ADDR16(bmp, line, vdp.field); | |
| 544 | } | |
| 545 | else*/ | |
| 546 | 546 | { /* non-interlaced mode */ |
| 547 | 547 | ln = BITMAP_ADDR16(bmp, line, 0); |
| 548 | 548 | ln2 = BITMAP_ADDR16(bmp, line, 1); |
| r5932 | r5933 | |
| 578 | 578 | |
| 579 | 579 | |
| 580 | 580 | /* |
| 581 | ||
| 581 | tms3556_interrupt_start_vblank | |
| 582 | 582 | |
| 583 | ||
| 583 | Do vblank-time tasks | |
| 584 | 584 | */ |
| 585 | 585 | static void tms3556_interrupt_start_vblank(void) |
| 586 | 586 | { |
| r5932 | r5933 | |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /* |
| 615 | ||
| 615 | tms3556_interrupt | |
| 616 | 616 | |
| 617 | ||
| 617 | scanline handler | |
| 618 | 618 | */ |
| 619 | 619 | void tms3556_interrupt() |
| 620 | 620 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /************************************************************************ |
| 2 | ||
| 2 | crct6845 | |
| 3 | 3 | |
| 4 | ||
| 4 | MESS Driver By: | |
| 5 | 5 | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 8 | 8 | |
| 9 | 9 | ************************************************************************/ |
| 10 | 10 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | video/crt.c | |
| 3 | 3 | |
| 4 | ||
| 4 | CRT video emulation for TX-0 and PDP-1. | |
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | Theory of operation: |
| 8 | 8 | |
| 9 | What makes such CRT devices so odd is that there is no video processor, no | |
| 10 | scan logic, no refresh logic. The beam position and intensity is | |
| 11 | controlled by the program completely: in order to draw an object, the | |
| 12 | program must direct the beam to each point of the object, and in order to | |
| 13 | refresh it, the program must redraw the object periodically. | |
| 9 | What makes such CRT devices so odd is that there is no video processor, no | |
| 10 | scan logic, no refresh logic. The beam position and intensity is | |
| 11 | controlled by the program completely: in order to draw an object, the | |
| 12 | program must direct the beam to each point of the object, and in order to | |
| 13 | refresh it, the program must redraw the object periodically. | |
| 14 | 14 | |
| 15 | Since the refresh rates are highly variable (completely controlled by the | |
| 16 | program), I need to simulate CRT remanence: the intensity of each pixel on | |
| 17 | display decreases regularly. In order to keep this efficient, I keep a | |
| 18 | list of non-black pixels, and only process these pixels on each refresh. | |
| 19 | In order to improve efficiency further, I keep a distinct list for each | |
| 20 | line of the display: I have found that it improves drawing speed slightly | |
| 21 | (probably because it improves the cache hit rate). | |
| 15 | Since the refresh rates are highly variable (completely controlled by the | |
| 16 | program), I need to simulate CRT remanence: the intensity of each pixel on | |
| 17 | display decreases regularly. In order to keep this efficient, I keep a | |
| 18 | list of non-black pixels, and only process these pixels on each refresh. | |
| 19 | In order to improve efficiency further, I keep a distinct list for each | |
| 20 | line of the display: I have found that it improves drawing speed slightly | |
| 21 | (probably because it improves the cache hit rate). | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | Raphael Nabet 2002-2004 | |
| 25 | Based on earlier work by Chris Salomon | |
| 24 | Raphael Nabet 2002-2004 | |
| 25 | Based on earlier work by Chris Salomon | |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | #include <math.h> |
| r5932 | r5933 | |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | /* |
| 60 | ||
| 60 | video_start_crt | |
| 61 | 61 | |
| 62 | ||
| 62 | video init | |
| 63 | 63 | */ |
| 64 | 64 | int video_start_crt(running_machine *machine, int num_levels, int offset_x, int offset_y, int width, int height) |
| 65 | 65 | { |
| r5932 | r5933 | |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | /* |
| 95 | ||
| 95 | crt_plot | |
| 96 | 96 | |
| 97 | ||
| 97 | schedule a pixel to be plotted | |
| 98 | 98 | */ |
| 99 | 99 | void crt_plot(int x, int y) |
| 100 | 100 | { |
| r5932 | r5933 | |
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | /* |
| 127 | ||
| 127 | VIDEO_EOF( crt ) | |
| 128 | 128 | |
| 129 | ||
| 129 | keep track of time | |
| 130 | 130 | */ |
| 131 | 131 | VIDEO_EOF( crt ) |
| 132 | 132 | { |
| r5932 | r5933 | |
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | /* |
| 138 | ||
| 138 | VIDEO_UPDATE( crt ) | |
| 139 | 139 | |
| 140 | ||
| 140 | update the bitmap | |
| 141 | 141 | */ |
| 142 | 142 | VIDEO_UPDATE( crt ) |
| 143 | 143 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | tms3556.h: header file for tms3556.c | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | READ8_HANDLER(tms3556_vram_r); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | TExt Display 7360 | |
| 4 | PeT mess@utanet.at | |
| 3 | TExt Display 7360 | |
| 4 | PeT mess@utanet.at | |
| 5 | 5 | |
| 6 | 6 | ***************************************************************************/ |
| 7 | 7 | /* |
| r5932 | r5933 | |
| 547 | 547 | static void ted7360_set_interrupt (running_machine *machine, int mask) |
| 548 | 548 | { |
| 549 | 549 | /* kernel itself polls for timer 2 shot (interrupt disabled!) |
| 550 | ||
| 550 | * when cassette loading */ | |
| 551 | 551 | ted7360[9] |= mask; |
| 552 | 552 | if ((ted7360[0xa] & ted7360[9] & 0x5e)) |
| 553 | 553 | { |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | ||
| 14 | - text mode | |
| 15 | 15 | |
| 16 | 16 | */ |
| 17 | 17 | |
| r5932 | r5933 | |
| 121 | 121 | |
| 122 | 122 | /*------------------------------------------------- |
| 123 | 123 | set_busy_flag - set busy flag and arm timer |
| 124 | ||
| 124 | to clear it later | |
| 125 | 125 | -------------------------------------------------*/ |
| 126 | 126 | |
| 127 | 127 | static void set_busy_flag(hd61830_t *hd61830, int period) |
| r5932 | r5933 | |
| 199 | 199 | logerror("HD61380 '%s' Display %s\n", device->tag, (data & HD61830_MODE_DISPLAY_ON) ? "On" : "Off"); |
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | ||
| 202 | ||
| 203 | 203 | case HD61830_INSTRUCTION_CHARACTER_PITCH: |
| 204 | 204 | hd61830->hp = (data & 0x07) + 1; |
| 205 | 205 | hd61830->vp = (data >> 4) + 1; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | Hitachi HD66421 LCD Controller/Driver | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | 7 | */ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Busicom 141-PF |
| 4 | 4 | |
| 5 | 5 | 04/08/2009 Initial driver by Miodrag Milanovic |
| r5932 | r5933 | |
| 13 | 13 | UINT8 busicom_printer_line[11][17]; |
| 14 | 14 | UINT8 busicom_printer_line_color[11]; |
| 15 | 15 | |
| 16 | static UINT8 printer_font[]= { | |
| 16 | static UINT8 printer_font[]= { | |
| 17 | 17 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 18 | 18 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 19 | 19 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| r5932 | r5933 | |
| 58 | 58 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 59 | 59 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 60 | 60 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 61 | ||
| 61 | ||
| 62 | 62 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 63 | 63 | 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, |
| 64 | 64 | 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, |
| r5932 | r5933 | |
| 1820 | 1820 | |
| 1821 | 1821 | VIDEO_UPDATE( busicom ) |
| 1822 | 1822 | { |
| 1823 | int y, x, b, j; | |
| 1823 | int y, x, b, j; | |
| 1824 | 1824 | //34x44 |
| 1825 | 1825 | for (y = 0; y < 11; y++) |
| 1826 | 1826 | { |
| 1827 | 1827 | UINT8 col = 8 * busicom_printer_line_color[y]; |
| 1828 | 1828 | for (x = 0; x < 17; x++) |
| 1829 | 1829 | { |
| 1830 | UINT8 chr = busicom_printer_line[y][x]; | |
| 1831 | for (j = 0; j < 44; j++) { | |
| 1830 | UINT8 chr = busicom_printer_line[y][x]; | |
| 1831 | for (j = 0; j < 44; j++) { | |
| 1832 | 1832 | for (b = 0; b < 34; b++) |
| 1833 | { | |
| 1833 | { | |
| 1834 | 1834 | *BITMAP_ADDR16(bitmap, (y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; |
| 1835 | 1835 | } |
| 1836 | 1836 | for (b = 34; b < 40; b++) |
| 1837 | { | |
| 1837 | { | |
| 1838 | 1838 | *BITMAP_ADDR16(bitmap, (y*44)+j, x*40+b) = 0; |
| 1839 | 1839 | } |
| 1840 | 1840 | |
| r5932 | r5933 | |
| 1850 | 1850 | PALETTE_INIT( busicom ) |
| 1851 | 1851 | { |
| 1852 | 1852 | int i; |
| 1853 | for(i=0;i<8;i++) { | |
| 1853 | for(i=0;i<8;i++) { | |
| 1854 | 1854 | palette_set_color( machine, i, MAKE_RGB(color[i],color[i],color[i]) ); |
| 1855 | 1855 | } |
| 1856 | 1856 | palette_set_color( machine, 8, MAKE_RGB(0xff,0xff,0xff) ); |
| 1857 | for(i=0;i<7;i++) { | |
| 1857 | for(i=0;i<7;i++) { | |
| 1858 | 1858 | palette_set_color( machine, i+9, MAKE_RGB(color_red[i],0x00,0x00) ); |
| 1859 | 1859 | } |
| 1860 | 1860 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | Hitachi HD66421 LCD Controller/Driver | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | 7 | */ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 82 | 82 | static CDP1869_INTERFACE( pecom_cdp1869_intf ) |
| 83 | 83 | { |
| 84 | 84 | "maincpu", |
| 85 | SCREEN_TAG, | |
| 85 | SCREEN_TAG, | |
| 86 | 86 | CDP1869_COLOR_CLK_PAL, |
| 87 | 87 | CDP1869_PAL, |
| 88 | 88 | pecom_page_ram_r, |
| r5932 | r5933 | |
| 111 | 111 | /* register for state saving */ |
| 112 | 112 | state_save_register_global(machine, state->cdp1802_mode); |
| 113 | 113 | state_save_register_global(machine, state->dma); |
| 114 | state_save_register_global_pointer(machine, state->page_ram, PECOM_PAGE_RAM_SIZE); | |
| 114 | state_save_register_global_pointer(machine, state->page_ram, PECOM_PAGE_RAM_SIZE); | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | static VIDEO_UPDATE( pecom ) |
| r5932 | r5933 | |
|---|---|---|
| 128 | 128 | color[0] = pocketc_colortable[PC1251_CONTRAST][0]; |
| 129 | 129 | color[1] = pocketc_colortable[PC1251_CONTRAST][1]; |
| 130 | 130 | |
| 131 | for (x=RIGHT,y=DOWN, i=0; i<60; x+=3) | |
| 131 | for (x=RIGHT,y=DOWN, i=0; i<60; x+=3) | |
| 132 | 132 | { |
| 133 | 133 | for (j=0; j<5; j++, i++, x+=3) |
| 134 | 134 | drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1251_lcd.reg[i], |
| 135 | 135 | PC1251_CONTRAST,0,0, |
| 136 | 136 | x,y); |
| 137 | 137 | } |
| 138 | for (i=0x7b; i>=0x40; x+=3) | |
| 138 | for (i=0x7b; i>=0x40; x+=3) | |
| 139 | 139 | { |
| 140 | 140 | for (j=0; j<5; j++, i--, x+=3) |
| 141 | 141 | drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1251_lcd.reg[i], |
| r5932 | r5933 | |
| 161 | 161 | pc1251_lcd.reg[0x3e] & 0x04 ? color[1] : color[0]); |
| 162 | 162 | |
| 163 | 163 | /* 0x3c 1 def?, 4 g, 8 de |
| 164 | 0x3d 2 shift, 4 rad, 8 error | |
| 165 | 0x3e 1 pro?, 2 run?, 4rsv?*/ | |
| 164 | 0x3d 2 shift, 4 rad, 8 error | |
| 165 | 0x3e 1 pro?, 2 run?, 4rsv?*/ | |
| 166 | 166 | return 0; |
| 167 | 167 | } |
| 168 | 168 |
| r5932 | r5933 | |
|---|---|---|
| 161 | 161 | vc4000_video.sprite_collision = 0; |
| 162 | 162 | vc4000_video.reg.d.sprite_collision &= 0xbf; |
| 163 | 163 | break; |
| 164 | ||
| 164 | ||
| 165 | 165 | #ifndef ANALOG_HACK |
| 166 | 166 | case 0xcc: |
| 167 | 167 | if (!activecpu_get_reg(S2650_FO)) data=input_port_read(machine, "JOY1_X"); |
| r5932 | r5933 | |
| 207 | 207 | joy1_y+=5; |
| 208 | 208 | if (joy1_y > STICKHIGH) joy1_y=STICKHIGH; |
| 209 | 209 | break; |
| 210 | // case 0x00: | |
| 211 | // joy1_y = vc4000_joystick_return_to_centre(joy1_y); | |
| 210 | // case 0x00: | |
| 211 | // joy1_y = vc4000_joystick_return_to_centre(joy1_y); | |
| 212 | 212 | } |
| 213 | 213 | data=joy1_y; |
| 214 | 214 | } |
| r5932 | r5933 | |
| 284 | 284 | joy2_y+=5; |
| 285 | 285 | if (joy2_y > STICKHIGH) joy2_y=STICKHIGH; |
| 286 | 286 | break; |
| 287 | // case 0x00: | |
| 288 | // joy2_y = vc4000_joystick_return_to_centre(joy2_y); | |
| 287 | // case 0x00: | |
| 288 | // joy2_y = vc4000_joystick_return_to_centre(joy2_y); | |
| 289 | 289 | } |
| 290 | 290 | data=joy2_y; |
| 291 | 291 | } |
| r5932 | r5933 | |
| 337 | 337 | |
| 338 | 338 | WRITE8_HANDLER(vc4000_video_w) |
| 339 | 339 | { |
| 340 | // | |
| 340 | // vc4000_video.reg.data[offset]=data; | |
| 341 | 341 | if (offset > 0xcf) offset &= 0xcf; // c0-cf is mirrored at d0-df, e0-ef, f0-ff |
| 342 | 342 | |
| 343 | 343 | switch (offset) { |
| r5932 | r5933 | |
| 353 | 353 | vc4000_video.sprites[0].scolor=((~data>>3)&7); |
| 354 | 354 | vc4000_video.sprites[1].scolor=(~data&7); |
| 355 | 355 | break; |
| 356 | ||
| 356 | ||
| 357 | 357 | case 0xc2: // Sprite 2+3 color |
| 358 | 358 | vc4000_video.sprites[2].scolor=((~data>>3)&7); |
| 359 | 359 | vc4000_video.sprites[3].scolor=(~data&7); |
| r5932 | r5933 | |
| 630 | 630 | vc4000_video.background_collision=0; |
| 631 | 631 | vc4000_video.sprite_collision=0; |
| 632 | 632 | vc4000_video.reg.d.sprite_collision=0; |
| 633 | // | |
| 633 | // logerror("begin of frame\n"); | |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | if (irq_pause>10) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | 733 ASR emulation | |
| 3 | 3 | |
| 4 | We are emulating a TI Model 733 ASR ("Silent 700") data terminal, | |
| 5 | interfaced through a TI asynchronous EIA/TTY interface module. | |
| 4 | We are emulating a TI Model 733 ASR ("Silent 700") data terminal, | |
| 5 | interfaced through a TI asynchronous EIA/TTY interface module. | |
| 6 | 6 | |
| 7 | The ASR features a printer, a keyboard and a tape unit (which is not | |
| 8 | emulated). The ASR is attached to the computer with a serial interface. | |
| 7 | The ASR features a printer, a keyboard and a tape unit (which is not | |
| 8 | emulated). The ASR is attached to the computer with a serial interface. | |
| 9 | 9 | |
| 10 | References: | |
| 11 | 945401-9701 Model 990/4 Computer System Field Maintainance Manual p. C-1, | |
| 12 | 945250-9701 990 Computer Family Systems Handbook pp. 5-9 through 5-16, | |
| 13 | 0943442-9701 Model 990 Computer Reference Manual Preliminary pp. 3-13 | |
| 14 | through 3-21 and 3-39 through 3-44. | |
| 10 | References: | |
| 11 | 945401-9701 Model 990/4 Computer System Field Maintainance Manual p. C-1, | |
| 12 | 945250-9701 990 Computer Family Systems Handbook pp. 5-9 through 5-16, | |
| 13 | 0943442-9701 Model 990 Computer Reference Manual Preliminary pp. 3-13 | |
| 14 | through 3-21 and 3-39 through 3-44. | |
| 15 | 15 | |
| 16 | TODO: | |
| 17 | * separate ASR emulation from EIA interface emulation? | |
| 18 | * implement tape interface? | |
| 16 | TODO: | |
| 17 | * separate ASR emulation from EIA interface emulation? | |
| 18 | * implement tape interface? | |
| 19 | 19 | |
| 20 | ||
| 20 | Raphael Nabet 2003 | |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | #include "driver.h" |
| r5932 | r5933 | |
| 47 | 47 | static struct |
| 48 | 48 | { |
| 49 | 49 | /*UINT8 OutQueue[ASROutQueueSize]; |
| 50 | int OutQueueHead; | |
| 51 | int OutQueueLen;*/ | |
| 50 | int OutQueueHead; | |
| 51 | int OutQueueLen;*/ | |
| 52 | 52 | |
| 53 | 53 | UINT8 recv_buf; |
| 54 | 54 | UINT8 xmit_buf; |
| r5932 | r5933 | |
| 84 | 84 | |
| 85 | 85 | static const gfx_layout fontlayout = |
| 86 | 86 | { |
| 87 | ||
| 87 | 6, 8, /* 6*8 characters */ | |
| 88 | 88 | /*96*/128, /* 96 characters */ |
| 89 | 89 | 1, /* 1 bit per pixel */ |
| 90 | 90 | { 0 }, |
| r5932 | r5933 | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /* |
| 107 | ||
| 107 | Initialize the asr core | |
| 108 | 108 | */ |
| 109 | 109 | void asr733_init(running_machine *machine) |
| 110 | 110 | { |
| r5932 | r5933 | |
| 314 | 314 | #endif |
| 315 | 315 | |
| 316 | 316 | /* |
| 317 | 0-7: receive buffer | |
| 318 | 8: XMITING transmit in progress, 1 if transmitting | |
| 319 | 9: TIMERR timing error, 1 if error | |
| 320 | 10: RCR reverse channel receive, not used | |
| 321 | "ASR733/33 ID" 1 -> TTY (???) (2270509-9701 pp. G-9 & G-10) | |
| 322 | 11: WRQ write request, 1 if ready to transmit | |
| 323 | 12: RRQ read request, 1 if ready to receive | |
| 324 | 13: DCD data carrier detect, not used | |
| 325 | 14: DSR data set ready, 1 if online | |
| 326 | 15: INT interrupt, 1 if interrupt | |
| 317 | 0-7: receive buffer | |
| 318 | 8: XMITING transmit in progress, 1 if transmitting | |
| 319 | 9: TIMERR timing error, 1 if error | |
| 320 | 10: RCR reverse channel receive, not used | |
| 321 | "ASR733/33 ID" 1 -> TTY (???) (2270509-9701 pp. G-9 & G-10) | |
| 322 | 11: WRQ write request, 1 if ready to transmit | |
| 323 | 12: RRQ read request, 1 if ready to receive | |
| 324 | 13: DCD data carrier detect, not used | |
| 325 | 14: DSR data set ready, 1 if online | |
| 326 | 15: INT interrupt, 1 if interrupt | |
| 327 | 327 | */ |
| 328 | 328 | static int asr733_cru_r(int offset, int unit) |
| 329 | 329 | { |
| r5932 | r5933 | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /* |
| 349 | 0-7: transmit buffer | |
| 350 | 8: not used | |
| 351 | 9: DTR data terminal ready (set to 1) | |
| 352 | 10: RTS request to send (set to 1) | |
| 353 | 11: CLRWRQ clear write request (write any value to execute) | |
| 354 | 12: CLRRRQ clear read request (write any value to execute) | |
| 355 | 13: CLRNSF clear new status flag - clear DSR/DCD interrupts (write any value to execute) | |
| 356 | 14: enable interrupts, 1 to enable interrupts | |
| 357 | 15: diagnostic mode, 0 for normal mode | |
| 349 | 0-7: transmit buffer | |
| 350 | 8: not used | |
| 351 | 9: DTR data terminal ready (set to 1) | |
| 352 | 10: RTS request to send (set to 1) | |
| 353 | 11: CLRWRQ clear write request (write any value to execute) | |
| 354 | 12: CLRRRQ clear read request (write any value to execute) | |
| 355 | 13: CLRNSF clear new status flag - clear DSR/DCD interrupts (write any value to execute) | |
| 356 | 14: enable interrupts, 1 to enable interrupts | |
| 357 | 15: diagnostic mode, 0 for normal mode | |
| 358 | 358 | */ |
| 359 | 359 | static void asr733_cru_w(running_machine *machine, int offset, int data, int unit) |
| 360 | 360 | { |
| r5932 | r5933 | |
| 417 | 417 | |
| 418 | 418 | |
| 419 | 419 | /* |
| 420 | ||
| 420 | Video refresh | |
| 421 | 421 | */ |
| 422 | 422 | void asr733_refresh(running_machine *machine, bitmap_t *bitmap, int unit, int x, int y) |
| 423 | 423 | { |
| r5932 | r5933 | |
| 602 | 602 | |
| 603 | 603 | |
| 604 | 604 | /* |
| 605 | keyboard handler: should be called regularly by machine code, for instance | |
| 606 | every Video Blank Interrupt. | |
| 605 | keyboard handler: should be called regularly by machine code, for instance | |
| 606 | every Video Blank Interrupt. | |
| 607 | 607 | */ |
| 608 | 608 | void asr733_keyboard(running_machine *machine, int unit) |
| 609 | 609 | { |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - reset behavior | |
| 15 | - busy flag timing | |
| 16 | - cursor flashing | |
| 17 | - display page flashing | |
| 18 | - internal chargen ROM | |
| 19 | - horizontal dot scroll | |
| 20 | - XOR/AND/Priority-OR compositions | |
| 21 | - text mode character display | |
| 22 | - single panel text mode | |
| 23 | - single/dual panel graphics mode | |
| 14 | - reset behavior | |
| 15 | - busy flag timing | |
| 16 | - cursor flashing | |
| 17 | - display page flashing | |
| 18 | - internal chargen ROM | |
| 19 | - horizontal dot scroll | |
| 20 | - XOR/AND/Priority-OR compositions | |
| 21 | - text mode character display | |
| 22 | - single panel text mode | |
| 23 | - single/dual panel graphics mode | |
| 24 | 24 | |
| 25 | 25 | */ |
| 26 | 26 | |
| r5932 | r5933 | |
| 195 | 195 | switch (sed1330->ir) |
| 196 | 196 | { |
| 197 | 197 | /* |
| 198 | case SED1330_INSTRUCTION_SLEEP_IN: | |
| 199 | break; | |
| 198 | case SED1330_INSTRUCTION_SLEEP_IN: | |
| 199 | break; | |
| 200 | 200 | */ |
| 201 | 201 | case SED1330_INSTRUCTION_CSRDIR_RIGHT: |
| 202 | 202 | case SED1330_INSTRUCTION_CSRDIR_LEFT: |
| r5932 | r5933 | |
| 225 | 225 | READ8_DEVICE_HANDLER( sed1330_data_r ) |
| 226 | 226 | { |
| 227 | 227 | sed1330_t *sed1330 = get_safe_token(device); |
| 228 | ||
| 228 | ||
| 229 | 229 | UINT8 data = devcb_call_read8(&sed1330->in_vd_func, sed1330->csr); |
| 230 | 230 | |
| 231 | 231 | if (LOG) logerror("SED1330 '%s' Memory Read %02x from %04x\n", device->tag, data, sed1330->csr); |
| r5932 | r5933 | |
| 326 | 326 | case SED1330_FC_FLASH_32: logerror("SED1330 '%s' Cursor: fFR/32\n", device->tag); break; |
| 327 | 327 | case SED1330_FC_FLASH_64: logerror("SED1330 '%s' Cursor: fFR/64\n", device->tag); break; |
| 328 | 328 | } |
| 329 | ||
| 329 | ||
| 330 | 330 | switch (sed1330->fp & 0x03) |
| 331 | 331 | { |
| 332 | 332 | case SED1330_FC_OFF: logerror("SED1330 '%s' Display Page 1: disabled\n", device->tag); break; |
| r5932 | r5933 | |
| 334 | 334 | case SED1330_FC_FLASH_32: logerror("SED1330 '%s' Display Page 1: flash fFR/32\n", device->tag); break; |
| 335 | 335 | case SED1330_FC_FLASH_64: logerror("SED1330 '%s' Display Page 1: flash fFR/64\n", device->tag); break; |
| 336 | 336 | } |
| 337 | ||
| 337 | ||
| 338 | 338 | switch ((sed1330->fp >> 2) & 0x03) |
| 339 | 339 | { |
| 340 | 340 | case SED1330_FC_OFF: logerror("SED1330 '%s' Display Page 2/4: disabled\n", device->tag); break; |
| r5932 | r5933 | |
| 418 | 418 | case 1: |
| 419 | 419 | sed1330->cry = (data & 0x0f) + 1; |
| 420 | 420 | sed1330->cm = BIT(data, 7); |
| 421 | if (LOG) | |
| 421 | if (LOG) | |
| 422 | 422 | { |
| 423 | 423 | logerror("SED1330 '%s' Vertical Cursor Location: %u\n", device->tag, sed1330->cry); |
| 424 | 424 | logerror("SED1330 '%s' Cursor Shape: %s\n", device->tag, BIT(data, 7) ? "Block" : "Underscore"); |
| r5932 | r5933 | |
| 480 | 480 | sed1330->csr = (sed1330->csr & 0xff00) | data; |
| 481 | 481 | break; |
| 482 | 482 | |
| 483 | case 1: | |
| 483 | case 1: | |
| 484 | 484 | sed1330->csr = (data << 8) | (sed1330->csr & 0xff); |
| 485 | 485 | if (LOG) logerror("SED1330 '%s' Cursor Address %04x\n", device->tag, sed1330->csr); |
| 486 | 486 | break; |
| r5932 | r5933 | |
| 490 | 490 | } |
| 491 | 491 | break; |
| 492 | 492 | /* |
| 493 | case SED1330_INSTRUCTION_CSRR: | |
| 494 | break; | |
| 493 | case SED1330_INSTRUCTION_CSRR: | |
| 494 | break; | |
| 495 | 495 | */ |
| 496 | 496 | case SED1330_INSTRUCTION_MWRITE: |
| 497 | 497 | if (LOG) logerror("SED1330 '%s' Memory Write %02x to %04x (row %u col %u line %u)\n", device->tag, data, sed1330->csr, sed1330->csr/80/8, sed1330->csr%80, sed1330->csr/80); |
| r5932 | r5933 | |
| 501 | 501 | increment_csr(sed1330); |
| 502 | 502 | break; |
| 503 | 503 | /* |
| 504 | case SED1330_INSTRUCTION_MREAD: | |
| 505 | break; | |
| 504 | case SED1330_INSTRUCTION_MREAD: | |
| 505 | break; | |
| 506 | 506 | */ |
| 507 | 507 | default: |
| 508 | 508 | logerror("SED1330 '%s' Unsupported instruction %02x\n", device->tag, sed1330->ir); |
| r5932 | r5933 | |
| 513 | 513 | |
| 514 | 514 | /*------------------------------------------------- |
| 515 | 515 | draw_text_scanline - draw one scanline |
| 516 | ||
| 516 | (currently this only draws the text cursor) | |
| 517 | 517 | -------------------------------------------------*/ |
| 518 | 518 | |
| 519 | 519 | static void draw_text_scanline(sed1330_t *sed1330, bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va) |
| r5932 | r5933 | |
| 587 | 587 | static void update_text(sed1330_t *sed1330, bitmap_t *bitmap, const rectangle *cliprect) |
| 588 | 588 | { |
| 589 | 589 | int y; |
| 590 | ||
| 590 | ||
| 591 | 591 | if (sed1330->ws) |
| 592 | 592 | { |
| 593 | 593 | for (y = 0; y < sed1330->sl1; y++) |
| r5932 | r5933 | |
| 695 | 695 | |
| 696 | 696 | static DEVICE_RESET( sed1330 ) |
| 697 | 697 | { |
| 698 | // | |
| 698 | // sed1330_t *sed1330 = get_safe_token(device); | |
| 699 | 699 | |
| 700 | 700 | } |
| 701 | 701 |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | { |
| 18 | 18 | int y, x, b, j; |
| 19 | 19 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 20 | ||
| 20 | ||
| 21 | 21 | for (y = 0; y < 16; y++) |
| 22 | 22 | { |
| 23 | 23 | for (x = 0; x < 64; x++) |
| 24 | 24 | { |
| 25 | 25 | UINT8 chr = mess_ram[x +(y*64) + 0x40000]; |
| 26 | UINT8 attr= mess_ram[x +(y*64) + 0x40400]; | |
| 27 | for (j = 0; j < 16; j++) { | |
| 26 | UINT8 attr= mess_ram[x +(y*64) + 0x40400]; | |
| 27 | for (j = 0; j < 16; j++) { | |
| 28 | 28 | UINT32 addr = 0x10000 + x + ((y*16+j)*64) + (pk8020_video_page * 0xC000); |
| 29 | 29 | UINT8 code1 = mess_ram[addr]; |
| 30 | 30 | UINT8 code2 = mess_ram[addr + 0x4000]; |
| 31 | 31 | UINT8 code3 = mess_ram[addr + 0x8000]; |
| 32 | UINT8 code4 = gfx[((chr<<4) + j) + (pk8020_font*0x1000)]; | |
| 32 | UINT8 code4 = gfx[((chr<<4) + j) + (pk8020_font*0x1000)]; | |
| 33 | 33 | if(attr) code4 ^= 0xff; |
| 34 | 34 | for (b = 0; b < 8; b++) |
| 35 | { | |
| 35 | { | |
| 36 | 36 | UINT8 col = (((code4 >> b) & 0x01) ? 0x08 : 0x00); |
| 37 | 37 | col |= (((code3 >> b) & 0x01) ? 0x04 : 0x00); |
| 38 | 38 | col |= (((code2 >> b) & 0x01) ? 0x02 : 0x00); |
| r5932 | r5933 | |
| 48 | 48 | PALETTE_INIT( pk8020 ) |
| 49 | 49 | { |
| 50 | 50 | int i; |
| 51 | for(i=0;i<16;i++) { | |
| 51 | for(i=0;i<16;i++) { | |
| 52 | 52 | palette_set_color( machine, i, MAKE_RGB(i*0x10,i*0x10,i*0x10) ); |
| 53 | 53 | } |
| 54 | 54 | } |
| r5932 | r5933 | |
|---|---|---|
| 19 | 19 | emu_timer *gal_video_timer = NULL; |
| 20 | 20 | |
| 21 | 21 | TIMER_CALLBACK( gal_video ) |
| 22 | { | |
| 22 | { | |
| 23 | 23 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 24 | 24 | int y, x; |
| 25 | if (galaxy_interrupts_enabled == TRUE) | |
| 25 | if (galaxy_interrupts_enabled == TRUE) | |
| 26 | 26 | { |
| 27 | 27 | UINT8 *gfx = memory_region(machine, "gfx1"); |
| 28 | 28 | UINT8 dat = (gal_latch_value & 0x3c) >> 2; |
| r5932 | r5933 | |
| 33 | 33 | if (mode == 0) |
| 34 | 34 | { |
| 35 | 35 | // Text mode |
| 36 | if (first == 0 && (cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_R) & 0x1f) == 0) | |
| 36 | if (first == 0 && (cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_R) & 0x1f) == 0) | |
| 37 | 37 | { |
| 38 | 38 | // Due to a fact that on real processor latch value is set at |
| 39 | 39 | // the end of last cycle we need to skip dusplay of double |
| 40 | 40 | // first char in each row |
| 41 | 41 | code = 0x00; |
| 42 | 42 | first = 1; |
| 43 | } | |
| 44 | else | |
| 43 | } | |
| 44 | else | |
| 45 | 45 | { |
| 46 | 46 | code = memory_read_byte(space,addr) & 0xbf; |
| 47 | 47 | code += (code & 0x80) >> 1; |
| r5932 | r5933 | |
| 50 | 50 | } |
| 51 | 51 | y = gal_cnt / 48 - 2; |
| 52 | 52 | x = (gal_cnt % 48) * 8; |
| 53 | ||
| 53 | ||
| 54 | 54 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 0) & 1; x++; |
| 55 | 55 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 1) & 1; x++; |
| 56 | 56 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 2) & 1; x++; |
| r5932 | r5933 | |
| 60 | 60 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 6) & 1; x++; |
| 61 | 61 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 7) & 1; |
| 62 | 62 | } |
| 63 | else | |
| 63 | else | |
| 64 | 64 | { // Graphics mode |
| 65 | if (first < 4 && (cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_R) & 0x1f) == 0) | |
| 65 | if (first < 4 && (cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_R) & 0x1f) == 0) | |
| 66 | 66 | { |
| 67 | 67 | // Due to a fact that on real processor latch value is set at |
| 68 | 68 | // the end of last cycle we need to skip dusplay of 4 times |
| 69 | 69 | // first char in each row |
| 70 | 70 | code = 0x00; |
| 71 | 71 | first++; |
| 72 | } | |
| 73 | else | |
| 72 | } | |
| 73 | else | |
| 74 | 74 | { |
| 75 | 75 | code = memory_read_byte(space,addr) ^ 0xff; |
| 76 | 76 | first = 0; |
| 77 | 77 | } |
| 78 | 78 | y = gal_cnt / 48 - 2; |
| 79 | 79 | x = (gal_cnt % 48) * 8; |
| 80 | ||
| 80 | ||
| 81 | 81 | /* hack - until calc of R is fixed in Z80 */ |
| 82 | if (x == 11 * 8 && y == 0) | |
| 82 | if (x == 11 * 8 && y == 0) | |
| 83 | 83 | { |
| 84 | 84 | start_addr = addr; |
| 85 | 85 | } |
| 86 | if ((x / 8 >= 11) && (x / 8 < 44)) | |
| 86 | if ((x / 8 >= 11) && (x / 8 < 44)) | |
| 87 | 87 | { |
| 88 | 88 | code = memory_read_byte(space, start_addr + y * 32 + (gal_cnt % 48) - 11) ^ 0xff; |
| 89 | } | |
| 90 | else | |
| 89 | } | |
| 90 | else | |
| 91 | 91 | { |
| 92 | 92 | code = 0x00; |
| 93 | 93 | } |
| 94 | 94 | /* end of hack */ |
| 95 | ||
| 95 | ||
| 96 | 96 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 0) & 1; x++; |
| 97 | 97 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 1) & 1; x++; |
| 98 | 98 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 2) & 1; x++; |
| r5932 | r5933 | |
| 101 | 101 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 5) & 1; x++; |
| 102 | 102 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 6) & 1; x++; |
| 103 | 103 | *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 7) & 1; |
| 104 | } | |
| 104 | } | |
| 105 | 105 | } |
| 106 | 106 | gal_cnt++; |
| 107 | } | |
| 107 | } | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | VIDEO_UPDATE( galaxy ) |
| 111 | 111 | { |
| 112 | 112 | timer_adjust_periodic(gal_video_timer, attotime_zero, 0, attotime_never); |
| 113 | if (galaxy_interrupts_enabled == FALSE) | |
| 113 | if (galaxy_interrupts_enabled == FALSE) | |
| 114 | 114 | { |
| 115 | 115 | rectangle black_area = {0, 384 - 1, 0, 208 - 1}; |
| 116 | 116 | bitmap_fill(tmpbitmap, &black_area, 0); |
| r5932 | r5933 | |
|---|---|---|
| 3 | 3 | |
| 4 | 4 | MESS Driver By: |
| 5 | 5 | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | /* the 4 bit input port b on IC39 are produced by 4 NAND gates. |
| 110 | these NAND gates take their | |
| 111 | inputs from c0 and c1 (from IC32) and ma12 (from the 6845) */ | |
| 110 | these NAND gates take their | |
| 111 | inputs from c0 and c1 (from IC32) and ma12 (from the 6845) */ | |
| 112 | 112 | |
| 113 | 113 | /* get bit m12 from the 6845 */ |
| 114 | 114 | ma12=(ma>>12)&1; |
| r5932 | r5933 | |
| 131 | 131 | s=(a+b+1)&0xf; |
| 132 | 132 | |
| 133 | 133 | /* if MA13 (TTXVDU) is low then IC8 and IC9 are used to calculate |
| 134 | the memory location required for the hi res video. | |
| 135 | if MA13 is hight then IC10 and IC11 are used to calculate the memory location for the teletext chip | |
| 136 | Note: the RA0,RA1,RA2 inputs to IC8 in high res modes will need to be added else where */ | |
| 134 | the memory location required for the hi res video. | |
| 135 | if MA13 is hight then IC10 and IC11 are used to calculate the memory location for the teletext chip | |
| 136 | Note: the RA0,RA1,RA2 inputs to IC8 in high res modes will need to be added else where */ | |
| 137 | 137 | if ((ma>>13)&1) |
| 138 | 138 | { |
| 139 | 139 | m=((ma&0x3ff)|0x3c00)|((s&0x8)<<11); |
| r5932 | r5933 | |
| 286 | 286 | else |
| 287 | 287 | video_screen_update_partial(space->machine->primary_screen, vpos -1 ); |
| 288 | 288 | |
| 289 | // | |
| 289 | // logerror("setting videoULA %s at %.4x size:%.4x\n",image_filename(image), addr, size); | |
| 290 | 290 | logerror("setting videoULA %.4x to:%.4x at :%d \n",data,offset,video_screen_get_vpos(space->machine->primary_screen) ); |
| 291 | 291 | |
| 292 | 292 |
| r5932 | r5933 | |
|---|---|---|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | for( i = 0; i < k1ge->wba_h; i++ ) |
| 329 | { | |
| 329 | { | |
| 330 | 330 | p[i] = oowcol; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | for( i = k1ge->wba_h + k1ge->wsi_h; i < 160; i++ ) |
| 334 | { | |
| 334 | { | |
| 335 | 335 | p[i] = oowcol; |
| 336 | 336 | } |
| 337 | 337 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | * | |
| 2 | * | |
| 3 | 3 | * Fujitsu Micro 7 Video functions |
| 4 | * | |
| 4 | * | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| r5932 | r5933 | |
| 38 | 38 | |
| 39 | 39 | /* |
| 40 | 40 | * Main CPU: Sub-CPU interface (port 0xfd05) |
| 41 | * | |
| 41 | * | |
| 42 | 42 | * Read: |
| 43 | 43 | * bit 7: Sub-CPU busy (or halted) |
| 44 | 44 | * bit 0: EXTDET (?) |
| r5932 | r5933 | |
| 50 | 50 | READ8_HANDLER( fm7_subintf_r ) |
| 51 | 51 | { |
| 52 | 52 | UINT8 ret = 0x00; |
| 53 | ||
| 53 | ||
| 54 | 54 | if(fm7_video.sub_busy != 0 || fm7_video.sub_halt != 0) |
| 55 | 55 | ret |= 0x80; |
| 56 | ||
| 56 | ||
| 57 | 57 | ret |= 0x7e; |
| 58 | 58 | //ret |= 0x01; // EXTDET (not implemented yet) |
| 59 | ||
| 59 | ||
| 60 | 60 | return ret; |
| 61 | 61 | } |
| 62 | 62 | |
| r5932 | r5933 | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /* |
| 98 | * Reading from 0xd404 (sub-CPU) causes an "Attention" FIRQ on the main CPU | |
| 98 | * Reading from 0xd404 (sub-CPU) causes an "Attention" FIRQ on the main CPU | |
| 99 | 99 | */ |
| 100 | 100 | READ8_HANDLER( fm7_attn_irq_r ) |
| 101 | 101 | { |
| r5932 | r5933 | |
| 106 | 106 | |
| 107 | 107 | /* |
| 108 | 108 | * Sub CPU: I/O port 0xd409 |
| 109 | * | |
| 109 | * | |
| 110 | 110 | * On read, enables VRAM access |
| 111 | 111 | * On write, disables VRAM access |
| 112 | 112 | */ |
| r5932 | r5933 | |
| 130 | 130 | { |
| 131 | 131 | UINT8 temp; |
| 132 | 132 | int page = 0; |
| 133 | ||
| 133 | ||
| 134 | 134 | if(offset >= 0xc000) |
| 135 | 135 | page = 1; |
| 136 | 136 | |
| r5932 | r5933 | |
| 139 | 139 | fm7_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = dat; |
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | ||
| 142 | ||
| 143 | 143 | temp = fm7_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)]; |
| 144 | 144 | if(fm7_alu.command & 0x20) |
| 145 | 145 | { // "not equal" write mode |
| r5932 | r5933 | |
| 151 | 151 | temp &= ~fm7_alu.compare_data; |
| 152 | 152 | dat &= fm7_alu.compare_data; |
| 153 | 153 | } |
| 154 | ||
| 154 | ||
| 155 | 155 | fm7_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = temp | dat; |
| 156 | 156 | } |
| 157 | 157 | |
| r5932 | r5933 | |
| 159 | 159 | { |
| 160 | 160 | // COMPARE - compares which colors match those in the compare registers |
| 161 | 161 | // can be used on its own, or when bit 6 of the command register is high. |
| 162 | ||
| 162 | ||
| 163 | 163 | UINT8 red,green,blue; |
| 164 | 164 | UINT8 dat = 0; |
| 165 | 165 | UINT8 colour; |
| r5932 | r5933 | |
| 168 | 168 | int match; |
| 169 | 169 | int page = 0; |
| 170 | 170 | UINT8 bit = 0x80; |
| 171 | ||
| 171 | ||
| 172 | 172 | if(offset >= 0xc000) |
| 173 | 173 | { |
| 174 | 174 | page = 1; |
| r5932 | r5933 | |
| 176 | 176 | } |
| 177 | 177 | else |
| 178 | 178 | offset += fm7_video.vram_offset; |
| 179 | ||
| 179 | ||
| 180 | 180 | blue = fm7_video_ram[(offset & 0x3fff) + (page * 0xc000)]; |
| 181 | 181 | red = fm7_video_ram[(offset & 0x3fff) + 0x4000 + (page * 0xc000)]; |
| 182 | 182 | green = fm7_video_ram[(offset & 0x3fff) + 0x8000 + (page * 0xc000)]; |
| 183 | 183 | |
| 184 | 184 | banks = (~fm7_alu.bank_disable) & 0x07; |
| 185 | ||
| 185 | ||
| 186 | 186 | for(x=0;x<8;x++) // loop through each pixel |
| 187 | 187 | { |
| 188 | 188 | colour = 0; |
| r5932 | r5933 | |
| 192 | 192 | colour |= 2; |
| 193 | 193 | if(green & bit) |
| 194 | 194 | colour |= 4; |
| 195 | ||
| 195 | ||
| 196 | 196 | match = 0; |
| 197 | 197 | for(y=0;y<8;y++) // loop through each compare register |
| 198 | 198 | { |
| r5932 | r5933 | |
| 204 | 204 | } |
| 205 | 205 | if(match != 0) |
| 206 | 206 | dat |= bit; |
| 207 | ||
| 207 | ||
| 208 | 208 | bit >>= 1; |
| 209 | 209 | } |
| 210 | 210 | fm7_alu.compare_data = dat; |
| r5932 | r5933 | |
| 217 | 217 | UINT8 dat; |
| 218 | 218 | int page = 0; |
| 219 | 219 | UINT8 mask; |
| 220 | ||
| 220 | ||
| 221 | 221 | if(fm7_alu.command & 0x40) |
| 222 | 222 | fm7_alu_function_compare(offset); |
| 223 | ||
| 223 | ||
| 224 | 224 | if(offset >= 0xc000) |
| 225 | 225 | { |
| 226 | 226 | page = 1; |
| r5932 | r5933 | |
| 228 | 228 | } |
| 229 | 229 | else |
| 230 | 230 | offset += fm7_video.vram_offset; |
| 231 | ||
| 231 | ||
| 232 | 232 | for(x=0;x<3;x++) // cycle through banks |
| 233 | 233 | { |
| 234 | 234 | if(!(fm7_alu.bank_disable & (1 << x))) |
| r5932 | r5933 | |
| 237 | 237 | dat = 0xff; |
| 238 | 238 | else |
| 239 | 239 | dat = 0; |
| 240 | ||
| 240 | ||
| 241 | 241 | mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & fm7_alu.mask; |
| 242 | 242 | dat &= ~fm7_alu.mask; |
| 243 | 243 | dat |= mask; |
| 244 | ||
| 244 | ||
| 245 | 245 | fm7_alu_mask_write(offset,x,dat); |
| 246 | 246 | } |
| 247 | 247 | } |
| r5932 | r5933 | |
| 253 | 253 | UINT8 dat; |
| 254 | 254 | int page = 0; |
| 255 | 255 | UINT8 mask; |
| 256 | ||
| 256 | ||
| 257 | 257 | if(fm7_alu.command & 0x40) |
| 258 | 258 | fm7_alu_function_compare(offset); |
| 259 | ||
| 259 | ||
| 260 | 260 | if(offset >= 0xc000) |
| 261 | 261 | { |
| 262 | 262 | page = 1; |
| r5932 | r5933 | |
| 264 | 264 | } |
| 265 | 265 | else |
| 266 | 266 | offset += fm7_video.vram_offset; |
| 267 | ||
| 267 | ||
| 268 | 268 | for(x=0;x<3;x++) // cycle through banks |
| 269 | 269 | { |
| 270 | 270 | if(!(fm7_alu.bank_disable & (1 << x))) |
| r5932 | r5933 | |
| 273 | 273 | dat = 0xff; |
| 274 | 274 | else |
| 275 | 275 | dat = 0; |
| 276 | ||
| 276 | ||
| 277 | 277 | mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); |
| 278 | 278 | dat |= mask; |
| 279 | ||
| 279 | ||
| 280 | 280 | mask &= fm7_alu.mask; |
| 281 | 281 | dat &= ~fm7_alu.mask; |
| 282 | 282 | dat |= mask; |
| 283 | ||
| 283 | ||
| 284 | 284 | fm7_alu_mask_write(offset,x,dat); |
| 285 | 285 | } |
| 286 | 286 | } |
| r5932 | r5933 | |
| 292 | 292 | UINT8 dat; |
| 293 | 293 | int page = 0; |
| 294 | 294 | UINT8 mask; |
| 295 | ||
| 295 | ||
| 296 | 296 | if(fm7_alu.command & 0x40) |
| 297 | 297 | fm7_alu_function_compare(offset); |
| 298 | ||
| 298 | ||
| 299 | 299 | if(offset >= 0xc000) |
| 300 | 300 | { |
| 301 | 301 | page = 1; |
| r5932 | r5933 | |
| 303 | 303 | } |
| 304 | 304 | else |
| 305 | 305 | offset += fm7_video.vram_offset; |
| 306 | ||
| 306 | ||
| 307 | 307 | for(x=0;x<3;x++) // cycle through banks |
| 308 | 308 | { |
| 309 | 309 | if(!(fm7_alu.bank_disable & (1 << x))) |
| r5932 | r5933 | |
| 312 | 312 | dat = 0xff; |
| 313 | 313 | else |
| 314 | 314 | dat = 0; |
| 315 | ||
| 315 | ||
| 316 | 316 | mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); |
| 317 | 317 | dat &= mask; |
| 318 | ||
| 318 | ||
| 319 | 319 | mask &= fm7_alu.mask; |
| 320 | 320 | dat &= ~fm7_alu.mask; |
| 321 | 321 | dat |= mask; |
| 322 | ||
| 322 | ||
| 323 | 323 | fm7_alu_mask_write(offset,x,dat); |
| 324 | 324 | } |
| 325 | 325 | } |
| r5932 | r5933 | |
| 331 | 331 | UINT8 dat; |
| 332 | 332 | int page = 0; |
| 333 | 333 | UINT8 mask; |
| 334 | ||
| 334 | ||
| 335 | 335 | if(fm7_alu.command & 0x40) |
| 336 | 336 | fm7_alu_function_compare(offset); |
| 337 | ||
| 337 | ||
| 338 | 338 | if(offset >= 0xc000) |
| 339 | 339 | { |
| 340 | 340 | page = 1; |
| r5932 | r5933 | |
| 342 | 342 | } |
| 343 | 343 | else |
| 344 | 344 | offset += fm7_video.vram_offset; |
| 345 | ||
| 345 | ||
| 346 | 346 | for(x=0;x<3;x++) // cycle through banks |
| 347 | 347 | { |
| 348 | 348 | if(!(fm7_alu.bank_disable & (1 << x))) |
| r5932 | r5933 | |
| 351 | 351 | dat = 0xff; |
| 352 | 352 | else |
| 353 | 353 | dat = 0; |
| 354 | ||
| 354 | ||
| 355 | 355 | mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); |
| 356 | 356 | dat ^= mask; |
| 357 | ||
| 357 | ||
| 358 | 358 | mask &= fm7_alu.mask; |
| 359 | 359 | dat &= ~fm7_alu.mask; |
| 360 | 360 | dat |= mask; |
| 361 | ||
| 361 | ||
| 362 | 362 | fm7_alu_mask_write(offset,x,dat); |
| 363 | 363 | } |
| 364 | 364 | } |
| r5932 | r5933 | |
| 370 | 370 | UINT8 dat; |
| 371 | 371 | int page = 0; |
| 372 | 372 | UINT8 mask; |
| 373 | ||
| 373 | ||
| 374 | 374 | if(fm7_alu.command & 0x40) |
| 375 | 375 | fm7_alu_function_compare(offset); |
| 376 | ||
| 376 | ||
| 377 | 377 | if(offset >= 0xc000) |
| 378 | 378 | { |
| 379 | 379 | page = 1; |
| r5932 | r5933 | |
| 381 | 381 | } |
| 382 | 382 | else |
| 383 | 383 | offset += fm7_video.vram_offset; |
| 384 | ||
| 384 | ||
| 385 | 385 | for(x=0;x<3;x++) // cycle through banks |
| 386 | 386 | { |
| 387 | 387 | if(!(fm7_alu.bank_disable & (1 << x))) |
| r5932 | r5933 | |
| 390 | 390 | dat = 0xff; |
| 391 | 391 | else |
| 392 | 392 | dat = 0; |
| 393 | ||
| 393 | ||
| 394 | 394 | mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); |
| 395 | 395 | dat = ~mask; |
| 396 | ||
| 396 | ||
| 397 | 397 | mask &= fm7_alu.mask; |
| 398 | 398 | dat &= ~fm7_alu.mask; |
| 399 | 399 | dat |= mask; |
| 400 | ||
| 400 | ||
| 401 | 401 | fm7_alu_mask_write(offset,x,dat); |
| 402 | 402 | } |
| 403 | 403 | } |
| r5932 | r5933 | |
| 410 | 410 | UINT8 dat; |
| 411 | 411 | int page = 0; |
| 412 | 412 | UINT8 mask; |
| 413 | ||
| 413 | ||
| 414 | 414 | if(fm7_alu.command & 0x40) |
| 415 | 415 | fm7_alu_function_compare(offset); |
| 416 | ||
| 416 | ||
| 417 | 417 | if(offset >= 0xc000) |
| 418 | 418 | { |
| 419 | 419 | page = 1; |
| r5932 | r5933 | |
| 421 | 421 | } |
| 422 | 422 | else |
| 423 | 423 | offset += fm7_video.vram_offset; |
| 424 | ||
| 424 | ||
| 425 | 425 | for(x=0;x<3;x++) // cycle through banks |
| 426 | 426 | { |
| 427 | 427 | if(!(fm7_alu.bank_disable & (1 << x))) |
| 428 | 428 | { |
| 429 | 429 | mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); |
| 430 | ||
| 430 | ||
| 431 | 431 | dat = mask & fm7_alu.mask; |
| 432 | ||
| 432 | ||
| 433 | 433 | fm7_alu_mask_write(offset,x,dat); |
| 434 | 434 | } |
| 435 | 435 | } |
| r5932 | r5933 | |
| 442 | 442 | UINT8 dat = 0; |
| 443 | 443 | int page = 0; |
| 444 | 444 | UINT8 mask; |
| 445 | ||
| 445 | ||
| 446 | 446 | if(fm7_alu.command & 0x40) |
| 447 | 447 | fm7_alu_function_compare(offset); |
| 448 | ||
| 448 | ||
| 449 | 449 | if(offset >= 0xc000) |
| 450 | 450 | { |
| 451 | 451 | page = 1; |
| r5932 | r5933 | |
| 453 | 453 | } |
| 454 | 454 | else |
| 455 | 455 | offset += fm7_video.vram_offset; |
| 456 | ||
| 456 | ||
| 457 | 457 | for(x=0;x<3;x++) // cycle through banks |
| 458 | 458 | { |
| 459 | 459 | if(!(fm7_alu.bank_disable & (1 << x))) |
| r5932 | r5933 | |
| 473 | 473 | dat &= ~fm7_alu.mask; |
| 474 | 474 | mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & fm7_alu.mask; |
| 475 | 475 | dat |= mask; |
| 476 | ||
| 476 | ||
| 477 | 477 | fm7_alu_mask_write(offset,x,dat); |
| 478 | 478 | } |
| 479 | } | |
| 479 | } | |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | static void fm7_alu_function(UINT32 offset) |
| r5932 | r5933 | |
| 514 | 514 | { |
| 515 | 515 | UINT32 addr; |
| 516 | 516 | UINT8 pixel_mask[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe }; |
| 517 | ||
| 518 | ||
| 517 | ||
| 518 | ||
| 519 | 519 | if(fm7_video.modestatus & 0x40) // 320 pixels wide |
| 520 | 520 | { |
| 521 | 521 | addr = (x >> 3) + (y * 40); |
| r5932 | r5933 | |
| 528 | 528 | addr &= 0x3fff; |
| 529 | 529 | if(fm7_video.active_video_page != 0) |
| 530 | 530 | addr += 0xc000; |
| 531 | ||
| 531 | ||
| 532 | 532 | if(fm7_alu.command & 0x80) // ALU must be active |
| 533 | 533 | { |
| 534 | 534 | fm7_alu.mask = pixel_mask[x & 0x07]; |
| 535 | 535 | fm7_alu_function(addr); |
| 536 | 536 | } |
| 537 | ||
| 537 | ||
| 538 | 538 | return addr; |
| 539 | 539 | } |
| 540 | 540 | |
| r5932 | r5933 | |
| 550 | 550 | int byte_count = 0; |
| 551 | 551 | UINT16 old_addr = 0xffff; |
| 552 | 552 | UINT16 addr; |
| 553 | ||
| 553 | ||
| 554 | 554 | fm7_alu.busy = 1; |
| 555 | ||
| 555 | ||
| 556 | 556 | horiz = x2 - x1; |
| 557 | 557 | vert = y2 - y1; |
| 558 | ||
| 558 | ||
| 559 | 559 | if(horiz < 0) |
| 560 | 560 | { |
| 561 | 561 | dirx = -1; |
| r5932 | r5933 | |
| 570 | 570 | } |
| 571 | 571 | else |
| 572 | 572 | diry = 1; |
| 573 | ||
| 573 | ||
| 574 | 574 | if(horiz == 0 && vert == 0) |
| 575 | 575 | { |
| 576 | 576 | fm7_line_set_pixel(x1,y1); |
| r5932 | r5933 | |
| 624 | 624 | if(rep < 0) |
| 625 | 625 | { |
| 626 | 626 | rep += horiz; |
| 627 | y1 += diry; | |
| 627 | y1 += diry; | |
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | } |
| r5932 | r5933 | |
| 646 | 646 | if(rep < 0) |
| 647 | 647 | { |
| 648 | 648 | rep += vert; |
| 649 | x1 += dirx; | |
| 649 | x1 += dirx; | |
| 650 | 650 | } |
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | ||
| 653 | ||
| 654 | 654 | // set timer to disable busy flag |
| 655 | 655 | // 1/16 us for each byte changed |
| 656 | 656 | timer_set(machine,ATTOTIME_IN_USEC(byte_count/16),NULL,0,fm77av_alu_task_end); |
| r5932 | r5933 | |
| 670 | 670 | return 0xff; |
| 671 | 671 | if((offset < 0xc000 && offset >=0x8000) && (fm7_video.multi_page & 0x04)) |
| 672 | 672 | return 0xff; |
| 673 | ||
| 673 | ||
| 674 | 674 | if(fm7_alu.command & 0x80) // ALU active, writes to VRAM even when reading it (go figure) |
| 675 | 675 | { |
| 676 | 676 | fm7_alu_function(offset+page); |
| 677 | 677 | } |
| 678 | ||
| 678 | ||
| 679 | 679 | if(fm7_video.modestatus & 0x40) |
| 680 | 680 | { |
| 681 | 681 | if(fm7_video.active_video_page != 0) |
| r5932 | r5933 | |
| 697 | 697 | { |
| 698 | 698 | int offs; |
| 699 | 699 | UINT16 page = 0x0000; |
| 700 | ||
| 700 | ||
| 701 | 701 | if(fm7_video.active_video_page != 0) |
| 702 | 702 | page = 0xc000; |
| 703 | 703 | |
| r5932 | r5933 | |
| 713 | 713 | fm7_alu_function(offset+page); |
| 714 | 714 | return; |
| 715 | 715 | } |
| 716 | ||
| 716 | ||
| 717 | 717 | if(fm7_video.modestatus & 0x40) |
| 718 | 718 | { |
| 719 | 719 | if(fm7_video.active_video_page != 0) |
| r5932 | r5933 | |
| 728 | 728 | else |
| 729 | 729 | offs = (offset & 0xc000) | ((offset + fm7_video.vram_offset) & 0x3fff); |
| 730 | 730 | } |
| 731 | // | |
| 731 | // if(fm7_video.vram_access != 0) | |
| 732 | 732 | fm7_video_ram[offs+page] = data; |
| 733 | 733 | } |
| 734 | 734 | |
| r5932 | r5933 | |
| 750 | 750 | return; |
| 751 | 751 | if((offset < 0xc000 && offset >=0x8000) && (fm7_video.multi_page & 0x04)) |
| 752 | 752 | return; |
| 753 | ||
| 753 | ||
| 754 | 754 | if(fm7_alu.command & 0x80) // ALU active |
| 755 | 755 | { |
| 756 | 756 | fm7_alu_function(offset+page); |
| 757 | 757 | return; |
| 758 | 758 | } |
| 759 | ||
| 759 | ||
| 760 | 760 | if(fm7_video.modestatus & 0x40) |
| 761 | 761 | { |
| 762 | 762 | if(fm7_video.active_video_page != 0) |
| r5932 | r5933 | |
| 920 | 920 | |
| 921 | 921 | /* |
| 922 | 922 | * Sub CPU: I/O port 0xd408 |
| 923 | * | |
| 923 | * | |
| 924 | 924 | * On read, enables the CRT display |
| 925 | 925 | * On write, disables the CRT display |
| 926 | 926 | */ |
| r5932 | r5933 | |
| 937 | 937 | |
| 938 | 938 | /* |
| 939 | 939 | * Sub CPU: I/O ports 0xd40e - 0xd40f |
| 940 | * | |
| 940 | * | |
| 941 | 941 | * 0xd40e: bits 0-6 - offset in bytes (high byte) (bit 6 is used for 400 line video only) |
| 942 | 942 | * 0xd40f: bits 0-7 - offset in bytes (low byte) |
| 943 | 943 | */ |
| 944 | 944 | WRITE8_HANDLER( fm7_vram_offset_w ) |
| 945 | 945 | { |
| 946 | 946 | UINT16 new_offset = 0; |
| 947 | ||
| 947 | ||
| 948 | 948 | switch(offset) |
| 949 | 949 | { |
| 950 | 950 | case 0: |
| 951 | 951 | if(fm7_video.active_video_page != 0) |
| 952 | 952 | new_offset = ((data & 0x3f) << 8) | (fm7_video.vram_offset2 & 0x00ff); |
| 953 | 953 | else |
| 954 | new_offset = ((data & 0x3f) << 8) | (fm7_video.vram_offset & 0x00ff); | |
| 954 | new_offset = ((data & 0x3f) << 8) | (fm7_video.vram_offset & 0x00ff); | |
| 955 | 955 | break; |
| 956 | 956 | case 1: // low 5 bits are used on FM-77AV and later only |
| 957 | 957 | if(fm7_type == SYS_FM7) |
| r5932 | r5933 | |
| 974 | 974 | } |
| 975 | 975 | } |
| 976 | 976 | break; |
| 977 | } | |
| 977 | } | |
| 978 | 978 | if(fm7_video.active_video_page != 0) |
| 979 | 979 | fm7_video.vram_offset2 = new_offset; |
| 980 | 980 | else |
| r5932 | r5933 | |
| 984 | 984 | /* |
| 985 | 985 | * Main CPU: port 0xfd37 |
| 986 | 986 | * Multipage |
| 987 | * Port is write-only | |
| 988 | * | |
| 989 | * bits 6-4: VRAM planes to display (G,R,B) (1=disable) | |
| 987 | * Port is write-only | |
| 988 | * | |
| 989 | * bits 6-4: VRAM planes to display (G,R,B) (1=disable) | |
| 990 | 990 | * bits 2-0: VRAM CPU access (G,R,B) (1=disable) |
| 991 | 991 | */ |
| 992 | 992 | WRITE8_HANDLER( fm7_multipage_w ) |
| r5932 | r5933 | |
| 1010 | 1010 | WRITE8_HANDLER( fm7_palette_w ) |
| 1011 | 1011 | { |
| 1012 | 1012 | UINT8 r = 0,g = 0,b = 0; |
| 1013 | ||
| 1013 | ||
| 1014 | 1014 | if(data & 0x04) |
| 1015 | 1015 | g = 0xff; |
| 1016 | 1016 | if(data & 0x02) |
| 1017 | 1017 | r = 0xff; |
| 1018 | 1018 | if(data & 0x01) |
| 1019 | 1019 | b = 0xff; |
| 1020 | ||
| 1020 | ||
| 1021 | 1021 | palette_set_color(space->machine,offset,MAKE_RGB(r,g,b)); |
| 1022 | 1022 | fm7_video.fm7_pal[offset] = data & 0x07; |
| 1023 | 1023 | } |
| r5932 | r5933 | |
| 1026 | 1026 | * Main CPU: 0xfd30 - 0xfd34 |
| 1027 | 1027 | * Analog colour palette (FM-77AV and later only) |
| 1028 | 1028 | * All ports are write-only. |
| 1029 | * | |
| 1029 | * | |
| 1030 | 1030 | * fd30: colour select(?) high 4 bits (LC11-LC8) |
| 1031 | 1031 | * fd31: colour select(?) low 8 bits (LC7-LC0) |
| 1032 | 1032 | * fd32: blue level (4 bits) |
| 1033 | 1033 | * fd33: red level (4 bits) |
| 1034 | * fd34: green level (4 bits) | |
| 1034 | * fd34: green level (4 bits) | |
| 1035 | 1035 | */ |
| 1036 | 1036 | WRITE8_HANDLER( fm77av_analog_palette_w ) |
| 1037 | 1037 | { |
| 1038 | 1038 | int val; |
| 1039 | ||
| 1039 | ||
| 1040 | 1040 | switch(offset) |
| 1041 | 1041 | { |
| 1042 | 1042 | case 0: |
| r5932 | r5933 | |
| 1074 | 1074 | |
| 1075 | 1075 | /* |
| 1076 | 1076 | * Sub CPU: 0xd430 - BUSY/NMI/Bank register (FM77AV series only) |
| 1077 | * | |
| 1077 | * | |
| 1078 | 1078 | * On read: bit 7 - 0 if in VBlank |
| 1079 | 1079 | * bit 4 - ALU busy(0)/ready(1) |
| 1080 | 1080 | * bit 2 - VSync status (1 if active?) |
| 1081 | 1081 | * bit 0 - RESET |
| 1082 | * | |
| 1083 | * On write: bits 1-0 - CGROM select (maps to 0xd800) | |
| 1084 | * bit 2 - fine offset enable (enables OA4-OA0 bits in VRAM offset) | |
| 1082 | * | |
| 1083 | * On write: bits 1-0 - CGROM select (maps to 0xd800) | |
| 1084 | * bit 2 - fine offset enable (enables OA4-OA0 bits in VRAM offset) | |
| 1085 | 1085 | * bit 5 - active VRAM page |
| 1086 | 1086 | * bit 6 - display VRAM page |
| 1087 | 1087 | * bit 7 - NMI mask register (1=mask) |
| r5932 | r5933 | |
| 1089 | 1089 | READ8_HANDLER( fm77av_video_flags_r ) |
| 1090 | 1090 | { |
| 1091 | 1091 | UINT8 ret = 0xff; |
| 1092 | ||
| 1092 | ||
| 1093 | 1093 | if(video_screen_get_vblank(space->machine->primary_screen)) |
| 1094 | 1094 | ret &= ~0x80; |
| 1095 | ||
| 1095 | ||
| 1096 | 1096 | if(fm7_alu.busy != 0) |
| 1097 | 1097 | ret &= ~0x10; |
| 1098 | ||
| 1098 | ||
| 1099 | 1099 | if(fm7_video.vsync_flag == 0) |
| 1100 | 1100 | ret &= ~0x04; |
| 1101 | 1101 | |
| 1102 | 1102 | if(!fm7_video.sub_reset) |
| 1103 | 1103 | ret &= ~0x01; |
| 1104 | ||
| 1104 | ||
| 1105 | 1105 | return ret; |
| 1106 | 1106 | } |
| 1107 | 1107 | |
| r5932 | r5933 | |
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | 1120 | /* |
| 1121 | * Main CPU: port 0xfd12 | |
| 1121 | * Main CPU: port 0xfd12 | |
| 1122 | 1122 | * Sub mode status register (FM-77AV or later) |
| 1123 | 1123 | * bit 6 (R/W) - Video mode width(?) 0=640 (default) 1=320. |
| 1124 | 1124 | * bit 1 (R/O) - DISPTMG status (0=blank) |
| r5932 | r5933 | |
| 1127 | 1127 | READ8_HANDLER( fm77av_sub_modestatus_r ) |
| 1128 | 1128 | { |
| 1129 | 1129 | UINT8 ret = 0x00; |
| 1130 | ||
| 1130 | ||
| 1131 | 1131 | ret |= 0xbc; |
| 1132 | 1132 | ret |= (fm7_video.modestatus & 0x40); |
| 1133 | ||
| 1133 | ||
| 1134 | 1134 | if(!video_screen_get_vblank(space->machine->primary_screen)) |
| 1135 | 1135 | ret |= 0x02; |
| 1136 | ||
| 1136 | ||
| 1137 | 1137 | if(fm7_video.vsync_flag != 0) |
| 1138 | 1138 | ret |= 0x01; |
| 1139 | ||
| 1139 | ||
| 1140 | 1140 | return ret; |
| 1141 | 1141 | } |
| 1142 | 1142 | |
| r5932 | r5933 | |
| 1163 | 1163 | /* |
| 1164 | 1164 | * Main CPU: port 0xfd13 |
| 1165 | 1165 | * Sub Bank select register |
| 1166 | * | |
| 1166 | * | |
| 1167 | 1167 | * bits 1 and 0 select which subsys ROM to be banked into sub CPU space |
| 1168 | 1168 | * on the FM-77AV40 and later, bit 2 can also selected to bank in sub monitor RAM. |
| 1169 | 1169 | */ |
| 1170 | 1170 | WRITE8_HANDLER( fm77av_sub_bank_w ) |
| 1171 | 1171 | { |
| 1172 | // | |
| 1172 | // UINT8* RAM = memory_region(space->machine,"sub"); | |
| 1173 | 1173 | UINT8* ROM; |
| 1174 | 1174 | static int prev; |
| 1175 | ||
| 1175 | ||
| 1176 | 1176 | if((data & 0x03) == (prev & 0x03)) |
| 1177 | 1177 | return; |
| 1178 | ||
| 1178 | ||
| 1179 | 1179 | fm7_video.subrom = data & 0x03; |
| 1180 | 1180 | switch (data & 0x03) |
| 1181 | 1181 | { |
| 1182 | 1182 | case 0x00: // Type C, 640x200 (as used on the FM-7) |
| 1183 | 1183 | ROM = memory_region(space->machine,"subsys_c"); |
| 1184 | // | |
| 1184 | // memory_set_bankptr(space->machine,20,ROM); | |
| 1185 | 1185 | memory_set_bankptr(space->machine,21,ROM+0x800); |
| 1186 | 1186 | logerror("VID: Sub ROM Type C selected\n"); |
| 1187 | 1187 | break; |
| 1188 | 1188 | case 0x01: // Type A, 640x200 |
| 1189 | 1189 | ROM = memory_region(space->machine,"subsys_a"); |
| 1190 | // | |
| 1190 | // memory_set_bankptr(space->machine,20,RAM+0xd800); | |
| 1191 | 1191 | memory_set_bankptr(space->machine,21,ROM); |
| 1192 | 1192 | logerror("VID: Sub ROM Type A selected\n"); |
| 1193 | 1193 | break; |
| 1194 | 1194 | case 0x02: // Type B, 320x200 |
| 1195 | 1195 | ROM = memory_region(space->machine,"subsys_b"); |
| 1196 | // | |
| 1196 | // memory_set_bankptr(space->machine,20,RAM+0xd800); | |
| 1197 | 1197 | memory_set_bankptr(space->machine,21,ROM); |
| 1198 | 1198 | logerror("VID: Sub ROM Type B selected\n"); |
| 1199 | 1199 | break; |
| 1200 | 1200 | case 0x03: // CG Font? |
| 1201 | 1201 | ROM = memory_region(space->machine,"subsyscg"); |
| 1202 | // | |
| 1202 | // memory_set_bankptr(space->machine,20,RAM+0xd800); | |
| 1203 | 1203 | memory_set_bankptr(space->machine,21,ROM); |
| 1204 | 1204 | logerror("VID: Sub ROM CG selected\n"); |
| 1205 | 1205 | break; |
| r5932 | r5933 | |
| 1215 | 1215 | /* |
| 1216 | 1216 | * Sub CPU: ports 0xd410-0xd42b (FM-77AV and later only) |
| 1217 | 1217 | * Video operations |
| 1218 | * | |
| 1218 | * | |
| 1219 | 1219 | * 0xd410 (R/W): Command register |
| 1220 | 1220 | * bit 7: 0=DIS 1=Start |
| 1221 | 1221 | * bits 6-5: MBIT1, MBIT2 |
| r5932 | r5933 | |
| 1238 | 1238 | * 0xd424-25(W): Line X0 (High-Low, X9-X0) |
| 1239 | 1239 | * 0xd426-27(W): Line Y0 (High-Low, Y8-Y0) |
| 1240 | 1240 | * 0xd428-29(W): Line X1 (High-Low, X9-X0) |
| 1241 | * 0xd42a-2b(W): Line Y1 (High-Low, Y8-Y0) | |
| 1241 | * 0xd42a-2b(W): Line Y1 (High-Low, Y8-Y0) | |
| 1242 | 1242 | */ |
| 1243 | 1243 | READ8_HANDLER( fm77av_alu_r ) |
| 1244 | 1244 | { |
| r5932 | r5933 | |
| 1269 | 1269 | WRITE8_HANDLER( fm77av_alu_w ) |
| 1270 | 1270 | { |
| 1271 | 1271 | UINT16 dat; |
| 1272 | ||
| 1272 | ||
| 1273 | 1273 | switch(offset) |
| 1274 | 1274 | { |
| 1275 | 1275 | case 0x00: |
| r5932 | r5933 | |
| 1297 | 1297 | break; |
| 1298 | 1298 | case 0x0b: |
| 1299 | 1299 | fm7_alu.bank_disable = data & 0x03; |
| 1300 | // | |
| 1300 | // logerror("ALU: write to bank disable register - %02x\n",data); | |
| 1301 | 1301 | break; |
| 1302 | 1302 | case 0x0c: |
| 1303 | 1303 | fm7_alu.tilepaint_b = data; |
| 1304 | // | |
| 1304 | // logerror("ALU: write to tilepaint (blue) register - %02x\n",data); | |
| 1305 | 1305 | break; |
| 1306 | 1306 | case 0x0d: |
| 1307 | 1307 | fm7_alu.tilepaint_r = data; |
| 1308 | // | |
| 1308 | // logerror("ALU: write to tilepaint (red) register - %02x\n",data); | |
| 1309 | 1309 | break; |
| 1310 | 1310 | case 0x0e: |
| 1311 | 1311 | fm7_alu.tilepaint_g = data; |
| 1312 | // | |
| 1312 | // logerror("ALU: write to tilepaint (green) register - %02x\n",data); | |
| 1313 | 1313 | break; |
| 1314 | 1314 | case 0x10: |
| 1315 | 1315 | dat = ((data & 0x1f) << 8) | (fm7_alu.addr_offset & 0x00ff); |
| 1316 | 1316 | fm7_alu.addr_offset = dat; |
| 1317 | // | |
| 1317 | // logerror("ALU: write to address offset (high) register - %02x (%04x)\n",data,fm7_alu.addr_offset); | |
| 1318 | 1318 | break; |
| 1319 | 1319 | case 0x11: |
| 1320 | 1320 | dat = (fm7_alu.addr_offset & 0xff00) | data; |
| 1321 | 1321 | fm7_alu.addr_offset = dat; |
| 1322 | // | |
| 1322 | // logerror("ALU: write to address offset (low) register - %02x (%04x)\n",data,fm7_alu.addr_offset); | |
| 1323 | 1323 | break; |
| 1324 | 1324 | case 0x12: |
| 1325 | 1325 | dat = (data << 8) | (fm7_alu.line_style & 0x00ff); |
| 1326 | 1326 | fm7_alu.line_style = dat; |
| 1327 | // | |
| 1327 | // logerror("ALU: write to line style (high) register - %02x (%04x)\n",data,fm7_alu.line_style); | |
| 1328 | 1328 | break; |
| 1329 | 1329 | case 0x13: |
| 1330 | 1330 | dat = (fm7_alu.line_style & 0xff00) | data; |
| 1331 | 1331 | fm7_alu.line_style = dat; |
| 1332 | // | |
| 1332 | // logerror("ALU: write to line style (low) register - %02x (%04x)\n",data,fm7_alu.line_style); | |
| 1333 | 1333 | break; |
| 1334 | 1334 | case 0x14: |
| 1335 | 1335 | dat = ((data & 0x03) << 8) | (fm7_alu.x0 & 0x00ff); |
| 1336 | 1336 | fm7_alu.x0 = dat; |
| 1337 | // | |
| 1337 | // logerror("ALU: write to X0 (high) register - %02x (%04x)\n",data,fm7_alu.x0); | |
| 1338 | 1338 | break; |
| 1339 | 1339 | case 0x15: |
| 1340 | 1340 | dat = (fm7_alu.x0 & 0xff00) | data; |
| 1341 | 1341 | fm7_alu.x0 = dat; |
| 1342 | // | |
| 1342 | // logerror("ALU: write to X0 (low) register - %02x (%04x)\n",data,fm7_alu.x0); | |
| 1343 | 1343 | break; |
| 1344 | 1344 | case 0x16: |
| 1345 | 1345 | dat = ((data & 0x01) << 8) | (fm7_alu.y0 & 0x00ff); |
| 1346 | 1346 | fm7_alu.y0 = dat; |
| 1347 | // | |
| 1347 | // logerror("ALU: write to Y0 (high) register - %02x (%04x)\n",data,fm7_alu.y0); | |
| 1348 | 1348 | break; |
| 1349 | 1349 | case 0x17: |
| 1350 | 1350 | dat = (fm7_alu.y0 & 0xff00) | data; |
| 1351 | 1351 | fm7_alu.y0 = dat; |
| 1352 | // | |
| 1352 | // logerror("ALU: write to Y0 (low) register - %02x (%04x)\n",data,fm7_alu.y0); | |
| 1353 | 1353 | break; |
| 1354 | 1354 | case 0x18: |
| 1355 | 1355 | dat = ((data & 0x03) << 8) | (fm7_alu.x1 & 0x00ff); |
| 1356 | 1356 | fm7_alu.x1 = dat; |
| 1357 | // | |
| 1357 | // logerror("ALU: write to X1 (high) register - %02x (%04x)\n",data,fm7_alu.x1); | |
| 1358 | 1358 | break; |
| 1359 | 1359 | case 0x19: |
| 1360 | 1360 | dat = (fm7_alu.x1 & 0xff00) | data; |
| 1361 | 1361 | fm7_alu.x1 = dat; |
| 1362 | // | |
| 1362 | // logerror("ALU: write to X1 (low) register - %02x (%04x)\n",data,fm7_alu.x1); | |
| 1363 | 1363 | break; |
| 1364 | 1364 | case 0x1a: |
| 1365 | 1365 | dat = ((data & 0x01) << 8) | (fm7_alu.y1 & 0x00ff); |
| 1366 | 1366 | fm7_alu.y1 = dat; |
| 1367 | // | |
| 1367 | // logerror("ALU: write to Y1 (high) register - %02x (%04x)\n",data,fm7_alu.y1); | |
| 1368 | 1368 | break; |
| 1369 | 1369 | case 0x1b: |
| 1370 | 1370 | dat = (fm7_alu.y1 & 0xff00) | data; |
| 1371 | 1371 | fm7_alu.y1 = dat; |
| 1372 | 1372 | // draw line |
| 1373 | 1373 | fm77av_line_draw(space->machine); |
| 1374 | // | |
| 1374 | // logerror("ALU: write to Y1 (low) register - %02x (%04x)\n",data,fm7_alu.y1); | |
| 1375 | 1375 | break; |
| 1376 | 1376 | default: |
| 1377 | 1377 | logerror("ALU: write 0x%02x to invalid register 0x%02x\n",data,offset); |
| r5932 | r5933 | |
| 1397 | 1397 | { |
| 1398 | 1398 | UINT8* RAM = memory_region(space->machine,"maincpu"); |
| 1399 | 1399 | UINT8* ROM; |
| 1400 | ||
| 1400 | ||
| 1401 | 1401 | if(!fm7_video.sub_halt) |
| 1402 | 1402 | return 0xff; |
| 1403 | ||
| 1403 | ||
| 1404 | 1404 | if(offset < 0x380) // work RAM |
| 1405 | 1405 | return RAM[0x1d000+offset]; |
| 1406 | 1406 | if(offset >= 0x380 && offset < 0x400) // shared RAM |
| r5932 | r5933 | |
| 1412 | 1412 | ROM = memory_region(space->machine,"subsyscg"); |
| 1413 | 1413 | return ROM[(fm7_video.cgrom*0x800)+(offset-0x800)]; |
| 1414 | 1414 | } |
| 1415 | ||
| 1415 | ||
| 1416 | 1416 | if(offset >= 0x410 && offset <= 0x42b) |
| 1417 | 1417 | return fm77av_alu_r(space,offset-0x410); |
| 1418 | ||
| 1418 | ||
| 1419 | 1419 | switch(offset) |
| 1420 | 1420 | { |
| 1421 | 1421 | case 0x400: |
| r5932 | r5933 | |
| 1440 | 1440 | return fm77av_key_encoder_r(space,offset-0x431); |
| 1441 | 1441 | default: |
| 1442 | 1442 | logerror("Unmapped read from sub CPU port 0xd%03x via MMR banking\n",offset); |
| 1443 | return 0xff; | |
| 1443 | return 0xff; | |
| 1444 | 1444 | } |
| 1445 | 1445 | return 0xff; |
| 1446 | 1446 | } |
| r5932 | r5933 | |
| 1467 | 1467 | RAM[0x1d000+offset] = data; |
| 1468 | 1468 | return; |
| 1469 | 1469 | } |
| 1470 | ||
| 1470 | ||
| 1471 | 1471 | if(offset >= 0x410 && offset <= 0x42b) |
| 1472 | 1472 | { |
| 1473 | 1473 | fm77av_alu_w(space,offset-0x410,data); |
| 1474 | 1474 | return; |
| 1475 | 1475 | } |
| 1476 | ||
| 1476 | ||
| 1477 | 1477 | switch(offset) |
| 1478 | 1478 | { |
| 1479 | 1479 | case 0x408: |
| r5932 | r5933 | |
| 1504 | 1504 | READ8_HANDLER( fm7_console_ram_banked_r ) |
| 1505 | 1505 | { |
| 1506 | 1506 | UINT8* RAM = memory_region(space->machine,"maincpu"); |
| 1507 | ||
| 1507 | ||
| 1508 | 1508 | if(!fm7_video.sub_halt) |
| 1509 | 1509 | return 0xff; |
| 1510 | ||
| 1510 | ||
| 1511 | 1511 | return RAM[0x1c000+offset]; |
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | 1514 | WRITE8_HANDLER( fm7_console_ram_banked_w ) |
| 1515 | 1515 | { |
| 1516 | 1516 | UINT8* RAM = memory_region(space->machine,"maincpu"); |
| 1517 | ||
| 1517 | ||
| 1518 | 1518 | if(!fm7_video.sub_halt) |
| 1519 | 1519 | return; |
| 1520 | ||
| 1520 | ||
| 1521 | 1521 | RAM[0x1c000+offset] = data; |
| 1522 | 1522 | } |
| 1523 | 1523 | |
| r5932 | r5933 | |
| 1547 | 1547 | UINT16 col; |
| 1548 | 1548 | int y, x, b; |
| 1549 | 1549 | UINT16 page = 0x0000; |
| 1550 | ||
| 1550 | ||
| 1551 | 1551 | if(fm7_video.display_video_page != 0) |
| 1552 | 1552 | page = 0xc000; |
| 1553 | 1553 | |
| r5932 | r5933 | |
| 1583 | 1583 | } |
| 1584 | 1584 | for (b = 0; b < 8; b++) |
| 1585 | 1585 | { |
| 1586 | 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); | |
| 1586 | 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); | |
| 1587 | 1587 | 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); |
| 1588 | 1588 | 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); |
| 1589 | 1589 | col += 8; // use analog palette |
| r5932 | r5933 | |
| 1629 | 1629 | PALETTE_INIT( fm7 ) |
| 1630 | 1630 | { |
| 1631 | 1631 | int x; |
| 1632 | ||
| 1632 | ||
| 1633 | 1633 | palette_set_colors(machine, 0, fm7_initial_palette, ARRAY_LENGTH(fm7_initial_palette)); |
| 1634 | 1634 | for(x=0;x<8;x++) |
| 1635 | 1635 | fm7_video.fm7_pal[x] = x; |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _______ _______ | |
| 10 | CLK_ 1 ---| \/ |--- 24 Vdd | |
| 11 | DMAO_ 2 ---| |--- 23 CLEAR_ | |
| 12 | INT_ 3 ---| |--- 22 SC1 | |
| 13 | TPA 4 ---| |--- 21 SC0 | |
| 14 | TPB 5 ---| |--- 20 DI7 | |
| 15 | COMP SYNC_ 6 ---| CDP1861C |--- 19 DI6 | |
| 16 | VIDEO 7 ---| top view |--- 18 DI5 | |
| 17 | RESET_ 8 ---| |--- 17 DI4 | |
| 18 | EFX_ 9 ---| |--- 16 DI3 | |
| 19 | DISP ON 10 ---| |--- 15 DI2 | |
| 20 | DISP OFF 11 ---| |--- 14 DI1 | |
| 21 | Vss 12 ---|________________|--- 13 DI0 | |
| 9 | _______ _______ | |
| 10 | CLK_ 1 ---| \/ |--- 24 Vdd | |
| 11 | DMAO_ 2 ---| |--- 23 CLEAR_ | |
| 12 | INT_ 3 ---| |--- 22 SC1 | |
| 13 | TPA 4 ---| |--- 21 SC0 | |
| 14 | TPB 5 ---| |--- 20 DI7 | |
| 15 | COMP SYNC_ 6 ---| CDP1861C |--- 19 DI6 | |
| 16 | VIDEO 7 ---| top view |--- 18 DI5 | |
| 17 | RESET_ 8 ---| |--- 17 DI4 | |
| 18 | EFX_ 9 ---| |--- 16 DI3 | |
| 19 | DISP ON 10 ---| |--- 15 DI2 | |
| 20 | DISP OFF 11 ---| |--- 14 DI1 | |
| 21 | Vss 12 ---|________________|--- 13 DI0 | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | ||
| 24 | http://homepage.mac.com/ruske/cosmacelf/cdp1861.pdf | |
| 25 | 25 | |
| 26 | 26 | **********************************************************************/ |
| 27 | 27 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | vtech2.c | |
| 3 | 3 | |
| 4 | 4 | video hardware |
| 5 | Juergen Buchmueller <pullmoll@t-online.de> MESS driver, Jan 2000 | |
| 6 | Davide Moretti <dave@rimini.com> ROM dump and hardware description | |
| 5 | Juergen Buchmueller <pullmoll@t-online.de> MESS driver, Jan 2000 | |
| 6 | Davide Moretti <dave@rimini.com> ROM dump and hardware description | |
| 7 | 7 | |
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 | |
| r5932 | r5933 | |
| 137 | 137 | case 0: |
| 138 | 138 | case 1: |
| 139 | 139 | /* |
| 140 | * GR 5 | |
| 141 | * 640x192 1bpp | |
| 142 | */ | |
| 140 | * GR 5 | |
| 141 | * 640x192 1bpp | |
| 142 | */ | |
| 143 | 143 | for( y = 0; y < 192; y++ ) |
| 144 | 144 | { |
| 145 | 145 | offs = offs_2[y]; |
| r5932 | r5933 | |
| 156 | 156 | |
| 157 | 157 | case 2: |
| 158 | 158 | /* |
| 159 | * GR 4 | |
| 160 | * 320x192 1bpp with two colors per 8 pixels | |
| 161 | */ | |
| 159 | * GR 4 | |
| 160 | * 320x192 1bpp with two colors per 8 pixels | |
| 161 | */ | |
| 162 | 162 | for( y = 0; y < 192; y++ ) |
| 163 | 163 | { |
| 164 | 164 | offs = offs_2[y]; |
| r5932 | r5933 | |
| 176 | 176 | |
| 177 | 177 | case 3: |
| 178 | 178 | /* |
| 179 | * GR 3 | |
| 180 | * 160x192 4bpp | |
| 181 | */ | |
| 179 | * GR 3 | |
| 180 | * 160x192 4bpp | |
| 181 | */ | |
| 182 | 182 | for( y = 0; y < 192; y++ ) |
| 183 | 183 | { |
| 184 | 184 | offs = offs_2[y]; |
| r5932 | r5933 | |
| 196 | 196 | case 4: |
| 197 | 197 | case 5: |
| 198 | 198 | /* |
| 199 | * GR 0 | |
| 200 | * 160x96 4bpp | |
| 201 | */ | |
| 199 | * GR 0 | |
| 200 | * 160x96 4bpp | |
| 201 | */ | |
| 202 | 202 | for( y = 0; y < 96; y++ ) |
| 203 | 203 | { |
| 204 | 204 | offs = offs_0[y]; |
| r5932 | r5933 | |
| 215 | 215 | |
| 216 | 216 | case 6: |
| 217 | 217 | /* |
| 218 | ||
| 218 | * GR 2 | |
| 219 | 219 | * 320x192 1bpp |
| 220 | 220 | */ |
| 221 | 221 | for( y = 0; y < 192; y++ ) |
| r5932 | r5933 | |
| 234 | 234 | |
| 235 | 235 | case 7: |
| 236 | 236 | /* |
| 237 | * GR 1 | |
| 238 | * 160x192 1bpp with two colors per 8 pixels | |
| 239 | */ | |
| 237 | * GR 1 | |
| 238 | * 160x192 1bpp with two colors per 8 pixels | |
| 239 | */ | |
| 240 | 240 | for( y = 0; y < 192; y++ ) |
| 241 | 241 | { |
| 242 | 242 | offs = offs_1[y]; |
| r5932 | r5933 | |
|---|---|---|
| 19 | 19 | }; |
| 20 | 20 | |
| 21 | 21 | /* |
| 22 | ||
| 22 | foreground: | |
| 23 | 23 | |
| 24 | ||
| 24 | "full" of each component | |
| 25 | 25 | |
| 26 | black, | |
| 27 | blue, | |
| 28 | red, | |
| 29 | magenta, | |
| 30 | green, | |
| 31 | cyan | |
| 32 | yellow | |
| 33 | white | |
| 26 | black, | |
| 27 | blue, | |
| 28 | red, | |
| 29 | magenta, | |
| 30 | green, | |
| 31 | cyan | |
| 32 | yellow | |
| 33 | white | |
| 34 | 34 | |
| 35 | "full of each component + half of another component" | |
| 36 | black | |
| 37 | violet | |
| 38 | red/purple | |
| 39 | pastel green | |
| 40 | sky blue | |
| 41 | yellow/green | |
| 42 | white | |
| 35 | "full of each component + half of another component" | |
| 36 | black | |
| 37 | violet | |
| 38 | red/purple | |
| 39 | pastel green | |
| 40 | sky blue | |
| 41 | yellow/green | |
| 42 | white | |
| 43 | 43 | |
| 44 | background: | |
| 45 | "half" of each component | |
| 46 | black | |
| 47 | dark blue | |
| 48 | dark red | |
| 49 | dark magenta | |
| 50 | dark green | |
| 51 | dark cyan | |
| 52 | dark yellow | |
| 53 | dark white (grey) | |
| 44 | background: | |
| 45 | "half" of each component | |
| 46 | black | |
| 47 | dark blue | |
| 48 | dark red | |
| 49 | dark magenta | |
| 50 | dark green | |
| 51 | dark cyan | |
| 52 | dark yellow | |
| 53 | dark white (grey) | |
| 54 | 54 | |
| 55 | 55 | */ |
| 56 | 56 | |
| r5932 | r5933 | |
| 194 | 194 | |
| 195 | 195 | /* |
| 196 | 196 | |
| 197 | - 1750000 cpu cycles per second | |
| 198 | - 35000 cpu cycles per frame | |
| 199 | - 35000/312 = 112.179 cycles per line | |
| 200 | - 112.179/(512/8) = 1.752 cycles per 8-pixels | |
| 197 | - 1750000 cpu cycles per second | |
| 198 | - 35000 cpu cycles per frame | |
| 199 | - 35000/312 = 112.179 cycles per line | |
| 200 | - 112.179/(512/8) = 1.752 cycles per 8-pixels | |
| 201 | 201 | */ |
| 202 | 202 | |
| 203 | 203 | /* Operation: |
| 204 | 204 | |
| 205 | - Vertical and horizontal dimensions are split into states. | |
| 206 | - Horizontal states take a multiple of horizontal cycles, and vertical states take a multiple of lines. | |
| 207 | - The horizontal states comprise left border, main display, right border and horizontal retrace timing. | |
| 208 | - The vertical states comprise top border, main display, bottom border and vertical retrace timing. | |
| 205 | - Vertical and horizontal dimensions are split into states. | |
| 206 | - Horizontal states take a multiple of horizontal cycles, and vertical states take a multiple of lines. | |
| 207 | - The horizontal states comprise left border, main display, right border and horizontal retrace timing. | |
| 208 | - The vertical states comprise top border, main display, bottom border and vertical retrace timing. | |
| 209 | 209 | |
| 210 | 210 | |
| 211 | - if frame rate is 50Hz, and there are 312 lines, then the line rate is 15600Hz. | |
| 212 | - Each frame takes 0.02 seconds, and each line takes 0.0000064 seconds - approx 64microseconds per line | |
| 211 | - if frame rate is 50Hz, and there are 312 lines, then the line rate is 15600Hz. | |
| 212 | - Each frame takes 0.02 seconds, and each line takes 0.0000064 seconds - approx 64microseconds per line | |
| 213 | 213 | |
| 214 | ||
| 214 | - the event list is based on cpu time | |
| 215 | 215 | |
| 216 | 216 | */ |
| 217 | 217 | |
| r5932 | r5933 | |
| 305 | 305 | /* border */ |
| 306 | 306 | case 0: |
| 307 | 307 | { |
| 308 | // | |
| 308 | // video_update->render_x+=(cycles_to_do)*8; | |
| 309 | 309 | } |
| 310 | 310 | break; |
| 311 | 311 | |
| r5932 | r5933 | |
| 345 | 345 | /* border */ |
| 346 | 346 | case 2: |
| 347 | 347 | { |
| 348 | // | |
| 348 | // video_update->render_x+=(cycles_to_do)*8; | |
| 349 | 349 | } |
| 350 | 350 | break; |
| 351 | 351 | |
| r5932 | r5933 | |
| 441 | 441 | /* border */ |
| 442 | 442 | case 0: |
| 443 | 443 | { |
| 444 | // | |
| 444 | // cycles_done = cycles_to_do; | |
| 445 | 445 | } |
| 446 | 446 | break; |
| 447 | 447 | |
| r5932 | r5933 | |
| 461 | 461 | /* border */ |
| 462 | 462 | case 2: |
| 463 | 463 | { |
| 464 | // | |
| 464 | // cycles_done = cycles_to_do; | |
| 465 | 465 | } |
| 466 | 466 | break; |
| 467 | 467 | |
| 468 | 468 | /* not visible */ |
| 469 | 469 | case 3: |
| 470 | 470 | { |
| 471 | // | |
| 471 | // cycles_done = cycles_to_do; | |
| 472 | 472 | } |
| 473 | 473 | break; |
| 474 | 474 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | * | |
| 2 | * | |
| 3 | 3 | * FM-7 header file |
| 4 | * | |
| 4 | * | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #ifndef FM7_H_ |
| r5932 | r5933 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | /*********************************************** |
| 27 | 27 | |
| 28 | ||
| 28 | CBM Quickloads | |
| 29 | 29 | |
| 30 | 30 | ***********************************************/ |
| 31 | 31 | |
| r5932 | r5933 | |
| 43 | 43 | |
| 44 | 44 | /*********************************************** |
| 45 | 45 | |
| 46 | ||
| 46 | CBM Cartridges | |
| 47 | 47 | |
| 48 | 48 | ***********************************************/ |
| 49 | 49 | |
| r5932 | r5933 | |
| 76 | 76 | |
| 77 | 77 | /*********************************************** |
| 78 | 78 | |
| 79 | ||
| 79 | CBM Datasette Tapes | |
| 80 | 80 | |
| 81 | 81 | ***********************************************/ |
| 82 | 82 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * includes/apple2gs.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * Apple IIgs |
| 6 | 6 | * |
| 7 | 7 | ****************************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * includes/apple3.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * Apple /// |
| 6 | 6 | * |
| 7 | 7 | ****************************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * includes/mac.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * Macintosh driver declarations |
| 6 | 6 | * |
| 7 | 7 | ****************************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | includes/coco.h | |
| 4 | 4 | |
| 5 | ||
| 5 | CoCo/Dragon | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 30 | 30 | UINT8 b2m_color[4]; |
| 31 | 31 | UINT8 b2m_localmachine; |
| 32 | 32 | UINT8 vblank_state; |
| 33 | ||
| 33 | ||
| 34 | 34 | /* devices */ |
| 35 | 35 | const device_config *fdc; |
| 36 | 36 | const device_config *pic; |
| r5932 | r5933 | |
|---|---|---|
| 47 | 47 | WRITE8_HANDLER ( raaspec_led_w ); |
| 48 | 48 | |
| 49 | 49 | READ8_HANDLER ( vectrex_via_r ); |
| 50 | WRITE8_HANDLER ( vectrex_via_w ); | |
| 50 | WRITE8_HANDLER ( vectrex_via_w ); | |
| 51 | 51 | |
| 52 | 52 | void vectrex_add_point_stereo (int x, int y, rgb_t color, int intensity); |
| 53 | 53 | void vectrex_add_point (int x, int y, rgb_t color, int intensity); |
| r5932 | r5933 | |
|---|---|---|
| 12 | 12 | /*----------- defined in machine/vc1541.c -----------*/ |
| 13 | 13 | |
| 14 | 14 | /* we currently have preliminary support for 1541 & 1551 only */ |
| 15 | enum { | |
| 15 | enum { | |
| 16 | 16 | type_1541 = 0, |
| 17 | 17 | type_1541ii, |
| 18 | 18 | type_1551, |
| r5932 | r5933 | |
| 29 | 29 | type_8250, |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | enum { | |
| 32 | enum { | |
| 33 | 33 | format_d64 = 0, /* 1541 image, 35 tracks */ |
| 34 | 34 | format_d64_err, /* 1541 image, 35 tracks + error table */ |
| 35 | 35 | format_d64_40t, /* 1541 image, 40 tracks */ |
| r5932 | r5933 | |
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | |
| 166 | Note: according to additional docs at zimmers.net, ROMs in these drive | |
| 167 | were interchangeable: you could burn later revisions on EEPROM and put | |
| 166 | Note: according to additional docs at zimmers.net, ROMs in these drive | |
| 167 | were interchangeable: you could burn later revisions on EEPROM and put | |
| 168 | 168 | them in older drives and they would work perfectly. |
| 169 | 169 | |
| 170 | 170 | ****************************************************************************/ |
| r5932 | r5933 | |
| 177 | 177 | ROM_LOAD( "325303-01.ub3", 0xe000, 0x2000, CRC(10b39158) SHA1(56dfe79b26f50af4e83fd9604857756d196516b9) ) |
| 178 | 178 | |
| 179 | 179 | /* |
| 180 | rev. 01 - It is believed to be the first revision of the 1541 firmware. The service manual says that this ROM | |
| 180 | rev. 01 - It is believed to be the first revision of the 1541 firmware. The service manual says that this ROM | |
| 181 | 181 | is for North America and Japan only. |
| 182 | rev. 02 - Second version of the 1541 firmware. The service manual says that this ROM was not available in North | |
| 182 | rev. 02 - Second version of the 1541 firmware. The service manual says that this ROM was not available in North | |
| 183 | 183 | America (Japan only?). |
| 184 | 184 | rev. 03 - It is said to be the first version that is usable in Europe (in the service manual?). |
| 185 | 185 | rev. 05 - From an old-style 1541 with short board. |
| r5932 | r5933 | |
| 264 | 264 | ****************************************************************************/ |
| 265 | 265 | |
| 266 | 266 | // no locations available for this, I need a picture of the board |
| 267 | // currently, we add 1570 to 1571, to preserve the firmware. | |
| 267 | // currently, we add 1570 to 1571, to preserve the firmware. | |
| 268 | 268 | // this will be used later, when proper drives will be added to each system |
| 269 | 269 | #define C1570_ROM( cpu ) \ |
| 270 | 270 | ROM_REGION( 0x10000, cpu, 0) \ |
| r5932 | r5933 | |
| 292 | 292 | rev. 01 - First revision of 1581 firmware |
| 293 | 293 | rev. 02 - Second revision of 1581 firmware |
| 294 | 294 | beta - Probably a beta version |
| 295 | 1563 - This comes from a prototype unit of the so-called c128d/81 (a c128d with built-in 1581 drive). | |
| 295 | 1563 - This comes from a prototype unit of the so-called c128d/81 (a c128d with built-in 1581 drive). | |
| 296 | 296 | Despite the label, is a 1581 firmaware |
| 297 | 297 | */ |
| 298 | 298 | #define C1581_ROM( cpu ) \ |
| r5932 | r5933 | |
| 369 | 369 | |
| 370 | 370 | Notes: The DOS 2.7 ROM in SFD-1001 is the same as in 8250 drives. Differences: |
| 371 | 371 | |
| 372 | CBM 8050 - dual 5" 1/4 floppy drive, disks are written on one side | |
| 373 | with double density | |
| 374 | CBM 8250 / 8250LP - dual 5.25" 1/4 floppy drive, disks are written | |
| 375 | on both sides. it reads 8050-disks, LP version has smaller case | |
| 376 | SFD-1001 - single 5" 1/4 floppy drive, same as CBM 8250LP, but only | |
| 377 | one drive and 1541-case | |
| 372 | CBM 8050 - dual 5" 1/4 floppy drive, disks are written on one side | |
| 373 | with double density | |
| 374 | CBM 8250 / 8250LP - dual 5.25" 1/4 floppy drive, disks are written | |
| 375 | on both sides. it reads 8050-disks, LP version has smaller case | |
| 376 | SFD-1001 - single 5" 1/4 floppy drive, same as CBM 8250LP, but only | |
| 377 | one drive and 1541-case | |
| 378 | 378 | |
| 379 | 379 | ****************************************************************************/ |
| 380 | 380 | |
| r5932 | r5933 | |
| 422 | 422 | ****************************************************************************/ |
| 423 | 423 | |
| 424 | 424 | #define C4040_ROM( cpu ) \ |
| 425 | ROM_REGION( 0x10000, cpu, 0 ) | |
| 425 | ROM_REGION( 0x10000, cpu, 0 ) | |
| 426 | 426 | |
| 427 | 427 | // still to be sorted out |
| 428 | 428 | |
| r5932 | r5933 | |
| 463 | 463 | drive Tandon TM603S (9090) |
| 464 | 464 | |
| 465 | 465 | |
| 466 | Note: The Commodore D9060 and D9090 can use the same firmware. The | |
| 467 | difference between these units is that the jumper J14 on the DOS board | |
| 468 | is open in the D9060, and closed in the D9090 to select a 4-head vs. | |
| 466 | Note: The Commodore D9060 and D9090 can use the same firmware. The | |
| 467 | difference between these units is that the jumper J14 on the DOS board | |
| 468 | is open in the D9060, and closed in the D9090 to select a 4-head vs. | |
| 469 | 469 | 6-head drive. The jumper J13 seems to be unused. |
| 470 | 470 | |
| 471 | 471 | ****************************************************************************/ |
| r5932 | r5933 | |
| 488 | 488 | |
| 489 | 489 | /**************************************************************************** |
| 490 | 490 | |
| 491 | ||
| 491 | Dual 8" floppy drive. Related to any other drive? What about 8060? | |
| 492 | 492 | |
| 493 | 493 | ****************************************************************************/ |
| 494 | 494 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * includes/lisa.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * Lisa driver declarations |
| 6 | 6 | * |
| 7 | 7 | ****************************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 63 | 63 | |
| 64 | 64 | // CRTC 6845 |
| 65 | 65 | typedef struct |
| 66 | { | |
| 66 | { | |
| 67 | 67 | UINT8 cursor_address_lo; |
| 68 | 68 | UINT8 cursor_address_hi; |
| 69 | 69 | UINT8 screen_address_lo; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * includes/c128.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * Commodore C128 Home Computer |
| 6 | * | |
| 6 | * | |
| 7 | 7 | * peter.trauner@jk.uni-linz.ac.at |
| 8 | 8 | * |
| 9 | 9 | * Documentation: iDOC (http://www.softwolves.pp.se/idoc) |
| 10 | 10 | * Christian Janoff <mepk@c64.org> |
| 11 | * | |
| 11 | * | |
| 12 | 12 | ****************************************************************************/ |
| 13 | 13 | |
| 14 | 14 | #ifndef C128_H_ |
| r5932 | r5933 | |
|---|---|---|
| 38 | 38 | int screen_mode; |
| 39 | 39 | int cassette_motor_mode; |
| 40 | 40 | int capslock_mode; |
| 41 | // | |
| 41 | // int scanline; | |
| 42 | 42 | /* tape reading related */ |
| 43 | 43 | UINT32 tape_value; |
| 44 | 44 | int tape_steps; |
| r5932 | r5933 | |
|---|---|---|
| 44 | 44 | |
| 45 | 45 | /* keyboard state */ |
| 46 | 46 | int abc77_txd; /* ABC-77 transmit data */ |
| 47 | ||
| 47 | ||
| 48 | 48 | /* video state */ |
| 49 | 49 | UINT8 *charram; /* character RAM */ |
| 50 | 50 | UINT8 *videoram; /* HR video RAM */ |
| r5932 | r5933 | |
|---|---|---|
| 13 | 13 | |
| 14 | 14 | extern UINT8 orion128_video_mode; |
| 15 | 15 | extern UINT8 orion128_video_page; |
| 16 | extern UINT8 orion128_video_width; | |
| 16 | extern UINT8 orion128_video_width; | |
| 17 | 17 | extern UINT8 orion_video_mode_mask ; |
| 18 | 18 | extern UINT8 orionpro_pseudo_color; |
| 19 | 19 | |
| r5932 | r5933 | |
| 31 | 31 | extern READ8_HANDLER ( orion128_system_r ); |
| 32 | 32 | extern WRITE8_HANDLER ( orion128_system_w ); |
| 33 | 33 | extern READ8_HANDLER ( orion128_romdisk_r ); |
| 34 | extern WRITE8_HANDLER ( orion128_romdisk_w ); | |
| 35 | extern WRITE8_HANDLER ( orion128_video_mode_w ); | |
| 36 | extern WRITE8_HANDLER ( orion128_memory_page_w ); | |
| 34 | extern WRITE8_HANDLER ( orion128_romdisk_w ); | |
| 35 | extern WRITE8_HANDLER ( orion128_video_mode_w ); | |
| 36 | extern WRITE8_HANDLER ( orion128_memory_page_w ); | |
| 37 | 37 | extern WRITE8_HANDLER ( orion128_video_page_w ); |
| 38 | 38 | extern WRITE8_HANDLER ( orionz80_memory_page_w ); |
| 39 | 39 | extern WRITE8_HANDLER ( orionz80_dispatcher_w ); |
| r5932 | r5933 | |
| 48 | 48 | extern MACHINE_RESET( orionpro ); |
| 49 | 49 | extern READ8_HANDLER ( orionpro_io_r ); |
| 50 | 50 | extern WRITE8_HANDLER ( orionpro_io_w ); |
| 51 | ||
| 51 | ||
| 52 | 52 | /*----------- defined in video/orion.c -----------*/ |
| 53 | 53 | |
| 54 | 54 | extern VIDEO_START( orion128 ); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * includes/bebox.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * BeBox |
| 6 | 6 | * |
| 7 | 7 | ****************************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 10 | 10 | #define CASSETTE_TAG "cassette" |
| 11 | 11 | #define CENTRONICS_TAG "centronics" |
| 12 | 12 | |
| 13 | //#define I8085_TAG "m19" | |
| 14 | //#define I8155_TAG "m12" | |
| 15 | //#define MC14412_TAG "m8" | |
| 13 | //#define I8085_TAG "m19" | |
| 14 | //#define I8155_TAG "m12" | |
| 15 | //#define MC14412_TAG "m8" | |
| 16 | 16 | #define RP5C01A_TAG "m301" |
| 17 | 17 | #define TCM5089_TAG "m11" |
| 18 | 18 | #define HD61830_TAG "m18" |
| r5932 | r5933 | |
|---|---|---|
| 14 | 14 | extern READ8_HANDLER( mz80k_strobe_r ); |
| 15 | 15 | extern WRITE8_HANDLER( mz80k_strobe_w ); |
| 16 | 16 | |
| 17 | extern const i8255a_interface mz80k_8255_int; | |
| 17 | extern const i8255a_interface mz80k_8255_int; | |
| 18 | 18 | extern const struct pit8253_config mz80k_pit8253_config; |
| 19 | 19 | |
| 20 | 20 | extern UINT8 mz80k_vertical; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * includes/cybiko.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * Cybiko Wireless Inter-tainment System |
| 6 | * | |
| 6 | * | |
| 7 | 7 | * (c) 2001-2007 Tim Schuerewegen |
| 8 | * | |
| 8 | * | |
| 9 | 9 | * Cybiko Classic (V1) |
| 10 | 10 | * Cybiko Classic (V2) |
| 11 | 11 | * Cybiko Xtreme |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * includes/c64.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * Commodore C64 Home Computer |
| 6 | * | |
| 6 | * | |
| 7 | 7 | * peter.trauner@jk.uni-linz.ac.at |
| 8 | * | |
| 8 | * | |
| 9 | 9 | * Documentation: www.funet.fi |
| 10 | 10 | * |
| 11 | 11 | ****************************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | * | |
| 3 | * includes/genesis.h | |
| 4 | 4 | * |
| 5 | 5 | ****************************************************************************/ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 13 | 13 | { |
| 14 | 14 | UINT8 *page_ram; /* page memory */ |
| 15 | 15 | UINT8 *charram; /* character generator ROM */ |
| 16 | int cdp1802_mode; /* CPU mode */ | |
| 16 | int cdp1802_mode; /* CPU mode */ | |
| 17 | 17 | int dma; /* memory refresh DMA */ |
| 18 | 18 | const device_config *cdp1869; |
| 19 | 19 | |
| 20 | 20 | /* timers */ |
| 21 | 21 | emu_timer *reset_timer; /* power on reset timer */ |
| 22 | ||
| 22 | ||
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | /*----------- defined in machine/pecom.c -----------*/ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | Intel 28F640J5 Flash ROM emulation (could also handle 28F320J5 with minor | |
| 3 | changes, and possibly 28F256J3, 28F128J3, 28F640J3 and 28F320J3) | |
| 2 | Intel 28F640J5 Flash ROM emulation (could also handle 28F320J5 with minor | |
| 3 | changes, and possibly 28F256J3, 28F128J3, 28F640J3 and 28F320J3) | |
| 4 | 4 | |
| 5 | The 28F640J5 is a 64Mbit FEEPROM that can be accessed either on an 8-bit or | |
| 6 | a 16-bit bus. | |
| 5 | The 28F640J5 is a 64Mbit FEEPROM that can be accessed either on an 8-bit or | |
| 6 | a 16-bit bus. | |
| 7 | 7 | |
| 8 | References: | |
| 9 | Datasheets were found on Intel's site (www.intel.com) | |
| 8 | References: | |
| 9 | Datasheets were found on Intel's site (www.intel.com) | |
| 10 | 10 | |
| 11 | ||
| 11 | Raphael Nabet 2004, based on MAME's intelfsh.c core | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | #include "driver.h" |
| r5932 | r5933 | |
| 64 | 64 | #define CLEAR_BLOCKLOCK(id, block) (strata[(id)].blocklock[(block) >> 3] &= ~(1 << ((block) & 7))) |
| 65 | 65 | |
| 66 | 66 | /* |
| 67 | Initialize one FEEPROM chip: may be called at driver init or image load | |
| 68 | time (or machine init time if you don't use MESS image core) | |
| 67 | Initialize one FEEPROM chip: may be called at driver init or image load | |
| 68 | time (or machine init time if you don't use MESS image core) | |
| 69 | 69 | */ |
| 70 | 70 | int strataflash_init(running_machine *machine, int id) |
| 71 | 71 | { |
| r5932 | r5933 | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /* |
| 100 | ||
| 100 | load the FEEPROM contents from file | |
| 101 | 101 | */ |
| 102 | 102 | int strataflash_load(int id, mame_file *file) |
| 103 | 103 | { |
| r5932 | r5933 | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /* |
| 150 | ||
| 150 | save the FEEPROM contents to file | |
| 151 | 151 | */ |
| 152 | 152 | int strataflash_save(int id, mame_file *file) |
| 153 | 153 | { |
| r5932 | r5933 | |
| 166 | 166 | return 1; |
| 167 | 167 | |
| 168 | 168 | /* chip state: lower boot block lockout, higher boot block lockout, |
| 169 | ||
| 169 | software data protect */ | |
| 170 | 170 | buf = strata[id].master_lock; |
| 171 | 171 | if (mame_fwrite(file, & buf, 1) != 1) |
| 172 | 172 | return 1; |
| r5932 | r5933 | |
| 214 | 214 | } bus_width_t; |
| 215 | 215 | |
| 216 | 216 | /* |
| 217 | ||
| 217 | read a 8/16-bit word from FEEPROM | |
| 218 | 218 | */ |
| 219 | 219 | static int strataflash_r(int id, offs_t offset, bus_width_t bus_width) |
| 220 | 220 | { |
| r5932 | r5933 | |
| 294 | 294 | } |
| 295 | 295 | return 0; // default case |
| 296 | 296 | /*case 0x03: // master lock config |
| 297 | if (strata[id].flash_master_lock) | |
| 298 | return 1; | |
| 299 | else | |
| 300 | return 0; | |
| 301 | */ | |
| 297 | if (strata[id].flash_master_lock) | |
| 298 | return 1; | |
| 299 | else | |
| 300 | return 0; | |
| 301 | */ | |
| 302 | 302 | |
| 303 | 303 | /* CFI query identification string */ |
| 304 | 304 | case 0x10: |
| r5932 | r5933 | |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /* |
| 413 | ||
| 413 | write a 8/16-bit word to FEEPROM | |
| 414 | 414 | */ |
| 415 | 415 | static void strataflash_w(int id, offs_t offset, int data, bus_width_t bus_width) |
| 416 | 416 | { |
| r5932 | r5933 | |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | /* |
| 659 | ||
| 659 | read a 8-bit word from FEEPROM | |
| 660 | 660 | */ |
| 661 | 661 | UINT8 strataflash_8_r(int id, offs_t offset) |
| 662 | 662 | { |
| r5932 | r5933 | |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | /* |
| 667 | ||
| 667 | write a 8-bit word to FEEPROM | |
| 668 | 668 | */ |
| 669 | 669 | void strataflash_8_w(int id, offs_t offset, UINT8 data) |
| 670 | 670 | { |
| r5932 | r5933 | |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | /* |
| 675 | ||
| 675 | read a 16-bit word from FEEPROM | |
| 676 | 676 | */ |
| 677 | 677 | UINT16 strataflash_16_r(int id, offs_t offset) |
| 678 | 678 | { |
| r5932 | r5933 | |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /* |
| 683 | ||
| 683 | write a 16-bit word to FEEPROM | |
| 684 | 684 | */ |
| 685 | 685 | void strataflash_16_w(int id, offs_t offset, UINT16 data) |
| 686 | 686 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | NEC | |
| 3 | NEC ?PD7201 Multiprotocol Serial Communications Controller emulation | |
| 4 | 4 | |
| 5 | 5 | Copyright MESS Team. |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| r5932 | r5933 | |
| 110 | 110 | |
| 111 | 111 | static DEVICE_START( upd7201 ) |
| 112 | 112 | { |
| 113 | // upd7201_t *upd7201 = get_safe_token(device); | |
| 114 | // const upd7201_interface *intf = get_interface(device); | |
| 113 | // upd7201_t *upd7201 = get_safe_token(device); | |
| 114 | // const upd7201_interface *intf = get_interface(device); | |
| 115 | 115 | |
| 116 | 116 | /* resolve callbacks */ |
| 117 | 117 | |
| r5932 | r5933 | |
| 120 | 120 | /* create the timers */ |
| 121 | 121 | |
| 122 | 122 | /* register for state saving */ |
| 123 | // | |
| 123 | // state_save_register_device_item(device, 0, upd7201->); | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /*------------------------------------------------- |
| r5932 | r5933 | |
| 142 | 142 | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 143 | 143 | |
| 144 | 144 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 145 | case DEVINFO_STR_NAME: strcpy(info->s, "NEC µPD7201"); break; | |
| 146 | case DEVINFO_STR_FAMILY: strcpy(info->s, "NEC µPD7201"); break; | |
| 145 | case DEVINFO_STR_NAME: strcpy(info->s, "NEC ?PD7201"); break; | |
| 146 | case DEVINFO_STR_FAMILY: strcpy(info->s, "NEC ?PD7201"); break; | |
| 147 | 147 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 148 | 148 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 149 | 149 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MESS Team"); break; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | strata.h: header file for strata.c | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | int strataflash_init(running_machine *machine, int id); |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | machine\dgn_beta.c (machine.c) |
| 4 | 4 | |
| 5 | ||
| 5 | Moved out of dragon.c, 2005-05-05, P.Harvey-Smith. | |
| 6 | 6 | |
| 7 | I decided to move this out of the main Dragon/CoCo source files, as | |
| 8 | the Beta is so radically different from the other Dragon machines that | |
| 9 | this made more sense (to me at least). | |
| 7 | I decided to move this out of the main Dragon/CoCo source files, as | |
| 8 | the Beta is so radically different from the other Dragon machines that | |
| 9 | this made more sense (to me at least). | |
| 10 | 10 | |
| 11 | 11 | Functions to emulate general aspects of the machine (RAM, ROM, interrupts, |
| 12 | 12 | I/O ports) |
| 13 | 13 | |
| 14 | 14 | References: |
| 15 | ||
| 15 | Disassembly of Dragon Beta ROM, examination of only (known) surviving board. | |
| 16 | 16 | |
| 17 | 17 | TODO: |
| 18 | ||
| 18 | Pretty much everything ! | |
| 19 | 19 | |
| 20 | ||
| 20 | Display working with 6845 taking data from rom. | |
| 21 | 21 | |
| 22 | 22 | 2005-05-10 |
| 23 | ||
| 23 | Memory banking seems to be working, as documented in code comments below. | |
| 24 | 24 | |
| 25 | 25 | 2005-05-31 |
| 26 | ||
| 26 | CPU#2 now executes code correctly to do transfers from WD2797. | |
| 27 | 27 | |
| 28 | 28 | 2005-06-03 |
| 29 | 29 | |
| 30 | When fed a standard OS-9 boot disk it reads in the boot file and attempts | |
| 31 | to start it, not being able to find init, it fails. Hopefully I will | |
| 32 | soon have an image of a Beta boot disk. | |
| 30 | When fed a standard OS-9 boot disk it reads in the boot file and attempts | |
| 31 | to start it, not being able to find init, it fails. Hopefully I will | |
| 32 | soon have an image of a Beta boot disk. | |
| 33 | 33 | |
| 34 | 34 | 2005-11-29 |
| 35 | 35 | |
| 36 | Major track tracing excersise on scans of bare beta board, reveal where a | |
| 37 | whole bunch of the PIA lines go, especially the IRQs, most of them go back | |
| 38 | to the IRQ line on the main CPU. | |
| 36 | Major track tracing excersise on scans of bare beta board, reveal where a | |
| 37 | whole bunch of the PIA lines go, especially the IRQs, most of them go back | |
| 38 | to the IRQ line on the main CPU. | |
| 39 | 39 | |
| 40 | 40 | 2005-12-07 |
| 41 | 41 | |
| 42 | ||
| 42 | First booted to OS9 prompt, did not execute startup scripts. | |
| 43 | 43 | |
| 44 | 44 | 2005-12-08 |
| 45 | 45 | |
| 46 | Fixed density setting on WD2797, so density of read data is now | |
| 47 | correctlty set as required by OS-9. This was the reason startup | |
| 48 | script was not being executed as Beta disks have a single denisty | |
| 49 | boot track, however the rest of the disk is double density. | |
| 50 | Booted completely to OS-9, including running startup script. | |
| 46 | Fixed density setting on WD2797, so density of read data is now | |
| 47 | correctlty set as required by OS-9. This was the reason startup | |
| 48 | script was not being executed as Beta disks have a single denisty | |
| 49 | boot track, however the rest of the disk is double density. | |
| 50 | Booted completely to OS-9, including running startup script. | |
| 51 | 51 | |
| 52 | 52 | 2006-09-27 |
| 53 | 53 | |
| 54 | ||
| 54 | Clean up of IRQ/FIRQ handling code allows correct booting again. | |
| 55 | 55 | |
| 56 | 56 | ***************************************************************************/ |
| 57 | 57 | |
| r5932 | r5933 | |
| 131 | 131 | static int d_pia1_pa_last; |
| 132 | 132 | static int d_pia1_pb_last; |
| 133 | 133 | static int DMA_NMI_LAST; |
| 134 | //static int DMA_NMI; | |
| 134 | //static int DMA_NMI; /* DMA cpu has received an NMI */ | |
| 135 | 135 | |
| 136 | 136 | #define INVALID_KEYROW -1 /* no ketrow selected */ |
| 137 | 137 | #define NO_KEY_PRESSED 0x7F /* retrurned by hardware if no key pressed */ |
| r5932 | r5933 | |
| 151 | 151 | DEVCB_NULL, |
| 152 | 152 | DEVCB_NULL, |
| 153 | 153 | DEVCB_NULL, |
| 154 | /*outputs: A/B,CA/B2 | |
| 154 | /*outputs: A/B,CA/B2 */ | |
| 155 | 155 | DEVCB_HANDLER(d_pia0_pa_w), |
| 156 | 156 | DEVCB_HANDLER(d_pia0_pb_w), |
| 157 | 157 | DEVCB_NULL, |
| 158 | 158 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 159 | /*irqs | |
| 159 | /*irqs | |
| 160 | 160 | DEVCB_LINE(d_pia0_irq_a), |
| 161 | 161 | DEVCB_LINE(d_pia0_irq_b) |
| 162 | 162 | }, |
| r5932 | r5933 | |
| 170 | 170 | DEVCB_NULL, |
| 171 | 171 | DEVCB_NULL, |
| 172 | 172 | DEVCB_NULL, |
| 173 | /*outputs: A/B,CA/B2 | |
| 173 | /*outputs: A/B,CA/B2 */ | |
| 174 | 174 | DEVCB_HANDLER(d_pia1_pa_w), |
| 175 | 175 | DEVCB_HANDLER(d_pia1_pb_w), |
| 176 | 176 | DEVCB_NULL, |
| 177 | 177 | DEVCB_NULL, |
| 178 | /*irqs | |
| 178 | /*irqs | |
| 179 | 179 | DEVCB_LINE(d_pia1_irq_a), |
| 180 | 180 | DEVCB_LINE(d_pia1_irq_b) |
| 181 | 181 | }, |
| r5932 | r5933 | |
| 191 | 191 | DEVCB_NULL, |
| 192 | 192 | DEVCB_NULL, |
| 193 | 193 | DEVCB_NULL, |
| 194 | /*outputs: A/B,CA/B2 | |
| 194 | /*outputs: A/B,CA/B2 */ | |
| 195 | 195 | DEVCB_HANDLER(d_pia2_pa_w), |
| 196 | 196 | DEVCB_HANDLER(d_pia2_pb_w), |
| 197 | 197 | DEVCB_NULL, |
| 198 | 198 | DEVCB_NULL, |
| 199 | /*irqs | |
| 199 | /*irqs | |
| 200 | 200 | DEVCB_LINE(d_pia2_irq_a), |
| 201 | 201 | DEVCB_LINE(d_pia2_irq_b) |
| 202 | 202 | } |
| r5932 | r5933 | |
| 491 | 491 | of the output shift register that is zero, most of the time there should |
| 492 | 492 | only be one row active e.g. |
| 493 | 493 | |
| 494 | Shifter Row being scanned | |
| 495 | 1111111110 0 | |
| 496 | 1111111101 1 | |
| 497 | 1111111011 2 | |
| 494 | Shifter Row being scanned | |
| 495 | 1111111110 0 | |
| 496 | 1111111101 1 | |
| 497 | 1111111011 2 | |
| 498 | 498 | |
| 499 | 499 | etc. |
| 500 | 500 | |
| r5932 | r5933 | |
| 548 | 548 | |
| 549 | 549 | /*********************************** PIA Handlers ************************/ |
| 550 | 550 | /* PIA #0 at $FC20-$FC23 I46 |
| 551 | This handles:- | |
| 552 | The Printer port, side A, | |
| 553 | PB0 R16 (pullup) -> Printer Port (PL1) | |
| 554 | PB1 Printer Port | |
| 555 | PB2 Keyboard (any key). | |
| 556 | PB3 D4 -> R37 -> TR1 switching circuit -> PL5 | |
| 557 | PB4 Keyboard Data out, clocked by CB2. | |
| 558 | positive edge clocks data out of the input shift register. | |
| 559 | PB5 Keyboard data in, clocked by PB4. | |
| 560 | PB6 R79 -> I99/6/7416 -> PL9/26/READY (from floppy) | |
| 561 | PB7 Printer port | |
| 562 | CB1 I36/39/6845(Horz Sync) | |
| 563 | CB2 Keyboard (out) Low loads input shift reg | |
| 551 | This handles:- | |
| 552 | The Printer port, side A, | |
| 553 | PB0 R16 (pullup) -> Printer Port (PL1) | |
| 554 | PB1 Printer Port | |
| 555 | PB2 Keyboard (any key). | |
| 556 | PB3 D4 -> R37 -> TR1 switching circuit -> PL5 | |
| 557 | PB4 Keyboard Data out, clocked by CB2. | |
| 558 | positive edge clocks data out of the input shift register. | |
| 559 | PB5 Keyboard data in, clocked by PB4. | |
| 560 | PB6 R79 -> I99/6/7416 -> PL9/26/READY (from floppy) | |
| 561 | PB7 Printer port | |
| 562 | CB1 I36/39/6845(Horz Sync) | |
| 563 | CB2 Keyboard (out) Low loads input shift reg | |
| 564 | 564 | */ |
| 565 | 565 | static READ8_DEVICE_HANDLER(d_pia0_pa_r) |
| 566 | 566 | { |
| r5932 | r5933 | |
| 576 | 576 | int RetVal; |
| 577 | 577 | int Idx; |
| 578 | 578 | int Selected; |
| 579 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", | |
| 579 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", | |
| 580 | 580 | "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" }; |
| 581 | ||
| 581 | ||
| 582 | 582 | LOG_KEYBOARD(("PB Read\n")); |
| 583 | 583 | |
| 584 | 584 | KAny_next = 0; |
| r5932 | r5933 | |
| 617 | 617 | static WRITE8_DEVICE_HANDLER(d_pia0_pb_w) |
| 618 | 618 | { |
| 619 | 619 | int InClkState; |
| 620 | //int | |
| 620 | //int OutClkState; | |
| 621 | 621 | |
| 622 | 622 | LOG_KEYBOARD(("PB Write\n")); |
| 623 | 623 | |
| 624 | 624 | InClkState = data & KInClk; |
| 625 | //OutClkState | |
| 625 | //OutClkState = data & KOutClk; | |
| 626 | 626 | |
| 627 | 627 | LOG_KEYBOARD(("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(d_pia0_pb_last & KInClk),Keyrow)); |
| 628 | 628 | |
| r5932 | r5933 | |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | /* PIA #1 at $FC24-$FC27 I63 |
| 678 | This handles :- | |
| 679 | Mouse + Disk Select on side A | |
| 680 | Halt on DMA CPU PA7 | |
| 681 | Beeper PB0 | |
| 682 | Halt on main CPU PB1 | |
| 683 | Character set select PB6 | |
| 684 | Baud rate PB1..PB5 ???? | |
| 678 | This handles :- | |
| 679 | Mouse + Disk Select on side A | |
| 680 | Halt on DMA CPU PA7 | |
| 681 | Beeper PB0 | |
| 682 | Halt on main CPU PB1 | |
| 683 | Character set select PB6 | |
| 684 | Baud rate PB1..PB5 ???? | |
| 685 | 685 | */ |
| 686 | 686 | |
| 687 | 687 | static READ8_DEVICE_HANDLER(d_pia1_pa_r) |
| r5932 | r5933 | |
| 693 | 693 | { |
| 694 | 694 | int HALT_DMA; |
| 695 | 695 | const device_config *fdc = devtag_get_device(device->machine, "wd179x"); |
| 696 | ||
| 696 | ||
| 697 | 697 | /* Only play with halt line if halt bit changed since last write */ |
| 698 | 698 | if((data & 0x80) != d_pia1_pa_last) |
| 699 | 699 | { |
| r5932 | r5933 | |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | /* PIA #2 at FCC0-FCC3 I28 |
| 771 | This handles :- | |
| 772 | DAT task select PA0..PA3 | |
| 771 | This handles :- | |
| 772 | DAT task select PA0..PA3 | |
| 773 | 773 | |
| 774 | ||
| 774 | DMA CPU NMI PA7 | |
| 775 | 775 | |
| 776 | Graphics control PB0..PB7 ??? | |
| 777 | VSYNC intutrupt CB2 | |
| 776 | Graphics control PB0..PB7 ??? | |
| 777 | VSYNC intutrupt CB2 | |
| 778 | 778 | */ |
| 779 | 779 | static READ8_DEVICE_HANDLER(d_pia2_pa_r) |
| 780 | 780 | { |
| r5932 | r5933 | |
| 1012 | 1012 | #if 0 |
| 1013 | 1013 | int Idx; |
| 1014 | 1014 | int Row; |
| 1015 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", | |
| 1015 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", | |
| 1016 | 1016 | "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" }; |
| 1017 | ||
| 1017 | ||
| 1018 | 1018 | LOG_KEYBOARD(("Scanning Host keyboard\n")); |
| 1019 | 1019 | |
| 1020 | 1020 | for(Idx=0; Idx<NoKeyrows; Idx++) |
| r5932 | r5933 | |
| 1056 | 1056 | |
| 1057 | 1057 | void dgn_beta_line_interrupt (int data) |
| 1058 | 1058 | { |
| 1059 | // /* Set PIA line, so it recognises inturrupt */ | |
| 1060 | // if (data) | |
| 1061 | // { | |
| 1062 | // pia_0_cb1_w(machine, 0,ASSERT_LINE); | |
| 1063 | // } | |
| 1064 | // else | |
| 1065 | // { | |
| 1066 | // pia_0_cb1_w(machine, 0,CLEAR_LINE); | |
| 1067 | // } | |
| 1059 | // /* Set PIA line, so it recognises inturrupt */ | |
| 1060 | // if (data) | |
| 1061 | // { | |
| 1062 | // pia_0_cb1_w(machine, 0,ASSERT_LINE); | |
| 1063 | // } | |
| 1064 | // else | |
| 1065 | // { | |
| 1066 | // pia_0_cb1_w(machine, 0,CLEAR_LINE); | |
| 1067 | // } | |
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | |
| r5932 | r5933 | |
| 1107 | 1107 | KAny_next = 0x00; /* Next value for KAny */ |
| 1108 | 1108 | |
| 1109 | 1109 | DMA_NMI_LAST = 0x80; /* start with DMA NMI inactive, as pulled up */ |
| 1110 | // | |
| 1110 | // DMA_NMI = CLEAR_LINE; /* start with DMA NMI inactive */ | |
| 1111 | 1111 | |
| 1112 | 1112 | wd17xx_set_density(fdc, DEN_MFM_LO); |
| 1113 | 1113 | wd17xx_set_drive(fdc, 0); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | pdp1 machine code | |
| 3 | 3 | |
| 4 | ||
| 4 | includes emulation for I/O devices (with the IOT opcode) and control panel functions | |
| 5 | 5 | |
| 6 | TODO: | |
| 7 | * typewriter out should overwrite the typewriter buffer | |
| 8 | * improve emulation of the internals of tape reader? | |
| 9 | * improve puncher timing? | |
| 6 | TODO: | |
| 7 | * typewriter out should overwrite the typewriter buffer | |
| 8 | * improve emulation of the internals of tape reader? | |
| 9 | * improve puncher timing? | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | #include <stdio.h> |
| r5932 | r5933 | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | /* |
| 50 | devices which are known to generate a completion pulse (source: maintainance manual 9-??, | |
| 51 | and 9-20, 9-21): | |
| 52 | emulated: | |
| 53 | * perforated tape reader | |
| 54 | * perforated tape punch | |
| 55 | * typewriter output | |
| 56 | * CRT display | |
| 57 | unemulated: | |
| 58 | * card punch (pac: 43) | |
| 59 | * line printer (lpr, lsp, but NOT lfb) | |
| 50 | devices which are known to generate a completion pulse (source: maintainance manual 9-??, | |
| 51 | and 9-20, 9-21): | |
| 52 | emulated: | |
| 53 | * perforated tape reader | |
| 54 | * perforated tape punch | |
| 55 | * typewriter output | |
| 56 | * CRT display | |
| 57 | unemulated: | |
| 58 | * card punch (pac: 43) | |
| 59 | * line printer (lpr, lsp, but NOT lfb) | |
| 60 | 60 | |
| 61 | ||
| 61 | This list should probably include additional optional devices (card reader comes to mind). | |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | 64 | /* IO status word */ |
| r5932 | r5933 | |
| 181 | 181 | static void pdp1_machine_stop(running_machine *machine) |
| 182 | 182 | { |
| 183 | 183 | /* the core will take care of freeing the timers, BUT we must set the variables |
| 184 | ||
| 184 | to NULL if we don't want to risk confusing the tape image init function */ | |
| 185 | 185 | tape_reader.timer = tape_puncher.timer = typewriter.tyo_timer = dpy_timer = NULL; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
| 189 | 189 | /* |
| 190 | ||
| 190 | driver init function | |
| 191 | 191 | |
| 192 | ||
| 192 | Set up the pdp1_memory pointer, and generate font data. | |
| 193 | 193 | */ |
| 194 | 194 | MACHINE_START( pdp1 ) |
| 195 | 195 | { |
| r5932 | r5933 | |
| 348 | 348 | |
| 349 | 349 | |
| 350 | 350 | /* |
| 351 | ||
| 351 | perforated tape handling | |
| 352 | 352 | */ |
| 353 | 353 | |
| 354 | 354 | void pdp1_get_open_mode(int id, unsigned int *readable, unsigned int *writeable, unsigned int *creatable) |
| r5932 | r5933 | |
| 377 | 377 | |
| 378 | 378 | |
| 379 | 379 | /* |
| 380 | ||
| 380 | Open a perforated tape image | |
| 381 | 381 | |
| 382 | ||
| 382 | unit 0 is reader (read-only), unit 1 is puncher (write-only) | |
| 383 | 383 | */ |
| 384 | 384 | DEVICE_IMAGE_LOAD( pdp1_tape ) |
| 385 | 385 | { |
| r5932 | r5933 | |
| 396 | 396 | |
| 397 | 397 | /* restart reader IO when necessary */ |
| 398 | 398 | /* note that this function may be called before pdp1_init_machine, therefore |
| 399 | before tape_reader.timer is allocated. It does not matter, as the clutch is never | |
| 400 | down at power-up, but we must not call timer_enable with a NULL parameter! */ | |
| 399 | before tape_reader.timer is allocated. It does not matter, as the clutch is never | |
| 400 | down at power-up, but we must not call timer_enable with a NULL parameter! */ | |
| 401 | 401 | if (tape_reader.timer) |
| 402 | 402 | { |
| 403 | 403 | if (tape_reader.motor_on && tape_reader.rcl) |
| r5932 | r5933 | |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /* |
| 449 | ||
| 449 | Read a byte from perforated tape | |
| 450 | 450 | */ |
| 451 | 451 | static int tape_read(UINT8 *reply) |
| 452 | 452 | { |
| r5932 | r5933 | |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /* |
| 460 | ||
| 460 | Write a byte to perforated tape | |
| 461 | 461 | */ |
| 462 | 462 | static void tape_write(UINT8 data) |
| 463 | 463 | { |
| r5932 | r5933 | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /* |
| 469 | ||
| 469 | common code for tape read commands (RPA, RPB, and read-in mode) | |
| 470 | 470 | */ |
| 471 | 471 | static void begin_tape_read(int binary, int nac) |
| 472 | 472 | { |
| r5932 | r5933 | |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | /* |
| 497 | ||
| 497 | timer callback to simulate reader IO | |
| 498 | 498 | */ |
| 499 | 499 | static TIMER_CALLBACK(reader_callback) |
| 500 | 500 | { |
| r5932 | r5933 | |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /* |
| 547 | ||
| 547 | timer callback to generate punch completion pulse | |
| 548 | 548 | */ |
| 549 | 549 | static TIMER_CALLBACK(puncher_callback) |
| 550 | 550 | { |
| r5932 | r5933 | |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | /* |
| 560 | ||
| 560 | Initiate read of a 18-bit word in binary format from tape (used in read-in mode) | |
| 561 | 561 | */ |
| 562 | 562 | void pdp1_tape_read_binary(const device_config *device) |
| 563 | 563 | { |
| r5932 | r5933 | |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | /* |
| 568 | ||
| 568 | perforated tape reader iot callbacks | |
| 569 | 569 | */ |
| 570 | 570 | |
| 571 | 571 | /* |
| 572 | ||
| 572 | rpa iot callback | |
| 573 | 573 | |
| 574 | op2: iot command operation (equivalent to mb & 077) | |
| 575 | nac: nead a completion pulse | |
| 576 | mb: contents of the MB register | |
| 577 | io: pointer on the IO register | |
| 578 | ac: contents of the AC register | |
| 574 | op2: iot command operation (equivalent to mb & 077) | |
| 575 | nac: nead a completion pulse | |
| 576 | mb: contents of the MB register | |
| 577 | io: pointer on the IO register | |
| 578 | ac: contents of the AC register | |
| 579 | 579 | */ |
| 580 | 580 | /* |
| 581 | 581 | * Read Perforated Tape, Alphanumeric |
| r5932 | r5933 | |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /* |
| 603 | ||
| 603 | rpb iot callback | |
| 604 | 604 | */ |
| 605 | 605 | /* |
| 606 | 606 | * Read Perforated Tape, Binary rpb |
| r5932 | r5933 | |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | /* |
| 640 | ||
| 640 | rrb iot callback | |
| 641 | 641 | */ |
| 642 | 642 | void iot_rrb(const device_config *device, int op2, int nac, int mb, int *io, int ac) |
| 643 | 643 | { |
| r5932 | r5933 | |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /* |
| 652 | ||
| 652 | perforated tape punch iot callbacks | |
| 653 | 653 | */ |
| 654 | 654 | |
| 655 | 655 | /* |
| 656 | ||
| 656 | ppa iot callback | |
| 657 | 657 | */ |
| 658 | 658 | /* |
| 659 | 659 | * Punch Perforated Tape, Alphanumeric |
| r5932 | r5933 | |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /* |
| 683 | ||
| 683 | ppb iot callback | |
| 684 | 684 | */ |
| 685 | 685 | /* |
| 686 | 686 | * Punch Perforated Tape, Binary |
| r5932 | r5933 | |
| 708 | 708 | |
| 709 | 709 | |
| 710 | 710 | /* |
| 711 | ||
| 711 | Typewriter handling | |
| 712 | 712 | |
| 713 | The alphanumeric on-line typewriter is a standard device on pdp-1: it | |
| 714 | can both handle keyboard input and print output text. | |
| 713 | The alphanumeric on-line typewriter is a standard device on pdp-1: it | |
| 714 | can both handle keyboard input and print output text. | |
| 715 | 715 | */ |
| 716 | 716 | |
| 717 | 717 | /* |
| 718 | ||
| 718 | Open a file for typewriter output | |
| 719 | 719 | */ |
| 720 | 720 | DEVICE_IMAGE_LOAD(pdp1_typewriter) |
| 721 | 721 | { |
| r5932 | r5933 | |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | /* |
| 736 | ||
| 736 | Write a character to typewriter | |
| 737 | 737 | */ |
| 738 | 738 | static void typewriter_out(running_machine *machine, UINT8 data) |
| 739 | 739 | { |
| r5932 | r5933 | |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | /* |
| 844 | ||
| 844 | timer callback to generate typewriter completion pulse | |
| 845 | 845 | */ |
| 846 | 846 | static TIMER_CALLBACK(tyo_callback) |
| 847 | 847 | { |
| r5932 | r5933 | |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | /* |
| 857 | ||
| 857 | tyo iot callback | |
| 858 | 858 | */ |
| 859 | 859 | void iot_tyo(const device_config *device, int op2, int nac, int mb, int *io, int ac) |
| 860 | 860 | { |
| r5932 | r5933 | |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | 898 | /* |
| 899 | ||
| 899 | tyi iot callback | |
| 900 | 900 | */ |
| 901 | 901 | /* When a typewriter key is struck, the code for the struck key is placed in the |
| 902 | 902 | * typewriter buffer, Program Flag 1 is set, and the type-in status bit is set to |
| r5932 | r5933 | |
| 961 | 961 | |
| 962 | 962 | |
| 963 | 963 | /* |
| 964 | ||
| 964 | timer callback to generate crt completion pulse | |
| 965 | 965 | */ |
| 966 | 966 | static TIMER_CALLBACK(dpy_callback) |
| 967 | 967 | { |
| r5932 | r5933 | |
| 970 | 970 | |
| 971 | 971 | |
| 972 | 972 | /* |
| 973 | ||
| 973 | dpy iot callback | |
| 974 | 974 | |
| 975 | ||
| 975 | Light on one pixel on CRT | |
| 976 | 976 | */ |
| 977 | 977 | void iot_dpy(const device_config *device, int op2, int nac, int mb, int *io, int ac) |
| 978 | 978 | { |
| r5932 | r5933 | |
| 1000 | 1000 | if (LOG_IOT_OVERLAP) |
| 1001 | 1001 | { |
| 1002 | 1002 | /* note that overlap detection is incomplete: it will only work if both DPY |
| 1003 | ||
| 1003 | instructions require a completion pulse */ | |
| 1004 | 1004 | if (timer_enable(dpy_timer, 0)) |
| 1005 | 1005 | logerror("Error: overlapped DPY instruction: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine)); |
| 1006 | 1006 | } |
| r5932 | r5933 | |
| 1011 | 1011 | |
| 1012 | 1012 | |
| 1013 | 1013 | /* |
| 1014 | ||
| 1014 | MIT parallel drum (variant of type 23) | |
| 1015 | 1015 | */ |
| 1016 | 1016 | |
| 1017 | 1017 | static void parallel_drum_set_il(int il) |
| r5932 | r5933 | |
| 1047 | 1047 | #endif |
| 1048 | 1048 | |
| 1049 | 1049 | /* |
| 1050 | ||
| 1050 | Open a file for drum | |
| 1051 | 1051 | */ |
| 1052 | 1052 | DEVICE_IMAGE_LOAD(pdp1_drum) |
| 1053 | 1053 | { |
| r5932 | r5933 | |
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | /* |
| 1082 | ||
| 1082 | Read a word from drum | |
| 1083 | 1083 | */ |
| 1084 | 1084 | static UINT32 drum_read(int field, int position) |
| 1085 | 1085 | { |
| r5932 | r5933 | |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | /* |
| 1096 | ||
| 1096 | Write a word to drum | |
| 1097 | 1097 | */ |
| 1098 | 1098 | static void drum_write(int field, int position, UINT32 data) |
| 1099 | 1099 | { |
| r5932 | r5933 | |
| 1162 | 1162 | |
| 1163 | 1163 | |
| 1164 | 1164 | /* |
| 1165 | ||
| 1165 | iot 11 callback | |
| 1166 | 1166 | |
| 1167 | ||
| 1167 | Read state of Spacewar! controllers | |
| 1168 | 1168 | |
| 1169 | Not documented, except a few comments in the Spacewar! source code: | |
| 1170 | it should leave the control word in the io as follows. | |
| 1171 | high order 4 bits, rotate ccw, rotate cw, (both mean hyperspace) | |
| 1172 | fire rocket, and fire torpedo. low order 4 bits, same for | |
| 1173 | other ship. routine is entered by jsp cwg. | |
| 1169 | Not documented, except a few comments in the Spacewar! source code: | |
| 1170 | it should leave the control word in the io as follows. | |
| 1171 | high order 4 bits, rotate ccw, rotate cw, (both mean hyperspace) | |
| 1172 | fire rocket, and fire torpedo. low order 4 bits, same for | |
| 1173 | other ship. routine is entered by jsp cwg. | |
| 1174 | 1174 | */ |
| 1175 | 1175 | void iot_011(const device_config *device, int op2, int nac, int mb, int *io, int ac) |
| 1176 | 1176 | { |
| r5932 | r5933 | |
| 1207 | 1207 | |
| 1208 | 1208 | |
| 1209 | 1209 | /* |
| 1210 | ||
| 1210 | cks iot callback | |
| 1211 | 1211 | |
| 1212 | ||
| 1212 | check IO status | |
| 1213 | 1213 | */ |
| 1214 | 1214 | void iot_cks(const device_config *device, int op2, int nac, int mb, int *io, int ac) |
| 1215 | 1215 | { |
| r5932 | r5933 | |
| 1221 | 1221 | |
| 1222 | 1222 | |
| 1223 | 1223 | /* |
| 1224 | ||
| 1224 | callback which is called when Start Clear is pulsed | |
| 1225 | 1225 | |
| 1226 | ||
| 1226 | IO devices should reset | |
| 1227 | 1227 | */ |
| 1228 | 1228 | void pdp1_io_sc_callback(const device_config *device) |
| 1229 | 1229 | { |
| r5932 | r5933 | |
| 1245 | 1245 | |
| 1246 | 1246 | |
| 1247 | 1247 | /* |
| 1248 | ||
| 1248 | typewriter keyboard handler | |
| 1249 | 1249 | */ |
| 1250 | 1250 | static void pdp1_keyboard(running_machine *machine) |
| 1251 | 1251 | { |
| r5932 | r5933 | |
| 1340 | 1340 | } |
| 1341 | 1341 | |
| 1342 | 1342 | /* |
| 1343 | ||
| 1343 | Not a real interrupt - just handle keyboard input | |
| 1344 | 1344 | */ |
| 1345 | 1345 | INTERRUPT_GEN( pdp1_interrupt ) |
| 1346 | 1346 | { |
| r5932 | r5933 | |
| 1394 | 1394 | { |
| 1395 | 1395 | cpu_set_reg(device, PDP1_RUN, 0); |
| 1396 | 1396 | cpu_set_reg(device, PDP1_RIM, 0); /* bug : we stop after reading an even-numbered word |
| 1397 | (i.e. data), whereas a real pdp-1 stops after reading | |
| 1398 | an odd-numbered word (i.e. dio instruciton) */ | |
| 1397 | (i.e. data), whereas a real pdp-1 stops after reading | |
| 1398 | an odd-numbered word (i.e. dio instruciton) */ | |
| 1399 | 1399 | } |
| 1400 | 1400 | if (control_transitions & pdp1_continue) |
| 1401 | 1401 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | NEC | |
| 3 | NEC ?PD7201 Multiprotocol Serial Communications Controller emulation | |
| 4 | 4 | |
| 5 | 5 | Copyright MESS Team. |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | CLK 1 |* \_/ | 40 Vcc | |
| 11 | _RESET 2 | | 39 _CTSA | |
| 12 | _DCDA 3 | | 38 _RTSA | |
| 13 | _RxCB 4 | | 37 TxDA | |
| 14 | _DCDB 5 | | 36 _TxCA | |
| 15 | _CTSB 6 | | 35 _RxCA | |
| 16 | _TxCB 7 | | 34 RxDA | |
| 17 | TxDB 8 | | 33 _SYNCA | |
| 18 | RxDB 9 | | 32 _WAITA/DRQRxA | |
| 19 | _RTSB/_SYNCB 10 | UPD7201 | 31 _DTRA/_HAO | |
| 20 | _WAITB/_DRQTxA 11 | | 30 _PRO/DRQTxB | |
| 21 | D7 12 | | 29 _PRI/DRQRxB | |
| 22 | D6 13 | | 28 _INT | |
| 23 | D5 14 | | 27 _INTAK | |
| 24 | D4 15 | | 26 _DTRB/_HAI | |
| 25 | D3 16 | | 25 B/_A | |
| 26 | D2 17 | | 24 C/_D | |
| 27 | D1 18 | | 23 _CS | |
| 28 | D0 19 | | 22 _RD | |
| 29 | Vss 20 |_____________| 21 _WR | |
| 9 | _____ _____ | |
| 10 | CLK 1 |* \_/ | 40 Vcc | |
| 11 | _RESET 2 | | 39 _CTSA | |
| 12 | _DCDA 3 | | 38 _RTSA | |
| 13 | _RxCB 4 | | 37 TxDA | |
| 14 | _DCDB 5 | | 36 _TxCA | |
| 15 | _CTSB 6 | | 35 _RxCA | |
| 16 | _TxCB 7 | | 34 RxDA | |
| 17 | TxDB 8 | | 33 _SYNCA | |
| 18 | RxDB 9 | | 32 _WAITA/DRQRxA | |
| 19 | _RTSB/_SYNCB 10 | UPD7201 | 31 _DTRA/_HAO | |
| 20 | _WAITB/_DRQTxA 11 | | 30 _PRO/DRQTxB | |
| 21 | D7 12 | | 29 _PRI/DRQRxB | |
| 22 | D6 13 | | 28 _INT | |
| 23 | D5 14 | | 27 _INTAK | |
| 24 | D4 15 | | 26 _DTRB/_HAI | |
| 25 | D3 16 | | 25 B/_A | |
| 26 | D2 17 | | 24 C/_D | |
| 27 | D1 18 | | 23 _CS | |
| 28 | D0 19 | | 22 _RD | |
| 29 | Vss 20 |_____________| 21 _WR | |
| 30 | 30 | |
| 31 | 31 | **********************************************************************/ |
| 32 | 32 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Homelab machine driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 31/08/2008 Preliminary driver. | |
| 6 | ||
| 5 | 31/08/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "includes/homelab.h" |
| 12 | ||
| 12 | ||
| 13 | 13 | /* Driver initialization */ |
| 14 | 14 | DRIVER_INIT(homelab) |
| 15 | 15 | { |
| r5932 | r5933 | |
|---|---|---|
| 29 | 29 | |
| 30 | 30 | static UINT8 GDROM_Cmd11_Reply[32] = |
| 31 | 31 | { |
| 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x19, 0x00, 0x00, 0x08, 0x53, 0x45, 0x20, 0x20, 0x20, 0x20, | |
| 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x19, 0x00, 0x00, 0x08, 0x53, 0x45, 0x20, 0x20, 0x20, 0x20, | |
| 33 | 33 | 0x20, 0x20, 0x52, 0x65, 0x76, 0x20, 0x36, 0x2E, 0x34, 0x32, 0x39, 0x39, 0x30, 0x33, 0x31, 0x36 |
| 34 | 34 | }; |
| 35 | 35 | |
| r5932 | r5933 | |
| 60 | 60 | |
| 61 | 61 | switch ( command[0] ) |
| 62 | 62 | { |
| 63 | ||
| 64 | 63 | |
| 64 | ||
| 65 | 65 | case 0x03: // REQUEST SENSE |
| 66 | 66 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 67 | 67 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| r5932 | r5933 | |
| 72 | 72 | command[0], command[1], |
| 73 | 73 | command[2], command[3], |
| 74 | 74 | command[4], command[5]); |
| 75 | // | |
| 75 | // if (SCSILengthFromUINT8( &command[ 4 ] ) < 32) return -1; | |
| 76 | 76 | return 32; //SCSILengthFromUINT8( &command[ 4 ] ); |
| 77 | 77 | |
| 78 | 78 | case 0x12: // INQUIRY |
| r5932 | r5933 | |
| 137 | 137 | { |
| 138 | 138 | fatalerror("GDROM: MSF mode used for CD_READ, unsupported\n"); |
| 139 | 139 | return 0; |
| 140 | } | |
| 140 | } | |
| 141 | 141 | else |
| 142 | 142 | { |
| 143 | 143 | our_this->lba = (command[2]<<16 | command[3]<<8 | command[4]) - 150; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | MESS specific Atari init and Cartridge code for Atari 8 bit systems | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| r5932 | r5933 | |
| 94 | 94 | { |
| 95 | 95 | offs_t ram_top; |
| 96 | 96 | offs_t ram_size; |
| 97 | ||
| 97 | ||
| 98 | 98 | /* set atari type (needed for banks above) */ |
| 99 | 99 | atari = type; |
| 100 | 100 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | applefdc.c | |
| 4 | 4 | |
| 5 | Implementation of various Apple Floppy Disk Controllers, including | |
| 6 | the classic Apple controller and the IWM (Integrated Woz Machine) | |
| 7 | chip | |
| 5 | Implementation of various Apple Floppy Disk Controllers, including | |
| 6 | the classic Apple controller and the IWM (Integrated Woz Machine) | |
| 7 | chip | |
| 8 | 8 | |
| 9 | The IWM chip was used as the floppy disk controller for early Macs and the | |
| 10 | Apple IIgs, and was eventually superceded by the SWIM chp. | |
| 9 | The IWM chip was used as the floppy disk controller for early Macs and the | |
| 10 | Apple IIgs, and was eventually superceded by the SWIM chp. | |
| 11 | 11 | |
| 12 | Nate Woods | |
| 13 | Raphael Nabet | |
| 12 | Nate Woods | |
| 13 | Raphael Nabet | |
| 14 | 14 | |
| 15 | Writing this code would not be possible if it weren't for the work of the | |
| 16 | XGS and KEGS emulators which also contain IWM emulations. | |
| 15 | Writing this code would not be possible if it weren't for the work of the | |
| 16 | XGS and KEGS emulators which also contain IWM emulations. | |
| 17 | 17 | |
| 18 | TODO | |
| 19 | - Implement the unimplemented IWM modes | |
| 20 | - IWM_MODE_CLOCKSPEED | |
| 21 | - IWM_MODE_BITCELLTIME | |
| 22 | - IWM_MODE_HANDSHAKEPROTOCOL | |
| 23 | - IWM_MODE_LATCHMODE | |
| 24 | - Investigate the differences between the IWM and the classic Apple II | |
| 25 | controller more fully. It is currently unclear what are genuine | |
| 26 | differences and what are effectively hacks that "just seem" to work. | |
| 27 | - Figure out iwm_readenable2handshake() and iwm_enable2(); they are | |
| 28 | hackish at best | |
| 29 | - Support the SWIM chip | |
| 30 | - Proper timing | |
| 31 | - This code was originally IWM specific; we need to clean up IWMisms in | |
| 32 | the code | |
| 33 | - Make it faster? | |
| 34 | - Add sound? | |
| 18 | TODO | |
| 19 | - Implement the unimplemented IWM modes | |
| 20 | - IWM_MODE_CLOCKSPEED | |
| 21 | - IWM_MODE_BITCELLTIME | |
| 22 | - IWM_MODE_HANDSHAKEPROTOCOL | |
| 23 | - IWM_MODE_LATCHMODE | |
| 24 | - Investigate the differences between the IWM and the classic Apple II | |
| 25 | controller more fully. It is currently unclear what are genuine | |
| 26 | differences and what are effectively hacks that "just seem" to work. | |
| 27 | - Figure out iwm_readenable2handshake() and iwm_enable2(); they are | |
| 28 | hackish at best | |
| 29 | - Support the SWIM chip | |
| 30 | - Proper timing | |
| 31 | - This code was originally IWM specific; we need to clean up IWMisms in | |
| 32 | the code | |
| 33 | - Make it faster? | |
| 34 | - Add sound? | |
| 35 | 35 | |
| 36 | 36 | *********************************************************************/ |
| 37 | 37 | |
| r5932 | r5933 | |
| 70 | 70 | /*************************************************************************** |
| 71 | 71 | IWM MODE |
| 72 | 72 | |
| 73 | ||
| 73 | The IWM mode has the following values: | |
| 74 | 74 | |
| 75 | Bit 7 Reserved | |
| 76 | Bit 6 Reserved | |
| 77 | Bit 5 Reserved | |
| 78 | Bit 4 ! Clock speed | |
| 79 | 0=7MHz; used by Apple IIgs | |
| 80 | 1=8MHz; used by Mac (I believe) | |
| 81 | Bit 3 ! Bit cell time | |
| 82 | 0=4usec/bit (used for 5.25" drives) | |
| 83 | 1=2usec/bit (used for 3.5" drives) | |
| 84 | Bit 2 Motor-off delay | |
| 85 | 0=leave on for 1 sec after system turns it off | |
| 86 | 1=turn off immediately | |
| 87 | Bit 1 ! Handshake protocol | |
| 88 | 0=synchronous (software supplies timing for writing data; used for 5.25" drives) | |
| 89 | 1=asynchronous (IWM supplies timing; used for 3.5" drives) | |
| 90 | Bit 0 ! Latch mode | |
| 91 | 0=read data stays valid for 7usec (used for 5.25" drives) | |
| 92 | 1=read data stays valid for full byte time (used for 3.5" drives) | |
| 75 | Bit 7 Reserved | |
| 76 | Bit 6 Reserved | |
| 77 | Bit 5 Reserved | |
| 78 | Bit 4 ! Clock speed | |
| 79 | 0=7MHz; used by Apple IIgs | |
| 80 | 1=8MHz; used by Mac (I believe) | |
| 81 | Bit 3 ! Bit cell time | |
| 82 | 0=4usec/bit (used for 5.25" drives) | |
| 83 | 1=2usec/bit (used for 3.5" drives) | |
| 84 | Bit 2 Motor-off delay | |
| 85 | 0=leave on for 1 sec after system turns it off | |
| 86 | 1=turn off immediately | |
| 87 | Bit 1 ! Handshake protocol | |
| 88 | 0=synchronous (software supplies timing for writing data; used for 5.25" drives) | |
| 89 | 1=asynchronous (IWM supplies timing; used for 3.5" drives) | |
| 90 | Bit 0 ! Latch mode | |
| 91 | 0=read data stays valid for 7usec (used for 5.25" drives) | |
| 92 | 1=read data stays valid for full byte time (used for 3.5" drives) | |
| 93 | 93 | |
| 94 | 94 | ***************************************************************************/ |
| 95 | 95 | |
| r5932 | r5933 | |
| 157 | 157 | static const applefdc_interface dummy_interface = {0, }; |
| 158 | 158 | |
| 159 | 159 | assert_is_applefdc(device); |
| 160 | return (device->static_config != NULL) | |
| 160 | return (device->static_config != NULL) | |
| 161 | 161 | ? (const applefdc_interface *) device->static_config |
| 162 | 162 | : &dummy_interface; |
| 163 | 163 | } |
| r5932 | r5933 | |
| 253 | 253 | const applefdc_interface *intf = get_interface(device); |
| 254 | 254 | |
| 255 | 255 | /* IWM status: |
| 256 | * | |
| 257 | * Bit 7 Sense input (write protect for 5.25" drive and general status line for 3.5") | |
| 258 | * Bit 6 Reserved | |
| 259 | * Bit 5 Drive enable (is 1 if drive is on) | |
| 260 | * Bits 4-0 Same as IWM mode bits 4-0 | |
| 261 | */ | |
| 256 | * | |
| 257 | * Bit 7 Sense input (write protect for 5.25" drive and general status line for 3.5") | |
| 258 | * Bit 6 Reserved | |
| 259 | * Bit 5 Drive enable (is 1 if drive is on) | |
| 260 | * Bits 4-0 Same as IWM mode bits 4-0 | |
| 261 | */ | |
| 262 | 262 | |
| 263 | 263 | status = iwm_enable2(device) ? 1 : (intf->read_status ? intf->read_status(device) : 0); |
| 264 | 264 | |
| r5932 | r5933 | |
| 308 | 308 | else |
| 309 | 309 | { |
| 310 | 310 | /* |
| 311 | * Right now, this function assumes latch mode; which is always used for | |
| 312 | * 3.5 inch drives. Eventually we should check to see if latch mode is | |
| 313 | * off | |
| 314 | */ | |
| 311 | * Right now, this function assumes latch mode; which is always used for | |
| 312 | * 3.5 inch drives. Eventually we should check to see if latch mode is | |
| 313 | * off | |
| 314 | */ | |
| 315 | 315 | if (LOG_APPLEFDC) |
| 316 | 316 | { |
| 317 | 317 | if ((fdc->mode & IWM_MODE_LATCHMODE) == 0x00) |
| r5932 | r5933 | |
| 329 | 329 | |
| 330 | 330 | case IWM_Q7: |
| 331 | 331 | /* Classic Apple II: Read status register |
| 332 | * IWM: Read handshake register | |
| 333 | */ | |
| 332 | * IWM: Read handshake register | |
| 333 | */ | |
| 334 | 334 | if (fdc->type == APPLEFDC_APPLE2) |
| 335 | 335 | result = applefdc_statusreg_r(device); |
| 336 | 336 | else |
| r5932 | r5933 | |
| 361 | 361 | else if (!iwm_enable2(device)) |
| 362 | 362 | { |
| 363 | 363 | /* |
| 364 | * Right now, this function assumes latch mode; which is always used for | |
| 365 | * 3.5 inch drives. Eventually we should check to see if latch mode is | |
| 366 | * off | |
| 367 | */ | |
| 364 | * Right now, this function assumes latch mode; which is always used for | |
| 365 | * 3.5 inch drives. Eventually we should check to see if latch mode is | |
| 366 | * off | |
| 367 | */ | |
| 368 | 368 | if (LOG_APPLEFDC) |
| 369 | 369 | { |
| 370 | 370 | if ((fdc->mode & IWM_MODE_LATCHMODE) == 0) |
| r5932 | r5933 | |
| 382 | 382 | |
| 383 | 383 | /*------------------------------------------------- |
| 384 | 384 | TIMER_CALLBACK(iwm_turnmotor_onoff) - timer |
| 385 | ||
| 385 | callback for turning motor on or off | |
| 386 | 386 | -------------------------------------------------*/ |
| 387 | 387 | |
| 388 | 388 | static TIMER_CALLBACK(iwm_turnmotor_onoff) |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | 55 21046-03 |
| 9 | 9 | |
| 10 | 10 | |-----------------------------------| |
| 11 | | LD1 SW1 CON2 | | |
| 12 | | | | |
| 13 | | CON3 S9 | | |
| 14 | | S8 | | |
| 15 | | LS240 LS174 7406 7406 | | |
| 16 | | | | |
| 17 | | LS174 FDC9229 LS107 LS266 | | |
| 18 | | | | |
| 19 | | | | |
| 20 | | SAB1793 | | |
| 21 | | LS368 16MHz | | |
| 22 | | S6 | | |
| 23 | | Z80DMA ROM | | |
| 24 | | | | |
| 25 | | | | |
| 26 | | Z80 TC5565 | | |
| 27 | | | | |
| 28 | | | | |
| 29 | | LS138 LS174 SW2 74374 | | |
| 30 | | | | |
| 31 | | LS10 LS266 S5 LS374 | | |
| 32 | | S3 | | |
| 33 | | S1 LS240 | | |
| 34 | | | | |
| 35 | | LS244 SW3 DM8131 | | |
| 36 | | | | |
| 37 | | | | |
| 11 | | LD1 SW1 CON2 | | |
| 12 | | | | |
| 13 | | CON3 S9 | | |
| 14 | | S8 | | |
| 15 | | LS240 LS174 7406 7406 | | |
| 16 | | | | |
| 17 | | LS174 FDC9229 LS107 LS266 | | |
| 18 | | | | |
| 19 | | | | |
| 20 | | SAB1793 | | |
| 21 | | LS368 16MHz | | |
| 22 | | S6 | | |
| 23 | | Z80DMA ROM | | |
| 24 | | | | |
| 25 | | | | |
| 26 | | Z80 TC5565 | | |
| 27 | | | | |
| 28 | | | | |
| 29 | | LS138 LS174 SW2 74374 | | |
| 30 | | | | |
| 31 | | LS10 LS266 S5 LS374 | | |
| 32 | | S3 | | |
| 33 | | S1 LS240 | | |
| 34 | | | | |
| 35 | | LS244 SW3 DM8131 | | |
| 36 | | | | |
| 37 | | | | |
| 38 | 38 | |--|-----------------------------|--| |
| 39 | 39 | |------------CON1-------------| |
| 40 | 40 | |
| r5932 | r5933 | |
| 43 | 43 | |
| 44 | 44 | ROM - Toshiba TMM27128D-20 16Kx8 EPROM "CNTR 1.07 6490318-07" |
| 45 | 45 | TC5565 - Toshiba TC5565PL-15 8Kx8 bit Static RAM |
| 46 | Z80 | |
| 46 | Z80 - Zilog Z8400APS Z80A CPU Central Processing Unit | |
| 47 | 47 | Z80DMA - Zilog Z8410APS Z80A DMA Direct Memory Access Controller |
| 48 | 48 | SAB1793 - Siemens SAB1793-02P Floppy Disc Controller |
| 49 | 49 | FDC9229 - SMC FDC9229BT Floppy Disc Interface Circuit |
| 50 | 50 | DM8131 - National Semiconductor DM8131N 6-Bit Unified Bus Comparator |
| 51 | CON1 - | |
| 52 | CON2 - AMP4284 | |
| 53 | CON3 - | |
| 54 | SW1 - | |
| 55 | SW2 - | |
| 56 | SW3 - | |
| 57 | S1 - | |
| 58 | S3 - | |
| 59 | S5 - | |
| 60 | S6 - Amount of RAM installed (A:2KB, B:8KB) | |
| 61 | S7 - Number of drives connected (0:3, 1:?) *located on solder side | |
| 62 | S8 - 0:8", 1:5.25" | |
| 63 | S9 - Location of RDY signal (A:P2:6, B:P2:34) | |
| 64 | LD1 - LED | |
| 51 | CON1 - | |
| 52 | CON2 - AMP4284 | |
| 53 | CON3 - | |
| 54 | SW1 - | |
| 55 | SW2 - | |
| 56 | SW3 - | |
| 57 | S1 - | |
| 58 | S3 - | |
| 59 | S5 - | |
| 60 | S6 - Amount of RAM installed (A:2KB, B:8KB) | |
| 61 | S7 - Number of drives connected (0:3, 1:?) *located on solder side | |
| 62 | S8 - 0:8", 1:5.25" | |
| 63 | S9 - Location of RDY signal (A:P2:6, B:P2:34) | |
| 64 | LD1 - LED | |
| 65 | 65 | |
| 66 | 66 | */ |
| 67 | 67 | |
| 68 | 68 | /* |
| 69 | 69 | |
| 70 | ||
| 70 | TODO: | |
| 71 | 71 | |
| 72 | Slow Controller | |
| 73 | --------------- | |
| 74 | - DS/DD SS/DS jumpers | |
| 75 | - S1-S5 jumpers | |
| 76 | - protection device @ 8B | |
| 77 | - FDC DRQ | |
| 78 | - Z80 wait logic | |
| 72 | Slow Controller | |
| 73 | --------------- | |
| 74 | - DS/DD SS/DS jumpers | |
| 75 | - S1-S5 jumpers | |
| 76 | - protection device @ 8B | |
| 77 | - FDC DRQ | |
| 78 | - Z80 wait logic | |
| 79 | 79 | |
| 80 | Fast Controller | |
| 81 | --------------- | |
| 82 | - implement missing features to Z80DMA | |
| 83 | - FDC INT | |
| 84 | - FDC DRQ | |
| 80 | Fast Controller | |
| 81 | --------------- | |
| 82 | - implement missing features to Z80DMA | |
| 83 | - FDC INT | |
| 84 | - FDC DRQ | |
| 85 | 85 | |
| 86 | 86 | */ |
| 87 | 87 | |
| r5932 | r5933 | |
| 252 | 252 | { |
| 253 | 253 | /* |
| 254 | 254 | |
| 255 | ||
| 255 | bit description | |
| 256 | 256 | |
| 257 | 0 _SEL 0 | |
| 258 | 1 _SEL 1 | |
| 259 | 2 _SEL 2 | |
| 260 | 3 _MOT | |
| 261 | 4 _SIDE | |
| 262 | 5 8B pin 2 (if S4 shorted) | |
| 263 | 6 8A pin 13 | |
| 264 | 7 FDC _MR | |
| 257 | 0 _SEL 0 | |
| 258 | 1 _SEL 1 | |
| 259 | 2 _SEL 2 | |
| 260 | 3 _MOT | |
| 261 | 4 _SIDE | |
| 262 | 5 8B pin 2 (if S4 shorted) | |
| 263 | 6 8A pin 13 | |
| 264 | 7 FDC _MR | |
| 265 | 265 | |
| 266 | ||
| 266 | */ | |
| 267 | 267 | |
| 268 | 268 | slow_t *conkort = get_safe_token_machine_slow(space->machine); |
| 269 | 269 | |
| 270 | 270 | /* drive selection */ |
| 271 | 271 | if (!BIT(data, 0)) wd17xx_set_drive(conkort->wd1791, 0); |
| 272 | 272 | if (!BIT(data, 1)) wd17xx_set_drive(conkort->wd1791, 1); |
| 273 | // | |
| 273 | // if (!BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2); | |
| 274 | 274 | |
| 275 | 275 | /* motor enable */ |
| 276 | 276 | floppy_drive_set_motor_state(get_floppy_image(space->machine, 0), !BIT(data, 3)); |
| r5932 | r5933 | |
| 292 | 292 | { |
| 293 | 293 | /* |
| 294 | 294 | |
| 295 | ||
| 295 | bit description | |
| 296 | 296 | |
| 297 | 0 _INT to main Z80 | |
| 298 | 1 | |
| 299 | 2 | |
| 300 | 3 | |
| 301 | 4 | |
| 302 | 5 | |
| 303 | 6 LS245 DIR | |
| 304 | 7 | |
| 297 | 0 _INT to main Z80 | |
| 298 | 1 | |
| 299 | 2 | |
| 300 | 3 | |
| 301 | 4 | |
| 302 | 5 | |
| 303 | 6 LS245 DIR | |
| 304 | 7 | |
| 305 | 305 | |
| 306 | ||
| 306 | */ | |
| 307 | 307 | |
| 308 | 308 | slow_t *conkort = get_safe_token_machine_slow(space->machine); |
| 309 | 309 | |
| r5932 | r5933 | |
| 434 | 434 | AM_RANGE(0x0f, 0x0f) AM_READ(fast_data_r) |
| 435 | 435 | AM_RANGE(0x1f, 0x1f) AM_WRITE(fast_data_w) |
| 436 | 436 | AM_RANGE(0x2f, 0x2f) AM_WRITE(fast_status_w) |
| 437 | // AM_RANGE(0x3f, 0x3f) AM_WRITE() | |
| 438 | // AM_RANGE(0x4f, 0x4f) AM_WRITE() | |
| 437 | // AM_RANGE(0x3f, 0x3f) AM_WRITE() | |
| 438 | // AM_RANGE(0x4f, 0x4f) AM_WRITE() | |
| 439 | 439 | AM_RANGE(0x5d, 0x5d) AM_READ(fast_ctrl_r) |
| 440 | 440 | AM_RANGE(0x68, 0x6b) AM_DEVREAD(SAB1793_TAG, wd17xx_r) |
| 441 | 441 | AM_RANGE(0x78, 0x7b) AM_DEVWRITE(SAB1793_TAG, wd17xx_w) |
| r5932 | r5933 | |
| 520 | 520 | { |
| 521 | 521 | /* |
| 522 | 522 | |
| 523 | ||
| 523 | bit description | |
| 524 | 524 | |
| 525 | 0 !(_DS0 & _DS1) | |
| 526 | 1 !(_DD0 & _DD1) | |
| 527 | 2 8B pin 10 | |
| 528 | 3 FDC DDEN | |
| 529 | 4 _R/BS | |
| 530 | 5 FDC HLT | |
| 531 | 6 FDC _HDLD | |
| 532 | 7 FDC IRQ | |
| 525 | 0 !(_DS0 & _DS1) | |
| 526 | 1 !(_DD0 & _DD1) | |
| 527 | 2 8B pin 10 | |
| 528 | 3 FDC DDEN | |
| 529 | 4 _R/BS | |
| 530 | 5 FDC HLT | |
| 531 | 6 FDC _HDLD | |
| 532 | 7 FDC IRQ | |
| 533 | 533 | |
| 534 | ||
| 534 | */ | |
| 535 | 535 | |
| 536 | 536 | slow_t *conkort = get_safe_token_machine_slow(device->machine); |
| 537 | 537 | |
| r5932 | r5933 | |
| 542 | 542 | { |
| 543 | 543 | /* |
| 544 | 544 | |
| 545 | ||
| 545 | bit description | |
| 546 | 546 | |
| 547 | 0 !(_DS0 & _DS1) | |
| 548 | 1 !(_DD0 & _DD1) | |
| 549 | 2 8B pin 10 | |
| 550 | 3 FDC DDEN | |
| 551 | 4 _R/BS | |
| 552 | 5 FDC HLT | |
| 553 | 6 FDC _HDLD | |
| 554 | 7 FDC IRQ | |
| 547 | 0 !(_DS0 & _DS1) | |
| 548 | 1 !(_DD0 & _DD1) | |
| 549 | 2 8B pin 10 | |
| 550 | 3 FDC DDEN | |
| 551 | 4 _R/BS | |
| 552 | 5 FDC HLT | |
| 553 | 6 FDC _HDLD | |
| 554 | 7 FDC IRQ | |
| 555 | 555 | |
| 556 | ||
| 556 | */ | |
| 557 | 557 | |
| 558 | 558 | } |
| 559 | 559 | |
| r5932 | r5933 | |
| 585 | 585 | |
| 586 | 586 | /* |
| 587 | 587 | |
| 588 | DMA Transfer Programs | |
| 589 | --------------------- | |
| 588 | DMA Transfer Programs | |
| 589 | --------------------- | |
| 590 | 590 | |
| 591 | ||
| 591 | C3 14 28 95 6B 02 8A CF 01 AF CF 87 | |
| 592 | 592 | |
| 593 | C3 reset | |
| 594 | 14 port A is memory, port A address increments | |
| 595 | 28 port B is I/O, port B address fixed | |
| 596 | 95 byte mode, port B starting address low follows, interrupt control byte follows | |
| 597 | 6B port B starting address 0x006B (FDC DATA read) | |
| 598 | 02 interrupt at end of block | |
| 599 | 8A ready active high | |
| 600 | CF load | |
| 601 | 01 transfer B->A | |
| 602 | AF disable interrupts | |
| 603 | CF load | |
| 604 | 87 enable DMA | |
| 593 | C3 reset | |
| 594 | 14 port A is memory, port A address increments | |
| 595 | 28 port B is I/O, port B address fixed | |
| 596 | 95 byte mode, port B starting address low follows, interrupt control byte follows | |
| 597 | 6B port B starting address 0x006B (FDC DATA read) | |
| 598 | 02 interrupt at end of block | |
| 599 | 8A ready active high | |
| 600 | CF load | |
| 601 | 01 transfer B->A | |
| 602 | AF disable interrupts | |
| 603 | CF load | |
| 604 | 87 enable DMA | |
| 605 | 605 | |
| 606 | ||
| 606 | C3 14 28 95 7B 02 8A CF 05 AF CF 87 | |
| 607 | 607 | |
| 608 | C3 reset | |
| 609 | 14 port A is memory, port A address increments | |
| 610 | 28 port B is I/O, port B address fixed | |
| 611 | 95 byte mode, port B starting address low follows, interrupt control byte follows | |
| 612 | 7B port B starting address 0x007B (FDC DATA write) | |
| 613 | 02 interrupt at end of block | |
| 614 | 8A ready active high | |
| 615 | CF load | |
| 616 | 05 transfer A->B | |
| 617 | AF disable interrupts | |
| 618 | CF load | |
| 619 | 87 enable DMA | |
| 608 | C3 reset | |
| 609 | 14 port A is memory, port A address increments | |
| 610 | 28 port B is I/O, port B address fixed | |
| 611 | 95 byte mode, port B starting address low follows, interrupt control byte follows | |
| 612 | 7B port B starting address 0x007B (FDC DATA write) | |
| 613 | 02 interrupt at end of block | |
| 614 | 8A ready active high | |
| 615 | CF load | |
| 616 | 05 transfer A->B | |
| 617 | AF disable interrupts | |
| 618 | CF load | |
| 619 | 87 enable DMA | |
| 620 | 620 | |
| 621 | ||
| 621 | C3 91 40 8A AB | |
| 622 | 622 | |
| 623 | C3 reset | |
| 624 | 91 byte mode, interrupt control byte follows | |
| 625 | 40 interrupt on RDY | |
| 626 | 8A _CE only, ready active high, stop on end of block | |
| 627 | AB enable interrupts | |
| 623 | C3 reset | |
| 624 | 91 byte mode, interrupt control byte follows | |
| 625 | 40 interrupt on RDY | |
| 626 | 8A _CE only, ready active high, stop on end of block | |
| 627 | AB enable interrupts | |
| 628 | 628 | |
| 629 | 629 | */ |
| 630 | 630 | |
| r5932 | r5933 | |
| 716 | 716 | |
| 717 | 717 | static const wd17xx_interface slow_wd17xx_interface = |
| 718 | 718 | { |
| 719 | slow_wd1791_callback, | |
| 719 | slow_wd1791_callback, | |
| 720 | 720 | NULL, |
| 721 | 721 | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| 722 | 722 | }; |
| r5932 | r5933 | |
| 742 | 742 | } |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | static const wd17xx_interface fast_wd17xx_interface = | |
| 746 | { | |
| 745 | static const wd17xx_interface fast_wd17xx_interface = | |
| 746 | { | |
| 747 | 747 | fast_wd1793_callback, |
| 748 | 748 | NULL, |
| 749 | 749 | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ap2_slot.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of Apple II device slots | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 63 | 63 | |
| 64 | 64 | assert((slotnum >= 0) && (slotnum <= 7)); |
| 65 | 65 | snprintf(buffer, ARRAY_LENGTH(buffer), "slot_%d", slotnum); |
| 66 | ||
| 66 | ||
| 67 | 67 | return devtag_get_device(machine, buffer); |
| 68 | 68 | } |
| 69 | 69 | |
| r5932 | r5933 | |
| 71 | 71 | |
| 72 | 72 | /*------------------------------------------------- |
| 73 | 73 | DEVICE_START(apple2_slot) - device start |
| 74 | ||
| 74 | function | |
| 75 | 75 | -------------------------------------------------*/ |
| 76 | 76 | |
| 77 | 77 | static DEVICE_START(apple2_slot) |
| r5932 | r5933 | |
| 135 | 135 | |
| 136 | 136 | /*------------------------------------------------- |
| 137 | 137 | DEVICE_GET_INFO(apple2_slot) - device get info |
| 138 | ||
| 138 | function | |
| 139 | 139 | -------------------------------------------------*/ |
| 140 | 140 | |
| 141 | 141 | DEVICE_GET_INFO(apple2_slot) |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "timer.h" |
| 11 | #include "state.h" | |
| 11 | #include "state.h" | |
| 12 | 12 | #include "device.h" |
| 13 | 13 | #include "sound/dac.h" |
| 14 | 14 | #include "cpu/saturn/saturn.h" |
| r5932 | r5933 | |
| 102 | 102 | /* from highest to lowest priority: HDW, NCE2, CE1, CE2, NCE3, NCE1 */ |
| 103 | 103 | static hp48_module hp48_modules[6]; |
| 104 | 104 | |
| 105 | static const char *const hp48_module_names[6] = | |
| 105 | static const char *const hp48_module_names[6] = | |
| 106 | 106 | { "HDW (I/O)", "NCE2 (RAM)", "CE1", "CE2", "NCE3", "NCE1 (ROM)" }; |
| 107 | 107 | |
| 108 | 108 | /* values returned by C=ID */ |
| 109 | 109 | static const UINT8 hp48_module_mask_id[6] = { 0x00, 0x03, 0x05, 0x07, 0x01, 0x00 }; |
| 110 | 110 | static const UINT8 hp48_module_addr_id[6] = { 0x19, 0xf4, 0xf6, 0xf8, 0xf2, 0x00 }; |
| 111 | 111 | |
| 112 | /* RAM/ROM extensions, GX/SX only (each UINT8 stores one nibble) | |
| 113 | port1: SX/GX: 32/128 KB | |
| 112 | /* RAM/ROM extensions, GX/SX only (each UINT8 stores one nibble) | |
| 113 | port1: SX/GX: 32/128 KB | |
| 114 | 114 | port2: SX:32/128KB, GX:128/512/4096 KB |
| 115 | 115 | */ |
| 116 | static UINT32 hp48_port_size[2]; | |
| 116 | static UINT32 hp48_port_size[2]; | |
| 117 | 117 | static UINT8 hp48_port_write[2]; |
| 118 | 118 | static UINT8* hp48_port_data[2]; |
| 119 | 119 | static UINT32 hp48_bank_switch; |
| r5932 | r5933 | |
| 146 | 146 | static void hp48_pulse_irq( running_machine *machine, int irq_line) |
| 147 | 147 | { |
| 148 | 148 | cputag_set_input_line(machine, "maincpu", irq_line, ASSERT_LINE ); |
| 149 | cputag_set_input_line(machine, "maincpu", irq_line, CLEAR_LINE ); | |
| 149 | cputag_set_input_line(machine, "maincpu", irq_line, CLEAR_LINE ); | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
| r5932 | r5933 | |
| 156 | 156 | |
| 157 | 157 | /* end of receive event */ |
| 158 | 158 | static TIMER_CALLBACK( hp48_rs232_byte_recv_cb ) |
| 159 | { | |
| 160 | LOG_SERIAL(( "%f hp48_rs232_byte_recv_cb: end of receive, data=%02x\n", | |
| 159 | { | |
| 160 | LOG_SERIAL(( "%f hp48_rs232_byte_recv_cb: end of receive, data=%02x\n", | |
| 161 | 161 | attotime_to_double(timer_get_time(machine)), param )); |
| 162 | 162 | |
| 163 | 163 | hp48_io[0x14] = param & 0xf; /* receive zone */ |
| r5932 | r5933 | |
| 175 | 175 | /* outside world initiates a receive event */ |
| 176 | 176 | void hp48_rs232_start_recv_byte( running_machine *machine, UINT8 data ) |
| 177 | 177 | { |
| 178 | LOG_SERIAL(( "%f hp48_rs232_start_recv_byte: start receiving, data=%02x\n", | |
| 178 | LOG_SERIAL(( "%f hp48_rs232_start_recv_byte: start receiving, data=%02x\n", | |
| 179 | 179 | attotime_to_double(timer_get_time(machine)), data )); |
| 180 | 180 | |
| 181 | 181 | hp48_io[0x11] |= 2; /* set byte receiving */ |
| 182 | ||
| 182 | ||
| 183 | 183 | /* interrupt */ |
| 184 | 184 | if ( hp48_io[0x10] & 1 ) |
| 185 | 185 | { |
| r5932 | r5933 | |
| 193 | 193 | |
| 194 | 194 | /* end of send event */ |
| 195 | 195 | static TIMER_CALLBACK( hp48_rs232_byte_sent_cb ) |
| 196 | { | |
| 196 | { | |
| 197 | 197 | const device_config *xmodem = devtag_get_device(machine, "rs232_x"); |
| 198 | 198 | const device_config *kermit = devtag_get_device(machine, "rs232_k"); |
| 199 | 199 | |
| 200 | LOG_SERIAL(( "%f hp48_rs232_byte_sent_cb: end of send, data=%02x\n", | |
| 200 | LOG_SERIAL(( "%f hp48_rs232_byte_sent_cb: end of send, data=%02x\n", | |
| 201 | 201 | attotime_to_double(timer_get_time(machine)), param )); |
| 202 | 202 | |
| 203 | 203 | hp48_io[0x12] &= ~3; /* clear byte sending and buffer full */ |
| r5932 | r5933 | |
| 221 | 221 | { |
| 222 | 222 | UINT8 data = HP48_IO_8(0x16); /* byte to send */ |
| 223 | 223 | |
| 224 | LOG_SERIAL(( "%05x %f hp48_rs232_send_byte: start sending, data=%02x\n", | |
| 224 | LOG_SERIAL(( "%05x %f hp48_rs232_send_byte: start sending, data=%02x\n", | |
| 225 | 225 | cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), attotime_to_double(timer_get_time(machine)), data )); |
| 226 | 226 | |
| 227 | 227 | /* set byte sending and send buffer full */ |
| r5932 | r5933 | |
| 238 | 238 | { |
| 239 | 239 | UINT8 data = chardev_in( hp48_chardev ); |
| 240 | 240 | |
| 241 | LOG_SERIAL(( "%f hp48_chardev_byte_recv_cb: end of receive, data=%02x\n", | |
| 241 | LOG_SERIAL(( "%f hp48_chardev_byte_recv_cb: end of receive, data=%02x\n", | |
| 242 | 242 | attotime_to_double(timer_get_time(machine)), data )); |
| 243 | 243 | |
| 244 | 244 | hp48_io[0x14] = data & 0xf; /* receive zone */ |
| r5932 | r5933 | |
| 257 | 257 | { |
| 258 | 258 | if ( status != CHARDEV_OK ) return; |
| 259 | 259 | |
| 260 | LOG_SERIAL(( "%f hp48_chardev_start_recv_byte: start receiving\n", | |
| 260 | LOG_SERIAL(( "%f hp48_chardev_start_recv_byte: start receiving\n", | |
| 261 | 261 | attotime_to_double(timer_get_time(machine)) )); |
| 262 | 262 | |
| 263 | 263 | hp48_io[0x11] |= 2; /* set byte receiving */ |
| 264 | ||
| 264 | ||
| 265 | 265 | /* interrupt */ |
| 266 | 266 | if ( hp48_io[0x10] & 1 ) |
| 267 | 267 | { |
| r5932 | r5933 | |
| 274 | 274 | |
| 275 | 275 | static void hp48_chardev_ready_to_send( running_machine *machine ) |
| 276 | 276 | { |
| 277 | hp48_io[0x12] &= ~3; | |
| 277 | hp48_io[0x12] &= ~3; | |
| 278 | 278 | |
| 279 | 279 | /* interrupt */ |
| 280 | 280 | if ( hp48_io[0x10] & 4 ) |
| r5932 | r5933 | |
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | static const chardev_interface hp48_chardev_iface = | |
| 286 | static const chardev_interface hp48_chardev_iface = | |
| 287 | 287 | { hp48_chardev_start_recv_byte, hp48_chardev_ready_to_send }; |
| 288 | 288 | |
| 289 | 289 | #endif |
| r5932 | r5933 | |
| 300 | 300 | |
| 301 | 301 | /* bits 0-8: keyboard lines */ |
| 302 | 302 | hp48_out = out & 0x1ff; |
| 303 | ||
| 303 | ||
| 304 | 304 | /* bits 9-10: unused */ |
| 305 | ||
| 305 | ||
| 306 | 306 | /* bit 11: beeper */ |
| 307 | 307 | dac_data_w( devtag_get_device(device->machine, "dac"), (out & 0x800) ? 0x80 : 00 ); |
| 308 | 308 | } |
| r5932 | r5933 | |
| 321 | 321 | if ( (hp48_out >> 6) & 1 ) in |= input_port_read( machine, "LINE6" ); |
| 322 | 322 | if ( (hp48_out >> 7) & 1 ) in |= input_port_read( machine, "LINE7" ); |
| 323 | 323 | if ( (hp48_out >> 8) & 1 ) in |= input_port_read( machine, "LINE8" ); |
| 324 | ||
| 324 | ||
| 325 | 325 | /* on key */ |
| 326 | 326 | in |= input_port_read( machine, "ON" ); |
| 327 | 327 | |
| r5932 | r5933 | |
| 339 | 339 | |
| 340 | 340 | /* key detect */ |
| 341 | 341 | static void hp48_update_kdn( running_machine *machine ) |
| 342 | { | |
| 342 | { | |
| 343 | 343 | int in = hp48_get_in( machine ); |
| 344 | 344 | |
| 345 | 345 | /* interrupt on raising edge */ |
| 346 | if ( in && !hp48_kdn ) | |
| 346 | if ( in && !hp48_kdn ) | |
| 347 | 347 | { |
| 348 | 348 | LOG(( "%f hp48_update_kdn: interrupt\n", attotime_to_double(timer_get_time(machine)) )); |
| 349 | 349 | hp48_io[0x19] |= 8; /* service request */ |
| r5932 | r5933 | |
| 360 | 360 | /* NMI for ON key */ |
| 361 | 361 | if ( input_port_read( machine, "ON" ) ) |
| 362 | 362 | { |
| 363 | LOG(( "%f hp48_kbd_cb: keyboard interrupt, on key\n", | |
| 364 | attotime_to_double(timer_get_time(machine)) )); | |
| 363 | LOG(( "%f hp48_kbd_cb: keyboard interrupt, on key\n", | |
| 364 | attotime_to_double(timer_get_time(machine)) )); | |
| 365 | 365 | hp48_io[0x19] |= 8; /* set service request */ |
| 366 | 366 | hp48_pulse_irq( machine, SATURN_WAKEUP_LINE ); |
| 367 | 367 | hp48_pulse_irq( machine, SATURN_NMI_LINE ); |
| r5932 | r5933 | |
| 377 | 377 | { |
| 378 | 378 | LOG(( "%05x %f hp48_rsi\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)) )); |
| 379 | 379 | |
| 380 | /* enables interrupts on key repeat | |
| 381 | (normally, there is only one interrupt, when the key is pressed) | |
| 382 | */ | |
| 380 | /* enables interrupts on key repeat | |
| 381 | (normally, there is only one interrupt, when the key is pressed) | |
| 382 | */ | |
| 383 | 383 | hp48_kdn = 0; |
| 384 | 384 | } |
| 385 | 385 | |
| r5932 | r5933 | |
| 389 | 389 | static void hp48_update_annunciators( running_machine *machine, void* param ) |
| 390 | 390 | { |
| 391 | 391 | /* bit 0: left shift |
| 392 | bit 1: right shift | |
| 393 | bit 2: alpha | |
| 394 | bit 3: alert | |
| 395 | bit 4: busy | |
| 396 | bit 5: transmit | |
| 397 | bit 7: master enable | |
| 398 | */ | |
| 392 | bit 1: right shift | |
| 393 | bit 2: alpha | |
| 394 | bit 3: alert | |
| 395 | bit 4: busy | |
| 396 | bit 5: transmit | |
| 397 | bit 7: master enable | |
| 398 | */ | |
| 399 | 399 | int markers = HP48_IO_8(0xb); |
| 400 | 400 | output_set_value( "lshift0", (markers & 0x81) == 0x81 ); |
| 401 | 401 | output_set_value( "rshift0", (markers & 0x82) == 0x82 ); |
| r5932 | r5933 | |
| 416 | 416 | |
| 417 | 417 | static WRITE8_HANDLER ( hp48_io_w ) |
| 418 | 418 | { |
| 419 | LOG(( "%05x %f hp48_io_w: off=%02x data=%x\n", | |
| 419 | LOG(( "%05x %f hp48_io_w: off=%02x data=%x\n", | |
| 420 | 420 | cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset, data )); |
| 421 | 421 | |
| 422 | 422 | switch( offset ) |
| r5932 | r5933 | |
| 440 | 440 | { |
| 441 | 441 | int old_cntrl = hp48_io[offset] & 8; |
| 442 | 442 | hp48_io[offset] = data; |
| 443 | if ( old_cntrl != (data & 8) ) | |
| 443 | if ( old_cntrl != (data & 8) ) | |
| 444 | 444 | { |
| 445 | 445 | hp48_apply_modules( space->machine, NULL ); |
| 446 | 446 | } |
| r5932 | r5933 | |
| 465 | 465 | /* bit 0: software interrupt */ |
| 466 | 466 | if ( data & 1 ) |
| 467 | 467 | { |
| 468 | LOG(( "%f hp48_io_w: software interrupt requested\n", | |
| 468 | LOG(( "%f hp48_io_w: software interrupt requested\n", | |
| 469 | 469 | attotime_to_double(timer_get_time(space->machine)) )); |
| 470 | 470 | hp48_pulse_irq( space->machine, SATURN_IRQ_LINE ); |
| 471 | 471 | data &= ~1; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | /* XXX not implemented | |
| 475 | bit 1: card test? | |
| 476 | */ | |
| 474 | /* XXX not implemented | |
| 475 | bit 1: card test? | |
| 476 | */ | |
| 477 | 477 | |
| 478 | 478 | hp48_io[0x0e] = data; |
| 479 | 479 | break; |
| r5932 | r5933 | |
| 499 | 499 | |
| 500 | 500 | /* XXX not implemented: |
| 501 | 501 | |
| 502 | - 0x0d: RS232c speed: | |
| 503 | bits 0-2: speed | |
| 504 | 000 = 1200 bauds | |
| 505 | 010 = 2400 bauds | |
| 506 | 100 = 4800 bauds | |
| 507 | 110 = 9600 bauds | |
| 502 | - 0x0d: RS232c speed: | |
| 503 | bits 0-2: speed | |
| 504 | 000 = 1200 bauds | |
| 505 | 010 = 2400 bauds | |
| 506 | 100 = 4800 bauds | |
| 507 | 110 = 9600 bauds | |
| 508 | 508 | bit 3: ? |
| 509 | 509 | |
| 510 | 510 | - 0x1a: I/R input |
| 511 | 511 | bit 0: irq |
| 512 | bit 1: irq enable | |
| 513 | bit 2: 1=RS232c mode 0=direct mode | |
| 514 | bit 3: receiving | |
| 512 | bit 1: irq enable | |
| 513 | bit 2: 1=RS232c mode 0=direct mode | |
| 514 | bit 3: receiving | |
| 515 | 515 | |
| 516 | - 0x1c: I/R output control | |
| 517 | bit 0: buffer full | |
| 518 | bit 1: transmitting | |
| 519 | bit 2: irq enable on buffer empty | |
| 520 | bit 3: led on (direct mode) | |
| 516 | - 0x1c: I/R output control | |
| 517 | bit 0: buffer full | |
| 518 | bit 1: transmitting | |
| 519 | bit 2: irq enable on buffer empty | |
| 520 | bit 3: led on (direct mode) | |
| 521 | 521 | |
| 522 | - 0x1d: I/R output buffer | |
| 523 | */ | |
| 522 | - 0x1d: I/R output buffer | |
| 523 | */ | |
| 524 | 524 | |
| 525 | 525 | default: hp48_io[offset] = data; |
| 526 | 526 | } |
| r5932 | r5933 | |
| 534 | 534 | |
| 535 | 535 | switch( offset ) |
| 536 | 536 | { |
| 537 | ||
| 537 | ||
| 538 | 538 | /* CRC register */ |
| 539 | 539 | case 0x04: data = hp48_crc & 0xf; break; |
| 540 | 540 | case 0x05: data = (hp48_crc >> 4) & 0xf; break; |
| r5932 | r5933 | |
| 547 | 547 | if ( hp48_io[0x9] & 8 ) /* test enable */ |
| 548 | 548 | { |
| 549 | 549 | /* XXX not implemented: |
| 550 | bit 3: battery in port 2 | |
| 551 | bit 2: battery in port 1 | |
| 552 | */ | |
| 550 | bit 3: battery in port 2 | |
| 551 | bit 2: battery in port 1 | |
| 552 | */ | |
| 553 | 553 | switch ( input_port_read( space->machine, "BATTERY" ) ) |
| 554 | 554 | { |
| 555 | 555 | case 1: data = 2; break; /* low */ |
| r5932 | r5933 | |
| 563 | 563 | case 0x29: |
| 564 | 564 | { |
| 565 | 565 | int last_line = HP48_IO_8(0x28) & 0x3f; /* last line of main bitmap before menu */ |
| 566 | int cur_line = video_screen_get_vpos( space->machine->primary_screen ); | |
| 566 | int cur_line = video_screen_get_vpos( space->machine->primary_screen ); | |
| 567 | 567 | if ( last_line <= 1 ) last_line = 0x3f; |
| 568 | 568 | data = ( cur_line >= 0 && cur_line <= last_line ) ? last_line - cur_line : 0; |
| 569 | 569 | if ( offset == 0x29 ) |
| r5932 | r5933 | |
| 590 | 590 | case 0x3f: data = (hp48_timer2 >> 28) & 0xf; break; |
| 591 | 591 | |
| 592 | 592 | /* serial */ |
| 593 | case 0x15: | |
| 593 | case 0x15: | |
| 594 | 594 | { |
| 595 | 595 | /* second nibble of received data */ |
| 596 | 596 | |
| 597 | 597 | const device_config *xmodem = devtag_get_device(space->machine, "rs232_x"); |
| 598 | const device_config *kermit = devtag_get_device(space->machine, "rs232_k"); | |
| 598 | const device_config *kermit = devtag_get_device(space->machine, "rs232_k"); | |
| 599 | 599 | |
| 600 | 600 | hp48_io[0x11] &= ~1; /* clear byte received */ |
| 601 | 601 | data = hp48_io[offset]; |
| 602 | ||
| 602 | ||
| 603 | 603 | /* protocol action */ |
| 604 | 604 | if ( xmodem && image_exists( xmodem ) ) xmodem_byte_transmitted( xmodem ); |
| 605 | 605 | else if ( kermit && image_exists( kermit ) ) kermit_byte_transmitted( kermit ); |
| r5932 | r5933 | |
| 634 | 634 | default: data = hp48_io[offset]; |
| 635 | 635 | } |
| 636 | 636 | |
| 637 | LOG(( "%05x %f hp48_io_r: off=%02x data=%x\n", | |
| 637 | LOG(( "%05x %f hp48_io_r: off=%02x data=%x\n", | |
| 638 | 638 | cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset, data )); |
| 639 | 639 | return data; |
| 640 | 640 | } |
| r5932 | r5933 | |
| 711 | 711 | |
| 712 | 712 | /* --------- memory controller ----------- */ |
| 713 | 713 | |
| 714 | /* | |
| 714 | /* | |
| 715 | 715 | Clark (S series) and York (G series) CPUs have 6 daisy-chained modules |
| 716 | 716 | |
| 717 | 717 | |
| r5932 | r5933 | |
| 776 | 776 | { |
| 777 | 777 | /* NCE2 */ |
| 778 | 778 | hp48_modules[5].off_mask = 0x7ffff; |
| 779 | nce2_enable = hp48_bank_switch >> 6; | |
| 779 | nce2_enable = hp48_bank_switch >> 6; | |
| 780 | 780 | } |
| 781 | 781 | } |
| 782 | 782 | |
| r5932 | r5933 | |
| 816 | 816 | |
| 817 | 817 | LOG(( "hp48_apply_modules: module %s configured at %05x-%05x, mirror %05x\n", |
| 818 | 818 | hp48_module_names[i], base, end, mirror )); |
| 819 | ||
| 819 | ||
| 820 | 820 | if ( hp48_modules[i].data ) |
| 821 | 821 | { |
| 822 | 822 | memory_set_bankptr( space->machine, i, hp48_modules[i].data ); |
| r5932 | r5933 | |
| 862 | 862 | |
| 863 | 863 | /* CONFIG opcode */ |
| 864 | 864 | void hp48_mem_config( const device_config *device, int v ) |
| 865 | { | |
| 865 | { | |
| 866 | 866 | int i; |
| 867 | 867 | |
| 868 | 868 | LOG(( "%05x %f hp48_mem_config: %05x\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), v )); |
| r5932 | r5933 | |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | /* ... second call sets the base address */ |
| 882 | if ( hp48_modules[i].state == HP48_MODULE_MASK_KNOWN ) | |
| 882 | if ( hp48_modules[i].state == HP48_MODULE_MASK_KNOWN ) | |
| 883 | 883 | { |
| 884 | 884 | hp48_modules[i].base = v & hp48_modules[i].mask; |
| 885 | 885 | hp48_modules[i].state = HP48_MODULE_CONFIGURED; |
| r5932 | r5933 | |
| 894 | 894 | |
| 895 | 895 | /* UNCFG opcode */ |
| 896 | 896 | void hp48_mem_unconfig( const device_config *device, int v ) |
| 897 | { | |
| 897 | { | |
| 898 | 898 | int i; |
| 899 | 899 | LOG(( "%05x %f hp48_mem_unconfig: %05x\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), v )); |
| 900 | 900 | |
| r5932 | r5933 | |
| 902 | 902 | for ( i = 0; i < 5; i++ ) |
| 903 | 903 | { |
| 904 | 904 | /* ... and unconfigure it */ |
| 905 | if ( hp48_modules[i].state == HP48_MODULE_CONFIGURED && | |
| 905 | if ( hp48_modules[i].state == HP48_MODULE_CONFIGURED && | |
| 906 | 906 | (hp48_modules[i].base == (v & hp48_modules[i].mask)) ) |
| 907 | 907 | { |
| 908 | 908 | hp48_modules[i].state = i> 0 ? HP48_MODULE_UNCONFIGURED : HP48_MODULE_MASK_KNOWN; |
| r5932 | r5933 | |
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | /* ... address need to be configured */ |
| 934 | if ( hp48_modules[i].state == HP48_MODULE_MASK_KNOWN ) | |
| 934 | if ( hp48_modules[i].state == HP48_MODULE_MASK_KNOWN ) | |
| 935 | 935 | { |
| 936 | 936 | data = hp48_module_addr_id[i] | (hp48_modules[i].base & ~0x3f); |
| 937 | 937 | break; |
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | LOG(( "%05x %f hp48_mem_id = %02x\n", | |
| 941 | LOG(( "%05x %f hp48_mem_id = %02x\n", | |
| 942 | 942 | cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data )); |
| 943 | 943 | |
| 944 | 944 | return data; /* everything is configured */ |
| r5932 | r5933 | |
| 966 | 966 | static void hp48_decode_nibble( UINT8* dst, UINT8* src, int size ) |
| 967 | 967 | { |
| 968 | 968 | int i; |
| 969 | for ( i=size-1; i >= 0; i-- ) | |
| 969 | for ( i=size-1; i >= 0; i-- ) | |
| 970 | 970 | { |
| 971 | 971 | dst[2*i+1] = src[i] >> 4; |
| 972 | 972 | dst[2*i] = src[i] & 0xf; |
| r5932 | r5933 | |
| 977 | 977 | static void hp48_encode_nibble( UINT8* dst, UINT8* src, int size ) |
| 978 | 978 | { |
| 979 | 979 | int i; |
| 980 | for ( i=0; i < size; i++ ) | |
| 980 | for ( i=0; i < size; i++ ) | |
| 981 | 981 | { |
| 982 | 982 | dst[i] = (src[2*i] & 0xf) | (src[2*i+1] << 4); |
| 983 | 983 | } |
| r5932 | r5933 | |
| 1043 | 1043 | static DEVICE_IMAGE_CREATE( hp48_port ) |
| 1044 | 1044 | { |
| 1045 | 1045 | struct hp48_port_config* conf = (struct hp48_port_config*) image->static_config; |
| 1046 | int size = conf->max_size; | |
| 1046 | int size = conf->max_size; | |
| 1047 | 1047 | /* XXX defaults to max_size; get user-specified size instead */ |
| 1048 | 1048 | |
| 1049 | 1049 | /* check size */ |
| r5932 | r5933 | |
| 1052 | 1052 | { |
| 1053 | 1053 | logerror( "hp48: image size for %s should be a power of two between %i and %i\n", conf->name, 32*1024, conf->max_size ); |
| 1054 | 1054 | return INIT_FAIL; |
| 1055 | } | |
| 1055 | } | |
| 1056 | 1056 | |
| 1057 | hp48_port_size[conf->port] = size; | |
| 1057 | hp48_port_size[conf->port] = size; | |
| 1058 | 1058 | hp48_port_write[conf->port] = 1; |
| 1059 | 1059 | hp48_fill_port( image ); |
| 1060 | 1060 | return INIT_PASS; |
| r5932 | r5933 | |
| 1063 | 1063 | static DEVICE_IMAGE_UNLOAD( hp48_port ) |
| 1064 | 1064 | { |
| 1065 | 1065 | struct hp48_port_config* conf = (struct hp48_port_config*) image->static_config; |
| 1066 | LOG(( "hp48_port image unload: %s size=%i rw=%i\n", | |
| 1066 | LOG(( "hp48_port image unload: %s size=%i rw=%i\n", | |
| 1067 | 1067 | conf->name, hp48_port_size[conf->port] ,hp48_port_write[conf->port] )); |
| 1068 | 1068 | if ( hp48_port_write[conf->port] ) |
| 1069 | 1069 | { |
| r5932 | r5933 | |
| 1084 | 1084 | DEVICE_GET_INFO( hp48_port ) |
| 1085 | 1085 | { |
| 1086 | 1086 | struct hp48_port_config* conf = device ? (struct hp48_port_config*) device->static_config : NULL; |
| 1087 | switch ( state ) | |
| 1087 | switch ( state ) | |
| 1088 | 1088 | { |
| 1089 | 1089 | case DEVINFO_INT_TOKEN_BYTES: info->i = 1; break; |
| 1090 | 1090 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| r5932 | r5933 | |
| 1178 | 1178 | hp48_modules[1].write = SMH_BANK(1); |
| 1179 | 1179 | hp48_modules[1].data = ram; |
| 1180 | 1180 | |
| 1181 | if ( HP48_G_SERIES ) | |
| 1181 | if ( HP48_G_SERIES ) | |
| 1182 | 1182 | { |
| 1183 | 1183 | /* bank switcher */ |
| 1184 | 1184 | hp48_modules[2].off_mask = 0x00fff; /* 2 KB */ |
| r5932 | r5933 | |
| 1207 | 1207 | state_save_register_global(machine, hp48_timer1 ); |
| 1208 | 1208 | state_save_register_global(machine, hp48_timer2 ); |
| 1209 | 1209 | state_save_register_global(machine, hp48_bank_switch ); |
| 1210 | for ( i = 0; i < 6; i++ ) | |
| 1210 | for ( i = 0; i < 6; i++ ) | |
| 1211 | 1211 | { |
| 1212 | 1212 | state_save_register_item(machine, "globals", NULL, i, hp48_modules[i].state ); |
| 1213 | 1213 | state_save_register_item(machine, "globals", NULL, i, hp48_modules[i].base ); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | applefdc.h | |
| 4 | 4 | |
| 5 | Implementation of various Apple Floppy Disk Controllers, including | |
| 6 | the classic Apple controller and the IWM (Integrated Woz Machine) | |
| 7 | chip | |
| 5 | Implementation of various Apple Floppy Disk Controllers, including | |
| 6 | the classic Apple controller and the IWM (Integrated Woz Machine) | |
| 7 | chip | |
| 8 | 8 | |
| 9 | Nate Woods | |
| 10 | Raphael Nabet | |
| 9 | Nate Woods | |
| 10 | Raphael Nabet | |
| 11 | 11 | |
| 12 | 12 | *********************************************************************/ |
| 13 | 13 | |
| r5932 | r5933 | |
| 55 | 55 | ***************************************************************************/ |
| 56 | 56 | |
| 57 | 57 | /* classic Apple II disk controller (pre-IWM) */ |
| 58 | DEVICE_GET_INFO(applefdc); | |
| 58 | DEVICE_GET_INFO(applefdc); | |
| 59 | 59 | |
| 60 | 60 | /* Integrated Woz Machine */ |
| 61 | 61 | DEVICE_GET_INFO(iwm); |
| 62 | 62 | |
| 63 | 63 | /* Steve Woz Integrated Machine (NYI) */ |
| 64 | DEVICE_GET_INFO(swim); | |
| 64 | DEVICE_GET_INFO(swim); | |
| 65 | 65 | |
| 66 | 66 | /* read/write handlers */ |
| 67 | 67 | READ8_DEVICE_HANDLER(applefdc_r); |
| r5932 | r5933 | |
| 81 | 81 | #define MDRV_APPLEFDC_MODIFY(_tag, _intrf) \ |
| 82 | 82 | MDRV_DEVICE_MODIFY(_tag) \ |
| 83 | 83 | MDRV_DEVICE_CONFIG(_intrf) |
| 84 | ||
| 84 | ||
| 85 | 85 | #define MDRV_IWM_ADD(_tag, _intrf) \ |
| 86 | 86 | MDRV_DEVICE_ADD(_tag, IWM, 0) \ |
| 87 | 87 | MDRV_DEVICE_CONFIG(_intrf) |
| r5932 | r5933 | |
| 89 | 89 | #define MDRV_IWM_MODIFY(_tag, _intrf) \ |
| 90 | 90 | MDRV_DEVICE_MODIFY(_tag) \ |
| 91 | 91 | MDRV_DEVICE_CONFIG(_intrf) |
| 92 | ||
| 92 | ||
| 93 | 93 | #define MDRV_SWIM_ADD(_tag, _intrf) \ |
| 94 | 94 | MDRV_DEVICE_ADD(_tag, SWIM, 0) \ |
| 95 | 95 | MDRV_DEVICE_CONFIG(_intrf) |
| r5932 | r5933 | |
| 97 | 97 | #define MDRV_SWIM_MODIFY(_tag, _intrf) \ |
| 98 | 98 | MDRV_DEVICE_MODIFY(_tag) \ |
| 99 | 99 | MDRV_DEVICE_CONFIG(_intrf) |
| 100 | ||
| 101 | 100 | |
| 101 | ||
| 102 | 102 | #endif /* __APPLEFDC_H__ */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | mockngbd.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of the Apple II Mockingboard | |
| 6 | 6 | |
| 7 | ||
| 7 | The Mockingboard comes in different flavours: | |
| 8 | 8 | |
| 9 | * Sound I: one AY-3-8910 chip for three audio channels | |
| 10 | * Speech I: one SC-01 chip | |
| 11 | * Sound II: two AY-3-8910 chips for six audio channels | |
| 12 | * Sound/Speech I: one AY-3-8910 and one SC-01 | |
| 9 | * Sound I: one AY-3-8910 chip for three audio channels | |
| 10 | * Speech I: one SC-01 chip | |
| 11 | * Sound II: two AY-3-8910 chips for six audio channels | |
| 12 | * Sound/Speech I: one AY-3-8910 and one SC-01 | |
| 13 | 13 | |
| 14 | * Mockingboard A: two AY-3-8913 chips for six audio channels and two open sockets for SSI-263 speech chips | |
| 15 | * Mockingboard B: not a soundcard per se, but just two SSI-263 speech chip upgrade for Mockingboard A | |
| 16 | * Mockingboard C: two AY-3-8913 and one SSI-263 (essentially a Mockingboard A with the upgrade pre-installed, only one speech chip allowed) | |
| 17 | * Mockingboard D: for Apple IIc only, two AY-3-8913 and one SSI-263, connected to the serial port and its own particular driver | |
| 18 | * Mockingboard M: bundled with Mindscape's Bank Street Music Writer, with two AY-3-8913 chips and an open socket | |
| 19 | for one speech chip. This model included a headphone jack and a jumper to permit sound to be played | |
| 20 | through the Apple's built-in speaker. | |
| 21 | * Mockingboard v1: a clone of the Mockingboard A from ReactiveMicro.com | |
| 22 | ||
| 14 | * Mockingboard A: two AY-3-8913 chips for six audio channels and two open sockets for SSI-263 speech chips | |
| 15 | * Mockingboard B: not a soundcard per se, but just two SSI-263 speech chip upgrade for Mockingboard A | |
| 16 | * Mockingboard C: two AY-3-8913 and one SSI-263 (essentially a Mockingboard A with the upgrade pre-installed, only one speech chip allowed) | |
| 17 | * Mockingboard D: for Apple IIc only, two AY-3-8913 and one SSI-263, connected to the serial port and its own particular driver | |
| 18 | * Mockingboard M: bundled with Mindscape's Bank Street Music Writer, with two AY-3-8913 chips and an open socket | |
| 19 | for one speech chip. This model included a headphone jack and a jumper to permit sound to be played | |
| 20 | through the Apple's built-in speaker. | |
| 21 | * Mockingboard v1: a clone of the Mockingboard A from ReactiveMicro.com | |
| 23 | 22 | |
| 24 | TODO - When sound cores and the 6522 VIA become devices, and devices | |
| 25 | can contain other devices, start containing AY8910 and 6522VIA | |
| 26 | implementations | |
| 27 | 23 | |
| 24 | TODO - When sound cores and the 6522 VIA become devices, and devices | |
| 25 | can contain other devices, start containing AY8910 and 6522VIA | |
| 26 | implementations | |
| 27 | ||
| 28 | 28 | *********************************************************************/ |
| 29 | 29 | |
| 30 | 30 | #include "mockngbd.h" |
| r5932 | r5933 | |
| 71 | 71 | |
| 72 | 72 | /*------------------------------------------------- |
| 73 | 73 | DEVICE_START(mockingboard) - device start |
| 74 | ||
| 74 | function | |
| 75 | 75 | -------------------------------------------------*/ |
| 76 | 76 | |
| 77 | 77 | static DEVICE_START(mockingboard) |
| r5932 | r5933 | |
| 82 | 82 | |
| 83 | 83 | /*------------------------------------------------- |
| 84 | 84 | DEVICE_RESET(mockingboard) - device reset |
| 85 | ||
| 85 | function | |
| 86 | 86 | -------------------------------------------------*/ |
| 87 | 87 | |
| 88 | 88 | static DEVICE_RESET(mockingboard) |
| r5932 | r5933 | |
| 97 | 97 | /* What follows is pure filth. It abuses the core like an angry pimp on a bad hair day. */ |
| 98 | 98 | |
| 99 | 99 | /* Since we know that the Mockingboard has no code ROM, we'll copy into the slot ROM space |
| 100 | an image of the onboard ROM so that when an IRQ bankswitches to the onboard ROM, we read | |
| 101 | the proper stuff. Without this, it will choke and try to use the memory handler above, and | |
| 102 | fail miserably. That should really be fixed. I beg you -- if you are reading this comment, | |
| 103 | fix this :) */ | |
| 104 | // memcpy (apple2_slotrom(slot), &apple_rom[0x0000 + (slot * 0x100)], 0x100); | |
| 100 | an image of the onboard ROM so that when an IRQ bankswitches to the onboard ROM, we read | |
| 101 | the proper stuff. Without this, it will choke and try to use the memory handler above, and | |
| 102 | fail miserably. That should really be fixed. I beg you -- if you are reading this comment, | |
| 103 | fix this :) */ | |
| 104 | // memcpy (apple2_slotrom(slot), &apple_rom[0x0000 + (slot * 0x100)], 0x100); | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| r5932 | r5933 | |
| 210 | 210 | |
| 211 | 211 | /*------------------------------------------------- |
| 212 | 212 | DEVICE_GET_INFO(mockingboard) - device get info |
| 213 | ||
| 213 | function | |
| 214 | 214 | -------------------------------------------------*/ |
| 215 | 215 | |
| 216 | 216 | DEVICE_GET_INFO(mockingboard) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/apple3.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple /// | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | VIA #0 (D VIA) | |
| 9 | CA1: 1 if a cartridge is inserted, 0 otherwise | |
| 8 | VIA #0 (D VIA) | |
| 9 | CA1: 1 if a cartridge is inserted, 0 otherwise | |
| 10 | 10 | |
| 11 | VIA #1 (E VIA) | |
| 12 | CA2: 1 if key pressed, 0 otherwise | |
| 11 | VIA #1 (E VIA) | |
| 12 | CA2: 1 if key pressed, 0 otherwise | |
| 13 | 13 | |
| 14 | 14 | ***************************************************************************/ |
| 15 | 15 | |
| r5932 | r5933 | |
| 603 | 603 | { |
| 604 | 604 | #if 0 |
| 605 | 605 | /* The Apple /// Diagnostics seems to expect that indexed writes |
| 606 | * always write to RAM. That image jumps to an address that is | |
| 607 | * undefined unless this code is enabled. However, the Sara | |
| 608 | * emulator does not have corresponding code here, though Chris | |
| 609 | * Smolinski does not rule out the possibility | |
| 610 | */ | |
| 606 | * always write to RAM. That image jumps to an address that is | |
| 607 | * undefined unless this code is enabled. However, the Sara | |
| 608 | * emulator does not have corresponding code here, though Chris | |
| 609 | * Smolinski does not rule out the possibility | |
| 610 | */ | |
| 611 | 611 | result = apple3_bankaddr(~0, offset - 0x8000); |
| 612 | 612 | #endif |
| 613 | 613 | } |
| r5932 | r5933 | |
|---|---|---|
| 13 | 13 | } CLIO; |
| 14 | 14 | |
| 15 | 15 | |
| 16 | //static UINT32 | |
| 16 | //static UINT32 unk_318_data_0 = 0; | |
| 17 | 17 | static MADAM madam; |
| 18 | 18 | static CLIO clio; |
| 19 | 19 | |
| r5932 | r5933 | |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | /* |
| 33 | ||
| 33 | I have no idea what piece of hardware this is. Possibly some kind of communication hardware. | |
| 34 | 34 | |
| 35 | During booting the following things get written/read: | |
| 36 | write 03180000 to 03180000 | |
| 37 | 4 read actions from 03180000, if lower bit is 1 0 1 0 then | |
| 38 | write 02000000 to 03180000 | |
| 39 | write 04000000 to 03180000 | |
| 40 | write 08000000 to 03180000 | |
| 41 | write 10000000 to 03180000 | |
| 42 | write 20000000 to 03180000 | |
| 43 | write 40000000 to 03180000 | |
| 44 | write 80000000 to 03180000 | |
| 45 | write 00000001 to 03180000 | |
| 46 | write 00000002 to 03180000 | |
| 47 | write 00000004 to 03180000 | |
| 48 | write 00000008 to 03180000 | |
| 49 | write 00000010 to 03180000 | |
| 50 | write 00000020 to 03180000 | |
| 51 | write 00000040 to 03180000 | |
| 52 | write 00000080 to 03180000 | |
| 53 | write 00000100 to 03180000 | |
| 54 | read from 03180000 | |
| 55 | write 04000000 to 03180000 | |
| 56 | write 08000000 to 03180000 | |
| 57 | write 10000000 to 03180000 | |
| 58 | write 20000000 to 03180000 | |
| 59 | write 40000000 to 03180000 | |
| 60 | write 80000000 to 03180000 | |
| 61 | write 00000001 to 03180000 | |
| 62 | write 00000002 to 03180000 | |
| 63 | write 00000004 to 03180000 | |
| 64 | write 00000008 to 03180000 | |
| 65 | write 00000010 to 03180000 | |
| 66 | write 00000020 to 03180000 | |
| 67 | write 00000040 to 03180000 | |
| 68 | write 00000080 to 03180000 | |
| 69 | write 00000100 to 03180000 | |
| 70 | write 00002000 to 03180000 | |
| 71 | several groups of 16 write actions or 16 read actions | |
| 35 | During booting the following things get written/read: | |
| 36 | write 03180000 to 03180000 | |
| 37 | 4 read actions from 03180000, if lower bit is 1 0 1 0 then | |
| 38 | write 02000000 to 03180000 | |
| 39 | write 04000000 to 03180000 | |
| 40 | write 08000000 to 03180000 | |
| 41 | write 10000000 to 03180000 | |
| 42 | write 20000000 to 03180000 | |
| 43 | write 40000000 to 03180000 | |
| 44 | write 80000000 to 03180000 | |
| 45 | write 00000001 to 03180000 | |
| 46 | write 00000002 to 03180000 | |
| 47 | write 00000004 to 03180000 | |
| 48 | write 00000008 to 03180000 | |
| 49 | write 00000010 to 03180000 | |
| 50 | write 00000020 to 03180000 | |
| 51 | write 00000040 to 03180000 | |
| 52 | write 00000080 to 03180000 | |
| 53 | write 00000100 to 03180000 | |
| 54 | read from 03180000 | |
| 55 | write 04000000 to 03180000 | |
| 56 | write 08000000 to 03180000 | |
| 57 | write 10000000 to 03180000 | |
| 58 | write 20000000 to 03180000 | |
| 59 | write 40000000 to 03180000 | |
| 60 | write 80000000 to 03180000 | |
| 61 | write 00000001 to 03180000 | |
| 62 | write 00000002 to 03180000 | |
| 63 | write 00000004 to 03180000 | |
| 64 | write 00000008 to 03180000 | |
| 65 | write 00000010 to 03180000 | |
| 66 | write 00000020 to 03180000 | |
| 67 | write 00000040 to 03180000 | |
| 68 | write 00000080 to 03180000 | |
| 69 | write 00000100 to 03180000 | |
| 70 | write 00002000 to 03180000 | |
| 71 | several groups of 16 write actions or 16 read actions | |
| 72 | 72 | */ |
| 73 | 73 | READ32_HANDLER( unk_318_r ) { |
| 74 | 74 | logerror( "%08X: UNK_318 read offset = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ap2_slot.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of Apple II device slots | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 51 | 51 | ***************************************************************************/ |
| 52 | 52 | |
| 53 | 53 | /* device get info function */ |
| 54 | DEVICE_GET_INFO(apple2_slot); | |
| 54 | DEVICE_GET_INFO(apple2_slot); | |
| 55 | 55 | |
| 56 | 56 | /* slot read function */ |
| 57 | 57 | READ8_DEVICE_HANDLER(apple2_slot_r); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | mockngbd.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of the Apple II Mockingboard | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 27 | 27 | ***************************************************************************/ |
| 28 | 28 | |
| 29 | 29 | /* device get info function */ |
| 30 | DEVICE_GET_INFO(mockingboard); | |
| 30 | DEVICE_GET_INFO(mockingboard); | |
| 31 | 31 | |
| 32 | 32 | /* slot read function */ |
| 33 | 33 | READ8_DEVICE_HANDLER(mockingboard_r); |
| r5932 | r5933 | |
|---|---|---|
| 154 | 154 | |
| 155 | 155 | /*************************************************************************** |
| 156 | 156 | |
| 157 | ||
| 157 | Discrete Devices IO | |
| 158 | 158 | |
| 159 | FD00 POR1: IN bit 0 - | |
| 160 | bit 1 - | |
| 161 | bit 2 PIPGE: Page signal | |
| 162 | bit 3 PIDTR: Serial output ready | |
| 163 | bit 4 PIBU1: Button on paddle 1 (1 = closed) | |
| 164 | bit 5 PIBU1: Button on paddle 2 (1 = closed) | |
| 165 | bit 6 PIRPI: Random data | |
| 166 | bit 7 PICAI: Cassette input data | |
| 159 | FD00 POR1: IN bit 0 - | |
| 160 | bit 1 - | |
| 161 | bit 2 PIPGE: Page signal | |
| 162 | bit 3 PIDTR: Serial output ready | |
| 163 | bit 4 PIBU1: Button on paddle 1 (1 = closed) | |
| 164 | bit 5 PIBU1: Button on paddle 2 (1 = closed) | |
| 165 | bit 6 PIRPI: Random data | |
| 166 | bit 7 PICAI: Cassette input data | |
| 167 | 167 | |
| 168 | ||
| 168 | FD01 PDLST: IN Single pulse used to trigger paddle timer circuit | |
| 169 | 169 | |
| 170 | FD04 POR1: OUT bit 0-3 Volume oscillator channel 0 | |
| 171 | bit 4-7 Volume oscillator channel 1 | |
| 170 | FD04 POR1: OUT bit 0-3 Volume oscillator channel 0 | |
| 171 | bit 4-7 Volume oscillator channel 1 | |
| 172 | 172 | |
| 173 | FD05 POR1: OUT bit 0-3 Volume oscillator channel 2 | |
| 174 | bit 4-7 Volume random noise generator | |
| 173 | FD05 POR1: OUT bit 0-3 Volume oscillator channel 2 | |
| 174 | bit 4-7 Volume random noise generator | |
| 175 | 175 | |
| 176 | FD06 POR0: OUT bit 0 POCAS: Cassette data output | |
| 177 | bit 1-2 PDLMSK: Paddle select | |
| 178 | bit 3 PDPNA: Paddle enable | |
| 179 | bit 4 POCM1: Cassette 1 motor control (0 = run) | |
| 180 | bit 5 POCM2: Cassette 2 motor control (0 = run) | |
| 181 | bit 6-7 ROM bank switching | |
| 176 | FD06 POR0: OUT bit 0 POCAS: Cassette data output | |
| 177 | bit 1-2 PDLMSK: Paddle select | |
| 178 | bit 3 PDPNA: Paddle enable | |
| 179 | bit 4 POCM1: Cassette 1 motor control (0 = run) | |
| 180 | bit 5 POCM2: Cassette 2 motor control (0 = run) | |
| 181 | bit 6-7 ROM bank switching | |
| 182 | 182 | ***************************************************************************/ |
| 183 | 183 | |
| 184 | 184 | READ8_HANDLER( dai_io_discrete_devices_r ) |
| r5932 | r5933 | |
| 244 | 244 | |
| 245 | 245 | /*************************************************************************** |
| 246 | 246 | |
| 247 | ||
| 247 | AMD 9911 mathematical coprocesor | |
| 248 | 248 | |
| 249 | 249 | ***************************************************************************/ |
| 250 | 250 |
| r5932 | r5933 | |
|---|---|---|
| 59 | 59 | static UINT8 n5380_Data[512]; |
| 60 | 60 | |
| 61 | 61 | #if NCR5380_DEVICE_CONVERSION |
| 62 | typedef struct _ncr5380_t ncr5380_t; | |
| 62 | typedef struct _ncr5380_t ncr5380_t; | |
| 63 | 63 | struct _ncr5380_t |
| 64 | 64 | { |
| 65 | 65 | SCSIInstance *devices[8]; |
| r5932 | r5933 | |
| 438 | 438 | |
| 439 | 439 | /* device interface */ |
| 440 | 440 | #if NCR5380_DEVICE_CONVERSION |
| 441 | static DEVICE_START( ncr5380 ) | |
| 441 | static DEVICE_START( ncr5380 ) | |
| 442 | 442 | { |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | |
| 446 | static DEVICE_RESET( ncr5380 ) | |
| 446 | static DEVICE_RESET( ncr5380 ) | |
| 447 | 447 | { |
| 448 | 448 | } |
| 449 | 449 |
| r5932 | r5933 | |
|---|---|---|
| 595 | 595 | break; |
| 596 | 596 | case 4: /* Read Data */ |
| 597 | 597 | /* |
| 598 | ||
| 598 | AdamNet Error codes on low nibble for tape1,disk1,disk2 and on high nibble for tape2 (share DCB with tape1): | |
| 599 | 599 | |
| 600 | 0x00 No Error (everything is OK) | |
| 601 | 0x01 CRC Error (block corrupt; data failed cyclic redundancy check) | |
| 602 | 0x02 Missing Block (attempt to access past physical end of medium) | |
| 603 | 0x03 Missing Media (not in drive or drive door open) | |
| 604 | 0x04 Missing Drive (not connected or not turned on) | |
| 605 | 0x05 Write-Protected (write-protect tab covered) | |
| 606 | 0x06 Drive Error (controller or seek failure) | |
| 607 | */ | |
| 600 | 0x00 No Error (everything is OK) | |
| 601 | 0x01 CRC Error (block corrupt; data failed cyclic redundancy check) | |
| 602 | 0x02 Missing Block (attempt to access past physical end of medium) | |
| 603 | 0x03 Missing Media (not in drive or drive door open) | |
| 604 | 0x04 Missing Drive (not connected or not turned on) | |
| 605 | 0x05 Write-Protected (write-protect tab covered) | |
| 606 | 0x06 Drive Error (controller or seek failure) | |
| 607 | */ | |
| 608 | 608 | if (deviceNum==1) |
| 609 | 609 | { |
| 610 | 610 | kbcode=getKeyFromBuffer(); |
| r5932 | r5933 | |
| 686 | 686 | WRITE8_HANDLER( adamnet_w ) |
| 687 | 687 | { |
| 688 | 688 | /* |
| 689 | If SmartWriter ROM is selected on lower Z80 memory | |
| 690 | if data bit1 is 1 -> Lower 32k = EOS otherwise Lower 32k = SmartWriter | |
| 691 | */ | |
| 689 | If SmartWriter ROM is selected on lower Z80 memory | |
| 690 | if data bit1 is 1 -> Lower 32k = EOS otherwise Lower 32k = SmartWriter | |
| 691 | */ | |
| 692 | 692 | UINT8 *BankBase; |
| 693 | 693 | BankBase = &memory_region(space->machine, "maincpu")[0x00000]; |
| 694 | 694 | |
| r5932 | r5933 | |
| 796 | 796 | inport6 = input_port_read(space->machine, "controllers"); |
| 797 | 797 | |
| 798 | 798 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more |
| 799 | than one, a real ColecoVision think that it is a third button, so we are going to emulate | |
| 800 | the right behaviour */ | |
| 799 | than one, a real ColecoVision think that it is a third button, so we are going to emulate | |
| 800 | the right behaviour */ | |
| 801 | 801 | |
| 802 | 802 | data = 0x0F; /* No key pressed by default */ |
| 803 | 803 | if (!(inport6&0x01)) /* If Driving Controller enabled -> no keypad 1 */ |
| r5932 | r5933 | |
| 845 | 845 | inport4 = input_port_read(space->machine, "controller2_keypad2"); |
| 846 | 846 | |
| 847 | 847 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more |
| 848 | than one, a real ColecoVision think that it is a third button, so we are going to emulate | |
| 849 | the right behaviour */ | |
| 848 | than one, a real ColecoVision think that it is a third button, so we are going to emulate | |
| 849 | the right behaviour */ | |
| 850 | 850 | |
| 851 | 851 | data = 0x0F; /* No key pressed by default */ |
| 852 | 852 | if (!(inport3 & 0x01)) data &= 0x0A; /* 0 */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | Atmel Serial DataFlash | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | AT45DB041 - 528 KByte | |
| 8 | AT45DB081 - 1056 KByte | |
| 9 | AT45DB161 - 2112 KByte | |
| 7 | AT45DB041 - 528 KByte | |
| 8 | AT45DB081 - 1056 KByte | |
| 9 | AT45DB161 - 2112 KByte | |
| 10 | 10 | |
| 11 | 11 | */ |
| 12 | 12 | |
| r5932 | r5933 | |
| 90 | 90 | static void common_start(const device_config *device, int device_type) |
| 91 | 91 | { |
| 92 | 92 | at45dbxx_t *flash = get_token(device); |
| 93 | ||
| 93 | ||
| 94 | 94 | _logerror( 0, ("at45dbxx_init (%d)\n", device_type)); |
| 95 | 95 | memset( flash, 0, sizeof( flash)); |
| 96 | 96 | switch (device_type) |
| r5932 | r5933 | |
| 103 | 103 | flash->data = auto_alloc_array(device->machine, UINT8, flash->size); |
| 104 | 104 | flash->buffer1 = auto_alloc_array(device->machine, UINT8, flash->page_size); |
| 105 | 105 | flash->buffer2 = auto_alloc_array(device->machine, UINT8, flash->page_size); |
| 106 | ||
| 106 | ||
| 107 | 107 | // data |
| 108 | 108 | state_save_register_item_pointer(device->machine, "at45dbxx", device->tag, 0, flash->data, flash->size); |
| 109 | 109 | // pins |
| r5932 | r5933 | |
| 392 | 392 | /* |
| 393 | 393 | NVRAM_HANDLER( at45dbxx ) |
| 394 | 394 | { |
| 395 | _logerror( 0, ("nvram_handler_at45dbxx (%p/%d)\n", file, read_or_write)); | |
| 396 | if (read_or_write) | |
| 397 | { | |
| 398 | at45dbxx_save( file); | |
| 399 | } | |
| 400 | else | |
| 401 | { | |
| 402 | if (file) | |
| 403 | { | |
| 404 | at45dbxx_load( file); | |
| 405 | } | |
| 406 | else | |
| 407 | { | |
| 408 | memset( flash->data, 0xFF, flash->size); | |
| 409 | } | |
| 410 | } | |
| 395 | _logerror( 0, ("nvram_handler_at45dbxx (%p/%d)\n", file, read_or_write)); | |
| 396 | if (read_or_write) | |
| 397 | { | |
| 398 | at45dbxx_save( file); | |
| 399 | } | |
| 400 | else | |
| 401 | { | |
| 402 | if (file) | |
| 403 | { | |
| 404 | at45dbxx_load( file); | |
| 405 | } | |
| 406 | else | |
| 407 | { | |
| 408 | memset( flash->data, 0xFF, flash->size); | |
| 409 | } | |
| 410 | } | |
| 411 | 411 | } |
| 412 | 412 | */ |
| 413 | 413 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | ataridev.h | |
| 3 | 3 | |
| 4 | 4 | */ |
| 5 | 5 |
| r5932 | r5933 | |
|---|---|---|
| 16 | 16 | /*****************************************************************************/ |
| 17 | 17 | |
| 18 | 18 | static IRQ_CALLBACK(mc8020_irq_callback) |
| 19 | { | |
| 19 | { | |
| 20 | 20 | return 0x00; |
| 21 | } | |
| 21 | } | |
| 22 | 22 | |
| 23 | 23 | MACHINE_RESET(mc8020) |
| 24 | 24 | { |
| 25 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), mc8020_irq_callback); | |
| 25 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), mc8020_irq_callback); | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | static void mc8020_ctc_interrupt(const device_config *device, int state) |
| r5932 | r5933 | |
| 40 | 40 | |
| 41 | 41 | static WRITE8_DEVICE_HANDLER( ctc_z2_w ) |
| 42 | 42 | { |
| 43 | z80ctc_trg_w(device, 0, data); | |
| 44 | z80ctc_trg_w(device, 1, data); | |
| 45 | ||
| 43 | z80ctc_trg_w(device, 0, data); | |
| 44 | z80ctc_trg_w(device, 1, data); | |
| 45 | ||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | const z80ctc_interface mc8020_ctc_intf = |
| 49 | { | |
| 49 | { | |
| 50 | 50 | 0, |
| 51 | mc8020_ctc_interrupt, | |
| 51 | mc8020_ctc_interrupt, | |
| 52 | 52 | ctc_z0_w, |
| 53 | 53 | ctc_z1_w, |
| 54 | 54 | ctc_z2_w |
| r5932 | r5933 | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | static READ8_DEVICE_HANDLER (mc80_port_b_r) |
| 59 | { | |
| 59 | { | |
| 60 | 60 | return 0; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | static READ8_DEVICE_HANDLER (mc80_port_a_r) |
| 64 | 64 | { |
| 65 | return 0; | |
| 65 | return 0; | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | static WRITE8_DEVICE_HANDLER (mc80_port_a_w) |
| r5932 | r5933 | |
| 97 | 97 | // reg C |
| 98 | 98 | // 7 6 5 4 -- module |
| 99 | 99 | // 3 - 0 left half, 1 right half |
| 100 | // 2 1 0 | |
| 100 | // 2 1 0 | |
| 101 | 101 | // ===== |
| 102 | 102 | // 0 0 0 - dark |
| 103 | 103 | // 0 0 1 - light |
| 104 | 104 | // 0 1 0 - in reg pixel |
| 105 | // | |
| 105 | // 0 1 1 - negate in reg pixel | |
| 106 | 106 | // 1 0 x - operation code in B reg |
| 107 | 107 | // reg B |
| 108 | 108 | // |
| 109 | UINT16 addr = ((offset & 0xff00) >> 2) | ((offset & 0x08) << 2) | (data >> 3); | |
| 109 | UINT16 addr = ((offset & 0xff00) >> 2) | ((offset & 0x08) << 2) | (data >> 3); | |
| 110 | 110 | UINT8 val[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; |
| 111 | 111 | int c = offset & 1; |
| 112 | 112 | mc8030_video_mem[addr] = mc8030_video_mem[addr] | (val[data & 7]*c); |
| 113 | ||
| 113 | ||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | WRITE8_HANDLER( eprom_prog_w ) |
| 117 | { | |
| 117 | { | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | static IRQ_CALLBACK(mc8030_irq_callback) |
| 121 | { | |
| 121 | { | |
| 122 | 122 | return 0x20; |
| 123 | } | |
| 123 | } | |
| 124 | 124 | |
| 125 | 125 | MACHINE_RESET(mc8030) |
| 126 | 126 | { |
| 127 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), mc8030_irq_callback); | |
| 127 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), mc8030_irq_callback); | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | static READ8_DEVICE_HANDLER (zve_port_a_r) |
| 131 | { | |
| 131 | { | |
| 132 | 132 | return 0xff; |
| 133 | 133 | } |
| 134 | 134 | |
| r5932 | r5933 | |
| 157 | 157 | }; |
| 158 | 158 | |
| 159 | 159 | static READ8_DEVICE_HANDLER (asp_port_a_r) |
| 160 | { | |
| 160 | { | |
| 161 | 161 | return 0xff; |
| 162 | 162 | } |
| 163 | 163 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | Atmel Serial DataFlash | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | AT45DB041 - 528 KByte | |
| 8 | AT45DB081 - 1056 KByte | |
| 9 | AT45DB161 - 2112 KByte | |
| 7 | AT45DB041 - 528 KByte | |
| 8 | AT45DB081 - 1056 KByte | |
| 9 | AT45DB161 - 2112 KByte | |
| 10 | 10 | |
| 11 | 11 | */ |
| 12 | 12 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | microbee.c | |
| 4 | 4 | |
| 5 | 5 | machine driver |
| 6 | ||
| 6 | Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000 | |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | ****************************************************************************/ |
| r5932 | r5933 | |
| 21 | 21 | |
| 22 | 22 | /*********************************************************** |
| 23 | 23 | |
| 24 | ||
| 24 | PIO | |
| 25 | 25 | |
| 26 | 26 | ************************************************************/ |
| 27 | 27 | |
| r5932 | r5933 | |
| 46 | 46 | |
| 47 | 47 | static WRITE8_DEVICE_HANDLER( pio_port_b_w ) |
| 48 | 48 | { |
| 49 | /* PIO port B - d5..d2 not emulated | |
| 50 | d7 network interrupt (microbee network for classrooms) | |
| 51 | d6 speaker | |
| 52 | d5 rs232 output (1=mark) | |
| 53 | d4 rs232 input (0=mark) | |
| 54 | d3 rs232 CTS (0=clear to send) | |
| 55 | d2 rs232 clock or DTR | |
| 56 | d1 cass out | |
| 57 | d0 cass in */ | |
| 49 | /* PIO port B - d5..d2 not emulated | |
| 50 | d7 network interrupt (microbee network for classrooms) | |
| 51 | d6 speaker | |
| 52 | d5 rs232 output (1=mark) | |
| 53 | d4 rs232 input (0=mark) | |
| 54 | d3 rs232 CTS (0=clear to send) | |
| 55 | d2 rs232 clock or DTR | |
| 56 | d1 cass out | |
| 57 | d0 cass in */ | |
| 58 | 58 | |
| 59 | 59 | cassette_output(mbee_cassette, (data & 0x02) ? -1.0 : +1.0); |
| 60 | 60 | |
| r5932 | r5933 | |
| 117 | 117 | |
| 118 | 118 | /************************************************************************************* |
| 119 | 119 | |
| 120 | ||
| 120 | Floppy DIsk | |
| 121 | 121 | |
| 122 | The callback is quite simple, no interrupts are used. | |
| 123 | If either IRQ or DRQ activate, they set bit 7 of inport 0x48. | |
| 122 | The callback is quite simple, no interrupts are used. | |
| 123 | If either IRQ or DRQ activate, they set bit 7 of inport 0x48. | |
| 124 | 124 | |
| 125 | 125 | *************************************************************************************/ |
| 126 | 126 | |
| r5932 | r5933 | |
| 136 | 136 | |
| 137 | 137 | READ8_HANDLER ( mbee_fdc_status_r ) |
| 138 | 138 | { |
| 139 | /* d7 indicate if IRQ or DRQ is occuring (1=happening) | |
| 140 | d6..d0 not used */ | |
| 139 | /* d7 indicate if IRQ or DRQ is occuring (1=happening) | |
| 140 | d6..d0 not used */ | |
| 141 | 141 | |
| 142 | 142 | return fdc_status; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | WRITE8_HANDLER ( mbee_fdc_motor_w ) |
| 146 | 146 | { |
| 147 | /* d7..d4 not used | |
| 148 | d3 density (1=MFM) | |
| 149 | d2 side (1=side 1) | |
| 150 | d1..d0 drive select (0 to 3 - although no microbee ever had more than 2 drives) */ | |
| 147 | /* d7..d4 not used | |
| 148 | d3 density (1=MFM) | |
| 149 | d2 side (1=side 1) | |
| 150 | d1..d0 drive select (0 to 3 - although no microbee ever had more than 2 drives) */ | |
| 151 | 151 | |
| 152 | 152 | wd17xx_set_drive(mbee_fdc, data & 3); |
| 153 | 153 | wd17xx_set_side(mbee_fdc, (data & 4) ? 1 : 0); |
| r5932 | r5933 | |
| 156 | 156 | |
| 157 | 157 | /*********************************************************** |
| 158 | 158 | |
| 159 | ||
| 159 | Machine | |
| 160 | 160 | |
| 161 | 161 | ************************************************************/ |
| 162 | 162 | |
| r5932 | r5933 | |
| 191 | 191 | mbee_vsync = 1; |
| 192 | 192 | |
| 193 | 193 | /* The printer status connects to the pio ASTB pin, and the printer changing to not |
| 194 | busy should signal an interrupt routine at B61C, (next line) but this doesn't work. | |
| 195 | The line below does what the interrupt should be doing. */ | |
| 194 | busy should signal an interrupt routine at B61C, (next line) but this doesn't work. | |
| 195 | The line below does what the interrupt should be doing. */ | |
| 196 | 196 | |
| 197 | 197 | z80pio_astb_w( mbee_z80pio, centronics_busy_r(mbee_printer)); /* signal int when not busy (L->H) */ |
| 198 | 198 | |
| r5932 | r5933 | |
| 201 | 201 | |
| 202 | 202 | /*********************************************************** |
| 203 | 203 | |
| 204 | ||
| 204 | Quickload | |
| 205 | 205 | |
| 206 | These load the standard BIN format, as well | |
| 207 | as COM and MWB files. | |
| 206 | These load the standard BIN format, as well | |
| 207 | as COM and MWB files. | |
| 208 | 208 | |
| 209 | 209 | ************************************************************/ |
| 210 | 210 |
| r5932 | r5933 | |
|---|---|---|
| 30 | 30 | static void msx_cpu_setbank (running_machine *machine, int page, UINT8 *mem) |
| 31 | 31 | { |
| 32 | 32 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 33 | switch (page) | |
| 33 | switch (page) | |
| 34 | 34 | { |
| 35 | 35 | case 1: |
| 36 | 36 | case 2: |
| r5932 | r5933 | |
| 136 | 136 | |
| 137 | 137 | nsize = 0x10000; /* 64 kb */ |
| 138 | 138 | mask = 3; |
| 139 | for (i=0; i<6; i++) | |
| 139 | for (i=0; i<6; i++) | |
| 140 | 140 | { |
| 141 | if (size == nsize) | |
| 141 | if (size == nsize) | |
| 142 | 142 | { |
| 143 | 143 | break; |
| 144 | 144 | } |
| 145 | 145 | mask = (mask << 1) | 1; |
| 146 | 146 | nsize <<= 1; |
| 147 | 147 | } |
| 148 | if (i == 6) | |
| 148 | if (i == 6) | |
| 149 | 149 | { |
| 150 | 150 | logerror ("ram mapper: error: must be 64kb, 128kb, 256kb, 512kb, " |
| 151 | 151 | "1mb, 2mb or 4mb\n"); |
| r5932 | r5933 | |
| 156 | 156 | |
| 157 | 157 | #ifdef MONMSX |
| 158 | 158 | f = fopen ("/home/sean/msx/hack/monmsx.bin", "r"); |
| 159 | if (f) | |
| 159 | if (f) | |
| 160 | 160 | { |
| 161 | 161 | fseek (f, 6L, SEEK_SET); |
| 162 | 162 | fread (state->mem, 1, 6151 - 6, f); |
| r5932 | r5933 | |
| 176 | 176 | { |
| 177 | 177 | int i; |
| 178 | 178 | |
| 179 | for (i=0; i<4; i++) | |
| 179 | for (i=0; i<4; i++) | |
| 180 | 180 | { |
| 181 | 181 | msx1.ram_mapper[i] = 3 - i; |
| 182 | 182 | } |
| r5932 | r5933 | |
| 213 | 213 | |
| 214 | 214 | MSX_SLOT_MAP(msxdos2) |
| 215 | 215 | { |
| 216 | if (page != 1) | |
| 216 | if (page != 1) | |
| 217 | 217 | { |
| 218 | 218 | msx_cpu_setbank (machine, page * 2 + 1, msx1.empty); |
| 219 | 219 | msx_cpu_setbank (machine, page * 2 + 2, msx1.empty); |
| 220 | } | |
| 221 | else | |
| 220 | } | |
| 221 | else | |
| 222 | 222 | { |
| 223 | 223 | msx_cpu_setbank (machine, 3, state->mem + state->banks[0] * 0x4000); |
| 224 | 224 | msx_cpu_setbank (machine, 4, state->mem + state->banks[0] * 0x4000 + 0x2000); |
| r5932 | r5933 | |
| 227 | 227 | |
| 228 | 228 | MSX_SLOT_WRITE(msxdos2) |
| 229 | 229 | { |
| 230 | if (addr == 0x6000) | |
| 230 | if (addr == 0x6000) | |
| 231 | 231 | { |
| 232 | 232 | state->banks[0] = val & 3; |
| 233 | 233 | slot_msxdos2_map (machine, state, 1); |
| r5932 | r5933 | |
| 238 | 238 | { |
| 239 | 239 | int banks; |
| 240 | 240 | |
| 241 | if (size > 0x200000) | |
| 241 | if (size > 0x200000) | |
| 242 | 242 | { |
| 243 | 243 | logerror ("konami: warning: truncating to 2mb\n"); |
| 244 | 244 | size = 0x200000; |
| 245 | 245 | return 1; |
| 246 | 246 | } |
| 247 | 247 | banks = size / 0x2000; |
| 248 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 248 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 249 | 249 | { |
| 250 | 250 | logerror ("konami: error: must be a 2 power of 8kb\n"); |
| 251 | 251 | return 1; |
| r5932 | r5933 | |
| 267 | 267 | |
| 268 | 268 | MSX_SLOT_MAP(konami) |
| 269 | 269 | { |
| 270 | switch (page) | |
| 270 | switch (page) | |
| 271 | 271 | { |
| 272 | 272 | case 0: |
| 273 | 273 | msx_cpu_setbank (machine, 1, state->mem); |
| r5932 | r5933 | |
| 289 | 289 | |
| 290 | 290 | MSX_SLOT_WRITE(konami) |
| 291 | 291 | { |
| 292 | switch (addr) | |
| 292 | switch (addr) | |
| 293 | 293 | { |
| 294 | 294 | case 0x6000: |
| 295 | 295 | state->banks[1] = val & state->bank_mask; |
| 296 | 296 | slot_konami_map (machine, state, 1); |
| 297 | if (msx1.state[0] == state) | |
| 297 | if (msx1.state[0] == state) | |
| 298 | 298 | { |
| 299 | 299 | slot_konami_map (machine, state, 0); |
| 300 | 300 | } |
| r5932 | r5933 | |
| 310 | 310 | case 0xa000: |
| 311 | 311 | state->banks[3] = val & state->bank_mask; |
| 312 | 312 | slot_konami_map (machine, state, 2); |
| 313 | if (msx1.state[3] == state) | |
| 313 | if (msx1.state[3] == state) | |
| 314 | 314 | { |
| 315 | 315 | slot_konami_map (machine, state, 3); |
| 316 | 316 | } |
| r5932 | r5933 | |
| 321 | 321 | { |
| 322 | 322 | int banks; |
| 323 | 323 | |
| 324 | if (size > 0x200000) | |
| 324 | if (size > 0x200000) | |
| 325 | 325 | { |
| 326 | 326 | logerror ("konami_scc: warning: truncating to 2mb\n"); |
| 327 | 327 | size = 0x200000; |
| 328 | 328 | return 1; |
| 329 | 329 | } |
| 330 | 330 | banks = size / 0x2000; |
| 331 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 331 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 332 | 332 | { |
| 333 | 333 | logerror ("konami_scc: error: must be a 2 power of 8kb\n"); |
| 334 | 334 | return 1; |
| r5932 | r5933 | |
| 352 | 352 | |
| 353 | 353 | static READ8_HANDLER (konami_scc_bank5) |
| 354 | 354 | { |
| 355 | if (offset & 0x80) | |
| 355 | if (offset & 0x80) | |
| 356 | 356 | { |
| 357 | 357 | #if 0 |
| 358 | 358 | if ((offset & 0xff) >= 0xe0) |
| r5932 | r5933 | |
| 362 | 362 | #endif |
| 363 | 363 | return 0xff; |
| 364 | 364 | } |
| 365 | else | |
| 365 | else | |
| 366 | 366 | { |
| 367 | 367 | return k051649_waveform_r (devtag_get_device(space->machine, "k051649"), offset & 0x7f); |
| 368 | 368 | } |
| r5932 | r5933 | |
| 370 | 370 | |
| 371 | 371 | MSX_SLOT_MAP(konami_scc) |
| 372 | 372 | { |
| 373 | switch (page) | |
| 373 | switch (page) | |
| 374 | 374 | { |
| 375 | 375 | case 0: |
| 376 | 376 | msx_cpu_setbank (machine, 1, state->mem + state->banks[2] * 0x2000); |
| r5932 | r5933 | |
| 395 | 395 | MSX_SLOT_WRITE(konami_scc) |
| 396 | 396 | { |
| 397 | 397 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 398 | if (addr >= 0x5000 && addr < 0x5800) | |
| 398 | if (addr >= 0x5000 && addr < 0x5800) | |
| 399 | 399 | { |
| 400 | 400 | state->banks[0] = val & state->bank_mask; |
| 401 | 401 | slot_konami_scc_map (machine, state, 1); |
| 402 | if (msx1.state[3] == state) | |
| 402 | if (msx1.state[3] == state) | |
| 403 | 403 | { |
| 404 | 404 | slot_konami_scc_map (machine, state, 3); |
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | else if (addr >= 0x7000 && addr < 0x7800) | |
| 407 | else if (addr >= 0x7000 && addr < 0x7800) | |
| 408 | 408 | { |
| 409 | 409 | state->banks[1] = val & state->bank_mask; |
| 410 | 410 | slot_konami_scc_map (machine, state, 1); |
| 411 | if (msx1.state[3] == state) | |
| 411 | if (msx1.state[3] == state) | |
| 412 | 412 | { |
| 413 | 413 | slot_konami_scc_map (machine, state, 3); |
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | else if (addr >= 0x9000 && addr < 0x9800) | |
| 416 | else if (addr >= 0x9000 && addr < 0x9800) | |
| 417 | 417 | { |
| 418 | 418 | state->banks[2] = val & state->bank_mask; |
| 419 | 419 | state->cart.scc.active = ((val & 0x3f) == 0x3f); |
| 420 | 420 | slot_konami_scc_map (machine, state, 2); |
| 421 | if (msx1.state[0] == state) | |
| 421 | if (msx1.state[0] == state) | |
| 422 | 422 | { |
| 423 | 423 | slot_konami_scc_map (machine, state, 0); |
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000) | |
| 426 | else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000) | |
| 427 | 427 | { |
| 428 | 428 | const device_config *k051649 = devtag_get_device(space->machine, "k051649"); |
| 429 | 429 | int offset = addr & 0xff; |
| 430 | 430 | |
| 431 | if (offset < 0x80) | |
| 431 | if (offset < 0x80) | |
| 432 | 432 | { |
| 433 | 433 | k051649_waveform_w (k051649, offset, val); |
| 434 | 434 | } |
| 435 | else if (offset < 0xa0) | |
| 435 | else if (offset < 0xa0) | |
| 436 | 436 | { |
| 437 | 437 | offset &= 0xf; |
| 438 | if (offset < 0xa) | |
| 438 | if (offset < 0xa) | |
| 439 | 439 | { |
| 440 | 440 | k051649_frequency_w (k051649, offset, val); |
| 441 | 441 | } |
| 442 | else if (offset < 0xf) | |
| 442 | else if (offset < 0xf) | |
| 443 | 443 | { |
| 444 | 444 | k051649_volume_w (k051649, offset - 0xa, val); |
| 445 | 445 | } |
| 446 | else | |
| 446 | else | |
| 447 | 447 | { |
| 448 | 448 | k051649_keyonoff_w (k051649, 0, val); |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | #if 0 |
| 452 | else if (offset >= 0xe0) | |
| 452 | else if (offset >= 0xe0) | |
| 453 | 453 | { |
| 454 | 454 | /* deformation register */ |
| 455 | 455 | } |
| 456 | 456 | #endif |
| 457 | 457 | } |
| 458 | else if (addr >= 0xb000 && addr < 0xb800) | |
| 458 | else if (addr >= 0xb000 && addr < 0xb800) | |
| 459 | 459 | { |
| 460 | 460 | state->banks[3] = val & state->bank_mask; |
| 461 | 461 | slot_konami_scc_map (machine, state, 2); |
| 462 | if (msx1.state[0] == state) | |
| 462 | if (msx1.state[0] == state) | |
| 463 | 463 | { |
| 464 | 464 | slot_konami_scc_map (machine, state, 0); |
| 465 | 465 | } |
| r5932 | r5933 | |
| 470 | 470 | { |
| 471 | 471 | int banks; |
| 472 | 472 | |
| 473 | if (size > 0x200000) | |
| 473 | if (size > 0x200000) | |
| 474 | 474 | { |
| 475 | 475 | logerror ("ascii8: warning: truncating to 2mb\n"); |
| 476 | 476 | size = 0x200000; |
| 477 | 477 | return 1; |
| 478 | 478 | } |
| 479 | 479 | banks = size / 0x2000; |
| 480 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 480 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 481 | 481 | { |
| 482 | 482 | logerror ("ascii8: error: must be a 2 power of 8kb\n"); |
| 483 | 483 | return 1; |
| r5932 | r5933 | |
| 499 | 499 | |
| 500 | 500 | MSX_SLOT_MAP(ascii8) |
| 501 | 501 | { |
| 502 | switch (page) | |
| 502 | switch (page) | |
| 503 | 503 | { |
| 504 | 504 | case 0: |
| 505 | 505 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 523 | 523 | { |
| 524 | 524 | int bank; |
| 525 | 525 | |
| 526 | if (addr >= 0x6000 && addr < 0x8000) | |
| 526 | if (addr >= 0x6000 && addr < 0x8000) | |
| 527 | 527 | { |
| 528 | 528 | bank = (addr / 0x800) & 3; |
| 529 | 529 | |
| 530 | 530 | state->banks[bank] = val & state->bank_mask; |
| 531 | if (bank <= 1) | |
| 531 | if (bank <= 1) | |
| 532 | 532 | { |
| 533 | 533 | slot_ascii8_map (machine, state, 1); |
| 534 | 534 | } |
| 535 | else if (msx1.state[2] == state) | |
| 535 | else if (msx1.state[2] == state) | |
| 536 | 536 | { |
| 537 | 537 | slot_ascii8_map (machine, state, 2); |
| 538 | 538 | } |
| r5932 | r5933 | |
| 543 | 543 | { |
| 544 | 544 | int banks; |
| 545 | 545 | |
| 546 | if (size > 0x400000) | |
| 546 | if (size > 0x400000) | |
| 547 | 547 | { |
| 548 | 548 | logerror ("ascii16: warning: truncating to 4mb\n"); |
| 549 | 549 | size = 0x400000; |
| 550 | 550 | } |
| 551 | 551 | banks = size / 0x4000; |
| 552 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 552 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 553 | 553 | { |
| 554 | 554 | logerror ("ascii16: error: must be a 2 power of 16kb\n"); |
| 555 | 555 | return 1; |
| r5932 | r5933 | |
| 574 | 574 | { |
| 575 | 575 | UINT8 *mem; |
| 576 | 576 | |
| 577 | switch (page) | |
| 577 | switch (page) | |
| 578 | 578 | { |
| 579 | 579 | case 0: |
| 580 | 580 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 598 | 598 | |
| 599 | 599 | MSX_SLOT_WRITE(ascii16) |
| 600 | 600 | { |
| 601 | if (addr >= 0x6000 && addr < 0x6800) | |
| 601 | if (addr >= 0x6000 && addr < 0x6800) | |
| 602 | 602 | { |
| 603 | 603 | state->banks[0] = val & state->bank_mask; |
| 604 | 604 | slot_ascii16_map (machine, state, 1); |
| 605 | 605 | } |
| 606 | else if (addr >= 0x7000 && addr < 0x7800) | |
| 606 | else if (addr >= 0x7000 && addr < 0x7800) | |
| 607 | 607 | { |
| 608 | 608 | state->banks[1] = val & state->bank_mask; |
| 609 | if (msx1.state[2] == state) | |
| 609 | if (msx1.state[2] == state) | |
| 610 | 610 | { |
| 611 | 611 | slot_ascii16_map (machine, state, 2); |
| 612 | 612 | } |
| r5932 | r5933 | |
| 619 | 619 | int banks; |
| 620 | 620 | |
| 621 | 621 | state->cart.sram.mem = auto_alloc_array(machine, UINT8, 0x2000); |
| 622 | if (size > 0x100000) | |
| 622 | if (size > 0x100000) | |
| 623 | 623 | { |
| 624 | 624 | logerror ("ascii8_sram: warning: truncating to 1mb\n"); |
| 625 | 625 | size = 0x100000; |
| 626 | 626 | return 1; |
| 627 | 627 | } |
| 628 | 628 | banks = size / 0x2000; |
| 629 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 629 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 630 | 630 | { |
| 631 | 631 | logerror ("ascii8_sram: error: must be a 2 power of 8kb\n"); |
| 632 | 632 | return 1; |
| r5932 | r5933 | |
| 638 | 638 | state->bank_mask = banks - 1; |
| 639 | 639 | state->cart.sram.sram_mask = banks; |
| 640 | 640 | state->cart.sram.empty_mask = ~(banks | (banks - 1)); |
| 641 | if (!state->sramfile) | |
| 641 | if (!state->sramfile) | |
| 642 | 642 | { |
| 643 | 643 | state->sramfile = sramfile; |
| 644 | 644 | } |
| r5932 | r5933 | |
| 657 | 657 | { |
| 658 | 658 | int bank = state->banks[bankno]; |
| 659 | 659 | |
| 660 | if (bank & state->cart.sram.empty_mask) | |
| 660 | if (bank & state->cart.sram.empty_mask) | |
| 661 | 661 | { |
| 662 | 662 | return msx1.empty; |
| 663 | 663 | } |
| 664 | else if (bank & state->cart.sram.sram_mask) | |
| 664 | else if (bank & state->cart.sram.sram_mask) | |
| 665 | 665 | { |
| 666 | 666 | return state->cart.sram.mem; |
| 667 | 667 | } |
| 668 | else | |
| 668 | else | |
| 669 | 669 | { |
| 670 | 670 | return state->mem + (bank & state->bank_mask) * 0x2000; |
| 671 | 671 | } |
| r5932 | r5933 | |
| 673 | 673 | |
| 674 | 674 | MSX_SLOT_MAP(ascii8_sram) |
| 675 | 675 | { |
| 676 | switch (page) | |
| 676 | switch (page) | |
| 677 | 677 | { |
| 678 | 678 | case 0: |
| 679 | 679 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 697 | 697 | { |
| 698 | 698 | int bank; |
| 699 | 699 | |
| 700 | if (addr >= 0x6000 && addr < 0x8000) | |
| 700 | if (addr >= 0x6000 && addr < 0x8000) | |
| 701 | 701 | { |
| 702 | 702 | bank = (addr / 0x800) & 3; |
| 703 | 703 | |
| 704 | 704 | state->banks[bank] = val; |
| 705 | if (bank <= 1) | |
| 705 | if (bank <= 1) | |
| 706 | 706 | { |
| 707 | 707 | slot_ascii8_sram_map (machine, state, 1); |
| 708 | 708 | } |
| 709 | else if (msx1.state[2] == state) | |
| 709 | else if (msx1.state[2] == state) | |
| 710 | 710 | { |
| 711 | 711 | slot_ascii8_sram_map (machine, state, 2); |
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | if (addr >= 0x8000 && addr < 0xc000) | |
| 714 | if (addr >= 0x8000 && addr < 0xc000) | |
| 715 | 715 | { |
| 716 | 716 | bank = addr < 0xa000 ? 2 : 3; |
| 717 | 717 | if (!(state->banks[bank] & state->cart.sram.empty_mask) && |
| 718 | (state->banks[bank] & state->cart.sram.sram_mask)) | |
| 718 | (state->banks[bank] & state->cart.sram.sram_mask)) | |
| 719 | 719 | { |
| 720 | 720 | state->cart.sram.mem[addr & 0x1fff] = val; |
| 721 | 721 | } |
| r5932 | r5933 | |
| 727 | 727 | file_error filerr; |
| 728 | 728 | mame_file *f; |
| 729 | 729 | |
| 730 | if (!state->sramfile) | |
| 730 | if (!state->sramfile) | |
| 731 | 731 | { |
| 732 | 732 | logerror ("ascii8_sram: error: no sram filename provided\n"); |
| 733 | 733 | return 1; |
| r5932 | r5933 | |
| 736 | 736 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_READ, &f); |
| 737 | 737 | if (filerr == FILERR_NONE) |
| 738 | 738 | { |
| 739 | if (mame_fread (f, state->cart.sram.mem, 0x2000) == 0x2000) | |
| 739 | if (mame_fread (f, state->cart.sram.mem, 0x2000) == 0x2000) | |
| 740 | 740 | { |
| 741 | 741 | mame_fclose (f); |
| 742 | 742 | logerror ("ascii8_sram: info: sram loaded\n"); |
| r5932 | r5933 | |
| 758 | 758 | file_error filerr; |
| 759 | 759 | mame_file *f; |
| 760 | 760 | |
| 761 | if (!state->sramfile) | |
| 761 | if (!state->sramfile) | |
| 762 | 762 | { |
| 763 | 763 | return 0; |
| 764 | 764 | } |
| r5932 | r5933 | |
| 785 | 785 | |
| 786 | 786 | state->cart.sram.mem = auto_alloc_array(machine, UINT8, 0x4000); |
| 787 | 787 | |
| 788 | if (size > 0x200000) | |
| 788 | if (size > 0x200000) | |
| 789 | 789 | { |
| 790 | 790 | logerror ("ascii16_sram: warning: truncating to 2mb\n"); |
| 791 | 791 | size = 0x200000; |
| 792 | 792 | } |
| 793 | 793 | banks = size / 0x4000; |
| 794 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 794 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 795 | 795 | { |
| 796 | 796 | logerror ("ascii16_sram: error: must be a 2 power of 16kb\n"); |
| 797 | 797 | return 1; |
| r5932 | r5933 | |
| 804 | 804 | state->bank_mask = banks - 1; |
| 805 | 805 | state->cart.sram.sram_mask = banks; |
| 806 | 806 | state->cart.sram.empty_mask = ~(banks | (banks - 1)); |
| 807 | if (!state->sramfile) | |
| 807 | if (!state->sramfile) | |
| 808 | 808 | { |
| 809 | 809 | state->sramfile = sramfile; |
| 810 | 810 | } |
| r5932 | r5933 | |
| 823 | 823 | { |
| 824 | 824 | int bank = state->banks[bankno]; |
| 825 | 825 | |
| 826 | if (bank & state->cart.sram.empty_mask) | |
| 826 | if (bank & state->cart.sram.empty_mask) | |
| 827 | 827 | { |
| 828 | 828 | return msx1.empty; |
| 829 | 829 | } |
| 830 | else if (bank & state->cart.sram.sram_mask) | |
| 830 | else if (bank & state->cart.sram.sram_mask) | |
| 831 | 831 | { |
| 832 | 832 | return state->cart.sram.mem; |
| 833 | 833 | } |
| 834 | else | |
| 834 | else | |
| 835 | 835 | { |
| 836 | 836 | return state->mem + (bank & state->bank_mask) * 0x4000; |
| 837 | 837 | } |
| r5932 | r5933 | |
| 841 | 841 | { |
| 842 | 842 | UINT8 *mem; |
| 843 | 843 | |
| 844 | switch (page) | |
| 844 | switch (page) | |
| 845 | 845 | { |
| 846 | 846 | case 0: |
| 847 | 847 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 865 | 865 | |
| 866 | 866 | MSX_SLOT_WRITE(ascii16_sram) |
| 867 | 867 | { |
| 868 | if (addr >= 0x6000 && addr < 0x6800) | |
| 868 | if (addr >= 0x6000 && addr < 0x6800) | |
| 869 | 869 | { |
| 870 | 870 | state->banks[0] = val; |
| 871 | 871 | slot_ascii16_sram_map (machine, state, 1); |
| 872 | 872 | } |
| 873 | else if (addr >= 0x7000 && addr < 0x7800) | |
| 873 | else if (addr >= 0x7000 && addr < 0x7800) | |
| 874 | 874 | { |
| 875 | 875 | state->banks[1] = val; |
| 876 | if (msx1.state[2] == state) | |
| 876 | if (msx1.state[2] == state) | |
| 877 | 877 | { |
| 878 | 878 | slot_ascii16_sram_map (machine, state, 2); |
| 879 | 879 | } |
| 880 | 880 | } |
| 881 | else if (addr >= 0x8000 && addr < 0xc000) | |
| 881 | else if (addr >= 0x8000 && addr < 0xc000) | |
| 882 | 882 | { |
| 883 | 883 | if (!(state->banks[1] & state->cart.sram.empty_mask) && |
| 884 | (state->banks[1] & state->cart.sram.sram_mask)) | |
| 884 | (state->banks[1] & state->cart.sram.sram_mask)) | |
| 885 | 885 | { |
| 886 | 886 | int offset, i; |
| 887 | 887 | |
| 888 | 888 | offset = addr & 0x07ff; |
| 889 | for (i=0; i<8; i++) | |
| 889 | for (i=0; i<8; i++) | |
| 890 | 890 | { |
| 891 | 891 | state->cart.sram.mem[offset] = val; |
| 892 | 892 | offset += 0x0800; |
| r5932 | r5933 | |
| 901 | 901 | mame_file *f; |
| 902 | 902 | UINT8 *p; |
| 903 | 903 | |
| 904 | if (!state->sramfile) | |
| 904 | if (!state->sramfile) | |
| 905 | 905 | { |
| 906 | 906 | logerror ("ascii16_sram: error: no sram filename provided\n"); |
| 907 | 907 | return 1; |
| r5932 | r5933 | |
| 912 | 912 | { |
| 913 | 913 | p = state->cart.sram.mem; |
| 914 | 914 | |
| 915 | if (mame_fread (f, state->cart.sram.mem, 0x200) == 0x200) | |
| 915 | if (mame_fread (f, state->cart.sram.mem, 0x200) == 0x200) | |
| 916 | 916 | { |
| 917 | 917 | int /*offset,*/ i; |
| 918 | 918 | |
| 919 | 919 | mame_fclose (f); |
| 920 | 920 | |
| 921 | 921 | //offset = 0; |
| 922 | for (i=0; i<7; i++) | |
| 922 | for (i=0; i<7; i++) | |
| 923 | 923 | { |
| 924 | 924 | memcpy (p + 0x800, p, 0x800); |
| 925 | 925 | p += 0x800; |
| r5932 | r5933 | |
| 944 | 944 | file_error filerr; |
| 945 | 945 | mame_file *f; |
| 946 | 946 | |
| 947 | if (!state->sramfile) | |
| 947 | if (!state->sramfile) | |
| 948 | 948 | { |
| 949 | 949 | return 0; |
| 950 | 950 | } |
| r5932 | r5933 | |
| 966 | 966 | |
| 967 | 967 | MSX_SLOT_INIT(rtype) |
| 968 | 968 | { |
| 969 | if (!(size == 0x60000 || size == 0x80000)) | |
| 969 | if (!(size == 0x60000 || size == 0x80000)) | |
| 970 | 970 | { |
| 971 | 971 | logerror ("rtype: error: rom file should be exactly 384kb\n"); |
| 972 | 972 | return 1; |
| r5932 | r5933 | |
| 988 | 988 | { |
| 989 | 989 | UINT8 *mem; |
| 990 | 990 | |
| 991 | switch (page) | |
| 991 | switch (page) | |
| 992 | 992 | { |
| 993 | 993 | case 0: |
| 994 | 994 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 1012 | 1012 | |
| 1013 | 1013 | MSX_SLOT_WRITE(rtype) |
| 1014 | 1014 | { |
| 1015 | if (addr >= 0x7000 && addr < 0x8000) | |
| 1015 | if (addr >= 0x7000 && addr < 0x8000) | |
| 1016 | 1016 | { |
| 1017 | 1017 | int data ; |
| 1018 | 1018 | |
| 1019 | if (val & 0x10) | |
| 1019 | if (val & 0x10) | |
| 1020 | 1020 | { |
| 1021 | 1021 | data = 0x10 | (val & 7); |
| 1022 | 1022 | } |
| 1023 | else | |
| 1023 | else | |
| 1024 | 1024 | { |
| 1025 | 1025 | data = val & 0x0f; |
| 1026 | 1026 | } |
| 1027 | 1027 | state->banks[0] = data; |
| 1028 | if (msx1.state[2] == state) | |
| 1028 | if (msx1.state[2] == state) | |
| 1029 | 1029 | { |
| 1030 | 1030 | slot_rtype_map (machine, state, 2); |
| 1031 | 1031 | } |
| r5932 | r5933 | |
| 1037 | 1037 | UINT8 *p; |
| 1038 | 1038 | static const char sramfile[] = "GameMaster2"; |
| 1039 | 1039 | |
| 1040 | if (size != 0x20000) | |
| 1040 | if (size != 0x20000) | |
| 1041 | 1041 | { |
| 1042 | 1042 | logerror ("gmaster2: error: rom file should be 128kb\n"); |
| 1043 | 1043 | return 1; |
| r5932 | r5933 | |
| 1049 | 1049 | p = auto_alloc_array(machine, UINT8, 0x4000); |
| 1050 | 1050 | memset (p, 0, 0x4000); |
| 1051 | 1051 | state->cart.sram.mem = p; |
| 1052 | if (!state->sramfile) | |
| 1052 | if (!state->sramfile) | |
| 1053 | 1053 | { |
| 1054 | 1054 | state->sramfile = sramfile; |
| 1055 | 1055 | } |
| r5932 | r5933 | |
| 1061 | 1061 | { |
| 1062 | 1062 | int i; |
| 1063 | 1063 | |
| 1064 | for (i=0; i<4; i++) | |
| 1064 | for (i=0; i<4; i++) | |
| 1065 | 1065 | { |
| 1066 | 1066 | state->banks[i] = i; |
| 1067 | 1067 | } |
| r5932 | r5933 | |
| 1069 | 1069 | |
| 1070 | 1070 | MSX_SLOT_MAP(gmaster2) |
| 1071 | 1071 | { |
| 1072 | switch (page) | |
| 1072 | switch (page) | |
| 1073 | 1073 | { |
| 1074 | 1074 | case 0: |
| 1075 | 1075 | case 1: |
| 1076 | 1076 | msx_cpu_setbank (machine, 1 + page * 2, state->mem); /* bank 0 is hardwired */ |
| 1077 | if (state->banks[1] > 15) | |
| 1077 | if (state->banks[1] > 15) | |
| 1078 | 1078 | { |
| 1079 | 1079 | msx_cpu_setbank (machine, 2 + page * 2, state->cart.sram.mem + |
| 1080 | 1080 | (state->banks[1] - 16) * 0x2000); |
| 1081 | 1081 | } |
| 1082 | else | |
| 1082 | else | |
| 1083 | 1083 | { |
| 1084 | 1084 | msx_cpu_setbank (machine, 2 + page * 2, state->mem + state->banks[1] * 0x2000); |
| 1085 | 1085 | } |
| 1086 | 1086 | break; |
| 1087 | 1087 | case 2: |
| 1088 | 1088 | case 3: |
| 1089 | if (state->banks[2] > 15) | |
| 1089 | if (state->banks[2] > 15) | |
| 1090 | 1090 | { |
| 1091 | 1091 | msx_cpu_setbank (machine, 5 + page * 2, state->cart.sram.mem + |
| 1092 | 1092 | (state->banks[2] - 16) * 0x2000); |
| 1093 | 1093 | } |
| 1094 | else | |
| 1094 | else | |
| 1095 | 1095 | { |
| 1096 | 1096 | msx_cpu_setbank (machine, 5 + page * 2, state->mem + state->banks[2] * 0x2000); |
| 1097 | 1097 | } |
| 1098 | if (state->banks[3] > 15) | |
| 1098 | if (state->banks[3] > 15) | |
| 1099 | 1099 | { |
| 1100 | 1100 | msx_cpu_setbank (machine, 6 + page * 2, state->cart.sram.mem + |
| 1101 | 1101 | (state->banks[3] - 16) * 0x2000); |
| 1102 | 1102 | } |
| 1103 | else | |
| 1103 | else | |
| 1104 | 1104 | { |
| 1105 | 1105 | msx_cpu_setbank (machine, 6 + page * 2, state->mem + state->banks[3] * 0x2000); |
| 1106 | 1106 | } |
| r5932 | r5933 | |
| 1110 | 1110 | |
| 1111 | 1111 | MSX_SLOT_WRITE(gmaster2) |
| 1112 | 1112 | { |
| 1113 | if (addr >= 0x6000 && addr < 0x7000) | |
| 1113 | if (addr >= 0x6000 && addr < 0x7000) | |
| 1114 | 1114 | { |
| 1115 | if (val & 0x10) | |
| 1115 | if (val & 0x10) | |
| 1116 | 1116 | { |
| 1117 | 1117 | val = val & 0x20 ? 17 : 16; |
| 1118 | 1118 | } |
| 1119 | else | |
| 1119 | else | |
| 1120 | 1120 | { |
| 1121 | 1121 | val = val & 15; |
| 1122 | 1122 | } |
| 1123 | 1123 | state->banks[1] = val; |
| 1124 | 1124 | slot_gmaster2_map (machine, state, 1); |
| 1125 | if (msx1.state[0] == state) | |
| 1125 | if (msx1.state[0] == state) | |
| 1126 | 1126 | { |
| 1127 | 1127 | slot_gmaster2_map (machine, state, 0); |
| 1128 | 1128 | } |
| 1129 | 1129 | } |
| 1130 | else if (addr >= 0x8000 && addr < 0x9000) | |
| 1130 | else if (addr >= 0x8000 && addr < 0x9000) | |
| 1131 | 1131 | { |
| 1132 | if (val & 0x10) | |
| 1132 | if (val & 0x10) | |
| 1133 | 1133 | { |
| 1134 | 1134 | val = val & 0x20 ? 17 : 16; |
| 1135 | 1135 | } |
| 1136 | else | |
| 1136 | else | |
| 1137 | 1137 | { |
| 1138 | 1138 | val = val & 15; |
| 1139 | 1139 | } |
| 1140 | 1140 | state->banks[2] = val; |
| 1141 | 1141 | slot_gmaster2_map (machine, state, 2); |
| 1142 | if (msx1.state[3] == state) | |
| 1142 | if (msx1.state[3] == state) | |
| 1143 | 1143 | { |
| 1144 | 1144 | slot_gmaster2_map (machine, state, 3); |
| 1145 | 1145 | } |
| 1146 | 1146 | } |
| 1147 | else if (addr >= 0xa000 && addr < 0xb000) | |
| 1147 | else if (addr >= 0xa000 && addr < 0xb000) | |
| 1148 | 1148 | { |
| 1149 | if (val & 0x10) | |
| 1149 | if (val & 0x10) | |
| 1150 | 1150 | { |
| 1151 | 1151 | val = val & 0x20 ? 17 : 16; |
| 1152 | 1152 | } |
| 1153 | else | |
| 1153 | else | |
| 1154 | 1154 | { |
| 1155 | 1155 | val = val & 15; |
| 1156 | 1156 | } |
| 1157 | 1157 | state->banks[3] = val; |
| 1158 | 1158 | slot_gmaster2_map (machine, state, 2); |
| 1159 | if (msx1.state[3] == state) | |
| 1159 | if (msx1.state[3] == state) | |
| 1160 | 1160 | { |
| 1161 | 1161 | slot_gmaster2_map (machine, state, 3); |
| 1162 | 1162 | } |
| 1163 | 1163 | } |
| 1164 | else if (addr >= 0xb000 && addr < 0xc000) | |
| 1164 | else if (addr >= 0xb000 && addr < 0xc000) | |
| 1165 | 1165 | { |
| 1166 | 1166 | addr &= 0x0fff; |
| 1167 | switch (state->banks[3]) | |
| 1167 | switch (state->banks[3]) | |
| 1168 | 1168 | { |
| 1169 | 1169 | case 16: |
| 1170 | 1170 | state->cart.sram.mem[addr] = val; |
| r5932 | r5933 | |
| 1188 | 1188 | filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_READ, &f); |
| 1189 | 1189 | if (filerr == FILERR_NONE) |
| 1190 | 1190 | { |
| 1191 | if (mame_fread (f, p + 0x1000, 0x2000) == 0x2000) | |
| 1191 | if (mame_fread (f, p + 0x1000, 0x2000) == 0x2000) | |
| 1192 | 1192 | { |
| 1193 | 1193 | memcpy (p, p + 0x1000, 0x1000); |
| 1194 | 1194 | memcpy (p + 0x3000, p + 0x2000, 0x1000); |
| r5932 | r5933 | |
| 1229 | 1229 | |
| 1230 | 1230 | MSX_SLOT_INIT(diskrom) |
| 1231 | 1231 | { |
| 1232 | if (size != 0x4000) | |
| 1232 | if (size != 0x4000) | |
| 1233 | 1233 | { |
| 1234 | 1234 | logerror ("diskrom: error: the diskrom should be 16kb\n"); |
| 1235 | 1235 | return 1; |
| r5932 | r5933 | |
| 1245 | 1245 | MSX_SLOT_RESET(diskrom) |
| 1246 | 1246 | { |
| 1247 | 1247 | const device_config *fdc = devtag_get_device(machine, "wd179x"); |
| 1248 | wd17xx_reset(fdc); | |
| 1248 | wd17xx_reset(fdc); | |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | static READ8_HANDLER (msx_diskrom_page1_r) |
| 1252 | 1252 | { |
| 1253 | 1253 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
| 1254 | switch (offset) | |
| 1254 | switch (offset) | |
| 1255 | 1255 | { |
| 1256 | 1256 | case 0: return wd17xx_status_r (fdc, 0); |
| 1257 | 1257 | case 1: return wd17xx_track_r (fdc, 0); |
| r5932 | r5933 | |
| 1266 | 1266 | static READ8_HANDLER (msx_diskrom_page2_r) |
| 1267 | 1267 | { |
| 1268 | 1268 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
| 1269 | if (offset >= 0x7f8) | |
| 1269 | if (offset >= 0x7f8) | |
| 1270 | 1270 | { |
| 1271 | switch (offset) | |
| 1271 | switch (offset) | |
| 1272 | 1272 | { |
| 1273 | 1273 | case 0x7f8: |
| 1274 | 1274 | return wd17xx_status_r (fdc, 0); |
| r5932 | r5933 | |
| 1284 | 1284 | return msx1.state[2]->mem[offset + 0x3800]; |
| 1285 | 1285 | } |
| 1286 | 1286 | } |
| 1287 | else | |
| 1287 | else | |
| 1288 | 1288 | { |
| 1289 | 1289 | return 0xff; |
| 1290 | 1290 | } |
| r5932 | r5933 | |
| 1293 | 1293 | MSX_SLOT_MAP(diskrom) |
| 1294 | 1294 | { |
| 1295 | 1295 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1296 | switch (page) | |
| 1296 | switch (page) | |
| 1297 | 1297 | { |
| 1298 | 1298 | case 0: |
| 1299 | 1299 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 1319 | 1319 | MSX_SLOT_WRITE(diskrom) |
| 1320 | 1320 | { |
| 1321 | 1321 | const device_config *fdc = devtag_get_device(machine, "wd179x"); |
| 1322 | if (addr >= 0xa000 && addr < 0xc000) | |
| 1322 | if (addr >= 0xa000 && addr < 0xc000) | |
| 1323 | 1323 | { |
| 1324 | 1324 | addr -= 0x4000; |
| 1325 | 1325 | } |
| 1326 | switch (addr) | |
| 1326 | switch (addr) | |
| 1327 | 1327 | { |
| 1328 | 1328 | case 0x7ff8: |
| 1329 | 1329 | wd17xx_command_w (fdc, 0, val); |
| r5932 | r5933 | |
| 1343 | 1343 | break; |
| 1344 | 1344 | case 0x7ffd: |
| 1345 | 1345 | wd17xx_set_drive (fdc,val & 1); |
| 1346 | if ((state->mem[0x3ffd] ^ val) & 0x40) | |
| 1346 | if ((state->mem[0x3ffd] ^ val) & 0x40) | |
| 1347 | 1347 | { |
| 1348 | 1348 | set_led_status (0, !(val & 0x40)); |
| 1349 | 1349 | } |
| r5932 | r5933 | |
| 1354 | 1354 | |
| 1355 | 1355 | MSX_SLOT_INIT(diskrom2) |
| 1356 | 1356 | { |
| 1357 | if (size != 0x4000) | |
| 1357 | if (size != 0x4000) | |
| 1358 | 1358 | { |
| 1359 | 1359 | logerror ("diskrom2: error: the diskrom2 should be 16kb\n"); |
| 1360 | 1360 | return 1; |
| r5932 | r5933 | |
| 1391 | 1391 | static READ8_HANDLER (msx_diskrom2_page2_r) |
| 1392 | 1392 | { |
| 1393 | 1393 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
| 1394 | if (offset >= 0x7b8) | |
| 1394 | if (offset >= 0x7b8) | |
| 1395 | 1395 | { |
| 1396 | switch (offset) | |
| 1396 | switch (offset) | |
| 1397 | 1397 | { |
| 1398 | 1398 | case 0x7b8: |
| 1399 | 1399 | return wd17xx_status_r (fdc, 0); |
| r5932 | r5933 | |
| 1409 | 1409 | return msx1.state[2]->mem[offset + 0x3800]; |
| 1410 | 1410 | } |
| 1411 | 1411 | } |
| 1412 | else | |
| 1412 | else | |
| 1413 | 1413 | { |
| 1414 | 1414 | return 0xff; |
| 1415 | 1415 | } |
| r5932 | r5933 | |
| 1418 | 1418 | MSX_SLOT_MAP(diskrom2) |
| 1419 | 1419 | { |
| 1420 | 1420 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1421 | switch (page) | |
| 1421 | switch (page) | |
| 1422 | 1422 | { |
| 1423 | 1423 | case 0: |
| 1424 | 1424 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 1443 | 1443 | MSX_SLOT_WRITE(diskrom2) |
| 1444 | 1444 | { |
| 1445 | 1445 | const device_config *fdc = devtag_get_device(machine, "wd179x"); |
| 1446 | if (addr >= 0xa000 && addr < 0xc000) | |
| 1446 | if (addr >= 0xa000 && addr < 0xc000) | |
| 1447 | 1447 | { |
| 1448 | 1448 | addr -= 0x4000; |
| 1449 | 1449 | } |
| 1450 | switch (addr) | |
| 1450 | switch (addr) | |
| 1451 | 1451 | { |
| 1452 | 1452 | case 0x7fb8: |
| 1453 | 1453 | wd17xx_command_w (fdc, 0, val); |
| r5932 | r5933 | |
| 1465 | 1465 | wd17xx_set_side (fdc,val & 1); |
| 1466 | 1466 | state->mem[0x3fbc] = val | 0xfe; |
| 1467 | 1467 | wd17xx_set_drive (fdc,val & 1); |
| 1468 | if ((state->mem[0x3fbc] ^ val) & 0x40) | |
| 1468 | if ((state->mem[0x3fbc] ^ val) & 0x40) | |
| 1469 | 1469 | { |
| 1470 | 1470 | set_led_status (0, !(val & 0x40)); |
| 1471 | 1471 | } |
| r5932 | r5933 | |
| 1476 | 1476 | |
| 1477 | 1477 | MSX_SLOT_INIT(synthesizer) |
| 1478 | 1478 | { |
| 1479 | if (size != 0x8000) | |
| 1479 | if (size != 0x8000) | |
| 1480 | 1480 | { |
| 1481 | 1481 | logerror ("synthesizer: error: rom file must be 32kb\n"); |
| 1482 | 1482 | return 1; |
| r5932 | r5933 | |
| 1495 | 1495 | |
| 1496 | 1496 | MSX_SLOT_MAP(synthesizer) |
| 1497 | 1497 | { |
| 1498 | switch (page) | |
| 1498 | switch (page) | |
| 1499 | 1499 | { |
| 1500 | 1500 | case 0: |
| 1501 | 1501 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 1517 | 1517 | |
| 1518 | 1518 | MSX_SLOT_WRITE(synthesizer) |
| 1519 | 1519 | { |
| 1520 | if (addr >= 0x4000 && addr < 0x8000 && !(addr & 0x0010)) | |
| 1520 | if (addr >= 0x4000 && addr < 0x8000 && !(addr & 0x0010)) | |
| 1521 | 1521 | { |
| 1522 | 1522 | dac_data_w (devtag_get_device(machine, "dac"), val); |
| 1523 | 1523 | } |
| r5932 | r5933 | |
| 1525 | 1525 | |
| 1526 | 1526 | MSX_SLOT_INIT(majutsushi) |
| 1527 | 1527 | { |
| 1528 | if (size != 0x20000) | |
| 1528 | if (size != 0x20000) | |
| 1529 | 1529 | { |
| 1530 | 1530 | logerror ("majutsushi: error: rom file must be 128kb\n"); |
| 1531 | 1531 | return 1; |
| r5932 | r5933 | |
| 1542 | 1542 | { |
| 1543 | 1543 | int i; |
| 1544 | 1544 | |
| 1545 | for (i=0; i<4; i++) | |
| 1545 | for (i=0; i<4; i++) | |
| 1546 | 1546 | { |
| 1547 | 1547 | state->banks[i] = i; |
| 1548 | 1548 | } |
| r5932 | r5933 | |
| 1550 | 1550 | |
| 1551 | 1551 | MSX_SLOT_MAP(majutsushi) |
| 1552 | 1552 | { |
| 1553 | switch (page) | |
| 1553 | switch (page) | |
| 1554 | 1554 | { |
| 1555 | 1555 | case 0: |
| 1556 | 1556 | msx_cpu_setbank (machine, 1, state->mem + state->banks[0] * 0x2000); |
| r5932 | r5933 | |
| 1573 | 1573 | |
| 1574 | 1574 | MSX_SLOT_WRITE(majutsushi) |
| 1575 | 1575 | { |
| 1576 | if (addr >= 0x5000 && addr < 0x6000) | |
| 1576 | if (addr >= 0x5000 && addr < 0x6000) | |
| 1577 | 1577 | { |
| 1578 | 1578 | dac_data_w (devtag_get_device(machine, "dac"), val); |
| 1579 | 1579 | } |
| 1580 | else if (addr >= 0x6000 && addr < 0x8000) | |
| 1580 | else if (addr >= 0x6000 && addr < 0x8000) | |
| 1581 | 1581 | { |
| 1582 | 1582 | state->banks[1] = val & 0x0f; |
| 1583 | 1583 | slot_majutsushi_map (machine, state, 1); |
| 1584 | if (msx1.state[0] == state) | |
| 1584 | if (msx1.state[0] == state) | |
| 1585 | 1585 | { |
| 1586 | 1586 | slot_konami_map (machine, state, 0); |
| 1587 | 1587 | } |
| 1588 | 1588 | } |
| 1589 | else if (addr >= 0x8000 && addr < 0xc000) | |
| 1589 | else if (addr >= 0x8000 && addr < 0xc000) | |
| 1590 | 1590 | { |
| 1591 | 1591 | state->banks[addr < 0xa000 ? 2 : 3] = val & 0x0f; |
| 1592 | 1592 | slot_majutsushi_map (machine, state, 2); |
| 1593 | if (msx1.state[3] == state) | |
| 1593 | if (msx1.state[3] == state) | |
| 1594 | 1594 | { |
| 1595 | 1595 | slot_konami_map (machine, state, 3); |
| 1596 | 1596 | } |
| r5932 | r5933 | |
| 1603 | 1603 | UINT8 *p; |
| 1604 | 1604 | int banks; |
| 1605 | 1605 | |
| 1606 | if (size > 0x400000) | |
| 1606 | if (size > 0x400000) | |
| 1607 | 1607 | { |
| 1608 | 1608 | logerror ("fmpac: warning: truncating rom to 4mb\n"); |
| 1609 | 1609 | size = 0x400000; |
| 1610 | 1610 | } |
| 1611 | 1611 | banks = size / 0x4000; |
| 1612 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 1612 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 1613 | 1613 | { |
| 1614 | 1614 | logerror ("fmpac: error: must be a 2 power of 16kb\n"); |
| 1615 | 1615 | return 1; |
| 1616 | 1616 | } |
| 1617 | 1617 | |
| 1618 | if (!strncmp ((char*)mem + 0x18, "PAC2", 4)) | |
| 1618 | if (!strncmp ((char*)mem + 0x18, "PAC2", 4)) | |
| 1619 | 1619 | { |
| 1620 | 1620 | state->cart.fmpac.sram_support = 1; |
| 1621 | 1621 | p = auto_alloc_array(machine, UINT8, 0x4000); |
| r5932 | r5933 | |
| 1623 | 1623 | memset (p + 0x2000, 0xff, 0x2000); |
| 1624 | 1624 | state->cart.fmpac.mem = p; |
| 1625 | 1625 | } |
| 1626 | else | |
| 1626 | else | |
| 1627 | 1627 | { |
| 1628 | 1628 | state->cart.fmpac.sram_support = 0; |
| 1629 | 1629 | state->cart.fmpac.mem = NULL; |
| r5932 | r5933 | |
| 1633 | 1633 | state->size = size; |
| 1634 | 1634 | state->mem = mem; |
| 1635 | 1635 | state->bank_mask = banks - 1; |
| 1636 | if (!state->sramfile) | |
| 1636 | if (!state->sramfile) | |
| 1637 | 1637 | { |
| 1638 | 1638 | state->sramfile = sramfile; |
| 1639 | 1639 | } |
| r5932 | r5933 | |
| 1649 | 1649 | state->cart.fmpac.sram_active = 0; |
| 1650 | 1650 | state->cart.fmpac.opll_active = 0; |
| 1651 | 1651 | msx1.opll_active = 0; |
| 1652 | for (i=0; i<=state->bank_mask; i++) | |
| 1652 | for (i=0; i<=state->bank_mask; i++) | |
| 1653 | 1653 | { |
| 1654 | 1654 | state->mem[0x3ff6 + i * 0x4000] = 0; |
| 1655 | 1655 | } |
| r5932 | r5933 | |
| 1666 | 1666 | |
| 1667 | 1667 | MSX_SLOT_MAP(fmpac) |
| 1668 | 1668 | { |
| 1669 | if (page == 1) | |
| 1669 | if (page == 1) | |
| 1670 | 1670 | { |
| 1671 | if (state->cart.fmpac.sram_active) | |
| 1671 | if (state->cart.fmpac.sram_active) | |
| 1672 | 1672 | { |
| 1673 | 1673 | msx_cpu_setbank (machine, 3, state->cart.fmpac.mem); |
| 1674 | 1674 | msx_cpu_setbank (machine, 4, state->cart.fmpac.mem + 0x2000); |
| 1675 | 1675 | } |
| 1676 | else | |
| 1676 | else | |
| 1677 | 1677 | { |
| 1678 | 1678 | msx_cpu_setbank (machine, 3, state->mem + state->banks[0] * 0x4000); |
| 1679 | 1679 | msx_cpu_setbank (machine, 4, state->mem + state->banks[0] * 0x4000 + 0x2000); |
| 1680 | 1680 | } |
| 1681 | 1681 | } |
| 1682 | else | |
| 1682 | else | |
| 1683 | 1683 | { |
| 1684 | 1684 | msx_cpu_setbank (machine, page * 2 + 1, msx1.empty); |
| 1685 | 1685 | msx_cpu_setbank (machine, page * 2 + 2, msx1.empty); |
| r5932 | r5933 | |
| 1691 | 1691 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1692 | 1692 | int i, data; |
| 1693 | 1693 | |
| 1694 | if (addr >= 0x4000 && addr < 0x6000 && state->cart.fmpac.sram_support) | |
| 1694 | if (addr >= 0x4000 && addr < 0x6000 && state->cart.fmpac.sram_support) | |
| 1695 | 1695 | { |
| 1696 | if (state->cart.fmpac.sram_active || addr >= 0x5ffe) | |
| 1696 | if (state->cart.fmpac.sram_active || addr >= 0x5ffe) | |
| 1697 | 1697 | { |
| 1698 | 1698 | state->cart.fmpac.mem[addr & 0x1fff] = val; |
| 1699 | 1699 | } |
| r5932 | r5933 | |
| 1703 | 1703 | state->cart.fmpac.mem[0x1fff] == 0x69); |
| 1704 | 1704 | } |
| 1705 | 1705 | |
| 1706 | switch (addr) | |
| 1706 | switch (addr) | |
| 1707 | 1707 | { |
| 1708 | 1708 | case 0x7ff4: |
| 1709 | if (state->cart.fmpac.opll_active) | |
| 1709 | if (state->cart.fmpac.opll_active) | |
| 1710 | 1710 | { |
| 1711 | 1711 | ym2413_w (devtag_get_device(space->machine, "ay8910"), 0, val); |
| 1712 | 1712 | } |
| 1713 | 1713 | break; |
| 1714 | 1714 | case 0x7ff5: |
| 1715 | if (state->cart.fmpac.opll_active) | |
| 1715 | if (state->cart.fmpac.opll_active) | |
| 1716 | 1716 | { |
| 1717 | 1717 | ym2413_w (devtag_get_device(space->machine, "ay8910"), 1, val); |
| 1718 | 1718 | } |
| 1719 | 1719 | break; |
| 1720 | 1720 | case 0x7ff6: |
| 1721 | 1721 | data = val & 0x11; |
| 1722 | for (i=0; i<=state->bank_mask; i++) | |
| 1722 | for (i=0; i<=state->bank_mask; i++) | |
| 1723 | 1723 | { |
| 1724 | 1724 | state->mem[0x3ff6 + i * 0x4000] = data; |
| 1725 | 1725 | } |
| 1726 | 1726 | state->cart.fmpac.mem[0x3ff6] = data; |
| 1727 | 1727 | state->cart.fmpac.opll_active = val & 1; |
| 1728 | if ((msx1.opll_active ^ val) & 1) | |
| 1728 | if ((msx1.opll_active ^ val) & 1) | |
| 1729 | 1729 | { |
| 1730 | 1730 | logerror ("FM-PAC: OPLL %sactivated\n", val & 1 ? "" : "de"); |
| 1731 | 1731 | } |
| r5932 | r5933 | |
| 1748 | 1748 | mame_file *f; |
| 1749 | 1749 | char buf[PAC_HEADER_LEN]; |
| 1750 | 1750 | |
| 1751 | if (!state->cart.fmpac.sram_support) | |
| 1751 | if (!state->cart.fmpac.sram_support) | |
| 1752 | 1752 | { |
| 1753 | 1753 | logerror ("Your fmpac.rom does not support sram\n"); |
| 1754 | 1754 | return 1; |
| r5932 | r5933 | |
| 1765 | 1765 | { |
| 1766 | 1766 | if ((mame_fread (f, buf, PAC_HEADER_LEN) == PAC_HEADER_LEN) && |
| 1767 | 1767 | !strncmp (buf, PAC_HEADER, PAC_HEADER_LEN) && |
| 1768 | mame_fread (f, state->cart.fmpac.mem, 0x1ffe)) | |
| 1768 | mame_fread (f, state->cart.fmpac.mem, 0x1ffe)) | |
| 1769 | 1769 | { |
| 1770 | 1770 | logerror ("fmpac: info: sram loaded\n"); |
| 1771 | 1771 | mame_fclose (f); |
| 1772 | 1772 | return 0; |
| 1773 | 1773 | } |
| 1774 | else | |
| 1774 | else | |
| 1775 | 1775 | { |
| 1776 | 1776 | logerror ("fmpac: warning: failed to load sram\n"); |
| 1777 | 1777 | mame_fclose (f); |
| r5932 | r5933 | |
| 1788 | 1788 | file_error filerr; |
| 1789 | 1789 | mame_file *f; |
| 1790 | 1790 | |
| 1791 | if (!state->cart.fmpac.sram_support || !state->sramfile) | |
| 1791 | if (!state->cart.fmpac.sram_support || !state->sramfile) | |
| 1792 | 1792 | { |
| 1793 | 1793 | return 0; |
| 1794 | 1794 | } |
| r5932 | r5933 | |
| 1797 | 1797 | if (filerr == FILERR_NONE) |
| 1798 | 1798 | { |
| 1799 | 1799 | if ((mame_fwrite (f, PAC_HEADER, PAC_HEADER_LEN) == PAC_HEADER_LEN) && |
| 1800 | (mame_fwrite (f, state->cart.fmpac.mem, 0x1ffe) == 0x1ffe)) | |
| 1800 | (mame_fwrite (f, state->cart.fmpac.mem, 0x1ffe) == 0x1ffe)) | |
| 1801 | 1801 | { |
| 1802 | 1802 | logerror ("fmpac: info: sram saved\n"); |
| 1803 | 1803 | mame_fclose (f); |
| 1804 | 1804 | return 0; |
| 1805 | 1805 | } |
| 1806 | else | |
| 1806 | else | |
| 1807 | 1807 | { |
| 1808 | 1808 | logerror ("fmpac: warning: sram save to file failed\n"); |
| 1809 | 1809 | mame_fclose (f); |
| r5932 | r5933 | |
| 1818 | 1818 | |
| 1819 | 1819 | MSX_SLOT_INIT(superloadrunner) |
| 1820 | 1820 | { |
| 1821 | if (size != 0x20000) | |
| 1821 | if (size != 0x20000) | |
| 1822 | 1822 | { |
| 1823 | 1823 | logerror ("superloadrunner: error: rom file should be exactly " |
| 1824 | 1824 | "128kb\n"); |
| r5932 | r5933 | |
| 1840 | 1840 | |
| 1841 | 1841 | MSX_SLOT_MAP(superloadrunner) |
| 1842 | 1842 | { |
| 1843 | if (page == 2) | |
| 1843 | if (page == 2) | |
| 1844 | 1844 | { |
| 1845 | 1845 | UINT8 *mem = state->mem + |
| 1846 | 1846 | (msx1.superloadrunner_bank & state->bank_mask) * 0x4000; |
| r5932 | r5933 | |
| 1848 | 1848 | msx_cpu_setbank (machine, 5, mem); |
| 1849 | 1849 | msx_cpu_setbank (machine, 6, mem + 0x2000); |
| 1850 | 1850 | } |
| 1851 | else | |
| 1851 | else | |
| 1852 | 1852 | { |
| 1853 | 1853 | msx_cpu_setbank (machine, page * 2 + 1, msx1.empty); |
| 1854 | 1854 | msx_cpu_setbank (machine, page * 2 + 2, msx1.empty); |
| r5932 | r5933 | |
| 1857 | 1857 | |
| 1858 | 1858 | MSX_SLOT_INIT(crossblaim) |
| 1859 | 1859 | { |
| 1860 | if (size != 0x10000) | |
| 1860 | if (size != 0x10000) | |
| 1861 | 1861 | { |
| 1862 | 1862 | logerror ("crossblaim: error: rom file should be exactly 64kb\n"); |
| 1863 | 1863 | return 1; |
| r5932 | r5933 | |
| 1880 | 1880 | |
| 1881 | 1881 | /* This might look odd, but it's what happens on the real cartridge */ |
| 1882 | 1882 | |
| 1883 | switch (page) | |
| 1883 | switch (page) | |
| 1884 | 1884 | { |
| 1885 | 1885 | case 0: |
| 1886 | 1886 | if (state->banks[0] < 2){ |
| 1887 | 1887 | mem = state->mem + state->banks[0] * 0x4000; |
| 1888 | 1888 | msx_cpu_setbank (machine, 1, mem); |
| 1889 | 1889 | msx_cpu_setbank (machine, 2, mem + 0x2000); |
| 1890 | } | |
| 1891 | else | |
| 1890 | } | |
| 1891 | else | |
| 1892 | 1892 | { |
| 1893 | 1893 | msx_cpu_setbank (machine, 1, msx1.empty); |
| 1894 | 1894 | msx_cpu_setbank (machine, 2, msx1.empty); |
| r5932 | r5933 | |
| 1908 | 1908 | mem = state->mem + state->banks[0] * 0x4000; |
| 1909 | 1909 | msx_cpu_setbank (machine, 7, mem); |
| 1910 | 1910 | msx_cpu_setbank (machine, 8, mem + 0x2000); |
| 1911 | } | |
| 1912 | else | |
| 1911 | } | |
| 1912 | else | |
| 1913 | 1913 | { |
| 1914 | 1914 | msx_cpu_setbank (machine, 7, msx1.empty); |
| 1915 | 1915 | msx_cpu_setbank (machine, 8, msx1.empty); |
| r5932 | r5933 | |
| 1924 | 1924 | if (!block) block = 1; |
| 1925 | 1925 | state->banks[0] = block; |
| 1926 | 1926 | |
| 1927 | if (msx1.state[0] == state) | |
| 1927 | if (msx1.state[0] == state) | |
| 1928 | 1928 | { |
| 1929 | 1929 | slot_crossblaim_map (machine, state, 0); |
| 1930 | 1930 | } |
| 1931 | if (msx1.state[2] == state) | |
| 1931 | if (msx1.state[2] == state) | |
| 1932 | 1932 | { |
| 1933 | 1933 | slot_crossblaim_map (machine, state, 2); |
| 1934 | 1934 | } |
| 1935 | if (msx1.state[3] == state) | |
| 1935 | if (msx1.state[3] == state) | |
| 1936 | 1936 | { |
| 1937 | 1937 | slot_crossblaim_map (machine, state, 3); |
| 1938 | 1938 | } |
| r5932 | r5933 | |
| 1942 | 1942 | { |
| 1943 | 1943 | int banks; |
| 1944 | 1944 | |
| 1945 | if (size > 0x200000) | |
| 1945 | if (size > 0x200000) | |
| 1946 | 1946 | { |
| 1947 | 1947 | logerror ("korean-80in1: warning: truncating to 2mb\n"); |
| 1948 | 1948 | size = 0x200000; |
| 1949 | 1949 | } |
| 1950 | 1950 | banks = size / 0x2000; |
| 1951 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 1951 | if (size != banks * 0x2000 || (~(banks - 1) % banks)) | |
| 1952 | 1952 | { |
| 1953 | 1953 | logerror ("korean-80in1: error: must be a 2 power of 8kb\n"); |
| 1954 | 1954 | return 1; |
| r5932 | r5933 | |
| 1965 | 1965 | { |
| 1966 | 1966 | int i; |
| 1967 | 1967 | |
| 1968 | for (i=0; i<4; i++) | |
| 1968 | for (i=0; i<4; i++) | |
| 1969 | 1969 | { |
| 1970 | 1970 | state->banks[i] = i; |
| 1971 | 1971 | } |
| r5932 | r5933 | |
| 1973 | 1973 | |
| 1974 | 1974 | MSX_SLOT_MAP(korean80in1) |
| 1975 | 1975 | { |
| 1976 | switch (page) | |
| 1976 | switch (page) | |
| 1977 | 1977 | { |
| 1978 | 1978 | case 0: |
| 1979 | 1979 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 1997 | 1997 | { |
| 1998 | 1998 | int bank; |
| 1999 | 1999 | |
| 2000 | if (addr >= 0x4000 && addr < 0x4004) | |
| 2000 | if (addr >= 0x4000 && addr < 0x4004) | |
| 2001 | 2001 | { |
| 2002 | 2002 | bank = addr & 3; |
| 2003 | 2003 | |
| 2004 | 2004 | state->banks[bank] = val & state->bank_mask; |
| 2005 | if (bank <= 1) | |
| 2005 | if (bank <= 1) | |
| 2006 | 2006 | { |
| 2007 | 2007 | slot_korean80in1_map (machine, state, 1); |
| 2008 | 2008 | } |
| 2009 | else if (msx1.state[2] == state) | |
| 2009 | else if (msx1.state[2] == state) | |
| 2010 | 2010 | { |
| 2011 | 2011 | slot_korean80in1_map (machine, state, 2); |
| 2012 | 2012 | } |
| r5932 | r5933 | |
| 2017 | 2017 | { |
| 2018 | 2018 | int banks; |
| 2019 | 2019 | |
| 2020 | if (size > 0x100000) | |
| 2020 | if (size > 0x100000) | |
| 2021 | 2021 | { |
| 2022 | 2022 | logerror ("korean-90in1: warning: truncating to 1mb\n"); |
| 2023 | 2023 | size = 0x100000; |
| 2024 | 2024 | } |
| 2025 | 2025 | banks = size / 0x4000; |
| 2026 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 2026 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 2027 | 2027 | { |
| 2028 | 2028 | logerror ("korean-90in1: error: must be a 2 power of 16kb\n"); |
| 2029 | 2029 | return 1; |
| r5932 | r5933 | |
| 2048 | 2048 | mem = state->mem + |
| 2049 | 2049 | ((msx1.korean90in1_bank & mask) & state->bank_mask) * 0x4000; |
| 2050 | 2050 | |
| 2051 | switch (page) | |
| 2051 | switch (page) | |
| 2052 | 2052 | { |
| 2053 | 2053 | case 0: |
| 2054 | 2054 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 2059 | 2059 | msx_cpu_setbank (machine, 4, mem + 0x2000); |
| 2060 | 2060 | break; |
| 2061 | 2061 | case 2: |
| 2062 | switch (msx1.korean90in1_bank & 0xc0) | |
| 2062 | switch (msx1.korean90in1_bank & 0xc0) | |
| 2063 | 2063 | { |
| 2064 | 2064 | case 0x80: /* 32 kb mode */ |
| 2065 | 2065 | mem += 0x4000; |
| r5932 | r5933 | |
| 2083 | 2083 | { |
| 2084 | 2084 | int banks; |
| 2085 | 2085 | |
| 2086 | if (size > 0x400000) | |
| 2086 | if (size > 0x400000) | |
| 2087 | 2087 | { |
| 2088 | 2088 | logerror ("korean-126in1: warning: truncating to 4mb\n"); |
| 2089 | 2089 | size = 0x400000; |
| 2090 | 2090 | } |
| 2091 | 2091 | banks = size / 0x4000; |
| 2092 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 2092 | if (size != banks * 0x4000 || (~(banks - 1) % banks)) | |
| 2093 | 2093 | { |
| 2094 | 2094 | logerror ("korean-126in1: error: must be a 2 power of 16kb\n"); |
| 2095 | 2095 | return 1; |
| r5932 | r5933 | |
| 2114 | 2114 | { |
| 2115 | 2115 | UINT8 *mem; |
| 2116 | 2116 | |
| 2117 | switch (page) | |
| 2117 | switch (page) | |
| 2118 | 2118 | { |
| 2119 | 2119 | case 0: |
| 2120 | 2120 | msx_cpu_setbank (machine, 1, msx1.empty); |
| r5932 | r5933 | |
| 2138 | 2138 | |
| 2139 | 2139 | MSX_SLOT_WRITE(korean126in1) |
| 2140 | 2140 | { |
| 2141 | if (addr >= 0x4000 && addr < 0x4002) | |
| 2141 | if (addr >= 0x4000 && addr < 0x4002) | |
| 2142 | 2142 | { |
| 2143 | 2143 | int bank = addr & 1; |
| 2144 | 2144 | state->banks[bank] = val & state->bank_mask; |
| 2145 | if (bank == 0) | |
| 2145 | if (bank == 0) | |
| 2146 | 2146 | { |
| 2147 | 2147 | slot_korean126in1_map (machine, state, 1); |
| 2148 | 2148 | } |
| 2149 | else if (msx1.state[2] == state) | |
| 2149 | else if (msx1.state[2] == state) | |
| 2150 | 2150 | { |
| 2151 | 2151 | slot_korean126in1_map (machine, state, 2); |
| 2152 | 2152 | } |
| r5932 | r5933 | |
| 2172 | 2172 | { |
| 2173 | 2173 | int i; |
| 2174 | 2174 | |
| 2175 | for (i=0; i<4; i++) | |
| 2175 | for (i=0; i<4; i++) | |
| 2176 | 2176 | { |
| 2177 | 2177 | state->banks[i] = i; |
| 2178 | 2178 | state->cart.sccp.ram_mode[i] = 0; |
| r5932 | r5933 | |
| 2188 | 2188 | int reg; |
| 2189 | 2189 | |
| 2190 | 2190 | |
| 2191 | if (offset >= 0x7e0) | |
| 2191 | if (offset >= 0x7e0) | |
| 2192 | 2192 | { |
| 2193 | 2193 | return msx1.state[2]->mem[ |
| 2194 | 2194 | msx1.state[2]->banks[2] * 0x2000 + 0x1800 + offset]; |
| r5932 | r5933 | |
| 2196 | 2196 | |
| 2197 | 2197 | reg = offset & 0xff; |
| 2198 | 2198 | |
| 2199 | if (reg < 0x80) | |
| 2199 | if (reg < 0x80) | |
| 2200 | 2200 | { |
| 2201 | 2201 | return k051649_waveform_r (devtag_get_device(space->machine, "k051649"), reg); |
| 2202 | 2202 | } |
| 2203 | else if (reg < 0xa0) | |
| 2203 | else if (reg < 0xa0) | |
| 2204 | 2204 | { |
| 2205 | 2205 | /* nothing */ |
| 2206 | 2206 | } |
| 2207 | else if (reg < 0xc0) | |
| 2207 | else if (reg < 0xc0) | |
| 2208 | 2208 | { |
| 2209 | 2209 | /* read wave 5 */ |
| 2210 | 2210 | return k051649_waveform_r (devtag_get_device(space->machine, "k051649"), 0x80 + (reg & 0x1f)); |
| 2211 | 2211 | } |
| 2212 | 2212 | #if 0 |
| 2213 | else if (reg < 0xe0) | |
| 2213 | else if (reg < 0xe0) | |
| 2214 | 2214 | { |
| 2215 | 2215 | /* write 0xff to deformation register */ |
| 2216 | 2216 | } |
| r5932 | r5933 | |
| 2223 | 2223 | { |
| 2224 | 2224 | int reg; |
| 2225 | 2225 | |
| 2226 | if (offset >= 0x7e0) | |
| 2226 | if (offset >= 0x7e0) | |
| 2227 | 2227 | { |
| 2228 | 2228 | return msx1.state[2]->mem[ |
| 2229 | 2229 | msx1.state[2]->banks[3] * 0x2000 + 0x1800 + offset]; |
| r5932 | r5933 | |
| 2231 | 2231 | |
| 2232 | 2232 | reg = offset & 0xff; |
| 2233 | 2233 | |
| 2234 | if (reg < 0xa0) | |
| 2234 | if (reg < 0xa0) | |
| 2235 | 2235 | { |
| 2236 | 2236 | return k051649_waveform_r (devtag_get_device(space->machine, "k051649"), reg); |
| 2237 | 2237 | } |
| 2238 | 2238 | #if 0 |
| 2239 | else if (reg >= 0xc0 && reg < 0xe0) | |
| 2239 | else if (reg >= 0xc0 && reg < 0xe0) | |
| 2240 | 2240 | { |
| 2241 | 2241 | /* write 0xff to deformation register */ |
| 2242 | 2242 | } |
| r5932 | r5933 | |
| 2248 | 2248 | MSX_SLOT_MAP(soundcartridge) |
| 2249 | 2249 | { |
| 2250 | 2250 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2251 | switch (page) | |
| 2251 | switch (page) | |
| 2252 | 2252 | { |
| 2253 | 2253 | case 0: |
| 2254 | 2254 | msx_cpu_setbank (machine, 1, state->mem + state->banks[2] * 0x2000); |
| r5932 | r5933 | |
| 2278 | 2278 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2279 | 2279 | int i; |
| 2280 | 2280 | |
| 2281 | if (addr < 0x4000) | |
| 2281 | if (addr < 0x4000) | |
| 2282 | 2282 | { |
| 2283 | 2283 | return; |
| 2284 | 2284 | } |
| 2285 | else if (addr < 0x6000) | |
| 2285 | else if (addr < 0x6000) | |
| 2286 | 2286 | { |
| 2287 | if (state->cart.sccp.ram_mode[0]) | |
| 2287 | if (state->cart.sccp.ram_mode[0]) | |
| 2288 | 2288 | { |
| 2289 | 2289 | state->mem[state->banks[0] * 0x2000 + (addr & 0x1fff)] = val; |
| 2290 | 2290 | } |
| 2291 | else if (addr >= 0x5000 && addr < 0x5800) | |
| 2291 | else if (addr >= 0x5000 && addr < 0x5800) | |
| 2292 | 2292 | { |
| 2293 | 2293 | state->banks[0] = val & state->bank_mask; |
| 2294 | 2294 | state->cart.sccp.banks_saved[0] = val; |
| 2295 | 2295 | slot_soundcartridge_map (machine, state, 1); |
| 2296 | if (msx1.state[3] == state) | |
| 2296 | if (msx1.state[3] == state) | |
| 2297 | 2297 | { |
| 2298 | 2298 | slot_soundcartridge_map (machine, state, 3); |
| 2299 | 2299 | } |
| 2300 | 2300 | } |
| 2301 | 2301 | } |
| 2302 | else if (addr < 0x8000) | |
| 2302 | else if (addr < 0x8000) | |
| 2303 | 2303 | { |
| 2304 | if (state->cart.sccp.ram_mode[1]) | |
| 2304 | if (state->cart.sccp.ram_mode[1]) | |
| 2305 | 2305 | { |
| 2306 | 2306 | state->mem[state->banks[1] * 0x2000 + (addr & 0x1fff)] = val; |
| 2307 | 2307 | } |
| 2308 | else if (addr >= 0x7000 && addr < 0x7800) | |
| 2308 | else if (addr >= 0x7000 && addr < 0x7800) | |
| 2309 | 2309 | { |
| 2310 | 2310 | state->banks[1] = val & state->bank_mask; |
| 2311 | 2311 | state->cart.sccp.banks_saved[1] = val; |
| 2312 | if (msx1.state[3] == state) | |
| 2312 | if (msx1.state[3] == state) | |
| 2313 | 2313 | { |
| 2314 | 2314 | slot_soundcartridge_map (machine, state, 3); |
| 2315 | 2315 | } |
| 2316 | 2316 | slot_soundcartridge_map (machine, state, 1); |
| 2317 | 2317 | } |
| 2318 | 2318 | } |
| 2319 | else if (addr < 0xa000) | |
| 2319 | else if (addr < 0xa000) | |
| 2320 | 2320 | { |
| 2321 | if (state->cart.sccp.ram_mode[2]) | |
| 2321 | if (state->cart.sccp.ram_mode[2]) | |
| 2322 | 2322 | { |
| 2323 | 2323 | state->mem[state->banks[2] * 0x2000 + (addr & 0x1fff)] = val; |
| 2324 | 2324 | } |
| 2325 | else if (addr >= 0x9000 && addr < 0x9800) | |
| 2325 | else if (addr >= 0x9000 && addr < 0x9800) | |
| 2326 | 2326 | { |
| 2327 | 2327 | state->banks[2] = val & state->bank_mask; |
| 2328 | 2328 | state->cart.sccp.banks_saved[2] = val; |
| r5932 | r5933 | |
| 2330 | 2330 | (((val & 0x3f) == 0x3f) && !(state->cart.sccp.mode & 0x20)); |
| 2331 | 2331 | |
| 2332 | 2332 | slot_soundcartridge_map (machine, state, 2); |
| 2333 | if (msx1.state[0] == state) | |
| 2333 | if (msx1.state[0] == state) | |
| 2334 | 2334 | { |
| 2335 | 2335 | slot_soundcartridge_map (machine, state, 0); |
| 2336 | 2336 | } |
| 2337 | 2337 | } |
| 2338 | else if (addr >= 0x9800 && state->cart.sccp.scc_active) | |
| 2338 | else if (addr >= 0x9800 && state->cart.sccp.scc_active) | |
| 2339 | 2339 | { |
| 2340 | 2340 | const device_config *k051649 = devtag_get_device(space->machine, "k051649"); |
| 2341 | 2341 | int offset = addr & 0xff; |
| 2342 | 2342 | |
| 2343 | if (offset < 0x80) | |
| 2343 | if (offset < 0x80) | |
| 2344 | 2344 | { |
| 2345 | 2345 | k051649_waveform_w (k051649, offset, val); |
| 2346 | 2346 | } |
| 2347 | else if (offset < 0xa0) | |
| 2347 | else if (offset < 0xa0) | |
| 2348 | 2348 | { |
| 2349 | 2349 | offset &= 0xf; |
| 2350 | 2350 | |
| 2351 | if (offset < 0xa) | |
| 2351 | if (offset < 0xa) | |
| 2352 | 2352 | { |
| 2353 | 2353 | k051649_frequency_w (k051649, offset, val); |
| 2354 | 2354 | } |
| 2355 | else if (offset < 0x0f) | |
| 2355 | else if (offset < 0x0f) | |
| 2356 | 2356 | { |
| 2357 | 2357 | k051649_volume_w (k051649, offset - 0xa, val); |
| 2358 | 2358 | } |
| 2359 | else if (offset == 0x0f) | |
| 2359 | else if (offset == 0x0f) | |
| 2360 | 2360 | { |
| 2361 | 2361 | k051649_keyonoff_w (k051649, 0, val); |
| 2362 | 2362 | } |
| 2363 | 2363 | } |
| 2364 | 2364 | #if 0 |
| 2365 | else if (offset < 0xe0) | |
| 2365 | else if (offset < 0xe0) | |
| 2366 | 2366 | { |
| 2367 | 2367 | /* write to deformation register */ |
| 2368 | 2368 | } |
| 2369 | 2369 | #endif |
| 2370 | 2370 | } |
| 2371 | 2371 | } |
| 2372 | else if (addr < 0xbffe) | |
| 2372 | else if (addr < 0xbffe) | |
| 2373 | 2373 | { |
| 2374 | if (state->cart.sccp.ram_mode[3]) | |
| 2374 | if (state->cart.sccp.ram_mode[3]) | |
| 2375 | 2375 | { |
| 2376 | 2376 | state->mem[state->banks[3] * 0x2000 + (addr & 0x1fff)] = val; |
| 2377 | 2377 | } |
| 2378 | else if (addr >= 0xb000 && addr < 0xb800) | |
| 2378 | else if (addr >= 0xb000 && addr < 0xb800) | |
| 2379 | 2379 | { |
| 2380 | 2380 | state->cart.sccp.banks_saved[3] = val; |
| 2381 | 2381 | state->banks[3] = val & state->bank_mask; |
| 2382 | 2382 | state->cart.sccp.sccp_active = |
| 2383 | 2383 | (val & 0x80) && (state->cart.sccp.mode & 0x20); |
| 2384 | 2384 | slot_soundcartridge_map (machine, state, 2); |
| 2385 | if (msx1.state[0] == state) | |
| 2385 | if (msx1.state[0] == state) | |
| 2386 | 2386 | { |
| 2387 | 2387 | slot_soundcartridge_map (machine, state, 0); |
| 2388 | 2388 | } |
| 2389 | 2389 | } |
| 2390 | else if (addr >= 0xb800 && state->cart.sccp.sccp_active) | |
| 2390 | else if (addr >= 0xb800 && state->cart.sccp.sccp_active) | |
| 2391 | 2391 | { |
| 2392 | 2392 | const device_config *k051649 = devtag_get_device(space->machine, "k051649"); |
| 2393 | 2393 | int offset = addr & 0xff; |
| 2394 | 2394 | |
| 2395 | if (offset < 0xa0) | |
| 2395 | if (offset < 0xa0) | |
| 2396 | 2396 | { |
| 2397 | 2397 | k052539_waveform_w (k051649, offset, val); |
| 2398 | 2398 | } |
| 2399 | else if (offset < 0xc0) | |
| 2399 | else if (offset < 0xc0) | |
| 2400 | 2400 | { |
| 2401 | 2401 | offset &= 0x0f; |
| 2402 | 2402 | |
| 2403 | if (offset < 0x0a) | |
| 2403 | if (offset < 0x0a) | |
| 2404 | 2404 | { |
| 2405 | 2405 | k051649_frequency_w (k051649, offset, val); |
| 2406 | 2406 | } |
| 2407 | else if (offset < 0x0f) | |
| 2407 | else if (offset < 0x0f) | |
| 2408 | 2408 | { |
| 2409 | 2409 | k051649_volume_w (k051649, offset - 0x0a, val); |
| 2410 | 2410 | } |
| 2411 | else if (offset == 0x0f) | |
| 2411 | else if (offset == 0x0f) | |
| 2412 | 2412 | { |
| 2413 | 2413 | k051649_keyonoff_w (k051649, 0, val); |
| 2414 | 2414 | } |
| 2415 | 2415 | } |
| 2416 | 2416 | #if 0 |
| 2417 | else if (offset < 0xe0) | |
| 2417 | else if (offset < 0xe0) | |
| 2418 | 2418 | { |
| 2419 | 2419 | /* write to deformation register */ |
| 2420 | 2420 | } |
| 2421 | 2421 | #endif |
| 2422 | 2422 | } |
| 2423 | 2423 | } |
| 2424 | else if (addr < 0xc000) | |
| 2424 | else if (addr < 0xc000) | |
| 2425 | 2425 | { |
| 2426 | 2426 | /* write to mode register */ |
| 2427 | if ((state->cart.sccp.mode ^ val) & 0x20) | |
| 2427 | if ((state->cart.sccp.mode ^ val) & 0x20) | |
| 2428 | 2428 | { |
| 2429 | 2429 | logerror ("soundcartrige: changed to %s mode\n", |
| 2430 | 2430 | val & 0x20 ? "scc+" : "scc"); |
| 2431 | 2431 | } |
| 2432 | 2432 | state->cart.sccp.mode = val; |
| 2433 | if (val & 0x10) | |
| 2433 | if (val & 0x10) | |
| 2434 | 2434 | { |
| 2435 | 2435 | /* all ram mode */ |
| 2436 | for (i=0; i<4; i++) | |
| 2436 | for (i=0; i<4; i++) | |
| 2437 | 2437 | { |
| 2438 | 2438 | state->cart.sccp.ram_mode[i] = 1; |
| 2439 | 2439 | } |
| 2440 | 2440 | } |
| 2441 | else | |
| 2441 | else | |
| 2442 | 2442 | { |
| 2443 | 2443 | state->cart.sccp.ram_mode[0] = val & 1; |
| 2444 | 2444 | state->cart.sccp.ram_mode[1] = val & 2; |
| r5932 | r5933 | |
|---|---|---|
| 56 | 56 | if (outa & 0x04) |
| 57 | 57 | { |
| 58 | 58 | data |= input_port_read(machine, "KEY8"); |
| 59 | ||
| 59 | ||
| 60 | 60 | /* At Power Up we fake a 'CLS' pressure */ |
| 61 | 61 | if (power) |
| 62 | 62 | data |= 0x08; |
| r5932 | r5933 | |
| 68 | 68 | if (outa & 0x10) |
| 69 | 69 | data |= input_port_read(machine, "KEY10"); |
| 70 | 70 | |
| 71 | if (outa & 0xc0) | |
| 71 | if (outa & 0xc0) | |
| 72 | 72 | data |= input_port_read(machine, "KEY11"); |
| 73 | 73 | |
| 74 | 74 | // missing lshift |
| r5932 | r5933 | |
| 119 | 119 | MACHINE_START( pc1350 ) |
| 120 | 120 | { |
| 121 | 121 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 122 | ||
| 122 | ||
| 123 | 123 | timer_set(machine, ATTOTIME_IN_SEC(1), NULL, 0, pc1350_power_up); |
| 124 | 124 | |
| 125 | 125 | memory_install_read8_handler(space, 0x6000, 0x6fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Pokemini machine emulation. | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | **********************************************************************/ |
| r5932 | r5933 | |
| 215 | 215 | static const int levels[4] = { 0, 1, 1, 2 }; |
| 216 | 216 | int level = levels[ pm_reg[0x71] & 0x03 ]; |
| 217 | 217 | |
| 218 | // if ( ( ( pm_reg[0x48] & 0x80 ) && ( pm_reg[0x4E] | ( pm_reg[0x4F] << 8 ) ) > ( pm_reg[0x4C] | ( pm_reg[0x4D] << 8 ) ) ) | |
| 219 | // || ( ( pm_reg[0x48] & 0x80 ) && pm_reg[0x4F] > pm_reg[0x4D] ) ) | |
| 220 | // { | |
| 218 | // if ( ( ( pm_reg[0x48] & 0x80 ) && ( pm_reg[0x4E] | ( pm_reg[0x4F] << 8 ) ) > ( pm_reg[0x4C] | ( pm_reg[0x4D] << 8 ) ) ) | |
| 219 | // || ( ( pm_reg[0x48] & 0x80 ) && pm_reg[0x4F] > pm_reg[0x4D] ) ) | |
| 220 | // { | |
| 221 | 221 | level = 0; |
| 222 | // | |
| 222 | // } | |
| 223 | 223 | |
| 224 | 224 | speaker_level_w( speaker, level ); |
| 225 | 225 | } |
| r5932 | r5933 | |
| 428 | 428 | switch( offset ) |
| 429 | 429 | { |
| 430 | 430 | case 0x00: /* start-up contrast |
| 431 | Bit 0-1 R/W Must be 1(?) | |
| 432 | Bit 2-7 R/W Start up contrast (doesn't affect contrast until after reboot) | |
| 433 | */ | |
| 431 | Bit 0-1 R/W Must be 1(?) | |
| 432 | Bit 2-7 R/W Start up contrast (doesn't affect contrast until after reboot) | |
| 433 | */ | |
| 434 | 434 | case 0x01: /* CPU related? |
| 435 | Bit 0-7 R/W Unknown | |
| 436 | */ | |
| 435 | Bit 0-7 R/W Unknown | |
| 436 | */ | |
| 437 | 437 | case 0x02: /* CPU related? |
| 438 | Bit 0-7 R/W Unknown | |
| 439 | */ | |
| 438 | Bit 0-7 R/W Unknown | |
| 439 | */ | |
| 440 | 440 | logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 441 | 441 | break; |
| 442 | 442 | case 0x08: /* Seconds-timer control |
| 443 | Bit 0 R/W Timer enable | |
| 444 | Bit 1 W Timer reset | |
| 445 | Bit 2-7 Unused | |
| 446 | */ | |
| 443 | Bit 0 R/W Timer enable | |
| 444 | Bit 1 W Timer reset | |
| 445 | Bit 2-7 Unused | |
| 446 | */ | |
| 447 | 447 | if ( data & 0x02 ) |
| 448 | 448 | { |
| 449 | 449 | pm_reg[0x09] = 0x00; |
| r5932 | r5933 | |
| 453 | 453 | } |
| 454 | 454 | break; |
| 455 | 455 | case 0x09: /* Seconds-timer (low), read only |
| 456 | Bit 0-7 R Seconds timer bit 0-7 | |
| 457 | */ | |
| 456 | Bit 0-7 R Seconds timer bit 0-7 | |
| 457 | */ | |
| 458 | 458 | return; |
| 459 | 459 | case 0x0A: /* Seconds-timer (mid), read only |
| 460 | Bit 0-7 R Seconds timer bit 8-15 | |
| 461 | */ | |
| 460 | Bit 0-7 R Seconds timer bit 8-15 | |
| 461 | */ | |
| 462 | 462 | return; |
| 463 | 463 | case 0x0B: /* Seconds-timer (high), read only |
| 464 | Bit 0-7 R Seconds timer bit 16-23 | |
| 465 | */ | |
| 464 | Bit 0-7 R Seconds timer bit 16-23 | |
| 465 | */ | |
| 466 | 466 | return; |
| 467 | 467 | case 0x10: /* Low power detector |
| 468 | Bit 0-4 R/W Unknown | |
| 469 | Bit 5 R Battery status: 0 - battery OK, 1 - battery low | |
| 470 | Bit 6-7 Unused | |
| 471 | */ | |
| 468 | Bit 0-4 R/W Unknown | |
| 469 | Bit 5 R Battery status: 0 - battery OK, 1 - battery low | |
| 470 | Bit 6-7 Unused | |
| 471 | */ | |
| 472 | 472 | logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 473 | 473 | break; |
| 474 | 474 | case 0x18: /* Timer 1 pre-scale + enable |
| 475 | Bit 0-2 R/W low timer 1 prescaler select | |
| 476 | 000 - 2 or 128 cycles | |
| 477 | 001 - 8 or 256 cycles | |
| 478 | 010 - 32 or 512 cycles | |
| 479 | 011 - 64 or 1024 cycles | |
| 480 | 100 - 128 or 2048 cycles | |
| 481 | 101 - 256 or 4096 cycles | |
| 482 | 110 - 1024 or 8192 cycles | |
| 483 | 111 - 4096 or 16384 cycles | |
| 484 | Bit 3 R/W Enable low counting | |
| 485 | Bit 4-6 R/W high timer 1 prescaler select | |
| 486 | Bit 7 R/W Enable high counting | |
| 487 | */ | |
| 475 | Bit 0-2 R/W low timer 1 prescaler select | |
| 476 | 000 - 2 or 128 cycles | |
| 477 | 001 - 8 or 256 cycles | |
| 478 | 010 - 32 or 512 cycles | |
| 479 | 011 - 64 or 1024 cycles | |
| 480 | 100 - 128 or 2048 cycles | |
| 481 | 101 - 256 or 4096 cycles | |
| 482 | 110 - 1024 or 8192 cycles | |
| 483 | 111 - 4096 or 16384 cycles | |
| 484 | Bit 3 R/W Enable low counting | |
| 485 | Bit 4-6 R/W high timer 1 prescaler select | |
| 486 | Bit 7 R/W Enable high counting | |
| 487 | */ | |
| 488 | 488 | /* Check for prescaler change for the low counter */ |
| 489 | 489 | if ( ( data & 0x07 ) != ( pm_reg[0x18] & 0x07 ) ) |
| 490 | 490 | { |
| r5932 | r5933 | |
| 528 | 528 | } |
| 529 | 529 | break; |
| 530 | 530 | case 0x19: /* Timers 1 speed |
| 531 | Bit 0 R/W Select slow timer for timer 1 lo | |
| 532 | Bit 1 R/W Select slow timer for timer 1 hi | |
| 533 | Bit 2-3 Unused | |
| 534 | Bit 4 R/W Enable slow timers | |
| 535 | Bit 5 R/W Enable fast timers | |
| 536 | Bit 6-7 Unused | |
| 537 | */ | |
| 531 | Bit 0 R/W Select slow timer for timer 1 lo | |
| 532 | Bit 1 R/W Select slow timer for timer 1 hi | |
| 533 | Bit 2-3 Unused | |
| 534 | Bit 4 R/W Enable slow timers | |
| 535 | Bit 5 R/W Enable fast timers | |
| 536 | Bit 6-7 Unused | |
| 537 | */ | |
| 538 | 538 | /* Check for prescaler change for the high counter */ |
| 539 | 539 | if ( ( data & 0x01 ) != ( pm_reg[0x19] & 0x01 ) ) |
| 540 | 540 | { |
| r5932 | r5933 | |
| 601 | 601 | } |
| 602 | 602 | break; |
| 603 | 603 | case 0x1A: /* Timer 2 pre-scale + enable |
| 604 | Bit 0-2 R/W low timer 2 prescaler select | |
| 605 | 000 - 2 or 128 cycles | |
| 606 | 001 - 8 or 256 cycles | |
| 607 | 010 - 32 or 512 cycles | |
| 608 | 011 - 64 or 1024 cycles | |
| 609 | 100 - 128 or 2048 cycles | |
| 610 | 101 - 256 or 4096 cycles | |
| 611 | 110 - 1024 or 8192 cycles | |
| 612 | 111 - 4096 or 16384 cycles | |
| 613 | Bit 3 R/W Enable low counting | |
| 614 | Bit 4-6 R/W high timer 2 prescaler select | |
| 615 | Bit 7 R/W Enable high counting | |
| 616 | */ | |
| 604 | Bit 0-2 R/W low timer 2 prescaler select | |
| 605 | 000 - 2 or 128 cycles | |
| 606 | 001 - 8 or 256 cycles | |
| 607 | 010 - 32 or 512 cycles | |
| 608 | 011 - 64 or 1024 cycles | |
| 609 | 100 - 128 or 2048 cycles | |
| 610 | 101 - 256 or 4096 cycles | |
| 611 | 110 - 1024 or 8192 cycles | |
| 612 | 111 - 4096 or 16384 cycles | |
| 613 | Bit 3 R/W Enable low counting | |
| 614 | Bit 4-6 R/W high timer 2 prescaler select | |
| 615 | Bit 7 R/W Enable high counting | |
| 616 | */ | |
| 617 | 617 | /* Check for prescaler change for the low counter */ |
| 618 | 618 | if ( ( data & 0x07 ) != ( pm_reg[0x1A] & 0x07 ) ) |
| 619 | 619 | { |
| r5932 | r5933 | |
| 657 | 657 | } |
| 658 | 658 | break; |
| 659 | 659 | case 0x1B: /* Timer 2 speeds |
| 660 | Bit 0 R/W Select slow timer for timer 2 lo | |
| 661 | Bit 1 R/W Select slow timer for timer 2 hi | |
| 662 | */ | |
| 660 | Bit 0 R/W Select slow timer for timer 2 lo | |
| 661 | Bit 1 R/W Select slow timer for timer 2 hi | |
| 662 | */ | |
| 663 | 663 | /* Check for prescaler change for the high counter */ |
| 664 | 664 | if ( ( data & 0x01 ) != ( pm_reg[0x1B] & 0x01 ) ) |
| 665 | 665 | { |
| r5932 | r5933 | |
| 701 | 701 | } |
| 702 | 702 | break; |
| 703 | 703 | case 0x1C: /* Timer 3 pre-scale + enable |
| 704 | Bit 0-2 R/W low timer 3 prescaler select | |
| 705 | 000 - 2 or 128 cycles | |
| 706 | 001 - 8 or 256 cycles | |
| 707 | 010 - 32 or 512 cycles | |
| 708 | 011 - 64 or 1024 cycles | |
| 709 | 100 - 128 or 2048 cycles | |
| 710 | 101 - 256 or 4096 cycles | |
| 711 | 110 - 1024 or 8192 cycles | |
| 712 | 111 - 4096 or 16384 cycles | |
| 713 | Bit 3 R/W Enable low counting | |
| 714 | Bit 4-6 R/W high timer 3 prescaler select | |
| 715 | Bit 7 R/W Enable high counting | |
| 716 | */ | |
| 704 | Bit 0-2 R/W low timer 3 prescaler select | |
| 705 | 000 - 2 or 128 cycles | |
| 706 | 001 - 8 or 256 cycles | |
| 707 | 010 - 32 or 512 cycles | |
| 708 | 011 - 64 or 1024 cycles | |
| 709 | 100 - 128 or 2048 cycles | |
| 710 | 101 - 256 or 4096 cycles | |
| 711 | 110 - 1024 or 8192 cycles | |
| 712 | 111 - 4096 or 16384 cycles | |
| 713 | Bit 3 R/W Enable low counting | |
| 714 | Bit 4-6 R/W high timer 3 prescaler select | |
| 715 | Bit 7 R/W Enable high counting | |
| 716 | */ | |
| 717 | 717 | /* Check for prescaler change for the low counter */ |
| 718 | 718 | if ( ( data & 0x07 ) != ( pm_reg[0x1C] & 0x07 ) ) |
| 719 | 719 | { |
| r5932 | r5933 | |
| 757 | 757 | } |
| 758 | 758 | break; |
| 759 | 759 | case 0x1D: /* Timer 3 speeds |
| 760 | Bit 0 R/W Select slow timer for timer 3 lo | |
| 761 | Bit 1 R/W Select slow timer for timer 3 hi | |
| 762 | */ | |
| 760 | Bit 0 R/W Select slow timer for timer 3 lo | |
| 761 | Bit 1 R/W Select slow timer for timer 3 hi | |
| 762 | */ | |
| 763 | 763 | /* Check for prescaler change for the high counter */ |
| 764 | 764 | if ( ( data & 0x01 ) != ( pm_reg[0x1D] & 0x01 ) ) |
| 765 | 765 | { |
| r5932 | r5933 | |
| 801 | 801 | } |
| 802 | 802 | break; |
| 803 | 803 | case 0x20: /* Event #1-#8 priority |
| 804 | Bit 0-1 R/W Timer 3 overflow Interrupt #7-#8 | |
| 805 | Bit 2-3 R/W Timer 1 overflow Interrupt #5-#6 | |
| 806 | Bit 4-5 R/W Timer 2 overflow Interrupt #3-#4 | |
| 807 | Bit 6-7 R/W VDraw/VBlank trigger Interrupt #1-#2 | |
| 808 | */ | |
| 804 | Bit 0-1 R/W Timer 3 overflow Interrupt #7-#8 | |
| 805 | Bit 2-3 R/W Timer 1 overflow Interrupt #5-#6 | |
| 806 | Bit 4-5 R/W Timer 2 overflow Interrupt #3-#4 | |
| 807 | Bit 6-7 R/W VDraw/VBlank trigger Interrupt #1-#2 | |
| 808 | */ | |
| 809 | 809 | pm_reg[0x20] = data; |
| 810 | 810 | pokemini_check_irqs( space->machine ); |
| 811 | 811 | break; |
| 812 | 812 | case 0x21: /* Event #15-#22 priority |
| 813 | Bit 0-1 R/W Unknown | |
| 814 | Bit 2-3 R/W All keypad interrupts - Interrupt #15-#22 | |
| 815 | Bit 4-7 R/W Unknown | |
| 816 | */ | |
| 813 | Bit 0-1 R/W Unknown | |
| 814 | Bit 2-3 R/W All keypad interrupts - Interrupt #15-#22 | |
| 815 | Bit 4-7 R/W Unknown | |
| 816 | */ | |
| 817 | 817 | pm_reg[0x21] = data; |
| 818 | 818 | pokemini_check_irqs( space->machine ); |
| 819 | 819 | break; |
| 820 | 820 | case 0x22: /* Event #9-#14 priority |
| 821 | Bit 0-1 R/W All #9 - #14 events - Interrupt #9-#14 | |
| 822 | Bit 2-7 Unused | |
| 823 | */ | |
| 821 | Bit 0-1 R/W All #9 - #14 events - Interrupt #9-#14 | |
| 822 | Bit 2-7 Unused | |
| 823 | */ | |
| 824 | 824 | pm_reg[0x22] = data; |
| 825 | 825 | pokemini_check_irqs( space->machine ); |
| 826 | 826 | break; |
| 827 | 827 | case 0x23: /* Event #1-#8 enable |
| 828 | Bit 0 R/W Timer 3 overflow (mirror) - Enable Interrupt #8 | |
| 829 | Bit 1 R/W Timer 3 overflow - Enable Interrupt #7 | |
| 830 | Bit 2 R/W Not called... - Enable Interrupt #6 | |
| 831 | Bit 3 R/W Timer 1 overflow - Enable Interrupt #5 | |
| 832 | Bit 4 R/W Not called... - Enable Interrupt #4 | |
| 833 | Bit 5 R/W Timer 2 overflow - Enable Interrupt #3 | |
| 834 | Bit 6 R/W V-Draw trigger - Enable Interrupt #2 | |
| 835 | Bit 7 R/W V-Blank trigger - Enable Interrupt #1 | |
| 836 | */ | |
| 828 | Bit 0 R/W Timer 3 overflow (mirror) - Enable Interrupt #8 | |
| 829 | Bit 1 R/W Timer 3 overflow - Enable Interrupt #7 | |
| 830 | Bit 2 R/W Not called... - Enable Interrupt #6 | |
| 831 | Bit 3 R/W Timer 1 overflow - Enable Interrupt #5 | |
| 832 | Bit 4 R/W Not called... - Enable Interrupt #4 | |
| 833 | Bit 5 R/W Timer 2 overflow - Enable Interrupt #3 | |
| 834 | Bit 6 R/W V-Draw trigger - Enable Interrupt #2 | |
| 835 | Bit 7 R/W V-Blank trigger - Enable Interrupt #1 | |
| 836 | */ | |
| 837 | 837 | pm_reg[0x23] = data; |
| 838 | 838 | pokemini_check_irqs( space->machine ); |
| 839 | 839 | break; |
| 840 | 840 | case 0x24: /* Event #9-#12 enable |
| 841 | Bit 0-5 R/W Unknown | |
| 842 | Bit 6-7 Unused | |
| 843 | */ | |
| 841 | Bit 0-5 R/W Unknown | |
| 842 | Bit 6-7 Unused | |
| 843 | */ | |
| 844 | 844 | pm_reg[0x24] = data; |
| 845 | 845 | pokemini_check_irqs( space->machine ); |
| 846 | 846 | break; |
| 847 | 847 | case 0x25: /* Event #15-#22 enable |
| 848 | Bit 0 R/W Press key "A" event - Enable interrupt #22 | |
| 849 | Bit 1 R/W Press key "B" event - Enable interrupt #21 | |
| 850 | Bit 2 R/W Press key "C" event - Enable interrupt #20 | |
| 851 | Bit 3 R/W Press D-pad up key event - Enable interrupt #19 | |
| 852 | Bit 4 R/W Press D-pad down key event - Enable interrupt #18 | |
| 853 | Bit 5 R/W Press D-pad left key event - Enable interrupt #17 | |
| 854 | Bit 6 R/W Press D-pad right key event - Enable interrupt #16 | |
| 855 | Bit 7 R/W Press power button event - Enable interrupt #15 | |
| 856 | */ | |
| 848 | Bit 0 R/W Press key "A" event - Enable interrupt #22 | |
| 849 | Bit 1 R/W Press key "B" event - Enable interrupt #21 | |
| 850 | Bit 2 R/W Press key "C" event - Enable interrupt #20 | |
| 851 | Bit 3 R/W Press D-pad up key event - Enable interrupt #19 | |
| 852 | Bit 4 R/W Press D-pad down key event - Enable interrupt #18 | |
| 853 | Bit 5 R/W Press D-pad left key event - Enable interrupt #17 | |
| 854 | Bit 6 R/W Press D-pad right key event - Enable interrupt #16 | |
| 855 | Bit 7 R/W Press power button event - Enable interrupt #15 | |
| 856 | */ | |
| 857 | 857 | pm_reg[0x25] = data; |
| 858 | 858 | pokemini_check_irqs( space->machine ); |
| 859 | 859 | break; |
| 860 | 860 | case 0x26: /* Event #13-#14 enable |
| 861 | Bit 0-2 R/W Unknown | |
| 862 | Bit 3 Unused | |
| 863 | Bit 4-5 R/W Unknown | |
| 864 | Bit 6 R/W Shock detector trigger - Enable interrupt #14 | |
| 865 | Bit 7 R/W IR receiver - low to high trigger - Enable interrupt #13 | |
| 866 | */ | |
| 861 | Bit 0-2 R/W Unknown | |
| 862 | Bit 3 Unused | |
| 863 | Bit 4-5 R/W Unknown | |
| 864 | Bit 6 R/W Shock detector trigger - Enable interrupt #14 | |
| 865 | Bit 7 R/W IR receiver - low to high trigger - Enable interrupt #13 | |
| 866 | */ | |
| 867 | 867 | pm_reg[0x26] = data; |
| 868 | 868 | pokemini_check_irqs( space->machine ); |
| 869 | 869 | break; |
| 870 | 870 | case 0x27: /* Interrupt active flag #1-#8 |
| 871 | Bit 0 Timer 3 overflow (mirror) / Clear interrupt #8 | |
| 872 | Bit 1 Timer 3 overflow / Clear interrupt #7 | |
| 873 | Bit 2 Not called ... / Clear interrupt #6 | |
| 874 | Bit 3 Timer 1 overflow / Clear interrupt #5 | |
| 875 | Bit 4 Not called ... / Clear interrupt #4 | |
| 876 | Bit 5 Timer 2 overflow / Clear interrupt #3 | |
| 877 | Bit 6 VDraw trigger / Clear interrupt #2 | |
| 878 | Bit 7 VBlank trigger / Clear interrupt #1 | |
| 879 | */ | |
| 871 | Bit 0 Timer 3 overflow (mirror) / Clear interrupt #8 | |
| 872 | Bit 1 Timer 3 overflow / Clear interrupt #7 | |
| 873 | Bit 2 Not called ... / Clear interrupt #6 | |
| 874 | Bit 3 Timer 1 overflow / Clear interrupt #5 | |
| 875 | Bit 4 Not called ... / Clear interrupt #4 | |
| 876 | Bit 5 Timer 2 overflow / Clear interrupt #3 | |
| 877 | Bit 6 VDraw trigger / Clear interrupt #2 | |
| 878 | Bit 7 VBlank trigger / Clear interrupt #1 | |
| 879 | */ | |
| 880 | 880 | pm_reg[0x27] &= ~data; |
| 881 | 881 | pokemini_check_irqs( space->machine ); |
| 882 | 882 | return; |
| 883 | 883 | case 0x28: /* Interrupt active flag #9-#12 |
| 884 | Bit 0-1 Unknown | |
| 885 | Bit 2 Unknown / Clear interrupt #12 | |
| 886 | Bit 3 Unknown / Clear interrupt #11 | |
| 887 | Bit 4 Unknown / Clear interrupt #10 | |
| 888 | Bit 5 Unknown / Clear interrupt #9 | |
| 889 | Bit 6-7 Unknown | |
| 890 | */ | |
| 884 | Bit 0-1 Unknown | |
| 885 | Bit 2 Unknown / Clear interrupt #12 | |
| 886 | Bit 3 Unknown / Clear interrupt #11 | |
| 887 | Bit 4 Unknown / Clear interrupt #10 | |
| 888 | Bit 5 Unknown / Clear interrupt #9 | |
| 889 | Bit 6-7 Unknown | |
| 890 | */ | |
| 891 | 891 | pm_reg[0x28] &= ~data; |
| 892 | 892 | pokemini_check_irqs( space->machine ); |
| 893 | 893 | return; |
| 894 | 894 | case 0x29: /* Interrupt active flag #15-#22 |
| 895 | Bit 0 Press key "A" event / Clear interrupt #22 | |
| 896 | Bit 1 Press key "B" event / Clear interrupt #21 | |
| 897 | Bit 2 Press key "C" event / Clear interrupt #20 | |
| 898 | Bit 3 Press D-pad up key event / Clear interrupt #19 | |
| 899 | Bit 4 Press D-pad down key event / Clear interrupt #18 | |
| 900 | Bit 5 Press D-pad left key event / Clear interrupt #17 | |
| 901 | Bit 6 Press D-pad right key event / Clear interrupt #16 | |
| 902 | Bit 7 Press power button event / Clear interrupt #15 | |
| 903 | */ | |
| 895 | Bit 0 Press key "A" event / Clear interrupt #22 | |
| 896 | Bit 1 Press key "B" event / Clear interrupt #21 | |
| 897 | Bit 2 Press key "C" event / Clear interrupt #20 | |
| 898 | Bit 3 Press D-pad up key event / Clear interrupt #19 | |
| 899 | Bit 4 Press D-pad down key event / Clear interrupt #18 | |
| 900 | Bit 5 Press D-pad left key event / Clear interrupt #17 | |
| 901 | Bit 6 Press D-pad right key event / Clear interrupt #16 | |
| 902 | Bit 7 Press power button event / Clear interrupt #15 | |
| 903 | */ | |
| 904 | 904 | pm_reg[0x29] &= ~data; |
| 905 | 905 | pokemini_check_irqs( space->machine ); |
| 906 | 906 | return; |
| 907 | 907 | case 0x2A: /* Interrupt active flag #13-#14 |
| 908 | Bit 0-5 Unknown | |
| 909 | Bit 6 Shock detector trigger / Clear interrupt #14 | |
| 910 | Bit 7 Unknown / Clear interrupt #13 | |
| 911 | */ | |
| 908 | Bit 0-5 Unknown | |
| 909 | Bit 6 Shock detector trigger / Clear interrupt #14 | |
| 910 | Bit 7 Unknown / Clear interrupt #13 | |
| 911 | */ | |
| 912 | 912 | pm_reg[0x2A] &= ~data; |
| 913 | 913 | pokemini_check_irqs( space->machine ); |
| 914 | 914 | return; |
| 915 | 915 | case 0x30: /* Timer 1 control 1 |
| 916 | Bit 0 R/W Unknown | |
| 917 | Bit 1 W Reset low counter | |
| 918 | Bit 2 R/W Enable high counter | |
| 919 | Bit 3 R/W Unknown | |
| 920 | Bit 4-6 Unused | |
| 921 | Bit 7 R/W Enable 16bit mode | |
| 922 | */ | |
| 916 | Bit 0 R/W Unknown | |
| 917 | Bit 1 W Reset low counter | |
| 918 | Bit 2 R/W Enable high counter | |
| 919 | Bit 3 R/W Unknown | |
| 920 | Bit 4-6 Unused | |
| 921 | Bit 7 R/W Enable 16bit mode | |
| 922 | */ | |
| 923 | 923 | if ( data & 0x02 ) |
| 924 | 924 | { |
| 925 | 925 | pm_reg[0x36] = pm_reg[0x32]; |
| r5932 | r5933 | |
| 949 | 949 | } |
| 950 | 950 | break; |
| 951 | 951 | case 0x31: /* Timer 1 control 2 |
| 952 | Bit 0 R/W Unknown | |
| 953 | Bit 1 W Reset hi counter | |
| 954 | Bit 2 R/W Enable high counter | |
| 955 | Bit 3 R/W Unknown | |
| 956 | Bit 4-7 Unused | |
| 957 | */ | |
| 952 | Bit 0 R/W Unknown | |
| 953 | Bit 1 W Reset hi counter | |
| 954 | Bit 2 R/W Enable high counter | |
| 955 | Bit 3 R/W Unknown | |
| 956 | Bit 4-7 Unused | |
| 957 | */ | |
| 958 | 958 | if ( data & 0x02 ) |
| 959 | 959 | { |
| 960 | 960 | pm_reg[0x37] = pm_reg[0x33]; |
| r5932 | r5933 | |
| 973 | 973 | } |
| 974 | 974 | break; |
| 975 | 975 | case 0x32: /* Timer 1 preset value (low) |
| 976 | Bit 0-7 R/W Timer 1 preset value bit 0-7 | |
| 977 | */ | |
| 976 | Bit 0-7 R/W Timer 1 preset value bit 0-7 | |
| 977 | */ | |
| 978 | 978 | break; |
| 979 | 979 | case 0x33: /* Timer 1 preset value (high) |
| 980 | Bit 0-7 R/W Timer 1 preset value bit 8-15 | |
| 981 | */ | |
| 980 | Bit 0-7 R/W Timer 1 preset value bit 8-15 | |
| 981 | */ | |
| 982 | 982 | break; |
| 983 | 983 | case 0x34: /* Timer 1 sound-pivot (low, unused) |
| 984 | ||
| 984 | */ | |
| 985 | 985 | case 0x35: /* Timer 1 sound-pivot (high, unused) |
| 986 | ||
| 986 | */ | |
| 987 | 987 | logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 988 | 988 | break; |
| 989 | 989 | case 0x36: /* Timer 1 counter (low), read only |
| 990 | ||
| 990 | */ | |
| 991 | 991 | return; |
| 992 | 992 | case 0x37: /* Timer 1 counter (high), read only |
| 993 | ||
| 993 | */ | |
| 994 | 994 | return; |
| 995 | 995 | case 0x38: /* Timer 2 control 1 |
| 996 | Bit 0 R/W Unknown | |
| 997 | Bit 1 W Reset low counter | |
| 998 | Bit 2 R/W Enable high counter | |
| 999 | Bit 3 R/W Unknown | |
| 1000 | Bit 4-6 Unused | |
| 1001 | Bit 7 R/W Enable 16bit mode | |
| 1002 | */ | |
| 996 | Bit 0 R/W Unknown | |
| 997 | Bit 1 W Reset low counter | |
| 998 | Bit 2 R/W Enable high counter | |
| 999 | Bit 3 R/W Unknown | |
| 1000 | Bit 4-6 Unused | |
| 1001 | Bit 7 R/W Enable 16bit mode | |
| 1002 | */ | |
| 1003 | 1003 | if ( data & 0x02 ) |
| 1004 | 1004 | { |
| 1005 | 1005 | pm_reg[0x3E] = pm_reg[0x3A]; |
| r5932 | r5933 | |
| 1028 | 1028 | } |
| 1029 | 1029 | break; |
| 1030 | 1030 | case 0x39: /* Timer 2 control 2 |
| 1031 | Bit 0 R/W Unknown | |
| 1032 | Bit 1 W Reset hi counter | |
| 1033 | Bit 2 R/W Enable high counter | |
| 1034 | Bit 3 R/W Unknown | |
| 1035 | Bit 4-7 Unused | |
| 1036 | */ | |
| 1031 | Bit 0 R/W Unknown | |
| 1032 | Bit 1 W Reset hi counter | |
| 1033 | Bit 2 R/W Enable high counter | |
| 1034 | Bit 3 R/W Unknown | |
| 1035 | Bit 4-7 Unused | |
| 1036 | */ | |
| 1037 | 1037 | if ( data & 0x02 ) |
| 1038 | 1038 | { |
| 1039 | 1039 | pm_reg[0x3F] = pm_reg[0x3A]; |
| r5932 | r5933 | |
| 1052 | 1052 | } |
| 1053 | 1053 | break; |
| 1054 | 1054 | case 0x3A: /* Timer 2 preset value (low) |
| 1055 | Bit 0-7 R/W Timer 2 preset value bit 0-7 | |
| 1056 | */ | |
| 1055 | Bit 0-7 R/W Timer 2 preset value bit 0-7 | |
| 1056 | */ | |
| 1057 | 1057 | break; |
| 1058 | 1058 | case 0x3B: /* Timer 2 preset value (high) |
| 1059 | Bit 0-7 R/W Timer 2 preset value bit 8-15 | |
| 1060 | */ | |
| 1059 | Bit 0-7 R/W Timer 2 preset value bit 8-15 | |
| 1060 | */ | |
| 1061 | 1061 | break; |
| 1062 | 1062 | case 0x3C: /* Timer 2 sound-pivot (low, unused) |
| 1063 | ||
| 1063 | */ | |
| 1064 | 1064 | case 0x3D: /* Timer 2 sound-pivot (high, unused) |
| 1065 | ||
| 1065 | */ | |
| 1066 | 1066 | logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 1067 | 1067 | break; |
| 1068 | 1068 | case 0x3E: /* Timer 2 counter (low), read only |
| 1069 | Bit 0-7 R/W Timer 2 counter value bit 0-7 | |
| 1070 | */ | |
| 1069 | Bit 0-7 R/W Timer 2 counter value bit 0-7 | |
| 1070 | */ | |
| 1071 | 1071 | return; |
| 1072 | 1072 | case 0x3F: /* Timer 2 counter (high), read only |
| 1073 | Bit 0-7 R/W Timer 2 counter value bit 8-15 | |
| 1074 | */ | |
| 1073 | Bit 0-7 R/W Timer 2 counter value bit 8-15 | |
| 1074 | */ | |
| 1075 | 1075 | return; |
| 1076 | 1076 | case 0x40: /* 256Hz timer control |
| 1077 | Bit 0 R/W Enable Timer | |
| 1078 | Bit 1 W Reset Timer | |
| 1079 | Bit 2-7 Unused | |
| 1080 | */ | |
| 1077 | Bit 0 R/W Enable Timer | |
| 1078 | Bit 1 W Reset Timer | |
| 1079 | Bit 2-7 Unused | |
| 1080 | */ | |
| 1081 | 1081 | if ( data & 0x02 ) |
| 1082 | 1082 | { |
| 1083 | 1083 | pm_reg[0x41] = 0; |
| r5932 | r5933 | |
| 1085 | 1085 | } |
| 1086 | 1086 | break; |
| 1087 | 1087 | case 0x41: /* 256Hz timer counter |
| 1088 | Bit 0-7 R 256Hz timer counter | |
| 1089 | */ | |
| 1088 | Bit 0-7 R 256Hz timer counter | |
| 1089 | */ | |
| 1090 | 1090 | return; |
| 1091 | 1091 | case 0x48: /* Timer 3 control 1 |
| 1092 | Bit 0 R/W Unknown | |
| 1093 | Bit 1 W Reset low counter | |
| 1094 | Bit 2 R/W Enable high counter | |
| 1095 | Bit 3 R/W Unknown | |
| 1096 | Bit 4-6 Unused | |
| 1097 | Bit 7 R/W Enable 16bit mode | |
| 1098 | */ | |
| 1092 | Bit 0 R/W Unknown | |
| 1093 | Bit 1 W Reset low counter | |
| 1094 | Bit 2 R/W Enable high counter | |
| 1095 | Bit 3 R/W Unknown | |
| 1096 | Bit 4-6 Unused | |
| 1097 | Bit 7 R/W Enable 16bit mode | |
| 1098 | */ | |
| 1099 | 1099 | if ( data & 0x02 ) |
| 1100 | 1100 | { |
| 1101 | 1101 | pm_reg[0x4E] = pm_reg[0x4A]; |
| r5932 | r5933 | |
| 1126 | 1126 | pokemini_update_sound( space->machine ); |
| 1127 | 1127 | break; |
| 1128 | 1128 | case 0x49: /* Timer 3 control 2 |
| 1129 | Bit 0 R/W Unknown | |
| 1130 | Bit 1 W Reset hi counter | |
| 1131 | Bit 2 R/W Enable high counter | |
| 1132 | Bit 3 R/W Unknown | |
| 1133 | Bit 4-7 Unused | |
| 1134 | */ | |
| 1129 | Bit 0 R/W Unknown | |
| 1130 | Bit 1 W Reset hi counter | |
| 1131 | Bit 2 R/W Enable high counter | |
| 1132 | Bit 3 R/W Unknown | |
| 1133 | Bit 4-7 Unused | |
| 1134 | */ | |
| 1135 | 1135 | if ( data & 0x02 ) |
| 1136 | 1136 | { |
| 1137 | 1137 | pm_reg[0x4F] = pm_reg[0x4B]; |
| r5932 | r5933 | |
| 1152 | 1152 | pokemini_update_sound( space->machine ); |
| 1153 | 1153 | break; |
| 1154 | 1154 | case 0x4A: /* Timer 3 preset value (low) |
| 1155 | Bit 0-7 R/W Timer 3 preset value bit 0-7 | |
| 1156 | */ | |
| 1155 | Bit 0-7 R/W Timer 3 preset value bit 0-7 | |
| 1156 | */ | |
| 1157 | 1157 | pm_reg[0x4A] = data; |
| 1158 | 1158 | pokemini_update_sound( space->machine ); |
| 1159 | 1159 | break; |
| 1160 | 1160 | case 0x4B: /* Timer 3 preset value (high) |
| 1161 | Bit 0-7 R/W Timer 3 preset value bit 8-15 | |
| 1162 | */ | |
| 1161 | Bit 0-7 R/W Timer 3 preset value bit 8-15 | |
| 1162 | */ | |
| 1163 | 1163 | pm_reg[0x4B] = data; |
| 1164 | 1164 | pokemini_update_sound( space->machine ); |
| 1165 | 1165 | break; |
| 1166 | 1166 | case 0x4C: /* Timer 3 sound-pivot (low) |
| 1167 | Bit 0-7 R/W Timer 3 sound-pivot value bit 0-7 | |
| 1168 | */ | |
| 1167 | Bit 0-7 R/W Timer 3 sound-pivot value bit 0-7 | |
| 1168 | */ | |
| 1169 | 1169 | pm_reg[0x4C] = data; |
| 1170 | 1170 | pokemini_update_sound( space->machine ); |
| 1171 | 1171 | break; |
| 1172 | 1172 | case 0x4D: /* Timer 3 sound-pivot (high) |
| 1173 | ||
| 1173 | Bit 0-7 R/W Timer 3 sound-pivot value bit 8-15 | |
| 1174 | 1174 | |
| 1175 | Sound-pivot location: | |
| 1176 | Pulse-Width of 0% = 0x0000 | |
| 1177 | Pulse-Width of 50% = Half of preset-value | |
| 1178 | Pulse-Width of 100% = Same as preset-value | |
| 1179 | */ | |
| 1175 | Sound-pivot location: | |
| 1176 | Pulse-Width of 0% = 0x0000 | |
| 1177 | Pulse-Width of 50% = Half of preset-value | |
| 1178 | Pulse-Width of 100% = Same as preset-value | |
| 1179 | */ | |
| 1180 | 1180 | pm_reg[0x4D] = data; |
| 1181 | 1181 | pokemini_update_sound( space->machine ); |
| 1182 | 1182 | break; |
| 1183 | 1183 | case 0x4E: /* Timer 3 counter (low), read only |
| 1184 | Bit 0-7 R/W Timer 3 counter value bit 0-7 | |
| 1185 | */ | |
| 1184 | Bit 0-7 R/W Timer 3 counter value bit 0-7 | |
| 1185 | */ | |
| 1186 | 1186 | return; |
| 1187 | 1187 | case 0x4F: /* Timer 3 counter (high), read only |
| 1188 | Bit 0-7 R/W Timer 3 counter value bit 8-15 | |
| 1189 | */ | |
| 1188 | Bit 0-7 R/W Timer 3 counter value bit 8-15 | |
| 1189 | */ | |
| 1190 | 1190 | return; |
| 1191 | 1191 | case 0x52: /* Keypad status |
| 1192 | Bit 0 R Key "A" | |
| 1193 | Bit 1 R Key "B" | |
| 1194 | Bit 2 R Key "C" | |
| 1195 | Bit 3 R D-pad up | |
| 1196 | Bit 4 R D-pad down | |
| 1197 | Bit 5 R D-pad left | |
| 1198 | Bit 6 R D-pad right | |
| 1199 | Bit 7 R Power button | |
| 1200 | */ | |
| 1192 | Bit 0 R Key "A" | |
| 1193 | Bit 1 R Key "B" | |
| 1194 | Bit 2 R Key "C" | |
| 1195 | Bit 3 R D-pad up | |
| 1196 | Bit 4 R D-pad down | |
| 1197 | Bit 5 R D-pad left | |
| 1198 | Bit 6 R D-pad right | |
| 1199 | Bit 7 R Power button | |
| 1200 | */ | |
| 1201 | 1201 | return; |
| 1202 | 1202 | case 0x60: /* I/O peripheral circuit select |
| 1203 | Bit 0 R/W Unknown | |
| 1204 | bit 1 R/W IR receive / transmit | |
| 1205 | Bit 2 R/W EEPROM / RTC data | |
| 1206 | Bit 3 R/W EEPROM / RTC clock | |
| 1207 | Bit 4 R/W Rumble controller | |
| 1208 | Bit 5 R/W IR enable/disable | |
| 1209 | Bit 6 R/W Unknown | |
| 1210 | Bit 7 R/W Unknown | |
| 1211 | */ | |
| 1203 | Bit 0 R/W Unknown | |
| 1204 | bit 1 R/W IR receive / transmit | |
| 1205 | Bit 2 R/W EEPROM / RTC data | |
| 1206 | Bit 3 R/W EEPROM / RTC clock | |
| 1207 | Bit 4 R/W Rumble controller | |
| 1208 | Bit 5 R/W IR enable/disable | |
| 1209 | Bit 6 R/W Unknown | |
| 1210 | Bit 7 R/W Unknown | |
| 1211 | */ | |
| 1212 | 1212 | break; |
| 1213 | 1213 | case 0x61: /* I/O peripheral status control |
| 1214 | Bit 0 R/W IR received bit (if device not selected: 0) | |
| 1215 | Bit 1 R/W IR transmit (if device not selected: 0) | |
| 1216 | Bit 2 R/W EEPROM / RTC data (if device not selected: 1) | |
| 1217 | Bit 3 R/W EEPROM / RTC clock (if device not selected: 0) | |
| 1218 | Bit 4 R/W Rumble on/off (if device not selected: 0) | |
| 1219 | Bit 5 R/W IR disable (receive & transmit) (if device not selected: 1) | |
| 1220 | Bit 6 Always 1 | |
| 1221 | Bit 7 R/W IR received bit (mirror, if device not selected: 0) | |
| 1222 | */ | |
| 1214 | Bit 0 R/W IR received bit (if device not selected: 0) | |
| 1215 | Bit 1 R/W IR transmit (if device not selected: 0) | |
| 1216 | Bit 2 R/W EEPROM / RTC data (if device not selected: 1) | |
| 1217 | Bit 3 R/W EEPROM / RTC clock (if device not selected: 0) | |
| 1218 | Bit 4 R/W Rumble on/off (if device not selected: 0) | |
| 1219 | Bit 5 R/W IR disable (receive & transmit) (if device not selected: 1) | |
| 1220 | Bit 6 Always 1 | |
| 1221 | Bit 7 R/W IR received bit (mirror, if device not selected: 0) | |
| 1222 | */ | |
| 1223 | 1223 | if ( pm_reg[0x60] & 0x04 ) |
| 1224 | 1224 | i2cmem_write( space->machine, 0, I2CMEM_SDA, ( data & 0x04 ) ? 1 : 0 ); |
| 1225 | 1225 | |
| r5932 | r5933 | |
| 1231 | 1231 | pokemini_update_sound( space->machine ); |
| 1232 | 1232 | break; |
| 1233 | 1233 | case 0x71: /* Sound volume |
| 1234 | Bit 0-1 R/W Sound volume | |
| 1235 | 00 - 0% | |
| 1236 | 01 - 50% | |
| 1237 | 10 - 50% | |
| 1238 | 11 - 100% | |
| 1239 | Bit 2 R/W Always set to 0 | |
| 1240 | Bit 3-7 Unused | |
| 1241 | */ | |
| 1234 | Bit 0-1 R/W Sound volume | |
| 1235 | 00 - 0% | |
| 1236 | 01 - 50% | |
| 1237 | 10 - 50% | |
| 1238 | 11 - 100% | |
| 1239 | Bit 2 R/W Always set to 0 | |
| 1240 | Bit 3-7 Unused | |
| 1241 | */ | |
| 1242 | 1242 | pm_reg[0x71] = data; |
| 1243 | 1243 | pokemini_update_sound( space->machine ); |
| 1244 | 1244 | break; |
| 1245 | 1245 | case 0x80: /* LCD control |
| 1246 | Bit 0 R/W Invert colors; 0 - normal, 1 - inverted | |
| 1247 | Bit 1 R/W Enable rendering of background | |
| 1248 | Bit 2 R/W Enable rendering of sprites | |
| 1249 | Bit 3 R/W Enable copy to LCD ram | |
| 1250 | Bit 4-5 R/W Map size | |
| 1251 | 00 - 12x16 | |
| 1252 | 01 - 16x12 | |
| 1253 | 10 - 24x8 | |
| 1254 | 11 - 24x8 (prohibited code) | |
| 1255 | Bit 6-7 Unused | |
| 1256 | */ | |
| 1246 | Bit 0 R/W Invert colors; 0 - normal, 1 - inverted | |
| 1247 | Bit 1 R/W Enable rendering of background | |
| 1248 | Bit 2 R/W Enable rendering of sprites | |
| 1249 | Bit 3 R/W Enable copy to LCD ram | |
| 1250 | Bit 4-5 R/W Map size | |
| 1251 | 00 - 12x16 | |
| 1252 | 01 - 16x12 | |
| 1253 | 10 - 24x8 | |
| 1254 | 11 - 24x8 (prohibited code) | |
| 1255 | Bit 6-7 Unused | |
| 1256 | */ | |
| 1257 | 1257 | prc.colors_inverted = ( data & 0x01 ) ? 1 : 0; |
| 1258 | 1258 | prc.background_enabled = ( data & 0x02 ) ? 1 : 0; |
| 1259 | 1259 | prc.sprites_enabled = ( data & 0x04 ) ? 1 : 0; |
| r5932 | r5933 | |
| 1271 | 1271 | } |
| 1272 | 1272 | break; |
| 1273 | 1273 | case 0x81: /* LCD render refresh rate |
| 1274 | Bit 0 R/W Unknown | |
| 1275 | Bit 1-3 R/W LCD refresh rate divider | |
| 1276 | 000 - 60Hz / 3 = 20Hz (0 - 2) | |
| 1277 | 001 - 60Hz / 6 = 10Hz (0 - 5) | |
| 1278 | 010 - 60Hz / 9 = 6,6Hz (0 - 8) | |
| 1279 | 011 - 60Hz / 12 = 5Hz (0 - B) | |
| 1280 | 100 - 60Hz / 2 = 30Hz (0 - 1) | |
| 1281 | 101 - 60Hz / 4 = 15Hz (0 - 3) | |
| 1282 | 110 - 60Hz / 6 = 10Hz (0 - 5) | |
| 1283 | 111 - 60Hz / 8 = 7,5Hz (0 - 7) | |
| 1284 | Bit 4-7 R Divider position, when overflow the LCD is updated | |
| 1285 | */ | |
| 1274 | Bit 0 R/W Unknown | |
| 1275 | Bit 1-3 R/W LCD refresh rate divider | |
| 1276 | 000 - 60Hz / 3 = 20Hz (0 - 2) | |
| 1277 | 001 - 60Hz / 6 = 10Hz (0 - 5) | |
| 1278 | 010 - 60Hz / 9 = 6,6Hz (0 - 8) | |
| 1279 | 011 - 60Hz / 12 = 5Hz (0 - B) | |
| 1280 | 100 - 60Hz / 2 = 30Hz (0 - 1) | |
| 1281 | 101 - 60Hz / 4 = 15Hz (0 - 3) | |
| 1282 | 110 - 60Hz / 6 = 10Hz (0 - 5) | |
| 1283 | 111 - 60Hz / 8 = 7,5Hz (0 - 7) | |
| 1284 | Bit 4-7 R Divider position, when overflow the LCD is updated | |
| 1285 | */ | |
| 1286 | 1286 | switch ( data & 0x0E ) |
| 1287 | 1287 | { |
| 1288 | 1288 | case 0x00: prc.max_frame_count = 3; break; |
| r5932 | r5933 | |
| 1296 | 1296 | } |
| 1297 | 1297 | break; |
| 1298 | 1298 | case 0x82: /* BG tile data memory offset (low) |
| 1299 | Bit 0-2 Always "0" | |
| 1300 | Bit 3-7 R/W BG tile data memory offset bit 3-7 | |
| 1301 | */ | |
| 1299 | Bit 0-2 Always "0" | |
| 1300 | Bit 3-7 R/W BG tile data memory offset bit 3-7 | |
| 1301 | */ | |
| 1302 | 1302 | data &= 0xF8; |
| 1303 | 1303 | prc.bg_tiles = ( prc.bg_tiles & 0xFFFF00 ) | data; |
| 1304 | 1304 | break; |
| 1305 | 1305 | case 0x83: /* BG tile data memory offset (mid) |
| 1306 | Bit 0-7 R/W BG tile data memory offset bit 8-15 | |
| 1307 | */ | |
| 1306 | Bit 0-7 R/W BG tile data memory offset bit 8-15 | |
| 1307 | */ | |
| 1308 | 1308 | prc.bg_tiles = ( prc.bg_tiles & 0xFF00FF ) | ( data << 8 ); |
| 1309 | 1309 | break; |
| 1310 | 1310 | case 0x84: /* BG tile data memory offset (high) |
| 1311 | Bit 0-4 R/W BG tile data memory offset bit 16-20 | |
| 1312 | Bit 5-7 Unused | |
| 1313 | */ | |
| 1311 | Bit 0-4 R/W BG tile data memory offset bit 16-20 | |
| 1312 | Bit 5-7 Unused | |
| 1313 | */ | |
| 1314 | 1314 | data &= 0x1F; |
| 1315 | 1315 | prc.bg_tiles = ( prc.bg_tiles & 0x00FFFF ) | ( data << 16 ); |
| 1316 | 1316 | break; |
| 1317 | 1317 | case 0x85: /* BG vertical move |
| 1318 | Bit 0-6 R/W Move the background up, move range: | |
| 1319 | Map size 0: 0x00 to 0x40 | |
| 1320 | Map size 1: 0x00 to 0x20 | |
| 1321 | Map size 2: move ignored | |
| 1322 | Bit 7 Unused | |
| 1323 | */ | |
| 1318 | Bit 0-6 R/W Move the background up, move range: | |
| 1319 | Map size 0: 0x00 to 0x40 | |
| 1320 | Map size 1: 0x00 to 0x20 | |
| 1321 | Map size 2: move ignored | |
| 1322 | Bit 7 Unused | |
| 1323 | */ | |
| 1324 | 1324 | case 0x86: /* BG horizontal move |
| 1325 | Bit 0-6 R/W Move the background left, move range: | |
| 1326 | Map size 0: move ignored | |
| 1327 | Map size 1: 0x00 to 0x20 | |
| 1328 | Map size 2: 0x00 to 0x60 | |
| 1329 | Bit 7 Unused | |
| 1330 | */ | |
| 1325 | Bit 0-6 R/W Move the background left, move range: | |
| 1326 | Map size 0: move ignored | |
| 1327 | Map size 1: 0x00 to 0x20 | |
| 1328 | Map size 2: 0x00 to 0x60 | |
| 1329 | Bit 7 Unused | |
| 1330 | */ | |
| 1331 | 1331 | logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 1332 | 1332 | break; |
| 1333 | 1333 | case 0x87: /* Sprite tile data memory offset (low) |
| 1334 | Bit 0-5 Always "0" | |
| 1335 | Bit 6-7 R/W Sprite tile data memory offset bit 6-7 | |
| 1336 | */ | |
| 1334 | Bit 0-5 Always "0" | |
| 1335 | Bit 6-7 R/W Sprite tile data memory offset bit 6-7 | |
| 1336 | */ | |
| 1337 | 1337 | data &= 0xC0; |
| 1338 | 1338 | prc.spr_tiles = ( prc.spr_tiles & 0xFFFF00 ) | data; |
| 1339 | 1339 | break; |
| 1340 | 1340 | case 0x88: /* Sprite tile data memory offset (med) |
| 1341 | Bit 0-7 R/W Sprite tile data memory offset bit 8-15 | |
| 1342 | */ | |
| 1341 | Bit 0-7 R/W Sprite tile data memory offset bit 8-15 | |
| 1342 | */ | |
| 1343 | 1343 | prc.spr_tiles = ( prc.spr_tiles & 0xFF00FF ) | ( data << 8 ); |
| 1344 | 1344 | break; |
| 1345 | 1345 | case 0x89: /* Sprite tile data memory offset (high) |
| 1346 | Bit 0-4 R/W Sprite tile data memory offset bit 16-20 | |
| 1347 | Bit 5-7 Unused | |
| 1348 | */ | |
| 1346 | Bit 0-4 R/W Sprite tile data memory offset bit 16-20 | |
| 1347 | Bit 5-7 Unused | |
| 1348 | */ | |
| 1349 | 1349 | data &= 0x1F; |
| 1350 | 1350 | prc.spr_tiles = ( prc.spr_tiles & 0x00FFFF ) | ( data << 16 ); |
| 1351 | 1351 | break; |
| 1352 | 1352 | case 0x8A: /* LCD status |
| 1353 | Bit 0 R Unknown | |
| 1354 | Bit 1 R Unknown | |
| 1355 | Bit 2 R Unknown | |
| 1356 | Bit 3 R Unknown | |
| 1357 | Bit 4 R LCD during V-Sync / Rendering circuitry active or not ( 1 = not active) | |
| 1358 | Bit 5 R Unknown | |
| 1359 | Bit 6-7 Unused | |
| 1360 | */ | |
| 1353 | Bit 0 R Unknown | |
| 1354 | Bit 1 R Unknown | |
| 1355 | Bit 2 R Unknown | |
| 1356 | Bit 3 R Unknown | |
| 1357 | Bit 4 R LCD during V-Sync / Rendering circuitry active or not ( 1 = not active) | |
| 1358 | Bit 5 R Unknown | |
| 1359 | Bit 6-7 Unused | |
| 1360 | */ | |
| 1361 | 1361 | case 0xFE: /* Direct LCD control / data |
| 1362 | Bit 0-7 R/W Direct LCD command or data | |
| 1363 | */ | |
| 1364 | // lcd_command_w( data ); | |
| 1362 | Bit 0-7 R/W Direct LCD command or data | |
| 1363 | */ | |
| 1364 | // lcd_command_w( data ); | |
| 1365 | 1365 | break; |
| 1366 | 1366 | case 0xFF: /* Direct LCD data |
| 1367 | Bit 0-7 R/W Direct LCD data | |
| 1368 | */ | |
| 1369 | // lcd_data_w( data ); | |
| 1367 | Bit 0-7 R/W Direct LCD data | |
| 1368 | */ | |
| 1369 | // lcd_data_w( data ); | |
| 1370 | 1370 | break; |
| 1371 | 1371 | default: |
| 1372 | 1372 | logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | Ricoh RP5C15 Real-time Clock | |
| 4 | Written by Barry Rodewald | |
| 5 | Started 04/07/07 | |
| 3 | Ricoh RP5C15 Real-time Clock | |
| 4 | Written by Barry Rodewald | |
| 5 | Started 04/07/07 | |
| 6 | 6 | |
| 7 | Registers are separated into two banks, switchable through | |
| 8 | the LSB of the MODE register. | |
| 7 | Registers are separated into two banks, switchable through | |
| 8 | the LSB of the MODE register. | |
| 9 | 9 | |
| 10 | ||
| 10 | Date and time are stored in BCD, one digit to each register | |
| 11 | 11 | |
| 12 | Register BANK 0 BANK 1 | |
| 13 | 0 Timer seconds CLKOUT | |
| 14 | 1 Timer seconds (10s) RTC Adjustment | |
| 15 | 2 Timer minutes Alarm minutes | |
| 16 | 3 Timer minutes (10s) Alarm minutes (10s) | |
| 17 | 4 Timer hours Alarm hours | |
| 18 | 5 Timer hours (10s) Alarm hours (10s) | |
| 19 | 6 Timer day-of-week Alarm day-of-week | |
| 20 | 7 Timer day Alarm day | |
| 21 | 8 Timer day (10s) Alarm day (10s) | |
| 22 | 9 Timer month (unused) | |
| 23 | 10 Timer month (10s) 12/24 hour clock selection | |
| 24 | 11 Timer year Years until next leap year | |
| 25 | 12 Timer year (10s) (unused) | |
| 26 | 13 MODE register MODE register | |
| 27 | 14 TEST register TEST register | |
| 28 | 15 RESET register RESET register | |
| 12 | Register BANK 0 BANK 1 | |
| 13 | 0 Timer seconds CLKOUT | |
| 14 | 1 Timer seconds (10s) RTC Adjustment | |
| 15 | 2 Timer minutes Alarm minutes | |
| 16 | 3 Timer minutes (10s) Alarm minutes (10s) | |
| 17 | 4 Timer hours Alarm hours | |
| 18 | 5 Timer hours (10s) Alarm hours (10s) | |
| 19 | 6 Timer day-of-week Alarm day-of-week | |
| 20 | 7 Timer day Alarm day | |
| 21 | 8 Timer day (10s) Alarm day (10s) | |
| 22 | 9 Timer month (unused) | |
| 23 | 10 Timer month (10s) 12/24 hour clock selection | |
| 24 | 11 Timer year Years until next leap year | |
| 25 | 12 Timer year (10s) (unused) | |
| 26 | 13 MODE register MODE register | |
| 27 | 14 TEST register TEST register | |
| 28 | 15 RESET register RESET register | |
| 29 | 29 | |
| 30 | 30 | |
| 31 | CLKOUT (W/O) - on the X68000, this is connected to the Timer LED | |
| 32 | xxxxx000 = always high (on) | |
| 33 | xxxxx001 = 16384Hz | |
| 34 | xxxxx010 = 1024Hz | |
| 35 | xxxxx011 = 128Hz | |
| 36 | xxxxx100 = 16Hz | |
| 37 | xxxxx101 = 1Hz | |
| 38 | xxxxx110 = 1/60Hz | |
| 39 | xxxxx111 = always low (off) | |
| 31 | CLKOUT (W/O) - on the X68000, this is connected to the Timer LED | |
| 32 | xxxxx000 = always high (on) | |
| 33 | xxxxx001 = 16384Hz | |
| 34 | xxxxx010 = 1024Hz | |
| 35 | xxxxx011 = 128Hz | |
| 36 | xxxxx100 = 16Hz | |
| 37 | xxxxx101 = 1Hz | |
| 38 | xxxxx110 = 1/60Hz | |
| 39 | xxxxx111 = always low (off) | |
| 40 | 40 | |
| 41 | Adjustment register (R/W) | |
| 42 | bit 0 = if set, will reset the seconds to zero, and if the | |
| 43 | seconds were > 30, increment the minutes by 1. | |
| 44 | Always returns 0. | |
| 41 | Adjustment register (R/W) | |
| 42 | bit 0 = if set, will reset the seconds to zero, and if the | |
| 43 | seconds were > 30, increment the minutes by 1. | |
| 44 | Always returns 0. | |
| 45 | 45 | |
| 46 | 12/24 hour clock register (R/W) (not implemented yet) | |
| 47 | bit 0 = selects 12 or 24 hour clock | |
| 48 | presumably, on reading, returns AM/PM status. | |
| 46 | 12/24 hour clock register (R/W) (not implemented yet) | |
| 47 | bit 0 = selects 12 or 24 hour clock | |
| 48 | presumably, on reading, returns AM/PM status. | |
| 49 | 49 | |
| 50 | Leap year register | |
| 51 | bit 0,1 = returns number of years until next leap year. | |
| 52 | Is simply year % 4. | |
| 50 | Leap year register | |
| 51 | bit 0,1 = returns number of years until next leap year. | |
| 52 | Is simply year % 4. | |
| 53 | 53 | |
| 54 | MODE register (R/W) | |
| 55 | bit 0 = if set, selects BANK 1, if reset, selects BANK 0 | |
| 56 | bit 2 = Alarm enable | |
| 57 | bit 3 = Timer enable | |
| 54 | MODE register (R/W) | |
| 55 | bit 0 = if set, selects BANK 1, if reset, selects BANK 0 | |
| 56 | bit 2 = Alarm enable | |
| 57 | bit 3 = Timer enable | |
| 58 | 58 | |
| 59 | TEST register (not implemented yet) | |
| 60 | bits 0-3 = generally all set to 0, use is unknown. | |
| 59 | TEST register (not implemented yet) | |
| 60 | bits 0-3 = generally all set to 0, use is unknown. | |
| 61 | 61 | |
| 62 | RESET register (not implemented yet) | |
| 63 | bit 0 = Alarm reset | |
| 64 | bit 1 = Timer reset | |
| 65 | bit 2 = if set, 16Hz pulse is off | |
| 66 | bit 3 = if set, 1Hz pulse is off | |
| 62 | RESET register (not implemented yet) | |
| 63 | bit 0 = Alarm reset | |
| 64 | bit 1 = Timer reset | |
| 65 | bit 2 = if set, 16Hz pulse is off | |
| 66 | bit 3 = if set, 1Hz pulse is off | |
| 67 | 67 | |
| 68 | 68 | */ |
| 69 | 69 |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | I/O ports) |
| 7 | 7 | |
| 8 | 8 | References: |
| 9 | There are two main references for the info for this driver | |
| 10 | - Tandy Color Computer Unravelled Series | |
| 11 | (http://www.giftmarket.org/unravelled/unravelled.shtml) | |
| 12 | - Assembly Language Programming For the CoCo 3 by Laurence A. Tepolt | |
| 13 | - Kevin K. Darlings GIME reference | |
| 14 | (http://www.cris.com/~Alxevans/gime.txt) | |
| 15 | - Sock Masters's GIME register reference | |
| 16 | (http://www.axess.com/twilight/sock/gime.html) | |
| 17 | - Robert Gault's FAQ | |
| 18 | (http://home.att.net/~robert.gault/Coco/FAQ/FAQ_main.htm) | |
| 19 | - Discussions with L. Curtis Boyle (LCB) and John Kowalski (JK) | |
| 9 | There are two main references for the info for this driver | |
| 10 | - Tandy Color Computer Unravelled Series | |
| 11 | (http://www.giftmarket.org/unravelled/unravelled.shtml) | |
| 12 | - Assembly Language Programming For the CoCo 3 by Laurence A. Tepolt | |
| 13 | - Kevin K. Darlings GIME reference | |
| 14 | (http://www.cris.com/~Alxevans/gime.txt) | |
| 15 | - Sock Masters's GIME register reference | |
| 16 | (http://www.axess.com/twilight/sock/gime.html) | |
| 17 | - Robert Gault's FAQ | |
| 18 | (http://home.att.net/~robert.gault/Coco/FAQ/FAQ_main.htm) | |
| 19 | - Discussions with L. Curtis Boyle (LCB) and John Kowalski (JK) | |
| 20 | 20 | |
| 21 | 21 | TODO: |
| 22 | - Implement unimplemented SAM registers | |
| 23 | - Implement unimplemented interrupts (serial) | |
| 24 | - Choose and implement more appropriate ratios for the speed up poke | |
| 25 | - Handle resets correctly | |
| 22 | - Implement unimplemented SAM registers | |
| 23 | - Implement unimplemented interrupts (serial) | |
| 24 | - Choose and implement more appropriate ratios for the speed up poke | |
| 25 | - Handle resets correctly | |
| 26 | 26 | |
| 27 | 27 | In the CoCo, all timings should be exactly relative to each other. This |
| 28 | 28 | table shows how all clocks are relative to each other (info: JK): |
| 29 | - Main CPU Clock 0.89 MHz | |
| 30 | - Horizontal Sync Interrupt 15.7 kHz/63.5us (57 clock cycles) | |
| 31 | - Vertical Sync Interrupt 60 Hz (14934 clock cycles) | |
| 32 | - Composite Video Color Carrier 3.58 MHz/279ns (1/4 clock cycles) | |
| 29 | - Main CPU Clock 0.89 MHz | |
| 30 | - Horizontal Sync Interrupt 15.7 kHz/63.5us (57 clock cycles) | |
| 31 | - Vertical Sync Interrupt 60 Hz (14934 clock cycles) | |
| 32 | - Composite Video Color Carrier 3.58 MHz/279ns (1/4 clock cycles) | |
| 33 | 33 | |
| 34 | 34 | It is also noting that the CoCo 3 had two sets of VSync interrupts. To quote |
| 35 | 35 | John Kowalski: |
| 36 | 36 | |
| 37 | One other thing to mention is that the old vertical interrupt and the new | |
| 38 | vertical interrupt are not the same.. The old one is triggered by the | |
| 39 | video's vertical sync pulse, but the new one is triggered on the next scan | |
| 40 | line *after* the last scan line of the active video display. That is : new | |
| 41 | vertical interrupt triggers somewheres around scan line 230 of the 262 line | |
| 42 | screen (if a 200 line graphics mode is used, a bit earlier if a 192 line | |
| 43 | mode is used and a bit later if a 225 line mode is used). The old vsync | |
| 44 | interrupt triggers on scanline zero. | |
| 37 | One other thing to mention is that the old vertical interrupt and the new | |
| 38 | vertical interrupt are not the same.. The old one is triggered by the | |
| 39 | video's vertical sync pulse, but the new one is triggered on the next scan | |
| 40 | line *after* the last scan line of the active video display. That is : new | |
| 41 | vertical interrupt triggers somewheres around scan line 230 of the 262 line | |
| 42 | screen (if a 200 line graphics mode is used, a bit earlier if a 192 line | |
| 43 | mode is used and a bit later if a 225 line mode is used). The old vsync | |
| 44 | interrupt triggers on scanline zero. | |
| 45 | 45 | |
| 46 | 230 is just an estimate [(262-200)/2+200]. I don't think the active part | |
| 47 | of the screen is exactly centered within the 262 line total. I can | |
| 48 | research that for you if you want an exact number for scanlines before the | |
| 49 | screen starts and the scanline that the v-interrupt triggers..etc. | |
| 46 | 230 is just an estimate [(262-200)/2+200]. I don't think the active part | |
| 47 | of the screen is exactly centered within the 262 line total. I can | |
| 48 | research that for you if you want an exact number for scanlines before the | |
| 49 | screen starts and the scanline that the v-interrupt triggers..etc. | |
| 50 | 50 | |
| 51 | 51 | Dragon Alpha code added 21-Oct-2004, |
| 52 | ||
| 52 | Phill Harvey-Smith (afra@aurigae.demon.co.uk) | |
| 53 | 53 | |
| 54 | ||
| 54 | Added AY-8912 and FDC code 30-Oct-2004. | |
| 55 | 55 | |
| 56 | 56 | Fixed Dragon Alpha NMI enable/disable, following circuit traces on a real machine. |
| 57 | ||
| 57 | P.Harvey-Smith, 11-Aug-2005. | |
| 58 | 58 | |
| 59 | 59 | Re-implemented Alpha NMI enable/disable, using direct PIA reads, rather than |
| 60 | 60 | keeping track of it in a variable in the driver. |
| 61 | ||
| 61 | P.Harvey-Smith, 25-Sep-2006. | |
| 62 | 62 | |
| 63 | 63 | Radically re-wrote memory emulation code for CoCo 1/2 & Dragon machines, the |
| 64 | 64 | new code emulates the memory mapping of the SAM, dependent on what size of |
| r5932 | r5933 | |
| 75 | 75 | the CoCo 1/2 should stay in coco.c, and that the coco3 and dragon specifc code |
| 76 | 76 | should go into coco3.c and dragon.c which should (hopefully) make the code |
| 77 | 77 | easier to manage. |
| 78 | ||
| 78 | P.Harvey-Smith, Dec 2006-Feb 2007 | |
| 79 | 79 | ***************************************************************************/ |
| 80 | 80 | |
| 81 | 81 | #include <math.h> |
| r5932 | r5933 | |
| 238 | 238 | * Notes of interest: Below are some observations of key programs and what |
| 239 | 239 | * they rely on: |
| 240 | 240 | * |
| 241 | * COLOR3: | |
| 242 | * (fs_pia_flip ? fall_scanline : rise_scanline) = border_top - 32 | |
| 241 | * COLOR3: | |
| 242 | * (fs_pia_flip ? fall_scanline : rise_scanline) = border_top - 32 | |
| 243 | 243 | */ |
| 244 | 244 | |
| 245 | 245 | const struct coco3_video_vars coco3_vidvars = |
| r5932 | r5933 | |
| 271 | 271 | DEVCB_NULL, |
| 272 | 272 | DEVCB_NULL, |
| 273 | 273 | DEVCB_NULL, |
| 274 | /*outputs: A/B,CA/B2 | |
| 274 | /*outputs: A/B,CA/B2 */ | |
| 275 | 275 | DEVCB_HANDLER(d_pia0_pa_w), |
| 276 | 276 | DEVCB_HANDLER(d_pia0_pb_w), |
| 277 | 277 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 278 | 278 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 279 | /*irqs | |
| 279 | /*irqs | |
| 280 | 280 | DEVCB_LINE(d_pia0_irq_a), |
| 281 | 281 | DEVCB_LINE(d_pia0_irq_b) |
| 282 | 282 | }; |
| r5932 | r5933 | |
| 291 | 291 | DEVCB_NULL, |
| 292 | 292 | DEVCB_NULL, |
| 293 | 293 | DEVCB_NULL, |
| 294 | /*outputs: A/B,CA/B2 | |
| 294 | /*outputs: A/B,CA/B2 */ | |
| 295 | 295 | DEVCB_HANDLER(d_pia1_pa_w), |
| 296 | 296 | DEVCB_HANDLER(d_pia1_pb_w), |
| 297 | 297 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 298 | 298 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 299 | /*irqs | |
| 299 | /*irqs | |
| 300 | 300 | DEVCB_LINE(d_pia1_firq_a), |
| 301 | 301 | DEVCB_LINE(d_pia1_firq_b) |
| 302 | 302 | }; |
| r5932 | r5933 | |
| 311 | 311 | DEVCB_NULL, |
| 312 | 312 | DEVCB_NULL, |
| 313 | 313 | DEVCB_NULL, |
| 314 | /*outputs: A/B,CA/B2 | |
| 314 | /*outputs: A/B,CA/B2 */ | |
| 315 | 315 | DEVCB_HANDLER(d_pia0_pa_w), |
| 316 | 316 | DEVCB_HANDLER(d_pia0_pb_w), |
| 317 | 317 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 318 | 318 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 319 | /*irqs | |
| 319 | /*irqs | |
| 320 | 320 | DEVCB_LINE(d_pia0_irq_a), |
| 321 | 321 | DEVCB_LINE(d_pia0_irq_b) |
| 322 | 322 | }; |
| r5932 | r5933 | |
| 331 | 331 | DEVCB_NULL, |
| 332 | 332 | DEVCB_NULL, |
| 333 | 333 | DEVCB_NULL, |
| 334 | /*outputs: A/B,CA/B2 | |
| 334 | /*outputs: A/B,CA/B2 */ | |
| 335 | 335 | DEVCB_HANDLER(d_pia1_pa_w), |
| 336 | 336 | DEVCB_HANDLER(d_pia1_pb_w_coco2), |
| 337 | 337 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 338 | 338 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 339 | /*irqs | |
| 339 | /*irqs | |
| 340 | 340 | DEVCB_LINE(d_pia1_firq_a), |
| 341 | 341 | DEVCB_LINE(d_pia1_firq_b) |
| 342 | 342 | }; |
| r5932 | r5933 | |
| 351 | 351 | DEVCB_NULL, |
| 352 | 352 | DEVCB_NULL, |
| 353 | 353 | DEVCB_NULL, |
| 354 | /*outputs: A/B,CA/B2 | |
| 354 | /*outputs: A/B,CA/B2 */ | |
| 355 | 355 | DEVCB_HANDLER(d_pia0_pa_w), |
| 356 | 356 | DEVCB_HANDLER(d_pia0_pb_w), |
| 357 | 357 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 358 | 358 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 359 | /*irqs | |
| 359 | /*irqs | |
| 360 | 360 | DEVCB_LINE(coco3_pia0_irq_a), |
| 361 | 361 | DEVCB_LINE(coco3_pia0_irq_b) |
| 362 | 362 | }; |
| r5932 | r5933 | |
| 371 | 371 | DEVCB_NULL, |
| 372 | 372 | DEVCB_NULL, |
| 373 | 373 | DEVCB_NULL, |
| 374 | /*outputs: A/B,CA/B2 | |
| 374 | /*outputs: A/B,CA/B2 */ | |
| 375 | 375 | DEVCB_HANDLER(d_pia1_pa_w), |
| 376 | 376 | DEVCB_HANDLER(d_pia1_pb_w), |
| 377 | 377 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 378 | 378 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 379 | /*irqs | |
| 379 | /*irqs | |
| 380 | 380 | DEVCB_LINE(coco3_pia1_firq_a), |
| 381 | 381 | DEVCB_LINE(coco3_pia1_firq_b) |
| 382 | 382 | }; |
| r5932 | r5933 | |
| 391 | 391 | DEVCB_NULL, |
| 392 | 392 | DEVCB_NULL, |
| 393 | 393 | DEVCB_NULL, |
| 394 | /*outputs: A/B,CA/B2 | |
| 394 | /*outputs: A/B,CA/B2 */ | |
| 395 | 395 | DEVCB_HANDLER(d_pia0_pa_w), |
| 396 | 396 | DEVCB_HANDLER(d_pia0_pb_w), |
| 397 | 397 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 398 | 398 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 399 | /*irqs | |
| 399 | /*irqs | |
| 400 | 400 | DEVCB_LINE(d_pia0_irq_a), |
| 401 | 401 | DEVCB_LINE(d_pia0_irq_b) |
| 402 | 402 | }; |
| r5932 | r5933 | |
| 411 | 411 | DEVCB_NULL, |
| 412 | 412 | DEVCB_NULL, |
| 413 | 413 | DEVCB_NULL, |
| 414 | /*outputs: A/B,CA/B2 | |
| 414 | /*outputs: A/B,CA/B2 */ | |
| 415 | 415 | DEVCB_HANDLER(d_pia1_pa_w), |
| 416 | 416 | DEVCB_HANDLER(d_pia1_pb_w), |
| 417 | 417 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 418 | 418 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 419 | /*irqs | |
| 419 | /*irqs | |
| 420 | 420 | DEVCB_LINE(d_pia1_firq_a), |
| 421 | 421 | DEVCB_LINE(d_pia1_firq_b) |
| 422 | 422 | }; |
| r5932 | r5933 | |
| 431 | 431 | DEVCB_NULL, |
| 432 | 432 | DEVCB_NULL, |
| 433 | 433 | DEVCB_NULL, |
| 434 | /*outputs: A/B,CA/B2 | |
| 434 | /*outputs: A/B,CA/B2 */ | |
| 435 | 435 | DEVCB_HANDLER(d_pia0_pa_w), |
| 436 | 436 | DEVCB_HANDLER(d_pia0_pb_w), |
| 437 | 437 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 438 | 438 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 439 | /*irqs | |
| 439 | /*irqs | |
| 440 | 440 | DEVCB_LINE(d_pia0_irq_a), |
| 441 | 441 | DEVCB_LINE(d_pia0_irq_b) |
| 442 | 442 | }; |
| r5932 | r5933 | |
| 451 | 451 | DEVCB_NULL, |
| 452 | 452 | DEVCB_NULL, |
| 453 | 453 | DEVCB_NULL, |
| 454 | /*outputs: A/B,CA/B2 | |
| 454 | /*outputs: A/B,CA/B2 */ | |
| 455 | 455 | DEVCB_HANDLER(d_pia1_pa_w), |
| 456 | 456 | DEVCB_HANDLER(dragon64_pia1_pb_w), |
| 457 | 457 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 458 | 458 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 459 | /*irqs | |
| 459 | /*irqs | |
| 460 | 460 | DEVCB_LINE(d_pia1_firq_a), |
| 461 | 461 | DEVCB_LINE(d_pia1_firq_b) |
| 462 | 462 | }; |
| r5932 | r5933 | |
| 472 | 472 | DEVCB_NULL, |
| 473 | 473 | DEVCB_NULL, |
| 474 | 474 | DEVCB_NULL, |
| 475 | /*outputs: A/B,CA/B2 | |
| 475 | /*outputs: A/B,CA/B2 */ | |
| 476 | 476 | DEVCB_HANDLER(d_pia0_pa_w), |
| 477 | 477 | DEVCB_HANDLER(d_pia0_pb_w), |
| 478 | 478 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 479 | 479 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 480 | /*irqs | |
| 480 | /*irqs | |
| 481 | 481 | DEVCB_LINE(d_pia0_irq_a), |
| 482 | 482 | DEVCB_LINE(d_pia0_irq_b) |
| 483 | 483 | }; |
| r5932 | r5933 | |
| 492 | 492 | DEVCB_NULL, |
| 493 | 493 | DEVCB_NULL, |
| 494 | 494 | DEVCB_NULL, |
| 495 | /*outputs: A/B,CA/B2 | |
| 495 | /*outputs: A/B,CA/B2 */ | |
| 496 | 496 | DEVCB_HANDLER(d_pia1_pa_w), |
| 497 | 497 | DEVCB_HANDLER(d_pia1_pb_w), |
| 498 | 498 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 499 | 499 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 500 | /*irqs | |
| 500 | /*irqs | |
| 501 | 501 | DEVCB_LINE(d_pia1_firq_a), |
| 502 | 502 | DEVCB_LINE(d_pia1_firq_b) |
| 503 | 503 | }; |
| r5932 | r5933 | |
| 512 | 512 | DEVCB_NULL, |
| 513 | 513 | DEVCB_NULL, |
| 514 | 514 | DEVCB_NULL, |
| 515 | /*outputs: A/B,CA/B2 | |
| 515 | /*outputs: A/B,CA/B2 */ | |
| 516 | 516 | DEVCB_HANDLER(dgnalpha_pia2_pa_w), |
| 517 | 517 | DEVCB_NULL, |
| 518 | 518 | DEVCB_NULL, |
| 519 | 519 | DEVCB_NULL, |
| 520 | /*irqs | |
| 520 | /*irqs | |
| 521 | 521 | DEVCB_LINE(d_pia2_firq_a), |
| 522 | 522 | DEVCB_LINE(d_pia2_firq_b) |
| 523 | 523 | }; |
| r5932 | r5933 | |
| 612 | 612 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_CC, trailer->reg_cc); |
| 613 | 613 | |
| 614 | 614 | /* I seem to only be able to get a small amount of the PIA state from the |
| 615 | * snapshot trailers. Thus I am going to configure the PIA myself. The | |
| 616 | * following PIA writes are the same thing that the CoCo ROM does on | |
| 617 | * startup. I wish I had a better solution | |
| 618 | */ | |
| 615 | * snapshot trailers. Thus I am going to configure the PIA myself. The | |
| 616 | * following PIA writes are the same thing that the CoCo ROM does on | |
| 617 | * startup. I wish I had a better solution | |
| 618 | */ | |
| 619 | 619 | |
| 620 | 620 | pia6821_w(state->pia_0, 1, 0x00); |
| 621 | 621 | pia6821_w(state->pia_0, 3, 0x00); |
| r5932 | r5933 | |
| 637 | 637 | pia6821_w(state->pia_1, 2, trailer->pia[6]); |
| 638 | 638 | |
| 639 | 639 | /* For some reason, specifying use of high ram seems to screw things up; |
| 640 | * I'm not sure whether it is because I'm using the wrong method to get | |
| 641 | * access that bit or or whether it is something else. So that is why | |
| 642 | * I am specifying 0x7fff instead of 0xffff here | |
| 643 | */ | |
| 640 | * I'm not sure whether it is because I'm using the wrong method to get | |
| 641 | * access that bit or or whether it is something else. So that is why | |
| 642 | * I am specifying 0x7fff instead of 0xffff here | |
| 643 | */ | |
| 644 | 644 | sam_set_state(state->sam, trailer->sam, 0x7fff); |
| 645 | 645 | } |
| 646 | 646 | |
| r5932 | r5933 | |
| 712 | 712 | paklength = 0xff00; |
| 713 | 713 | |
| 714 | 714 | /* PAK files reflect the fact that JeffV's emulator did not appear to |
| 715 | * differentiate between RAM and ROM memory. So what we do when a PAK | |
| 716 | * loads is to copy the ROM into RAM, load the PAK into RAM, and then | |
| 717 | * copy the part of RAM corresponding to PAK ROM to the actual PAK ROM | |
| 718 | * area. | |
| 719 | * | |
| 720 | * It is ugly, but it reflects the way that JeffV's emulator works | |
| 721 | */ | |
| 715 | * differentiate between RAM and ROM memory. So what we do when a PAK | |
| 716 | * loads is to copy the ROM into RAM, load the PAK into RAM, and then | |
| 717 | * copy the part of RAM corresponding to PAK ROM to the actual PAK ROM | |
| 718 | * area. | |
| 719 | * | |
| 720 | * It is ugly, but it reflects the way that JeffV's emulator works | |
| 721 | */ | |
| 722 | 722 | |
| 723 | 723 | memcpy(rambase + 0x8000, rombase, 0x4000); |
| 724 | 724 | memcpy(rambase + 0xC000, pakbase, 0x3F00); |
| r5932 | r5933 | |
| 814 | 814 | romsize = image_length(image); |
| 815 | 815 | |
| 816 | 816 | /* The following hack is for Arkanoid running on the CoCo2. |
| 817 | The issuse is the CoCo2 hardware only allows the cartridge | |
| 818 | interface to access 0xC000-0xFEFF (16K). The Arkanoid ROM is | |
| 819 | 32K starting at 0x8000. The first 16K is totally inaccessable | |
| 820 | from a CoCo2. Thus we need to skip ahead in the ROM file. On | |
| 821 | the CoCo3 the entire 32K ROM is accessable. */ | |
| 817 | The issuse is the CoCo2 hardware only allows the cartridge | |
| 818 | interface to access 0xC000-0xFEFF (16K). The Arkanoid ROM is | |
| 819 | 32K starting at 0x8000. The first 16K is totally inaccessable | |
| 820 | from a CoCo2. Thus we need to skip ahead in the ROM file. On | |
| 821 | the CoCo3 the entire 32K ROM is accessable. */ | |
| 822 | 822 | |
| 823 | 823 | if (image_crc(image) == 0x25C3AA70) /* Test for Arkanoid */ |
| 824 | 824 | { |
| r5932 | r5933 | |
| 1097 | 1097 | double val; |
| 1098 | 1098 | UINT8 ctrl = input_port_read_safe(machine, "ctrl_sel", 0x00); |
| 1099 | 1099 | /* this function gets only called for hi-res joystick. hence, ctrl can only take values |
| 1100 | ||
| 1100 | 0x04, 0x40 (hi-res) or 0x05, 0x50 (hi-res coco3max) */ | |
| 1101 | 1101 | UINT8 coco3max = ((ctrl & 0x0f) == 0x05 || (ctrl & 0xf0) == 0x50) ? 1 : 0; |
| 1102 | 1102 | |
| 1103 | 1103 | static const char *const port_tags[2][4] = |
| r5932 | r5933 | |
| 1160 | 1160 | |
| 1161 | 1161 | The sound MUX has 4 possible settings, depend on SELA and SELB inputs: |
| 1162 | 1162 | |
| 1163 | 00 - DAC (digital - analog converter) | |
| 1164 | 01 - CSN (cassette) | |
| 1165 | 10 - SND input from cartridge (NYI because we only support the FDC) | |
| 1166 | 11 - Grounded (0) | |
| 1163 | 00 - DAC (digital - analog converter) | |
| 1164 | 01 - CSN (cassette) | |
| 1165 | 10 - SND input from cartridge (NYI because we only support the FDC) | |
| 1166 | 11 - Grounded (0) | |
| 1167 | 1167 | |
| 1168 | 1168 | Note on the Dragon Alpha state 11, selects the AY-3-8912, this is currently |
| 1169 | 1169 | un-implemented - phs. |
| r5932 | r5933 | |
| 1216 | 1216 | static void soundmux_update(running_machine *machine) |
| 1217 | 1217 | { |
| 1218 | 1218 | /* This function is called whenever the MUX (selector switch) is changed |
| 1219 | * It mainly turns on and off the cassette audio depending on the switch. | |
| 1220 | * It also calls a function into the cartridges device to tell it if it is | |
| 1221 | * switch on or off. | |
| 1222 | */ | |
| 1219 | * It mainly turns on and off the cassette audio depending on the switch. | |
| 1220 | * It also calls a function into the cartridges device to tell it if it is | |
| 1221 | * switch on or off. | |
| 1222 | */ | |
| 1223 | 1223 | cassette_state new_state; |
| 1224 | 1224 | int soundmux_status = get_soundmux_status(machine); |
| 1225 | 1225 | |
| r5932 | r5933 | |
| 1247 | 1247 | coco_state *state = machine->driver_data; |
| 1248 | 1248 | |
| 1249 | 1249 | /* Call this function whenever you need to update the sound. It will |
| 1250 | * automatically mute any devices that are switched out. | |
| 1251 | */ | |
| 1250 | * automatically mute any devices that are switched out. | |
| 1251 | */ | |
| 1252 | 1252 | UINT8 dac = pia6821_get_output_a(state->pia_1) & 0xFC; |
| 1253 | 1253 | UINT8 pia1_pb1 = (pia6821_get_output_b(state->pia_1) & 0x02) ? 0x80 : 0x00; |
| 1254 | 1254 | int soundmux_status = get_soundmux_status(machine); |
| r5932 | r5933 | |
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | 1277 | /* |
| 1278 | ||
| 1278 | Dragon Alpha AY-3-8912 | |
| 1279 | 1279 | */ |
| 1280 | 1280 | |
| 1281 | 1281 | READ8_HANDLER ( dgnalpha_psg_porta_read ) |
| r5932 | r5933 | |
| 1309 | 1309 | /*************************************************************************** |
| 1310 | 1310 | PIA0 ($FF00-$FF1F) (Chip U8) |
| 1311 | 1311 | |
| 1312 | PIA0 PA0-PA7 - Keyboard/Joystick read | |
| 1313 | PIA0 PB0-PB7 - Keyboard write | |
| 1314 | PIA0 CA1 - M6847 HS (Horizontal Sync) | |
| 1315 | PIA0 CA2 - SEL1 (Used by sound mux and joystick) | |
| 1316 | PIA0 CB1 - M6847 FS (Field Sync) | |
| 1317 | PIA0 CB2 - SEL2 (Used by sound mux and joystick) | |
| 1312 | PIA0 PA0-PA7 - Keyboard/Joystick read | |
| 1313 | PIA0 PB0-PB7 - Keyboard write | |
| 1314 | PIA0 CA1 - M6847 HS (Horizontal Sync) | |
| 1315 | PIA0 CA2 - SEL1 (Used by sound mux and joystick) | |
| 1316 | PIA0 CB1 - M6847 FS (Field Sync) | |
| 1317 | PIA0 CB2 - SEL2 (Used by sound mux and joystick) | |
| 1318 | 1318 | ***************************************************************************/ |
| 1319 | 1319 | |
| 1320 | 1320 | static WRITE8_DEVICE_HANDLER ( d_pia0_ca2_w ) |
| r5932 | r5933 | |
| 1498 | 1498 | /*************************************************************************** |
| 1499 | 1499 | PIA1 ($FF20-$FF3F) (Chip U4) |
| 1500 | 1500 | |
| 1501 | PIA1 PA0 - CASSDIN | |
| 1502 | PIA1 PA1 - RS232 OUT (CoCo), Printer Strobe (Dragon) | |
| 1503 | PIA1 PA2-PA7 - DAC | |
| 1504 | PIA1 PB0 - RS232 IN | |
| 1505 | PIA1 PB1 - Single bit sound | |
| 1506 | PIA1 PB2 - RAMSZ (32/64K, 16K, and 4K three position switch) | |
| 1507 | PIA1 PB3 - M6847 CSS | |
| 1508 | PIA1 PB4 - M6847 INT/EXT and M6847 GM0 | |
| 1509 | PIA1 PB5 - M6847 GM1 | |
| 1510 | PIA1 PB6 - M6847 GM2 | |
| 1511 | PIA1 PB7 - M6847 A/G | |
| 1512 | PIA1 CA1 - CD (Carrier Detect; NYI) | |
| 1513 | PIA1 CA2 - CASSMOT (Cassette Motor) | |
| 1514 | PIA1 CB1 - CART (Cartridge Detect) | |
| 1515 | PIA1 CB2 - SNDEN (Sound Enable) | |
| 1501 | PIA1 PA0 - CASSDIN | |
| 1502 | PIA1 PA1 - RS232 OUT (CoCo), Printer Strobe (Dragon) | |
| 1503 | PIA1 PA2-PA7 - DAC | |
| 1504 | PIA1 PB0 - RS232 IN | |
| 1505 | PIA1 PB1 - Single bit sound | |
| 1506 | PIA1 PB2 - RAMSZ (32/64K, 16K, and 4K three position switch) | |
| 1507 | PIA1 PB3 - M6847 CSS | |
| 1508 | PIA1 PB4 - M6847 INT/EXT and M6847 GM0 | |
| 1509 | PIA1 PB5 - M6847 GM1 | |
| 1510 | PIA1 PB6 - M6847 GM2 | |
| 1511 | PIA1 PB7 - M6847 A/G | |
| 1512 | PIA1 CA1 - CD (Carrier Detect; NYI) | |
| 1513 | PIA1 CA2 - CASSMOT (Cassette Motor) | |
| 1514 | PIA1 CB1 - CART (Cartridge Detect) | |
| 1515 | PIA1 CB2 - SNDEN (Sound Enable) | |
| 1516 | 1516 | ***************************************************************************/ |
| 1517 | 1517 | |
| 1518 | 1518 | static WRITE8_DEVICE_HANDLER ( d_pia1_cb2_w ) |
| r5932 | r5933 | |
| 1544 | 1544 | static WRITE8_DEVICE_HANDLER ( d_pia1_pa_w ) |
| 1545 | 1545 | { |
| 1546 | 1546 | /* |
| 1547 | * This port appears at $FF20 | |
| 1548 | * | |
| 1549 | * Bits | |
| 1550 | * 7-2: DAC to speaker or cassette | |
| 1551 | * 1: Serial out (CoCo), Printer strobe (Dragon) | |
| 1552 | */ | |
| 1547 | * This port appears at $FF20 | |
| 1548 | * | |
| 1549 | * Bits | |
| 1550 | * 7-2: DAC to speaker or cassette | |
| 1551 | * 1: Serial out (CoCo), Printer strobe (Dragon) | |
| 1552 | */ | |
| 1553 | 1553 | UINT8 dac = pia6821_get_output_a(device) & 0xFC; |
| 1554 | 1554 | static int dclg_previous_bit; |
| 1555 | 1555 | |
| r5932 | r5933 | |
| 1636 | 1636 | mc6847_ag_w(state->mc6847, BIT(data, 7)); |
| 1637 | 1637 | |
| 1638 | 1638 | /* PB1 will drive the sound output. This is a rarely |
| 1639 | * used single bit sound mode. It is always connected thus | |
| 1640 | * cannot be disabled. | |
| 1641 | * | |
| 1642 | * Source: Page 31 of the Tandy Color Computer Service Manual | |
| 1643 | */ | |
| 1639 | * used single bit sound mode. It is always connected thus | |
| 1640 | * cannot be disabled. | |
| 1641 | * | |
| 1642 | * Source: Page 31 of the Tandy Color Computer Service Manual | |
| 1643 | */ | |
| 1644 | 1644 | coco_sound_update(device->machine); |
| 1645 | 1645 | } |
| 1646 | 1646 | |
| r5932 | r5933 | |
| 1655 | 1655 | mc6847_ag_w(state->mc6847, BIT(data, 7)); |
| 1656 | 1656 | |
| 1657 | 1657 | /* PB1 will drive the sound output. This is a rarely |
| 1658 | * used single bit sound mode. It is always connected thus | |
| 1659 | * cannot be disabled. | |
| 1660 | * | |
| 1661 | * Source: Page 31 of the Tandy Color Computer Serice Manual | |
| 1662 | */ | |
| 1658 | * used single bit sound mode. It is always connected thus | |
| 1659 | * cannot be disabled. | |
| 1660 | * | |
| 1661 | * Source: Page 31 of the Tandy Color Computer Serice Manual | |
| 1662 | */ | |
| 1663 | 1663 | coco_sound_update(device->machine); |
| 1664 | 1664 | } |
| 1665 | 1665 | |
| r5932 | r5933 | |
| 1684 | 1684 | /*************************************************************************** |
| 1685 | 1685 | PIA2 ($FF24-$FF28) on Daragon Alpha/Professional |
| 1686 | 1686 | |
| 1687 | PIA2 PA0 bcdir to AY-8912 | |
| 1688 | PIA2 PA1 bc0 to AY-8912 | |
| 1689 | PIA2 PA2 Rom switch, 0=basic rom, 1=boot rom. | |
| 1690 | PIA2 PA3-PA7 Unknown/unused ? | |
| 1691 | PIA2 PB0-PB7 connected to D0..7 of the AY8912. | |
| 1692 | CB1 DRQ from WD2797 disk controler. | |
| 1687 | PIA2 PA0 bcdir to AY-8912 | |
| 1688 | PIA2 PA1 bc0 to AY-8912 | |
| 1689 | PIA2 PA2 Rom switch, 0=basic rom, 1=boot rom. | |
| 1690 | PIA2 PA3-PA7 Unknown/unused ? | |
| 1691 | PIA2 PB0-PB7 connected to D0..7 of the AY8912. | |
| 1692 | CB1 DRQ from WD2797 disk controler. | |
| 1693 | 1693 | ***************************************************************************/ |
| 1694 | 1694 | |
| 1695 | 1695 | static WRITE8_DEVICE_HANDLER( dgnalpha_pia2_pa_w ) |
| r5932 | r5933 | |
| 1861 | 1861 | coco_state *state = device->machine->driver_data; |
| 1862 | 1862 | |
| 1863 | 1863 | /* This handles the reading of the memory sense switch (pb2) for the CoCo 1, |
| 1864 | ||
| 1864 | * and serial-in (pb0). Serial-in not yet implemented. */ | |
| 1865 | 1865 | int result; |
| 1866 | 1866 | |
| 1867 | 1867 | /* For the CoCo 1, the logic has been changed to only select 64K rams |
| 1868 | if there is more than 16K of memory, as the Color Basic 1.0 rom | |
| 1869 | can only configure 4K or 16K ram banks (as documented in "Color | |
| 1870 | Basic Unreveled"), doing this allows this allows the coco driver | |
| 1871 | to access 32K of ram, and also allows the cocoe driver to access | |
| 1872 | the full 64K, as this uses Color Basic 1.2, which can configure 64K rams */ | |
| 1868 | if there is more than 16K of memory, as the Color Basic 1.0 rom | |
| 1869 | can only configure 4K or 16K ram banks (as documented in "Color | |
| 1870 | Basic Unreveled"), doing this allows this allows the coco driver | |
| 1871 | to access 32K of ram, and also allows the cocoe driver to access | |
| 1872 | the full 64K, as this uses Color Basic 1.2, which can configure 64K rams */ | |
| 1873 | 1873 | |
| 1874 | 1874 | if (mess_ram_size > 0x8000) /* 1 bank of 64K rams */ |
| 1875 | 1875 | result = (pia6821_get_output_b(state->pia_0) & 0x80) >> 5; |
| r5932 | r5933 | |
| 1884 | 1884 | static READ8_DEVICE_HANDLER ( d_pia1_pb_r_dragon32 ) |
| 1885 | 1885 | { |
| 1886 | 1886 | /* This handles the reading of the memory sense switch (pb2) for the Dragon 32, |
| 1887 | ||
| 1887 | * and pb0, is the printer /busy line. */ | |
| 1888 | 1888 | |
| 1889 | 1889 | int result; |
| 1890 | 1890 | |
| 1891 | 1891 | /* Of the Dragon machines, Only the Dragon 32 needs the ram select bit |
| 1892 | as both the 64 and Alpha, always have 64K rams, also the meaning of | |
| 1893 | the bit is different with respect to the CoCo 1 */ | |
| 1892 | as both the 64 and Alpha, always have 64K rams, also the meaning of | |
| 1893 | the bit is different with respect to the CoCo 1 */ | |
| 1894 | 1894 | |
| 1895 | 1895 | if (mess_ram_size > 0x8000) |
| 1896 | 1896 | result = 0x00; /* 1 bank of 64K, rams */ |
| r5932 | r5933 | |
| 1905 | 1905 | coco_state *state = device->machine->driver_data; |
| 1906 | 1906 | |
| 1907 | 1907 | /* This handles the reading of the memory sense switch (pb2) for the CoCo 2 and 3, |
| 1908 | * and serial-in (pb0). Serial-in not yet implemented. | |
| 1909 | */ | |
| 1908 | * and serial-in (pb0). Serial-in not yet implemented. | |
| 1909 | */ | |
| 1910 | 1910 | int result; |
| 1911 | 1911 | |
| 1912 | 1912 | if (mess_ram_size <= 0x1000) |
| r5932 | r5933 | |
| 1920 | 1920 | |
| 1921 | 1921 | |
| 1922 | 1922 | /* |
| 1923 | ||
| 1923 | Compusense Dragon Plus Control register | |
| 1924 | 1924 | */ |
| 1925 | 1925 | |
| 1926 | 1926 | /* The read handler will eventually return the 6845 status */ |
| r5932 | r5933 | |
| 1930 | 1930 | } |
| 1931 | 1931 | |
| 1932 | 1932 | /* |
| 1933 | ||
| 1933 | When writing the bits have the following meanings : | |
| 1934 | 1934 | |
| 1935 | bit value purpose | |
| 1936 | 0 0 First 2k of memory map determined by bits 1 & 2 | |
| 1937 | 1 6845 display RAM mapped into first 2K of map, | |
| 1935 | bit value purpose | |
| 1936 | 0 0 First 2k of memory map determined by bits 1 & 2 | |
| 1937 | 1 6845 display RAM mapped into first 2K of map, | |
| 1938 | 1938 | |
| 1939 | 2,1 0,0 Normal bottom 32K or ram mapped (from mainboard). | |
| 1940 | 0,1 First 32K of plus RAM mapped into $0000-$7FFF | |
| 1941 | 1,0 Second 32K of plus RAM mapped into $0000-$7FFF | |
| 1942 | 1,1 Undefined. I will assume that it's the same as 00. | |
| 1943 | 3-7 Unused. | |
| 1939 | 2,1 0,0 Normal bottom 32K or ram mapped (from mainboard). | |
| 1940 | 0,1 First 32K of plus RAM mapped into $0000-$7FFF | |
| 1941 | 1,0 Second 32K of plus RAM mapped into $0000-$7FFF | |
| 1942 | 1,1 Undefined. I will assume that it's the same as 00. | |
| 1943 | 3-7 Unused. | |
| 1944 | 1944 | */ |
| 1945 | 1945 | WRITE8_HANDLER ( plus_reg_w ) |
| 1946 | 1946 | { |
| r5932 | r5933 | |
| 1971 | 1971 | static SAM6883_SET_MPU_RATE( d_sam_set_mpurate ) |
| 1972 | 1972 | { |
| 1973 | 1973 | /* The infamous speed up poke. |
| 1974 | * | |
| 1975 | * This was a SAM switch that occupied 4 addresses: | |
| 1976 | * | |
| 1977 | * $FFD9 (set) R1 | |
| 1978 | * $FFD8 (clear) R1 | |
| 1979 | * $FFD7 (set) R0 | |
| 1980 | * $FFD6 (clear) R0 | |
| 1981 | * | |
| 1982 | * R1:R0 formed the following states: | |
| 1983 | * 00 - slow 0.89 MHz | |
| 1984 | * 01 - dual speed ??? | |
| 1985 | * 1x - fast 1.78 MHz | |
| 1986 | * | |
| 1987 | * R1 controlled whether the video addressing was speeded up and R0 | |
| 1988 | * did the same for the CPU. On pre-CoCo 3 machines, setting R1 caused | |
| 1989 | * the screen to display garbage because the M6847 could not display | |
| 1990 | * fast enough. | |
| 1991 | * | |
| 1992 | * TODO: Make the overclock more accurate. In dual speed, ROM was a fast | |
| 1993 | * access but RAM was not. I don't know how to simulate this. | |
| 1994 | */ | |
| 1974 | * | |
| 1975 | * This was a SAM switch that occupied 4 addresses: | |
| 1976 | * | |
| 1977 | * $FFD9 (set) R1 | |
| 1978 | * $FFD8 (clear) R1 | |
| 1979 | * $FFD7 (set) R0 | |
| 1980 | * $FFD6 (clear) R0 | |
| 1981 | * | |
| 1982 | * R1:R0 formed the following states: | |
| 1983 | * 00 - slow 0.89 MHz | |
| 1984 | * 01 - dual speed ??? | |
| 1985 | * 1x - fast 1.78 MHz | |
| 1986 | * | |
| 1987 | * R1 controlled whether the video addressing was speeded up and R0 | |
| 1988 | * did the same for the CPU. On pre-CoCo 3 machines, setting R1 caused | |
| 1989 | * the screen to display garbage because the M6847 could not display | |
| 1990 | * fast enough. | |
| 1991 | * | |
| 1992 | * TODO: Make the overclock more accurate. In dual speed, ROM was a fast | |
| 1993 | * access but RAM was not. I don't know how to simulate this. | |
| 1994 | */ | |
| 1995 | 1995 | cpu_set_clockscale(cputag_get_cpu(device->machine, "maincpu"), val ? 2 : 1); |
| 1996 | 1996 | } |
| 1997 | 1997 | |
| r5932 | r5933 | |
| 2003 | 2003 | static void setup_memory_map(running_machine *machine) |
| 2004 | 2004 | { |
| 2005 | 2005 | /* |
| 2006 | The following table contains the RAM block mappings for the CoCo 1/2 and Dragon computers | |
| 2007 | This replicates the behavior of the SAM ram size programming bits which in ther real hardware | |
| 2008 | allowed the use of various sizes of RAM chips, as follows :- | |
| 2006 | The following table contains the RAM block mappings for the CoCo 1/2 and Dragon computers | |
| 2007 | This replicates the behavior of the SAM ram size programming bits which in ther real hardware | |
| 2008 | allowed the use of various sizes of RAM chips, as follows :- | |
| 2009 | 2009 | |
| 2010 | 1 or 2 banks of 4K | |
| 2011 | 1 or 2 banks of 16K | |
| 2012 | 1 bank of 64K | |
| 2013 | up to 64K of static ram. | |
| 2010 | 1 or 2 banks of 4K | |
| 2011 | 1 or 2 banks of 16K | |
| 2012 | 1 bank of 64K | |
| 2013 | up to 64K of static ram. | |
| 2014 | 2014 | |
| 2015 | For the 4K and 16K chip sizes, if the second bank was empty it would be mapped to nothing. | |
| 2016 | For the 4K and 16K chip sizes, the banks would be mirrored at chip size*2 intervals. | |
| 2015 | For the 4K and 16K chip sizes, if the second bank was empty it would be mapped to nothing. | |
| 2016 | For the 4K and 16K chip sizes, the banks would be mirrored at chip size*2 intervals. | |
| 2017 | 2017 | |
| 2018 | ||
| 2018 | The following table holds the data required to implement this. | |
| 2019 | 2019 | |
| 2020 | Note though it is technically possible to have 2 banks of 4K rams, for a total of 8K, I | |
| 2021 | have never seen a machine with this configuration, so I have not implemented it. | |
| 2022 | */ | |
| 2020 | Note though it is technically possible to have 2 banks of 4K rams, for a total of 8K, I | |
| 2021 | have never seen a machine with this configuration, so I have not implemented it. | |
| 2022 | */ | |
| 2023 | 2023 | |
| 2024 | 2024 | struct coco_meminfo |
| 2025 | 2025 | { |
| r5932 | r5933 | |
| 2056 | 2056 | coco_state *state = machine->driver_data; |
| 2057 | 2057 | UINT8 memsize = get_sam_memorysize(state->sam); |
| 2058 | 2058 | UINT8 maptype = get_sam_maptype(state->sam); |
| 2059 | // | |
| 2059 | // UINT8 pagemode = get_sam_pagemode(machine); | |
| 2060 | 2060 | int last_ram_block; /* Last block that will be RAM, dependent on maptype */ |
| 2061 | 2061 | int block_index; /* Index of block being processed */ |
| 2062 | 2062 | int wbank; /* bank no to go in this block */ |
| r5932 | r5933 | |
| 2128 | 2128 | static SAM6883_SET_PAGE_ONE_MODE( d_sam_set_pageonemode ) |
| 2129 | 2129 | { |
| 2130 | 2130 | /* Page mode - allowed switching between the low 32k and the high 32k, |
| 2131 | * assuming that 64k wasn't enabled | |
| 2132 | * | |
| 2133 | * TODO: Actually implement this. Also find out what the CoCo 3 did with | |
| 2134 | * this (it probably ignored it) | |
| 2135 | */ | |
| 2131 | * assuming that 64k wasn't enabled | |
| 2132 | * | |
| 2133 | * TODO: Actually implement this. Also find out what the CoCo 3 did with | |
| 2134 | * this (it probably ignored it) | |
| 2135 | */ | |
| 2136 | 2136 | |
| 2137 | 2137 | if (!get_sam_maptype(device)) // Ignored in maptype 1 |
| 2138 | 2138 | { |
| r5932 | r5933 | |
| 2148 | 2148 | static SAM6883_SET_MEMORY_SIZE( d_sam_set_memorysize ) |
| 2149 | 2149 | { |
| 2150 | 2150 | /* Memory size - allowed restricting memory accesses to something less than |
| 2151 | * 32k | |
| 2152 | * | |
| 2153 | * This was a SAM switch that occupied 4 addresses: | |
| 2154 | * | |
| 2155 | * $FFDD (set) R1 | |
| 2156 | * $FFDC (clear) R1 | |
| 2157 | * $FFDB (set) R0 | |
| 2158 | * $FFDA (clear) R0 | |
| 2159 | * | |
| 2160 | * R1:R0 formed the following states: | |
| 2161 | * 00 - 4k | |
| 2162 | * 01 - 16k | |
| 2163 | * 10 - 64k | |
| 2164 | * 11 - static RAM (??) | |
| 2165 | * | |
| 2166 | * If something less than 64k was set, the low RAM would be smaller and | |
| 2167 | * mirror the other parts of the RAM | |
| 2168 | * | |
| 2169 | * TODO: Find out what "static RAM" is | |
| 2170 | * TODO: This should affect _all_ memory accesses, not just video ram | |
| 2171 | * TODO: Verify that the CoCo 3 ignored this | |
| 2172 | */ | |
| 2151 | * 32k | |
| 2152 | * | |
| 2153 | * This was a SAM switch that occupied 4 addresses: | |
| 2154 | * | |
| 2155 | * $FFDD (set) R1 | |
| 2156 | * $FFDC (clear) R1 | |
| 2157 | * $FFDB (set) R0 | |
| 2158 | * $FFDA (clear) R0 | |
| 2159 | * | |
| 2160 | * R1:R0 formed the following states: | |
| 2161 | * 00 - 4k | |
| 2162 | * 01 - 16k | |
| 2163 | * 10 - 64k | |
| 2164 | * 11 - static RAM (??) | |
| 2165 | * | |
| 2166 | * If something less than 64k was set, the low RAM would be smaller and | |
| 2167 | * mirror the other parts of the RAM | |
| 2168 | * | |
| 2169 | * TODO: Find out what "static RAM" is | |
| 2170 | * TODO: This should affect _all_ memory accesses, not just video ram | |
| 2171 | * TODO: Verify that the CoCo 3 ignored this | |
| 2172 | */ | |
| 2173 | 2173 | |
| 2174 | 2174 | setup_memory_map(device->machine); |
| 2175 | 2175 | } |
| r5932 | r5933 | |
| 2279 | 2279 | |
| 2280 | 2280 | /************************************* |
| 2281 | 2281 | * |
| 2282 | * | |
| 2282 | * CoCo 3 | |
| 2283 | 2283 | * |
| 2284 | 2284 | *************************************/ |
| 2285 | 2285 | |
| r5932 | r5933 | |
| 2289 | 2289 | * translates it into a physical RAM address. The following logical memory |
| 2290 | 2290 | * addresses have the following bank indexes: |
| 2291 | 2291 | * |
| 2292 | * Bank 0 $0000-$1FFF | |
| 2293 | * Bank 1 $2000-$3FFF | |
| 2294 | * Bank 2 $4000-$5FFF | |
| 2295 | * Bank 3 $6000-$7FFF | |
| 2296 | * Bank 4 $8000-$9FFF | |
| 2297 | * Bank 5 $A000-$BFFF | |
| 2298 | * Bank 6 $C000-$DFFF | |
| 2299 | * Bank 7 $E000-$FDFF | |
| 2300 | * Bank 8 $FE00-$FEFF | |
| 2292 | * Bank 0 $0000-$1FFF | |
| 2293 | * Bank 1 $2000-$3FFF | |
| 2294 | * Bank 2 $4000-$5FFF | |
| 2295 | * Bank 3 $6000-$7FFF | |
| 2296 | * Bank 4 $8000-$9FFF | |
| 2297 | * Bank 5 $A000-$BFFF | |
| 2298 | * Bank 6 $C000-$DFFF | |
| 2299 | * Bank 7 $E000-$FDFF | |
| 2300 | * Bank 8 $FE00-$FEFF | |
| 2301 | 2301 | * |
| 2302 | 2302 | * The result represents a physical RAM address. Since ROM/Cartidge space is |
| 2303 | 2303 | * outside of the standard RAM memory map, ROM addresses get a "physical RAM" |
| r5932 | r5933 | |
| 2318 | 2318 | if (coco3_gimereg[0] & 8) |
| 2319 | 2319 | { |
| 2320 | 2320 | /* this GIME register fixes logical addresses $FExx to physical |
| 2321 | ||
| 2321 | * addresses $7FExx ($1FExx if 128k */ | |
| 2322 | 2322 | assert(offset < 0x200); |
| 2323 | 2323 | return ((mess_ram_size - 0x200) & 0x7ffff) + offset; |
| 2324 | 2324 | } |
| r5932 | r5933 | |
| 2345 | 2345 | } |
| 2346 | 2346 | |
| 2347 | 2347 | /* Are we actually in ROM? |
| 2348 | * | |
| 2349 | * In our world, ROM is represented by memory blocks 0x40-0x47 | |
| 2350 | * | |
| 2351 | * 0 Extended Color Basic | |
| 2352 | * 1 Color Basic | |
| 2353 | * 2 Reset Initialization | |
| 2354 | * 3 Super Extended Color Basic | |
| 2355 | * 4-7 Cartridge ROM | |
| 2356 | * | |
| 2357 | * This is the level where ROM is mapped, according to Tepolt (p21) | |
| 2358 | */ | |
| 2348 | * | |
| 2349 | * In our world, ROM is represented by memory blocks 0x40-0x47 | |
| 2350 | * | |
| 2351 | * 0 Extended Color Basic | |
| 2352 | * 1 Color Basic | |
| 2353 | * 2 Reset Initialization | |
| 2354 | * 3 Super Extended Color Basic | |
| 2355 | * 4-7 Cartridge ROM | |
| 2356 | * | |
| 2357 | * This is the level where ROM is mapped, according to Tepolt (p21) | |
| 2358 | */ | |
| 2359 | 2359 | if (((block & 0x3f) >= 0x3c) && !coco3_enable_64k && !forceram) |
| 2360 | 2360 | { |
| 2361 | 2361 | static const UINT8 rommap[4][4] = |
| r5932 | r5933 | |
| 2439 | 2439 | READ8_HANDLER(coco3_mmu_r) |
| 2440 | 2440 | { |
| 2441 | 2441 | /* The high two bits are floating (high resistance). Therefore their |
| 2442 | * value is undefined. But we are exposing them anyways here | |
| 2443 | */ | |
| 2442 | * value is undefined. But we are exposing them anyways here | |
| 2443 | */ | |
| 2444 | 2444 | return coco3_mmu[offset]; |
| 2445 | 2445 | } |
| 2446 | 2446 | |
| r5932 | r5933 | |
| 2488 | 2488 | case 4: /* Timer MSB/LSB; these arn't readable */ |
| 2489 | 2489 | case 5: |
| 2490 | 2490 | /* JK tells me that these values are indeterminate; and $7E appears |
| 2491 | * to be the value most commonly returned | |
| 2492 | */ | |
| 2491 | * to be the value most commonly returned | |
| 2492 | */ | |
| 2493 | 2493 | result = 0x7e; |
| 2494 | 2494 | break; |
| 2495 | 2495 | |
| r5932 | r5933 | |
| 2515 | 2515 | switch(offset) |
| 2516 | 2516 | { |
| 2517 | 2517 | case 0: |
| 2518 | /* $FF90 Initialization register 0 | |
| 2519 | * Bit 7 COCO 1=CoCo compatible mode | |
| 2520 | * Bit 6 MMUEN 1=MMU enabled | |
| 2521 | * Bit 5 IEN 1 = GIME chip IRQ enabled | |
| 2522 | * Bit 4 FEN 1 = GIME chip FIRQ enabled | |
| 2523 | * Bit 3 MC3 1 = RAM at FEXX is constant | |
| 2524 | * Bit 2 MC2 1 = standard SCS (Spare Chip Select) | |
| 2525 | * Bit 1 MC1 ROM map control | |
| 2526 | * Bit 0 MC0 ROM map control | |
| 2527 | */ | |
| 2518 | /* $FF90 Initialization register 0 | |
| 2519 | * Bit 7 COCO 1=CoCo compatible mode | |
| 2520 | * Bit 6 MMUEN 1=MMU enabled | |
| 2521 | * Bit 5 IEN 1 = GIME chip IRQ enabled | |
| 2522 | * Bit 4 FEN 1 = GIME chip FIRQ enabled | |
| 2523 | * Bit 3 MC3 1 = RAM at FEXX is constant | |
| 2524 | * Bit 2 MC2 1 = standard SCS (Spare Chip Select) | |
| 2525 | * Bit 1 MC1 ROM map control | |
| 2526 | * Bit 0 MC0 ROM map control | |
| 2527 | */ | |
| 2528 | 2528 | coco3_mmu_update(space->machine, 0, 8); |
| 2529 | 2529 | { |
| 2530 | 2530 | if (coco3_gimereg[0] & 0x04) |
| r5932 | r5933 | |
| 2542 | 2542 | break; |
| 2543 | 2543 | |
| 2544 | 2544 | case 1: |
| 2545 | /* $FF91 Initialization register 1 | |
| 2546 | * Bit 7 Unused | |
| 2547 | * Bit 6 Unused | |
| 2548 | * Bit 5 TINS Timer input select; 1 = 280 nsec, 0 = 63.5 usec | |
| 2549 | * Bit 4 Unused | |
| 2550 | * Bit 3 Unused | |
| 2551 | * Bit 2 Unused | |
| 2552 | * Bit 1 Unused | |
| 2553 | * Bit 0 TR Task register select | |
| 2554 | */ | |
| 2545 | /* $FF91 Initialization register 1 | |
| 2546 | * Bit 7 Unused | |
| 2547 | * Bit 6 Unused | |
| 2548 | * Bit 5 TINS Timer input select; 1 = 280 nsec, 0 = 63.5 usec | |
| 2549 | * Bit 4 Unused | |
| 2550 | * Bit 3 Unused | |
| 2551 | * Bit 2 Unused | |
| 2552 | * Bit 1 Unused | |
| 2553 | * Bit 0 TR Task register select | |
| 2554 | */ | |
| 2555 | 2555 | coco3_mmu_update(space->machine, 0, 8); |
| 2556 | 2556 | coco3_timer_reset(space->machine); |
| 2557 | 2557 | break; |
| 2558 | 2558 | |
| 2559 | 2559 | case 2: |
| 2560 | /* $FF92 Interrupt request enable register | |
| 2561 | * Bit 7 Unused | |
| 2562 | * Bit 6 Unused | |
| 2563 | * Bit 5 TMR Timer interrupt | |
| 2564 | * Bit 4 HBORD Horizontal border interrupt | |
| 2565 | * Bit 3 VBORD Vertical border interrupt | |
| 2566 | * ! Bit 2 EI2 Serial data interrupt | |
| 2567 | * Bit 1 EI1 Keyboard interrupt | |
| 2568 | * Bit 0 EI0 Cartridge interrupt | |
| 2569 | */ | |
| 2560 | /* $FF92 Interrupt request enable register | |
| 2561 | * Bit 7 Unused | |
| 2562 | * Bit 6 Unused | |
| 2563 | * Bit 5 TMR Timer interrupt | |
| 2564 | * Bit 4 HBORD Horizontal border interrupt | |
| 2565 | * Bit 3 VBORD Vertical border interrupt | |
| 2566 | * ! Bit 2 EI2 Serial data interrupt | |
| 2567 | * Bit 1 EI1 Keyboard interrupt | |
| 2568 | * Bit 0 EI0 Cartridge interrupt | |
| 2569 | */ | |
| 2570 | 2570 | if (LOG_INT_MASKING) |
| 2571 | 2571 | { |
| 2572 | 2572 | logerror("CoCo3 IRQ: Interrupts { %s%s%s%s%s%s} enabled\n", |
| r5932 | r5933 | |
| 2581 | 2581 | break; |
| 2582 | 2582 | |
| 2583 | 2583 | case 3: |
| 2584 | /* $FF93 Fast interrupt request enable register | |
| 2585 | * Bit 7 Unused | |
| 2586 | * Bit 6 Unused | |
| 2587 | * Bit 5 TMR Timer interrupt | |
| 2588 | * Bit 4 HBORD Horizontal border interrupt | |
| 2589 | * Bit 3 VBORD Vertical border interrupt | |
| 2590 | * ! Bit 2 EI2 Serial border interrupt | |
| 2591 | * Bit 1 EI1 Keyboard interrupt | |
| 2592 | * Bit 0 EI0 Cartridge interrupt | |
| 2593 | */ | |
| 2584 | /* $FF93 Fast interrupt request enable register | |
| 2585 | * Bit 7 Unused | |
| 2586 | * Bit 6 Unused | |
| 2587 | * Bit 5 TMR Timer interrupt | |
| 2588 | * Bit 4 HBORD Horizontal border interrupt | |
| 2589 | * Bit 3 VBORD Vertical border interrupt | |
| 2590 | * ! Bit 2 EI2 Serial border interrupt | |
| 2591 | * Bit 1 EI1 Keyboard interrupt | |
| 2592 | * Bit 0 EI0 Cartridge interrupt | |
| 2593 | */ | |
| 2594 | 2594 | if (LOG_INT_MASKING) |
| 2595 | 2595 | { |
| 2596 | 2596 | logerror("CoCo3 FIRQ: Interrupts { %s%s%s%s%s%s} enabled\n", |
| r5932 | r5933 | |
| 2605 | 2605 | break; |
| 2606 | 2606 | |
| 2607 | 2607 | case 4: |
| 2608 | /* $FF94 Timer register MSB | |
| 2609 | * Bits 4-7 Unused | |
| 2610 | * Bits 0-3 High order four bits of the timer | |
| 2611 | */ | |
| 2608 | /* $FF94 Timer register MSB | |
| 2609 | * Bits 4-7 Unused | |
| 2610 | * Bits 0-3 High order four bits of the timer | |
| 2611 | */ | |
| 2612 | 2612 | coco3_timer_reset(space->machine); |
| 2613 | 2613 | break; |
| 2614 | 2614 | |
| 2615 | 2615 | case 5: |
| 2616 | /* $FF95 Timer register LSB | |
| 2617 | * Bits 0-7 Low order eight bits of the timer | |
| 2618 | */ | |
| 2616 | /* $FF95 Timer register LSB | |
| 2617 | * Bits 0-7 Low order eight bits of the timer | |
| 2618 | */ | |
| 2619 | 2619 | if (timer_was_off && (coco3_gimereg[5] != 0x00)) |
| 2620 | 2620 | { |
| 2621 | 2621 | /* Writes to $FF95 do not cause the timer to reset, but MESS |
| 2622 | * will invoke coco3_timer_reset() if $FF94/5 was previously | |
| 2623 | * $0000. The reason for this is because the timer is not | |
| 2624 | * actually off when $FF94/5 are loaded with $0000; rather it | |
| 2625 | * is continuously reloading the GIME's internal countdown | |
| 2626 | * register, even if it isn't causing interrupts to be raised. | |
| 2627 | * | |
| 2628 | * Failure to do this was the cause of bug #1065. Special | |
| 2629 | * thanks to John Kowalski for pointing me in the right | |
| 2630 | * direction | |
| 2631 | */ | |
| 2622 | * will invoke coco3_timer_reset() if $FF94/5 was previously | |
| 2623 | * $0000. The reason for this is because the timer is not | |
| 2624 | * actually off when $FF94/5 are loaded with $0000; rather it | |
| 2625 | * is continuously reloading the GIME's internal countdown | |
| 2626 | * register, even if it isn't causing interrupts to be raised. | |
| 2627 | * | |
| 2628 | * Failure to do this was the cause of bug #1065. Special | |
| 2629 | * thanks to John Kowalski for pointing me in the right | |
| 2630 | * direction | |
| 2631 | */ | |
| 2632 | 2632 | coco3_timer_reset(space->machine); |
| 2633 | 2633 | } |
| 2634 | 2634 | break; |
| 2635 | 2635 | |
| 2636 | 2636 | case 8: |
| 2637 | /* $FF98 Video Mode Register | |
| 2638 | * Bit 7 BP 0 = Text modes, 1 = Graphics modes | |
| 2639 | * Bit 6 Unused | |
| 2640 | * ! Bit 5 BPI Burst Phase Invert (Color Set) | |
| 2641 | * Bit 4 MOCH 1 = Monochrome on Composite | |
| 2642 | * ! Bit 3 H50 1 = 50 Hz power, 0 = 60 Hz power | |
| 2643 | * Bits 0-2 LPR Lines per row | |
| 2644 | */ | |
| 2637 | /* $FF98 Video Mode Register | |
| 2638 | * Bit 7 BP 0 = Text modes, 1 = Graphics modes | |
| 2639 | * Bit 6 Unused | |
| 2640 | * ! Bit 5 BPI Burst Phase Invert (Color Set) | |
| 2641 | * Bit 4 MOCH 1 = Monochrome on Composite | |
| 2642 | * ! Bit 3 H50 1 = 50 Hz power, 0 = 60 Hz power | |
| 2643 | * Bits 0-2 LPR Lines per row | |
| 2644 | */ | |
| 2645 | 2645 | break; |
| 2646 | 2646 | |
| 2647 | 2647 | case 9: |
| 2648 | /* $FF99 Video Resolution Register | |
| 2649 | * Bit 7 Undefined | |
| 2650 | * Bits 5-6 LPF Lines per Field (Number of Rows) | |
| 2651 | * Bits 2-4 HRES Horizontal Resolution | |
| 2652 | * Bits 0-1 CRES Color Resolution | |
| 2653 | */ | |
| 2648 | /* $FF99 Video Resolution Register | |
| 2649 | * Bit 7 Undefined | |
| 2650 | * Bits 5-6 LPF Lines per Field (Number of Rows) | |
| 2651 | * Bits 2-4 HRES Horizontal Resolution | |
| 2652 | * Bits 0-1 CRES Color Resolution | |
| 2653 | */ | |
| 2654 | 2654 | break; |
| 2655 | 2655 | |
| 2656 | 2656 | case 10: |
| 2657 | /* $FF9A Border Register | |
| 2658 | * Bits 6,7 Unused | |
| 2659 | * Bits 0-5 BRDR Border color | |
| 2660 | */ | |
| 2657 | /* $FF9A Border Register | |
| 2658 | * Bits 6,7 Unused | |
| 2659 | * Bits 0-5 BRDR Border color | |
| 2660 | */ | |
| 2661 | 2661 | break; |
| 2662 | 2662 | |
| 2663 | 2663 | case 12: |
| 2664 | /* $FF9C Vertical Scroll Register | |
| 2665 | * Bits 4-7 Reserved | |
| 2666 | * ! Bits 0-3 VSC Vertical Scroll bits | |
| 2667 | */ | |
| 2664 | /* $FF9C Vertical Scroll Register | |
| 2665 | * Bits 4-7 Reserved | |
| 2666 | * ! Bits 0-3 VSC Vertical Scroll bits | |
| 2667 | */ | |
| 2668 | 2668 | break; |
| 2669 | 2669 | |
| 2670 | 2670 | case 11: |
| 2671 | 2671 | case 13: |
| 2672 | 2672 | case 14: |
| 2673 | /* $FF9B,$FF9D,$FF9E Vertical Offset Registers | |
| 2674 | * | |
| 2675 | * According to JK, if an odd value is placed in $FF9E on the 1986 | |
| 2676 | * GIME, the GIME crashes | |
| 2677 | * | |
| 2678 | * The reason that $FF9B is not mentioned in offical documentation | |
| 2679 | * is because it is only meaninful in CoCo 3's with the 2MB upgrade | |
| 2680 | */ | |
| 2673 | /* $FF9B,$FF9D,$FF9E Vertical Offset Registers | |
| 2674 | * | |
| 2675 | * According to JK, if an odd value is placed in $FF9E on the 1986 | |
| 2676 | * GIME, the GIME crashes | |
| 2677 | * | |
| 2678 | * The reason that $FF9B is not mentioned in offical documentation | |
| 2679 | * is because it is only meaninful in CoCo 3's with the 2MB upgrade | |
| 2680 | */ | |
| 2681 | 2681 | break; |
| 2682 | 2682 | |
| 2683 | 2683 | case 15: |
| 2684 | 2684 | /* |
| 2685 | * $FF9F Horizontal Offset Register | |
| 2686 | * Bit 7 HVEN Horizontal Virtual Enable | |
| 2687 | * Bits 0-6 X0-X6 Horizontal Offset Address | |
| 2688 | * | |
| 2689 | * Unline $FF9D-E, this value can be modified mid frame | |
| 2690 | */ | |
| 2685 | * $FF9F Horizontal Offset Register | |
| 2686 | * Bit 7 HVEN Horizontal Virtual Enable | |
| 2687 | * Bits 0-6 X0-X6 Horizontal Offset Address | |
| 2688 | * | |
| 2689 | * Unline $FF9D-E, this value can be modified mid frame | |
| 2690 | */ | |
| 2691 | 2691 | break; |
| 2692 | 2692 | } |
| 2693 | 2693 | } |
| r5932 | r5933 | |
| 2715 | 2715 | /*************************************************************************** |
| 2716 | 2716 | CARTRIDGE EXPANSION SLOT |
| 2717 | 2717 | |
| 2718 | The bulk of the cartridge handling is in cococart.c and related code, | |
| 2719 | whereas this interfaces with the main CoCo emulation. This code also | |
| 2720 | implements the hacks required to simulate the state where a CoCo | |
| 2721 | cartridge ties the CART line to Q, which cannot be emulated by | |
| 2722 | conventional techniques. | |
| 2718 | The bulk of the cartridge handling is in cococart.c and related code, | |
| 2719 | whereas this interfaces with the main CoCo emulation. This code also | |
| 2720 | implements the hacks required to simulate the state where a CoCo | |
| 2721 | cartridge ties the CART line to Q, which cannot be emulated by | |
| 2722 | conventional techniques. | |
| 2723 | 2723 | |
| 2724 | When the CART line is set to Q, we begin a "twiddle" session - | |
| 2725 | specifically the CART line is toggled on and off twice to ensure that | |
| 2726 | if the PIA is accepting an interrupt, that it will receive it. We also | |
| 2727 | start twiddle sessions when CART is set to Q and the PIA is written to, | |
| 2728 | in order to pick up any interrupt enables that might happen | |
| 2724 | When the CART line is set to Q, we begin a "twiddle" session - | |
| 2725 | specifically the CART line is toggled on and off twice to ensure that | |
| 2726 | if the PIA is accepting an interrupt, that it will receive it. We also | |
| 2727 | start twiddle sessions when CART is set to Q and the PIA is written to, | |
| 2728 | in order to pick up any interrupt enables that might happen | |
| 2729 | 2729 | ***************************************************************************/ |
| 2730 | 2730 | |
| 2731 | 2731 | /*------------------------------------------------- |
| r5932 | r5933 | |
| 2741 | 2741 | |
| 2742 | 2742 | /*------------------------------------------------- |
| 2743 | 2743 | coco3_cart_w - calls coco_cart_w and |
| 2744 | ||
| 2744 | in addition will raise the GIME interrupt | |
| 2745 | 2745 | -------------------------------------------------*/ |
| 2746 | 2746 | |
| 2747 | 2747 | void coco3_cart_w(const device_config *device, int data) |
| r5932 | r5933 | |
| 2776 | 2776 | |
| 2777 | 2777 | /*------------------------------------------------- |
| 2778 | 2778 | coco_pia_1_w - wrapper for pia_1_w() that will |
| 2779 | ||
| 2779 | also call twiddle Q lines, if necessary | |
| 2780 | 2780 | -------------------------------------------------*/ |
| 2781 | 2781 | |
| 2782 | 2782 | WRITE8_DEVICE_HANDLER(coco_pia_1_w) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | tc8521.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Toshiba TC8251 Real Time Clock code | |
| 6 | 6 | |
| 7 | ||
| 7 | (or RICOH RF5C01A) | |
| 8 | 8 | |
| 9 | ||
| 9 | Registers: | |
| 10 | 10 | |
| 11 | ||
| 11 | Page 0/Mode 0 (timer): | |
| 12 | 12 | |
| 13 | 0x00: 1-second counter | |
| 14 | 0x01: 10-second counter | |
| 15 | 0x02: 1-minute counter | |
| 16 | 0x03: 10-minute counter | |
| 17 | 0x04: 1-hour counter | |
| 18 | 0x05: 10-hour counter | |
| 19 | 0x06: day-of-the-week counter | |
| 20 | 0x07: 1-day counter | |
| 21 | 0x08: 10-day counter | |
| 22 | 0x09: 1-month counter | |
| 23 | 0x0A: 10-month counter | |
| 24 | 0x0b: 1-year counter | |
| 25 | 0x0c: 10-year counter | |
| 13 | 0x00: 1-second counter | |
| 14 | 0x01: 10-second counter | |
| 15 | 0x02: 1-minute counter | |
| 16 | 0x03: 10-minute counter | |
| 17 | 0x04: 1-hour counter | |
| 18 | 0x05: 10-hour counter | |
| 19 | 0x06: day-of-the-week counter | |
| 20 | 0x07: 1-day counter | |
| 21 | 0x08: 10-day counter | |
| 22 | 0x09: 1-month counter | |
| 23 | 0x0A: 10-month counter | |
| 24 | 0x0b: 1-year counter | |
| 25 | 0x0c: 10-year counter | |
| 26 | 26 | |
| 27 | Page 1/Mode 1 (alarm): | |
| 28 | 0x00: unused | |
| 29 | 0x01: unused | |
| 30 | 0x02: 1-minute alarm | |
| 31 | 0x03: 10-minute alarm | |
| 32 | 0x04: 1-hour alarm | |
| 33 | 0x05: 10-hour alarm | |
| 34 | 0x06: day-of-the-week alarm | |
| 35 | 0x07: 1-day alarm | |
| 36 | 0x08: 10-day alarm | |
| 37 | 0x09: unused | |
| 38 | 0x0a: 12/24 hour select register | |
| 39 | 0x0b: leap year counter | |
| 40 | 0x0c: unused | |
| 27 | Page 1/Mode 1 (alarm): | |
| 28 | 0x00: unused | |
| 29 | 0x01: unused | |
| 30 | 0x02: 1-minute alarm | |
| 31 | 0x03: 10-minute alarm | |
| 32 | 0x04: 1-hour alarm | |
| 33 | 0x05: 10-hour alarm | |
| 34 | 0x06: day-of-the-week alarm | |
| 35 | 0x07: 1-day alarm | |
| 36 | 0x08: 10-day alarm | |
| 37 | 0x09: unused | |
| 38 | 0x0a: 12/24 hour select register | |
| 39 | 0x0b: leap year counter | |
| 40 | 0x0c: unused | |
| 41 | 41 | |
| 42 | Page 2/Mode 2 (ram block 1) and | |
| 43 | Page 3/Mode 3 (ram block 2): | |
| 44 | 0x00: ram | |
| 45 | 0x01: ram | |
| 46 | 0x02: ram | |
| 47 | 0x03: ram | |
| 48 | 0x04: ram | |
| 49 | 0x05: ram | |
| 50 | 0x06: ram | |
| 51 | 0x07: ram | |
| 52 | 0x08: ram | |
| 53 | 0x09: ram | |
| 54 | 0x0a: ram | |
| 55 | 0x0b: ram | |
| 56 | 0x0c: ram | |
| 42 | Page 2/Mode 2 (ram block 1) and | |
| 43 | Page 3/Mode 3 (ram block 2): | |
| 44 | 0x00: ram | |
| 45 | 0x01: ram | |
| 46 | 0x02: ram | |
| 47 | 0x03: ram | |
| 48 | 0x04: ram | |
| 49 | 0x05: ram | |
| 50 | 0x06: ram | |
| 51 | 0x07: ram | |
| 52 | 0x08: ram | |
| 53 | 0x09: ram | |
| 54 | 0x0a: ram | |
| 55 | 0x0b: ram | |
| 56 | 0x0c: ram | |
| 57 | 57 | |
| 58 | 58 | |
| 59 | ||
| 59 | registers common to all modes: | |
| 60 | 60 | |
| 61 | 0x0d: MODE register | |
| 62 | bit 3: timer enable | |
| 63 | bit 2: alarm enable | |
| 64 | bit 1,0: mode/page select | |
| 65 | 0x0e: test register | |
| 66 | bit 3: test 3 | |
| 67 | bit 2: test 2 | |
| 68 | bit 1: test 1 | |
| 69 | bit 0: test 0 | |
| 70 | 0x0f: RESET etc | |
| 71 | bit 3: 1 Hz enable | |
| 72 | bit 2: 16 Hz enable | |
| 73 | bit 1: timer reset | |
| 74 | bit 0: alarm reset | |
| 61 | 0x0d: MODE register | |
| 62 | bit 3: timer enable | |
| 63 | bit 2: alarm enable | |
| 64 | bit 1,0: mode/page select | |
| 65 | 0x0e: test register | |
| 66 | bit 3: test 3 | |
| 67 | bit 2: test 2 | |
| 68 | bit 1: test 1 | |
| 69 | bit 0: test 0 | |
| 70 | 0x0f: RESET etc | |
| 71 | bit 3: 1 Hz enable | |
| 72 | bit 2: 16 Hz enable | |
| 73 | bit 1: timer reset | |
| 74 | bit 0: alarm reset | |
| 75 | 75 | |
| 76 | 76 | *********************************************************************/ |
| 77 | 77 | |
| r5932 | r5933 | |
| 179 | 179 | |
| 180 | 180 | /*------------------------------------------------- |
| 181 | 181 | tc8521_load_stream - read tc8521 data from |
| 182 | ||
| 182 | supplied file | |
| 183 | 183 | -------------------------------------------------*/ |
| 184 | 184 | |
| 185 | 185 | void tc8521_load_stream(const device_config *device, mame_file *file) |
| r5932 | r5933 | |
| 198 | 198 | |
| 199 | 199 | /*------------------------------------------------- |
| 200 | 200 | tc8521_save_stream - write tc8521 data to |
| 201 | ||
| 201 | supplied file | |
| 202 | 202 | -------------------------------------------------*/ |
| 203 | 203 | |
| 204 | 204 | void tc8521_save_stream(const device_config *device, mame_file *file) |
| r5932 | r5933 | |
|---|---|---|
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | |
| 219 | INLINE mc6854_t* get_safe_token( const device_config *device ) | |
| 219 | INLINE mc6854_t* get_safe_token( const device_config *device ) | |
| 220 | 220 | { |
| 221 | 221 | assert( device != NULL ); |
| 222 | 222 | assert( device->token != NULL ); |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | Changes: |
| 8 | 8 | |
| 9 | 13/2/2002 AK - MBC2 and MBC3 support and added NVRAM support. | |
| 10 | 23/2/2002 AK - MBC5 support, and MBC2 RAM support. | |
| 11 | 13/3/2002 AK - Tidied up the MBC code, window layer now has it's | |
| 12 | own palette. Tidied init code. | |
| 13 | 15/3/2002 AK - More init code tidying with a slight hack to stop | |
| 14 | sound when the machine starts. | |
| 15 | 19/3/2002 AK - Changed NVRAM code to the new battery_* functions. | |
| 16 | 24/3/2002 AK - Added MBC1 mode switching, and partial MBC3 RTC support. | |
| 17 | 28/3/2002 AK - Improved LCD status timing and interrupts. | |
| 18 | Free memory when we shutdown instead of leaking. | |
| 19 | 31/3/2002 AK - Handle IO memory reading so we return 0xFF for registers | |
| 20 | that are unsupported. | |
| 21 | 7/4/2002 AK - Free memory from battery load/save. General tidying. | |
| 22 | 13/4/2002 AK - Ok, don't free memory when we shutdown as that causes | |
| 23 | a crash on reset. | |
| 24 | 28/4/2002 AK - General code tidying. | |
| 25 | Fixed MBC3's RAM/RTC banking. | |
| 26 | Added support for games with more than 128 ROM banks. | |
| 27 | 12/6/2002 AK - Rewrote the way bg and sprite palettes are handled. | |
| 28 | The window layer no longer has it's own palette. | |
| 29 | Added Super Game Boy support. | |
| 30 | 13/6/2002 AK - Added Game Boy Color support. | |
| 9 | 13/2/2002 AK - MBC2 and MBC3 support and added NVRAM support. | |
| 10 | 23/2/2002 AK - MBC5 support, and MBC2 RAM support. | |
| 11 | 13/3/2002 AK - Tidied up the MBC code, window layer now has it's | |
| 12 | own palette. Tidied init code. | |
| 13 | 15/3/2002 AK - More init code tidying with a slight hack to stop | |
| 14 | sound when the machine starts. | |
| 15 | 19/3/2002 AK - Changed NVRAM code to the new battery_* functions. | |
| 16 | 24/3/2002 AK - Added MBC1 mode switching, and partial MBC3 RTC support. | |
| 17 | 28/3/2002 AK - Improved LCD status timing and interrupts. | |
| 18 | Free memory when we shutdown instead of leaking. | |
| 19 | 31/3/2002 AK - Handle IO memory reading so we return 0xFF for registers | |
| 20 | that are unsupported. | |
| 21 | 7/4/2002 AK - Free memory from battery load/save. General tidying. | |
| 22 | 13/4/2002 AK - Ok, don't free memory when we shutdown as that causes | |
| 23 | a crash on reset. | |
| 24 | 28/4/2002 AK - General code tidying. | |
| 25 | Fixed MBC3's RAM/RTC banking. | |
| 26 | Added support for games with more than 128 ROM banks. | |
| 27 | 12/6/2002 AK - Rewrote the way bg and sprite palettes are handled. | |
| 28 | The window layer no longer has it's own palette. | |
| 29 | Added Super Game Boy support. | |
| 30 | 13/6/2002 AK - Added Game Boy Color support. | |
| 31 | 31 | |
| 32 | 17/5/2004 WP - Added Megaduck/Cougar Boy support. | |
| 33 | 13/6/2005 WP - Added support for bootstrap rom banking. | |
| 32 | 17/5/2004 WP - Added Megaduck/Cougar Boy support. | |
| 33 | 13/6/2005 WP - Added support for bootstrap rom banking. | |
| 34 | 34 | |
| 35 | 35 | ***************************************************************************/ |
| 36 | 36 | #define __MACHINE_GB_C |
| r5932 | r5933 | |
| 96 | 96 | static UINT8 sgb_atf_data[4050]; /* (SGB) Attribute files */ |
| 97 | 97 | UINT8 *sgb_tile_data; |
| 98 | 98 | UINT16 sgb_pal[128]; /* SGB palette remapping */ |
| 99 | UINT16 sgb_pal_data[4096]; /* 512 palettes of 4 colours */ | |
| 100 | UINT8 sgb_pal_map[20][18]; /* Palette tile map */ | |
| 101 | UINT8 sgb_tile_map[2048]; /* 32x32 tile map data (0-tile,1-attribute) */ | |
| 102 | UINT8 sgb_window_mask; /* Current GB screen mask */ | |
| 103 | UINT8 sgb_hack; /* Flag set if we're using a hack */ | |
| 99 | UINT16 sgb_pal_data[4096]; /* 512 palettes of 4 colours */ | |
| 100 | UINT8 sgb_pal_map[20][18]; /* Palette tile map */ | |
| 101 | UINT8 sgb_tile_map[2048]; /* 32x32 tile map data (0-tile,1-attribute) */ | |
| 102 | UINT8 sgb_window_mask; /* Current GB screen mask */ | |
| 103 | UINT8 sgb_hack; /* Flag set if we're using a hack */ | |
| 104 | 104 | |
| 105 | 105 | static UINT8 *gb_cart = NULL; |
| 106 | 106 | static UINT8 *gb_cart_ram = NULL; |
| r5932 | r5933 | |
| 160 | 160 | /* #define V_BANK*/ /* Display bank switching debug information */ |
| 161 | 161 | #endif |
| 162 | 162 | |
| 163 | static void gb_init_regs(running_machine *machine) | |
| 163 | static void gb_init_regs(running_machine *machine) | |
| 164 | 164 | { |
| 165 | 165 | /* Initialize the registers */ |
| 166 | 166 | SIODATA = 0x00; |
| r5932 | r5933 | |
| 170 | 170 | gb_io_w( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM ), 0x06, 0x00 ); /* TIMEMOD */ |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | static void gb_rom16_0000( running_machine *machine, UINT8 *addr ) | |
| 173 | static void gb_rom16_0000( running_machine *machine, UINT8 *addr ) | |
| 174 | 174 | { |
| 175 | 175 | memory_set_bankptr( machine, 5, addr ); |
| 176 | 176 | memory_set_bankptr( machine, 10, addr + 0x0100 ); |
| r5932 | r5933 | |
| 178 | 178 | memory_set_bankptr( machine, 11, addr + 0x0900 ); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | static void gb_rom16_4000( running_machine *machine, UINT8 *addr ) | |
| 181 | static void gb_rom16_4000( running_machine *machine, UINT8 *addr ) | |
| 182 | 182 | { |
| 183 | 183 | memory_set_bankptr( machine, 1, addr ); |
| 184 | 184 | memory_set_bankptr( machine, 4, addr + 0x2000 ); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | static void gb_rom8_4000( running_machine *machine, UINT8 *addr ) | |
| 187 | static void gb_rom8_4000( running_machine *machine, UINT8 *addr ) | |
| 188 | 188 | { |
| 189 | 189 | memory_set_bankptr( machine, 1, addr ); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | static void gb_rom8_6000( running_machine *machine, UINT8 *addr ) | |
| 192 | static void gb_rom8_6000( running_machine *machine, UINT8 *addr ) | |
| 193 | 193 | { |
| 194 | 194 | memory_set_bankptr( machine, 4, addr ); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | static void gb_init(running_machine *machine) | |
| 197 | static void gb_init(running_machine *machine) | |
| 198 | 198 | { |
| 199 | 199 | const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ); |
| 200 | 200 | |
| r5932 | r5933 | |
| 328 | 328 | memset( sgb_tile_data, 0, 0x2000 ); |
| 329 | 329 | |
| 330 | 330 | /* Initialize the Sound Registers */ // should be unnecessary with the bootrom |
| 331 | //gb_sound_w(devtag_get_device(machine, "custom"), 0x16,0xF0); | |
| 331 | //gb_sound_w(devtag_get_device(machine, "custom"), 0x16,0xF0); /* F0 for SGB */ | |
| 332 | 332 | //gb_sound_w(devtag_get_device(machine, "custom"), 0x15,0xF3); |
| 333 | 333 | //gb_sound_w(devtag_get_device(machine, "custom"), 0x14,0x77); |
| 334 | 334 | |
| r5932 | r5933 | |
| 337 | 337 | memset( sgb_atf_data, 0, sizeof(sgb_atf_data) ); |
| 338 | 338 | |
| 339 | 339 | /* HACKS for Donkey Kong Land 2 + 3. |
| 340 | For some reason that I haven't figured out, they store the tile | |
| 341 | data differently. Hacks will go once I figure it out */ | |
| 340 | For some reason that I haven't figured out, they store the tile | |
| 341 | data differently. Hacks will go once I figure it out */ | |
| 342 | 342 | sgb_hack = 0; |
| 343 | 343 | |
| 344 | 344 | if (gb_cart) // make sure cart is in |
| r5932 | r5933 | |
| 387 | 387 | memory_set_bankptr(machine, 6, memory_region(machine, "maincpu") + 0x100 ); |
| 388 | 388 | |
| 389 | 389 | /* Allocate memory for internal ram */ |
| 390 | for( ii = 0; ii < 8; ii++ ) | |
| 390 | for( ii = 0; ii < 8; ii++ ) | |
| 391 | 391 | { |
| 392 | 392 | GBC_RAMMap[ii] = mess_ram + CGB_START_RAM_BANKS + ii * 0x1000; |
| 393 | 393 | memset (GBC_RAMMap[ii], 0, 0x1000); |
| r5932 | r5933 | |
| 401 | 401 | return; |
| 402 | 402 | |
| 403 | 403 | /* NOTE: The reason we save the carts RAM this way instead of using MAME's |
| 404 | built in macros is because they force the filename to be the name of | |
| 405 | the machine. We need to have a separate name for each game. */ | |
| 404 | built in macros is because they force the filename to be the name of | |
| 405 | the machine. We need to have a separate name for each game. */ | |
| 406 | 406 | image_battery_save(devtag_get_device(machine, "cart"), gb_cart_ram, RAMBanks * 0x2000 ); |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | static void gb_set_mbc1_banks( running_machine *machine ) | |
| 409 | static void gb_set_mbc1_banks( running_machine *machine ) | |
| 410 | 410 | { |
| 411 | 411 | gb_rom16_4000( machine, ROMMap[ ROMBank ] ); |
| 412 | 412 | memory_set_bankptr( machine, 2, RAMMap[ MBC1Mode ? ( ROMBank >> 5 ) : 0 ] ); |
| r5932 | r5933 | |
| 454 | 454 | static WRITE8_HANDLER( gb_rom_bank_select_mbc5 ) |
| 455 | 455 | { |
| 456 | 456 | /* MBC5 has a 9 bit bank select |
| 457 | Writing into 2000-2FFF sets the lower 8 bits | |
| 458 | Writing into 3000-3FFF sets the 9th bit | |
| 459 | */ | |
| 457 | Writing into 2000-2FFF sets the lower 8 bits | |
| 458 | Writing into 3000-3FFF sets the 9th bit | |
| 459 | */ | |
| 460 | 460 | logerror( "0x%04X: MBC5 ROM Bank select write 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 461 | if( offset & 0x1000 ) | |
| 461 | if( offset & 0x1000 ) | |
| 462 | 462 | { |
| 463 | 463 | ROMBank = (ROMBank & 0xFF ) | ( ( data & 0x01 ) << 8 ); |
| 464 | } | |
| 465 | else | |
| 464 | } | |
| 465 | else | |
| 466 | 466 | { |
| 467 | 467 | ROMBank = (ROMBank & 0x100 ) | data; |
| 468 | 468 | } |
| r5932 | r5933 | |
| 470 | 470 | gb_rom16_4000( space->machine, ROMMap[ROMBank] ); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | static WRITE8_HANDLER( gb_ram_bank_select_mbc6 ) | |
| 473 | static WRITE8_HANDLER( gb_ram_bank_select_mbc6 ) | |
| 474 | 474 | { |
| 475 | 475 | logerror( "0x%04X: write to mbc6 ram enable area: %04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | static WRITE8_HANDLER( gb_rom_bank_select_mbc6_1 ) | |
| 478 | static WRITE8_HANDLER( gb_rom_bank_select_mbc6_1 ) | |
| 479 | 479 | { |
| 480 | 480 | logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), 0x2000 + offset, data ); |
| 481 | if ( offset & 0x0800 ) | |
| 481 | if ( offset & 0x0800 ) | |
| 482 | 482 | { |
| 483 | if ( data == 0x00 ) | |
| 483 | if ( data == 0x00 ) | |
| 484 | 484 | { |
| 485 | 485 | gb_rom8_4000( space->machine, ROMMap[ROMBank>>1] + ( ( ROMBank & 0x01 ) ? 0x2000 : 0x0000 ) ); |
| 486 | 486 | } |
| 487 | } | |
| 488 | else | |
| 487 | } | |
| 488 | else | |
| 489 | 489 | { |
| 490 | 490 | ROMBank = data; |
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | static WRITE8_HANDLER( gb_rom_bank_select_mbc6_2 ) | |
| 494 | static WRITE8_HANDLER( gb_rom_bank_select_mbc6_2 ) | |
| 495 | 495 | { |
| 496 | 496 | logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), 0x3000 + offset, data ); |
| 497 | if ( offset & 0x0800 ) | |
| 497 | if ( offset & 0x0800 ) | |
| 498 | 498 | { |
| 499 | if ( data == 0x00 ) | |
| 499 | if ( data == 0x00 ) | |
| 500 | 500 | { |
| 501 | 501 | gb_rom8_6000( space->machine, ROMMap[ROMBank00>>1] + ( ( ROMBank00 & 0x01 ) ? 0x2000 : 0x0000 ) ); |
| 502 | 502 | } |
| 503 | } | |
| 504 | else | |
| 503 | } | |
| 504 | else | |
| 505 | 505 | { |
| 506 | 506 | ROMBank00 = data; |
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | static WRITE8_HANDLER( gb_rom_bank_select_mbc7 ) | |
| 510 | static WRITE8_HANDLER( gb_rom_bank_select_mbc7 ) | |
| 511 | 511 | { |
| 512 | 512 | logerror( "0x%04X: write to mbc7 rom select register: 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), 0x2000 + offset, data ); |
| 513 | 513 | /* Bit 12 must be set for writing to the mbc register */ |
| 514 | if ( offset & 0x0100 ) | |
| 514 | if ( offset & 0x0100 ) | |
| 515 | 515 | { |
| 516 | 516 | ROMBank = data; |
| 517 | 517 | gb_rom16_4000( space->machine, ROMMap[ROMBank] ); |
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | static WRITE8_HANDLER( gb_rom_bank_unknown_mbc7 ) | |
| 521 | static WRITE8_HANDLER( gb_rom_bank_unknown_mbc7 ) | |
| 522 | 522 | { |
| 523 | 523 | logerror( "0x%04X: write to mbc7 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), 0x3000 + offset, data ); |
| 524 | 524 | /* Bit 12 must be set for writing to the mbc register */ |
| 525 | if ( offset & 0x0100 ) | |
| 525 | if ( offset & 0x0100 ) | |
| 526 | 526 | { |
| 527 | switch( offset & 0x7000 ) | |
| 527 | switch( offset & 0x7000 ) | |
| 528 | 528 | { |
| 529 | 529 | case 0x0000: /* 0x3000-0x3fff */ |
| 530 | 530 | case 0x1000: /* 0x4000-0x4fff */ |
| r5932 | r5933 | |
| 536 | 536 | } |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | static WRITE8_HANDLER( gb_rom_bank_select_wisdom ) | |
| 539 | static WRITE8_HANDLER( gb_rom_bank_select_wisdom ) | |
| 540 | 540 | { |
| 541 | 541 | logerror( "0x%04X: wisdom tree mapper write to address 0x%04X\n", cpu_get_pc( space->cpu ), offset ); |
| 542 | 542 | /* The address determines the bank to select */ |
| r5932 | r5933 | |
| 560 | 560 | static WRITE8_HANDLER( gb_ram_bank_select_mbc3 ) |
| 561 | 561 | { |
| 562 | 562 | logerror( "0x%04X: write mbc3 ram bank select register 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 563 | if( data & 0x8 ) | |
| 563 | if( data & 0x8 ) | |
| 564 | 564 | { /* RTC banks */ |
| 565 | if ( CartType & TIMER ) | |
| 565 | if ( CartType & TIMER ) | |
| 566 | 566 | { |
| 567 | 567 | MBC3RTCBank = data & 0x07; |
| 568 | if ( data < 5 ) | |
| 568 | if ( data < 5 ) | |
| 569 | 569 | { |
| 570 | 570 | memset( MBC3RTCData, MBC3RTCMap[MBC3RTCBank], 0x2000 ); |
| 571 | 571 | memory_set_bankptr( space->machine, 2, MBC3RTCData ); |
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | } | |
| 575 | else | |
| 574 | } | |
| 575 | else | |
| 576 | 576 | { /* RAM banks */ |
| 577 | 577 | RAMBank = data & 0x3; |
| 578 | 578 | MBC3RTCBank = 0xFF; |
| r5932 | r5933 | |
| 585 | 585 | { |
| 586 | 586 | logerror( "0x%04X: MBC5 RAM Bank select write 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 587 | 587 | data &= 0x0F; |
| 588 | if( CartType & RUMBLE ) | |
| 588 | if( CartType & RUMBLE ) | |
| 589 | 589 | { |
| 590 | 590 | data &= 0x7; |
| 591 | 591 | } |
| r5932 | r5933 | |
| 597 | 597 | WRITE8_HANDLER ( gb_ram_enable ) |
| 598 | 598 | { |
| 599 | 599 | /* FIXME: Currently we don't handle this, but a value of 0xA will enable |
| 600 | ||
| 600 | * writing to the cart's RAM banks */ | |
| 601 | 601 | logerror( "0x%04X: Write to ram enable register 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 602 | 602 | } |
| 603 | 603 | |
| r5932 | r5933 | |
| 610 | 610 | static WRITE8_HANDLER( gb_mem_mode_select_mbc3 ) |
| 611 | 611 | { |
| 612 | 612 | logerror( "0x%04X: Write to mbc3 mem mode select register 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data ); |
| 613 | if( CartType & TIMER ) | |
| 613 | if( CartType & TIMER ) | |
| 614 | 614 | { |
| 615 | 615 | /* FIXME: RTC Latch goes here */ |
| 616 | 616 | MBC3RTCMap[0] = 50; /* Seconds */ |
| r5932 | r5933 | |
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | static WRITE8_HANDLER( gb_ram_tama5 ) | |
| 624 | static WRITE8_HANDLER( gb_ram_tama5 ) | |
| 625 | 625 | { |
| 626 | 626 | logerror( "0x%04X: TAMA5 write 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), 0xA000 + offset, data ); |
| 627 | switch( offset & 0x0001 ) | |
| 627 | switch( offset & 0x0001 ) | |
| 628 | 628 | { |
| 629 | 629 | case 0x0000: /* Write to data register */ |
| 630 | switch( gbLastTama5Command ) | |
| 630 | switch( gbLastTama5Command ) | |
| 631 | 631 | { |
| 632 | 632 | case 0x00: /* Bits 0-3 for rom bank selection */ |
| 633 | 633 | ROMBank = ( ROMBank & 0xF0 ) | ( data & 0x0F ); |
| r5932 | r5933 | |
| 648 | 648 | break; |
| 649 | 649 | case 0x07: /* Address selection lo */ |
| 650 | 650 | /* This address always seems to written last, so we'll just |
| 651 | ||
| 651 | execute the command here */ | |
| 652 | 652 | gbTama5Address = ( gbTama5Address & 0xF0 ) | ( data & 0x0F ); |
| 653 | switch ( gbTama5Address & 0xE0 ) | |
| 653 | switch ( gbTama5Address & 0xE0 ) | |
| 654 | 654 | { |
| 655 | 655 | case 0x00: /* Write memory */ |
| 656 | 656 | logerror( "Write tama5 memory 0x%02X <- 0x%02X\n", gbTama5Address & 0x1F, gbTama5Byte ); |
| r5932 | r5933 | |
| 661 | 661 | gbTama5Byte = gbTama5Memory[ gbTama5Address & 0x1F ]; |
| 662 | 662 | break; |
| 663 | 663 | case 0x40: /* Unknown, some kind of read */ |
| 664 | if ( ( gbTama5Address & 0x1F ) == 0x12 ) | |
| 664 | if ( ( gbTama5Address & 0x1F ) == 0x12 ) | |
| 665 | 665 | { |
| 666 | 666 | gbTama5Byte = 0xFF; |
| 667 | 667 | } |
| r5932 | r5933 | |
| 674 | 674 | } |
| 675 | 675 | break; |
| 676 | 676 | case 0x0001: /* Write to control register */ |
| 677 | switch( data ) | |
| 677 | switch( data ) | |
| 678 | 678 | { |
| 679 | 679 | case 0x00: /* Bits 0-3 for rom bank selection */ |
| 680 | 680 | case 0x01: /* Bits 4-7 for rom bank selection */ |
| r5932 | r5933 | |
| 709 | 709 | static UINT8 mmm01_bank; |
| 710 | 710 | static UINT8 mmm01_bank_mask; |
| 711 | 711 | |
| 712 | static WRITE8_HANDLER( gb_rom_bank_mmm01_0000_w ) | |
| 712 | static WRITE8_HANDLER( gb_rom_bank_mmm01_0000_w ) | |
| 713 | 713 | { |
| 714 | 714 | logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( space->cpu ), data, offset+0x000 ); |
| 715 | if ( data & 0x40 ) | |
| 715 | if ( data & 0x40 ) | |
| 716 | 716 | { |
| 717 | 717 | mmm01_bank_offset = mmm01_reg1; |
| 718 | 718 | memory_set_bankptr( space->machine, 5, ROMMap[ mmm01_bank_offset ] ); |
| r5932 | r5933 | |
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | static WRITE8_HANDLER( gb_rom_bank_mmm01_2000_w ) | |
| 724 | static WRITE8_HANDLER( gb_rom_bank_mmm01_2000_w ) | |
| 725 | 725 | { |
| 726 | 726 | logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( space->cpu ), data, offset+0x2000 ); |
| 727 | 727 | |
| 728 | 728 | mmm01_reg1 = data & ROMMask; |
| 729 | 729 | mmm01_bank = mmm01_reg1 & mmm01_bank_mask; |
| 730 | if ( mmm01_bank == 0 ) | |
| 730 | if ( mmm01_bank == 0 ) | |
| 731 | 731 | { |
| 732 | 732 | mmm01_bank = 1; |
| 733 | 733 | } |
| 734 | 734 | gb_rom16_4000( space->machine, ROMMap[ mmm01_bank_offset + mmm01_bank ] ); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | static WRITE8_HANDLER( gb_rom_bank_mmm01_4000_w ) | |
| 737 | static WRITE8_HANDLER( gb_rom_bank_mmm01_4000_w ) | |
| 738 | 738 | { |
| 739 | 739 | logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( space->cpu ), data, offset+0x4000 ); |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | static WRITE8_HANDLER( gb_rom_bank_mmm01_6000_w ) | |
| 742 | static WRITE8_HANDLER( gb_rom_bank_mmm01_6000_w ) | |
| 743 | 743 | { |
| 744 | 744 | logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( space->cpu ), data, offset+0x6000 ); |
| 745 | 745 | /* Not sure if this is correct, Taito Variety Pack sets these values */ |
| 746 | 746 | /* Momotarou Collection 2 writes 01 and 21 here */ |
| 747 | switch( data ) | |
| 747 | switch( data ) | |
| 748 | 748 | { |
| 749 | 749 | case 0x30: mmm01_bank_mask = 0x07; break; |
| 750 | 750 | case 0x38: mmm01_bank_mask = 0x03; break; |
| r5932 | r5933 | |
| 754 | 754 | |
| 755 | 755 | /* Korean MBC1 variant mapping */ |
| 756 | 756 | |
| 757 | static void gb_set_mbc1_kor_banks( running_machine *machine ) | |
| 757 | static void gb_set_mbc1_kor_banks( running_machine *machine ) | |
| 758 | 758 | { |
| 759 | if ( ROMBank & 0x30 ) | |
| 759 | if ( ROMBank & 0x30 ) | |
| 760 | 760 | { |
| 761 | 761 | gb_rom16_0000( machine, ROMMap[ ROMBank & 0x30 ] ); |
| 762 | 762 | } |
| r5932 | r5933 | |
| 809 | 809 | case 0x01: /* SB - Serial transfer data */ |
| 810 | 810 | break; |
| 811 | 811 | case 0x02: /* SC - SIO control */ |
| 812 | switch( data & 0x81 ) | |
| 812 | switch( data & 0x81 ) | |
| 813 | 813 | { |
| 814 | 814 | case 0x00: |
| 815 | 815 | case 0x01: |
| r5932 | r5933 | |
| 832 | 832 | return; |
| 833 | 833 | case 0x05: /* TIMA - Timer counter */ |
| 834 | 834 | /* Check if the counter is being reloaded in this cycle */ |
| 835 | if ( gb_timer.reloading && ( gb_timer.divcount & ( gb_timer.shift_cycles - 1 ) ) == 4 ) | |
| 835 | if ( gb_timer.reloading && ( gb_timer.divcount & ( gb_timer.shift_cycles - 1 ) ) == 4 ) | |
| 836 | 836 | { |
| 837 | 837 | data = TIMECNT; |
| 838 | 838 | } |
| 839 | 839 | break; |
| 840 | 840 | case 0x06: /* TMA - Timer module */ |
| 841 | 841 | /* Check if the counter is being reloaded in this cycle */ |
| 842 | if ( gb_timer.reloading && ( gb_timer.divcount & ( gb_timer.shift_cycles - 1 ) ) == 4 ) | |
| 842 | if ( gb_timer.reloading && ( gb_timer.divcount & ( gb_timer.shift_cycles - 1 ) ) == 4 ) | |
| 843 | 843 | { |
| 844 | 844 | TIMECNT = data; |
| 845 | 845 | } |
| r5932 | r5933 | |
| 847 | 847 | case 0x07: /* TAC - Timer control */ |
| 848 | 848 | data |= 0xF8; |
| 849 | 849 | /* Check if timer is just disabled or the timer frequency is changing */ |
| 850 | if ( ( ! ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) ) || ( ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) && ( data & 0x03 ) != ( TIMEFRQ & 0x03 ) ) ) | |
| 850 | if ( ( ! ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) ) || ( ( data & 0x04 ) && ( TIMEFRQ & 0x04 ) && ( data & 0x03 ) != ( TIMEFRQ & 0x03 ) ) ) | |
| 851 | 851 | { |
| 852 | 852 | /* Check if TIMECNT should be incremented */ |
| 853 | if ( ( gb_timer.divcount & ( gb_timer.shift_cycles - 1 ) ) >= ( gb_timer.shift_cycles >> 1 ) ) | |
| 853 | if ( ( gb_timer.divcount & ( gb_timer.shift_cycles - 1 ) ) >= ( gb_timer.shift_cycles >> 1 ) ) | |
| 854 | 854 | { |
| 855 | 855 | gb_timer_increment(space->machine); |
| 856 | 856 | } |
| r5932 | r5933 | |
| 869 | 869 | |
| 870 | 870 | WRITE8_HANDLER ( gb_io2_w ) |
| 871 | 871 | { |
| 872 | if ( offset == 0x10 ) | |
| 872 | if ( offset == 0x10 ) | |
| 873 | 873 | { |
| 874 | 874 | /* disable BIOS ROM */ |
| 875 | 875 | gb_rom16_0000( space->machine, ROMMap[ROMBank00] ); |
| 876 | } | |
| 877 | else | |
| 876 | } | |
| 877 | else | |
| 878 | 878 | { |
| 879 | 879 | gb_video_w( space, offset, data ); |
| 880 | 880 | } |
| r5932 | r5933 | |
| 937 | 937 | if (sgb_rest) |
| 938 | 938 | { |
| 939 | 939 | /* We should test for this case , but the code below won't |
| 940 | ||
| 940 | work with the current setup */ | |
| 941 | 941 | /* if (sgb_bytecount == 16) |
| 942 | { | |
| 943 | logerror("SGB: end of block is not zero!"); | |
| 944 | sgb_start = 0; | |
| 945 | }*/ | |
| 942 | { | |
| 943 | logerror("SGB: end of block is not zero!"); | |
| 944 | sgb_start = 0; | |
| 945 | }*/ | |
| 946 | 946 | sgb_data[sgb_bytecount] >>= 1; |
| 947 | 947 | sgb_data[sgb_bytecount] |= 0x80; |
| 948 | 948 | sgb_bitcount++; |
| r5932 | r5933 | |
| 1205 | 1205 | break; |
| 1206 | 1206 | case 0x09: /* SOU_TRN */ |
| 1207 | 1207 | /* This command sends data to the SNES sound processor. |
| 1208 | ||
| 1208 | We'll need to emulate that for this to be used */ | |
| 1209 | 1209 | /* Not Implemented */ |
| 1210 | 1210 | break; |
| 1211 | 1211 | case 0x0A: /* PAL_SET */ |
| r5932 | r5933 | |
| 1351 | 1351 | break; |
| 1352 | 1352 | case 0x19: /* ? */ |
| 1353 | 1353 | /* Called by: dkl,dkl2,dkl3,zeldadx |
| 1354 | ||
| 1354 | But I don't know what it is for. */ | |
| 1355 | 1355 | /* Not Implemented */ |
| 1356 | 1356 | break; |
| 1357 | 1357 | case 0x1E: /* Used by bootrom to transfer the gb cart header */ |
| r5932 | r5933 | |
| 1453 | 1453 | gb_dummy_ram_bank = auto_alloc_array( device->machine, UINT8, 0x2000 ); |
| 1454 | 1454 | memset( gb_dummy_ram_bank, 0xFF, 0x2000 ); |
| 1455 | 1455 | |
| 1456 | for(I = 0; I < MAX_ROMBANK; I++) | |
| 1456 | for(I = 0; I < MAX_ROMBANK; I++) | |
| 1457 | 1457 | { |
| 1458 | 1458 | ROMMap[I] = gb_dummy_rom_bank; |
| 1459 | 1459 | } |
| 1460 | for(I = 0; I < MAX_RAMBANK; I++) | |
| 1460 | for(I = 0; I < MAX_RAMBANK; I++) | |
| 1461 | 1461 | { |
| 1462 | 1462 | RAMMap[I] = gb_dummy_ram_bank; |
| 1463 | 1463 | } |
| r5932 | r5933 | |
| 1607 | 1607 | |
| 1608 | 1608 | /* Check for presence of a header, and skip that header */ |
| 1609 | 1609 | J = filesize % 0x4000; |
| 1610 | if ( J == 512 ) | |
| 1610 | if ( J == 512 ) | |
| 1611 | 1611 | { |
| 1612 | 1612 | logerror( "Rom-header found, skipping\n" ); |
| 1613 | 1613 | image_fseek( image, J, SEEK_SET ); |
| r5932 | r5933 | |
| 1615 | 1615 | } |
| 1616 | 1616 | |
| 1617 | 1617 | /* Verify that the file contains 16kb blocks */ |
| 1618 | if ( ( filesize == 0 ) || ( ( filesize % 0x4000 ) != 0 ) ) | |
| 1618 | if ( ( filesize == 0 ) || ( ( filesize % 0x4000 ) != 0 ) ) | |
| 1619 | 1619 | { |
| 1620 | 1620 | image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Invalid rom file size" ); |
| 1621 | 1621 | return INIT_FAIL; |
| r5932 | r5933 | |
| 1625 | 1625 | gb_cart = auto_alloc_array( image->machine, UINT8, filesize ); |
| 1626 | 1626 | |
| 1627 | 1627 | /* Read cartridge */ |
| 1628 | if ( image_fread( image, gb_cart, filesize ) != filesize ) | |
| 1628 | if ( image_fread( image, gb_cart, filesize ) != filesize ) | |
| 1629 | 1629 | { |
| 1630 | 1630 | image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file" ); |
| 1631 | 1631 | return INIT_FAIL; |
| r5932 | r5933 | |
| 1635 | 1635 | ROMBank00 = 0; |
| 1636 | 1636 | |
| 1637 | 1637 | /* Check for presence of MMM01 mapper */ |
| 1638 | if ( filesize >= 0x8000 ) | |
| 1638 | if ( filesize >= 0x8000 ) | |
| 1639 | 1639 | { |
| 1640 | 1640 | static const UINT8 nintendo_logo[0x18] = { |
| 1641 | 1641 | 0xCE, 0xED, 0x66, 0x66, 0xCC, 0x0D, 0x00, 0x0B, |
| r5932 | r5933 | |
| 1644 | 1644 | }; |
| 1645 | 1645 | int bytes_matched = 0; |
| 1646 | 1646 | gb_header = gb_cart + filesize - 0x8000; |
| 1647 | for ( I = 0; I < 0x18; I++ ) | |
| 1647 | for ( I = 0; I < 0x18; I++ ) | |
| 1648 | 1648 | { |
| 1649 | if ( gb_header[0x0104 + I] == nintendo_logo[I] ) | |
| 1649 | if ( gb_header[0x0104 + I] == nintendo_logo[I] ) | |
| 1650 | 1650 | { |
| 1651 | 1651 | bytes_matched++; |
| 1652 | 1652 | } |
| 1653 | 1653 | } |
| 1654 | if ( bytes_matched == 0x18 && gb_header[0x0147] >= 0x0B && gb_header[0x0147] <= 0x0D ) | |
| 1654 | if ( bytes_matched == 0x18 && gb_header[0x0147] >= 0x0B && gb_header[0x0147] <= 0x0D ) | |
| 1655 | 1655 | { |
| 1656 | 1656 | ROMBank00 = ( filesize / 0x4000 ) - 2; |
| 1657 | 1657 | mmm01_bank_offset = ROMBank00; |
| 1658 | } | |
| 1659 | else | |
| 1658 | } | |
| 1659 | else | |
| 1660 | 1660 | { |
| 1661 | 1661 | gb_header = gb_cart; |
| 1662 | 1662 | } |
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | /* Fill in our cart details */ |
| 1666 | switch( gb_header[0x0147] ) | |
| 1666 | switch( gb_header[0x0147] ) | |
| 1667 | 1667 | { |
| 1668 | 1668 | case 0x00: MBCType = MBC_NONE; CartType = 0; break; |
| 1669 | 1669 | case 0x01: MBCType = MBC_MBC1; CartType = 0; break; |
| r5932 | r5933 | |
| 1700 | 1700 | } |
| 1701 | 1701 | |
| 1702 | 1702 | /* Check whether we're dealing with a (possible) Wisdom Tree game here */ |
| 1703 | if ( gb_header[0x0147] == 0x00 ) | |
| 1703 | if ( gb_header[0x0147] == 0x00 ) | |
| 1704 | 1704 | { |
| 1705 | 1705 | int count = 0; |
| 1706 | for( I = 0x0134; I <= 0x014C; I++ ) | |
| 1706 | for( I = 0x0134; I <= 0x014C; I++ ) | |
| 1707 | 1707 | { |
| 1708 | 1708 | count += gb_header[I]; |
| 1709 | 1709 | } |
| 1710 | if ( count == 0 ) | |
| 1710 | if ( count == 0 ) | |
| 1711 | 1711 | { |
| 1712 | 1712 | MBCType = MBC_WISDOM; |
| 1713 | 1713 | } |
| 1714 | 1714 | } |
| 1715 | 1715 | |
| 1716 | 1716 | /* Check if we're dealing with a Korean variant of the MBC1 mapper */ |
| 1717 | if ( MBCType == MBC_MBC1 ) | |
| 1717 | if ( MBCType == MBC_MBC1 ) | |
| 1718 | 1718 | { |
| 1719 | if ( gb_header[0x13F] == 0x42 && gb_header[0x140] == 0x32 && gb_header[0x141] == 0x43 && gb_header[0x142] == 0x4B ) | |
| 1719 | if ( gb_header[0x13F] == 0x42 && gb_header[0x140] == 0x32 && gb_header[0x141] == 0x43 && gb_header[0x142] == 0x4B ) | |
| 1720 | 1720 | { |
| 1721 | 1721 | MBCType = MBC_MBC1_KOR; |
| 1722 | 1722 | } |
| 1723 | 1723 | } |
| 1724 | if ( MBCType == MBC_UNKNOWN ) | |
| 1724 | if ( MBCType == MBC_UNKNOWN ) | |
| 1725 | 1725 | { |
| 1726 | 1726 | image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Unknown mapper type" ); |
| 1727 | 1727 | return INIT_FAIL; |
| 1728 | 1728 | } |
| 1729 | if ( MBCType == MBC_MMM01 ) | |
| 1729 | if ( MBCType == MBC_MMM01 ) | |
| 1730 | 1730 | { |
| 1731 | // image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Mapper MMM01 is not supported yet" ); | |
| 1732 | // return INIT_FAIL; | |
| 1731 | // image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Mapper MMM01 is not supported yet" ); | |
| 1732 | // return INIT_FAIL; | |
| 1733 | 1733 | } |
| 1734 | if ( MBCType == MBC_MBC4 ) | |
| 1734 | if ( MBCType == MBC_MBC4 ) | |
| 1735 | 1735 | { |
| 1736 | 1736 | image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Mapper MBC4 is not supported yet" ); |
| 1737 | 1737 | return INIT_FAIL; |
| 1738 | 1738 | } |
| 1739 | 1739 | /* MBC7 support is still work-in-progress, so only enable it for debug builds */ |
| 1740 | 1740 | #ifndef MAME_DEBUG |
| 1741 | if ( MBCType == MBC_MBC7 ) | |
| 1741 | if ( MBCType == MBC_MBC7 ) | |
| 1742 | 1742 | { |
| 1743 | 1743 | image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Mapper MBC7 is not supported yet" ); |
| 1744 | 1744 | return INIT_FAIL; |
| r5932 | r5933 | |
| 1746 | 1746 | #endif |
| 1747 | 1747 | |
| 1748 | 1748 | ROMBanks = filesize / 0x4000; |
| 1749 | switch( gb_header[0x0148] ) | |
| 1749 | switch( gb_header[0x0148] ) | |
| 1750 | 1750 | { |
| 1751 | 1751 | case 0x52: |
| 1752 | 1752 | reported_rom_banks = 72; |
| r5932 | r5933 | |
| 1766 | 1766 | reported_rom_banks = 256; |
| 1767 | 1767 | break; |
| 1768 | 1768 | } |
| 1769 | if ( ROMBanks != reported_rom_banks && MBCType != MBC_WISDOM ) | |
| 1769 | if ( ROMBanks != reported_rom_banks && MBCType != MBC_WISDOM ) | |
| 1770 | 1770 | { |
| 1771 | 1771 | logerror( "Warning loading cartridge: Filesize and reported ROM banks don't match.\n" ); |
| 1772 | 1772 | } |
| r5932 | r5933 | |
| 1792 | 1792 | } |
| 1793 | 1793 | |
| 1794 | 1794 | /* |
| 1795 | Handle odd-sized cartridges (72,80,96 banks) | |
| 1796 | ROMBanks ROMMask | |
| 1797 | 72 (1001000) 1000111 (71) | |
| 1798 | 80 (1010000) 1001111 (79) | |
| 1799 | 96 (1100000) 1011111 (95) | |
| 1800 | */ | |
| 1795 | Handle odd-sized cartridges (72,80,96 banks) | |
| 1796 | ROMBanks ROMMask | |
| 1797 | 72 (1001000) 1000111 (71) | |
| 1798 | 80 (1010000) 1001111 (79) | |
| 1799 | 96 (1100000) 1011111 (95) | |
| 1800 | */ | |
| 1801 | 1801 | ROMMask = I - 1; |
| 1802 | if ( ( ROMBanks & ROMMask ) != 0 ) | |
| 1802 | if ( ( ROMBanks & ROMMask ) != 0 ) | |
| 1803 | 1803 | { |
| 1804 | for( ; I & ROMBanks; I++ ) | |
| 1804 | for( ; I & ROMBanks; I++ ) | |
| 1805 | 1805 | { |
| 1806 | 1806 | ROMMap[ I ] = ROMMap[ I & ROMMask ]; |
| 1807 | 1807 | } |
| r5932 | r5933 | |
| 1809 | 1809 | } |
| 1810 | 1810 | |
| 1811 | 1811 | /* Fill out the remaining rom bank pointers, if any. */ |
| 1812 | for ( ; I < MAX_ROMBANK; I++ ) | |
| 1812 | for ( ; I < MAX_ROMBANK; I++ ) | |
| 1813 | 1813 | { |
| 1814 | 1814 | ROMMap[ I ] = ROMMap[ I & ROMMask ]; |
| 1815 | 1815 | } |
| r5932 | r5933 | |
| 1849 | 1849 | if( MBCType == MBC_MBC2 ) |
| 1850 | 1850 | RAMBanks = 1; |
| 1851 | 1851 | /* MBC7 has 512 bytes(?) of internal RAM */ |
| 1852 | if ( MBCType == MBC_MBC7 ) | |
| 1852 | if ( MBCType == MBC_MBC7 ) | |
| 1853 | 1853 | { |
| 1854 | 1854 | RAMBanks = 1; |
| 1855 | 1855 | } |
| r5932 | r5933 | |
| 1867 | 1867 | |
| 1868 | 1868 | /* Set up rest of the (mirrored) RAM pages */ |
| 1869 | 1869 | RAMMask = I - 1; |
| 1870 | for ( ; I < MAX_RAMBANK; I++ ) | |
| 1870 | for ( ; I < MAX_RAMBANK; I++ ) | |
| 1871 | 1871 | { |
| 1872 | 1872 | RAMMap[ I ] = RAMMap [ I & RAMMask ]; |
| 1873 | 1873 | } |
| 1874 | } | |
| 1875 | else | |
| 1874 | } | |
| 1875 | else | |
| 1876 | 1876 | { |
| 1877 | 1877 | RAMMask = 0; |
| 1878 | 1878 | } |
| 1879 | 1879 | |
| 1880 | 1880 | /* If there's an RTC claim memory to store the RTC contents */ |
| 1881 | if ( CartType & TIMER ) | |
| 1881 | if ( CartType & TIMER ) | |
| 1882 | 1882 | { |
| 1883 | 1883 | MBC3RTCData = auto_alloc_array(image->machine, UINT8, 0x2000 ); |
| 1884 | 1884 | } |
| 1885 | 1885 | |
| 1886 | if ( MBCType == MBC_TAMA5 ) | |
| 1886 | if ( MBCType == MBC_TAMA5 ) | |
| 1887 | 1887 | { |
| 1888 | 1888 | MBC3RTCData = auto_alloc_array(image->machine, UINT8, 0x2000 ); |
| 1889 | 1889 | memset( gbTama5Memory, 0xFF, sizeof(gbTama5Memory) ); |
| r5932 | r5933 | |
| 1909 | 1909 | /* Decrement number of handled bits */ |
| 1910 | 1910 | SIOCount--; |
| 1911 | 1911 | /* If all bits done, stop timer and trigger interrupt */ |
| 1912 | if ( ! SIOCount ) | |
| 1912 | if ( ! SIOCount ) | |
| 1913 | 1913 | { |
| 1914 | 1914 | SIOCONT &= 0x7F; |
| 1915 | 1915 | timer_enable( gb_serial_timer, 0 ); |
| r5932 | r5933 | |
| 1917 | 1917 | } |
| 1918 | 1918 | } |
| 1919 | 1919 | |
| 1920 | INLINE void gb_timer_check_irq( running_machine *machine ) | |
| 1920 | INLINE void gb_timer_check_irq( running_machine *machine ) | |
| 1921 | 1921 | { |
| 1922 | 1922 | gb_timer.reloading = 0; |
| 1923 | if ( gb_timer.triggering_irq ) | |
| 1923 | if ( gb_timer.triggering_irq ) | |
| 1924 | 1924 | { |
| 1925 | 1925 | gb_timer.triggering_irq = 0; |
| 1926 | if ( TIMECNT == 0 ) | |
| 1926 | if ( TIMECNT == 0 ) | |
| 1927 | 1927 | { |
| 1928 | 1928 | TIMECNT = TIMEMOD; |
| 1929 | 1929 | cputag_set_input_line(machine, "maincpu", TIM_INT, ASSERT_LINE ); |
| r5932 | r5933 | |
| 1932 | 1932 | } |
| 1933 | 1933 | } |
| 1934 | 1934 | |
| 1935 | static void gb_timer_increment( running_machine *machine ) | |
| 1935 | static void gb_timer_increment( running_machine *machine ) | |
| 1936 | 1936 | { |
| 1937 | 1937 | gb_timer_check_irq(machine); |
| 1938 | 1938 | |
| 1939 | 1939 | TIMECNT += 1; |
| 1940 | if ( TIMECNT == 0 ) | |
| 1940 | if ( TIMECNT == 0 ) | |
| 1941 | 1941 | { |
| 1942 | 1942 | gb_timer.triggering_irq = 1; |
| 1943 | 1943 | } |
| 1944 | 1944 | } |
| 1945 | 1945 | |
| 1946 | void gb_timer_callback(const device_config *device, int cycles) | |
| 1946 | void gb_timer_callback(const device_config *device, int cycles) | |
| 1947 | 1947 | { |
| 1948 | 1948 | UINT16 old_gb_divcount = gb_timer.divcount; |
| 1949 | 1949 | gb_timer.divcount += cycles; |
| 1950 | 1950 | |
| 1951 | 1951 | gb_timer_check_irq(device->machine); |
| 1952 | 1952 | |
| 1953 | if ( TIMEFRQ & 0x04 ) | |
| 1953 | if ( TIMEFRQ & 0x04 ) | |
| 1954 | 1954 | { |
| 1955 | 1955 | UINT16 old_count = old_gb_divcount >> gb_timer.shift; |
| 1956 | 1956 | UINT16 new_count = gb_timer.divcount >> gb_timer.shift; |
| 1957 | if ( cycles > gb_timer.shift_cycles ) | |
| 1957 | if ( cycles > gb_timer.shift_cycles ) | |
| 1958 | 1958 | { |
| 1959 | 1959 | gb_timer_increment(device->machine); |
| 1960 | 1960 | old_count++; |
| 1961 | 1961 | } |
| 1962 | if ( new_count != old_count ) | |
| 1962 | if ( new_count != old_count ) | |
| 1963 | 1963 | { |
| 1964 | 1964 | gb_timer_increment(device->machine); |
| 1965 | 1965 | } |
| 1966 | if ( new_count << gb_timer.shift < gb_timer.divcount ) | |
| 1966 | if ( new_count << gb_timer.shift < gb_timer.divcount ) | |
| 1967 | 1967 | { |
| 1968 | 1968 | gb_timer_check_irq(device->machine); |
| 1969 | 1969 | } |
| r5932 | r5933 | |
| 1972 | 1972 | |
| 1973 | 1973 | WRITE8_HANDLER ( gbc_io2_w ) |
| 1974 | 1974 | { |
| 1975 | switch( offset ) | |
| 1975 | switch( offset ) | |
| 1976 | 1976 | { |
| 1977 | 1977 | case 0x0D: /* KEY1 - Prepare speed switch */ |
| 1978 | 1978 | cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), LR35902_SPEED, data ); |
| r5932 | r5933 | |
| 1992 | 1992 | gbc_video_w( space, offset, data ); |
| 1993 | 1993 | } |
| 1994 | 1994 | |
| 1995 | READ8_HANDLER( gbc_io2_r ) | |
| 1995 | READ8_HANDLER( gbc_io2_r ) | |
| 1996 | 1996 | { |
| 1997 | switch( offset ) | |
| 1997 | switch( offset ) | |
| 1998 | 1998 | { |
| 1999 | 1999 | case 0x0D: /* KEY1 */ |
| 2000 | 2000 | return cpu_get_reg( cputag_get_cpu(space->machine, "maincpu"), LR35902_SPEED ); |
| r5932 | r5933 | |
| 2060 | 2060 | { |
| 2061 | 2061 | UINT8 data; |
| 2062 | 2062 | |
| 2063 | if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) ) | |
| 2063 | if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) ) | |
| 2064 | 2064 | { |
| 2065 | 2065 | offset ^= 0x0C; |
| 2066 | 2066 | } |
| r5932 | r5933 | |
| 2072 | 2072 | |
| 2073 | 2073 | WRITE8_HANDLER ( megaduck_video_w ) |
| 2074 | 2074 | { |
| 2075 | if ( !offset ) | |
| 2075 | if ( !offset ) | |
| 2076 | 2076 | { |
| 2077 | 2077 | data = BITSWAP8(data,7,3,5,4,2,1,0,6); |
| 2078 | 2078 | } |
| 2079 | if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) ) | |
| 2079 | if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) ) | |
| 2080 | 2080 | { |
| 2081 | 2081 | offset ^= 0x0C; |
| 2082 | 2082 | } |
| r5932 | r5933 | |
| 2099 | 2099 | |
| 2100 | 2100 | WRITE8_HANDLER( megaduck_sound_w2 ) |
| 2101 | 2101 | { |
| 2102 | switch(offset) | |
| 2102 | switch(offset) | |
| 2103 | 2103 | { |
| 2104 | 2104 | case 0x00: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x10, data ); break; |
| 2105 | 2105 | case 0x01: gb_sound_w(devtag_get_device(space->machine, "custom"), 0x12, data ); break; |
| r5932 | r5933 | |
| 2161 | 2161 | filesize = image_length(image); |
| 2162 | 2162 | ROMBanks = filesize / 0x4000; |
| 2163 | 2163 | |
| 2164 | if ( ( filesize == 0 ) || ( ( filesize % 0x4000 ) != 0 ) ) | |
| 2164 | if ( ( filesize == 0 ) || ( ( filesize % 0x4000 ) != 0 ) ) | |
| 2165 | 2165 | { |
| 2166 | 2166 | image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Invalid rom file size" ); |
| 2167 | 2167 | return INIT_FAIL; |
| r5932 | r5933 | |
| 2171 | 2171 | gb_cart = auto_alloc_array(image->machine, UINT8, filesize); |
| 2172 | 2172 | |
| 2173 | 2173 | /* Read cartridge */ |
| 2174 | if (image_fread (image, gb_cart, filesize) != filesize) | |
| 2174 | if (image_fread (image, gb_cart, filesize) != filesize) | |
| 2175 | 2175 | { |
| 2176 | 2176 | image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file" ); |
| 2177 | 2177 | return INIT_FAIL; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | tc8521.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Toshiba TC8251 Real Time Clock code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 990_hd.c: emulation of a generic ti990 hard disk controller, for use with | |
| 3 | TILINE-based TI990 systems (TI990/10, /12, /12LR, /10A, Business system 300 | |
| 4 | and 300A). | |
| 2 | 990_hd.c: emulation of a generic ti990 hard disk controller, for use with | |
| 3 | TILINE-based TI990 systems (TI990/10, /12, /12LR, /10A, Business system 300 | |
| 4 | and 300A). | |
| 5 | 5 | |
| 6 | This core will emulate the common feature set found in every disk controller. | |
| 7 | Most controllers support additional features, but are still compatible with | |
| 8 | the basic feature set. I have a little documentation on two specific | |
| 9 | disk controllers (WD900 and WD800/WD800A), but I have not tried to emulate | |
| 10 | controller-specific features. | |
| 6 | This core will emulate the common feature set found in every disk controller. | |
| 7 | Most controllers support additional features, but are still compatible with | |
| 8 | the basic feature set. I have a little documentation on two specific | |
| 9 | disk controllers (WD900 and WD800/WD800A), but I have not tried to emulate | |
| 10 | controller-specific features. | |
| 11 | 11 | |
| 12 | 12 | |
| 13 | ||
| 13 | Long description: see 2234398-9701 and 2306140-9701. | |
| 14 | 14 | |
| 15 | 15 | |
| 16 | ||
| 16 | Raphael Nabet 2002-2003 | |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| r5932 | r5933 | |
| 52 | 52 | |
| 53 | 53 | /*INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) |
| 54 | 54 | { |
| 55 | word->bytes[0] = (data >> 24) & 0xff; | |
| 56 | word->bytes[1] = (data >> 16) & 0xff; | |
| 57 | word->bytes[2] = (data >> 8) & 0xff; | |
| 58 | word->bytes[3] = data & 0xff; | |
| 55 | word->bytes[0] = (data >> 24) & 0xff; | |
| 56 | word->bytes[1] = (data >> 16) & 0xff; | |
| 57 | word->bytes[2] = (data >> 8) & 0xff; | |
| 58 | word->bytes[3] = data & 0xff; | |
| 59 | 59 | }*/ |
| 60 | 60 | |
| 61 | 61 | /* disk image header */ |
| r5932 | r5933 | |
| 104 | 104 | w0_unsafe = 0x1000, |
| 105 | 105 | w0_end_of_cylinder = 0x0800, |
| 106 | 106 | w0_seek_incomplete = 0x0400, |
| 107 | /*w0_offset_active | |
| 107 | /*w0_offset_active = 0x0200,*/ | |
| 108 | 108 | w0_pack_change = 0x0100, |
| 109 | 109 | |
| 110 | 110 | w0_attn_lines = 0x00f0, |
| 111 | 111 | w0_attn_mask = 0x000f, |
| 112 | 112 | |
| 113 | 113 | w1_extended_command = 0xc000, |
| 114 | /*w1_strobe_early = 0x2000, | |
| 115 | w1_strobe_late = 0x1000,*/ | |
| 114 | /*w1_strobe_early = 0x2000, | |
| 115 | w1_strobe_late = 0x1000,*/ | |
| 116 | 116 | w1_transfer_inhibit = 0x0800, |
| 117 | 117 | w1_command = 0x0700, |
| 118 | 118 | w1_offset = 0x0080, |
| r5932 | r5933 | |
| 128 | 128 | w7_complete = 0x4000, |
| 129 | 129 | w7_error = 0x2000, |
| 130 | 130 | w7_int_enable = 0x1000, |
| 131 | /*w7_lock_out | |
| 131 | /*w7_lock_out = 0x0800,*/ | |
| 132 | 132 | w7_retry = 0x0400, |
| 133 | 133 | w7_ecc = 0x0200, |
| 134 | 134 | w7_abnormal_completion = 0x0100, |
| r5932 | r5933 | |
| 146 | 146 | static const UINT16 w_mask[8] = |
| 147 | 147 | { |
| 148 | 148 | 0x000f, /* Controllers should prevent overwriting of w0 status bits, and I know |
| 149 | ||
| 149 | that some controllers do so. */ | |
| 150 | 150 | 0xffff, |
| 151 | 151 | 0xffff, |
| 152 | 152 | 0xffff, |
| r5932 | r5933 | |
| 187 | 187 | |
| 188 | 188 | /*DEVICE_STOP( ti990_hd ) |
| 189 | 189 | { |
| 190 | ||
| 190 | d->img = NULL; | |
| 191 | 191 | }*/ |
| 192 | 192 | |
| 193 | 193 | /* |
| 194 | ||
| 194 | Initialize hard disk unit and open a hard disk image | |
| 195 | 195 | */ |
| 196 | 196 | static DEVICE_IMAGE_LOAD( ti990_hd ) |
| 197 | 197 | { |
| r5932 | r5933 | |
| 231 | 231 | |
| 232 | 232 | /* use custom image header. */ |
| 233 | 233 | /* to convert old header-less images to this format, insert a 16-byte |
| 234 | ||
| 234 | header as follow: 00 00 03 8f 00 00 00 05 00 00 00 21 00 00 01 00 */ | |
| 235 | 235 | image_fseek(d->img, 0, SEEK_SET); |
| 236 | 236 | bytes_read = image_fread(d->img, &custom_header, sizeof(custom_header)); |
| 237 | 237 | if (bytes_read != sizeof(custom_header)) |
| r5932 | r5933 | |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /* |
| 271 | ||
| 271 | close a hard disk image | |
| 272 | 272 | */ |
| 273 | 273 | static DEVICE_IMAGE_UNLOAD( ti990_hd ) |
| 274 | 274 | { |
| r5932 | r5933 | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /* |
| 290 | ||
| 290 | Return true if a HD image has been loaded | |
| 291 | 291 | */ |
| 292 | 292 | INLINE int is_unit_loaded(int unit) |
| 293 | 293 | { |
| r5932 | r5933 | |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /* |
| 311 | ||
| 311 | Init the hdc core | |
| 312 | 312 | */ |
| 313 | 313 | MACHINE_START(ti990_hdc) |
| 314 | 314 | { |
| r5932 | r5933 | |
| 344 | 344 | |
| 345 | 345 | |
| 346 | 346 | /* |
| 347 | Parse the disk select lines, and return the corresponding tape unit. | |
| 348 | (-1 if none) | |
| 347 | Parse the disk select lines, and return the corresponding tape unit. | |
| 348 | (-1 if none) | |
| 349 | 349 | */ |
| 350 | 350 | static int cur_disk_unit(void) |
| 351 | 351 | { |
| r5932 | r5933 | |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /* |
| 373 | ||
| 373 | Update interrupt state | |
| 374 | 374 | */ |
| 375 | 375 | static void update_interrupt(running_machine *machine) |
| 376 | 376 | { |
| r5932 | r5933 | |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /* |
| 384 | ||
| 384 | Check that a sector address is valid. | |
| 385 | 385 | |
| 386 | ||
| 386 | Terminate current command and return non-zero if the address is invalid. | |
| 387 | 387 | */ |
| 388 | 388 | static int check_sector_address(running_machine *machine, int unit, unsigned int cylinder, unsigned int head, unsigned int sector) |
| 389 | 389 | { |
| r5932 | r5933 | |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /* |
| 412 | ||
| 412 | Seek to sector whose address is given | |
| 413 | 413 | */ |
| 414 | 414 | static int sector_to_lba(running_machine *machine, int unit, unsigned int cylinder, unsigned int head, unsigned int sector, unsigned int *lba) |
| 415 | 415 | { |
| r5932 | r5933 | |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /* |
| 425 | ||
| 425 | Read one given sector | |
| 426 | 426 | */ |
| 427 | 427 | static int read_sector(int unit, unsigned int lba, void *buffer, unsigned int bytes_to_read) |
| 428 | 428 | { |
| r5932 | r5933 | |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /* |
| 455 | ||
| 455 | Write one given sector | |
| 456 | 456 | */ |
| 457 | 457 | static int write_sector(int unit, unsigned int lba, const void *buffer, unsigned int bytes_to_write) |
| 458 | 458 | { |
| r5932 | r5933 | |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /* |
| 485 | ||
| 485 | Handle the store registers command: read the drive geometry. | |
| 486 | 486 | */ |
| 487 | 487 | static void store_registers(running_machine *machine) |
| 488 | 488 | { |
| r5932 | r5933 | |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | /* |
| 542 | ||
| 542 | Handle the write format command: format a complete track on disk. | |
| 543 | 543 | |
| 544 | ||
| 544 | The emulation just clears the track data in the disk image. | |
| 545 | 545 | */ |
| 546 | 546 | static void write_format(running_machine *machine) |
| 547 | 547 | { |
| r5932 | r5933 | |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | /* |
| 614 | ||
| 614 | Handle the read data command: read a variable number of sectors from disk. | |
| 615 | 615 | */ |
| 616 | 616 | static void read_data(running_machine *machine) |
| 617 | 617 | { |
| r5932 | r5933 | |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /* |
| 714 | ||
| 714 | Handle the write data command: write a variable number of sectors from disk. | |
| 715 | 715 | */ |
| 716 | 716 | static void write_data(running_machine *machine) |
| 717 | 717 | { |
| r5932 | r5933 | |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | /* |
| 826 | ||
| 826 | Handle the unformatted read command: read drive geometry information. | |
| 827 | 827 | */ |
| 828 | 828 | static void unformatted_read(running_machine *machine) |
| 829 | 829 | { |
| r5932 | r5933 | |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | 899 | /* |
| 900 | ||
| 900 | Handle the restore command: return to track 0. | |
| 901 | 901 | */ |
| 902 | 902 | static void restore(running_machine *machine) |
| 903 | 903 | { |
| r5932 | r5933 | |
| 922 | 922 | hdc.d[dsk_sel].unsafe = 0; /* I think */ |
| 923 | 923 | |
| 924 | 924 | /*if (seek_to_sector(dsk_sel, 0, 0, 0)) |
| 925 | ||
| 925 | return;*/ | |
| 926 | 926 | |
| 927 | 927 | hdc.w[7] |= w7_idle | w7_complete; |
| 928 | 928 | update_interrupt(machine); |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | /* |
| 932 | ||
| 932 | Parse command code and execute the command. | |
| 933 | 933 | */ |
| 934 | 934 | static void execute_command(running_machine *machine) |
| 935 | 935 | { |
| r5932 | r5933 | |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | 991 | /* |
| 992 | ||
| 992 | Read one register in TPCS space | |
| 993 | 993 | */ |
| 994 | 994 | READ16_HANDLER(ti990_hdc_r) |
| 995 | 995 | { |
| r5932 | r5933 | |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | /* |
| 1003 | ||
| 1003 | Write one register in TPCS space. Execute command if w7_idle is cleared. | |
| 1004 | 1004 | */ |
| 1005 | 1005 | WRITE16_HANDLER(ti990_hdc_w) |
| 1006 | 1006 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | 990_hd.h: include file for 990_hd.c | |
| 3 | 3 | */ |
| 4 | 4 | #ifndef __990_HD_H_ |
| 5 | 5 | #define __990_HD_H_ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | TI-99/4 and /4a disk controller emulation. | |
| 3 | 3 | |
| 4 | Known disk controllers: | |
| 5 | * TI original SD disk controller. First sold as a side port module | |
| 6 | (PHP1800), later as a card to be inserted in the PE-box (PHP1240). | |
| 7 | Uses a WD1771 FDC, and supports a format of 40 tracks of 9 sectors. | |
| 8 | * TI DD disk controller prototype. Uses some NEC FDC and supports 16 | |
| 9 | sectors per track. (Not emulated) | |
| 10 | * CorComp FDC. Specs unknown, but it supports DD. (Not emulated) | |
| 11 | * SNUG BwG. A nice DD disk controller. Supports 18 sectors per track. | |
| 12 | * Myarc HFDC. Extremely elaborate, supports DD (and even HD, provided that | |
| 13 | a) the data separator is a 9216B and not a 9216, and b) that the OS | |
| 14 | overrides the hfdc DSR, whose HD support is buggy) and MFM harddisks. | |
| 4 | Known disk controllers: | |
| 5 | * TI original SD disk controller. First sold as a side port module | |
| 6 | (PHP1800), later as a card to be inserted in the PE-box (PHP1240). | |
| 7 | Uses a WD1771 FDC, and supports a format of 40 tracks of 9 sectors. | |
| 8 | * TI DD disk controller prototype. Uses some NEC FDC and supports 16 | |
| 9 | sectors per track. (Not emulated) | |
| 10 | * CorComp FDC. Specs unknown, but it supports DD. (Not emulated) | |
| 11 | * SNUG BwG. A nice DD disk controller. Supports 18 sectors per track. | |
| 12 | * Myarc HFDC. Extremely elaborate, supports DD (and even HD, provided that | |
| 13 | a) the data separator is a 9216B and not a 9216, and b) that the OS | |
| 14 | overrides the hfdc DSR, whose HD support is buggy) and MFM harddisks. | |
| 15 | 15 | |
| 16 | An alternative was installing the hexbus controller (which was just a | |
| 17 | prototype, and is not emulated) and connecting a hexbus floppy disk | |
| 18 | controller. The integrated hexbus port was the only supported way to | |
| 19 | attach a floppy drive to a TI-99/2 or a TI-99/5. The integrated hexbus | |
| 20 | port was the recommended way to attach a floppy drive to the TI-99/8, | |
| 21 | but I think this computer supported the TI-99/4(a) disk controllers, too. | |
| 16 | An alternative was installing the hexbus controller (which was just a | |
| 17 | prototype, and is not emulated) and connecting a hexbus floppy disk | |
| 18 | controller. The integrated hexbus port was the only supported way to | |
| 19 | attach a floppy drive to a TI-99/2 or a TI-99/5. The integrated hexbus | |
| 20 | port was the recommended way to attach a floppy drive to the TI-99/8, | |
| 21 | but I think this computer supported the TI-99/4(a) disk controllers, too. | |
| 22 | 22 | |
| 23 | ||
| 23 | Raphael Nabet, 1999-2004. | |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | #include "driver.h" |
| r5932 | r5933 | |
| 66 | 66 | static void *motor_on_timer; |
| 67 | 67 | |
| 68 | 68 | /* |
| 69 | ||
| 69 | call this when the state of DSKhold or DRQ/IRQ or DVENA change | |
| 70 | 70 | |
| 71 | Emulation is faulty because the CPU is actually stopped in the midst of | |
| 72 | instruction, at the end of the memory access | |
| 71 | Emulation is faulty because the CPU is actually stopped in the midst of | |
| 72 | instruction, at the end of the memory access | |
| 73 | 73 | */ |
| 74 | 74 | static void fdc_handle_hold(running_machine *machine) |
| 75 | 75 | { |
| r5932 | r5933 | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /* |
| 83 | ||
| 83 | callback called at the end of DVENA pulse | |
| 84 | 84 | */ |
| 85 | 85 | static TIMER_CALLBACK(motor_on_timer_callback) |
| 86 | 86 | { |
| r5932 | r5933 | |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | 112 | /* |
| 113 | ||
| 113 | Convert physical sector address to sector offset in disk image | |
| 114 | 114 | */ |
| 115 | 115 | static UINT64 ti99_translate_offset(floppy_image *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector) |
| 116 | 116 | { |
| r5932 | r5933 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /* |
| 135 | ||
| 135 | support for 48TPI disks in 96TPI drives | |
| 136 | 136 | */ |
| 137 | 137 | static int ti99_tracktranslate(const device_config *image, floppy_image *floppy, int physical_track) |
| 138 | 138 | { |
| r5932 | r5933 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /* |
| 149 | ||
| 149 | Sniff the geometry of a v9t9 format disk image | |
| 150 | 150 | */ |
| 151 | 151 | static void ti99_guess_geometry(floppy_image *floppy, ti99_geometry *geometry, int *vote, int *success) |
| 152 | 152 | { |
| r5932 | r5933 | |
| 178 | 178 | geometry->secspertrack = vib.secspertrack; |
| 179 | 179 | if (geometry->secspertrack == 0) |
| 180 | 180 | /* Some images might be like this, because the original SSSD TI |
| 181 | ||
| 181 | controller always assumes 9. */ | |
| 182 | 182 | geometry->secspertrack = 9; |
| 183 | 183 | geometry->tracksperside = vib.tracksperside; |
| 184 | 184 | if (geometry->tracksperside == 0) |
| 185 | 185 | /* Some images are like this, because the original SSSD TI |
| 186 | ||
| 186 | controller always assumes 40. */ | |
| 187 | 187 | geometry->tracksperside = 40; |
| 188 | 188 | geometry->sides = vib.sides; |
| 189 | 189 | if (geometry->sides == 0) |
| 190 | 190 | /* Some images are like this, because the original SSSD TI |
| 191 | ||
| 191 | controller always assumes that tracks beyond 40 are on side 2. */ | |
| 192 | 192 | geometry->sides = totsecs / (geometry->secspertrack * geometry->tracksperside); |
| 193 | 193 | geometry->density = vib.density; |
| 194 | 194 | if (geometry->density == 0) |
| r5932 | r5933 | |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /* If we have been unable to parse the format, let us guess according to |
| 211 | ||
| 211 | file lenght */ | |
| 212 | 212 | switch (floppy_image_size(floppy)) |
| 213 | 213 | { |
| 214 | 214 | case 1*40*9*256: /* 90kbytes: SSSD */ |
| r5932 | r5933 | |
| 225 | 225 | return; |
| 226 | 226 | |
| 227 | 227 | case 2*40*9*256: /* 180kbytes: either DSSD or 18-sector-per-track |
| 228 | SSDD. We assume DSSD since DSSD is more common | |
| 229 | and is supported by the original TI SD disk | |
| 230 | controller. */ | |
| 228 | SSDD. We assume DSSD since DSSD is more common | |
| 229 | and is supported by the original TI SD disk | |
| 230 | controller. */ | |
| 231 | 231 | geometry->sides = 2; |
| 232 | 232 | geometry->tracksperside = 40; |
| 233 | 233 | geometry->secspertrack = 9; |
| r5932 | r5933 | |
| 239 | 239 | return; |
| 240 | 240 | |
| 241 | 241 | case 1*40*16*256: /* 160kbytes: 16-sector-per-track SSDD (standard |
| 242 | format for TI DD disk controller prototype, and | |
| 243 | the TI hexbus disk controller???) */ | |
| 242 | format for TI DD disk controller prototype, and | |
| 243 | the TI hexbus disk controller???) */ | |
| 244 | 244 | geometry->sides = 1; |
| 245 | 245 | geometry->tracksperside = 40; |
| 246 | 246 | geometry->secspertrack = 16; |
| r5932 | r5933 | |
| 252 | 252 | return; |
| 253 | 253 | |
| 254 | 254 | case 2*40*16*256: /* 320kbytes: 16-sector-per-track DSDD (standard |
| 255 | format for TI DD disk controller prototype, and | |
| 256 | TI hexbus disk controller???) */ | |
| 255 | format for TI DD disk controller prototype, and | |
| 256 | TI hexbus disk controller???) */ | |
| 257 | 257 | geometry->sides = 2; |
| 258 | 258 | geometry->tracksperside = 40; |
| 259 | 259 | geometry->secspertrack = 16; |
| r5932 | r5933 | |
| 265 | 265 | return; |
| 266 | 266 | |
| 267 | 267 | case 2*40*18*256: /* 360kbytes: 18-sector-per-track DSDD (standard |
| 268 | format for most third-party DD disk controllers, | |
| 269 | but reportedly not supported by the original TI | |
| 270 | DD disk controller) */ | |
| 268 | format for most third-party DD disk controllers, | |
| 269 | but reportedly not supported by the original TI | |
| 270 | DD disk controller) */ | |
| 271 | 271 | geometry->sides = 2; |
| 272 | 272 | geometry->tracksperside = 40; |
| 273 | 273 | geometry->secspertrack = 18; |
| r5932 | r5933 | |
| 279 | 279 | return; |
| 280 | 280 | |
| 281 | 281 | case 2*80*18*256: /* 720kbytes: 18-sector-per-track 80-track DSDD |
| 282 | ||
| 282 | (Myarc only) */ | |
| 283 | 283 | geometry->sides = 2; |
| 284 | 284 | geometry->tracksperside = 80; |
| 285 | 285 | geometry->secspertrack = 18; |
| r5932 | r5933 | |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /* |
| 368 | ||
| 368 | callback called whenever DRQ/IRQ state change | |
| 369 | 369 | */ |
| 370 | 370 | static WD17XX_CALLBACK( fdc_callback ) |
| 371 | 371 | { |
| r5932 | r5933 | |
| 394 | 394 | |
| 395 | 395 | |
| 396 | 396 | /* |
| 397 | Initializes all available controllers. This routine is only used in the | |
| 398 | init state of the emulator. During the normal operation, only the | |
| 399 | reset routines are used. | |
| 397 | Initializes all available controllers. This routine is only used in the | |
| 398 | init state of the emulator. During the normal operation, only the | |
| 399 | reset routines are used. | |
| 400 | 400 | */ |
| 401 | 401 | void ti99_floppy_controllers_init_all(running_machine *machine) |
| 402 | 402 | { |
| r5932 | r5933 | |
| 410 | 410 | |
| 411 | 411 | /*===========================================================================*/ |
| 412 | 412 | /* |
| 413 | ||
| 413 | TI99/4(a) Floppy disk controller card emulation | |
| 414 | 414 | */ |
| 415 | 415 | |
| 416 | 416 | /* prototypes */ |
| r5932 | r5933 | |
| 432 | 432 | }; |
| 433 | 433 | |
| 434 | 434 | /* |
| 435 | ||
| 435 | Reset fdc card, set up handlers | |
| 436 | 436 | */ |
| 437 | 437 | void ti99_fdc_reset(running_machine *machine) |
| 438 | 438 | { |
| r5932 | r5933 | |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /* |
| 456 | ||
| 456 | Read disk CRU interface | |
| 457 | 457 | |
| 458 | bit 0: HLD pin | |
| 459 | bit 1-3: drive n active | |
| 460 | bit 4: 0: motor strobe on | |
| 461 | bit 5: always 0 | |
| 462 | bit 6: always 1 | |
| 463 | bit 7: selected side | |
| 458 | bit 0: HLD pin | |
| 459 | bit 1-3: drive n active | |
| 460 | bit 4: 0: motor strobe on | |
| 461 | bit 5: always 0 | |
| 462 | bit 6: always 1 | |
| 463 | bit 7: selected side | |
| 464 | 464 | */ |
| 465 | 465 | static int fdc_cru_r(running_machine *machine, int offset) |
| 466 | 466 | { |
| r5932 | r5933 | |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /* |
| 490 | ||
| 490 | Write disk CRU interface | |
| 491 | 491 | */ |
| 492 | 492 | static void fdc_cru_w(running_machine *machine, int offset, int data) |
| 493 | 493 | { |
| 494 | 494 | const device_config *fdc = devtag_get_device(machine, "wd179x"); |
| 495 | ||
| 495 | ||
| 496 | 496 | switch (offset) |
| 497 | 497 | { |
| 498 | 498 | case 0: |
| r5932 | r5933 | |
| 513 | 513 | |
| 514 | 514 | case 2: |
| 515 | 515 | /* Set disk ready/hold (bit 2) |
| 516 | 0: ignore IRQ and DRQ | |
| 517 | 1: TMS9900 is stopped until IRQ or DRQ are set (OR the motor stops rotating - rotates | |
| 518 | for 4.23s after write to revelant CRU bit, this is not emulated and could cause | |
| 519 | the TI99 to lock...) */ | |
| 516 | 0: ignore IRQ and DRQ | |
| 517 | 1: TMS9900 is stopped until IRQ or DRQ are set (OR the motor stops rotating - rotates | |
| 518 | for 4.23s after write to revelant CRU bit, this is not emulated and could cause | |
| 519 | the TI99 to lock...) */ | |
| 520 | 520 | DSKhold = data; |
| 521 | 521 | fdc_handle_hold(machine); |
| 522 | 522 | break; |
| r5932 | r5933 | |
| 567 | 567 | |
| 568 | 568 | |
| 569 | 569 | /* |
| 570 | ||
| 570 | read a byte in disk DSR space | |
| 571 | 571 | */ |
| 572 | 572 | static READ8_HANDLER(fdc_mem_r) |
| 573 | 573 | { |
| 574 | 574 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
| 575 | ||
| 575 | ||
| 576 | 576 | switch (offset) |
| 577 | 577 | { |
| 578 | 578 | case 0x1FF0: /* Status register */ |
| r5932 | r5933 | |
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | /* |
| 592 | ||
| 592 | write a byte in disk DSR space | |
| 593 | 593 | */ |
| 594 | 594 | static WRITE8_HANDLER(fdc_mem_w) |
| 595 | 595 | { |
| 596 | 596 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
| 597 | ||
| 597 | ||
| 598 | 598 | data ^= 0xFF; /* inverted data bus */ |
| 599 | 599 | |
| 600 | 600 | switch (offset) |
| r5932 | r5933 | |
| 618 | 618 | #if HAS_99CCFDC |
| 619 | 619 | /*===========================================================================*/ |
| 620 | 620 | /* |
| 621 | ||
| 621 | Alternate fdc: CorcComp FDC | |
| 622 | 622 | |
| 623 | Advantages: | |
| 624 | * this card supports Double Density. | |
| 625 | * this card support an additional floppy drive, for a total of 4 floppies. | |
| 623 | Advantages: | |
| 624 | * this card supports Double Density. | |
| 625 | * this card support an additional floppy drive, for a total of 4 floppies. | |
| 626 | 626 | |
| 627 | References: | |
| 628 | * ??? | |
| 627 | References: | |
| 628 | * ??? | |
| 629 | 629 | */ |
| 630 | 630 | |
| 631 | 631 | /* prototypes */ |
| r5932 | r5933 | |
| 646 | 646 | void ti99_ccfdc_reset(running_machine *machine) |
| 647 | 647 | { |
| 648 | 648 | const device_config *fdc = devtag_get_device(machine, "wd179x"); |
| 649 | ||
| 649 | ||
| 650 | 650 | ti99_disk_DSR = memory_region(machine, region_dsr) + offset_ccfdc_dsr; |
| 651 | 651 | DSEL = 0; |
| 652 | 652 | DSKnum = -1; |
| r5932 | r5933 | |
| 666 | 666 | |
| 667 | 667 | |
| 668 | 668 | /* |
| 669 | ||
| 669 | Read disk CRU interface | |
| 670 | 670 | |
| 671 | bit 0: drive 4 active (not emulated) | |
| 672 | bit 1-3: drive n active | |
| 673 | bit 4-7: dip switches 1-4 | |
| 671 | bit 0: drive 4 active (not emulated) | |
| 672 | bit 1-3: drive n active | |
| 673 | bit 4-7: dip switches 1-4 | |
| 674 | 674 | */ |
| 675 | 675 | static int ccfdc_cru_r(int offset) |
| 676 | 676 | { |
| r5932 | r5933 | |
| 695 | 695 | |
| 696 | 696 | |
| 697 | 697 | /* |
| 698 | ||
| 698 | Write disk CRU interface | |
| 699 | 699 | */ |
| 700 | 700 | static void ccfdc_cru_w(running_machine *machine, int offset, int data) |
| 701 | 701 | { |
| 702 | 702 | const device_config *fdc = devtag_get_device(machine, "wd179x"); |
| 703 | ||
| 703 | ||
| 704 | 704 | switch (offset) |
| 705 | 705 | { |
| 706 | 706 | case 0: |
| r5932 | r5933 | |
| 721 | 721 | |
| 722 | 722 | case 2: |
| 723 | 723 | /* Set disk ready/hold (bit 2) |
| 724 | 0: ignore IRQ and DRQ | |
| 725 | 1: TMS9900 is stopped until IRQ or DRQ are set (OR the motor stops rotating - rotates | |
| 726 | for 4.23s after write to revelant CRU bit, this is not emulated and could cause | |
| 727 | the TI99 to lock...) */ | |
| 724 | 0: ignore IRQ and DRQ | |
| 725 | 1: TMS9900 is stopped until IRQ or DRQ are set (OR the motor stops rotating - rotates | |
| 726 | for 4.23s after write to revelant CRU bit, this is not emulated and could cause | |
| 727 | the TI99 to lock...) */ | |
| 728 | 728 | DSKhold = data; |
| 729 | 729 | fdc_handle_hold(machine); |
| 730 | 730 | break; |
| r5932 | r5933 | |
| 799 | 799 | |
| 800 | 800 | |
| 801 | 801 | /* |
| 802 | ||
| 802 | read a byte in disk DSR space | |
| 803 | 803 | */ |
| 804 | 804 | static READ8_HANDLER(ccfdc_mem_r) |
| 805 | 805 | { |
| r5932 | r5933 | |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /* |
| 814 | ||
| 814 | write a byte in disk DSR space | |
| 815 | 815 | */ |
| 816 | 816 | static WRITE8_HANDLER(ccfdc_mem_w) |
| 817 | 817 | { |
| r5932 | r5933 | |
| 821 | 821 | |
| 822 | 822 | /*===========================================================================*/ |
| 823 | 823 | /* |
| 824 | ||
| 824 | Alternate fdc: BwG card from SNUG | |
| 825 | 825 | |
| 826 | Advantages: | |
| 827 | * this card supports Double Density. | |
| 828 | * as this card includes its own RAM, it does not need to allocate a portion | |
| 829 | of VDP RAM to store I/O buffers. | |
| 830 | * this card includes a MM58274C RTC. | |
| 831 | * this card support an additional floppy drive, for a total of 4 floppies. | |
| 826 | Advantages: | |
| 827 | * this card supports Double Density. | |
| 828 | * as this card includes its own RAM, it does not need to allocate a portion | |
| 829 | of VDP RAM to store I/O buffers. | |
| 830 | * this card includes a MM58274C RTC. | |
| 831 | * this card support an additional floppy drive, for a total of 4 floppies. | |
| 832 | 832 | |
| 833 | Reference: | |
| 834 | * BwG Disketten-Controller: Beschreibung der DSR | |
| 835 | <http://home.t-online.de/home/harald.glaab/snug/bwg.pdf> | |
| 833 | Reference: | |
| 834 | * BwG Disketten-Controller: Beschreibung der DSR | |
| 835 | <http://home.t-online.de/home/harald.glaab/snug/bwg.pdf> | |
| 836 | 836 | */ |
| 837 | 837 | |
| 838 | 838 | /* prototypes */ |
| r5932 | r5933 | |
| 856 | 856 | |
| 857 | 857 | |
| 858 | 858 | /* |
| 859 | ||
| 859 | Reset fdc card, set up handlers | |
| 860 | 860 | */ |
| 861 | 861 | void ti99_bwg_reset(running_machine *machine) |
| 862 | 862 | { |
| 863 | 863 | const device_config *fdc = devtag_get_device(machine, "wd179x"); |
| 864 | ||
| 864 | ||
| 865 | 865 | ti99_disk_DSR = memory_region(machine, region_dsr) + offset_bwg_dsr; |
| 866 | 866 | bwg_ram = memory_region(machine, region_dsr) + offset_bwg_ram; |
| 867 | 867 | bwg_ram_offset = 0; |
| r5932 | r5933 | |
| 874 | 874 | |
| 875 | 875 | DVENA = 0; |
| 876 | 876 | motor_on = 0; |
| 877 | ||
| 877 | ||
| 878 | 878 | use_80_track_drives = FALSE; |
| 879 | ||
| 879 | ||
| 880 | 880 | ti99_peb_set_card_handlers(0x1100, & bwg_handlers); |
| 881 | 881 | |
| 882 | 882 | wd17xx_reset(fdc); /* initialize the floppy disk controller */ |
| r5932 | r5933 | |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | /* |
| 887 | ||
| 887 | Read disk CRU interface | |
| 888 | 888 | |
| 889 | bit 0: drive 4 active (not emulated) | |
| 890 | bit 1-3: drive n active | |
| 891 | bit 4-7: dip switches 1-4 | |
| 889 | bit 0: drive 4 active (not emulated) | |
| 890 | bit 1-3: drive n active | |
| 891 | bit 4-7: dip switches 1-4 | |
| 892 | 892 | */ |
| 893 | 893 | static int bwg_cru_r(running_machine *machine, int offset) |
| 894 | 894 | { |
| r5932 | r5933 | |
| 913 | 913 | |
| 914 | 914 | |
| 915 | 915 | /* |
| 916 | ||
| 916 | Write disk CRU interface | |
| 917 | 917 | */ |
| 918 | 918 | static void bwg_cru_w(running_machine *machine, int offset, int data) |
| 919 | 919 | { |
| 920 | 920 | const device_config *fdc = devtag_get_device(machine, "wd179x"); |
| 921 | ||
| 921 | ||
| 922 | 922 | switch (offset) |
| 923 | 923 | { |
| 924 | 924 | case 0: |
| r5932 | r5933 | |
| 939 | 939 | |
| 940 | 940 | case 2: |
| 941 | 941 | /* Set disk ready/hold (bit 2) |
| 942 | 0: ignore IRQ and DRQ | |
| 943 | 1: TMS9900 is stopped until IRQ or DRQ are set (OR the motor stops rotating - rotates | |
| 944 | for 4.23s after write to revelant CRU bit, this is not emulated and could cause | |
| 945 | the TI99 to lock...) */ | |
| 942 | 0: ignore IRQ and DRQ | |
| 943 | 1: TMS9900 is stopped until IRQ or DRQ are set (OR the motor stops rotating - rotates | |
| 944 | for 4.23s after write to revelant CRU bit, this is not emulated and could cause | |
| 945 | the TI99 to lock...) */ | |
| 946 | 946 | DSKhold = data; |
| 947 | 947 | fdc_handle_hold(machine); |
| 948 | 948 | break; |
| r5932 | r5933 | |
| 1030 | 1030 | |
| 1031 | 1031 | |
| 1032 | 1032 | /* |
| 1033 | ||
| 1033 | read a byte in disk DSR space | |
| 1034 | 1034 | */ |
| 1035 | 1035 | static READ8_HANDLER(bwg_mem_r) |
| 1036 | 1036 | { |
| 1037 | 1037 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
| 1038 | ||
| 1038 | ||
| 1039 | 1039 | int reply = 0; |
| 1040 | 1040 | |
| 1041 | 1041 | if (offset < 0x1c00) |
| r5932 | r5933 | |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | /* |
| 1078 | ||
| 1078 | write a byte in disk DSR space | |
| 1079 | 1079 | */ |
| 1080 | 1080 | static WRITE8_HANDLER(bwg_mem_w) |
| 1081 | 1081 | { |
| 1082 | 1082 | const device_config *fdc = devtag_get_device(space->machine, "wd179x"); |
| 1083 | ||
| 1083 | ||
| 1084 | 1084 | if (offset < 0x1c00) |
| 1085 | 1085 | ; |
| 1086 | 1086 | else if (offset < 0x1fe0) |
| r5932 | r5933 | |
| 1120 | 1120 | |
| 1121 | 1121 | /*===========================================================================*/ |
| 1122 | 1122 | /* |
| 1123 | ||
| 1123 | Alternate fdc: HFDC card built by Myarc | |
| 1124 | 1124 | |
| 1125 | Advantages: same as BwG, plus: | |
| 1126 | * high density support (only on upgraded cards, I think) | |
| 1127 | * hard disk support (only prehistoric mfm hard disks are supported, though) | |
| 1128 | * DMA support (I think the DMA controller can only access the on-board RAM) | |
| 1125 | Advantages: same as BwG, plus: | |
| 1126 | * high density support (only on upgraded cards, I think) | |
| 1127 | * hard disk support (only prehistoric mfm hard disks are supported, though) | |
| 1128 | * DMA support (I think the DMA controller can only access the on-board RAM) | |
| 1129 | 1129 | |
| 1130 | This card includes a MM58274C RTC and a 9234 HFDC with its various support | |
| 1131 | chips. | |
| 1130 | This card includes a MM58274C RTC and a 9234 HFDC with its various support | |
| 1131 | chips. | |
| 1132 | 1132 | |
| 1133 | Reference: | |
| 1134 | * hfdc manual | |
| 1135 | <ftp://ftp.whtech.com//datasheets & manuals/Hardware manuals/hfdc manual.max> | |
| 1133 | Reference: | |
| 1134 | * hfdc manual | |
| 1135 | <ftp://ftp.whtech.com//datasheets & manuals/Hardware manuals/hfdc manual.max> | |
| 1136 | 1136 | */ |
| 1137 | 1137 | |
| 1138 | 1138 | /* prototypes */ |
| r5932 | r5933 | |
| 1157 | 1157 | static int hfdc_irq_state; |
| 1158 | 1158 | |
| 1159 | 1159 | /* |
| 1160 | Select the correct HFDC disk units. | |
| 1161 | floppy disks are selected by the 4 gpos instead of the select lines. | |
| 1160 | Select the correct HFDC disk units. | |
| 1161 | floppy disks are selected by the 4 gpos instead of the select lines. | |
| 1162 | 1162 | */ |
| 1163 | 1163 | static int hfdc_select_callback(int which, select_mode_t select_mode, int select_line, int gpos) |
| 1164 | 1164 | { |
| r5932 | r5933 | |
| 1178 | 1178 | case sm_floppy_fast: |
| 1179 | 1179 | /* floppy disk */ |
| 1180 | 1180 | /* We use the 4 general purpose output as select lines in order to |
| 1181 | ||
| 1181 | support 4 drives. */ | |
| 1182 | 1182 | switch (gpos & 0xf) |
| 1183 | 1183 | { |
| 1184 | 1184 | case 1: |
| r5932 | r5933 | |
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /* |
| 1211 | ||
| 1211 | Read a byte from buffer in DMA mode | |
| 1212 | 1212 | */ |
| 1213 | 1213 | static UINT8 hfdc_dma_read_callback(int which, offs_t offset) |
| 1214 | 1214 | { |
| r5932 | r5933 | |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | /* |
| 1220 | ||
| 1220 | Write a byte to buffer in DMA mode | |
| 1221 | 1221 | */ |
| 1222 | 1222 | static void hfdc_dma_write_callback(int which, offs_t offset, UINT8 data) |
| 1223 | 1223 | { |
| r5932 | r5933 | |
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | /* |
| 1229 | ||
| 1229 | Called whenever the state of the sms9234 interrupt pin changes. | |
| 1230 | 1230 | */ |
| 1231 | 1231 | static void hfdc_int_callback(int which, int state) |
| 1232 | 1232 | { |
| r5932 | r5933 | |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | /* |
| 1239 | ||
| 1239 | Reset fdc card, set up handlers | |
| 1240 | 1240 | */ |
| 1241 | 1241 | void ti99_hfdc_reset(running_machine *machine) |
| 1242 | 1242 | { |
| r5932 | r5933 | |
| 1262 | 1262 | |
| 1263 | 1263 | |
| 1264 | 1264 | /* |
| 1265 | ||
| 1265 | Read disk CRU interface | |
| 1266 | 1266 | */ |
| 1267 | 1267 | static int hfdc_cru_r(running_machine *machine, int offset) |
| 1268 | 1268 | { |
| r5932 | r5933 | |
| 1273 | 1273 | /* CRU bits */ |
| 1274 | 1274 | if (cru_sel) |
| 1275 | 1275 | /* DIP switches. Logic levels are inverted (on->0, off->1). CRU |
| 1276 | bit order is the reverse of DIP-switch order, too (dip 1 -> bit 7, | |
| 1277 | dip 8 -> bit 0). Return value examples: | |
| 1278 | ff -> 4 slow 40-track DD drives | |
| 1279 | 55 -> 4 fast 40-track DD drives | |
| 1280 | aa -> 4 80-track DD drives | |
| 1281 | 00 -> 4 80-track HD drives */ | |
| 1276 | bit order is the reverse of DIP-switch order, too (dip 1 -> bit 7, | |
| 1277 | dip 8 -> bit 0). Return value examples: | |
| 1278 | ff -> 4 slow 40-track DD drives | |
| 1279 | 55 -> 4 fast 40-track DD drives | |
| 1280 | aa -> 4 80-track DD drives | |
| 1281 | 00 -> 4 80-track HD drives */ | |
| 1282 | 1282 | reply = use_80_track_drives ? 0x00 : 0x55; |
| 1283 | 1283 | else |
| 1284 | 1284 | { |
| r5932 | r5933 | |
| 1288 | 1288 | if (motor_on) |
| 1289 | 1289 | reply |= 2; |
| 1290 | 1290 | /*if (hfdc_dma_in_progress) |
| 1291 | ||
| 1291 | reply |= 4;*/ | |
| 1292 | 1292 | } |
| 1293 | 1293 | break; |
| 1294 | 1294 | |
| r5932 | r5933 | |
| 1302 | 1302 | |
| 1303 | 1303 | |
| 1304 | 1304 | /* |
| 1305 | ||
| 1305 | Write disk CRU interface | |
| 1306 | 1306 | */ |
| 1307 | 1307 | static void hfdc_cru_w(running_machine *machine, int offset, int data) |
| 1308 | 1308 | { |
| r5932 | r5933 | |
| 1377 | 1377 | |
| 1378 | 1378 | |
| 1379 | 1379 | /* |
| 1380 | ||
| 1380 | read a byte in disk DSR space | |
| 1381 | 1381 | */ |
| 1382 | 1382 | static READ8_HANDLER(hfdc_mem_r) |
| 1383 | 1383 | { |
| r5932 | r5933 | |
| 1430 | 1430 | } |
| 1431 | 1431 | |
| 1432 | 1432 | /* |
| 1433 | ||
| 1433 | write a byte in disk DSR space | |
| 1434 | 1434 | */ |
| 1435 | 1435 | static WRITE8_HANDLER(hfdc_mem_w) |
| 1436 | 1436 | { |
| r5932 | r5933 | |
|---|---|---|
| 80 | 80 | gamecom_clock_timer = timer_alloc(machine, gamecom_clock_timer_callback , NULL); |
| 81 | 81 | |
| 82 | 82 | /* intialize the empty dummy bank */ |
| 83 | if ( dummy_bank == NULL ) | |
| 83 | if ( dummy_bank == NULL ) | |
| 84 | 84 | { |
| 85 | 85 | dummy_bank = auto_alloc_array(machine, UINT8, 8 * 1024 ); |
| 86 | 86 | } |
| r5932 | r5933 | |
| 95 | 95 | gamecom_internal_w( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), SM8521_WDTC, 0x38 ); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | static void gamecom_set_mmu( running_machine *machine, int mmu, UINT8 data ) | |
| 98 | static void gamecom_set_mmu( running_machine *machine, int mmu, UINT8 data ) | |
| 99 | 99 | { |
| 100 | if ( data < 32 ) | |
| 100 | if ( data < 32 ) | |
| 101 | 101 | { |
| 102 | 102 | /* select internal ROM bank */ |
| 103 | 103 | memory_set_bankptr( machine, mmu, memory_region(machine, "user1") + (data << 13) ); |
| 104 | } | |
| 105 | else | |
| 104 | } | |
| 105 | else | |
| 106 | 106 | { |
| 107 | 107 | /* select cartridge bank */ |
| 108 | if ( cartridge == NULL ) | |
| 108 | if ( cartridge == NULL ) | |
| 109 | 109 | { |
| 110 | 110 | memory_set_bankptr( machine, mmu, dummy_bank ); |
| 111 | } | |
| 112 | else | |
| 111 | } | |
| 112 | else | |
| 113 | 113 | { |
| 114 | 114 | memory_set_bankptr( machine, mmu, cartridge + ( data << 13 ) ); |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | static void handle_stylus_press( running_machine *machine, UINT8 column ) | |
| 119 | static void handle_stylus_press( running_machine *machine, UINT8 column ) | |
| 120 | 120 | { |
| 121 | 121 | static const UINT16 row_data[10] = { 0x3FE, 0x3FD, 0x3FB, 0x3F7, 0x3EF, 0x3DF, 0x3BF, 0x37F, 0x2FF, 0x1FF }; |
| 122 | 122 | static UINT32 stylus_x; |
| 123 | 123 | static UINT32 stylus_y; |
| 124 | 124 | |
| 125 | if ( column == 0 ) | |
| 125 | if ( column == 0 ) | |
| 126 | 126 | { |
| 127 | if ( ! ( input_port_read(machine, "IN2") & 0x04 ) ) | |
| 127 | if ( ! ( input_port_read(machine, "IN2") & 0x04 ) ) | |
| 128 | 128 | { |
| 129 | 129 | stylus_x = input_port_read(machine, "STYX") >> 4; |
| 130 | 130 | stylus_y = input_port_read(machine, "STYY") >> 4; |
| 131 | } | |
| 132 | else | |
| 131 | } | |
| 132 | else | |
| 133 | 133 | { |
| 134 | 134 | stylus_x = 16; |
| 135 | 135 | stylus_y = 16; |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | if ( stylus_x == column ) | |
| 139 | if ( stylus_x == column ) | |
| 140 | 140 | { |
| 141 | 141 | cpu_set_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P0, row_data[stylus_y] & 0xFF ); |
| 142 | 142 | cpu_set_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P1, ( cpu_get_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P1 ) & 0xFC ) | ( ( row_data[stylus_y] >> 8 ) & 0x03 ) ); |
| 143 | } | |
| 144 | else | |
| 143 | } | |
| 144 | else | |
| 145 | 145 | { |
| 146 | 146 | cpu_set_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P0, 0xFF ); |
| 147 | 147 | cpu_set_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P1, ( cpu_get_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P1 ) & 0xFC ) | 0x03 ); |
| r5932 | r5933 | |
| 150 | 150 | |
| 151 | 151 | WRITE8_HANDLER( gamecom_internal_w ) |
| 152 | 152 | { |
| 153 | if ( offset >= 0x80 ) | |
| 153 | if ( offset >= 0x80 ) | |
| 154 | 154 | { |
| 155 | 155 | internal_ram[offset] = data; |
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | switch( offset ) | |
| 159 | switch( offset ) | |
| 160 | 160 | { |
| 161 | 161 | case SM8521_IE0: cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_IE0, data ); return; |
| 162 | 162 | case SM8521_IE1: cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_IE1, data ); return; |
| r5932 | r5933 | |
| 165 | 165 | case SM8521_P0: cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P0, data ); return; |
| 166 | 166 | case SM8521_P1: cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P1, data ); return; |
| 167 | 167 | case SM8521_P2: cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P2, data ); |
| 168 | switch( ( cpu_get_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P1 ) << 8 ) | data ) | |
| 168 | switch( ( cpu_get_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P1 ) << 8 ) | data ) | |
| 169 | 169 | { |
| 170 | 170 | case 0xFBFF: /* column #0 */ |
| 171 | 171 | /* P0 bit 0 cleared => 01 */ |
| r5932 | r5933 | |
| 250 | 250 | /* P3 bit7 clear, bit6 set -> enable cartridge port #0? */ |
| 251 | 251 | /* P3 bit6 clear, bit7 set -> enable cartridge port #1? */ |
| 252 | 252 | cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P3, data ); |
| 253 | switch( data & 0xc0 ) | |
| 253 | switch( data & 0xc0 ) | |
| 254 | 254 | { |
| 255 | 255 | case 0x40: cartridge = cartridge1; break; |
| 256 | 256 | case 0x80: cartridge = cartridge2; break; |
| r5932 | r5933 | |
| 290 | 290 | |
| 291 | 291 | /* Video hardware and DMA */ |
| 292 | 292 | case SM8521_LCDC: |
| 293 | // | |
| 293 | // logerror( "%X: Setting LCDC to %X\n", activecpu_get_pc(), data ); | |
| 294 | 294 | break; |
| 295 | 295 | case SM8521_LCH: |
| 296 | 296 | break; |
| r5932 | r5933 | |
| 302 | 302 | gamecom_dma.decrement_x = data & 0x08; |
| 303 | 303 | gamecom_dma.decrement_y = data & 0x10; |
| 304 | 304 | gamecom_dma.enabled = data & 0x80; |
| 305 | if ( gamecom_dma.enabled ) | |
| 305 | if ( gamecom_dma.enabled ) | |
| 306 | 306 | { |
| 307 | 307 | gamecom_dma_init(space->machine); |
| 308 | 308 | } |
| r5932 | r5933 | |
| 344 | 344 | gamecom_timer[1].counter = 0; |
| 345 | 345 | break; |
| 346 | 346 | case SM8521_CLKT: /* bit 6-7 */ |
| 347 | if ( data & 0x80 ) | |
| 347 | if ( data & 0x80 ) | |
| 348 | 348 | { |
| 349 | 349 | /* timer run */ |
| 350 | if ( data & 0x40 ) | |
| 350 | if ( data & 0x40 ) | |
| 351 | 351 | { |
| 352 | 352 | /* timer resolution 1 minute */ |
| 353 | 353 | timer_adjust_periodic(gamecom_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(60)); |
| 354 | } | |
| 355 | else | |
| 354 | } | |
| 355 | else | |
| 356 | 356 | { |
| 357 | 357 | /* TImer resolution 1 second */ |
| 358 | 358 | timer_adjust_periodic(gamecom_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1)); |
| 359 | 359 | } |
| 360 | } | |
| 361 | else | |
| 360 | } | |
| 361 | else | |
| 362 | 362 | { |
| 363 | 363 | /* disable timer reset */ |
| 364 | 364 | timer_enable( gamecom_clock_timer, 0 ); |
| r5932 | r5933 | |
| 384 | 384 | READ8_HANDLER( gamecom_internal_r ) |
| 385 | 385 | { |
| 386 | 386 | /* NPW 22-Dec-2008 - Shouldn't this entire function be moved to an internal memory map of the CPU core? */ |
| 387 | if ( offset >= 0x80 ) | |
| 387 | if ( offset >= 0x80 ) | |
| 388 | 388 | { |
| 389 | 389 | return internal_ram[offset]; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | switch( offset ) | |
| 392 | switch( offset ) | |
| 393 | 393 | { |
| 394 | 394 | case SM8521_R0: case SM8521_R1: case SM8521_R2: case SM8521_R3: |
| 395 | 395 | case SM8521_R4: case SM8521_R5: case SM8521_R6: case SM8521_R7: |
| r5932 | r5933 | |
| 417 | 417 | case SM8521_P3C: return cpu_get_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P3C ); |
| 418 | 418 | case SM8521_TM0D: return gamecom_timer[0].counter; |
| 419 | 419 | case SM8521_TM1D: return gamecom_timer[1].counter; |
| 420 | // case SM8521_CLKT: /* bit 0-5 read only, 6-7 read/write */ | |
| 421 | // return ( gamecom_internal_registers[offset] & 0xC0 ) | ( clock_timer_val & 0x3F ); | |
| 420 | // case SM8521_CLKT: /* bit 0-5 read only, 6-7 read/write */ | |
| 421 | // return ( gamecom_internal_registers[offset] & 0xC0 ) | ( clock_timer_val & 0x3F ); | |
| 422 | 422 | |
| 423 | 423 | /* Reserved addresses */ |
| 424 | 424 | case SM8521_18: case SM8521_1B: |
| r5932 | r5933 | |
| 429 | 429 | case SM8521_55: case SM8521_56: case SM8521_57: case SM8521_58: |
| 430 | 430 | case SM8521_59: case SM8521_5A: case SM8521_5B: case SM8521_5C: |
| 431 | 431 | case SM8521_5D: |
| 432 | // | |
| 432 | // logerror( "%X: Read from reserved address (0x%02X)\n", cpu_get_pc(space->cpu), offset ); | |
| 433 | 433 | break; |
| 434 | 434 | |
| 435 | 435 | } |
| r5932 | r5933 | |
| 438 | 438 | |
| 439 | 439 | /* The manual is not conclusive as to which bit of the DMVP register (offset 0x3D) determines |
| 440 | 440 | which page for source or destination is used */ |
| 441 | static void gamecom_dma_init(running_machine *machine) | |
| 441 | static void gamecom_dma_init(running_machine *machine) | |
| 442 | 442 | { |
| 443 | if ( gamecom_dma.decrement_x || gamecom_dma.decrement_y ) | |
| 443 | if ( gamecom_dma.decrement_x || gamecom_dma.decrement_y ) | |
| 444 | 444 | { |
| 445 | 445 | logerror( "TODO: Decrement-x and decrement-y are not supported yet\n" ); |
| 446 | 446 | } |
| r5932 | r5933 | |
| 462 | 462 | gamecom_dma.palette[3] = ( gamecom_internal_registers[SM8521_DMPL] & 0xC0 ) >> 6; |
| 463 | 463 | gamecom_dma.source_mask = 0x1FFF; |
| 464 | 464 | gamecom_dma.dest_mask = 0x1FFF; |
| 465 | // logerror("DMA: width %Xx%X, source (%X,%X), dest (%X,%X), transfer_mode %X, banks %X \n", gamecom_dma.width_x, gamecom_dma.width_y, gamecom_dma.source_x, gamecom_dma.source_y, gamecom_dma.dest_x, gamecom_dma.dest_y, gamecom_dma.transfer_mode, gamecom_internal_registers[SM8521_DMVP] ); | |
| 466 | // logerror( " Palette: %d, %d, %d, %d\n", gamecom_dma.palette[0], gamecom_dma.palette[1], gamecom_dma.palette[2], gamecom_dma.palette[3] ); | |
| 467 | switch( gamecom_dma.transfer_mode ) | |
| 465 | // logerror("DMA: width %Xx%X, source (%X,%X), dest (%X,%X), transfer_mode %X, banks %X \n", gamecom_dma.width_x, gamecom_dma.width_y, gamecom_dma.source_x, gamecom_dma.source_y, gamecom_dma.dest_x, gamecom_dma.dest_y, gamecom_dma.transfer_mode, gamecom_internal_registers[SM8521_DMVP] ); | |
| 466 | // logerror( " Palette: %d, %d, %d, %d\n", gamecom_dma.palette[0], gamecom_dma.palette[1], gamecom_dma.palette[2], gamecom_dma.palette[3] ); | |
| 467 | switch( gamecom_dma.transfer_mode ) | |
| 468 | 468 | { |
| 469 | 469 | case 0x00: |
| 470 | 470 | /* VRAM->VRAM */ |
| r5932 | r5933 | |
| 473 | 473 | break; |
| 474 | 474 | case 0x02: |
| 475 | 475 | /* ROM->VRAM */ |
| 476 | // | |
| 476 | // logerror( "DMA DMBR = %X\n", gamecom_internal_registers[SM8521_DMBR] ); | |
| 477 | 477 | gamecom_dma.source_width = 64; |
| 478 | if ( gamecom_internal_registers[SM8521_DMBR] < 16 ) | |
| 478 | if ( gamecom_internal_registers[SM8521_DMBR] < 16 ) | |
| 479 | 479 | { |
| 480 | 480 | gamecom_dma.source_bank = memory_region(machine, "user1") + (gamecom_internal_registers[SM8521_DMBR] << 14); |
| 481 | 481 | gamecom_dma.source_mask = 0x3FFF; |
| 482 | } | |
| 483 | else | |
| 482 | } | |
| 483 | else | |
| 484 | 484 | { |
| 485 | 485 | logerror( "TODO: Reading from external ROMs not supported yet\n" ); |
| 486 | 486 | gamecom_dma.source_bank = memory_region(machine, "user1"); |
| r5932 | r5933 | |
| 513 | 513 | Their usage is also not explained properly in the manuals. Guess we'll have to wait |
| 514 | 514 | for them to show up in some rom images... |
| 515 | 515 | */ |
| 516 | void gamecom_handle_dma( const device_config *device, int cycles ) | |
| 516 | void gamecom_handle_dma( const device_config *device, int cycles ) | |
| 517 | 517 | { |
| 518 | 518 | unsigned y_count, x_count; |
| 519 | 519 | /* If not enabled, ignore */ |
| 520 | if ( ! gamecom_dma.enabled ) | |
| 520 | if ( ! gamecom_dma.enabled ) | |
| 521 | 521 | { |
| 522 | 522 | return; |
| 523 | 523 | } |
| 524 | for( y_count = 0; y_count <= gamecom_dma.width_y; y_count++ ) | |
| 524 | for( y_count = 0; y_count <= gamecom_dma.width_y; y_count++ ) | |
| 525 | 525 | { |
| 526 | for( x_count = 0; x_count <= gamecom_dma.width_x; x_count++ ) | |
| 526 | for( x_count = 0; x_count <= gamecom_dma.width_x; x_count++ ) | |
| 527 | 527 | { |
| 528 | 528 | int source_pixel = 0; |
| 529 | 529 | int dest_pixel = 0; |
| r5932 | r5933 | |
| 531 | 531 | int dest_addr = gamecom_dma.dest_current & gamecom_dma.dest_mask; |
| 532 | 532 | /* handle DMA for 1 pixel */ |
| 533 | 533 | /* Read pixel data */ |
| 534 | switch ( gamecom_dma.source_x_current & 0x03 ) | |
| 534 | switch ( gamecom_dma.source_x_current & 0x03 ) | |
| 535 | 535 | { |
| 536 | 536 | case 0x00: source_pixel = ( gamecom_dma.source_bank[src_addr] & 0xC0 ) >> 6; break; |
| 537 | 537 | case 0x01: source_pixel = ( gamecom_dma.source_bank[src_addr] & 0x30 ) >> 4; break; |
| r5932 | r5933 | |
| 539 | 539 | case 0x03: source_pixel = ( gamecom_dma.source_bank[src_addr] & 0x03 ); break; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | if ( !gamecom_dma.overwrite_mode && source_pixel == 0 ) | |
| 542 | if ( !gamecom_dma.overwrite_mode && source_pixel == 0 ) | |
| 543 | 543 | { |
| 544 | switch ( gamecom_dma.dest_x_current & 0x03 ) | |
| 544 | switch ( gamecom_dma.dest_x_current & 0x03 ) | |
| 545 | 545 | { |
| 546 | 546 | case 0x00: dest_pixel = ( gamecom_dma.dest_bank[dest_addr] & 0xC0 ) >> 6; break; |
| 547 | 547 | case 0x01: dest_pixel = ( gamecom_dma.dest_bank[dest_addr] & 0x30 ) >> 4; break; |
| r5932 | r5933 | |
| 555 | 555 | /* Not sure if this should be done before the compound stuff - WP */ |
| 556 | 556 | source_pixel = gamecom_dma.palette[ source_pixel ]; |
| 557 | 557 | /* Write pixel data */ |
| 558 | switch( gamecom_dma.dest_x_current & 0x03 ) | |
| 558 | switch( gamecom_dma.dest_x_current & 0x03 ) | |
| 559 | 559 | { |
| 560 | 560 | case 0x00: |
| 561 | 561 | gamecom_dma.dest_bank[dest_addr] = ( gamecom_dma.dest_bank[dest_addr] & 0x3F ) | ( source_pixel << 6 ); |
| r5932 | r5933 | |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /* Advance a pixel */ |
| 575 | if ( gamecom_dma.decrement_x ) | |
| 575 | if ( gamecom_dma.decrement_x ) | |
| 576 | 576 | { |
| 577 | 577 | gamecom_dma.source_x_current--; |
| 578 | if ( ( gamecom_dma.source_x_current & 0x03 ) == 0x03 ) | |
| 578 | if ( ( gamecom_dma.source_x_current & 0x03 ) == 0x03 ) | |
| 579 | 579 | { |
| 580 | 580 | gamecom_dma.source_current--; |
| 581 | 581 | } |
| 582 | } | |
| 583 | else | |
| 582 | } | |
| 583 | else | |
| 584 | 584 | { |
| 585 | 585 | gamecom_dma.source_x_current++; |
| 586 | if ( ( gamecom_dma.source_x_current & 0x03 ) == 0x00 ) | |
| 586 | if ( ( gamecom_dma.source_x_current & 0x03 ) == 0x00 ) | |
| 587 | 587 | { |
| 588 | 588 | gamecom_dma.source_current++; |
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | 591 | gamecom_dma.dest_x_current++; |
| 592 | if ( ( gamecom_dma.dest_x_current & 0x03 ) == 0x00 ) | |
| 592 | if ( ( gamecom_dma.dest_x_current & 0x03 ) == 0x00 ) | |
| 593 | 593 | { |
| 594 | 594 | gamecom_dma.dest_current++; |
| 595 | 595 | } |
| r5932 | r5933 | |
| 607 | 607 | cputag_set_input_line(device->machine, "maincpu", DMA_INT, HOLD_LINE ); |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | void gamecom_update_timers( const device_config *device, int cycles ) | |
| 610 | void gamecom_update_timers( const device_config *device, int cycles ) | |
| 611 | 611 | { |
| 612 | if ( gamecom_timer[0].enabled ) | |
| 612 | if ( gamecom_timer[0].enabled ) | |
| 613 | 613 | { |
| 614 | 614 | gamecom_timer[0].state_count += cycles; |
| 615 | while ( gamecom_timer[0].state_count >= gamecom_timer[0].state_limit ) | |
| 615 | while ( gamecom_timer[0].state_count >= gamecom_timer[0].state_limit ) | |
| 616 | 616 | { |
| 617 | 617 | gamecom_timer[0].state_count -= gamecom_timer[0].state_limit; |
| 618 | 618 | gamecom_timer[0].counter++; |
| 619 | if ( gamecom_timer[0].counter == gamecom_timer[0].check_value ) | |
| 619 | if ( gamecom_timer[0].counter == gamecom_timer[0].check_value ) | |
| 620 | 620 | { |
| 621 | 621 | gamecom_timer[0].counter = 0; |
| 622 | 622 | cputag_set_input_line(device->machine, "maincpu", TIM0_INT, HOLD_LINE ); |
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | if ( gamecom_timer[1].enabled ) | |
| 626 | if ( gamecom_timer[1].enabled ) | |
| 627 | 627 | { |
| 628 | 628 | gamecom_timer[1].state_count += cycles; |
| 629 | while ( gamecom_timer[1].state_count >= gamecom_timer[1].state_limit ) | |
| 629 | while ( gamecom_timer[1].state_count >= gamecom_timer[1].state_limit ) | |
| 630 | 630 | { |
| 631 | 631 | gamecom_timer[1].state_count -= gamecom_timer[1].state_limit; |
| 632 | 632 | gamecom_timer[1].counter++; |
| 633 | if ( gamecom_timer[1].counter == gamecom_timer[1].check_value ) | |
| 633 | if ( gamecom_timer[1].counter == gamecom_timer[1].check_value ) | |
| 634 | 634 | { |
| 635 | 635 | gamecom_timer[1].counter = 0; |
| 636 | 636 | cputag_set_input_line(device->machine, "maincpu", TIM1_INT, HOLD_LINE ); |
| r5932 | r5933 | |
| 639 | 639 | } |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | WRITE8_HANDLER( gamecom_vram_w ) | |
| 642 | WRITE8_HANDLER( gamecom_vram_w ) | |
| 643 | 643 | { |
| 644 | 644 | gamecom_vram[offset] = data; |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | READ8_HANDLER( gamecom_vram_r ) | |
| 647 | READ8_HANDLER( gamecom_vram_r ) | |
| 648 | 648 | { |
| 649 | 649 | return gamecom_vram[offset]; |
| 650 | 650 | } |
| r5932 | r5933 | |
| 660 | 660 | int load_offset = 0; |
| 661 | 661 | |
| 662 | 662 | /* allocate memory on first load of a cartridge */ |
| 663 | if ( cartridge1 == NULL ) | |
| 663 | if ( cartridge1 == NULL ) | |
| 664 | 664 | { |
| 665 | 665 | cartridge1 = auto_alloc_array(image->machine, UINT8, 2048 * 1024 ); |
| 666 | 666 | } |
| 667 | 667 | filesize = image_length( image ); |
| 668 | switch( filesize ) | |
| 668 | switch( filesize ) | |
| 669 | 669 | { |
| 670 | 670 | case 0x008000: load_offset = 0; break; /* 32 KB */ |
| 671 | 671 | case 0x040000: load_offset = 0; break; /* 256KB */ |
| r5932 | r5933 | |
| 677 | 677 | logerror( "Error loading cartridge: Invalid file size.\n" ); |
| 678 | 678 | return INIT_FAIL; |
| 679 | 679 | } |
| 680 | if ( image_fread( image, cartridge1 + load_offset, filesize ) != filesize ) | |
| 680 | if ( image_fread( image, cartridge1 + load_offset, filesize ) != filesize ) | |
| 681 | 681 | { |
| 682 | 682 | logerror( "Error loading cartridge: Unable to read from file: %s.\n", image_filename(image) ); |
| 683 | 683 | return INIT_FAIL; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | smartmed.c: SmartMedia Flash ROM emulation | |
| 3 | 3 | |
| 4 | The SmartMedia is a Flash ROM in a fancy card. It is used in a variety of | |
| 5 | digital devices (still cameras...) and can be interfaced with a computer. | |
| 4 | The SmartMedia is a Flash ROM in a fancy card. It is used in a variety of | |
| 5 | digital devices (still cameras...) and can be interfaced with a computer. | |
| 6 | 6 | |
| 7 | References: | |
| 8 | Datasheets for various SmartMedia chips were found on Samsung and Toshiba's | |
| 9 | sites (http://www.toshiba.com/taec and | |
| 10 | http://www.samsung.com/Products/Semiconductor/Flash/FlashCard/SmartMedia) | |
| 7 | References: | |
| 8 | Datasheets for various SmartMedia chips were found on Samsung and Toshiba's | |
| 9 | sites (http://www.toshiba.com/taec and | |
| 10 | http://www.samsung.com/Products/Semiconductor/Flash/FlashCard/SmartMedia) | |
| 11 | 11 | |
| 12 | TODO: | |
| 13 | * support multi-plane mode? | |
| 14 | * use HD-format images instead of our experimental custom format? | |
| 12 | TODO: | |
| 13 | * support multi-plane mode? | |
| 14 | * use HD-format images instead of our experimental custom format? | |
| 15 | 15 | |
| 16 | ||
| 16 | Raphael Nabet 2004 | |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| r5932 | r5933 | |
| 38 | 38 | |
| 39 | 39 | /*INLINE void set_UINT32BE(UINT32BE *word, UINT32 data) |
| 40 | 40 | { |
| 41 | word->bytes[0] = (data >> 24) & 0xff; | |
| 42 | word->bytes[1] = (data >> 16) & 0xff; | |
| 43 | word->bytes[2] = (data >> 8) & 0xff; | |
| 44 | word->bytes[3] = data & 0xff; | |
| 41 | word->bytes[0] = (data >> 24) & 0xff; | |
| 42 | word->bytes[1] = (data >> 16) & 0xff; | |
| 43 | word->bytes[2] = (data >> 8) & 0xff; | |
| 44 | word->bytes[3] = data & 0xff; | |
| 45 | 45 | }*/ |
| 46 | 46 | |
| 47 | 47 | /* SmartMedia image header */ |
| r5932 | r5933 | |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | /* |
| 114 | ||
| 114 | Init a SmartMedia image | |
| 115 | 115 | */ |
| 116 | 116 | DEVICE_START( smartmedia ) |
| 117 | 117 | { |
| r5932 | r5933 | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /* |
| 137 | ||
| 137 | Load a SmartMedia image | |
| 138 | 138 | */ |
| 139 | 139 | DEVICE_IMAGE_LOAD( smartmedia ) |
| 140 | 140 | { |
| r5932 | r5933 | |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /* |
| 181 | ||
| 181 | Unload a SmartMedia image | |
| 182 | 182 | */ |
| 183 | 183 | DEVICE_IMAGE_UNLOAD( smartmedia ) |
| 184 | 184 | { |
| r5932 | r5933 | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /* |
| 218 | ||
| 218 | write a byte to SmartMedia command port | |
| 219 | 219 | */ |
| 220 | 220 | void smartmedia_command_w(const device_config *device, UINT8 data) |
| 221 | 221 | { |
| 222 | 222 | smartmedia_t *sm = get_safe_token(device); |
| 223 | ||
| 223 | ||
| 224 | 224 | if (!smartmedia_present(device)) |
| 225 | 225 | return; |
| 226 | 226 | |
| r5932 | r5933 | |
| 286 | 286 | } |
| 287 | 287 | break; |
| 288 | 288 | /*case 0x11: |
| 289 | ||
| 289 | break;*/ | |
| 290 | 290 | case 0x60: |
| 291 | 291 | sm->mode = SM_M_ERASE; |
| 292 | 292 | sm->page_addr = 0; |
| r5932 | r5933 | |
| 312 | 312 | sm->mode = SM_M_READSTATUS; |
| 313 | 313 | break; |
| 314 | 314 | /*case 0x71: |
| 315 | ||
| 315 | break;*/ | |
| 316 | 316 | case 0x90: |
| 317 | 317 | sm->mode = SM_M_READID; |
| 318 | 318 | break; |
| 319 | 319 | /*case 0x91: |
| 320 | ||
| 320 | break;*/ | |
| 321 | 321 | default: |
| 322 | 322 | logerror("smartmedia: unsupported command 0x%02x\n", data); |
| 323 | 323 | sm->mode = SM_M_INIT; |
| r5932 | r5933 | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | /* |
| 329 | ||
| 329 | write a byte to SmartMedia address port | |
| 330 | 330 | */ |
| 331 | 331 | void smartmedia_address_w(const device_config *device, UINT8 data) |
| 332 | 332 | { |
| 333 | 333 | smartmedia_t *sm = get_safe_token(device); |
| 334 | ||
| 334 | ||
| 335 | 335 | if (!smartmedia_present(device)) |
| 336 | 336 | return; |
| 337 | 337 | |
| r5932 | r5933 | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /* |
| 383 | ||
| 383 | read a byte from SmartMedia data port | |
| 384 | 384 | */ |
| 385 | 385 | UINT8 smartmedia_data_r(const device_config *device) |
| 386 | 386 | { |
| r5932 | r5933 | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /* |
| 428 | ||
| 428 | write a byte to SmartMedia data port | |
| 429 | 429 | */ |
| 430 | 430 | void smartmedia_data_w(const device_config *device, UINT8 data) |
| 431 | 431 | { |
| 432 | 432 | smartmedia_t *sm = get_safe_token(device); |
| 433 | ||
| 433 | ||
| 434 | 434 | if (!smartmedia_present(device)) |
| 435 | 435 | return; |
| 436 | 436 | |
| r5932 | r5933 | |
| 456 | 456 | |
| 457 | 457 | |
| 458 | 458 | /* |
| 459 | Initialize one SmartMedia chip: may be called at driver init or image load | |
| 460 | time (or machine init time if you don't use MESS image core) | |
| 459 | Initialize one SmartMedia chip: may be called at driver init or image load | |
| 460 | time (or machine init time if you don't use MESS image core) | |
| 461 | 461 | */ |
| 462 | 462 | static DEVICE_RESET(smartmedia) |
| 463 | 463 | { |
| 464 | 464 | smartmedia_t *sm = get_safe_token(device); |
| 465 | ||
| 465 | ||
| 466 | 466 | sm->mode = SM_M_INIT; |
| 467 | 467 | sm->pointer_mode = SM_PM_A; |
| 468 | 468 | sm->status = (sm->status & 0x80) | 0x40; |
| r5932 | r5933 | |
| 471 | 471 | |
| 472 | 472 | DEVICE_GET_INFO( smartmedia ) |
| 473 | 473 | { |
| 474 | switch ( state ) | |
| 474 | switch ( state ) | |
| 475 | 475 | { |
| 476 | 476 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 477 | 477 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(smartmedia_t); break; |
| 478 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; | |
| 478 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; | |
| 479 | 479 | case DEVINFO_INT_IMAGE_TYPE: info->i = IO_MEMCARD; break; |
| 480 | 480 | case DEVINFO_INT_IMAGE_READABLE: info->i = 1; break; |
| 481 | 481 | case DEVINFO_INT_IMAGE_WRITEABLE: info->i = 1; break; |
| r5932 | r5933 | |
|---|---|---|
| 14 | 14 | |
| 15 | 15 | /* |
| 16 | 16 | 8048 Ports: |
| 17 | ||
| 17 | ||
| 18 | 18 | P1 Bit 0..1 - RAM bank select |
| 19 | 19 | Bit 3..7 - Keypad input |
| 20 | 20 | |
| r5932 | r5933 | |
| 147 | 147 | if ((state->video_enable == 0x00) && (data & 0x10)) |
| 148 | 148 | { |
| 149 | 149 | advision_vh_update(space->machine, state->video_hpos); |
| 150 | ||
| 150 | ||
| 151 | 151 | state->video_hpos++; |
| 152 | ||
| 152 | ||
| 153 | 153 | if (state->video_hpos > 255) |
| 154 | 154 | { |
| 155 | 155 | state->video_hpos = 0; |
| 156 | 156 | logerror("HPOS OVERFLOW\n"); |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | ||
| 159 | ||
| 160 | 160 | state->video_enable = data & 0x10; |
| 161 | 161 | state->video_bank = (data & 0xe0) >> 5; |
| 162 | 162 | } |
| r5932 | r5933 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | static UINT8* radio_ram_disk; |
| 22 | 22 | |
| 23 | void radio86_init_keyboard() | |
| 23 | void radio86_init_keyboard() | |
| 24 | 24 | { |
| 25 | 25 | radio86_keyboard_mask = 0; |
| 26 | 26 | radio86_tape_value = 0x10; |
| r5932 | r5933 | |
| 59 | 59 | |
| 60 | 60 | static READ8_DEVICE_HANDLER (radio86_8255_portc_r2 ) |
| 61 | 61 | { |
| 62 | double level = cassette_input(devtag_get_device(device->machine, "cassette")); | |
| 62 | double level = cassette_input(devtag_get_device(device->machine, "cassette")); | |
| 63 | 63 | UINT8 dat = input_port_read(device->machine, "LINE8"); |
| 64 | if (level < 0) { | |
| 64 | if (level < 0) { | |
| 65 | 65 | dat ^= radio86_tape_value; |
| 66 | } | |
| 67 | return dat; | |
| 66 | } | |
| 67 | return dat; | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | static WRITE8_DEVICE_HANDLER (radio86_8255_porta_w2 ) |
| r5932 | r5933 | |
| 74 | 74 | |
| 75 | 75 | static WRITE8_DEVICE_HANDLER (radio86_8255_portc_w2 ) |
| 76 | 76 | { |
| 77 | cassette_output(devtag_get_device(device->machine, "cassette"),data & 0x01 ? 1 : -1); | |
| 77 | cassette_output(devtag_get_device(device->machine, "cassette"),data & 0x01 ? 1 : -1); | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| r5932 | r5933 | |
| 102 | 102 | |
| 103 | 103 | static READ8_DEVICE_HANDLER (rk7007_8255_portc_r ) |
| 104 | 104 | { |
| 105 | double level = cassette_input(devtag_get_device(device->machine, "cassette")); | |
| 105 | double level = cassette_input(devtag_get_device(device->machine, "cassette")); | |
| 106 | 106 | UINT8 key = 0xff; |
| 107 | 107 | if ((radio86_keyboard_mask & 0x01)!=0) { key &= input_port_read(device->machine,"CLINE0"); } |
| 108 | 108 | if ((radio86_keyboard_mask & 0x02)!=0) { key &= input_port_read(device->machine,"CLINE1"); } |
| r5932 | r5933 | |
| 113 | 113 | if ((radio86_keyboard_mask & 0x40)!=0) { key &= input_port_read(device->machine,"CLINE6"); } |
| 114 | 114 | if ((radio86_keyboard_mask & 0x80)!=0) { key &= input_port_read(device->machine,"CLINE7"); } |
| 115 | 115 | key &= 0xe0; |
| 116 | if (level < 0) { | |
| 116 | if (level < 0) { | |
| 117 | 117 | key ^= radio86_tape_value; |
| 118 | } | |
| 119 | return key; | |
| 118 | } | |
| 119 | return key; | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | I8255A_INTERFACE( rk7007_ppi8255_interface ) |
| r5932 | r5933 | |
| 158 | 158 | { 0, 0, 0, 0 } |
| 159 | 159 | }; |
| 160 | 160 | |
| 161 | static TIMER_CALLBACK( radio86_reset ) | |
| 161 | static TIMER_CALLBACK( radio86_reset ) | |
| 162 | 162 | { |
| 163 | 163 | memory_set_bank(machine, 1, 0); |
| 164 | 164 | } |
| r5932 | r5933 | |
| 167 | 167 | |
| 168 | 168 | READ8_HANDLER (radio_cpu_state_r ) |
| 169 | 169 | { |
| 170 | return cpu_get_reg(space->cpu, I8085_STATUS); | |
| 170 | return cpu_get_reg(space->cpu, I8085_STATUS); | |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | READ8_HANDLER (radio_io_r ) |
| r5932 | r5933 | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | |
| 193 | WRITE8_HANDLER ( radio86_pagesel ) | |
| 193 | WRITE8_HANDLER ( radio86_pagesel ) | |
| 194 | 194 | { |
| 195 | 195 | disk_sel = data; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | static READ8_DEVICE_HANDLER (radio86_romdisk_porta_r ) |
| 199 | 199 | { |
| 200 | UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x10000; | |
| 200 | UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x10000; | |
| 201 | 201 | if ((disk_sel & 0x0f) ==0) { |
| 202 | return romdisk[romdisk_msb*256+romdisk_lsb]; | |
| 202 | return romdisk[romdisk_msb*256+romdisk_lsb]; | |
| 203 | 203 | } else { |
| 204 | 204 | if (disk_sel==0xdf) { |
| 205 | 205 | return radio_ram_disk[romdisk_msb*256+romdisk_lsb + 0x10000]; |
| r5932 | r5933 | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | static WRITE8_DEVICE_HANDLER (radio86_romdisk_portb_w ) |
| 213 | { | |
| 213 | { | |
| 214 | 214 | romdisk_lsb = data; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | static WRITE8_DEVICE_HANDLER (radio86_romdisk_portc_w ) |
| 218 | { | |
| 219 | romdisk_msb = data; | |
| 218 | { | |
| 219 | romdisk_msb = data; | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | I8255A_INTERFACE( radio86_ppi8255_interface_2 ) |
| r5932 | r5933 | |
| 239 | 239 | DEVCB_NULL, |
| 240 | 240 | DEVCB_NULL, |
| 241 | 241 | DEVCB_NULL, |
| 242 | DEVCB_NULL, | |
| 242 | DEVCB_NULL, | |
| 243 | 243 | DEVCB_HANDLER(mikrosha_8255_font_page_w), |
| 244 | 244 | DEVCB_NULL |
| 245 | 245 | }; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | machine/ti990.c | |
| 3 | 3 | |
| 4 | ||
| 4 | Emulation for a few generic aspects of TI990 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | 8 | #include "ti990.h" |
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | ||
| 11 | Interrupt priority encoder. Actually part of the CPU board. | |
| 12 | 12 | */ |
| 13 | 13 | static UINT16 intlines; |
| 14 | 14 | |
| r5932 | r5933 | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /* |
| 76 | ||
| 76 | hold and debounce load line (emulation is inaccurate) | |
| 77 | 77 | */ |
| 78 | 78 | |
| 79 | 79 | static TIMER_CALLBACK(clear_load) |
| r5932 | r5933 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /* |
| 91 | ||
| 91 | line interrupt | |
| 92 | 92 | */ |
| 93 | 93 | |
| 94 | 94 | /* ckon_state: 1 if line clock active (RTCLR flip-flop on TI990/10 schematics - |
| r5932 | r5933 | |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | /* |
| 114 | ||
| 114 | Control panel emulation | |
| 115 | 115 | |
| 116 | three panel types | |
| 117 | * operator panel | |
| 118 | * programmer panel | |
| 119 | * MDU (external unit connected instead of the control panel, as seen in | |
| 120 | 945401-9701 p. 2-5 though 2-15) | |
| 116 | three panel types | |
| 117 | * operator panel | |
| 118 | * programmer panel | |
| 119 | * MDU (external unit connected instead of the control panel, as seen in | |
| 120 | 945401-9701 p. 2-5 though 2-15) | |
| 121 | 121 | |
| 122 | Operator panel: | |
| 123 | * Power led | |
| 124 | * Fault led | |
| 125 | * Off/On/Load switch | |
| 122 | Operator panel: | |
| 123 | * Power led | |
| 124 | * Fault led | |
| 125 | * Off/On/Load switch | |
| 126 | 126 | |
| 127 | Programmer panel: | |
| 128 | * 16 status light, 32 switches, IDLE, RUN leds | |
| 129 | * interface to a low-level debugger in ROMs | |
| 127 | Programmer panel: | |
| 128 | * 16 status light, 32 switches, IDLE, RUN leds | |
| 129 | * interface to a low-level debugger in ROMs | |
| 130 | 130 | |
| 131 | * MDU: | |
| 132 | * includes a programmer panel, a tape unit, and a few parts | |
| 133 | (diagnostic tape, diagnostic ROMs, etc.) | |
| 131 | * MDU: | |
| 132 | * includes a programmer panel, a tape unit, and a few parts | |
| 133 | (diagnostic tape, diagnostic ROMs, etc.) | |
| 134 | 134 | |
| 135 | CRU output: | |
| 136 | 0-7: lights 0-7 | |
| 137 | 8: increment scan | |
| 138 | 9: clear scan (according to 990 handbook) | |
| 139 | A: run light (additionally sets all data LEDs to 1s, the scan count to 0b10 and enables the HALT/SIE switch) | |
| 140 | B: fault light | |
| 141 | C: Memory Error Interrupt clear | |
| 142 | D: Start panel timer | |
| 143 | E: Set SIE function (interrupt after 2 instructions are executed) | |
| 144 | F: flag (according to 990 handbook) | |
| 135 | CRU output: | |
| 136 | 0-7: lights 0-7 | |
| 137 | 8: increment scan | |
| 138 | 9: clear scan (according to 990 handbook) | |
| 139 | A: run light (additionally sets all data LEDs to 1s, the scan count to 0b10 and enables the HALT/SIE switch) | |
| 140 | B: fault light | |
| 141 | C: Memory Error Interrupt clear | |
| 142 | D: Start panel timer | |
| 143 | E: Set SIE function (interrupt after 2 instructions are executed) | |
| 144 | F: flag (according to 990 handbook) | |
| 145 | 145 | |
| 146 | input : | |
| 147 | 0-7: switches 0-7 (or data from MDU tape) | |
| 148 | 8: scan count bit 1 | |
| 149 | 9: scan count bit 0 | |
| 150 | A: timer active | |
| 151 | B: programmer panel not present or locked | |
| 152 | C: char in MDU tape unit buffer? | |
| 153 | D: unused? | |
| 154 | E: if 0, MDU unit present | |
| 155 | F: flag (according to 990 handbook) | |
| 146 | input : | |
| 147 | 0-7: switches 0-7 (or data from MDU tape) | |
| 148 | 8: scan count bit 1 | |
| 149 | 9: scan count bit 0 | |
| 150 | A: timer active | |
| 151 | B: programmer panel not present or locked | |
| 152 | C: char in MDU tape unit buffer? | |
| 153 | D: unused? | |
| 154 | E: if 0, MDU unit present | |
| 155 | F: flag (according to 990 handbook) | |
| 156 | 156 | */ |
| 157 | 157 | |
| 158 | 158 | READ8_HANDLER ( ti990_panel_read ) |
| r5932 | r5933 | |
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | /* |
| 172 | ||
| 172 | CPU board soft reset (RSET instruction) | |
| 173 | 173 | */ |
| 174 | 174 | void ti990_cpuboard_reset(void) |
| 175 | 175 | { |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | the output starts at 1 level. It changes to 0 when the start bit has been transmitted. | |
| 13 | This therefore signals that data is following. | |
| 14 | When all data bits have been received, stop bits are transmitted with a value of 1. | |
| 12 | the output starts at 1 level. It changes to 0 when the start bit has been transmitted. | |
| 13 | This therefore signals that data is following. | |
| 14 | When all data bits have been received, stop bits are transmitted with a value of 1. | |
| 15 | 15 | |
| 16 | msm8251 expects this in asynchronous mode: | |
| 17 | packet format: | |
| 16 | msm8251 expects this in asynchronous mode: | |
| 17 | packet format: | |
| 18 | 18 | |
| 19 | bit count function value | |
| 20 | 1 start bit 0 | |
| 21 | note 1 data bits x | |
| 22 | note 2 parity bit x | |
| 23 | note 3 stop bits 1 | |
| 19 | bit count function value | |
| 20 | 1 start bit 0 | |
| 21 | note 1 data bits x | |
| 22 | note 2 parity bit x | |
| 23 | note 3 stop bits 1 | |
| 24 | 24 | |
| 25 | Note: | |
| 26 | 1. Data size can be defined (usual value is 8) | |
| 27 | 2. Parity bit (if parity is set to odd or even). Value of bit | |
| 28 | is defined by data parity. | |
| 29 | 3. There should be at least 1 stop bit. | |
| 25 | Note: | |
| 26 | 1. Data size can be defined (usual value is 8) | |
| 27 | 2. Parity bit (if parity is set to odd or even). Value of bit | |
| 28 | is defined by data parity. | |
| 29 | 3. There should be at least 1 stop bit. | |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | 32 | #include "driver.h" |
| r5932 | r5933 | |
| 55 | 55 | int i; |
| 56 | 56 | |
| 57 | 57 | /* if sum of all bits in the byte is even, then the data |
| 58 | ||
| 58 | has even parity, otherwise it has odd parity */ | |
| 59 | 59 | for (i=0; i<256; i++) |
| 60 | 60 | { |
| 61 | 61 | int data; |
| r5932 | r5933 | |
| 738 | 738 | |
| 739 | 739 | |
| 740 | 740 | /* |
| 741 | ||
| 741 | packet: | |
| 742 | 742 | |
| 743 | 1 byte SOH | |
| 744 | 1 byte packet id | |
| 745 | 1 byte packet id (stored 1's complemented) | |
| 746 | 128 bytes data | |
| 747 | 1 byte CRC-16 upper byte | |
| 748 | 1 byte CRC-16 lower byte | |
| 749 | */ | |
| 743 | 1 byte SOH | |
| 744 | 1 byte packet id | |
| 745 | 1 byte packet id (stored 1's complemented) | |
| 746 | 128 bytes data | |
| 747 | 1 byte CRC-16 upper byte | |
| 748 | 1 byte CRC-16 lower byte | |
| 749 | */ | |
| 750 | 750 | |
| 751 | 751 | /* soh */ |
| 752 | 752 | xmodem_transfer.packet[count] = XMODEM_SOH; |
| r5932 | r5933 | |
| 878 | 878 | |
| 879 | 879 | /* this converts state at this end to a state the other end can accept */ |
| 880 | 880 | /* e.g. CTS at this end becomes RTS at other end. |
| 881 | RTS at this end becomes CTS at other end. | |
| 882 | TX at this end becomes RX at other end. | |
| 883 | RX at this end becomes TX at other end. | |
| 884 | etc | |
| 881 | RTS at this end becomes CTS at other end. | |
| 882 | TX at this end becomes RX at other end. | |
| 883 | RX at this end becomes TX at other end. | |
| 884 | etc | |
| 885 | 885 | |
| 886 | ||
| 886 | The same thing is done inside the serial null-terminal lead */ | |
| 887 | 887 | |
| 888 | 888 | static unsigned long serial_connection_spin_bits(unsigned long input_status) |
| 889 | 889 | { |
| r5932 | r5933 | |
| 941 | 941 | { |
| 942 | 942 | /* both connections should have their in connection setup! */ |
| 943 | 943 | /* the in connection is the callback they use to update their state based |
| 944 | ||
| 944 | on the output from the other side */ | |
| 945 | 945 | connection_a->out_callback = connection_b->in_callback; |
| 946 | 946 | connection_b->out_callback = connection_a->in_callback; |
| 947 | 947 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Bashkiria-2M machine driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 28/03/2008 Preliminary driver. | |
| 6 | ||
| 5 | 28/03/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| r5932 | r5933 | |
| 18 | 18 | #include "includes/b2m.h" |
| 19 | 19 | |
| 20 | 20 | static READ8_HANDLER (b2m_keyboard_r ) |
| 21 | { | |
| 21 | { | |
| 22 | 22 | UINT8 key = 0x00; |
| 23 | 23 | if (offset < 0x100) { |
| 24 | 24 | if ((offset & 0x01)!=0) { key |= input_port_read(space->machine,"LINE0"); } |
| r5932 | r5933 | |
| 28 | 28 | if ((offset & 0x10)!=0) { key |= input_port_read(space->machine,"LINE4"); } |
| 29 | 29 | if ((offset & 0x20)!=0) { key |= input_port_read(space->machine,"LINE5"); } |
| 30 | 30 | if ((offset & 0x40)!=0) { key |= input_port_read(space->machine,"LINE6"); } |
| 31 | if ((offset & 0x80)!=0) { key |= input_port_read(space->machine,"LINE7"); } | |
| 31 | if ((offset & 0x80)!=0) { key |= input_port_read(space->machine,"LINE7"); } | |
| 32 | 32 | } else { |
| 33 | 33 | if ((offset & 0x01)!=0) { key |= input_port_read(space->machine,"LINE8"); } |
| 34 | 34 | if ((offset & 0x02)!=0) { key |= input_port_read(space->machine,"LINE9"); } |
| r5932 | r5933 | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| 41 | static void b2m_set_bank(running_machine *machine,int bank) | |
| 41 | static void b2m_set_bank(running_machine *machine,int bank) | |
| 42 | 42 | { |
| 43 | 43 | UINT8 *rom; |
| 44 | 44 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 45 | ||
| 45 | ||
| 46 | 46 | memory_install_write8_handler(space, 0x0000, 0x27ff, 0, 0, SMH_BANK(1)); |
| 47 | 47 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_BANK(2)); |
| 48 | 48 | memory_install_write8_handler(space, 0x3000, 0x6fff, 0, 0, SMH_BANK(3)); |
| r5932 | r5933 | |
| 54 | 54 | case 0 : |
| 55 | 55 | case 1 : |
| 56 | 56 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP); |
| 57 | ||
| 57 | ||
| 58 | 58 | memory_set_bankptr(machine, 1, mess_ram); |
| 59 | 59 | memory_set_bankptr(machine, 2, mess_ram + 0x2800); |
| 60 | 60 | memory_set_bankptr(machine, 3, mess_ram + 0x3000); |
| 61 | 61 | memory_set_bankptr(machine, 4, mess_ram + 0x7000); |
| 62 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 62 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 63 | 63 | break; |
| 64 | 64 | #if 0 |
| 65 | 65 | case 1 : |
| r5932 | r5933 | |
| 70 | 70 | memory_set_bankptr(machine, 2, mess_ram + 0x2800); |
| 71 | 71 | memory_set_bankptr(machine, 3, rom + 0x12000); |
| 72 | 72 | memory_set_bankptr(machine, 4, rom + 0x16000); |
| 73 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 73 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 74 | 74 | break; |
| 75 | 75 | #endif |
| 76 | 76 | case 2 : |
| 77 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); | |
| 77 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); | |
| 78 | 78 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP); |
| 79 | 79 | |
| 80 | 80 | memory_set_bankptr(machine, 1, mess_ram); |
| 81 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); | |
| 81 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); | |
| 82 | 82 | memory_set_bankptr(machine, 3, mess_ram + 0x10000); |
| 83 | 83 | memory_set_bankptr(machine, 4, mess_ram + 0x7000); |
| 84 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 84 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 85 | 85 | break; |
| 86 | 86 | case 3 : |
| 87 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); | |
| 87 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); | |
| 88 | 88 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP); |
| 89 | 89 | |
| 90 | 90 | memory_set_bankptr(machine, 1, mess_ram); |
| 91 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); | |
| 91 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); | |
| 92 | 92 | memory_set_bankptr(machine, 3, mess_ram + 0x14000); |
| 93 | 93 | memory_set_bankptr(machine, 4, mess_ram + 0x7000); |
| 94 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 94 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 95 | 95 | break; |
| 96 | 96 | case 4 : |
| 97 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); | |
| 97 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); | |
| 98 | 98 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP); |
| 99 | 99 | |
| 100 | 100 | memory_set_bankptr(machine, 1, mess_ram); |
| 101 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); | |
| 101 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); | |
| 102 | 102 | memory_set_bankptr(machine, 3, mess_ram + 0x18000); |
| 103 | 103 | memory_set_bankptr(machine, 4, mess_ram + 0x7000); |
| 104 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 105 | ||
| 104 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 105 | ||
| 106 | 106 | break; |
| 107 | 107 | case 5 : |
| 108 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); | |
| 108 | memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_UNMAP); | |
| 109 | 109 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP); |
| 110 | 110 | |
| 111 | 111 | memory_set_bankptr(machine, 1, mess_ram); |
| 112 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); | |
| 112 | memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, b2m_keyboard_r); | |
| 113 | 113 | memory_set_bankptr(machine, 3, mess_ram + 0x1c000); |
| 114 | 114 | memory_set_bankptr(machine, 4, mess_ram + 0x7000); |
| 115 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 116 | ||
| 115 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 116 | ||
| 117 | 117 | break; |
| 118 | 118 | case 6 : |
| 119 | 119 | memory_set_bankptr(machine, 1, mess_ram); |
| 120 | 120 | memory_set_bankptr(machine, 2, mess_ram + 0x2800); |
| 121 | 121 | memory_set_bankptr(machine, 3, mess_ram + 0x3000); |
| 122 | 122 | memory_set_bankptr(machine, 4, mess_ram + 0x7000); |
| 123 | memory_set_bankptr(machine, 5, mess_ram + 0xe000); | |
| 123 | memory_set_bankptr(machine, 5, mess_ram + 0xe000); | |
| 124 | 124 | break; |
| 125 | 125 | case 7 : |
| 126 | 126 | memory_install_write8_handler(space, 0x0000, 0x27ff, 0, 0, SMH_UNMAP); |
| r5932 | r5933 | |
| 128 | 128 | memory_install_write8_handler(space, 0x3000, 0x6fff, 0, 0, SMH_UNMAP); |
| 129 | 129 | memory_install_write8_handler(space, 0x7000, 0xdfff, 0, 0, SMH_UNMAP); |
| 130 | 130 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP); |
| 131 | ||
| 132 | memory_set_bankptr(machine, 1, rom + 0x10000); | |
| 133 | memory_set_bankptr(machine, 2, rom + 0x10000); | |
| 134 | memory_set_bankptr(machine, 3, rom + 0x10000); | |
| 135 | memory_set_bankptr(machine, 4, rom + 0x10000); | |
| 136 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 131 | ||
| 132 | memory_set_bankptr(machine, 1, rom + 0x10000); | |
| 133 | memory_set_bankptr(machine, 2, rom + 0x10000); | |
| 134 | memory_set_bankptr(machine, 3, rom + 0x10000); | |
| 135 | memory_set_bankptr(machine, 4, rom + 0x10000); | |
| 136 | memory_set_bankptr(machine, 5, rom + 0x10000); | |
| 137 | 137 | break; |
| 138 | 138 | } |
| 139 | 139 | } |
| r5932 | r5933 | |
| 141 | 141 | static PIT8253_OUTPUT_CHANGED(bm2_pit_out0) |
| 142 | 142 | { |
| 143 | 143 | b2m_state *st = device->machine->driver_data; |
| 144 | pic8259_set_irq_line(st->pic,1,state); | |
| 144 | pic8259_set_irq_line(st->pic,1,state); | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | static PIT8253_OUTPUT_CHANGED(bm2_pit_out1) |
| 149 | { | |
| 150 | b2m_state *st = device->machine->driver_data; | |
| 149 | { | |
| 150 | b2m_state *st = device->machine->driver_data; | |
| 151 | 151 | speaker_level_w(st->speaker, state); |
| 152 | 152 | |
| 153 | 153 | } |
| r5932 | r5933 | |
| 177 | 177 | }; |
| 178 | 178 | |
| 179 | 179 | static WRITE8_DEVICE_HANDLER (b2m_8255_porta_w ) |
| 180 | { | |
| 180 | { | |
| 181 | 181 | b2m_state *state = device->machine->driver_data; |
| 182 | 182 | state->b2m_8255_porta = data; |
| 183 | 183 | } |
| 184 | 184 | static WRITE8_DEVICE_HANDLER (b2m_8255_portb_w ) |
| 185 | { | |
| 185 | { | |
| 186 | 186 | b2m_state *state = device->machine->driver_data; |
| 187 | 187 | state->b2m_video_scroll = data; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | static WRITE8_DEVICE_HANDLER (b2m_8255_portc_w ) |
| 191 | { | |
| 191 | { | |
| 192 | 192 | b2m_state *state = device->machine->driver_data; |
| 193 | 193 | |
| 194 | 194 | state->b2m_8255_portc = data; |
| r5932 | r5933 | |
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | static WRITE8_DEVICE_HANDLER (b2m_ext_8255_portc_w ) |
| 218 | { | |
| 218 | { | |
| 219 | 219 | UINT8 drive = ((data >> 1) & 1) ^ 1; |
| 220 | UINT8 side = (data & 1) ^ 1; | |
| 220 | UINT8 side = (data & 1) ^ 1; | |
| 221 | 221 | b2m_state *state = device->machine->driver_data; |
| 222 | 222 | |
| 223 | 223 | if (state->b2m_drive!=drive) { |
| r5932 | r5933 | |
| 244 | 244 | { |
| 245 | 245 | b2m_state *state = device->machine->driver_data; |
| 246 | 246 | |
| 247 | UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x12000; | |
| 248 | return romdisk[state->b2m_romdisk_msb*256+state->b2m_romdisk_lsb]; | |
| 247 | UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x12000; | |
| 248 | return romdisk[state->b2m_romdisk_msb*256+state->b2m_romdisk_lsb]; | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | static WRITE8_DEVICE_HANDLER (b2m_romdisk_portb_w ) |
| 252 | { | |
| 252 | { | |
| 253 | 253 | b2m_state *state = device->machine->driver_data; |
| 254 | 254 | state->b2m_romdisk_lsb = data; |
| 255 | 255 | } |
| r5932 | r5933 | |
| 257 | 257 | static WRITE8_DEVICE_HANDLER (b2m_romdisk_portc_w ) |
| 258 | 258 | { |
| 259 | 259 | b2m_state *state = device->machine->driver_data; |
| 260 | state->b2m_romdisk_msb = data & 0x7f; | |
| 260 | state->b2m_romdisk_msb = data & 0x7f; | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | I8255A_INTERFACE( b2m_ppi8255_interface_3 ) |
| r5932 | r5933 | |
| 271 | 271 | }; |
| 272 | 272 | |
| 273 | 273 | static PIC8259_SET_INT_LINE( b2m_pic_set_int_line ) |
| 274 | { | |
| 275 | cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE); | |
| 276 | } | |
| 274 | { | |
| 275 | cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE); | |
| 276 | } | |
| 277 | 277 | |
| 278 | 278 | /* Driver initialization */ |
| 279 | 279 | DRIVER_INIT(b2m) |
| 280 | 280 | { |
| 281 | 281 | b2m_state *state = machine->driver_data; |
| 282 | 282 | |
| 283 | memset(mess_ram,0,128*1024); | |
| 283 | memset(mess_ram,0,128*1024); | |
| 284 | 284 | state->vblank_state = 0; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | WRITE8_HANDLER ( b2m_palette_w ) | |
| 287 | WRITE8_HANDLER ( b2m_palette_w ) | |
| 288 | 288 | { |
| 289 | 289 | b2m_state *state = space->machine->driver_data; |
| 290 | 290 | |
| 291 | 291 | UINT8 b = (3 - ((data >> 6) & 3)) * 0x55; |
| 292 | 292 | UINT8 g = (3 - ((data >> 4) & 3)) * 0x55; |
| 293 | 293 | UINT8 r = (3 - ((data >> 2) & 3)) * 0x55; |
| 294 | ||
| 294 | ||
| 295 | 295 | UINT8 bw = (3 - (data & 3)) * 0x55; |
| 296 | ||
| 297 | state->b2m_color[offset & 3] = data; | |
| 298 | ||
| 296 | ||
| 297 | state->b2m_color[offset & 3] = data; | |
| 298 | ||
| 299 | 299 | if (input_port_read(space->machine,"MONITOR")==1) { |
| 300 | 300 | palette_set_color_rgb(space->machine,offset, r, g, b); |
| 301 | 301 | } else { |
| r5932 | r5933 | |
| 309 | 309 | return state->b2m_color[offset]; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | WRITE8_HANDLER ( b2m_localmachine_w ) | |
| 312 | WRITE8_HANDLER ( b2m_localmachine_w ) | |
| 313 | 313 | { |
| 314 | 314 | b2m_state *state = space->machine->driver_data; |
| 315 | 315 | state->b2m_localmachine = data; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | READ8_HANDLER ( b2m_localmachine_r ) | |
| 318 | READ8_HANDLER ( b2m_localmachine_r ) | |
| 319 | 319 | { |
| 320 | 320 | b2m_state *state = space->machine->driver_data; |
| 321 | 321 | return state->b2m_localmachine; |
| r5932 | r5933 | |
| 335 | 335 | state->speaker = devtag_get_device(machine, "speaker"); |
| 336 | 336 | |
| 337 | 337 | wd17xx_set_pause_time(state->fdc,10); |
| 338 | ||
| 338 | ||
| 339 | 339 | /* register for state saving */ |
| 340 | 340 | state_save_register_global(machine, state->b2m_8255_porta); |
| 341 | 341 | state_save_register_global(machine, state->b2m_video_scroll); |
| r5932 | r5933 | |
| 348 | 348 | state_save_register_global_pointer(machine, state->b2m_color, 4); |
| 349 | 349 | state_save_register_global(machine, state->b2m_localmachine); |
| 350 | 350 | state_save_register_global(machine, state->vblank_state); |
| 351 | ||
| 351 | ||
| 352 | 352 | state_save_register_postload(machine, b2m_postload, NULL); |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | static IRQ_CALLBACK(b2m_irq_callback) |
| 356 | { | |
| 356 | { | |
| 357 | 357 | b2m_state *state = device->machine->driver_data; |
| 358 | 358 | return pic8259_acknowledge(state->pic); |
| 359 | } | |
| 359 | } | |
| 360 | 360 | |
| 361 | 361 | const struct pic8259_interface b2m_pic8259_config = { |
| 362 | 362 | b2m_pic_set_int_line |
| 363 | 363 | }; |
| 364 | 364 | |
| 365 | 365 | INTERRUPT_GEN (b2m_vblank_interrupt) |
| 366 | { | |
| 366 | { | |
| 367 | 367 | b2m_state *state = device->machine->driver_data; |
| 368 | 368 | state->vblank_state++; |
| 369 | 369 | if (state->vblank_state>1) state->vblank_state=0; |
| 370 | pic8259_set_irq_line(state->pic, 0, state->vblank_state); | |
| 370 | pic8259_set_irq_line(state->pic, 0, state->vblank_state); | |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | MACHINE_RESET(b2m) |
| 374 | { | |
| 374 | { | |
| 375 | 375 | b2m_state *state = machine->driver_data; |
| 376 | 376 | state->b2m_side = 0; |
| 377 | 377 | state->b2m_drive = 0; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * machine/ins8154.h |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * INS8154 N-Channel 128-by-8 Bit RAM Input/Output (RAM I/O) |
| 6 | 6 | * |
| 7 | 7 | ****************************************************************************/ |
| r5932 | r5933 | |
| 32 | 32 | read8_device_func in_b_func; |
| 33 | 33 | write8_device_func out_a_func; |
| 34 | 34 | write8_device_func out_b_func; |
| 35 | ins8154_irq_func irq_func; | |
| 35 | ins8154_irq_func irq_func; | |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | DEVICE_GET_INFO( ins8154 ); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | smartmed.h: header file for smartmed.c | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | #ifndef __SMARTMEDIA_H__ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | ti990.h: header file for ti990.c | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | void ti990_reset_int(void); |
| r5932 | r5933 | |
|---|---|---|
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | |
| 84 | INLINE mc6846_t* get_safe_token( const device_config *device ) | |
| 84 | INLINE mc6846_t* get_safe_token( const device_config *device ) | |
| 85 | 85 | { |
| 86 | 86 | assert( device != NULL ); |
| 87 | 87 | assert( device->token != NULL ); |
| r5932 | r5933 | |
|---|---|---|
| 142 | 142 | |
| 143 | 143 | /*------------------------------------------------- |
| 144 | 144 | change_output_lines - change output line |
| 145 | ||
| 145 | state | |
| 146 | 146 | -------------------------------------------------*/ |
| 147 | 147 | |
| 148 | 148 | static void change_output_lines(const device_config *device) |
| r5932 | r5933 | |
| 166 | 166 | |
| 167 | 167 | /*------------------------------------------------- |
| 168 | 168 | clock_scan_counters - clock the keyboard |
| 169 | ||
| 169 | scan counters | |
| 170 | 170 | -------------------------------------------------*/ |
| 171 | 171 | |
| 172 | 172 | static void clock_scan_counters(const device_config *device) |
| r5932 | r5933 | |
| 199 | 199 | cdp1871_t *cdp1871 = get_safe_token(device); |
| 200 | 200 | |
| 201 | 201 | UINT8 data = 0; |
| 202 | ||
| 202 | ||
| 203 | 203 | switch (cdp1871->drive) |
| 204 | 204 | { |
| 205 | 205 | case 0: data = devcb_call_read8(&cdp1871->in_d1_func, 0); break; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | 8530scc.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Zilog 8530 SCC (Serial Control Chip) code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 291 | 291 | scc->mode = 1; |
| 292 | 292 | scc->reg = data & 0x0f; |
| 293 | 293 | logerror("SCC: Port B Reg select - %i\n",scc->reg); |
| 294 | // | |
| 294 | // scc_putbreg(device, data & 0xf0); | |
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | else |
| r5932 | r5933 | |
| 310 | 310 | scc->mode = 1; |
| 311 | 311 | scc->reg = data & 0x0f; |
| 312 | 312 | logerror("SCC: Port A Reg select - %i\n", scc->reg); |
| 313 | // | |
| 313 | // scc_putareg(device, data & 0xf0); | |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | else |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | D1 1 |* \_/ | 40 Vdd | |
| 11 | D2 2 | | 39 SHIFT | |
| 12 | D3 3 | | 38 CONTROL | |
| 13 | D4 4 | | 37 ALPHA | |
| 14 | D5 5 | | 36 DEBOUNCE | |
| 15 | D6 6 | | 35 _RTP | |
| 16 | D7 7 | | 34 TPB | |
| 17 | D8 8 | | 33 _DA | |
| 18 | D9 9 | | 32 BUS 7 | |
| 19 | D10 10 | CDP1871 | 31 BUS 6 | |
| 20 | D11 11 | | 30 BUS 5 | |
| 21 | S1 12 | | 29 BUS 4 | |
| 22 | S2 13 | | 28 BUS 3 | |
| 23 | S3 14 | | 27 BUS 2 | |
| 24 | S4 15 | | 26 BUS 1 | |
| 25 | S5 16 | | 25 BUS 0 | |
| 26 | S6 17 | | 24 CS4 | |
| 27 | S7 18 | | 23 CS3 | |
| 28 | S8 19 | | 22 CS2 | |
| 29 | Vss 20 |_____________| 21 _CS1 | |
| 9 | _____ _____ | |
| 10 | D1 1 |* \_/ | 40 Vdd | |
| 11 | D2 2 | | 39 SHIFT | |
| 12 | D3 3 | | 38 CONTROL | |
| 13 | D4 4 | | 37 ALPHA | |
| 14 | D5 5 | | 36 DEBOUNCE | |
| 15 | D6 6 | | 35 _RTP | |
| 16 | D7 7 | | 34 TPB | |
| 17 | D8 8 | | 33 _DA | |
| 18 | D9 9 | | 32 BUS 7 | |
| 19 | D10 10 | CDP1871 | 31 BUS 6 | |
| 20 | D11 11 | | 30 BUS 5 | |
| 21 | S1 12 | | 29 BUS 4 | |
| 22 | S2 13 | | 28 BUS 3 | |
| 23 | S3 14 | | 27 BUS 2 | |
| 24 | S4 15 | | 26 BUS 1 | |
| 25 | S5 16 | | 25 BUS 0 | |
| 26 | S6 17 | | 24 CS4 | |
| 27 | S7 18 | | 23 CS3 | |
| 28 | S8 19 | | 22 CS2 | |
| 29 | Vss 20 |_____________| 21 _CS1 | |
| 30 | 30 | |
| 31 | 31 | **********************************************************************/ |
| 32 | 32 |
| r5932 | r5933 | |
|---|---|---|
| 36 | 36 | static void pmd851_update_memory(running_machine *machine) |
| 37 | 37 | { |
| 38 | 38 | const address_space* space = cputag_get_address_space(machine, "maincpu",ADDRESS_SPACE_PROGRAM); |
| 39 | ||
| 39 | ||
| 40 | 40 | if (pmd85_startup_mem_map) |
| 41 | 41 | { |
| 42 | 42 | UINT8 *mem = memory_region(machine, "maincpu"); |
| r5932 | r5933 | |
| 228 | 228 | |
| 229 | 229 | /******************************************************************************* |
| 230 | 230 | |
| 231 | Motherboard 8255 (PMD-85.1, PMD-85.2, PMD-85.3, Didaktik Alfa) | |
| 232 | -------------------------------------------------------------- | |
| 233 | keyboard, speaker, LEDs | |
| 231 | Motherboard 8255 (PMD-85.1, PMD-85.2, PMD-85.3, Didaktik Alfa) | |
| 232 | -------------------------------------------------------------- | |
| 233 | keyboard, speaker, LEDs | |
| 234 | 234 | |
| 235 | 235 | *******************************************************************************/ |
| 236 | 236 | |
| r5932 | r5933 | |
| 271 | 271 | |
| 272 | 272 | /******************************************************************************* |
| 273 | 273 | |
| 274 | Motherboard 8255 (Mato) | |
| 275 | ----------------------- | |
| 276 | keyboard, speaker, LEDs, tape | |
| 274 | Motherboard 8255 (Mato) | |
| 275 | ----------------------- | |
| 276 | keyboard, speaker, LEDs, tape | |
| 277 | 277 | |
| 278 | 278 | *******************************************************************************/ |
| 279 | 279 | |
| r5932 | r5933 | |
| 305 | 305 | |
| 306 | 306 | /******************************************************************************* |
| 307 | 307 | |
| 308 | I/O board 8255 | |
| 309 | -------------- | |
| 310 | GPIO/0 (K3 connector), GPIO/1 (K4 connector) | |
| 308 | I/O board 8255 | |
| 309 | -------------- | |
| 310 | GPIO/0 (K3 connector), GPIO/1 (K4 connector) | |
| 311 | 311 | |
| 312 | 312 | *******************************************************************************/ |
| 313 | 313 | |
| r5932 | r5933 | |
| 343 | 343 | |
| 344 | 344 | /******************************************************************************* |
| 345 | 345 | |
| 346 | I/O board 8255 | |
| 347 | -------------- | |
| 348 | IMS-2 (K5 connector) | |
| 346 | I/O board 8255 | |
| 347 | -------------- | |
| 348 | IMS-2 (K5 connector) | |
| 349 | 349 | |
| 350 | ||
| 350 | - 8251 - cassette recorder and V.24/IFSS (selectable by switch) | |
| 351 | 351 | |
| 352 | ||
| 352 | - external interfaces connector (K2) | |
| 353 | 353 | |
| 354 | 354 | *******************************************************************************/ |
| 355 | 355 | |
| r5932 | r5933 | |
| 385 | 385 | |
| 386 | 386 | /******************************************************************************* |
| 387 | 387 | |
| 388 | I/O board 8251 | |
| 389 | -------------- | |
| 390 | cassette recorder and V.24/IFSS (selectable by switch) | |
| 388 | I/O board 8251 | |
| 389 | -------------- | |
| 390 | cassette recorder and V.24/IFSS (selectable by switch) | |
| 391 | 391 | |
| 392 | 392 | *******************************************************************************/ |
| 393 | 393 | |
| 394 | 394 | /******************************************************************************* |
| 395 | 395 | |
| 396 | I/O board 8253 | |
| 397 | -------------- | |
| 396 | I/O board 8253 | |
| 397 | -------------- | |
| 398 | 398 | |
| 399 | Timer 0: | |
| 400 | OUT0 - external interfaces connector (K2) | |
| 401 | CLK0 - external interfaces connector (K2) | |
| 402 | GATE0 - external interfaces connector (K2), default = 1 | |
| 403 | Timer 1: | |
| 404 | OUT0 - external interfaces connector (K2), msm8251 (for V24 only) | |
| 405 | CLK0 - hardwired to 2 MHz system clock | |
| 406 | GATE0 - external interfaces connector (K2), default = 1 | |
| 407 | Timer 2: | |
| 408 | OUT0 - unused | |
| 409 | CLK0 - hardwired to 1HZ signal generator | |
| 410 | GATE0 - hardwired to 5V, default = 1 | |
| 399 | Timer 0: | |
| 400 | OUT0 - external interfaces connector (K2) | |
| 401 | CLK0 - external interfaces connector (K2) | |
| 402 | GATE0 - external interfaces connector (K2), default = 1 | |
| 403 | Timer 1: | |
| 404 | OUT0 - external interfaces connector (K2), msm8251 (for V24 only) | |
| 405 | CLK0 - hardwired to 2 MHz system clock | |
| 406 | GATE0 - external interfaces connector (K2), default = 1 | |
| 407 | Timer 2: | |
| 408 | OUT0 - unused | |
| 409 | CLK0 - hardwired to 1HZ signal generator | |
| 410 | GATE0 - hardwired to 5V, default = 1 | |
| 411 | 411 | |
| 412 | 412 | *******************************************************************************/ |
| 413 | 413 | |
| r5932 | r5933 | |
| 422 | 422 | |
| 423 | 423 | /******************************************************************************* |
| 424 | 424 | |
| 425 | I/O board external interfaces connector (K2) | |
| 426 | -------------------------------------------- | |
| 425 | I/O board external interfaces connector (K2) | |
| 426 | -------------------------------------------- | |
| 427 | 427 | |
| 428 | 428 | *******************************************************************************/ |
| 429 | 429 | |
| r5932 | r5933 | |
| 431 | 431 | |
| 432 | 432 | /******************************************************************************* |
| 433 | 433 | |
| 434 | ROM Module 8255 | |
| 435 | --------------- | |
| 436 | port A - data read | |
| 437 | ports B, C - address select | |
| 434 | ROM Module 8255 | |
| 435 | --------------- | |
| 436 | port A - data read | |
| 437 | ports B, C - address select | |
| 438 | 438 | |
| 439 | 439 | *******************************************************************************/ |
| 440 | 440 | |
| r5932 | r5933 | |
| 470 | 470 | |
| 471 | 471 | /******************************************************************************* |
| 472 | 472 | |
| 473 | I/O ports (PMD-85.1, PMD-85.2, PMD-85.3, Didaktik Alfa) | |
| 474 | ------------------------------------------------------- | |
| 473 | I/O ports (PMD-85.1, PMD-85.2, PMD-85.3, Didaktik Alfa) | |
| 474 | ------------------------------------------------------- | |
| 475 | 475 | |
| 476 | I/O board | |
| 477 | 1xxx11aa external interfaces connector (K2) | |
| 476 | I/O board | |
| 477 | 1xxx11aa external interfaces connector (K2) | |
| 478 | 478 | |
| 479 | 0xxx11aa I/O board interfaces | |
| 480 | 000111aa 8251 (casette recorder, V24) | |
| 481 | 010011aa 8255 (GPIO/0, GPIO/1) | |
| 482 | 010111aa 8253 | |
| 483 | 011111aa 8255 (IMS-2) | |
| 479 | 0xxx11aa I/O board interfaces | |
| 480 | 000111aa 8251 (casette recorder, V24) | |
| 481 | 010011aa 8255 (GPIO/0, GPIO/1) | |
| 482 | 010111aa 8253 | |
| 483 | 011111aa 8255 (IMS-2) | |
| 484 | 484 | |
| 485 | Motherboard | |
| 486 | 1xxx01aa 8255 (keyboard, speaker, LEDs) | |
| 487 | PMD-85.3 memory banking | |
| 485 | Motherboard | |
| 486 | 1xxx01aa 8255 (keyboard, speaker, LEDs) | |
| 487 | PMD-85.3 memory banking | |
| 488 | 488 | |
| 489 | ROM Module | |
| 490 | 1xxx10aa 8255 (ROM reading) | |
| 489 | ROM Module | |
| 490 | 1xxx10aa 8255 (ROM reading) | |
| 491 | 491 | |
| 492 | 492 | *******************************************************************************/ |
| 493 | 493 | |
| r5932 | r5933 | |
| 635 | 635 | |
| 636 | 636 | /******************************************************************************* |
| 637 | 637 | |
| 638 | I/O ports (Mato) | |
| 639 | ---------------- | |
| 638 | I/O ports (Mato) | |
| 639 | ---------------- | |
| 640 | 640 | |
| 641 | Motherboard | |
| 642 | 1xxx01aa 8255 (keyboard, speaker, LEDs, tape) | |
| 641 | Motherboard | |
| 642 | 1xxx01aa 8255 (keyboard, speaker, LEDs, tape) | |
| 643 | 643 | |
| 644 | 644 | *******************************************************************************/ |
| 645 | 645 | |
| r5932 | r5933 | |
| 844 | 844 | |
| 845 | 845 | static DIRECT_UPDATE_HANDLER(pmd85_opbaseoverride) |
| 846 | 846 | { |
| 847 | if (input_port_read(space->machine, "RESET") & 0x01) | |
| 847 | if (input_port_read(space->machine, "RESET") & 0x01) | |
| 848 | 848 | timer_set(space->machine, ATTOTIME_IN_USEC(10), NULL, 0, pmd_reset); |
| 849 | 849 | return address; |
| 850 | 850 | } |
| r5932 | r5933 | |
| 899 | 899 | pmd85_common_driver_init(machine); |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | static TIMER_CALLBACK( setup_machine_state ) | |
| 902 | static TIMER_CALLBACK( setup_machine_state ) | |
| 903 | 903 | { |
| 904 | 904 | const device_config *pit8253 = devtag_get_device(machine, "pit8253"); |
| 905 | 905 | |
| 906 | 906 | pit8253_gate_w(pit8253, 0, 1); |
| 907 | 907 | pit8253_gate_w(pit8253, 1, 1); |
| 908 | 908 | pit8253_gate_w(pit8253, 2, 1); |
| 909 | if (pmd85_model!=MATO) | |
| 909 | if (pmd85_model!=MATO) | |
| 910 | 910 | { |
| 911 | 911 | msm8251_connect(devtag_get_device(machine, "uart"), &pmd85_cassette_serial_connection); |
| 912 | 912 | } |
| r5932 | r5933 | |
| 936 | 936 | |
| 937 | 937 | timer_set(machine, attotime_zero, NULL, 0, setup_machine_state ); |
| 938 | 938 | |
| 939 | memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), pmd85_opbaseoverride); | |
| 939 | memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), pmd85_opbaseoverride); | |
| 940 | 940 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | 8530scc.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Zilog 8530 SCC (Serial Control Chip) code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 168 | 168 | * 26 2 R,I |
| 169 | 169 | * 28 4 SP,PC |
| 170 | 170 | * 32 2 0 (reserved for future use) |
| 171 | * 34 1 | |
| 171 | * 34 1 Border color | |
| 172 | 172 | * 35 1 0 (reserved for future use) |
| 173 | 173 | * 36 2 Status word |
| 174 | 174 | * 38 - RAM dump |
| 175 | 175 | * |
| 176 | * Status word: | |
| 177 | * Bit Description | |
| 178 | * 15-8 Reserved for future use | |
| 179 | * 7-6 Reserved for internal use (0) | |
| 180 | * 5 Flash: 0=INK/1=PAPER | |
| 181 | * 4 Interrupt pending for execution | |
| 182 | * 3 If 1, IM 0; if 0, bit 1 determines interrupt mode | |
| 183 | * (Spectrum v 0.99e had this behaviour reversed, and this | |
| 184 | * bit was not used in versions previous to v 0.99e) | |
| 185 | * 2 IFF2 (internal use) | |
| 186 | * 1 Interrupt Mode (if bit 3 reset): 0=>IM1, 1=>IM2 | |
| 187 | * 0 IFF1: 0=DI/1=EI | |
| 176 | * Status word: | |
| 177 | * Bit Description | |
| 178 | * 15-8 Reserved for future use | |
| 179 | * 7-6 Reserved for internal use (0) | |
| 180 | * 5 Flash: 0=INK/1=PAPER | |
| 181 | * 4 Interrupt pending for execution | |
| 182 | * 3 If 1, IM 0; if 0, bit 1 determines interrupt mode | |
| 183 | * (Spectrum v 0.99e had this behaviour reversed, and this | |
| 184 | * bit was not used in versions previous to v 0.99e) | |
| 185 | * 2 IFF2 (internal use) | |
| 186 | * 1 Interrupt Mode (if bit 3 reset): 0=>IM1, 1=>IM2 | |
| 187 | * 0 IFF1: 0=DI/1=EI | |
| 188 | 188 | * |
| 189 | 189 | *******************************************************************/ |
| 190 | 190 | void spectrum_setup_sp(running_machine *machine, unsigned char *pSnapshot, unsigned long SnapshotSize) |
| r5932 | r5933 | |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | if (SnapshotSize == 49179) |
| 411 | { | |
| 411 | { | |
| 412 | 412 | /* get pc from stack */ |
| 413 | 413 | addr = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP) & 0xFFFF; |
| 414 | 414 | |
| 415 | 415 | lo = memory_read_byte(space,addr + 0); |
| 416 | hi = memory_read_byte(space,addr + 1); | |
| 416 | hi = memory_read_byte(space,addr + 1); | |
| 417 | 417 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, (hi << 8) | lo); |
| 418 | 418 | memory_write_byte(space, addr + 0, 0); |
| 419 | 419 | memory_write_byte(space, addr + 1, 0); |
| 420 | ||
| 420 | ||
| 421 | 421 | memory_write_byte(space, 0x5CB0, 0xff); // Set NMIADD system variable to make game run |
| 422 | 422 | // when directly started with cart mounted |
| 423 | 423 | addr += 2; |
| r5932 | r5933 | |
| 465 | 465 | unsigned char ch; |
| 466 | 466 | int i; |
| 467 | 467 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 468 | ||
| 468 | ||
| 469 | 469 | do |
| 470 | 470 | { |
| 471 | 471 | /* get byte */ |
| 472 | 472 | ch = pSource[0]; |
| 473 | 473 | |
| 474 | 474 | /* either start 0f 0x0ed, 0x0ed, xx yy or |
| 475 | ||
| 475 | * single 0x0ed */ | |
| 476 | 476 | if (ch == (unsigned char) 0x0ed) |
| 477 | 477 | { |
| 478 | 478 | if (pSource[1] == (unsigned char) 0x0ed) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | * |
| 3 | * | |
| 3 | * kay_kbd.c | |
| 4 | 4 | * |
| 5 | * | |
| 5 | * Kaypro II Serial Keyboard | |
| 6 | 6 | * |
| 7 | * Most of this is copied from the old kaypro.c, | |
| 8 | * rather than re-inventing the wheel. | |
| 7 | * Most of this is copied from the old kaypro.c, | |
| 8 | * rather than re-inventing the wheel. | |
| 9 | 9 | * |
| 10 | * Juergen Buchmueller, July 1998 | |
| 11 | * Benjamin C. W. Sittler, July 1998 (new keyboard table) | |
| 10 | * Juergen Buchmueller, July 1998 | |
| 11 | * Benjamin C. W. Sittler, July 1998 (new keyboard table) | |
| 12 | 12 | * |
| 13 | * Converted to a serial device (as far as MESS will allow) | |
| 14 | * by Robbbert, April 2009. | |
| 13 | * Converted to a serial device (as far as MESS will allow) | |
| 14 | * by Robbbert, April 2009. | |
| 15 | 15 | * |
| 16 | 16 | ******************************************************************************/ |
| 17 | 17 | |
| r5932 | r5933 | |
| 101 | 101 | PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 102 | 102 | PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 103 | 103 | PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 104 | PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) | |
| 104 | PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL)) | |
| 105 | 105 | PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) |
| 106 | 106 | PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 107 | 107 | |
| r5932 | r5933 | |
| 384 | 384 | #if 0 |
| 385 | 385 | |
| 386 | 386 | /****************************************************** |
| 387 | * kaypro_const_w (write console status ;) | |
| 388 | * bit | |
| 389 | * 0 flush keyboard buffer | |
| 387 | * kaypro_const_w (write console status ;) | |
| 388 | * bit | |
| 389 | * 0 flush keyboard buffer | |
| 390 | 390 | ******************************************************/ |
| 391 | 391 | static WRITE8_HANDLER ( kaypro2_const_w ) |
| 392 | 392 | { |
| r5932 | r5933 | |
| 397 | 397 | #endif |
| 398 | 398 | |
| 399 | 399 | /****************************************************** |
| 400 | * stuff character into the keyboard buffer | |
| 401 | * releases CPU if it was waiting for a key | |
| 402 | * sounds bell if buffer would overflow | |
| 400 | * stuff character into the keyboard buffer | |
| 401 | * releases CPU if it was waiting for a key | |
| 402 | * sounds bell if buffer would overflow | |
| 403 | 403 | ******************************************************/ |
| 404 | 404 | static void kay_kbd_in( running_machine *machine, UINT8 data ) |
| 405 | 405 | { |
| r5932 | r5933 | |
| 421 | 421 | |
| 422 | 422 | UINT8 kay_kbd_c_r( void ) |
| 423 | 423 | { |
| 424 | /* d4 transmit buffer empty - 1=ok to send | |
| 425 | d2 appears to be receive buffer empty - 1=ok to receive | |
| 426 | d0 keyboard buffer empty - 1=key waiting to be used */ | |
| 424 | /* d4 transmit buffer empty - 1=ok to send | |
| 425 | d2 appears to be receive buffer empty - 1=ok to receive | |
| 426 | d0 keyboard buffer empty - 1=key waiting to be used */ | |
| 427 | 427 | |
| 428 | 428 | UINT8 data = control_status; |
| 429 | 429 | |
| r5932 | r5933 | |
| 457 | 457 | void kay_kbd_d_w( running_machine *machine, UINT8 data ) |
| 458 | 458 | { |
| 459 | 459 | /* Beeper control - lengths need verifying |
| 460 | 01 - keyclick | |
| 461 | 02 - short beep | |
| 462 | 04 - standard bell beep | |
| 463 | 08 - mute | |
| 464 | 16 - unmute */ | |
| 460 | 01 - keyclick | |
| 461 | 02 - short beep | |
| 462 | 04 - standard bell beep | |
| 463 | 08 - mute | |
| 464 | 16 - unmute */ | |
| 465 | 465 | |
| 466 | 466 | UINT16 length = 0; |
| 467 | 467 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Motorola 6883 SAM interface and emulation | |
| 4 | 4 | |
| 5 | This function emulates all the functionality of one M6883 | |
| 6 | synchronous address multiplexer. | |
| 5 | This function emulates all the functionality of one M6883 | |
| 6 | synchronous address multiplexer. | |
| 7 | 7 | |
| 8 | Note that the real SAM chip was intimately involved in things like | |
| 9 | memory and video addressing, which are things that the MAME core | |
| 10 | largely handles. Thus, this code only takes care of a small part | |
| 11 | of the SAM's actual functionality; it simply tracks the SAM | |
| 12 | registers and handles things like save states. It then delegates | |
| 13 | the bulk of the responsibilities back to the host. | |
| 8 | Note that the real SAM chip was intimately involved in things like | |
| 9 | memory and video addressing, which are things that the MAME core | |
| 10 | largely handles. Thus, this code only takes care of a small part | |
| 11 | of the SAM's actual functionality; it simply tracks the SAM | |
| 12 | registers and handles things like save states. It then delegates | |
| 13 | the bulk of the responsibilities back to the host. | |
| 14 | 14 | |
| 15 | The Motorola 6883 SAM has 16 bits worth of state, but the state is changed | |
| 16 | by writing into a 32 byte address space; odd bytes set bits and even bytes | |
| 17 | clear bits. Here is the layout: | |
| 15 | The Motorola 6883 SAM has 16 bits worth of state, but the state is changed | |
| 16 | by writing into a 32 byte address space; odd bytes set bits and even bytes | |
| 17 | clear bits. Here is the layout: | |
| 18 | 18 | |
| 19 | 31 Set TY Map Type 0: RAM/ROM 1: All RAM | |
| 20 | 30 Clear TY Map Type | |
| 21 | 29 Set M1 Memory Size 00: 4K 10: 64K Dynamic | |
| 22 | 28 Clear M1 Memory Size 01: 16K 11: 64K Static | |
| 23 | 27 Set M0 Memory Size | |
| 24 | 26 Clear M0 Memory Size | |
| 25 | 25 Set R1 MPU Rate 00: Slow 10: Fast | |
| 26 | 24 Clear R1 MPU Rate 01: Dual 11: Fast | |
| 27 | 23 Set R0 MPU Rate | |
| 28 | 22 Clear R0 MPU Rate | |
| 29 | 21 Set P1 Page #1 0: Low 1: High | |
| 30 | 20 Clear P1 Page #1 | |
| 31 | 19 Set F6 Display Offset | |
| 32 | 18 Clear F6 Display Offset | |
| 33 | 17 Set F5 Display Offset | |
| 34 | 16 Clear F5 Display Offset | |
| 35 | 15 Set F4 Display Offset | |
| 36 | 14 Clear F4 Display Offset | |
| 37 | 13 Set F3 Display Offset | |
| 38 | 12 Clear F3 Display Offset | |
| 39 | 11 Set F2 Display Offset | |
| 40 | 10 Clear F2 Display Offset | |
| 41 | 9 Set F1 Display Offset | |
| 42 | 8 Clear F1 Display Offset | |
| 43 | 7 Set F0 Display Offset | |
| 44 | 6 Clear F0 Display Offset | |
| 45 | 5 Set V2 VDG Mode | |
| 46 | 4 Clear V2 VDG Mode | |
| 47 | 3 Set V1 VDG Mode | |
| 48 | 2 Clear V1 VDG Mode | |
| 49 | 1 Set V0 VDG Mode | |
| 50 | 0 Clear V0 VDG Mode | |
| 19 | 31 Set TY Map Type 0: RAM/ROM 1: All RAM | |
| 20 | 30 Clear TY Map Type | |
| 21 | 29 Set M1 Memory Size 00: 4K 10: 64K Dynamic | |
| 22 | 28 Clear M1 Memory Size 01: 16K 11: 64K Static | |
| 23 | 27 Set M0 Memory Size | |
| 24 | 26 Clear M0 Memory Size | |
| 25 | 25 Set R1 MPU Rate 00: Slow 10: Fast | |
| 26 | 24 Clear R1 MPU Rate 01: Dual 11: Fast | |
| 27 | 23 Set R0 MPU Rate | |
| 28 | 22 Clear R0 MPU Rate | |
| 29 | 21 Set P1 Page #1 0: Low 1: High | |
| 30 | 20 Clear P1 Page #1 | |
| 31 | 19 Set F6 Display Offset | |
| 32 | 18 Clear F6 Display Offset | |
| 33 | 17 Set F5 Display Offset | |
| 34 | 16 Clear F5 Display Offset | |
| 35 | 15 Set F4 Display Offset | |
| 36 | 14 Clear F4 Display Offset | |
| 37 | 13 Set F3 Display Offset | |
| 38 | 12 Clear F3 Display Offset | |
| 39 | 11 Set F2 Display Offset | |
| 40 | 10 Clear F2 Display Offset | |
| 41 | 9 Set F1 Display Offset | |
| 42 | 8 Clear F1 Display Offset | |
| 43 | 7 Set F0 Display Offset | |
| 44 | 6 Clear F0 Display Offset | |
| 45 | 5 Set V2 VDG Mode | |
| 46 | 4 Clear V2 VDG Mode | |
| 47 | 3 Set V1 VDG Mode | |
| 48 | 2 Clear V1 VDG Mode | |
| 49 | 1 Set V0 VDG Mode | |
| 50 | 0 Clear V0 VDG Mode | |
| 51 | 51 | |
| 52 | 52 | **********************************************************************/ |
| 53 | 53 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | SST Multi-Purpose Flash (MPF) | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | SST39VF020 - 256 KByte | |
| 8 | SST39VF400A - 512 Kbyte | |
| 7 | SST39VF020 - 256 KByte | |
| 8 | SST39VF400A - 512 Kbyte | |
| 9 | 9 | |
| 10 | 10 | */ |
| 11 | 11 | |
| r5932 | r5933 | |
| 57 | 57 | { |
| 58 | 58 | sst39vfx_t *flash = get_token(device); |
| 59 | 59 | const sst39vfx_config *config = get_config(device); |
| 60 | ||
| 60 | ||
| 61 | 61 | _logerror( 0, ("sst39vfx_init (%d)\n", device_type)); |
| 62 | 62 | memset( flash, 0, sizeof( flash)); |
| 63 | 63 | switch (device_type) |
| r5932 | r5933 | |
| 106 | 106 | /* |
| 107 | 107 | READ8_HANDLER( sst39vfx_r ) |
| 108 | 108 | { |
| 109 | _logerror( 1, ("sst39vfx_r (%08X)\n", offset)); | |
| 110 | if (flash->swap) offset = OFFSET_SWAP( offset, flash->swap); | |
| 111 | return flash->data[offset]; | |
| 109 | _logerror( 1, ("sst39vfx_r (%08X)\n", offset)); | |
| 110 | if (flash->swap) offset = OFFSET_SWAP( offset, flash->swap); | |
| 111 | return flash->data[offset]; | |
| 112 | 112 | } |
| 113 | 113 | */ |
| 114 | 114 | |
| 115 | 115 | /* |
| 116 | 116 | WRITE8_HANDLER( sst39vfx_w ) |
| 117 | 117 | { |
| 118 | _logerror( 1, ("sst39vfx_w (%08X/%02X)\n", offset, data)); | |
| 119 | if (flash->swap) offset = OFFSET_SWAP( offset, flash->swap); | |
| 120 | flash->data[offset] = data; | |
| 118 | _logerror( 1, ("sst39vfx_w (%08X/%02X)\n", offset, data)); | |
| 119 | if (flash->swap) offset = OFFSET_SWAP( offset, flash->swap); | |
| 120 | flash->data[offset] = data; | |
| 121 | 121 | } |
| 122 | 122 | */ |
| 123 | 123 | |
| r5932 | r5933 | |
| 126 | 126 | int i, j; |
| 127 | 127 | UINT8 *base, temp[8]; |
| 128 | 128 | sst39vfx_t *flash = get_token(device); |
| 129 | ||
| 129 | ||
| 130 | 130 | base = flash->data; |
| 131 | 131 | for (i=0;i<flash->size;i+=flash->swap) |
| 132 | 132 | { |
| r5932 | r5933 | |
| 138 | 138 | void sst39vfx_load(const device_config *device, mame_file *file) |
| 139 | 139 | { |
| 140 | 140 | sst39vfx_t *flash = get_token(device); |
| 141 | ||
| 141 | ||
| 142 | 142 | _logerror( 0, ("sst39vfx_load (%p)\n", file)); |
| 143 | 143 | mame_fread( file, flash->data, flash->size); |
| 144 | 144 | if (flash->swap) sst39vfx_swap(device); |
| r5932 | r5933 | |
| 147 | 147 | void sst39vfx_save(const device_config *device, mame_file *file) |
| 148 | 148 | { |
| 149 | 149 | sst39vfx_t *flash = get_token(device); |
| 150 | ||
| 150 | ||
| 151 | 151 | _logerror( 0, ("sst39vfx_save (%p)\n", file)); |
| 152 | 152 | if (flash->swap) sst39vfx_swap(device); |
| 153 | 153 | mame_fwrite( file, flash->data, flash->size); |
| r5932 | r5933 | |
| 157 | 157 | /* |
| 158 | 158 | NVRAM_HANDLER( sst39vfx ) |
| 159 | 159 | { |
| 160 | _logerror( 0, ("nvram_handler_sst39vfx (%p/%d)\n", file, read_or_write)); | |
| 161 | if (read_or_write) | |
| 162 | { | |
| 163 | sst39vfx_save( file); | |
| 164 | } | |
| 165 | else | |
| 166 | { | |
| 167 | if (file) | |
| 168 | { | |
| 169 | sst39vfx_load( file); | |
| 170 | } | |
| 171 | else | |
| 172 | { | |
| 173 | memset( flash->data, 0xFF, flash->size); | |
| 174 | } | |
| 175 | } | |
| 160 | _logerror( 0, ("nvram_handler_sst39vfx (%p/%d)\n", file, read_or_write)); | |
| 161 | if (read_or_write) | |
| 162 | { | |
| 163 | sst39vfx_save( file); | |
| 164 | } | |
| 165 | else | |
| 166 | { | |
| 167 | if (file) | |
| 168 | { | |
| 169 | sst39vfx_load( file); | |
| 170 | } | |
| 171 | else | |
| 172 | { | |
| 173 | memset( flash->data, 0xFF, flash->size); | |
| 174 | } | |
| 175 | } | |
| 176 | 176 | } |
| 177 | 177 | */ |
| 178 | 178 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | TX-0 | |
| 3 | 3 | * |
| 4 | ||
| 4 | Raphael Nabet, 2004 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| r5932 | r5933 | |
| 149 | 149 | static void tx0_machine_stop(running_machine *machine) |
| 150 | 150 | { |
| 151 | 151 | /* the core will take care of freeing the timers, BUT we must set the variables |
| 152 | ||
| 152 | to NULL if we don't want to risk confusing the tape image init function */ | |
| 153 | 153 | tape_reader.timer = tape_puncher.timer = typewriter.prt_timer = dis_timer = NULL; |
| 154 | 154 | } |
| 155 | 155 | |
| r5932 | r5933 | |
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | /* |
| 169 | ||
| 169 | perforated tape handling | |
| 170 | 170 | */ |
| 171 | 171 | |
| 172 | 172 | void tx0_tape_get_open_mode(int id, unsigned int *readable, unsigned int *writeable, unsigned int *creatable) |
| r5932 | r5933 | |
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | /* |
| 196 | ||
| 196 | Open a perforated tape image | |
| 197 | 197 | |
| 198 | ||
| 198 | unit 0 is reader (read-only), unit 1 is puncher (write-only) | |
| 199 | 199 | */ |
| 200 | 200 | DEVICE_IMAGE_LOAD( tx0_tape ) |
| 201 | 201 | { |
| r5932 | r5933 | |
| 212 | 212 | |
| 213 | 213 | /* restart reader IO when necessary */ |
| 214 | 214 | /* note that this function may be called before tx0_init_machine, therefore |
| 215 | before tape_reader.timer is allocated. It does not matter, as the clutch is never | |
| 216 | down at power-up, but we must not call timer_enable with a NULL parameter! */ | |
| 215 | before tape_reader.timer is allocated. It does not matter, as the clutch is never | |
| 216 | down at power-up, but we must not call timer_enable with a NULL parameter! */ | |
| 217 | 217 | if (tape_reader.timer) |
| 218 | 218 | { |
| 219 | 219 | if (tape_reader.motor_on && tape_reader.rcl) |
| r5932 | r5933 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /* |
| 265 | ||
| 265 | Read a byte from perforated tape | |
| 266 | 266 | */ |
| 267 | 267 | static int tape_read(UINT8 *reply) |
| 268 | 268 | { |
| r5932 | r5933 | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /* |
| 276 | ||
| 276 | Write a byte to perforated tape | |
| 277 | 277 | */ |
| 278 | 278 | static void tape_write(UINT8 data) |
| 279 | 279 | { |
| r5932 | r5933 | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /* |
| 285 | ||
| 285 | common code for tape read commands (R1C, R3C, and read-in mode) | |
| 286 | 286 | */ |
| 287 | 287 | static void begin_tape_read(int binary) |
| 288 | 288 | { |
| r5932 | r5933 | |
| 303 | 303 | |
| 304 | 304 | |
| 305 | 305 | /* |
| 306 | ||
| 306 | timer callback to simulate reader IO | |
| 307 | 307 | */ |
| 308 | 308 | static TIMER_CALLBACK(reader_callback) |
| 309 | 309 | { |
| r5932 | r5933 | |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /* |
| 353 | ||
| 353 | timer callback to generate punch completion pulse | |
| 354 | 354 | */ |
| 355 | 355 | static TIMER_CALLBACK(puncher_callback) |
| 356 | 356 | { |
| r5932 | r5933 | |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /* |
| 361 | ||
| 361 | Initiate read of a 6-bit word from tape | |
| 362 | 362 | */ |
| 363 | 363 | void tx0_io_r1l(const device_config *device) |
| 364 | 364 | { |
| r5932 | r5933 | |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | /* |
| 369 | ||
| 369 | Initiate read of a 18-bit word from tape (used in read-in mode) | |
| 370 | 370 | */ |
| 371 | 371 | void tx0_io_r3l(const device_config *device) |
| 372 | 372 | { |
| r5932 | r5933 | |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | /* |
| 377 | ||
| 377 | Write a 7-bit word to tape (7th bit clear) | |
| 378 | 378 | */ |
| 379 | 379 | void tx0_io_p6h(const device_config *device) |
| 380 | 380 | { |
| r5932 | r5933 | |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | /* |
| 392 | ||
| 392 | Write a 7-bit word to tape (7th bit set) | |
| 393 | 393 | */ |
| 394 | 394 | void tx0_io_p7h(const device_config *device) |
| 395 | 395 | { |
| r5932 | r5933 | |
| 405 | 405 | |
| 406 | 406 | |
| 407 | 407 | /* |
| 408 | ||
| 408 | Typewriter handling | |
| 409 | 409 | |
| 410 | The alphanumeric on-line typewriter is a standard device on tx-0: it can | |
| 411 | both handle keyboard input and print output text. | |
| 410 | The alphanumeric on-line typewriter is a standard device on tx-0: it can | |
| 411 | both handle keyboard input and print output text. | |
| 412 | 412 | */ |
| 413 | 413 | |
| 414 | 414 | /* |
| 415 | ||
| 415 | Open a file for typewriter output | |
| 416 | 416 | */ |
| 417 | 417 | DEVICE_IMAGE_LOAD(tx0_typewriter) |
| 418 | 418 | { |
| r5932 | r5933 | |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /* |
| 431 | ||
| 431 | Write a character to typewriter | |
| 432 | 432 | */ |
| 433 | 433 | static void typewriter_out(running_machine *machine, UINT8 data) |
| 434 | 434 | { |
| r5932 | r5933 | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | /* |
| 441 | ||
| 441 | timer callback to generate typewriter completion pulse | |
| 442 | 442 | */ |
| 443 | 443 | static TIMER_CALLBACK(prt_callback) |
| 444 | 444 | { |
| r5932 | r5933 | |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /* |
| 449 | ||
| 449 | prt io callback | |
| 450 | 450 | */ |
| 451 | 451 | void tx0_io_prt(const device_config *device) |
| 452 | 452 | { |
| r5932 | r5933 | |
| 464 | 464 | |
| 465 | 465 | |
| 466 | 466 | /* |
| 467 | ||
| 467 | timer callback to generate crt completion pulse | |
| 468 | 468 | */ |
| 469 | 469 | static TIMER_CALLBACK(dis_callback) |
| 470 | 470 | { |
| r5932 | r5933 | |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /* |
| 475 | ||
| 475 | Plot one point on crt | |
| 476 | 476 | */ |
| 477 | 477 | void tx0_io_dis(const device_config *device) |
| 478 | 478 | { |
| r5932 | r5933 | |
| 490 | 490 | |
| 491 | 491 | |
| 492 | 492 | /* |
| 493 | ||
| 493 | Magtape support | |
| 494 | 494 | |
| 495 | ||
| 495 | Magtape format: | |
| 496 | 496 | |
| 497 | ||
| 497 | 7-track tape, 6-bit data, 1-bit parity | |
| 498 | 498 | |
| 499 | 499 | |
| 500 | 500 | */ |
| r5932 | r5933 | |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | /* |
| 552 | ||
| 552 | Open a magnetic tape image | |
| 553 | 553 | */ |
| 554 | 554 | DEVICE_IMAGE_LOAD( tx0_magtape ) |
| 555 | 555 | { |
| r5932 | r5933 | |
| 559 | 559 | |
| 560 | 560 | /* restart IO when necessary */ |
| 561 | 561 | /* note that this function may be called before tx0_init_machine, therefore |
| 562 | before magtape.timer is allocated. We must not call timer_enable with a | |
| 563 | NULL parameter! */ | |
| 562 | before magtape.timer is allocated. We must not call timer_enable with a | |
| 563 | NULL parameter! */ | |
| 564 | 564 | if (magtape.timer) |
| 565 | 565 | { |
| 566 | 566 | if (magtape.state == MTS_SELECTING) |
| r5932 | r5933 | |
| 607 | 607 | |
| 608 | 608 | if ((mar & 03) != 1) |
| 609 | 609 | { /* unimplemented device: remain in unselected state and set rwc |
| 610 | ||
| 610 | flag? */ | |
| 611 | 611 | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_RWC); |
| 612 | 612 | } |
| 613 | 613 | else |
| r5932 | r5933 | |
| 689 | 689 | { |
| 690 | 690 | case MTBSS_STATE0: |
| 691 | 691 | /* STATE0 -> initial interrecord gap, longitudinal parity; |
| 692 | if longitudinal parity was all 0s, gap between longitudinal | |
| 693 | parity and data, first byte of data */ | |
| 692 | if longitudinal parity was all 0s, gap between longitudinal | |
| 693 | parity and data, first byte of data */ | |
| 694 | 694 | if (buf != 0) |
| 695 | 695 | magtape.u.backspace_state = MTBSS_STATE1; |
| 696 | 696 | break; |
| 697 | 697 | case MTBSS_STATE1: |
| 698 | 698 | /* STATE1 -> first byte of gap between longitudinal parity and |
| 699 | ||
| 699 | data, second byte of data */ | |
| 700 | 700 | if (buf == 0) |
| 701 | 701 | magtape.u.backspace_state = MTBSS_STATE2; |
| 702 | 702 | else |
| r5932 | r5933 | |
| 704 | 704 | break; |
| 705 | 705 | case MTBSS_STATE2: |
| 706 | 706 | /* STATE2 -> second byte of gap between longitudinal parity and |
| 707 | ||
| 707 | data */ | |
| 708 | 708 | if (buf == 0) |
| 709 | 709 | magtape.u.backspace_state = MTBSS_STATE3; |
| 710 | 710 | else |
| r5932 | r5933 | |
| 716 | 716 | break; |
| 717 | 717 | case MTBSS_STATE3: |
| 718 | 718 | /* STATE3 -> third byte of gap between longitudinal parity and |
| 719 | ||
| 719 | data */ | |
| 720 | 720 | if (buf == 0) |
| 721 | 721 | magtape.u.backspace_state = MTBSS_STATE4; |
| 722 | 722 | else |
| r5932 | r5933 | |
| 728 | 728 | break; |
| 729 | 729 | case MTBSS_STATE4: |
| 730 | 730 | /* STATE4 -> first byte of data word, first byte of |
| 731 | ||
| 731 | interrecord gap after data */ | |
| 732 | 732 | if (buf == 0) |
| 733 | 733 | { |
| 734 | 734 | if (magtape.long_parity) |
| r5932 | r5933 | |
| 774 | 774 | if (image_fread(magtape.img, &buf, 1) != 1) |
| 775 | 775 | { /* I/O error or EOF? */ |
| 776 | 776 | /* The MAME fileio layer makes it very hard to make the |
| 777 | difference... MAME seems to assume that I/O errors never | |
| 778 | happen, whereas it is really easy to cause one by | |
| 779 | deconnecting an external drive the image is located on!!! */ | |
| 777 | difference... MAME seems to assume that I/O errors never | |
| 778 | happen, whereas it is really easy to cause one by | |
| 779 | deconnecting an external drive the image is located on!!! */ | |
| 780 | 780 | UINT64 offs; |
| 781 | 781 | offs = image_ftell(magtape.img); |
| 782 | 782 | if (image_fseek(magtape.img, 0, SEEK_END) || (offs != image_ftell(magtape.img))) |
| r5932 | r5933 | |
| 787 | 787 | else |
| 788 | 788 | { /* end of tape -> ??? */ |
| 789 | 789 | /* maybe we run past end of tape, so that tape is ejected from |
| 790 | ||
| 790 | upper reel and unit becomes unavailable??? */ | |
| 791 | 791 | /*image_unload(magtape.img);*/ |
| 792 | 792 | /* Or do we stop at EOT mark??? */ |
| 793 | 793 | magtape.state = MTS_UNSELECTING; |
| r5932 | r5933 | |
| 865 | 865 | break; |
| 866 | 866 | case MTRDS_STATE3: |
| 867 | 867 | /* STATE3 -> first byte of new word of data, or first byte |
| 868 | ||
| 868 | of gap between data and longitudinal parity */ | |
| 869 | 869 | if (buf != 0) |
| 870 | 870 | { |
| 871 | 871 | magtape.u.read.state = MTRDS_STATE1; |
| r5932 | r5933 | |
| 883 | 883 | break; |
| 884 | 884 | case MTRDS_STATE4: |
| 885 | 885 | /* STATE4 -> second byte of gap between data and |
| 886 | ||
| 886 | longitudinal parity */ | |
| 887 | 887 | if (buf != 0) |
| 888 | 888 | { |
| 889 | 889 | logerror("tape seems to be corrupt\n"); |
| r5932 | r5933 | |
| 896 | 896 | |
| 897 | 897 | case MTRDS_STATE5: |
| 898 | 898 | /* STATE5 -> third byte of gap between data and |
| 899 | ||
| 899 | longitudinal parity */ | |
| 900 | 900 | if (buf != 0) |
| 901 | 901 | { |
| 902 | 902 | logerror("tape seems to be corrupt\n"); |
| r5932 | r5933 | |
| 914 | 914 | { |
| 915 | 915 | logerror("invalid longitudinal parity\n"); |
| 916 | 916 | /* no idea if the original tx-0 magtape controller |
| 917 | ||
| 917 | checks parity, but can't harm if we do */ | |
| 918 | 918 | cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC); |
| 919 | 919 | } |
| 920 | 920 | /* set EOR and unselect... */ |
| r5932 | r5933 | |
| 1070 | 1070 | |
| 1071 | 1071 | |
| 1072 | 1072 | /* |
| 1073 | ||
| 1073 | callback which is called when reset line is pulsed | |
| 1074 | 1074 | |
| 1075 | ||
| 1075 | IO devices should reset | |
| 1076 | 1076 | */ |
| 1077 | 1077 | void tx0_io_reset_callback(const device_config *device) |
| 1078 | 1078 | { |
| r5932 | r5933 | |
| 1092 | 1092 | |
| 1093 | 1093 | |
| 1094 | 1094 | /* |
| 1095 | ||
| 1095 | typewriter keyboard handler | |
| 1096 | 1096 | */ |
| 1097 | 1097 | static void tx0_keyboard(running_machine *machine) |
| 1098 | 1098 | { |
| r5932 | r5933 | |
| 1110 | 1110 | { |
| 1111 | 1111 | typewriter_keys[i] = input_port_read(machine, twrnames[i]); |
| 1112 | 1112 | } |
| 1113 | ||
| 1113 | ||
| 1114 | 1114 | for (i=0; i<4; i++) |
| 1115 | 1115 | { |
| 1116 | 1116 | typewriter_transitions = typewriter_keys[i] & (~ old_typewriter_keys[i]); |
| r5932 | r5933 | |
| 1121 | 1121 | charcode = (i << 4) + j; |
| 1122 | 1122 | /* shuffle and insert data into LR */ |
| 1123 | 1123 | /* BTW, I am not sure how the char code is combined with the |
| 1124 | ||
| 1124 | previous LR */ | |
| 1125 | 1125 | lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); |
| 1126 | 1126 | /* write modified LR */ |
| 1127 | 1127 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_LR, lr); |
| r5932 | r5933 | |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | /* |
| 1138 | ||
| 1138 | Not a real interrupt - just handle keyboard input | |
| 1139 | 1139 | */ |
| 1140 | 1140 | INTERRUPT_GEN( tx0_interrupt ) |
| 1141 | 1141 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Motorola 6883 SAM interface and emulation | |
| 4 | 4 | |
| 5 | This function emulates all the functionality of one M6883 | |
| 6 | synchronous address multiplexer. | |
| 5 | This function emulates all the functionality of one M6883 | |
| 6 | synchronous address multiplexer. | |
| 7 | 7 | |
| 8 | Note that the real SAM chip was intimately involved in things like | |
| 9 | memory and video addressing, which are things that the MAME core | |
| 10 | largely handles. Thus, this code only takes care of a small part | |
| 11 | of the SAM's actual functionality; it simply tracks the SAM | |
| 12 | registers and handles things like save states. It then delegates | |
| 13 | the bulk of the responsibilities back to the host. | |
| 8 | Note that the real SAM chip was intimately involved in things like | |
| 9 | memory and video addressing, which are things that the MAME core | |
| 10 | largely handles. Thus, this code only takes care of a small part | |
| 11 | of the SAM's actual functionality; it simply tracks the SAM | |
| 12 | registers and handles things like save states. It then delegates | |
| 13 | the bulk of the responsibilities back to the host. | |
| 14 | 14 | |
| 15 | 15 | **********************************************************************/ |
| 16 | 16 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | SST Multi-Purpose Flash (MPF) | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | SST39VF020 - 256 KByte | |
| 8 | SST39VF400A - 512 Kbyte | |
| 7 | SST39VF020 - 256 KByte | |
| 8 | SST39VF400A - 512 Kbyte | |
| 9 | 9 | |
| 10 | 10 | */ |
| 11 | 11 | |
| r5932 | r5933 | |
| 37 | 37 | MDRV_DEVICE_CONFIG_DATA32(sst39vfx_config, cpu_endianess, _cpu_endianess) |
| 38 | 38 | |
| 39 | 39 | #define MDRV_SST39VF020_REMOVE(_tag) \ |
| 40 | MDRV_DEVICE_REMOVE(_tag) | |
| 41 | ||
| 40 | MDRV_DEVICE_REMOVE(_tag) | |
| 41 | ||
| 42 | 42 | #define SST39VF400A DEVICE_GET_INFO_NAME(sst39vf400a) |
| 43 | 43 | |
| 44 | 44 | #define MDRV_SST39VF400A_ADD(_tag,_cpu_datawidth,_cpu_endianess) \ |
| r5932 | r5933 | |
|---|---|---|
| 5 | 5 | Machine file to handle emulation of the AY-3600 keyboard controller. |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | -Make the caps lock functional, remove dependency on input_port_1. | |
| 9 | Caps lock now functional. Barry Nelson 04/05/2001 | |
| 10 | Still dependent on input_port_1 though. | |
| 11 | -Rename variables from a2 to AY3600 | |
| 12 | Done. Barry Nelson 04/05/2001 | |
| 13 | Find the correct MAGIC_KEY_REPEAT_NUMBER | |
| 14 | Use the keyboard ROM for building a remapping table? | |
| 8 | -Make the caps lock functional, remove dependency on input_port_1. | |
| 9 | Caps lock now functional. Barry Nelson 04/05/2001 | |
| 10 | Still dependent on input_port_1 though. | |
| 11 | -Rename variables from a2 to AY3600 | |
| 12 | Done. Barry Nelson 04/05/2001 | |
| 13 | Find the correct MAGIC_KEY_REPEAT_NUMBER | |
| 14 | Use the keyboard ROM for building a remapping table? | |
| 15 | 15 | |
| 16 | 16 | ***************************************************************************/ |
| 17 | 17 | |
| r5932 | r5933 | |
| 43 | 43 | |
| 44 | 44 | static const unsigned char ay3600_key_remap_2[9*8][4] = |
| 45 | 45 | { |
| 46 | /* norm ctrl shft both */ | |
| 47 | { 0x7f,0x7f,0x7f,0x7f }, /* UNUSED */ | |
| 48 | { 0x08,0x08,0x08,0x08 }, /* Left */ | |
| 49 | { 0x09,0x09,0x09,0x09 }, /* UNUSED */ | |
| 50 | { 0x0a,0x0a,0x0a,0x0a }, /* UNUSED */ | |
| 51 | { 0x0b,0x0b,0x0b,0x0b }, /* UNUSED */ | |
| 52 | { 0x0d,0x0d,0x0d,0x0d }, /* Enter */ | |
| 53 | { 0x15,0x15,0x15,0x15 }, /* Right */ | |
| 54 | { 0x1b,0x1b,0x1b,0x1b }, /* Escape */ | |
| 55 | { 0x20,0x20,0x20,0x20 }, /* Space */ | |
| 56 | { 0x27,0x27,0x22,0x22 }, /* UNUSED */ | |
| 57 | { 0x2c,0x2c,0x3c,0x3c }, /* , < */ | |
| 58 | { 0x3a,0x3a,0x2a,0x2a }, /* : * */ | |
| 59 | { 0x2e,0x2e,0x3e,0x3e }, /* . > */ | |
| 60 | { 0x2f,0x2f,0x3f,0x3f }, /* / ? */ | |
| 61 | { 0x30,0x30,0x30,0x30 }, /* 0 */ | |
| 62 | { 0x31,0x31,0x21,0x21 }, /* 1 ! */ | |
| 63 | { 0x32,0x32,0x22,0x22 }, /* 2 " */ | |
| 64 | { 0x33,0x33,0x23,0x23 }, /* 3 # */ | |
| 65 | { 0x34,0x34,0x24,0x24 }, /* 4 $ */ | |
| 66 | { 0x35,0x35,0x25,0x25 }, /* 5 % */ | |
| 67 | { 0x36,0x36,0x26,0x26 }, /* 6 & */ | |
| 68 | { 0x37,0x37,0x27,0x27 }, /* 7 ' */ | |
| 69 | { 0x38,0x38,0x28,0x28 }, /* 8 ( */ | |
| 70 | { 0x39,0x39,0x29,0x29 }, /* 9 ) */ | |
| 71 | { 0x3b,0x3b,0x2b,0x2b }, /* ; + */ | |
| 72 | { 0x2d,0x2d,0x3d,0x3d }, /* - = */ | |
| 73 | { 0x5b,0x1b,0x7b,0x1b }, /* UNUSED */ | |
| 74 | { 0x5c,0x1c,0x7c,0x1c }, /* UNUSED */ | |
| 75 | { 0x5d,0x1d,0x7d,0x1d }, /* UNUSED */ | |
| 76 | { 0x60,0x60,0x7e,0x7e }, /* UNUSED */ | |
| 77 | { 0x41,0x01,0x41,0x01 }, /* A */ | |
| 78 | { 0x42,0x02,0x42,0x02 }, /* B */ | |
| 79 | { 0x43,0x03,0x43,0x03 }, /* C */ | |
| 80 | { 0x44,0x04,0x44,0x04 }, /* D */ | |
| 81 | { 0x45,0x05,0x45,0x05 }, /* E */ | |
| 82 | { 0x46,0x06,0x46,0x06 }, /* F */ | |
| 83 | { 0x47,0x07,0x47,0x07 }, /* G */ | |
| 84 | { 0x48,0x08,0x48,0x08 }, /* H */ | |
| 85 | { 0x49,0x09,0x49,0x09 }, /* I */ | |
| 86 | { 0x4a,0x0a,0x4a,0x0a }, /* J */ | |
| 87 | { 0x4b,0x0b,0x4b,0x0b }, /* K */ | |
| 88 | { 0x4c,0x0c,0x4c,0x0c }, /* L */ | |
| 89 | { 0x4d,0x0d,0x5d,0x0d }, /* M ] */ | |
| 90 | { 0x4e,0x0e,0x5e,0x1e }, /* N ^ */ | |
| 91 | { 0x4f,0x0f,0x4f,0x0f }, /* O */ | |
| 92 | { 0x50,0x10,0x40,0x00 }, /* P @ */ | |
| 93 | { 0x51,0x11,0x51,0x11 }, /* Q */ | |
| 94 | { 0x52,0x12,0x52,0x12 }, /* R */ | |
| 95 | { 0x53,0x13,0x53,0x13 }, /* S */ | |
| 96 | { 0x54,0x14,0x54,0x14 }, /* T */ | |
| 97 | { 0x55,0x15,0x55,0x15 }, /* U */ | |
| 98 | { 0x56,0x16,0x56,0x16 }, /* V */ | |
| 99 | { 0x57,0x17,0x57,0x17 }, /* W */ | |
| 100 | { 0x58,0x18,0x58,0x18 }, /* X */ | |
| 101 | { 0x59,0x19,0x59,0x19 }, /* Y */ | |
| 102 | { 0x5a,0x1a,0x5a,0x1a } /* Z */ | |
| 46 | /* norm ctrl shft both */ | |
| 47 | { 0x7f,0x7f,0x7f,0x7f }, /* UNUSED */ | |
| 48 | { 0x08,0x08,0x08,0x08 }, /* Left */ | |
| 49 | { 0x09,0x09,0x09,0x09 }, /* UNUSED */ | |
| 50 | { 0x0a,0x0a,0x0a,0x0a }, /* UNUSED */ | |
| 51 | { 0x0b,0x0b,0x0b,0x0b }, /* UNUSED */ | |
| 52 | { 0x0d,0x0d,0x0d,0x0d }, /* Enter */ | |
| 53 | { 0x15,0x15,0x15,0x15 }, /* Right */ | |
| 54 | { 0x1b,0x1b,0x1b,0x1b }, /* Escape */ | |
| 55 | { 0x20,0x20,0x20,0x20 }, /* Space */ | |
| 56 | { 0x27,0x27,0x22,0x22 }, /* UNUSED */ | |
| 57 | { 0x2c,0x2c,0x3c,0x3c }, /* , < */ | |
| 58 | { 0x3a,0x3a,0x2a,0x2a }, /* : * */ | |
| 59 | { 0x2e,0x2e,0x3e,0x3e }, /* . > */ | |
| 60 | { 0x2f,0x2f,0x3f,0x3f }, /* / ? */ | |
| 61 | { 0x30,0x30,0x30,0x30 }, /* 0 */ | |
| 62 | { 0x31,0x31,0x21,0x21 }, /* 1 ! */ | |
| 63 | { 0x32,0x32,0x22,0x22 }, /* 2 " */ | |
| 64 | { 0x33,0x33,0x23,0x23 }, /* 3 # */ | |
| 65 | { 0x34,0x34,0x24,0x24 }, /* 4 $ */ | |
| 66 | { 0x35,0x35,0x25,0x25 }, /* 5 % */ | |
| 67 | { 0x36,0x36,0x26,0x26 }, /* 6 & */ | |
| 68 | { 0x37,0x37,0x27,0x27 }, /* 7 ' */ | |
| 69 | { 0x38,0x38,0x28,0x28 }, /* 8 ( */ | |
| 70 | { 0x39,0x39,0x29,0x29 }, /* 9 ) */ | |
| 71 | { 0x3b,0x3b,0x2b,0x2b }, /* ; + */ | |
| 72 | { 0x2d,0x2d,0x3d,0x3d }, /* - = */ | |
| 73 | { 0x5b,0x1b,0x7b,0x1b }, /* UNUSED */ | |
| 74 | { 0x5c,0x1c,0x7c,0x1c }, /* UNUSED */ | |
| 75 | { 0x5d,0x1d,0x7d,0x1d }, /* UNUSED */ | |
| 76 | { 0x60,0x60,0x7e,0x7e }, /* UNUSED */ | |
| 77 | { 0x41,0x01,0x41,0x01 }, /* A */ | |
| 78 | { 0x42,0x02,0x42,0x02 }, /* B */ | |
| 79 | { 0x43,0x03,0x43,0x03 }, /* C */ | |
| 80 | { 0x44,0x04,0x44,0x04 }, /* D */ | |
| 81 | { 0x45,0x05,0x45,0x05 }, /* E */ | |
| 82 | { 0x46,0x06,0x46,0x06 }, /* F */ | |
| 83 | { 0x47,0x07,0x47,0x07 }, /* G */ | |
| 84 | { 0x48,0x08,0x48,0x08 }, /* H */ | |
| 85 | { 0x49,0x09,0x49,0x09 }, /* I */ | |
| 86 | { 0x4a,0x0a,0x4a,0x0a }, /* J */ | |
| 87 | { 0x4b,0x0b,0x4b,0x0b }, /* K */ | |
| 88 | { 0x4c,0x0c,0x4c,0x0c }, /* L */ | |
| 89 | { 0x4d,0x0d,0x5d,0x0d }, /* M ] */ | |
| 90 | { 0x4e,0x0e,0x5e,0x1e }, /* N ^ */ | |
| 91 | { 0x4f,0x0f,0x4f,0x0f }, /* O */ | |
| 92 | { 0x50,0x10,0x40,0x00 }, /* P @ */ | |
| 93 | { 0x51,0x11,0x51,0x11 }, /* Q */ | |
| 94 | { 0x52,0x12,0x52,0x12 }, /* R */ | |
| 95 | { 0x53,0x13,0x53,0x13 }, /* S */ | |
| 96 | { 0x54,0x14,0x54,0x14 }, /* T */ | |
| 97 | { 0x55,0x15,0x55,0x15 }, /* U */ | |
| 98 | { 0x56,0x16,0x56,0x16 }, /* V */ | |
| 99 | { 0x57,0x17,0x57,0x17 }, /* W */ | |
| 100 | { 0x58,0x18,0x58,0x18 }, /* X */ | |
| 101 | { 0x59,0x19,0x59,0x19 }, /* Y */ | |
| 102 | { 0x5a,0x1a,0x5a,0x1a } /* Z */ | |
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | 105 | static const unsigned char ay3600_key_remap_2e[2][9*8][4] = |
| 106 | 106 | { |
| 107 | 107 | /* caps lock off norm ctrl shft both */ |
| 108 | 108 | { |
| 109 | { 0x7f,0x7f,0x7f,0x7f }, /* Backspace */ | |
| 110 | { 0x08,0x08,0x08,0x08 }, /* Left */ | |
| 111 | { 0x09,0x09,0x09,0x09 }, /* Tab */ | |
| 112 | { 0x0a,0x0a,0x0a,0x0a }, /* Down */ | |
| 113 | { 0x0b,0x0b,0x0b,0x0b }, /* Up */ | |
| 114 | { 0x0d,0x0d,0x0d,0x0d }, /* Enter */ | |
| 115 | { 0x15,0x15,0x15,0x15 }, /* Right */ | |
| 116 | { 0x1b,0x1b,0x1b,0x1b }, /* Escape */ | |
| 117 | { 0x20,0x20,0x20,0x20 }, /* Space */ | |
| 109 | { 0x7f,0x7f,0x7f,0x7f }, /* Backspace */ | |
| 110 | { 0x08,0x08,0x08,0x08 }, /* Left */ | |
| 111 | { 0x09,0x09,0x09,0x09 }, /* Tab */ | |
| 112 | { 0x0a,0x0a,0x0a,0x0a }, /* Down */ | |
| 113 | { 0x0b,0x0b,0x0b,0x0b }, /* Up */ | |
| 114 | { 0x0d,0x0d,0x0d,0x0d }, /* Enter */ | |
| 115 | { 0x15,0x15,0x15,0x15 }, /* Right */ | |
| 116 | { 0x1b,0x1b,0x1b,0x1b }, /* Escape */ | |
| 117 | { 0x20,0x20,0x20,0x20 }, /* Space */ | |
| 118 | 118 | { 0x27,0x27,0x22,0x22 }, /* ' " */ |
| 119 | { 0x2c,0x2c,0x3c,0x3c }, /* , < */ | |
| 120 | { 0x2d,0x2d,0x5f,0x1f }, /* - _ */ | |
| 121 | { 0x2e,0x2e,0x3e,0x3e }, /* . > */ | |
| 122 | { 0x2f,0x2f,0x3f,0x3f }, /* / ? */ | |
| 123 | { 0x30,0x30,0x29,0x29 }, /* 0 ) */ | |
| 124 | { 0x31,0x31,0x21,0x21 }, /* 1 ! */ | |
| 125 | { 0x32,0x00,0x40,0x00 }, /* 2 @ */ | |
| 126 | { 0x33,0x33,0x23,0x23 }, /* 3 # */ | |
| 127 | { 0x34,0x34,0x24,0x24 }, /* 4 $ */ | |
| 128 | { 0x35,0x35,0x25,0x25 }, /* 5 % */ | |
| 129 | { 0x36,0x1e,0x5e,0x1e }, /* 6 ^ */ | |
| 130 | { 0x37,0x37,0x26,0x26 }, /* 7 & */ | |
| 131 | { 0x38,0x38,0x2a,0x2a }, /* 8 * */ | |
| 132 | { 0x39,0x39,0x28,0x28 }, /* 9 ( */ | |
| 133 | { 0x3b,0x3b,0x3a,0x3a }, /* ; : */ | |
| 134 | { 0x3d,0x3d,0x2b,0x2b }, /* = + */ | |
| 135 | { 0x5b,0x1b,0x7b,0x1b }, /* [ { */ | |
| 136 | { 0x5c,0x1c,0x7c,0x1c }, /* \ | */ | |
| 137 | { 0x5d,0x1d,0x7d,0x1d }, /* ] } */ | |
| 138 | { 0x60,0x60,0x7e,0x7e }, /* ` ~ */ | |
| 139 | { 0x61,0x01,0x41,0x01 }, /* a A */ | |
| 140 | { 0x62,0x02,0x42,0x02 }, /* b B */ | |
| 141 | { 0x63,0x03,0x43,0x03 }, /* c C */ | |
| 142 | { 0x64,0x04,0x44,0x04 }, /* d D */ | |
| 143 | { 0x65,0x05,0x45,0x05 }, /* e E */ | |
| 144 | { 0x66,0x06,0x46,0x06 }, /* f F */ | |
| 145 | { 0x67,0x07,0x47,0x07 }, /* g G */ | |
| 146 | { 0x68,0x08,0x48,0x08 }, /* h H */ | |
| 147 | { 0x69,0x09,0x49,0x09 }, /* i I */ | |
| 148 | { 0x6a,0x0a,0x4a,0x0a }, /* j J */ | |
| 149 | { 0x6b,0x0b,0x4b,0x0b }, /* k K */ | |
| 150 | { 0x6c,0x0c,0x4c,0x0c }, /* l L */ | |
| 151 | { 0x6d,0x0d,0x4d,0x0d }, /* m M */ | |
| 152 | { 0x6e,0x0e,0x4e,0x0e }, /* n N */ | |
| 153 | { 0x6f,0x0f,0x4f,0x0f }, /* o O */ | |
| 154 | { 0x70,0x10,0x50,0x10 }, /* p P */ | |
| 155 | { 0x71,0x11,0x51,0x11 }, /* q Q */ | |
| 156 | { 0x72,0x12,0x52,0x12 }, /* r R */ | |
| 157 | { 0x73,0x13,0x53,0x13 }, /* s S */ | |
| 158 | { 0x74,0x14,0x54,0x14 }, /* t T */ | |
| 159 | { 0x75,0x15,0x55,0x15 }, /* u U */ | |
| 160 | { 0x76,0x16,0x56,0x16 }, /* v V */ | |
| 161 | { 0x77,0x17,0x57,0x17 }, /* w W */ | |
| 162 | { 0x78,0x18,0x58,0x18 }, /* x X */ | |
| 163 | { 0x79,0x19,0x59,0x19 }, /* y Y */ | |
| 164 | { 0x7a,0x1a,0x5a,0x1a }, /* z Z */ | |
| 165 | { 0x30,0x30,0x30,0x30 }, /* 0 (KP) */ | |
| 166 | { 0x31,0x31,0x31,0x31 }, /* 1 (KP) */ | |
| 167 | { 0x32,0x32,0x32,0x32 }, /* 2 (KP) */ | |
| 168 | { 0x33,0x33,0x33,0x33 }, /* 3 (KP) */ | |
| 169 | { 0x34,0x34,0x34,0x34 }, /* 4 (KP) */ | |
| 170 | { 0x35,0x35,0x35,0x35 }, /* 5 (KP) */ | |
| 171 | { 0x36,0x36,0x36,0x36 }, /* 6 (KP) */ | |
| 172 | { 0x37,0x37,0x37,0x37 }, /* 7 (KP) */ | |
| 173 | { 0x38,0x38,0x38,0x38 }, /* 8 (KP) */ | |
| 174 | { 0x39,0x39,0x39,0x39 }, /* 9 (KP) */ | |
| 175 | { 0x2f,0x2f,0x2f,0x2f }, /* / (KP) */ | |
| 176 | { 0x2a,0x2a,0x2a,0x2a }, /* * (KP) */ | |
| 177 | { 0x2d,0x2d,0x2d,0x2d }, /* - (KP) */ | |
| 178 | { 0x2b,0x2b,0x2b,0x2b }, /* + (KP) */ | |
| 179 | { 0x2e,0x2e,0x2e,0x2e }, /* . (KP) */ | |
| 180 | { 0x0d,0x0d,0x0d,0x0d } /* Enter (KP) */ | |
| 119 | { 0x2c,0x2c,0x3c,0x3c }, /* , < */ | |
| 120 | { 0x2d,0x2d,0x5f,0x1f }, /* - _ */ | |
| 121 | { 0x2e,0x2e,0x3e,0x3e }, /* . > */ | |
| 122 | { 0x2f,0x2f,0x3f,0x3f }, /* / ? */ | |
| 123 | { 0x30,0x30,0x29,0x29 }, /* 0 ) */ | |
| 124 | { 0x31,0x31,0x21,0x21 }, /* 1 ! */ | |
| 125 | { 0x32,0x00,0x40,0x00 }, /* 2 @ */ | |
| 126 | { 0x33,0x33,0x23,0x23 }, /* 3 # */ | |
| 127 | { 0x34,0x34,0x24,0x24 }, /* 4 $ */ | |
| 128 | { 0x35,0x35,0x25,0x25 }, /* 5 % */ | |
| 129 | { 0x36,0x1e,0x5e,0x1e }, /* 6 ^ */ | |
| 130 | { 0x37,0x37,0x26,0x26 }, /* 7 & */ | |
| 131 | { 0x38,0x38,0x2a,0x2a }, /* 8 * */ | |
| 132 | { 0x39,0x39,0x28,0x28 }, /* 9 ( */ | |
| 133 | { 0x3b,0x3b,0x3a,0x3a }, /* ; : */ | |
| 134 | { 0x3d,0x3d,0x2b,0x2b }, /* = + */ | |
| 135 | { 0x5b,0x1b,0x7b,0x1b }, /* [ { */ | |
| 136 | { 0x5c,0x1c,0x7c,0x1c }, /* \ | */ | |
| 137 | { 0x5d,0x1d,0x7d,0x1d }, /* ] } */ | |
| 138 | { 0x60,0x60,0x7e,0x7e }, /* ` ~ */ | |
| 139 | { 0x61,0x01,0x41,0x01 }, /* a A */ | |
| 140 | { 0x62,0x02,0x42,0x02 }, /* b B */ | |
| 141 | { 0x63,0x03,0x43,0x03 }, /* c C */ | |
| 142 | { 0x64,0x04,0x44,0x04 }, /* d D */ | |
| 143 | { 0x65,0x05,0x45,0x05 }, /* e E */ | |
| 144 | { 0x66,0x06,0x46,0x06 }, /* f F */ | |
| 145 | { 0x67,0x07,0x47,0x07 }, /* g G */ | |
| 146 | { 0x68,0x08,0x48,0x08 }, /* h H */ | |
| 147 | { 0x69,0x09,0x49,0x09 }, /* i I */ | |
| 148 | { 0x6a,0x0a,0x4a,0x0a }, /* j J */ | |
| 149 | { 0x6b,0x0b,0x4b,0x0b }, /* k K */ | |
| 150 | { 0x6c,0x0c,0x4c,0x0c }, /* l L */ | |
| 151 | { 0x6d,0x0d,0x4d,0x0d }, /* m M */ | |
| 152 | { 0x6e,0x0e,0x4e,0x0e }, /* n N */ | |
| 153 | { 0x6f,0x0f,0x4f,0x0f }, /* o O */ | |
| 154 | { 0x70,0x10,0x50,0x10 }, /* p P */ | |
| 155 | { 0x71,0x11,0x51,0x11 }, /* q Q */ | |
| 156 | { 0x72,0x12,0x52,0x12 }, /* r R */ | |
| 157 | { 0x73,0x13,0x53,0x13 }, /* s S */ | |
| 158 | { 0x74,0x14,0x54,0x14 }, /* t T */ | |
| 159 | { 0x75,0x15,0x55,0x15 }, /* u U */ | |
| 160 | { 0x76,0x16,0x56,0x16 }, /* v V */ | |
| 161 | { 0x77,0x17,0x57,0x17 }, /* w W */ | |
| 162 | { 0x78,0x18,0x58,0x18 }, /* x X */ | |
| 163 | { 0x79,0x19,0x59,0x19 }, /* y Y */ | |
| 164 | { 0x7a,0x1a,0x5a,0x1a }, /* z Z */ | |
| 165 | { 0x30,0x30,0x30,0x30 }, /* 0 (KP) */ | |
| 166 | { 0x31,0x31,0x31,0x31 }, /* 1 (KP) */ | |
| 167 | { 0x32,0x32,0x32,0x32 }, /* 2 (KP) */ | |
| 168 | { 0x33,0x33,0x33,0x33 }, /* 3 (KP) */ | |
| 169 | { 0x34,0x34,0x34,0x34 }, /* 4 (KP) */ | |
| 170 | { 0x35,0x35,0x35,0x35 }, /* 5 (KP) */ | |
| 171 | { 0x36,0x36,0x36,0x36 }, /* 6 (KP) */ | |
| 172 | { 0x37,0x37,0x37,0x37 }, /* 7 (KP) */ | |
| 173 | { 0x38,0x38,0x38,0x38 }, /* 8 (KP) */ | |
| 174 | { 0x39,0x39,0x39,0x39 }, /* 9 (KP) */ | |
| 175 | { 0x2f,0x2f,0x2f,0x2f }, /* / (KP) */ | |
| 176 | { 0x2a,0x2a,0x2a,0x2a }, /* * (KP) */ | |
| 177 | { 0x2d,0x2d,0x2d,0x2d }, /* - (KP) */ | |
| 178 | { 0x2b,0x2b,0x2b,0x2b }, /* + (KP) */ | |
| 179 | { 0x2e,0x2e,0x2e,0x2e }, /* . (KP) */ | |
| 180 | { 0x0d,0x0d,0x0d,0x0d } /* Enter (KP) */ | |
| 181 | 181 | }, |
| 182 | 182 | /* caps lock on norm ctrl shft both */ |
| 183 | 183 | { |
| 184 | { 0x7f,0x7f,0x7f,0x7f }, /* Backspace */ | |
| 185 | { 0x08,0x08,0x08,0x08 }, /* Left */ | |
| 186 | { 0x09,0x09,0x09,0x09 }, /* Tab */ | |
| 187 | { 0x0a,0x0a,0x0a,0x0a }, /* Down */ | |
| 188 | { 0x0b,0x0b,0x0b,0x0b }, /* Up */ | |
| 189 | { 0x0d,0x0d,0x0d,0x0d }, /* Enter */ | |
| 190 | { 0x15,0x15,0x15,0x15 }, /* Right */ | |
| 191 | { 0x1b,0x1b,0x1b,0x1b }, /* Escape */ | |
| 192 | { 0x20,0x20,0x20,0x20 }, /* Space */ | |
| 184 | { 0x7f,0x7f,0x7f,0x7f }, /* Backspace */ | |
| 185 | { 0x08,0x08,0x08,0x08 }, /* Left */ | |
| 186 | { 0x09,0x09,0x09,0x09 }, /* Tab */ | |
| 187 | { 0x0a,0x0a,0x0a,0x0a }, /* Down */ | |
| 188 | { 0x0b,0x0b,0x0b,0x0b }, /* Up */ | |
| 189 | { 0x0d,0x0d,0x0d,0x0d }, /* Enter */ | |
| 190 | { 0x15,0x15,0x15,0x15 }, /* Right */ | |
| 191 | { 0x1b,0x1b,0x1b,0x1b }, /* Escape */ | |
| 192 | { 0x20,0x20,0x20,0x20 }, /* Space */ | |
| 193 | 193 | { 0x27,0x27,0x22,0x22 }, /* ' " */ |
| 194 | { 0x2c,0x2c,0x3c,0x3c }, /* , < */ | |
| 195 | { 0x2d,0x2d,0x5f,0x1f }, /* - _ */ | |
| 196 | { 0x2e,0x2e,0x3e,0x3e }, /* . > */ | |
| 197 | { 0x2f,0x2f,0x3f,0x3f }, /* / ? */ | |
| 198 | { 0x30,0x30,0x29,0x29 }, /* 0 ) */ | |
| 199 | { 0x31,0x31,0x21,0x21 }, /* 1 ! */ | |
| 200 | { 0x32,0x00,0x40,0x00 }, /* 2 @ */ | |
| 201 | { 0x33,0x33,0x23,0x23 }, /* 3 # */ | |
| 202 | { 0x34,0x34,0x24,0x24 }, /* 4 $ */ | |
| 203 | { 0x35,0x35,0x25,0x25 }, /* 5 % */ | |
| 204 | { 0x36,0x1e,0x5e,0x1e }, /* 6 ^ */ | |
| 205 | { 0x37,0x37,0x26,0x26 }, /* 7 & */ | |
| 206 | { 0x38,0x38,0x2a,0x2a }, /* 8 * */ | |
| 207 | { 0x39,0x39,0x28,0x28 }, /* 9 ( */ | |
| 208 | { 0x3b,0x3b,0x3a,0x3a }, /* ; : */ | |
| 209 | { 0x3d,0x3d,0x2b,0x2b }, /* = + */ | |
| 210 | { 0x5b,0x1b,0x7b,0x1b }, /* [ { */ | |
| 211 | { 0x5c,0x1c,0x7c,0x1c }, /* \ | */ | |
| 212 | { 0x5d,0x1d,0x7d,0x1d }, /* ] } */ | |
| 213 | { 0x60,0x60,0x7e,0x7e }, /* ` ~ */ | |
| 214 | { 0x41,0x01,0x61,0x01 }, /* A a */ | |
| 215 | { 0x42,0x02,0x62,0x02 }, /* B b */ | |
| 216 | { 0x43,0x03,0x63,0x03 }, /* C c */ | |
| 217 | { 0x44,0x04,0x64,0x04 }, /* D d */ | |
| 218 | { 0x45,0x05,0x65,0x05 }, /* E e */ | |
| 219 | { 0x46,0x06,0x66,0x06 }, /* F f */ | |
| 220 | { 0x47,0x07,0x67,0x07 }, /* G g */ | |
| 221 | { 0x48,0x08,0x68,0x08 }, /* H h */ | |
| 222 | { 0x49,0x09,0x69,0x09 }, /* I i */ | |
| 223 | { 0x4a,0x0a,0x6a,0x0a }, /* J j */ | |
| 224 | { 0x4b,0x0b,0x6b,0x0b }, /* K k */ | |
| 225 | { 0x4c,0x0c,0x6c,0x0c }, /* L l */ | |
| 226 | { 0x4d,0x0d,0x6d,0x0d }, /* M m */ | |
| 227 | { 0x4e,0x0e,0x6e,0x0e }, /* N n */ | |
| 228 | { 0x4f,0x0f,0x6f,0x0f }, /* O o */ | |
| 229 | { 0x50,0x10,0x70,0x10 }, /* P p */ | |
| 230 | { 0x51,0x11,0x71,0x11 }, /* Q q */ | |
| 231 | { 0x52,0x12,0x72,0x12 }, /* R r */ | |
| 232 | { 0x53,0x13,0x73,0x13 }, /* S s */ | |
| 233 | { 0x54,0x14,0x74,0x14 }, /* T t */ | |
| 234 | { 0x55,0x15,0x75,0x15 }, /* U u */ | |
| 235 | { 0x56,0x16,0x76,0x16 }, /* V v */ | |
| 236 | { 0x57,0x17,0x77,0x17 }, /* W w */ | |
| 237 | { 0x58,0x18,0x78,0x18 }, /* X x */ | |
| 238 | { 0x59,0x19,0x79,0x19 }, /* Y y */ | |
| 239 | { 0x5a,0x1a,0x7a,0x1a }, /* Z z */ | |
| 240 | { 0x30,0x30,0x30,0x30 }, /* 0 (KP) */ | |
| 241 | { 0x31,0x31,0x31,0x31 }, /* 1 (KP) */ | |
| 242 | { 0x32,0x32,0x32,0x32 }, /* 2 (KP) */ | |
| 243 | { 0x33,0x33,0x33,0x33 }, /* 3 (KP) */ | |
| 244 | { 0x34,0x34,0x34,0x34 }, /* 4 (KP) */ | |
| 245 | { 0x35,0x35,0x35,0x35 }, /* 5 (KP) */ | |
| 246 | { 0x36,0x36,0x36,0x36 }, /* 6 (KP) */ | |
| 247 | { 0x37,0x37,0x37,0x37 }, /* 7 (KP) */ | |
| 248 | { 0x38,0x38,0x38,0x38 }, /* 8 (KP) */ | |
| 249 | { 0x39,0x39,0x39,0x39 }, /* 9 (KP) */ | |
| 250 | { 0x2f,0x2f,0x2f,0x2f }, /* / (KP) */ | |
| 251 | { 0x2a,0x2a,0x2a,0x2a }, /* * (KP) */ | |
| 252 | { 0x2d,0x2d,0x2d,0x2d }, /* - (KP) */ | |
| 253 | { 0x2b,0x2b,0x2b,0x2b }, /* + (KP) */ | |
| 254 | { 0x2e,0x2e,0x2e,0x2e }, /* . (KP) */ | |
| 255 | { 0x0d,0x0d,0x0d,0x0d } /* Enter (KP) */ | |
| 194 | { 0x2c,0x2c,0x3c,0x3c }, /* , < */ | |
| 195 | { 0x2d,0x2d,0x5f,0x1f }, /* - _ */ | |
| 196 | { 0x2e,0x2e,0x3e,0x3e }, /* . > */ | |
| 197 | { 0x2f,0x2f,0x3f,0x3f }, /* / ? */ | |
| 198 | { 0x30,0x30,0x29,0x29 }, /* 0 ) */ | |
| 199 | { 0x31,0x31,0x21,0x21 }, /* 1 ! */ | |
| 200 | { 0x32,0x00,0x40,0x00 }, /* 2 @ */ | |
| 201 | { 0x33,0x33,0x23,0x23 }, /* 3 # */ | |
| 202 | { 0x34,0x34,0x24,0x24 }, /* 4 $ */ | |
| 203 | { 0x35,0x35,0x25,0x25 }, /* 5 % */ | |
| 204 | { 0x36,0x1e,0x5e,0x1e }, /* 6 ^ */ | |
| 205 | { 0x37,0x37,0x26,0x26 }, /* 7 & */ | |
| 206 | { 0x38,0x38,0x2a,0x2a }, /* 8 * */ | |
| 207 | { 0x39,0x39,0x28,0x28 }, /* 9 ( */ | |
| 208 | { 0x3b,0x3b,0x3a,0x3a }, /* ; : */ | |
| 209 | { 0x3d,0x3d,0x2b,0x2b }, /* = + */ | |
| 210 | { 0x5b,0x1b,0x7b,0x1b }, /* [ { */ | |
| 211 | { 0x5c,0x1c,0x7c,0x1c }, /* \ | */ | |
| 212 | { 0x5d,0x1d,0x7d,0x1d }, /* ] } */ | |
| 213 | { 0x60,0x60,0x7e,0x7e }, /* ` ~ */ | |
| 214 | { 0x41,0x01,0x61,0x01 }, /* A a */ | |
| 215 | { 0x42,0x02,0x62,0x02 }, /* B b */ | |
| 216 | { 0x43,0x03,0x63,0x03 }, /* C c */ | |
| 217 | { 0x44,0x04,0x64,0x04 }, /* D d */ | |
| 218 | { 0x45,0x05,0x65,0x05 }, /* E e */ | |
| 219 | { 0x46,0x06,0x66,0x06 }, /* F f */ | |
| 220 | { 0x47,0x07,0x67,0x07 }, /* G g */ | |
| 221 | { 0x48,0x08,0x68,0x08 }, /* H h */ | |
| 222 | { 0x49,0x09,0x69,0x09 }, /* I i */ | |
| 223 | { 0x4a,0x0a,0x6a,0x0a }, /* J j */ | |
| 224 | { 0x4b,0x0b,0x6b,0x0b }, /* K k */ | |
| 225 | { 0x4c,0x0c,0x6c,0x0c }, /* L l */ | |
| 226 | { 0x4d,0x0d,0x6d,0x0d }, /* M m */ | |
| 227 | { 0x4e,0x0e,0x6e,0x0e }, /* N n */ | |
| 228 | { 0x4f,0x0f,0x6f,0x0f }, /* O o */ | |
| 229 | { 0x50,0x10,0x70,0x10 }, /* P p */ | |
| 230 | { 0x51,0x11,0x71,0x11 }, /* Q q */ | |
| 231 | { 0x52,0x12,0x72,0x12 }, /* R r */ | |
| 232 | { 0x53,0x13,0x73,0x13 }, /* S s */ | |
| 233 | { 0x54,0x14,0x74,0x14 }, /* T t */ | |
| 234 | { 0x55,0x15,0x75,0x15 }, /* U u */ | |
| 235 | { 0x56,0x16,0x76,0x16 }, /* V v */ | |
| 236 | { 0x57,0x17,0x77,0x17 }, /* W w */ | |
| 237 | { 0x58,0x18,0x78,0x18 }, /* X x */ | |
| 238 | { 0x59,0x19,0x79,0x19 }, /* Y y */ | |
| 239 | { 0x5a,0x1a,0x7a,0x1a }, /* Z z */ | |
| 240 | { 0x30,0x30,0x30,0x30 }, /* 0 (KP) */ | |
| 241 | { 0x31,0x31,0x31,0x31 }, /* 1 (KP) */ | |
| 242 | { 0x32,0x32,0x32,0x32 }, /* 2 (KP) */ | |
| 243 | { 0x33,0x33,0x33,0x33 }, /* 3 (KP) */ | |
| 244 | { 0x34,0x34,0x34,0x34 }, /* 4 (KP) */ | |
| 245 | { 0x35,0x35,0x35,0x35 }, /* 5 (KP) */ | |
| 246 | { 0x36,0x36,0x36,0x36 }, /* 6 (KP) */ | |
| 247 | { 0x37,0x37,0x37,0x37 }, /* 7 (KP) */ | |
| 248 | { 0x38,0x38,0x38,0x38 }, /* 8 (KP) */ | |
| 249 | { 0x39,0x39,0x39,0x39 }, /* 9 (KP) */ | |
| 250 | { 0x2f,0x2f,0x2f,0x2f }, /* / (KP) */ | |
| 251 | { 0x2a,0x2a,0x2a,0x2a }, /* * (KP) */ | |
| 252 | { 0x2d,0x2d,0x2d,0x2d }, /* - (KP) */ | |
| 253 | { 0x2b,0x2b,0x2b,0x2b }, /* + (KP) */ | |
| 254 | { 0x2e,0x2e,0x2e,0x2e }, /* . (KP) */ | |
| 255 | { 0x0d,0x0d,0x0d,0x0d } /* Enter (KP) */ | |
| 256 | 256 | } |
| 257 | 257 | }; |
| 258 | 258 | |
| r5932 | r5933 | |
| 325 | 325 | ay3600_keys = auto_alloc_array_clear(machine, unsigned int, AY3600_KEYS_LENGTH); |
| 326 | 326 | |
| 327 | 327 | /* We poll the keyboard periodically to scan the keys. This is |
| 328 | ||
| 328 | actually consistent with how the AY-3600 keyboard controller works. */ | |
| 329 | 329 | timer_pulse(machine, ATTOTIME_IN_HZ(60), NULL, 0, AY3600_poll); |
| 330 | 330 | |
| 331 | 331 | /* Set Caps Lock light to ON, since that's how we default it. */ |
| r5932 | r5933 | |
| 366 | 366 | |
| 367 | 367 | static unsigned int time_until_repeat = MAGIC_KEY_REPEAT_NUMBER; |
| 368 | 368 | |
| 369 | static const char *const portnames[] = { "keyb_0", "keyb_1", "keyb_2", "keyb_3", "keyb_4", "keyb_5", "keyb_6", | |
| 369 | static const char *const portnames[] = { "keyb_0", "keyb_1", "keyb_2", "keyb_3", "keyb_4", "keyb_5", "keyb_6", | |
| 370 | 370 | "keypad_1", "keypad_2" }; |
| 371 | 371 | |
| 372 | 372 | /* check for these special cases because they affect the emulated key codes */ |
| r5932 | r5933 | |
| 435 | 435 | |
| 436 | 436 | /* reset key check */ |
| 437 | 437 | if (apple2_pressed_specialkey(machine, SPECIALKEY_RESET) && |
| 438 | (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL)) | |
| 438 | (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL)) | |
| 439 | 439 | { |
| 440 | if (!reset_flag) | |
| 440 | if (!reset_flag) | |
| 441 | 441 | { |
| 442 | 442 | reset_flag = 1; |
| 443 | 443 | /* using PULSE_LINE does not allow us to press and hold key */ |
| r5932 | r5933 | |
| 463 | 463 | |
| 464 | 464 | for (bit = 0; bit < 8; bit++) |
| 465 | 465 | { |
| 466 | if (a2_has_capslock(machine)) | |
| 466 | if (a2_has_capslock(machine)) | |
| 467 | 467 | { |
| 468 | 468 | curkey = ay3600_key_remap_2e[caps_lock][port*8+bit][switchkey]; |
| 469 | 469 | curkey_unmodified = ay3600_key_remap_2e[caps_lock][port*8+bit][0]; |
| 470 | } | |
| 471 | else | |
| 470 | } | |
| 471 | else | |
| 472 | 472 | { |
| 473 | 473 | curkey = ay3600_key_remap_2[port*8+bit][switchkey]; |
| 474 | 474 | curkey_unmodified = ay3600_key_remap_2[port*8+bit][0]; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ap2_lang.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of the Apple II Language Card | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 83 | 83 | |
| 84 | 84 | /*------------------------------------------------- |
| 85 | 85 | DEVICE_START(apple2_langcard) - device start |
| 86 | ||
| 86 | function | |
| 87 | 87 | -------------------------------------------------*/ |
| 88 | 88 | |
| 89 | 89 | static DEVICE_START(apple2_langcard) |
| r5932 | r5933 | |
| 95 | 95 | |
| 96 | 96 | /*------------------------------------------------- |
| 97 | 97 | DEVICE_GET_INFO(apple2_langcard) - device get info |
| 98 | ||
| 98 | function | |
| 99 | 99 | -------------------------------------------------*/ |
| 100 | 100 | |
| 101 | 101 | DEVICE_GET_INFO(apple2_langcard) |
| r5932 | r5933 | |
|---|---|---|
| 42 | 42 | |
| 43 | 43 | READ8_HANDLER ( p2000t_port_000f_r ) |
| 44 | 44 | { |
| 45 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", | |
| 45 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", | |
| 46 | 46 | "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" }; |
| 47 | 47 | |
| 48 | 48 | if (p2000t_ports.port_101f & P2000M_101F_KEYINT) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | TMS9901 Programmable System Interface | |
| 3 | 3 | |
| 4 | ||
| 4 | Raphael Nabet, 2000-2004 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include <math.h> |
| r5932 | r5933 | |
| 10 | 10 | #include "tms9901.h" |
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | ||
| 13 | TMS9901 emulation. | |
| 14 | 14 | |
| 15 | 15 | Overview: |
| 16 | TMS9901 is a support chip for TMS9900. It handles interrupts, provides | |
| 17 | several I/O pins, and a timer (a.k.a. clock: it is merely a register which | |
| 18 | decrements regularly and can generate an interrupt when it reaches 0). | |
| 16 | TMS9901 is a support chip for TMS9900. It handles interrupts, provides | |
| 17 | several I/O pins, and a timer (a.k.a. clock: it is merely a register which | |
| 18 | decrements regularly and can generate an interrupt when it reaches 0). | |
| 19 | 19 | |
| 20 | It communicates with the TMS9900 with the CRU bus, and with the rest of the | |
| 21 | world with a number of parallel I/O pins. | |
| 20 | It communicates with the TMS9900 with the CRU bus, and with the rest of the | |
| 21 | world with a number of parallel I/O pins. | |
| 22 | 22 | |
| 23 | I/O and timer functions should work with any other 990/99xx/99xxx CPU. | |
| 24 | On the other hand, interrupt handling was primarily designed for tms9900 | |
| 25 | and 99000 based systems: other CPUs can support interrupts, but not the 16 | |
| 26 | distinct interrupt vectors. | |
| 23 | I/O and timer functions should work with any other 990/99xx/99xxx CPU. | |
| 24 | On the other hand, interrupt handling was primarily designed for tms9900 | |
| 25 | and 99000 based systems: other CPUs can support interrupts, but not the 16 | |
| 26 | distinct interrupt vectors. | |
| 27 | 27 | |
| 28 | 28 | Pins: |
| 29 | Vcc, Vss: power supply | |
| 30 | Phi*: system clock (connected to TMS9900 Phi3* or TMS9980 CLKOUT*) | |
| 31 | RST1*: reset input | |
| 32 | CRUIN, CRUOUT, CRUCLK, CE*, S0-S4: CRU bus (CPU interface) | |
| 33 | INTREQ*, IC0-IC3: interrupt bus (CPU interface) | |
| 34 | INT*1-INT*6: used as interrupt/input pins. | |
| 35 | P0-P6: used as input/output pins. | |
| 36 | INT*7/P15-INT*15/P7: used as either interrupt/input or input/output pins. | |
| 37 | Note that a pin cannot be used simultaneously as output and as interrupt. | |
| 38 | (This is mostly obvious, but it implies that you cannot trigger an | |
| 39 | interrupt by setting the output state of a pin, which is not SO obvious.) | |
| 29 | Vcc, Vss: power supply | |
| 30 | Phi*: system clock (connected to TMS9900 Phi3* or TMS9980 CLKOUT*) | |
| 31 | RST1*: reset input | |
| 32 | CRUIN, CRUOUT, CRUCLK, CE*, S0-S4: CRU bus (CPU interface) | |
| 33 | INTREQ*, IC0-IC3: interrupt bus (CPU interface) | |
| 34 | INT*1-INT*6: used as interrupt/input pins. | |
| 35 | P0-P6: used as input/output pins. | |
| 36 | INT*7/P15-INT*15/P7: used as either interrupt/input or input/output pins. | |
| 37 | Note that a pin cannot be used simultaneously as output and as interrupt. | |
| 38 | (This is mostly obvious, but it implies that you cannot trigger an | |
| 39 | interrupt by setting the output state of a pin, which is not SO obvious.) | |
| 40 | 40 | |
| 41 | 41 | Interrupt handling: |
| 42 | After each clock cycle, TMS9901 latches the state of INT1*-INT15* (except | |
| 43 | pins which are set as output pins). If the clock is enabled, it replaces | |
| 44 | INT3* with an internal timer interrupt flag. Then it inverts the value and | |
| 45 | performs a bit-wise AND with the interrupt mask. | |
| 42 | After each clock cycle, TMS9901 latches the state of INT1*-INT15* (except | |
| 43 | pins which are set as output pins). If the clock is enabled, it replaces | |
| 44 | INT3* with an internal timer interrupt flag. Then it inverts the value and | |
| 45 | performs a bit-wise AND with the interrupt mask. | |
| 46 | 46 | |
| 47 | If there are some unmasked interrupt bits, INTREQ* is asserted and the code | |
| 48 | of the lowest active interrupt is placed on IC0-IC3. If these pins are | |
| 49 | duly connected to the tms9900 INTREQ* and IC0-IC3 pins, the result is that | |
| 50 | asserting an INTn* on tms9901 will cause a level-n interrupt request on the | |
| 51 | tms9900, provided that this interrupt pin is not masked in tms9901, and | |
| 52 | that no unmasked higher-priority (i.e. lower-level) interrupt pin is set. | |
| 47 | If there are some unmasked interrupt bits, INTREQ* is asserted and the code | |
| 48 | of the lowest active interrupt is placed on IC0-IC3. If these pins are | |
| 49 | duly connected to the tms9900 INTREQ* and IC0-IC3 pins, the result is that | |
| 50 | asserting an INTn* on tms9901 will cause a level-n interrupt request on the | |
| 51 | tms9900, provided that this interrupt pin is not masked in tms9901, and | |
| 52 | that no unmasked higher-priority (i.e. lower-level) interrupt pin is set. | |
| 53 | 53 | |
| 54 | This interrupt request lasts for as long as the interrupt pin and the | |
| 55 | relevant bit in the interrupt mask are set (level-triggered interrupts). | |
| 56 | (The request may be shadowed by a higher-priority interrupt request, but | |
| 57 | it will resume when the higher-priority request ends.) | |
| 54 | This interrupt request lasts for as long as the interrupt pin and the | |
| 55 | relevant bit in the interrupt mask are set (level-triggered interrupts). | |
| 56 | (The request may be shadowed by a higher-priority interrupt request, but | |
| 57 | it will resume when the higher-priority request ends.) | |
| 58 | 58 | |
| 59 | TIMER interrupts are kind of an exception, since they are not associated | |
| 60 | with an external interrupt pin. I think there is an internal timer | |
| 61 | interrupt flag that is set when the decrementer reaches 0, and is cleared | |
| 62 | by a write to the 9901 int*3 enable bit ("SBO 3" in interrupt mode). | |
| 59 | TIMER interrupts are kind of an exception, since they are not associated | |
| 60 | with an external interrupt pin. I think there is an internal timer | |
| 61 | interrupt flag that is set when the decrementer reaches 0, and is cleared | |
| 62 | by a write to the 9901 int*3 enable bit ("SBO 3" in interrupt mode). | |
| 63 | 63 | |
| 64 | 64 | TODO: |
| 65 | * Emulate the RST1* input. Note that RST1* active (low) makes INTREQ* | |
| 66 | inactive (high) with IC0-IC3 = 0. | |
| 67 | * the clock read register is updated every time the timer decrements when | |
| 68 | the TMS9901 is not in clock mode. This probably implies that if the | |
| 69 | clock mode is cleared and re-asserted immediately, the tms9901 may fail | |
| 70 | to update the clock read register: this is not emulated. | |
| 71 | * The clock mode is entered when a 1 is written to the control bit. It is | |
| 72 | exited when a 0 is written to the control bit or the a tms9901 select bit | |
| 73 | greater than 15 is accessed. According to the data sheet, "when CE* is | |
| 74 | inactive (HIGH), the PSI is not disabled from seeing the select lines. | |
| 75 | As the CPU is accessing memory, A10-A14 could very easily have a value of | |
| 76 | 15 or greater" (this is assuming that S0-S4 are connected to A10-A14, | |
| 77 | which makes sense with most tms9900 family members). There is no way | |
| 78 | this "feature" (I would call it a hardware bug) can be emulated | |
| 79 | efficiently, as we would need to watch every memory access. | |
| 65 | * Emulate the RST1* input. Note that RST1* active (low) makes INTREQ* | |
| 66 | inactive (high) with IC0-IC3 = 0. | |
| 67 | * the clock read register is updated every time the timer decrements when | |
| 68 | the TMS9901 is not in clock mode. This probably implies that if the | |
| 69 | clock mode is cleared and re-asserted immediately, the tms9901 may fail | |
| 70 | to update the clock read register: this is not emulated. | |
| 71 | * The clock mode is entered when a 1 is written to the control bit. It is | |
| 72 | exited when a 0 is written to the control bit or the a tms9901 select bit | |
| 73 | greater than 15 is accessed. According to the data sheet, "when CE* is | |
| 74 | inactive (HIGH), the PSI is not disabled from seeing the select lines. | |
| 75 | As the CPU is accessing memory, A10-A14 could very easily have a value of | |
| 76 | 15 or greater" (this is assuming that S0-S4 are connected to A10-A14, | |
| 77 | which makes sense with most tms9900 family members). There is no way | |
| 78 | this "feature" (I would call it a hardware bug) can be emulated | |
| 79 | efficiently, as we would need to watch every memory access. | |
| 80 | 80 | */ |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | /* |
| 84 | ||
| 84 | tms9901 state structure | |
| 85 | 85 | */ |
| 86 | 86 | |
| 87 | 87 | |
| r5932 | r5933 | |
| 94 | 94 | { |
| 95 | 95 | /* interrupt registers */ |
| 96 | 96 | int supported_int_mask; /* mask: bit #n is set if pin #n is supported as an interrupt pin, |
| 97 | ||
| 97 | i.e. the driver sends a notification whenever the pin state changes */ | |
| 98 | 98 | /* setting these bits is not required, but it saves you the trouble of |
| 99 | saving the state of interrupt pins and feeding it to the port read | |
| 100 | handlers again */ | |
| 99 | saving the state of interrupt pins and feeding it to the port read | |
| 100 | handlers again */ | |
| 101 | 101 | int int_state; /* state of the int1-int15 lines */ |
| 102 | 102 | int timer_int_pending; /* timer int pending (overrides int3 pin if timer enabled) */ |
| 103 | 103 | int enabled_ints; /* interrupt enable mask */ |
| r5932 | r5933 | |
| 114 | 114 | void *timer; /* MESS timer, used to emulate the decrementer register */ |
| 115 | 115 | |
| 116 | 116 | int clockinvl; /* clock interval, loaded in decrementer when it reaches 0. |
| 117 | ||
| 117 | 0 means decrementer off */ | |
| 118 | 118 | int latchedtimer; /* when we go into timer mode, the decrementer is copied there to allow to read it reliably */ |
| 119 | 119 | |
| 120 | 120 | int mode9901; /* TMS9901 current mode |
| 121 | 0 = so-called interrupt mode (read interrupt | |
| 122 | state, write interrupt enable mask) | |
| 123 | 1 = clock mode (read/write clock interval) */ | |
| 121 | 0 = so-called interrupt mode (read interrupt | |
| 122 | state, write interrupt enable mask) | |
| 123 | 1 = clock mode (read/write clock interval) */ | |
| 124 | 124 | |
| 125 | 125 | /* tms9901 clock rate (PHI* pin, normally connected to TMS9900 Phi3*) */ |
| 126 | 126 | /* decrementer rate equates PHI* rate/64 (e.g. 46875Hz for a 3MHz clock) |
| 127 | ||
| 127 | (warning: 3MHz on a tms9900 is equivalent to 12MHz on a tms9995 or tms99000) */ | |
| 128 | 128 | double clock_rate; |
| 129 | 129 | |
| 130 | 130 | /* Pointer to interface */ |
| r5932 | r5933 | |
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | /* |
| 148 | ||
| 148 | utilities | |
| 149 | 149 | */ |
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | /* |
| 153 | return the number of the first (i.e. least significant) non-zero bit among | |
| 154 | the 16 first bits | |
| 153 | return the number of the first (i.e. least significant) non-zero bit among | |
| 154 | the 16 first bits | |
| 155 | 155 | */ |
| 156 | 156 | static int find_first_bit(int value) |
| 157 | 157 | { |
| r5932 | r5933 | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /* |
| 193 | ||
| 193 | should be called after any change to int_state or enabled_ints. | |
| 194 | 194 | */ |
| 195 | 195 | static void tms9901_field_interrupts(const device_config *device) |
| 196 | 196 | { |
| r5932 | r5933 | |
| 214 | 214 | if (current_ints) |
| 215 | 215 | { |
| 216 | 216 | /* find which interrupt tripped us: |
| 217 | ||
| 217 | we simply look for the first bit set to 1 in current_ints... */ | |
| 218 | 218 | int level = find_first_bit(current_ints); |
| 219 | 219 | |
| 220 | 220 | tms->int_pending = TRUE; |
| r5932 | r5933 | |
| 233 | 233 | |
| 234 | 234 | |
| 235 | 235 | /* |
| 236 | function which should be called by the driver when the state of an INTn* | |
| 237 | pin changes (only required if the pin is set up as an interrupt pin) | |
| 236 | function which should be called by the driver when the state of an INTn* | |
| 237 | pin changes (only required if the pin is set up as an interrupt pin) | |
| 238 | 238 | |
| 239 | state == 0: INTn* is inactive (high) | |
| 240 | state != 0: INTn* is active (low) | |
| 239 | state == 0: INTn* is inactive (high) | |
| 240 | state != 0: INTn* is active (low) | |
| 241 | 241 | |
| 242 | ||
| 242 | 0<=pin_number<=15 | |
| 243 | 243 | */ |
| 244 | 244 | void tms9901_set_single_int(const device_config *device, int pin_number, int state) |
| 245 | 245 | { |
| r5932 | r5933 | |
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | /* |
| 259 | This call-back is called by the MESS timer system when the decrementer | |
| 260 | reaches 0. | |
| 259 | This call-back is called by the MESS timer system when the decrementer | |
| 260 | reaches 0. | |
| 261 | 261 | */ |
| 262 | 262 | static TIMER_CALLBACK(decrementer_callback) |
| 263 | 263 | { |
| r5932 | r5933 | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /* |
| 273 | ||
| 273 | load the content of clockinvl into the decrementer | |
| 274 | 274 | */ |
| 275 | 275 | static void tms9901_timer_reload(const device_config *device) |
| 276 | 276 | { |
| r5932 | r5933 | |
| 288 | 288 | |
| 289 | 289 | |
| 290 | 290 | /*---------------------------------------------------------------- |
| 291 | ||
| 291 | TMS9901 CRU interface. | |
| 292 | 292 | ----------------------------------------------------------------*/ |
| 293 | 293 | |
| 294 | 294 | /* |
| 295 | ||
| 295 | Read a 8 bit chunk from tms9901. | |
| 296 | 296 | |
| 297 | signification: | |
| 298 | bit 0: mode9901 | |
| 299 | if (mode9901 == 0) | |
| 300 | bit 1-15: current status of the INT1*-INT15* pins | |
| 301 | else | |
| 302 | bit 1-14: current timer value | |
| 303 | bit 15: value of the INTREQ* (interrupt request to TMS9900) pin. | |
| 297 | signification: | |
| 298 | bit 0: mode9901 | |
| 299 | if (mode9901 == 0) | |
| 300 | bit 1-15: current status of the INT1*-INT15* pins | |
| 301 | else | |
| 302 | bit 1-14: current timer value | |
| 303 | bit 15: value of the INTREQ* (interrupt request to TMS9900) pin. | |
| 304 | 304 | |
| 305 | ||
| 305 | bit 16-31: current status of the P0-P15 pins (quits timer mode, too...) | |
| 306 | 306 | */ |
| 307 | 307 | READ8_DEVICE_HANDLER ( tms9901_cru_r ) |
| 308 | 308 | { |
| r5932 | r5933 | |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | /* |
| 376 | ||
| 376 | Write 1 bit to tms9901. | |
| 377 | 377 | |
| 378 | signification: | |
| 379 | bit 0: write mode9901 | |
| 380 | if (mode9901 == 0) | |
| 381 | bit 1-15: write interrupt mask register | |
| 382 | else | |
| 383 | bit 1-14: write timer period | |
| 384 | bit 15: if written value == 0, soft reset (just resets all I/O pins as input) | |
| 378 | signification: | |
| 379 | bit 0: write mode9901 | |
| 380 | if (mode9901 == 0) | |
| 381 | bit 1-15: write interrupt mask register | |
| 382 | else | |
| 383 | bit 1-14: write timer period | |
| 384 | bit 15: if written value == 0, soft reset (just resets all I/O pins as input) | |
| 385 | 385 | |
| 386 | ||
| 386 | bit 16-31: set output state of P0-P15 (and set them as output pin) (quit timer mode, too...) | |
| 387 | 387 | */ |
| 388 | 388 | WRITE8_DEVICE_HANDLER ( tms9901_cru_w ) |
| 389 | 389 | { |
| r5932 | r5933 | |
| 402 | 402 | if (tms->mode9901) |
| 403 | 403 | { |
| 404 | 404 | /* we are switching to clock mode: latch the current value of |
| 405 | ||
| 405 | the decrementer register */ | |
| 406 | 406 | if (tms->clockinvl) |
| 407 | 407 | tms->latchedtimer = ceil(attotime_to_double(timer_timeleft(tms->timer)) * (tms->clock_rate / 64.)); |
| 408 | 408 | else |
| r5932 | r5933 | |
| 429 | 429 | case 0x0D: |
| 430 | 430 | case 0x0E: |
| 431 | 431 | /* |
| 432 | ||
| 432 | write one bit to 9901 (bits 1-14) | |
| 433 | 433 | |
| 434 | mode9901==0 ? Disable/Enable an interrupt | |
| 435 | : Bit in clock interval | |
| 436 | */ | |
| 434 | mode9901==0 ? Disable/Enable an interrupt | |
| 435 | : Bit in clock interval | |
| 436 | */ | |
| 437 | 437 | /* offset is the index of the modified bit of register (-> interrupt number -1) */ |
| 438 | 438 | if (tms->mode9901) |
| 439 | 439 | { /* modify clock interval */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | ay3600.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Include file for AY3600 keyboard; used by Apple IIs | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ap2_lang.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of the Apple II Language Card | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 28 | 28 | ***************************************************************************/ |
| 29 | 29 | |
| 30 | 30 | /* device get info function */ |
| 31 | DEVICE_GET_INFO(apple2_langcard); | |
| 31 | DEVICE_GET_INFO(apple2_langcard); | |
| 32 | 32 | |
| 33 | 33 | /* slot read function */ |
| 34 | 34 | READ8_DEVICE_HANDLER(apple2_langcard_r); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | tms9901.h: header file for tms9901.c | |
| 3 | 3 | |
| 4 | ||
| 4 | Raphael Nabet | |
| 5 | 5 | */ |
| 6 | 6 | #ifndef __TMS9901_H__ |
| 7 | 7 | #define __TMS9901_H__ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | machine/oric.c | |
| 4 | 4 | |
| 5 | Paul Cook | |
| 6 | Kev Thacker | |
| 5 | Paul Cook | |
| 6 | Kev Thacker | |
| 7 | 7 | |
| 8 | Thankyou to Fabrice Frances for his ORIC documentation which helped with this driver | |
| 9 | http://oric.ifrance.com/oric/ | |
| 8 | Thankyou to Fabrice Frances for his ORIC documentation which helped with this driver | |
| 9 | http://oric.ifrance.com/oric/ | |
| 10 | 10 | |
| 11 | TODO: | |
| 12 | - there are problems loading some .wav's. Try to fix these. | |
| 13 | - fix more graphics display problems | |
| 14 | - check the printer works | |
| 15 | - fix more disc drive/wd179x problems so more software will run | |
| 11 | TODO: | |
| 12 | - there are problems loading some .wav's. Try to fix these. | |
| 13 | - fix more graphics display problems | |
| 14 | - check the printer works | |
| 15 | - fix more disc drive/wd179x problems so more software will run | |
| 16 | 16 | |
| 17 | 17 | *********************************************************************/ |
| 18 | 18 | |
| r5932 | r5933 | |
| 107 | 107 | static void oric_keyboard_sense_refresh(running_machine *machine) |
| 108 | 108 | { |
| 109 | 109 | /* The following assumes that if a 0 is written, it can be used to detect if any key |
| 110 | ||
| 110 | has been pressed.. */ | |
| 111 | 111 | /* for each bit that is 0, it combines it's pressed state with the pressed state so far */ |
| 112 | 112 | |
| 113 | 113 | int i; |
| r5932 | r5933 | |
| 289 | 289 | data |= 1; |
| 290 | 290 | |
| 291 | 291 | /* "A simple cable to catch the vertical retrace signal ! |
| 292 | This cable connects the video output for the television/monitor | |
| 293 | to the via cb1 input. Interrupts can be generated from the vertical | |
| 294 | sync, and flicker free games can be produced */ | |
| 292 | This cable connects the video output for the television/monitor | |
| 293 | to the via cb1 input. Interrupts can be generated from the vertical | |
| 294 | sync, and flicker free games can be produced */ | |
| 295 | 295 | |
| 296 | 296 | input_port_9 = input_port_read(machine, "FLOPPY"); |
| 297 | 297 | /* cable is enabled? */ |
| r5932 | r5933 | |
| 514 | 514 | { |
| 515 | 515 | /* data is ignored, address is used to decode operation */ |
| 516 | 516 | |
| 517 | /* | |
| 517 | /* logerror("apple 2 interface v2 rom page: %01x\n",(offset & 0x02)>>1); */ | |
| 518 | 518 | |
| 519 | 519 | /* bit 0 is 0 for page 0, 1 for page 1 */ |
| 520 | 520 | memory_set_bankptr(space->machine, 4, memory_region(space->machine, "maincpu") + 0x014000 + 0x0100 + (((offset & 0x02)>>1)<<8)); |
| r5932 | r5933 | |
| 583 | 583 | static void oric_jasmin_set_mem_0x0c000(running_machine *machine) |
| 584 | 584 | { |
| 585 | 585 | /* assumption: |
| 586 | 1. It is possible to access all 16k overlay ram. | |
| 587 | 2. If os is enabled, and overlay ram is enabled, all 16k can be accessed. | |
| 588 | 3. if os is disabled, and overlay ram is enabled, jasmin rom takes priority. | |
| 589 | */ | |
| 586 | 1. It is possible to access all 16k overlay ram. | |
| 587 | 2. If os is enabled, and overlay ram is enabled, all 16k can be accessed. | |
| 588 | 3. if os is disabled, and overlay ram is enabled, jasmin rom takes priority. | |
| 589 | */ | |
| 590 | 590 | |
| 591 | 591 | /* the ram is disabled in the jasmin rom which indicates that jasmin takes |
| 592 | ||
| 592 | priority over the ram */ | |
| 593 | 593 | |
| 594 | 594 | /* basic rom disabled? */ |
| 595 | 595 | if ((port_3fb_w & 0x01)==0) |
| r5932 | r5933 | |
| 946 | 946 | break; |
| 947 | 947 | case 0x04: |
| 948 | 948 | data = port_314_r | 0x07f; |
| 949 | /* | |
| 949 | /* logerror("port_314_r: %02x\n",data); */ | |
| 950 | 950 | break; |
| 951 | 951 | case 0x08: |
| 952 | 952 | data = port_318_r | 0x07f; |
| 953 | /* | |
| 953 | /* logerror("port_318_r: %02x\n",data); */ | |
| 954 | 954 | break; |
| 955 | 955 | |
| 956 | 956 | default: |
| r5932 | r5933 | |
|---|---|---|
| 23 | 23 | fec08 // test of special europc registers 800a rtc time or date error, rtc corrected |
| 24 | 24 | fef66 0xf |
| 25 | 25 | fdb3e 0x8..0xc |
| 26 | ||
| 26 | fd7f8 | |
| 27 | 27 | fdb5f |
| 28 | 28 | fe172 |
| 29 | 29 | fecc5 // 801a video setup error |
| r5932 | r5933 | |
| 34 | 34 | (801a) |
| 35 | 35 | 0x8000 output |
| 36 | 36 | 1 rtc error |
| 37 | 2 rtc time or date error | |
| 38 | 4 checksum error in setup | |
| 39 | 8 rtc status corrected | |
| 40 | 10 video setup error | |
| 41 | 20 video ram bad | |
| 42 | 40 monitor type not recogniced | |
| 43 | 80 mouse port enabled | |
| 44 | 100 joystick port enabled | |
| 37 | 2 rtc time or date error | |
| 38 | 4 checksum error in setup | |
| 39 | 8 rtc status corrected | |
| 40 | 10 video setup error | |
| 41 | 20 video ram bad | |
| 42 | 40 monitor type not recogniced | |
| 43 | 80 mouse port enabled | |
| 44 | 100 joystick port enabled | |
| 45 | 45 | |
| 46 | 46 | fe1e2 fdc0c cpu speed is 4.77 MHz |
| 47 | 47 | fe1e5 ff9c0 keyboard processor error |
| r5932 | r5933 | |
| 90 | 90 | 63 bit 6,7 clock select |
| 91 | 91 | 254 bit 6,7 clock select |
| 92 | 92 | 250 bit 0: mouse on |
| 93 | ||
| 93 | bit 1: joystick on | |
| 94 | 94 | 254..257 r/w memory ? JIM asic? ram behaviour |
| 95 | 95 | |
| 96 | 96 | */ |
| 97 | 97 | WRITE8_HANDLER ( europc_jim_w ) |
| 98 | 98 | { |
| 99 | switch (offset) | |
| 99 | switch (offset) | |
| 100 | 100 | { |
| 101 | 101 | case 2: |
| 102 | if (!(data & 0x80)) | |
| 102 | if (!(data & 0x80)) | |
| 103 | 103 | { |
| 104 | switch (data) | |
| 104 | switch (data) | |
| 105 | 105 | { |
| 106 | 106 | case 0x1f: |
| 107 | 107 | case 0x0b: europc_jim.mode = AGA_MONO; break; |
| r5932 | r5933 | |
| 112 | 112 | default: europc_jim.mode = AGA_OFF; break; |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | // mode= data&0x10?AGA_COLOR:AGA_MONO; | |
| 116 | // mode= data&0x10?AGA_COLOR:AGA_OFF; | |
| 115 | // mode= data&0x10?AGA_COLOR:AGA_MONO; | |
| 116 | // mode= data&0x10?AGA_COLOR:AGA_OFF; | |
| 117 | 117 | pc_aga_set_mode(space->machine, europc_jim.mode); |
| 118 | 118 | if (data & 0x80) europc_jim.state = 0; |
| 119 | 119 | break; |
| 120 | 120 | case 4: |
| 121 | switch(data & 0xc0) | |
| 121 | switch(data & 0xc0) | |
| 122 | 122 | { |
| 123 | 123 | case 0x00: cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 1.0 / 2); break; |
| 124 | 124 | case 0x40: cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 3.0 / 4); break; |
| r5932 | r5933 | |
| 136 | 136 | READ8_HANDLER ( europc_jim_r ) |
| 137 | 137 | { |
| 138 | 138 | int data = 0; |
| 139 | switch(offset) | |
| 139 | switch(offset) | |
| 140 | 140 | { |
| 141 | 141 | case 4: case 5: case 6: case 7: data = europc_jim.data[offset]; break; |
| 142 | 142 | case 0: case 1: case 2: case 3: data = 0; break; |
| r5932 | r5933 | |
| 147 | 147 | |
| 148 | 148 | READ8_HANDLER ( europc_jim2_r ) |
| 149 | 149 | { |
| 150 | switch (europc_jim.state) | |
| 150 | switch (europc_jim.state) | |
| 151 | 151 | { |
| 152 | 152 | case 0: europc_jim.state++; return 0; |
| 153 | 153 | case 1: europc_jim.state++; return 0x80; |
| 154 | 154 | case 2: |
| 155 | 155 | europc_jim.state = 0; |
| 156 | switch (europc_jim.mode) | |
| 156 | switch (europc_jim.mode) | |
| 157 | 157 | { |
| 158 | 158 | case AGA_COLOR: return 0x87; // for color; |
| 159 | 159 | case AGA_MONO: return 0x90; //for mono |
| 160 | 160 | case AGA_OFF: return 0x80; // for vram |
| 161 | // | |
| 161 | // return 0x97; //for error | |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | return 0; |
| r5932 | r5933 | |
| 172 | 172 | |
| 173 | 173 | WRITE8_HANDLER( europc_pio_w ) |
| 174 | 174 | { |
| 175 | switch (offset) | |
| 175 | switch (offset) | |
| 176 | 176 | { |
| 177 | 177 | case 1: |
| 178 | 178 | europc_pio.port61=data; |
| 179 | // if (data == 0x30) pc1640.port62 = (pc1640.port65 & 0x10) >> 4; | |
| 180 | // else if (data == 0x34) pc1640.port62 = pc1640.port65 & 0xf; | |
| 179 | // if (data == 0x30) pc1640.port62 = (pc1640.port65 & 0x10) >> 4; | |
| 180 | // else if (data == 0x34) pc1640.port62 = pc1640.port65 & 0xf; | |
| 181 | 181 | pit8253_gate_w(devtag_get_device(space->machine, "pit8253"), 2, BIT(data, 0)); |
| 182 | 182 | pc_speaker_set_spkrdata(space->machine, BIT(data, 1)); |
| 183 | 183 | pc_keyb_set_clock(BIT(data, 6)); |
| r5932 | r5933 | |
| 191 | 191 | READ8_HANDLER( europc_pio_r ) |
| 192 | 192 | { |
| 193 | 193 | int data = 0; |
| 194 | switch (offset) | |
| 194 | switch (offset) | |
| 195 | 195 | { |
| 196 | 196 | case 0: |
| 197 | 197 | if (!(europc_pio.port61&0x80)) |
| r5932 | r5933 | |
| 201 | 201 | data = europc_pio.port61; |
| 202 | 202 | break; |
| 203 | 203 | case 2: |
| 204 | if (pit8253_get_output(devtag_get_device(space->machine, "pit8253"), 2)) | |
| 204 | if (pit8253_get_output(devtag_get_device(space->machine, "pit8253"), 2)) | |
| 205 | 205 | data |= 0x20; |
| 206 | 206 | break; |
| 207 | 207 | } |
| r5932 | r5933 | |
| 211 | 211 | // realtime clock and nvram |
| 212 | 212 | static struct { |
| 213 | 213 | /* |
| 214 | reg 0: seconds | |
| 215 | reg 1: minutes | |
| 216 | reg 2: hours | |
| 217 | reg 3: day 1 based | |
| 218 | reg 4: month 1 based | |
| 219 | reg 5: year bcd (no century, values bigger 88? are handled as 1900, else 2000) | |
| 220 | reg 6: | |
| 221 | reg 7: | |
| 222 | reg 8: | |
| 223 | reg 9: | |
| 224 | reg a: | |
| 225 | reg b: 0x10 written | |
| 226 | bit 0,1: 0 video startup mode: 0=specialadapter, 1=color40, 2=color80, 3=monochrom | |
| 227 | bit 2: internal video on | |
| 228 | bit 4: color | |
| 229 | bit 6,7: clock | |
| 230 | reg c: | |
| 231 | bit 0,1: language/country | |
| 232 | reg d: xor checksum | |
| 233 | reg e: | |
| 234 | reg 0f: 01 status ok, when not 01 written | |
| 235 | */ | |
| 214 | reg 0: seconds | |
| 215 | reg 1: minutes | |
| 216 | reg 2: hours | |
| 217 | reg 3: day 1 based | |
| 218 | reg 4: month 1 based | |
| 219 | reg 5: year bcd (no century, values bigger 88? are handled as 1900, else 2000) | |
| 220 | reg 6: | |
| 221 | reg 7: | |
| 222 | reg 8: | |
| 223 | reg 9: | |
| 224 | reg a: | |
| 225 | reg b: 0x10 written | |
| 226 | bit 0,1: 0 video startup mode: 0=specialadapter, 1=color40, 2=color80, 3=monochrom | |
| 227 | bit 2: internal video on | |
| 228 | bit 4: color | |
| 229 | bit 6,7: clock | |
| 230 | reg c: | |
| 231 | bit 0,1: language/country | |
| 232 | reg d: xor checksum | |
| 233 | reg e: | |
| 234 | reg 0f: 01 status ok, when not 01 written | |
| 235 | */ | |
| 236 | 236 | UINT8 data[0x10]; |
| 237 | 237 | int reg; |
| 238 | 238 | int state; |
| r5932 | r5933 | |
| 259 | 259 | { |
| 260 | 260 | int month, year; |
| 261 | 261 | europc_rtc.data[0]=bcd_adjust(europc_rtc.data[0]+1); |
| 262 | if (europc_rtc.data[0]>=0x60) | |
| 262 | if (europc_rtc.data[0]>=0x60) | |
| 263 | 263 | { |
| 264 | 264 | europc_rtc.data[0]=0; |
| 265 | 265 | europc_rtc.data[1]=bcd_adjust(europc_rtc.data[1]+1); |
| 266 | if (europc_rtc.data[1]>=0x60) | |
| 266 | if (europc_rtc.data[1]>=0x60) | |
| 267 | 267 | { |
| 268 | 268 | europc_rtc.data[1]=0; |
| 269 | 269 | europc_rtc.data[2]=bcd_adjust(europc_rtc.data[2]+1); |
| 270 | if (europc_rtc.data[2]>=0x24) | |
| 270 | if (europc_rtc.data[2]>=0x24) | |
| 271 | 271 | { |
| 272 | 272 | europc_rtc.data[2]=0; |
| 273 | 273 | europc_rtc.data[3]=bcd_adjust(europc_rtc.data[3]+1); |
| 274 | 274 | month=bcd_2_dec(europc_rtc.data[4]); |
| 275 | 275 | year=bcd_2_dec(europc_rtc.data[5])+2000; // save for julian_days_in_month_calculation |
| 276 | if (europc_rtc.data[3]> gregorian_days_in_month(month, year)) | |
| 276 | if (europc_rtc.data[3]> gregorian_days_in_month(month, year)) | |
| 277 | 277 | { |
| 278 | 278 | europc_rtc.data[3]=1; |
| 279 | 279 | europc_rtc.data[4]=bcd_adjust(europc_rtc.data[4]+1); |
| 280 | if (europc_rtc.data[4]>0x12) | |
| 280 | if (europc_rtc.data[4]>0x12) | |
| 281 | 281 | { |
| 282 | 282 | europc_rtc.data[4]=1; |
| 283 | 283 | europc_rtc.data[5]=bcd_adjust(europc_rtc.data[5]+1)&0xff; |
| r5932 | r5933 | |
| 300 | 300 | READ8_HANDLER( europc_rtc_r ) |
| 301 | 301 | { |
| 302 | 302 | int data=0; |
| 303 | switch (europc_rtc.state) | |
| 303 | switch (europc_rtc.state) | |
| 304 | 304 | { |
| 305 | 305 | case 1: |
| 306 | 306 | data=(europc_rtc.data[europc_rtc.reg]&0xf0)>>4; |
| r5932 | r5933 | |
| 309 | 309 | case 2: |
| 310 | 310 | data=europc_rtc.data[europc_rtc.reg]&0xf; |
| 311 | 311 | europc_rtc.state=0; |
| 312 | // | |
| 312 | // logerror("rtc read %x %.2x\n",europc_rtc.reg, europc_rtc.data[europc_rtc.reg]); | |
| 313 | 313 | break; |
| 314 | 314 | } |
| 315 | 315 | return data; |
| r5932 | r5933 | |
| 317 | 317 | |
| 318 | 318 | WRITE8_HANDLER( europc_rtc_w ) |
| 319 | 319 | { |
| 320 | switch (europc_rtc.state) | |
| 320 | switch (europc_rtc.state) | |
| 321 | 321 | { |
| 322 | 322 | case 0: |
| 323 | 323 | europc_rtc.reg=data; |
| r5932 | r5933 | |
| 330 | 330 | case 2: |
| 331 | 331 | europc_rtc.data[europc_rtc.reg]=(europc_rtc.data[europc_rtc.reg]&~0xf)|(data&0xf); |
| 332 | 332 | europc_rtc.state=0; |
| 333 | // | |
| 333 | // logerror("rtc written %x %.2x\n",europc_rtc.reg, europc_rtc.data[europc_rtc.reg]); | |
| 334 | 334 | break; |
| 335 | 335 | } |
| 336 | 336 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 990_dk.c: emulation of a TI FD800 'Diablo' floppy disk controller | |
| 3 | controller, for use with any TI990 system (and possibly any system which | |
| 4 | implements the CRU bus). | |
| 2 | 990_dk.c: emulation of a TI FD800 'Diablo' floppy disk controller | |
| 3 | controller, for use with any TI990 system (and possibly any system which | |
| 4 | implements the CRU bus). | |
| 5 | 5 | |
| 6 | ||
| 6 | This floppy disk controller supports IBM-format 8" SSSD and DSSD floppies. | |
| 7 | 7 | |
| 8 | ||
| 8 | Raphael Nabet 2003 | |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| r5932 | r5933 | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /* |
| 128 | ||
| 128 | Read the first id field that can be found on the floppy disk. | |
| 129 | 129 | |
| 130 | unit: floppy drive index | |
| 131 | head: selected head | |
| 132 | cylinder_id: cylinder ID read | |
| 133 | sector_id: sector ID read | |
| 130 | unit: floppy drive index | |
| 131 | head: selected head | |
| 132 | cylinder_id: cylinder ID read | |
| 133 | sector_id: sector ID read | |
| 134 | 134 | |
| 135 | ||
| 135 | Return TRUE if an ID was found | |
| 136 | 136 | */ |
| 137 | 137 | static int fd800_read_id(int unit, int head, int *cylinder_id, int *sector_id) |
| 138 | 138 | { |
| r5932 | r5933 | |
| 141 | 141 | |
| 142 | 142 | /*revolution_count = 0; |
| 143 | 143 | |
| 144 | while (revolution_count < 2) | |
| 145 | {*/ | |
| 144 | while (revolution_count < 2) | |
| 145 | {*/ | |
| 146 | 146 | if (floppy_drive_get_next_id(fd800.drv[unit].img, head, &id)) |
| 147 | 147 | { |
| 148 | 148 | if (cylinder_id) |
| r5932 | r5933 | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /* |
| 160 | ||
| 160 | Find a sector by id. | |
| 161 | 161 | |
| 162 | unit: floppy drive index | |
| 163 | head: selected head | |
| 164 | sector: sector ID to search | |
| 165 | data_id: data ID to be used when calling sector read/write functions | |
| 162 | unit: floppy drive index | |
| 163 | head: selected head | |
| 164 | sector: sector ID to search | |
| 165 | data_id: data ID to be used when calling sector read/write functions | |
| 166 | 166 | |
| 167 | ||
| 167 | Return TRUE if the given sector ID was found | |
| 168 | 168 | */ |
| 169 | 169 | static int fd800_find_sector(int unit, int head, int sector, int *data_id) |
| 170 | 170 | { |
| r5932 | r5933 | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /* |
| 195 | ||
| 195 | Perform seek command | |
| 196 | 196 | |
| 197 | unit: floppy drive index | |
| 198 | cylinder: track to seek for | |
| 199 | head: head for which the seek is performed | |
| 197 | unit: floppy drive index | |
| 198 | cylinder: track to seek for | |
| 199 | head: head for which the seek is performed | |
| 200 | 200 | |
| 201 | ||
| 201 | Return FALSE if the seek was successful | |
| 202 | 202 | */ |
| 203 | 203 | static int fd800_do_seek(int unit, int cylinder, int head) |
| 204 | 204 | { |
| r5932 | r5933 | |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /* |
| 259 | ||
| 259 | Perform restore command | |
| 260 | 260 | |
| 261 | ||
| 261 | unit: floppy drive index | |
| 262 | 262 | |
| 263 | ||
| 263 | Return FALSE if the restore was successful | |
| 264 | 264 | */ |
| 265 | 265 | static int fd800_do_restore(int unit) |
| 266 | 266 | { |
| r5932 | r5933 | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /* |
| 298 | ||
| 298 | Perform a read operation for one sector | |
| 299 | 299 | */ |
| 300 | 300 | static void fd800_do_read(void) |
| 301 | 301 | { |
| r5932 | r5933 | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /* |
| 326 | ||
| 326 | Perform a write operation for one sector | |
| 327 | 327 | */ |
| 328 | 328 | static void fd800_do_write(void) |
| 329 | 329 | { |
| r5932 | r5933 | |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /* |
| 351 | ||
| 351 | Execute a fdc command | |
| 352 | 352 | */ |
| 353 | 353 | static void fd800_do_cmd(void) |
| 354 | 354 | { |
| r5932 | r5933 | |
| 380 | 380 | switch (fd800.cmd_reg >> 12) |
| 381 | 381 | { |
| 382 | 382 | case 0: /* select |
| 383 | bits 16-25: 0s | |
| 384 | bits 26-27: unit number (0-3) */ | |
| 383 | bits 16-25: 0s | |
| 384 | bits 26-27: unit number (0-3) */ | |
| 385 | 385 | unit = (fd800.cmd_reg >> 10) & 3; |
| 386 | 386 | |
| 387 | 387 | /* reset status */ |
| r5932 | r5933 | |
| 399 | 399 | break; |
| 400 | 400 | |
| 401 | 401 | case 1: /* seek |
| 402 | bits 16-22: cylinder number (0-76) | |
| 403 | bits 23-24: 0s | |
| 404 | bits 25: head number (1=upper) | |
| 405 | bits 26-27: unit number (0-3) */ | |
| 402 | bits 16-22: cylinder number (0-76) | |
| 403 | bits 23-24: 0s | |
| 404 | bits 25: head number (1=upper) | |
| 405 | bits 26-27: unit number (0-3) */ | |
| 406 | 406 | unit = (fd800.cmd_reg >> 10) & 3; |
| 407 | 407 | head = (fd800.cmd_reg >> 9) & 1; |
| 408 | 408 | cylinder = fd800.cmd_reg & 0x7f; |
| r5932 | r5933 | |
| 418 | 418 | break; |
| 419 | 419 | |
| 420 | 420 | case 2: /* restore |
| 421 | bits 16-25: 0s | |
| 422 | bits 26-27: unit number (0-3) */ | |
| 421 | bits 16-25: 0s | |
| 422 | bits 26-27: unit number (0-3) */ | |
| 423 | 423 | unit = (fd800.cmd_reg >> 10) & 3; |
| 424 | 424 | |
| 425 | 425 | /* reset status */ |
| r5932 | r5933 | |
| 433 | 433 | break; |
| 434 | 434 | |
| 435 | 435 | case 3: /* sector length |
| 436 | bits 16-22: sector word count (0-64) | |
| 437 | bits 23-25: 0s | |
| 438 | bits 26-27: unit number (0-3) */ | |
| 436 | bits 16-22: sector word count (0-64) | |
| 437 | bits 23-25: 0s | |
| 438 | bits 26-27: unit number (0-3) */ | |
| 439 | 439 | unit = (fd800.cmd_reg >> 10) & 3; |
| 440 | 440 | seclen = fd800.cmd_reg & 0x7f; |
| 441 | 441 | |
| r5932 | r5933 | |
| 457 | 457 | break; |
| 458 | 458 | |
| 459 | 459 | case 4: /* read |
| 460 | bits 16-20: sector number (1-26) | |
| 461 | bits 21-23: 0s | |
| 462 | bit 24: no sequential sectoring (1=active) | |
| 463 | bit 25: head number (1=upper) | |
| 464 | bits 26-27: unit number (0-3) */ | |
| 460 | bits 16-20: sector number (1-26) | |
| 461 | bits 21-23: 0s | |
| 462 | bit 24: no sequential sectoring (1=active) | |
| 463 | bit 25: head number (1=upper) | |
| 464 | bits 26-27: unit number (0-3) */ | |
| 465 | 465 | unit = (fd800.cmd_reg >> 10) & 3; |
| 466 | 466 | head = (fd800.cmd_reg >> 9) & 1; |
| 467 | 467 | /*non_seq_mode = (fd800.cmd_reg >> 8) & 1;*/ |
| r5932 | r5933 | |
| 482 | 482 | break; |
| 483 | 483 | |
| 484 | 484 | case 5: /* read ID |
| 485 | bits 16-24: 0s | |
| 486 | bit 25: head number (1=upper) | |
| 487 | bits 26-27: unit number (0-3) */ | |
| 485 | bits 16-24: 0s | |
| 486 | bit 25: head number (1=upper) | |
| 487 | bits 26-27: unit number (0-3) */ | |
| 488 | 488 | unit = (fd800.cmd_reg >> 10) & 3; |
| 489 | 489 | head = (fd800.cmd_reg >> 9) & 1; |
| 490 | 490 | |
| r5932 | r5933 | |
| 506 | 506 | break; |
| 507 | 507 | |
| 508 | 508 | case 6: /* read unformatted |
| 509 | bits 16-20: sector number (1-26) | |
| 510 | bits 21-24: 0s | |
| 511 | bit 25: head number (1=upper) | |
| 512 | bits 26-27: unit number (0-3) */ | |
| 509 | bits 16-20: sector number (1-26) | |
| 510 | bits 21-24: 0s | |
| 511 | bit 25: head number (1=upper) | |
| 512 | bits 26-27: unit number (0-3) */ | |
| 513 | 513 | /* ... */ |
| 514 | 514 | break; |
| 515 | 515 | |
| 516 | 516 | case 7: /* write |
| 517 | bits 16-20: sector number (1-26) | |
| 518 | bits 21-24: 0s | |
| 519 | bit 25: head number (1=upper) | |
| 520 | bits 26-27: unit number (0-3) */ | |
| 517 | bits 16-20: sector number (1-26) | |
| 518 | bits 21-24: 0s | |
| 519 | bit 25: head number (1=upper) | |
| 520 | bits 26-27: unit number (0-3) */ | |
| 521 | 521 | unit = (fd800.cmd_reg >> 10) & 3; |
| 522 | 522 | head = (fd800.cmd_reg >> 9) & 1; |
| 523 | 523 | sector = fd800.cmd_reg & 0x1f; |
| r5932 | r5933 | |
| 547 | 547 | break; |
| 548 | 548 | |
| 549 | 549 | case 8: /* write delete |
| 550 | bits 16-20: sector number (1-26) | |
| 551 | bits 21-24: 0s | |
| 552 | bit 25: head number (1=upper) | |
| 553 | bits 26-27: unit number (0-3) */ | |
| 550 | bits 16-20: sector number (1-26) | |
| 551 | bits 21-24: 0s | |
| 552 | bit 25: head number (1=upper) | |
| 553 | bits 26-27: unit number (0-3) */ | |
| 554 | 554 | unit = (fd800.cmd_reg >> 10) & 3; |
| 555 | 555 | head = (fd800.cmd_reg >> 9) & 1; |
| 556 | 556 | sector = fd800.cmd_reg & 0x1f; |
| r5932 | r5933 | |
| 580 | 580 | break; |
| 581 | 581 | |
| 582 | 582 | case 9: /* format track |
| 583 | bits 16-23: track ID (0-255, normally current cylinder index, or 255 for bad track) | |
| 584 | bit 24: verify only (1 - verify, 0 - format & verify) | |
| 585 | bit 25: head number (1=upper) | |
| 586 | bits 26-27: unit number (0-3) */ | |
| 583 | bits 16-23: track ID (0-255, normally current cylinder index, or 255 for bad track) | |
| 584 | bit 24: verify only (1 - verify, 0 - format & verify) | |
| 585 | bit 25: head number (1=upper) | |
| 586 | bits 26-27: unit number (0-3) */ | |
| 587 | 587 | /* ... */ |
| 588 | 588 | break; |
| 589 | 589 | |
| 590 | 590 | case 10: /* load int mask |
| 591 | bit 16: bad mask for interrupt (0 = unmask or enable interrupt) | |
| 592 | bits 17-27: 0s */ | |
| 591 | bit 16: bad mask for interrupt (0 = unmask or enable interrupt) | |
| 592 | bits 17-27: 0s */ | |
| 593 | 593 | fd800.interrupt_f_f = fd800.cmd_reg & 1; |
| 594 | 594 | fd800_field_interrupt(); |
| 595 | 595 | break; |
| 596 | 596 | |
| 597 | 597 | case 11: /* stop |
| 598 | bits 16-25: 0s | |
| 599 | bits 26-27: unit number (0-3) */ | |
| 598 | bits 16-25: 0s | |
| 599 | bits 26-27: unit number (0-3) */ | |
| 600 | 600 | unit = (fd800.cmd_reg >> 10) & 3; |
| 601 | 601 | |
| 602 | 602 | /* reset status */ |
| r5932 | r5933 | |
| 609 | 609 | break; |
| 610 | 610 | |
| 611 | 611 | case 12: /* step head |
| 612 | bits 16-22: track number (0-76) | |
| 613 | bits 23-25: 0s | |
| 614 | bits 26-27: unit number (0-3) */ | |
| 612 | bits 16-22: track number (0-76) | |
| 613 | bits 23-25: 0s | |
| 614 | bits 26-27: unit number (0-3) */ | |
| 615 | 615 | unit = (fd800.cmd_reg >> 10) & 3; |
| 616 | 616 | cylinder = fd800.cmd_reg & 0x7f; |
| 617 | 617 | |
| r5932 | r5933 | |
| 630 | 630 | break; |
| 631 | 631 | |
| 632 | 632 | case 13: /* maintenance commands |
| 633 | bits 16-23: according to extended command code | |
| 634 | bits 24-27: extended command code (0-7) */ | |
| 633 | bits 16-23: according to extended command code | |
| 634 | bits 24-27: extended command code (0-7) */ | |
| 635 | 635 | switch ((fd800.cmd_reg >> 8) & 15) |
| 636 | 636 | { |
| 637 | 637 | case 0: /* reset |
| 638 | ||
| 638 | bits 16-23: 0s */ | |
| 639 | 639 | /* ... */ |
| 640 | 640 | break; |
| 641 | 641 | case 1: /* retry inhibit |
| 642 | ||
| 642 | bits 16-23: 0s */ | |
| 643 | 643 | /* ... */ |
| 644 | 644 | break; |
| 645 | 645 | case 2: /* LED test |
| 646 | bit 16: 1 | |
| 647 | bits 17-19: 0s | |
| 648 | bit 20: LED #2 enable | |
| 649 | bit 21: LED #3 enable | |
| 650 | bit 22: LED #4 enable | |
| 651 | bit 23: enable LEDs */ | |
| 646 | bit 16: 1 | |
| 647 | bits 17-19: 0s | |
| 648 | bit 20: LED #2 enable | |
| 649 | bit 21: LED #3 enable | |
| 650 | bit 22: LED #4 enable | |
| 651 | bit 23: enable LEDs */ | |
| 652 | 652 | /* ... */ |
| 653 | 653 | break; |
| 654 | 654 | case 3: /* program error (a.k.a. invalid command) |
| 655 | ||
| 655 | bits 16-23: 0s */ | |
| 656 | 656 | /* ... */ |
| 657 | 657 | break; |
| 658 | 658 | case 4: /* memory read |
| 659 | bits 16-20: controller memory address (shifted left by 8 to generate 9900 address) | |
| 660 | bits 21-23: 0s */ | |
| 659 | bits 16-20: controller memory address (shifted left by 8 to generate 9900 address) | |
| 660 | bits 21-23: 0s */ | |
| 661 | 661 | /* ... */ |
| 662 | 662 | break; |
| 663 | 663 | case 5: /* RAM load |
| 664 | bit 16: 0 | |
| 665 | bits 17-23: RAM offset (shifted left by 1 and offset by >1800 to generate 9900 address) */ | |
| 664 | bit 16: 0 | |
| 665 | bits 17-23: RAM offset (shifted left by 1 and offset by >1800 to generate 9900 address) */ | |
| 666 | 666 | /* ... */ |
| 667 | 667 | break; |
| 668 | 668 | case 6: /* RAM run |
| 669 | bit 16: 0 | |
| 670 | bits 17-23: RAM offset (shifted left by 1 and offset by >1800 to generate 9900 address) */ | |
| 669 | bit 16: 0 | |
| 670 | bits 17-23: RAM offset (shifted left by 1 and offset by >1800 to generate 9900 address) */ | |
| 671 | 671 | /* ... */ |
| 672 | 672 | break; |
| 673 | 673 | case 7: /* power up simulation |
| 674 | ||
| 674 | bits 16-23: 0s */ | |
| 675 | 675 | /* ... */ |
| 676 | 676 | break; |
| 677 | 677 | } |
| r5932 | r5933 | |
| 679 | 679 | break; |
| 680 | 680 | |
| 681 | 681 | case 14: /* IPL |
| 682 | bits 16-22: track number (0-76) | |
| 683 | bit 23: 0 | |
| 684 | bit 24: no sequential sectoring (1=active) | |
| 685 | bit 25: head number (1=upper) | |
| 686 | bits 26-27: unit number (0-3) */ | |
| 682 | bits 16-22: track number (0-76) | |
| 683 | bit 23: 0 | |
| 684 | bit 24: no sequential sectoring (1=active) | |
| 685 | bit 25: head number (1=upper) | |
| 686 | bits 26-27: unit number (0-3) */ | |
| 687 | 687 | unit = (fd800.cmd_reg >> 10) & 3; |
| 688 | 688 | head = (fd800.cmd_reg >> 9) & 1; |
| 689 | 689 | /*non_seq_mode = (fd800.cmd_reg >> 8) & 1;*/ |
| r5932 | r5933 | |
| 704 | 704 | break; |
| 705 | 705 | |
| 706 | 706 | case 15: /* Clear Status port |
| 707 | ||
| 707 | bits 16-27: 0s */ | |
| 708 | 708 | fd800.stat_reg = 0; |
| 709 | 709 | fd800_field_interrupt(); |
| 710 | 710 | break; |
| r5932 | r5933 | |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | /* |
| 715 | ||
| 715 | read one CRU bit | |
| 716 | 716 | |
| 717 | 0-15: receive buffer | |
| 718 | 16-31: status: | |
| 719 | 16: OP complete (1 -> complete???) | |
| 720 | 17: Xfer ready (XFER) (1 -> ready???) | |
| 721 | 18: drive not ready | |
| 722 | 19: data check error | |
| 723 | 20: seek error/?????? | |
| 724 | 21 invalid command/?????? | |
| 725 | 22: no address mark found/?????? | |
| 726 | 23: equipment check error/?????? | |
| 727 | 24: ID check error | |
| 728 | 25: ID not found | |
| 729 | 26: Controller busy (CTLBSY) (0 -> controller is ready) | |
| 730 | 27: write protect | |
| 731 | 28: deleted sector detected | |
| 732 | 29: unit LSB | |
| 733 | 30: unit MSB | |
| 734 | 31: Interrupt (CBUSY???) (1 -> controller is ready) | |
| 717 | 0-15: receive buffer | |
| 718 | 16-31: status: | |
| 719 | 16: OP complete (1 -> complete???) | |
| 720 | 17: Xfer ready (XFER) (1 -> ready???) | |
| 721 | 18: drive not ready | |
| 722 | 19: data check error | |
| 723 | 20: seek error/?????? | |
| 724 | 21 invalid command/?????? | |
| 725 | 22: no address mark found/?????? | |
| 726 | 23: equipment check error/?????? | |
| 727 | 24: ID check error | |
| 728 | 25: ID not found | |
| 729 | 26: Controller busy (CTLBSY) (0 -> controller is ready) | |
| 730 | 27: write protect | |
| 731 | 28: deleted sector detected | |
| 732 | 29: unit LSB | |
| 733 | 30: unit MSB | |
| 734 | 31: Interrupt (CBUSY???) (1 -> controller is ready) | |
| 735 | 735 | */ |
| 736 | 736 | READ8_HANDLER(fd800_cru_r) |
| 737 | 737 | { |
| r5932 | r5933 | |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | /* |
| 759 | ||
| 759 | write one CRU bit | |
| 760 | 760 | |
| 761 | 0-15: controller data word (transmit buffer) | |
| 762 | 16-31: controller command word (command register) | |
| 763 | 16-23: parameter value | |
| 764 | 24: flag bit/extended command code | |
| 765 | 25: head select/extended command code | |
| 766 | 26: FD unit number LSB/extended command code | |
| 767 | 27: FD unit number MSB/extended command code | |
| 768 | 28-31: command code | |
| 761 | 0-15: controller data word (transmit buffer) | |
| 762 | 16-31: controller command word (command register) | |
| 763 | 16-23: parameter value | |
| 764 | 24: flag bit/extended command code | |
| 765 | 25: head select/extended command code | |
| 766 | 26: FD unit number LSB/extended command code | |
| 767 | 27: FD unit number MSB/extended command code | |
| 768 | 28-31: command code | |
| 769 | 769 | */ |
| 770 | 770 | WRITE8_HANDLER(fd800_cru_w) |
| 771 | 771 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Orao machine driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 23/02/2008 Sound support added. | |
| 6 | 22/02/2008 Preliminary driver. | |
| 7 | ||
| 5 | 23/02/2008 Sound support added. | |
| 6 | 22/02/2008 Preliminary driver. | |
| 7 | ||
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | #include "driver.h" |
| r5932 | r5933 | |
| 24 | 24 | { |
| 25 | 25 | memset(orao_memory,0xff,0x6000); |
| 26 | 26 | } |
| 27 | ||
| 27 | ||
| 28 | 28 | MACHINE_RESET( orao ) |
| 29 | { | |
| 29 | { | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | READ8_HANDLER( orao_io_r ) |
| 33 | 33 | { |
| 34 | 34 | double level; |
| 35 | ||
| 35 | ||
| 36 | 36 | switch(offset) { |
| 37 | 37 | /* Keyboard*/ |
| 38 | 38 | case 0x07FC : return input_port_read(space->machine, "LINE0"); |
| r5932 | r5933 | |
| 55 | 55 | case 0x05FF : return input_port_read(space->machine, "LINE17"); |
| 56 | 56 | case 0x03FE : return input_port_read(space->machine, "LINE18"); |
| 57 | 57 | case 0x03FF : return input_port_read(space->machine, "LINE19"); |
| 58 | /* Tape */ | |
| 59 | case 0x07FF : | |
| 60 | level = cassette_input(devtag_get_device(space->machine, "cassette")); | |
| 61 | if (level < 0) { | |
| 62 | return 0x00; | |
| 58 | /* Tape */ | |
| 59 | case 0x07FF : | |
| 60 | level = cassette_input(devtag_get_device(space->machine, "cassette")); | |
| 61 | if (level < 0) { | |
| 62 | return 0x00; | |
| 63 | 63 | } |
| 64 | return 0xff; | |
| 64 | return 0xff; | |
| 65 | 65 | } |
| 66 | ||
| 67 | ||
| 68 | return 0xff; | |
| 66 | ||
| 67 | ||
| 68 | return 0xff; | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | WRITE8_HANDLER( orao_io_w ) |
| 73 | { | |
| 73 | { | |
| 74 | 74 | if (offset == 0x0800) |
| 75 | 75 | { |
| 76 | 76 | const device_config *dac_device = devtag_get_device(space->machine, "dac"); |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - timers (other than delay mode) | |
| 15 | - serial I/O | |
| 16 | - reset behavior | |
| 14 | - timers (other than delay mode) | |
| 15 | - serial I/O | |
| 16 | - reset behavior | |
| 17 | 17 | |
| 18 | 18 | */ |
| 19 | 19 | |
| r5932 | r5933 | |
| 118 | 118 | /* interrupt vectors */ |
| 119 | 119 | static const UINT8 INT_VECTOR[] = |
| 120 | 120 | { |
| 121 | 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, | |
| 121 | 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, | |
| 122 | 122 | 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e |
| 123 | 123 | }; |
| 124 | 124 | |
| r5932 | r5933 | |
| 208 | 208 | |
| 209 | 209 | /*------------------------------------------------- |
| 210 | 210 | check_interrupts - set the interrupt request |
| 211 | ||
| 211 | line state | |
| 212 | 212 | -------------------------------------------------*/ |
| 213 | 213 | |
| 214 | 214 | static void check_interrupts(z80sti_t *z80sti) |
| r5932 | r5933 | |
| 423 | 423 | int i; |
| 424 | 424 | LOG(("Z80STI '%s' Interrupt Pending Register B: %x\n", device->tag, data)); |
| 425 | 425 | z80sti->ipr &= (z80sti->ipr & 0xff00) | data; |
| 426 | ||
| 426 | ||
| 427 | 427 | for (i = 0; i < 16; i++) |
| 428 | 428 | { |
| 429 | 429 | if (!BIT(z80sti->ipr, i) && (z80sti->int_state[i] == Z80_DAISY_INT)) z80sti->int_state[i] = 0; |
| r5932 | r5933 | |
| 438 | 438 | int i; |
| 439 | 439 | LOG(("Z80STI '%s' Interrupt Pending Register A: %x\n", device->tag, data)); |
| 440 | 440 | z80sti->ipr &= (data << 8) | (z80sti->ipr & 0xff); |
| 441 | ||
| 441 | ||
| 442 | 442 | for (i = 0; i < 16; i++) |
| 443 | 443 | { |
| 444 | 444 | if (!BIT(z80sti->ipr, i) && (z80sti->int_state[i] == Z80_DAISY_INT)) z80sti->int_state[i] = 0; |
| r5932 | r5933 | |
| 510 | 510 | z80sti->tdr[TIMER_A] = data; |
| 511 | 511 | break; |
| 512 | 512 | /* |
| 513 | case Z80STI_REGISTER_UCR: | |
| 514 | z80sti->ucr = data; | |
| 515 | break; | |
| 513 | case Z80STI_REGISTER_UCR: | |
| 514 | z80sti->ucr = data; | |
| 515 | break; | |
| 516 | 516 | |
| 517 | case Z80STI_REGISTER_RSR: | |
| 518 | z80sti->rsr = data; | |
| 519 | break; | |
| 517 | case Z80STI_REGISTER_RSR: | |
| 518 | z80sti->rsr = data; | |
| 519 | break; | |
| 520 | 520 | |
| 521 | case Z80STI_REGISTER_TSR: | |
| 522 | z80sti->tsr = data; | |
| 523 | break; | |
| 521 | case Z80STI_REGISTER_TSR: | |
| 522 | z80sti->tsr = data; | |
| 523 | break; | |
| 524 | 524 | |
| 525 | case Z80STI_REGISTER_UDR: | |
| 526 | z80sti->udr = data; | |
| 527 | break; | |
| 525 | case Z80STI_REGISTER_UDR: | |
| 526 | z80sti->udr = data; | |
| 527 | break; | |
| 528 | 528 | */ |
| 529 | 529 | default: |
| 530 | 530 | LOG(("Z80STI '%s' Unsupported Register %x\n", device->tag, offset & 0x0f)); |
| r5932 | r5933 | |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | LOG(("Z80STI '%s' Interrupt State: %u\n", device->tag, state)); |
| 677 | ||
| 677 | ||
| 678 | 678 | return state; |
| 679 | 679 | } |
| 680 | 680 | |
| r5932 | r5933 | |
| 703 | 703 | |
| 704 | 704 | /* set interrupt in-service register bit */ |
| 705 | 705 | z80sti->isr |= (1 << i); |
| 706 | ||
| 706 | ||
| 707 | 707 | check_interrupts(z80sti); |
| 708 | 708 | |
| 709 | 709 | LOG(("Z80STI '%s' Interrupt Acknowledge Vector: %02x\n", device->tag, vector)); |
| r5932 | r5933 | |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | logerror("z80sti_irq_ack: failed to find an interrupt to ack!\n"); |
| 716 | ||
| 716 | ||
| 717 | 717 | return 0; |
| 718 | 718 | } |
| 719 | 719 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | Motorola Evaluation Kit 6800 D2 | |
| 3 | MEK6800D2 | |
| 2 | Motorola Evaluation Kit 6800 D2 | |
| 3 | MEK6800D2 | |
| 4 | 4 | |
| 5 | ||
| 5 | machine Driver | |
| 6 | 6 | |
| 7 | ||
| 7 | Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000 | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | #include "driver.h" |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | 990_dk.h: include file for 990_dk.c | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | FLOPPY_OPTIONS_EXTERN(fd800); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | IBM AT Compatibles | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| r5932 | r5933 | |
| 225 | 225 | |
| 226 | 226 | if (LOG_PORT80 && (offset == 0)) |
| 227 | 227 | { |
| 228 | logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, | |
| 228 | logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, | |
| 229 | 229 | (unsigned) cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPC)); |
| 230 | 230 | } |
| 231 | 231 | |
| r5932 | r5933 | |
| 406 | 406 | { |
| 407 | 407 | pic8259_set_irq_line(at_devices.pic8259_master, 6, state); |
| 408 | 408 | //if ( mess_ram[0x0490] == 0x74 ) |
| 409 | // | |
| 409 | // mess_ram[0x0490] = 0x54; | |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | |
| r5932 | r5933 | |
| 497 | 497 | logerror("%04x: writing $%02x to P2\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), data ); |
| 498 | 498 | |
| 499 | 499 | at_set_gate_a20( space->machine, ( data & 0x02 ) ? 1 : 0 ); |
| 500 | ||
| 500 | ||
| 501 | 501 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE ); |
| 502 | 502 | |
| 503 | 503 | /* OPT BUF FULL is connected to IR1 on the master 8259 */ |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | TAO 1 |* \_/ | 40 Vcc | |
| 11 | TBO 2 | | 39 RC | |
| 12 | TCO 3 | | 38 SI | |
| 13 | TDO 4 | | 37 SO | |
| 14 | TCK 5 | | 36 TC | |
| 15 | _M1 6 | | 35 A0 | |
| 16 | _RES 7 | | 34 A1 | |
| 17 | I0 8 | | 33 A2 | |
| 18 | I1 9 | | 32 A3 | |
| 19 | I2 10 | MK3801 | 31 _WR | |
| 20 | I3 11 | Z80-STI | 30 _CE | |
| 21 | I4 12 | | 29 _RD | |
| 22 | I5 13 | | 28 D7 | |
| 23 | I6 14 | | 27 D6 | |
| 24 | I7 15 | | 26 D5 | |
| 25 | IEI 16 | | 25 D4 | |
| 26 | _INT 17 | | 24 D3 | |
| 27 | IEO 18 | | 23 D2 | |
| 28 | _IORQ 19 | | 22 D1 | |
| 29 | Vss 20 |_____________| 21 D0 | |
| 9 | _____ _____ | |
| 10 | TAO 1 |* \_/ | 40 Vcc | |
| 11 | TBO 2 | | 39 RC | |
| 12 | TCO 3 | | 38 SI | |
| 13 | TDO 4 | | 37 SO | |
| 14 | TCK 5 | | 36 TC | |
| 15 | _M1 6 | | 35 A0 | |
| 16 | _RES 7 | | 34 A1 | |
| 17 | I0 8 | | 33 A2 | |
| 18 | I1 9 | | 32 A3 | |
| 19 | I2 10 | MK3801 | 31 _WR | |
| 20 | I3 11 | Z80-STI | 30 _CE | |
| 21 | I4 12 | | 29 _RD | |
| 22 | I5 13 | | 28 D7 | |
| 23 | I6 14 | | 27 D6 | |
| 24 | I7 15 | | 26 D5 | |
| 25 | IEI 16 | | 25 D4 | |
| 26 | _INT 17 | | 24 D3 | |
| 27 | IEO 18 | | 23 D2 | |
| 28 | _IORQ 19 | | 22 D1 | |
| 29 | Vss 20 |_____________| 21 D0 | |
| 30 | 30 | |
| 31 | 31 | **********************************************************************/ |
| 32 | 32 | |
| r5932 | r5933 | |
| 66 | 66 | |
| 67 | 67 | /* this gets called for each read of the SI pin (pin 38) */ |
| 68 | 68 | devcb_read_line in_si_func; |
| 69 | ||
| 69 | ||
| 70 | 70 | /* this gets called for each change of the SO pin (pin 37) */ |
| 71 | 71 | devcb_write_line out_so_func; |
| 72 | 72 | |
| 73 | 73 | /* this gets called for each change of the TAO pin (pin 1) */ |
| 74 | 74 | devcb_write_line out_tao_func; |
| 75 | ||
| 75 | ||
| 76 | 76 | /* this gets called for each change of the TBO pin (pin 2) */ |
| 77 | 77 | devcb_write_line out_tbo_func; |
| 78 | ||
| 78 | ||
| 79 | 79 | /* this gets called for each change of the TCO pin (pin 3) */ |
| 80 | 80 | devcb_write_line out_tco_func; |
| 81 | ||
| 81 | ||
| 82 | 82 | /* this gets called for each change of the TDO pin (pin 4) */ |
| 83 | 83 | devcb_write_line out_tdo_func; |
| 84 | 84 |
| r5932 | r5933 | |
|---|---|---|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | static READ8_DEVICE_HANDLER (vector06_8255_portc_r ) |
| 42 | { | |
| 42 | { | |
| 43 | 43 | double level = cassette_input(devtag_get_device(device->machine, "cassette")); |
| 44 | 44 | UINT8 retVal = input_port_read(device->machine, "LINE8"); |
| 45 | if (level > 0) { | |
| 46 | retVal |= 0x10; | |
| 45 | if (level > 0) { | |
| 46 | retVal |= 0x10; | |
| 47 | 47 | } |
| 48 | 48 | return retVal; |
| 49 | 49 | } |
| r5932 | r5933 | |
| 55 | 55 | |
| 56 | 56 | static void vector_set_video_mode(running_machine *machine, int width) { |
| 57 | 57 | rectangle visarea; |
| 58 | ||
| 58 | ||
| 59 | 59 | visarea.min_x = 0; |
| 60 | 60 | visarea.min_y = 0; |
| 61 | 61 | visarea.max_x = width+64-1; |
| 62 | 62 | visarea.max_y = 256+64-1; |
| 63 | video_screen_configure(machine->primary_screen, width+64, 256+64, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); | |
| 63 | video_screen_configure(machine->primary_screen, width+64, 256+64, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | static WRITE8_DEVICE_HANDLER (vector06_8255_portb_w ) |
| 67 | 67 | { |
| 68 | 68 | vector_color_index = data & 0x0f; |
| 69 | if ((data & 0x10) != vector_video_mode) | |
| 69 | if ((data & 0x10) != vector_video_mode) | |
| 70 | 70 | { |
| 71 | 71 | vector_video_mode = data & 0x10; |
| 72 | 72 | vector_set_video_mode(device->machine,(vector_video_mode==0x10) ? 512 : 256); |
| 73 | } | |
| 73 | } | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | WRITE8_HANDLER(vector06_color_set) |
| r5932 | r5933 | |
| 86 | 86 | |
| 87 | 87 | static READ8_DEVICE_HANDLER (vector06_romdisk_portb_r ) |
| 88 | 88 | { |
| 89 | UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x18000; | |
| 89 | UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x18000; | |
| 90 | 90 | UINT16 addr = (romdisk_msb*256+romdisk_lsb) & 0x7fff; |
| 91 | return romdisk[addr]; | |
| 91 | return romdisk[addr]; | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | static WRITE8_DEVICE_HANDLER (vector06_romdisk_porta_w ) |
| 95 | { | |
| 95 | { | |
| 96 | 96 | romdisk_lsb = data; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | static WRITE8_DEVICE_HANDLER (vector06_romdisk_portc_w ) |
| 100 | { | |
| 101 | romdisk_msb = data; | |
| 100 | { | |
| 101 | romdisk_msb = data; | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | I8255A_INTERFACE( vector06_ppi8255_2_interface ) |
| r5932 | r5933 | |
| 145 | 145 | { |
| 146 | 146 | vblank_state++; |
| 147 | 147 | if (vblank_state>1) vblank_state=0; |
| 148 | cpu_set_input_line(device,0,vblank_state ? HOLD_LINE : CLEAR_LINE); | |
| 149 | ||
| 148 | cpu_set_input_line(device,0,vblank_state ? HOLD_LINE : CLEAR_LINE); | |
| 149 | ||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | static IRQ_CALLBACK ( vector06_irq_callback ) |
| r5932 | r5933 | |
| 172 | 172 | { |
| 173 | 173 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 174 | 174 | wd17xx_set_side (fdc,((data & 4) >> 2) ^ 1); |
| 175 | wd17xx_set_drive(fdc,data & 1); | |
| 175 | wd17xx_set_drive(fdc,data & 1); | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | MACHINE_START( vector06 ) |
| r5932 | r5933 | |
| 184 | 184 | MACHINE_RESET( vector06 ) |
| 185 | 185 | { |
| 186 | 186 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 187 | ||
| 187 | ||
| 188 | 188 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), vector06_irq_callback); |
| 189 | 189 | memory_install_read8_handler (space, 0x0000, 0x7fff, 0, 0, SMH_BANK(1)); |
| 190 | 190 | memory_install_write8_handler(space, 0x0000, 0x7fff, 0, 0, SMH_BANK(2)); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Thierry Nouspikel's USB-SmartMedia card emulation | |
| 3 | 3 | |
| 4 | This card features three USB ports (two host and one device) and a | |
| 5 | SmartMedia interface. The original prototype was designed by Thierry | |
| 6 | Nouspikel, and its description was published in 2003; a small series of | |
| 7 | approximately 100 printed-circuit boards was ordered shortly afterwards | |
| 8 | by various TI users. | |
| 4 | This card features three USB ports (two host and one device) and a | |
| 5 | SmartMedia interface. The original prototype was designed by Thierry | |
| 6 | Nouspikel, and its description was published in 2003; a small series of | |
| 7 | approximately 100 printed-circuit boards was ordered shortly afterwards | |
| 8 | by various TI users. | |
| 9 | 9 | |
| 10 | ||
| 10 | The specs have been published in <http://www.nouspikel.com/ti99/usb.html>. | |
| 11 | 11 | |
| 12 | The USB interface uses a Philips ISP1161A USB controller that supports | |
| 13 | USB 2.0 full-speed (12 Mbit/s) and low-speed (1.5 Mbit/s) I/O (high speed | |
| 14 | (480 Mbits/sec) is not supported, but it is hardly a problem since TI99 is | |
| 15 | too slow to take advantage from high speed). The SmartMedia interface uses | |
| 16 | a few TTL buffers. The card also includes an 8MByte StrataFlash FEEPROM | |
| 17 | and 1MByte of SRAM for DSR use. | |
| 12 | The USB interface uses a Philips ISP1161A USB controller that supports | |
| 13 | USB 2.0 full-speed (12 Mbit/s) and low-speed (1.5 Mbit/s) I/O (high speed | |
| 14 | (480 Mbits/sec) is not supported, but it is hardly a problem since TI99 is | |
| 15 | too slow to take advantage from high speed). The SmartMedia interface uses | |
| 16 | a few TTL buffers. The card also includes an 8MByte StrataFlash FEEPROM | |
| 17 | and 1MByte of SRAM for DSR use. | |
| 18 | 18 | |
| 19 | TODO: | |
| 20 | * Test SmartMedia support | |
| 21 | * Implement USB controller and assorted USB devices | |
| 22 | * Save DSR FEEPROM to disk | |
| 19 | TODO: | |
| 20 | * Test SmartMedia support | |
| 21 | * Implement USB controller and assorted USB devices | |
| 22 | * Save DSR FEEPROM to disk | |
| 23 | 23 | |
| 24 | ||
| 24 | Raphael Nabet, 2004. | |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | #include "driver.h" |
| r5932 | r5933 | |
| 70 | 70 | static int tms9995_mode; |
| 71 | 71 | |
| 72 | 72 | /* |
| 73 | ||
| 73 | Initilaizes USB-SmartMedia card, set up handlers | |
| 74 | 74 | */ |
| 75 | 75 | void ti99_usbsm_init(running_machine *machine) |
| 76 | 76 | { |
| r5932 | r5933 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /* |
| 81 | ||
| 81 | Reset USB-SmartMedia card, set up handlers | |
| 82 | 82 | */ |
| 83 | 83 | int ti99_usbsm_reset(running_machine *machine, int in_tms9995_mode) |
| 84 | 84 | { |
| r5932 | r5933 | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /* |
| 100 | ||
| 100 | Read USB-SmartMedia CRU interface | |
| 101 | 101 | */ |
| 102 | 102 | static int usbsm_cru_r(running_machine *machine, int offset) |
| 103 | 103 | { |
| r5932 | r5933 | |
| 109 | 109 | { |
| 110 | 110 | case 0: |
| 111 | 111 | /* |
| 112 | bit | |
| 113 | 0 >1x00 0: USB Host controller requests interrupt. | |
| 114 | 1 >1x02 0: USB Device controller requests interrupt. | |
| 115 | 2 >1x04 1: USB Host controller suspended. | |
| 116 | 3 >1x06 1: USB Device controller suspended. | |
| 117 | 4 >1x08 0: Strata FEEPROM is busy. | |
| 118 | 1: Strata FEEPROM is ready. | |
| 119 | 5 >1x0A 0: SmartMedia card is busy. | |
| 120 | 1: SmartMedia card absent or ready. | |
| 121 | 6 >1x0C 0: No SmartMedia card present. | |
| 122 | 1: A card is in the connector. | |
| 123 | 7 >1x0E 0: SmartMedia card is protected. | |
| 124 | 1: Card absent or not protected. | |
| 125 | */ | |
| 112 | bit | |
| 113 | 0 >1x00 0: USB Host controller requests interrupt. | |
| 114 | 1 >1x02 0: USB Device controller requests interrupt. | |
| 115 | 2 >1x04 1: USB Host controller suspended. | |
| 116 | 3 >1x06 1: USB Device controller suspended. | |
| 117 | 4 >1x08 0: Strata FEEPROM is busy. | |
| 118 | 1: Strata FEEPROM is ready. | |
| 119 | 5 >1x0A 0: SmartMedia card is busy. | |
| 120 | 1: SmartMedia card absent or ready. | |
| 121 | 6 >1x0C 0: No SmartMedia card present. | |
| 122 | 1: A card is in the connector. | |
| 123 | 7 >1x0E 0: SmartMedia card is protected. | |
| 124 | 1: Card absent or not protected. | |
| 125 | */ | |
| 126 | 126 | reply = 0x33; |
| 127 | 127 | if (! smartmedia_present(smartmedia)) |
| 128 | 128 | reply |= 0xc0; |
| r5932 | r5933 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /* |
| 138 | ||
| 138 | Write USB-SmartMedia CRU interface | |
| 139 | 139 | */ |
| 140 | 140 | static void usbsm_cru_w(running_machine *machine, int offset, int data) |
| 141 | 141 | { |
| r5932 | r5933 | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /* |
| 193 | ||
| 193 | read a byte in USB-SmartMedia DSR space | |
| 194 | 194 | */ |
| 195 | 195 | static READ8_HANDLER(usbsm_mem_r) |
| 196 | 196 | { |
| r5932 | r5933 | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /* |
| 207 | ||
| 207 | write a byte in USB-SmartMedia DSR space | |
| 208 | 208 | */ |
| 209 | 209 | static WRITE8_HANDLER(usbsm_mem_w) |
| 210 | 210 | { |
| r5932 | r5933 | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /* |
| 224 | ||
| 224 | demultiplexed read in USB-SmartMedia DSR space | |
| 225 | 225 | */ |
| 226 | 226 | static UINT16 usbsm_mem_16_r(const address_space* space,offs_t offset) |
| 227 | 227 | { |
| r5932 | r5933 | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /* |
| 258 | ||
| 258 | demultiplexed write in USB-SmartMedia DSR space | |
| 259 | 259 | */ |
| 260 | 260 | static void usbsm_mem_16_w(const address_space* space,offs_t offset, UINT16 data) |
| 261 | 261 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Galeb machine driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 23/02/2008 Sound support added. | |
| 6 | 22/02/2008 Preliminary driver. | |
| 7 | ||
| 5 | 23/02/2008 Sound support added. | |
| 6 | 22/02/2008 Preliminary driver. | |
| 7 | ||
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "sound/dac.h" |
| 13 | 13 | #include "includes/galeb.h" |
| 14 | ||
| 14 | ||
| 15 | 15 | /* Driver initialization */ |
| 16 | 16 | DRIVER_INIT(galeb) |
| 17 | 17 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | ||
| 2 | Acorn Electron driver | |
| 3 | 3 | |
| 4 | ||
| 4 | MESS Driver By: | |
| 5 | 5 | |
| 6 | ||
| 6 | Wilbert Pol | |
| 7 | 7 | |
| 8 | 8 | ******************************************************************************/ |
| 9 | 9 | |
| r5932 | r5933 | |
| 15 | 15 | ULA electron_ula; |
| 16 | 16 | static emu_timer *electron_tape_timer; |
| 17 | 17 | |
| 18 | static const device_config *cassette_device_image( running_machine *machine ) | |
| 18 | static const device_config *cassette_device_image( running_machine *machine ) | |
| 19 | 19 | { |
| 20 | 20 | return devtag_get_device(machine, "cassette"); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | static void electron_tape_start( void ) | |
| 23 | static void electron_tape_start( void ) | |
| 24 | 24 | { |
| 25 | if ( electron_ula.tape_running ) | |
| 25 | if ( electron_ula.tape_running ) | |
| 26 | 26 | { |
| 27 | 27 | return; |
| 28 | 28 | } |
| r5932 | r5933 | |
| 34 | 34 | timer_adjust_periodic(electron_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(4800)); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | static void electron_tape_stop( void ) | |
| 37 | static void electron_tape_stop( void ) | |
| 38 | 38 | { |
| 39 | 39 | electron_ula.tape_running = 0; |
| 40 | 40 | timer_reset( electron_tape_timer, attotime_never ); |
| r5932 | r5933 | |
| 45 | 45 | |
| 46 | 46 | static TIMER_CALLBACK(electron_tape_timer_handler) |
| 47 | 47 | { |
| 48 | if ( electron_ula.cassette_motor_mode ) | |
| 48 | if ( electron_ula.cassette_motor_mode ) | |
| 49 | 49 | { |
| 50 | 50 | double tap_val; |
| 51 | 51 | tap_val = cassette_input( cassette_device_image( machine ) ); |
| 52 | if ( tap_val < -0.5 ) | |
| 52 | if ( tap_val < -0.5 ) | |
| 53 | 53 | { |
| 54 | 54 | electron_ula.tape_value = ( electron_ula.tape_value << 8 ) | TAPE_LOW; |
| 55 | 55 | electron_ula.tape_steps++; |
| 56 | } | |
| 57 | else if ( tap_val > 0.5 ) | |
| 56 | } | |
| 57 | else if ( tap_val > 0.5 ) | |
| 58 | 58 | { |
| 59 | 59 | electron_ula.tape_value = ( electron_ula.tape_value << 8 ) | TAPE_HIGH; |
| 60 | 60 | electron_ula.tape_steps++; |
| 61 | } | |
| 62 | else | |
| 61 | } | |
| 62 | else | |
| 63 | 63 | { |
| 64 | 64 | electron_ula.tape_steps = 0; |
| 65 | 65 | electron_ula.bit_count = 0; |
| 66 | 66 | electron_ula.high_tone_set = 0; |
| 67 | 67 | electron_ula.tape_value = 0x80808080; |
| 68 | 68 | } |
| 69 | if ( electron_ula.tape_steps > 2 && ( electron_ula.tape_value == 0x0000FFFF || electron_ula.tape_value == 0x00FF00FF ) ) | |
| 69 | if ( electron_ula.tape_steps > 2 && ( electron_ula.tape_value == 0x0000FFFF || electron_ula.tape_value == 0x00FF00FF ) ) | |
| 70 | 70 | { |
| 71 | 71 | electron_ula.tape_steps = 0; |
| 72 | switch( electron_ula.bit_count ) | |
| 72 | switch( electron_ula.bit_count ) | |
| 73 | 73 | { |
| 74 | 74 | case 0: /* start bit */ |
| 75 | 75 | electron_ula.start_bit = ( ( electron_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); |
| 76 | 76 | //logerror( "++ Read start bit: %d\n", electron_ula.start_bit ); |
| 77 | if ( electron_ula.start_bit ) | |
| 77 | if ( electron_ula.start_bit ) | |
| 78 | 78 | { |
| 79 | if ( electron_ula.high_tone_set ) | |
| 79 | if ( electron_ula.high_tone_set ) | |
| 80 | 80 | { |
| 81 | 81 | electron_ula.bit_count--; |
| 82 | 82 | } |
| 83 | } | |
| 84 | else | |
| 83 | } | |
| 84 | else | |
| 85 | 85 | { |
| 86 | 86 | electron_ula.high_tone_set = 0; |
| 87 | 87 | } |
| r5932 | r5933 | |
| 94 | 94 | case 9: /* stop bit */ |
| 95 | 95 | electron_ula.stop_bit = ( ( electron_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); |
| 96 | 96 | //logerror( "++ Read stop bit: %d\n", electron_ula.stop_bit ); |
| 97 | if ( electron_ula.start_bit && electron_ula.stop_bit && electron_ula.tape_byte == 0xFF && ! electron_ula.high_tone_set ) | |
| 97 | if ( electron_ula.start_bit && electron_ula.stop_bit && electron_ula.tape_byte == 0xFF && ! electron_ula.high_tone_set ) | |
| 98 | 98 | { |
| 99 | 99 | electron_interrupt_handler( machine, INT_SET, INT_HIGH_TONE ); |
| 100 | 100 | electron_ula.high_tone_set = 1; |
| 101 | } | |
| 102 | else if ( ! electron_ula.start_bit && electron_ula.stop_bit ) | |
| 101 | } | |
| 102 | else if ( ! electron_ula.start_bit && electron_ula.stop_bit ) | |
| 103 | 103 | { |
| 104 | 104 | //logerror( "-- Byte read from tape: %02x\n", electron_ula.tape_byte ); |
| 105 | 105 | electron_interrupt_handler( machine, INT_SET, INT_RECEIVE_FULL ); |
| 106 | } | |
| 107 | else | |
| 106 | } | |
| 107 | else | |
| 108 | 108 | { |
| 109 | 109 | logerror( "Invalid start/stop bit combination detected: %d,%d\n", electron_ula.start_bit, electron_ula.stop_bit ); |
| 110 | 110 | } |
| r5932 | r5933 | |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | static READ8_HANDLER( electron_read_keyboard ) | |
| 118 | static READ8_HANDLER( electron_read_keyboard ) | |
| 119 | 119 | { |
| 120 | 120 | UINT8 data = 0; |
| 121 | 121 | int i; |
| 122 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", | |
| 122 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", | |
| 123 | 123 | "LINE7", "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13" }; |
| 124 | ||
| 124 | ||
| 125 | 125 | //logerror( "PC=%04x: keyboard read from paged rom area, address: %04x", activecpu_get_pc(), offset ); |
| 126 | for( i = 0; i < 14; i++ ) | |
| 126 | for( i = 0; i < 14; i++ ) | |
| 127 | 127 | { |
| 128 | if( !(offset & 1) ) | |
| 128 | if( !(offset & 1) ) | |
| 129 | 129 | data |= input_port_read(space->machine, keynames[i]) & 0x0f; |
| 130 | 130 | |
| 131 | 131 | offset = offset >> 1; |
| r5932 | r5933 | |
| 134 | 134 | return data; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | READ8_HANDLER( electron_jim_r ) | |
| 137 | READ8_HANDLER( electron_jim_r ) | |
| 138 | 138 | { |
| 139 | 139 | return 0xff; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | WRITE8_HANDLER( electron_jim_w ) | |
| 142 | WRITE8_HANDLER( electron_jim_w ) | |
| 143 | 143 | { |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | READ8_HANDLER( electron_1mhz_r ) | |
| 146 | READ8_HANDLER( electron_1mhz_r ) | |
| 147 | 147 | { |
| 148 | 148 | return 0xff; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | WRITE8_HANDLER( electron_1mhz_w ) | |
| 151 | WRITE8_HANDLER( electron_1mhz_w ) | |
| 152 | 152 | { |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | READ8_HANDLER( electron_ula_r ) | |
| 155 | READ8_HANDLER( electron_ula_r ) | |
| 156 | 156 | { |
| 157 | 157 | UINT8 data = ((UINT8 *)memory_region(space->machine, "user1"))[0x43E00 + offset]; |
| 158 | switch ( offset & 0x0f ) | |
| 158 | switch ( offset & 0x0f ) | |
| 159 | 159 | { |
| 160 | 160 | case 0x00: /* Interrupt status */ |
| 161 | 161 | data = electron_ula.interrupt_status; |
| r5932 | r5933 | |
| 180 | 180 | const device_config *speaker = devtag_get_device(space->machine, "beep"); |
| 181 | 181 | int i = electron_palette_offset[(( offset >> 1 ) & 0x03)]; |
| 182 | 182 | logerror( "ULA: write offset %02x <- %02x\n", offset & 0x0f, data ); |
| 183 | switch( offset & 0x0f ) | |
| 183 | switch( offset & 0x0f ) | |
| 184 | 184 | { |
| 185 | 185 | case 0x00: /* Interrupt control */ |
| 186 | 186 | electron_ula.interrupt_control = data; |
| r5932 | r5933 | |
| 199 | 199 | break; |
| 200 | 200 | case 0x05: /* Interrupt clear and paging */ |
| 201 | 201 | /* rom page requests are honoured when currently bank 0-7 or 12-15 is switched in, |
| 202 | * or when 8-11 is currently switched in only switching to bank 8-15 is allowed. | |
| 203 | * | |
| 204 | * Rompages 10 and 11 both select the Basic ROM. | |
| 205 | * Rompages 8 and 9 both select the keyboard. | |
| 206 | */ | |
| 207 | if ( ( ( electron_ula.rompage & 0x0C ) != 0x08 ) || ( data & 0x08 ) ) | |
| 202 | * or when 8-11 is currently switched in only switching to bank 8-15 is allowed. | |
| 203 | * | |
| 204 | * Rompages 10 and 11 both select the Basic ROM. | |
| 205 | * Rompages 8 and 9 both select the keyboard. | |
| 206 | */ | |
| 207 | if ( ( ( electron_ula.rompage & 0x0C ) != 0x08 ) || ( data & 0x08 ) ) | |
| 208 | 208 | { |
| 209 | 209 | electron_ula.rompage = data & 0x0f; |
| 210 | if ( electron_ula.rompage == 8 || electron_ula.rompage == 9 ) | |
| 210 | if ( electron_ula.rompage == 8 || electron_ula.rompage == 9 ) | |
| 211 | 211 | { |
| 212 | 212 | electron_ula.rompage = 8; |
| 213 | 213 | memory_install_read8_handler( space, 0x8000, 0xbfff, 0, 0, electron_read_keyboard ); |
| 214 | } | |
| 215 | else | |
| 214 | } | |
| 215 | else | |
| 216 | 216 | { |
| 217 | 217 | memory_install_read8_handler( space, 0x8000, 0xbfff, 0, 0, SMH_BANK(2) ); |
| 218 | 218 | } |
| 219 | 219 | memory_set_bank(space->machine, 2, electron_ula.rompage); |
| 220 | 220 | } |
| 221 | if ( data & 0x10 ) | |
| 221 | if ( data & 0x10 ) | |
| 222 | 222 | { |
| 223 | 223 | electron_interrupt_handler( space->machine, INT_CLEAR, INT_DISPLAY_END ); |
| 224 | 224 | } |
| 225 | if ( data & 0x20 ) | |
| 225 | if ( data & 0x20 ) | |
| 226 | 226 | { |
| 227 | 227 | electron_interrupt_handler( space->machine, INT_CLEAR, INT_RTC ); |
| 228 | 228 | } |
| 229 | if ( data & 0x40 ) | |
| 229 | if ( data & 0x40 ) | |
| 230 | 230 | { |
| 231 | 231 | electron_interrupt_handler( space->machine, INT_CLEAR, INT_HIGH_TONE ); |
| 232 | 232 | } |
| 233 | if ( data & 0x80 ) | |
| 233 | if ( data & 0x80 ) | |
| 234 | 234 | { |
| 235 | 235 | } |
| 236 | 236 | break; |
| 237 | 237 | case 0x06: /* Counter divider */ |
| 238 | if ( electron_ula.communication_mode == 0x01) | |
| 238 | if ( electron_ula.communication_mode == 0x01) | |
| 239 | 239 | { |
| 240 | 240 | beep_set_frequency( speaker, 1000000 / ( 16 * ( data + 1 ) ) ); |
| 241 | 241 | } |
| 242 | 242 | break; |
| 243 | 243 | case 0x07: /* Misc. */ |
| 244 | 244 | electron_ula.communication_mode = ( data >> 1 ) & 0x03; |
| 245 | switch( electron_ula.communication_mode ) | |
| 245 | switch( electron_ula.communication_mode ) | |
| 246 | 246 | { |
| 247 | 247 | case 0x00: /* cassette input */ |
| 248 | 248 | beep_set_state( speaker, 0 ); |
| r5932 | r5933 | |
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | void electron_interrupt_handler(running_machine *machine, int mode, int interrupt) | |
| 290 | void electron_interrupt_handler(running_machine *machine, int mode, int interrupt) | |
| 291 | 291 | { |
| 292 | if ( mode == INT_SET ) | |
| 292 | if ( mode == INT_SET ) | |
| 293 | 293 | { |
| 294 | 294 | electron_ula.interrupt_status |= interrupt; |
| 295 | } | |
| 296 | else | |
| 295 | } | |
| 296 | else | |
| 297 | 297 | { |
| 298 | 298 | electron_ula.interrupt_status &= ~interrupt; |
| 299 | 299 | } |
| 300 | if ( electron_ula.interrupt_status & electron_ula.interrupt_control & ~0x83 ) | |
| 300 | if ( electron_ula.interrupt_status & electron_ula.interrupt_control & ~0x83 ) | |
| 301 | 301 | { |
| 302 | 302 | electron_ula.interrupt_status |= 0x01; |
| 303 | 303 | cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE ); |
| 304 | } | |
| 305 | else | |
| 304 | } | |
| 305 | else | |
| 306 | 306 | { |
| 307 | 307 | electron_ula.interrupt_status &= ~0x01; |
| 308 | 308 | cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE ); |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | machine/pc_hdc.c |
| 4 | 4 | |
| 5 | ||
| 5 | Functions to emulate a WD1004A-WXI hard disk controller | |
| 6 | 6 | |
| 7 | Information was gathered from various places: | |
| 8 | Linux' /usr/src/linux/drivers/block/xd.c and /usr/include/linux/xd.h | |
| 9 | Original IBM PC-XT technical data book | |
| 10 | The WD1004A-WXI BIOS ROM image | |
| 7 | Information was gathered from various places: | |
| 8 | Linux' /usr/src/linux/drivers/block/xd.c and /usr/include/linux/xd.h | |
| 9 | Original IBM PC-XT technical data book | |
| 10 | The WD1004A-WXI BIOS ROM image | |
| 11 | 11 | |
| 12 | 12 | TODO: |
| 13 | Still very much :) | |
| 14 | The format of the so called 'POD' (power on drive paramters?) area | |
| 15 | read from the MBR (master boot record) at offset 1AD to 1BD is wrong. | |
| 13 | Still very much :) | |
| 14 | The format of the so called 'POD' (power on drive paramters?) area | |
| 15 | read from the MBR (master boot record) at offset 1AD to 1BD is wrong. | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | |
| 19 | There were a lot of different Fixed Disk Adapter for the IBM pcs. | |
| 20 | Xebec produced a couple of the Fixed Disk Adapter for IBM. | |
| 21 | ||
| 22 | One Xebec Adapter has these roms on it: | |
| 23 | One MK6xxxx ROM: 62X0822__(M)_AMI_8621MAB__S68B364-P__(C)IBM_CORP_1982,1985__PHILIPPINES.12D.2364.bin | |
| 24 | One 2732 ROM for the Z80: 104839RE__COPYRIGHT__XEBEC_1986.12A.2732.bin | |
| 19 | There were a lot of different Fixed Disk Adapter for the IBM pcs. | |
| 20 | Xebec produced a couple of the Fixed Disk Adapter for IBM. | |
| 25 | 21 | |
| 22 | One Xebec Adapter has these roms on it: | |
| 23 | One MK6xxxx ROM: 62X0822__(M)_AMI_8621MAB__S68B364-P__(C)IBM_CORP_1982,1985__PHILIPPINES.12D.2364.bin | |
| 24 | One 2732 ROM for the Z80: 104839RE__COPYRIGHT__XEBEC_1986.12A.2732.bin | |
| 26 | 25 | |
| 27 | tandon Fixed Disk Adapter found in an IBM 5150: | |
| 28 | 600963-001__TYPE_5.U12.2764.bin | |
| 29 | 26 | |
| 27 | tandon Fixed Disk Adapter found in an IBM 5150: | |
| 28 | 600963-001__TYPE_5.U12.2764.bin | |
| 29 | ||
| 30 | 30 | ***************************************************************************/ |
| 31 | 31 | |
| 32 | 32 | #include "driver.h" |
| r5932 | r5933 | |
| 230 | 230 | |
| 231 | 231 | if ( img == NULL ) |
| 232 | 232 | return NULL; |
| 233 | ||
| 233 | ||
| 234 | 234 | if (!image_exists(img)) |
| 235 | 235 | return NULL; |
| 236 | 236 | |
| r5932 | r5933 | |
| 596 | 596 | |
| 597 | 597 | |
| 598 | 598 | /* Command format |
| 599 | * Bits Description | |
| 600 | * 7 0 | |
| 601 | * xxxxxxxx command | |
| 602 | * dddhhhhh drive / head | |
| 603 | * ccssssss cylinder h / sector | |
| 604 | * cccccccc cylinder l | |
| 605 | * nnnnnnnn count | |
| 606 | * xxxxxxxx control | |
| 599 | * Bits Description | |
| 600 | * 7 0 | |
| 601 | * xxxxxxxx command | |
| 602 | * dddhhhhh drive / head | |
| 603 | * ccssssss cylinder h / sector | |
| 604 | * cccccccc cylinder l | |
| 605 | * nnnnnnnn count | |
| 606 | * xxxxxxxx control | |
| 607 | 607 | * |
| 608 | * Command format extra for set drive characteristics | |
| 609 | * 000000cc cylinders h | |
| 610 | * cccccccc cylinders l | |
| 611 | * 000hhhhh heads | |
| 612 | * 000000cc reduced write h | |
| 613 | * cccccccc reduced write l | |
| 614 | * 000000cc write precomp h | |
| 615 | * cccccccc write precomp l | |
| 616 | * eeeeeeee ecc | |
| 608 | * Command format extra for set drive characteristics | |
| 609 | * 000000cc cylinders h | |
| 610 | * cccccccc cylinders l | |
| 611 | * 000hhhhh heads | |
| 612 | * 000000cc reduced write h | |
| 613 | * cccccccc reduced write l | |
| 614 | * 000000cc write precomp h | |
| 615 | * cccccccc write precomp l | |
| 616 | * eeeeeeee ecc | |
| 617 | 617 | */ |
| 618 | 618 | static void pc_hdc_data_w(running_machine *machine, int n, int data) |
| 619 | 619 | { |
| r5932 | r5933 | |
| 755 | 755 | |
| 756 | 756 | |
| 757 | 757 | /* |
| 758 | ||
| 758 | Dipswitch configuration | |
| 759 | 759 | |
| 760 | 760 | |
| 761 | Tandon/Western Digital Fixed Disk Controller | |
| 762 | bit0-1 : Determine disk size(?) | |
| 763 | Causes geometry data to be read from c8043, c8053, c8063, c8073 (?) | |
| 764 | 00 - 40 Mbytes | |
| 765 | 01 - 30 Mbytes | |
| 766 | 10 - 10 Mbytes | |
| 767 | 11 - 20 Mbytes | |
| 768 | bit2-7 : unknown | |
| 761 | Tandon/Western Digital Fixed Disk Controller | |
| 762 | bit0-1 : Determine disk size(?) | |
| 763 | Causes geometry data to be read from c8043, c8053, c8063, c8073 (?) | |
| 764 | 00 - 40 Mbytes | |
| 765 | 01 - 30 Mbytes | |
| 766 | 10 - 10 Mbytes | |
| 767 | 11 - 20 Mbytes | |
| 768 | bit2-7 : unknown | |
| 769 | 769 | |
| 770 | 770 | */ |
| 771 | 771 | |
| r5932 | r5933 | |
| 779 | 779 | |
| 780 | 780 | /************************************************************************* |
| 781 | 781 | * |
| 782 | * HDC | |
| 783 | * hard disk controller | |
| 782 | * HDC | |
| 783 | * hard disk controller | |
| 784 | 784 | * |
| 785 | 785 | *************************************************************************/ |
| 786 | 786 | |
| r5932 | r5933 | |
| 821 | 821 | |
| 822 | 822 | /************************************* |
| 823 | 823 | * |
| 824 | * | |
| 824 | * Port handlers | |
| 825 | 825 | * |
| 826 | 826 | *************************************/ |
| 827 | 827 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Orion machine driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 22/04/2008 Orion Pro added | |
| 6 | 02/04/2008 Preliminary driver. | |
| 7 | ||
| 5 | 22/04/2008 Orion Pro added | |
| 6 | 02/04/2008 Preliminary driver. | |
| 7 | ||
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | |
| r5932 | r5933 | |
| 36 | 36 | |
| 37 | 37 | static READ8_DEVICE_HANDLER (orion_romdisk_porta_r ) |
| 38 | 38 | { |
| 39 | UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x10000; | |
| 40 | return romdisk[romdisk_msb*256+romdisk_lsb]; | |
| 39 | UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x10000; | |
| 40 | return romdisk[romdisk_msb*256+romdisk_lsb]; | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | static WRITE8_DEVICE_HANDLER (orion_romdisk_portb_w ) |
| 44 | { | |
| 44 | { | |
| 45 | 45 | romdisk_lsb = data; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | static WRITE8_DEVICE_HANDLER (orion_romdisk_portc_w ) |
| 49 | { | |
| 50 | romdisk_msb = data; | |
| 49 | { | |
| 50 | romdisk_msb = data; | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | I8255A_INTERFACE( orion128_ppi8255_interface_1) |
| r5932 | r5933 | |
| 71 | 71 | { |
| 72 | 72 | const device_config *fdc = devtag_get_device(machine, "wd1793"); |
| 73 | 73 | |
| 74 | wd17xx_set_density (fdc,DEN_FM_HI); | |
| 74 | wd17xx_set_density (fdc,DEN_FM_HI); | |
| 75 | 75 | orion_video_mode_mask = 7; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | READ8_HANDLER ( orion128_system_r ) | |
| 78 | READ8_HANDLER ( orion128_system_r ) | |
| 79 | 79 | { |
| 80 | 80 | return i8255a_r(devtag_get_device(space->machine, "ppi8255_2"), offset & 3); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | WRITE8_HANDLER ( orion128_system_w ) | |
| 83 | WRITE8_HANDLER ( orion128_system_w ) | |
| 84 | 84 | { |
| 85 | i8255a_w(devtag_get_device(space->machine, "ppi8255_2"), offset & 3, data); | |
| 85 | i8255a_w(devtag_get_device(space->machine, "ppi8255_2"), offset & 3, data); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | READ8_HANDLER ( orion128_romdisk_r ) | |
| 88 | READ8_HANDLER ( orion128_romdisk_r ) | |
| 89 | 89 | { |
| 90 | return i8255a_r(devtag_get_device(space->machine, "ppi8255_1"), offset & 3); | |
| 90 | return i8255a_r(devtag_get_device(space->machine, "ppi8255_1"), offset & 3); | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | WRITE8_HANDLER ( orion128_romdisk_w ) | |
| 94 | { | |
| 95 | i8255a_w(devtag_get_device(space->machine, "ppi8255_1"), offset & 3, data); | |
| 93 | WRITE8_HANDLER ( orion128_romdisk_w ) | |
| 94 | { | |
| 95 | i8255a_w(devtag_get_device(space->machine, "ppi8255_1"), offset & 3, data); | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | static void orion_set_video_mode(running_machine *machine, int width) | |
| 98 | static void orion_set_video_mode(running_machine *machine, int width) | |
| 99 | 99 | { |
| 100 | 100 | rectangle visarea; |
| 101 | ||
| 101 | ||
| 102 | 102 | visarea.min_x = 0; |
| 103 | 103 | visarea.min_y = 0; |
| 104 | 104 | visarea.max_x = width-1; |
| 105 | visarea.max_y = 255; | |
| 106 | video_screen_configure(machine->primary_screen, width, 256, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); | |
| 105 | visarea.max_y = 255; | |
| 106 | video_screen_configure(machine->primary_screen, width, 256, &visarea, video_screen_get_frame_period(machine->primary_screen).attoseconds); | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | WRITE8_HANDLER ( orion128_video_mode_w ) |
| 110 | { | |
| 111 | if ((data & 0x80)!=(orion128_video_mode & 0x80)) | |
| 110 | { | |
| 111 | if ((data & 0x80)!=(orion128_video_mode & 0x80)) | |
| 112 | 112 | { |
| 113 | if ((data & 0x80)==0x80) | |
| 113 | if ((data & 0x80)==0x80) | |
| 114 | 114 | { |
| 115 | if (orion_video_mode_mask == 31) | |
| 115 | if (orion_video_mode_mask == 31) | |
| 116 | 116 | { |
| 117 | 117 | orion128_video_width = SCREEN_WIDTH_512; |
| 118 | orion_set_video_mode(space->machine,512); | |
| 119 | } | |
| 120 | else | |
| 118 | orion_set_video_mode(space->machine,512); | |
| 119 | } | |
| 120 | else | |
| 121 | 121 | { |
| 122 | 122 | orion128_video_width = SCREEN_WIDTH_480; |
| 123 | orion_set_video_mode(space->machine,480); | |
| 124 | } | |
| 125 | } | |
| 126 | else | |
| 123 | orion_set_video_mode(space->machine,480); | |
| 124 | } | |
| 125 | } | |
| 126 | else | |
| 127 | 127 | { |
| 128 | 128 | orion128_video_width = SCREEN_WIDTH_384; |
| 129 | 129 | orion_set_video_mode(space->machine,384); |
| 130 | 130 | } |
| 131 | } | |
| 132 | ||
| 131 | } | |
| 132 | ||
| 133 | 133 | orion128_video_mode = data; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | WRITE8_HANDLER ( orion128_video_page_w ) |
| 137 | { | |
| 138 | if (orion128_video_page != data) | |
| 137 | { | |
| 138 | if (orion128_video_page != data) | |
| 139 | 139 | { |
| 140 | if ((data & 0x80)!=(orion128_video_page & 0x80)) | |
| 140 | if ((data & 0x80)!=(orion128_video_page & 0x80)) | |
| 141 | 141 | { |
| 142 | if ((data & 0x80)==0x80) | |
| 142 | if ((data & 0x80)==0x80) | |
| 143 | 143 | { |
| 144 | if (orion_video_mode_mask == 31) | |
| 144 | if (orion_video_mode_mask == 31) | |
| 145 | 145 | { |
| 146 | 146 | orion128_video_width = SCREEN_WIDTH_512; |
| 147 | orion_set_video_mode(space->machine,512); | |
| 148 | } | |
| 149 | else | |
| 147 | orion_set_video_mode(space->machine,512); | |
| 148 | } | |
| 149 | else | |
| 150 | 150 | { |
| 151 | 151 | orion128_video_width = SCREEN_WIDTH_480; |
| 152 | orion_set_video_mode(space->machine,480); | |
| 153 | } | |
| 154 | } | |
| 155 | else | |
| 152 | orion_set_video_mode(space->machine,480); | |
| 153 | } | |
| 154 | } | |
| 155 | else | |
| 156 | 156 | { |
| 157 | 157 | orion128_video_width = SCREEN_WIDTH_384; |
| 158 | 158 | orion_set_video_mode(space->machine,384); |
| 159 | 159 | } |
| 160 | } | |
| 160 | } | |
| 161 | 161 | } |
| 162 | 162 | orion128_video_page = data; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | WRITE8_HANDLER ( orion128_memory_page_w ) |
| 167 | { | |
| 168 | if (data!=orion128_memory_page ) | |
| 167 | { | |
| 168 | if (data!=orion128_memory_page ) | |
| 169 | 169 | { |
| 170 | 170 | memory_set_bankptr(space->machine, 1, mess_ram + (data & 3) * 0x10000); |
| 171 | 171 | orion128_memory_page = (data & 3); |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | MACHINE_RESET ( orion128 ) | |
| 176 | { | |
| 175 | MACHINE_RESET ( orion128 ) | |
| 176 | { | |
| 177 | 177 | orion128_video_page = 0; |
| 178 | 178 | orion128_video_mode = 0; |
| 179 | 179 | orion128_memory_page = -1; |
| r5932 | r5933 | |
| 189 | 189 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 190 | 190 | |
| 191 | 191 | wd17xx_set_side(fdc,((data & 0x10) >> 4) ^ 1); |
| 192 | wd17xx_set_drive(fdc,data & 3); | |
| 192 | wd17xx_set_drive(fdc,data & 3); | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | READ8_HANDLER ( orion128_floppy_r ) |
| 196 | { | |
| 196 | { | |
| 197 | 197 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 198 | 198 | |
| 199 | switch(offset) | |
| 199 | switch(offset) | |
| 200 | 200 | { |
| 201 | 201 | case 0x0 : |
| 202 | 202 | case 0x10 : return wd17xx_status_r(fdc,0); |
| r5932 | r5933 | |
| 206 | 206 | case 0x12 : return wd17xx_sector_r(fdc,0); |
| 207 | 207 | case 0x3 : |
| 208 | 208 | case 0x13 : return wd17xx_data_r(fdc,0); |
| 209 | } | |
| 209 | } | |
| 210 | 210 | return 0xff; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | WRITE8_HANDLER ( orion128_floppy_w ) |
| 214 | { | |
| 214 | { | |
| 215 | 215 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 216 | ||
| 217 | switch(offset) | |
| 216 | ||
| 217 | switch(offset) | |
| 218 | 218 | { |
| 219 | 219 | case 0x0 : |
| 220 | 220 | case 0x10 : wd17xx_command_w(fdc,0,data); break; |
| r5932 | r5933 | |
| 224 | 224 | case 0x12 : wd17xx_sector_w(fdc,0,data);break; |
| 225 | 225 | case 0x3 : |
| 226 | 226 | case 0x13 : wd17xx_data_w(fdc,0,data);break; |
| 227 | case 0x4 : | |
| 228 | case 0x14 : | |
| 227 | case 0x4 : | |
| 228 | case 0x14 : | |
| 229 | 229 | case 0x20 : orion_disk_control_w(space, offset, data);break; |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | static READ8_HANDLER ( orionz80_floppy_rtc_r ) |
| 233 | { | |
| 234 | if ((offset >= 0x60) && (offset <= 0x6f)) | |
| 233 | { | |
| 234 | if ((offset >= 0x60) && (offset <= 0x6f)) | |
| 235 | 235 | { |
| 236 | 236 | return mc146818_port_r(space,offset-0x60); |
| 237 | } | |
| 238 | else | |
| 239 | { | |
| 237 | } | |
| 238 | else | |
| 239 | { | |
| 240 | 240 | return orion128_floppy_r(space,offset); |
| 241 | } | |
| 241 | } | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | static WRITE8_HANDLER ( orionz80_floppy_rtc_w ) |
| 245 | { | |
| 246 | if ((offset >= 0x60) && (offset <= 0x6f)) | |
| 245 | { | |
| 246 | if ((offset >= 0x60) && (offset <= 0x6f)) | |
| 247 | 247 | { |
| 248 | 248 | mc146818_port_w(space,offset-0x60,data); |
| 249 | } | |
| 250 | else | |
| 249 | } | |
| 250 | else | |
| 251 | 251 | { |
| 252 | 252 | orion128_floppy_w(space,offset,data); |
| 253 | } | |
| 253 | } | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | DRIVER_INIT( orionz80 ) |
| 258 | 258 | { |
| 259 | memset(mess_ram,0,512*1024); | |
| 259 | memset(mess_ram,0,512*1024); | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
| r5932 | r5933 | |
| 271 | 271 | |
| 272 | 272 | static UINT8 orion_speaker; |
| 273 | 273 | WRITE8_HANDLER ( orionz80_sound_w ) |
| 274 | { | |
| 274 | { | |
| 275 | 275 | const device_config *speaker = devtag_get_device(space->machine, "speaker"); |
| 276 | if (orion_speaker == 0) | |
| 276 | if (orion_speaker == 0) | |
| 277 | 277 | { |
| 278 | orion_speaker = data; | |
| 279 | } | |
| 280 | else | |
| 278 | orion_speaker = data; | |
| 279 | } | |
| 280 | else | |
| 281 | 281 | { |
| 282 | orion_speaker = 0 ; | |
| 282 | orion_speaker = 0 ; | |
| 283 | 283 | } |
| 284 | 284 | speaker_level_w(speaker,orion_speaker); |
| 285 | ||
| 285 | ||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | static WRITE8_HANDLER ( orionz80_sound_fe_w ) |
| 289 | { | |
| 289 | { | |
| 290 | 290 | const device_config *speaker = devtag_get_device(space->machine, "speaker"); |
| 291 | 291 | speaker_level_w(speaker,(data>>4) & 0x01); |
| 292 | 292 | } |
| r5932 | r5933 | |
| 297 | 297 | UINT8 bank_select; |
| 298 | 298 | UINT8 segment_select; |
| 299 | 299 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 300 | ||
| 300 | ||
| 301 | 301 | bank_select = (orionz80_dispatcher & 0x0c) >> 2; |
| 302 | 302 | segment_select = orionz80_dispatcher & 0x03; |
| 303 | ||
| 303 | ||
| 304 | 304 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| 305 | if ((orionz80_dispatcher & 0x80)==0) | |
| 305 | if ((orionz80_dispatcher & 0x80)==0) | |
| 306 | 306 | { // dispatcher on |
| 307 | memory_set_bankptr(machine, 1, mess_ram + 0x10000 * bank_select + segment_select * 0x4000 ); | |
| 308 | } | |
| 309 | else | |
| 307 | memory_set_bankptr(machine, 1, mess_ram + 0x10000 * bank_select + segment_select * 0x4000 ); | |
| 308 | } | |
| 309 | else | |
| 310 | 310 | { // dispatcher off |
| 311 | memory_set_bankptr(machine, 1, mess_ram + 0x10000 * orionz80_memory_page); | |
| 311 | memory_set_bankptr(machine, 1, mess_ram + 0x10000 * orionz80_memory_page); | |
| 312 | 312 | } |
| 313 | ||
| 314 | memory_set_bankptr(machine, 2, mess_ram + 0x4000 + 0x10000 * orionz80_memory_page); | |
| 315 | ||
| 316 | if ((orionz80_dispatcher & 0x20) == 0) | |
| 313 | ||
| 314 | memory_set_bankptr(machine, 2, mess_ram + 0x4000 + 0x10000 * orionz80_memory_page); | |
| 315 | ||
| 316 | if ((orionz80_dispatcher & 0x20) == 0) | |
| 317 | 317 | { |
| 318 | 318 | memory_install_write8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_w); |
| 319 | 319 | memory_install_write8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_w); |
| 320 | memory_install_write8_handler(space, 0xf700, 0xf7ff, 0, 0, orionz80_floppy_rtc_w); | |
| 320 | memory_install_write8_handler(space, 0xf700, 0xf7ff, 0, 0, orionz80_floppy_rtc_w); | |
| 321 | 321 | memory_install_read8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_r); |
| 322 | 322 | memory_install_read8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_r); |
| 323 | memory_install_read8_handler(space, 0xf700, 0xf7ff, 0, 0, orionz80_floppy_rtc_r); | |
| 324 | ||
| 323 | memory_install_read8_handler(space, 0xf700, 0xf7ff, 0, 0, orionz80_floppy_rtc_r); | |
| 324 | ||
| 325 | 325 | memory_install_write8_handler(space, 0xf800, 0xf8ff, 0, 0, orion128_video_mode_w); |
| 326 | 326 | memory_install_write8_handler(space, 0xf900, 0xf9ff, 0, 0, orionz80_memory_page_w); |
| 327 | 327 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, orion128_video_page_w); |
| 328 | 328 | memory_install_write8_handler(space, 0xfb00, 0xfbff, 0, 0, orionz80_dispatcher_w); |
| 329 | 329 | memory_install_write8_handler(space, 0xfc00, 0xfeff, 0, 0, SMH_UNMAP); |
| 330 | 330 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, orionz80_sound_w); |
| 331 | ||
| 332 | memory_set_bankptr(machine, 3, mess_ram + 0xf000); | |
| 333 | memory_set_bankptr(machine, 5, memory_region(machine, "maincpu") + 0xf800); | |
| 334 | ||
| 335 | } | |
| 336 | else | |
| 331 | ||
| 332 | memory_set_bankptr(machine, 3, mess_ram + 0xf000); | |
| 333 | memory_set_bankptr(machine, 5, memory_region(machine, "maincpu") + 0xf800); | |
| 334 | ||
| 335 | } | |
| 336 | else | |
| 337 | 337 | { |
| 338 | 338 | /* if it is full memory access */ |
| 339 | memory_set_bankptr(machine, 3, mess_ram + 0xf000 + 0x10000 * orionz80_memory_page); | |
| 340 | memory_set_bankptr(machine, 4, mess_ram + 0xf400 + 0x10000 * orionz80_memory_page); | |
| 341 | memory_set_bankptr(machine, 5, mess_ram + 0xf800 + 0x10000 * orionz80_memory_page); | |
| 342 | } | |
| 339 | memory_set_bankptr(machine, 3, mess_ram + 0xf000 + 0x10000 * orionz80_memory_page); | |
| 340 | memory_set_bankptr(machine, 4, mess_ram + 0xf400 + 0x10000 * orionz80_memory_page); | |
| 341 | memory_set_bankptr(machine, 5, mess_ram + 0xf800 + 0x10000 * orionz80_memory_page); | |
| 342 | } | |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | WRITE8_HANDLER ( orionz80_memory_page_w ) |
| 346 | { | |
| 346 | { | |
| 347 | 347 | orionz80_memory_page = data & 7; |
| 348 | 348 | orionz80_switch_bank(space->machine); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | WRITE8_HANDLER ( orionz80_dispatcher_w ) |
| 352 | { | |
| 352 | { | |
| 353 | 353 | orionz80_dispatcher = data; |
| 354 | 354 | orionz80_switch_bank(space->machine); |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | MACHINE_RESET ( orionz80 ) | |
| 358 | { | |
| 357 | MACHINE_RESET ( orionz80 ) | |
| 358 | { | |
| 359 | 359 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 360 | ||
| 360 | ||
| 361 | 361 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 362 | 362 | memory_install_write8_handler(space, 0x4000, 0xefff, 0, 0, SMH_BANK(2)); |
| 363 | 363 | memory_install_write8_handler(space, 0xf000, 0xf3ff, 0, 0, SMH_BANK(3)); |
| 364 | 364 | |
| 365 | 365 | memory_install_write8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_w); |
| 366 | 366 | memory_install_write8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_w); |
| 367 | memory_install_write8_handler(space, 0xf700, 0xf7ff, 0, 0, orionz80_floppy_rtc_w); | |
| 367 | memory_install_write8_handler(space, 0xf700, 0xf7ff, 0, 0, orionz80_floppy_rtc_w); | |
| 368 | 368 | memory_install_read8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_r); |
| 369 | 369 | memory_install_read8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_r); |
| 370 | memory_install_read8_handler(space, 0xf700, 0xf7ff, 0, 0, orionz80_floppy_rtc_r); | |
| 371 | ||
| 370 | memory_install_read8_handler(space, 0xf700, 0xf7ff, 0, 0, orionz80_floppy_rtc_r); | |
| 371 | ||
| 372 | 372 | memory_install_write8_handler(space, 0xf800, 0xf8ff, 0, 0, orion128_video_mode_w); |
| 373 | 373 | memory_install_write8_handler(space, 0xf900, 0xf9ff, 0, 0, orionz80_memory_page_w); |
| 374 | 374 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, orion128_video_page_w); |
| 375 | 375 | memory_install_write8_handler(space, 0xfb00, 0xfbff, 0, 0, orionz80_dispatcher_w); |
| 376 | 376 | memory_install_write8_handler(space, 0xfc00, 0xfeff, 0, 0, SMH_UNMAP); |
| 377 | 377 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, orionz80_sound_w); |
| 378 | ||
| 379 | ||
| 380 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0xf800); | |
| 381 | memory_set_bankptr(machine, 2, mess_ram + 0x4000); | |
| 382 | memory_set_bankptr(machine, 3, mess_ram + 0xf000); | |
| 383 | memory_set_bankptr(machine, 5, memory_region(machine, "maincpu") + 0xf800); | |
| 384 | ||
| 385 | 378 | |
| 379 | ||
| 380 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0xf800); | |
| 381 | memory_set_bankptr(machine, 2, mess_ram + 0x4000); | |
| 382 | memory_set_bankptr(machine, 3, mess_ram + 0xf000); | |
| 383 | memory_set_bankptr(machine, 5, memory_region(machine, "maincpu") + 0xf800); | |
| 384 | ||
| 385 | ||
| 386 | 386 | orion128_video_page = 0; |
| 387 | 387 | orion128_video_mode = 0; |
| 388 | 388 | orionz80_memory_page = 0; |
| r5932 | r5933 | |
| 393 | 393 | radio86_init_keyboard(); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | INTERRUPT_GEN( orionz80_interrupt ) | |
| 396 | INTERRUPT_GEN( orionz80_interrupt ) | |
| 397 | 397 | { |
| 398 | if ((orionz80_dispatcher & 0x40)==0x40) | |
| 398 | if ((orionz80_dispatcher & 0x40)==0x40) | |
| 399 | 399 | { |
| 400 | cpu_set_input_line(device, 0, HOLD_LINE); | |
| 401 | } | |
| 400 | cpu_set_input_line(device, 0, HOLD_LINE); | |
| 401 | } | |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | READ8_HANDLER ( orionz80_io_r ) | |
| 404 | READ8_HANDLER ( orionz80_io_r ) | |
| 405 | 405 | { |
| 406 | if (offset == 0xFFFD) | |
| 406 | if (offset == 0xFFFD) | |
| 407 | 407 | { |
| 408 | 408 | return ay8910_r (devtag_get_device(space->machine, "ay8912"), 0); |
| 409 | 409 | } |
| 410 | 410 | return 0xff; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | WRITE8_HANDLER ( orionz80_io_w ) | |
| 413 | WRITE8_HANDLER ( orionz80_io_w ) | |
| 414 | 414 | { |
| 415 | switch (offset & 0xff) | |
| 415 | switch (offset & 0xff) | |
| 416 | 416 | { |
| 417 | 417 | case 0xf8 : orion128_video_mode_w(space,0,data);break; |
| 418 | 418 | case 0xf9 : orionz80_memory_page_w(space,0,data);break; |
| r5932 | r5933 | |
| 421 | 421 | case 0xfe : orionz80_sound_fe_w(space,0,data);break; |
| 422 | 422 | case 0xff : orionz80_sound_w(space,0,data);break; |
| 423 | 423 | } |
| 424 | switch(offset) | |
| 424 | switch(offset) | |
| 425 | 425 | { |
| 426 | 426 | case 0xfffd : ay8910_address_w(devtag_get_device(space->machine, "ay8912"), 0, data); |
| 427 | 427 | break; |
| 428 | 428 | case 0xbffd : |
| 429 | 429 | case 0xbefd : ay8910_data_w(devtag_get_device(space->machine, "ay8912"), 0, data); |
| 430 | break; | |
| 430 | break; | |
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | |
| r5932 | r5933 | |
| 444 | 444 | |
| 445 | 445 | DRIVER_INIT( orionpro ) |
| 446 | 446 | { |
| 447 | memset(mess_ram,0,512*1024); | |
| 447 | memset(mess_ram,0,512*1024); | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | |
| r5932 | r5933 | |
| 459 | 459 | static void orionpro_bank_switch(running_machine *machine) |
| 460 | 460 | { |
| 461 | 461 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 462 | int page = orionpro_page & 7; // we have only 8 pages | |
| 462 | int page = orionpro_page & 7; // we have only 8 pages | |
| 463 | 463 | int is128 = (orionpro_dispatcher & 0x80) ? 1 : 0; |
| 464 | if (is128==1) | |
| 464 | if (is128==1) | |
| 465 | 465 | { |
| 466 | 466 | page = orionpro_128_page & 7; |
| 467 | 467 | } |
| r5932 | r5933 | |
| 473 | 473 | memory_install_write8_handler(space, 0xf000, 0xf3ff, 0, 0, SMH_BANK(6)); |
| 474 | 474 | memory_install_write8_handler(space, 0xf400, 0xf7ff, 0, 0, SMH_BANK(7)); |
| 475 | 475 | memory_install_write8_handler(space, 0xf800, 0xffff, 0, 0, SMH_BANK(8)); |
| 476 | ||
| 477 | ||
| 478 | if ((orionpro_dispatcher & 0x01)==0x00) | |
| 476 | ||
| 477 | ||
| 478 | if ((orionpro_dispatcher & 0x01)==0x00) | |
| 479 | 479 | { // RAM0 segment disabled |
| 480 | 480 | memory_set_bankptr(machine, 1, mess_ram + 0x10000 * page); |
| 481 | memory_set_bankptr(machine, 2, mess_ram + 0x10000 * page + 0x2000); | |
| 482 | } | |
| 483 | else | |
| 481 | memory_set_bankptr(machine, 2, mess_ram + 0x10000 * page + 0x2000); | |
| 482 | } | |
| 483 | else | |
| 484 | 484 | { |
| 485 | 485 | memory_set_bankptr(machine, 1, mess_ram + (orionpro_ram0_segment & 31) * 0x4000); |
| 486 | 486 | memory_set_bankptr(machine, 2, mess_ram + (orionpro_ram0_segment & 31) * 0x4000 + 0x2000); |
| 487 | 487 | } |
| 488 | if ((orionpro_dispatcher & 0x10)==0x10) | |
| 489 | { // ROM1 enabled | |
| 488 | if ((orionpro_dispatcher & 0x10)==0x10) | |
| 489 | { // ROM1 enabled | |
| 490 | 490 | memory_install_write8_handler(space, 0x0000, 0x1fff, 0, 0, SMH_UNMAP); |
| 491 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x20000); | |
| 491 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x20000); | |
| 492 | 492 | } |
| 493 | if ((orionpro_dispatcher & 0x08)==0x08) | |
| 493 | if ((orionpro_dispatcher & 0x08)==0x08) | |
| 494 | 494 | { // ROM2 enabled |
| 495 | 495 | memory_install_write8_handler(space, 0x2000, 0x3fff, 0, 0, SMH_UNMAP); |
| 496 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x22000 + (orionpro_rom2_segment & 7) * 0x2000); | |
| 496 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x22000 + (orionpro_rom2_segment & 7) * 0x2000); | |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | if ((orionpro_dispatcher & 0x02)==0x00) | |
| 499 | if ((orionpro_dispatcher & 0x02)==0x00) | |
| 500 | 500 | { // RAM1 segment disabled |
| 501 | memory_set_bankptr(machine, 3, mess_ram + 0x10000 * page + 0x4000); | |
| 502 | } | |
| 503 | else | |
| 501 | memory_set_bankptr(machine, 3, mess_ram + 0x10000 * page + 0x4000); | |
| 502 | } | |
| 503 | else | |
| 504 | 504 | { |
| 505 | memory_set_bankptr(machine, 3, mess_ram + (orionpro_ram1_segment & 31) * 0x4000); | |
| 505 | memory_set_bankptr(machine, 3, mess_ram + (orionpro_ram1_segment & 31) * 0x4000); | |
| 506 | 506 | } |
| 507 | ||
| 508 | if ((orionpro_dispatcher & 0x04)==0x00) | |
| 507 | ||
| 508 | if ((orionpro_dispatcher & 0x04)==0x00) | |
| 509 | 509 | { // RAM2 segment disabled |
| 510 | 510 | memory_set_bankptr(machine, 4, mess_ram + 0x10000 * page + 0x8000); |
| 511 | } | |
| 511 | } | |
| 512 | 512 | else |
| 513 | { | |
| 513 | { | |
| 514 | 514 | memory_set_bankptr(machine, 4, mess_ram + (orionpro_ram2_segment & 31) * 0x4000); |
| 515 | 515 | } |
| 516 | ||
| 516 | ||
| 517 | 517 | memory_set_bankptr(machine, 5, mess_ram + 0x10000 * page + 0xc000); |
| 518 | ||
| 519 | if (is128) | |
| 518 | ||
| 519 | if (is128) | |
| 520 | 520 | { |
| 521 | memory_set_bankptr(machine, 6, mess_ram + 0x10000 * 0 + 0xf000); | |
| 521 | memory_set_bankptr(machine, 6, mess_ram + 0x10000 * 0 + 0xf000); | |
| 522 | 522 | |
| 523 | 523 | memory_install_write8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_w); |
| 524 | 524 | memory_install_write8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_w); |
| 525 | 525 | memory_install_write8_handler(space, 0xf600, 0xf6ff, 0, 0, SMH_UNMAP); |
| 526 | memory_install_write8_handler(space, 0xf700, 0xf7ff, 0, 0, orion128_floppy_w); | |
| 526 | memory_install_write8_handler(space, 0xf700, 0xf7ff, 0, 0, orion128_floppy_w); | |
| 527 | 527 | memory_install_read8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_r); |
| 528 | 528 | memory_install_read8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_r); |
| 529 | 529 | memory_install_read8_handler(space, 0xf600, 0xf6ff, 0, 0, SMH_UNMAP); |
| 530 | memory_install_read8_handler(space, 0xf700, 0xf7ff, 0, 0, orion128_floppy_r); | |
| 531 | ||
| 530 | memory_install_read8_handler(space, 0xf700, 0xf7ff, 0, 0, orion128_floppy_r); | |
| 531 | ||
| 532 | 532 | memory_install_write8_handler(space, 0xf800, 0xf8ff, 0, 0, orion128_video_mode_w); |
| 533 | 533 | memory_install_write8_handler(space, 0xf900, 0xf9ff, 0, 0, orionpro_memory_page_w); |
| 534 | 534 | memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, orion128_video_page_w); |
| 535 | 535 | memory_install_write8_handler(space, 0xfb00, 0xfeff, 0, 0, SMH_UNMAP); |
| 536 | 536 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, orionz80_sound_w); |
| 537 | ||
| 538 | ||
| 539 | memory_set_bankptr(machine, 8, mess_ram + 0x10000 * 0 + 0xf800); | |
| 540 | } | |
| 541 | else | |
| 537 | ||
| 538 | ||
| 539 | memory_set_bankptr(machine, 8, mess_ram + 0x10000 * 0 + 0xf800); | |
| 540 | } | |
| 541 | else | |
| 542 | 542 | { |
| 543 | if ((orionpro_dispatcher & 0x40)==0x40) | |
| 543 | if ((orionpro_dispatcher & 0x40)==0x40) | |
| 544 | 544 | { // FIX F000 enabled |
| 545 | memory_set_bankptr(machine, 6, mess_ram + 0x10000 * 0 + 0xf000); | |
| 546 | memory_set_bankptr(machine, 7, mess_ram + 0x10000 * 0 + 0xf400); | |
| 547 | memory_set_bankptr(machine, 8, mess_ram + 0x10000 * 0 + 0xf800); | |
| 548 | } | |
| 549 | else | |
| 545 | memory_set_bankptr(machine, 6, mess_ram + 0x10000 * 0 + 0xf000); | |
| 546 | memory_set_bankptr(machine, 7, mess_ram + 0x10000 * 0 + 0xf400); | |
| 547 | memory_set_bankptr(machine, 8, mess_ram + 0x10000 * 0 + 0xf800); | |
| 548 | } | |
| 549 | else | |
| 550 | 550 | { |
| 551 | memory_set_bankptr(machine, 6, mess_ram + 0x10000 * page + 0xf000); | |
| 552 | memory_set_bankptr(machine, 7, mess_ram + 0x10000 * page + 0xf400); | |
| 553 | memory_set_bankptr(machine, 8, mess_ram + 0x10000 * page + 0xf800); | |
| 551 | memory_set_bankptr(machine, 6, mess_ram + 0x10000 * page + 0xf000); | |
| 552 | memory_set_bankptr(machine, 7, mess_ram + 0x10000 * page + 0xf400); | |
| 553 | memory_set_bankptr(machine, 8, mess_ram + 0x10000 * page + 0xf800); | |
| 554 | 554 | } |
| 555 | } | |
| 555 | } | |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | static WRITE8_HANDLER ( orionpro_memory_page_w ) |
| 559 | { | |
| 559 | { | |
| 560 | 560 | orionpro_128_page = data; |
| 561 | 561 | orionpro_bank_switch(space->machine); |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | MACHINE_RESET ( orionpro ) | |
| 565 | { | |
| 566 | radio86_init_keyboard(); | |
| 564 | MACHINE_RESET ( orionpro ) | |
| 565 | { | |
| 566 | radio86_init_keyboard(); | |
| 567 | 567 | |
| 568 | 568 | orion128_video_page = 0; |
| 569 | 569 | orion128_video_mode = 0; |
| r5932 | r5933 | |
| 577 | 577 | |
| 578 | 578 | orionpro_dispatcher = 0x50; |
| 579 | 579 | orionpro_bank_switch(machine); |
| 580 | ||
| 580 | ||
| 581 | 581 | orion_speaker = 0; |
| 582 | 582 | orion128_video_width = SCREEN_WIDTH_384; |
| 583 | 583 | orion_set_video_mode(machine,384); |
| r5932 | r5933 | |
| 586 | 586 | orionpro_pseudo_color = 0; |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | READ8_HANDLER ( orionpro_io_r ) | |
| 589 | READ8_HANDLER ( orionpro_io_r ) | |
| 590 | 590 | { |
| 591 | 591 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 592 | ||
| 593 | switch (offset & 0xff) | |
| 594 | { | |
| 592 | ||
| 593 | switch (offset & 0xff) | |
| 594 | { | |
| 595 | 595 | case 0x00 : return 0x56; |
| 596 | 596 | case 0x04 : return orionpro_ram0_segment; |
| 597 | 597 | case 0x05 : return orionpro_ram1_segment; |
| r5932 | r5933 | |
| 599 | 599 | case 0x08 : return orionpro_page; |
| 600 | 600 | case 0x09 : return orionpro_rom2_segment; |
| 601 | 601 | case 0x0a : return orionpro_dispatcher; |
| 602 | case 0x10 : return wd17xx_status_r(fdc,0); | |
| 602 | case 0x10 : return wd17xx_status_r(fdc,0); | |
| 603 | 603 | case 0x11 : return wd17xx_track_r(fdc,0); |
| 604 | 604 | case 0x12 : return wd17xx_sector_r(fdc,0); |
| 605 | 605 | case 0x13 : return wd17xx_data_r(fdc,0); |
| 606 | case 0x18 : | |
| 607 | case 0x19 : | |
| 608 | case 0x1a : | |
| 609 | case 0x1b : | |
| 606 | case 0x18 : | |
| 607 | case 0x19 : | |
| 608 | case 0x1a : | |
| 609 | case 0x1b : | |
| 610 | 610 | return orion128_system_r(space,(offset & 0xff)-0x18); |
| 611 | 611 | case 0x28 : return orion128_romdisk_r(space,0); |
| 612 | 612 | case 0x29 : return orion128_romdisk_r(space,1); |
| 613 | 613 | case 0x2a : return orion128_romdisk_r(space,2); |
| 614 | 614 | case 0x2b : return orion128_romdisk_r(space,3); |
| 615 | 615 | } |
| 616 | if (offset == 0xFFFD) | |
| 616 | if (offset == 0xFFFD) | |
| 617 | 617 | { |
| 618 | 618 | return ay8910_r (devtag_get_device(space->machine, "ay8912"), 0); |
| 619 | 619 | } |
| 620 | 620 | return 0xff; |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | WRITE8_HANDLER ( orionpro_io_w ) | |
| 623 | WRITE8_HANDLER ( orionpro_io_w ) | |
| 624 | 624 | { |
| 625 | 625 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 626 | ||
| 627 | switch (offset & 0xff) | |
| 628 | { | |
| 629 | case 0x04 : orionpro_ram0_segment = data; orionpro_bank_switch(space->machine); break; | |
| 626 | ||
| 627 | switch (offset & 0xff) | |
| 628 | { | |
| 629 | case 0x04 : orionpro_ram0_segment = data; orionpro_bank_switch(space->machine); break; | |
| 630 | 630 | case 0x05 : orionpro_ram1_segment = data; orionpro_bank_switch(space->machine); break; |
| 631 | 631 | case 0x06 : orionpro_ram2_segment = data; orionpro_bank_switch(space->machine); break; |
| 632 | 632 | case 0x08 : orionpro_page = data; orionpro_bank_switch(space->machine); break; |
| r5932 | r5933 | |
| 637 | 637 | case 0x12 : wd17xx_sector_w(fdc,0,data);break; |
| 638 | 638 | case 0x13 : wd17xx_data_w(fdc,0,data);break; |
| 639 | 639 | case 0x14 : orion_disk_control_w(space, 9, data);break; |
| 640 | case 0x18 : | |
| 641 | case 0x19 : | |
| 642 | case 0x1a : | |
| 643 | case 0x1b : | |
| 640 | case 0x18 : | |
| 641 | case 0x19 : | |
| 642 | case 0x1a : | |
| 643 | case 0x1b : | |
| 644 | 644 | orion128_system_w(space,(offset & 0xff)-0x18,data); break; |
| 645 | 645 | case 0x28 : orion128_romdisk_w(space,0,data); break; |
| 646 | 646 | case 0x29 : orion128_romdisk_w(space,1,data); break; |
| r5932 | r5933 | |
| 648 | 648 | case 0x2b : orion128_romdisk_w(space,3,data); break; |
| 649 | 649 | case 0xf8 : orion128_video_mode_w(space,0,data);break; |
| 650 | 650 | case 0xf9 : orionpro_128_page = data; orionpro_bank_switch(space->machine); break; |
| 651 | case 0xfa : orion128_video_page_w(space,0,data);break; | |
| 651 | case 0xfa : orion128_video_page_w(space,0,data);break; | |
| 652 | 652 | case 0xfc : orionpro_pseudo_color = data;break; |
| 653 | 653 | case 0xfe : orionz80_sound_fe_w(space,0,data);break; |
| 654 | 654 | case 0xff : orionz80_sound_w(space,0,data);break; |
| 655 | 655 | } |
| 656 | switch(offset) | |
| 656 | switch(offset) | |
| 657 | 657 | { |
| 658 | 658 | case 0xfffd : ay8910_address_w(devtag_get_device(space->machine, "ay8912"), 0, data); |
| 659 | 659 | break; |
| 660 | 660 | case 0xbffd : |
| 661 | 661 | case 0xbefd : ay8910_data_w(devtag_get_device(space->machine, "ay8912"), 0, data); |
| 662 | break; | |
| 662 | break; | |
| 663 | 663 | } |
| 664 | 664 | } |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - daisy chaining | |
| 15 | - correct gpio_timer period | |
| 16 | - disable GPIO3/4 interrupts when timer A/B in pulse mode | |
| 17 | - spurious interrupt | |
| 14 | - daisy chaining | |
| 15 | - correct gpio_timer period | |
| 16 | - disable GPIO3/4 interrupts when timer A/B in pulse mode | |
| 17 | - spurious interrupt | |
| 18 | 18 | |
| 19 | If you look at the MFP datasheet it is obvious that it can generate the conditions for a spurious interrupt. | |
| 20 | However the fact that they indeed happen in the ST is quite interesting. | |
| 19 | If you look at the MFP datasheet it is obvious that it can generate the conditions for a spurious interrupt. | |
| 20 | However the fact that they indeed happen in the ST is quite interesting. | |
| 21 | 21 | |
| 22 | The MFP will generate a spurious interrupt if interrupts are disabled (by changing the IERA/IERB registers) | |
| 23 | at the “precise point�. The precise point would be after the system (but not necessarily the CPU, see below) | |
| 24 | triggered an MFP interrupt, and before the CPU drives the interrupt acknowledge cycle. | |
| 22 | The MFP will generate a spurious interrupt if interrupts are disabled (by changing the IERA/IERB registers) | |
| 23 | at the ???precise point???. The precise point would be after the system (but not necessarily the CPU, see below) | |
| 24 | triggered an MFP interrupt, and before the CPU drives the interrupt acknowledge cycle. | |
| 25 | 25 | |
| 26 | If the MFP was connected directly to the CPU, spurious interrupts probably couldn’t happen. However in the | |
| 27 | ST, GLUE seats in the middle and handles all the interrupt timing. It is possible that GLUE introduces a | |
| 28 | delay between detecting a change in the MFP interrupt request signal and actually propagating the change to | |
| 29 | the CPU IPL signals (it is even possible that GLUE make some kind of latching). This would create a window | |
| 30 | long enough for the “precise point� described above. | |
| 26 | If the MFP was connected directly to the CPU, spurious interrupts probably couldn???t happen. However in the | |
| 27 | ST, GLUE seats in the middle and handles all the interrupt timing. It is possible that GLUE introduces a | |
| 28 | delay between detecting a change in the MFP interrupt request signal and actually propagating the change to | |
| 29 | the CPU IPL signals (it is even possible that GLUE make some kind of latching). This would create a window | |
| 30 | long enough for the ???precise point??? described above. | |
| 31 | 31 | |
| 32 | "yes, the spurious interrupt occurs when i mask a timer. i did not notice an occurance of the SPI when changing data and control registers. | |
| 33 | if i kill interrupts with the status reg before masking the timer interrupt, then the SPI occurs as soon as the status register is set to re-enable interrupts." | |
| 32 | "yes, the spurious interrupt occurs when i mask a timer. i did not notice an occurance of the SPI when changing data and control registers. | |
| 33 | if i kill interrupts with the status reg before masking the timer interrupt, then the SPI occurs as soon as the status register is set to re-enable interrupts." | |
| 34 | 34 | |
| 35 | - divide serial clock by 16 | |
| 36 | - synchronous mode | |
| 37 | - 1.5/2 stop bits | |
| 38 | - interrupt on receiver break end | |
| 39 | - interrupt on character boundaries during break transmission | |
| 40 | - loopback mode | |
| 35 | - divide serial clock by 16 | |
| 36 | - synchronous mode | |
| 37 | - 1.5/2 stop bits | |
| 38 | - interrupt on receiver break end | |
| 39 | - interrupt on character boundaries during break transmission | |
| 40 | - loopback mode | |
| 41 | 41 | |
| 42 | 42 | */ |
| 43 | 43 | |
| r5932 | r5933 | |
| 340 | 340 | |
| 341 | 341 | /*------------------------------------------------- |
| 342 | 342 | check_interrupts - set the interrupt request |
| 343 | ||
| 343 | line state | |
| 344 | 344 | -------------------------------------------------*/ |
| 345 | 345 | |
| 346 | 346 | static void check_interrupts(const device_config *device) |
| r5932 | r5933 | |
| 406 | 406 | |
| 407 | 407 | /*------------------------------------------------- |
| 408 | 408 | rx_buffer_full - signal receive buffer full |
| 409 | ||
| 409 | interrupt | |
| 410 | 410 | -------------------------------------------------*/ |
| 411 | 411 | |
| 412 | 412 | static void rx_buffer_full(const device_config *device) |
| r5932 | r5933 | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | /*------------------------------------------------- |
| 441 | tx_buffer_empty - signal transmit buffer | |
| 442 | empty interrupt | |
| 441 | tx_buffer_empty - signal transmit buffer | |
| 442 | empty interrupt | |
| 443 | 443 | -------------------------------------------------*/ |
| 444 | 444 | |
| 445 | 445 | static void tx_buffer_empty(const device_config *device) |
| r5932 | r5933 | |
| 648 | 648 | static void tx_break(const device_config *device) |
| 649 | 649 | { |
| 650 | 650 | mc68901_t *mc68901 = get_safe_token(device); |
| 651 | ||
| 651 | ||
| 652 | 652 | if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE) |
| 653 | 653 | { |
| 654 | 654 | if (mc68901->tsr & MC68901_TSR_BREAK) |
| r5932 | r5933 | |
| 717 | 717 | { |
| 718 | 718 | /* transmit start bit */ |
| 719 | 719 | TXD(0); |
| 720 | ||
| 720 | ||
| 721 | 721 | /* load transmit buffer */ |
| 722 | 722 | mc68901->tx_buffer = mc68901->udr; |
| 723 | 723 | mc68901->tx_bits = 0; |
| r5932 | r5933 | |
| 1258 | 1258 | case MC68901_UCR_START_STOP_1_15: |
| 1259 | 1259 | mc68901->rxtx_start = 1; |
| 1260 | 1260 | mc68901->rxtx_stop = 1; |
| 1261 | if (LOG) logerror("MC68901 Start Bits : 1, Stop Bits : 1 | |
| 1261 | if (LOG) logerror("MC68901 Start Bits : 1, Stop Bits : 1??, Format : asynchronous\n"); | |
| 1262 | 1262 | break; |
| 1263 | 1263 | case MC68901_UCR_START_STOP_1_2: |
| 1264 | 1264 | mc68901->rxtx_start = 1; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Amiga floppy disk controller emulation | |
| 4 | 4 | |
| 5 | - The drive spins at 300 RPM = 1 Rev every 200ms | |
| 6 | - At 2usec per bit, that's 12500 bytes per track, or 6250 words per track | |
| 7 | - At 4usec per bit, that's 6250 bytes per track, or 3125 words per track | |
| 8 | - Each standard amiga sector has 544 words per sector, and 11 sectors per track = 11968 bytes | |
| 9 | - ( 12500(max) - 11968(actual) ) = 532 per track gap bytes | |
| 5 | - The drive spins at 300 RPM = 1 Rev every 200ms | |
| 6 | - At 2usec per bit, that's 12500 bytes per track, or 6250 words per track | |
| 7 | - At 4usec per bit, that's 6250 bytes per track, or 3125 words per track | |
| 8 | - Each standard amiga sector has 544 words per sector, and 11 sectors per track = 11968 bytes | |
| 9 | - ( 12500(max) - 11968(actual) ) = 532 per track gap bytes | |
| 10 | 10 | |
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 | |
| r5932 | r5933 | |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | static void start_rev_timer( int drive ) { |
| 625 | // | |
| 625 | // double time; | |
| 626 | 626 | |
| 627 | 627 | if ( fdc_status[drive].rev_timer_started ) { |
| 628 | 628 | logerror("Revolution timer started twice?!\n" ); |
| r5932 | r5933 | |
|---|---|---|
| 22 | 22 | static TIMER_CALLBACK(keyboard_callback) |
| 23 | 23 | { |
| 24 | 24 | UINT8 code, i, j; |
| 25 | static const char *const keynames[] = { "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", | |
| 25 | static const char *const keynames[] = { "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", | |
| 26 | 26 | "LINE7", "LINE8", "LINE9", "LINE10", "LINE11" }; |
| 27 | 27 | |
| 28 | for(i = 1; i < 12; i++) | |
| 28 | for(i = 1; i < 12; i++) | |
| 29 | 29 | { |
| 30 | 30 | code = input_port_read(machine, keynames[i-1]); |
| 31 | if (code != 0) | |
| 31 | if (code != 0) | |
| 32 | 32 | { |
| 33 | for(j = 0; j < 8; j++) | |
| 33 | for(j = 0; j < 8; j++) | |
| 34 | 34 | { |
| 35 | if (code == (1 << j)) | |
| 35 | if (code == (1 << j)) | |
| 36 | 36 | { |
| 37 | 37 | key_code = j + i*8; |
| 38 | 38 | break; |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | if ((input_port_read(machine, "LINE0") & 4) == 4) | |
| 41 | if ((input_port_read(machine, "LINE0") & 4) == 4) | |
| 42 | 42 | { |
| 43 | if (i==6 || i==7) | |
| 43 | if (i==6 || i==7) | |
| 44 | 44 | { |
| 45 | 45 | key_code -= 16; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | } |
| 49 | if ((input_port_read(machine, "LINE0") & 4) == 4) | |
| 49 | if ((input_port_read(machine, "LINE0") & 4) == 4) | |
| 50 | 50 | { |
| 51 | if (i>=8 && i<=11) | |
| 51 | if (i>=8 && i<=11) | |
| 52 | 52 | { |
| 53 | 53 | key_code += 32; |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | key_pressed = 0x40; |
| 57 | if ((input_port_read(machine, "LINE0") & 2) == 0) | |
| 57 | if ((input_port_read(machine, "LINE0") & 2) == 0) | |
| 58 | 58 | { |
| 59 | 59 | key_irq_vector = 0x30; |
| 60 | } | |
| 61 | else | |
| 60 | } | |
| 61 | else | |
| 62 | 62 | { |
| 63 | 63 | key_irq_vector = 0xBC; |
| 64 | 64 | } |
| r5932 | r5933 | |
| 89 | 89 | bk_scrool = 01330; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | READ16_HANDLER (bk_key_state_r) | |
| 93 | { | |
| 92 | READ16_HANDLER (bk_key_state_r) | |
| 93 | { | |
| 94 | 94 | return kbd_state; |
| 95 | 95 | } |
| 96 | READ16_HANDLER (bk_key_code_r) | |
| 96 | READ16_HANDLER (bk_key_code_r) | |
| 97 | 97 | { |
| 98 | 98 | kbd_state &= ~0x80; // mark reading done |
| 99 | 99 | key_pressed = 0; |
| 100 | 100 | return key_code; |
| 101 | 101 | } |
| 102 | READ16_HANDLER (bk_vid_scrool_r) | |
| 102 | READ16_HANDLER (bk_vid_scrool_r) | |
| 103 | 103 | { |
| 104 | 104 | return bk_scrool; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | READ16_HANDLER (bk_key_press_r) | |
| 107 | READ16_HANDLER (bk_key_press_r) | |
| 108 | 108 | { |
| 109 | double level = cassette_input(devtag_get_device(space->machine, "cassette")); | |
| 109 | double level = cassette_input(devtag_get_device(space->machine, "cassette")); | |
| 110 | 110 | UINT16 cas; |
| 111 | if (level < 0) | |
| 112 | { | |
| 113 | cas = 0x00; | |
| 114 | } | |
| 115 | else | |
| 111 | if (level < 0) | |
| 116 | 112 | { |
| 113 | cas = 0x00; | |
| 114 | } | |
| 115 | else | |
| 116 | { | |
| 117 | 117 | cas = 0x20; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return 0x8080 | key_pressed | cas; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | WRITE16_HANDLER(bk_key_state_w) | |
| 123 | WRITE16_HANDLER(bk_key_state_w) | |
| 124 | 124 | { |
| 125 | 125 | kbd_state = (kbd_state & ~0x40) | (data & 0x40); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | WRITE16_HANDLER(bk_vid_scrool_w) | |
| 128 | WRITE16_HANDLER(bk_vid_scrool_w) | |
| 129 | 129 | { |
| 130 | 130 | bk_scrool = data; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | WRITE16_HANDLER(bk_key_press_w) | |
| 133 | WRITE16_HANDLER(bk_key_press_w) | |
| 134 | 134 | { |
| 135 | 135 | } |
| 136 | 136 | |
| r5932 | r5933 | |
| 141 | 141 | |
| 142 | 142 | WRITE16_HANDLER(bk_floppy_cmd_w) |
| 143 | 143 | { |
| 144 | if ((data & 1) == 1) | |
| 144 | if ((data & 1) == 1) | |
| 145 | 145 | { |
| 146 | 146 | bk_drive = 0; |
| 147 | 147 | } |
| 148 | if ((data & 2) == 2) | |
| 148 | if ((data & 2) == 2) | |
| 149 | 149 | { |
| 150 | 150 | bk_drive = 1; |
| 151 | 151 | } |
| 152 | if ((data & 4) == 4) | |
| 152 | if ((data & 4) == 4) | |
| 153 | 153 | { |
| 154 | 154 | bk_drive = 2; |
| 155 | 155 | } |
| 156 | if ((data & 8) == 8) | |
| 156 | if ((data & 8) == 8) | |
| 157 | 157 | { |
| 158 | 158 | bk_drive = 3; |
| 159 | 159 | } |
| 160 | if (data == 0) | |
| 160 | if (data == 0) | |
| 161 | 161 | { |
| 162 | 162 | bk_drive = -1; |
| 163 | 163 | } |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - break detection | |
| 15 | - wr0 reset tx interrupt pending | |
| 16 | - wait/ready | |
| 17 | - 1.5 stop bits | |
| 14 | - break detection | |
| 15 | - wr0 reset tx interrupt pending | |
| 16 | - wait/ready | |
| 17 | - 1.5 stop bits | |
| 18 | 18 | |
| 19 | 19 | */ |
| 20 | 20 | |
| r5932 | r5933 | |
| 166 | 166 | struct _z80dart_t |
| 167 | 167 | { |
| 168 | 168 | devcb_resolved_write_line out_int_func; |
| 169 | ||
| 169 | ||
| 170 | 170 | dart_channel channel[2]; /* channels */ |
| 171 | 171 | |
| 172 | 172 | int int_state[8]; /* interrupt state */ |
| r5932 | r5933 | |
| 401 | 401 | |
| 402 | 402 | /*------------------------------------------------- |
| 403 | 403 | character_completed - check if complete |
| 404 | ||
| 404 | data word has been transferred | |
| 405 | 405 | -------------------------------------------------*/ |
| 406 | 406 | |
| 407 | 407 | static int character_completed(dart_channel *ch) |
| r5932 | r5933 | |
| 417 | 417 | { |
| 418 | 418 | z80dart_t *z80dart = get_safe_token(device); |
| 419 | 419 | dart_channel *ch = &z80dart->channel[channel]; |
| 420 | ||
| 420 | ||
| 421 | 421 | int parity = (ch->wr[1] & Z80DART_WR4_PARITY_EVEN) ? 1 : 0; |
| 422 | 422 | |
| 423 | 423 | if (RXD != (ch->rx_parity ^ parity)) |
| r5932 | r5933 | |
| 433 | 433 | take_interrupt(device, channel, INT_SPECIAL); |
| 434 | 434 | } |
| 435 | 435 | break; |
| 436 | ||
| 436 | ||
| 437 | 437 | case Z80DART_WR1_RX_INT_ALL_PARITY: |
| 438 | 438 | take_interrupt(device, channel, INT_SPECIAL); |
| 439 | 439 | break; |
| 440 | ||
| 440 | ||
| 441 | 441 | case Z80DART_WR1_RX_INT_ALL: |
| 442 | 442 | take_interrupt(device, channel, INT_RECEIVE); |
| 443 | 443 | break; |
| r5932 | r5933 | |
| 453 | 453 | { |
| 454 | 454 | z80dart_t *z80dart = get_safe_token(device); |
| 455 | 455 | dart_channel *ch = &z80dart->channel[channel]; |
| 456 | ||
| 456 | ||
| 457 | 457 | if (!RXD) |
| 458 | 458 | { |
| 459 | 459 | /* framing error detected */ |
| r5932 | r5933 | |
| 467 | 467 | take_interrupt(device, channel, INT_SPECIAL); |
| 468 | 468 | } |
| 469 | 469 | break; |
| 470 | ||
| 470 | ||
| 471 | 471 | case Z80DART_WR1_RX_INT_ALL_PARITY: |
| 472 | 472 | case Z80DART_WR1_RX_INT_ALL: |
| 473 | 473 | take_interrupt(device, channel, INT_SPECIAL); |
| r5932 | r5933 | |
| 484 | 484 | { |
| 485 | 485 | z80dart_t *z80dart = get_safe_token(device); |
| 486 | 486 | dart_channel *ch = &z80dart->channel[channel]; |
| 487 | ||
| 487 | ||
| 488 | 488 | float stop_bits = get_stop_bits(ch); |
| 489 | 489 | |
| 490 | 490 | switch (ch->rx_state) |
| r5932 | r5933 | |
| 507 | 507 | case STATE_DATA: |
| 508 | 508 | /* shift bit into shift register */ |
| 509 | 509 | shift_data_in(ch); |
| 510 | ||
| 510 | ||
| 511 | 511 | if (character_completed(ch)) |
| 512 | 512 | { |
| 513 | 513 | /* all data bits received */ |
| r5932 | r5933 | |
| 576 | 576 | { |
| 577 | 577 | z80dart_t *z80dart = get_safe_token(device); |
| 578 | 578 | dart_channel *ch = &z80dart->channel[channel]; |
| 579 | ||
| 579 | ||
| 580 | 580 | int word_length = get_tx_word_length(ch); |
| 581 | 581 | float stop_bits = get_stop_bits(ch); |
| 582 | 582 | |
| r5932 | r5933 | |
| 778 | 778 | LOG(("Z80DART \"%s\" Channel %c : Transmit Interrupt Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR1_TX_INT_ENABLE) ? 1 : 0)); |
| 779 | 779 | LOG(("Z80DART \"%s\" Channel %c : Status Affects Vector %u\n", device->tag, 'A' + channel, (data & Z80DART_WR1_STATUS_VECTOR) ? 1 : 0)); |
| 780 | 780 | LOG(("Z80DART \"%s\" Channel %c : Wait/Ready Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR1_WRDY_ENABLE) ? 1 : 0)); |
| 781 | ||
| 781 | ||
| 782 | 782 | switch (data & Z80DART_WR1_RX_INT_ENABLE_MASK) |
| 783 | 783 | { |
| 784 | 784 | case Z80DART_WR1_RX_INT_DISABLE: |
| r5932 | r5933 | |
| 892 | 892 | dart_channel *ch = &z80dart->channel[channel]; |
| 893 | 893 | |
| 894 | 894 | ch->tx_data = data; |
| 895 | ||
| 895 | ||
| 896 | 896 | ch->rr[0] &= ~Z80DART_RR0_TX_BUFFER_EMPTY; |
| 897 | 897 | ch->rr[1] &= ~Z80DART_RR1_ALL_SENT; |
| 898 | 898 | |
| r5932 | r5933 | |
| 923 | 923 | take_interrupt(device, channel, INT_SPECIAL); |
| 924 | 924 | } |
| 925 | 925 | break; |
| 926 | ||
| 926 | ||
| 927 | 927 | case Z80DART_WR1_RX_INT_ALL_PARITY: |
| 928 | 928 | case Z80DART_WR1_RX_INT_ALL: |
| 929 | 929 | take_interrupt(device, channel, INT_SPECIAL); |
| r5932 | r5933 | |
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | /*------------------------------------------------- |
| 1063 | z80dart_dcda_w - data carrier detected | |
| 1064 | (channel A) | |
| 1063 | z80dart_dcda_w - data carrier detected | |
| 1064 | (channel A) | |
| 1065 | 1065 | -------------------------------------------------*/ |
| 1066 | 1066 | |
| 1067 | 1067 | void z80dart_dcda_w(const device_config *device, int state) |
| r5932 | r5933 | |
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | /*------------------------------------------------- |
| 1073 | z80dart_dcdb_w - data carrier detected | |
| 1074 | (channel B) | |
| 1073 | z80dart_dcdb_w - data carrier detected | |
| 1074 | (channel B) | |
| 1075 | 1075 | -------------------------------------------------*/ |
| 1076 | 1076 | |
| 1077 | 1077 | void z80dart_dcdb_w(const device_config *device, int state) |
| r5932 | r5933 | |
| 1146 | 1146 | if (!state) return; |
| 1147 | 1147 | |
| 1148 | 1148 | LOG(("Z80DART \"%s\" Channel A : Receiver Clock Pulse\n", device->tag)); |
| 1149 | ||
| 1149 | ||
| 1150 | 1150 | ch->rx_clock++; |
| 1151 | 1151 | |
| 1152 | 1152 | if (ch->rx_clock == clocks) |
| r5932 | r5933 | |
| 1172 | 1172 | if (!state) return; |
| 1173 | 1173 | |
| 1174 | 1174 | LOG(("Z80DART \"%s\" Channel A : Transmitter Clock Pulse\n", device->tag)); |
| 1175 | ||
| 1175 | ||
| 1176 | 1176 | ch->tx_clock++; |
| 1177 | 1177 | |
| 1178 | 1178 | if (ch->tx_clock == clocks) |
| r5932 | r5933 | |
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | 1187 | /*------------------------------------------------- |
| 1188 | z80dart_rxtxcb_w - receive/transmit clock | |
| 1189 | (channel B) | |
| 1188 | z80dart_rxtxcb_w - receive/transmit clock | |
| 1189 | (channel B) | |
| 1190 | 1190 | -------------------------------------------------*/ |
| 1191 | 1191 | |
| 1192 | 1192 | void z80dart_rxtxcb_w(const device_config *device, int state) |
| r5932 | r5933 | |
| 1199 | 1199 | if (!state) return; |
| 1200 | 1200 | |
| 1201 | 1201 | LOG(("Z80DART \"%s\" Channel A : Receiver/Transmitter Clock Pulse\n", device->tag)); |
| 1202 | ||
| 1202 | ||
| 1203 | 1203 | ch->rx_clock++; |
| 1204 | 1204 | ch->tx_clock++; |
| 1205 | 1205 | |
| r5932 | r5933 | |
| 1251 | 1251 | int state = 0; |
| 1252 | 1252 | int i; |
| 1253 | 1253 | |
| 1254 | LOG(("Z80DART \"%s\" : Interrupt State B:%d%d%d%d A:%d%d%d%d\n", device->tag, | |
| 1254 | LOG(("Z80DART \"%s\" : Interrupt State B:%d%d%d%d A:%d%d%d%d\n", device->tag, | |
| 1255 | 1255 | z80dart->int_state[0], z80dart->int_state[1], z80dart->int_state[2], z80dart->int_state[3], |
| 1256 | 1256 | z80dart->int_state[4], z80dart->int_state[5], z80dart->int_state[6], z80dart->int_state[7])); |
| 1257 | 1257 | |
| r5932 | r5933 | |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | logerror("z80dart_irq_ack: failed to find an interrupt to ack!\n"); |
| 1304 | ||
| 1304 | ||
| 1305 | 1305 | return z80dart->channel[Z80DART_CH_B].rr[2]; |
| 1306 | 1306 | } |
| 1307 | 1307 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Amiga keyboard controller emulation | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 33 | 33 | (*tailptr)->card_select = (abcbus_card_select)device_get_info_fct((*tailptr)->device, DEVINFO_FCT_ABCBUS_CARD_SELECT); |
| 34 | 34 | tailptr = &(*tailptr)->next; |
| 35 | 35 | } |
| 36 | ||
| 36 | ||
| 37 | 37 | astring_free(tempstring); |
| 38 | 38 | |
| 39 | 39 | daisy_state = head; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | a7800.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Machine file to handle emulation of the Atari 7800. | |
| 6 | 6 | |
| 7 | ||
| 7 | ||
| 8 | 8 | |
| 9 | 14-May-2002 kubecj Fixed Fatal Run - adding simple riot timer helped. | |
| 10 | maybe someone with knowledge should add full fledged | |
| 11 | riot emulation? | |
| 9 | 14-May-2002 kubecj Fixed Fatal Run - adding simple riot timer helped. | |
| 10 | maybe someone with knowledge should add full fledged | |
| 11 | riot emulation? | |
| 12 | 12 | |
| 13 | 13-May-2002 kubecj Fixed a7800_cart_type not to be too short ;-D | |
| 14 | fixed for loading of bank6 cart (uh, I hope) | |
| 15 | fixed for loading 64k supercarts | |
| 16 | fixed for using PAL bios | |
| 17 | cart not needed when in PAL mode | |
| 18 | added F18 Hornet bank select type | |
| 19 | added Activision bank select type | |
| 13 | 13-May-2002 kubecj Fixed a7800_cart_type not to be too short ;-D | |
| 14 | fixed for loading of bank6 cart (uh, I hope) | |
| 15 | fixed for loading 64k supercarts | |
| 16 | fixed for using PAL bios | |
| 17 | cart not needed when in PAL mode | |
| 18 | added F18 Hornet bank select type | |
| 19 | added Activision bank select type | |
| 20 | 20 | |
| 21 | 21 | ***************************************************************************/ |
| 22 | 22 | |
| r5932 | r5933 | |
| 142 | 142 | #define MBANK_TYPE_ACTIVISION 0x0100 |
| 143 | 143 | #define MBANK_TYPE_ABSOLUTE 0x0200 |
| 144 | 144 | |
| 145 | /* Header format | |
| 146 | 0 Header version - 1 byte | |
| 147 | 1..16 "ATARI7800 " - 16 bytes | |
| 148 | 17..48 Cart title - 32 bytes | |
| 149 | 49..52 data length - 4 bytes | |
| 150 | 53..54 cart type - 2 bytes | |
| 151 | bit 0 0x01 - pokey cart | |
| 152 | bit 1 0x02 - supercart bank switched | |
| 153 | bit 2 0x04 - supercart RAM at $4000 | |
| 154 | bit 3 0x08 - additional ROM at $4000 | |
| 145 | /* Header format | |
| 146 | 0 Header version - 1 byte | |
| 147 | 1..16 "ATARI7800 " - 16 bytes | |
| 148 | 17..48 Cart title - 32 bytes | |
| 149 | 49..52 data length - 4 bytes | |
| 150 | 53..54 cart type - 2 bytes | |
| 151 | bit 0 0x01 - pokey cart | |
| 152 | bit 1 0x02 - supercart bank switched | |
| 153 | bit 2 0x04 - supercart RAM at $4000 | |
| 154 | bit 3 0x08 - additional ROM at $4000 | |
| 155 | 155 | |
| 156 | bit 8-15 - Special | |
| 157 | 0 = Normal cart | |
| 158 | 1 = Absolute (F18 Hornet) | |
| 159 | 2 = Activision | |
| 156 | bit 8-15 - Special | |
| 157 | 0 = Normal cart | |
| 158 | 1 = Absolute (F18 Hornet) | |
| 159 | 2 = Activision | |
| 160 | 160 | |
| 161 | 55 controller 1 type - 1 byte | |
| 162 | 56 controller 2 type - 1 byte | |
| 163 | 0 = None | |
| 164 | 1 = Joystick | |
| 165 | 2 = Light Gun | |
| 161 | 55 controller 1 type - 1 byte | |
| 162 | 56 controller 2 type - 1 byte | |
| 163 | 0 = None | |
| 164 | 1 = Joystick | |
| 165 | 2 = Light Gun | |
| 166 | 166 | 57 0 = NTSC/1 = PAL |
| 167 | 167 | |
| 168 | 168 | 100..127 "ACTUAL CART DATA STARTS HERE" - 28 bytes |
| 169 | 169 | |
| 170 | 170 | Versions: |
| 171 | Version 0: Initial release | |
| 172 | Version 1: Added PAL/NTSC bit. Added Special cart byte. | |
| 173 | Changed 53 bit 2, added bit 3 | |
| 171 | Version 0: Initial release | |
| 172 | Version 1: Added PAL/NTSC bit. Added Special cart byte. | |
| 173 | Changed 53 bit 2, added bit 3 | |
| 174 | 174 | |
| 175 | 175 | */ |
| 176 | 176 | |
| r5932 | r5933 | |
| 274 | 274 | memcpy( memory + 0xC000, memory + 0x10000 + len - 0x4000, 0x4000); |
| 275 | 275 | |
| 276 | 276 | /* fixed 2002/05/13 kubecj |
| 277 | there was 0x08, I added also two other cases. | |
| 278 | Now, it loads bank n-2 to $4000 if it's empty. | |
| 279 | */ | |
| 277 | there was 0x08, I added also two other cases. | |
| 278 | Now, it loads bank n-2 to $4000 if it's empty. | |
| 279 | */ | |
| 280 | 280 | |
| 281 | /* bank n-2 | |
| 281 | /* bank n-2 */ | |
| 282 | 282 | if( ! ( a7800_cart_type & 0x0D ) ) |
| 283 | 283 | { |
| 284 | 284 | memcpy( memory + 0x4000, memory + 0x10000 + len - 0x8000, 0x4000); |
| r5932 | r5933 | |
| 372 | 372 | } |
| 373 | 373 | memory_set_bankptr(space->machine, 2,memory + 0x10000 + (data << 14)); |
| 374 | 374 | memory_set_bankptr(space->machine, 3,memory + 0x12000 + (data << 14)); |
| 375 | /* | |
| 375 | /* logerror("BANK SEL: %d\n",data); */ | |
| 376 | 376 | } |
| 377 | 377 | else if(( a7800_cart_type == MBANK_TYPE_ABSOLUTE ) &&( offset == 0x4000 ) ) |
| 378 | 378 | { |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | R/_W 1 |* \_/ | 48 _CS | |
| 11 | RS1 2 | | 47 _DS | |
| 12 | RS2 3 | | 46 _DTACK | |
| 13 | RS3 4 | | 45 _IACK | |
| 14 | RS4 5 | | 44 D7 | |
| 15 | RS5 6 | | 43 D6 | |
| 16 | TC 7 | | 42 D5 | |
| 17 | SO 8 | | 41 D4 | |
| 18 | SI 9 | | 40 D3 | |
| 19 | RC 10 | | 39 D2 | |
| 20 | Vcc 11 | | 38 D1 | |
| 21 | NC 12 | MC68901 | 37 D0 | |
| 22 | TAO 13 | MK68901 | 36 GND | |
| 23 | TBO 14 | | 35 CLK | |
| 24 | TCO 15 | | 34 _IEI | |
| 25 | TDO 16 | | 33 _IEO | |
| 26 | XTAL1 17 | | 32 _IRQ | |
| 27 | XTAL2 18 | | 31 _RR | |
| 28 | TAI 19 | | 30 _TR | |
| 29 | TBI 20 | | 29 I7 | |
| 30 | _RESET 21 | | 28 I6 | |
| 31 | I0 22 | | 27 I5 | |
| 32 | I1 23 | | 26 I4 | |
| 33 | I2 24 |_____________| 25 I3 | |
| 9 | _____ _____ | |
| 10 | R/_W 1 |* \_/ | 48 _CS | |
| 11 | RS1 2 | | 47 _DS | |
| 12 | RS2 3 | | 46 _DTACK | |
| 13 | RS3 4 | | 45 _IACK | |
| 14 | RS4 5 | | 44 D7 | |
| 15 | RS5 6 | | 43 D6 | |
| 16 | TC 7 | | 42 D5 | |
| 17 | SO 8 | | 41 D4 | |
| 18 | SI 9 | | 40 D3 | |
| 19 | RC 10 | | 39 D2 | |
| 20 | Vcc 11 | | 38 D1 | |
| 21 | NC 12 | MC68901 | 37 D0 | |
| 22 | TAO 13 | MK68901 | 36 GND | |
| 23 | TBO 14 | | 35 CLK | |
| 24 | TCO 15 | | 34 _IEI | |
| 25 | TDO 16 | | 33 _IEO | |
| 26 | XTAL1 17 | | 32 _IRQ | |
| 27 | XTAL2 18 | | 31 _RR | |
| 28 | TAI 19 | | 30 _TR | |
| 29 | TBI 20 | | 29 I7 | |
| 30 | _RESET 21 | | 28 I6 | |
| 31 | I0 22 | | 27 I5 | |
| 32 | I1 23 | | 26 I4 | |
| 33 | I2 24 |_____________| 25 I3 | |
| 34 | 34 | |
| 35 | 35 | **********************************************************************/ |
| 36 | 36 | |
| r5932 | r5933 | |
| 76 | 76 | |
| 77 | 77 | /* this gets called for each read of the SI pin (pin 9) */ |
| 78 | 78 | devcb_read_line in_si_func; |
| 79 | ||
| 79 | ||
| 80 | 80 | /* this gets called for each change of the SO pin (pin 8) */ |
| 81 | 81 | devcb_write_line out_so_func; |
| 82 | 82 | |
| 83 | 83 | /* this gets called for each change of the TAO pin (pin 13) */ |
| 84 | 84 | devcb_write_line out_tao_func; |
| 85 | ||
| 85 | ||
| 86 | 86 | /* this gets called for each change of the TBO pin (pin 14) */ |
| 87 | 87 | devcb_write_line out_tbo_func; |
| 88 | ||
| 88 | ||
| 89 | 89 | /* this gets called for each change of the TCO pin (pin 15) */ |
| 90 | 90 | devcb_write_line out_tco_func; |
| 91 | ||
| 91 | ||
| 92 | 92 | /* this gets called for each change of the TDO pin (pin 16) */ |
| 93 | 93 | devcb_write_line out_tdo_func; |
| 94 | 94 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Matsushita/Panasonic CDR521/522 type CDROM drive emulation | |
| 4 | 4 | |
| 5 | 5 | Notes: |
| 6 | 6 | This version implements the drive found in Amiga CDTV. There are |
| r5932 | r5933 | |
| 30 | 30 | typedef struct |
| 31 | 31 | { |
| 32 | 32 | UINT8 enabled; /* /ENABLE - Unit enabled */ |
| 33 | UINT8 cmd_signal; /* /CMD - Command mode | |
| 33 | UINT8 cmd_signal; /* /CMD - Command mode */ | |
| 34 | 34 | UINT8 stch_signal; /* /STCH - Status Changed */ |
| 35 | 35 | UINT8 sten_signal; /* /STEN - Status Enabled */ |
| 36 | 36 | UINT8 scor_signal; /* /STEN - Subcode Ready */ |
| r5932 | r5933 | |
|---|---|---|
| 41 | 41 | |
| 42 | 42 | #define Z80DART DEVICE_GET_INFO_NAME(z80dart) |
| 43 | 43 | /* |
| 44 | #define Z8470 DEVICE_GET_INFO_NAME(z8470) | |
| 45 | #define LH0081 DEVICE_GET_INFO_NAME(lh0088) | |
| 46 | #define MK3881 DEVICE_GET_INFO_NAME(mk3888) | |
| 44 | #define Z8470 DEVICE_GET_INFO_NAME(z8470) | |
| 45 | #define LH0081 DEVICE_GET_INFO_NAME(lh0088) | |
| 46 | #define MK3881 DEVICE_GET_INFO_NAME(mk3888) | |
| 47 | 47 | */ |
| 48 | 48 | |
| 49 | 49 | #define MDRV_Z80DART_ADD(_tag, _clock, _config) \ |
| r5932 | r5933 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | if (nascom1_portstat.stat_count < 9) |
| 116 | 116 | return (input_port_read(space->machine, keynames[nascom1_portstat.stat_count]) | ~0x7f); |
| 117 | ||
| 117 | ||
| 118 | 118 | return (0xff); |
| 119 | 119 | } |
| 120 | 120 | |
| r5932 | r5933 | |
| 125 | 125 | cassette_change_state( devtag_get_device(space->machine, "cassette"), |
| 126 | 126 | ( data & 0x10 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR ); |
| 127 | 127 | |
| 128 | if (!(data & NASCOM1_KEY_RESET)) | |
| 128 | if (!(data & NASCOM1_KEY_RESET)) | |
| 129 | 129 | { |
| 130 | 130 | if (nascom1_portstat.stat_flags & NASCOM1_KEY_RESET) |
| 131 | 131 | nascom1_portstat.stat_count = 0; |
| 132 | } | |
| 133 | else | |
| 132 | } | |
| 133 | else | |
| 134 | 134 | nascom1_portstat.stat_flags = NASCOM1_KEY_RESET; |
| 135 | 135 | |
| 136 | if (!(data & NASCOM1_KEY_INCR)) | |
| 136 | if (!(data & NASCOM1_KEY_INCR)) | |
| 137 | 137 | { |
| 138 | 138 | if (nascom1_portstat.stat_flags & NASCOM1_KEY_INCR) |
| 139 | 139 | nascom1_portstat.stat_count++; |
| 140 | } | |
| 141 | else | |
| 140 | } | |
| 141 | else | |
| 142 | 142 | nascom1_portstat.stat_flags = NASCOM1_KEY_INCR; |
| 143 | 143 | } |
| 144 | 144 | |
| r5932 | r5933 | |
| 270 | 270 | MACHINE_RESET( nascom2 ) |
| 271 | 271 | { |
| 272 | 272 | const device_config *fdc = devtag_get_device(machine, "wd1793"); |
| 273 | ||
| 273 | ||
| 274 | 274 | wd17xx_set_density(fdc,DEN_FM_HI); |
| 275 | 275 | |
| 276 | 276 | MACHINE_RESET_CALL(nascom1); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | a b | |
| 4 | -12 V <-- * 1 * --> -12V | |
| 5 | 0 V --- * 2 * --- 0 V | |
| 6 | RESIN_ --> * 3 * --> XMEMWR_ | |
| 7 | 0 V --- * 4 * --> XMEMFL_ | |
| 8 | INT_ --> * 5 * --> phi | |
| 9 | D7 <-> * 6 * --- 0 V | |
| 10 | D6 <-> * 7 * --- 0 V | |
| 11 | D5 <-> * 8 * --- 0 V | |
| 12 | D4 <-> * 9 * --- 0 V | |
| 13 | D3 <-> * 10 * --- 0 V | |
| 14 | D2 <-> * 11 * --- 0 V | |
| 15 | D1 <-> * 12 * --- 0 V | |
| 16 | D0 <-> * 13 * --- 0 V | |
| 17 | * 14 * --> A15 | |
| 18 | RST_ <-- * 15 * --> A14 | |
| 19 | IN1 <-- * 16 * --> A13 | |
| 20 | IN0 <-- * 17 * --> A12 | |
| 21 | OUT5 <-- * 18 * --> A11 | |
| 22 | OUT4 <-- * 19 * --> A10 | |
| 23 | OUT3 <-- * 20 * --> A9 | |
| 24 | OUT2 <-- * 21 * --> A8 | |
| 25 | OUT0 <-- * 22 * --> A7 | |
| 26 | OUT1 <-- * 23 * --> A6 | |
| 27 | NMI_ --> * 24 * --> A5 | |
| 28 | INP2_ <-- * 25 * --> A4 | |
| 29 | XINPSTB_ <-- * 26 * --> A3 | |
| 30 | XOUTPSTB_ <-- * 27 * --> A2 | |
| 31 | XM_ --> * 28 * --> A1 | |
| 32 | RFSH_ <-- * 29 * --> A0 | |
| 33 | RDY --> * 30 * --> MEMRQ_ | |
| 34 | +5 V <-- * 31 * --> +5 V | |
| 35 | +12 V <-- * 32 * --> +12 V | |
| 3 | a b | |
| 4 | -12 V <-- * 1 * --> -12V | |
| 5 | 0 V --- * 2 * --- 0 V | |
| 6 | RESIN_ --> * 3 * --> XMEMWR_ | |
| 7 | 0 V --- * 4 * --> XMEMFL_ | |
| 8 | INT_ --> * 5 * --> phi | |
| 9 | D7 <-> * 6 * --- 0 V | |
| 10 | D6 <-> * 7 * --- 0 V | |
| 11 | D5 <-> * 8 * --- 0 V | |
| 12 | D4 <-> * 9 * --- 0 V | |
| 13 | D3 <-> * 10 * --- 0 V | |
| 14 | D2 <-> * 11 * --- 0 V | |
| 15 | D1 <-> * 12 * --- 0 V | |
| 16 | D0 <-> * 13 * --- 0 V | |
| 17 | * 14 * --> A15 | |
| 18 | RST_ <-- * 15 * --> A14 | |
| 19 | IN1 <-- * 16 * --> A13 | |
| 20 | IN0 <-- * 17 * --> A12 | |
| 21 | OUT5 <-- * 18 * --> A11 | |
| 22 | OUT4 <-- * 19 * --> A10 | |
| 23 | OUT3 <-- * 20 * --> A9 | |
| 24 | OUT2 <-- * 21 * --> A8 | |
| 25 | OUT0 <-- * 22 * --> A7 | |
| 26 | OUT1 <-- * 23 * --> A6 | |
| 27 | NMI_ --> * 24 * --> A5 | |
| 28 | INP2_ <-- * 25 * --> A4 | |
| 29 | XINPSTB_ <-- * 26 * --> A3 | |
| 30 | XOUTPSTB_ <-- * 27 * --> A2 | |
| 31 | XM_ --> * 28 * --> A1 | |
| 32 | RFSH_ <-- * 29 * --> A0 | |
| 33 | RDY --> * 30 * --> MEMRQ_ | |
| 34 | +5 V <-- * 31 * --> +5 V | |
| 35 | +12 V <-- * 32 * --> +12 V | |
| 36 | 36 | |
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | 39 | /* |
| 40 | 40 | |
| 41 | OUT 0 _OUT data output | |
| 42 | OUT 1 _CS card select | |
| 43 | OUT 2 _C1 command 1 | |
| 44 | OUT 3 _C2 command 2 | |
| 45 | OUT 4 _C3 command 3 | |
| 46 | OUT 5 _C4 command 4 | |
| 41 | OUT 0 _OUT data output | |
| 42 | OUT 1 _CS card select | |
| 43 | OUT 2 _C1 command 1 | |
| 44 | OUT 3 _C2 command 2 | |
| 45 | OUT 4 _C3 command 3 | |
| 46 | OUT 5 _C4 command 4 | |
| 47 | 47 | |
| 48 | IN 0 _INP data input | |
| 49 | IN 1 _STAT status in | |
| 50 | IN 7 RST reset | |
| 48 | IN 0 _INP data input | |
| 49 | IN 1 _STAT status in | |
| 50 | IN 7 RST reset | |
| 51 | 51 | |
| 52 | 52 | |
| 53 | ABCBUS_CHANNEL_ABC850_852_856 = 36, | |
| 54 | ABCBUS_CHANNEL_ABC832_834_850 = 44, | |
| 55 | ABCBUS_CHANNEL_ABC830 = 45, | |
| 56 | ABCBUS_CHANNEL_ABC838 = 46 | |
| 53 | ABCBUS_CHANNEL_ABC850_852_856 = 36, | |
| 54 | ABCBUS_CHANNEL_ABC832_834_850 = 44, | |
| 55 | ABCBUS_CHANNEL_ABC830 = 45, | |
| 56 | ABCBUS_CHANNEL_ABC838 = 46 | |
| 57 | 57 | |
| 58 | 58 | */ |
| 59 | 59 | |
| 60 | 60 | /* |
| 61 | 61 | |
| 62 | ||
| 62 | Type Size Tracks Sides Sectors/track Sectors Speed Drives | |
| 63 | 63 | |
| 64 | ABC-830 Floppy 160 KB 40 1 16 640 250 Kbps MPI 51, BASF 6106 | |
| 65 | Floppy 80 KB 40 1 8 320 250 Kbps Scandia Metric FD2 | |
| 66 | ABC-832 Floppy 640 KB 80 2 16 2560 250 Kbps Micropolis 1015, Micropolis 1115, BASF 6118 | |
| 67 | ABC-834 Floppy 640 KB 80 2 16 2560 250 Kbps Teac FD 55 F | |
| 68 | ABC-838 Floppy 1 MB 77 2 25 3978 500 Kbps BASF 6104, BASF 6115 | |
| 69 | ABC-850 Floppy 640 KB 80 2 16 2560 250 Kbps TEAC FD 55 F, BASF 6136 | |
| 70 | HDD 10 MB 320 4 32 40960 5 Mbps Rodime 202, BASF 6186 | |
| 71 | ABC-852 Floppy 640 KB 80 2 16 2560 250 Kbps TEAC FD 55 F, BASF 6136 | |
| 72 | HDD 20 MB 615 4 32 78720 5 Mbps NEC 5126 | |
| 73 | Streamer 45 MB 9 90 Kbps Archive 5945-C (tape: DC300XL 450ft) | |
| 74 | ABC-856 Floppy 640 KB 80 2 16 2560 250 Kbps TEAC FD 55 F | |
| 75 | HDD 64 MB 1024 8 32 262144 5 Mbps Micropolis 1325 | |
| 76 | Streamer 45 MB 9 90 Kbps Archive 5945-C (tape: DC300XL 450ft) | |
| 64 | ABC-830 Floppy 160 KB 40 1 16 640 250 Kbps MPI 51, BASF 6106 | |
| 65 | Floppy 80 KB 40 1 8 320 250 Kbps Scandia Metric FD2 | |
| 66 | ABC-832 Floppy 640 KB 80 2 16 2560 250 Kbps Micropolis 1015, Micropolis 1115, BASF 6118 | |
| 67 | ABC-834 Floppy 640 KB 80 2 16 2560 250 Kbps Teac FD 55 F | |
| 68 | ABC-838 Floppy 1 MB 77 2 25 3978 500 Kbps BASF 6104, BASF 6115 | |
| 69 | ABC-850 Floppy 640 KB 80 2 16 2560 250 Kbps TEAC FD 55 F, BASF 6136 | |
| 70 | HDD 10 MB 320 4 32 40960 5 Mbps Rodime 202, BASF 6186 | |
| 71 | ABC-852 Floppy 640 KB 80 2 16 2560 250 Kbps TEAC FD 55 F, BASF 6136 | |
| 72 | HDD 20 MB 615 4 32 78720 5 Mbps NEC 5126 | |
| 73 | Streamer 45 MB 9 90 Kbps Archive 5945-C (tape: DC300XL 450ft) | |
| 74 | ABC-856 Floppy 640 KB 80 2 16 2560 250 Kbps TEAC FD 55 F | |
| 75 | HDD 64 MB 1024 8 32 262144 5 Mbps Micropolis 1325 | |
| 76 | Streamer 45 MB 9 90 Kbps Archive 5945-C (tape: DC300XL 450ft) | |
| 77 | 77 | |
| 78 | 78 | */ |
| 79 | 79 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Matsushita/Panasonic CDR521/522 type CDROM drive emulation | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 630 | 630 | |
| 631 | 631 | while ( !chg && row > 0) |
| 632 | 632 | { |
| 633 | new = input_port_read(device->machine, keynames[row - 1]); | |
| 634 | chg = keyrows[--row] ^ new; | |
| 633 | new = input_port_read(device->machine, keynames[row - 1]); | |
| 634 | chg = keyrows[--row] ^ new; | |
| 635 | 635 | } |
| 636 | if (!chg) | |
| 636 | if (!chg) | |
| 637 | 637 | --row; |
| 638 | 638 | |
| 639 | 639 | if (row >= 0) |
| r5932 | r5933 | |
| 645 | 645 | /* CapsLock LED */ |
| 646 | 646 | if( row == 3 && chg == 0x80 ) |
| 647 | 647 | set_led_status(1, (keyrows[3] & 0x80) ? 0 : 1); |
| 648 | ||
| 648 | ||
| 649 | 649 | if (new & chg) /* key(s) pressed ? */ |
| 650 | 650 | { |
| 651 | 651 | mod = 0; |
| r5932 | r5933 | |
| 717 | 717 | const device_config *via_0 = devtag_get_device(machine, "via6522_0"); |
| 718 | 718 | const device_config *via_1 = devtag_get_device(machine, "via6522_1"); |
| 719 | 719 | const device_config *ay8910 = devtag_get_device(machine, "ay8910.1"); |
| 720 | ||
| 720 | ||
| 721 | 721 | /* check for .DMP file format */ |
| 722 | 722 | if (snapshot_size == 8263) |
| 723 | 723 | { |
| r5932 | r5933 | |
| 931 | 931 | { |
| 932 | 932 | int i; |
| 933 | 933 | static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" }; |
| 934 | ||
| 934 | ||
| 935 | 935 | for (i = 1; i < 10; i++) |
| 936 | 936 | { |
| 937 | 937 | keyrows[i] = input_port_read(machine, keynames[i-1]); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | TMS9902 Asynchronous Communication Controller | |
| 3 | 3 | |
| 4 | ||
| 4 | Raphael Nabet, 2003 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include <math.h> |
| r5932 | r5933 | |
| 10 | 10 | #include "tms9902.h" |
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | ||
| 13 | TMS9902 emulation. | |
| 14 | 14 | |
| 15 | 15 | Overview: |
| 16 | TMS9902 is an asynchronous serial controller for use with the TI990 and | |
| 17 | TMS9900 family. It provides serial I/O, three extra I/O pins (namely RTS, | |
| 18 | DSR and CTS), and a timer. It communicates with the CPU through the CRU | |
| 19 | I/O bus, and one interrupt pin. | |
| 16 | TMS9902 is an asynchronous serial controller for use with the TI990 and | |
| 17 | TMS9900 family. It provides serial I/O, three extra I/O pins (namely RTS, | |
| 18 | DSR and CTS), and a timer. It communicates with the CPU through the CRU | |
| 19 | I/O bus, and one interrupt pin. | |
| 20 | 20 | |
| 21 | 21 | Pins: |
| 22 | ||
| 22 | (...) | |
| 23 | 23 | |
| 24 | 24 | */ |
| 25 | 25 | |
| r5932 | r5933 | |
| 34 | 34 | /* driver-specific configuration */ |
| 35 | 35 | /* tms9902 clock rate (PHI* pin, normally connected to TMS9900 Phi3*) */ |
| 36 | 36 | /* Official range is 2MHz-3.3MHz. Some tms9902s were sold as "MP9214", and |
| 37 | were tested for speeds up to 4MHz, provided the clk4m control bit is set. | |
| 38 | (warning: 3MHz on a tms9900 is equivalent to 12MHz on a tms9995 or tms99000) */ | |
| 37 | were tested for speeds up to 4MHz, provided the clk4m control bit is set. | |
| 38 | (warning: 3MHz on a tms9900 is equivalent to 12MHz on a tms9995 or tms99000) */ | |
| 39 | 39 | double clock_rate; |
| 40 | 40 | |
| 41 | 41 | /* CRU interface */ |
| r5932 | r5933 | |
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | /* |
| 125 | ||
| 125 | should be called after any change to int_state or enabled_ints. | |
| 126 | 126 | */ |
| 127 | 127 | static void field_interrupts(const device_config *device) |
| 128 | 128 | { |
| r5932 | r5933 | |
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | /* |
| 146 | ||
| 146 | function device should be called by the driver when the state of CTS changes | |
| 147 | 147 | |
| 148 | state == 0: CTS* is inactive (high) | |
| 149 | state != 0: CTS* is active (low) | |
| 148 | state == 0: CTS* is inactive (high) | |
| 149 | state != 0: CTS* is active (low) | |
| 150 | 150 | */ |
| 151 | 151 | void tms9902_set_cts(const device_config *device, int state) |
| 152 | 152 | { |
| r5932 | r5933 | |
| 171 | 171 | |
| 172 | 172 | |
| 173 | 173 | /* |
| 174 | ||
| 174 | function device should be called by the driver when the state of DSR changes | |
| 175 | 175 | |
| 176 | state == 0: DSR* is inactive (high) | |
| 177 | state != 0: DSR* is active (low) | |
| 176 | state == 0: DSR* is inactive (high) | |
| 177 | state != 0: DSR* is active (low) | |
| 178 | 178 | */ |
| 179 | 179 | void tms9902_set_dsr(const device_config *device, int state) |
| 180 | 180 | { |
| r5932 | r5933 | |
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | /* |
| 209 | This call-back is called by the MESS timer system when the decrementer | |
| 210 | reaches 0. | |
| 209 | This call-back is called by the MESS timer system when the decrementer | |
| 210 | reaches 0. | |
| 211 | 211 | */ |
| 212 | 212 | static TIMER_CALLBACK(decrementer_callback) |
| 213 | 213 | { |
| r5932 | r5933 | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /* |
| 224 | ||
| 224 | load the content of clockinvl into the decrementer | |
| 225 | 225 | */ |
| 226 | 226 | static void reload_interval_timer(const device_config *device) |
| 227 | 227 | { |
| r5932 | r5933 | |
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | /*---------------------------------------------------------------- |
| 304 | ||
| 304 | TMS9902 CRU interface. | |
| 305 | 305 | ----------------------------------------------------------------*/ |
| 306 | 306 | |
| 307 | 307 | /* |
| 308 | ||
| 308 | Read a 8 bit chunk from tms9902. | |
| 309 | 309 | |
| 310 | signification: | |
| 311 | bit 0-7: RBR0-7 Receive Buffer register | |
| 312 | bit 8: not used (always 0) | |
| 313 | bit 9: RCVERR Receive Error (RFER | ROVER | RPER) | |
| 314 | bit 10: RPER Receive Parity Error | |
| 315 | bit 11: ROVER Receive Overrun Error | |
| 316 | bit 12: RFER Receive Framing Error | |
| 317 | bit 13-15: not emulated, normally used for diagnostics | |
| 318 | bit 16: RBINT (RBRL&RIENB) | |
| 310 | signification: | |
| 311 | bit 0-7: RBR0-7 Receive Buffer register | |
| 312 | bit 8: not used (always 0) | |
| 313 | bit 9: RCVERR Receive Error (RFER | ROVER | RPER) | |
| 314 | bit 10: RPER Receive Parity Error | |
| 315 | bit 11: ROVER Receive Overrun Error | |
| 316 | bit 12: RFER Receive Framing Error | |
| 317 | bit 13-15: not emulated, normally used for diagnostics | |
| 318 | bit 16: RBINT (RBRL&RIENB) | |
| 319 | 319 | */ |
| 320 | 320 | READ8_DEVICE_HANDLER( tms9902_cru_r ) |
| 321 | 321 | { |
| r5932 | r5933 | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /* |
| 364 | ||
| 364 | Write 1 bit to tms9902. | |
| 365 | 365 | |
| 366 | signification: | |
| 367 | ... | |
| 366 | signification: | |
| 367 | ... | |
| 368 | 368 | */ |
| 369 | 369 | WRITE8_DEVICE_HANDLER( tms9902_cru_w ) |
| 370 | 370 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Peripheral expansion bus support. | |
| 3 | 3 | |
| 4 | The ti-99/4, ti-99/4a, ti computer 99/8, myarc geneve, and snug sgcpu | |
| 5 | 99/4p systems all feature a bus connector that enables the connection of | |
| 6 | extension cards. (Although the hexbus is the preferred bus to add | |
| 7 | additional peripherals to a ti-99/8, ti-99/8 is believed to be compatible | |
| 8 | with the older PEB system.) In the case of the TI consoles, this bus | |
| 9 | connector is located on the right side of the console. | |
| 4 | The ti-99/4, ti-99/4a, ti computer 99/8, myarc geneve, and snug sgcpu | |
| 5 | 99/4p systems all feature a bus connector that enables the connection of | |
| 6 | extension cards. (Although the hexbus is the preferred bus to add | |
| 7 | additional peripherals to a ti-99/8, ti-99/8 is believed to be compatible | |
| 8 | with the older PEB system.) In the case of the TI consoles, this bus | |
| 9 | connector is located on the right side of the console. | |
| 10 | 10 | |
| 11 | While a few extension cards connect to the side bus connector of the | |
| 12 | ti-99/4(a) console directly, most extension cards were designed to be | |
| 13 | inserted in a PEB instead. The PEB (Peripheral Expansion Box) is a big box | |
| 14 | with an alimentation, a few bus drivers, and several card slots, that | |
| 15 | connects to the ti-99/4(a) side port. The reason for using a PEB is that | |
| 16 | daisy-chaining many modules caused the system to be unreliable due to the | |
| 17 | noise produced by the successive contacts. (As a matter of fact, TI | |
| 18 | initially released most of its extension cards as side bus units, but when | |
| 19 | the design proved to be unreliable, the PEB was introduced. The TI speech | |
| 20 | synthesizer was the only TI extension that remained on the side bus after | |
| 21 | the introduction of the PEB, probably because TI wanted the speech | |
| 22 | synthesizer to be a cheap extension, and the PEB was not cheap.) | |
| 11 | While a few extension cards connect to the side bus connector of the | |
| 12 | ti-99/4(a) console directly, most extension cards were designed to be | |
| 13 | inserted in a PEB instead. The PEB (Peripheral Expansion Box) is a big box | |
| 14 | with an alimentation, a few bus drivers, and several card slots, that | |
| 15 | connects to the ti-99/4(a) side port. The reason for using a PEB is that | |
| 16 | daisy-chaining many modules caused the system to be unreliable due to the | |
| 17 | noise produced by the successive contacts. (As a matter of fact, TI | |
| 18 | initially released most of its extension cards as side bus units, but when | |
| 19 | the design proved to be unreliable, the PEB was introduced. The TI speech | |
| 20 | synthesizer was the only TI extension that remained on the side bus after | |
| 21 | the introduction of the PEB, probably because TI wanted the speech | |
| 22 | synthesizer to be a cheap extension, and the PEB was not cheap.) | |
| 23 | 23 | |
| 24 | The third-party myarc geneve and snug sgcpu computers are actually cards | |
| 25 | to be inserted into a PEB: they have a PC keyboard connector, and replace | |
| 26 | the original ti-99 console completely. | |
| 24 | The third-party myarc geneve and snug sgcpu computers are actually cards | |
| 25 | to be inserted into a PEB: they have a PC keyboard connector, and replace | |
| 26 | the original ti-99 console completely. | |
| 27 | 27 | |
| 28 | Each expansion card is assigned to one of 16 CRU address ranges. | |
| 29 | I appended the names of known TI peripherals that use each port (I appended | |
| 30 | '???' when I don't know what the peripheral is :-) ). | |
| 31 | * 0x1000-0x10FE "For test equipment use on production line" | |
| 32 | * 0x1100-0x11FE disk controller | |
| 33 | * 0x1200-0x12FE modem??? | |
| 34 | * 0x1300-0x13FE RS232 1&2, PIO 1 | |
| 35 | * 0x1400-0x14FE unassigned | |
| 36 | * 0x1500-0x15FE RS232 3&4, PIO 2 | |
| 37 | * 0x1600-0x16FE unassigned | |
| 38 | * 0x1700-0x17FE hex-bus (prototypes) | |
| 39 | * 0x1800-0x18FE thermal printer (early peripheral) | |
| 40 | * 0x1900-0x19FE EPROM programmer??? (Mezzanine board in July 1981's TI99/7 | |
| 41 | prototype) | |
| 42 | * 0x1A00-0x1AFE unassigned | |
| 43 | * 0x1B00-0x1BFE TI GPL debugger card | |
| 44 | * 0x1C00-0x1CFE Video Controller Card (Possibly the weirdest device. This | |
| 45 | card is connected to the video output of the computer, to a VCR, and a | |
| 46 | video monitor. It can control the VCR, connect the display to either | |
| 47 | VCR output or computer video output, and it can read or save binary | |
| 48 | data to video tape. I think it can act as a genlock interface (i.e. | |
| 49 | TMS9918 transparent background shows the video signal), too, but I am | |
| 50 | not sure about this.) | |
| 51 | * 0x1D00-0x1DFE IEEE 488 Controller Card ('intelligent' parallel bus, | |
| 52 | schematics on ftp.whtech.com) | |
| 53 | * 0x1E00-0x1EFE unassigned | |
| 54 | * 0x1F00-0x1FFE P-code card (part of a complete development system) | |
| 28 | Each expansion card is assigned to one of 16 CRU address ranges. | |
| 29 | I appended the names of known TI peripherals that use each port (I appended | |
| 30 | '???' when I don't know what the peripheral is :-) ). | |
| 31 | * 0x1000-0x10FE "For test equipment use on production line" | |
| 32 | * 0x1100-0x11FE disk controller | |
| 33 | * 0x1200-0x12FE modem??? | |
| 34 | * 0x1300-0x13FE RS232 1&2, PIO 1 | |
| 35 | * 0x1400-0x14FE unassigned | |
| 36 | * 0x1500-0x15FE RS232 3&4, PIO 2 | |
| 37 | * 0x1600-0x16FE unassigned | |
| 38 | * 0x1700-0x17FE hex-bus (prototypes) | |
| 39 | * 0x1800-0x18FE thermal printer (early peripheral) | |
| 40 | * 0x1900-0x19FE EPROM programmer??? (Mezzanine board in July 1981's TI99/7 | |
| 41 | prototype) | |
| 42 | * 0x1A00-0x1AFE unassigned | |
| 43 | * 0x1B00-0x1BFE TI GPL debugger card | |
| 44 | * 0x1C00-0x1CFE Video Controller Card (Possibly the weirdest device. This | |
| 45 | card is connected to the video output of the computer, to a VCR, and a | |
| 46 | video monitor. It can control the VCR, connect the display to either | |
| 47 | VCR output or computer video output, and it can read or save binary | |
| 48 | data to video tape. I think it can act as a genlock interface (i.e. | |
| 49 | TMS9918 transparent background shows the video signal), too, but I am | |
| 50 | not sure about this.) | |
| 51 | * 0x1D00-0x1DFE IEEE 488 Controller Card ('intelligent' parallel bus, | |
| 52 | schematics on ftp.whtech.com) | |
| 53 | * 0x1E00-0x1EFE unassigned | |
| 54 | * 0x1F00-0x1FFE P-code card (part of a complete development system) | |
| 55 | 55 | |
| 56 | The ti-99/8 implements 16 extra ports: | |
| 57 | * 0x2000-0x26ff and 0x2800-0x2fff: reserved for future expansion? | |
| 58 | * 0x2700-0x27ff: internal DSR | |
| 56 | The ti-99/8 implements 16 extra ports: | |
| 57 | * 0x2000-0x26ff and 0x2800-0x2fff: reserved for future expansion? | |
| 58 | * 0x2700-0x27ff: internal DSR | |
| 59 | 59 | |
| 60 | The snug sgcpu 99/4p implements 12 extra ports: | |
| 61 | * 0x0400-0x0eff: free | |
| 62 | * 0x0f00-0x0fff: internal DSR | |
| 60 | The snug sgcpu 99/4p implements 12 extra ports: | |
| 61 | * 0x0400-0x0eff: free | |
| 62 | * 0x0f00-0x0fff: internal DSR | |
| 63 | 63 | |
| 64 | Known mappings for 3rd party cards: | |
| 65 | * Horizon RAMdisk: any ports from 0 to 7 (port 0 is most common). | |
| 66 | * Myarc 128k/512k (RAM and DSR ROM): port 0 (0x1000-0x11FE) | |
| 67 | * Corcomp 512k (RAM and DSR ROM): port unknown | |
| 68 | * Super AMS 128k/512k: port 14 (0x1E00-0x1EFE) | |
| 69 | * Foundation 128k/512k: port 14 (0x1E00-0x1EFE) | |
| 70 | * Gram Karte: any port (0-15) | |
| 71 | * EVPC (video card): 0x1400-0x14FE | |
| 72 | * HSGPL (GROM replacement): 0x1B00-0x1BFE | |
| 64 | Known mappings for 3rd party cards: | |
| 65 | * Horizon RAMdisk: any ports from 0 to 7 (port 0 is most common). | |
| 66 | * Myarc 128k/512k (RAM and DSR ROM): port 0 (0x1000-0x11FE) | |
| 67 | * Corcomp 512k (RAM and DSR ROM): port unknown | |
| 68 | * Super AMS 128k/512k: port 14 (0x1E00-0x1EFE) | |
| 69 | * Foundation 128k/512k: port 14 (0x1E00-0x1EFE) | |
| 70 | * Gram Karte: any port (0-15) | |
| 71 | * EVPC (video card): 0x1400-0x14FE | |
| 72 | * HSGPL (GROM replacement): 0x1B00-0x1BFE | |
| 73 | 73 | |
| 74 | Of course, these devices additionally need some support routines, and | |
| 75 | possibly memory-mapped I/O registers. To do so, memory range 0x4000-5FFF | |
| 76 | is shared by all cards. The system enables each card as needed by writing | |
| 77 | a 1 to the first CRU bit: when this happens the card can safely enable its | |
| 78 | ROM, RAM, memory-mapped registers, etc. Provided the ROM uses the proper | |
| 79 | ROM header, the system will recognize and call peripheral I/O functions, | |
| 80 | interrupt service routines, and startup routines. (All these routines are | |
| 81 | generally called DSR = Device Service Routine.) | |
| 74 | Of course, these devices additionally need some support routines, and | |
| 75 | possibly memory-mapped I/O registers. To do so, memory range 0x4000-5FFF | |
| 76 | is shared by all cards. The system enables each card as needed by writing | |
| 77 | a 1 to the first CRU bit: when this happens the card can safely enable its | |
| 78 | ROM, RAM, memory-mapped registers, etc. Provided the ROM uses the proper | |
| 79 | ROM header, the system will recognize and call peripheral I/O functions, | |
| 80 | interrupt service routines, and startup routines. (All these routines are | |
| 81 | generally called DSR = Device Service Routine.) | |
| 82 | 82 | |
| 83 | Also, the cards can trigger level-1 ("INTA") interrupts. A LOAD interrupt | |
| 84 | is present on the side port of the ti-99/4(a), too, but it was never used | |
| 85 | by TI, AFAIK. Also, an interrupt line called "INTB" is found on several | |
| 86 | cards built by TI, but it is not connected: I am quite unsure whether it | |
| 87 | was intended to be connected to the LOAD line, to the INT2 line of TMS9985, | |
| 88 | or it was only to be used with the ti-99/4(a) development system running on | |
| 89 | a TI990/10. This is not the only unused feature: cards built by TI support | |
| 90 | sensing of an interrupt status register and 19-bit addressing, even though | |
| 91 | ti-99/4(A) does not take advantage of these features. TI documentation | |
| 92 | tells that some of these features are "defined by the Personal Computer PCC | |
| 93 | at Texas Instrument", which is not very explicit (What on earth does "PCC" | |
| 94 | stand for?). Maybe it refers to the ti-99/4(a) development system running | |
| 95 | on a TI990/10, or to the ti-99/7 and ti-99/8 prototypes. | |
| 83 | Also, the cards can trigger level-1 ("INTA") interrupts. A LOAD interrupt | |
| 84 | is present on the side port of the ti-99/4(a), too, but it was never used | |
| 85 | by TI, AFAIK. Also, an interrupt line called "INTB" is found on several | |
| 86 | cards built by TI, but it is not connected: I am quite unsure whether it | |
| 87 | was intended to be connected to the LOAD line, to the INT2 line of TMS9985, | |
| 88 | or it was only to be used with the ti-99/4(a) development system running on | |
| 89 | a TI990/10. This is not the only unused feature: cards built by TI support | |
| 90 | sensing of an interrupt status register and 19-bit addressing, even though | |
| 91 | ti-99/4(A) does not take advantage of these features. TI documentation | |
| 92 | tells that some of these features are "defined by the Personal Computer PCC | |
| 93 | at Texas Instrument", which is not very explicit (What on earth does "PCC" | |
| 94 | stand for?). Maybe it refers to the ti-99/4(a) development system running | |
| 95 | on a TI990/10, or to the ti-99/7 and ti-99/8 prototypes. | |
| 96 | 96 | |
| 97 | Note that I use 8-bit RAM handlers. Obviously, using 16-bit handlers would | |
| 98 | be equivalent and faster on a ti-99/4(a), but we need to interface the | |
| 99 | extension cards not only to the ti-99/4(a), but to the geneve and ti-99/8 | |
| 100 | emulators as well. | |
| 97 | Note that I use 8-bit RAM handlers. Obviously, using 16-bit handlers would | |
| 98 | be equivalent and faster on a ti-99/4(a), but we need to interface the | |
| 99 | extension cards not only to the ti-99/4(a), but to the geneve and ti-99/8 | |
| 100 | emulators as well. | |
| 101 | 101 | */ |
| 102 | 102 | |
| 103 | 103 | #include "driver.h" |
| r5932 | r5933 | |
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | /* |
| 170 | ||
| 170 | Initializes the expansion card handlers | |
| 171 | 171 | |
| 172 | 172 | */ |
| 173 | 173 | void ti99_peb_init() |
| r5932 | r5933 | |
| 178 | 178 | |
| 179 | 179 | |
| 180 | 180 | /* |
| 181 | ||
| 181 | Resets the expansion card handlers | |
| 182 | 182 | |
| 183 | in_has_16bit_peb: TRUE if we are using the snug sgcpu 99/4p 16-bit | |
| 184 | extensions | |
| 185 | in_inta_callback: callback called when the state of INTA changes (may be | |
| 186 | NULL) | |
| 187 | in_intb_callback: callback called when the state of INTB changes (may be | |
| 188 | NULL) | |
| 183 | in_has_16bit_peb: TRUE if we are using the snug sgcpu 99/4p 16-bit | |
| 184 | extensions | |
| 185 | in_inta_callback: callback called when the state of INTA changes (may be | |
| 186 | NULL) | |
| 187 | in_intb_callback: callback called when the state of INTB changes (may be | |
| 188 | NULL) | |
| 189 | 189 | */ |
| 190 | 190 | void ti99_peb_reset(int in_has_16bit_peb, void (*in_inta_callback)(running_machine *machine, int state), void (*in_intb_callback)(running_machine *machine, int state)) |
| 191 | 191 | { |
| r5932 | r5933 | |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /* |
| 205 | ||
| 205 | Sets the handlers for one expansion port (normal 8-bit card) | |
| 206 | 206 | |
| 207 | cru_base: CRU base address (any of 0x1000, 0x1100, 0x1200, ..., 0x1F00) | |
| 208 | (snug sgcpu 99/4p accepts 0x0400, ..., 0x1F00, ti-99/8 accepts 0x1000, | |
| 209 | ..., 0x2F00) | |
| 210 | handler: handler structure for the given card | |
| 207 | cru_base: CRU base address (any of 0x1000, 0x1100, 0x1200, ..., 0x1F00) | |
| 208 | (snug sgcpu 99/4p accepts 0x0400, ..., 0x1F00, ti-99/8 accepts 0x1000, | |
| 209 | ..., 0x2F00) | |
| 210 | handler: handler structure for the given card | |
| 211 | 211 | */ |
| 212 | 212 | void ti99_peb_set_card_handlers(int cru_base, const ti99_peb_card_handlers_t *handler) |
| 213 | 213 | { |
| r5932 | r5933 | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /* |
| 244 | Sets the handlers for one expansion port (special 16-bit card for snug | |
| 245 | sgcpu 99/4p) | |
| 244 | Sets the handlers for one expansion port (special 16-bit card for snug | |
| 245 | sgcpu 99/4p) | |
| 246 | 246 | |
| 247 | cru_base: CRU base address (any of 0x1000, 0x1100, 0x1200, ..., 0x1F00) | |
| 248 | (snug sgcpu 99/4p accepts 0x0400, ..., 0x1F00, ti-99/8 accepts 0x1000, | |
| 249 | ..., 0x2F00) | |
| 250 | handler: handler structure for the given card | |
| 247 | cru_base: CRU base address (any of 0x1000, 0x1100, 0x1200, ..., 0x1F00) | |
| 248 | (snug sgcpu 99/4p accepts 0x0400, ..., 0x1F00, ti-99/8 accepts 0x1000, | |
| 249 | ..., 0x2F00) | |
| 250 | handler: handler structure for the given card | |
| 251 | 251 | */ |
| 252 | 252 | void ti99_peb_set_16bit_card_handlers(int cru_base, const ti99_peb_16bit_card_handlers_t *handler) |
| 253 | 253 | { |
| r5932 | r5933 | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /* |
| 275 | Update ila status register and assert or clear INTA interrupt line | |
| 276 | accordingly. | |
| 275 | Update ila status register and assert or clear INTA interrupt line | |
| 276 | accordingly. | |
| 277 | 277 | |
| 278 | bit: bit number ([0,7] for original INTA register, [8,15] are extra | |
| 279 | "virtual" bits for devices that assert the INTA line without setting a | |
| 280 | bit of the ILA register) | |
| 281 | state: 1 to assert bit, 0 to clear | |
| 278 | bit: bit number ([0,7] for original INTA register, [8,15] are extra | |
| 279 | "virtual" bits for devices that assert the INTA line without setting a | |
| 280 | bit of the ILA register) | |
| 281 | state: 1 to assert bit, 0 to clear | |
| 282 | 282 | */ |
| 283 | 283 | void ti99_peb_set_ila_bit(running_machine *machine, int bit, int state) |
| 284 | 284 | { |
| r5932 | r5933 | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /* |
| 300 | Update ilb status register and assert or clear INTB interrupt line | |
| 301 | accordingly. | |
| 300 | Update ilb status register and assert or clear INTB interrupt line | |
| 301 | accordingly. | |
| 302 | 302 | |
| 303 | bit: bit number ([0,7] for original INTAB register, [8,15] are extra | |
| 304 | "virtual" bits for devices that assert the INTB line without setting a | |
| 305 | bit of the ILB register) | |
| 306 | state: 1 to assert bit, 0 to clear | |
| 303 | bit: bit number ([0,7] for original INTAB register, [8,15] are extra | |
| 304 | "virtual" bits for devices that assert the INTB line without setting a | |
| 305 | bit of the ILB register) | |
| 306 | state: 1 to assert bit, 0 to clear | |
| 307 | 307 | */ |
| 308 | 308 | void ti99_peb_set_ilb_bit(running_machine *machine, int bit, int state) |
| 309 | 309 | { |
| r5932 | r5933 | |
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | /* |
| 326 | ||
| 326 | Read CRU in range >1000->1ffe (>800->fff) (ti-99/4(a)) | |
| 327 | 327 | */ |
| 328 | 328 | READ8_HANDLER ( ti99_4x_peb_cru_r ) |
| 329 | 329 | { |
| r5932 | r5933 | |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /* |
| 343 | ||
| 343 | Write CRU in range >1000->1ffe (>800->fff) (ti-99/4(a)) | |
| 344 | 344 | */ |
| 345 | 345 | WRITE8_HANDLER ( ti99_4x_peb_cru_w ) |
| 346 | 346 | { |
| r5932 | r5933 | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /* |
| 375 | ||
| 375 | Read mem in range >4000->5ffe (ti-99/4(a)) | |
| 376 | 376 | */ |
| 377 | 377 | READ16_HANDLER ( ti99_4x_peb_r ) |
| 378 | 378 | { |
| r5932 | r5933 | |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /* |
| 398 | ||
| 398 | Write mem in range >4000->5ffe (ti-99/4(a)) | |
| 399 | 399 | */ |
| 400 | 400 | WRITE16_HANDLER ( ti99_4x_peb_w ) |
| 401 | 401 | { |
| r5932 | r5933 | |
| 419 | 419 | |
| 420 | 420 | |
| 421 | 421 | /* |
| 422 | ||
| 422 | Read CRU in range >1000->1ffe (>800->fff) (Geneve) | |
| 423 | 423 | */ |
| 424 | 424 | READ8_HANDLER ( geneve_peb_cru_r ) |
| 425 | 425 | { |
| r5932 | r5933 | |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /* |
| 439 | ||
| 439 | Write CRU in range >1000->1ffe (>800->fff) (Geneve) | |
| 440 | 440 | */ |
| 441 | 441 | WRITE8_HANDLER ( geneve_peb_cru_w ) |
| 442 | 442 | { |
| r5932 | r5933 | |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | /* |
| 471 | ||
| 471 | Read mem in range >4000->5fff (Geneve) | |
| 472 | 472 | */ |
| 473 | 473 | READ8_HANDLER ( geneve_peb_r ) |
| 474 | 474 | { |
| r5932 | r5933 | |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | /* |
| 491 | ||
| 491 | Write mem in range >4000->5fff (Geneve) | |
| 492 | 492 | */ |
| 493 | 493 | WRITE8_HANDLER ( geneve_peb_w ) |
| 494 | 494 | { |
| r5932 | r5933 | |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | /* |
| 508 | ||
| 508 | Read CRU in range >1000->2ffe (>0800->17ff) (ti-99/8) | |
| 509 | 509 | */ |
| 510 | 510 | READ8_HANDLER ( ti99_8_peb_cru_r ) |
| 511 | 511 | { |
| r5932 | r5933 | |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | /* |
| 525 | ||
| 525 | Write CRU in range >1000->2ffe (>0800->17ff) (ti-99/8) | |
| 526 | 526 | */ |
| 527 | 527 | WRITE8_HANDLER ( ti99_8_peb_cru_w ) |
| 528 | 528 | { |
| r5932 | r5933 | |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | /* |
| 557 | ||
| 557 | Read mem in range >4000->5fff (ti-99/8) | |
| 558 | 558 | */ |
| 559 | 559 | READ8_HANDLER ( ti99_8_peb_r ) |
| 560 | 560 | { |
| r5932 | r5933 | |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /* |
| 577 | ||
| 577 | Write mem in range >4000->5fff (ti-99/8) | |
| 578 | 578 | */ |
| 579 | 579 | WRITE8_HANDLER ( ti99_8_peb_w ) |
| 580 | 580 | { |
| r5932 | r5933 | |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /* |
| 594 | ||
| 594 | Read CRU in range >0400->1ffe (>200->fff) (snug sgcpu 99/4p) | |
| 595 | 595 | */ |
| 596 | 596 | READ8_HANDLER ( ti99_4p_peb_cru_r ) |
| 597 | 597 | { |
| r5932 | r5933 | |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | /* |
| 611 | ||
| 611 | Write CRU in range >0400->1ffe (>200->fff) (snug sgcpu 99/4p) | |
| 612 | 612 | */ |
| 613 | 613 | WRITE8_HANDLER ( ti99_4p_peb_cru_w ) |
| 614 | 614 | { |
| r5932 | r5933 | |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | /* |
| 661 | ||
| 661 | Read mem in range >4000->5ffe (snug sgcpu 99/4p) | |
| 662 | 662 | */ |
| 663 | 663 | READ16_HANDLER ( ti99_4p_peb_r ) |
| 664 | 664 | { |
| r5932 | r5933 | |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /* |
| 712 | ||
| 712 | Write mem in range >4000->5ffe (snug sgcpu 99/4p) | |
| 713 | 713 | */ |
| 714 | 714 | WRITE16_HANDLER ( ti99_4p_peb_w ) |
| 715 | 715 | { |
| r5932 | r5933 | |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | /* |
| 749 | ||
| 749 | Set the state of the SENILA line (snug sgcpu 99/4p) | |
| 750 | 750 | */ |
| 751 | 751 | void ti99_4p_peb_set_senila(int state) |
| 752 | 752 | { |
| r5932 | r5933 | |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | /* |
| 757 | ||
| 757 | Set the state of the SENILB line (snug sgcpu 99/4p) | |
| 758 | 758 | */ |
| 759 | 759 | void ti99_4p_peb_set_senilb(int state) |
| 760 | 760 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Amiga cartridge emulation | |
| 4 | 4 | |
| 5 | 5 | TODO: |
| 6 | 6 | - Investigate why the AR2/3 sometimes garble the video on exit from the cart |
| r5932 | r5933 | |
| 113 | 113 | if ( ((pc >> 16) & 0xff ) != 0xf0 ) |
| 114 | 114 | { |
| 115 | 115 | /* if we're not, see if either the Spurious IRQ vector |
| 116 | ||
| 116 | or the NMI vector are being overwritten */ | |
| 117 | 117 | if ( offset == (0x60/2) || offset == (0x7c/2) ) |
| 118 | 118 | { |
| 119 | 119 | /* trigger an NMI or spurious irq */ |
| r5932 | r5933 | |
| 367 | 367 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK(3)); |
| 368 | 368 | |
| 369 | 369 | /* Install Custom chip monitor */ |
| 370 | // memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r); | |
| 371 | // memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w); | |
| 370 | // memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r); | |
| 371 | // memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w); | |
| 372 | 372 | |
| 373 | 373 | /* Install status/mode handlers */ |
| 374 | 374 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r); |
| r5932 | r5933 | |
| 387 | 387 | |
| 388 | 388 | /*************************************************************************** |
| 389 | 389 | |
| 390 | ||
| 390 | MAME/MESS hooks | |
| 391 | 391 | |
| 392 | 392 | ***************************************************************************/ |
| 393 | 393 |
| r5932 | r5933 | |
|---|---|---|
| 336 | 336 | |
| 337 | 337 | //static const struct aica6850_interface osborne1_6850_config = |
| 338 | 338 | //{ |
| 339 | // 10, /* tx_clock */ | |
| 340 | // 10, /* rx_clock */ | |
| 341 | // NULL, /* rx_pin */ | |
| 342 | // NULL, /* tx_pin */ | |
| 343 | // NULL, /* cts_pin */ | |
| 344 | // NULL, /* rts_pin */ | |
| 345 | // NULL, /* dcd_pin */ | |
| 346 | // NULL /* int_callback */ | |
| 339 | // 10, /* tx_clock */ | |
| 340 | // 10, /* rx_clock */ | |
| 341 | // NULL, /* rx_pin */ | |
| 342 | // NULL, /* tx_pin */ | |
| 343 | // NULL, /* cts_pin */ | |
| 344 | // NULL, /* rts_pin */ | |
| 345 | // NULL, /* dcd_pin */ | |
| 346 | // NULL /* int_callback */ | |
| 347 | 347 | //}; |
| 348 | 348 | |
| 349 | 349 | |
| r5932 | r5933 | |
| 474 | 474 | { |
| 475 | 475 | floppy_install_load_proc(floppy_get_device(machine, drive), osborne1_load_proc); |
| 476 | 476 | } |
| 477 | ||
| 477 | ||
| 478 | 478 | memory_set_direct_update_handler( space, osborne1_opbase ); |
| 479 | 479 | } |
| 480 | 480 | |
| r5932 | r5933 | |
| 487 | 487 | memset( osborne1.empty_4K, 0xFF, 0x1000 ); |
| 488 | 488 | |
| 489 | 489 | /* Configure the 6850 ACIA */ |
| 490 | // | |
| 490 | // acia6850_config( 0, &osborne1_6850_config ); | |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | |
| 494 | 494 | /**************************************************************** |
| 495 | ||
| 495 | Osborne1 specific daisy chain code | |
| 496 | 496 | ****************************************************************/ |
| 497 | 497 | |
| 498 | 498 | |
| r5932 | r5933 | |
| 507 | 507 | /* Enable ROM and I/O when IRQ is acknowledged */ |
| 508 | 508 | UINT8 old_bankswitch = osborne1.bankswitch; |
| 509 | 509 | const address_space* space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 510 | ||
| 510 | ||
| 511 | 511 | osborne1_bankswitch_w( space, 0, 0 ); |
| 512 | 512 | osborne1.bankswitch = old_bankswitch; |
| 513 | 513 | osborne1.in_irq_handler = 1; |
| r5932 | r5933 | |
|---|---|---|
| 516 | 516 | /* |
| 517 | 517 | DMA commands |
| 518 | 518 | |
| 519 | 0RDDh LOAD R,D Load 8 bit data D to PSG register R (0<=R<=15) | |
| 520 | 1NNNh PAUSE N Pause for N prescaled ticks (0<N<=4095) | |
| 521 | 2NNNh REPEAT N Set loop counter to N for this stream (0<N<=4095), and mark next instruction as loop start. | |
| 522 | 3xxxh (reserved) Do not use | |
| 523 | 4000h NOP No operation (64us idle) | |
| 524 | 4001h LOOP If loop counter non zero, loop back to the first instruction after REPEAT instruction and decrement loop counter. | |
| 525 | 4010h INT Interrupt the CPU | |
| 526 | 4020h STOP Stop processing the sound list. | |
| 519 | 0RDDh LOAD R,D Load 8 bit data D to PSG register R (0<=R<=15) | |
| 520 | 1NNNh PAUSE N Pause for N prescaled ticks (0<N<=4095) | |
| 521 | 2NNNh REPEAT N Set loop counter to N for this stream (0<N<=4095), and mark next instruction as loop start. | |
| 522 | 3xxxh (reserved) Do not use | |
| 523 | 4000h NOP No operation (64us idle) | |
| 524 | 4001h LOOP If loop counter non zero, loop back to the first instruction after REPEAT instruction and decrement loop counter. | |
| 525 | 4010h INT Interrupt the CPU | |
| 526 | 4020h STOP Stop processing the sound list. | |
| 527 | 527 | */ |
| 528 | 528 | |
| 529 | 529 | static void amstrad_plus_dma_parse(running_machine *machine, int channel) |
| r5932 | r5933 | |
| 544 | 544 | return; |
| 545 | 545 | } |
| 546 | 546 | command = (mess_ram[asic.dma_addr[channel]+1] << 8) + mess_ram[asic.dma_addr[channel]]; |
| 547 | // | |
| 547 | // logerror("DMA #%i: address %04x: command %04x\n",channel,asic.dma_addr[channel],command); | |
| 548 | 548 | switch (command & 0xf000) |
| 549 | 549 | { |
| 550 | 550 | case 0x0000: // Load PSG register |
| r5932 | r5933 | |
| 1025 | 1025 | UINT16 *p = BITMAP_ADDR16( bitmap, y, 0 ); |
| 1026 | 1026 | int i; |
| 1027 | 1027 | |
| 1028 | // | |
| 1028 | // logerror( "amstrad_plus_update_row_sprites: ma = 0x%04x, ra = %d, y = %d, x_count = %d, cursor_x = %d\n", ma, ra, y, x_count, cursor_x ); | |
| 1029 | 1029 | |
| 1030 | 1030 | for ( i = 15 * 8; i >= 0; i -= 8 ) |
| 1031 | 1031 | { |
| r5932 | r5933 | |
| 1074 | 1074 | UINT16 *p = BITMAP_ADDR16( bitmap, y, 0 ); |
| 1075 | 1075 | int i; |
| 1076 | 1076 | |
| 1077 | // | |
| 1077 | // logerror( "aleste_update_row_mode2: ma = 0x%04x, ra = %d, y = %d, x_count = %d, cursor_x = %d\n", ma, ra, y, x_count, cursor_x ); | |
| 1078 | 1078 | |
| 1079 | 1079 | for ( i = 0; i < x_count; i++ ) |
| 1080 | 1080 | { |
| r5932 | r5933 | |
| 1120 | 1120 | UINT16 *p = BITMAP_ADDR16( bitmap, y, 0 ); |
| 1121 | 1121 | int i; |
| 1122 | 1122 | |
| 1123 | // | |
| 1123 | // logerror( "aleste_update_row_mode3: ma = 0x%04x, ra = %d, y = %d, x_count = %d, cursor_x = %d\n", ma, ra, y, x_count, cursor_x ); | |
| 1124 | 1124 | |
| 1125 | 1125 | for ( i = 0; i < x_count; i++ ) |
| 1126 | 1126 | { |
| r5932 | r5933 | |
| 1154 | 1154 | |
| 1155 | 1155 | static MC6845_UPDATE_ROW( amstrad_update_row ) |
| 1156 | 1156 | { |
| 1157 | // | |
| 1157 | // logerror( "amstrad_update_row: ma = 0x%04x, ra = %d, y = %d, x_count = %d, cursor_x = %d\n", ma, ra, y, x_count, cursor_x ); | |
| 1158 | 1158 | |
| 1159 | 1159 | if ( draw_function ) |
| 1160 | 1160 | draw_function( device, bitmap, cliprect, ma, ra, y, x_count, cursor_x, param ); |
| r5932 | r5933 | |
| 1685 | 1685 | { // ASIC secondary lower ROM selection (bit 5: 1 = enabled) |
| 1686 | 1686 | if ( asic.enabled ) |
| 1687 | 1687 | { |
| 1688 | // | |
| 1688 | // logerror("L-ROM: Lower ROM enabled, cart bank %i\n", asic.rmr2 & 0x07 ); | |
| 1689 | 1689 | bank_base = &memory_region(machine, "maincpu")[0x4000 * ( asic.rmr2 & 0x07 )]; |
| 1690 | 1690 | switch( asic.rmr2 & 0x18 ) |
| 1691 | 1691 | { |
| 1692 | 1692 | case 0x00: |
| 1693 | // | |
| 1693 | // logerror("L-ROM: located at &0000\n"); | |
| 1694 | 1694 | memory_set_bankptr(machine,1, bank_base); |
| 1695 | 1695 | memory_set_bankptr(machine,2, bank_base+0x02000); |
| 1696 | 1696 | break; |
| 1697 | 1697 | case 0x08: |
| 1698 | // | |
| 1698 | // logerror("L-ROM: located at &4000\n"); | |
| 1699 | 1699 | memory_set_bankptr(machine,3, bank_base); |
| 1700 | 1700 | memory_set_bankptr(machine,4, bank_base+0x02000); |
| 1701 | 1701 | break; |
| 1702 | 1702 | case 0x10: |
| 1703 | // | |
| 1703 | // logerror("L-ROM: located at &8000\n"); | |
| 1704 | 1704 | memory_set_bankptr(machine,5, bank_base); |
| 1705 | 1705 | memory_set_bankptr(machine,6, bank_base+0x02000); |
| 1706 | 1706 | break; |
| 1707 | 1707 | case 0x18: |
| 1708 | // | |
| 1708 | // logerror("L-ROM: located at &0000, ASIC registers enabled\n"); | |
| 1709 | 1709 | memory_set_bankptr(machine,1, bank_base); |
| 1710 | 1710 | memory_set_bankptr(machine,2, bank_base+0x02000); |
| 1711 | 1711 | break; |
| r5932 | r5933 | |
| 1785 | 1785 | Aleste_RamBanks[i] = BankAddr; |
| 1786 | 1786 | AmstradCPC_RamBanks[i] = BankAddr; |
| 1787 | 1787 | } |
| 1788 | } | |
| 1789 | else | |
| 1788 | } | |
| 1789 | else | |
| 1790 | 1790 | {/* Need to add the ram expansion configuration here ! */ |
| 1791 | 1791 | } |
| 1792 | 1792 | amstrad_rethinkMemory(machine); |
| r5932 | r5933 | |
| 1862 | 1862 | WRITE8_HANDLER( amstrad_plus_asic_4000_w ) |
| 1863 | 1863 | { |
| 1864 | 1864 | video_screen_update_partial( space->machine->primary_screen, video_screen_get_vpos( space->machine->primary_screen ) ); |
| 1865 | // | |
| 1865 | // logerror("ASIC: Write to register at &%04x\n",offset+0x4000); | |
| 1866 | 1866 | amstrad_plus_asic_ram[offset] = data & 0x0f; |
| 1867 | 1867 | } |
| 1868 | 1868 | |
| r5932 | r5933 | |
| 1877 | 1877 | } |
| 1878 | 1878 | if(offset == 0x0800) // Programmable raster interrupt |
| 1879 | 1879 | { |
| 1880 | // | |
| 1880 | // logerror("ASIC: Wrote %02x to PRI\n",data); | |
| 1881 | 1881 | asic.pri = data; |
| 1882 | 1882 | } |
| 1883 | 1883 | if(offset >= 0x0801 && offset <= 0x0803) // Split screen registers |
| r5932 | r5933 | |
| 2049 | 2049 | static void amstrad_GateArray_write(running_machine *machine, UINT8 dataToGateArray) |
| 2050 | 2050 | { |
| 2051 | 2051 | /* Get Bit 7 and 6 of the dataToGateArray = Gate Array function selected */ |
| 2052 | switch ((dataToGateArray & 0xc0)>>6) | |
| 2052 | switch ((dataToGateArray & 0xc0)>>6) | |
| 2053 | 2053 | { |
| 2054 | 2054 | /* Pen selection |
| 2055 | 2055 | ------------- |
| r5932 | r5933 | |
| 2132 | 2132 | } |
| 2133 | 2133 | |
| 2134 | 2134 | /* If bit 4 of the "Select screen mode and rom configuration" register of the Gate-Array is set to "1" |
| 2135 | ||
| 2135 | then the interrupt request is cleared and the 6-bit counter is reset to "0". */ | |
| 2136 | 2136 | if ( gate_array.mrer & 0x10 ) |
| 2137 | 2137 | { |
| 2138 | 2138 | amstrad_CRTC_HS_Counter = 0; |
| r5932 | r5933 | |
| 2298 | 2298 | |
| 2299 | 2299 | unsigned char data = 0xFF; |
| 2300 | 2300 | unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8); |
| 2301 | // | |
| 2301 | // m6845_personality_t crtc_type; | |
| 2302 | 2302 | int page; |
| 2303 | 2303 | |
| 2304 | // crtc_type = input_port_read_safe(space->machine, "crtc", 0); | |
| 2305 | // m6845_set_personality(crtc_type); | |
| 2304 | // crtc_type = input_port_read_safe(space->machine, "crtc", 0); | |
| 2305 | // m6845_set_personality(crtc_type); | |
| 2306 | 2306 | |
| 2307 | 2307 | if(aleste_mode & 0x04) |
| 2308 | 2308 | { |
| r5932 | r5933 | |
| 2317 | 2317 | /* if b14 = 0 : CRTC Read selected */ |
| 2318 | 2318 | if ((offset & (1<<14)) == 0) |
| 2319 | 2319 | { |
| 2320 | switch(r1r0) | |
| 2320 | switch(r1r0) | |
| 2321 | 2321 | { |
| 2322 | 2322 | case 0x02: |
| 2323 | 2323 | data = mc6845_status_r( mc6845, 0 ); |
| 2324 | // | |
| 2324 | // /* CRTC Type 1 : Read Status Register | |
| 2325 | 2325 | // CRTC Type 3 or 4 : Read from selected internal 6845 register */ |
| 2326 | // switch(crtc_type) { | |
| 2327 | // case M6845_PERSONALITY_UM6845R: | |
| 2328 | // data = amstrad_CRTC_CR; /* Read Status Register */ | |
| 2329 | // break; | |
| 2330 | // case M6845_PERSONALITY_AMS40489: | |
| 2331 | // case M6845_PERSONALITY_PREASIC: | |
| 2332 | // data = m6845_register_r(0); | |
| 2333 | // break; | |
| 2334 | // default: | |
| 2335 | // break; | |
| 2336 | // } | |
| 2326 | // switch(crtc_type) { | |
| 2327 | // case M6845_PERSONALITY_UM6845R: | |
| 2328 | // data = amstrad_CRTC_CR; /* Read Status Register */ | |
| 2329 | // break; | |
| 2330 | // case M6845_PERSONALITY_AMS40489: | |
| 2331 | // case M6845_PERSONALITY_PREASIC: | |
| 2332 | // data = m6845_register_r(0); | |
| 2333 | // break; | |
| 2334 | // default: | |
| 2335 | // break; | |
| 2336 | // } | |
| 2337 | 2337 | break; |
| 2338 | 2338 | case 0x03: |
| 2339 | 2339 | /* All CRTC type : Read from selected internal 6845 register Read only */ |
| r5932 | r5933 | |
| 2508 | 2508 | } |
| 2509 | 2509 | |
| 2510 | 2510 | /* if b11 = 0 : 8255 PPI Write selected - bits 9 and 8 then define the PPI function access as shown below: |
| 2511 | b9 b8 | PPI Function Read/Write status | |
| 2512 | 0 0 | Port A data Read/Write | |
| 2513 | 0 1 | Port B data Read/Write | |
| 2514 | 1 0 | Port C data Read/Write | |
| 2515 | 1 1 | Control Write Only | |
| 2516 | */ | |
| 2511 | b9 b8 | PPI Function Read/Write status | |
| 2512 | 0 0 | Port A data Read/Write | |
| 2513 | 0 1 | Port B data Read/Write | |
| 2514 | 1 0 | Port C data Read/Write | |
| 2515 | 1 1 | Control Write Only | |
| 2516 | */ | |
| 2517 | 2517 | if ((offset & (1<<11)) == 0) |
| 2518 | 2518 | { |
| 2519 | 2519 | unsigned int Index = ((offset & 0x0300) >> 8); |
| r5932 | r5933 | |
| 2551 | 2551 | { |
| 2552 | 2552 | case 0x00: |
| 2553 | 2553 | /* FDC Motor Control - Bit 0 defines the state of the FDD motor: |
| 2554 | * "1" the FDD motor will be active. | |
| 2555 | * "0" the FDD motor will be in-active.*/ | |
| 2554 | * "1" the FDD motor will be active. | |
| 2555 | * "0" the FDD motor will be in-active.*/ | |
| 2556 | 2556 | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), (data & 0x01)); |
| 2557 | 2557 | floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), (data & 0x01)); |
| 2558 | 2558 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1); |
| r5932 | r5933 | |
| 2570 | 2570 | } |
| 2571 | 2571 | } |
| 2572 | 2572 | |
| 2573 | /* Aleste Extend Port: | |
| 2574 | D0 - VRAM Bank 0/1 (64K) | |
| 2575 | D1 - MODE 0-Norm ,1-High resolution | |
| 2576 | D2 - MAPMOD 0-Amstrad ,1-Yamaha mapper | |
| 2577 | D3 - MAP Page 0/1 (256K) | |
| 2578 | D4 - 580WI53 | |
| 2579 | D5 - 0-AY8910 ,1-512WI1 */ | |
| 2573 | /* Aleste Extend Port: | |
| 2574 | D0 - VRAM Bank 0/1 (64K) | |
| 2575 | D1 - MODE 0-Norm ,1-High resolution | |
| 2576 | D2 - MAPMOD 0-Amstrad ,1-Yamaha mapper | |
| 2577 | D3 - MAP Page 0/1 (256K) | |
| 2578 | D4 - 580WI53 | |
| 2579 | D5 - 0-AY8910 ,1-512WI1 */ | |
| 2580 | 2580 | if(offset == 0xfabf) |
| 2581 | 2581 | { |
| 2582 | 2582 | aleste_mode = data; |
| r5932 | r5933 | |
| 2647 | 2647 | RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8); |
| 2648 | 2648 | |
| 2649 | 2649 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, RegData); |
| 2650 | // | |
| 2650 | // cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_SP, RegData); | |
| 2651 | 2651 | |
| 2652 | 2652 | RegData = (pSnapshot[0x025] & 0x0ff); |
| 2653 | 2653 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, RegData); |
| r5932 | r5933 | |
| 2811 | 2811 | } |
| 2812 | 2812 | |
| 2813 | 2813 | /* multiface hardware enabled? */ |
| 2814 | if (multiface_hardware_enabled(machine)) | |
| 2814 | if (multiface_hardware_enabled(machine)) | |
| 2815 | 2815 | { |
| 2816 | 2816 | multiface_rethink_memory(machine); |
| 2817 | 2817 | } |
| r5932 | r5933 | |
| 2864 | 2864 | { |
| 2865 | 2865 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2866 | 2866 | const device_config *ay8910 = devtag_get_device(machine, "ay"); |
| 2867 | ||
| 2867 | ||
| 2868 | 2868 | if(aleste_mode & 0x20) // RTC selected |
| 2869 | 2869 | { |
| 2870 | 2870 | switch(aleste_rtc_function) |
| r5932 | r5933 | |
| 2954 | 2954 | /* Set b7 with cassette tape input */ |
| 2955 | 2955 | if(amstrad_system_type != SYSTEM_GX4000) |
| 2956 | 2956 | { |
| 2957 | if (cassette_input(devtag_get_device(device->machine, "cassette" )) > 0.03) | |
| 2957 | if (cassette_input(devtag_get_device(device->machine, "cassette" )) > 0.03) | |
| 2958 | 2958 | { |
| 2959 | 2959 | data |= (1<<7); |
| 2960 | 2960 | } |
| r5932 | r5933 | |
| 3020 | 3020 | /* b5 Cassette Write data */ |
| 3021 | 3021 | if(amstrad_system_type != SYSTEM_GX4000) |
| 3022 | 3022 | { |
| 3023 | if ((changed_data & 0x20) != 0) | |
| 3023 | if ((changed_data & 0x20) != 0) | |
| 3024 | 3024 | { |
| 3025 | 3025 | cassette_output(devtag_get_device(device->machine, "cassette" ), |
| 3026 | 3026 | ((data & 0x20) ? -1.0 : +1.0)); |
| r5932 | r5933 | |
| 3299 | 3299 | Amstrad_ROM_Table[7] = &rom[0x018000]; |
| 3300 | 3300 | amstrad_common_init(machine); |
| 3301 | 3301 | amstrad_reset_machine(machine); |
| 3302 | // | |
| 3302 | // amstrad_init_palette(machine); | |
| 3303 | 3303 | |
| 3304 | 3304 | multiface_init(machine); |
| 3305 | 3305 | |
| r5932 | r5933 | |
| 3581 | 3581 | |
| 3582 | 3582 | /*static DEVICE_IMAGE_LOAD( aleste ) |
| 3583 | 3583 | { |
| 3584 | if (device_load_basicdsk_floppy(image)==INIT_PASS) | |
| 3585 | { | |
| 3586 | basicdsk_set_geometry(image, 80, 2, 9, 512, 0x01, 0, FALSE); | |
| 3587 | return INIT_PASS; | |
| 3588 | } | |
| 3589 | return INIT_FAIL; | |
| 3584 | if (device_load_basicdsk_floppy(image)==INIT_PASS) | |
| 3585 | { | |
| 3586 | basicdsk_set_geometry(image, 80, 2, 9, 512, 0x01, 0, FALSE); | |
| 3587 | return INIT_PASS; | |
| 3588 | } | |
| 3589 | return INIT_FAIL; | |
| 3590 | 3590 | }*/ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | header file for machine/99_peb.c | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | ||
| 6 | prototype for CRU handlers in expansion system | |
| 7 | 7 | */ |
| 8 | 8 | typedef int (*cru_read_handler)(running_machine *machine, int offset); |
| 9 | 9 | typedef void (*cru_write_handler)(running_machine *machine, int offset, int data); |
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | ||
| 12 | Descriptor for TI peripheral expansion cards (8-bit bus) | |
| 13 | 13 | */ |
| 14 | 14 | typedef struct ti99_peb_card_handlers_t |
| 15 | 15 | { |
| r5932 | r5933 | |
| 21 | 21 | } ti99_peb_card_handlers_t; |
| 22 | 22 | |
| 23 | 23 | /* |
| 24 | Descriptor for 16-bit peripheral expansion cards designed for the snug | |
| 25 | sgcpu 99/4p system. (These cards were not designed by TI, TI always | |
| 26 | regarded the ti-99 as an 8-bit system.) | |
| 24 | Descriptor for 16-bit peripheral expansion cards designed for the snug | |
| 25 | sgcpu 99/4p system. (These cards were not designed by TI, TI always | |
| 26 | regarded the ti-99 as an 8-bit system.) | |
| 27 | 27 | */ |
| 28 | 28 | typedef struct ti99_peb_16bit_card_handlers_t |
| 29 | 29 | { |
| r5932 | r5933 | |
| 44 | 44 | inta_rs232_4_bit = 7-5, |
| 45 | 45 | |
| 46 | 46 | /* extra "virtual" bits for devices that assert the INTA line without |
| 47 | ||
| 47 | setting a bit of the ILA register */ | |
| 48 | 48 | inta_ide_bit = 8, |
| 49 | 49 | inta_ide_clk_bit = 9, |
| 50 | 50 |
| r5932 | r5933 | |
|---|---|---|
| 43 | 43 | - Bugfix: busy flag was cleared too early |
| 44 | 44 | |
| 45 | 45 | 2009-June-21 Robbbert: |
| 46 | - The Bugfix above, while valid, caused the Osborne1 to fail. This | |
| 47 | is because the delay must not exceed 14usec (found by extensive testing). | |
| 48 | - The minimum delay is 1usec, need by z80netf while formatting a disk. | |
| 49 | - http://www.bannister.org/forums/ubbthreads.php?ubb=showflat&Number=50889#Post50889 | |
| 50 | explains the problems, testing done, and the test procedure for the z80netf. | |
| 51 | - Thus, the delay is set to 10usec, and all the disks I have (not many) | |
| 52 | seem to work. | |
| 53 | - Note to anyone who wants to change something: Make sure that the | |
| 54 | Osborne1 boots up! It is extremely sensitive to timing! | |
| 55 | - For testing only: The osborne1 rom can be patched to make it much | |
| 56 | more stable, by changing the byte at 0x0da7 from 0x28 to 0x18. | |
| 46 | - The Bugfix above, while valid, caused the Osborne1 to fail. This | |
| 47 | is because the delay must not exceed 14usec (found by extensive testing). | |
| 48 | - The minimum delay is 1usec, need by z80netf while formatting a disk. | |
| 49 | - http://www.bannister.org/forums/ubbthreads.php?ubb=showflat&Number=50889#Post50889 | |
| 50 | explains the problems, testing done, and the test procedure for the z80netf. | |
| 51 | - Thus, the delay is set to 10usec, and all the disks I have (not many) | |
| 52 | seem to work. | |
| 53 | - Note to anyone who wants to change something: Make sure that the | |
| 54 | Osborne1 boots up! It is extremely sensitive to timing! | |
| 55 | - For testing only: The osborne1 rom can be patched to make it much | |
| 56 | more stable, by changing the byte at 0x0da7 from 0x28 to 0x18. | |
| 57 | 57 | |
| 58 | 58 | 2009-June-25 Robbbert: |
| 59 | - Turns out kayproii not working, 10usec is too short.. but 11usec is ok. | |
| 60 | Setting it to 12usec. | |
| 61 | Really, this whole thing needs a complete rewrite. | |
| 59 | - Turns out kayproii not working, 10usec is too short.. but 11usec is ok. | |
| 60 | Setting it to 12usec. | |
| 61 | Really, this whole thing needs a complete rewrite. | |
| 62 | 62 | |
| 63 | 63 | 2009-July-08 Roberto Lavarone: |
| 64 | ||
| 64 | - Fixed a bug in head load flag handling: einstein and samcoupe now working again | |
| 65 | 65 | |
| 66 | 66 | 2009-September-30 Robbbert: |
| 67 | - Modified what status flags are returned after a Forced Interrupt, | |
| 68 | to allow Microbee to boot CP/M. | |
| 67 | - Modified what status flags are returned after a Forced Interrupt, | |
| 68 | to allow Microbee to boot CP/M. | |
| 69 | 69 | |
| 70 | 70 | TODO: |
| 71 | 71 | - Multiple record write |
| r5932 | r5933 | |
| 933 | 933 | |
| 934 | 934 | usecs = 12; |
| 935 | 935 | |
| 936 | /* set new timer */ | |
| 936 | /* set new timer */ | |
| 937 | 937 | timer_adjust_oneshot(w->timer, ATTOTIME_IN_USEC(usecs), MISCCALLBACK_COMMAND); |
| 938 | 938 | } |
| 939 | 939 |
| r5932 | r5933 | |
|---|---|---|
| 851 | 851 | if (!strncmp((char*)&magic[0x7FF0], "TMR SEGA", 8)) |
| 852 | 852 | { |
| 853 | 853 | /* Technically, it should be this, but remove for now until verified: |
| 854 | if (!strcmp(sysname, "gamegear")) | |
| 855 | { | |
| 856 | if ((unsigned char)magic[0x7FFD] < 0x50) | |
| 857 | retval = IMAGE_VERIFY_PASS; | |
| 858 | } | |
| 859 | if (!strcmp(sysname, "sms")) | |
| 860 | { | |
| 861 | if ((unsigned char)magic[0x7FFD] >= 0x50) | |
| 862 | retval = IMAGE_VERIFY_PASS; | |
| 863 | } | |
| 864 | */ | |
| 854 | if (!strcmp(sysname, "gamegear")) | |
| 855 | { | |
| 856 | if ((unsigned char)magic[0x7FFD] < 0x50) | |
| 857 | retval = IMAGE_VERIFY_PASS; | |
| 858 | } | |
| 859 | if (!strcmp(sysname, "sms")) | |
| 860 | { | |
| 861 | if ((unsigned char)magic[0x7FFD] >= 0x50) | |
| 862 | retval = IMAGE_VERIFY_PASS; | |
| 863 | } | |
| 864 | */ | |
| 865 | 865 | retval = IMAGE_VERIFY_PASS; |
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | /* Check at $81f0 also */ |
| 870 | 870 | //if (!retval) { |
| 871 | // | |
| 871 | // if (!strncmp(&magic[0x81f0], "TMR SEGA", 8)) { | |
| 872 | 872 | /* Technically, it should be this, but remove for now until verified: |
| 873 | if (!strcmp(sysname, "gamegear")) { | |
| 874 | if ((unsigned char)magic[0x81fd] < 0x50) | |
| 875 | retval = IMAGE_VERIFY_PASS; | |
| 876 | } | |
| 877 | if (!strcmp(sysname, "sms")) { | |
| 878 | if ((unsigned char)magic[0x81fd] >= 0x50) | |
| 879 | retval = IMAGE_VERIFY_PASS; | |
| 880 | } | |
| 881 | */ | |
| 882 | // retval = IMAGE_VERIFY_PASS; | |
| 883 | // } | |
| 873 | if (!strcmp(sysname, "gamegear")) { | |
| 874 | if ((unsigned char)magic[0x81fd] < 0x50) | |
| 875 | retval = IMAGE_VERIFY_PASS; | |
| 876 | } | |
| 877 | if (!strcmp(sysname, "sms")) { | |
| 878 | if ((unsigned char)magic[0x81fd] >= 0x50) | |
| 879 | retval = IMAGE_VERIFY_PASS; | |
| 880 | } | |
| 881 | */ | |
| 882 | // retval = IMAGE_VERIFY_PASS; | |
| 883 | // } | |
| 884 | 884 | //} |
| 885 | 885 | |
| 886 | 886 | return retval; |
| r5932 | r5933 | |
| 991 | 991 | if (strcmp(image->tag,"cart4")==0) |
| 992 | 992 | { |
| 993 | 993 | index = 3; |
| 994 | } | |
| 994 | } | |
| 995 | 995 | if (strcmp(image->tag,"cart5")==0) |
| 996 | 996 | { |
| 997 | 997 | index = 4; |
| 998 | } | |
| 998 | } | |
| 999 | 999 | /* Check for 512-byte header */ |
| 1000 | 1000 | if ((size / 512) & 1) |
| 1001 | 1001 | { |
| r5932 | r5933 | |
|---|---|---|
| 21 | 21 | static TIMER_CALLBACK(poly88_usart_timer_callback) |
| 22 | 22 | { |
| 23 | 23 | int_vector = 0xe7; |
| 24 | cpu_set_input_line(cputag_get_cpu(machine, "maincpu"), 0, HOLD_LINE); | |
| 24 | cpu_set_input_line(cputag_get_cpu(machine, "maincpu"), 0, HOLD_LINE); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | WRITE8_HANDLER(poly_baud_rate_w) |
| r5932 | r5933 | |
| 29 | 29 | logerror("poly_baud_rate_w %02x\n",data); |
| 30 | 30 | poly88_usart_timer = timer_alloc(space->machine, poly88_usart_timer_callback, NULL); |
| 31 | 31 | timer_adjust_periodic(poly88_usart_timer, attotime_zero, 0, ATTOTIME_IN_HZ(300)); |
| 32 | ||
| 32 | ||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | static UINT8 row_number(UINT8 code) { |
| r5932 | r5933 | |
| 40 | 40 | if BIT(code,4) return 4; |
| 41 | 41 | if BIT(code,5) return 5; |
| 42 | 42 | if BIT(code,6) return 6; |
| 43 | if BIT(code,7) return 7; | |
| 43 | if BIT(code,7) return 7; | |
| 44 | 44 | return 0; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | static TIMER_CALLBACK(keyboard_callback) |
| 48 | 48 | { |
| 49 | 49 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6" }; |
| 50 | ||
| 50 | ||
| 51 | 51 | int i; |
| 52 | 52 | UINT8 code; |
| 53 | 53 | UINT8 key_code = 0; |
| 54 | 54 | UINT8 shift = input_port_read(machine, "LINEC") & 0x02 ? 1 : 0; |
| 55 | 55 | UINT8 ctrl = input_port_read(machine, "LINEC") & 0x01 ? 1 : 0; |
| 56 | ||
| 57 | for(i = 0; i < 7; i++) | |
| 56 | ||
| 57 | for(i = 0; i < 7; i++) | |
| 58 | 58 | { |
| 59 | ||
| 59 | ||
| 60 | 60 | code = input_port_read(machine, keynames[i]); |
| 61 | if (code != 0) | |
| 61 | if (code != 0) | |
| 62 | 62 | { |
| 63 | 63 | if (i==0 && shift==0) { |
| 64 | 64 | key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs |
| r5932 | r5933 | |
| 107 | 107 | key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl |
| 108 | 108 | } |
| 109 | 109 | if (i==6) { |
| 110 | switch(row_number(code)) | |
| 110 | switch(row_number(code)) | |
| 111 | 111 | { |
| 112 | 112 | case 0: key_code = 0x11; break; |
| 113 | 113 | case 1: key_code = 0x12; break; |
| r5932 | r5933 | |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | if (key_code==0 && last_code !=0){ | |
| 125 | int_vector = 0xef; | |
| 126 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); | |
| 124 | if (key_code==0 && last_code !=0){ | |
| 125 | int_vector = 0xef; | |
| 126 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); | |
| 127 | 127 | } else { |
| 128 | 128 | last_code = key_code; |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | static IRQ_CALLBACK (poly88_irq_callback) |
| 133 | { | |
| 133 | { | |
| 134 | 134 | return int_vector; |
| 135 | 135 | } |
| 136 | 136 | |
| r5932 | r5933 | |
| 151 | 151 | static int clk_level_tape = 1; |
| 152 | 152 | |
| 153 | 153 | |
| 154 | // | |
| 154 | // if (!(input_port_read(machine, "DSW0") & 0x02)) /* V.24 / Tape Switch */ | |
| 155 | 155 | //{ |
| 156 | 156 | /* tape reading */ |
| 157 | 157 | if (cassette_get_state(devtag_get_device(machine, "cassette"))&CASSETTE_PLAY) |
| r5932 | r5933 | |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | ||
| 180 | ||
| 181 | 181 | /* tape writing */ |
| 182 | 182 | if (cassette_get_state(devtag_get_device(machine, "cassette"))&CASSETTE_RECORD) |
| 183 | 183 | { |
| r5932 | r5933 | |
| 198 | 198 | if (!clk_level) |
| 199 | 199 | msm8251_transmit_clock(devtag_get_device(machine, "uart")); |
| 200 | 200 | clk_level = clk_level ? 0 : 1; |
| 201 | // | |
| 201 | // } | |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
| 205 | static TIMER_CALLBACK( setup_machine_state ) | |
| 205 | static TIMER_CALLBACK( setup_machine_state ) | |
| 206 | 206 | { |
| 207 | 207 | msm8251_connect(devtag_get_device(machine, "uart"), &poly88_cassette_serial_connection); |
| 208 | 208 | } |
| r5932 | r5933 | |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | MACHINE_RESET(poly88) |
| 220 | { | |
| 220 | { | |
| 221 | 221 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), poly88_irq_callback); |
| 222 | 222 | timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback); |
| 223 | 223 | intr = 0; |
| 224 | 224 | last_code = 0; |
| 225 | ||
| 225 | ||
| 226 | 226 | timer_set(machine, attotime_zero, NULL, 0, setup_machine_state ); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | INTERRUPT_GEN( poly88_interrupt ) |
| 230 | 230 | { |
| 231 | 231 | int_vector = 0xf7; |
| 232 | cpu_set_input_line(device, 0, HOLD_LINE); | |
| 232 | cpu_set_input_line(device, 0, HOLD_LINE); | |
| 233 | 233 | } |
| 234 | 234 | static void poly88_usart_rxready (const device_config *device, int state) |
| 235 | 235 | { |
| 236 | 236 | //int_vector = 0xe7; |
| 237 | //cpu_set_input_line(device, 0, HOLD_LINE); | |
| 237 | //cpu_set_input_line(device, 0, HOLD_LINE); | |
| 238 | 238 | } |
| 239 | 239 | const msm8251_interface poly88_usart_interface= |
| 240 | 240 | { |
| r5932 | r5933 | |
| 264 | 264 | UINT16 recordLen; |
| 265 | 265 | UINT16 address; |
| 266 | 266 | UINT8 recordType; |
| 267 | ||
| 267 | ||
| 268 | 268 | int pos = 0x300; |
| 269 | 269 | char name[9]; |
| 270 | 270 | int i = 0; |
| 271 | 271 | int theend = 0; |
| 272 | 272 | |
| 273 | 273 | image_fread(image, data, snapshot_size); |
| 274 | ||
| 274 | ||
| 275 | 275 | while (pos<snapshot_size) { |
| 276 | 276 | for(i=0;i<9;i++) { |
| 277 | 277 | name[i] = (char) data[pos + i]; |
| 278 | } | |
| 278 | } | |
| 279 | 279 | pos+=8; |
| 280 | 280 | name[8] = 0; |
| 281 | ||
| 282 | ||
| 281 | ||
| 282 | ||
| 283 | 283 | recordNum = data[pos]+ data[pos+1]*256; pos+=2; |
| 284 | recordLen = data[pos]; pos++; | |
| 284 | recordLen = data[pos]; pos++; | |
| 285 | 285 | if (recordLen==0) recordLen=0x100; |
| 286 | 286 | address = data[pos] + data[pos+1]*256; pos+=2; |
| 287 | 287 | recordType = data[pos]; pos++; |
| 288 | ||
| 289 | logerror("Block :%s number:%d length: %d address=%04x type:%d\n",name,recordNum,recordLen,address, recordType); | |
| 288 | ||
| 289 | logerror("Block :%s number:%d length: %d address=%04x type:%d\n",name,recordNum,recordLen,address, recordType); | |
| 290 | 290 | switch(recordType) { |
| 291 | 291 | case 0 : |
| 292 | 292 | /* 00 Absolute */ |
| 293 | 293 | memcpy(memory_get_read_ptr(space,address ), data + pos ,recordLen); |
| 294 | 294 | break; |
| 295 | case 1 : | |
| 295 | case 1 : | |
| 296 | 296 | /* 01 Comment */ |
| 297 | 297 | break; |
| 298 | 298 | case 2 : |
| 299 | 299 | /* 02 End */ |
| 300 | 300 | theend = 1; |
| 301 | 301 | break; |
| 302 | case 3 : | |
| 302 | case 3 : | |
| 303 | 303 | /* 03 Auto Start @ Address */ |
| 304 | 304 | cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), I8085_PC, address); |
| 305 | 305 | theend = 1; |
| 306 | 306 | break; |
| 307 | case 4 : | |
| 307 | case 4 : | |
| 308 | 308 | /* 04 Data ( used by Assembler ) */ |
| 309 | 309 | logerror("ASM load unsupported\n"); |
| 310 | 310 | theend = 1; |
| 311 | 311 | break; |
| 312 | case 5 : | |
| 312 | case 5 : | |
| 313 | 313 | /* 05 BASIC program file */ |
| 314 | 314 | logerror("BASIC load unsupported\n"); |
| 315 | 315 | theend = 1; |
| r5932 | r5933 | |
| 319 | 319 | theend = 1; |
| 320 | 320 | break; |
| 321 | 321 | default: break; |
| 322 | } | |
| 323 | ||
| 322 | } | |
| 323 | ||
| 324 | 324 | if (theend) { |
| 325 | 325 | break; |
| 326 | 326 | } |
| 327 | 327 | pos+=recordLen; |
| 328 | } | |
| 328 | } | |
| 329 | 329 | device_reset(devtag_get_device(image->machine, "uart")); |
| 330 | 330 | return INIT_PASS; |
| 331 | 331 | } |
| r5932 | r5933 | |
|---|---|---|
| 16 | 16 | static UINT8 llc1_key_state = 0; |
| 17 | 17 | |
| 18 | 18 | static READ8_DEVICE_HANDLER (llc1_port_b_r) |
| 19 | { | |
| 19 | { | |
| 20 | 20 | UINT8 retVal = 0; |
| 21 | 21 | if (code!=0) { |
| 22 | 22 | if (llc1_key_state==0) { |
| r5932 | r5933 | |
| 27 | 27 | llc1_key_state = 2; |
| 28 | 28 | retVal = 0; |
| 29 | 29 | } else { |
| 30 | llc1_key_state = 0; | |
| 30 | llc1_key_state = 0; | |
| 31 | 31 | retVal = code; |
| 32 | 32 | code =0; |
| 33 | 33 | } |
| r5932 | r5933 | |
| 41 | 41 | |
| 42 | 42 | static READ8_DEVICE_HANDLER (llc1_port_a_r) |
| 43 | 43 | { |
| 44 | return 0; | |
| 44 | return 0; | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| r5932 | r5933 | |
| 72 | 72 | { |
| 73 | 73 | int i,j; |
| 74 | 74 | UINT8 c; |
| 75 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", | |
| 75 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", | |
| 76 | 76 | "LINE5", "LINE6", "LINE7", "LINE8", "LINE9", "LINE10", "LINE11" }; |
| 77 | 77 | |
| 78 | for(i = 0; i < 12; i++) | |
| 78 | for(i = 0; i < 12; i++) | |
| 79 | 79 | { |
| 80 | 80 | c = input_port_read(machine, keynames[i]); |
| 81 | if (c != 0) | |
| 81 | if (c != 0) | |
| 82 | 82 | { |
| 83 | for(j = 0; j < 8; j++) | |
| 83 | for(j = 0; j < 8; j++) | |
| 84 | 84 | { |
| 85 | if (c == (1 << j)) | |
| 85 | if (c == (1 << j)) | |
| 86 | 86 | { |
| 87 | 87 | code = j + i*8; |
| 88 | 88 | break; |
| 89 | 89 | } |
| 90 | } | |
| 90 | } | |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /* Driver initialization */ |
| 96 | 96 | DRIVER_INIT(llc1) |
| 97 | { | |
| 97 | { | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | MACHINE_RESET( llc1 ) |
| r5932 | r5933 | |
| 114 | 114 | MACHINE_RESET( llc2 ) |
| 115 | 115 | { |
| 116 | 116 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 117 | ||
| 117 | ||
| 118 | 118 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 119 | 119 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu")); |
| 120 | ||
| 120 | ||
| 121 | 121 | memory_install_write8_handler(space, 0x4000, 0x5fff, 0, 0, SMH_UNMAP); |
| 122 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x4000); | |
| 122 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x4000); | |
| 123 | 123 | |
| 124 | 124 | memory_install_write8_handler(space, 0x6000, 0xbfff, 0, 0, SMH_UNMAP); |
| 125 | memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") + 0x6000); | |
| 125 | memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") + 0x6000); | |
| 126 | 126 | |
| 127 | 127 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, SMH_BANK(4)); |
| 128 | memory_set_bankptr(machine, 4, mess_ram + 0xc000); | |
| 128 | memory_set_bankptr(machine, 4, mess_ram + 0xc000); | |
| 129 | 129 | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | WRITE8_HANDLER( llc2_rom_disable_w ) |
| 133 | { | |
| 133 | { | |
| 134 | 134 | const address_space *mem_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 135 | ||
| 135 | ||
| 136 | 136 | memory_install_write8_handler(mem_space, 0x0000, 0xbfff, 0, 0, SMH_BANK(1)); |
| 137 | memory_set_bankptr(space->machine, 1, mess_ram); | |
| 137 | memory_set_bankptr(space->machine, 1, mess_ram); | |
| 138 | 138 | |
| 139 | 139 | memory_install_write8_handler(mem_space, 0x4000, 0x5fff, 0, 0, SMH_BANK(2)); |
| 140 | memory_set_bankptr(space->machine, 2, mess_ram + 0x4000); | |
| 140 | memory_set_bankptr(space->machine, 2, mess_ram + 0x4000); | |
| 141 | 141 | |
| 142 | 142 | memory_install_write8_handler(mem_space, 0x6000, 0xbfff, 0, 0, SMH_BANK(3)); |
| 143 | memory_set_bankptr(space->machine, 3, mess_ram + 0x6000); | |
| 143 | memory_set_bankptr(space->machine, 3, mess_ram + 0x6000); | |
| 144 | 144 | |
| 145 | 145 | memory_install_write8_handler(mem_space, 0xc000, 0xffff, 0, 0, SMH_BANK(4)); |
| 146 | memory_set_bankptr(space->machine, 4, mess_ram + 0xc000); | |
| 146 | memory_set_bankptr(space->machine, 4, mess_ram + 0xc000); | |
| 147 | 147 | |
| 148 | 148 | } |
| 149 | 149 | |
| r5932 | r5933 | |
| 153 | 153 | const address_space *mem_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 154 | 154 | if (data & 0x02) { |
| 155 | 155 | memory_install_write8_handler(mem_space, 0x4000, 0x5fff, 0, 0, SMH_UNMAP); |
| 156 | memory_set_bankptr(space->machine, 2, memory_region(space->machine, "maincpu") + 0x10000); | |
| 156 | memory_set_bankptr(space->machine, 2, memory_region(space->machine, "maincpu") + 0x10000); | |
| 157 | 157 | } else { |
| 158 | 158 | memory_install_write8_handler(mem_space, 0x4000, 0x5fff, 0, 0, SMH_BANK(2)); |
| 159 | memory_set_bankptr(space->machine, 2, mess_ram + 0x4000); | |
| 159 | memory_set_bankptr(space->machine, 2, mess_ram + 0x4000); | |
| 160 | 160 | } |
| 161 | ||
| 161 | ||
| 162 | 162 | } |
| 163 | 163 | static READ8_DEVICE_HANDLER (llc2_port_b_r) |
| 164 | { | |
| 164 | { | |
| 165 | 165 | return 0; |
| 166 | 166 | } |
| 167 | 167 | |
| r5932 | r5933 | |
| 174 | 174 | if (BIT(val,5)) return 6; |
| 175 | 175 | if (BIT(val,6)) return 7; |
| 176 | 176 | if (BIT(val,7)) return 8; |
| 177 | return 0; | |
| 177 | return 0; | |
| 178 | 178 | } |
| 179 | 179 | static READ8_DEVICE_HANDLER (llc2_port_a_r) |
| 180 | { | |
| 180 | { | |
| 181 | 181 | UINT8 *k7659 = memory_region(device->machine, "k7659"); |
| 182 | 182 | UINT8 retVal = 0; |
| 183 | 183 | UINT8 a1 = input_port_read(device->machine, "A1"); |
| r5932 | r5933 | |
| 213 | 213 | code = 0x90 + key_pos(a10); |
| 214 | 214 | } else if (a11!=0) { |
| 215 | 215 | code = 0xA0 + key_pos(a11); |
| 216 | } | |
| 217 | if (code!=0) { | |
| 216 | } | |
| 217 | if (code!=0) { | |
| 218 | 218 | if (BIT(a8,6) || BIT(a8,7)) { |
| 219 | 219 | code |= 0x100; |
| 220 | 220 | } else if (BIT(a12,6)) { |
| 221 | 221 | code |= 0x200; |
| 222 | 222 | } |
| 223 | 223 | retVal = k7659[code] | 0x80; |
| 224 | } | |
| 225 | return retVal; | |
| 224 | } | |
| 225 | return retVal; | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Ricoh RP5C01A Real Time Clock With Internal RAM emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - divide frequencies from device clock | |
| 15 | - mask out unused bits in register writes | |
| 16 | - clock adjust | |
| 17 | - 12 hour clock | |
| 18 | - leap year counter | |
| 19 | - timer reset | |
| 14 | - divide frequencies from device clock | |
| 15 | - mask out unused bits in register writes | |
| 16 | - clock adjust | |
| 17 | - 12 hour clock | |
| 18 | - leap year counter | |
| 19 | - timer reset | |
| 20 | 20 | |
| 21 | 21 | */ |
| 22 | 22 | |
| r5932 | r5933 | |
| 79 | 79 | UINT8 reg[4][13]; /* clock registers */ |
| 80 | 80 | |
| 81 | 81 | UINT8 mode; /* mode register */ |
| 82 | ||
| 82 | ||
| 83 | 83 | /* timers */ |
| 84 | 84 | emu_timer *clock_timer; |
| 85 | 85 | emu_timer *alarm_timer; |
| r5932 | r5933 | |
| 114 | 114 | |
| 115 | 115 | WRITE_LINE_DEVICE_HANDLER( rp5c01a_adj_w ) |
| 116 | 116 | { |
| 117 | // | |
| 117 | // rp5c01a_t *rp5c01a = get_safe_token(device); | |
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 |
| r5932 | r5933 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | WRITE8_DEVICE_HANDLER(z1013_z80pio_w) |
| 23 | 23 | { |
| 24 | if ((offset & 1) ==0) | |
| 25 | z80pio_d_w(device, offset >> 1, data); | |
| 26 | else | |
| 24 | if ((offset & 1) ==0) | |
| 25 | z80pio_d_w(device, offset >> 1, data); | |
| 26 | else | |
| 27 | 27 | z80pio_c_w(device, offset >> 1, data); |
| 28 | 28 | } |
| 29 | 29 | |
| r5932 | r5933 | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | static READ8_DEVICE_HANDLER (z1013_port_b_r) |
| 47 | { | |
| 47 | { | |
| 48 | 48 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", |
| 49 | 49 | "LINE4", "LINE5", "LINE6", "LINE7" }; |
| 50 | 50 | UINT8 data = input_port_read(device->machine, keynames[z1013_keyboard_line & 7]); |
| r5932 | r5933 | |
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | 73 | static READ8_DEVICE_HANDLER (z1013k7659_port_b_r) |
| 74 | { | |
| 74 | { | |
| 75 | 75 | return 0xff; |
| 76 | 76 | } |
| 77 | 77 | |
| r5932 | r5933 | |
| 79 | 79 | { |
| 80 | 80 | DEVCB_NULL, /* callback when change interrupt status */ |
| 81 | 81 | DEVCB_NULL, |
| 82 | DEVCB_HANDLER(z1013k7659_port_b_r), | |
| 82 | DEVCB_HANDLER(z1013k7659_port_b_r), | |
| 83 | 83 | DEVCB_NULL, |
| 84 | 84 | DEVCB_NULL, |
| 85 | 85 | DEVCB_NULL, |
| r5932 | r5933 | |
| 98 | 98 | runaddr = data[4] + data[5]*256; |
| 99 | 99 | if (data[12]!='C') return INIT_FAIL; |
| 100 | 100 | if (data[13]!=0xD3 || data[14]!=0xD3 || data[14]!=0xD3) return INIT_FAIL; |
| 101 | ||
| 101 | ||
| 102 | 102 | memcpy (memory_get_read_ptr(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM), startaddr ), |
| 103 | 103 | data+0x20, endaddr - startaddr + 1); |
| 104 | 104 |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | F-001-EB-REV0 |
| 10 | 10 | |
| 11 | |--------------------------------------| | |
| 12 | | 40174 4073 4049 4075 | | |
| 13 | | | | |
| 14 | | ROM 40175 4073 4075 | | |
| 15 | | | | |
| 16 | |----| - - - - | | |
| 17 | | | | | | 7805 | | |
| 18 | | | | | | | | |
| 19 | | | | | | | | |
| 20 | |C C C C C | | |
| 21 | |N N N N N | | |
| 22 | |5 1 2 3 4 | | |
| 23 | | | | | | | | |
| 24 | | | | | | | | |
| 25 | | | | | | | | |
| 26 | | - - - LD1 - | | |
| 11 | |--------------------------------------| | |
| 12 | | 40174 4073 4049 4075 | | |
| 13 | | | | |
| 14 | | ROM 40175 4073 4075 | | |
| 15 | | | | |
| 16 | |----| - - - - | | |
| 17 | | | | | | 7805 | | |
| 18 | | | | | | | | |
| 19 | | | | | | | | |
| 20 | |C C C C C | | |
| 21 | |N N N N N | | |
| 22 | |5 1 2 3 4 | | |
| 23 | | | | | | | | |
| 24 | | | | | | | | |
| 25 | | | | | | | | |
| 26 | | - - - LD1 - | | |
| 27 | 27 | |-------------------------------------------| |
| 28 | 28 | |
| 29 | 29 | Notes: |
| 30 | 30 | All IC's shown. |
| 31 | 31 | |
| 32 | 32 | ROM - NEC D2732D-4 4Kx8 EPROM, unlabeled |
| 33 | CN1 - COMX-35 bus connector slot 1 | |
| 34 | CN2 - COMX-35 bus connector slot 2 | |
| 35 | CN3 - COMX-35 bus connector slot 3 | |
| 36 | CN4 - COMX-35 bus connector slot 4 | |
| 37 | CN5 - COMX-35 bus PCB edge connector | |
| 38 | LD1 - LED | |
| 33 | CN1 - COMX-35 bus connector slot 1 | |
| 34 | CN2 - COMX-35 bus connector slot 2 | |
| 35 | CN3 - COMX-35 bus connector slot 3 | |
| 36 | CN4 - COMX-35 bus connector slot 4 | |
| 37 | CN5 - COMX-35 bus PCB edge connector | |
| 38 | LD1 - LED | |
| 39 | 39 | |
| 40 | 40 | */ |
| 41 | 41 | |
| r5932 | r5933 | |
| 49 | 49 | |
| 50 | 50 | F-001-FD-REV0 |
| 51 | 51 | |
| 52 | |---------------| | |
| 53 | | CN1 | | |
| 54 | |---| |---------------------------| | |
| 55 | | | | |
| 56 | | 40174 4068 4072 -| | |
| 57 | | ROM || | |
| 58 | | LS04 4072 4050 7438 C| | |
| 59 | |8MHz N| | |
| 60 | | 4049 4075 LS08 2| | |
| 61 | |LD1 WD1770 || | |
| 62 | | 40174 4503 4075 7438 -| | |
| 63 | |LD2 | | |
| 52 | |---------------| | |
| 53 | | CN1 | | |
| 54 | |---| |---------------------------| | |
| 55 | | | | |
| 56 | | 40174 4068 4072 -| | |
| 57 | | ROM || | |
| 58 | | LS04 4072 4050 7438 C| | |
| 59 | |8MHz N| | |
| 60 | | 4049 4075 LS08 2| | |
| 61 | |LD1 WD1770 || | |
| 62 | | 40174 4503 4075 7438 -| | |
| 63 | |LD2 | | |
| 64 | 64 | |-----------------------------------------------| |
| 65 | 65 | |
| 66 | 66 | Notes: |
| 67 | 67 | All IC's shown. |
| 68 | 68 | |
| 69 | 69 | ROM - "D.O.S. V1.2" |
| 70 | WD1770 - Western Digital WD1770-xx Floppy Disc Controller @ 8MHz | |
| 71 | CN1 - COMX-35 bus PCB edge connector | |
| 72 | CN2 - 34 pin floppy connector | |
| 73 | LD1 - card selected LED | |
| 74 | LD2 - floppy motor on LED | |
| 70 | WD1770 - Western Digital WD1770-xx Floppy Disc Controller @ 8MHz | |
| 71 | CN1 - COMX-35 bus PCB edge connector | |
| 72 | CN2 - 34 pin floppy connector | |
| 73 | LD1 - card selected LED | |
| 74 | LD2 - floppy motor on LED | |
| 75 | 75 | |
| 76 | 76 | */ |
| 77 | 77 | |
| r5932 | r5933 | |
| 85 | 85 | |
| 86 | 86 | F-003-CLM-REV 1 |
| 87 | 87 | |
| 88 | |---------------| | |
| 89 | | CN1 | | |
| 90 | |---| |---------------------------| | |
| 91 | | | | |
| 92 | | MC14174 LS86 LS175 LS10 LS161 | | |
| 93 | | 14.31818MHz | | |
| 94 | | LS245 LS04 | | |
| 95 | | ROM1 6845 CN2 | | |
| 96 | | LS374 LS165 | | |
| 97 | |LD2 LS138 LS157 LS157 | | |
| 98 | |LD1 6116 ROM2 SW1 | | |
| 99 | | LS126 LS32 LS157 | | |
| 88 | |---------------| | |
| 89 | | CN1 | | |
| 90 | |---| |---------------------------| | |
| 91 | | | | |
| 92 | | MC14174 LS86 LS175 LS10 LS161 | | |
| 93 | | 14.31818MHz | | |
| 94 | | LS245 LS04 | | |
| 95 | | ROM1 6845 CN2 | | |
| 96 | | LS374 LS165 | | |
| 97 | |LD2 LS138 LS157 LS157 | | |
| 98 | |LD1 6116 ROM2 SW1 | | |
| 99 | | LS126 LS32 LS157 | | |
| 100 | 100 | |-----------------------------------------------| |
| 101 | 101 | |
| 102 | 102 | Notes: |
| 103 | 103 | All IC's shown. |
| 104 | 104 | |
| 105 | 6845 - Motorola MC6845P CRT Controller | |
| 106 | 6116 - Motorola MCM6116P15 2Kx8 Asynchronous CMOS Static RAM | |
| 105 | 6845 - Motorola MC6845P CRT Controller | |
| 106 | 6116 - Motorola MCM6116P15 2Kx8 Asynchronous CMOS Static RAM | |
| 107 | 107 | ROM1 - Mitsubishi 2Kx8 EPROM "C" |
| 108 | 108 | ROM2 - Mitsubishi 2Kx8 EPROM "P" |
| 109 | CN1 - COMX-35 bus PCB edge connector | |
| 110 | CN2 - RCA video output connector | |
| 111 | LD1 - LED | |
| 112 | LD2 - LED | |
| 113 | SW1 - switch | |
| 109 | CN1 - COMX-35 bus PCB edge connector | |
| 110 | CN2 - RCA video output connector | |
| 111 | LD1 - LED | |
| 112 | LD2 - LED | |
| 113 | SW1 - switch | |
| 114 | 114 | |
| 115 | 115 | */ |
| 116 | 116 | |
| r5932 | r5933 | |
| 239 | 239 | const device_config *fdc = devtag_get_device(space->machine, WD1770_TAG); |
| 240 | 240 | /* |
| 241 | 241 | |
| 242 | ||
| 242 | bit description | |
| 243 | 243 | |
| 244 | 0 A0 | |
| 245 | 1 A1 | |
| 246 | 2 DRIVE0 | |
| 247 | 3 DRIVE1 | |
| 248 | 4 F9 DISB | |
| 249 | 5 SIDE SELECT | |
| 244 | 0 A0 | |
| 245 | 1 A1 | |
| 246 | 2 DRIVE0 | |
| 247 | 3 DRIVE1 | |
| 248 | 4 F9 DISB | |
| 249 | 5 SIDE SELECT | |
| 250 | 250 | |
| 251 | ||
| 251 | */ | |
| 252 | 252 | |
| 253 | 253 | comx35_state *state = space->machine->driver_data; |
| 254 | 254 | |
| r5932 | r5933 | |
| 261 | 261 | if (BIT(data, 2)) |
| 262 | 262 | { |
| 263 | 263 | wd17xx_set_drive(fdc,0); |
| 264 | } | |
| 264 | } | |
| 265 | 265 | else if (BIT(data, 3)) |
| 266 | 266 | { |
| 267 | 267 | wd17xx_set_drive(fdc,1); |
| r5932 | r5933 | |
| 288 | 288 | |
| 289 | 289 | static UINT8 printer_r(running_machine *machine) |
| 290 | 290 | { |
| 291 | // | |
| 291 | // comx35_state *state = machine->driver_data; | |
| 292 | 292 | |
| 293 | 293 | int printer = input_port_read(machine, "PRINTER") & 0x07; |
| 294 | 294 | UINT8 data = 0; |
| r5932 | r5933 | |
| 298 | 298 | case PRINTER_PARALLEL: |
| 299 | 299 | case PRINTER_PLOTTER: |
| 300 | 300 | /* |
| 301 | INP 2 for the printer status, where: | |
| 302 | b0=1: Acknowledge Fault | |
| 303 | b1=0: Device Busy | |
| 304 | b2=0: Paper Empty | |
| 305 | b3=1: Device Not Selected | |
| 306 | */ | |
| 301 | INP 2 for the printer status, where: | |
| 302 | b0=1: Acknowledge Fault | |
| 303 | b1=0: Device Busy | |
| 304 | b2=0: Paper Empty | |
| 305 | b3=1: Device Not Selected | |
| 306 | */ | |
| 307 | 307 | |
| 308 | 308 | data = 0x06; |
| 309 | 309 | break; |
| 310 | 310 | |
| 311 | 311 | case PRINTER_SERIAL: |
| 312 | 312 | /* |
| 313 | INP 2 for the printer status and to start a new range of bits for the next byte. | |
| 314 | */ | |
| 313 | INP 2 for the printer status and to start a new range of bits for the next byte. | |
| 314 | */ | |
| 315 | 315 | break; |
| 316 | 316 | |
| 317 | 317 | case PRINTER_THERMAL: |
| 318 | 318 | /* |
| 319 | INP 2 is used for the printer status, where: | |
| 320 | b0=1: Printer Not Ready | |
| 321 | b1=1: Energizing Head | |
| 322 | b2=1: Head At Position 0 | |
| 323 | */ | |
| 319 | INP 2 is used for the printer status, where: | |
| 320 | b0=1: Printer Not Ready | |
| 321 | b1=1: Energizing Head | |
| 322 | b2=1: Head At Position 0 | |
| 323 | */ | |
| 324 | 324 | break; |
| 325 | 325 | } |
| 326 | 326 | |
| r5932 | r5933 | |
| 329 | 329 | |
| 330 | 330 | static void printer_w(running_machine *machine, UINT8 data) |
| 331 | 331 | { |
| 332 | // | |
| 332 | // comx35_state *state = machine->driver_data; | |
| 333 | 333 | int printer = input_port_read(machine, "PRINTER") & 0x07; |
| 334 | 334 | |
| 335 | 335 | switch (printer) |
| r5932 | r5933 | |
| 337 | 337 | case PRINTER_PARALLEL: |
| 338 | 338 | case PRINTER_PLOTTER: |
| 339 | 339 | /* |
| 340 | OUT 2 is used to send a byte to the printer | |
| 341 | */ | |
| 340 | OUT 2 is used to send a byte to the printer | |
| 341 | */ | |
| 342 | 342 | |
| 343 | 343 | printer_output(printer_device(machine), data); |
| 344 | 344 | break; |
| 345 | 345 | |
| 346 | 346 | case PRINTER_SERIAL: |
| 347 | 347 | /* |
| 348 | OUT 2 is used to send a bit to the printer | |
| 349 | */ | |
| 348 | OUT 2 is used to send a bit to the printer | |
| 349 | */ | |
| 350 | 350 | break; |
| 351 | 351 | |
| 352 | 352 | case PRINTER_THERMAL: |
| 353 | 353 | /* |
| 354 | OUT 2 is used to control the thermal printer where: | |
| 355 | Q = 0, b0-7: Pixel 1 to 8 | |
| 356 | Q = 1, b7: Pixel 9 (if b0-6=#21) | |
| 357 | Q = 1, b3=1: Move head right | |
| 358 | Q = 1, b0-7=#12: Move head left | |
| 359 | */ | |
| 354 | OUT 2 is used to control the thermal printer where: | |
| 355 | Q = 0, b0-7: Pixel 1 to 8 | |
| 356 | Q = 1, b7: Pixel 9 (if b0-6=#21) | |
| 357 | Q = 1, b3=1: Move head right | |
| 358 | Q = 1, b0-7=#12: Move head left | |
| 359 | */ | |
| 360 | 360 | break; |
| 361 | 361 | } |
| 362 | 362 | } |
| r5932 | r5933 | |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | /* allocate reset timer */ |
| 650 | ||
| 650 | ||
| 651 | 651 | state->reset_timer = timer_alloc(machine, reset_tick, NULL); |
| 652 | 652 | |
| 653 | 653 | /* screen format */ |
| r5932 | r5933 | |
| 740 | 740 | case COMX_TYPE_BINARY: |
| 741 | 741 | /* |
| 742 | 742 | |
| 743 | ||
| 743 | Type 1: pure machine code (i.e. no basic) | |
| 744 | 744 | |
| 745 | Byte 0 to 4: 1 - 'COMX' | |
| 746 | Byte 5 and 6: Start address (1802 way; see above) | |
| 747 | Byte 6 and 7: End address | |
| 748 | Byte 9 and 10: Execution address | |
| 745 | Byte 0 to 4: 1 - 'COMX' | |
| 746 | Byte 5 and 6: Start address (1802 way; see above) | |
| 747 | Byte 6 and 7: End address | |
| 748 | Byte 9 and 10: Execution address | |
| 749 | 749 | |
| 750 | Byte 11 to Eof, should be stored in ram from start to end; execution address | |
| 751 | 'xxxx' for the CALL (@xxxx) basic statement to actually run the code. | |
| 750 | Byte 11 to Eof, should be stored in ram from start to end; execution address | |
| 751 | 'xxxx' for the CALL (@xxxx) basic statement to actually run the code. | |
| 752 | 752 | |
| 753 | ||
| 753 | */ | |
| 754 | 754 | { |
| 755 | 755 | UINT16 start_address, end_address, run_address; |
| 756 | ||
| 756 | ||
| 757 | 757 | image_fread(image, header, 6); |
| 758 | 758 | |
| 759 | 759 | start_address = header[0] << 8 | header[1]; |
| r5932 | r5933 | |
| 769 | 769 | case COMX_TYPE_BASIC: |
| 770 | 770 | /* |
| 771 | 771 | |
| 772 | ||
| 772 | Type 2: Regular basic code or machine code followed by basic | |
| 773 | 773 | |
| 774 | Byte 0 to 4: 2 - 'COMX' | |
| 775 | Byte 5 and 6: DEFUS value, to be stored on 0x4281 and 0x4282 | |
| 776 | Byte 7 and 8: EOP value, to be stored on 0x4283 and 0x4284 | |
| 777 | Byte 9 and 10: End array, start string to be stored on 0x4292 and 0x4293 | |
| 778 | Byte 11 and 12: start array to be stored on 0x4294 and 0x4295 | |
| 779 | Byte 13 and 14: EOD and end string to be stored on 0x4299 and 0x429A | |
| 774 | Byte 0 to 4: 2 - 'COMX' | |
| 775 | Byte 5 and 6: DEFUS value, to be stored on 0x4281 and 0x4282 | |
| 776 | Byte 7 and 8: EOP value, to be stored on 0x4283 and 0x4284 | |
| 777 | Byte 9 and 10: End array, start string to be stored on 0x4292 and 0x4293 | |
| 778 | Byte 11 and 12: start array to be stored on 0x4294 and 0x4295 | |
| 779 | Byte 13 and 14: EOD and end string to be stored on 0x4299 and 0x429A | |
| 780 | 780 | |
| 781 | ||
| 781 | Byte 15 to Eof to be stored on 0x4400 and onwards | |
| 782 | 782 | |
| 783 | Byte 0x4281-0x429A (or at least the ones above) should be set otherwise | |
| 784 | BASIC won't 'see' the code. | |
| 783 | Byte 0x4281-0x429A (or at least the ones above) should be set otherwise | |
| 784 | BASIC won't 'see' the code. | |
| 785 | 785 | |
| 786 | ||
| 786 | */ | |
| 787 | 787 | |
| 788 | 788 | image_fread_memory(image, 0x4281, 4); |
| 789 | 789 | image_fread_memory(image, 0x4292, 4); |
| r5932 | r5933 | |
| 794 | 794 | case COMX_TYPE_BASIC_FM: |
| 795 | 795 | /* |
| 796 | 796 | |
| 797 | ||
| 797 | Type 3: F&M basic load | |
| 798 | 798 | |
| 799 | Not the most important! But we designed our own basic extension, you can | |
| 800 | find it in the F&M basic folder as F&M Basic.comx. When you run this all | |
| 801 | basic code should start at address 0x6700 instead of 0x4400 as from | |
| 802 | 0x4400-0x6700 the F&M basic stuff is loaded. So format is identical to Type | |
| 803 | 2 except Byte 15 to Eof should be stored on 0x6700 instead. .comx files of | |
| 804 | this format can also be found in the same folder as the F&M basic.comx file. | |
| 799 | Not the most important! But we designed our own basic extension, you can | |
| 800 | find it in the F&M basic folder as F&M Basic.comx. When you run this all | |
| 801 | basic code should start at address 0x6700 instead of 0x4400 as from | |
| 802 | 0x4400-0x6700 the F&M basic stuff is loaded. So format is identical to Type | |
| 803 | 2 except Byte 15 to Eof should be stored on 0x6700 instead. .comx files of | |
| 804 | this format can also be found in the same folder as the F&M basic.comx file. | |
| 805 | 805 | |
| 806 | ||
| 806 | */ | |
| 807 | 807 | |
| 808 | 808 | image_fread_memory(image, 0x4281, 4); |
| 809 | 809 | image_fread_memory(image, 0x4292, 4); |
| r5932 | r5933 | |
| 814 | 814 | case COMX_TYPE_RESERVED: |
| 815 | 815 | /* |
| 816 | 816 | |
| 817 | Type 4: Incorrect DATA format, I suggest to forget this one as it won't work | |
| 818 | in most cases. Instead I left this one reserved and designed Type 5 instead. | |
| 817 | Type 4: Incorrect DATA format, I suggest to forget this one as it won't work | |
| 818 | in most cases. Instead I left this one reserved and designed Type 5 instead. | |
| 819 | 819 | |
| 820 | ||
| 820 | */ | |
| 821 | 821 | break; |
| 822 | 822 | |
| 823 | 823 | case COMX_TYPE_DATA: |
| 824 | 824 | /* |
| 825 | 825 | |
| 826 | ||
| 826 | Type 5: Data load | |
| 827 | 827 | |
| 828 | Byte 0 to 4: 5 - 'COMX' | |
| 829 | Byte 5 and 6: Array length | |
| 830 | Byte 7 to Eof: Basic 'data' | |
| 828 | Byte 0 to 4: 5 - 'COMX' | |
| 829 | Byte 5 and 6: Array length | |
| 830 | Byte 7 to Eof: Basic 'data' | |
| 831 | 831 | |
| 832 | To load this first get the 'start array' from the running COMX, i.e. address | |
| 833 | 0x4295/0x4296. Calculate the EOD as 'start array' + length of the data (i.e. | |
| 834 | file length - 7). Store the EOD back on 0x4299 and ox429A. Calculate the | |
| 835 | 'Start String' as 'start array' + 'Array length' (Byte 5 and 6). Store the | |
| 836 | 'Start String' on 0x4292/0x4293. Load byte 7 and onwards starting from the | |
| 837 | 'start array' value fetched from 0x4295/0x4296. | |
| 832 | To load this first get the 'start array' from the running COMX, i.e. address | |
| 833 | 0x4295/0x4296. Calculate the EOD as 'start array' + length of the data (i.e. | |
| 834 | file length - 7). Store the EOD back on 0x4299 and ox429A. Calculate the | |
| 835 | 'Start String' as 'start array' + 'Array length' (Byte 5 and 6). Store the | |
| 836 | 'Start String' on 0x4292/0x4293. Load byte 7 and onwards starting from the | |
| 837 | 'start array' value fetched from 0x4295/0x4296. | |
| 838 | 838 | |
| 839 | ||
| 839 | */ | |
| 840 | 840 | { |
| 841 | 841 | UINT16 start_array, end_array, start_string, array_length; |
| 842 | 842 | |
| r5932 | r5933 | |
| 848 | 848 | |
| 849 | 849 | memory_write_byte(program, 0x4299, end_array >> 8); |
| 850 | 850 | memory_write_byte(program, 0x429a, end_array & 0xff); |
| 851 | ||
| 851 | ||
| 852 | 852 | start_string = start_array + array_length; |
| 853 | 853 | |
| 854 | 854 | memory_write_byte(program, 0x4292, start_string >> 8); |
| r5932 | r5933 | |
|---|---|---|
| 70 | 70 | static TIMER_CALLBACK( cassette_data_callback ) |
| 71 | 71 | { |
| 72 | 72 | /* This does all baud rates. 250 baud (trs80), and 500 baud (all others) set bit 7 of "cassette_data". |
| 73 | ||
| 73 | 1500 baud (trs80m3, trs80m4) is interrupt-driven and uses bit 0 of "cassette_data" */ | |
| 74 | 74 | |
| 75 | 75 | static double old_cassette_val; |
| 76 | 76 | double new_val = cassette_input(trs80_cass); |
| r5932 | r5933 | |
| 169 | 169 | |
| 170 | 170 | /************************************* |
| 171 | 171 | * |
| 172 | * | |
| 172 | * Port handlers. | |
| 173 | 173 | * |
| 174 | 174 | *************************************/ |
| 175 | 175 | |
| r5932 | r5933 | |
| 177 | 177 | READ8_HANDLER( trs80m4_e0_r ) |
| 178 | 178 | { |
| 179 | 179 | /* Indicates which devices are interrupting - d6..d3 not emulated. |
| 180 | Whenever an interrupt occurs, this port is immediately read | |
| 181 | to find out which device requires service. Lowest-numbered | |
| 182 | bit takes precedence. We take this opportunity to clear the | |
| 183 | cpu INT line. | |
| 180 | Whenever an interrupt occurs, this port is immediately read | |
| 181 | to find out which device requires service. Lowest-numbered | |
| 182 | bit takes precedence. We take this opportunity to clear the | |
| 183 | cpu INT line. | |
| 184 | 184 | |
| 185 | d6 RS232 Error (Any of {FE, PE, OR} errors has occured) | |
| 186 | d5 RS232 Rcv (DAV indicates a char ready to be picked up from uart) | |
| 187 | d4 RS232 Xmit (TBMT indicates ready to accept another char from cpu) | |
| 188 | d3 I/O Bus | |
| 189 | d2 RTC | |
| 190 | d1 Cass 1500 baud Falling | |
| 191 | d0 Cass 1500 baud Rising */ | |
| 185 | d6 RS232 Error (Any of {FE, PE, OR} errors has occured) | |
| 186 | d5 RS232 Rcv (DAV indicates a char ready to be picked up from uart) | |
| 187 | d4 RS232 Xmit (TBMT indicates ready to accept another char from cpu) | |
| 188 | d3 I/O Bus | |
| 189 | d2 RTC | |
| 190 | d1 Cass 1500 baud Falling | |
| 191 | d0 Cass 1500 baud Rising */ | |
| 192 | 192 | |
| 193 | 193 | cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); |
| 194 | 194 | return ~(trs80_mask & trs80_int); |
| r5932 | r5933 | |
| 197 | 197 | READ8_HANDLER( trs80m4_e4_r ) |
| 198 | 198 | { |
| 199 | 199 | /* Indicates which devices are interrupting - d6..d5 not emulated. |
| 200 | Whenever an NMI occurs, this port is immediately read | |
| 201 | to find out which device requires service. Lowest-numbered | |
| 202 | bit takes precedence. We take this opportunity to clear the | |
| 203 | cpu NMI line. | |
| 200 | Whenever an NMI occurs, this port is immediately read | |
| 201 | to find out which device requires service. Lowest-numbered | |
| 202 | bit takes precedence. We take this opportunity to clear the | |
| 203 | cpu NMI line. | |
| 204 | 204 | |
| 205 | d7 status of FDC INTREQ (0=true) | |
| 206 | d6 status of Motor Timeout (0=true) | |
| 207 | d5 status of Reset signal (0=true - this will reboot the computer) */ | |
| 205 | d7 status of FDC INTREQ (0=true) | |
| 206 | d6 status of Motor Timeout (0=true) | |
| 207 | d5 status of Reset signal (0=true - this will reboot the computer) */ | |
| 208 | 208 | |
| 209 | 209 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 210 | 210 | |
| r5932 | r5933 | |
| 214 | 214 | READ8_HANDLER( trs80m4_e8_r ) |
| 215 | 215 | { |
| 216 | 216 | /* not emulated |
| 217 | d7 Clear-to-Send (CTS), Pin 5 | |
| 218 | d6 Data-Set-Ready (DSR), pin 6 | |
| 219 | d5 Carrier Detect (CD), pin 8 | |
| 220 | d4 Ring Indicator (RI), pin 22 | |
| 221 | d3,d2,d0 Not used | |
| 222 | d1 UART Receiver Input, pin 20 (pin 20 is also DTR) */ | |
| 217 | d7 Clear-to-Send (CTS), Pin 5 | |
| 218 | d6 Data-Set-Ready (DSR), pin 6 | |
| 219 | d5 Carrier Detect (CD), pin 8 | |
| 220 | d4 Ring Indicator (RI), pin 22 | |
| 221 | d3,d2,d0 Not used | |
| 222 | d1 UART Receiver Input, pin 20 (pin 20 is also DTR) */ | |
| 223 | 223 | |
| 224 | 224 | return 0; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | READ8_HANDLER( trs80m4_ea_r ) |
| 228 | 228 | { |
| 229 | /* UART Status Register | |
| 230 | d7 Data Received ('1'=condition true) | |
| 231 | d6 Transmitter Holding Register empty ('1'=condition true) | |
| 232 | d5 Overrun Error ('1'=condition true) | |
| 233 | d4 Framing Error ('1'=condition true) | |
| 234 | d3 Parity Error ('1'=condition true) | |
| 235 | d2..d0 Not used */ | |
| 229 | /* UART Status Register | |
| 230 | d7 Data Received ('1'=condition true) | |
| 231 | d6 Transmitter Holding Register empty ('1'=condition true) | |
| 232 | d5 Overrun Error ('1'=condition true) | |
| 233 | d4 Framing Error ('1'=condition true) | |
| 234 | d3 Parity Error ('1'=condition true) | |
| 235 | d2..d0 Not used */ | |
| 236 | 236 | |
| 237 | 237 | UINT8 data=7; |
| 238 | 238 | ay31015_set_input_pin( trs80_ay31015, AY31015_SWE, 0 ); |
| r5932 | r5933 | |
| 265 | 265 | READ8_HANDLER( sys80_f9_r ) |
| 266 | 266 | { |
| 267 | 267 | /* UART Status Register - d6..d4 not emulated |
| 268 | d7 Transmit buffer empty (inverted) | |
| 269 | d6 CTS pin | |
| 270 | d5 DSR pin | |
| 271 | d4 CD pin | |
| 272 | d3 Parity Error | |
| 273 | d2 Framing Error | |
| 274 | d1 Overrun | |
| 275 | d0 Data Available */ | |
| 268 | d7 Transmit buffer empty (inverted) | |
| 269 | d6 CTS pin | |
| 270 | d5 DSR pin | |
| 271 | d4 CD pin | |
| 272 | d3 Parity Error | |
| 273 | d2 Framing Error | |
| 274 | d1 Overrun | |
| 275 | d0 Data Available */ | |
| 276 | 276 | |
| 277 | 277 | UINT8 data=70; |
| 278 | 278 | ay31015_set_input_pin( trs80_ay31015, AY31015_SWE, 0 ); |
| r5932 | r5933 | |
| 294 | 294 | READ8_HANDLER( trs80_ff_r ) |
| 295 | 295 | { |
| 296 | 296 | /* ModeSel and cassette data |
| 297 | d7 cassette data from tape | |
| 298 | d2 modesel setting */ | |
| 297 | d7 cassette data from tape | |
| 298 | d2 modesel setting */ | |
| 299 | 299 | |
| 300 | 300 | UINT8 data = (~trs80_mode & 1) << 5; |
| 301 | 301 | return data | cassette_data; |
| r5932 | r5933 | |
| 304 | 304 | READ8_HANDLER( trs80m4_ff_r ) |
| 305 | 305 | { |
| 306 | 306 | /* Return of cassette data stream from tape |
| 307 | d7 Low-speed data | |
| 308 | d6..d1 info from write of port EC | |
| 309 | d0 High-speed data */ | |
| 307 | d7 Low-speed data | |
| 308 | d6..d1 info from write of port EC | |
| 309 | d0 High-speed data */ | |
| 310 | 310 | |
| 311 | 311 | trs80_int &= 0xfc; /* clear cassette interrupts */ |
| 312 | 312 | |
| r5932 | r5933 | |
| 317 | 317 | WRITE8_HANDLER( trs80m4_84_w ) |
| 318 | 318 | { |
| 319 | 319 | /* Hi-res graphics control - d6..d4 not emulated |
| 320 | d7 Page Control | |
| 321 | d6 Fix upper memory | |
| 322 | d5 Memory bit 1 | |
| 323 | d4 Memory bit 0 | |
| 324 | d3 Invert Video | |
| 325 | d2 80/64 width | |
| 326 | d1 Select bit 1 | |
| 327 | d0 Select bit 0 */ | |
| 320 | d7 Page Control | |
| 321 | d6 Fix upper memory | |
| 322 | d5 Memory bit 1 | |
| 323 | d4 Memory bit 0 | |
| 324 | d3 Invert Video | |
| 325 | d2 80/64 width | |
| 326 | d1 Select bit 1 | |
| 327 | d0 Select bit 0 */ | |
| 328 | 328 | |
| 329 | 329 | /* get address space instead of io space */ |
| 330 | 330 | const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r5932 | r5933 | |
| 458 | 458 | WRITE8_HANDLER( trs80m4p_9c_w ) /* model 4P only - swaps the ROM with read-only RAM */ |
| 459 | 459 | { |
| 460 | 460 | /* Meaning of trs80_model4 variable: |
| 461 | d5..d4 memory mode (as described in section above) | |
| 462 | d3 rom switch (1=enabled) only effective in mode0 and 1 | |
| 463 | d2 this is a Model 4P | |
| 464 | d1 this is a Model 4 | |
| 465 | d0 Video banking exists yes/no (1=not banked) */ | |
| 461 | d5..d4 memory mode (as described in section above) | |
| 462 | d3 rom switch (1=enabled) only effective in mode0 and 1 | |
| 463 | d2 this is a Model 4P | |
| 464 | d1 this is a Model 4 | |
| 465 | d0 Video banking exists yes/no (1=not banked) */ | |
| 466 | 466 | |
| 467 | 467 | /* get address space instead of io space */ |
| 468 | 468 | const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r5932 | r5933 | |
| 481 | 481 | memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu")); |
| 482 | 482 | break; |
| 483 | 483 | } |
| 484 | } | |
| 484 | } | |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | WRITE8_HANDLER( trs80m4_e0_w ) |
| 488 | 488 | { |
| 489 | 489 | /* Interrupt settings - which devices are allowed to interrupt - bits align with read of E0 |
| 490 | d6 Enable Rec Err | |
| 491 | d5 Enable Rec Data | |
| 492 | d4 Enable Xmit Emp | |
| 493 | d3 Enable I/O int | |
| 494 | d2 Enable RT int | |
| 495 | d1 C fall Int | |
| 496 | d0 C Rise Int */ | |
| 490 | d6 Enable Rec Err | |
| 491 | d5 Enable Rec Data | |
| 492 | d4 Enable Xmit Emp | |
| 493 | d3 Enable I/O int | |
| 494 | d2 Enable RT int | |
| 495 | d1 C fall Int | |
| 496 | d0 C Rise Int */ | |
| 497 | 497 | |
| 498 | 498 | trs80_mask = data; |
| 499 | 499 | } |
| r5932 | r5933 | |
| 501 | 501 | WRITE8_HANDLER( trs80m4_e4_w ) |
| 502 | 502 | { |
| 503 | 503 | /* Disk to NMI interface |
| 504 | d7 1=enable disk INTRQ to generate NMI | |
| 505 | d6 1=enable disk Motor Timeout to generate NMI */ | |
| 504 | d7 1=enable disk INTRQ to generate NMI | |
| 505 | d6 1=enable disk Motor Timeout to generate NMI */ | |
| 506 | 506 | |
| 507 | 507 | trs80_nmi_mask = data; |
| 508 | 508 | } |
| r5932 | r5933 | |
| 517 | 517 | WRITE8_HANDLER( trs80m4_e9_w ) |
| 518 | 518 | { |
| 519 | 519 | /* UART set baud rate. Rx = bits 0..3, Tx = bits 4..7 |
| 520 | 00h 50 | |
| 521 | 11h 75 | |
| 522 | 22h 110 | |
| 523 | 33h 134.5 | |
| 524 | 44h 150 | |
| 525 | 55h 300 | |
| 526 | 66h 600 | |
| 527 | 77h 1200 | |
| 528 | 88h 1800 | |
| 529 | 99h 2000 | |
| 530 | AAh 2400 | |
| 531 | BBh 3600 | |
| 532 | CCh 4800 | |
| 533 | DDh 7200 | |
| 534 | EEh 9600 | |
| 535 | FFh 19200 */ | |
| 520 | 00h 50 | |
| 521 | 11h 75 | |
| 522 | 22h 110 | |
| 523 | 33h 134.5 | |
| 524 | 44h 150 | |
| 525 | 55h 300 | |
| 526 | 66h 600 | |
| 527 | 77h 1200 | |
| 528 | 88h 1800 | |
| 529 | 99h 2000 | |
| 530 | AAh 2400 | |
| 531 | BBh 3600 | |
| 532 | CCh 4800 | |
| 533 | DDh 7200 | |
| 534 | EEh 9600 | |
| 535 | FFh 19200 */ | |
| 536 | 536 | |
| 537 | 537 | int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 }; |
| 538 | 538 | ay31015_set_receiver_clock( trs80_ay31015, baud_clock[data & 0x0f]); |
| r5932 | r5933 | |
| 544 | 544 | if (trs80_reg_load) |
| 545 | 545 | |
| 546 | 546 | /* d2..d0 not emulated |
| 547 | d7 Even Parity Enable ('1'=even, '0'=odd) | |
| 548 | d6='1',d5='1' for 8 bits | |
| 549 | d6='0',d5='1' for 7 bits | |
| 550 | d6='1',d5='0' for 6 bits | |
| 551 | d6='0',d5='0' for 5 bits | |
| 552 | d4 Stop Bit Select ('1'=two stop bits, '0'=one stop bit) | |
| 553 | d3 Parity Inhibit ('1'=disable; No parity, '0'=parity enabled) | |
| 554 | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) | |
| 555 | d1 Request-to-Send (RTS), pin 4 | |
| 556 | d0 Data-Terminal-Ready (DTR), pin 20 */ | |
| 547 | d7 Even Parity Enable ('1'=even, '0'=odd) | |
| 548 | d6='1',d5='1' for 8 bits | |
| 549 | d6='0',d5='1' for 7 bits | |
| 550 | d6='1',d5='0' for 6 bits | |
| 551 | d6='0',d5='0' for 5 bits | |
| 552 | d4 Stop Bit Select ('1'=two stop bits, '0'=one stop bit) | |
| 553 | d3 Parity Inhibit ('1'=disable; No parity, '0'=parity enabled) | |
| 554 | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) | |
| 555 | d1 Request-to-Send (RTS), pin 4 | |
| 556 | d0 Data-Terminal-Ready (DTR), pin 20 */ | |
| 557 | 557 | |
| 558 | 558 | { |
| 559 | 559 | ay31015_set_input_pin( trs80_ay31015, AY31015_CS, 0 ); |
| r5932 | r5933 | |
| 568 | 568 | { |
| 569 | 569 | |
| 570 | 570 | /* not emulated |
| 571 | d7,d6 Not used | |
| 572 | d5 Secondary Unassigned, pin 18 | |
| 573 | d4 Secondary Transmit Data, pin 14 | |
| 574 | d3 Secondary Request-to-Send, pin 19 | |
| 575 | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) | |
| 576 | d1 Data-Terminal-Ready (DTR), pin 20 | |
| 577 | d0 Request-to-Send (RTS), pin 4 */ | |
| 571 | d7,d6 Not used | |
| 572 | d5 Secondary Unassigned, pin 18 | |
| 573 | d4 Secondary Transmit Data, pin 14 | |
| 574 | d3 Secondary Request-to-Send, pin 19 | |
| 575 | d2 Break ('0'=disable transmit data; continuous RS232 'SPACE' condition) | |
| 576 | d1 Data-Terminal-Ready (DTR), pin 20 | |
| 577 | d0 Request-to-Send (RTS), pin 4 */ | |
| 578 | 578 | |
| 579 | 579 | } |
| 580 | 580 | } |
| r5932 | r5933 | |
| 587 | 587 | WRITE8_HANDLER( trs80m4_ec_w ) |
| 588 | 588 | { |
| 589 | 589 | /* Hardware settings - d5..d4 not emulated |
| 590 | d6 CPU fast (1=4MHz, 0=2MHz) | |
| 591 | d5 1=Enable Video Wait | |
| 592 | d4 1=Enable External I/O bus | |
| 593 | d3 1=Enable Alternate Character Set | |
| 594 | d2 Mode Select (0=64 chars, 1=32chars) | |
| 595 | d1 Cassette Motor (1=On) */ | |
| 590 | d6 CPU fast (1=4MHz, 0=2MHz) | |
| 591 | d5 1=Enable Video Wait | |
| 592 | d4 1=Enable External I/O bus | |
| 593 | d3 1=Enable Alternate Character Set | |
| 594 | d2 Mode Select (0=64 chars, 1=32chars) | |
| 595 | d1 Cassette Motor (1=On) */ | |
| 596 | 596 | |
| 597 | 597 | cputag_set_clock(space->machine, "maincpu", data & 0x40 ? MODEL4_MASTER_CLOCK/5 : MODEL4_MASTER_CLOCK/10); |
| 598 | 598 | |
| r5932 | r5933 | |
| 608 | 608 | /* Selection of drive and parameters - d6..d5 not emulated. |
| 609 | 609 | A write also causes the selected drive motor to turn on for about 3 seconds. |
| 610 | 610 | When the motor turns off, the drive is deselected. |
| 611 | d7 1=MFM, 0=FM | |
| 612 | d6 1=Wait | |
| 613 | d5 1=Write Precompensation enabled | |
| 614 | d4 0=Side 0, 1=Side 1 | |
| 615 | d3 1=select drive 3 | |
| 616 | d2 1=select drive 2 | |
| 617 | d1 1=select drive 1 | |
| 618 | d0 1=select drive 0 */ | |
| 611 | d7 1=MFM, 0=FM | |
| 612 | d6 1=Wait | |
| 613 | d5 1=Write Precompensation enabled | |
| 614 | d4 0=Side 0, 1=Side 1 | |
| 615 | d3 1=select drive 3 | |
| 616 | d2 1=select drive 2 | |
| 617 | d1 1=select drive 1 | |
| 618 | d0 1=select drive 0 */ | |
| 619 | 619 | |
| 620 | 620 | UINT8 drive = 255; |
| 621 | 621 | |
| r5932 | r5933 | |
| 645 | 645 | WRITE8_HANDLER( sys80_f8_w ) |
| 646 | 646 | { |
| 647 | 647 | /* not emulated |
| 648 | d2 reset UART (XR pin) | |
| 649 | d1 DTR | |
| 650 | d0 RTS */ | |
| 648 | d2 reset UART (XR pin) | |
| 649 | d1 DTR | |
| 650 | d0 RTS */ | |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | WRITE8_HANDLER( sys80_fe_w ) |
| 654 | 654 | { |
| 655 | 655 | /* not emulated |
| 656 | ||
| 656 | d4 select internal or external cassette player */ | |
| 657 | 657 | |
| 658 | 658 | trs80_tape_unit = (data & 0x10) ? 2 : 1; |
| 659 | 659 | } |
| r5932 | r5933 | |
| 662 | 662 | WRITE8_HANDLER( lnw80_fe_w ) |
| 663 | 663 | { |
| 664 | 664 | /* lnw80 video options |
| 665 | d3 bankswitch lower 16k between roms and hires ram (1=hires) | |
| 666 | d2 enable colour \ | |
| 667 | d1 hres / these 2 are the bits from the MODE command of LNWBASIC | |
| 668 | d0 inverse video (entire screen) */ | |
| 665 | d3 bankswitch lower 16k between roms and hires ram (1=hires) | |
| 666 | d2 enable colour \ | |
| 667 | d1 hres / these 2 are the bits from the MODE command of LNWBASIC | |
| 668 | d0 inverse video (entire screen) */ | |
| 669 | 669 | |
| 670 | 670 | /* get address space instead of io space */ |
| 671 | 671 | const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r5932 | r5933 | |
| 696 | 696 | WRITE8_HANDLER( trs80_ff_w ) |
| 697 | 697 | { |
| 698 | 698 | /* Standard output port of Model I |
| 699 | d3 ModeSel bit | |
| 700 | d2 Relay | |
| 701 | d1, d0 Cassette output */ | |
| 699 | d3 ModeSel bit | |
| 700 | d2 Relay | |
| 701 | d1, d0 Cassette output */ | |
| 702 | 702 | |
| 703 | 703 | static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 }; |
| 704 | 704 | |
| r5932 | r5933 | |
| 716 | 716 | WRITE8_HANDLER( trs80m4_ff_w ) |
| 717 | 717 | { |
| 718 | 718 | /* Cassette port |
| 719 | ||
| 719 | d1, d0 Cassette output */ | |
| 720 | 720 | |
| 721 | 721 | static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 }; |
| 722 | 722 | cassette_output( trs80_cass, levels[data & 3]); |
| r5932 | r5933 | |
| 726 | 726 | |
| 727 | 727 | /************************************* |
| 728 | 728 | * |
| 729 | * | |
| 729 | * Interrupt handlers. | |
| 730 | 730 | * |
| 731 | 731 | *************************************/ |
| 732 | 732 | |
| 733 | 733 | INTERRUPT_GEN( trs80_rtc_interrupt ) |
| 734 | 734 | { |
| 735 | 735 | /* This enables the processing of interrupts for the clock and the flashing cursor. |
| 736 | The OS counts one tick for each interrupt. The Model I has 40 ticks per | |
| 737 | second, while the Model III/4 has 30. */ | |
| 736 | The OS counts one tick for each interrupt. The Model I has 40 ticks per | |
| 737 | second, while the Model III/4 has 30. */ | |
| 738 | 738 | |
| 739 | 739 | if (trs80_model4) // Model 4 |
| 740 | 740 | { |
| r5932 | r5933 | |
| 797 | 797 | |
| 798 | 798 | |
| 799 | 799 | /************************************* |
| 800 | * * | |
| 801 | * Memory handlers * | |
| 802 | * * | |
| 800 | * * | |
| 801 | * Memory handlers * | |
| 802 | * * | |
| 803 | 803 | *************************************/ |
| 804 | 804 | |
| 805 | 805 | READ8_DEVICE_HANDLER (trs80_wd179x_r) |
| r5932 | r5933 | |
| 813 | 813 | READ8_HANDLER ( trs80_printer_r ) |
| 814 | 814 | { |
| 815 | 815 | /* Bit 7 - 1 = Busy; 0 = Not Busy |
| 816 | Bit 6 - 1 = Out of Paper; 0 = Paper | |
| 817 | Bit 5 - 1 = Printer selected; 0 = Printer not selected | |
| 818 | Bit 4 - 1 = No Fault; 0 = Fault | |
| 819 | Bits 3..0 - Not used */ | |
| 816 | Bit 6 - 1 = Out of Paper; 0 = Paper | |
| 817 | Bit 5 - 1 = Printer selected; 0 = Printer not selected | |
| 818 | Bit 4 - 1 = No Fault; 0 = Fault | |
| 819 | Bits 3..0 - Not used */ | |
| 820 | 820 | |
| 821 | 821 | UINT8 data = 0; |
| 822 | 822 | data |= centronics_busy_r(trs80_printer) << 7; |
| r5932 | r5933 | |
| 837 | 837 | WRITE8_HANDLER( trs80_cassunit_w ) |
| 838 | 838 | { |
| 839 | 839 | /* not emulated |
| 840 | 01 for unit 1 (default | |
| 841 | 02 for unit 2 */ | |
| 840 | 01 for unit 1 (default | |
| 841 | 02 for unit 2 */ | |
| 842 | 842 | |
| 843 | 843 | trs80_tape_unit = data; |
| 844 | 844 | } |
| r5932 | r5933 | |
| 846 | 846 | READ8_HANDLER( trs80_irq_status_r ) |
| 847 | 847 | { |
| 848 | 848 | /* (trs80l2) Whenever an interrupt occurs, 37E0 is read to see what devices require service. |
| 849 | d7 = RTC | |
| 850 | d6 = FDC | |
| 851 | d2 = Communications (not emulated) | |
| 852 | All interrupting devices are serviced in a single interrupt. There is a mask byte, | |
| 853 | which is dealt with by the DOS. We take the opportunity to reset the cpu INT line. */ | |
| 849 | d7 = RTC | |
| 850 | d6 = FDC | |
| 851 | d2 = Communications (not emulated) | |
| 852 | All interrupting devices are serviced in a single interrupt. There is a mask byte, | |
| 853 | which is dealt with by the DOS. We take the opportunity to reset the cpu INT line. */ | |
| 854 | 854 | |
| 855 | 855 | int result = trs80_int; |
| 856 | 856 | cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); |
| r5932 | r5933 | |
| 884 | 884 | head = 0; |
| 885 | 885 | break; |
| 886 | 886 | /* These 3 combinations aren't official. Some manufacturers of double-sided disks |
| 887 | ||
| 887 | used drive select 4 to indicate the other side. */ | |
| 888 | 888 | case 9: |
| 889 | 889 | drive = 0; |
| 890 | 890 | head = 1; |
| r5932 | r5933 | |
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | /************************************* |
| 911 | * | |
| 911 | * Keyboard * | |
| 912 | 912 | *************************************/ |
| 913 | 913 | READ8_HANDLER( trs80_keyboard_r ) |
| 914 | 914 | { |
| r5932 | r5933 | |
| 936 | 936 | |
| 937 | 937 | |
| 938 | 938 | /************************************* |
| 939 | * | |
| 939 | * Machine * | |
| 940 | 940 | *************************************/ |
| 941 | 941 | |
| 942 | 942 | MACHINE_RESET( trs80 ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Ricoh RP5C01A Real Time Clock With Internal RAM emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | _CS 1 |* \_/ | 18 Vcc | |
| 11 | CS 2 | | 17 OSCOUT | |
| 12 | ADJ 3 | | 16 OSCIN | |
| 13 | A0 4 | | 15 _ALARM | |
| 14 | A1 5 | RP5C01A | 14 D3 | |
| 15 | A2 6 | | 13 D2 | |
| 16 | A3 7 | | 12 D1 | |
| 17 | _RD 8 | | 11 D0 | |
| 18 | GND 9 |_____________| 10 _WR | |
| 9 | _____ _____ | |
| 10 | _CS 1 |* \_/ | 18 Vcc | |
| 11 | CS 2 | | 17 OSCOUT | |
| 12 | ADJ 3 | | 16 OSCIN | |
| 13 | A0 4 | | 15 _ALARM | |
| 14 | A1 5 | RP5C01A | 14 D3 | |
| 15 | A2 6 | | 13 D2 | |
| 16 | A3 7 | | 12 D1 | |
| 17 | _RD 8 | | 11 D0 | |
| 18 | GND 9 |_____________| 10 _WR | |
| 19 | 19 | |
| 20 | 20 | **********************************************************************/ |
| 21 | 21 |
| r5932 | r5933 | |
|---|---|---|
| 105 | 105 | else if (!(p1 & P1_EXT_RAM_ENABLE)) { |
| 106 | 106 | return ram[offset]; |
| 107 | 107 | } else { |
| 108 | // | |
| 108 | // return ef9341_r( offset & 0x02, offset & 0x01 ); | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | return 0; |
| r5932 | r5933 | |
| 119 | 119 | else if (!(p1 & P1_VDC_ENABLE)) { |
| 120 | 120 | odyssey2_video_w(space, offset, data); |
| 121 | 121 | } else { |
| 122 | // | |
| 122 | // ef9341_w( offset & 0x02, offset & 0x01, data ); | |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 |
| r5932 | r5933 | |
|---|---|---|
| 55 | 55 | { |
| 56 | 56 | if (!eeprom.clock && (data&4) ) |
| 57 | 57 | { |
| 58 | // | |
| 58 | // logerror("!!!tandy1000 eeprom %.2x %.2x\n",eeprom.state, data); | |
| 59 | 59 | switch (eeprom.state) |
| 60 | 60 | { |
| 61 | 61 | case 0: |
| r5932 | r5933 | |
| 165 | 165 | |
| 166 | 166 | WRITE8_HANDLER ( pc_t1t_p37x_w ) |
| 167 | 167 | { |
| 168 | // | |
| 168 | // DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", cpu_get_pc( space->cpu),offset, data)); | |
| 169 | 169 | if (offset!=4) |
| 170 | 170 | logerror("T1T_p37x_w %.5x #%d $%02x\n", cpu_get_pc( space->cpu),offset, data); |
| 171 | 171 | tandy.data[offset]=data; |
| r5932 | r5933 | |
| 180 | 180 | READ8_HANDLER ( pc_t1t_p37x_r ) |
| 181 | 181 | { |
| 182 | 182 | int data = tandy.data[offset]; |
| 183 | // | |
| 183 | // DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", cpu_get_pc( space->cpu), offset, data)); | |
| 184 | 184 | return data; |
| 185 | 185 | } |
| 186 | 186 | |
| r5932 | r5933 | |
| 213 | 213 | break; |
| 214 | 214 | case 2: |
| 215 | 215 | tandy_ppi.portc = data; |
| 216 | if (data & 8) | |
| 216 | if (data & 8) | |
| 217 | 217 | cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 1); |
| 218 | 218 | else |
| 219 | 219 | cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 4.77/8); |
| r5932 | r5933 | |
| 233 | 233 | data=tandy_ppi.portb; |
| 234 | 234 | break; |
| 235 | 235 | case 2: |
| 236 | // if (tandy1000hx) { | |
| 237 | // data=tandy_ppi.portc; // causes problems (setuphx) | |
| 236 | // if (tandy1000hx) { | |
| 237 | // data=tandy_ppi.portc; // causes problems (setuphx) | |
| 238 | 238 | if (!tandy1000_read_eeprom()) data&=~0x10; |
| 239 | // | |
| 239 | // } | |
| 240 | 240 | break; |
| 241 | 241 | } |
| 242 | 242 | return data; |
| r5932 | r5933 | |
| 369 | 369 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) /* F9 43 C3 */ |
| 370 | 370 | PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) /* F10 44 C4 */ |
| 371 | 371 | PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NumLock") PORT_CODE(KEYCODE_NUMLOCK) PORT_TOGGLE/* Num Lock 45 C5 */ |
| 372 | PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Hold") PORT_CODE(KEYCODE_SCRLOCK) /* | |
| 372 | PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Hold") PORT_CODE(KEYCODE_SCRLOCK) /* 46 C6 */ | |
| 373 | 373 | PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 7 \\") PORT_CODE(KEYCODE_7_PAD) /* Keypad 7 47 C7 */ |
| 374 | 374 | PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 8 ~") PORT_CODE(KEYCODE_8_PAD) /* Keypad 8 48 C8 */ |
| 375 | 375 | PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 9 (PgUp)") PORT_CODE(KEYCODE_9_PAD) /* Keypad 9 (PgUp) 49 C9 */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | primo.c | |
| 4 | 4 | |
| 5 | Functions to emulate general aspects of Microkey Primo computers | |
| 6 | (RAM, ROM, interrupts, I/O ports) | |
| 5 | Functions to emulate general aspects of Microkey Primo computers | |
| 6 | (RAM, ROM, interrupts, I/O ports) | |
| 7 | 7 | |
| 8 | ||
| 8 | Krzysztof Strzecha | |
| 9 | 9 | |
| 10 | 10 | *******************************************************************************/ |
| 11 | 11 | |
| r5932 | r5933 | |
| 31 | 31 | |
| 32 | 32 | /******************************************************************************* |
| 33 | 33 | |
| 34 | ||
| 34 | Interrupt callback | |
| 35 | 35 | |
| 36 | 36 | *******************************************************************************/ |
| 37 | 37 | |
| r5932 | r5933 | |
| 43 | 43 | |
| 44 | 44 | /******************************************************************************* |
| 45 | 45 | |
| 46 | ||
| 46 | Memory banking | |
| 47 | 47 | |
| 48 | 48 | *******************************************************************************/ |
| 49 | 49 | |
| r5932 | r5933 | |
| 74 | 74 | |
| 75 | 75 | /******************************************************************************* |
| 76 | 76 | |
| 77 | ||
| 77 | IO read/write handlers | |
| 78 | 78 | |
| 79 | 79 | *******************************************************************************/ |
| 80 | 80 | |
| r5932 | r5933 | |
| 120 | 120 | data &= ~0x10; |
| 121 | 121 | |
| 122 | 122 | // bit 3 - SRQ |
| 123 | // | |
| 123 | // data &= (!cbm_serial_request_read(serbus, 0)) ? ~0x08 : ~0x00; | |
| 124 | 124 | |
| 125 | 125 | // bit 2 - joystic 2 (not implemeted yet) |
| 126 | 126 | |
| r5932 | r5933 | |
| 198 | 198 | |
| 199 | 199 | if (data & 0x04) |
| 200 | 200 | logerror ("SRQ WRITE\n"); |
| 201 | // | |
| 201 | // logerror ("IOW KI-2 data:%02x\n", data); | |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | WRITE8_HANDLER( primo_FD_w ) |
| r5932 | r5933 | |
| 212 | 212 | |
| 213 | 213 | /******************************************************************************* |
| 214 | 214 | |
| 215 | ||
| 215 | Driver initialization | |
| 216 | 216 | |
| 217 | 217 | *******************************************************************************/ |
| 218 | 218 | |
| r5932 | r5933 | |
| 241 | 241 | |
| 242 | 242 | /******************************************************************************* |
| 243 | 243 | |
| 244 | ||
| 244 | Machine initialization | |
| 245 | 245 | |
| 246 | 246 | *******************************************************************************/ |
| 247 | 247 | |
| r5932 | r5933 | |
| 268 | 268 | |
| 269 | 269 | /******************************************************************************* |
| 270 | 270 | |
| 271 | ||
| 271 | Snapshot files (.pss) | |
| 272 | 272 | |
| 273 | 273 | *******************************************************************************/ |
| 274 | 274 | |
| r5932 | r5933 | |
| 337 | 337 | |
| 338 | 338 | /******************************************************************************* |
| 339 | 339 | |
| 340 | ||
| 340 | Quicload files (.pp) | |
| 341 | 341 | |
| 342 | 342 | *******************************************************************************/ |
| 343 | 343 |
| r5932 | r5933 | |
|---|---|---|
| 193 | 193 | memory_set_bankptr(machine, 3, ti8x_ram + 0x004000*(ti8x_memory_page_2&0x01)); |
| 194 | 194 | memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, SMH_BANK(3)); |
| 195 | 195 | } |
| 196 | ||
| 196 | ||
| 197 | 197 | } |
| 198 | 198 | else |
| 199 | 199 | { |
| r5932 | r5933 | |
| 399 | 399 | |
| 400 | 400 | if (ti_calculator_model == TI_83p) |
| 401 | 401 | memset(ti8x_ram, 0, sizeof(unsigned char)*32*1024); |
| 402 | ||
| 403 | // memset(mem + 0x83000, 0xff, 0x1000); | |
| 404 | ||
| 402 | ||
| 403 | // memset(mem + 0x83000, 0xff, 0x1000); | |
| 404 | ||
| 405 | 405 | ti_calculator_model = TI_83p; |
| 406 | 406 | |
| 407 | 407 | timer_pulse(machine, ATTOTIME_IN_HZ(200), NULL, 0, ti85_timer_callback); |
| r5932 | r5933 | |
| 549 | 549 | { |
| 550 | 550 | UINT8* ti82_video; |
| 551 | 551 | UINT8 ti82_port11; |
| 552 | ||
| 552 | ||
| 553 | 553 | if(ti82_video_dir == 4) |
| 554 | 554 | ++ti82_video_y; |
| 555 | 555 | if(ti82_video_dir == 5) |
| r5932 | r5933 | |
| 563 | 563 | ti82_port11 = ti82_video_buffer[(12*ti82_video_y)+ti82_video_x]; |
| 564 | 564 | else |
| 565 | 565 | { |
| 566 | ti82_video_col = ti82_video_x * 6; | |
| 566 | ti82_video_col = ti82_video_x * 6; | |
| 567 | 567 | ti82_video_bit = ti82_video_col & 7; |
| 568 | 568 | ti82_video = &ti82_video_buffer[(ti82_video_y*12)+(ti82_video_col>>3)]; |
| 569 | 569 | ti82_port11 = ((((*ti82_video)<<8)+ti82_video[1])>>(10-ti82_video_bit)); |
| r5932 | r5933 | |
| 601 | 601 | |
| 602 | 602 | READ8_HANDLER ( ti83_port_0002_r ) |
| 603 | 603 | { |
| 604 | return ti8x_port2; | |
| 604 | return ti8x_port2; | |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | READ8_HANDLER ( ti83_port_0003_r ) |
| r5932 | r5933 | |
| 621 | 621 | |
| 622 | 622 | READ8_HANDLER ( ti83p_port_0002_r ) |
| 623 | 623 | { |
| 624 | return ti8x_port2|3; | |
| 624 | return ti8x_port2|3; | |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | WRITE8_HANDLER ( ti81_port_0007_w ) |
| r5932 | r5933 | |
| 648 | 648 | { |
| 649 | 649 | if (ti85_LCD_status && !(data&0x08)) ti85_timer_interrupt_mask = 0; |
| 650 | 650 | ti85_ON_interrupt_mask = data&0x01; |
| 651 | // | |
| 651 | // ti85_timer_interrupt_mask = data&0x04; | |
| 652 | 652 | ti85_LCD_mask = data&0x02; |
| 653 | 653 | ti85_LCD_status = data&0x08; |
| 654 | 654 | } |
| r5932 | r5933 | |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | WRITE8_HANDLER ( ti82_port_0010_w) |
| 709 | { | |
| 709 | { | |
| 710 | 710 | if (data == 0x00 || data == 0x01) |
| 711 | 711 | ti82_video_mode = data; |
| 712 | 712 | if (data >= 0x04 && data <= 0x07) |
| r5932 | r5933 | |
| 724 | 724 | WRITE8_HANDLER ( ti82_port_0011_w ) |
| 725 | 725 | { |
| 726 | 726 | UINT8* ti82_video; |
| 727 | ||
| 727 | ||
| 728 | 728 | if(ti82_video_mode) |
| 729 | 729 | ti82_video_buffer[(12*ti82_video_y)+ti82_video_x] = data; |
| 730 | 730 | else |
| 731 | 731 | { |
| 732 | 732 | data = data<<0x02; |
| 733 | ti82_video_col = ti82_video_x * 6; | |
| 733 | ti82_video_col = ti82_video_x * 6; | |
| 734 | 734 | ti82_video_bit = ti82_video_col & 0x07; |
| 735 | 735 | ti82_video = &ti82_video_buffer[(ti82_video_y*12)+(ti82_video_col>>3)]; |
| 736 | 736 | *ti82_video = (*ti82_video & ~(0xFC>>ti82_video_bit)) | (data>>ti82_video_bit); |
| r5932 | r5933 | |
| 746 | 746 | --ti82_video_x; |
| 747 | 747 | if(ti82_video_dir == 0x07) |
| 748 | 748 | ++ti82_video_x; |
| 749 | ||
| 749 | ||
| 750 | 750 | ti82_video_x &= 15; |
| 751 | 751 | ti82_video_y &= 63; |
| 752 | 752 | } |
| r5932 | r5933 | |
| 754 | 754 | WRITE8_HANDLER ( ti83_port_0000_w ) |
| 755 | 755 | { |
| 756 | 756 | ti8x_memory_page_1 = (ti8x_memory_page_1 & 7) | ((data & 16) >> 1); |
| 757 | update_ti85_memory(space->machine); | |
| 757 | update_ti85_memory(space->machine); | |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | WRITE8_HANDLER ( ti83_port_0002_w ) |
| r5932 | r5933 | |
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | WRITE8_HANDLER ( ti83_port_0003_w ) |
| 768 | { | |
| 768 | { | |
| 769 | 769 | if (ti85_LCD_status && !(data&0x08)) ti85_timer_interrupt_mask = 0; |
| 770 | 770 | ti85_ON_interrupt_mask = data&0x01; |
| 771 | 771 | //ti85_timer_interrupt_mask = data&0x04; |
| r5932 | r5933 | |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | WRITE8_HANDLER ( ti83p_port_0010_w) |
| 816 | { | |
| 816 | { | |
| 817 | 817 | if (data == 0x00 || data == 0x01) |
| 818 | 818 | ti82_video_mode = data; |
| 819 | 819 | if (data == 0x02 || data == 0x03) |
| r5932 | r5933 | |
| 828 | 828 | ti82_video_y = data - 0x80; |
| 829 | 829 | if (data >= 0xc8) |
| 830 | 830 | ti85_LCD_contrast = data - 0xc8; |
| 831 | ||
| 831 | ||
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | /* NVRAM functions */ |
| r5932 | r5933 | |
|---|---|---|
| 633 | 633 | |
| 634 | 634 | svi.bank_switch = 0xff; |
| 635 | 635 | svi318_set_banks(machine); |
| 636 | ||
| 636 | ||
| 637 | 637 | for(drive=0;drive<2;drive++) |
| 638 | 638 | { |
| 639 | 639 | floppy_install_load_proc(floppy_get_device(machine, drive), svi318_load_proc); |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - count | |
| 15 | - stop | |
| 16 | - reset | |
| 17 | - reference registers | |
| 14 | - count | |
| 15 | - stop | |
| 16 | - reset | |
| 17 | - reference registers | |
| 18 | 18 | |
| 19 | 19 | */ |
| 20 | 20 | |
| r5932 | r5933 | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /*------------------------------------------------- |
| 260 | msm58321_address_write_w - adddress write | |
| 261 | handshake | |
| 260 | msm58321_address_write_w - adddress write | |
| 261 | handshake | |
| 262 | 262 | -------------------------------------------------*/ |
| 263 | 263 | |
| 264 | 264 | WRITE_LINE_DEVICE_HANDLER( msm58321_address_write_w ) |
| r5932 | r5933 | |
| 276 | 276 | |
| 277 | 277 | WRITE_LINE_DEVICE_HANDLER( msm58321_stop_w ) |
| 278 | 278 | { |
| 279 | // | |
| 279 | // msm58321_t *msm58321 = get_safe_token(device); | |
| 280 | 280 | |
| 281 | 281 | if (LOG) logerror("MSM58321 '%s' STOP: %u\n", device->tag, state); |
| 282 | 282 | } |
| r5932 | r5933 | |
| 287 | 287 | |
| 288 | 288 | WRITE_LINE_DEVICE_HANDLER( msm58321_test_w ) |
| 289 | 289 | { |
| 290 | // | |
| 290 | // msm58321_t *msm58321 = get_safe_token(device); | |
| 291 | 291 | |
| 292 | 292 | if (LOG) logerror("MSM58321 '%s' TEST: %u\n", device->tag, state); |
| 293 | 293 | } |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | CS2 1 |* \_/ | 16 Vdd | |
| 11 | WRITE 2 | | 15 XT | |
| 12 | READ 3 | | 14 _XT | |
| 13 | D0 4 | MSM58321RS | 13 CS1 | |
| 14 | D1 5 | | 12 TEST | |
| 15 | D2 6 | | 11 STOP | |
| 16 | D3 7 | | 10 _BUSY | |
| 17 | GND 8 |_____________| 9 ADDRESS WRITE | |
| 9 | _____ _____ | |
| 10 | CS2 1 |* \_/ | 16 Vdd | |
| 11 | WRITE 2 | | 15 XT | |
| 12 | READ 3 | | 14 _XT | |
| 13 | D0 4 | MSM58321RS | 13 CS1 | |
| 14 | D1 5 | | 12 TEST | |
| 15 | D2 6 | | 11 STOP | |
| 16 | D3 7 | | 10 _BUSY | |
| 17 | GND 8 |_____________| 9 ADDRESS WRITE | |
| 18 | 18 | |
| 19 | 19 | **********************************************************************/ |
| 20 | 20 |
| r5932 | r5933 | |
|---|---|---|
| 49 | 49 | fc818 |
| 50 | 50 | fc87d display amstrad .. |
| 51 | 51 | fca17 keyboard check |
| 52 | fca69 | |
| 53 | fd680 | |
| 52 | fca69 | |
| 53 | fd680 | |
| 54 | 54 | fd7f9 |
| 55 | ||
| 55 | fca7b !keyboard interrupt routine for this check | |
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | 58 | |
| r5932 | r5933 | |
| 84 | 84 | fc5fa |
| 85 | 85 | the following when language selection not 0 (test for presence of 0x80000..0x9ffff ram) |
| 86 | 86 | fc60e |
| 87 | ||
| 87 | fc667 | |
| 88 | 88 | fc678 |
| 89 | 89 | fc6e5 |
| 90 | 90 | fc72e |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | ||
| 14 | - strobed mode | |
| 15 | 15 | |
| 16 | 16 | */ |
| 17 | 17 | |
| r5932 | r5933 | |
| 330 | 330 | WRITE8_DEVICE_HANDLER( i8155_w ) |
| 331 | 331 | { |
| 332 | 332 | i8155_t *i8155 = get_safe_token(device); |
| 333 | ||
| 333 | ||
| 334 | 334 | switch (offset & 0x07) |
| 335 | 335 | { |
| 336 | 336 | case I8155_REGISTER_COMMAND: |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | PC3 1 |* \_/ | 40 Vcc | |
| 11 | PC4 2 | | 39 PC2 | |
| 12 | TIMER IN 3 | | 38 PC1 | |
| 13 | RESET 4 | | 37 PC0 | |
| 14 | PC5 5 | | 36 PB7 | |
| 15 | _TIMER OUT 6 | | 35 PB6 | |
| 16 | IO/_M 7 | | 34 PB5 | |
| 17 | CE or _CE 8 | | 33 PB4 | |
| 18 | _RD 9 | | 32 PB3 | |
| 19 | _WR 10 | 8155 | 31 PB2 | |
| 20 | ALE 11 | 8156 | 30 PB1 | |
| 21 | AD0 12 | | 29 PB0 | |
| 22 | AD1 13 | | 28 PA7 | |
| 23 | AD2 14 | | 27 PA6 | |
| 24 | AD3 15 | | 26 PA5 | |
| 25 | AD4 16 | | 25 PA4 | |
| 26 | AD5 17 | | 24 PA3 | |
| 27 | AD6 18 | | 23 PA2 | |
| 28 | AD7 19 | | 22 PA1 | |
| 29 | Vss 20 |_____________| 21 PA0 | |
| 9 | _____ _____ | |
| 10 | PC3 1 |* \_/ | 40 Vcc | |
| 11 | PC4 2 | | 39 PC2 | |
| 12 | TIMER IN 3 | | 38 PC1 | |
| 13 | RESET 4 | | 37 PC0 | |
| 14 | PC5 5 | | 36 PB7 | |
| 15 | _TIMER OUT 6 | | 35 PB6 | |
| 16 | IO/_M 7 | | 34 PB5 | |
| 17 | CE or _CE 8 | | 33 PB4 | |
| 18 | _RD 9 | | 32 PB3 | |
| 19 | _WR 10 | 8155 | 31 PB2 | |
| 20 | ALE 11 | 8156 | 30 PB1 | |
| 21 | AD0 12 | | 29 PB0 | |
| 22 | AD1 13 | | 28 PA7 | |
| 23 | AD2 14 | | 27 PA6 | |
| 24 | AD3 15 | | 26 PA5 | |
| 25 | AD4 16 | | 25 PA4 | |
| 26 | AD5 17 | | 24 PA3 | |
| 27 | AD6 18 | | 23 PA2 | |
| 28 | AD7 19 | | 22 PA1 | |
| 29 | Vss 20 |_____________| 21 PA0 | |
| 30 | 30 | |
| 31 | 31 | **********************************************************************/ |
| 32 | 32 |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | TODO: | |
| 13 | ||
| 14 | - update frequency from interface capacitor value | |
| 15 | - debounce from interface capacitor value | |
| 12 | TODO: | |
| 16 | 13 | |
| 14 | - update frequency from interface capacitor value | |
| 15 | - debounce from interface capacitor value | |
| 16 | ||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| r5932 | r5933 | |
| 73 | 73 | |
| 74 | 74 | /*------------------------------------------------- |
| 75 | 75 | change_output_lines - change output line |
| 76 | ||
| 76 | state | |
| 77 | 77 | -------------------------------------------------*/ |
| 78 | 78 | |
| 79 | 79 | static void change_output_lines(const device_config *device) |
| r5932 | r5933 | |
| 92 | 92 | |
| 93 | 93 | /*------------------------------------------------- |
| 94 | 94 | clock_scan_counters - clock the keyboard |
| 95 | ||
| 95 | scan counters | |
| 96 | 96 | -------------------------------------------------*/ |
| 97 | 97 | |
| 98 | 98 | static void clock_scan_counters(const device_config *device) |
| r5932 | r5933 | |
|---|---|---|
| 20 | 20 | { |
| 21 | 21 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; |
| 22 | 22 | |
| 23 | if (offset == 0) | |
| 23 | if (offset == 0) | |
| 24 | 24 | { |
| 25 | 25 | double level = cassette_input(devtag_get_device(space->machine, "cassette")); |
| 26 | 26 | return (level > 0) ? 0xfe : 0xff; |
| 27 | } | |
| 28 | else | |
| 27 | } | |
| 28 | else | |
| 29 | 29 | { |
| 30 | 30 | return input_port_read(space->machine, keynames[(offset>>3) & 0x07]) & (0x01<<(offset & 0x07)) ? 0xfe : 0xff; |
| 31 | 31 | } |
| r5932 | r5933 | |
| 34 | 34 | UINT8 gal_latch_value = 0; |
| 35 | 35 | |
| 36 | 36 | WRITE8_HANDLER( galaxy_latch_w ) |
| 37 | { | |
| 38 | double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000; | |
| 37 | { | |
| 38 | double val = (((data >>6) & 1 ) + ((data >> 2) & 1) - 1) * 32000; | |
| 39 | 39 | gal_latch_value = data; |
| 40 | 40 | cassette_output(devtag_get_device(space->machine, "cassette"), val); |
| 41 | 41 | } |
| r5932 | r5933 | |
| 176 | 176 | MACHINE_RESET( galaxy ) |
| 177 | 177 | { |
| 178 | 178 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 179 | ||
| 179 | ||
| 180 | 180 | /* ROM 2 enable/disable */ |
| 181 | 181 | memory_install_read8_handler(space, 0x1000, 0x1fff, 0, 0, input_port_read(machine, "ROM2") ? SMH_BANK(10) : SMH_NOP); |
| 182 | 182 | memory_install_write8_handler(space, 0x1000, 0x1fff, 0, 0, SMH_NOP); |
| r5932 | r5933 | |
| 198 | 198 | { |
| 199 | 199 | UINT8 *ROM = memory_region(machine, "maincpu"); |
| 200 | 200 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 201 | ||
| 201 | ||
| 202 | 202 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), galaxy_irq_callback); |
| 203 | 203 | |
| 204 | 204 | ROM[0x0037] = 0x29; |
| r5932 | r5933 | |
|---|---|---|
| 15 | 15 | static UINT8 gamepock_port_b; |
| 16 | 16 | static HD44102CH hd44102ch[3]; |
| 17 | 17 | |
| 18 | static void hd44102ch_w( int which, int c_d, UINT8 data ) | |
| 18 | static void hd44102ch_w( int which, int c_d, UINT8 data ) | |
| 19 | 19 | { |
| 20 | if ( c_d ) | |
| 20 | if ( c_d ) | |
| 21 | 21 | { |
| 22 | 22 | UINT8 y; |
| 23 | 23 | /* Data */ |
| r5932 | r5933 | |
| 25 | 25 | |
| 26 | 26 | /* Increment/decrement Y counter */ |
| 27 | 27 | y = ( hd44102ch[which].address & 0x3F ) + hd44102ch[which].y_inc; |
| 28 | if ( y == 0xFF ) | |
| 28 | if ( y == 0xFF ) | |
| 29 | 29 | { |
| 30 | 30 | y = 49; |
| 31 | 31 | } |
| 32 | if ( y == 50 ) | |
| 32 | if ( y == 50 ) | |
| 33 | 33 | { |
| 34 | 34 | y = 0; |
| 35 | 35 | } |
| 36 | 36 | hd44102ch[which].address = ( hd44102ch[which].address & 0xC0 ) | y; |
| 37 | } | |
| 38 | else | |
| 37 | } | |
| 38 | else | |
| 39 | 39 | { |
| 40 | 40 | /* Command */ |
| 41 | switch ( data ) | |
| 41 | switch ( data ) | |
| 42 | 42 | { |
| 43 | 43 | case 0x38: /* Display off */ |
| 44 | 44 | hd44102ch[which].enabled = 0; |
| r5932 | r5933 | |
| 59 | 59 | hd44102ch[which].start_page = data & 0xC0; |
| 60 | 60 | break; |
| 61 | 61 | default: |
| 62 | if ( ( data & 0x3F ) < 50 ) | |
| 62 | if ( ( data & 0x3F ) < 50 ) | |
| 63 | 63 | { |
| 64 | 64 | hd44102ch[which].address = data; |
| 65 | 65 | } |
| r5932 | r5933 | |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | static void hd44102ch_init( int which ) | |
| 71 | static void hd44102ch_init( int which ) | |
| 72 | 72 | { |
| 73 | 73 | memset( &hd44102ch[which], 0, sizeof( HD44102CH ) ); |
| 74 | 74 | hd44102ch[which].y_inc = 0x01; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | static void gamepock_lcd_update(void) | |
| 77 | static void gamepock_lcd_update(void) | |
| 78 | 78 | { |
| 79 | 79 | /* Check whether HD44102CH #1 is enabled */ |
| 80 | if ( gamepock_port_a & 0x08 ) | |
| 80 | if ( gamepock_port_a & 0x08 ) | |
| 81 | 81 | { |
| 82 | 82 | hd44102ch_w( 0, gamepock_port_a & 0x04, gamepock_port_b ); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /* Check whether HD44102CH #2 is enabled */ |
| 86 | if ( gamepock_port_a & 0x10 ) | |
| 86 | if ( gamepock_port_a & 0x10 ) | |
| 87 | 87 | { |
| 88 | 88 | hd44102ch_w( 1, gamepock_port_a & 0x04, gamepock_port_b ); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /* Check whether HD44102CH #3 is enabled */ |
| 92 | if ( gamepock_port_a & 0x20 ) | |
| 92 | if ( gamepock_port_a & 0x20 ) | |
| 93 | 93 | { |
| 94 | 94 | hd44102ch_w( 2, gamepock_port_a & 0x04, gamepock_port_b ); |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | WRITE8_HANDLER( gamepock_port_a_w ) | |
| 98 | WRITE8_HANDLER( gamepock_port_a_w ) | |
| 99 | 99 | { |
| 100 | 100 | UINT8 old_port_a = gamepock_port_a; |
| 101 | 101 | |
| 102 | 102 | gamepock_port_a = data; |
| 103 | 103 | |
| 104 | if ( ! ( old_port_a & 0x02 ) && ( gamepock_port_a & 0x02 ) ) | |
| 104 | if ( ! ( old_port_a & 0x02 ) && ( gamepock_port_a & 0x02 ) ) | |
| 105 | 105 | { |
| 106 | 106 | gamepock_lcd_update(); |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | WRITE8_HANDLER( gamepock_port_b_w ) | |
| 110 | WRITE8_HANDLER( gamepock_port_b_w ) | |
| 111 | 111 | { |
| 112 | 112 | gamepock_port_b = data; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | READ8_HANDLER( gamepock_port_b_r ) | |
| 115 | READ8_HANDLER( gamepock_port_b_r ) | |
| 116 | 116 | { |
| 117 | 117 | logerror("gamepock_port_b_r: not implemented\n"); |
| 118 | 118 | return 0xFF; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | READ8_HANDLER( gamepock_port_c_r ) | |
| 121 | READ8_HANDLER( gamepock_port_c_r ) | |
| 122 | 122 | { |
| 123 | 123 | UINT8 data = 0xFF; |
| 124 | 124 | |
| 125 | if ( gamepock_port_a & 0x80 ) | |
| 125 | if ( gamepock_port_a & 0x80 ) | |
| 126 | 126 | { |
| 127 | 127 | data &= input_port_read(space->machine, "IN0"); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | if ( gamepock_port_a & 0x40 ) | |
| 130 | if ( gamepock_port_a & 0x40 ) | |
| 131 | 131 | { |
| 132 | 132 | data &= input_port_read(space->machine, "IN1"); |
| 133 | 133 | } |
| r5932 | r5933 | |
| 135 | 135 | return data; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | MACHINE_RESET( gamepock ) | |
| 138 | MACHINE_RESET( gamepock ) | |
| 139 | 139 | { |
| 140 | 140 | hd44102ch_init( 0 ); |
| 141 | 141 | hd44102ch_init( 1 ); |
| 142 | 142 | hd44102ch_init( 2 ); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | VIDEO_UPDATE( gamepock ) | |
| 145 | VIDEO_UPDATE( gamepock ) | |
| 146 | 146 | { |
| 147 | 147 | UINT8 ad; |
| 148 | 148 | int i,j; |
| 149 | 149 | |
| 150 | 150 | /* Handle HD44102CH #0 */ |
| 151 | 151 | ad = hd44102ch[0].start_page; |
| 152 | for ( i = 0; i < 4; i++ ) | |
| 152 | for ( i = 0; i < 4; i++ ) | |
| 153 | 153 | { |
| 154 | for ( j = 0; j < 50; j++ ) | |
| 154 | for ( j = 0; j < 50; j++ ) | |
| 155 | 155 | { |
| 156 | 156 | *BITMAP_ADDR16(bitmap, i * 8 + 0, 49 - j ) = ( hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; |
| 157 | 157 | *BITMAP_ADDR16(bitmap, i * 8 + 1, 49 - j ) = ( hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; |
| r5932 | r5933 | |
| 167 | 167 | |
| 168 | 168 | /* Handle HD44102CH #1 */ |
| 169 | 169 | ad = hd44102ch[1].start_page; |
| 170 | for ( i = 4; i < 8; i++ ) | |
| 170 | for ( i = 4; i < 8; i++ ) | |
| 171 | 171 | { |
| 172 | for ( j = 0; j < 50; j++ ) | |
| 172 | for ( j = 0; j < 50; j++ ) | |
| 173 | 173 | { |
| 174 | 174 | *BITMAP_ADDR16(bitmap, i * 8 + 0, j ) = ( hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; |
| 175 | 175 | *BITMAP_ADDR16(bitmap, i * 8 + 1, j ) = ( hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; |
| r5932 | r5933 | |
| 185 | 185 | |
| 186 | 186 | /* Handle HD44102CH #2 */ |
| 187 | 187 | ad = hd44102ch[2].start_page; |
| 188 | for ( i = 0; i < 4; i++ ) | |
| 188 | for ( i = 0; i < 4; i++ ) | |
| 189 | 189 | { |
| 190 | for ( j = 0; j < 25; j++ ) | |
| 190 | for ( j = 0; j < 25; j++ ) | |
| 191 | 191 | { |
| 192 | 192 | *BITMAP_ADDR16(bitmap, i * 8 + 0, 50 + j ) = ( hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; |
| 193 | 193 | *BITMAP_ADDR16(bitmap, i * 8 + 1, 50 + j ) = ( hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; |
| r5932 | r5933 | |
| 198 | 198 | *BITMAP_ADDR16(bitmap, i * 8 + 6, 50 + j ) = ( hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; |
| 199 | 199 | *BITMAP_ADDR16(bitmap, i * 8 + 7, 50 + j ) = ( hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; |
| 200 | 200 | } |
| 201 | for ( j = 25; j < 50; j++ ) | |
| 201 | for ( j = 25; j < 50; j++ ) | |
| 202 | 202 | { |
| 203 | 203 | *BITMAP_ADDR16(bitmap, 32 + i * 8 + 0, 25 + j ) = ( hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; |
| 204 | 204 | *BITMAP_ADDR16(bitmap, 32 + i * 8 + 1, 25 + j ) = ( hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; |
| r5932 | r5933 | |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /* This is called whenever the T0 pin switches state */ |
| 219 | int gamepock_io_callback( const device_config *device, int ioline, int state ) | |
| 219 | int gamepock_io_callback( const device_config *device, int ioline, int state ) | |
| 220 | 220 | { |
| 221 | 221 | const device_config *speaker = devtag_get_device(device->machine, "speaker"); |
| 222 | if ( ioline == UPD7810_TO ) | |
| 222 | if ( ioline == UPD7810_TO ) | |
| 223 | 223 | { |
| 224 | 224 | speaker_level_w(speaker, state & 1 ); |
| 225 | 225 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | TI99/4(a) RS232 card emulation | |
| 3 | 3 | |
| 4 | This card features two RS232C ports (which share one single connector) and | |
| 5 | one centronics-like fully bi-directional parallel port. Each TI99 system | |
| 6 | can accomodate two such RS232 cards (provided a resistor is moved in one of | |
| 7 | the cards to change its CRU base address from >1300 to >1500), for a total | |
| 8 | of four RS232 ports and two parallel ports. | |
| 4 | This card features two RS232C ports (which share one single connector) and | |
| 5 | one centronics-like fully bi-directional parallel port. Each TI99 system | |
| 6 | can accomodate two such RS232 cards (provided a resistor is moved in one of | |
| 7 | the cards to change its CRU base address from >1300 to >1500), for a total | |
| 8 | of four RS232 ports and two parallel ports. | |
| 9 | 9 | |
| 10 | The card is fairly simple: two 9902 chips handle one serial port each, two | |
| 11 | unidirectional TTL buffers handle the PIO data bus, there is extra TTL for | |
| 12 | address decoding and CRU interface, and a DSR ROM. | |
| 10 | The card is fairly simple: two 9902 chips handle one serial port each, two | |
| 11 | unidirectional TTL buffers handle the PIO data bus, there is extra TTL for | |
| 12 | address decoding and CRU interface, and a DSR ROM. | |
| 13 | 13 | |
| 14 | References: | |
| 15 | <http://www.nouspikel.com/ti99/rs232c.htm>: great description of the | |
| 16 | hardware and software aspects. | |
| 17 | <ftp://ftp.whtech.com//datasheets/TMS9902A.max>: tms9902a datasheet | |
| 18 | <ftp://ftp.whtech.com//datasheets/Hardware manuals/ti rs232 card schematic.max> | |
| 14 | References: | |
| 15 | <http://www.nouspikel.com/ti99/rs232c.htm>: great description of the | |
| 16 | hardware and software aspects. | |
| 17 | <ftp://ftp.whtech.com//datasheets/TMS9902A.max>: tms9902a datasheet | |
| 18 | <ftp://ftp.whtech.com//datasheets/Hardware manuals/ti rs232 card schematic.max> | |
| 19 | 19 | |
| 20 | ||
| 20 | Raphael Nabet, 2003. | |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | #include "driver.h" |
| r5932 | r5933 | |
| 53 | 53 | int pio_in_buffer; |
| 54 | 54 | int pio_readable; |
| 55 | 55 | int pio_writable; |
| 56 | int pio_write; // 1 if image is to be written to | |
| 56 | int pio_write; // 1 if image is to be written to | |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | typedef struct _card_t card_t; |
| r5932 | r5933 | |
| 70 | 70 | |
| 71 | 71 | return (pio_t *)device->token; |
| 72 | 72 | } |
| 73 | ||
| 73 | ||
| 74 | 74 | static const ti99_peb_card_handlers_t rs232_handlers = |
| 75 | 75 | { |
| 76 | 76 | rs232_cru_r, |
| r5932 | r5933 | |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | 82 | /* |
| 83 | ||
| 83 | Initialize pio unit and open image | |
| 84 | 84 | */ |
| 85 | 85 | static DEVICE_IMAGE_LOAD( ti99_4_pio ) |
| 86 | 86 | { |
| r5932 | r5933 | |
| 89 | 89 | pio->pio_readable = ! image_has_been_created(image); |
| 90 | 90 | /* tell whether the image is writable */ |
| 91 | 91 | pio->pio_writable = image_is_writable(image); |
| 92 | ||
| 92 | ||
| 93 | 93 | if (pio->pio_write && pio->pio_writable) |
| 94 | 94 | pio->pio_handshakein = 0; /* receiver ready */ |
| 95 | 95 | else |
| r5932 | r5933 | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /* |
| 102 | ||
| 102 | close a pio image | |
| 103 | 103 | */ |
| 104 | 104 | static DEVICE_IMAGE_UNLOAD( ti99_4_pio ) |
| 105 | 105 | { |
| r5932 | r5933 | |
| 126 | 126 | pio->pio_write = 1; |
| 127 | 127 | } |
| 128 | 128 | /* |
| 129 | ||
| 129 | Initialize rs232 unit and open image | |
| 130 | 130 | */ |
| 131 | 131 | static DEVICE_IMAGE_LOAD( ti99_4_rs232 ) |
| 132 | 132 | { |
| 133 | 133 | const device_config *tms9902 = NULL; |
| 134 | ||
| 134 | ||
| 135 | 135 | if (strcmp(image->tag, "rs232:port0")) { |
| 136 | 136 | tms9902 = devtag_get_device(image->machine, "rs232:tms9902_0"); |
| 137 | 137 | } |
| 138 | 138 | if (strcmp(image->tag, "rs232:port1")) { |
| 139 | 139 | tms9902 = devtag_get_device(image->machine, "rs232:tms9902_1"); |
| 140 | 140 | } |
| 141 | ||
| 141 | ||
| 142 | 142 | if (image) |
| 143 | 143 | { |
| 144 | 144 | tms9902_set_cts(tms9902, 1); |
| r5932 | r5933 | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /* |
| 157 | ||
| 157 | close a rs232 image | |
| 158 | 158 | */ |
| 159 | 159 | static DEVICE_IMAGE_UNLOAD( ti99_4_rs232 ) |
| 160 | { | |
| 160 | { | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /* |
| 164 | ||
| 164 | Initializes rs232 card, set up handlers | |
| 165 | 165 | */ |
| 166 | 166 | static DEVICE_START( ti99_4_rs232 ) |
| 167 | 167 | { |
| r5932 | r5933 | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /* |
| 172 | ||
| 172 | Reset rs232 card, set up handlers | |
| 173 | 173 | */ |
| 174 | 174 | static DEVICE_RESET( ti99_4_rs232 ) |
| 175 | 175 | { |
| r5932 | r5933 | |
| 178 | 178 | ti99_peb_set_card_handlers(0x1300, & rs232_handlers); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | static READ8_DEVICE_HANDLER(ti99_4_pio_r) | |
| 181 | static READ8_DEVICE_HANDLER(ti99_4_pio_r) | |
| 182 | 182 | { |
| 183 | 183 | pio_t *pio = get_safe_token_pio(device); |
| 184 | 184 | UINT8 reply = 0x00; |
| r5932 | r5933 | |
| 199 | 199 | return reply; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | static READ8_DEVICE_HANDLER(ti99_4_pio_buf_r) | |
| 202 | static READ8_DEVICE_HANDLER(ti99_4_pio_buf_r) | |
| 203 | 203 | { |
| 204 | 204 | pio_t *pio = get_safe_token_pio(device); |
| 205 | 205 | return pio->pio_direction ? pio->pio_in_buffer : pio->pio_out_buffer; |
| r5932 | r5933 | |
| 285 | 285 | pio->led = data; |
| 286 | 286 | break; |
| 287 | 287 | } |
| 288 | } | |
| 288 | } | |
| 289 | 289 | /* |
| 290 | ||
| 290 | Read rs232 card CRU interface | |
| 291 | 291 | |
| 292 | bit 0: always 0 | |
| 293 | ... | |
| 292 | bit 0: always 0 | |
| 293 | ... | |
| 294 | 294 | */ |
| 295 | 295 | static int rs232_cru_r(running_machine *machine, int offset) |
| 296 | 296 | { |
| r5932 | r5933 | |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /* |
| 335 | ||
| 335 | Write rs232 card CRU interface | |
| 336 | 336 | */ |
| 337 | 337 | static void rs232_cru_w(running_machine *machine, int offset, int data) |
| 338 | 338 | { |
| r5932 | r5933 | |
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | /* |
| 364 | ||
| 364 | read a byte in rs232 DSR space | |
| 365 | 365 | */ |
| 366 | 366 | static READ8_HANDLER(rs232_mem_r) |
| 367 | 367 | { |
| r5932 | r5933 | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /* |
| 385 | ||
| 385 | write a byte in rs232 DSR space | |
| 386 | 386 | */ |
| 387 | 387 | static WRITE8_HANDLER(rs232_mem_w) |
| 388 | 388 | { |
| 389 | 389 | if (offset >= 0x1000) |
| 390 | 390 | { |
| 391 | /* PIO */ | |
| 391 | /* PIO */ | |
| 392 | 392 | ti99_4_pio_buf_w(devtag_get_device(space->machine, "rs232:pio"), offset, data); |
| 393 | 393 | } |
| 394 | 394 | else |
| r5932 | r5933 | |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /* |
| 401 | ||
| 401 | rs232 interrupt handler | |
| 402 | 402 | */ |
| 403 | 403 | static TMS9902_INT_CALLBACK( int_callback_0 ) |
| 404 | 404 | { |
| r5932 | r5933 | |
| 430 | 430 | { |
| 431 | 431 | 3000000., /* clock rate (3MHz) */ |
| 432 | 432 | int_callback_0, /* called when interrupt pin state changes */ |
| 433 | NULL,//rts_callback, /* called when Request To Send pin state changes */ | |
| 434 | NULL,//brk_callback, /* called when BReaK state changes */ | |
| 433 | NULL,//rts_callback, /* called when Request To Send pin state changes */ | |
| 434 | NULL,//brk_callback, /* called when BReaK state changes */ | |
| 435 | 435 | xmit_callback_0 /* called when a character is transmitted */ |
| 436 | 436 | }; |
| 437 | 437 | |
| r5932 | r5933 | |
| 439 | 439 | { |
| 440 | 440 | 3000000., /* clock rate (3MHz) */ |
| 441 | 441 | int_callback_1, /* called when interrupt pin state changes */ |
| 442 | NULL,//rts_callback, /* called when Request To Send pin state changes */ | |
| 443 | NULL,//brk_callback, /* called when BReaK state changes */ | |
| 442 | NULL,//rts_callback, /* called when Request To Send pin state changes */ | |
| 443 | NULL,//brk_callback, /* called when BReaK state changes */ | |
| 444 | 444 | xmit_callback_1 /* called when a character is transmitted */ |
| 445 | 445 | }; |
| 446 | 446 | |
| 447 | 447 | DEVICE_GET_INFO( ti99_4_rs232 ) |
| 448 | 448 | { |
| 449 | switch ( state ) | |
| 449 | switch ( state ) | |
| 450 | 450 | { |
| 451 | 451 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 452 | 452 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(card_t); break; |
| r5932 | r5933 | |
| 455 | 455 | case DEVINFO_INT_IMAGE_READABLE: info->i = 1; break; |
| 456 | 456 | case DEVINFO_INT_IMAGE_WRITEABLE: info->i = 1; break; |
| 457 | 457 | case DEVINFO_INT_IMAGE_CREATABLE: info->i = 1; break; |
| 458 | ||
| 458 | ||
| 459 | 459 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ti99_4_rs232 ); break; |
| 460 | 460 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ti99_4_rs232 ); break; |
| 461 | 461 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME( ti99_4_rs232 ); break; |
| r5932 | r5933 | |
| 476 | 476 | #define MDRV_TI99_4_RS232_ADD(_tag) \ |
| 477 | 477 | MDRV_DEVICE_ADD(_tag, TI99_4_RS232, 0) |
| 478 | 478 | |
| 479 | ||
| 479 | ||
| 480 | 480 | DEVICE_GET_INFO( ti99_4_pio ) |
| 481 | 481 | { |
| 482 | switch ( state ) | |
| 482 | switch ( state ) | |
| 483 | 483 | { |
| 484 | 484 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 485 | 485 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(pio_t); break; |
| r5932 | r5933 | |
| 488 | 488 | case DEVINFO_INT_IMAGE_READABLE: info->i = 1; break; |
| 489 | 489 | case DEVINFO_INT_IMAGE_WRITEABLE: info->i = 1; break; |
| 490 | 490 | case DEVINFO_INT_IMAGE_CREATABLE: info->i = 1; break; |
| 491 | ||
| 491 | ||
| 492 | 492 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ti99_4_pio ); break; |
| 493 | 493 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ti99_4_pio ); break; |
| 494 | 494 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME( ti99_4_pio ); break; |
| r5932 | r5933 | |
| 520 | 520 | |
| 521 | 521 | DEVICE_GET_INFO( ti99_4_rs232_card ) |
| 522 | 522 | { |
| 523 | switch ( state ) | |
| 523 | switch ( state ) | |
| 524 | 524 | { |
| 525 | 525 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 526 | 526 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(card_t); break; |
| 527 | 527 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 528 | 528 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( ti99_4_rs232_card ); break; |
| 529 | 529 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME( ti99_4_rs232_card ); break; |
| 530 | ||
| 531 | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_DRIVER_NAME(ti99_4_rs232); break; | |
| 530 | ||
| 531 | case DEVINFO_PTR_MACHINE_CONFIG: info->machine_config = MACHINE_DRIVER_NAME(ti99_4_rs232); break; | |
| 532 | 532 | case DEVINFO_STR_NAME: strcpy( info->s, "TI99 RS232 card"); break; |
| 533 | 533 | case DEVINFO_STR_FAMILY: strcpy(info->s, "TI99 RS232 card"); break; |
| 534 | 534 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | ROW Y1 1 |* \_/ | 18 Vcc | |
| 11 | ROW Y2 2 | | 17 DATA OUT A | |
| 12 | ROW Y3 3 | | 16 DATA OUT B | |
| 13 | ROW Y4 4 | | 15 DATA OUT C | |
| 14 | OSCILLATOR 5 | MM74C922 | 14 DATA OUT D | |
| 15 | KEYBOUNCE MASK 6 | | 13 _OUTPUT ENABLE | |
| 16 | COLUMN X4 7 | | 12 DATA AVAILABLE | |
| 17 | COLUMN X3 8 | | 11 COLUMN X1 | |
| 18 | GND 9 |_____________| 10 COLUMN X2 | |
| 9 | _____ _____ | |
| 10 | ROW Y1 1 |* \_/ | 18 Vcc | |
| 11 | ROW Y2 2 | | 17 DATA OUT A | |
| 12 | ROW Y3 3 | | 16 DATA OUT B | |
| 13 | ROW Y4 4 | | 15 DATA OUT C | |
| 14 | OSCILLATOR 5 | MM74C922 | 14 DATA OUT D | |
| 15 | KEYBOUNCE MASK 6 | | 13 _OUTPUT ENABLE | |
| 16 | COLUMN X4 7 | | 12 DATA AVAILABLE | |
| 17 | COLUMN X3 8 | | 11 COLUMN X1 | |
| 18 | GND 9 |_____________| 10 COLUMN X2 | |
| 19 | 19 | |
| 20 | _____ _____ | |
| 21 | ROW Y1 1 |* \_/ | 20 Vcc | |
| 22 | ROW Y2 2 | | 19 DATA OUT A | |
| 23 | ROW Y3 3 | | 18 DATA OUT B | |
| 24 | ROW Y4 4 | | 17 DATA OUT C | |
| 25 | ROW Y5 5 | MM74C923 | 16 DATA OUT D | |
| 26 | OSCILLATOR 6 | | 15 DATA OUT E | |
| 27 | KEYBOUNCE MASK 7 | | 14 _OUTPUT ENABLE | |
| 28 | COLUMN X4 8 | | 13 DATA AVAILABLE | |
| 29 | COLUMN X3 9 | | 12 COLUMN X1 | |
| 30 | GND 10 |_____________| 11 COLUMN X2 | |
| 20 | _____ _____ | |
| 21 | ROW Y1 1 |* \_/ | 20 Vcc | |
| 22 | ROW Y2 2 | | 19 DATA OUT A | |
| 23 | ROW Y3 3 | | 18 DATA OUT B | |
| 24 | ROW Y4 4 | | 17 DATA OUT C | |
| 25 | ROW Y5 5 | MM74C923 | 16 DATA OUT D | |
| 26 | OSCILLATOR 6 | | 15 DATA OUT E | |
| 27 | KEYBOUNCE MASK 7 | | 14 _OUTPUT ENABLE | |
| 28 | COLUMN X4 8 | | 13 DATA AVAILABLE | |
| 29 | COLUMN X3 9 | | 12 COLUMN X1 | |
| 30 | GND 10 |_____________| 11 COLUMN X2 | |
| 31 | 31 | |
| 32 | 32 | **********************************************************************/ |
| 33 | 33 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | |
| 3 | compis.c | |
| 4 | machine driver | |
| 3 | compis.c | |
| 4 | machine driver | |
| 5 | 5 | |
| 6 | Per Ola Ingvarsson | |
| 7 | Tomas Karlsson | |
| 6 | Per Ola Ingvarsson | |
| 7 | Tomas Karlsson | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 113 | 113 | typedef struct |
| 114 | 114 | { |
| 115 | 115 | UINT8 nationality; /* Character set, keyboard layout (Swedish) */ |
| 116 | UINT8 release_time; /* Autorepeat release time (0.8) */ | |
| 117 | UINT8 speed; /* Transmission speed (14) */ | |
| 118 | UINT8 roll_over; /* Key roll-over (MKEY) */ | |
| 119 | UINT8 click; /* Key click (NO) */ | |
| 120 | UINT8 break_nmi; /* Keyboard break (NMI) */ | |
| 121 | UINT8 beep_freq; /* Beep frequency (low) */ | |
| 122 | UINT8 beep_dura; /* Beep duration (short) */ | |
| 123 | UINT8 password[8]; /* Password */ | |
| 124 | UINT8 owner[16]; /* Owner */ | |
| 125 | UINT8 network_id; /* Network workstation number (1) */ | |
| 126 | UINT8 boot_order[4]; /* Boot device order (FD HD NW PD) */ | |
| 116 | UINT8 release_time; /* Autorepeat release time (0.8) */ | |
| 117 | UINT8 speed; /* Transmission speed (14) */ | |
| 118 | UINT8 roll_over; /* Key roll-over (MKEY) */ | |
| 119 | UINT8 click; /* Key click (NO) */ | |
| 120 | UINT8 break_nmi; /* Keyboard break (NMI) */ | |
| 121 | UINT8 beep_freq; /* Beep frequency (low) */ | |
| 122 | UINT8 beep_dura; /* Beep duration (short) */ | |
| 123 | UINT8 password[8]; /* Password */ | |
| 124 | UINT8 owner[16]; /* Owner */ | |
| 125 | UINT8 network_id; /* Network workstation number (1) */ | |
| 126 | UINT8 boot_order[4]; /* Boot device order (FD HD NW PD) */ | |
| 127 | 127 | UINT8 key_code; |
| 128 | 128 | UINT8 key_status; |
| 129 | 129 | } TYP_COMPIS_KEYBOARD; |
| r5932 | r5933 | |
| 259 | 259 | compis.keyboard.key_status = key_status; |
| 260 | 260 | compis.usart.status |= COMPIS_USART_STATUS_RX_READY; |
| 261 | 261 | compis.usart.bytes_sent = 0; |
| 262 | // | |
| 262 | // compis_osp_pic_irq(COMPIS_IRQ_8251_RXRDY); | |
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
| r5932 | r5933 | |
| 374 | 374 | |
| 375 | 375 | /*-------------------------------------------------------------------------*/ |
| 376 | 376 | /* Bit 0: J5-4 */ |
| 377 | /* Bit 1: J5-5 | |
| 377 | /* Bit 1: J5-5 */ | |
| 378 | 378 | /* Bit 2: J6-3 Cassette read */ |
| 379 | 379 | /* Bit 3: J2-6 DSR / S8-4 Test */ |
| 380 | 380 | /* Bit 4: J4-6 DSR / S8-3 Test */ |
| 381 | /* Bit 5: J7-11 Centronics BUSY */ | |
| 382 | /* Bit 6: J7-13 Centronics SELECT */ | |
| 383 | /* Bit 7: Tmr0 */ | |
| 381 | /* Bit 5: J7-11 Centronics BUSY */ | |
| 382 | /* Bit 6: J7-13 Centronics SELECT */ | |
| 383 | /* Bit 7: Tmr0 */ | |
| 384 | 384 | /*-------------------------------------------------------------------------*/ |
| 385 | 385 | static READ8_DEVICE_HANDLER( compis_ppi_port_b_r ) |
| 386 | 386 | { |
| r5932 | r5933 | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /*-------------------------------------------------------------------------*/ |
| 400 | /* Bit 0: J5-1 */ | |
| 401 | /* Bit 1: J5-2 */ | |
| 402 | /* Bit 2: Select: 1=time measure, DSR from J2/J4 pin 6. 0=read cassette */ | |
| 403 | /* Bit 3: Datex: Tristate datex output (low) */ | |
| 404 | /* Bit 4: V2-5 Floppy motor on/off */ | |
| 405 | /* Bit 5: J7-1 Centronics STROBE */ | |
| 406 | /* Bit 6: V2-4 Floppy Soft reset */ | |
| 407 | /* Bit 7: V2-3 Floppy Terminal count */ | |
| 400 | /* Bit 0: J5-1 */ | |
| 401 | /* Bit 1: J5-2 */ | |
| 402 | /* Bit 2: Select: 1=time measure, DSR from J2/J4 pin 6. 0=read cassette */ | |
| 403 | /* Bit 3: Datex: Tristate datex output (low) */ | |
| 404 | /* Bit 4: V2-5 Floppy motor on/off */ | |
| 405 | /* Bit 5: J7-1 Centronics STROBE */ | |
| 406 | /* Bit 6: V2-4 Floppy Soft reset */ | |
| 407 | /* Bit 7: V2-3 Floppy Terminal count */ | |
| 408 | 408 | /*-------------------------------------------------------------------------*/ |
| 409 | 409 | static WRITE8_DEVICE_HANDLER( compis_ppi_port_c_w ) |
| 410 | 410 | { |
| r5932 | r5933 | |
| 479 | 479 | static void compis_usart_rxready(const device_config *device, int state) |
| 480 | 480 | { |
| 481 | 481 | /* |
| 482 | if (state) | |
| 483 | compis_pic_irq(COMPIS_IRQ_8251_RXRDY); | |
| 482 | if (state) | |
| 483 | compis_pic_irq(COMPIS_IRQ_8251_RXRDY); | |
| 484 | 484 | */ |
| 485 | 485 | } |
| 486 | 486 | |
| r5932 | r5933 | |
| 516 | 516 | |
| 517 | 517 | /************************************* |
| 518 | 518 | * |
| 519 | * | |
| 519 | * 80186 interrupt controller | |
| 520 | 520 | * |
| 521 | 521 | *************************************/ |
| 522 | 522 | static IRQ_CALLBACK(int_callback) |
| r5932 | r5933 | |
| 703 | 703 | |
| 704 | 704 | /************************************* |
| 705 | 705 | * |
| 706 | * | |
| 706 | * 80186 internal timers | |
| 707 | 707 | * |
| 708 | 708 | *************************************/ |
| 709 | 709 | |
| r5932 | r5933 | |
| 892 | 892 | |
| 893 | 893 | /************************************* |
| 894 | 894 | * |
| 895 | * | |
| 895 | * 80186 internal DMA | |
| 896 | 896 | * |
| 897 | 897 | *************************************/ |
| 898 | 898 | |
| r5932 | r5933 | |
| 955 | 955 | /* otherwise, set a timer */ |
| 956 | 956 | else |
| 957 | 957 | { |
| 958 | // | |
| 958 | // int count = d->count; | |
| 959 | 959 | |
| 960 | 960 | /* adjust for redline racer */ |
| 961 | 961 | // int dacnum = (d->dest & 0x3f) / 2; |
| r5932 | r5933 | |
| 963 | 963 | if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest); |
| 964 | 964 | |
| 965 | 965 | d->finished = 0; |
| 966 | /* | |
| 966 | /* timer_adjust_oneshot(d->finish_timer, | |
| 967 | 967 | ATTOTIME_IN_HZ(dac[dacnum].frequency) * (double)count, which);*/ |
| 968 | 968 | } |
| 969 | 969 | } |
| r5932 | r5933 | |
| 976 | 976 | |
| 977 | 977 | /************************************* |
| 978 | 978 | * |
| 979 | * | |
| 979 | * 80186 internal I/O reads | |
| 980 | 980 | * |
| 981 | 981 | *************************************/ |
| 982 | 982 | |
| r5932 | r5933 | |
| 1112 | 1112 | case 0x68: |
| 1113 | 1113 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(space->cpu), (offset - 0x60) / 8); |
| 1114 | 1114 | which = (offset - 0x60) / 8; |
| 1115 | // | |
| 1115 | // stream_update(dma_stream, 0); | |
| 1116 | 1116 | return i186.dma[which].source; |
| 1117 | 1117 | |
| 1118 | 1118 | case 0x61: |
| 1119 | 1119 | case 0x69: |
| 1120 | 1120 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(space->cpu), (offset - 0x61) / 8); |
| 1121 | 1121 | which = (offset - 0x61) / 8; |
| 1122 | // | |
| 1122 | // stream_update(dma_stream, 0); | |
| 1123 | 1123 | return i186.dma[which].source >> 16; |
| 1124 | 1124 | |
| 1125 | 1125 | case 0x62: |
| 1126 | 1126 | case 0x6a: |
| 1127 | 1127 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(space->cpu), (offset - 0x62) / 8); |
| 1128 | 1128 | which = (offset - 0x62) / 8; |
| 1129 | // | |
| 1129 | // stream_update(dma_stream, 0); | |
| 1130 | 1130 | return i186.dma[which].dest; |
| 1131 | 1131 | |
| 1132 | 1132 | case 0x63: |
| 1133 | 1133 | case 0x6b: |
| 1134 | 1134 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(space->cpu), (offset - 0x63) / 8); |
| 1135 | 1135 | which = (offset - 0x63) / 8; |
| 1136 | // | |
| 1136 | // stream_update(dma_stream, 0); | |
| 1137 | 1137 | return i186.dma[which].dest >> 16; |
| 1138 | 1138 | |
| 1139 | 1139 | case 0x64: |
| 1140 | 1140 | case 0x6c: |
| 1141 | 1141 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(space->cpu), (offset - 0x64) / 8); |
| 1142 | 1142 | which = (offset - 0x64) / 8; |
| 1143 | // | |
| 1143 | // stream_update(dma_stream, 0); | |
| 1144 | 1144 | return i186.dma[which].count; |
| 1145 | 1145 | |
| 1146 | 1146 | case 0x65: |
| 1147 | 1147 | case 0x6d: |
| 1148 | 1148 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(space->cpu), (offset - 0x65) / 8); |
| 1149 | 1149 | which = (offset - 0x65) / 8; |
| 1150 | // | |
| 1150 | // stream_update(dma_stream, 0); | |
| 1151 | 1151 | return i186.dma[which].control; |
| 1152 | 1152 | |
| 1153 | 1153 | default: |
| r5932 | r5933 | |
| 1159 | 1159 | |
| 1160 | 1160 | /************************************* |
| 1161 | 1161 | * |
| 1162 | * | |
| 1162 | * 80186 internal I/O writes | |
| 1163 | 1163 | * |
| 1164 | 1164 | *************************************/ |
| 1165 | 1165 | |
| r5932 | r5933 | |
| 1312 | 1312 | temp = (i186.mem.peripheral & 0xffc0) << 4; |
| 1313 | 1313 | if (i186.mem.middle_size & 0x0040) |
| 1314 | 1314 | { |
| 1315 | // install_mem_read_handler(2, temp, temp + 0x2ff, peripheral_r); | |
| 1316 | // install_mem_write_handler(2, temp, temp + 0x2ff, peripheral_w); | |
| 1315 | // install_mem_read_handler(2, temp, temp + 0x2ff, peripheral_r); | |
| 1316 | // install_mem_write_handler(2, temp, temp + 0x2ff, peripheral_w); | |
| 1317 | 1317 | } |
| 1318 | 1318 | else |
| 1319 | 1319 | { |
| 1320 | 1320 | temp &= 0xffff; |
| 1321 | // install_port_read_handler(2, temp, temp + 0x2ff, peripheral_r); | |
| 1322 | // install_port_write_handler(2, temp, temp + 0x2ff, peripheral_w); | |
| 1321 | // install_port_read_handler(2, temp, temp + 0x2ff, peripheral_r); | |
| 1322 | // install_port_write_handler(2, temp, temp + 0x2ff, peripheral_w); | |
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | /* we need to do this at a time when the I86 context is swapped in */ |
| r5932 | r5933 | |
| 1332 | 1332 | case 0x68: |
| 1333 | 1333 | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x60) / 8, data16); |
| 1334 | 1334 | which = (offset - 0x60) / 8; |
| 1335 | // | |
| 1335 | // stream_update(dma_stream, 0); | |
| 1336 | 1336 | i186.dma[which].source = (i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff); |
| 1337 | 1337 | break; |
| 1338 | 1338 | |
| r5932 | r5933 | |
| 1340 | 1340 | case 0x69: |
| 1341 | 1341 | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x61) / 8, data16); |
| 1342 | 1342 | which = (offset - 0x61) / 8; |
| 1343 | // | |
| 1343 | // stream_update(dma_stream, 0); | |
| 1344 | 1344 | i186.dma[which].source = (i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000); |
| 1345 | 1345 | break; |
| 1346 | 1346 | |
| r5932 | r5933 | |
| 1348 | 1348 | case 0x6a: |
| 1349 | 1349 | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x62) / 8, data16); |
| 1350 | 1350 | which = (offset - 0x62) / 8; |
| 1351 | // | |
| 1351 | // stream_update(dma_stream, 0); | |
| 1352 | 1352 | i186.dma[which].dest = (i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff); |
| 1353 | 1353 | break; |
| 1354 | 1354 | |
| r5932 | r5933 | |
| 1356 | 1356 | case 0x6b: |
| 1357 | 1357 | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x63) / 8, data16); |
| 1358 | 1358 | which = (offset - 0x63) / 8; |
| 1359 | // | |
| 1359 | // stream_update(dma_stream, 0); | |
| 1360 | 1360 | i186.dma[which].dest = (i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000); |
| 1361 | 1361 | break; |
| 1362 | 1362 | |
| r5932 | r5933 | |
| 1364 | 1364 | case 0x6c: |
| 1365 | 1365 | if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", cpu_get_pc(space->cpu), (offset - 0x64) / 8, data16); |
| 1366 | 1366 | which = (offset - 0x64) / 8; |
| 1367 | // | |
| 1367 | // stream_update(dma_stream, 0); | |
| 1368 | 1368 | i186.dma[which].count = data16; |
| 1369 | 1369 | break; |
| 1370 | 1370 | |
| r5932 | r5933 | |
| 1372 | 1372 | case 0x6d: |
| 1373 | 1373 | if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", cpu_get_pc(space->cpu), (offset - 0x65) / 8, data16); |
| 1374 | 1374 | which = (offset - 0x65) / 8; |
| 1375 | // | |
| 1375 | // stream_update(dma_stream, 0); | |
| 1376 | 1376 | update_dma_control(space->machine, which, data16); |
| 1377 | 1377 | break; |
| 1378 | 1378 | |
| r5932 | r5933 | |
| 1394 | 1394 | memory_install_read16_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_IO), temp, temp + 0xff, 0, 0, i186_internal_port_r); |
| 1395 | 1395 | memory_install_write16_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_IO), temp, temp + 0xff, 0, 0, i186_internal_port_w); |
| 1396 | 1396 | } |
| 1397 | /* | |
| 1397 | /* popmessage("Sound CPU reset");*/ | |
| 1398 | 1398 | break; |
| 1399 | 1399 | |
| 1400 | 1400 | default: |
| r5932 | r5933 | |
| 1431 | 1431 | * |
| 1432 | 1432 | *************************************************************/ |
| 1433 | 1433 | |
| 1434 | static PIC8259_SET_INT_LINE( compis_pic8259_master_set_int_line ) | |
| 1434 | static PIC8259_SET_INT_LINE( compis_pic8259_master_set_int_line ) | |
| 1435 | 1435 | { |
| 1436 | 1436 | cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE); |
| 1437 | 1437 | } |
| 1438 | 1438 | |
| 1439 | 1439 | |
| 1440 | static PIC8259_SET_INT_LINE( compis_pic8259_slave_set_int_line ) | |
| 1440 | static PIC8259_SET_INT_LINE( compis_pic8259_slave_set_int_line ) | |
| 1441 | 1441 | { |
| 1442 | if ( compis_devices.pic8259_master ) | |
| 1442 | if ( compis_devices.pic8259_master ) | |
| 1443 | 1443 | { |
| 1444 | 1444 | pic8259_set_irq_line(compis_devices.pic8259_master, 2, interrupt); |
| 1445 | 1445 | } |
| r5932 | r5933 | |
| 1503 | 1503 | /*-------------------------------------------------------------------------*/ |
| 1504 | 1504 | INTERRUPT_GEN( compis_vblank_int ) |
| 1505 | 1505 | { |
| 1506 | // | |
| 1506 | // compis_gdc_vblank_int(); | |
| 1507 | 1507 | compis_keyb_update(device->machine); |
| 1508 | 1508 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | vtech2.c | |
| 3 | 3 | |
| 4 | 4 | machine driver |
| 5 | Juergen Buchmueller <pullmoll@t-online.de> MESS driver, Jan 2000 | |
| 6 | Davide Moretti <dave@rimini.com> ROM dump and hardware description | |
| 5 | Juergen Buchmueller <pullmoll@t-online.de> MESS driver, Jan 2000 | |
| 6 | Davide Moretti <dave@rimini.com> ROM dump and hardware description | |
| 7 | 7 | |
| 8 | 8 | TODO: |
| 9 | Add loading images from WAV files. | |
| 10 | Printer and RS232 support. | |
| 11 | Check if the FDC is really the same as in the | |
| 12 | Laser 210/310 (aka VZ200/300) series. | |
| 9 | Add loading images from WAV files. | |
| 10 | Printer and RS232 support. | |
| 11 | Check if the FDC is really the same as in the | |
| 12 | Laser 210/310 (aka VZ200/300) series. | |
| 13 | 13 | |
| 14 | 14 | ****************************************************************************/ |
| 15 | 15 | |
| r5932 | r5933 | |
| 204 | 204 | /************************************************* |
| 205 | 205 | * memory mapped I/O read |
| 206 | 206 | * bit function |
| 207 | * 7 not assigned | |
| 208 | * 6 column 6 | |
| 209 | * 5 column 5 | |
| 210 | * 4 column 4 | |
| 211 | * 3 column 3 | |
| 212 | * 2 column 2 | |
| 213 | * 1 column 1 | |
| 214 | * 0 column 0 | |
| 207 | * 7 not assigned | |
| 208 | * 6 column 6 | |
| 209 | * 5 column 5 | |
| 210 | * 4 column 4 | |
| 211 | * 3 column 3 | |
| 212 | * 2 column 2 | |
| 213 | * 1 column 1 | |
| 214 | * 0 column 0 | |
| 215 | 215 | ************************************************/ |
| 216 | 216 | static int mra_bank(running_machine *machine, int bank, int offs) |
| 217 | 217 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | // |
| 2 | // | |
| 2 | // corvus_hd | |
| 3 | 3 | // |
| 4 | // Implementation of a Corvus Hard Drive / Host Bus Adapter pair. The drive | |
| 5 | // being emulated is a Rev B drive, functionally speaking, rather than an Omnidrive. | |
| 4 | // Implementation of a Corvus Hard Drive / Host Bus Adapter pair. The drive | |
| 5 | // being emulated is a Rev B drive, functionally speaking, rather than an Omnidrive. | |
| 6 | 6 | // |
| 7 | // The Corvus Flat Cable HBA is a very simplistic device due to the fact that most | |
| 8 | // of the smarts are in the Hard Drive itself. What's in the hard drive includes a | |
| 7 | // The Corvus Flat Cable HBA is a very simplistic device due to the fact that most | |
| 8 | // of the smarts are in the Hard Drive itself. What's in the hard drive includes a | |
| 9 | 9 | // Z80 processor, 4K of EPROM and 5KB of RAM. Ultimately, a true emulation would include |
| 10 | 10 | // the on-boad controller; however, that is outside the current scope of this code. Maybe |
| 11 | 11 | // if I could get a Rev. B/H drive, it could be reverse-engineered to do this. |
| 12 | 12 | // |
| 13 | // | |
| 13 | // The Flat Cable controller has two registers: | |
| 14 | 14 | // |
| 15 | // Data - Single byte bidirectional data transfer | |
| 16 | // Status Register - Bit 7 - Controller Ready -- off = ready, on = not ready | |
| 17 | // Bit 6 - Bus Direction -- off = host-to-controller, on = controller-to-host | |
| 15 | // Data - Single byte bidirectional data transfer | |
| 16 | // Status Register - Bit 7 - Controller Ready -- off = ready, on = not ready | |
| 17 | // Bit 6 - Bus Direction -- off = host-to-controller, on = controller-to-host | |
| 18 | 18 | // |
| 19 | // | |
| 19 | // Layout of a Corvus Hard Disk is as follows: | |
| 20 | 20 | // |
| 21 | // Blk Len Description | |
| 22 | // --- --- ----------- | |
| 23 | // 0 1 Boot Block | |
| 24 | // 1 1 Disk Parameter Block | |
| 25 | // 2 1 Diagnostic Block (prep code) | |
| 26 | // 3 1 Constellation Parameter Block | |
| 27 | // 4 2 Dispatcher Code | |
| 28 | // 6 2 Pipes and Semaphores code (Semaphore table contained in block 7, bytes 1-256) | |
| 29 | // 8 10 Mirror Controller Code | |
| 30 | // 18 2 LSI-11 Controller Code | |
| 31 | // 20 2 Pipes Controller Code | |
| 32 | // 22 3 Reserved for Future Use | |
| 33 | // 25 8 Boot Blocks 0-7. Apple II uses 0-3, Concept uses 4-7 | |
| 34 | // 33 4 Active User Table | |
| 35 | // 37 3 Reserved | |
| 21 | // Blk Len Description | |
| 22 | // --- --- ----------- | |
| 23 | // 0 1 Boot Block | |
| 24 | // 1 1 Disk Parameter Block | |
| 25 | // 2 1 Diagnostic Block (prep code) | |
| 26 | // 3 1 Constellation Parameter Block | |
| 27 | // 4 2 Dispatcher Code | |
| 28 | // 6 2 Pipes and Semaphores code (Semaphore table contained in block 7, bytes 1-256) | |
| 29 | // 8 10 Mirror Controller Code | |
| 30 | // 18 2 LSI-11 Controller Code | |
| 31 | // 20 2 Pipes Controller Code | |
| 32 | // 22 3 Reserved for Future Use | |
| 33 | // 25 8 Boot Blocks 0-7. Apple II uses 0-3, Concept uses 4-7 | |
| 34 | // 33 4 Active User Table | |
| 35 | // 37 3 Reserved | |
| 36 | 36 | // |
| 37 | // All of the above blocks are initialized by the DDIAG program. This can be found on the | |
| 38 | // Concept FSYSGEN floppy. | |
| 39 | // - Boot blocks and code blocks are initialized using the "Update Firmware on Disk" function. | |
| 40 | // - Disk Parameter Block is initialized using the "Display/Modify Drive Parameters" function | |
| 37 | // All of the above blocks are initialized by the DDIAG program. This can be found on the | |
| 38 | // Concept FSYSGEN floppy. | |
| 39 | // - Boot blocks and code blocks are initialized using the "Update Firmware on Disk" function. | |
| 40 | // - Disk Parameter Block is initialized using the "Display/Modify Drive Parameters" function | |
| 41 | 41 | // |
| 42 | // | |
| 42 | // An on-disk structure is written with the SYSGEN utility on the same disk. Password is "HAI" | |
| 43 | 43 | // |
| 44 | 44 | // |
| 45 | // | |
| 45 | // Corvus Hard Disk performance characteristics (from a 6MB Rev B-E drive) | |
| 46 | 46 | // |
| 47 | // Average Latency: 6.25ms | |
| 48 | // Average Access Time: 125ms (and you thought YOUR drive was slow...) | |
| 49 | // Maximum Access Time: 240ms | |
| 50 | // Maximum Access Time (single track): 3ms | |
| 51 | // Data Transfer Rate: 960Kb/sec | |
| 52 | // Rotational Speed: 4800RPM | |
| 47 | // Average Latency: 6.25ms | |
| 48 | // Average Access Time: 125ms (and you thought YOUR drive was slow...) | |
| 49 | // Maximum Access Time: 240ms | |
| 50 | // Maximum Access Time (single track): 3ms | |
| 51 | // Data Transfer Rate: 960Kb/sec | |
| 52 | // Rotational Speed: 4800RPM | |
| 53 | 53 | // |
| 54 | // | |
| 54 | // Brett Wyer | |
| 55 | 55 | // |
| 56 | 56 | // |
| 57 | // TODO: | |
| 58 | // Implement READY line glitch after last byte of command (Disk System Tech Ref pp. 3) | |
| 59 | // Implement Read-after-Write (always happens on Rev B/H drives per Mass Storage GTI pp. 12) | |
| 60 | // Implement Multiple physical drive support - Up to four | |
| 61 | // Implement Drive Illegal Addresses (seek past last sector) | |
| 62 | // Implement Switches on front of drive (LSI-11, MUX, Format, Reset) | |
| 63 | // Implement an inter-sector delay during the FORMAT command (format happens too quickly now) | |
| 57 | // TODO: | |
| 58 | // Implement READY line glitch after last byte of command (Disk System Tech Ref pp. 3) | |
| 59 | // Implement Read-after-Write (always happens on Rev B/H drives per Mass Storage GTI pp. 12) | |
| 60 | // Implement Multiple physical drive support - Up to four | |
| 61 | // Implement Drive Illegal Addresses (seek past last sector) | |
| 62 | // Implement Switches on front of drive (LSI-11, MUX, Format, Reset) | |
| 63 | // Implement an inter-sector delay during the FORMAT command (format happens too quickly now) | |
| 64 | 64 | // |
| 65 | 65 | |
| 66 | 66 | #include "driver.h" |
| r5932 | r5933 | |
| 387 | 387 | // Dump a buffer to the error log in a nice format. |
| 388 | 388 | // |
| 389 | 389 | // Pass: |
| 390 | // buffer: Data to be dumped | |
| 391 | // length: Number of bytes to be dumped | |
| 390 | // buffer: Data to be dumped | |
| 391 | // length: Number of bytes to be dumped | |
| 392 | 392 | // |
| 393 | 393 | // Returns: |
| 394 | // | |
| 394 | // nada | |
| 395 | 395 | // |
| 396 | 396 | static void dump_buffer(UINT8 *buffer, UINT16 length) { |
| 397 | 397 | |
| r5932 | r5933 | |
| 429 | 429 | // a side-effect of this command, as is awaiting_modifier. |
| 430 | 430 | // |
| 431 | 431 | // Pass: |
| 432 | // | |
| 432 | // data: Initial byte received from the host in Host to Controller mode | |
| 433 | 433 | // |
| 434 | 434 | // Returns: |
| 435 | // | |
| 435 | // Whether the command was invalid or not (TRUE = invalid command) | |
| 436 | 436 | // |
| 437 | 437 | static UINT8 parse_hdc_command(UINT8 data) { |
| 438 | 438 | |
| r5932 | r5933 | |
| 460 | 460 | case BOOT: |
| 461 | 461 | case READ_BOOT_BLOCK: |
| 462 | 462 | case GET_DRIVE_PARAMETERS: |
| 463 | // | |
| 463 | // case PARK_HEADS_REVH: | |
| 464 | 464 | case PARK_HEADS_OMNI: |
| 465 | 465 | case ECHO: |
| 466 | 466 | case PREP_MODE_SELECT: |
| r5932 | r5933 | |
| 473 | 473 | // Double-byte commands |
| 474 | 474 | // |
| 475 | 475 | case SEMAPHORE_LOCK_CODE: |
| 476 | // | |
| 476 | // case SEMAPHORE_UNLOCK_CODE: | |
| 477 | 477 | case SEMAPHORE_INIT_CODE: |
| 478 | // case PIPE_READ_CODE: | |
| 479 | // case PIPE_WRITE_CODE: | |
| 480 | // case PIPE_CLOSE_CODE: | |
| 481 | // case PIPE_STATUS_CODE: | |
| 482 | // case SEMAPHORE_STATUS_CODE: | |
| 478 | // case PIPE_READ_CODE: | |
| 479 | // case PIPE_WRITE_CODE: | |
| 480 | // case PIPE_CLOSE_CODE: | |
| 481 | // case PIPE_STATUS_CODE: | |
| 482 | // case SEMAPHORE_STATUS_CODE: | |
| 483 | 483 | case PIPE_OPEN_WRITE_CODE: |
| 484 | // case PIPE_AREA_INIT_CODE: | |
| 485 | // case PIPE_OPEN_READ_CODE: | |
| 484 | // case PIPE_AREA_INIT_CODE: | |
| 485 | // case PIPE_OPEN_READ_CODE: | |
| 486 | 486 | case ADDACTIVE_CODE: |
| 487 | // case DELACTIVEUSR_REVBH_CODE: | |
| 488 | // case DELACTIVEUSR_OMNI_CODE: | |
| 489 | // case DELACTIVENUM_OMNI_CODE: | |
| 490 | // case FINDACTIVE_CODE: | |
| 487 | // case DELACTIVEUSR_REVBH_CODE: | |
| 488 | // case DELACTIVEUSR_OMNI_CODE: | |
| 489 | // case DELACTIVENUM_OMNI_CODE: | |
| 490 | // case FINDACTIVE_CODE: | |
| 491 | 491 | c->awaiting_modifier = TRUE; |
| 492 | 492 | LOG(("parse_hdc_command: Double byte command recoginized: 0x%2.2x\n", data)); |
| 493 | 493 | break; |
| r5932 | r5933 | |
| 535 | 535 | // Write a variably-sized chunk of data to the CHD file |
| 536 | 536 | // |
| 537 | 537 | // Pass: |
| 538 | // drv: Drive number to write to | |
| 539 | // sector: Physical sector number to write to | |
| 540 | // buffer: Buffer to write | |
| 541 | // len: Length of the buffer (amount of data to write) | |
| 538 | // drv: Drive number to write to | |
| 539 | // sector: Physical sector number to write to | |
| 540 | // buffer: Buffer to write | |
| 541 | // len: Length of the buffer (amount of data to write) | |
| 542 | 542 | // |
| 543 | 543 | // Returns: |
| 544 | // | |
| 544 | // status: Command status | |
| 545 | 545 | // |
| 546 | 546 | static UINT8 corvus_write_sector(running_machine *machine, UINT8 drv, UINT32 sector, UINT8 *buffer, int len) { |
| 547 | 547 | |
| r5932 | r5933 | |
| 597 | 597 | // Write a variably-sized chunk of data to the user area of the virtual Corvus drive |
| 598 | 598 | // |
| 599 | 599 | // Pass: |
| 600 | // dadr: Corvus-encoded Disk Address -- Logical Sector | |
| 601 | // buffer: Buffer holding the data to be written to the disk | |
| 602 | // len: Length of the buffer | |
| 600 | // dadr: Corvus-encoded Disk Address -- Logical Sector | |
| 601 | // buffer: Buffer holding the data to be written to the disk | |
| 602 | // len: Length of the buffer | |
| 603 | 603 | // |
| 604 | 604 | // Returns: |
| 605 | // | |
| 605 | // status: Corvus status | |
| 606 | 606 | // |
| 607 | 607 | static UINT8 corvus_write_logical_sector(running_machine *machine, dadr_t *dadr, UINT8 *buffer, int len) { |
| 608 | 608 | |
| r5932 | r5933 | |
| 646 | 646 | // Read a variably-sized chunk of data from the CHD file |
| 647 | 647 | // |
| 648 | 648 | // Pass: |
| 649 | // drv: Drive number to read from | |
| 650 | // sector: Physical sector number to read from | |
| 651 | // buffer: Buffer to hold the data read from the disk | |
| 652 | // len: Length of the buffer | |
| 649 | // drv: Drive number to read from | |
| 650 | // sector: Physical sector number to read from | |
| 651 | // buffer: Buffer to hold the data read from the disk | |
| 652 | // len: Length of the buffer | |
| 653 | 653 | // |
| 654 | 654 | // Returns: |
| 655 | // | |
| 655 | // status: Corvus status | |
| 656 | 656 | // |
| 657 | 657 | static UINT8 corvus_read_sector(running_machine *machine, UINT8 drv, UINT32 sector, UINT8 *buffer, int len) { |
| 658 | 658 | |
| r5932 | r5933 | |
| 697 | 697 | // Read a variably-sized chunk of data from the user area of the virtual Corvus drive |
| 698 | 698 | // |
| 699 | 699 | // Pass: |
| 700 | // dadr: Corvus-encoded Disk Address -- Logical Sector | |
| 701 | // buffer: Buffer to hold the data read from the disk | |
| 702 | // len: Length of the buffer | |
| 700 | // dadr: Corvus-encoded Disk Address -- Logical Sector | |
| 701 | // buffer: Buffer to hold the data read from the disk | |
| 702 | // len: Length of the buffer | |
| 703 | 703 | // |
| 704 | 704 | // Returns: |
| 705 | // | |
| 705 | // status: Corvus status | |
| 706 | 706 | // |
| 707 | 707 | static UINT8 corvus_read_logical_sector(running_machine *machine, dadr_t *dadr, UINT8 *buffer, int len) { |
| 708 | 708 | |
| r5932 | r5933 | |
| 747 | 747 | // Lock a semaphore in the semaphore table |
| 748 | 748 | // |
| 749 | 749 | // Pass: |
| 750 | // | |
| 750 | // name: Name of the semaphore to lock | |
| 751 | 751 | // |
| 752 | 752 | // Returns: |
| 753 | // | |
| 753 | // status: Disk status | |
| 754 | 754 | // |
| 755 | 755 | // Side-effects: |
| 756 | // | |
| 756 | // Fills in the semaphore result code | |
| 757 | 757 | // |
| 758 | 758 | static UINT8 corvus_lock_semaphore(running_machine *machine, UINT8 *name) { |
| 759 | 759 | |
| r5932 | r5933 | |
| 825 | 825 | // Unock a semaphore in the semaphore table |
| 826 | 826 | // |
| 827 | 827 | // Pass: |
| 828 | // | |
| 828 | // name: Name of the semaphore to unlock | |
| 829 | 829 | // |
| 830 | 830 | // Returns: |
| 831 | // | |
| 831 | // status: Disk status | |
| 832 | 832 | // |
| 833 | 833 | // Side-effects: |
| 834 | // | |
| 834 | // Fills in the semaphore result code | |
| 835 | 835 | // |
| 836 | 836 | static UINT8 corvus_unlock_semaphore(running_machine *machine, UINT8 *name) { |
| 837 | 837 | |
| r5932 | r5933 | |
| 895 | 895 | // Zap all of the semaphores from the table (set them to blanks) |
| 896 | 896 | // |
| 897 | 897 | // Pass: |
| 898 | // | |
| 898 | // Nothing | |
| 899 | 899 | // |
| 900 | 900 | // Returns: |
| 901 | // | |
| 901 | // Disk status | |
| 902 | 902 | // |
| 903 | 903 | // |
| 904 | 904 | static UINT8 corvus_init_semaphore_table( running_machine *machine ) { |
| r5932 | r5933 | |
| 926 | 926 | // Fills in the Drive Parameter packet based on the opened CHD file |
| 927 | 927 | // |
| 928 | 928 | // Pass: |
| 929 | // | |
| 929 | // drv: Drive number to get parameters from | |
| 930 | 930 | // |
| 931 | 931 | // Returns: |
| 932 | // | |
| 932 | // Status of command | |
| 933 | 933 | // |
| 934 | 934 | static UINT8 corvus_get_drive_parameters(running_machine *machine, UINT8 drv) { |
| 935 | 935 | |
| r5932 | r5933 | |
| 1035 | 1035 | // Old-style Boot (0x14) command boot block reader |
| 1036 | 1036 | // |
| 1037 | 1037 | // Pass: |
| 1038 | // | |
| 1038 | // block: Boot block number to read (0-7) | |
| 1039 | 1039 | // |
| 1040 | 1040 | // Returns: |
| 1041 | // | |
| 1041 | // status: Status of read operation | |
| 1042 | 1042 | // |
| 1043 | 1043 | static UINT8 corvus_read_boot_block(running_machine *machine, UINT8 block) { |
| 1044 | 1044 | |
| r5932 | r5933 | |
| 1058 | 1058 | // Reads firmware information from the first cylinder of the drive |
| 1059 | 1059 | // |
| 1060 | 1060 | // Pass: |
| 1061 | // head: Head number | |
| 1062 | // sector: Sector number | |
| 1061 | // head: Head number | |
| 1062 | // sector: Sector number | |
| 1063 | 1063 | // |
| 1064 | 1064 | // Returns: |
| 1065 | // | |
| 1065 | // Status of command | |
| 1066 | 1066 | // |
| 1067 | 1067 | static UINT8 corvus_read_firmware_block(running_machine *machine, UINT8 head, UINT8 sector) { |
| 1068 | 1068 | |
| r5932 | r5933 | |
| 1088 | 1088 | // Writes firmware information to the first cylinder of the drive |
| 1089 | 1089 | // |
| 1090 | 1090 | // Pass: |
| 1091 | // head: Head number | |
| 1092 | // sector: Sector number | |
| 1093 | // buffer: Data to be written | |
| 1091 | // head: Head number | |
| 1092 | // sector: Sector number | |
| 1093 | // buffer: Data to be written | |
| 1094 | 1094 | // |
| 1095 | 1095 | // Returns: |
| 1096 | // | |
| 1096 | // Status of command | |
| 1097 | 1097 | // |
| 1098 | 1098 | static UINT8 corvus_write_firmware_block(running_machine *machine, UINT8 head, UINT8 sector, UINT8 *buffer) { |
| 1099 | 1099 | |
| r5932 | r5933 | |
| 1119 | 1119 | // Write the pattern provided across the entire disk |
| 1120 | 1120 | // |
| 1121 | 1121 | // Pass: |
| 1122 | // | |
| 1122 | // pattern: 512-byte buffer containing the pattern to write to the whole drive | |
| 1123 | 1123 | // |
| 1124 | 1124 | // Returns: |
| 1125 | // | |
| 1125 | // Status of command | |
| 1126 | 1126 | // |
| 1127 | 1127 | static UINT8 corvus_format_drive(running_machine *machine, UINT8 *pattern, UINT16 len) { |
| 1128 | 1128 | |
| r5932 | r5933 | |
| 1167 | 1167 | // Returns a hard_disk_file object for a given virtual hard drive device in the concept |
| 1168 | 1168 | // |
| 1169 | 1169 | // Pass: |
| 1170 | // | |
| 1170 | // id: Drive number (1 - 15) | |
| 1171 | 1171 | // |
| 1172 | 1172 | // Returns: |
| 1173 | // | |
| 1173 | // hard_disk_file object | |
| 1174 | 1174 | // |
| 1175 | 1175 | static hard_disk_file *corvus_hdc_file(running_machine *machine, int id) { |
| 1176 | 1176 | static const char *const tags[] = { |
| r5932 | r5933 | |
| 1200 | 1200 | // Having received a complete packet from the host, process it |
| 1201 | 1201 | // |
| 1202 | 1202 | // Pass: |
| 1203 | // | |
| 1203 | // Invalid_Command_Flag: Invalid command flag responses are handled in this routine | |
| 1204 | 1204 | // |
| 1205 | 1205 | // Returns: |
| 1206 | // | |
| 1206 | // Nothing | |
| 1207 | 1207 | // |
| 1208 | 1208 | static void corvus_process_command_packet(running_machine *machine, UINT8 invalid_command_flag) { |
| 1209 | 1209 | |
| r5932 | r5933 | |
| 1251 | 1251 | // Semaphore commands |
| 1252 | 1252 | // |
| 1253 | 1253 | case SEMAPHORE_LOCK_CODE: |
| 1254 | // | |
| 1254 | // case SEMAPHORE_UNLOCK_CODE: | |
| 1255 | 1255 | case SEMAPHORE_INIT_CODE: |
| 1256 | // | |
| 1256 | // case SEMAPHORE_STATUS_CODE: | |
| 1257 | 1257 | switch(c->buffer.command.modifier) { |
| 1258 | 1258 | case SEMAPHORE_LOCK_MOD: |
| 1259 | 1259 | c->buffer.semaphore_locking_response.status = corvus_lock_semaphore(machine, c->buffer.lock_semaphore_command.name); |
| r5932 | r5933 | |
| 1369 | 1369 | // Callback routine for completion of controller functions |
| 1370 | 1370 | // |
| 1371 | 1371 | // Pass: |
| 1372 | // | |
| 1372 | // Callback Function | |
| 1373 | 1373 | // |
| 1374 | 1374 | // Returns: |
| 1375 | // | |
| 1375 | // Nothing | |
| 1376 | 1376 | // |
| 1377 | 1377 | static TIMER_CALLBACK(corvus_hdc_callback) |
| 1378 | 1378 | { |
| r5932 | r5933 | |
| 1406 | 1406 | c->recv_bytes = 0; |
| 1407 | 1407 | c->xmit_bytes = 1; |
| 1408 | 1408 | logerror("corvus_hdc_callback: Exceeded four-second timeout for data from host, resetting communications\n"); |
| 1409 | } else { // if(c->recv_bytes == 0) | |
| 1409 | } else { // if(c->recv_bytes == 0) This was a variable-size command | |
| 1410 | 1410 | LOG(("corvus_hdc_callback: Executing variable-length command via four-second timeout\n")); |
| 1411 | 1411 | corvus_process_command_packet(machine, 0); // Process the command |
| 1412 | 1412 | } |
| r5932 | r5933 | |
| 1428 | 1428 | // Global routine to initialize the Hard Disk Controller structures and arrays |
| 1429 | 1429 | // |
| 1430 | 1430 | // Pass: |
| 1431 | // | |
| 1431 | // Nothing | |
| 1432 | 1432 | // |
| 1433 | 1433 | // Returns: |
| 1434 | // | |
| 1434 | // NULL if there's no file to attach to | |
| 1435 | 1435 | // |
| 1436 | 1436 | UINT8 corvus_hdc_init(running_machine *machine) { |
| 1437 | 1437 | |
| r5932 | r5933 | |
| 1571 | 1571 | // Global routine to read the Status Register from the Controller (Controller to Host) |
| 1572 | 1572 | // |
| 1573 | 1573 | // Pass: |
| 1574 | // | |
| 1574 | // Nothing | |
| 1575 | 1575 | // |
| 1576 | 1576 | // Returns: |
| 1577 | // | |
| 1577 | // Value in the controller status register | |
| 1578 | 1578 | // |
| 1579 | 1579 | READ8_HANDLER ( corvus_hdc_status_r ) { |
| 1580 | 1580 | |
| r5932 | r5933 | |
| 1593 | 1593 | // when complete. |
| 1594 | 1594 | // |
| 1595 | 1595 | // Pass: |
| 1596 | // | |
| 1596 | // Nothing | |
| 1597 | 1597 | // |
| 1598 | 1598 | // Returns: |
| 1599 | // | |
| 1599 | // Value in the controller data register | |
| 1600 | 1600 | // |
| 1601 | 1601 | READ8_HANDLER ( corvus_hdc_data_r ) { |
| 1602 | 1602 | |
| r5932 | r5933 | |
| 1624 | 1624 | |
| 1625 | 1625 | timer_set(space->machine, (ATTOTIME_IN_USEC(INTERBYTE_DELAY)), NULL, CALLBACK_HTC_MODE, corvus_hdc_callback); |
| 1626 | 1626 | |
| 1627 | // | |
| 1627 | // c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY); // Put us in Idle, Host-to-Controller mode | |
| 1628 | 1628 | } else { |
| 1629 | 1629 | // |
| 1630 | 1630 | // Not finished with this packet. Insert an interbyte delay and then let the host continue |
| r5932 | r5933 | |
| 1643 | 1643 | // Write to the Data Register on the Controller (Host to Controller) |
| 1644 | 1644 | // |
| 1645 | 1645 | // Pass: |
| 1646 | // | |
| 1646 | // Value to write to controller data register | |
| 1647 | 1647 | // |
| 1648 | 1648 | // Returns: |
| 1649 | // | |
| 1649 | // Nothing | |
| 1650 | 1650 | // |
| 1651 | 1651 | WRITE8_HANDLER ( corvus_hdc_data_w ) { |
| 1652 | 1652 |
| r5932 | r5933 | |
|---|---|---|
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | 95 | /* |
| 96 | Some fake bios code to initialize some registers and set up some things on the wonderswan. | |
| 97 | The code from f:ffe0 which gets copied to 0:0400 is taken from a wonderswan crystal's initial | |
| 98 | memory settings. Lacking real bios dumps we will use this.... | |
| 96 | Some fake bios code to initialize some registers and set up some things on the wonderswan. | |
| 97 | The code from f:ffe0 which gets copied to 0:0400 is taken from a wonderswan crystal's initial | |
| 98 | memory settings. Lacking real bios dumps we will use this.... | |
| 99 | 99 | |
| 100 | ||
| 100 | The setting of SP to 2000h is what's needed to get Wonderswan Colloseum to boot. | |
| 101 | 101 | |
| 102 | f000:ffc0 | |
| 103 | FC cld | |
| 102 | f000:ffc0 | |
| 103 | FC cld | |
| 104 | 104 | BC 00 20 mov sp,2000h |
| 105 | 68 00 00 push 0000h | |
| 106 | 07 pop es | |
| 107 | 68 00 F0 push F000h | |
| 108 | 1F pop ds | |
| 109 | BF 00 04 mov di,0400h | |
| 110 | BE E0 FF mov si,FFE0h | |
| 111 | B9 10 00 mov cx,0010h | |
| 112 | F3 A4 rep movsb | |
| 113 | B0 2F mov al,2Fh | |
| 114 | E6 C0 out al,C0h | |
| 115 | EA 00 04 00 00 jmp 0000:0400 | |
| 105 | 68 00 00 push 0000h | |
| 106 | 07 pop es | |
| 107 | 68 00 F0 push F000h | |
| 108 | 1F pop ds | |
| 109 | BF 00 04 mov di,0400h | |
| 110 | BE E0 FF mov si,FFE0h | |
| 111 | B9 10 00 mov cx,0010h | |
| 112 | F3 A4 rep movsb | |
| 113 | B0 2F mov al,2Fh | |
| 114 | E6 C0 out al,C0h | |
| 115 | EA 00 04 00 00 jmp 0000:0400 | |
| 116 | 116 | |
| 117 | f000:ffe0 | |
| 118 | E4 A0 in al, A0h | |
| 119 | 0C 01 or al,01h | |
| 120 | E6 A0 out al,A0h | |
| 121 | EA 00 00 FF FF jmp FFFFh:0000h | |
| 117 | f000:ffe0 | |
| 118 | E4 A0 in al, A0h | |
| 119 | 0C 01 or al,01h | |
| 120 | E6 A0 out al,A0h | |
| 121 | EA 00 00 FF FF jmp FFFFh:0000h | |
| 122 | 122 | |
| 123 | 123 | */ |
| 124 | 124 | static const UINT8 ws_fake_bios_code[] = { |
| r5932 | r5933 | |
| 128 | 128 | 0xea, 0xc0, 0xff, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | static void wswan_handle_irqs( running_machine *machine ) | |
| 131 | static void wswan_handle_irqs( running_machine *machine ) | |
| 132 | 132 | { |
| 133 | 133 | if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_HBLTMR ) { |
| 134 | 134 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_HBLTMR ); |
| r5932 | r5933 | |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | static void wswan_set_irq_line( running_machine *machine, int irq) | |
| 154 | static void wswan_set_irq_line( running_machine *machine, int irq) | |
| 155 | 155 | { |
| 156 | if ( ws_portram[0xb2] & irq ) | |
| 156 | if ( ws_portram[0xb2] & irq ) | |
| 157 | 157 | { |
| 158 | 158 | ws_portram[0xb6] |= irq; |
| 159 | 159 | wswan_handle_irqs( machine ); |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | static void wswan_clear_irq_line( running_machine *machine, int irq) | |
| 163 | static void wswan_clear_irq_line( running_machine *machine, int irq) | |
| 164 | 164 | { |
| 165 | 165 | ws_portram[0xb6] &= ~irq; |
| 166 | 166 | wswan_handle_irqs( machine ); |
| r5932 | r5933 | |
| 170 | 170 | { |
| 171 | 171 | /* A second passed */ |
| 172 | 172 | rtc.second = rtc.second + 1; |
| 173 | if ( ( rtc.second & 0x0F ) > 9 ) | |
| 173 | if ( ( rtc.second & 0x0F ) > 9 ) | |
| 174 | 174 | { |
| 175 | 175 | rtc.second = ( rtc.second & 0xF0 ) + 0x10; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /* Check for minute passed */ |
| 179 | if ( rtc.second >= 0x60 ) | |
| 179 | if ( rtc.second >= 0x60 ) | |
| 180 | 180 | { |
| 181 | 181 | rtc.second = 0; |
| 182 | 182 | rtc.minute = rtc.minute + 1; |
| 183 | if ( ( rtc.minute & 0x0F ) > 9 ) | |
| 183 | if ( ( rtc.minute & 0x0F ) > 9 ) | |
| 184 | 184 | { |
| 185 | 185 | rtc.minute = ( rtc.minute & 0xF0 ) + 0x10; |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /* Check for hour passed */ |
| 190 | if ( rtc.minute >= 0x60 ) | |
| 190 | if ( rtc.minute >= 0x60 ) | |
| 191 | 191 | { |
| 192 | 192 | rtc.minute = 0; |
| 193 | 193 | rtc.hour = rtc.hour + 1; |
| 194 | if ( ( rtc.hour & 0x0F ) > 9 ) | |
| 194 | if ( ( rtc.hour & 0x0F ) > 9 ) | |
| 195 | 195 | { |
| 196 | 196 | rtc.hour = ( rtc.hour & 0xF0 ) + 0x10; |
| 197 | 197 | } |
| 198 | if ( rtc.hour == 0x12 ) | |
| 198 | if ( rtc.hour == 0x12 ) | |
| 199 | 199 | { |
| 200 | 200 | rtc.hour |= 0x80; |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /* Check for day passed */ |
| 205 | if ( rtc.hour >= 0x24 ) | |
| 205 | if ( rtc.hour >= 0x24 ) | |
| 206 | 206 | { |
| 207 | 207 | rtc.hour = 0; |
| 208 | 208 | rtc.day = rtc.day + 1; |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | static void wswan_machine_stop( running_machine *machine ) | |
| 212 | static void wswan_machine_stop( running_machine *machine ) | |
| 213 | 213 | { |
| 214 | if ( eeprom.size ) | |
| 214 | if ( eeprom.size ) | |
| 215 | 215 | { |
| 216 | 216 | image_battery_save( devtag_get_device(machine, "cart"), eeprom.data, eeprom.size ); |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | static void wswan_setup_bios( running_machine *machine ) | |
| 220 | static void wswan_setup_bios( running_machine *machine ) | |
| 221 | 221 | { |
| 222 | if ( ws_bios_bank == NULL ) | |
| 222 | if ( ws_bios_bank == NULL ) | |
| 223 | 223 | { |
| 224 | 224 | ws_bios_bank = auto_alloc_array(machine, UINT8, 0x10000 ); |
| 225 | 225 | memcpy( ws_bios_bank + 0xffc0, ws_fake_bios_code, 0x40 ); |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | MACHINE_START( wswan ) | |
| 229 | MACHINE_START( wswan ) | |
| 230 | 230 | { |
| 231 | 231 | ws_bios_bank = NULL; |
| 232 | 232 | system_type = WSWAN; |
| 233 | 233 | add_exit_callback( machine, wswan_machine_stop ); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | MACHINE_START( wscolor ) | |
| 236 | MACHINE_START( wscolor ) | |
| 237 | 237 | { |
| 238 | 238 | ws_bios_bank = NULL; |
| 239 | 239 | system_type = WSC; |
| r5932 | r5933 | |
| 282 | 282 | memory_set_bankptr( machine, 14, ROMMap[(ROMBanks - 2) & (ROMBanks - 1)] ); |
| 283 | 283 | wswan_bios_disabled = 0; |
| 284 | 284 | memory_set_bankptr( machine, 15, ws_bios_bank ); |
| 285 | // | |
| 285 | // memory_set_bankptr( machine, 15, ROMMap[(ROMBanks - 1) & (ROMBanks - 1)] ); | |
| 286 | 286 | |
| 287 | 287 | /* Set up RTC timer */ |
| 288 | if ( rtc.present ) | |
| 288 | if ( rtc.present ) | |
| 289 | 289 | { |
| 290 | 290 | timer_pulse(machine, ATTOTIME_IN_SEC(1), NULL, 0, wswan_rtc_callback ); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | NVRAM_HANDLER( wswan ) | |
| 295 | NVRAM_HANDLER( wswan ) | |
| 296 | 296 | { |
| 297 | if ( read_or_write ) | |
| 297 | if ( read_or_write ) | |
| 298 | 298 | { |
| 299 | 299 | /* Save the EEPROM data */ |
| 300 | 300 | mame_fwrite( file, internal_eeprom, INTERNAL_EEPROM_SIZE ); |
| 301 | } | |
| 302 | else | |
| 301 | } | |
| 302 | else | |
| 303 | 303 | { |
| 304 | 304 | /* Load the EEPROM data */ |
| 305 | if ( file ) | |
| 305 | if ( file ) | |
| 306 | 306 | { |
| 307 | 307 | mame_fread( file, internal_eeprom, INTERNAL_EEPROM_SIZE ); |
| 308 | } | |
| 309 | else | |
| 308 | } | |
| 309 | else | |
| 310 | 310 | { |
| 311 | 311 | /* Initialize the EEPROM data */ |
| 312 | 312 | memset( internal_eeprom, 0xFF, sizeof( internal_eeprom ) ); |
| r5932 | r5933 | |
| 316 | 316 | |
| 317 | 317 | READ8_HANDLER( wswan_sram_r ) |
| 318 | 318 | { |
| 319 | if ( eeprom.data == NULL ) | |
| 319 | if ( eeprom.data == NULL ) | |
| 320 | 320 | { |
| 321 | 321 | return 0xFF; |
| 322 | 322 | } |
| r5932 | r5933 | |
| 325 | 325 | |
| 326 | 326 | WRITE8_HANDLER( wswan_sram_w ) |
| 327 | 327 | { |
| 328 | if ( eeprom.data == NULL ) | |
| 328 | if ( eeprom.data == NULL ) | |
| 329 | 329 | { |
| 330 | 330 | return; |
| 331 | 331 | } |
| r5932 | r5933 | |
| 366 | 366 | /* Bit 1 - Determine mono/color */ |
| 367 | 367 | /* Bit 2 - Determine color/crystal */ |
| 368 | 368 | value = value & ~ 0x02; |
| 369 | if ( system_type == WSC ) | |
| 369 | if ( system_type == WSC ) | |
| 370 | 370 | { |
| 371 | 371 | value |= 2; |
| 372 | 372 | } |
| r5932 | r5933 | |
| 384 | 384 | value = wswan_vdp.timer_vblank_count >> 8; |
| 385 | 385 | break; |
| 386 | 386 | case 0xCB: /* RTC data */ |
| 387 | if ( ws_portram[0xca] == 0x95 && ( rtc.index < 7 ) ) | |
| 387 | if ( ws_portram[0xca] == 0x95 && ( rtc.index < 7 ) ) | |
| 388 | 388 | { |
| 389 | switch( rtc.index ) | |
| 389 | switch( rtc.index ) | |
| 390 | 390 | { |
| 391 | 391 | case 0: value = rtc.year; break; |
| 392 | 392 | case 1: value = rtc.month; break; |
| r5932 | r5933 | |
| 409 | 409 | switch( offset ) |
| 410 | 410 | { |
| 411 | 411 | case 0x00: /* Display control |
| 412 | Bit 0 - Background layer enable | |
| 413 | Bit 1 - Foreground layer enable | |
| 414 | Bit 2 - Sprites enable | |
| 415 | Bit 3 - Sprite window enable | |
| 416 | Bit 4-5 - Foreground window configuration | |
| 417 | 00 - Foreground layer is displayed inside and outside foreground window area | |
| 418 | 01 - Unknown | |
| 419 | 10 - Foreground layer is displayed only inside foreground window area | |
| 420 | 11 - Foreground layer is displayed outside foreground window area | |
| 421 | Bit 6-7 - Unknown | |
| 422 | */ | |
| 412 | Bit 0 - Background layer enable | |
| 413 | Bit 1 - Foreground layer enable | |
| 414 | Bit 2 - Sprites enable | |
| 415 | Bit 3 - Sprite window enable | |
| 416 | Bit 4-5 - Foreground window configuration | |
| 417 | 00 - Foreground layer is displayed inside and outside foreground window area | |
| 418 | 01 - Unknown | |
| 419 | 10 - Foreground layer is displayed only inside foreground window area | |
| 420 | 11 - Foreground layer is displayed outside foreground window area | |
| 421 | Bit 6-7 - Unknown | |
| 422 | */ | |
| 423 | 423 | wswan_vdp.layer_bg_enable = data & 0x1; |
| 424 | 424 | wswan_vdp.layer_fg_enable = (data & 0x2) >> 1; |
| 425 | 425 | wswan_vdp.sprites_enable = (data & 0x4) >> 2; |
| r5932 | r5933 | |
| 427 | 427 | wswan_vdp.window_fg_mode = (data & 0x30) >> 4; |
| 428 | 428 | break; |
| 429 | 429 | case 0x01: /* Background colour |
| 430 | In 16 colour mode: | |
| 431 | Bit 0-3 - Palette index | |
| 432 | Bit 4-7 - Palette number | |
| 433 | Otherwise: | |
| 434 | Bit 0-2 - Main palette index | |
| 435 | Bit 3-7 - Unknown | |
| 436 | */ | |
| 430 | In 16 colour mode: | |
| 431 | Bit 0-3 - Palette index | |
| 432 | Bit 4-7 - Palette number | |
| 433 | Otherwise: | |
| 434 | Bit 0-2 - Main palette index | |
| 435 | Bit 3-7 - Unknown | |
| 436 | */ | |
| 437 | 437 | break; |
| 438 | 438 | case 0x02: /* Current scanline |
| 439 | Bit 0-7 - Current scanline (Most likely read-only) | |
| 440 | */ | |
| 439 | Bit 0-7 - Current scanline (Most likely read-only) | |
| 440 | */ | |
| 441 | 441 | logerror( "Write to current scanline! Current value: %d Data to write: %d\n", wswan_vdp.current_line, data ); |
| 442 | 442 | /* Returning so we don't overwrite the value here, not that it |
| 443 | ||
| 443 | * really matters */ | |
| 444 | 444 | return; |
| 445 | 445 | case 0x03: /* Line compare |
| 446 | Bit 0-7 - Line compare | |
| 447 | */ | |
| 446 | Bit 0-7 - Line compare | |
| 447 | */ | |
| 448 | 448 | wswan_vdp.line_compare = data; |
| 449 | 449 | break; |
| 450 | 450 | case 0x04: /* Sprite table base address |
| 451 | Bit 0-5 - Determine sprite table base address 0 0xxxxxx0 00000000 | |
| 452 | Bit 6-7 - Unknown | |
| 453 | */ | |
| 451 | Bit 0-5 - Determine sprite table base address 0 0xxxxxx0 00000000 | |
| 452 | Bit 6-7 - Unknown | |
| 453 | */ | |
| 454 | 454 | wswan_vdp.sprite_table_address = ( data & 0x3F ) << 9; |
| 455 | 455 | break; |
| 456 | 456 | case 0x05: /* Number of sprite to start drawing with |
| 457 | Bit 0-7 - First sprite number | |
| 458 | */ | |
| 457 | Bit 0-7 - First sprite number | |
| 458 | */ | |
| 459 | 459 | wswan_vdp.sprite_first = data; |
| 460 | 460 | break; |
| 461 | 461 | case 0x06: /* Number of sprites to draw |
| 462 | Bit 0-7 - Number of sprites to draw | |
| 463 | */ | |
| 462 | Bit 0-7 - Number of sprites to draw | |
| 463 | */ | |
| 464 | 464 | wswan_vdp.sprite_count = data; |
| 465 | 465 | break; |
| 466 | 466 | case 0x07: /* Background/Foreground table base addresses |
| 467 | Bit 0-2 - Determine background table base address 00xxx000 00000000 | |
| 468 | Bit 3 - Unknown | |
| 469 | Bit 4-6 - Determine foreground table base address 00xxx000 00000000 | |
| 470 | Bit 7 - Unknown | |
| 471 | */ | |
| 467 | Bit 0-2 - Determine background table base address 00xxx000 00000000 | |
| 468 | Bit 3 - Unknown | |
| 469 | Bit 4-6 - Determine foreground table base address 00xxx000 00000000 | |
| 470 | Bit 7 - Unknown | |
| 471 | */ | |
| 472 | 472 | wswan_vdp.layer_bg_address = (data & 0x7) << 11; |
| 473 | 473 | wswan_vdp.layer_fg_address = (data & 0x70) << 7; |
| 474 | 474 | break; |
| 475 | 475 | case 0x08: /* Left coordinate of foreground window |
| 476 | Bit 0-7 - Left coordinate of foreground window area | |
| 477 | */ | |
| 476 | Bit 0-7 - Left coordinate of foreground window area | |
| 477 | */ | |
| 478 | 478 | wswan_vdp.window_fg_left = data; |
| 479 | 479 | break; |
| 480 | 480 | case 0x09: /* Top coordinate of foreground window |
| 481 | Bit 0-7 - Top coordinatte of foreground window area | |
| 482 | */ | |
| 481 | Bit 0-7 - Top coordinatte of foreground window area | |
| 482 | */ | |
| 483 | 483 | wswan_vdp.window_fg_top = data; |
| 484 | 484 | break; |
| 485 | 485 | case 0x0A: /* Right coordinate of foreground window |
| 486 | Bit 0-7 - Right coordinate of foreground window area | |
| 487 | */ | |
| 486 | Bit 0-7 - Right coordinate of foreground window area | |
| 487 | */ | |
| 488 | 488 | wswan_vdp.window_fg_right = data; |
| 489 | 489 | break; |
| 490 | 490 | case 0x0B: /* Bottom coordinate of foreground window |
| 491 | Bit 0-7 - Bottom coordinate of foreground window area | |
| 492 | */ | |
| 491 | Bit 0-7 - Bottom coordinate of foreground window area | |
| 492 | */ | |
| 493 | 493 | wswan_vdp.window_fg_bottom = data; |
| 494 | 494 | break; |
| 495 | 495 | case 0x0C: /* Left coordinate of sprite window |
| 496 | Bit 0-7 - Left coordinate of sprite window area | |
| 497 | */ | |
| 496 | Bit 0-7 - Left coordinate of sprite window area | |
| 497 | */ | |
| 498 | 498 | wswan_vdp.window_sprites_left = data; |
| 499 | 499 | break; |
| 500 | 500 | case 0x0D: /* Top coordinate of sprite window |
| 501 | Bit 0-7 - Top coordinate of sprite window area | |
| 502 | */ | |
| 501 | Bit 0-7 - Top coordinate of sprite window area | |
| 502 | */ | |
| 503 | 503 | wswan_vdp.window_sprites_top = data; |
| 504 | 504 | break; |
| 505 | 505 | case 0x0E: /* Right coordinate of sprite window |
| 506 | Bit 0-7 - Right coordinate of sprite window area | |
| 507 | */ | |
| 506 | Bit 0-7 - Right coordinate of sprite window area | |
| 507 | */ | |
| 508 | 508 | wswan_vdp.window_sprites_right = data; |
| 509 | 509 | break; |
| 510 | 510 | case 0x0F: /* Bottom coordinate of sprite window |
| 511 | Bit 0-7 - Bottom coordiante of sprite window area | |
| 512 | */ | |
| 511 | Bit 0-7 - Bottom coordiante of sprite window area | |
| 512 | */ | |
| 513 | 513 | wswan_vdp.window_sprites_bottom = data; |
| 514 | 514 | break; |
| 515 | 515 | case 0x10: /* Background layer X scroll |
| 516 | Bit 0-7 - Background layer X scroll | |
| 517 | */ | |
| 516 | Bit 0-7 - Background layer X scroll | |
| 517 | */ | |
| 518 | 518 | wswan_vdp.layer_bg_scroll_x = data; |
| 519 | 519 | break; |
| 520 | 520 | case 0x11: /* Background layer Y scroll |
| 521 | Bit 0-7 - Background layer Y scroll | |
| 522 | */ | |
| 521 | Bit 0-7 - Background layer Y scroll | |
| 522 | */ | |
| 523 | 523 | wswan_vdp.layer_bg_scroll_y = data; |
| 524 | 524 | break; |
| 525 | 525 | case 0x12: /* Foreground layer X scroll |
| 526 | Bit 0-7 - Foreground layer X scroll | |
| 527 | */ | |
| 526 | Bit 0-7 - Foreground layer X scroll | |
| 527 | */ | |
| 528 | 528 | wswan_vdp.layer_fg_scroll_x = data; |
| 529 | 529 | break; |
| 530 | 530 | case 0x13: /* Foreground layer Y scroll |
| 531 | Bit 0-7 - Foreground layer Y scroll | |
| 532 | */ | |
| 531 | Bit 0-7 - Foreground layer Y scroll | |
| 532 | */ | |
| 533 | 533 | wswan_vdp.layer_fg_scroll_y = data; |
| 534 | 534 | break; |
| 535 | 535 | case 0x14: /* LCD control |
| 536 | Bit 0 - LCD enable | |
| 537 | Bit 1-7 - Unknown | |
| 538 | */ | |
| 536 | Bit 0 - LCD enable | |
| 537 | Bit 1-7 - Unknown | |
| 538 | */ | |
| 539 | 539 | wswan_vdp.lcd_enable = data & 0x1; |
| 540 | 540 | break; |
| 541 | 541 | case 0x15: /* LCD icons |
| 542 | Bit 0 - LCD sleep icon enable | |
| 543 | Bit 1 - Vertical position icon enable | |
| 544 | Bit 2 - Horizontal position icon enable | |
| 545 | Bit 3 - Dot 1 icon enable | |
| 546 | Bit 4 - Dot 2 icon enable | |
| 547 | Bit 5 - Dot 3 icon enable | |
| 548 | Bit 6-7 - Unknown | |
| 549 | */ | |
| 542 | Bit 0 - LCD sleep icon enable | |
| 543 | Bit 1 - Vertical position icon enable | |
| 544 | Bit 2 - Horizontal position icon enable | |
| 545 | Bit 3 - Dot 1 icon enable | |
| 546 | Bit 4 - Dot 2 icon enable | |
| 547 | Bit 5 - Dot 3 icon enable | |
| 548 | Bit 6-7 - Unknown | |
| 549 | */ | |
| 550 | 550 | wswan_vdp.icons = data; /* ummmmm */ |
| 551 | 551 | break; |
| 552 | 552 | case 0x1c: /* Palette colors 0 and 1 |
| 553 | Bit 0-3 - Gray tone setting for main palette index 0 | |
| 554 | Bit 4-7 - Gray tone setting for main palette index 1 | |
| 555 | */ | |
| 556 | if ( system_type == WSC ) | |
| 553 | Bit 0-3 - Gray tone setting for main palette index 0 | |
| 554 | Bit 4-7 - Gray tone setting for main palette index 1 | |
| 555 | */ | |
| 556 | if ( system_type == WSC ) | |
| 557 | 557 | { |
| 558 | 558 | int i = 15 - ( data & 0x0F ); |
| 559 | 559 | int j = 15 - ( ( data & 0xF0 ) >> 4 ); |
| 560 | 560 | wswan_vdp.main_palette[0] = ( i << 8 ) | ( i << 4 ) | i; |
| 561 | 561 | wswan_vdp.main_palette[1] = ( j << 8 ) | ( j << 4 ) | j; |
| 562 | } | |
| 563 | else | |
| 562 | } | |
| 563 | else | |
| 564 | 564 | { |
| 565 | 565 | wswan_vdp.main_palette[0] = data & 0x0F; |
| 566 | 566 | wswan_vdp.main_palette[1] = ( data & 0xF0 ) >> 4; |
| 567 | 567 | } |
| 568 | 568 | break; |
| 569 | 569 | case 0x1d: /* Palette colors 2 and 3 |
| 570 | Bit 0-3 - Gray tone setting for main palette index 2 | |
| 571 | Bit 4-7 - Gray tone setting for main palette index 3 | |
| 572 | */ | |
| 573 | if ( system_type == WSC ) | |
| 570 | Bit 0-3 - Gray tone setting for main palette index 2 | |
| 571 | Bit 4-7 - Gray tone setting for main palette index 3 | |
| 572 | */ | |
| 573 | if ( system_type == WSC ) | |
| 574 | 574 | { |
| 575 | 575 | int i = 15 - ( data & 0x0F ); |
| 576 | 576 | int j = 15 - ( ( data & 0xF0 ) >> 4 ); |
| 577 | 577 | wswan_vdp.main_palette[2] = ( i << 8 ) | ( i << 4 ) | i; |
| 578 | 578 | wswan_vdp.main_palette[3] = ( j << 8 ) | ( j << 4 ) | j; |
| 579 | } | |
| 580 | else | |
| 579 | } | |
| 580 | else | |
| 581 | 581 | { |
| 582 | 582 | wswan_vdp.main_palette[2] = data & 0x0F; |
| 583 | 583 | wswan_vdp.main_palette[3] = ( data & 0xF0 ) >> 4; |
| 584 | 584 | } |
| 585 | 585 | break; |
| 586 | 586 | case 0x1e: /* Palette colors 4 and 5 |
| 587 | Bit 0-3 - Gray tone setting for main palette index 4 | |
| 588 | Bit 4-7 - Gray tone setting for main paeltte index 5 | |
| 589 | */ | |
| 590 | if ( system_type == WSC ) | |
| 587 | Bit 0-3 - Gray tone setting for main palette index 4 | |
| 588 | Bit 4-7 - Gray tone setting for main paeltte index 5 | |
| 589 | */ | |
| 590 | if ( system_type == WSC ) | |
| 591 | 591 | { |
| 592 | 592 | int i = 15 - ( data & 0x0F ); |
| 593 | 593 | int j = 15 - ( ( data & 0xF0 ) >> 4 ); |
| 594 | 594 | wswan_vdp.main_palette[4] = ( i << 8 ) | ( i << 4 ) | i; |
| 595 | 595 | wswan_vdp.main_palette[5] = ( j << 8 ) | ( j << 4 ) | j; |
| 596 | } | |
| 597 | else | |
| 596 | } | |
| 597 | else | |
| 598 | 598 | { |
| 599 | 599 | wswan_vdp.main_palette[4] = data & 0x0F; |
| 600 | 600 | wswan_vdp.main_palette[5] = ( data & 0xF0 ) >> 4; |
| 601 | 601 | } |
| 602 | 602 | break; |
| 603 | 603 | case 0x1f: /* Palette colors 6 and 7 |
| 604 | Bit 0-3 - Gray tone setting for main palette index 6 | |
| 605 | Bit 4-7 - Gray tone setting for main palette index 7 | |
| 606 | */ | |
| 607 | if ( system_type == WSC ) | |
| 604 | Bit 0-3 - Gray tone setting for main palette index 6 | |
| 605 | Bit 4-7 - Gray tone setting for main palette index 7 | |
| 606 | */ | |
| 607 | if ( system_type == WSC ) | |
| 608 | 608 | { |
| 609 | 609 | int i = 15 - ( data & 0x0F ); |
| 610 | 610 | int j = 15 - ( ( data & 0xF0 ) >> 4 ); |
| 611 | 611 | wswan_vdp.main_palette[6] = ( i << 8 ) | ( i << 4 ) | i; |
| 612 | 612 | wswan_vdp.main_palette[7] = ( j << 8 ) | ( j << 4 ) | j; |
| 613 | } | |
| 614 | else | |
| 613 | } | |
| 614 | else | |
| 615 | 615 | { |
| 616 | 616 | wswan_vdp.main_palette[6] = data & 0x0F; |
| 617 | 617 | wswan_vdp.main_palette[7] = ( data & 0xF0 ) >> 4; |
| 618 | 618 | } |
| 619 | 619 | break; |
| 620 | 620 | case 0x20: /* tile/sprite palette settings |
| 621 | Bit 0-3 - Palette 0 index 0 | |
| 622 | Bit 4-7 - Palette 0 index 1 */ | |
| 621 | Bit 0-3 - Palette 0 index 0 | |
| 622 | Bit 4-7 - Palette 0 index 1 */ | |
| 623 | 623 | case 0x21: /* Bit 0-3 - Palette 0 index 2 |
| 624 | ||
| 624 | Bit 4-7 - Palette 0 index 3 */ | |
| 625 | 625 | case 0x22: /* Bit 0-3 - Palette 1 index 0 |
| 626 | ||
| 626 | Bit 4-7 - Palette 1 index 1 */ | |
| 627 | 627 | case 0x23: /* Bit 0-3 - Palette 1 index 2 |
| 628 | ||
| 628 | Bit 4-7 - Palette 1 index 3 */ | |
| 629 | 629 | case 0x24: /* Bit 0-3 - Palette 2 index 0 |
| 630 | ||
| 630 | Bit 4-7 - Palette 2 index 1 */ | |
| 631 | 631 | case 0x25: /* Bit 0-3 - Palette 2 index 2 |
| 632 | ||
| 632 | Bit 4-7 - Palette 2 index 3 */ | |
| 633 | 633 | case 0x26: /* Bit 0-3 - Palette 3 index 0 |
| 634 | ||
| 634 | Bit 4-7 - Palette 3 index 1 */ | |
| 635 | 635 | case 0x27: /* Bit 0-3 - Palette 3 index 2 |
| 636 | ||
| 636 | Bit 4-7 - Palette 3 index 3 */ | |
| 637 | 637 | case 0x28: /* Bit 0-3 - Palette 4 index 0 |
| 638 | ||
| 638 | Bit 4-7 - Palette 4 index 1 */ | |
| 639 | 639 | case 0x29: /* Bit 0-3 - Palette 4 index 2 |
| 640 | ||
| 640 | Bit 4-7 - Palette 4 index 3 */ | |
| 641 | 641 | case 0x2A: /* Bit 0-3 - Palette 5 index 0 |
| 642 | ||
| 642 | Bit 4-7 - Palette 5 index 1 */ | |
| 643 | 643 | case 0x2B: /* Bit 0-3 - Palette 5 index 2 |
| 644 | ||
| 644 | Bit 4-7 - Palette 5 index 3 */ | |
| 645 | 645 | case 0x2C: /* Bit 0-3 - Palette 6 index 0 |
| 646 | ||
| 646 | Bit 4-7 - Palette 6 index 1 */ | |
| 647 | 647 | case 0x2D: /* Bit 0-3 - Palette 6 index 2 |
| 648 | ||
| 648 | Bit 4-7 - Palette 6 index 3 */ | |
| 649 | 649 | case 0x2E: /* Bit 0-3 - Palette 7 index 0 |
| 650 | ||
| 650 | Bit 4-7 - Palette 7 index 1 */ | |
| 651 | 651 | case 0x2F: /* Bit 0-3 - Palette 7 index 2 |
| 652 | ||
| 652 | Bit 4-7 - Palette 7 index 3 */ | |
| 653 | 653 | case 0x30: /* Bit 0-3 - Palette 8 / Sprite Palette 0 index 0 |
| 654 | ||
| 654 | Bit 4-7 - Palette 8 / Sprite Palette 0 index 1 */ | |
| 655 | 655 | case 0x31: /* Bit 0-3 - Palette 8 / Sprite Palette 0 index 2 |
| 656 | ||
| 656 | Bit 4-7 - Palette 8 / Sprite Palette 0 index 3 */ | |
| 657 | 657 | case 0x32: /* Bit 0-3 - Palette 9 / Sprite Palette 1 index 0 |
| 658 | ||
| 658 | Bit 4-7 - Palette 9 / Sprite Palette 1 index 1 */ | |
| 659 | 659 | case 0x33: /* Bit 0-3 - Palette 9 / Sprite Palette 1 index 2 |
| 660 | ||
| 660 | Bit 4-7 - Palette 9 / Sprite Palette 1 index 3 */ | |
| 661 | 661 | case 0x34: /* Bit 0-3 - Palette 10 / Sprite Palette 2 index 0 |
| 662 | ||
| 662 | Bit 4-7 - Palette 10 / Sprite Palette 2 index 1 */ | |
| 663 | 663 | case 0x35: /* Bit 0-3 - Palette 10 / Sprite Palette 2 index 2 |
| 664 | ||
| 664 | Bit 4-7 - Palette 10 / Sprite Palette 2 index 3 */ | |
| 665 | 665 | case 0x36: /* Bit 0-3 - Palette 11 / Sprite Palette 3 index 0 |
| 666 | ||
| 666 | Bit 4-7 - Palette 11 / Sprite Palette 3 index 1 */ | |
| 667 | 667 | case 0x37: /* Bit 0-3 - Palette 11 / Sprite Palette 3 index 2 |
| 668 | ||
| 668 | Bit 4-7 - Palette 11 / Sprite Palette 3 index 3 */ | |
| 669 | 669 | case 0x38: /* Bit 0-3 - Palette 12 / Sprite Palette 4 index 0 |
| 670 | ||
| 670 | Bit 4-7 - Palette 12 / Sprite Palette 4 index 1 */ | |
| 671 | 671 | case 0x39: /* Bit 0-3 - Palette 12 / Sprite Palette 4 index 2 |
| 672 | ||
| 672 | Bit 4-7 - Palette 12 / Sprite Palette 4 index 3 */ | |
| 673 | 673 | case 0x3A: /* Bit 0-3 - Palette 13 / Sprite Palette 5 index 0 |
| 674 | ||
| 674 | Bit 4-7 - Palette 13 / Sprite Palette 5 index 1 */ | |
| 675 | 675 | case 0x3B: /* Bit 0-3 - Palette 13 / Sprite Palette 5 index 2 |
| 676 | ||
| 676 | Bit 4-7 - Palette 13 / Sprite Palette 5 index 3 */ | |
| 677 | 677 | case 0x3C: /* Bit 0-3 - Palette 14 / Sprite Palette 6 index 0 |
| 678 | ||
| 678 | Bit 4-7 - Palette 14 / Sprite Palette 6 index 1 */ | |
| 679 | 679 | case 0x3D: /* Bit 0-3 - Palette 14 / Sprite Palette 6 index 2 |
| 680 | ||
| 680 | Bit 4-7 - Palette 14 / Sprite Palette 6 index 3 */ | |
| 681 | 681 | case 0x3E: /* Bit 0-3 - Palette 15 / Sprite Palette 7 index 0 |
| 682 | ||
| 682 | Bit 4-7 - Palette 15 / Sprite Palette 7 index 1 */ | |
| 683 | 683 | case 0x3F: /* Bit 0-3 - Palette 15 / Sprite Palette 7 index 2 |
| 684 | ||
| 684 | Bit 4-7 - Palette 15 / Sprite Palette 7 index 3 */ | |
| 685 | 685 | break; |
| 686 | 686 | case 0x40: /* DMA source address (low) |
| 687 | Bit 0-7 - DMA source address bit 0-7 | |
| 688 | */ | |
| 687 | Bit 0-7 - DMA source address bit 0-7 | |
| 688 | */ | |
| 689 | 689 | case 0x41: /* DMA source address (high) |
| 690 | Bit 0-7 - DMA source address bit 8-15 | |
| 691 | */ | |
| 690 | Bit 0-7 - DMA source address bit 8-15 | |
| 691 | */ | |
| 692 | 692 | case 0x42: /* DMA source bank |
| 693 | Bit 0-7 - DMA source bank number | |
| 694 | */ | |
| 693 | Bit 0-7 - DMA source bank number | |
| 694 | */ | |
| 695 | 695 | case 0x43: /* DMA destination bank |
| 696 | Bit 0-7 - DMA destination bank number | |
| 697 | */ | |
| 696 | Bit 0-7 - DMA destination bank number | |
| 697 | */ | |
| 698 | 698 | case 0x44: /* DMA destination address (low) |
| 699 | Bit 0-7 - DMA destination address bit 0-7 | |
| 700 | */ | |
| 699 | Bit 0-7 - DMA destination address bit 0-7 | |
| 700 | */ | |
| 701 | 701 | case 0x45: /* DMA destination address (high) |
| 702 | Bit 0-7 - DMA destination address bit 8-15 | |
| 703 | */ | |
| 702 | Bit 0-7 - DMA destination address bit 8-15 | |
| 703 | */ | |
| 704 | 704 | case 0x46: /* Size of copied data (low) |
| 705 | Bit 0-7 - DMA size bit 0-7 | |
| 706 | */ | |
| 705 | Bit 0-7 - DMA size bit 0-7 | |
| 706 | */ | |
| 707 | 707 | case 0x47: /* Size of copied data (high) |
| 708 | Bit 0-7 - DMA size bit 8-15 | |
| 709 | */ | |
| 708 | Bit 0-7 - DMA size bit 8-15 | |
| 709 | */ | |
| 710 | 710 | break; |
| 711 | 711 | case 0x48: /* DMA control |
| 712 | Bit 0-6 - Unknown | |
| 713 | Bit 7 - DMA stop/start | |
| 714 | */ | |
| 712 | Bit 0-6 - Unknown | |
| 713 | Bit 7 - DMA stop/start | |
| 714 | */ | |
| 715 | 715 | if( data & 0x80 ) |
| 716 | 716 | { |
| 717 | 717 | UINT32 src, dst; |
| r5932 | r5933 | |
| 720 | 720 | src = ws_portram[0x40] + (ws_portram[0x41] << 8) + (ws_portram[0x42] << 16); |
| 721 | 721 | dst = ws_portram[0x44] + (ws_portram[0x45] << 8) + (ws_portram[0x43] << 16); |
| 722 | 722 | length = ws_portram[0x46] + (ws_portram[0x47] << 8); |
| 723 | for( ; length > 0; length-- ) | |
| 723 | for( ; length > 0; length-- ) | |
| 724 | 724 | { |
| 725 | 725 | memory_write_byte(space, dst, memory_read_byte(space, src ) ); |
| 726 | 726 | src++; |
| r5932 | r5933 | |
| 739 | 739 | } |
| 740 | 740 | break; |
| 741 | 741 | case 0x4A: /* Sound DMA source address (low) |
| 742 | Bit 0-7 - Sound DMA source address bit 0-7 | |
| 743 | */ | |
| 742 | Bit 0-7 - Sound DMA source address bit 0-7 | |
| 743 | */ | |
| 744 | 744 | sound_dma.source = ( sound_dma.source & 0x0FFF00 ) | data; |
| 745 | 745 | break; |
| 746 | 746 | case 0x4B: /* Sound DMA source address (high) |
| 747 | Bit 0-7 - Sound DMA source address bit 8-15 | |
| 748 | */ | |
| 747 | Bit 0-7 - Sound DMA source address bit 8-15 | |
| 748 | */ | |
| 749 | 749 | sound_dma.source = ( sound_dma.source & 0x0F00FF ) | ( data << 8 ); |
| 750 | 750 | break; |
| 751 | 751 | case 0x4C: /* Sound DMA source memory segment |
| 752 | Bit 0-3 - Sound DMA source address segment | |
| 753 | Bit 4-7 - Unknown | |
| 754 | */ | |
| 752 | Bit 0-3 - Sound DMA source address segment | |
| 753 | Bit 4-7 - Unknown | |
| 754 | */ | |
| 755 | 755 | sound_dma.source = ( sound_dma.source & 0xFFFF ) | ( ( data & 0x0F ) << 16 ); |
| 756 | 756 | break; |
| 757 | 757 | case 0x4D: /* Unknown */ |
| 758 | 758 | break; |
| 759 | 759 | case 0x4E: /* Sound DMA transfer size (low) |
| 760 | Bit 0-7 - Sound DMA transfer size bit 0-7 | |
| 761 | */ | |
| 760 | Bit 0-7 - Sound DMA transfer size bit 0-7 | |
| 761 | */ | |
| 762 | 762 | sound_dma.size = ( sound_dma.size & 0xFF00 ) | data; |
| 763 | 763 | break; |
| 764 | 764 | case 0x4F: /* Sound DMA transfer size (high) |
| 765 | Bit 0-7 - Sound DMA transfer size bit 8-15 | |
| 766 | */ | |
| 765 | Bit 0-7 - Sound DMA transfer size bit 8-15 | |
| 766 | */ | |
| 767 | 767 | sound_dma.size = ( sound_dma.size & 0xFF ) | ( data << 8 ); |
| 768 | 768 | break; |
| 769 | 769 | case 0x50: /* Unknown */ |
| 770 | 770 | case 0x51: /* Unknown */ |
| 771 | 771 | break; |
| 772 | 772 | case 0x52: /* Sound DMA start/stop |
| 773 | Bit 0-6 - Unknown | |
| 774 | Bit 7 - Sound DMA stop/start | |
| 775 | */ | |
| 773 | Bit 0-6 - Unknown | |
| 774 | Bit 7 - Sound DMA stop/start | |
| 775 | */ | |
| 776 | 776 | sound_dma.enable = data; |
| 777 | 777 | break; |
| 778 | 778 | case 0x60: /* Video mode |
| 779 | Bit 0-4 - Unknown | |
| 780 | Bit 5 - Packed mode 0 = not packed mode, 1 = packed mode | |
| 781 | Bit 6 - 4/16 colour mode select: 0 = 4 colour mode, 1 = 16 colour mode | |
| 782 | Bit 7 - monochrome/colour mode select: 0 = monochrome mode, 1 = colour mode | |
| 783 | */ | |
| 779 | Bit 0-4 - Unknown | |
| 780 | Bit 5 - Packed mode 0 = not packed mode, 1 = packed mode | |
| 781 | Bit 6 - 4/16 colour mode select: 0 = 4 colour mode, 1 = 16 colour mode | |
| 782 | Bit 7 - monochrome/colour mode select: 0 = monochrome mode, 1 = colour mode | |
| 783 | */ | |
| 784 | 784 | /* |
| 785 | * 111 - packed, 16 color, use 4000/8000, color | |
| 786 | * 110 - not packed, 16 color, use 4000/8000, color | |
| 787 | * 101 - packed, 4 color, use 2000, color | |
| 788 | * 100 - not packed, 4 color, use 2000, color | |
| 789 | * 011 - packed, 16 color, use 4000/8000, monochrome | |
| 790 | * 010 - not packed, 16 color , use 4000/8000, monochrome | |
| 791 | * 001 - packed, 4 color, use 2000, monochrome | |
| 792 | * 000 - not packed, 4 color, use 2000, monochrome - Regular WS monochrome | |
| 793 | */ | |
| 794 | if ( system_type == WSC ) | |
| 785 | * 111 - packed, 16 color, use 4000/8000, color | |
| 786 | * 110 - not packed, 16 color, use 4000/8000, color | |
| 787 | * 101 - packed, 4 color, use 2000, color | |
| 788 | * 100 - not packed, 4 color, use 2000, color | |
| 789 | * 011 - packed, 16 color, use 4000/8000, monochrome | |
| 790 | * 010 - not packed, 16 color , use 4000/8000, monochrome | |
| 791 | * 001 - packed, 4 color, use 2000, monochrome | |
| 792 | * 000 - not packed, 4 color, use 2000, monochrome - Regular WS monochrome | |
| 793 | */ | |
| 794 | if ( system_type == WSC ) | |
| 795 | 795 | { |
| 796 | 796 | wswan_vdp.color_mode = data & 0x80; |
| 797 | 797 | wswan_vdp.colors_16 = data & 0x40; |
| r5932 | r5933 | |
| 799 | 799 | } |
| 800 | 800 | break; |
| 801 | 801 | case 0x80: /* Audio 1 freq (lo) |
| 802 | Bit 0-7 - Audio channel 1 frequency bit 0-7 | |
| 803 | */ | |
| 802 | Bit 0-7 - Audio channel 1 frequency bit 0-7 | |
| 803 | */ | |
| 804 | 804 | case 0x81: /* Audio 1 freq (hi) |
| 805 | Bit 0-7 - Audio channel 1 frequency bit 8-15 | |
| 806 | */ | |
| 805 | Bit 0-7 - Audio channel 1 frequency bit 8-15 | |
| 806 | */ | |
| 807 | 807 | case 0x82: /* Audio 2 freq (lo) |
| 808 | Bit 0-7 - Audio channel 2 frequency bit 0-7 | |
| 809 | */ | |
| 808 | Bit 0-7 - Audio channel 2 frequency bit 0-7 | |
| 809 | */ | |
| 810 | 810 | case 0x83: /* Audio 2 freq (hi) |
| 811 | Bit 0-7 - Audio channel 2 frequency bit 8-15 | |
| 812 | */ | |
| 811 | Bit 0-7 - Audio channel 2 frequency bit 8-15 | |
| 812 | */ | |
| 813 | 813 | case 0x84: /* Audio 3 freq (lo) |
| 814 | Bit 0-7 - Audio channel 3 frequency bit 0-7 | |
| 815 | */ | |
| 814 | Bit 0-7 - Audio channel 3 frequency bit 0-7 | |
| 815 | */ | |
| 816 | 816 | case 0x85: /* Audio 3 freq (hi) |
| 817 | Bit 0-7 - Audio channel 3 frequency bit 8-15 | |
| 818 | */ | |
| 817 | Bit 0-7 - Audio channel 3 frequency bit 8-15 | |
| 818 | */ | |
| 819 | 819 | case 0x86: /* Audio 4 freq (lo) |
| 820 | Bit 0-7 - Audio channel 4 frequency bit 0-7 | |
| 821 | */ | |
| 820 | Bit 0-7 - Audio channel 4 frequency bit 0-7 | |
| 821 | */ | |
| 822 | 822 | case 0x87: /* Audio 4 freq (hi) |
| 823 | Bit 0-7 - Audio channel 4 frequency bit 8-15 | |
| 824 | */ | |
| 823 | Bit 0-7 - Audio channel 4 frequency bit 8-15 | |
| 824 | */ | |
| 825 | 825 | case 0x88: /* Audio 1 volume |
| 826 | Bit 0-3 - Right volume audio channel 1 | |
| 827 | Bit 4-7 - Left volume audio channel 1 | |
| 828 | */ | |
| 826 | Bit 0-3 - Right volume audio channel 1 | |
| 827 | Bit 4-7 - Left volume audio channel 1 | |
| 828 | */ | |
| 829 | 829 | case 0x89: /* Audio 2 volume |
| 830 | Bit 0-3 - Right volume audio channel 2 | |
| 831 | Bit 4-7 - Left volume audio channel 2 | |
| 832 | */ | |
| 830 | Bit 0-3 - Right volume audio channel 2 | |
| 831 | Bit 4-7 - Left volume audio channel 2 | |
| 832 | */ | |
| 833 | 833 | case 0x8A: /* Audio 3 volume |
| 834 | Bit 0-3 - Right volume audio channel 3 | |
| 835 | Bit 4-7 - Left volume audio channel 3 | |
| 836 | */ | |
| 834 | Bit 0-3 - Right volume audio channel 3 | |
| 835 | Bit 4-7 - Left volume audio channel 3 | |
| 836 | */ | |
| 837 | 837 | case 0x8B: /* Audio 4 volume |
| 838 | Bit 0-3 - Right volume audio channel 4 | |
| 839 | Bit 4-7 - Left volume audio channel 4 | |
| 840 | */ | |
| 838 | Bit 0-3 - Right volume audio channel 4 | |
| 839 | Bit 4-7 - Left volume audio channel 4 | |
| 840 | */ | |
| 841 | 841 | case 0x8C: /* Sweep step |
| 842 | Bit 0-7 - Sweep step | |
| 843 | */ | |
| 842 | Bit 0-7 - Sweep step | |
| 843 | */ | |
| 844 | 844 | case 0x8D: /* Sweep time |
| 845 | Bit 0-7 - Sweep time | |
| 846 | */ | |
| 845 | Bit 0-7 - Sweep time | |
| 846 | */ | |
| 847 | 847 | case 0x8E: /* Noise control |
| 848 | Bit 0-2 - Noise generator type | |
| 849 | Bit 3 - Reset | |
| 850 | Bit 4 - Enable | |
| 851 | Bit 5-7 - Unknown | |
| 852 | */ | |
| 848 | Bit 0-2 - Noise generator type | |
| 849 | Bit 3 - Reset | |
| 850 | Bit 4 - Enable | |
| 851 | Bit 5-7 - Unknown | |
| 852 | */ | |
| 853 | 853 | case 0x8F: /* Sample location |
| 854 | Bit 0-7 - Sample address location 0 00xxxxxx xx000000 | |
| 855 | */ | |
| 854 | Bit 0-7 - Sample address location 0 00xxxxxx xx000000 | |
| 855 | */ | |
| 856 | 856 | case 0x90: /* Audio control |
| 857 | Bit 0 - Audio 1 enable | |
| 858 | Bit 1 - Audio 2 enable | |
| 859 | Bit 2 - Audio 3 enable | |
| 860 | Bit 3 - Audio 4 enable | |
| 861 | Bit 4 - Unknown | |
| 862 | Bit 5 - Audio 2 voice mode enable | |
| 863 | Bit 6 - Audio 3 sweep mode enable | |
| 864 | Bit 7 - Audio 4 noise mode enable | |
| 865 | */ | |
| 857 | Bit 0 - Audio 1 enable | |
| 858 | Bit 1 - Audio 2 enable | |
| 859 | Bit 2 - Audio 3 enable | |
| 860 | Bit 3 - Audio 4 enable | |
| 861 | Bit 4 - Unknown | |
| 862 | Bit 5 - Audio 2 voice mode enable | |
| 863 | Bit 6 - Audio 3 sweep mode enable | |
| 864 | Bit 7 - Audio 4 noise mode enable | |
| 865 | */ | |
| 866 | 866 | case 0x91: /* Audio output |
| 867 | Bit 0 - Mono select | |
| 868 | Bit 1-2 - Output volume | |
| 869 | Bit 3 - External stereo | |
| 870 | Bit 4-6 - Unknown | |
| 871 | Bit 7 - External speaker (Read-only, set by hardware) | |
| 872 | */ | |
| 867 | Bit 0 - Mono select | |
| 868 | Bit 1-2 - Output volume | |
| 869 | Bit 3 - External stereo | |
| 870 | Bit 4-6 - Unknown | |
| 871 | Bit 7 - External speaker (Read-only, set by hardware) | |
| 872 | */ | |
| 873 | 873 | case 0x92: /* Noise counter shift register (lo) |
| 874 | Bit 0-7 - Noise counter shift register bit 0-7 | |
| 875 | */ | |
| 874 | Bit 0-7 - Noise counter shift register bit 0-7 | |
| 875 | */ | |
| 876 | 876 | case 0x93: /* Noise counter shift register (hi) |
| 877 | Bit 0-6 - Noise counter shift register bit 8-14 | |
| 878 | bit 7 - Unknown | |
| 879 | */ | |
| 877 | Bit 0-6 - Noise counter shift register bit 8-14 | |
| 878 | bit 7 - Unknown | |
| 879 | */ | |
| 880 | 880 | case 0x94: /* Master volume |
| 881 | Bit 0-3 - Master volume | |
| 882 | Bit 4-7 - Unknown | |
| 883 | */ | |
| 881 | Bit 0-3 - Master volume | |
| 882 | Bit 4-7 - Unknown | |
| 883 | */ | |
| 884 | 884 | wswan_sound_port_w( space, offset, data ); |
| 885 | 885 | break; |
| 886 | 886 | case 0xa0: /* Hardware type - this is probably read only |
| 887 | Bit 0 - Enable cartridge slot and/or disable bios | |
| 888 | Bit 1 - Hardware type: 0 = WS, 1 = WSC | |
| 889 | Bit 2-7 - Unknown | |
| 890 | */ | |
| 891 | if ( ( data & 0x01 ) && !wswan_bios_disabled ) | |
| 887 | Bit 0 - Enable cartridge slot and/or disable bios | |
| 888 | Bit 1 - Hardware type: 0 = WS, 1 = WSC | |
| 889 | Bit 2-7 - Unknown | |
| 890 | */ | |
| 891 | if ( ( data & 0x01 ) && !wswan_bios_disabled ) | |
| 892 | 892 | { |
| 893 | 893 | wswan_bios_disabled = 1; |
| 894 | 894 | memory_set_bankptr( space->machine, 15, ROMMap[ ( ( ( ws_portram[0xc0] & 0x0F ) << 4 ) | 15 ) & ( ROMBanks - 1 ) ] ); |
| 895 | 895 | } |
| 896 | 896 | break; |
| 897 | 897 | case 0xa2: /* Timer control |
| 898 | Bit 0 - HBlank Timer enable | |
| 899 | Bit 1 - HBlank Timer mode: 0 = one shot, 1 = auto reset | |
| 900 | Bit 2 - VBlank Timer(1/75s) enable | |
| 901 | Bit 3 - VBlank Timer mode: 0 = one shot, 1 = auto reset | |
| 902 | Bit 4-7 - Unknown | |
| 903 | */ | |
| 898 | Bit 0 - HBlank Timer enable | |
| 899 | Bit 1 - HBlank Timer mode: 0 = one shot, 1 = auto reset | |
| 900 | Bit 2 - VBlank Timer(1/75s) enable | |
| 901 | Bit 3 - VBlank Timer mode: 0 = one shot, 1 = auto reset | |
| 902 | Bit 4-7 - Unknown | |
| 903 | */ | |
| 904 | 904 | wswan_vdp.timer_hblank_enable = data & 0x1; |
| 905 | 905 | wswan_vdp.timer_hblank_mode = (data & 0x2) >> 1; |
| 906 | 906 | wswan_vdp.timer_vblank_enable = (data & 0x4) >> 2; |
| 907 | 907 | wswan_vdp.timer_vblank_mode = (data & 0x8) >> 3; |
| 908 | 908 | break; |
| 909 | 909 | case 0xa4: /* HBlank timer frequency (low) - reload value |
| 910 | Bit 0-7 - HBlank timer reload value bit 0-7 | |
| 911 | */ | |
| 910 | Bit 0-7 - HBlank timer reload value bit 0-7 | |
| 911 | */ | |
| 912 | 912 | wswan_vdp.timer_hblank_reload &= 0xff00; |
| 913 | 913 | wswan_vdp.timer_hblank_reload += data; |
| 914 | 914 | wswan_vdp.timer_hblank_count = wswan_vdp.timer_hblank_reload; |
| 915 | 915 | break; |
| 916 | 916 | case 0xa5: /* HBlank timer frequency (high) - reload value |
| 917 | Bit 8-15 - HBlank timer reload value bit 8-15 | |
| 918 | */ | |
| 917 | Bit 8-15 - HBlank timer reload value bit 8-15 | |
| 918 | */ | |
| 919 | 919 | wswan_vdp.timer_hblank_reload &= 0xff; |
| 920 | 920 | wswan_vdp.timer_hblank_reload += data << 8; |
| 921 | 921 | wswan_vdp.timer_hblank_count = wswan_vdp.timer_hblank_reload; |
| 922 | 922 | break; |
| 923 | 923 | case 0xa6: /* VBlank timer frequency (low) - reload value |
| 924 | Bit 0-7 - VBlank timer reload value bit 0-7 | |
| 925 | */ | |
| 924 | Bit 0-7 - VBlank timer reload value bit 0-7 | |
| 925 | */ | |
| 926 | 926 | wswan_vdp.timer_vblank_reload &= 0xff00; |
| 927 | 927 | wswan_vdp.timer_vblank_reload += data; |
| 928 | 928 | wswan_vdp.timer_vblank_count = wswan_vdp.timer_vblank_reload; |
| 929 | 929 | break; |
| 930 | 930 | case 0xa7: /* VBlank timer frequency (high) - reload value |
| 931 | Bit 0-7 - VBlank timer reload value bit 8-15 | |
| 932 | */ | |
| 931 | Bit 0-7 - VBlank timer reload value bit 8-15 | |
| 932 | */ | |
| 933 | 933 | wswan_vdp.timer_vblank_reload &= 0xff; |
| 934 | 934 | wswan_vdp.timer_vblank_reload += data << 8; |
| 935 | 935 | wswan_vdp.timer_vblank_count = wswan_vdp.timer_vblank_reload; |
| 936 | 936 | break; |
| 937 | 937 | case 0xa8: /* HBlank counter (low) |
| 938 | Bit 0-7 - HBlank counter bit 0-7 | |
| 939 | */ | |
| 938 | Bit 0-7 - HBlank counter bit 0-7 | |
| 939 | */ | |
| 940 | 940 | case 0xa9: /* HBlank counter (high) |
| 941 | Bit 0-7 - HBlank counter bit 8-15 | |
| 942 | */ | |
| 941 | Bit 0-7 - HBlank counter bit 8-15 | |
| 942 | */ | |
| 943 | 943 | case 0xaa: /* VBlank counter (low) |
| 944 | Bit 0-7 - VBlank counter bit 0-7 | |
| 945 | */ | |
| 944 | Bit 0-7 - VBlank counter bit 0-7 | |
| 945 | */ | |
| 946 | 946 | case 0xab: /* VBlank counter (high) |
| 947 | Bit 0-7 - VBlank counter bit 8-15 | |
| 948 | */ | |
| 947 | Bit 0-7 - VBlank counter bit 8-15 | |
| 948 | */ | |
| 949 | 949 | break; |
| 950 | 950 | |
| 951 | 951 | case 0xb0: /* Interrupt base vector |
| 952 | Bit 0-7 - Interrupt base vector | |
| 953 | */ | |
| 952 | Bit 0-7 - Interrupt base vector | |
| 953 | */ | |
| 954 | 954 | break; |
| 955 | 955 | case 0xb1: /* Communication byte |
| 956 | Bit 0-7 - Communication byte | |
| 957 | */ | |
| 956 | Bit 0-7 - Communication byte | |
| 957 | */ | |
| 958 | 958 | break; |
| 959 | 959 | case 0xb2: /* Interrupt enable |
| 960 | Bit 0 - Serial transmit interrupt enable | |
| 961 | Bit 1 - Key press interrupt enable | |
| 962 | Bit 2 - RTC alarm interrupt enable | |
| 963 | Bit 3 - Serial receive interrupt enable | |
| 964 | Bit 4 - Drawing line detection interrupt enable | |
| 965 | Bit 5 - VBlank timer interrupt enable | |
| 966 | Bit 6 - VBlank interrupt enable | |
| 967 | Bit 7 - HBlank timer interrupt enable | |
| 968 | */ | |
| 960 | Bit 0 - Serial transmit interrupt enable | |
| 961 | Bit 1 - Key press interrupt enable | |
| 962 | Bit 2 - RTC alarm interrupt enable | |
| 963 | Bit 3 - Serial receive interrupt enable | |
| 964 | Bit 4 - Drawing line detection interrupt enable | |
| 965 | Bit 5 - VBlank timer interrupt enable | |
| 966 | Bit 6 - VBlank interrupt enable | |
| 967 | Bit 7 - HBlank timer interrupt enable | |
| 968 | */ | |
| 969 | 969 | break; |
| 970 | 970 | case 0xb3: /* serial communication control |
| 971 | Bit 0 - Receive complete | |
| 972 | Bit 1 - Error | |
| 973 | Bit 2 - Send complete | |
| 974 | Bit 3-4 - Unknown | |
| 975 | Bit 5 - Send data interrupt generation | |
| 976 | Bit 6 - Connection speed: 0 = 9600 bps, 1 = 38400 bps | |
| 977 | bit 7 - Receive data interrupt generation | |
| 978 | */ | |
| 979 | // data |= 0x02; | |
| 971 | Bit 0 - Receive complete | |
| 972 | Bit 1 - Error | |
| 973 | Bit 2 - Send complete | |
| 974 | Bit 3-4 - Unknown | |
| 975 | Bit 5 - Send data interrupt generation | |
| 976 | Bit 6 - Connection speed: 0 = 9600 bps, 1 = 38400 bps | |
| 977 | bit 7 - Receive data interrupt generation | |
| 978 | */ | |
| 979 | // data |= 0x02; | |
| 980 | 980 | ws_portram[0xb1] = 0xFF; |
| 981 | if ( data & 0x80 ) | |
| 981 | if ( data & 0x80 ) | |
| 982 | 982 | { |
| 983 | // | |
| 983 | // ws_portram[0xb1] = 0x00; | |
| 984 | 984 | data |= 0x04; |
| 985 | 985 | } |
| 986 | if (data & 0x20 ) | |
| 986 | if (data & 0x20 ) | |
| 987 | 987 | { |
| 988 | // | |
| 988 | // data |= 0x01; | |
| 989 | 989 | } |
| 990 | 990 | break; |
| 991 | 991 | case 0xb5: /* Read controls |
| 992 | Bit 0-3 - Current state of input lines (read-only) | |
| 993 | Bit 4-6 - Select line of inputs to read | |
| 994 | 001 - Read Y cursors | |
| 995 | 010 - Read X cursors | |
| 996 | 100 - Read START,A,B buttons | |
| 997 | Bit 7 - Unknown | |
| 998 | */ | |
| 992 | Bit 0-3 - Current state of input lines (read-only) | |
| 993 | Bit 4-6 - Select line of inputs to read | |
| 994 | 001 - Read Y cursors | |
| 995 | 010 - Read X cursors | |
| 996 | 100 - Read START,A,B buttons | |
| 997 | Bit 7 - Unknown | |
| 998 | */ | |
| 999 | 999 | data = data & 0xF0; |
| 1000 | switch( data ) | |
| 1000 | switch( data ) | |
| 1001 | 1001 | { |
| 1002 | 1002 | case 0x10: /* Read Y cursors: Y1 - Y2 - Y3 - Y4 */ |
| 1003 | 1003 | data = data | input_port_read(space->machine, "CURSY"); |
| r5932 | r5933 | |
| 1011 | 1011 | } |
| 1012 | 1012 | break; |
| 1013 | 1013 | case 0xb6: /* Interrupt acknowledge |
| 1014 | Bit 0 - Serial transmit interrupt acknowledge | |
| 1015 | Bit 1 - Key press interrupt acknowledge | |
| 1016 | Bit 2 - RTC alarm interrupt acknowledge | |
| 1017 | Bit 3 - Serial receive interrupt acknowledge | |
| 1018 | Bit 4 - Drawing line detection interrupt acknowledge | |
| 1019 | Bit 5 - VBlank timer interrupt acknowledge | |
| 1020 | Bit 6 - VBlank interrupt acknowledge | |
| 1021 | Bit 7 - HBlank timer interrupt acknowledge | |
| 1022 | */ | |
| 1014 | Bit 0 - Serial transmit interrupt acknowledge | |
| 1015 | Bit 1 - Key press interrupt acknowledge | |
| 1016 | Bit 2 - RTC alarm interrupt acknowledge | |
| 1017 | Bit 3 - Serial receive interrupt acknowledge | |
| 1018 | Bit 4 - Drawing line detection interrupt acknowledge | |
| 1019 | Bit 5 - VBlank timer interrupt acknowledge | |
| 1020 | Bit 6 - VBlank interrupt acknowledge | |
| 1021 | Bit 7 - HBlank timer interrupt acknowledge | |
| 1022 | */ | |
| 1023 | 1023 | wswan_clear_irq_line( space->machine, data ); |
| 1024 | 1024 | data = ws_portram[0xB6]; |
| 1025 | 1025 | break; |
| 1026 | 1026 | case 0xba: /* Internal EEPROM data (low) |
| 1027 | Bit 0-7 - Internal EEPROM data transfer bit 0-7 | |
| 1028 | */ | |
| 1027 | Bit 0-7 - Internal EEPROM data transfer bit 0-7 | |
| 1028 | */ | |
| 1029 | 1029 | case 0xbb: /* Internal EEPROM data (high) |
| 1030 | Bit 0-7 - Internal EEPROM data transfer bit 8-15 | |
| 1031 | */ | |
| 1030 | Bit 0-7 - Internal EEPROM data transfer bit 8-15 | |
| 1031 | */ | |
| 1032 | 1032 | break; |
| 1033 | 1033 | case 0xbc: /* Internal EEPROM address (low) |
| 1034 | Bit 0-7 - Internal EEPROM address bit 1-8 | |
| 1035 | */ | |
| 1034 | Bit 0-7 - Internal EEPROM address bit 1-8 | |
| 1035 | */ | |
| 1036 | 1036 | case 0xbd: /* Internal EEPROM address (high) |
| 1037 | Bit 0 - Internal EEPROM address bit 9(?) | |
| 1038 | Bit 1-7 - Unknown | |
| 1039 | Only 1KByte internal EEPROM?? | |
| 1040 | */ | |
| 1037 | Bit 0 - Internal EEPROM address bit 9(?) | |
| 1038 | Bit 1-7 - Unknown | |
| 1039 | Only 1KByte internal EEPROM?? | |
| 1040 | */ | |
| 1041 | 1041 | break; |
| 1042 | 1042 | case 0xbe: /* Internal EEPROM command |
| 1043 | Bit 0 - Read complete (read only) | |
| 1044 | Bit 1 - Write complete (read only) | |
| 1045 | Bit 2-3 - Unknown | |
| 1046 | Bit 4 - Read | |
| 1047 | Bit 5 - Write | |
| 1048 | Bit 6 - Protect | |
| 1049 | Bit 7 - Initialize | |
| 1050 | */ | |
| 1051 | if ( data & 0x20 ) | |
| 1043 | Bit 0 - Read complete (read only) | |
| 1044 | Bit 1 - Write complete (read only) | |
| 1045 | Bit 2-3 - Unknown | |
| 1046 | Bit 4 - Read | |
| 1047 | Bit 5 - Write | |
| 1048 | Bit 6 - Protect | |
| 1049 | Bit 7 - Initialize | |
| 1050 | */ | |
| 1051 | if ( data & 0x20 ) | |
| 1052 | 1052 | { |
| 1053 | 1053 | UINT16 addr = ( ( ( ws_portram[0xbd] << 8 ) | ws_portram[0xbc] ) << 1 ) & 0x1FF; |
| 1054 | 1054 | internal_eeprom[ addr ] = ws_portram[0xba]; |
| 1055 | 1055 | internal_eeprom[ addr + 1 ] = ws_portram[0xbb]; |
| 1056 | 1056 | data |= 0x02; |
| 1057 | } | |
| 1058 | else if ( data & 0x10 ) | |
| 1057 | } | |
| 1058 | else if ( data & 0x10 ) | |
| 1059 | 1059 | { |
| 1060 | 1060 | UINT16 addr = ( ( ( ws_portram[0xbd] << 8 ) | ws_portram[0xbc] ) << 1 ) & 0x1FF; |
| 1061 | 1061 | ws_portram[0xba] = internal_eeprom[ addr ]; |
| 1062 | 1062 | ws_portram[0xbb] = internal_eeprom[ addr + 1]; |
| 1063 | 1063 | data |= 0x01; |
| 1064 | } | |
| 1065 | else | |
| 1064 | } | |
| 1065 | else | |
| 1066 | 1066 | { |
| 1067 | 1067 | logerror( "Unsupported internal EEPROM command: %X\n", data ); |
| 1068 | 1068 | } |
| 1069 | 1069 | break; |
| 1070 | 1070 | case 0xc0: /* ROM bank select for banks 4-15 |
| 1071 | Bit 0-3 - ROM bank base register for banks 4-15 | |
| 1072 | Bit 4-7 - Unknown | |
| 1073 | */ | |
| 1071 | Bit 0-3 - ROM bank base register for banks 4-15 | |
| 1072 | Bit 4-7 - Unknown | |
| 1073 | */ | |
| 1074 | 1074 | memory_set_bankptr( space->machine, 4, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 4 ) & ( ROMBanks - 1 ) ] ); |
| 1075 | 1075 | memory_set_bankptr( space->machine, 5, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 5 ) & ( ROMBanks - 1 ) ] ); |
| 1076 | 1076 | memory_set_bankptr( space->machine, 6, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 6 ) & ( ROMBanks - 1 ) ] ); |
| r5932 | r5933 | |
| 1082 | 1082 | memory_set_bankptr( space->machine, 12, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 12 ) & ( ROMBanks - 1 ) ] ); |
| 1083 | 1083 | memory_set_bankptr( space->machine, 13, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 13 ) & ( ROMBanks - 1 ) ] ); |
| 1084 | 1084 | memory_set_bankptr( space->machine, 14, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 14 ) & ( ROMBanks - 1 ) ] ); |
| 1085 | if ( wswan_bios_disabled ) | |
| 1085 | if ( wswan_bios_disabled ) | |
| 1086 | 1086 | { |
| 1087 | 1087 | memory_set_bankptr( space->machine, 15, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 15 ) & ( ROMBanks - 1 ) ] ); |
| 1088 | 1088 | } |
| 1089 | 1089 | break; |
| 1090 | 1090 | case 0xc1: /* SRAM bank select |
| 1091 | Bit 0-7 - SRAM bank to select | |
| 1092 | */ | |
| 1093 | if ( eeprom.mode == SRAM_64K || eeprom.mode == SRAM_256K || eeprom.mode == SRAM_512K || eeprom.mode == SRAM_1M || eeprom.mode == SRAM_2M ) | |
| 1091 | Bit 0-7 - SRAM bank to select | |
| 1092 | */ | |
| 1093 | if ( eeprom.mode == SRAM_64K || eeprom.mode == SRAM_256K || eeprom.mode == SRAM_512K || eeprom.mode == SRAM_1M || eeprom.mode == SRAM_2M ) | |
| 1094 | 1094 | { |
| 1095 | 1095 | eeprom.page = &eeprom.data[ ( data * 64 * 1024 ) & ( eeprom.size - 1 ) ]; |
| 1096 | 1096 | } |
| 1097 | 1097 | break; |
| 1098 | 1098 | case 0xc2: /* ROM bank select for segment 2 (0x20000 - 0x2ffff) |
| 1099 | Bit 0-7 - ROM bank for segment 2 | |
| 1100 | */ | |
| 1099 | Bit 0-7 - ROM bank for segment 2 | |
| 1100 | */ | |
| 1101 | 1101 | memory_set_bankptr( space->machine, 2, ROMMap[ data & ( ROMBanks - 1 ) ]); |
| 1102 | 1102 | break; |
| 1103 | 1103 | case 0xc3: /* ROM bank select for segment 3 (0x30000-0x3ffff) |
| 1104 | Bit 0-7 - ROM bank for segment 3 | |
| 1105 | */ | |
| 1104 | Bit 0-7 - ROM bank for segment 3 | |
| 1105 | */ | |
| 1106 | 1106 | memory_set_bankptr( space->machine, 3, ROMMap[ data & ( ROMBanks - 1 ) ]); |
| 1107 | 1107 | break; |
| 1108 | 1108 | case 0xc6: /* EEPROM address lower bits port/EEPROM address and command port |
| 1109 | 1KBit EEPROM: | |
| 1110 | Bit 0-5 - EEPROM address bit 1-6 | |
| 1111 | Bit 6-7 - Command | |
| 1112 | 00 - Extended command address bit 4-5: | |
| 1113 | 00 - Write disable | |
| 1114 | 01 - Write all | |
| 1115 | 10 - Erase all | |
| 1116 | 11 - Write enable | |
| 1117 | 01 - Write | |
| 1118 | 10 - Read | |
| 1119 | 11 - Erase | |
| 1120 | 16KBit EEPROM: | |
| 1121 | Bit 0-7 - EEPROM address bit 1-8 | |
| 1122 | */ | |
| 1123 | switch( eeprom.mode ) | |
| 1109 | 1KBit EEPROM: | |
| 1110 | Bit 0-5 - EEPROM address bit 1-6 | |
| 1111 | Bit 6-7 - Command | |
| 1112 | 00 - Extended command address bit 4-5: | |
| 1113 | 00 - Write disable | |
| 1114 | 01 - Write all | |
| 1115 | 10 - Erase all | |
| 1116 | 11 - Write enable | |
| 1117 | 01 - Write | |
| 1118 | 10 - Read | |
| 1119 | 11 - Erase | |
| 1120 | 16KBit EEPROM: | |
| 1121 | Bit 0-7 - EEPROM address bit 1-8 | |
| 1122 | */ | |
| 1123 | switch( eeprom.mode ) | |
| 1124 | 1124 | { |
| 1125 | 1125 | case EEPROM_1K: |
| 1126 | 1126 | eeprom.address = data & 0x3F; |
| 1127 | 1127 | eeprom.command = data >> 4; |
| 1128 | if ( ( eeprom.command & 0x0C ) != 0x00 ) | |
| 1128 | if ( ( eeprom.command & 0x0C ) != 0x00 ) | |
| 1129 | 1129 | { |
| 1130 | 1130 | eeprom.command = eeprom.command & 0x0C; |
| 1131 | 1131 | } |
| r5932 | r5933 | |
| 1139 | 1139 | } |
| 1140 | 1140 | break; |
| 1141 | 1141 | case 0xc7: /* EEPROM higher bits/command bits port |
| 1142 | 1KBit EEPROM: | |
| 1143 | Bit 0 - Start | |
| 1144 | Bit 1-7 - Unknown | |
| 1145 | 16KBit EEPROM: | |
| 1146 | Bit 0-1 - EEPROM address bit 9-10 | |
| 1147 | Bit 2-3 - Command | |
| 1148 | 00 - Extended command address bit 0-1: | |
| 1149 | 00 - Write disable | |
| 1150 | 01 - Write all | |
| 1151 | 10 - Erase all | |
| 1152 | 11 - Write enable | |
| 1153 | 01 - Write | |
| 1154 | 10 - Read | |
| 1155 | 11 - Erase | |
| 1156 | Bit 4 - Start | |
| 1157 | Bit 5-7 - Unknown | |
| 1158 | */ | |
| 1142 | 1KBit EEPROM: | |
| 1143 | Bit 0 - Start | |
| 1144 | Bit 1-7 - Unknown | |
| 1145 | 16KBit EEPROM: | |
| 1146 | Bit 0-1 - EEPROM address bit 9-10 | |
| 1147 | Bit 2-3 - Command | |
| 1148 | 00 - Extended command address bit 0-1: | |
| 1149 | 00 - Write disable | |
| 1150 | 01 - Write all | |
| 1151 | 10 - Erase all | |
| 1152 | 11 - Write enable | |
| 1153 | 01 - Write | |
| 1154 | 10 - Read | |
| 1155 | 11 - Erase | |
| 1156 | Bit 4 - Start | |
| 1157 | Bit 5-7 - Unknown | |
| 1158 | */ | |
| 1159 | 1159 | switch( eeprom.mode ) |
| 1160 | 1160 | { |
| 1161 | 1161 | case EEPROM_1K: |
| r5932 | r5933 | |
| 1164 | 1164 | case EEPROM_16K: |
| 1165 | 1165 | eeprom.address = ( ( data & 0x03 ) << 8 ) | ( eeprom.address & 0xFF ); |
| 1166 | 1166 | eeprom.command = data & 0x0F; |
| 1167 | if ( ( eeprom.command & 0x0C ) != 0x00 ) | |
| 1167 | if ( ( eeprom.command & 0x0C ) != 0x00 ) | |
| 1168 | 1168 | { |
| 1169 | 1169 | eeprom.command = eeprom.command & 0x0C; |
| 1170 | 1170 | } |
| r5932 | r5933 | |
| 1176 | 1176 | } |
| 1177 | 1177 | break; |
| 1178 | 1178 | case 0xc8: /* EEPROM command |
| 1179 | Bit 0 - Read complete (read only) | |
| 1180 | Bit 1 - Write complete (read only) | |
| 1181 | Bit 2-3 - Unknown | |
| 1182 | Bit 4 - Read | |
| 1183 | Bit 5 - Write | |
| 1184 | Bit 6 - Protect | |
| 1185 | Bit 7 - Initialize | |
| 1186 | */ | |
| 1187 | if ( eeprom.mode == EEPROM_1K || eeprom.mode == EEPROM_16K ) | |
| 1179 | Bit 0 - Read complete (read only) | |
| 1180 | Bit 1 - Write complete (read only) | |
| 1181 | Bit 2-3 - Unknown | |
| 1182 | Bit 4 - Read | |
| 1183 | Bit 5 - Write | |
| 1184 | Bit 6 - Protect | |
| 1185 | Bit 7 - Initialize | |
| 1186 | */ | |
| 1187 | if ( eeprom.mode == EEPROM_1K || eeprom.mode == EEPROM_16K ) | |
| 1188 | 1188 | { |
| 1189 | if ( data & 0x80 ) | |
| 1189 | if ( data & 0x80 ) | |
| 1190 | 1190 | { /* Initialize */ |
| 1191 | 1191 | logerror( "Unsupported EEPROM command 'Initialize'\n" ); |
| 1192 | 1192 | } |
| 1193 | if ( data & 0x40 ) | |
| 1193 | if ( data & 0x40 ) | |
| 1194 | 1194 | { /* Protect */ |
| 1195 | switch( eeprom.command ) | |
| 1195 | switch( eeprom.command ) | |
| 1196 | 1196 | { |
| 1197 | 1197 | case 0x00: |
| 1198 | 1198 | eeprom.write_enabled = 0; |
| r5932 | r5933 | |
| 1206 | 1206 | logerror( "Unsupported 'Protect' command %X\n", eeprom.command ); |
| 1207 | 1207 | } |
| 1208 | 1208 | } |
| 1209 | if ( data & 0x20 ) | |
| 1209 | if ( data & 0x20 ) | |
| 1210 | 1210 | { /* Write */ |
| 1211 | if ( eeprom.write_enabled ) | |
| 1211 | if ( eeprom.write_enabled ) | |
| 1212 | 1212 | { |
| 1213 | switch( eeprom.command ) | |
| 1213 | switch( eeprom.command ) | |
| 1214 | 1214 | { |
| 1215 | 1215 | case 0x04: |
| 1216 | 1216 | eeprom.data[ ( eeprom.address << 1 ) + 1 ] = ws_portram[0xc4]; |
| r5932 | r5933 | |
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| 1224 | 1224 | } |
| 1225 | if ( data & 0x10 ) | |
| 1225 | if ( data & 0x10 ) | |
| 1226 | 1226 | { /* Read */ |
| 1227 | 1227 | ws_portram[0xc4] = eeprom.data[ ( eeprom.address << 1 ) + 1 ]; |
| 1228 | 1228 | ws_portram[0xc5] = eeprom.data[ eeprom.address << 1 ]; |
| 1229 | 1229 | data |= 0x01; |
| 1230 | 1230 | } |
| 1231 | } | |
| 1232 | else | |
| 1231 | } | |
| 1232 | else | |
| 1233 | 1233 | { |
| 1234 | 1234 | logerror( "EEPROM command for unknown EEPROM type\n" ); |
| 1235 | 1235 | } |
| 1236 | 1236 | break; |
| 1237 | 1237 | case 0xca: /* RTC Command |
| 1238 | Bit 0-4 - RTC command | |
| 1239 | 10000 - Reset | |
| 1240 | 10010 - Write timer settings (alarm) | |
| 1241 | 10011 - Read timer settings (alarm) | |
| 1242 | 10100 - Set time/date | |
| 1243 | 10101 - Get time/date | |
| 1244 | Bit 5-6 - Unknown | |
| 1245 | Bit 7 - Command done (read only) | |
| 1246 | */ | |
| 1247 | switch( data ) | |
| 1238 | Bit 0-4 - RTC command | |
| 1239 | 10000 - Reset | |
| 1240 | 10010 - Write timer settings (alarm) | |
| 1241 | 10011 - Read timer settings (alarm) | |
| 1242 | 10100 - Set time/date | |
| 1243 | 10101 - Get time/date | |
| 1244 | Bit 5-6 - Unknown | |
| 1245 | Bit 7 - Command done (read only) | |
| 1246 | */ | |
| 1247 | switch( data ) | |
| 1248 | 1248 | { |
| 1249 | 1249 | case 0x10: /* Reset */ |
| 1250 | 1250 | rtc.index = 8; |
| r5932 | r5933 | |
| 1283 | 1283 | } |
| 1284 | 1284 | break; |
| 1285 | 1285 | case 0xcb: /* RTC Data */ |
| 1286 | if ( ws_portram[0xca] == 0x94 && rtc.index < 7 ) | |
| 1286 | if ( ws_portram[0xca] == 0x94 && rtc.index < 7 ) | |
| 1287 | 1287 | { |
| 1288 | switch( rtc.index ) | |
| 1288 | switch( rtc.index ) | |
| 1289 | 1289 | { |
| 1290 | 1290 | case 0: rtc.year = data; break; |
| 1291 | 1291 | case 1: rtc.month = data; break; |
| r5932 | r5933 | |
| 1307 | 1307 | ws_portram[offset] = data; |
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | static const char* wswan_determine_sram( UINT8 data ) | |
| 1310 | static const char* wswan_determine_sram( UINT8 data ) | |
| 1311 | 1311 | { |
| 1312 | 1312 | eeprom.write_enabled = 0; |
| 1313 | 1313 | eeprom.mode = SRAM_UNKNOWN; |
| 1314 | switch( data ) | |
| 1314 | switch( data ) | |
| 1315 | 1315 | { |
| 1316 | 1316 | case 0x00: eeprom.mode = SRAM_NONE; break; |
| 1317 | 1317 | case 0x01: eeprom.mode = SRAM_64K; break; |
| r5932 | r5933 | |
| 1335 | 1335 | |
| 1336 | 1336 | static const char* wswan_determine_romsize( UINT8 data ) |
| 1337 | 1337 | { |
| 1338 | switch( data ) | |
| 1338 | switch( data ) | |
| 1339 | 1339 | { |
| 1340 | 1340 | case 0x02: return wswan_romsize_str[ ROM_4M ]; |
| 1341 | 1341 | case 0x03: return wswan_romsize_str[ ROM_8M ]; |
| r5932 | r5933 | |
| 1410 | 1410 | mame_printf_debug( "\tSRAM size: %s\n", sram_str ); |
| 1411 | 1411 | mame_printf_debug( "\tFeatures: %X\n", ROMMap[ROMBanks-1][0xfffc] ); |
| 1412 | 1412 | mame_printf_debug( "\tRTC: %s\n", ( ROMMap[ROMBanks-1][0xfffd] ? "yes" : "no" ) ); |
| 1413 | for( ii = 0; ii < ROMBanks; ii++ ) | |
| 1413 | for( ii = 0; ii < ROMBanks; ii++ ) | |
| 1414 | 1414 | { |
| 1415 | 1415 | int count; |
| 1416 | for( count = 0; count < 0x10000; count++ ) | |
| 1416 | for( count = 0; count < 0x10000; count++ ) | |
| 1417 | 1417 | { |
| 1418 | 1418 | sum += ROMMap[ii][count]; |
| 1419 | 1419 | } |
| r5932 | r5933 | |
| 1425 | 1425 | } |
| 1426 | 1426 | #endif |
| 1427 | 1427 | |
| 1428 | if ( eeprom.size != 0 ) | |
| 1428 | if ( eeprom.size != 0 ) | |
| 1429 | 1429 | { |
| 1430 | 1430 | eeprom.data = auto_alloc_array(image->machine, UINT8, eeprom.size ); |
| 1431 | 1431 | image_battery_load( image, eeprom.data, eeprom.size ); |
| r5932 | r5933 | |
| 1442 | 1442 | |
| 1443 | 1443 | static TIMER_CALLBACK(wswan_scanline_interrupt) |
| 1444 | 1444 | { |
| 1445 | if( wswan_vdp.current_line < 144 ) | |
| 1445 | if( wswan_vdp.current_line < 144 ) | |
| 1446 | 1446 | { |
| 1447 | 1447 | wswan_refresh_scanline(); |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | 1450 | /* Decrement 12kHz (HBlank) counter */ |
| 1451 | if ( wswan_vdp.timer_hblank_enable && wswan_vdp.timer_hblank_reload != 0 ) | |
| 1451 | if ( wswan_vdp.timer_hblank_enable && wswan_vdp.timer_hblank_reload != 0 ) | |
| 1452 | 1452 | { |
| 1453 | 1453 | wswan_vdp.timer_hblank_count--; |
| 1454 | 1454 | logerror( "timer_hblank_count: %X\n", wswan_vdp.timer_hblank_count ); |
| 1455 | if ( wswan_vdp.timer_hblank_count == 0 ) | |
| 1455 | if ( wswan_vdp.timer_hblank_count == 0 ) | |
| 1456 | 1456 | { |
| 1457 | if ( wswan_vdp.timer_hblank_mode ) | |
| 1457 | if ( wswan_vdp.timer_hblank_mode ) | |
| 1458 | 1458 | { |
| 1459 | 1459 | wswan_vdp.timer_hblank_count = wswan_vdp.timer_hblank_reload; |
| 1460 | } | |
| 1461 | else | |
| 1460 | } | |
| 1461 | else | |
| 1462 | 1462 | { |
| 1463 | 1463 | wswan_vdp.timer_hblank_reload = 0; |
| 1464 | 1464 | } |
| r5932 | r5933 | |
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | 1470 | /* Handle Sound DMA */ |
| 1471 | if ( ( sound_dma.enable & 0x88 ) == 0x80 ) | |
| 1471 | if ( ( sound_dma.enable & 0x88 ) == 0x80 ) | |
| 1472 | 1472 | { |
| 1473 | 1473 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM ); |
| 1474 | 1474 | /* TODO: Output sound DMA byte */ |
| 1475 | 1475 | wswan_port_w( space, 0x89, memory_read_byte(space, sound_dma.source ) ); |
| 1476 | 1476 | sound_dma.size--; |
| 1477 | 1477 | sound_dma.source = ( sound_dma.source + 1 ) & 0x0FFFFF; |
| 1478 | if ( sound_dma.size == 0 ) | |
| 1478 | if ( sound_dma.size == 0 ) | |
| 1479 | 1479 | { |
| 1480 | 1480 | sound_dma.enable &= 0x7F; |
| 1481 | 1481 | } |
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | // | |
| 1484 | // wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159; | |
| 1485 | 1485 | |
| 1486 | if( wswan_vdp.current_line == 144 ) | |
| 1486 | if( wswan_vdp.current_line == 144 ) | |
| 1487 | 1487 | { |
| 1488 | 1488 | wswan_set_irq_line( machine, WSWAN_IFLAG_VBL ); |
| 1489 | 1489 | /* Decrement 75Hz (VBlank) counter */ |
| 1490 | if ( wswan_vdp.timer_vblank_enable && wswan_vdp.timer_vblank_reload != 0 ) | |
| 1490 | if ( wswan_vdp.timer_vblank_enable && wswan_vdp.timer_vblank_reload != 0 ) | |
| 1491 | 1491 | { |
| 1492 | 1492 | wswan_vdp.timer_vblank_count--; |
| 1493 | 1493 | logerror( "timer_vblank_count: %X\n", wswan_vdp.timer_vblank_count ); |
| 1494 | if ( wswan_vdp.timer_vblank_count == 0 ) | |
| 1494 | if ( wswan_vdp.timer_vblank_count == 0 ) | |
| 1495 | 1495 | { |
| 1496 | if ( wswan_vdp.timer_vblank_mode ) | |
| 1496 | if ( wswan_vdp.timer_vblank_mode ) | |
| 1497 | 1497 | { |
| 1498 | 1498 | wswan_vdp.timer_vblank_count = wswan_vdp.timer_vblank_reload; |
| 1499 | } | |
| 1500 | else | |
| 1499 | } | |
| 1500 | else | |
| 1501 | 1501 | { |
| 1502 | 1502 | wswan_vdp.timer_vblank_reload = 0; |
| 1503 | 1503 | } |
| r5932 | r5933 | |
| 1507 | 1507 | } |
| 1508 | 1508 | } |
| 1509 | 1509 | |
| 1510 | // | |
| 1510 | // wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159; | |
| 1511 | 1511 | |
| 1512 | if ( wswan_vdp.current_line == wswan_vdp.line_compare ) | |
| 1512 | if ( wswan_vdp.current_line == wswan_vdp.line_compare ) | |
| 1513 | 1513 | { |
| 1514 | 1514 | wswan_set_irq_line( machine, WSWAN_IFLAG_LCMP ); |
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159; |
| 1518 | 1518 | |
| 1519 | if ( wswan_vdp.current_line == 0 ) | |
| 1519 | if ( wswan_vdp.current_line == 0 ) | |
| 1520 | 1520 | { |
| 1521 | if ( wswan_vdp.display_vertical != wswan_vdp.new_display_vertical ) | |
| 1521 | if ( wswan_vdp.display_vertical != wswan_vdp.new_display_vertical ) | |
| 1522 | 1522 | { |
| 1523 | 1523 | wswan_vdp.display_vertical = wswan_vdp.new_display_vertical; |
| 1524 | if ( wswan_vdp.display_vertical ) | |
| 1524 | if ( wswan_vdp.display_vertical ) | |
| 1525 | 1525 | { |
| 1526 | 1526 | video_screen_set_visarea( machine->primary_screen, 5*8, 5*8 + WSWAN_Y_PIXELS - 1, 0, WSWAN_X_PIXELS - 1 ); |
| 1527 | } | |
| 1528 | else | |
| 1527 | } | |
| 1528 | else | |
| 1529 | 1529 | { |
| 1530 | 1530 | video_screen_set_visarea( machine->primary_screen, 0, WSWAN_X_PIXELS - 1, 5*8, 5*8 + WSWAN_Y_PIXELS - 1 ); |
| 1531 | 1531 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | zx.c | |
| 3 | 3 | |
| 4 | 4 | machine driver |
| 5 | ||
| 5 | Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999 | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 25 | 25 | |
| 26 | 26 | static WRITE8_HANDLER( zx_ram_w ) |
| 27 | 27 | { |
| 28 | UINT8 *RAM = memory_region(space->machine, "maincpu"); | |
| 28 | UINT8 *RAM = memory_region(space->machine, "maincpu"); | |
| 29 | 29 | RAM[offset + 0x4000] = data; |
| 30 | 30 | |
| 31 | 31 | if (data & 0x40) |
| r5932 | r5933 | |
| 43 | 43 | /* I know this looks really pointless... but it has to be here */ |
| 44 | 44 | READ8_HANDLER( zx_ram_r ) |
| 45 | 45 | { |
| 46 | UINT8 *RAM = memory_region(space->machine, "maincpu"); | |
| 46 | UINT8 *RAM = memory_region(space->machine, "maincpu"); | |
| 47 | 47 | return RAM[offset | 0xc000]; |
| 48 | 48 | } |
| 49 | 49 | |
| r5932 | r5933 | |
| 102 | 102 | READ8_HANDLER ( zx80_io_r ) |
| 103 | 103 | { |
| 104 | 104 | /* port FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out |
| 105 | ||
| 105 | The upper 8 bits are used to select a keyboard scan line | |
| 106 | 106 | |
| 107 | ||
| 107 | The diode doesn't make any visual difference, but it's in the schematic, and used by the code. */ | |
| 108 | 108 | |
| 109 | 109 | UINT8 data = 0xff; |
| 110 | 110 | UINT8 offs = offset & 0xff; |
| r5932 | r5933 | |
| 138 | 138 | zx_ula_bkgnd(space->machine, 0); |
| 139 | 139 | ula_irq_active = 0; |
| 140 | 140 | |
| 141 | // | |
| 141 | // LOG_ZX81_IOR("ULA IRQs off"); | |
| 142 | 142 | } |
| 143 | // else | |
| 144 | // { | |
| 143 | // else | |
| 144 | // { | |
| 145 | 145 | if ((cassette_input(devtag_get_device(space->machine, "cassette")) < -0.75) && zx_tape_bit) |
| 146 | 146 | { |
| 147 | 147 | zx_tape_bit = 0x00; |
| r5932 | r5933 | |
| 150 | 150 | |
| 151 | 151 | data &= ~zx_tape_bit; |
| 152 | 152 | |
| 153 | // LOG_ZX81_IOR("Tape"); | |
| 154 | // } | |
| 153 | // LOG_ZX81_IOR("Tape"); | |
| 154 | // } | |
| 155 | 155 | if (ula_frame_vsync == 3) |
| 156 | 156 | { |
| 157 | 157 | ula_frame_vsync = 2; |
| 158 | // | |
| 158 | // LOG_ZX81_VSYNC; | |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | else |
| r5932 | r5933 | |
| 167 | 167 | READ8_HANDLER ( zx81_io_r ) |
| 168 | 168 | { |
| 169 | 169 | /* port FB = read printer status, not emulated |
| 170 | FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out | |
| 171 | The upper 8 bits are used to select a keyboard scan line */ | |
| 170 | FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out | |
| 171 | The upper 8 bits are used to select a keyboard scan line */ | |
| 172 | 172 | |
| 173 | 173 | UINT8 data = 0xff; |
| 174 | 174 | UINT8 offs = offset & 0xff; |
| r5932 | r5933 | |
| 202 | 202 | zx_ula_bkgnd(space->machine, 0); |
| 203 | 203 | ula_irq_active = 0; |
| 204 | 204 | |
| 205 | // | |
| 205 | // LOG_ZX81_IOR("ULA IRQs off"); | |
| 206 | 206 | } |
| 207 | 207 | else |
| 208 | 208 | { |
| r5932 | r5933 | |
| 214 | 214 | |
| 215 | 215 | data &= ~zx_tape_bit; |
| 216 | 216 | |
| 217 | // | |
| 217 | // LOG_ZX81_IOR("Tape"); | |
| 218 | 218 | } |
| 219 | 219 | if (ula_frame_vsync == 3) |
| 220 | 220 | { |
| 221 | 221 | ula_frame_vsync = 2; |
| 222 | // | |
| 222 | // LOG_ZX81_VSYNC; | |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | else |
| r5932 | r5933 | |
| 231 | 231 | READ8_HANDLER ( pc8300_io_r ) |
| 232 | 232 | { |
| 233 | 233 | /* port F5 = sound |
| 234 | F6 = unknown | |
| 235 | FB = read printer status, not emulated | |
| 236 | FE = read keyboard and cass bit; turn off HSYNC-generator/cass-out | |
| 237 | The upper 8 bits are used to select a keyboard scan line. | |
| 238 | No TV diode */ | |
| 234 | F6 = unknown | |
| 235 | FB = read printer status, not emulated | |
| 236 | FE = read keyboard and cass bit; turn off HSYNC-generator/cass-out | |
| 237 | The upper 8 bits are used to select a keyboard scan line. | |
| 238 | No TV diode */ | |
| 239 | 239 | |
| 240 | 240 | UINT8 data = 0xff; |
| 241 | 241 | UINT8 offs = offset & 0xff; |
| r5932 | r5933 | |
| 274 | 274 | zx_ula_bkgnd(space->machine, 0); |
| 275 | 275 | ula_irq_active = 0; |
| 276 | 276 | |
| 277 | // | |
| 277 | // LOG_ZX81_IOR("ULA IRQs off"); | |
| 278 | 278 | } |
| 279 | 279 | else |
| 280 | 280 | { |
| r5932 | r5933 | |
| 286 | 286 | |
| 287 | 287 | data &= ~zx_tape_bit; |
| 288 | 288 | |
| 289 | // | |
| 289 | // LOG_ZX81_IOR("Tape"); | |
| 290 | 290 | } |
| 291 | 291 | if (ula_frame_vsync == 3) |
| 292 | 292 | { |
| 293 | 293 | ula_frame_vsync = 2; |
| 294 | // | |
| 294 | // LOG_ZX81_VSYNC; | |
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | else |
| r5932 | r5933 | |
| 303 | 303 | READ8_HANDLER ( pow3000_io_r ) |
| 304 | 304 | { |
| 305 | 305 | /* port 7E = read NTSC/PAL diode |
| 306 | F5 = sound | |
| 307 | F6 = unknown | |
| 308 | FB = read printer status, not emulated | |
| 309 | FE = read keyboard and cass bit; turn off HSYNC-generator/cass-out | |
| 310 | The upper 8 bits are used to select a keyboard scan line */ | |
| 306 | F5 = sound | |
| 307 | F6 = unknown | |
| 308 | FB = read printer status, not emulated | |
| 309 | FE = read keyboard and cass bit; turn off HSYNC-generator/cass-out | |
| 310 | The upper 8 bits are used to select a keyboard scan line */ | |
| 311 | 311 | |
| 312 | 312 | UINT8 data = 0xff; |
| 313 | 313 | UINT8 offs = offset & 0xff; |
| r5932 | r5933 | |
| 362 | 362 | |
| 363 | 363 | data &= ~zx_tape_bit; |
| 364 | 364 | |
| 365 | // | |
| 365 | // LOG_ZX81_IOR("Tape"); | |
| 366 | 366 | } |
| 367 | 367 | if (ula_frame_vsync == 3) |
| 368 | 368 | { |
| 369 | 369 | ula_frame_vsync = 2; |
| 370 | // | |
| 370 | // LOG_ZX81_VSYNC; | |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | else |
| r5932 | r5933 | |
| 379 | 379 | WRITE8_HANDLER( zx80_io_w ) |
| 380 | 380 | { |
| 381 | 381 | /* port FF = write HSYNC and cass data */ |
| 382 | ||
| 382 | ||
| 383 | 383 | UINT8 offs = offset & 0xff; |
| 384 | 384 | |
| 385 | 385 | if (offs == 0xff) |
| r5932 | r5933 | |
| 391 | 391 | WRITE8_HANDLER ( zx81_io_w ) |
| 392 | 392 | { |
| 393 | 393 | /* port F5 = unknown, pc8300/pow3000/lambda only |
| 394 | F6 = unknown, pc8300/pow3000/lambda only | |
| 395 | FB = write data to printer, not emulated | |
| 396 | FD = turn off NMI generator | |
| 397 | FE = turn on NMI generator | |
| 398 | FF = write HSYNC and cass data */ | |
| 394 | F6 = unknown, pc8300/pow3000/lambda only | |
| 395 | FB = write data to printer, not emulated | |
| 396 | FD = turn off NMI generator | |
| 397 | FE = turn on NMI generator | |
| 398 | FF = write HSYNC and cass data */ | |
| 399 | 399 | |
| 400 | 400 | const device_config *screen = video_screen_first(space->machine->config); |
| 401 | 401 | int height = video_screen_get_height(screen); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * machine/ps2.c |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * IBM Personal System 2 |
| 6 | 6 | * |
| 7 | 7 | ****************************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/nec765.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Functions to emulate a NEC765/Intel 8272 compatible floppy disk controller | |
| 6 | 6 | |
| 7 | ||
| 7 | Code by Kevin Thacker. | |
| 8 | 8 | |
| 9 | ||
| 9 | TODO: | |
| 10 | 10 | |
| 11 | 11 | - overrun condition |
| 12 | - Scan Commands | |
| 13 | - crc error in id field and crc error in data field errors | |
| 14 | - disc not present, and no sectors on track for data, deleted data, write, write deleted, | |
| 15 | read a track etc | |
| 12 | - Scan Commands | |
| 13 | - crc error in id field and crc error in data field errors | |
| 14 | - disc not present, and no sectors on track for data, deleted data, write, write deleted, | |
| 15 | read a track etc | |
| 16 | 16 | - end of cylinder condition - almost working, needs fixing with |
| 17 | 17 | PCW and PC drivers |
| 18 | - resolve "ready" state stuff (ready state when reset for PC, ready state change while processing command AND | |
| 19 | while idle) | |
| 18 | - resolve "ready" state stuff (ready state when reset for PC, ready state change while processing command AND | |
| 19 | while idle) | |
| 20 | 20 | |
| 21 | 21 | ***************************************************************************/ |
| 22 | 22 | |
| r5932 | r5933 | |
| 118 | 118 | |
| 119 | 119 | unsigned int ncn; |
| 120 | 120 | |
| 121 | // | |
| 121 | // unsigned int nec765_id_index; | |
| 122 | 122 | char *execution_phase_data; |
| 123 | 123 | unsigned int nec765_flags; |
| 124 | 124 | |
| 125 | // unsigned char specify[2]; | |
| 126 | // unsigned char perpendicular_mode[1]; | |
| 125 | // unsigned char specify[2]; | |
| 126 | // unsigned char perpendicular_mode[1]; | |
| 127 | 127 | |
| 128 | 128 | int command; |
| 129 | 129 | |
| r5932 | r5933 | |
| 168 | 168 | if (!fdc->intf->get_image) |
| 169 | 169 | { |
| 170 | 170 | if (fdc->intf->floppy_drive_tags[fdc->drive]!=NULL) { |
| 171 | image = devtag_get_device(device->machine,fdc->intf->floppy_drive_tags[fdc->drive]); | |
| 171 | image = devtag_get_device(device->machine,fdc->intf->floppy_drive_tags[fdc->drive]); | |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | else |
| r5932 | r5933 | |
| 233 | 233 | |
| 234 | 234 | /* if a seek is done without drive connected: */ |
| 235 | 235 | /* abnormal termination of command, |
| 236 | seek complete, | |
| 237 | not ready | |
| 238 | */ | |
| 236 | seek complete, | |
| 237 | not ready | |
| 238 | */ | |
| 239 | 239 | |
| 240 | 240 | /* if a seek is done with drive connected, but disc missing: */ |
| 241 | 241 | /* abnormal termination of command, |
| 242 | seek complete, | |
| 243 | not ready */ | |
| 242 | seek complete, | |
| 243 | not ready */ | |
| 244 | 244 | |
| 245 | 245 | /* if a seek is done with drive connected and disc in drive */ |
| 246 | 246 | /* seek complete */ |
| 247 | 247 | |
| 248 | 248 | |
| 249 | 249 | /* On the PC however, it appears that recalibrates and seeks can be performed without |
| 250 | ||
| 250 | a disc in the drive. */ | |
| 251 | 251 | |
| 252 | 252 | /* Therefore, the above output is dependant on the state of the drive */ |
| 253 | 253 | |
| 254 | 254 | /* In the Amstrad CPC, the drive select is provided by the NEC765. A single port is also |
| 255 | assigned for setting the drive motor state. The motor state controls the motor of the selected | |
| 256 | drive */ | |
| 255 | assigned for setting the drive motor state. The motor state controls the motor of the selected | |
| 256 | drive */ | |
| 257 | 257 | |
| 258 | 258 | /* On the PC the drive can be selected with the DIGITAL OUTPUT REGISTER, and the motor of each |
| 259 | ||
| 259 | of the 4 possible drives is also settable using the same register */ | |
| 260 | 260 | |
| 261 | 261 | /* Assumption for PC: (NOT TESTED - NEEDS VERIFICATION) */ |
| 262 | 262 | |
| 263 | 263 | /* If a seek is done without drive connected: */ |
| 264 | 264 | /* abnormal termination of command, |
| 265 | seek complete, | |
| 266 | fault | |
| 267 | */ | |
| 265 | seek complete, | |
| 266 | fault | |
| 267 | */ | |
| 268 | 268 | |
| 269 | 269 | /* if a seek is done with drive connected, but disc missing: */ |
| 270 | 270 | /* seek complete */ |
| r5932 | r5933 | |
| 273 | 273 | /* seek complete */ |
| 274 | 274 | |
| 275 | 275 | /* On Amstrad CPC: |
| 276 | If drive not connected, or drive connected but disc not in drive, not ready! | |
| 277 | If drive connected and drive motor on, ready! | |
| 278 | On PC: | |
| 279 | Drive is always ready! | |
| 276 | If drive not connected, or drive connected but disc not in drive, not ready! | |
| 277 | If drive connected and drive motor on, ready! | |
| 278 | On PC: | |
| 279 | Drive is always ready! | |
| 280 | 280 | |
| 281 | In 37c78 docs, the ready bits of the nec765 are marked as unused. | |
| 282 | This indicates it is always ready!!!!! | |
| 283 | */ | |
| 281 | In 37c78 docs, the ready bits of the nec765 are marked as unused. | |
| 282 | This indicates it is always ready!!!!! | |
| 283 | */ | |
| 284 | 284 | |
| 285 | 285 | const device_config *img = current_image(device); |
| 286 | 286 | nec765_t *fdc = get_safe_token(device); |
| r5932 | r5933 | |
| 328 | 328 | |
| 329 | 329 | /* set drive and side */ |
| 330 | 330 | fdc->nec765_status[0] |= fdc->drive | (fdc->side<<2); |
| 331 | ||
| 331 | ||
| 332 | 332 | nec765_set_int(device,0); |
| 333 | 333 | nec765_set_int(device,1); |
| 334 | 334 | |
| 335 | 335 | fdc->nec765_flags &= ~NEC765_SEEK_ACTIVE; |
| 336 | ||
| 336 | ||
| 337 | 337 | nec765_idle(device); |
| 338 | 338 | } |
| 339 | 339 | |
| r5932 | r5933 | |
| 406 | 406 | else if (fdc->timer_type == 4) |
| 407 | 407 | { |
| 408 | 408 | /* if in dma mode, a int is not generated per byte. If not in DMA mode |
| 409 | ||
| 409 | a int is generated per byte */ | |
| 410 | 410 | if (fdc->nec765_flags & NEC765_DMA_MODE) |
| 411 | 411 | { |
| 412 | 412 | nec765_set_dma_drq(device,1); |
| r5932 | r5933 | |
| 510 | 510 | ) |
| 511 | 511 | { |
| 512 | 512 | /* seek completed */ |
| 513 | // | |
| 513 | // nec765_seek_complete(device); | |
| 514 | 514 | // delay for the time of 1 step, the PCW does not like immediate recalibrates |
| 515 | 515 | nec765_setup_timed_int(device,1); |
| 516 | 516 | } |
| r5932 | r5933 | |
| 711 | 711 | with error */ |
| 712 | 712 | static void nec765_set_ready_change_callback(const device_config *controller, const device_config *img, int state) |
| 713 | 713 | { |
| 714 | nec765_t *fdc = get_safe_token(controller); | |
| 714 | nec765_t *fdc = get_safe_token(controller); | |
| 715 | 715 | int drive = floppy_get_drive(img); |
| 716 | 716 | |
| 717 | 717 | logerror("nec765: ready state change\n"); |
| r5932 | r5933 | |
| 826 | 826 | |
| 827 | 827 | - get next sector id from disc |
| 828 | 828 | - if sector id matches id specified in command, it will |
| 829 | ||
| 829 | search for next data block and read data from it. | |
| 830 | 830 | |
| 831 | 831 | - if the index is seen twice while it is searching for a sector, then the sector cannot be found |
| 832 | 832 | */ |
| r5932 | r5933 | |
| 864 | 864 | nec765_get_next_id(device, &id); |
| 865 | 865 | |
| 866 | 866 | /* tested on Amstrad CPC - All bytes must match, otherwise |
| 867 | ||
| 867 | a NO DATA error is reported */ | |
| 868 | 868 | if (id.R == fdc->nec765_command_bytes[4]) |
| 869 | 869 | { |
| 870 | 870 | if (id.C == fdc->nec765_command_bytes[2]) |
| r5932 | r5933 | |
| 874 | 874 | if (id.N == fdc->nec765_command_bytes[5]) |
| 875 | 875 | { |
| 876 | 876 | /* end of cylinder is set if: |
| 877 | 1. sector data is read completely (i.e. no other errors occur like | |
| 878 | no data. | |
| 879 | 2. sector being read is same specified by EOT | |
| 880 | 3. terminal count is not received */ | |
| 877 | 1. sector data is read completely (i.e. no other errors occur like | |
| 878 | no data. | |
| 879 | 2. sector being read is same specified by EOT | |
| 880 | 3. terminal count is not received */ | |
| 881 | 881 | if (fdc->nec765_command_bytes[4]==fdc->nec765_command_bytes[6]) |
| 882 | 882 | { |
| 883 | 883 | /* set end of cylinder */ |
| r5932 | r5933 | |
| 891 | 891 | else |
| 892 | 892 | { |
| 893 | 893 | /* the specified sector ID was found, however, the C value specified |
| 894 | ||
| 894 | in the read/write command did not match the C value read from the disc */ | |
| 895 | 895 | |
| 896 | 896 | /* no data - checked on Amstrad CPC */ |
| 897 | 897 | fdc->nec765_status[1] |= NEC765_ST1_NO_DATA; |
| r5932 | r5933 | |
| 901 | 901 | if (id.C == 0x0ff) |
| 902 | 902 | { |
| 903 | 903 | /* the C value is 0x0ff which indicates a bad track in the IBM soft-sectored |
| 904 | ||
| 904 | format */ | |
| 905 | 905 | fdc->nec765_status[2] |= NEC765_ST2_BAD_CYLINDER; |
| 906 | 906 | } |
| 907 | 907 | |
| r5932 | r5933 | |
| 938 | 938 | /* completed read command */ |
| 939 | 939 | |
| 940 | 940 | /* end of cylinder is set when: |
| 941 | - a whole sector has been read | |
| 942 | - terminal count input is not set | |
| 943 | - AND the the sector specified by EOT was read | |
| 944 | */ | |
| 941 | - a whole sector has been read | |
| 942 | - terminal count input is not set | |
| 943 | - AND the the sector specified by EOT was read | |
| 944 | */ | |
| 945 | 945 | |
| 946 | 946 | /* if end of cylinder is set, and we did receive a terminal count, then clear it */ |
| 947 | 947 | if ((fdc->nec765_flags & NEC765_TC)!=0) |
| r5932 | r5933 | |
| 1131 | 1131 | /* completed read command */ |
| 1132 | 1132 | |
| 1133 | 1133 | /* end of cylinder is set when: |
| 1134 | - a whole sector has been read | |
| 1135 | - terminal count input is not set | |
| 1136 | - AND the the sector specified by EOT was read | |
| 1137 | */ | |
| 1134 | - a whole sector has been read | |
| 1135 | - terminal count input is not set | |
| 1136 | - AND the the sector specified by EOT was read | |
| 1137 | */ | |
| 1138 | 1138 | |
| 1139 | 1139 | /* if end of cylinder is set, and we did receive a terminal count, then clear it */ |
| 1140 | 1140 | if ((fdc->nec765_flags & NEC765_TC)!=0) |
| r5932 | r5933 | |
| 1221 | 1221 | if (fdc->nec765_command_bytes[0] & 0x080) |
| 1222 | 1222 | { |
| 1223 | 1223 | /* it appears that in multi-track mode, |
| 1224 | the EOT parameter of the command is ignored!? - | |
| 1225 | or is it ignored the first time and not the next, so that | |
| 1226 | if it is started on side 0, it will end at EOT on side 1, | |
| 1227 | but if started on side 1 it will end at end of track???? | |
| 1224 | the EOT parameter of the command is ignored!? - | |
| 1225 | or is it ignored the first time and not the next, so that | |
| 1226 | if it is started on side 0, it will end at EOT on side 1, | |
| 1227 | but if started on side 1 it will end at end of track???? | |
| 1228 | 1228 | |
| 1229 | PC driver requires this to end at last sector on side 1, and | |
| 1230 | ignore EOT parameter. | |
| 1229 | PC driver requires this to end at last sector on side 1, and | |
| 1230 | ignore EOT parameter. | |
| 1231 | 1231 | |
| 1232 | To be checked!!!! | |
| 1233 | */ | |
| 1232 | To be checked!!!! | |
| 1233 | */ | |
| 1234 | 1234 | |
| 1235 | 1235 | /* if just read last sector and on side 1 - finish */ |
| 1236 | 1236 | if ((nec765_just_read_last_sector_on_track(device)) && |
| r5932 | r5933 | |
| 1267 | 1267 | |
| 1268 | 1268 | /* Multi-Track operation: |
| 1269 | 1269 | |
| 1270 | ||
| 1270 | Verified on Amstrad CPC. | |
| 1271 | 1271 | |
| 1272 | disc format used: | |
| 1273 | 9 sectors per track | |
| 1274 | 2 sides | |
| 1275 | Sector IDs: &01, &02, &03, &04, &05, &06, &07, &08, &09 | |
| 1272 | disc format used: | |
| 1273 | 9 sectors per track | |
| 1274 | 2 sides | |
| 1275 | Sector IDs: &01, &02, &03, &04, &05, &06, &07, &08, &09 | |
| 1276 | 1276 | |
| 1277 | Command specified: | |
| 1278 | SIDE = 0, | |
| 1279 | C = 0,H = 0,R = 1, N = 2, EOT = 1 | |
| 1280 | Sectors read: | |
| 1281 | Sector 1 side 0 | |
| 1282 | Sector 1 side 1 | |
| 1277 | Command specified: | |
| 1278 | SIDE = 0, | |
| 1279 | C = 0,H = 0,R = 1, N = 2, EOT = 1 | |
| 1280 | Sectors read: | |
| 1281 | Sector 1 side 0 | |
| 1282 | Sector 1 side 1 | |
| 1283 | 1283 | |
| 1284 | Command specified: | |
| 1285 | SIDE = 0, | |
| 1286 | C = 0,H = 0,R = 1, N = 2, EOT = 3 | |
| 1287 | Sectors read: | |
| 1288 | Sector 1 side 0 | |
| 1289 | Sector 2 side 0 | |
| 1290 | Sector 3 side 0 | |
| 1291 | Sector 1 side 1 | |
| 1292 | Sector 2 side 1 | |
| 1293 | Sector 3 side 1 | |
| 1284 | Command specified: | |
| 1285 | SIDE = 0, | |
| 1286 | C = 0,H = 0,R = 1, N = 2, EOT = 3 | |
| 1287 | Sectors read: | |
| 1288 | Sector 1 side 0 | |
| 1289 | Sector 2 side 0 | |
| 1290 | Sector 3 side 0 | |
| 1291 | Sector 1 side 1 | |
| 1292 | Sector 2 side 1 | |
| 1293 | Sector 3 side 1 | |
| 1294 | 1294 | |
| 1295 | 1295 | |
| 1296 | Command specified: | |
| 1297 | SIDE = 0, | |
| 1298 | C = 0, H = 0, R = 7, N = 2, EOT = 3 | |
| 1299 | Sectors read: | |
| 1300 | Sector 7 side 0 | |
| 1301 | Sector 8 side 0 | |
| 1302 | Sector 9 side 0 | |
| 1303 | Sector 10 not found. Error "No Data" | |
| 1296 | Command specified: | |
| 1297 | SIDE = 0, | |
| 1298 | C = 0, H = 0, R = 7, N = 2, EOT = 3 | |
| 1299 | Sectors read: | |
| 1300 | Sector 7 side 0 | |
| 1301 | Sector 8 side 0 | |
| 1302 | Sector 9 side 0 | |
| 1303 | Sector 10 not found. Error "No Data" | |
| 1304 | 1304 | |
| 1305 | Command specified: | |
| 1306 | SIDE = 1, | |
| 1307 | C = 0, H = 1, R = 1, N = 2, EOT = 1 | |
| 1308 | Sectors read: | |
| 1309 | Sector 1 side 1 | |
| 1305 | Command specified: | |
| 1306 | SIDE = 1, | |
| 1307 | C = 0, H = 1, R = 1, N = 2, EOT = 1 | |
| 1308 | Sectors read: | |
| 1309 | Sector 1 side 1 | |
| 1310 | 1310 | |
| 1311 | Command specified: | |
| 1312 | SIDE = 1, | |
| 1313 | C = 0, H = 1, R = 1, N = 2, EOT = 2 | |
| 1314 | Sectors read: | |
| 1315 | Sector 1 side 1 | |
| 1316 | Sector 1 side 2 | |
| 1311 | Command specified: | |
| 1312 | SIDE = 1, | |
| 1313 | C = 0, H = 1, R = 1, N = 2, EOT = 2 | |
| 1314 | Sectors read: | |
| 1315 | Sector 1 side 1 | |
| 1316 | Sector 1 side 2 | |
| 1317 | 1317 | |
| 1318 | 1318 | */ |
| 1319 | 1319 | |
| r5932 | r5933 | |
| 1324 | 1324 | if (fdc->nec765_command_bytes[0] & 0x080) |
| 1325 | 1325 | { |
| 1326 | 1326 | /* if we have reached EOT (fdc->nec765_command_bytes[6]) |
| 1327 | ||
| 1327 | on side 1, then read is complete */ | |
| 1328 | 1328 | if (fdc->side==1) |
| 1329 | 1329 | return 1; |
| 1330 | 1330 | |
| r5932 | r5933 | |
| 1674 | 1674 | if (fdc->nec765_flags & NEC765_SEEK_ACTIVE) |
| 1675 | 1675 | { |
| 1676 | 1676 | /* any command results in a invalid - I think that seek, recalibrate and |
| 1677 | ||
| 1677 | sense interrupt status may work*/ | |
| 1678 | 1678 | fdc->nec765_data_reg = 0; |
| 1679 | 1679 | } |
| 1680 | 1680 | |
| r5932 | r5933 | |
| 1866 | 1866 | case 0x04: /* sense drive status */ |
| 1867 | 1867 | nec765_setup_drive_and_side(device); |
| 1868 | 1868 | img = current_image(device); |
| 1869 | ||
| 1869 | ||
| 1870 | 1870 | fdc->nec765_status[3] = fdc->drive | (fdc->side<<2); |
| 1871 | 1871 | |
| 1872 | 1872 | if (img) |
| r5932 | r5933 | |
| 1905 | 1905 | case 0x0a: /* read id */ |
| 1906 | 1906 | nec765_setup_drive_and_side(device); |
| 1907 | 1907 | img = current_image(device); |
| 1908 | ||
| 1908 | ||
| 1909 | 1909 | fdc->nec765_status[0] = fdc->drive | (fdc->side<<2); |
| 1910 | 1910 | fdc->nec765_status[1] = 0; |
| 1911 | 1911 | fdc->nec765_status[2] = 0; |
| r5932 | r5933 | |
| 2197 | 2197 | fdc->nec765_status[0] = 0x080 | 0x040; |
| 2198 | 2198 | |
| 2199 | 2199 | /* for the purpose of pc-xt. If any of the drives have a disk inserted, |
| 2200 | do not set not-ready - need to check with pc_fdc->c whether all drives | |
| 2201 | are checked or only the drive selected with the drive select bits?? */ | |
| 2200 | do not set not-ready - need to check with pc_fdc->c whether all drives | |
| 2201 | are checked or only the drive selected with the drive select bits?? */ | |
| 2202 | 2202 | |
| 2203 | 2203 | a_drive_is_ready = 0; |
| 2204 | 2204 | for (i = 0; i < 4; i++) |
| 2205 | 2205 | { |
| 2206 | if (fdc->intf->floppy_drive_tags[i]!=NULL) { | |
| 2206 | if (fdc->intf->floppy_drive_tags[i]!=NULL) { | |
| 2207 | 2207 | if (image_exists(devtag_get_device(device->machine,fdc->intf->floppy_drive_tags[i]))) { |
| 2208 | 2208 | a_drive_is_ready = 1; |
| 2209 | 2209 | break; |
| r5932 | r5933 | |
|---|---|---|
| 43 | 43 | { |
| 44 | 44 | int data = outa; |
| 45 | 45 | |
| 46 | if (outb & 0x01) | |
| 46 | if (outb & 0x01) | |
| 47 | 47 | data |= input_port_read(device->machine, "KEY0"); |
| 48 | 48 | |
| 49 | if (outb & 0x02) | |
| 49 | if (outb & 0x02) | |
| 50 | 50 | data |= input_port_read(device->machine, "KEY1"); |
| 51 | 51 | |
| 52 | if (outb & 0x04) | |
| 52 | if (outb & 0x04) | |
| 53 | 53 | data |= input_port_read(device->machine, "KEY2"); |
| 54 | 54 | |
| 55 | if (outb & 0x08) | |
| 55 | if (outb & 0x08) | |
| 56 | 56 | data |= input_port_read(device->machine, "KEY3"); |
| 57 | 57 | |
| 58 | if (outb & 0x10) | |
| 58 | if (outb & 0x10) | |
| 59 | 59 | data |= input_port_read(device->machine, "KEY4"); |
| 60 | 60 | |
| 61 | if (outb & 0x20) | |
| 61 | if (outb & 0x20) | |
| 62 | 62 | { |
| 63 | 63 | data |= input_port_read(device->machine, "KEY5"); |
| 64 | ||
| 64 | ||
| 65 | 65 | /* At Power Up we fake a 'C-CE' pressure */ |
| 66 | 66 | if (power) |
| 67 | 67 | data |= 0x01; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | if (outa & 0x01) | |
| 70 | if (outa & 0x01) | |
| 71 | 71 | data |= input_port_read(device->machine, "KEY6"); |
| 72 | 72 | |
| 73 | if (outa & 0x02) | |
| 73 | if (outa & 0x02) | |
| 74 | 74 | data |= input_port_read(device->machine, "KEY7"); |
| 75 | 75 | |
| 76 | if (outa & 0x04) | |
| 76 | if (outa & 0x04) | |
| 77 | 77 | data |= input_port_read(device->machine, "KEY8"); |
| 78 | 78 | |
| 79 | 79 | if (outa & 0x08) |
| r5932 | r5933 | |
| 95 | 95 | { |
| 96 | 96 | int data=outb; |
| 97 | 97 | |
| 98 | if (input_port_read(device->machine, "EXTRA") & 0x04) | |
| 98 | if (input_port_read(device->machine, "EXTRA") & 0x04) | |
| 99 | 99 | data |= 0x01; |
| 100 | 100 | |
| 101 | 101 | return data; |
| r5932 | r5933 | |
| 148 | 148 | #if 0 |
| 149 | 149 | char sucker[]={ |
| 150 | 150 | /* this routine dump the memory (start 0) |
| 151 | in an endless loop, | |
| 152 | the pc side must be started before this | |
| 153 | its here to allow verification of the decimal data | |
| 154 | in mame disassembler | |
| 155 | */ | |
| 151 | in an endless loop, | |
| 152 | the pc side must be started before this | |
| 153 | its here to allow verification of the decimal data | |
| 154 | in mame disassembler | |
| 155 | */ | |
| 156 | 156 | #if 1 |
| 157 | 157 | 18,4,/*lip xl */ |
| 158 | 158 | 2,0,/*lia 0 startaddress low */ |
| r5932 | r5933 | |
| 183 | 183 | /*400f x: */ |
| 184 | 184 | /* dump external memory */ |
| 185 | 185 | 4, /*ix */ |
| 186 | 87,/* | |
| 186 | 87,/* ldd */ | |
| 187 | 187 | #endif |
| 188 | 188 | 218,/*exab */ |
| 189 | 189 | |
| r5932 | r5933 | |
| 192 | 192 | 0,4,/*lii 4 */ |
| 193 | 193 | |
| 194 | 194 | /*a: */ |
| 195 | 218,/* exab */ | |
| 196 | 90,/* sl */ | |
| 197 | 218,/* exab */ | |
| 198 | 18,94,/* lip 94 */ | |
| 199 | 96,252,/* anma 252 */ | |
| 195 | 218,/* exab */ | |
| 196 | 90,/* sl */ | |
| 197 | 218,/* exab */ | |
| 198 | 18,94,/* lip 94 */ | |
| 199 | 96,252,/* anma 252 */ | |
| 200 | 200 | 2,2, /*lia 2 */ |
| 201 | 196,/* adcm */ | |
| 202 | 95,/* outf */ | |
| 201 | 196,/* adcm */ | |
| 202 | 95,/* outf */ | |
| 203 | 203 | /*b: */ |
| 204 | 204 | 204,/*inb */ |
| 205 | 205 | 102,128,/*tsia 0x80 */ |
| 206 | 206 | #if 0 |
| 207 | 41,4,/* | |
| 207 | 41,4,/* jnzm b */ | |
| 208 | 208 | #else |
| 209 | 209 | /* input not working reliable! */ |
| 210 | 210 | /* so handshake removed, PC side must run with disabled */ |
| r5932 | r5933 | |
| 212 | 212 | 78,20, /*wait 20 */ |
| 213 | 213 | #endif |
| 214 | 214 | |
| 215 | 218,/* exab */ | |
| 216 | 90,/* sl */ | |
| 217 | 218,/* exab */ | |
| 218 | 18,94,/* lip 94 */ | |
| 215 | 218,/* exab */ | |
| 216 | 90,/* sl */ | |
| 217 | 218,/* exab */ | |
| 218 | 18,94,/* lip 94 */ | |
| 219 | 219 | 96,252,/*anma 252 */ |
| 220 | 2,0,/* | |
| 220 | 2,0,/* lia 0 */ | |
| 221 | 221 | 196,/*adcm */ |
| 222 | 95,/* | |
| 222 | 95,/* outf */ | |
| 223 | 223 | /*c: */ |
| 224 | 224 | 204,/*inb */ |
| 225 | 225 | 102,128,/*tsia 0x80 */ |
| 226 | 226 | #if 0 |
| 227 | 57,4,/* | |
| 227 | 57,4,/* jzm c */ | |
| 228 | 228 | #else |
| 229 | 229 | 78,20, /*wait 20 */ |
| 230 | 230 | #endif |
| r5932 | r5933 | |
| 234 | 234 | |
| 235 | 235 | 41,41,/*jnzm x: */ |
| 236 | 236 | |
| 237 | 55,/* | |
| 237 | 55,/* rtn */ | |
| 238 | 238 | }; |
| 239 | 239 | |
| 240 | 240 | for (i=0; i<sizeof(sucker);i++) pc1401_mem[0x4000+i]=sucker[i]; |
| 241 | 241 | logerror("%d %d\n",i, 0x4000+i); |
| 242 | 242 | #endif |
| 243 | 243 | |
| 244 | for (i=0; i<128; i++) | |
| 244 | for (i=0; i<128; i++) | |
| 245 | 245 | gfx[i]=i; |
| 246 | 246 | |
| 247 | 247 | timer_set(machine, ATTOTIME_IN_SEC(1), NULL, 0, pc1401_power_up); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | NEC uPD1990AC Serial I/O Calendar & Clock emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | ||
| 14 | - test mode | |
| 15 | 15 | |
| 16 | 16 | */ |
| 17 | 17 | |
| r5932 | r5933 | |
| 57 | 57 | int c; /* command */ |
| 58 | 58 | int clk; /* shift clock */ |
| 59 | 59 | int tp; /* time pulse */ |
| 60 | ||
| 60 | ||
| 61 | 61 | /* timers */ |
| 62 | 62 | emu_timer *clock_timer; |
| 63 | 63 | emu_timer *data_out_timer; |
| r5932 | r5933 | |
| 155 | 155 | |
| 156 | 156 | case UPD1990A_MODE_SHIFT: |
| 157 | 157 | if (LOG) logerror("UPD1990A Shift Mode\n"); |
| 158 | ||
| 158 | ||
| 159 | 159 | /* enable time counter */ |
| 160 | 160 | timer_enable(upd1990a->clock_timer, 1); |
| 161 | 161 | |
| r5932 | r5933 | |
| 201 | 201 | case UPD1990A_MODE_TIME_READ: |
| 202 | 202 | { |
| 203 | 203 | int i; |
| 204 | ||
| 204 | ||
| 205 | 205 | if (LOG) logerror("UPD1990A Time Read Mode\n"); |
| 206 | 206 | |
| 207 | 207 | /* enable time counter */ |
| r5932 | r5933 | |
| 226 | 226 | |
| 227 | 227 | case UPD1990A_MODE_TP_64HZ_SET: |
| 228 | 228 | if (LOG) logerror("UPD1990A TP = 64 Hz Set Mode\n"); |
| 229 | ||
| 229 | ||
| 230 | 230 | /* 64 Hz time pulse */ |
| 231 | 231 | timer_adjust_periodic(upd1990a->tp_timer, attotime_zero, 0, ATTOTIME_IN_HZ(64*2)); |
| 232 | 232 | break; |
| 233 | 233 | |
| 234 | 234 | case UPD1990A_MODE_TP_256HZ_SET: |
| 235 | 235 | if (LOG) logerror("UPD1990A TP = 256 Hz Set Mode\n"); |
| 236 | ||
| 236 | ||
| 237 | 237 | /* 256 Hz time pulse */ |
| 238 | 238 | timer_adjust_periodic(upd1990a->tp_timer, attotime_zero, 0, ATTOTIME_IN_HZ(256*2)); |
| 239 | 239 | break; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/nec765.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Functions to emulate a NEC765/Intel 8272 compatible floppy disk controller | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 52 | 52 | |
| 53 | 53 | /* image lookup */ |
| 54 | 54 | nec765_get_image_func get_image; |
| 55 | ||
| 55 | ||
| 56 | 56 | NEC765_RDY_PIN rdy_pin; |
| 57 | ||
| 57 | ||
| 58 | 58 | const char *floppy_drive_tags[4]; |
| 59 | 59 | } nec765_interface; |
| 60 | 60 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | apple2gs.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple IIgs code | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | ||
| 8 | Apple IIgs specific softswitches: | |
| 9 | 9 | |
| 10 | C019 - RDVBLBAR | |
| 11 | bits 7 - set during vblank (when at scanline 192 or higher) | |
| 10 | C019 - RDVBLBAR | |
| 11 | bits 7 - set during vblank (when at scanline 192 or higher) | |
| 12 | 12 | |
| 13 | C022 - TBCOLOR | |
| 14 | bits 7-4 - text foreground color | |
| 15 | bits 3-0 - text background color | |
| 13 | C022 - TBCOLOR | |
| 14 | bits 7-4 - text foreground color | |
| 15 | bits 3-0 - text background color | |
| 16 | 16 | |
| 17 | C023 - VGCINT | |
| 18 | bit 7 - set for interrupt generated by VGC | |
| 17 | C023 - VGCINT | |
| 18 | bit 7 - set for interrupt generated by VGC | |
| 19 | 19 | |
| 20 | bit 6 - set during one second interrupt | |
| 21 | bit 5 - set during scanline interrupt | |
| 20 | bit 6 - set during one second interrupt | |
| 21 | bit 5 - set during scanline interrupt | |
| 22 | 22 | |
| 23 | bit 4 - set during external interrupt | |
| 24 | bit 3 - ??? | |
| 25 | bit 2 - set for interrupt every second | |
| 23 | bit 4 - set during external interrupt | |
| 24 | bit 3 - ??? | |
| 25 | bit 2 - set for interrupt every second | |
| 26 | 26 | |
| 27 | bit 1 - set for scanline interrupt | |
| 28 | bit 0 - set for external interrupt | |
| 27 | bit 1 - set for scanline interrupt | |
| 28 | bit 0 - set for external interrupt | |
| 29 | 29 | |
| 30 | C025 - KEYMODREG | |
| 31 | bit 7 - option key pressed | |
| 32 | bit 6 - command key presssed | |
| 33 | bit 5 - modified latch | |
| 34 | bit 4 - keypad key pressed | |
| 35 | bit 3 - repeating | |
| 36 | bit 2 - caps lock latched | |
| 37 | bit 1 - control key pressed | |
| 38 | bit 0 - shift key pressed | |
| 30 | C025 - KEYMODREG | |
| 31 | bit 7 - option key pressed | |
| 32 | bit 6 - command key presssed | |
| 33 | bit 5 - modified latch | |
| 34 | bit 4 - keypad key pressed | |
| 35 | bit 3 - repeating | |
| 36 | bit 2 - caps lock latched | |
| 37 | bit 1 - control key pressed | |
| 38 | bit 0 - shift key pressed | |
| 39 | 39 | |
| 40 | C027 - KMSTATUS | |
| 41 | bit 7 - set if mouse register full | |
| 42 | bit 6 - mouse interupt enable flag | |
| 43 | bit 5 - set if data register full | |
| 44 | bit 4 - data interrupt enabled | |
| 45 | bit 3 - set if key data full | |
| 46 | bit 2 - key data interurpt enabled | |
| 47 | bit 1 - clear if horizontal mouse data, set if vertical | |
| 48 | bit 0 - command register full | |
| 40 | C027 - KMSTATUS | |
| 41 | bit 7 - set if mouse register full | |
| 42 | bit 6 - mouse interupt enable flag | |
| 43 | bit 5 - set if data register full | |
| 44 | bit 4 - data interrupt enabled | |
| 45 | bit 3 - set if key data full | |
| 46 | bit 2 - key data interurpt enabled | |
| 47 | bit 1 - clear if horizontal mouse data, set if vertical | |
| 48 | bit 0 - command register full | |
| 49 | 49 | |
| 50 | ||
| 50 | C02D - SLTROMSEL | |
| 51 | 51 | |
| 52 | C031 - DISKREG | |
| 53 | bit 7 - set to select head on 3.5" drive | |
| 54 | bit 6 - set to enable 3.5" drive, clear to enable 5.25" drive | |
| 52 | C031 - DISKREG | |
| 53 | bit 7 - set to select head on 3.5" drive | |
| 54 | bit 6 - set to enable 3.5" drive, clear to enable 5.25" drive | |
| 55 | 55 | |
| 56 | C035 - SHADOW | |
| 57 | bit 7 - ??? | |
| 58 | bit 6 - set to inhibit I/O and LC operations ($C000-$FFFF) | |
| 59 | bit 5 - ??? | |
| 60 | bit 4 - set to inhibit shadowing aux hires page | |
| 61 | bit 3 - set to inhibit shadowing super hires video | |
| 62 | bit 2 - set to inhibit shadowing hires page 2 | |
| 63 | bit 1 - set to inhibit shadowing hires page 2 | |
| 64 | bit 0 - set to inhibit shadowing text pages | |
| 56 | C035 - SHADOW | |
| 57 | bit 7 - ??? | |
| 58 | bit 6 - set to inhibit I/O and LC operations ($C000-$FFFF) | |
| 59 | bit 5 - ??? | |
| 60 | bit 4 - set to inhibit shadowing aux hires page | |
| 61 | bit 3 - set to inhibit shadowing super hires video | |
| 62 | bit 2 - set to inhibit shadowing hires page 2 | |
| 63 | bit 1 - set to inhibit shadowing hires page 2 | |
| 64 | bit 0 - set to inhibit shadowing text pages | |
| 65 | 65 | |
| 66 | C036 - CYAREG | |
| 67 | bit 7 - clear for slow speed, set for hi speed | |
| 68 | bit 6 - ??? | |
| 69 | bit 5 - ??? | |
| 70 | bit 4 - shadow in all RAM banks | |
| 71 | bit 3 - slot 7 motor on | |
| 72 | bit 2 - slot 6 motor on | |
| 73 | bit 1 - slot 5 motor on | |
| 74 | bit 0 - slot 4 motor on | |
| 66 | C036 - CYAREG | |
| 67 | bit 7 - clear for slow speed, set for hi speed | |
| 68 | bit 6 - ??? | |
| 69 | bit 5 - ??? | |
| 70 | bit 4 - shadow in all RAM banks | |
| 71 | bit 3 - slot 7 motor on | |
| 72 | bit 2 - slot 6 motor on | |
| 73 | bit 1 - slot 5 motor on | |
| 74 | bit 0 - slot 4 motor on | |
| 75 | 75 | |
| 76 | C041 - INTEN | |
| 77 | bit 4 - set to enable quarter second interrupts | |
| 78 | bit 3 - set to enable VBL interrupts | |
| 79 | bit 2 - set to enable Mega II mouse switch interrupts | |
| 80 | bit 1 - set to enable Mega II mouse movement interrupts | |
| 81 | bit 0 - set to enable Mega II mouse mouse operation | |
| 76 | C041 - INTEN | |
| 77 | bit 4 - set to enable quarter second interrupts | |
| 78 | bit 3 - set to enable VBL interrupts | |
| 79 | bit 2 - set to enable Mega II mouse switch interrupts | |
| 80 | bit 1 - set to enable Mega II mouse movement interrupts | |
| 81 | bit 0 - set to enable Mega II mouse mouse operation | |
| 82 | 82 | |
| 83 | C046 - DIAGTYPE/INTFLAG | |
| 84 | bit 7 - set if mouse button currently down | |
| 85 | bit 6 - set if mouse button down on last read | |
| 86 | bit 5 - set for AN3 | |
| 87 | bit 4 - set if currently in quarter second interrupt | |
| 88 | bit 3 - set if currently in VBL interrupt | |
| 89 | bit 2 - set if currently in Mega II mouse switch interrupt | |
| 90 | bit 1 - set if currently in Mega II mouse movement interrupt | |
| 91 | bit 0 - set if system IRQ line asserted | |
| 83 | C046 - DIAGTYPE/INTFLAG | |
| 84 | bit 7 - set if mouse button currently down | |
| 85 | bit 6 - set if mouse button down on last read | |
| 86 | bit 5 - set for AN3 | |
| 87 | bit 4 - set if currently in quarter second interrupt | |
| 88 | bit 3 - set if currently in VBL interrupt | |
| 89 | bit 2 - set if currently in Mega II mouse switch interrupt | |
| 90 | bit 1 - set if currently in Mega II mouse movement interrupt | |
| 91 | bit 0 - set if system IRQ line asserted | |
| 92 | 92 | |
| 93 | ||
| 93 | C047 - CLRVBLINT | |
| 94 | 94 | |
| 95 | C068 - STATEREG | |
| 96 | bit 7 - ALTZP status | |
| 97 | bit 6 - PAGE2 status | |
| 98 | bit 5 - RAMRD status | |
| 99 | bit 4 - RAMWRT status | |
| 100 | bit 3 - !LCRAM status (inverted) | |
| 101 | bit 2 - LCRAM2 status | |
| 102 | bit 1 - ROMBANK status (unimplemented) | |
| 103 | bit 0 - INTCXROM status | |
| 95 | C068 - STATEREG | |
| 96 | bit 7 - ALTZP status | |
| 97 | bit 6 - PAGE2 status | |
| 98 | bit 5 - RAMRD status | |
| 99 | bit 4 - RAMWRT status | |
| 100 | bit 3 - !LCRAM status (inverted) | |
| 101 | bit 2 - LCRAM2 status | |
| 102 | bit 1 - ROMBANK status (unimplemented) | |
| 103 | bit 0 - INTCXROM status | |
| 104 | 104 | |
| 105 | 105 | *********************************************************************/ |
| 106 | 106 | |
| r5932 | r5933 | |
| 1722 | 1722 | { |
| 1723 | 1723 | apple2gs_clock_timer = timer_alloc(machine, apple2gs_clock_tick, NULL); |
| 1724 | 1724 | timer_adjust_periodic(apple2gs_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1)); |
| 1725 | ||
| 1725 | ||
| 1726 | 1726 | apple2gs_qsecond_timer = timer_alloc(machine, apple2gs_qsecond_tick, NULL); |
| 1727 | 1727 | timer_adjust_periodic(apple2gs_qsecond_timer, ATTOTIME_IN_USEC(266700), 0, ATTOTIME_IN_USEC(266700)); |
| 1728 | ||
| 1728 | ||
| 1729 | 1729 | apple2gs_scanline_timer = timer_alloc(machine, apple2gs_scanline_tick, NULL); |
| 1730 | 1730 | timer_adjust_oneshot(apple2gs_scanline_timer, attotime_never, 0); |
| 1731 | 1731 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | X68000 custom SASI Hard Disk controller | |
| 4 | 4 | |
| 5 | 5 | 0xe96001 (R/W) - SASI data I/O |
| 6 | 6 | 0xe96003 (W) - SEL signal high (0) |
| r5932 | r5933 | |
| 258 | 258 | case SASI_CMD_FORMAT_UNIT: |
| 259 | 259 | case SASI_CMD_FORMAT_UNIT_06: |
| 260 | 260 | /* |
| 261 | Format Unit command format (differs from SASI spec?) | |
| 262 | 0 | 0x06 | |
| 263 | 1 | Unit number (0-7) | LBA MSB (high 5 bits) | |
| 264 | 2 | LBA | |
| 265 | 3 | LBA LSB | |
| 266 | 4 | ?? (usually 0x01) | |
| 267 | 5 | ?? | |
| 268 | */ | |
| 261 | Format Unit command format (differs from SASI spec?) | |
| 262 | 0 | 0x06 | |
| 263 | 1 | Unit number (0-7) | LBA MSB (high 5 bits) | |
| 264 | 2 | LBA | |
| 265 | 3 | LBA LSB | |
| 266 | 4 | ?? (usually 0x01) | |
| 267 | 5 | ?? | |
| 268 | */ | |
| 269 | 269 | sasi->phase = SASI_PHASE_STATUS; |
| 270 | 270 | sasi->io = 1; // Output |
| 271 | 271 | sasi->status_port |= 0x04; // C/D remains the same |
| r5932 | r5933 | |
| 323 | 323 | break; |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | // | |
| 326 | // logerror("SASI: write to HDC, offset %04x, data %04x\n",offset,data); | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | READ16_DEVICE_HANDLER( x68k_hdc_r ) |
| r5932 | r5933 | |
| 427 | 427 | } |
| 428 | 428 | return 0x00; |
| 429 | 429 | case 0x01: |
| 430 | // | |
| 430 | // logerror("SASI: [%08x] read from status port, read 0x%02x\n",activecpu_get_pc(),sasi->status_port); | |
| 431 | 431 | return sasi->status_port; |
| 432 | 432 | case 0x02: |
| 433 | 433 | return 0xff; // write-only |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | NEC uPD1990AC Serial I/O Calendar & Clock emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | C2 1 |* \_/ | 14 Vdd | |
| 11 | C1 2 | | 13 XTAL | |
| 12 | C0 3 | | 12 _XTAL | |
| 13 | STB 4 | uPD1990AC | 11 OUT ENBL | |
| 14 | CS 5 | | 10 TP | |
| 15 | DATA IN 6 | | 9 DATA OUT | |
| 16 | GND 7 |_____________| 8 CLK | |
| 9 | _____ _____ | |
| 10 | C2 1 |* \_/ | 14 Vdd | |
| 11 | C1 2 | | 13 XTAL | |
| 12 | C0 3 | | 12 _XTAL | |
| 13 | STB 4 | uPD1990AC | 11 OUT ENBL | |
| 14 | CS 5 | | 10 TP | |
| 15 | DATA IN 6 | | 9 DATA OUT | |
| 16 | GND 7 |_____________| 8 CLK | |
| 17 | 17 | |
| 18 | 18 | **********************************************************************/ |
| 19 | 19 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | X68000 Custom SASI HD controller | |
| 4 | 4 | |
| 5 | 5 | */ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/mac.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Mac hardware - Mac 128k, 512k, 512ke, Plus, SE, Classic, II (SCSI, SCC, ADB, etc) | |
| 6 | 6 | |
| 7 | Nate Woods | |
| 8 | Ernesto Corvi | |
| 9 | Raphael Nabet | |
| 10 | R. Belmont | |
| 7 | Nate Woods | |
| 8 | Ernesto Corvi | |
| 9 | Raphael Nabet | |
| 10 | R. Belmont | |
| 11 | 11 | |
| 12 | ||
| 12 | Mac Model Feature Summary: | |
| 13 | 13 | |
| 14 | 14 | CPU FDC Kbd/Mouse PRAM Video |
| 15 | - Mac 128k 68k IWM orig orig Original | |
| 16 | - Mac 512k 68k IWM orig orig Original | |
| 17 | - Mac 512ke 68k IWM orig orig Original | |
| 18 | - Mac Plus 68k IWM orig ext Original | |
| 19 | - Mac SE 68k IWM MacII ADB ext Original | |
| 20 | - Mac Classic 68k SWIM MacII ADB ext Original | |
| 21 | - Mac Portable 68k (16 MHz) SWIM ADB-PMU PMU 640x480 B&W | |
| 22 | - PwrBook 100 68k (16 MHz) SWIM ADB-PMU PMU 640x480 B&W | |
| 23 | - Mac II 020 IWM MacII ADB ext NuBus card | |
| 24 | - Mac IIx 030 SWIM MacII ADB ext NuBus card | |
| 25 | - Mac IIfx 030 SWIM ADB-IOP ext NuBus card | |
| 26 | - Mac SE/30 030 SWIM MacII ADB ext Internal fake NuBus card (need video declaration ROM!) | |
| 27 | - Mac IIcx 030 SWIM ADB-CUDA ext NuBus card | |
| 28 | - Mac IIci 030 SWIM ADB-CUDA ext Internal "RBV" type | |
| 29 | - Mac LC 020 SWIM Egret ADB ext Internal "V8" type | |
| 30 | - Mac LC II 030 SWIM Egret ADB ext Internal "V8" type | |
| 31 | - Mac LC III 030 SWIM Egret ADB ext Internal "V8" type | |
| 15 | - Mac 128k 68k IWM orig orig Original | |
| 16 | - Mac 512k 68k IWM orig orig Original | |
| 17 | - Mac 512ke 68k IWM orig orig Original | |
| 18 | - Mac Plus 68k IWM orig ext Original | |
| 19 | - Mac SE 68k IWM MacII ADB ext Original | |
| 20 | - Mac Classic 68k SWIM MacII ADB ext Original | |
| 21 | - Mac Portable 68k (16 MHz) SWIM ADB-PMU PMU 640x480 B&W | |
| 22 | - PwrBook 100 68k (16 MHz) SWIM ADB-PMU PMU 640x480 B&W | |
| 23 | - Mac II 020 IWM MacII ADB ext NuBus card | |
| 24 | - Mac IIx 030 SWIM MacII ADB ext NuBus card | |
| 25 | - Mac IIfx 030 SWIM ADB-IOP ext NuBus card | |
| 26 | - Mac SE/30 030 SWIM MacII ADB ext Internal fake NuBus card (need video declaration ROM!) | |
| 27 | - Mac IIcx 030 SWIM ADB-CUDA ext NuBus card | |
| 28 | - Mac IIci 030 SWIM ADB-CUDA ext Internal "RBV" type | |
| 29 | - Mac LC 020 SWIM Egret ADB ext Internal "V8" type | |
| 30 | - Mac LC II 030 SWIM Egret ADB ext Internal "V8" type | |
| 31 | - Mac LC III 030 SWIM Egret ADB ext Internal "V8" type | |
| 32 | 32 | |
| 33 | Notes: | |
| 34 | - The Mac Plus boot code seems to check to see the extent of ROM | |
| 35 | mirroring to determine if SCSI is available. If the ROM is mirrored, | |
| 36 | then SCSI is not available. Thanks to R. Belmont for making this | |
| 37 | discovery. | |
| 38 | - On the SE and most later Macs, the first access to 4xxxxx turns off the overlay. | |
| 39 | However, the Mac II/IIx/IIcx (and others?) have the old-style VIA overlay control bit! | |
| 40 | - The Mac II can have either a 68551 PMMU fitted or an Apple custom that handles 24 vs. 32 | |
| 41 | bit addressing mode. The ROM is *not* 32-bit clean so Mac OS normally runs in 24 bit mode, | |
| 42 | but A/UX can run 32. | |
| 43 | - There are 5 known kinds of host-side ADB hardware: | |
| 44 | * "Mac II ADB" used in the SE, II, IIx, IIcx, SE/30, IIci, Quadra 610, Quadra 650, Quadra 700, | |
| 45 | Quadra 800, Centris 610 and Centris 650. This is a dumb state machine using the VIA. | |
| 46 | * "ADB-PMU" used in the Mac Portable and all 680x0-based PowerBooks. | |
| 47 | * "ADB-EGRET" used in the IIsi, IIvi, IIvx, Classic II, LC, LC II, LC III, Performa 460, | |
| 48 | and Performa 600. This is a 68HC05 with a different internal ROM than CUDA. | |
| 49 | * "ADB-IOP" (ADB driven by a 6502 coprocessor, similar to Lisa) used in the IIfx, | |
| 50 | Quadra 900, and Quadra 950. | |
| 51 | * "ADB-CUDA" (Apple's CUDA chip, which is a 68HC05 MCU) used in the Color Classic, LC 520, | |
| 52 | LC 55x, LC 57x, LC 58x, Quadra 630, Quadra 660AV, Quadra 840AV, PowerMac 6100/7100/8100, | |
| 53 | IIcx, IIci, and PowerMac 5200. | |
| 33 | Notes: | |
| 34 | - The Mac Plus boot code seems to check to see the extent of ROM | |
| 35 | mirroring to determine if SCSI is available. If the ROM is mirrored, | |
| 36 | then SCSI is not available. Thanks to R. Belmont for making this | |
| 37 | discovery. | |
| 38 | - On the SE and most later Macs, the first access to 4xxxxx turns off the overlay. | |
| 39 | However, the Mac II/IIx/IIcx (and others?) have the old-style VIA overlay control bit! | |
| 40 | - The Mac II can have either a 68551 PMMU fitted or an Apple custom that handles 24 vs. 32 | |
| 41 | bit addressing mode. The ROM is *not* 32-bit clean so Mac OS normally runs in 24 bit mode, | |
| 42 | but A/UX can run 32. | |
| 43 | - There are 5 known kinds of host-side ADB hardware: | |
| 44 | * "Mac II ADB" used in the SE, II, IIx, IIcx, SE/30, IIci, Quadra 610, Quadra 650, Quadra 700, | |
| 45 | Quadra 800, Centris 610 and Centris 650. This is a dumb state machine using the VIA. | |
| 46 | * "ADB-PMU" used in the Mac Portable and all 680x0-based PowerBooks. | |
| 47 | * "ADB-EGRET" used in the IIsi, IIvi, IIvx, Classic II, LC, LC II, LC III, Performa 460, | |
| 48 | and Performa 600. This is a 68HC05 with a different internal ROM than CUDA. | |
| 49 | * "ADB-IOP" (ADB driven by a 6502 coprocessor, similar to Lisa) used in the IIfx, | |
| 50 | Quadra 900, and Quadra 950. | |
| 51 | * "ADB-CUDA" (Apple's CUDA chip, which is a 68HC05 MCU) used in the Color Classic, LC 520, | |
| 52 | LC 55x, LC 57x, LC 58x, Quadra 630, Quadra 660AV, Quadra 840AV, PowerMac 6100/7100/8100, | |
| 53 | IIcx, IIci, and PowerMac 5200. | |
| 54 | 54 | |
| 55 | TODO: | |
| 56 | - Mac Portable and PowerBook 100 are similar to this hardware, but we need ROMs! | |
| 57 | - Call the RTC timer | |
| 58 | - SE FDHD and Classic require SWIM support. SWIM is 100% IWM compatible with 800k drives, but | |
| 59 | becomes a different chip for 1.44MB. | |
| 60 | - Check that 0x600000-0x6fffff still address RAM when overlay bit is off | |
| 61 | (IM-III seems to say it does not on Mac 128k, 512k, and 512ke). | |
| 62 | - What on earth are 0x700000-0x7fffff mapped to ? | |
| 55 | TODO: | |
| 56 | - Mac Portable and PowerBook 100 are similar to this hardware, but we need ROMs! | |
| 57 | - Call the RTC timer | |
| 58 | - SE FDHD and Classic require SWIM support. SWIM is 100% IWM compatible with 800k drives, but | |
| 59 | becomes a different chip for 1.44MB. | |
| 60 | - Check that 0x600000-0x6fffff still address RAM when overlay bit is off | |
| 61 | (IM-III seems to say it does not on Mac 128k, 512k, and 512ke). | |
| 62 | - What on earth are 0x700000-0x7fffff mapped to ? | |
| 63 | 63 | |
| 64 | 64 | |
| 65 | Mac LC notes: | |
| 66 | IOBase is 50f00000 in 32-bit mode and f00000 in 24-bit | |
| 67 | VIA1 is at IOBase | |
| 68 | IWM is at IOBase + 0x16000 | |
| 65 | Mac LC notes: | |
| 66 | IOBase is 50f00000 in 32-bit mode and f00000 in 24-bit | |
| 67 | VIA1 is at IOBase | |
| 68 | IWM is at IOBase + 0x16000 | |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | ****************************************************************************/ |
| r5932 | r5933 | |
| 270 | 270 | |
| 271 | 271 | |
| 272 | 272 | /* |
| 273 | ||
| 273 | Interrupt handling | |
| 274 | 274 | */ |
| 275 | 275 | |
| 276 | 276 | static int scc_interrupt, via_interrupt, scsi_interrupt, last_taken_interrupt; |
| r5932 | r5933 | |
| 393 | 393 | |
| 394 | 394 | |
| 395 | 395 | /* |
| 396 | ||
| 396 | R Nabet 000531 : added keyboard code | |
| 397 | 397 | */ |
| 398 | 398 | |
| 399 | 399 | /* ************************************************************************* |
| r5932 | r5933 | |
| 428 | 428 | static int kbd_shift_count; |
| 429 | 429 | |
| 430 | 430 | /* |
| 431 | ||
| 431 | scan_keyboard() | |
| 432 | 432 | |
| 433 | ||
| 433 | scan the keyboard, and returns key transition code (or NULL ($7B) if none) | |
| 434 | 434 | */ |
| 435 | 435 | |
| 436 | 436 | /* keyboard matrix to detect transition */ |
| r5932 | r5933 | |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /* |
| 547 | ||
| 547 | power-up init | |
| 548 | 548 | */ |
| 549 | 549 | static void keyboard_init(void) |
| 550 | 550 | { |
| r5932 | r5933 | |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | /* |
| 627 | ||
| 627 | called when inquiry times out (1/4s) | |
| 628 | 628 | */ |
| 629 | 629 | static TIMER_CALLBACK(inquiry_timeout_func) |
| 630 | 630 | { |
| r5932 | r5933 | |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | /* |
| 637 | ||
| 637 | called when a command is received from the mac | |
| 638 | 638 | */ |
| 639 | 639 | static void keyboard_receive(running_machine *machine, int val) |
| 640 | 640 | { |
| r5932 | r5933 | |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /* format : 1 if another device (-> keypad ?) connected | next device (-> keypad ?) number 1-8 |
| 684 | ||
| 684 | | keyboard model number 1-8 | 1 */ | |
| 685 | 685 | /* keyboards : |
| 686 | 3 : mac 512k, US and international layout ? Mac plus ??? | |
| 687 | other values : Apple II keyboards ? | |
| 688 | */ | |
| 686 | 3 : mac 512k, US and international layout ? Mac plus ??? | |
| 687 | other values : Apple II keyboards ? | |
| 688 | */ | |
| 689 | 689 | /* keypads : |
| 690 | ??? : standard keypad (always available on Mac Plus) ??? | |
| 691 | */ | |
| 690 | ??? : standard keypad (always available on Mac Plus) ??? | |
| 691 | */ | |
| 692 | 692 | kbd_shift_out(machine, 0x17); /* probably wrong */ |
| 693 | 693 | break; |
| 694 | 694 | |
| r5932 | r5933 | |
| 840 | 840 | scsiRd+sIDR $580060 Input Data Register |
| 841 | 841 | scsiRd+sRESET $580070 Reset Parity/Interrupt |
| 842 | 842 | |
| 843 | ||
| 843 | */ | |
| 844 | 844 | |
| 845 | 845 | READ16_HANDLER ( macplus_scsi_r ) |
| 846 | 846 | { |
| r5932 | r5933 | |
| 1056 | 1056 | ++rtc_seconds[3]; |
| 1057 | 1057 | |
| 1058 | 1058 | /*if (++rtc_seconds[4] == 0) |
| 1059 | if (++rtc_seconds[5] == 0) | |
| 1060 | if (++rtc_seconds[6] == 0) | |
| 1061 | ++rtc_seconds[7];*/ | |
| 1059 | if (++rtc_seconds[5] == 0) | |
| 1060 | if (++rtc_seconds[6] == 0) | |
| 1061 | ++rtc_seconds[7];*/ | |
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | /* Executes a command. |
| r5932 | r5933 | |
| 1278 | 1278 | READ16_HANDLER ( mac_iwm_r ) |
| 1279 | 1279 | { |
| 1280 | 1280 | /* The first time this is called is in a floppy test, which goes from |
| 1281 | * $400104 to $400126. After that, all access to the floppy goes through | |
| 1282 | * the disk driver in the MacOS | |
| 1283 | * | |
| 1284 | * I just thought this would be on interest to someone trying to further | |
| 1285 | * this driver along | |
| 1286 | */ | |
| 1281 | * $400104 to $400126. After that, all access to the floppy goes through | |
| 1282 | * the disk driver in the MacOS | |
| 1283 | * | |
| 1284 | * I just thought this would be on interest to someone trying to further | |
| 1285 | * this driver along | |
| 1286 | */ | |
| 1287 | 1287 | |
| 1288 | 1288 | UINT16 result = 0; |
| 1289 | 1289 | const device_config *fdc = devtag_get_device(space->machine, "fdc"); |
| r5932 | r5933 | |
| 1331 | 1331 | { |
| 1332 | 1332 | int NewX, NewY; |
| 1333 | 1333 | |
| 1334 | NewX = input_port_read(machine, "MOUSE2"); | |
| 1335 | NewY = input_port_read(machine, "MOUSE1"); | |
| 1334 | NewX = input_port_read(machine, "MOUSE2"); | |
| 1335 | NewY = input_port_read(machine, "MOUSE1"); | |
| 1336 | 1336 | |
| 1337 | 1337 | if ((NewX != adb_lastmousex) || (NewY != adb_lastmousey)) |
| 1338 | 1338 | { |
| r5932 | r5933 | |
| 1345 | 1345 | int MouseCountX = 0, MouseCountY = 0; |
| 1346 | 1346 | int NewX, NewY; |
| 1347 | 1347 | |
| 1348 | NewX = input_port_read(machine, "MOUSE2"); | |
| 1349 | NewY = input_port_read(machine, "MOUSE1"); | |
| 1348 | NewX = input_port_read(machine, "MOUSE2"); | |
| 1349 | NewY = input_port_read(machine, "MOUSE1"); | |
| 1350 | 1350 | |
| 1351 | 1351 | /* see if it moved in the x coord */ |
| 1352 | 1352 | if (NewX != adb_lastmousex) |
| r5932 | r5933 | |
| 1391 | 1391 | addr = (adb_command>>4); |
| 1392 | 1392 | reg = (adb_command & 3); |
| 1393 | 1393 | |
| 1394 | // | |
| 1394 | // printf("Mac sent %x\n", adb_command); | |
| 1395 | 1395 | |
| 1396 | 1396 | if (adb_waiting_cmd) |
| 1397 | 1397 | { |
| r5932 | r5933 | |
| 1417 | 1417 | break; |
| 1418 | 1418 | |
| 1419 | 1419 | case 2: // listen |
| 1420 | // | |
| 1420 | // printf("ADB LISTEN: reg %x address %x\n", reg, addr); | |
| 1421 | 1421 | adb_direction = 1; // input from Mac |
| 1422 | 1422 | adb_listenreg = reg; |
| 1423 | 1423 | adb_listenaddr = addr; |
| 1424 | 1424 | break; |
| 1425 | 1425 | |
| 1426 | 1426 | case 3: // talk |
| 1427 | // | |
| 1427 | // printf("ADB TALK: reg %x address %x\n", reg, addr); | |
| 1428 | 1428 | |
| 1429 | 1429 | adb_direction = 0; // output to Mac |
| 1430 | 1430 | if (addr == adb_mouseaddr) |
| 1431 | 1431 | { |
| 1432 | 1432 | UINT8 mouseX, mouseY; |
| 1433 | 1433 | |
| 1434 | // | |
| 1434 | // printf("Talking to mouse, register %x\n", reg); | |
| 1435 | 1435 | |
| 1436 | 1436 | switch (reg) |
| 1437 | 1437 | { |
| 1438 | 1438 | // read mouse |
| 1439 | case 0: | |
| 1439 | case 0: | |
| 1440 | 1440 | mac_adb_accummouse(machine, &mouseX, &mouseY); |
| 1441 | 1441 | adb_buffer[0] = (input_port_read(machine, "MOUSE0") & 0x01) ? 0x00 : 0x80; |
| 1442 | 1442 | adb_buffer[0] |= mouseX & 0x7f; |
| r5932 | r5933 | |
| 1459 | 1459 | } |
| 1460 | 1460 | else if (addr == adb_keybaddr) |
| 1461 | 1461 | { |
| 1462 | // | |
| 1462 | // printf("Talking to keyboard, register %x\n", reg); | |
| 1463 | 1463 | |
| 1464 | 1464 | switch (reg) |
| 1465 | 1465 | { |
| 1466 | 1466 | // read keyboard |
| 1467 | case 0: | |
| 1467 | case 0: | |
| 1468 | 1468 | adb_buffer[0] = adb_buffer[1] = 0x80; // nothing pressed |
| 1469 | 1469 | adb_datasize = 2; |
| 1470 | 1470 | break; |
| r5932 | r5933 | |
| 1539 | 1539 | ret = (adb_send & 0x80)>>7; |
| 1540 | 1540 | adb_send <<= 1; |
| 1541 | 1541 | |
| 1542 | // | |
| 1542 | // printf("IN CB2 = %x\n", ret); | |
| 1543 | 1543 | |
| 1544 | 1544 | return ret; |
| 1545 | 1545 | } |
| 1546 | 1546 | |
| 1547 | 1547 | static WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2) |
| 1548 | 1548 | { |
| 1549 | // | |
| 1549 | // printf("OUT CB2 = %x\n", data); | |
| 1550 | 1550 | adb_command <<= 1; |
| 1551 | 1551 | adb_command |= data & 1; |
| 1552 | 1552 | } |
| r5932 | r5933 | |
| 1650 | 1650 | * |
| 1651 | 1651 | * PORT A |
| 1652 | 1652 | * |
| 1653 | * bit 7 R SCC Wait/Request | |
| 1654 | * bit 6 W Main/Alternate screen buffer select | |
| 1655 | * bit 5 W Floppy Disk Line Selection | |
| 1656 | * bit 4 W Overlay/Normal memory mapping | |
| 1657 | * bit 3 W Main/Alternate sound buffer | |
| 1658 | * bit 2-0 W Sound Volume | |
| 1653 | * bit 7 R SCC Wait/Request | |
| 1654 | * bit 6 W Main/Alternate screen buffer select | |
| 1655 | * bit 5 W Floppy Disk Line Selection | |
| 1656 | * bit 4 W Overlay/Normal memory mapping | |
| 1657 | * bit 3 W Main/Alternate sound buffer | |
| 1658 | * bit 2-0 W Sound Volume | |
| 1659 | 1659 | * |
| 1660 | 1660 | * |
| 1661 | 1661 | * PORT B |
| 1662 | 1662 | * |
| 1663 | * bit 7 W Sound enable | |
| 1664 | * bit 6 R Video beam in display | |
| 1665 | * bit 5 (pre-ADB) R Mouse Y2 | |
| 1666 | * (ADB) W ADB ST1 | |
| 1667 | * bit 4 (pre-ADB) R Mouse X2 | |
| 1668 | * (ADB) W ADB ST0 | |
| 1669 | * bit 3 (pre-ADB) R Mouse button (active low) | |
| 1670 | * (ADB) R ADB INT | |
| 1671 | * bit 2 W Real time clock enable | |
| 1672 | * bit 1 W Real time clock data clock | |
| 1673 | * bit 0 RW Real time clock data | |
| 1663 | * bit 7 W Sound enable | |
| 1664 | * bit 6 R Video beam in display | |
| 1665 | * bit 5 (pre-ADB) R Mouse Y2 | |
| 1666 | * (ADB) W ADB ST1 | |
| 1667 | * bit 4 (pre-ADB) R Mouse X2 | |
| 1668 | * (ADB) W ADB ST0 | |
| 1669 | * bit 3 (pre-ADB) R Mouse button (active low) | |
| 1670 | * (ADB) R ADB INT | |
| 1671 | * bit 2 W Real time clock enable | |
| 1672 | * bit 1 W Real time clock data clock | |
| 1673 | * bit 0 RW Real time clock data | |
| 1674 | 1674 | * |
| 1675 | 1675 | */ |
| 1676 | 1676 | |
| r5932 | r5933 | |
| 1736 | 1736 | mac_set_volume(sound, data & 0x07); |
| 1737 | 1737 | |
| 1738 | 1738 | /* Early Mac models had VIA A4 control overlaying. In the Mac SE (and |
| 1739 | * possibly later models), overlay was set on reset, but cleared on the | |
| 1740 | * first access to the ROM. */ | |
| 1739 | * possibly later models), overlay was set on reset, but cleared on the | |
| 1740 | * first access to the ROM. */ | |
| 1741 | 1741 | if (mac_model < MODEL_MAC_SE) |
| 1742 | 1742 | set_memory_overlay(device->machine, (data & 0x10) >> 4); |
| 1743 | 1743 | } |
| r5932 | r5933 | |
| 1996 | 1996 | { SCSI_ID_6, "harddisk2", SCSI_DEVICE_HARDDISK } /* SCSI ID 6, using CHD 0, and it's a harddisk */ |
| 1997 | 1997 | } |
| 1998 | 1998 | }; |
| 1999 | // 41a868 | |
| 1999 | // 41a868 41a5ac = data copy | |
| 2000 | 2000 | static const struct NCR5380interface macplus_5380intf = |
| 2001 | 2001 | { |
| 2002 | 2002 | &dev_table, // SCSI device table |
| r5932 | r5933 | |
| 2011 | 2011 | MACHINE_START( macscsi ) |
| 2012 | 2012 | { |
| 2013 | 2013 | ncr5380_init(machine, &macplus_5380intf); |
| 2014 | ||
| 2014 | ||
| 2015 | 2015 | add_exit_callback(machine, macscsi_exit); |
| 2016 | 2016 | } |
| 2017 | 2017 | |
| r5932 | r5933 | |
| 3040 | 3040 | |
| 3041 | 3041 | case 0xa9a0: /* _GetResource */ |
| 3042 | 3042 | /* HACKHACK - the 'type' output assumes that the host is little endian |
| 3043 | * since this is just trace code it isn't much of an issue | |
| 3044 | */ | |
| 3043 | * since this is just trace code it isn't much of an issue | |
| 3044 | */ | |
| 3045 | 3045 | sprintf(s, " type='%c%c%c%c' id=%i", (char) mem[a7+3], (char) mem[a7+2], |
| 3046 | 3046 | (char) mem[a7+5], (char) mem[a7+4], *((INT16*) (mem + a7))); |
| 3047 | 3047 | break; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | Philips PCF8593 CMOS clock/calendar circuit | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 423 | 423 | /* |
| 424 | 424 | NVRAM_HANDLER( pcf8593 ) |
| 425 | 425 | { |
| 426 | _logerror( 0, ("nvram_handler_pcf8593 (%p/%d)\n", file, read_or_write)); | |
| 427 | if (read_or_write) | |
| 428 | { | |
| 429 | pcf8593_save( file); | |
| 430 | } | |
| 431 | else | |
| 432 | { | |
| 433 | if (file) | |
| 434 | { | |
| 435 | pcf8593_load( file); | |
| 436 | } | |
| 437 | else | |
| 438 | { | |
| 439 | memset( rtc->data, 0, rtc->size); | |
| 440 | } | |
| 441 | } | |
| 426 | _logerror( 0, ("nvram_handler_pcf8593 (%p/%d)\n", file, read_or_write)); | |
| 427 | if (read_or_write) | |
| 428 | { | |
| 429 | pcf8593_save( file); | |
| 430 | } | |
| 431 | else | |
| 432 | { | |
| 433 | if (file) | |
| 434 | { | |
| 435 | pcf8593_load( file); | |
| 436 | } | |
| 437 | else | |
| 438 | { | |
| 439 | memset( rtc->data, 0, rtc->size); | |
| 440 | } | |
| 441 | } | |
| 442 | 442 | } |
| 443 | 443 | */ |
| 444 | 444 |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | #include "includes/ac1.h" |
| 12 | 12 | |
| 13 | 13 | static READ8_DEVICE_HANDLER (ac1_port_b_r) |
| 14 | { | |
| 14 | { | |
| 15 | 15 | return 0xff; |
| 16 | 16 | } |
| 17 | 17 | |
| r5932 | r5933 | |
| 26 | 26 | UINT8 line4 = input_port_read(device->machine, "LINE4"); |
| 27 | 27 | UINT8 line5 = input_port_read(device->machine, "LINE5"); |
| 28 | 28 | UINT8 line6 = input_port_read(device->machine, "LINE6"); |
| 29 | ||
| 29 | ||
| 30 | 30 | UINT8 SH = BNOT(BIT(line6,0)); |
| 31 | 31 | UINT8 CTRL = BNOT(BIT(line6,1)); |
| 32 | 32 | UINT8 SPACE = BIT(line6,2); |
| 33 | 33 | UINT8 ENTER = BIT(line6,3); |
| 34 | 34 | UINT8 BACK = BIT(line6,4); |
| 35 | ||
| 35 | ||
| 36 | 36 | UINT8 all = line0 | line1 | line2 | line3 | line4 | line5; |
| 37 | 37 | UINT8 s1 = BNOT(BIT(all,0));UINT8 z1 = (line0 !=0) ? 0 : 1; |
| 38 | 38 | UINT8 s2 = BNOT(BIT(all,1));UINT8 z2 = (line1 !=0) ? 0 : 1; |
| r5932 | r5933 | |
| 43 | 43 | UINT8 s7 = BNOT(BIT(all,6)); |
| 44 | 44 | UINT8 s8 = BNOT(BIT(all,7)); |
| 45 | 45 | UINT8 tast,td0,td1,td2,td3,td4,td5,td6,dg5; |
| 46 | ||
| 46 | ||
| 47 | 47 | /* Additional double keys */ |
| 48 | 48 | if (SPACE) { |
| 49 | 49 | z1 = 0; s1 = 0; SH = 0; |
| r5932 | r5933 | |
| 54 | 54 | if (BACK) { |
| 55 | 55 | z4 = 0; s1 = 0; CTRL = 0; |
| 56 | 56 | } |
| 57 | ||
| 57 | ||
| 58 | 58 | tast = BNOT(s1 & s2 & s3 & s4 & s5 &s6 & s7 & s8); |
| 59 | 59 | td0 = BNOT(s2 & s4 & s6 & s8); |
| 60 | 60 | td1 = BNOT(s3 & s4 & s7 & s8); |
| r5932 | r5933 | |
| 64 | 64 | dg5 = BNOT(z3 & z4 & z5 & z6); |
| 65 | 65 | td5 = BNOT(BNOT(dg5 & BNOT(SH)) & z1 & z2); |
| 66 | 66 | td6 = (dg5 & CTRL); |
| 67 | return td0 + (td1 << 1) +(td2 << 2) +(td3 << 3) +(td4 << 4) +(td5 << 5) +(td6 << 6) +(tast << 7); | |
| 67 | return td0 + (td1 << 1) +(td2 << 2) +(td3 << 3) +(td4 << 4) +(td5 << 5) +(td6 << 6) +(tast << 7); | |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | static WRITE8_DEVICE_HANDLER (ac1_port_a_w) |
| r5932 | r5933 | |
|---|---|---|
| 138 | 138 | devcb_resolve_write_line(&i8212->out_int_func, &intf->out_int_func, device); |
| 139 | 139 | devcb_resolve_read8(&i8212->in_di_func, &intf->in_di_func, device); |
| 140 | 140 | devcb_resolve_write8(&i8212->out_do_func, &intf->out_do_func, device); |
| 141 | ||
| 141 | ||
| 142 | 142 | /* register for state saving */ |
| 143 | 143 | state_save_register_device_item(device, 0, i8212->md); |
| 144 | 144 | state_save_register_device_item(device, 0, i8212->stb); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/mpc105.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Motorola MPC105 PCI bridge | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | Philips PCF8593 CMOS clock/calendar circuit | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | _DS1 1 |* \_/ | 24 Vcc | |
| 11 | MD 2 | | 23 _INT | |
| 12 | DI1 3 | | 22 DI8 | |
| 13 | DO1 4 | | 21 DO8 | |
| 14 | DI2 5 | | 20 DI7 | |
| 15 | DO2 6 | 8212 | 19 DO7 | |
| 16 | DI3 7 | | 18 DI6 | |
| 17 | DO3 8 | | 17 DO6 | |
| 18 | DI4 9 | | 16 DI5 | |
| 19 | DO4 10 | | 15 DO5 | |
| 20 | STB 11 | | 14 _CLR | |
| 21 | GND 12 |_____________| 13 DS2 | |
| 9 | _____ _____ | |
| 10 | _DS1 1 |* \_/ | 24 Vcc | |
| 11 | MD 2 | | 23 _INT | |
| 12 | DI1 3 | | 22 DI8 | |
| 13 | DO1 4 | | 21 DO8 | |
| 14 | DI2 5 | | 20 DI7 | |
| 15 | DO2 6 | 8212 | 19 DO7 | |
| 16 | DI3 7 | | 18 DI6 | |
| 17 | DO3 8 | | 17 DO6 | |
| 18 | DI4 9 | | 16 DI5 | |
| 19 | DO4 10 | | 15 DO5 | |
| 20 | STB 11 | | 14 _CLR | |
| 21 | GND 12 |_____________| 13 DS2 | |
| 22 | 22 | |
| 23 | 23 | **********************************************************************/ |
| 24 | 24 |
| r5932 | r5933 | |
|---|---|---|
| 194 | 194 | return devtag_get_device(device->machine,i8271->intf->floppy_drive_tags[i8271->drive]); |
| 195 | 195 | } else { |
| 196 | 196 | return NULL; |
| 197 | } | |
| 197 | } | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
| r5932 | r5933 | |
| 1078 | 1078 | status |= (1<<2) | (1<<6); |
| 1079 | 1079 | |
| 1080 | 1080 | /* these two do not appear to be set at all! ?? */ |
| 1081 | ||
| 1081 | ||
| 1082 | 1082 | if (i8271->intf->floppy_drive_tags[0]!=NULL) { |
| 1083 | 1083 | if (floppy_drive_get_flag_state(devtag_get_device(device->machine,i8271->intf->floppy_drive_tags[0]), FLOPPY_DRIVE_READY)) |
| 1084 | 1084 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/mpc105.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Motorola MPC105 PCI bridge | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 990_tap.c: emulation of a generic ti990 tape controller, for use with | |
| 3 | TILINE-based TI990 systems (TI990/10, /12, /12LR, /10A, Business system 300 | |
| 4 | and 300A). | |
| 2 | 990_tap.c: emulation of a generic ti990 tape controller, for use with | |
| 3 | TILINE-based TI990 systems (TI990/10, /12, /12LR, /10A, Business system 300 | |
| 4 | and 300A). | |
| 5 | 5 | |
| 6 | This core will emulate the common feature set found in every tape controller. | |
| 7 | Most controllers support additional features, but are still compatible with | |
| 8 | the basic feature set. I have a little documentation on two specific | |
| 9 | tape controllers (MT3200 and WD800/WD800A), but I have not tried to emulate | |
| 10 | controller-specific features. | |
| 6 | This core will emulate the common feature set found in every tape controller. | |
| 7 | Most controllers support additional features, but are still compatible with | |
| 8 | the basic feature set. I have a little documentation on two specific | |
| 9 | tape controllers (MT3200 and WD800/WD800A), but I have not tried to emulate | |
| 10 | controller-specific features. | |
| 11 | 11 | |
| 12 | 12 | |
| 13 | ||
| 13 | Long description: see 2234398-9701 and 2306140-9701. | |
| 14 | 14 | |
| 15 | 15 | |
| 16 | ||
| 16 | Raphael Nabet 2002 | |
| 17 | 17 | */ |
| 18 | 18 | /* |
| 19 | ||
| 19 | Image encoding: | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 2 bytes: record len - little-endian | |
| 23 | 2 bytes: always 0s (length MSBs?) | |
| 24 | len bytes: data | |
| 25 | 2 bytes: record len - little-endian | |
| 26 | 2 bytes: always 0s (length MSBs?) | |
| 22 | 2 bytes: record len - little-endian | |
| 23 | 2 bytes: always 0s (length MSBs?) | |
| 24 | len bytes: data | |
| 25 | 2 bytes: record len - little-endian | |
| 26 | 2 bytes: always 0s (length MSBs?) | |
| 27 | 27 | |
| 28 | ||
| 28 | 4 0s: EOF mark | |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | 31 | #include "driver.h" |
| r5932 | r5933 | |
| 86 | 86 | w7_tiline_parity_err = 0x0010, |
| 87 | 87 | w7_tiline_timing_err = 0x0008, |
| 88 | 88 | w7_tiline_timeout_err = 0x0004, |
| 89 | /*w7_format_error | |
| 89 | /*w7_format_error = 0x0002,*/ | |
| 90 | 90 | w7_tape_error = 0x0001 |
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | 93 | static const UINT16 w_mask[8] = |
| 94 | 94 | { |
| 95 | 95 | 0x000f, /* Controllers should prevent overwriting of w0 status bits, and I know |
| 96 | ||
| 96 | that some controllers do so. */ | |
| 97 | 97 | 0xffff, |
| 98 | 98 | 0xffff, |
| 99 | 99 | 0xffff, |
| r5932 | r5933 | |
| 124 | 124 | |
| 125 | 125 | /*DEVICE_STOP( ti990_tape ) |
| 126 | 126 | { |
| 127 | ||
| 127 | d->img = NULL; | |
| 128 | 128 | }*/ |
| 129 | 129 | |
| 130 | 130 | /* |
| 131 | ||
| 131 | Open a tape image | |
| 132 | 132 | */ |
| 133 | 133 | DEVICE_IMAGE_LOAD( ti990_tape ) |
| 134 | 134 | { |
| r5932 | r5933 | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | ||
| 154 | Close a tape image | |
| 155 | 155 | */ |
| 156 | 156 | DEVICE_IMAGE_UNLOAD( ti990_tape ) |
| 157 | 157 | { |
| r5932 | r5933 | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /* |
| 171 | ||
| 171 | Init the tape controller core | |
| 172 | 172 | */ |
| 173 | 173 | void ti990_tpc_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state)) |
| 174 | 174 | { |
| r5932 | r5933 | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /* |
| 186 | Parse the tape select lines, and return the corresponding tape unit. | |
| 187 | (-1 if none) | |
| 186 | Parse the tape select lines, and return the corresponding tape unit. | |
| 187 | (-1 if none) | |
| 188 | 188 | */ |
| 189 | 189 | static int cur_tape_unit(void) |
| 190 | 190 | { |
| r5932 | r5933 | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /* |
| 212 | ||
| 212 | Update interrupt state | |
| 213 | 213 | */ |
| 214 | 214 | static void update_interrupt(running_machine *machine) |
| 215 | 215 | { |
| r5932 | r5933 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /* |
| 223 | ||
| 223 | Handle the read binary forward command: read the next record on tape. | |
| 224 | 224 | */ |
| 225 | 225 | static void cmd_read_binary_forward(running_machine *machine) |
| 226 | 226 | { |
| r5932 | r5933 | |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /* |
| 449 | ||
| 449 | Handle the record skip forward command: skip a specified number of records. | |
| 450 | 450 | */ |
| 451 | 451 | static void cmd_record_skip_forward(running_machine *machine) |
| 452 | 452 | { |
| r5932 | r5933 | |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /* |
| 585 | ||
| 585 | Handle the record skip reverse command: skip a specified number of records backwards. | |
| 586 | 586 | */ |
| 587 | 587 | static void cmd_record_skip_reverse(running_machine *machine) |
| 588 | 588 | { |
| r5932 | r5933 | |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | /* |
| 743 | ||
| 743 | Handle the rewind command: rewind to BOT. | |
| 744 | 744 | */ |
| 745 | 745 | static void cmd_rewind(running_machine *machine) |
| 746 | 746 | { |
| r5932 | r5933 | |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | /* |
| 790 | ||
| 790 | Handle the rewind and offline command: disable the tape unit. | |
| 791 | 791 | */ |
| 792 | 792 | static void cmd_rewind_and_offline(running_machine *machine) |
| 793 | 793 | { |
| r5932 | r5933 | |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | /* |
| 828 | ||
| 828 | Handle the read transport status command: return the current tape status. | |
| 829 | 829 | */ |
| 830 | 830 | static void read_transport_status(running_machine *machine) |
| 831 | 831 | { |
| r5932 | r5933 | |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | /* |
| 868 | ||
| 868 | Parse command code and execute the command. | |
| 869 | 869 | */ |
| 870 | 870 | static void execute_command(running_machine *machine) |
| 871 | 871 | { |
| r5932 | r5933 | |
| 952 | 952 | |
| 953 | 953 | |
| 954 | 954 | /* |
| 955 | ||
| 955 | Read one register in TPCS space | |
| 956 | 956 | */ |
| 957 | 957 | READ16_HANDLER(ti990_tpc_r) |
| 958 | 958 | { |
| r5932 | r5933 | |
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | /* |
| 966 | ||
| 966 | Write one register in TPCS space. Execute command if w7_idle is cleared. | |
| 967 | 967 | */ |
| 968 | 968 | WRITE16_HANDLER(ti990_tpc_w) |
| 969 | 969 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Amiga CD-ROM controller emulation | |
| 4 | 4 | |
| 5 | 5 | Notes: |
| 6 | 6 | Many thanks to Toni Wilen for all the help and information about the |
| r5932 | r5933 | |
| 28 | 28 | |
| 29 | 29 | /*************************************************************************** |
| 30 | 30 | |
| 31 | ||
| 31 | DMAC | |
| 32 | 32 | |
| 33 | 33 | ***************************************************************************/ |
| 34 | 34 | |
| r5932 | r5933 | |
| 382 | 382 | |
| 383 | 383 | /*************************************************************************** |
| 384 | 384 | |
| 385 | ||
| 385 | Autoconfig | |
| 386 | 386 | |
| 387 | 387 | ***************************************************************************/ |
| 388 | 388 | |
| r5932 | r5933 | |
| 420 | 420 | |
| 421 | 421 | /*************************************************************************** |
| 422 | 422 | |
| 423 | ||
| 423 | TPI6525 | |
| 424 | 424 | |
| 425 | 425 | ***************************************************************************/ |
| 426 | 426 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | 990_tap.h: include file for 990_tap.c | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | DEVICE_START( ti990_tape ); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Corvus Concept driver | |
| 3 | 3 | |
| 4 | ||
| 4 | Raphael Nabet, Brett Wyer, 2003-2005 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| r5932 | r5933 | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /* |
| 208 | ||
| 208 | VIA port A | |
| 209 | 209 | |
| 210 | 0: omninet ready (I) | |
| 211 | 1: CTS0 (I) | |
| 212 | 2: CTS1 (I) | |
| 213 | 3: DSR0 (I) | |
| 214 | 4: DSR1 (I) | |
| 215 | 5: DCD0 (I) | |
| 216 | 6: DCD1 (I) | |
| 217 | 7: IOX (O) | |
| 210 | 0: omninet ready (I) | |
| 211 | 1: CTS0 (I) | |
| 212 | 2: CTS1 (I) | |
| 213 | 3: DSR0 (I) | |
| 214 | 4: DSR1 (I) | |
| 215 | 5: DCD0 (I) | |
| 216 | 6: DCD1 (I) | |
| 217 | 7: IOX (O) | |
| 218 | 218 | */ |
| 219 | 219 | static READ8_DEVICE_HANDLER(via_in_a) |
| 220 | 220 | { |
| r5932 | r5933 | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /* |
| 232 | ||
| 232 | VIA port B | |
| 233 | 233 | |
| 234 | 0: video off (O) | |
| 235 | 1: video address 17 (O) | |
| 236 | 2: video address 18 (O) | |
| 237 | 3: monitor orientation (I) | |
| 238 | 4: CH rate select DC0 (serial port line) (O) | |
| 239 | 5: CH rate select DC1 (serial port line) (O) | |
| 240 | 6: boot switch 0 (I) | |
| 241 | 7: boot switch 1 (I) | |
| 234 | 0: video off (O) | |
| 235 | 1: video address 17 (O) | |
| 236 | 2: video address 18 (O) | |
| 237 | 3: monitor orientation (I) | |
| 238 | 4: CH rate select DC0 (serial port line) (O) | |
| 239 | 5: CH rate select DC1 (serial port line) (O) | |
| 240 | 6: boot switch 0 (I) | |
| 241 | 7: boot switch 1 (I) | |
| 242 | 242 | */ |
| 243 | 243 | static READ8_DEVICE_HANDLER(via_in_b) |
| 244 | 244 | { |
| r5932 | r5933 | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /* |
| 258 | ||
| 258 | VIA CB2: used as sound output | |
| 259 | 259 | */ |
| 260 | 260 | static WRITE8_DEVICE_HANDLER(via_out_cb2) |
| 261 | 261 | { |
| r5932 | r5933 | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /* |
| 266 | ||
| 266 | VIA irq -> 68k level 5 | |
| 267 | 267 | */ |
| 268 | 268 | static void via_irq_func(const device_config *device, int state) |
| 269 | 269 | { |
| r5932 | r5933 | |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /* |
| 530 | ||
| 530 | Concept fdc controller | |
| 531 | 531 | */ |
| 532 | 532 | |
| 533 | 533 | static UINT8 fdc_local_status; |
| r5932 | r5933 | |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | /* |
| 680 | * | |
| 680 | * Concept Hard Disk Controller (hdc) | |
| 681 | 681 | */ |
| 682 | 682 | |
| 683 | 683 | static READ8_HANDLER(concept_hdc_reg_r); |
| r5932 | r5933 | |
| 685 | 685 | static READ8_HANDLER(concept_hdc_rom_r); |
| 686 | 686 | |
| 687 | 687 | /* |
| 688 | * | |
| 688 | * Hook up the Register and ROM R/W routines into the Slot I/O Space | |
| 689 | 689 | */ |
| 690 | 690 | |
| 691 | 691 | static void concept_hdc_init(running_machine *machine, int slot) |
| r5932 | r5933 | |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | /* |
| 698 | * | |
| 698 | * Handle reads against the Hard Disk Controller's onboard registers | |
| 699 | 699 | */ |
| 700 | 700 | static READ8_HANDLER(concept_hdc_reg_r) |
| 701 | 701 | { |
| r5932 | r5933 | |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /* |
| 717 | * | |
| 717 | * Handle writes against the Hard Disk Controller's onboard registers | |
| 718 | 718 | */ |
| 719 | 719 | static WRITE8_HANDLER(concept_hdc_reg_w) |
| 720 | 720 | { |
| r5932 | r5933 | |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | /* |
| 731 | * | |
| 731 | * Handle reads agsint the Hard Disk Controller's onboard ROM | |
| 732 | 732 | */ |
| 733 | 733 | static READ8_HANDLER(concept_hdc_rom_r) |
| 734 | 734 | { |
| r5932 | r5933 | |
|---|---|---|
| 3 | 3 | |
| 4 | 4 | MESS Driver By: |
| 5 | 5 | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 19 | 19 | const uPD7002_interface *intf; |
| 20 | 20 | |
| 21 | 21 | /* Status Register |
| 22 | D0 and D1 define the currently selected input channel | |
| 23 | D2 flag output | |
| 24 | D3 0 = 8 bit mode 1 = 12 bit mode | |
| 25 | D4 2nd MSB of conversion | |
| 26 | D5 MSB of conversion | |
| 27 | D6 0 = busy, 1 = not busy (~busy) | |
| 28 | D7 0 = conversion completed, 1 = conversion not completed (~EOC) | |
| 29 | */ | |
| 22 | D0 and D1 define the currently selected input channel | |
| 23 | D2 flag output | |
| 24 | D3 0 = 8 bit mode 1 = 12 bit mode | |
| 25 | D4 2nd MSB of conversion | |
| 26 | D5 MSB of conversion | |
| 27 | D6 0 = busy, 1 = not busy (~busy) | |
| 28 | D7 0 = conversion completed, 1 = conversion not completed (~EOC) | |
| 29 | */ | |
| 30 | 30 | int status; |
| 31 | 31 | |
| 32 | 32 | /* High data byte |
| 33 | ||
| 33 | This byte contains the 8 most significant bits of the analogue to digital conversion. */ | |
| 34 | 34 | int data1; |
| 35 | 35 | |
| 36 | 36 | /* Low data byte |
| 37 | In 12 bit mode: Bits 7 to 4 define the four low order bits of the conversion. | |
| 38 | In 8 bit mode. All bits 7 to 4 are inaccurate. | |
| 39 | Bits 3 to 0 are always set to low. */ | |
| 37 | In 12 bit mode: Bits 7 to 4 define the four low order bits of the conversion. | |
| 38 | In 8 bit mode. All bits 7 to 4 are inaccurate. | |
| 39 | Bits 3 to 0 are always set to low. */ | |
| 40 | 40 | int data0; |
| 41 | 41 | |
| 42 | 42 | |
| r5932 | r5933 | |
| 44 | 44 | int digitalvalue; |
| 45 | 45 | |
| 46 | 46 | /* this counter is used to check a full end of conversion has been reached |
| 47 | if the uPD7002 is half way through one conversion and a new conversion is requested | |
| 48 | the counter at the end of the first conversion will not match and not be processed | |
| 49 | only then at the end of the second conversion will the conversion complete function run */ | |
| 47 | if the uPD7002 is half way through one conversion and a new conversion is requested | |
| 48 | the counter at the end of the first conversion will not match and not be processed | |
| 49 | only then at the end of the second conversion will the conversion complete function run */ | |
| 50 | 50 | int conversion_counter; |
| 51 | 51 | }; |
| 52 | 52 | |
| r5932 | r5933 | |
| 122 | 122 | { |
| 123 | 123 | case 0: |
| 124 | 124 | /* |
| 125 | Data Latch/AD start | |
| 126 | D0 and D1 together define which one of the four input channels is selected | |
| 127 | D2 flag input, normally set to 0???? | |
| 128 | D3 defines whether an 8 (0) or 12 (1) bit resolution conversion should occur | |
| 129 | D4 to D7 not used. | |
| 125 | Data Latch/AD start | |
| 126 | D0 and D1 together define which one of the four input channels is selected | |
| 127 | D2 flag input, normally set to 0???? | |
| 128 | D3 defines whether an 8 (0) or 12 (1) bit resolution conversion should occur | |
| 129 | D4 to D7 not used. | |
| 130 | 130 | |
| 131 | an 8 bit conversion typically takes 4ms | |
| 132 | an 12 bit conversion typically takes 10ms | |
| 131 | an 8 bit conversion typically takes 4ms | |
| 132 | an 12 bit conversion typically takes 10ms | |
| 133 | 133 | |
| 134 | writing to this register will initiate a conversion. | |
| 135 | */ | |
| 134 | writing to this register will initiate a conversion. | |
| 135 | */ | |
| 136 | 136 | |
| 137 | 137 | /* set D6=0 busy ,D7=1 conversion not complete */ |
| 138 | 138 | uPD7002->status=(data & 0x0f) | 0x80; |
| r5932 | r5933 | |
| 142 | 142 | if (uPD7002->intf->EOC_func) uPD7002->intf->EOC_func(device, 1); |
| 143 | 143 | |
| 144 | 144 | /* the uPD7002 works by sampling the analogue value at the start of the conversion |
| 145 | ||
| 145 | so it is read hear and stored until the end of the A to D conversion */ | |
| 146 | 146 | |
| 147 | 147 | // this function should return a 16 bit value. |
| 148 | 148 | uPD7002->digitalvalue = uPD7002->intf->get_analogue_func(device, uPD7002->status & 0x03); |
| r5932 | r5933 | |
| 166 | 166 | |
| 167 | 167 | case 3: |
| 168 | 168 | /* Test Mode: Used for inspecting the device, The data input-output terminals assume an input |
| 169 | state and are connected to the A/D counter. Therefore, the A/D conversion data | |
| 170 | read out after this is meaningless. | |
| 171 | */ | |
| 169 | state and are connected to the A/D counter. Therefore, the A/D conversion data | |
| 170 | read out after this is meaningless. | |
| 171 | */ | |
| 172 | 172 | break; |
| 173 | 173 | } |
| 174 | 174 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Atmel at29c040a flash EEPROM | |
| 3 | 3 | |
| 4 | ||
| 4 | 512k*8 FEEPROM, organized in pages of 256 bytes. | |
| 5 | 5 | |
| 6 | References: | |
| 7 | Datasheets were found on Atmel's site (www.atmel.com) | |
| 6 | References: | |
| 7 | Datasheets were found on Atmel's site (www.atmel.com) | |
| 8 | 8 | |
| 9 | ||
| 9 | Raphael Nabet 2003 | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | #include "driver.h" |
| r5932 | r5933 | |
| 24 | 24 | #define BYTE_ADDRESS_MASK 0x000ff |
| 25 | 25 | |
| 26 | 26 | /* |
| 27 | ||
| 27 | at29c40a state | |
| 28 | 28 | |
| 29 | Command states (s_cmd_0 is the initial state): | |
| 30 | s_cmd_0: default state | |
| 31 | s_cmd_1: state after writing aa to 5555 | |
| 32 | s_cmd_2: state after writing 55 to 2aaa | |
| 29 | Command states (s_cmd_0 is the initial state): | |
| 30 | s_cmd_0: default state | |
| 31 | s_cmd_1: state after writing aa to 5555 | |
| 32 | s_cmd_2: state after writing 55 to 2aaa | |
| 33 | 33 | |
| 34 | Programming states (s_programming_0 is the initial state): | |
| 35 | s_programming_0: default state | |
| 36 | s_programming_1: a program and enable/disable lock command has been | |
| 37 | executed, but programming has not actually started. | |
| 38 | s_programming_2: the programming buffer is being written to | |
| 39 | s_programming_3: the programming buffer is being burnt to flash ROM | |
| 34 | Programming states (s_programming_0 is the initial state): | |
| 35 | s_programming_0: default state | |
| 36 | s_programming_1: a program and enable/disable lock command has been | |
| 37 | executed, but programming has not actually started. | |
| 38 | s_programming_2: the programming buffer is being written to | |
| 39 | s_programming_3: the programming buffer is being burnt to flash ROM | |
| 40 | 40 | */ |
| 41 | 41 | static struct |
| 42 | 42 | { |
| r5932 | r5933 | |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | /* |
| 78 | ||
| 78 | programming timer callback | |
| 79 | 79 | */ |
| 80 | 80 | static TIMER_CALLBACK(at29c040a_programming_timer_callback) |
| 81 | 81 | { |
| r5932 | r5933 | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /* |
| 121 | Initialize one FEEPROM chip: may be called at driver init or image load | |
| 122 | time (or machine init time if you don't use MESS image core) | |
| 121 | Initialize one FEEPROM chip: may be called at driver init or image load | |
| 122 | time (or machine init time if you don't use MESS image core) | |
| 123 | 123 | */ |
| 124 | 124 | void at29c040a_init_data_ptr(int id, UINT8 *data_ptr) |
| 125 | 125 | { |
| r5932 | r5933 | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /* |
| 130 | ||
| 130 | Initialize one FEEPROM chip: must be called at machine init time | |
| 131 | 131 | */ |
| 132 | 132 | void at29c040a_init(running_machine *machine,int id) |
| 133 | 133 | { |
| r5932 | r5933 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /* |
| 138 | ||
| 138 | load the contents of one FEEPROM file | |
| 139 | 139 | */ |
| 140 | 140 | int at29c040a_file_load(int id, mame_file *file) |
| 141 | 141 | { |
| r5932 | r5933 | |
| 148 | 148 | return 1; |
| 149 | 149 | |
| 150 | 150 | /* chip state: lower boot block lockout, higher boot block lockout, |
| 151 | ||
| 151 | software data protect */ | |
| 152 | 152 | if (mame_fread(file, & buf, 1) != 1) |
| 153 | 153 | return 1; |
| 154 | 154 | at29c040a[id].s_lower_bbl = (buf >> 2) & 1; |
| r5932 | r5933 | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /* |
| 168 | ||
| 168 | save the FEEPROM contents to file | |
| 169 | 169 | */ |
| 170 | 170 | int at29c040a_file_save(int id, mame_file *file) |
| 171 | 171 | { |
| r5932 | r5933 | |
| 177 | 177 | return 1; |
| 178 | 178 | |
| 179 | 179 | /* chip state: lower boot block lockout, higher boot block lockout, |
| 180 | ||
| 180 | software data protect */ | |
| 181 | 181 | buf = (at29c040a[id].s_lower_bbl << 2) | (at29c040a[id].s_higher_bbl << 1) | at29c040a[id].s_sdp; |
| 182 | 182 | if (mame_fwrite(file, & buf, 1) != 1) |
| 183 | 183 | return 1; |
| r5932 | r5933 | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /* |
| 198 | ||
| 198 | read a byte from FEEPROM | |
| 199 | 199 | */ |
| 200 | 200 | UINT8 at29c040a_r(int id, offs_t offset) |
| 201 | 201 | { |
| r5932 | r5933 | |
| 212 | 212 | if (at29c040a[id].s_pgm == s_pgm_1) |
| 213 | 213 | { |
| 214 | 214 | /* attempty to access a locked out boot block: cancel programming |
| 215 | ||
| 215 | command if necessary */ | |
| 216 | 216 | at29c040a[id].s_pgm = s_pgm_0; |
| 217 | 217 | at29c040a[id].s_enabling_sdb = FALSE; |
| 218 | 218 | at29c040a[id].s_disabling_sdb = FALSE; |
| r5932 | r5933 | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /* |
| 269 | ||
| 269 | write a byte to FEEPROM | |
| 270 | 270 | */ |
| 271 | 271 | void at29c040a_w(int id, offs_t offset, UINT8 data) |
| 272 | 272 | { |
| r5932 | r5933 | |
| 404 | 404 | || ((offset >= FEEPROM_SIZE-BOOT_BLOCK_SIZE) && at29c040a[id].s_higher_bbl)) |
| 405 | 405 | { |
| 406 | 406 | /* attempty to access a locked out boot block: cancel programming |
| 407 | ||
| 407 | command if necessary */ | |
| 408 | 408 | at29c040a[id].s_pgm = s_pgm_0; |
| 409 | 409 | at29c040a[id].s_enabling_sdb = FALSE; |
| 410 | 410 | at29c040a[id].s_disabling_sdb = FALSE; |
| r5932 | r5933 | |
|---|---|---|
| 214 | 214 | else /*if (size <= 0xc000) */ { |
| 215 | 215 | if (page) { |
| 216 | 216 | /* shift up 16kB; custom memcpy so overlapping memory |
| 217 | ||
| 217 | isn't corrupted. ROM starts in page 1 (0x4000) */ | |
| 218 | 218 | UINT8 *m; |
| 219 | 219 | |
| 220 | 220 | page = 1; |
| r5932 | r5933 | |
| 474 | 474 | |
| 475 | 475 | memset (&msx1, 0, sizeof (MSX)); |
| 476 | 476 | /* LOAD_DEVICE is called before DRIVER_INIT */ |
| 477 | for (i=0; i<MSX_MAX_CARTS; i++) | |
| 477 | for (i=0; i<MSX_MAX_CARTS; i++) | |
| 478 | 478 | { |
| 479 | 479 | msx1.cart_state[i] = cart_state[i]; |
| 480 | 480 | } |
| r5932 | r5933 | |
| 690 | 690 | |
| 691 | 691 | adress |
| 692 | 692 | |
| 693 | 7FF8H read status register | |
| 694 | write command register | |
| 695 | 7FF9H r/w track register (r/o on NMS 8245 and Sony) | |
| 696 | 7FFAH r/w sector register (r/o on NMS 8245 and Sony) | |
| 697 | 7FFBH r/w data register | |
| 693 | 7FF8H read status register | |
| 694 | write command register | |
| 695 | 7FF9H r/w track register (r/o on NMS 8245 and Sony) | |
| 696 | 7FFAH r/w sector register (r/o on NMS 8245 and Sony) | |
| 697 | 7FFBH r/w data register | |
| 698 | 698 | |
| 699 | 699 | |
| 700 | 700 | hardware registers |
| r5932 | r5933 | |
| 703 | 703 | |
| 704 | 704 | 7FFCH r/w bit 0 side select |
| 705 | 705 | 7FFDH r/w b7>M-on , b6>in-use , b1>ds1 , b0>ds0 (all neg. logic) |
| 706 | 7FFEH | |
| 706 | 7FFEH not used | |
| 707 | 707 | 7FFFH read b7>drq , b6>intrq |
| 708 | 708 | |
| 709 | 709 | set on 7FFDH bit 2 always to 0 (some use it as disk change reset) |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | IN3 1 |* \_/ | 28 IN2 | |
| 11 | IN4 2 | | 27 IN1 | |
| 12 | IN5 3 | | 26 IN0 | |
| 13 | IN6 4 | | 25 ADD A | |
| 14 | IN7 5 | | 24 ADD B | |
| 15 | START 6 | | 23 ADD C | |
| 16 | EOC 7 | ADC0808 | 22 ALE | |
| 17 | 2-5 8 | ADC0809 | 21 2-1 MSB | |
| 18 | OUTPUT ENABLE 9 | | 20 2-2 | |
| 19 | CLOCK 10 | | 19 2-3 | |
| 20 | Vcc 11 | | 18 2-4 | |
| 21 | Vref+ 12 | | 17 2-8 LSB | |
| 22 | GND 13 | | 16 Vref- | |
| 23 | 2-7 14 |_____________| 15 2-6 | |
| 9 | _____ _____ | |
| 10 | IN3 1 |* \_/ | 28 IN2 | |
| 11 | IN4 2 | | 27 IN1 | |
| 12 | IN5 3 | | 26 IN0 | |
| 13 | IN6 4 | | 25 ADD A | |
| 14 | IN7 5 | | 24 ADD B | |
| 15 | START 6 | | 23 ADD C | |
| 16 | EOC 7 | ADC0808 | 22 ALE | |
| 17 | 2-5 8 | ADC0809 | 21 2-1 MSB | |
| 18 | OUTPUT ENABLE 9 | | 20 2-2 | |
| 19 | CLOCK 10 | | 19 2-3 | |
| 20 | Vcc 11 | | 18 2-4 | |
| 21 | Vref+ 12 | | 17 2-8 LSB | |
| 22 | GND 13 | | 16 Vref- | |
| 23 | 2-7 14 |_____________| 15 2-6 | |
| 24 | 24 | |
| 25 | 25 | **********************************************************************/ |
| 26 | 26 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************** |
| 2 | * | |
| 2 | * Sharp MZ700 | |
| 3 | 3 | * |
| 4 | * | |
| 4 | * machine driver | |
| 5 | 5 | * |
| 6 | * | |
| 6 | * Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000 | |
| 7 | 7 | * |
| 8 | 8 | * Reference: http://sharpmz.computingmuseum.com |
| 9 | 9 | * |
| r5932 | r5933 | |
| 59 | 59 | const struct pit8253_config mz700_pit8253_config = |
| 60 | 60 | { |
| 61 | 61 | { |
| 62 | /* clockin | |
| 62 | /* clockin callback */ | |
| 63 | 63 | { XTAL_17_73447MHz/20, pit_out0_changed }, |
| 64 | 64 | { 15611.0, pit_out1_changed }, |
| 65 | 65 | { 0, pit_irq_2 }, |
| r5932 | r5933 | |
| 69 | 69 | const struct pit8253_config mz800_pit8253_config = |
| 70 | 70 | { |
| 71 | 71 | { |
| 72 | /* clockin | |
| 72 | /* clockin callback */ | |
| 73 | 73 | { XTAL_17_73447MHz/16, pit_out0_changed }, |
| 74 | 74 | { 15611.0, pit_out1_changed }, |
| 75 | 75 | { 0, pit_irq_2 }, |
| r5932 | r5933 | |
| 416 | 416 | const device_config *speaker = devtag_get_device(device->machine, "speaker"); |
| 417 | 417 | if((prev_state==0) && (state==1)) { |
| 418 | 418 | speaker_level ^= 1; |
| 419 | } | |
| 419 | } | |
| 420 | 420 | prev_state = state; |
| 421 | 421 | speaker_level_w( speaker, speaker_level); |
| 422 | 422 | } |
| r5932 | r5933 | |
| 516 | 516 | * bit 0 out unused |
| 517 | 517 | */ |
| 518 | 518 | |
| 519 | // UINT8 state = cassette_get_state(devtag_get_device(device->machine, "cassette")); | |
| 520 | // UINT8 action = ((~pio_port_c_output & 8) & (data & 8)); /* detect low-to-high transition */ | |
| 519 | // UINT8 state = cassette_get_state(devtag_get_device(device->machine, "cassette")); | |
| 520 | // UINT8 action = ((~pio_port_c_output & 8) & (data & 8)); /* detect low-to-high transition */ | |
| 521 | 521 | |
| 522 | 522 | /* The motor control circuit consists of a resistor, capacitor, invertor, nand-gate, and D flip-flop. |
| 523 | The sense input from the cassette player goes low whenever play, rewind or fast-forward is pressed. | |
| 524 | This connects to most of the above components. | |
| 525 | The Q output enables the motor, and also connects to Bit 4 (input). | |
| 526 | Bit 3 outputs a string of pulses to the Clock pin, and therefore cannot be used to control | |
| 527 | the motor directly. | |
| 528 | For the moment, the user can use the UI to select play, stop, etc. | |
| 529 | If you load from the command-line or the software-picker, type in L <enter> immediately. | |
| 523 | The sense input from the cassette player goes low whenever play, rewind or fast-forward is pressed. | |
| 524 | This connects to most of the above components. | |
| 525 | The Q output enables the motor, and also connects to Bit 4 (input). | |
| 526 | Bit 3 outputs a string of pulses to the Clock pin, and therefore cannot be used to control | |
| 527 | the motor directly. | |
| 528 | For the moment, the user can use the UI to select play, stop, etc. | |
| 529 | If you load from the command-line or the software-picker, type in L <enter> immediately. | |
| 530 | 530 | |
| 531 | cassette_change_state( | |
| 532 | devtag_get_device(device->machine, "cassette"), | |
| 533 | ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, | |
| 534 | CASSETTE_MOTOR_DISABLED); | |
| 531 | cassette_change_state( | |
| 532 | devtag_get_device(device->machine, "cassette"), | |
| 533 | ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, | |
| 534 | CASSETTE_MOTOR_DISABLED); | |
| 535 | 535 | |
| 536 | ||
| 536 | */ | |
| 537 | 537 | |
| 538 | 538 | LOG(2,"mz700_pio_port_c_w",("%02X\n", data),device->machine); |
| 539 | 539 | |
| r5932 | r5933 | |
| 542 | 542 | |
| 543 | 543 | |
| 544 | 544 | /****************************************************************************** |
| 545 | * | |
| 545 | * Sharp MZ800 | |
| 546 | 546 | * |
| 547 | 547 | * |
| 548 | 548 | ******************************************************************************/ |
| r5932 | r5933 | |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | /* port CE |
| 639 | * bit 3 1: MZ700 mode 0: MZ800 mode | |
| 640 | * bit 2 1: 640 horizontal 0: 320 horizontal | |
| 641 | * bit 1 1: 4bpp/2bpp 0: 2bpp/1bpp | |
| 642 | * bit 0 ??? | |
| 639 | * bit 3 1: MZ700 mode 0: MZ800 mode | |
| 640 | * bit 2 1: 640 horizontal 0: 320 horizontal | |
| 641 | * bit 1 1: 4bpp/2bpp 0: 2bpp/1bpp | |
| 642 | * bit 0 ??? | |
| 643 | 643 | */ |
| 644 | 644 | WRITE8_HANDLER( mz800_display_mode_w ) |
| 645 | 645 | { |
| r5932 | r5933 | |
| 650 | 650 | mz->screen = data & 0x03; |
| 651 | 651 | |
| 652 | 652 | /* change memory maps if we switched mode */ |
| 653 | // if (BIT(data, 3) != mz->mz700_mode) | |
| 654 | // { | |
| 655 | // logerror("mz800_display_mode_w: switching mode to %s\n", (BIT(data, 3) ? "mz700" : "mz800")); | |
| 656 | // mz->mz700_mode = BIT(data, 3); | |
| 657 | // mz_bank_4_w(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0, 0); | |
| 658 | // } | |
| 653 | // if (BIT(data, 3) != mz->mz700_mode) | |
| 654 | // { | |
| 655 | // logerror("mz800_display_mode_w: switching mode to %s\n", (BIT(data, 3) ? "mz700" : "mz800")); | |
| 656 | // mz->mz700_mode = BIT(data, 3); | |
| 657 | // mz_bank_4_w(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0, 0); | |
| 658 | // } | |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | /* port CF */ |
| r5932 | r5933 | |
|---|---|---|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /* If VIA T2 starts, reset refresh timer. |
| 94 | ||
| 94 | This is the best strategy for most games. */ | |
| 95 | 95 | vectrex_reset_refresh = 1; |
| 96 | 96 | |
| 97 | 97 | vectrex_imager_angles = narrow_escape_angles; |
| r5932 | r5933 | |
| 114 | 114 | { |
| 115 | 115 | vectrex_imager_angles = minestorm_3d_angles; |
| 116 | 116 | |
| 117 | /* Don't reset T2 each time it's written. | |
| 118 | This would cause jerking in mine3. */ | |
| 117 | /* Don't reset T2 each time it's written. | |
| 118 | This would cause jerking in mine3. */ | |
| 119 | 119 | vectrex_reset_refresh = 0; |
| 120 | 120 | } |
| 121 | 121 | |
| r5932 | r5933 | |
| 229 | 229 | int pot; |
| 230 | 230 | static const char *const ctrlnames[] = { "CONTR1X", "CONTR1Y", "CONTR2X", "CONTR2Y" }; |
| 231 | 231 | |
| 232 | pot = input_port_read(device->machine, ctrlnames[(vectrex_via_out[PORTB] & 0x6) >> 1]) - 0x80; | |
| 233 | ||
| 232 | pot = input_port_read(device->machine, ctrlnames[(vectrex_via_out[PORTB] & 0x6) >> 1]) - 0x80; | |
| 233 | ||
| 234 | 234 | if (pot > (signed char)vectrex_via_out[PORTA]) |
| 235 | 235 | vectrex_via_out[PORTB] |= 0x20; |
| 236 | 236 | else |
| r5932 | r5933 | |
| 326 | 326 | if (wavel < 1) |
| 327 | 327 | { |
| 328 | 328 | /* The Vectrex sends a stream of pulses which control the speed of |
| 329 | the motor using Pulse Width Modulation. Guessed parameters are MMI | |
| 330 | (mass moment of inertia) of the color wheel, DAMPC (damping coefficient) | |
| 331 | of the whole thing and some constants of the motor's torque/speed curve. | |
| 332 | pwl is the negative pulse width and wavel is the whole wavelength. */ | |
| 329 | the motor using Pulse Width Modulation. Guessed parameters are MMI | |
| 330 | (mass moment of inertia) of the color wheel, DAMPC (damping coefficient) | |
| 331 | of the whole thing and some constants of the motor's torque/speed curve. | |
| 332 | pwl is the negative pulse width and wavel is the whole wavelength. */ | |
| 333 | 333 | |
| 334 | 334 | ang_acc = (50.0 - 1.55 * vectrex_imager_freq) / MMI; |
| 335 | 335 | vectrex_imager_freq += ang_acc * pwl + DAMPC * vectrex_imager_freq / MMI * wavel; |
| r5932 | r5933 | |
| 354 | 354 | DRIVER_INIT(vectrex) |
| 355 | 355 | { |
| 356 | 356 | /* |
| 357 | * Uninitialized RAM needs to return 0xff. Otherwise the mines in | |
| 358 | * the first level of Minestorm are not evenly distributed. | |
| 359 | */ | |
| 357 | * Uninitialized RAM needs to return 0xff. Otherwise the mines in | |
| 358 | * the first level of Minestorm are not evenly distributed. | |
| 359 | */ | |
| 360 | 360 | |
| 361 | 361 | memset(vectorram, 0xff, vectorram_size); |
| 362 | 362 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /************************************************************************* |
| 2 | 2 | * |
| 3 | * | |
| 3 | * pc_joy.h | |
| 4 | 4 | * |
| 5 | * | |
| 5 | * joystick port | |
| 6 | 6 | * |
| 7 | 7 | *************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 7 | 7 | c230048 - 5 is written, want 6 |
| 8 | 8 | c0d9d9e - where bad happens, from routine @ c0da260 |
| 9 | 9 | |
| 10 | c0d9d8e - R0 on return is the value to put in | |
| 10 | c0d9d8e - R0 on return is the value to put in | |
| 11 | 11 | |
| 12 | 12 | cfffee0 - stack location when bad happens |
| 13 | ||
| 13 | ||
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | #include "driver.h" |
| r5932 | r5933 | |
| 22 | 22 | #include "naomi.h" |
| 23 | 23 | #include "machine/gdrom.h" |
| 24 | 24 | #include "devices/chd_cd.h" |
| 25 | ||
| 25 | ||
| 26 | 26 | #define ATAPI_CYCLES_PER_SECTOR (5000) // TBD for Dreamcast |
| 27 | 27 | |
| 28 | 28 | #define ATAPI_STAT_BSY 0x80 |
| r5932 | r5933 | |
| 99 | 99 | ddtdata.destination = atapi_xferbase; // destination address |
| 100 | 100 | ddtdata.length = 2048/4; |
| 101 | 101 | ddtdata.size = 4; |
| 102 | ddtdata.buffer = sector_buffer; | |
| 102 | ddtdata.buffer = sector_buffer; | |
| 103 | 103 | ddtdata.direction=1; // 0 source to buffer, 1 buffer to destination |
| 104 | 104 | ddtdata.channel= -1; // not used |
| 105 | 105 | ddtdata.mode= -1; // copy from/to buffer |
| r5932 | r5933 | |
| 175 | 175 | atapi_xfermod = 0; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | // | |
| 178 | // printf( "atapi_r: atapi_xferlen=%d\n", atapi_xferlen ); | |
| 179 | 179 | if( atapi_xferlen != 0 ) |
| 180 | 180 | { |
| 181 | 181 | atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_DRQ | ATAPI_STAT_SERVDSC; |
| 182 | gdrom_alt_status = ATAPI_STAT_DRQ | ATAPI_STAT_SERVDSC; | |
| 182 | gdrom_alt_status = ATAPI_STAT_DRQ | ATAPI_STAT_SERVDSC; | |
| 183 | 183 | atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO; |
| 184 | 184 | } |
| 185 | 185 | else |
| r5932 | r5933 | |
| 264 | 264 | mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, cpu_get_pc(space->cpu)); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | // | |
| 267 | // printf( "atapi_r( %08x, %08x ) %08x\n", offset, mem_mask, data ); | |
| 268 | 268 | return data; |
| 269 | 269 | } |
| 270 | 270 | |
| r5932 | r5933 | |
| 273 | 273 | running_machine *machine = space->machine; |
| 274 | 274 | int reg; |
| 275 | 275 | |
| 276 | // | |
| 276 | // printf( "atapi_w( %08x, %08x, %08x )\n", offset, mem_mask, data ); | |
| 277 | 277 | |
| 278 | 278 | if (mem_mask == 0x0000ffff) // word-wide command write |
| 279 | 279 | { |
| 280 | // | |
| 280 | // printf("atapi_w: data=%04x\n", data ); | |
| 281 | 281 | |
| 282 | // | |
| 282 | // printf("ATAPI: packet write %04x\n", data); | |
| 283 | 283 | atapi_data[atapi_data_ptr++] = data & 0xff; |
| 284 | 284 | atapi_data[atapi_data_ptr++] = data >> 8; |
| 285 | 285 | |
| 286 | 286 | if (atapi_cdata_wait) |
| 287 | 287 | { |
| 288 | // | |
| 288 | // printf("ATAPI: waiting, ptr %d wait %d\n", atapi_data_ptr, atapi_cdata_wait); | |
| 289 | 289 | if (atapi_data_ptr == atapi_cdata_wait) |
| 290 | 290 | { |
| 291 | 291 | // send it to the device |
| r5932 | r5933 | |
| 303 | 303 | { |
| 304 | 304 | int phase; |
| 305 | 305 | |
| 306 | // | |
| 306 | // printf("atapi_w: command %02x\n", atapi_data[0]&0xff ); | |
| 307 | 307 | |
| 308 | 308 | // reset data pointer for reading SCSI results |
| 309 | 309 | atapi_data_ptr = 0; |
| r5932 | r5933 | |
| 621 | 621 | off=offset << 1; |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | // | |
| 624 | // printf("gdrom_r: @ %x (off %x), mask %llx (PC %x)\n", offset, off, mem_mask, cpu_get_pc(space->cpu)); | |
| 625 | 625 | |
| 626 | 626 | if (offset == 3) |
| 627 | 627 | { |
| r5932 | r5933 | |
| 650 | 650 | off=offset << 1; |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | // | |
| 653 | // printf("GDROM: [%08x=%x]write %llx to %x, mask %llx (PC %x)\n", 0x5f7000+off*4, dat, data, offset, mem_mask, cpu_get_pc(space->cpu)); | |
| 654 | 654 | |
| 655 | 655 | if (off >= 0x20) |
| 656 | 656 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | experimental LISA driver | |
| 3 | 3 | |
| 4 | This driver runs most ROM test code successfully, and it loads the boot | |
| 5 | file, but it locks when booting from Lisa OS (probably because of floppy | |
| 6 | write bug). MacWorks boots fine, though (I think it looks when we | |
| 7 | attempt to write to floppy, too). | |
| 4 | This driver runs most ROM test code successfully, and it loads the boot | |
| 5 | file, but it locks when booting from Lisa OS (probably because of floppy | |
| 6 | write bug). MacWorks boots fine, though (I think it looks when we | |
| 7 | attempt to write to floppy, too). | |
| 8 | 8 | |
| 9 | TODO : | |
| 10 | * fix floppy write bug | |
| 11 | * *** Boot and run LisaTest !!! *** | |
| 12 | * finish MMU (does not switch to bank 0 on 68k trap) --- fixed in June 2003??? | |
| 13 | * support hard disk to boot office system | |
| 14 | * finish keyboard/mouse support | |
| 15 | * finish clock support | |
| 16 | * write SCC support | |
| 17 | * finalize sound support (involves adding new features to the 6522 VIA core) | |
| 18 | * fix warm-reset (I think I need to use a callback when 68k RESET | |
| 19 | instruction is called) | |
| 20 | * write support for additionnal hardware (hard disk, etc...) | |
| 21 | * emulate LISA1 (?) | |
| 22 | * optimize MMU emulation ! | |
| 9 | TODO : | |
| 10 | * fix floppy write bug | |
| 11 | * *** Boot and run LisaTest !!! *** | |
| 12 | * finish MMU (does not switch to bank 0 on 68k trap) --- fixed in June 2003??? | |
| 13 | * support hard disk to boot office system | |
| 14 | * finish keyboard/mouse support | |
| 15 | * finish clock support | |
| 16 | * write SCC support | |
| 17 | * finalize sound support (involves adding new features to the 6522 VIA core) | |
| 18 | * fix warm-reset (I think I need to use a callback when 68k RESET | |
| 19 | instruction is called) | |
| 20 | * write support for additionnal hardware (hard disk, etc...) | |
| 21 | * emulate LISA1 (?) | |
| 22 | * optimize MMU emulation ! | |
| 23 | 23 | |
| 24 | DONE (just a reminder to uplift my spirit) : | |
| 25 | * the lion's share of MMU (spring 2000) | |
| 26 | * video hardware (except contrast control) (spring 2000) | |
| 27 | * LISA2/Mac XL floppy hardware (november 2000) | |
| 24 | DONE (just a reminder to uplift my spirit) : | |
| 25 | * the lion's share of MMU (spring 2000) | |
| 26 | * video hardware (except contrast control) (spring 2000) | |
| 27 | * LISA2/Mac XL floppy hardware (november 2000) | |
| 28 | 28 | |
| 29 | Credits : | |
| 30 | * the lisaemu project (<http://www.sundernet.com/>) has gathered much | |
| 31 | hardware information (books, schematics...) without which this driver | |
| 32 | could never have been written | |
| 33 | * The driver raised the interest of several MESS regulars (Paul Lunga, | |
| 34 | Dennis Munsie...) who supported my feeble efforts | |
| 29 | Credits : | |
| 30 | * the lisaemu project (<http://www.sundernet.com/>) has gathered much | |
| 31 | hardware information (books, schematics...) without which this driver | |
| 32 | could never have been written | |
| 33 | * The driver raised the interest of several MESS regulars (Paul Lunga, | |
| 34 | Dennis Munsie...) who supported my feeble efforts | |
| 35 | 35 | |
| 36 | ||
| 36 | Raphael Nabet, 2000-2003 | |
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | 39 | #include "driver.h" |
| r5932 | r5933 | |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | /* |
| 49 | ||
| 49 | pointers with RAM & ROM location | |
| 50 | 50 | */ |
| 51 | 51 | |
| 52 | 52 | /* up to 2MB of 68k RAM (normally 1MB or 512kb), generally 16kb of ROM */ |
| r5932 | r5933 | |
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | /* |
| 71 | ||
| 71 | MMU regs | |
| 72 | 72 | */ |
| 73 | 73 | |
| 74 | 74 | static int setup; /* MMU setup mode : allows to edit the MMU regs */ |
| r5932 | r5933 | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | /* |
| 98 | parity logic - only hard errors are emulated for now, since | |
| 99 | a) the ROMs power-up test only tests hard errors | |
| 100 | b) most memory boards do not use soft errors (i.e. they only generate 1 | |
| 101 | parity bit to detect errors, instead of generating several ECC bits to | |
| 102 | fix errors) | |
| 98 | parity logic - only hard errors are emulated for now, since | |
| 99 | a) the ROMs power-up test only tests hard errors | |
| 100 | b) most memory boards do not use soft errors (i.e. they only generate 1 | |
| 101 | parity bit to detect errors, instead of generating several ECC bits to | |
| 102 | fix errors) | |
| 103 | 103 | */ |
| 104 | 104 | |
| 105 | 105 | static int diag2; /* -> writes wrong parity data into RAM */ |
| r5932 | r5933 | |
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | ||
| 115 | video | |
| 116 | 116 | */ |
| 117 | 117 | static int VTMSK; /* VBI enable */ |
| 118 | 118 | static int VTIR; /* VBI pending */ |
| r5932 | r5933 | |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | /* |
| 124 | 2 vias : one is used for communication with COPS ; the other may be used to interface | |
| 125 | a hard disk | |
| 124 | 2 vias : one is used for communication with COPS ; the other may be used to interface | |
| 125 | a hard disk | |
| 126 | 126 | */ |
| 127 | 127 | |
| 128 | 128 | static READ8_DEVICE_HANDLER(COPS_via_in_b); |
| r5932 | r5933 | |
| 159 | 159 | }; |
| 160 | 160 | |
| 161 | 161 | /* |
| 162 | ||
| 162 | floppy disk interface | |
| 163 | 163 | */ |
| 164 | 164 | |
| 165 | 165 | static int FDIR; |
| r5932 | r5933 | |
| 170 | 170 | static int PWM_floppy_motor_speed; |
| 171 | 171 | |
| 172 | 172 | /* |
| 173 | ||
| 173 | lisa model identification | |
| 174 | 174 | */ |
| 175 | 175 | static enum |
| 176 | 176 | { |
| r5932 | r5933 | |
| 184 | 184 | { |
| 185 | 185 | 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) */ |
| 186 | 186 | /* Note that the beep routine in boot ROMs implies that |
| 187 | VIA clock is 1.25 times faster with fast timers than with | |
| 188 | slow timers. I read the schematics again and again, and | |
| 189 | I simply don't understand : in one case the VIA is | |
| 190 | connected to the 68k E clock, which is CPUCK/10, and in | |
| 191 | another case, to a generated PH2 clock which is CPUCK/4, | |
| 192 | with additionnal logic to keep it in phase with the 68k | |
| 193 | memory cycle. After hearing the beep when MacWorks XL | |
| 194 | boots, I bet the correct values are .625 MHz and .5 MHz. | |
| 195 | Maybe the schematics are wrong, and PH2 is CPUCK/8. | |
| 196 | Maybe the board uses a 6522 variant with different | |
| 197 | timings. */ | |
| 187 | VIA clock is 1.25 times faster with fast timers than with | |
| 188 | slow timers. I read the schematics again and again, and | |
| 189 | I simply don't understand : in one case the VIA is | |
| 190 | connected to the 68k E clock, which is CPUCK/10, and in | |
| 191 | another case, to a generated PH2 clock which is CPUCK/4, | |
| 192 | with additionnal logic to keep it in phase with the 68k | |
| 193 | memory cycle. After hearing the beep when MacWorks XL | |
| 194 | boots, I bet the correct values are .625 MHz and .5 MHz. | |
| 195 | Maybe the schematics are wrong, and PH2 is CPUCK/8. | |
| 196 | Maybe the board uses a 6522 variant with different | |
| 197 | timings. */ | |
| 198 | 198 | enum |
| 199 | 199 | { |
| 200 | 200 | twiggy, /* twiggy drives (Lisa 1) */ |
| r5932 | r5933 | |
| 206 | 206 | } lisa_features; |
| 207 | 207 | |
| 208 | 208 | /* |
| 209 | ||
| 209 | protos | |
| 210 | 210 | */ |
| 211 | 211 | |
| 212 | 212 | static READ16_HANDLER ( lisa_IO_r ); |
| r5932 | r5933 | |
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | /* |
| 217 | ||
| 217 | Interrupt handling | |
| 218 | 218 | */ |
| 219 | 219 | |
| 220 | 220 | static void lisa_field_interrupts(running_machine *machine) |
| r5932 | r5933 | |
| 223 | 223 | return; /* don't touch anything... */ |
| 224 | 224 | |
| 225 | 225 | /*if (RSIR) |
| 226 | // serial interrupt | |
| 227 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_6, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); | |
| 228 | else if (int0) | |
| 229 | // external interrupt | |
| 230 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); | |
| 231 | else if (int1) | |
| 232 | // external interrupt | |
| 233 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); | |
| 234 | else if (int2) | |
| 235 | // external interrupt | |
| 236 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_3, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); | |
| 237 | else*/ if (KBIR) | |
| 226 | // serial interrupt | |
| 227 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_6, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); | |
| 228 | else if (int0) | |
| 229 | // external interrupt | |
| 230 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_5, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); | |
| 231 | else if (int1) | |
| 232 | // external interrupt | |
| 233 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); | |
| 234 | else if (int2) | |
| 235 | // external interrupt | |
| 236 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_3, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); | |
| 237 | else*/ if (KBIR) | |
| 238 | 238 | /* COPS VIA interrupt */ |
| 239 | 239 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_2, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 240 | 240 | else if (FDIR || VTIR) |
| r5932 | r5933 | |
| 286 | 286 | |
| 287 | 287 | |
| 288 | 288 | /* |
| 289 | ||
| 289 | keyboard interface | |
| 290 | 290 | */ |
| 291 | 291 | |
| 292 | 292 | static int COPS_Ready; /* COPS is about to read a command from VIA port A */ |
| r5932 | r5933 | |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | /* |
| 388 | ||
| 388 | scan_keyboard() | |
| 389 | 389 | |
| 390 | ||
| 390 | scan the keyboard, and add key transition codes to buffer as needed | |
| 391 | 391 | */ |
| 392 | 392 | /* shamelessly stolen from machine/mac.c :-) */ |
| 393 | 393 | |
| r5932 | r5933 | |
| 447 | 447 | int new_mx, new_my; |
| 448 | 448 | |
| 449 | 449 | /*if (COPS_force_unplug) |
| 450 | ||
| 450 | return;*/ /* ???? */ | |
| 451 | 451 | |
| 452 | 452 | new_mx = input_port_read(machine, "MOUSE_X"); |
| 453 | 453 | new_my = input_port_read(machine, "MOUSE_Y"); |
| r5932 | r5933 | |
| 729 | 729 | static void plug_keyboard(running_machine *machine) |
| 730 | 730 | { |
| 731 | 731 | /* |
| 732 | ||
| 732 | possible keyboard IDs according to Lisa Hardware Manual and boot ROM source code | |
| 733 | 733 | |
| 734 | 2 MSBs : "mfg code" (-> 0x80 for Keytronics, 0x00 for "APD") | |
| 735 | 6 LSBs : | |
| 736 | 0x0x : "old US keyboard" | |
| 737 | 0x3f : US keyboard | |
| 738 | 0x3d : Canadian keyboard | |
| 739 | 0x2f : UK | |
| 740 | 0x2e : German | |
| 741 | 0x2d : French | |
| 742 | 0x27 : Swiss-French | |
| 743 | 0x26 : Swiss-German | |
| 744 | unknown : spanish, US dvorak, italian & swedish | |
| 745 | */ | |
| 734 | 2 MSBs : "mfg code" (-> 0x80 for Keytronics, 0x00 for "APD") | |
| 735 | 6 LSBs : | |
| 736 | 0x0x : "old US keyboard" | |
| 737 | 0x3f : US keyboard | |
| 738 | 0x3d : Canadian keyboard | |
| 739 | 0x2f : UK | |
| 740 | 0x2e : German | |
| 741 | 0x2d : French | |
| 742 | 0x27 : Swiss-French | |
| 743 | 0x26 : Swiss-German | |
| 744 | unknown : spanish, US dvorak, italian & swedish | |
| 745 | */ | |
| 746 | 746 | |
| 747 | 747 | static const UINT8 cmd[2] = |
| 748 | 748 | { |
| r5932 | r5933 | |
| 770 | 770 | /* VIA1 accessors (COPS, sound, and 2 hard disk lines) */ |
| 771 | 771 | |
| 772 | 772 | /* |
| 773 | PA0-7 (I/O) : VIA <-> COPS data bus | |
| 774 | CA1 (I) : COPS sending valid data | |
| 775 | CA2 (O) : VIA -> COPS handshake | |
| 773 | PA0-7 (I/O) : VIA <-> COPS data bus | |
| 774 | CA1 (I) : COPS sending valid data | |
| 775 | CA2 (O) : VIA -> COPS handshake | |
| 776 | 776 | */ |
| 777 | 777 | static WRITE8_DEVICE_HANDLER(COPS_via_out_a) |
| 778 | 778 | { |
| r5932 | r5933 | |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /* |
| 793 | PB7 (O) : CR* ("Controller Reset", used by hard disk interface) ??? | |
| 794 | PB6 (I) : CRDY ("COPS ready") : set low by the COPS for 20us when it is reading a command | |
| 795 | from the data bus (command latched at low-to-high transition) | |
| 796 | PB5 (I/O) : PR* ; as output : "parity error latch reset" (only when CR* and RESET* are | |
| 797 | inactive) ; as input : low when CR* or RESET are low. | |
| 798 | PB4 (I) : FDIR (floppy disk interrupt request - the fdc shared RAM should not be accessed | |
| 799 | unless this bit is 1) | |
| 800 | PB1-3 (O) : sound volume | |
| 801 | PB0 (O) : forces disconnection of keyboard and mouse (allows to retrive keyboard ID, etc.) | |
| 793 | PB7 (O) : CR* ("Controller Reset", used by hard disk interface) ??? | |
| 794 | PB6 (I) : CRDY ("COPS ready") : set low by the COPS for 20us when it is reading a command | |
| 795 | from the data bus (command latched at low-to-high transition) | |
| 796 | PB5 (I/O) : PR* ; as output : "parity error latch reset" (only when CR* and RESET* are | |
| 797 | inactive) ; as input : low when CR* or RESET are low. | |
| 798 | PB4 (I) : FDIR (floppy disk interrupt request - the fdc shared RAM should not be accessed | |
| 799 | unless this bit is 1) | |
| 800 | PB1-3 (O) : sound volume | |
| 801 | PB0 (O) : forces disconnection of keyboard and mouse (allows to retrive keyboard ID, etc.) | |
| 802 | 802 | |
| 803 | CB1 : not used | |
| 804 | CB2 (O) : sound output | |
| 803 | CB1 : not used | |
| 804 | CB2 (O) : sound output | |
| 805 | 805 | */ |
| 806 | 806 | static READ8_DEVICE_HANDLER(COPS_via_in_b) |
| 807 | 807 | { |
| r5932 | r5933 | |
| 860 | 860 | /* VIA2 accessors (hard disk, and a few floppy disk lines) */ |
| 861 | 861 | |
| 862 | 862 | /* |
| 863 | PA0-7 (I/O) : VIA <-> hard disk data bus (cf PB3) | |
| 864 | CA1 (I) : hard disk BSY line | |
| 865 | CA2 (O) : hard disk PSTRB* line | |
| 863 | PA0-7 (I/O) : VIA <-> hard disk data bus (cf PB3) | |
| 864 | CA1 (I) : hard disk BSY line | |
| 865 | CA2 (O) : hard disk PSTRB* line | |
| 866 | 866 | */ |
| 867 | 867 | |
| 868 | 868 | /* |
| 869 | PB7 (O) : WCNT line : set contrast latch on low-to-high transition ? | |
| 870 | PB6 (I) : floppy disk DISK DIAG line | |
| 871 | PB5 (I) : hard disk data DD0-7 current parity (does not depend on PB2) | |
| 872 | PB4 (O) : hard disk CMD* line | |
| 873 | PB3 (O) : hard disk DR/W* line ; controls the direction of the drivers on the data bus | |
| 874 | PB2 (O) : when low, disables hard disk interface drivers | |
| 875 | PB1 (I) : hard disk BSY line | |
| 876 | PB0 (I) : hard disk OCD (Open Cable Detect) line : 0 when hard disk attached | |
| 877 | CB1 : not used | |
| 878 | CB2 (I) : current parity latch value | |
| 869 | PB7 (O) : WCNT line : set contrast latch on low-to-high transition ? | |
| 870 | PB6 (I) : floppy disk DISK DIAG line | |
| 871 | PB5 (I) : hard disk data DD0-7 current parity (does not depend on PB2) | |
| 872 | PB4 (O) : hard disk CMD* line | |
| 873 | PB3 (O) : hard disk DR/W* line ; controls the direction of the drivers on the data bus | |
| 874 | PB2 (O) : when low, disables hard disk interface drivers | |
| 875 | PB1 (I) : hard disk BSY line | |
| 876 | PB0 (I) : hard disk OCD (Open Cable Detect) line : 0 when hard disk attached | |
| 877 | CB1 : not used | |
| 878 | CB2 (I) : current parity latch value | |
| 879 | 879 | */ |
| 880 | 880 | static READ8_DEVICE_HANDLER(parallel_via_in_b) |
| 881 | 881 | { |
| r5932 | r5933 | |
| 899 | 899 | |
| 900 | 900 | |
| 901 | 901 | /* |
| 902 | ||
| 902 | LISA video emulation | |
| 903 | 903 | */ |
| 904 | 904 | |
| 905 | 905 | VIDEO_START( lisa ) |
| r5932 | r5933 | |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | /* |
| 910 | ||
| 910 | Video update | |
| 911 | 911 | */ |
| 912 | 912 | VIDEO_UPDATE( lisa ) |
| 913 | 913 | { |
| r5932 | r5933 | |
| 924 | 924 | for (y = 0; y < resy; y++) |
| 925 | 925 | { |
| 926 | 926 | for (x = 0; x < resx; x++) |
| 927 | // | |
| 927 | // line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> ((x+y*resx) & 0xf))) ? 0 : 1; | |
| 928 | 928 | line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> (x & 0xf))) ? 0 : 1; |
| 929 | 929 | draw_scanline8(bitmap, 0, y, resx, line_buffer, screen->machine->pens); |
| 930 | 930 | } |
| r5932 | r5933 | |
| 947 | 947 | { |
| 948 | 948 | if (address & 0x004000) |
| 949 | 949 | { |
| 950 | // | |
| 950 | // the_seg = 0; /* correct ??? */ | |
| 951 | 951 | } |
| 952 | 952 | else |
| 953 | 953 | { |
| r5932 | r5933 | |
| 1084 | 1084 | |
| 1085 | 1085 | /*void init_lisa1(void) |
| 1086 | 1086 | { |
| 1087 | lisa_model = lisa1; | |
| 1088 | lisa_features.has_fast_timers = 0; | |
| 1089 | lisa_features.floppy_hardware = twiggy; | |
| 1090 | lisa_features.has_double_sided_floppy = 1; | |
| 1091 | lisa_features.has_mac_xl_video = 0; | |
| 1087 | lisa_model = lisa1; | |
| 1088 | lisa_features.has_fast_timers = 0; | |
| 1089 | lisa_features.floppy_hardware = twiggy; | |
| 1090 | lisa_features.has_double_sided_floppy = 1; | |
| 1091 | lisa_features.has_mac_xl_video = 0; | |
| 1092 | 1092 | }*/ |
| 1093 | 1093 | |
| 1094 | 1094 | DRIVER_INIT( lisa2 ) |
| r5932 | r5933 | |
| 1100 | 1100 | lisa_features.floppy_hardware = sony_lisa2; |
| 1101 | 1101 | lisa_features.has_double_sided_floppy = 0; |
| 1102 | 1102 | lisa_features.has_mac_xl_video = 0; |
| 1103 | ||
| 1103 | ||
| 1104 | 1104 | bad_parity_table = auto_alloc_array(machine, UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ |
| 1105 | 1105 | } |
| 1106 | 1106 | |
| r5932 | r5933 | |
| 1113 | 1113 | lisa_features.floppy_hardware = sony_lisa210; |
| 1114 | 1114 | lisa_features.has_double_sided_floppy = 0; |
| 1115 | 1115 | lisa_features.has_mac_xl_video = 0; |
| 1116 | ||
| 1116 | ||
| 1117 | 1117 | bad_parity_table = auto_alloc_array(machine, UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ |
| 1118 | 1118 | } |
| 1119 | 1119 | |
| r5932 | r5933 | |
| 1126 | 1126 | lisa_features.floppy_hardware = sony_lisa210; |
| 1127 | 1127 | lisa_features.has_double_sided_floppy = 0; |
| 1128 | 1128 | lisa_features.has_mac_xl_video = 1; |
| 1129 | ||
| 1129 | ||
| 1130 | 1130 | bad_parity_table = auto_alloc_array(machine, UINT8, 0x40000); /* 1 bit per byte of CPU RAM */ |
| 1131 | 1131 | } |
| 1132 | 1132 | |
| r5932 | r5933 | |
| 1276 | 1276 | set_VTIR(device->machine, 1); |
| 1277 | 1277 | else |
| 1278 | 1278 | set_VTIR(device->machine, 0); |
| 1279 | ||
| 1279 | ||
| 1280 | 1280 | /* do keyboard scan */ |
| 1281 | 1281 | scan_keyboard(device->machine); |
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | 1284 | /* |
| 1285 | ||
| 1285 | Lots of fun with the Lisa fdc hardware | |
| 1286 | 1286 | |
| 1287 | The iwm floppy select line is connected to the drive SEL line in Lisa2 (which is why Lisa 2 | |
| 1288 | cannot support 2 floppy drives)... | |
| 1287 | The iwm floppy select line is connected to the drive SEL line in Lisa2 (which is why Lisa 2 | |
| 1288 | cannot support 2 floppy drives)... | |
| 1289 | 1289 | */ |
| 1290 | 1290 | |
| 1291 | 1291 | INLINE void lisa_fdc_ttl_glue_access(running_machine *machine, offs_t offset) |
| r5932 | r5933 | |
| 1317 | 1317 | } |
| 1318 | 1318 | } |
| 1319 | 1319 | /*else |
| 1320 | ||
| 1320 | MT1 = offset & 1;*/ | |
| 1321 | 1321 | break; |
| 1322 | 1322 | case 4: |
| 1323 | 1323 | /*DIS = offset & 1;*/ /* forbids access from the 68000 to our RAM */ |
| r5932 | r5933 | |
| 1325 | 1325 | case 5: |
| 1326 | 1326 | /*HDS = offset & 1;*/ /* head select (-> disk side) on twiggy */ |
| 1327 | 1327 | /*if (lisa_features.floppy_hardware == twiggy) |
| 1328 | twiggy_set_head_line(offset & 1); | |
| 1329 | else*/ if (lisa_features.floppy_hardware == sony_lisa210) | |
| 1328 | twiggy_set_head_line(offset & 1); | |
| 1329 | else*/ if (lisa_features.floppy_hardware == sony_lisa210) | |
| 1330 | 1330 | sony_set_sel_line(devtag_get_device(machine, "fdc"), offset & 1); |
| 1331 | 1331 | break; |
| 1332 | 1332 | case 6: |
| r5932 | r5933 | |
| 1384 | 1384 | case 2: /* writes the PWM register */ |
| 1385 | 1385 | /* the written value is used to generate the motor speed control signal */ |
| 1386 | 1386 | /*if (lisa_features.floppy_hardware == twiggy) |
| 1387 | twiggy_set_speed((256-data) * ??? + ???); | |
| 1388 | else*/ if (lisa_features.floppy_hardware == sony_lisa210) | |
| 1387 | twiggy_set_speed((256-data) * ??? + ???); | |
| 1388 | else*/ if (lisa_features.floppy_hardware == sony_lisa210) | |
| 1389 | 1389 | sony_set_speed(((256-data) * 1.3) + 237); |
| 1390 | 1390 | break; |
| 1391 | 1391 | |
| r5932 | r5933 | |
| 1470 | 1470 | { /* special setup mode */ |
| 1471 | 1471 | if (offset & 0x002000) |
| 1472 | 1472 | { |
| 1473 | // | |
| 1473 | // the_seg = 0; /* correct ??? */ | |
| 1474 | 1474 | } |
| 1475 | 1475 | else |
| 1476 | 1476 | { |
| r5932 | r5933 | |
| 1511 | 1511 | offs_t address = (mmu_regs[the_seg][segment].sorg + seg_offset) & 0x1fffff; |
| 1512 | 1512 | |
| 1513 | 1513 | /*logerror("read, logical address%lX\n", offset); |
| 1514 | ||
| 1514 | logerror("physical address%lX\n", address);*/ | |
| 1515 | 1515 | |
| 1516 | 1516 | switch (mmu_regs[the_seg][segment].type) |
| 1517 | 1517 | { |
| r5932 | r5933 | |
| 1573 | 1573 | /* this emulation is not guaranteed accurate */ |
| 1574 | 1574 | |
| 1575 | 1575 | /* problem : due to collisions with video, timings of the LISA CPU |
| 1576 | ||
| 1576 | are slightly different from timings of a bare 68k */ | |
| 1577 | 1577 | /* so we use a kludge... */ |
| 1578 | 1578 | int time_in_frame = video_screen_get_vpos(space->machine->primary_screen); |
| 1579 | 1579 | static int videoROM_address = 0; |
| 1580 | 1580 | |
| 1581 | 1581 | /* the BOOT ROM only reads 56 bits, so there must be some wrap-around for |
| 1582 | ||
| 1582 | videoROM_address <= 56 */ | |
| 1583 | 1583 | /* pixel clock 20MHz, memory access rate 1.25MHz, horizontal clock 22.7kHz |
| 1584 | according to Apple, which must stand for 1.25MHz/55 = 22727kHz, vertical | |
| 1585 | clock approximately 60Hz, which means there are about 380 lines, including VBlank */ | |
| 1584 | according to Apple, which must stand for 1.25MHz/55 = 22727kHz, vertical | |
| 1585 | clock approximately 60Hz, which means there are about 380 lines, including VBlank */ | |
| 1586 | 1586 | /* The values are different on the Mac XL, and I don't know the correct values |
| 1587 | ||
| 1587 | for sure. */ | |
| 1588 | 1588 | |
| 1589 | 1589 | /* Something appears to be wrong with the timings, since we expect to read the |
| 1590 | 2nd half when v-syncing, i.e. for lines beyond the 431th or 364th one (provided | |
| 1591 | there are no additionnal margins). | |
| 1592 | This is caused by the fact that 68k timings are wrong (memory accesses are | |
| 1593 | interlaced with the video hardware, which is not emulated). */ | |
| 1590 | 2nd half when v-syncing, i.e. for lines beyond the 431th or 364th one (provided | |
| 1591 | there are no additionnal margins). | |
| 1592 | This is caused by the fact that 68k timings are wrong (memory accesses are | |
| 1593 | interlaced with the video hardware, which is not emulated). */ | |
| 1594 | 1594 | if (lisa_features.has_mac_xl_video) |
| 1595 | 1595 | { |
| 1596 | 1596 | if ((time_in_frame >= 374) && (time_in_frame <= 392)) /* these values have not been tested */ |
| r5932 | r5933 | |
| 1643 | 1643 | { |
| 1644 | 1644 | if (offset & 0x002000) |
| 1645 | 1645 | { |
| 1646 | // | |
| 1646 | // the_seg = 0; /* correct ??? */ | |
| 1647 | 1647 | } |
| 1648 | 1648 | else |
| 1649 | 1649 | { |
| r5932 | r5933 | |
| 1945 | 1945 | switch ((offset & 0x0600) >> 9) |
| 1946 | 1946 | { |
| 1947 | 1947 | case 0: /* serial ports control */ |
| 1948 | /*SCCBCTL .EQU $FCD241 ;SCC channel B control | |
| 1949 | ACTL .EQU 2 ;offset to SCC channel A control | |
| 1950 | SCCDATA .EQU 4 ;offset to SCC data regs*/ | |
| 1948 | /*SCCBCTL .EQU $FCD241 ;SCC channel B control | |
| 1949 | ACTL .EQU 2 ;offset to SCC channel A control | |
| 1950 | SCCDATA .EQU 4 ;offset to SCC data regs*/ | |
| 1951 | 1951 | break; |
| 1952 | 1952 | |
| 1953 | 1953 | case 2: /* parallel port */ |
| r5932 | r5933 | |
| 2102 | 2102 | COMBINE_DATA(& video_address_latch); |
| 2103 | 2103 | videoram_ptr = ((UINT16 *)lisa_ram_ptr) + ((video_address_latch << 6) & 0xfc000); |
| 2104 | 2104 | /*logerror("video address latch %X -> base address %X\n", video_address_latch, |
| 2105 | ||
| 2105 | (video_address_latch << 7) & 0x1f8000);*/ | |
| 2106 | 2106 | break; |
| 2107 | 2107 | } |
| 2108 | 2108 | break; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /************************************************************************* |
| 2 | 2 | * |
| 3 | * | |
| 3 | * pc_joy.h | |
| 4 | 4 | * |
| 5 | * | |
| 5 | * joystick port | |
| 6 | 6 | * |
| 7 | 7 | *************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 283 | 283 | MACHINE_RESET( sym1 ) |
| 284 | 284 | { |
| 285 | 285 | /* make 0xf800 to 0xffff point to the last half of the monitor ROM |
| 286 | ||
| 286 | so that the CPU can find its reset vectors */ | |
| 287 | 287 | memory_install_readwrite8_handler(cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ), |
| 288 | 288 | 0xf800, 0xffff, 0, 0, SMH_BANK(1), SMH_NOP); |
| 289 | 289 | memory_set_bankptr(machine, 1, sym1_monitor + 0x800); |
| r5932 | r5933 | |
|---|---|---|
| 145 | 145 | head = 0; |
| 146 | 146 | |
| 147 | 147 | /* |
| 148 | * Every fifth cycle is a wait cycle, so I reduced | |
| 149 | * the overlocking by one fitfth | |
| 150 | * Underclocking causes the tape loading to not work. | |
| 151 | */ | |
| 152 | // cpunum_set_clockscale(machine, 0, 0.80); | |
| 148 | * Every fifth cycle is a wait cycle, so I reduced | |
| 149 | * the overlocking by one fitfth | |
| 150 | * Underclocking causes the tape loading to not work. | |
| 151 | */ | |
| 152 | // cpunum_set_clockscale(machine, 0, 0.80); | |
| 153 | 153 | |
| 154 | 154 | /* Initialize some patterns to be displayed in graphics mode */ |
| 155 | 155 | for( i = 0; i < 256; i++ ) |
| r5932 | r5933 | |
| 164 | 164 | |
| 165 | 165 | /************************************* |
| 166 | 166 | * |
| 167 | * | |
| 167 | * Port handlers. | |
| 168 | 168 | * |
| 169 | 169 | *************************************/ |
| 170 | 170 | |
| r5932 | r5933 | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /************************************* |
| 269 | * * | |
| 270 | * Memory handlers * | |
| 271 | * * | |
| 269 | * * | |
| 270 | * Memory handlers * | |
| 271 | * * | |
| 272 | 272 | *************************************/ |
| 273 | 273 | |
| 274 | 274 | static UINT8 psg_a_out = 0x00; |
| r5932 | r5933 | |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /************************************* |
| 485 | * | |
| 485 | * Keyboard * | |
| 486 | 486 | *************************************/ |
| 487 | 487 | READ8_HANDLER( cgenie_keyboard_r ) |
| 488 | 488 | { |
| r5932 | r5933 | |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | /************************************* |
| 519 | * | |
| 519 | * Video RAM * | |
| 520 | 520 | *************************************/ |
| 521 | 521 | |
| 522 | 522 | int cgenie_videoram_r( int offset ) |
| r5932 | r5933 | |
| 580 | 580 | |
| 581 | 581 | /************************************* |
| 582 | 582 | * |
| 583 | * | |
| 583 | * Interrupt handlers. | |
| 584 | 584 | * |
| 585 | 585 | *************************************/ |
| 586 | 586 |
| r5932 | r5933 | |
|---|---|---|
| 87 | 87 | |
| 88 | 88 | /**************************************** |
| 89 | 89 | |
| 90 | ||
| 90 | Graphics Drawing | |
| 91 | 91 | |
| 92 | 92 | ****************************************/ |
| 93 | 93 | |
| r5932 | r5933 | |
| 164 | 164 | { |
| 165 | 165 | case NORMAL_SPRITE: |
| 166 | 166 | /* A sprite may be set to 'normal'. This means that pen number '0' will be transparent and |
| 167 | ||
| 167 | non-collideable. All other pens will be opaque and collideable */ | |
| 168 | 168 | if (color == 0) |
| 169 | 169 | break; |
| 170 | 170 | if (!(x & 0x01)) /* Upper nibble */ |
| r5932 | r5933 | |
| 198 | 198 | |
| 199 | 199 | case BOUNDARY: |
| 200 | 200 | /* A sprite may be set to 'boundary'. This is a 'normal' sprite with the exception that pen |
| 201 | ||
| 201 | number 'F' is transparent (and still collideable). */ | |
| 202 | 202 | if (color == 0) |
| 203 | 203 | break; |
| 204 | 204 | if (!(x & 0x01)) /* Upper nibble */ |
| r5932 | r5933 | |
| 237 | 237 | |
| 238 | 238 | case SHADOW: |
| 239 | 239 | /* A sprite may be set to 'shadow'. This is a 'normal' sprite with the exception that pen |
| 240 | ||
| 240 | number 'E' is non-collideable (but still opaque) */ | |
| 241 | 241 | if (color == 0) |
| 242 | 242 | break; |
| 243 | 243 | if (!(x & 0x01)) /* Upper nibble */ |
| r5932 | r5933 | |
| 271 | 271 | |
| 272 | 272 | case BOUNDARY_SHADOW: |
| 273 | 273 | /* This sprite is a 'normal' sprite with the characteristics of both 'boundary' |
| 274 | and 'shadow'. That is, pen number 'F' is transparent (and still collideable) and | |
| 275 | pen number 'E' is non-collideable (but still opaque). */ | |
| 274 | and 'shadow'. That is, pen number 'F' is transparent (and still collideable) and | |
| 275 | pen number 'E' is non-collideable (but still opaque). */ | |
| 276 | 276 | if (color == 0) |
| 277 | 277 | break; |
| 278 | 278 | if (!(x & 0x01)) /* Upper nibble */ |
| r5932 | r5933 | |
| 311 | 311 | |
| 312 | 312 | case BACKGROUND: |
| 313 | 313 | /* A sprite may be set to 'background'. This sprite will overwrite the contents of the video and |
| 314 | collision buffers. Pens '0' and 'F' are no longer transparent. This sprite is used to initialize | |
| 315 | the buffers at the start of a 'painting'. Additionally, no collision detection is done, and no write | |
| 316 | to the collision depository occurs. The 'E' error will cause the pen number 'E' to be non-collideable | |
| 317 | and therefore not clear the collision buffer */ | |
| 314 | collision buffers. Pens '0' and 'F' are no longer transparent. This sprite is used to initialize | |
| 315 | the buffers at the start of a 'painting'. Additionally, no collision detection is done, and no write | |
| 316 | to the collision depository occurs. The 'E' error will cause the pen number 'E' to be non-collideable | |
| 317 | and therefore not clear the collision buffer */ | |
| 318 | 318 | if (!(x & 0x01)) /* Upper nibble */ |
| 319 | 319 | { |
| 320 | 320 | *screen = (*screen & 0x0f) | (color << 4); |
| r5932 | r5933 | |
| 349 | 349 | |
| 350 | 350 | case NO_COLL: |
| 351 | 351 | /* A sprite may be set to 'non-collideable'. This means that it will have no affect on the contents of |
| 352 | ||
| 352 | the collision buffer and all other collision activities are overridden (pen 'F' is not collideable). */ | |
| 353 | 353 | if (color == 0) |
| 354 | 354 | break; |
| 355 | 355 | if (!(x & 0x01)) /* Upper nibble */ |
| r5932 | r5933 | |
| 361 | 361 | |
| 362 | 362 | case XOR_SPRITE: |
| 363 | 363 | /* This is a 'normal' sprite with the exception that the data from the video buffer is exclusive-ored |
| 364 | with the sprite data and written back out to the video buffer. Collision activity is 'normal'. The 'E' | |
| 365 | error will cause the pen number 'E' to be non-collideable and therefore not react with the collision | |
| 366 | buffer */ | |
| 364 | with the sprite data and written back out to the video buffer. Collision activity is 'normal'. The 'E' | |
| 365 | error will cause the pen number 'E' to be non-collideable and therefore not react with the collision | |
| 366 | buffer */ | |
| 367 | 367 | if (color == 0) |
| 368 | 368 | break; |
| 369 | 369 | if (!(x & 0x01)) /* Upper nibble */ |
| r5932 | r5933 | |
| 892 | 892 | |
| 893 | 893 | /**************************************** |
| 894 | 894 | |
| 895 | ||
| 895 | Suzy Emulation | |
| 896 | 896 | |
| 897 | 897 | ****************************************/ |
| 898 | 898 | |
| r5932 | r5933 | |
| 913 | 913 | UINT16 right; |
| 914 | 914 | UINT32 res, mod; |
| 915 | 915 | /* |
| 916 | Hardware divide: | |
| 917 | EFGH | |
| 918 | * NP | |
| 919 | ---------------- | |
| 920 | ABCD | |
| 921 | Remainder (JK)LM | |
| 922 | */ | |
| 916 | Hardware divide: | |
| 917 | EFGH | |
| 918 | * NP | |
| 919 | ---------------- | |
| 920 | ABCD | |
| 921 | Remainder (JK)LM | |
| 922 | */ | |
| 923 | 923 | |
| 924 | 924 | left = suzy.data[MATH_H] | (suzy.data[MATH_G] << 8) | (suzy.data[MATH_F] << 16) | (suzy.data[MATH_E] << 24); |
| 925 | 925 | right = suzy.data[MATH_P] | (suzy.data[MATH_N] << 8); |
| r5932 | r5933 | |
| 936 | 936 | res = left / right; |
| 937 | 937 | mod = left % right; |
| 938 | 938 | } |
| 939 | // | |
| 939 | // logerror("coprocessor %8x / %8x = %4x\n", left, right, res); | |
| 940 | 940 | suzy.data[MATH_D] = res & 0xff; |
| 941 | 941 | suzy.data[MATH_C] = res >> 8; |
| 942 | 942 | suzy.data[MATH_B] = res >> 16; |
| r5932 | r5933 | |
| 953 | 953 | UINT16 left, right; |
| 954 | 954 | UINT32 res, accu; |
| 955 | 955 | /* |
| 956 | Hardware multiply: | |
| 957 | AB | |
| 958 | * CD | |
| 959 | ---------------- | |
| 960 | EFGH | |
| 961 | Accumulate JKLM | |
| 962 | */ | |
| 956 | Hardware multiply: | |
| 957 | AB | |
| 958 | * CD | |
| 959 | ---------------- | |
| 960 | EFGH | |
| 961 | Accumulate JKLM | |
| 962 | */ | |
| 963 | 963 | suzy.accumulate_overflow = FALSE; |
| 964 | 964 | |
| 965 | 965 | left = suzy.data[MATH_B] | (suzy.data[MATH_A] << 8); |
| r5932 | r5933 | |
| 1060 | 1060 | default: |
| 1061 | 1061 | value = suzy.data[offset]; |
| 1062 | 1062 | } |
| 1063 | // | |
| 1063 | // logerror("suzy read %.2x %.2x\n",offset,data); | |
| 1064 | 1064 | return value; |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| r5932 | r5933 | |
| 1071 | 1071 | /* Additional effects of a write */ |
| 1072 | 1072 | /* Even addresses are the LSB. Any CPU write to an LSB in 0x00-0x7f will set the MSB to 0. */ |
| 1073 | 1073 | /* This in particular holds for math quantities: Writing to B (0x54), D (0x52), |
| 1074 | F (0x62), H (0x60), K (0x6e) or M (0x6c) will force a '0' to be written to A (0x55), | |
| 1075 | C (0x53), E (0x63), G (0x61), J (0x6f) or L (0x6d) respectively */ | |
| 1074 | F (0x62), H (0x60), K (0x6e) or M (0x6c) will force a '0' to be written to A (0x55), | |
| 1075 | C (0x53), E (0x63), G (0x61), J (0x6f) or L (0x6d) respectively */ | |
| 1076 | 1076 | switch(offset) |
| 1077 | 1077 | { |
| 1078 | 1078 | case 0x00: case 0x02: case 0x04: case 0x06: case 0x08: case 0x0a: case 0x0c: case 0x0e: |
| r5932 | r5933 | |
| 1094 | 1094 | break; |
| 1095 | 1095 | case 0x53: |
| 1096 | 1096 | /* If we are going to perform a signed multiplication, we store the sign and convert the number |
| 1097 | ||
| 1097 | to an unsigned one */ | |
| 1098 | 1098 | if (suzy.data[SPRSYS] & 0x80) /* signed math */ |
| 1099 | 1099 | { |
| 1100 | 1100 | UINT16 factor, temp; |
| r5932 | r5933 | |
| 1112 | 1112 | break; |
| 1113 | 1113 | /* Writing to A will start a 16 bit multiply */ |
| 1114 | 1114 | /* If we are going to perform a signed multiplication, we also store the sign and convert the |
| 1115 | ||
| 1115 | number to an unsigned one */ | |
| 1116 | 1116 | case 0x55: |
| 1117 | 1117 | if (suzy.data[SPRSYS] & 0x80) /* signed math */ |
| 1118 | 1118 | { |
| r5932 | r5933 | |
| 1141 | 1141 | lynx_blitter(space->machine); |
| 1142 | 1142 | } |
| 1143 | 1143 | break; |
| 1144 | // | |
| 1144 | // case 0xb2: case 0xb3: /* Cart Bank 0 & 1 */ | |
| 1145 | 1145 | } |
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | |
| 1149 | 1149 | /**************************************** |
| 1150 | 1150 | |
| 1151 | ||
| 1151 | Mikey emulation | |
| 1152 | 1152 | |
| 1153 | 1153 | ****************************************/ |
| 1154 | 1154 | |
| r5932 | r5933 | |
| 1301 | 1301 | |
| 1302 | 1302 | /**************************************** |
| 1303 | 1303 | |
| 1304 | ||
| 1304 | Timers | |
| 1305 | 1305 | |
| 1306 | 1306 | ****************************************/ |
| 1307 | 1307 | |
| r5932 | r5933 | |
| 1361 | 1361 | |
| 1362 | 1362 | static void lynx_timer_signal_irq(running_machine *machine, int which) |
| 1363 | 1363 | { |
| 1364 | if ( ( lynx_timer[which].cntrl1 & 0x80 ) && ( which != 4 ) ) | |
| 1364 | if ( ( lynx_timer[which].cntrl1 & 0x80 ) && ( which != 4 ) ) | |
| 1365 | 1365 | { // irq flag handling later |
| 1366 | 1366 | mikey.data[0x81] |= ( 1 << which ); |
| 1367 | 1367 | cputag_set_input_line(machine, "maincpu", M65SC02_IRQ_LINE, ASSERT_LINE); |
| 1368 | 1368 | } |
| 1369 | switch ( which ) | |
| 1369 | switch ( which ) | |
| 1370 | 1370 | { |
| 1371 | 1371 | case 0: |
| 1372 | 1372 | lynx_timer_count_down( machine, 2 ); |
| r5932 | r5933 | |
| 1394 | 1394 | |
| 1395 | 1395 | void lynx_timer_count_down(running_machine *machine, int which) |
| 1396 | 1396 | { |
| 1397 | if ( ( lynx_timer[which].cntrl1 & 0x0f ) == 0x0f ) | |
| 1397 | if ( ( lynx_timer[which].cntrl1 & 0x0f ) == 0x0f ) | |
| 1398 | 1398 | { |
| 1399 | if ( lynx_timer[which].counter > 0 ) | |
| 1399 | if ( lynx_timer[which].counter > 0 ) | |
| 1400 | 1400 | { |
| 1401 | 1401 | lynx_timer[which].counter--; |
| 1402 | 1402 | return; |
| 1403 | 1403 | } |
| 1404 | if ( lynx_timer[which].counter == 0 ) | |
| 1404 | if ( lynx_timer[which].counter == 0 ) | |
| 1405 | 1405 | { |
| 1406 | 1406 | lynx_timer[which].cntrl2 |= 8; |
| 1407 | 1407 | lynx_timer_signal_irq(machine, which); |
| 1408 | if ( lynx_timer[which].cntrl1 & 0x10 ) | |
| 1408 | if ( lynx_timer[which].cntrl1 & 0x10 ) | |
| 1409 | 1409 | { |
| 1410 | 1410 | lynx_timer[which].counter = lynx_timer[which].bakup; |
| 1411 | } | |
| 1412 | else | |
| 1411 | } | |
| 1412 | else | |
| 1413 | 1413 | { |
| 1414 | 1414 | lynx_timer[which].counter--; |
| 1415 | 1415 | } |
| r5932 | r5933 | |
| 1488 | 1488 | lynx_timer[which].cntrl2 &= ~0x08; |
| 1489 | 1489 | break; |
| 1490 | 1490 | case 2: |
| 1491 | // | |
| 1491 | // lynx_timer[which].counter = data; // why commented out? | |
| 1492 | 1492 | break; |
| 1493 | 1493 | case 3: |
| 1494 | 1494 | lynx_timer[which].cntrl2 = (lynx_timer[which].cntrl2 & 0x08) | (data & ~0x08); |
| r5932 | r5933 | |
| 1518 | 1518 | |
| 1519 | 1519 | /**************************************** |
| 1520 | 1520 | |
| 1521 | ||
| 1521 | UART Emulation | |
| 1522 | 1522 | |
| 1523 | 1523 | ****************************************/ |
| 1524 | 1524 | |
| r5932 | r5933 | |
| 1606 | 1606 | |
| 1607 | 1607 | /**************************************** |
| 1608 | 1608 | |
| 1609 | ||
| 1609 | Mikey memory handlers | |
| 1610 | 1610 | |
| 1611 | 1611 | ****************************************/ |
| 1612 | 1612 | |
| r5932 | r5933 | |
| 1761 | 1761 | logerror("Trying to enable bank 1 write. %d\n", mikey.data[offset] & 0x10); |
| 1762 | 1762 | break; |
| 1763 | 1763 | |
| 1764 | // | |
| 1764 | // case 0x90: // SDONEACK - Suzy Done Acknowledge | |
| 1765 | 1765 | case 0x91: // CPUSLEEP - CPU Bus Request Disable |
| 1766 | 1766 | mikey.data[offset] = data; |
| 1767 | 1767 | if (!data) |
| r5932 | r5933 | |
| 1780 | 1780 | |
| 1781 | 1781 | /**************************************** |
| 1782 | 1782 | |
| 1783 | ||
| 1783 | Init / Config | |
| 1784 | 1784 | |
| 1785 | 1785 | ****************************************/ |
| 1786 | 1786 | |
| r5932 | r5933 | |
| 1792 | 1792 | WRITE8_HANDLER( lynx_memory_config_w ) |
| 1793 | 1793 | { |
| 1794 | 1794 | /* bit 7: hispeed, uses page mode accesses (4 instead of 5 cycles ) |
| 1795 | ||
| 1795 | * when these are safe in the cpu */ | |
| 1796 | 1796 | lynx_memory_config = data; |
| 1797 | 1797 | |
| 1798 | 1798 | memory_install_read8_handler(space, 0xfc00, 0xfcff, 0, 0, (data & 1) ? SMH_BANK(1) : suzy_read); |
| r5932 | r5933 | |
| 1869 | 1869 | |
| 1870 | 1870 | /**************************************** |
| 1871 | 1871 | |
| 1872 | ||
| 1872 | Image handling | |
| 1873 | 1873 | |
| 1874 | 1874 | ****************************************/ |
| 1875 | 1875 | |
| r5932 | r5933 | |
| 1959 | 1959 | return INIT_FAIL; |
| 1960 | 1960 | |
| 1961 | 1961 | /* 2008-10 FP: According to Handy source these should be page_size_bank0. Are we using |
| 1962 | it correctly in MESS? Moreover, the next two values should be page_size_bank1. We should | |
| 1963 | implement this as well */ | |
| 1962 | it correctly in MESS? Moreover, the next two values should be page_size_bank1. We should | |
| 1963 | implement this as well */ | |
| 1964 | 1964 | lynx_granularity = header[4] | (header[5] << 8); |
| 1965 | 1965 | |
| 1966 | 1966 | logerror ("%s %dkb cartridge with %dbyte granularity from %s\n", |
| r5932 | r5933 | |
| 1971 | 1971 | else if (!mame_stricmp (filetype, "lyx")) |
| 1972 | 1972 | { |
| 1973 | 1973 | /* 2008-10 FP: FIXME: .lyx file don't have an header, hence they miss "lynx_granularity" |
| 1974 | (see above). What if bank 0 has to be loaded elsewhere? And what about bank 1? | |
| 1975 | These should work with most .lyx files, but we need additional info on raw cart images */ | |
| 1974 | (see above). What if bank 0 has to be loaded elsewhere? And what about bank 1? | |
| 1975 | These should work with most .lyx files, but we need additional info on raw cart images */ | |
| 1976 | 1976 | if (size == 0x20000) |
| 1977 | 1977 | lynx_granularity = 0x0200; |
| 1978 | 1978 | else if (size == 0x80000) |
| r5932 | r5933 | |
|---|---|---|
| 30 | 30 | static READ8_HANDLER( ondra_keyboard_r ) |
| 31 | 31 | { |
| 32 | 32 | UINT8 retVal = 0x00; |
| 33 | UINT8 ondra_keyboard_line = offset & 0x000f; | |
| 34 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; | |
| 33 | UINT8 ondra_keyboard_line = offset & 0x000f; | |
| 34 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; | |
| 35 | 35 | double valcas = cassette_input(cassette_device_image(space->machine)); |
| 36 | 36 | if ( valcas < 0.00) { |
| 37 | 37 | retVal = 0x80; |
| 38 | } | |
| 38 | } | |
| 39 | 39 | if (ondra_keyboard_line > 9) { |
| 40 | 40 | retVal |= 0x1f; |
| 41 | 41 | } else { |
| 42 | retVal |= input_port_read(space->machine, keynames[ondra_keyboard_line]); | |
| 42 | retVal |= input_port_read(space->machine, keynames[ondra_keyboard_line]); | |
| 43 | 43 | } |
| 44 | 44 | return retVal; |
| 45 | 45 | } |
| r5932 | r5933 | |
| 84 | 84 | |
| 85 | 85 | static TIMER_CALLBACK(nmi_check_callback) |
| 86 | 86 | { |
| 87 | if ((input_port_read(machine, "NMI") & 1) == 1) | |
| 87 | if ((input_port_read(machine, "NMI") & 1) == 1) | |
| 88 | 88 | { |
| 89 | 89 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 90 | 90 | } |
| r5932 | r5933 | |
| 95 | 95 | ondra_bank1_status = 0; |
| 96 | 96 | ondra_bank2_status = 0; |
| 97 | 97 | ondra_update_banks(machine); |
| 98 | ||
| 98 | ||
| 99 | 99 | timer_pulse(machine, ATTOTIME_IN_HZ(10), NULL, 0, nmi_check_callback); |
| 100 | 100 | } |
| 101 | 101 |
| r5932 | r5933 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | /*********************************************************** |
| 21 | 21 | |
| 22 | ||
| 22 | PIO | |
| 23 | 23 | |
| 24 | ||
| 24 | Port B is unused on both PIOs | |
| 25 | 25 | |
| 26 | 26 | ************************************************************/ |
| 27 | 27 | |
| r5932 | r5933 | |
| 32 | 32 | |
| 33 | 33 | static READ8_DEVICE_HANDLER( pio_system_r ) |
| 34 | 34 | { |
| 35 | /* | |
| 35 | /* d3 Centronics ready flag */ | |
| 36 | 36 | |
| 37 | 37 | UINT8 data = ~centronics_busy_r(kaypro_printer) << 3; |
| 38 | 38 | return (kaypro_system_port & 0xf7) | (data & 8) ; |
| r5932 | r5933 | |
| 40 | 40 | |
| 41 | 41 | static WRITE8_DEVICE_HANDLER( pio_system_w ) |
| 42 | 42 | { |
| 43 | /* d7 bank select | |
| 44 | d6 disk drive motors - not emulated | |
| 45 | d5 double-density enable (0=double density) | |
| 46 | d4 Centronics strobe | |
| 47 | d2 side select (1=side 1) | |
| 48 | d1 drive B | |
| 49 | d0 drive A */ | |
| 43 | /* d7 bank select | |
| 44 | d6 disk drive motors - not emulated | |
| 45 | d5 double-density enable (0=double density) | |
| 46 | d4 Centronics strobe | |
| 47 | d2 side select (1=side 1) | |
| 48 | d1 drive B | |
| 49 | d0 drive A */ | |
| 50 | 50 | |
| 51 | 51 | /* get address space */ |
| 52 | 52 | const address_space *mem = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r5932 | r5933 | |
| 133 | 133 | |
| 134 | 134 | /*********************************************************** |
| 135 | 135 | |
| 136 | ||
| 136 | KAYPRO2X SYSTEM PORT | |
| 137 | 137 | |
| 138 | ||
| 138 | The PIOs were replaced by a few standard 74xx chips | |
| 139 | 139 | |
| 140 | 140 | ************************************************************/ |
| 141 | 141 | |
| r5932 | r5933 | |
| 147 | 147 | |
| 148 | 148 | WRITE8_HANDLER( kaypro2x_system_port_w ) |
| 149 | 149 | { |
| 150 | /* d7 bank select | |
| 151 | d6 alternate character set (write only) | |
| 152 | d5 double-density enable | |
| 153 | d4 disk drive motors - not emulated | |
| 154 | d3 Centronics strobe | |
| 155 | d2 side select (appears that 0=side 1?) | |
| 156 | d1 drive B | |
| 157 | d0 drive A */ | |
| 150 | /* d7 bank select | |
| 151 | d6 alternate character set (write only) | |
| 152 | d5 double-density enable | |
| 153 | d4 disk drive motors - not emulated | |
| 154 | d3 Centronics strobe | |
| 155 | d2 side select (appears that 0=side 1?) | |
| 156 | d1 drive B | |
| 157 | d0 drive A */ | |
| 158 | 158 | |
| 159 | 159 | /* get address space */ |
| 160 | 160 | const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| r5932 | r5933 | |
| 192 | 192 | |
| 193 | 193 | /*********************************************************************** |
| 194 | 194 | |
| 195 | SIO | |
| 196 | Baud rate setup commented out until MAME includes the feature. | |
| 195 | SIO | |
| 196 | Baud rate setup commented out until MAME includes the feature. | |
| 197 | 197 | |
| 198 | ||
| 198 | On Kaypro2x, Channel B on both SIOs is hardwired to 300 baud. | |
| 199 | 199 | |
| 200 | ||
| 200 | Both devices on sio2 (printer and modem) are not emulated. | |
| 201 | 201 | |
| 202 | 202 | ************************************************************************/ |
| 203 | 203 | |
| 204 | 204 | /* Set baud rate. bits 0..3 Rx and Tx are tied together. Baud Rate Generator is a AY-5-8116, SMC8116, etc. |
| 205 | 00h 50 | |
| 206 | 11h 75 | |
| 207 | 22h 110 | |
| 208 | 33h 134.5 | |
| 209 | 44h 150 | |
| 210 | 55h 300 | |
| 211 | 66h 600 | |
| 212 | 77h 1200 | |
| 213 | 88h 1800 | |
| 214 | 99h 2000 | |
| 215 | AAh 2400 | |
| 216 | BBh 3600 | |
| 217 | CCh 4800 | |
| 218 | DDh 7200 | |
| 219 | EEh 9600 | |
| 220 | FFh 19200 */ | |
| 205 | 00h 50 | |
| 206 | 11h 75 | |
| 207 | 22h 110 | |
| 208 | 33h 134.5 | |
| 209 | 44h 150 | |
| 210 | 55h 300 | |
| 211 | 66h 600 | |
| 212 | 77h 1200 | |
| 213 | 88h 1800 | |
| 214 | 99h 2000 | |
| 215 | AAh 2400 | |
| 216 | BBh 3600 | |
| 217 | CCh 4800 | |
| 218 | DDh 7200 | |
| 219 | EEh 9600 | |
| 220 | FFh 19200 */ | |
| 221 | 221 | |
| 222 | 222 | static const int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 }; |
| 223 | 223 | |
| r5932 | r5933 | |
| 225 | 225 | { |
| 226 | 226 | data &= 0x0f; |
| 227 | 227 | |
| 228 | // z80sio_set_rx_clock( kaypro_z80sio, baud_clock[data], 0); | |
| 229 | // z80sio_set_tx_clock( kaypro_z80sio, baud_clock[data], 0); | |
| 228 | // z80sio_set_rx_clock( kaypro_z80sio, baud_clock[data], 0); | |
| 229 | // z80sio_set_tx_clock( kaypro_z80sio, baud_clock[data], 0); | |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | WRITE8_HANDLER( kayproii_baud_b_w ) /* Channel B - Keyboard - only usable speed is 300 baud */ |
| 233 | 233 | { |
| 234 | 234 | data &= 0x0f; |
| 235 | 235 | |
| 236 | // z80sio_set_rx_clock( kaypro_z80sio, baud_clock[data], 1); | |
| 237 | // z80sio_set_tx_clock( kaypro_z80sio, baud_clock[data], 1); | |
| 236 | // z80sio_set_rx_clock( kaypro_z80sio, baud_clock[data], 1); | |
| 237 | // z80sio_set_tx_clock( kaypro_z80sio, baud_clock[data], 1); | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | WRITE8_HANDLER( kaypro2x_baud_a_w ) /* Channel A on 2nd SIO - Serial Printer */ |
| 241 | 241 | { |
| 242 | 242 | data &= 0x0f; |
| 243 | 243 | |
| 244 | // z80sio_set_rx_clock( kaypro2x_z80sio, baud_clock[data], 0); | |
| 245 | // z80sio_set_tx_clock( kaypro2x_z80sio, baud_clock[data], 0); | |
| 244 | // z80sio_set_rx_clock( kaypro2x_z80sio, baud_clock[data], 0); | |
| 245 | // z80sio_set_tx_clock( kaypro2x_z80sio, baud_clock[data], 0); | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | const z80sio_interface kaypro_sio_intf = |
| r5932 | r5933 | |
| 261 | 261 | return z80sio_d_r(device, 0); |
| 262 | 262 | else |
| 263 | 263 | if (offset == 1) |
| 264 | // | |
| 264 | // return z80sio_d_r(device, 1); | |
| 265 | 265 | return kay_kbd_d_r(); |
| 266 | 266 | else |
| 267 | 267 | if (offset == 2) |
| 268 | 268 | return z80sio_c_r(device, 0); |
| 269 | 269 | else |
| 270 | // | |
| 270 | // return z80sio_c_r(device, 1); | |
| 271 | 271 | return kay_kbd_c_r(); |
| 272 | 272 | } |
| 273 | 273 | |
| r5932 | r5933 | |
| 277 | 277 | z80sio_d_w(device, 0, data); |
| 278 | 278 | else |
| 279 | 279 | if (offset == 1) |
| 280 | // | |
| 280 | // z80sio_d_w(device, 1, data); | |
| 281 | 281 | kay_kbd_d_w(device->machine, data); |
| 282 | 282 | else |
| 283 | 283 | if (offset == 2) |
| r5932 | r5933 | |
| 317 | 317 | |
| 318 | 318 | /************************************************************************************* |
| 319 | 319 | |
| 320 | ||
| 320 | Floppy DIsk | |
| 321 | 321 | |
| 322 | If DRQ or IRQ is set, and cpu is halted, the NMI goes low. | |
| 323 | Since the HALT occurs last (and has no callback mechanism), we need to set | |
| 324 | a short delay, to give time for the processor to execute the HALT before NMI | |
| 325 | becomes active. | |
| 322 | If DRQ or IRQ is set, and cpu is halted, the NMI goes low. | |
| 323 | Since the HALT occurs last (and has no callback mechanism), we need to set | |
| 324 | a short delay, to give time for the processor to execute the HALT before NMI | |
| 325 | becomes active. | |
| 326 | 326 | |
| 327 | 327 | *************************************************************************************/ |
| 328 | 328 | |
| r5932 | r5933 | |
| 349 | 349 | |
| 350 | 350 | /*********************************************************** |
| 351 | 351 | |
| 352 | ||
| 352 | Machine | |
| 353 | 353 | |
| 354 | 354 | ************************************************************/ |
| 355 | 355 | |
| r5932 | r5933 | |
| 378 | 378 | |
| 379 | 379 | /*********************************************************** |
| 380 | 380 | |
| 381 | ||
| 381 | Quickload | |
| 382 | 382 | |
| 383 | This loads a .COM file to address 0x100 then jumps | |
| 384 | there. Sometimes .COM has been renamed to .CPM to | |
| 385 | prevent windows going ballistic. These can be loaded | |
| 386 | as well. | |
| 383 | This loads a .COM file to address 0x100 then jumps | |
| 384 | there. Sometimes .COM has been renamed to .CPM to | |
| 385 | prevent windows going ballistic. These can be loaded | |
| 386 | as well. | |
| 387 | 387 | |
| 388 | 388 | ************************************************************/ |
| 389 | 389 | |
| r5932 | r5933 | |
| 402 | 402 | RAM[i+0x100] = data; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | // | |
| 405 | // if (input_port_read(image->machine, "CONFIG") & 1) | |
| 406 | 406 | { |
| 407 | 407 | pio_system_w(kayproii_z80pio_s, 0, kaypro_system_port & 0x7f); // switch TPA in |
| 408 | 408 | RAM[0x80]=0; // clear out command tail |
| r5932 | r5933 | |
| 428 | 428 | RAM[i+0x100] = data; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | // | |
| 431 | // if (input_port_read(image->machine, "CONFIG") & 1) | |
| 432 | 432 | { |
| 433 | 433 | kaypro2x_system_port_w(space, 0, kaypro_system_port & 0x7f); |
| 434 | 434 | RAM[0x80]=0; |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | #include "super80.h" |
| 10 | 10 | |
| 11 | 11 | /* Bits in shared variable: |
| 12 | d5 cassette LED | |
| 13 | d4 super80v rom or pcg bankswitch (1=pcg ram, 0=char gen rom) | |
| 14 | d2 super80v video or colour bankswitch (1=video ram, 0=colour ram) | |
| 15 | d2 super80 screen off (=2mhz) or on (bursts of 2mhz at 50hz = 1mhz) */ | |
| 12 | d5 cassette LED | |
| 13 | d4 super80v rom or pcg bankswitch (1=pcg ram, 0=char gen rom) | |
| 14 | d2 super80v video or colour bankswitch (1=video ram, 0=colour ram) | |
| 15 | d2 super80 screen off (=2mhz) or on (bursts of 2mhz at 50hz = 1mhz) */ | |
| 16 | 16 | |
| 17 | 17 | UINT8 super80_shared=0xff; |
| 18 | 18 | |
| r5932 | r5933 | |
| 83 | 83 | |
| 84 | 84 | static UINT8 cass_data[]={ 0, 0, 0, 0 }; |
| 85 | 85 | |
| 86 | /* this timer runs at 200khz and does 2 jobs: | |
| 87 | 1. Scan the keyboard and present the results to the pio | |
| 88 | 2. Emulate the 2 chips in the cassette input circuit | |
| 86 | /* this timer runs at 200khz and does 2 jobs: | |
| 87 | 1. Scan the keyboard and present the results to the pio | |
| 88 | 2. Emulate the 2 chips in the cassette input circuit | |
| 89 | 89 | |
| 90 | Reasons why it is necessary: | |
| 91 | 1. The real z80pio is driven by the cpu clock and is capable of independent actions. | |
| 92 | MAME does not support this at all. If the interrupt key sequence is entered, the | |
| 93 | computer can be reset out of a hung state by the operator. | |
| 94 | 2. This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage, | |
| 95 | and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint. | |
| 90 | Reasons why it is necessary: | |
| 91 | 1. The real z80pio is driven by the cpu clock and is capable of independent actions. | |
| 92 | MAME does not support this at all. If the interrupt key sequence is entered, the | |
| 93 | computer can be reset out of a hung state by the operator. | |
| 94 | 2. This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage, | |
| 95 | and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint. | |
| 96 | 96 | |
| 97 | The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop. | |
| 98 | My "read-any-system" cassette circuit was a CA3140 op-amp, the smarts being done in software. | |
| 97 | The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop. | |
| 98 | My "read-any-system" cassette circuit was a CA3140 op-amp, the smarts being done in software. | |
| 99 | 99 | |
| 100 | bit 0 = original system (U79 and U1) | |
| 101 | bit 1 = MDS fast system | |
| 102 | bit 2 = CA3140 */ | |
| 100 | bit 0 = original system (U79 and U1) | |
| 101 | bit 1 = MDS fast system | |
| 102 | bit 2 = CA3140 */ | |
| 103 | 103 | |
| 104 | 104 | static TIMER_CALLBACK( super80_timer ) |
| 105 | 105 | { |
| r5932 | r5933 | |
| 158 | 158 | /*************************************** PRINTER ********************************************************/ |
| 159 | 159 | |
| 160 | 160 | /* The Super80 had an optional I/O card that plugged into the S-100 slot. The card had facility for running |
| 161 | an 8-bit Centronics printer, and a serial device at 300, 600, or 1200 baud. The I/O address range | |
| 162 | was selectable via 4 dipswitches. The serial parameters (baud rate, parity, stop bits, etc) was | |
| 163 | chosen with more dipswitches. Regretably, no parameters could be set by software. Currently, the | |
| 164 | Centronics printer is emulated; the serial side of things may be done later, as will the dipswitches. | |
| 161 | an 8-bit Centronics printer, and a serial device at 300, 600, or 1200 baud. The I/O address range | |
| 162 | was selectable via 4 dipswitches. The serial parameters (baud rate, parity, stop bits, etc) was | |
| 163 | chosen with more dipswitches. Regretably, no parameters could be set by software. Currently, the | |
| 164 | Centronics printer is emulated; the serial side of things may be done later, as will the dipswitches. | |
| 165 | 165 | |
| 166 | The most commonly used I/O range is DC-DE (DC = centronics, DD = serial data, DE = serial control | |
| 167 | All the home-brew roms use this, except for super80e which uses BC-BE (which we don't support yet). */ | |
| 166 | The most commonly used I/O range is DC-DE (DC = centronics, DD = serial data, DE = serial control | |
| 167 | All the home-brew roms use this, except for super80e which uses BC-BE (which we don't support yet). */ | |
| 168 | 168 | |
| 169 | 169 | /**************************** I/O PORTS *****************************************************************/ |
| 170 | 170 | |
| r5932 | r5933 | |
| 173 | 173 | UINT8 data=0x7f; |
| 174 | 174 | |
| 175 | 175 | /* bit 7 = printer busy |
| 176 | ||
| 176 | 0 = printer is not busy */ | |
| 177 | 177 | |
| 178 | 178 | data |= centronics_busy_r(super80_printer) << 7; |
| 179 | 179 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | Machine code for Myarc Geneve. | |
| 3 | Raphael Nabet, 2003. | |
| 2 | Machine code for Myarc Geneve. | |
| 3 | Raphael Nabet, 2003. | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include <math.h> |
| r5932 | r5933 | |
| 30 | 30 | static void poll_mouse(running_machine *machine); |
| 31 | 31 | |
| 32 | 32 | /* |
| 33 | ||
| 33 | pointers to memory areas | |
| 34 | 34 | */ |
| 35 | 35 | /* pointer to boot ROM */ |
| 36 | 36 | static UINT8 *ROM_ptr; |
| r5932 | r5933 | |
| 42 | 42 | static UINT8 *DRAM_ptr; |
| 43 | 43 | |
| 44 | 44 | /* |
| 45 | ||
| 45 | Configuration | |
| 46 | 46 | */ |
| 47 | 47 | /* TRUE if speech synthesizer present */ |
| 48 | 48 | static char has_speech; |
| r5932 | r5933 | |
| 87 | 87 | static void machine_stop_geneve(running_machine *machine); |
| 88 | 88 | |
| 89 | 89 | /* |
| 90 | ||
| 90 | GROM support. | |
| 91 | 91 | |
| 92 | ||
| 92 | The Geneve does not include any GROM, but it features a simple GROM emulator. | |
| 93 | 93 | |
| 94 | One oddity is that, since the Geneve does not use a look-ahead buffer, GPL | |
| 95 | data is always off one byte, i.e. GPL bytes 0, 1, 2... are stored in bytes | |
| 96 | 1, 2, 3... of pages >38->3f (byte 0 of page >38 is has GPL address >ffff). | |
| 94 | One oddity is that, since the Geneve does not use a look-ahead buffer, GPL | |
| 95 | data is always off one byte, i.e. GPL bytes 0, 1, 2... are stored in bytes | |
| 96 | 1, 2, 3... of pages >38->3f (byte 0 of page >38 is has GPL address >ffff). | |
| 97 | 97 | |
| 98 | I think that I have once read that the geneve GROM emulator does not | |
| 99 | emulate wrap-around within a GROM, i.e. address >1fff is followed by >2000 | |
| 100 | (instead of >0000 with a real GROM). | |
| 98 | I think that I have once read that the geneve GROM emulator does not | |
| 99 | emulate wrap-around within a GROM, i.e. address >1fff is followed by >2000 | |
| 100 | (instead of >0000 with a real GROM). | |
| 101 | 101 | */ |
| 102 | 102 | static struct |
| 103 | 103 | { |
| r5932 | r5933 | |
| 106 | 106 | } GPL_port; |
| 107 | 107 | |
| 108 | 108 | /* |
| 109 | ||
| 109 | Cartridge support | |
| 110 | 110 | |
| 111 | ||
| 111 | The Geneve does not have a cartridge port, but it has cartridge emulation. | |
| 112 | 112 | */ |
| 113 | 113 | static int cartridge_page; |
| 114 | 114 | |
| r5932 | r5933 | |
| 138 | 138 | |
| 139 | 139 | /*===========================================================================*/ |
| 140 | 140 | /* |
| 141 | General purpose code: | |
| 142 | initialization, cart loading, etc. | |
| 141 | General purpose code: | |
| 142 | initialization, cart loading, etc. | |
| 143 | 143 | */ |
| 144 | 144 | |
| 145 | 145 | DRIVER_INIT( geneve ) |
| r5932 | r5933 | |
| 155 | 155 | MACHINE_START( geneve ) |
| 156 | 156 | { |
| 157 | 157 | /* Initialize all. Actually, at this point, we don't know |
| 158 | how the switches are set. Later we use the configuration switches to | |
| 159 | determine which one to use. */ | |
| 158 | how the switches are set. Later we use the configuration switches to | |
| 159 | determine which one to use. */ | |
| 160 | 160 | ti99_peb_init(); |
| 161 | 161 | ti99_floppy_controllers_init_all(machine); |
| 162 | 162 | ti99_ide_init(machine); |
| r5932 | r5933 | |
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | /* |
| 260 | ||
| 260 | video initialization. | |
| 261 | 261 | */ |
| 262 | 262 | VIDEO_START(geneve) |
| 263 | 263 | { |
| r5932 | r5933 | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /* |
| 269 | ||
| 269 | scanline interrupt | |
| 270 | 270 | */ |
| 271 | 271 | INTERRUPT_GEN( geneve_hblank_interrupt ) |
| 272 | 272 | { |
| r5932 | r5933 | |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /* |
| 284 | ||
| 284 | inta is connected to both tms9901 IRQ1 line and to tms9995 INT4/EC line. | |
| 285 | 285 | */ |
| 286 | 286 | static void inta_callback(running_machine *machine, int state) |
| 287 | 287 | { |
| r5932 | r5933 | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /* |
| 293 | ||
| 293 | intb is connected to tms9901 IRQ12 line. | |
| 294 | 294 | */ |
| 295 | 295 | static void intb_callback(running_machine *machine, int state) |
| 296 | 296 | { |
| r5932 | r5933 | |
| 304 | 304 | #pragma mark MEMORY HANDLERS |
| 305 | 305 | #endif |
| 306 | 306 | /* |
| 307 | ||
| 307 | Memory handlers. | |
| 308 | 308 | */ |
| 309 | 309 | |
| 310 | 310 | /* |
| 311 | ||
| 311 | TMS5200 speech chip read | |
| 312 | 312 | */ |
| 313 | 313 | static READ8_HANDLER ( geneve_speech_r ) |
| 314 | 314 | { |
| r5932 | r5933 | |
| 324 | 324 | if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220"))) |
| 325 | 325 | { |
| 326 | 326 | /* Weirdly enough, we are always seeing some problems even though |
| 327 | ||
| 327 | everything is working fine. */ | |
| 328 | 328 | /*attotime time_to_ready = double_to_attotime(tms5220_time_to_ready()); |
| 329 | logerror("ti99/4a speech says aaargh!\n"); | |
| 330 | logerror("(time to ready: %f -> %d)\n", time_to_ready, (int) ceil(3000000*time_to_ready));*/ | |
| 329 | logerror("ti99/4a speech says aaargh!\n"); | |
| 330 | logerror("(time to ready: %f -> %d)\n", time_to_ready, (int) ceil(3000000*time_to_ready));*/ | |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | #endif |
| 335 | 335 | |
| 336 | 336 | /* |
| 337 | ||
| 337 | TMS5200 speech chip write | |
| 338 | 338 | */ |
| 339 | 339 | static WRITE8_HANDLER ( geneve_speech_w ) |
| 340 | 340 | { |
| r5932 | r5933 | |
| 342 | 342 | |
| 343 | 343 | #if 1 |
| 344 | 344 | /* the stupid design of the tms5220 core means that ready is cleared when |
| 345 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the | |
| 346 | case, we would need to store the value on the bus, which would be more | |
| 347 | complex. */ | |
| 345 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the | |
| 346 | case, we would need to store the value on the bus, which would be more | |
| 347 | complex. */ | |
| 348 | 348 | if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220"))) |
| 349 | 349 | { |
| 350 | 350 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220"))); |
| r5932 | r5933 | |
| 553 | 553 | |
| 554 | 554 | offset &= 0x1fff; |
| 555 | 555 | |
| 556 | /* Although we could have 128K boot ROM (page f0...ff), the stock | |
| 557 | Geneve only has 16K. The address is incompletely decoded, so page | |
| 558 | f0 is mirrored on all even pages up to fe, and f1 is mirrored on | |
| 559 | f3, f5, ... ff. | |
| 560 | Currently, MESS is delivered with the 16K ROM only. So for the time | |
| 561 | being, we won't lose much if we mask the page bits. | |
| 562 | Michael Zapf, 2008-01-23 | |
| 563 | */ | |
| 556 | /* Although we could have 128K boot ROM (page f0...ff), the stock | |
| 557 | Geneve only has 16K. The address is incompletely decoded, so page | |
| 558 | f0 is mirrored on all even pages up to fe, and f1 is mirrored on | |
| 559 | f3, f5, ... ff. | |
| 560 | Currently, MESS is delivered with the 16K ROM only. So for the time | |
| 561 | being, we won't lose much if we mask the page bits. | |
| 562 | Michael Zapf, 2008-01-23 | |
| 563 | */ | |
| 564 | 564 | if (page > 0xf1) page &= 0xf1; |
| 565 | ||
| 565 | ||
| 566 | 566 | switch (page) |
| 567 | 567 | { |
| 568 | 568 | case 0xf0: |
| r5932 | r5933 | |
| 653 | 653 | page_lookup[offset-0xf110] = data; |
| 654 | 654 | return; |
| 655 | 655 | |
| 656 | /*case 0xf118: // read-only register??? | |
| 657 | key_buf = data; | |
| 658 | return*/ | |
| 656 | /*case 0xf118: // read-only register??? | |
| 657 | key_buf = data; | |
| 658 | return*/ | |
| 659 | 659 | |
| 660 | 660 | case 0xf120: |
| 661 | 661 | sn76496_w(devtag_get_device(space->machine, "sn76496"), 0, data); |
| r5932 | r5933 | |
| 706 | 706 | page_lookup[offset-0x8000] = data; |
| 707 | 707 | return; |
| 708 | 708 | |
| 709 | /*case 0x8008: // read-only register??? | |
| 710 | key_buf = data; | |
| 711 | return*/ | |
| 709 | /*case 0x8008: // read-only register??? | |
| 710 | key_buf = data; | |
| 711 | return*/ | |
| 712 | 712 | |
| 713 | 713 | case 0x8010: |
| 714 | 714 | case 0x8011: |
| r5932 | r5933 | |
| 852 | 852 | offset &= 0x1fff; |
| 853 | 853 | |
| 854 | 854 | /* ROM is incompletely decoded. Pages f0, f2, f4 ... fe all map to the |
| 855 | ||
| 855 | first 8K Boot ROM; f1, ..., ff to the second 8K. See above. */ | |
| 856 | 856 | if (page > 0xf1) page &= 0xf1; |
| 857 | ||
| 857 | ||
| 858 | 858 | switch (page) |
| 859 | 859 | { |
| 860 | 860 | case 0xf0: |
| r5932 | r5933 | |
| 961 | 961 | static void read_key_if_possible(running_machine *machine) |
| 962 | 962 | { |
| 963 | 963 | /* if keyboard reset is not asserted, and key clock is enabled, and key |
| 964 | ||
| 964 | buffer clear is disabled, and key queue is not empty. */ | |
| 965 | 965 | if ((! KeyReset) && (mode_flags & mf_keyclock) && (mode_flags & mf_keyclear) && KeyQueueLen) |
| 966 | 966 | { |
| 967 | 967 | tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 8, 1); |
| r5932 | r5933 | |
| 991 | 991 | 0x1d, /* right control */ |
| 992 | 992 | 0x38, /* alt gr */ |
| 993 | 993 | /* extra codes are 0x5b for Left Windows, 0x5c for Right Windows, 0x5d |
| 994 | for Menu, 0x5e for power, 0x5f for sleep, 0x63 for wake, but I doubt | |
| 995 | any Geneve program would take advantage of these. */ | |
| 994 | for Menu, 0x5e for power, 0x5f for sleep, 0x63 for wake, but I doubt | |
| 995 | any Geneve program would take advantage of these. */ | |
| 996 | 996 | |
| 997 | 997 | /* extended key that is equivalent to a non-extended key |
| 998 | ||
| 998 | with shift off */ | |
| 999 | 999 | 0x35, /* pad slash */ |
| 1000 | 1000 | |
| 1001 | 1001 | /* extended keys that are equivalent to non-extended keys |
| 1002 | ||
| 1002 | with numlock off */ | |
| 1003 | 1003 | 0x47, /* home */ |
| 1004 | 1004 | 0x48, /* up */ |
| 1005 | 1005 | 0x49, /* page up */ |
| r5932 | r5933 | |
| 1045 | 1045 | |
| 1046 | 1046 | /* Release Fake Shift/Unshift if another key is pressed */ |
| 1047 | 1047 | /* We do so if a key is released, though it is actually |
| 1048 | ||
| 1048 | required only if it is a modifier key */ | |
| 1049 | 1049 | /*if (pressed)*/ |
| 1050 | 1050 | { |
| 1051 | 1051 | if (KeyFakeShiftState) |
| r5932 | r5933 | |
| 1148 | 1148 | else if (keycode == 0x6f) |
| 1149 | 1149 | { /* emulate pause (F15) key */ |
| 1150 | 1150 | /* this is a bit complex, as Pause -> Ctrl+NumLock and |
| 1151 | Ctrl+Pause -> Ctrl+ScrLock. Furthermore, there is no | |
| 1152 | repeat or release. */ | |
| 1151 | Ctrl+Pause -> Ctrl+ScrLock. Furthermore, there is no | |
| 1152 | repeat or release. */ | |
| 1153 | 1153 | if (pressed) |
| 1154 | 1154 | { |
| 1155 | 1155 | if (KeyCtrlState) |
| r5932 | r5933 | |
| 1253 | 1253 | #pragma mark TMS9901 INTERFACE |
| 1254 | 1254 | #endif |
| 1255 | 1255 | /* |
| 1256 | ||
| 1256 | Geneve-specific tms9901 I/O handlers | |
| 1257 | 1257 | |
| 1258 | ||
| 1258 | See mess/machine/tms9901.c for generic tms9901 CRU handlers. | |
| 1259 | 1259 | */ |
| 1260 | 1260 | /* |
| 1261 | ||
| 1261 | TMS9901 interrupt handling on a Geneve. | |
| 1262 | 1262 | |
| 1263 | Geneve uses the following interrupts: | |
| 1264 | INT1: external interrupt (used by RS232 controller, for instance) - | |
| 1265 | connected to tms9995 int4, too. | |
| 1266 | INT2: VDP interrupt | |
| 1267 | TMS9901 timer interrupt? (overrides INT3) | |
| 1268 | INT8: keyboard interrupt??? | |
| 1269 | INT10: mouse interrupt??? | |
| 1270 | INT11: clock interrupt??? | |
| 1271 | INT12: INTB interrupt from PE-bus | |
| 1263 | Geneve uses the following interrupts: | |
| 1264 | INT1: external interrupt (used by RS232 controller, for instance) - | |
| 1265 | connected to tms9995 int4, too. | |
| 1266 | INT2: VDP interrupt | |
| 1267 | TMS9901 timer interrupt? (overrides INT3) | |
| 1268 | INT8: keyboard interrupt??? | |
| 1269 | INT10: mouse interrupt??? | |
| 1270 | INT11: clock interrupt??? | |
| 1271 | INT12: INTB interrupt from PE-bus | |
| 1272 | 1272 | */ |
| 1273 | 1273 | |
| 1274 | 1274 | /* |
| 1275 | ||
| 1275 | set the state of int2 (called by tms9928 core) | |
| 1276 | 1276 | */ |
| 1277 | 1277 | /*void tms9901_set_int2(int state) |
| 1278 | 1278 | { |
| 1279 | ||
| 1279 | tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 2, state); | |
| 1280 | 1280 | }*/ |
| 1281 | 1281 | |
| 1282 | 1282 | /* |
| 1283 | ||
| 1283 | Called by the 9901 core whenever the state of INTREQ and IC0-3 changes | |
| 1284 | 1284 | */ |
| 1285 | 1285 | static TMS9901_INT_CALLBACK( tms9901_interrupt_callback ) |
| 1286 | 1286 | { |
| r5932 | r5933 | |
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | /* |
| 1292 | ||
| 1292 | Read pins INT3*-INT7* of Geneve 9901. | |
| 1293 | 1293 | |
| 1294 | signification: | |
| 1295 | (bit 1: INT1 status) | |
| 1296 | (bit 2: INT2 status) | |
| 1297 | bit 3-7: joystick status | |
| 1294 | signification: | |
| 1295 | (bit 1: INT1 status) | |
| 1296 | (bit 2: INT2 status) | |
| 1297 | bit 3-7: joystick status | |
| 1298 | 1298 | */ |
| 1299 | 1299 | static READ8_DEVICE_HANDLER( R9901_0 ) |
| 1300 | 1300 | { |
| r5932 | r5933 | |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | /* |
| 1309 | ||
| 1309 | Read pins INT8*-INT15* of Geneve 9901. | |
| 1310 | 1310 | |
| 1311 | signification: | |
| 1312 | (bit 0: keyboard interrupt) | |
| 1313 | bit 1: unused | |
| 1314 | bit 2: mouse right button | |
| 1315 | (bit 3: clock interrupt) | |
| 1316 | (bit 4: INTB from PE-bus) | |
| 1317 | bit 5 & 7: used as output | |
| 1318 | bit 6: unused | |
| 1311 | signification: | |
| 1312 | (bit 0: keyboard interrupt) | |
| 1313 | bit 1: unused | |
| 1314 | bit 2: mouse right button | |
| 1315 | (bit 3: clock interrupt) | |
| 1316 | (bit 4: INTB from PE-bus) | |
| 1317 | bit 5 & 7: used as output | |
| 1318 | bit 6: unused | |
| 1319 | 1319 | */ |
| 1320 | 1320 | static READ8_DEVICE_HANDLER( R9901_1 ) |
| 1321 | 1321 | { |
| r5932 | r5933 | |
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | /* |
| 1330 | ||
| 1330 | Read pins P0-P7 of Geneve 9901. | |
| 1331 | 1331 | */ |
| 1332 | 1332 | static READ8_DEVICE_HANDLER( R9901_2 ) |
| 1333 | 1333 | { |
| r5932 | r5933 | |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | /* |
| 1338 | Read pins P8-P15 of Geneve 9901. | |
| 1339 | bit 4: mouse right button | |
| 1338 | Read pins P8-P15 of Geneve 9901. | |
| 1339 | bit 4: mouse right button | |
| 1340 | 1340 | */ |
| 1341 | 1341 | static READ8_DEVICE_HANDLER( R9901_3 ) |
| 1342 | 1342 | { |
| r5932 | r5933 | |
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | 1352 | /* |
| 1353 | ||
| 1353 | Write PE bus reset line | |
| 1354 | 1354 | */ |
| 1355 | 1355 | static WRITE8_DEVICE_HANDLER( W9901_PE_bus_reset ) |
| 1356 | 1356 | { |
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | /* |
| 1360 | ||
| 1360 | Write VDP reset line | |
| 1361 | 1361 | */ |
| 1362 | 1362 | static WRITE8_DEVICE_HANDLER( W9901_VDP_reset ) |
| 1363 | 1363 | { |
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | 1366 | /* |
| 1367 | ||
| 1367 | Write joystick select line | |
| 1368 | 1368 | */ |
| 1369 | 1369 | static WRITE8_DEVICE_HANDLER( W9901_JoySel ) |
| 1370 | 1370 | { |
| r5932 | r5933 | |
| 1388 | 1388 | KeyAutoRepeatKey = 0; |
| 1389 | 1389 | } |
| 1390 | 1390 | /*else |
| 1391 | ||
| 1391 | poll_keyboard(space->machine);*/ | |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | 1394 | /* |
| 1395 | ||
| 1395 | Write external mem cycles (0=long, 1=short) | |
| 1396 | 1396 | */ |
| 1397 | 1397 | static WRITE8_DEVICE_HANDLER( W9901_ext_mem_wait_states ) |
| 1398 | 1398 | { |
| 1399 | 1399 | } |
| 1400 | 1400 | |
| 1401 | 1401 | /* |
| 1402 | ||
| 1402 | Write vdp wait cycles (1=add 15 cycles, 0=add none) | |
| 1403 | 1403 | */ |
| 1404 | 1404 | static WRITE8_DEVICE_HANDLER( W9901_VDP_wait_states ) |
| 1405 | 1405 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | beta.h | |
| 4 | 4 | |
| 5 | Implementation of Beta disk drive support for Spectrum and clones | |
| 6 | ||
| 7 | 04/05/2008 Created by Miodrag Milanovic | |
| 5 | Implementation of Beta disk drive support for Spectrum and clones | |
| 8 | 6 | |
| 7 | 04/05/2008 Created by Miodrag Milanovic | |
| 8 | ||
| 9 | 9 | *********************************************************************/ |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "devices/flopdrv.h" |
| r5932 | r5933 | |
| 49 | 49 | void betadisk_enable(const device_config *device) |
| 50 | 50 | { |
| 51 | 51 | beta_disk_state *beta = get_safe_token(device); |
| 52 | ||
| 52 | ||
| 53 | 53 | beta->betadisk_active = 1; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | void betadisk_disable(const device_config *device) |
| 57 | 57 | { |
| 58 | 58 | beta_disk_state *beta = get_safe_token(device); |
| 59 | ||
| 59 | ||
| 60 | 60 | beta->betadisk_active = 0; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | void betadisk_clear_status(const device_config *device) |
| 64 | 64 | { |
| 65 | 65 | beta_disk_state *beta = get_safe_token(device); |
| 66 | ||
| 66 | ||
| 67 | 67 | beta->betadisk_status = 0; |
| 68 | 68 | } |
| 69 | 69 | |
| r5932 | r5933 | |
| 71 | 71 | { |
| 72 | 72 | const device_config *wd_device = devtag_get_device(device->machine, BETA_DISK_TAG); |
| 73 | 73 | beta_disk_state *beta = get_safe_token(wd_device); |
| 74 | if (wd_device->started) { | |
| 74 | if (wd_device->started) { | |
| 75 | 75 | switch (state) |
| 76 | 76 | { |
| 77 | 77 | case WD17XX_DRQ_SET: |
| r5932 | r5933 | |
| 79 | 79 | beta->betadisk_status |= (1<<6); |
| 80 | 80 | } |
| 81 | 81 | break; |
| 82 | ||
| 82 | ||
| 83 | 83 | case WD17XX_DRQ_CLR: |
| 84 | 84 | { |
| 85 | 85 | beta->betadisk_status &=~(1<<6); |
| 86 | 86 | } |
| 87 | 87 | break; |
| 88 | ||
| 88 | ||
| 89 | 89 | case WD17XX_IRQ_SET: |
| 90 | 90 | { |
| 91 | 91 | beta->betadisk_status |= (1<<7); |
| 92 | 92 | } |
| 93 | 93 | break; |
| 94 | ||
| 94 | ||
| 95 | 95 | case WD17XX_IRQ_CLR: |
| 96 | 96 | { |
| 97 | 97 | beta->betadisk_status &=~(1<<7); |
| r5932 | r5933 | |
| 106 | 106 | READ8_DEVICE_HANDLER(betadisk_status_r) |
| 107 | 107 | { |
| 108 | 108 | beta_disk_state *beta = get_safe_token(device); |
| 109 | ||
| 109 | ||
| 110 | 110 | if (beta->betadisk_active==1) { |
| 111 | return wd17xx_status_r(beta->wd179x, offset); | |
| 111 | return wd17xx_status_r(beta->wd179x, offset); | |
| 112 | 112 | } else { |
| 113 | 113 | return 0xff; |
| 114 | 114 | } |
| r5932 | r5933 | |
| 117 | 117 | READ8_DEVICE_HANDLER(betadisk_track_r) |
| 118 | 118 | { |
| 119 | 119 | beta_disk_state *beta = get_safe_token(device); |
| 120 | ||
| 120 | ||
| 121 | 121 | if (beta->betadisk_active==1) { |
| 122 | return wd17xx_track_r(beta->wd179x, offset); | |
| 122 | return wd17xx_track_r(beta->wd179x, offset); | |
| 123 | 123 | } else { |
| 124 | 124 | return 0xff; |
| 125 | 125 | } |
| r5932 | r5933 | |
| 128 | 128 | READ8_DEVICE_HANDLER(betadisk_sector_r) |
| 129 | 129 | { |
| 130 | 130 | beta_disk_state *beta = get_safe_token(device); |
| 131 | ||
| 131 | ||
| 132 | 132 | if (beta->betadisk_active==1) { |
| 133 | return wd17xx_sector_r(beta->wd179x, offset); | |
| 133 | return wd17xx_sector_r(beta->wd179x, offset); | |
| 134 | 134 | } else { |
| 135 | 135 | return 0xff; |
| 136 | 136 | } |
| r5932 | r5933 | |
| 138 | 138 | |
| 139 | 139 | READ8_DEVICE_HANDLER(betadisk_data_r) |
| 140 | 140 | { |
| 141 | ||
| 141 | ||
| 142 | 142 | beta_disk_state *beta = get_safe_token(device); |
| 143 | ||
| 143 | ||
| 144 | 144 | if (beta->betadisk_active==1) { |
| 145 | return wd17xx_data_r(beta->wd179x, offset); | |
| 145 | return wd17xx_data_r(beta->wd179x, offset); | |
| 146 | 146 | } else { |
| 147 | 147 | return 0xff; |
| 148 | 148 | } |
| r5932 | r5933 | |
| 151 | 151 | READ8_DEVICE_HANDLER(betadisk_state_r) |
| 152 | 152 | { |
| 153 | 153 | beta_disk_state *beta = get_safe_token(device); |
| 154 | ||
| 154 | ||
| 155 | 155 | if (beta->betadisk_active==1) { |
| 156 | 156 | return beta->betadisk_status; |
| 157 | 157 | } else { |
| r5932 | r5933 | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | WRITE8_DEVICE_HANDLER(betadisk_param_w) |
| 163 | { | |
| 163 | { | |
| 164 | 164 | beta_disk_state *beta = get_safe_token(device); |
| 165 | ||
| 165 | ||
| 166 | 166 | if (beta->betadisk_active==1) { |
| 167 | wd17xx_set_drive(beta->wd179x, data & 3); | |
| 167 | wd17xx_set_drive(beta->wd179x, data & 3); | |
| 168 | 168 | wd17xx_set_side (beta->wd179x,(data & 0x10) ? 0 : 1 ); |
| 169 | 169 | wd17xx_set_density(beta->wd179x, data & 0x20 ? DEN_MFM_HI : DEN_FM_LO ); |
| 170 | 170 | if ((data & 0x04) == 0) // reset |
| 171 | 171 | { |
| 172 | wd17xx_reset(beta->wd179x); | |
| 173 | } | |
| 172 | wd17xx_reset(beta->wd179x); | |
| 173 | } | |
| 174 | 174 | beta->betadisk_status = (data & 0x3f) | beta->betadisk_status; |
| 175 | 175 | } |
| 176 | } | |
| 176 | } | |
| 177 | 177 | |
| 178 | 178 | WRITE8_DEVICE_HANDLER(betadisk_command_w) |
| 179 | 179 | { |
| 180 | 180 | beta_disk_state *beta = get_safe_token(device); |
| 181 | ||
| 181 | ||
| 182 | 182 | if (beta->betadisk_active==1) { |
| 183 | 183 | wd17xx_command_w(beta->wd179x, offset, data); |
| 184 | } | |
| 184 | } | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | WRITE8_DEVICE_HANDLER(betadisk_track_w) |
| 188 | 188 | { |
| 189 | 189 | beta_disk_state *beta = get_safe_token(device); |
| 190 | ||
| 190 | ||
| 191 | 191 | if (beta->betadisk_active==1) { |
| 192 | 192 | wd17xx_track_w(beta->wd179x, offset, data); |
| 193 | } | |
| 193 | } | |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | WRITE8_DEVICE_HANDLER(betadisk_sector_w) |
| 197 | 197 | { |
| 198 | 198 | beta_disk_state *beta = get_safe_token(device); |
| 199 | ||
| 199 | ||
| 200 | 200 | if (beta->betadisk_active==1) { |
| 201 | 201 | wd17xx_sector_w(beta->wd179x, offset, data); |
| 202 | } | |
| 202 | } | |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | WRITE8_DEVICE_HANDLER(betadisk_data_w) |
| 206 | { | |
| 206 | { | |
| 207 | 207 | beta_disk_state *beta = get_safe_token(device); |
| 208 | ||
| 208 | ||
| 209 | 209 | if (beta->betadisk_active==1) { |
| 210 | 210 | wd17xx_data_w(beta->wd179x, offset, data); |
| 211 | } | |
| 211 | } | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | static const floppy_config beta_floppy_config = |
| r5932 | r5933 | |
| 240 | 240 | ROM_LOAD( "trd503kay.rom", 0x00000, 0x4000, CRC(77baccbb) SHA1(9c5fb89b57643f723246453809dad3f669bf59a3)) |
| 241 | 241 | ROM_LOAD( "trd503xbios.rom",0x00000, 0x4000, CRC(8be427cc) SHA1(78f423fd200e720aa6b857f00969fa1f8c7da20e)) |
| 242 | 242 | ROM_LOAD( "trd503[a4].rom", 0x00000, 0x4000, CRC(c2387608) SHA1(93e0b92a3f38b59cc006d22f9c9299f5377b15e5)) |
| 243 | ||
| 244 | 243 | |
| 244 | ||
| 245 | 245 | ROM_LOAD( "trd504.rom", 0x00000, 0x4000, CRC(ba310874) SHA1(05e55e37df8eee6c68601ba9cf6c92195852ce3f)) |
| 246 | 246 | ROM_LOAD( "trd504s.rom", 0x00000, 0x4000, CRC(c5ca0423) SHA1(cb2da2c4575bc54454e4f97073c5bb37505487fe)) |
| 247 | 247 | ROM_LOAD( "trd504s2.rom", 0x00000, 0x4000, CRC(1e9b59aa) SHA1(d6eb0eeb429c70d1f8f9a23ca4e2feb5f73d3120)) |
| 248 | 248 | ROM_LOAD( "trd504s3.rom", 0x00000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db)) |
| 249 | ||
| 250 | ||
| 249 | ||
| 250 | ||
| 251 | 251 | ROM_LOAD( "trd504tm.rom", 0x00000, 0x4000, CRC(2334b8c6) SHA1(2fd8944e067140324e998b59aab766f16eb5c7fb)) |
| 252 | 252 | ROM_LOAD( "trd504t.rom", 0x00000, 0x4000, CRC(e212d1e0) SHA1(745e9caf576e64a5386ad845256d28593d34cc40)) |
| 253 | 253 | ROM_LOAD( "trd504tb2.rom", 0x00000, 0x4000, CRC(8d943e6b) SHA1(bf6ab329791258f02c5f695b0c7448998b709435)) |
| r5932 | r5933 | |
| 264 | 264 | ROM_LOAD( "trd505h.rom", 0x00000, 0x4000, CRC(9ba15549) SHA1(5908784cdfb782066bde08f186f0bbb6f6b80545)) |
| 265 | 265 | ROM_LOAD( "trd505d.rom", 0x00000, 0x4000, CRC(31e4be08) SHA1(dd08bdea8b5caa35569f49770e380d16bb37502b)) |
| 266 | 266 | ROM_LOAD( "trd505[a2].rom", 0x00000, 0x4000, CRC(a102e726) SHA1(a3f0ef7b7d8b3022f306be8d9e8a51ae699097df)) |
| 267 | ||
| 267 | ||
| 268 | 268 | ROM_LOAD( "trd56661.rom", 0x00000, 0x4000, CRC(8528c789) SHA1(1332a01137bd537fee696ba7adddc0a15b3237c4)) |
| 269 | 269 | ROM_LOAD( "trd5666hte.rom", 0x00000, 0x4000, CRC(03841161) SHA1(4e523768231130947a81247e116fc049bd6da963)) |
| 270 | 270 | ROM_LOAD( "trd5613.rom", 0x00000, 0x4000, CRC(d66cda49) SHA1(dac3c8396fc4f85b5673076cc647afbe439ad17a)) |
| 271 | ||
| 271 | ||
| 272 | 272 | ROM_LOAD( "trd512.rom", 0x00000, 0x4000, CRC(b615d6c4) SHA1(4abb90243f66df19caa84f82d0b880a6ce344eca)) |
| 273 | 273 | ROM_LOAD( "trd512f.rom", 0x00000, 0x4000, CRC(edb74f8c) SHA1(c5b2cd18926dde4a68bcd8c360ba33d6c11b8801)) |
| 274 | 274 | |
| r5932 | r5933 | |
| 288 | 288 | ROM_LOAD( "trd606h.rom", 0x00000, 0x4000, CRC(6b44fdd7) SHA1(4ca7ea2bc0e62c98c9ba86a304aee3cbf88d6b09)) |
| 289 | 289 | |
| 290 | 290 | ROM_LOAD( "trd607m.rom", 0x00000, 0x4000, CRC(5a062f03) SHA1(bbd68481c76e8a3f2f26847faa72c42df013b617)) |
| 291 | ||
| 291 | ||
| 292 | 292 | ROM_LOAD( "trd608.rom", 0x00000, 0x4000, CRC(5c998d53) SHA1(c65a972e75e627336c44ea184cb9ae81dfa2069b)) |
| 293 | 293 | ROM_LOAD( "trd608-2.rom", 0x00000, 0x4000, CRC(3541b280) SHA1(2b93c1887f485639ec15860b5503dc7efb6d31d6)) |
| 294 | 294 | ROM_LOAD( "trd608-3.rom", 0x00000, 0x4000, CRC(d3e91d69) SHA1(5e367d3601d07bd2af1d6255561a5983c0e9fb5d)) |
| 295 | ||
| 295 | ||
| 296 | 296 | ROM_LOAD( "trd609.rom", 0x00000, 0x4000, CRC(91028924) SHA1(fa5433f73aab93c58c891ceee2cdfed0a979dfbb)) |
| 297 | 297 | ROM_LOAD( "trd609e.rom", 0x00000, 0x4000, CRC(46312c8c) SHA1(0ce69fe76e17a875c287e3725f6209f1c59d8bd9)) |
| 298 | ||
| 298 | ||
| 299 | 299 | ROM_LOAD( "trd610e.rom", 0x00000, 0x4000, CRC(95395ca4) SHA1(8cda2efbf2360cd675ea8b04b43cf1746fb41f35)) |
| 300 | ||
| 300 | ||
| 301 | 301 | ROM_LOAD( "trd701.rom", 0x00000, 0x4000, CRC(47f39c0d) SHA1(53d8b8959c321618caaef5aeb270e530e8f8ada3)) |
| 302 | ||
| 302 | ||
| 303 | 303 | //Default for now |
| 304 | ROM_LOAD( "trd503.rom", 0x00000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c)) | |
| 305 | ROM_END | |
| 304 | ROM_LOAD( "trd503.rom", 0x00000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c)) | |
| 305 | ROM_END | |
| 306 | 306 | |
| 307 | 307 | |
| 308 | 308 | /*------------------------------------------------- |
| r5932 | r5933 | |
| 318 | 318 | assert(device->tag != NULL); |
| 319 | 319 | |
| 320 | 320 | /* find our WD179x */ |
| 321 | astring_printf(tempstring, "%s:%s", device->tag, "wd179x"); | |
| 321 | astring_printf(tempstring, "%s:%s", device->tag, "wd179x"); | |
| 322 | 322 | beta->wd179x = devtag_get_device(device->machine, astring_c(tempstring)); |
| 323 | 323 | |
| 324 | astring_free(tempstring); | |
| 324 | astring_free(tempstring); | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /*------------------------------------------------- |
| r5932 | r5933 | |
| 342 | 342 | { |
| 343 | 343 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 344 | 344 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 345 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(beta_disk_state); break; | |
| 345 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(beta_disk_state); break; | |
| 346 | 346 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 347 | 347 | |
| 348 | 348 | /* --- the following bits of info are returned as pointers --- */ |
| r5932 | r5933 | |
| 353 | 353 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(beta_disk); break; |
| 354 | 354 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 355 | 355 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(beta_disk); break; |
| 356 | ||
| 356 | ||
| 357 | 357 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 358 | 358 | case DEVINFO_STR_NAME: strcpy(info->s, "Beta Disk Interface"); break; |
| 359 | 359 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Beta Disk Interface"); break; |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | pc_turbo.c |
| 4 | 4 | |
| 5 | ||
| 5 | The PC "turbo" button | |
| 6 | 6 | |
| 7 | 7 | **********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/i82439tx.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Intel 82439TX PCI Bridge | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ds1315.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Dallas Semiconductor's Phantom Time Chip DS1315. | |
| 6 | 6 | |
| 7 | ||
| 7 | by tim lindner, November 2001. | |
| 8 | 8 | |
| 9 | 9 | *********************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 193 | 193 | static void ds1315_fill_raw_data(const device_config *device) |
| 194 | 194 | { |
| 195 | 195 | /* This routine will (hopefully) call a standard 'C' library routine to get the current |
| 196 | date and time and then fill in the raw data struct. | |
| 197 | */ | |
| 196 | date and time and then fill in the raw data struct. | |
| 197 | */ | |
| 198 | 198 | |
| 199 | 199 | mame_system_time systime; |
| 200 | 200 | ds1315_t *ds1315 = get_token(device); |
| r5932 | r5933 | |
| 231 | 231 | static void ds1315_input_raw_data(const device_config *device) |
| 232 | 232 | { |
| 233 | 233 | /* This routine is called when new date and time has been written to the |
| 234 | clock chip. Currently we ignore setting the date and time in the clock | |
| 235 | chip. | |
| 234 | clock chip. Currently we ignore setting the date and time in the clock | |
| 235 | chip. | |
| 236 | 236 | |
| 237 | We always return the host's time when asked. | |
| 238 | */ | |
| 237 | We always return the host's time when asked. | |
| 238 | */ | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | beta.h | |
| 4 | 4 | |
| 5 | Implementation of Beta disk drive support for Spectrum and clones | |
| 6 | ||
| 7 | 04/05/2008 Created by Miodrag Milanovic | |
| 5 | Implementation of Beta disk drive support for Spectrum and clones | |
| 8 | 6 | |
| 7 | 04/05/2008 Created by Miodrag Milanovic | |
| 8 | ||
| 9 | 9 | *********************************************************************/ |
| 10 | 10 | #ifndef BETA_H |
| 11 | 11 | #define BETA_H |
| r5932 | r5933 | |
| 28 | 28 | |
| 29 | 29 | #define MDRV_BETA_DISK_REMOVE(_tag) \ |
| 30 | 30 | MDRV_DEVICE_REMOVE(_tag) |
| 31 | ||
| 31 | ||
| 32 | 32 | READ8_DEVICE_HANDLER(betadisk_status_r); |
| 33 | 33 | READ8_DEVICE_HANDLER(betadisk_track_r); |
| 34 | 34 | READ8_DEVICE_HANDLER(betadisk_sector_r); |
| r5932 | r5933 | |
| 43 | 43 | |
| 44 | 44 | /* device interface */ |
| 45 | 45 | DEVICE_GET_INFO( beta_disk ); |
| 46 | ||
| 46 | ||
| 47 | 47 | #endif /* BETA_H */ |
| r5932 | r5933 | |
|---|---|---|
| 34 | 34 | Transmit and receive clocks are connected to the same clock */ |
| 35 | 35 | |
| 36 | 36 | /* if rs232 is disabled, receive clock is linked to cassette hardware */ |
| 37 | // if (exidy_fe & 0x80) | |
| 38 | // { | |
| 37 | // if (exidy_fe & 0x80) | |
| 38 | // { | |
| 39 | 39 | connect to rs232 |
| 40 | // | |
| 40 | // } | |
| 41 | 41 | //} |
| 42 | 42 | #endif |
| 43 | 43 | |
| r5932 | r5933 | |
| 77 | 77 | case 0x00: /* Cassette 300 baud */ |
| 78 | 78 | |
| 79 | 79 | /* loading a tape - this is basically the same as the super80. |
| 80 | ||
| 80 | We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */ | |
| 81 | 81 | |
| 82 | 82 | cass_data.input.length++; |
| 83 | 83 | |
| r5932 | r5933 | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies. |
| 95 | ||
| 95 | Synchronisation of the frequency pulses to the uart is extremely important. */ | |
| 96 | 96 | |
| 97 | 97 | cass_data.output.length++; |
| 98 | 98 | if (!(cass_data.output.length & 0x1f)) |
| r5932 | r5933 | |
| 243 | 243 | if (data & 0x80) |
| 244 | 244 | { |
| 245 | 245 | /* connect to serial device (not yet emulated) */ |
| 246 | // | |
| 246 | // timer_adjust_periodic(serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate)); | |
| 247 | 247 | } |
| 248 | 248 | else |
| 249 | 249 | { |
| 250 | 250 | /* connect to tape */ |
| 251 | // | |
| 251 | // hd6402_connect(&cassette_serial_connection); | |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | } |
| r5932 | r5933 | |
| 326 | 326 | READ8_HANDLER(exidy_ff_r) |
| 327 | 327 | { |
| 328 | 328 | /* The use of the parallel port as a general purpose port is not emulated. |
| 329 | Currently the only use is to read the printer status in the Centronics CENDRV bios routine. | |
| 330 | This uses bit 7. The other bits have been set high (=nothing plugged in). | |
| 331 | This fixes those games that use a joystick. */ | |
| 329 | Currently the only use is to read the printer status in the Centronics CENDRV bios routine. | |
| 330 | This uses bit 7. The other bits have been set high (=nothing plugged in). | |
| 331 | This fixes those games that use a joystick. */ | |
| 332 | 332 | |
| 333 | 333 | const device_config *printer = devtag_get_device(space->machine, "centronics"); |
| 334 | 334 | UINT8 data=0x7f; |
| 335 | 335 | |
| 336 | 336 | /* bit 7 = printer busy |
| 337 | ||
| 337 | 0 = printer is not busy */ | |
| 338 | 338 | |
| 339 | 339 | data |= centronics_busy_r(printer) << 7; |
| 340 | 340 | |
| r5932 | r5933 | |
| 353 | 353 | return; /* can't run a program if the cartridge isn't in */ |
| 354 | 354 | |
| 355 | 355 | /* Since Exidy Basic is by Microsoft, it needs some preprocessing before it can be run. |
| 356 | 1. A start address of 01D5 indicates a basic program which needs its pointers fixed up. | |
| 357 | 2. If autorunning, jump to C689 (command processor), else jump to C3DD (READY prompt). | |
| 358 | Important addresses: | |
| 359 | 01D5 = start (load) address of a conventional basic program | |
| 360 | C858 = an autorun basic program will have this exec address on the tape | |
| 361 | C3DD = part of basic that displays READY and lets user enter input */ | |
| 356 | 1. A start address of 01D5 indicates a basic program which needs its pointers fixed up. | |
| 357 | 2. If autorunning, jump to C689 (command processor), else jump to C3DD (READY prompt). | |
| 358 | Important addresses: | |
| 359 | 01D5 = start (load) address of a conventional basic program | |
| 360 | C858 = an autorun basic program will have this exec address on the tape | |
| 361 | C3DD = part of basic that displays READY and lets user enter input */ | |
| 362 | 362 | |
| 363 | 363 | if ((start_address == 0x1d5) || (execute_address == 0xc858)) |
| 364 | 364 | { |
| 365 | 365 | UINT8 i, data[]={ |
| 366 | 0xcd, 0x26, 0xc4, // CALL C426 ;set up other pointers | |
| 367 | 0x21, 0xd4, 1, // LD HL,01D4 ;start of program address (used by C689) | |
| 368 | 0x36, 0, // LD (HL),00 ;make sure dummy end-of-line is there | |
| 369 | 0xc3, 0x89, 0xc6,}; // JP C689 ;run program | |
| 366 | 0xcd, 0x26, 0xc4, // CALL C426 ;set up other pointers | |
| 367 | 0x21, 0xd4, 1, // LD HL,01D4 ;start of program address (used by C689) | |
| 368 | 0x36, 0, // LD (HL),00 ;make sure dummy end-of-line is there | |
| 369 | 0xc3, 0x89, 0xc6,}; // JP C689 ;run program | |
| 370 | 370 | |
| 371 | 371 | for (i = 0; i < ARRAY_LENGTH(data); i++) |
| 372 | 372 | memory_write_byte(space, 0xf01f + i, data[i]); |
| r5932 | r5933 | |
| 392 | 392 | |
| 393 | 393 | MACHINE_START( exidy ) |
| 394 | 394 | { |
| 395 | // | |
| 395 | // serial_timer = timer_alloc(machine, exidy_serial_timer_callback, NULL); | |
| 396 | 396 | cassette_timer = timer_alloc(machine, exidy_cassette_tc, NULL); |
| 397 | 397 | } |
| 398 | 398 |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | pc_turbo.h |
| 4 | 4 | |
| 5 | ||
| 5 | The PC "turbo" button | |
| 6 | 6 | |
| 7 | 7 | **********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/i82439tx.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Intel 82439TX PCI Bridge | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/pc8801.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Implementation of the PC8801 | |
| 6 | 6 | |
| 7 | On the PC8801, there are two CPUs. The main CPU and the FDC CPU. Two | |
| 8 | 8255 PPIs are used for cross CPU communication. These ports are connected | |
| 9 | as below: | |
| 7 | On the PC8801, there are two CPUs. The main CPU and the FDC CPU. Two | |
| 8 | 8255 PPIs are used for cross CPU communication. These ports are connected | |
| 9 | as below: | |
| 10 | 10 | |
| 11 | Main CPU 8255 port A <--> FDC CPU 8255 port B | |
| 12 | Main CPU 8255 port B <--> FDC CPU 8255 port A | |
| 13 | Main CPU 8255 port C (bits 7-4) <--> FDC CPU 8255 port C (bits 0-3) | |
| 14 | Main CPU 8255 port C (bits 0-3) <--> FDC CPU 8255 port C (bits 7-4) | |
| 11 | Main CPU 8255 port A <--> FDC CPU 8255 port B | |
| 12 | Main CPU 8255 port B <--> FDC CPU 8255 port A | |
| 13 | Main CPU 8255 port C (bits 7-4) <--> FDC CPU 8255 port C (bits 0-3) | |
| 14 | Main CPU 8255 port C (bits 0-3) <--> FDC CPU 8255 port C (bits 7-4) | |
| 15 | 15 | |
| 16 | 16 | ***************************************************************************/ |
| 17 | 17 | |
| r5932 | r5933 | |
| 227 | 227 | |
| 228 | 228 | READ8_HANDLER(pc88sr_inport_30) |
| 229 | 229 | /* DIP-SW1 |
| 230 | bit 0: BASIC selection (0 = N-BASIC, 1 = N88-BASIC) | |
| 231 | bit 1: terminal mode (0 = terminal mode, 1 = BASIC mode) | |
| 232 | bit 2: startup text width (0 = 80chars/line, 1 = 40chars/line) | |
| 233 | bit 3: startup text height (0 = 25lines/screen, 1 = 20lines/screen) | |
| 234 | bit 4: S parameter (0 = enable, 1 = disable) | |
| 235 | bit 5: operation when recevied DEL code (0 = handle DEL code, | |
| 236 | 1 = ignore DEL code) | |
| 237 | bit 6: universal input port 1 (currently always 1) | |
| 238 | bit 7: universal input port 2 (currently always 1) | |
| 230 | bit 0: BASIC selection (0 = N-BASIC, 1 = N88-BASIC) | |
| 231 | bit 1: terminal mode (0 = terminal mode, 1 = BASIC mode) | |
| 232 | bit 2: startup text width (0 = 80chars/line, 1 = 40chars/line) | |
| 233 | bit 3: startup text height (0 = 25lines/screen, 1 = 20lines/screen) | |
| 234 | bit 4: S parameter (0 = enable, 1 = disable) | |
| 235 | bit 5: operation when recevied DEL code (0 = handle DEL code, | |
| 236 | 1 = ignore DEL code) | |
| 237 | bit 6: universal input port 1 (currently always 1) | |
| 238 | bit 7: universal input port 2 (currently always 1) | |
| 239 | 239 | */ |
| 240 | 240 | { |
| 241 | 241 | int r; |
| r5932 | r5933 | |
| 255 | 255 | |
| 256 | 256 | READ8_HANDLER(pc88sr_inport_31) |
| 257 | 257 | /* DIP-SW2 |
| 258 | bit 0: serial parity (0 = enable, 1 = disable) | |
| 259 | bit 1: parity type (0 = even parity, 1 = odd parity) | |
| 260 | bit 2: serial bit length (0 = 8bits/char, 1 = 7bits/char) | |
| 261 | bit 3: stop bit length (0 = 2bits, 1 = 1bits) | |
| 262 | bit 4: X parameter (0 = enable, 1 = disable) | |
| 263 | bit 5: duplex mode (0 = half, 1 = full-duplex) | |
| 264 | bit 6: speed switch (0 = normal speed, 1 = high speed) | |
| 265 | bit 7: N88-BASIC version (0 = V2.x, 1 = V1.x) | |
| 258 | bit 0: serial parity (0 = enable, 1 = disable) | |
| 259 | bit 1: parity type (0 = even parity, 1 = odd parity) | |
| 260 | bit 2: serial bit length (0 = 8bits/char, 1 = 7bits/char) | |
| 261 | bit 3: stop bit length (0 = 2bits, 1 = 1bits) | |
| 262 | bit 4: X parameter (0 = enable, 1 = disable) | |
| 263 | bit 5: duplex mode (0 = half, 1 = full-duplex) | |
| 264 | bit 6: speed switch (0 = normal speed, 1 = high speed) | |
| 265 | bit 7: N88-BASIC version (0 = V2.x, 1 = V1.x) | |
| 266 | 266 | */ |
| 267 | 267 | { |
| 268 | 268 | int r; |
| r5932 | r5933 | |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | /* NPW 11-Feb-2006 - This is a brutal no-good hack to work around bug #759 |
| 747 | * | |
| 748 | * The problem is that in MESS 0.96, a regression was introduced that | |
| 749 | * prevented the PC8801 from booting up. The source of this regression | |
| 750 | * was the 8255 PPI rewrite. | |
| 751 | * | |
| 752 | * What seems to happen is CPU #0 does a write to 8255 #0 port C at PC=37CF | |
| 753 | * and this causes a communication to be made to CPU #1. Under the | |
| 754 | * previous 8255 code, this write would not actually make it to the the | |
| 755 | * slave CPU, CPU #1. After examining the data sheet, all indications are | |
| 756 | * that the new 8255 behavior is indeed correct. | |
| 757 | * | |
| 758 | * So what I'm doing is an ugly hack so that when the slave CPU #1 sees the | |
| 759 | * value written to it, I actually change this to the previous value, | |
| 760 | * cloaking the communication. So the PC8801 now boots up, but hopefully | |
| 761 | * a correct fix can be made. | |
| 762 | */ | |
| 747 | * | |
| 748 | * The problem is that in MESS 0.96, a regression was introduced that | |
| 749 | * prevented the PC8801 from booting up. The source of this regression | |
| 750 | * was the 8255 PPI rewrite. | |
| 751 | * | |
| 752 | * What seems to happen is CPU #0 does a write to 8255 #0 port C at PC=37CF | |
| 753 | * and this causes a communication to be made to CPU #1. Under the | |
| 754 | * previous 8255 code, this write would not actually make it to the the | |
| 755 | * slave CPU, CPU #1. After examining the data sheet, all indications are | |
| 756 | * that the new 8255 behavior is indeed correct. | |
| 757 | * | |
| 758 | * So what I'm doing is an ugly hack so that when the slave CPU #1 sees the | |
| 759 | * value written to it, I actually change this to the previous value, | |
| 760 | * cloaking the communication. So the PC8801 now boots up, but hopefully | |
| 761 | * a correct fix can be made. | |
| 762 | */ | |
| 763 | 763 | if ((chip == 1) && (result == 0xF8)) |
| 764 | 764 | result = 0xF0; |
| 765 | 765 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ds1315.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Dallas Semiconductor's Phantom Time Chip DS1315. | |
| 6 | 6 | |
| 7 | ||
| 7 | by tim lindner, November 2001. | |
| 8 | 8 | |
| 9 | 9 | *********************************************************************/ |
| 10 | 10 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | atom.c | |
| 4 | 4 | |
| 5 | Functions to emulate general aspects of the machine (RAM, ROM, | |
| 6 | interrupts, I/O ports) | |
| 5 | Functions to emulate general aspects of the machine (RAM, ROM, | |
| 6 | interrupts, I/O ports) | |
| 7 | 7 | |
| 8 | Many thanks to Kees van Oss for: | |
| 9 | 1. Tape input/output circuit diagram. It describes in great detail how the 2.4 kHz | |
| 10 | tone, 2.4 kHz tone enable, tape output and tape input are connected. | |
| 11 | 2. The DOS rom for the Atom so I could complete the floppy disc emulation. | |
| 12 | 3. Details of the eprom expansion board for the Atom. | |
| 13 | 4. His demo programs which I used to test the driver. | |
| 8 | Many thanks to Kees van Oss for: | |
| 9 | 1. Tape input/output circuit diagram. It describes in great detail how the 2.4 kHz | |
| 10 | tone, 2.4 kHz tone enable, tape output and tape input are connected. | |
| 11 | 2. The DOS rom for the Atom so I could complete the floppy disc emulation. | |
| 12 | 3. Details of the eprom expansion board for the Atom. | |
| 13 | 4. His demo programs which I used to test the driver. | |
| 14 | 14 | |
| 15 | 15 | ***********************************************************************/ |
| 16 | 16 | |
| r5932 | r5933 | |
| 95 | 95 | { |
| 96 | 96 | /* I'm assuming that the nmi is edge triggered */ |
| 97 | 97 | /* a interrupt from the fdc will cause a change in line state, and |
| 98 | the nmi will be triggered, but when the state changes because the int | |
| 99 | is cleared this will not cause another nmi */ | |
| 98 | the nmi will be triggered, but when the state changes because the int | |
| 99 | is cleared this will not cause another nmi */ | |
| 100 | 100 | /* I'll emulate it like this to be sure */ |
| 101 | 101 | |
| 102 | 102 | if (state!=previous_i8271_int_state) |
| r5932 | r5933 | |
| 104 | 104 | if (state) |
| 105 | 105 | { |
| 106 | 106 | /* I'll pulse it because if I used hold-line I'm not sure |
| 107 | ||
| 107 | it would clear - to be checked */ | |
| 108 | 108 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 109 | 109 | } |
| 110 | 110 | } |
| r5932 | r5933 | |
| 154 | 154 | timer_state^=1; |
| 155 | 155 | |
| 156 | 156 | /* the 2.4 kHz signal is notted (A), and nand'ed with the 2.4kz enable, resulting |
| 157 | ||
| 157 | in B. The final cassette output is the result of tape output nand'ed with B */ | |
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | { |
| r5932 | r5933 | |
| 185 | 185 | |
| 186 | 186 | /* this is temporary */ |
| 187 | 187 | /* Kees van Oss mentions that address 8-b are used for the random number |
| 188 | generator. I don't know if this is hardware, or random data because the | |
| 189 | ram chips are not cleared at start-up. So at this time, these numbers | |
| 190 | are poked into the memory to simulate it. When I have more details I will fix it */ | |
| 188 | generator. I don't know if this is hardware, or random data because the | |
| 189 | ram chips are not cleared at start-up. So at this time, these numbers | |
| 190 | are poked into the memory to simulate it. When I have more details I will fix it */ | |
| 191 | 191 | memory_region(machine, "maincpu")[0x08] = mame_rand(machine) & 0x0ff; |
| 192 | 192 | memory_region(machine, "maincpu")[0x09] = mame_rand(machine) & 0x0ff; |
| 193 | 193 | memory_region(machine, "maincpu")[0x0a] = mame_rand(machine) & 0x0ff; |
| r5932 | r5933 | |
| 282 | 282 | |
| 283 | 283 | row = atom_8255_porta & 0x0f; |
| 284 | 284 | /* logerror("8255: Read port b: %02X %02X\n", input_port_read(machine, port), |
| 285 | ||
| 285 | input_port_read(machine, "KEY10") & 0xc0); */ | |
| 286 | 286 | return ((input_port_read(device->machine, keynames[row]) & 0x3f) | (input_port_read(device->machine, "KEY10") & 0xc0)); |
| 287 | 287 | } |
| 288 | 288 | |
| r5932 | r5933 | |
| 312 | 312 | |
| 313 | 313 | /* Atom 6847 modes: |
| 314 | 314 | |
| 315 | 0000xxxx Text | |
| 316 | 0001xxxx 64x64 4 | |
| 317 | 0011xxxx 128x64 2 | |
| 318 | 0101xxxx 128x64 4 | |
| 319 | 0111xxxx 128x96 2 | |
| 320 | 1001xxxx 128x96 4 | |
| 321 | 1011xxxx 128x192 2 | |
| 322 | 1101xxxx 128x192 4 | |
| 323 | 1111xxxx 256x192 2 | |
| 315 | 0000xxxx Text | |
| 316 | 0001xxxx 64x64 4 | |
| 317 | 0011xxxx 128x64 2 | |
| 318 | 0101xxxx 128x64 4 | |
| 319 | 0111xxxx 128x96 2 | |
| 320 | 1001xxxx 128x96 4 | |
| 321 | 1011xxxx 128x192 2 | |
| 322 | 1101xxxx 128x192 4 | |
| 323 | 1111xxxx 256x192 2 | |
| 324 | 324 | |
| 325 | 325 | */ |
| 326 | 326 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | 6551.h | |
| 4 | 4 | |
| 5 | ||
| 5 | MOS Technology 6551 Asynchronous Communications Interface Adapter | |
| 6 | 6 | |
| 7 | A1 A0 Write Read | |
| 8 | 0 0 Transmit Data Register Receiver Data Register | |
| 9 | 0 1 Programmed Reset Status Register | |
| 10 | 1 0 Command Register | |
| 11 | 1 1 Control Register | |
| 7 | A1 A0 Write Read | |
| 8 | 0 0 Transmit Data Register Receiver Data Register | |
| 9 | 0 1 Programmed Reset Status Register | |
| 10 | 1 0 Command Register | |
| 11 | 1 1 Control Register | |
| 12 | 12 | |
| 13 | 13 | *********************************************************************/ |
| 14 | 14 | |
| r5932 | r5933 | |
| 75 | 75 | |
| 76 | 76 | /*------------------------------------------------- |
| 77 | 77 | acia_6551_in_callback - called when other side |
| 78 | ||
| 78 | has updated state | |
| 79 | 79 | -------------------------------------------------*/ |
| 80 | 80 | |
| 81 | 81 | static void acia_6551_in_callback(running_machine *machine, int id, unsigned long state) |
| r5932 | r5933 | |
| 128 | 128 | /* if transmit is not empty... transmit data */ |
| 129 | 129 | if ((acia->transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0) |
| 130 | 130 | { |
| 131 | // | |
| 131 | // logerror("UART6551\n"); | |
| 132 | 132 | transmit_register_send_bit(machine, &acia->transmit_reg, &acia->connection); |
| 133 | 133 | } |
| 134 | 134 | } |
| r5932 | r5933 | |
| 248 | 248 | break; |
| 249 | 249 | |
| 250 | 250 | /* |
| 251 | Status cleared by | |
| 252 | b0 Parity error * (1: error) self clearing ** | |
| 253 | b1 Framing error * (1: error) self clearing ** | |
| 254 | b2 Overrun * (1: error) self clearing ** | |
| 255 | b3 Receive Data Register Full (1: full) Read Receive Data Register | |
| 256 | b4 Transmit Data Reg Empty (1: empty) Write Transmit Data Register | |
| 257 | b5 DCD (0: DCD low, 1: DCD high) Not resettable, reflects DCD state | |
| 258 | b6 DSR (0: DSR low, 1: DCD high) Not resettable, reflects DSR state | |
| 259 | b7 IRQ (0: no int., 1: interrupt) Read Status Register | |
| 251 | Status cleared by | |
| 252 | b0 Parity error * (1: error) self clearing ** | |
| 253 | b1 Framing error * (1: error) self clearing ** | |
| 254 | b2 Overrun * (1: error) self clearing ** | |
| 255 | b3 Receive Data Register Full (1: full) Read Receive Data Register | |
| 256 | b4 Transmit Data Reg Empty (1: empty) Write Transmit Data Register | |
| 257 | b5 DCD (0: DCD low, 1: DCD high) Not resettable, reflects DCD state | |
| 258 | b6 DSR (0: DSR low, 1: DCD high) Not resettable, reflects DSR state | |
| 259 | b7 IRQ (0: no int., 1: interrupt) Read Status Register | |
| 260 | 260 | */ |
| 261 | 261 | case 1: |
| 262 | 262 | { |
| r5932 | r5933 | |
| 340 | 340 | |
| 341 | 341 | |
| 342 | 342 | /* |
| 343 | ||
| 343 | Command Register: | |
| 344 | 344 | |
| 345 | b0 Data Terminal Ready | |
| 346 | 0 : disable receiver and all interrupts (DTR high) | |
| 347 | 1 : enable receiver and all interrupts (DTR low) | |
| 348 | b1 Receiver Interrupt Enable | |
| 349 | 0 : IRQ interrupt enabled from bit 3 of status register | |
| 350 | 1 : IRQ interrupt disabled | |
| 351 | b3,b2 Transmitter Control | |
| 352 | Transmit Interrupt RTS level Transmitter | |
| 353 | 00 disabled high off | |
| 354 | 01 enabled low on | |
| 355 | 10 disabled low on | |
| 356 | 11 disabled low Transmit BRK | |
| 357 | b4 Normal/Echo Mode for Receiver | |
| 358 | 0 : normal | |
| 359 | 1 : echo (bits 2 and 3 must be 0) | |
| 360 | b5 Parity Enable | |
| 361 | 0 : parity disabled, no parity bit generated or received | |
| 362 | 1 : parity enabled | |
| 363 | b7,b6 Parity | |
| 364 | 00 : odd parity receiver and transmitter | |
| 365 | 01 : even parity receiver and transmitter | |
| 366 | 10 : mark parity bit transmitted, parity check disabled | |
| 367 | 11 : space parity bit transmitted, parity check disabled | |
| 368 | */ | |
| 345 | b0 Data Terminal Ready | |
| 346 | 0 : disable receiver and all interrupts (DTR high) | |
| 347 | 1 : enable receiver and all interrupts (DTR low) | |
| 348 | b1 Receiver Interrupt Enable | |
| 349 | 0 : IRQ interrupt enabled from bit 3 of status register | |
| 350 | 1 : IRQ interrupt disabled | |
| 351 | b3,b2 Transmitter Control | |
| 352 | Transmit Interrupt RTS level Transmitter | |
| 353 | 00 disabled high off | |
| 354 | 01 enabled low on | |
| 355 | 10 disabled low on | |
| 356 | 11 disabled low Transmit BRK | |
| 357 | b4 Normal/Echo Mode for Receiver | |
| 358 | 0 : normal | |
| 359 | 1 : echo (bits 2 and 3 must be 0) | |
| 360 | b5 Parity Enable | |
| 361 | 0 : parity disabled, no parity bit generated or received | |
| 362 | 1 : parity enabled | |
| 363 | b7,b6 Parity | |
| 364 | 00 : odd parity receiver and transmitter | |
| 365 | 01 : even parity receiver and transmitter | |
| 366 | 10 : mark parity bit transmitted, parity check disabled | |
| 367 | 11 : space parity bit transmitted, parity check disabled | |
| 368 | */ | |
| 369 | 369 | |
| 370 | 370 | case 2: |
| 371 | 371 | { |
| r5932 | r5933 | |
| 403 | 403 | break; |
| 404 | 404 | |
| 405 | 405 | /* |
| 406 | ||
| 406 | Control register: | |
| 407 | 407 | |
| 408 | b3-b0 baud rate generator: | |
| 409 | 0000 : 16x external clock | |
| 410 | 0001 : 50 baud | |
| 411 | 0010 : 75 25 | |
| 412 | 0011 : 110 35 | |
| 413 | 0100 : 134.5 | |
| 414 | 0101 : 150 | |
| 415 | 0110 : 300 150 | |
| 416 | 0111 : 600 300 | |
| 417 | 1000 : 1200 600 | |
| 418 | 1001 : 1800 600 | |
| 419 | 1010 : 2400 600 | |
| 420 | 1011 : 3600 1200 | |
| 421 | 1100 : 4800 1200 | |
| 422 | 1101 : 7200 2400 | |
| 423 | 1110 : 9600 2400 | |
| 424 | 1111 : 19,200 9600 | |
| 425 | b4 receiver clock source | |
| 426 | 0 : external receiver clock | |
| 427 | 1 : baud rate generator | |
| 428 | b6,b5 word length | |
| 429 | 00 : 8 bits | |
| 430 | 01 : 7 | |
| 431 | 10 : 6 | |
| 432 | 11 : 5 | |
| 433 | b7 stop bits | |
| 434 | 0 : 1 stop bit | |
| 435 | 1 : 2 stop bits | |
| 436 | (1 stop bit if parity and word length = 8) | |
| 437 | (1 1/2 stop bits if word length = 5 and no parity) | |
| 438 | */ | |
| 408 | b3-b0 baud rate generator: | |
| 409 | 0000 : 16x external clock | |
| 410 | 0001 : 50 baud | |
| 411 | 0010 : 75 25 | |
| 412 | 0011 : 110 35 | |
| 413 | 0100 : 134.5 | |
| 414 | 0101 : 150 | |
| 415 | 0110 : 300 150 | |
| 416 | 0111 : 600 300 | |
| 417 | 1000 : 1200 600 | |
| 418 | 1001 : 1800 600 | |
| 419 | 1010 : 2400 600 | |
| 420 | 1011 : 3600 1200 | |
| 421 | 1100 : 4800 1200 | |
| 422 | 1101 : 7200 2400 | |
| 423 | 1110 : 9600 2400 | |
| 424 | 1111 : 19,200 9600 | |
| 425 | b4 receiver clock source | |
| 426 | 0 : external receiver clock | |
| 427 | 1 : baud rate generator | |
| 428 | b6,b5 word length | |
| 429 | 00 : 8 bits | |
| 430 | 01 : 7 | |
| 431 | 10 : 6 | |
| 432 | 11 : 5 | |
| 433 | b7 stop bits | |
| 434 | 0 : 1 stop bit | |
| 435 | 1 : 2 stop bits | |
| 436 | (1 stop bit if parity and word length = 8) | |
| 437 | (1 1/2 stop bits if word length = 5 and no parity) | |
| 438 | */ | |
| 439 | 439 | case 3: |
| 440 | 440 | { |
| 441 | 441 | unsigned char previous_control_register; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | ay31015.c by Robbbert, May 2008 | |
| 4 | 4 | |
| 5 | Code for the AY-3-1014A, AY-3-1015(D), AY-5-1013(A), and AY-6-1013 UARTs | |
| 6 | The HD6402 UART is compatible with the AY-3-1015 UART. | |
| 5 | Code for the AY-3-1014A, AY-3-1015(D), AY-5-1013(A), and AY-6-1013 UARTs | |
| 6 | The HD6402 UART is compatible with the AY-3-1015 UART. | |
| 7 | 7 | |
| 8 | ||
| 8 | This is cycle-accurate according to the specifications. | |
| 9 | 9 | |
| 10 | It supports independent receive and transmit clocks, | |
| 11 | and transmission and reception can occur simultaneously if desired. | |
| 10 | It supports independent receive and transmit clocks, | |
| 11 | and transmission and reception can occur simultaneously if desired. | |
| 12 | 12 | |
| 13 | ||
| 13 | Note to any MESSDEVs who might happen to stray here: | |
| 14 | 14 | |
| 15 | - If you find bugs, please fix them yourself. | |
| 16 | - If you want to convert it to a DEVICE, please do so. | |
| 17 | - If you want to add support for multiple instances, please do so. | |
| 15 | - If you find bugs, please fix them yourself. | |
| 16 | - If you want to convert it to a DEVICE, please do so. | |
| 17 | - If you want to add support for multiple instances, please do so. | |
| 18 | 18 | |
| 19 | 19 | ***************************************************************************** |
| 20 | 20 | |
| r5932 | r5933 | |
| 29 | 29 | ****************************************************************************** |
| 30 | 30 | |
| 31 | 31 | It is not clear in the documentation as to which settings will reset the device. |
| 32 | ||
| 32 | To be safe, we will always reset whenever the control register changes. | |
| 33 | 33 | |
| 34 | Also, it not clear exactly what happens under various error conditions. | |
| 35 | What we do is: | |
| 36 | 1. During receive the stop bit processing is cut short, so we can better | |
| 37 | synchronise the next byte. | |
| 38 | 2. If a framing error occurs, we do not signal DAV, but instead skip | |
| 39 | the bad byte and start looking for the next. | |
| 34 | Also, it not clear exactly what happens under various error conditions. | |
| 35 | What we do is: | |
| 36 | 1. During receive the stop bit processing is cut short, so we can better | |
| 37 | synchronise the next byte. | |
| 38 | 2. If a framing error occurs, we do not signal DAV, but instead skip | |
| 39 | the bad byte and start looking for the next. | |
| 40 | 40 | |
| 41 | This device has only been tested successfully at 300 baud, with 8 bits, | |
| 42 | 2 stop bits and no parity. | |
| 41 | This device has only been tested successfully at 300 baud, with 8 bits, | |
| 42 | 2 stop bits and no parity. | |
| 43 | 43 | |
| 44 | The bit order of the status and control registers is set up to suit the | |
| 45 | Exidy driver. If you wish to use it for some other driver, use the BITSWAP8 | |
| 46 | macro in your driver. | |
| 44 | The bit order of the status and control registers is set up to suit the | |
| 45 | Exidy driver. If you wish to use it for some other driver, use the BITSWAP8 | |
| 46 | macro in your driver. | |
| 47 | 47 | |
| 48 | 48 | ******************************************************************************** |
| 49 | 49 | |
| r5932 | r5933 | |
| 326 | 326 | { |
| 327 | 327 | ay31015->status_reg |= STATUS_FE; // framing error - the stop bit not high |
| 328 | 328 | ay31015->rx_state = PREP_TIME; // lost sync - start over |
| 329 | // | |
| 329 | // return; | |
| 330 | 330 | } |
| 331 | 331 | else |
| 332 | 332 | ay31015->status_reg &= ~STATUS_FE; |
| r5932 | r5933 | |
| 357 | 357 | if (ay31015->second_stop_bit) |
| 358 | 358 | { |
| 359 | 359 | /* We should wait for the full first stop bit and |
| 360 | ||
| 360 | the beginning of the second stop bit */ | |
| 361 | 361 | ay31015->rx_state = SECOND_STOP_BIT; |
| 362 | 362 | ay31015->rx_pulses += ay31015->second_stop_bit - 7; |
| 363 | 363 | } |
| r5932 | r5933 | |
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | return; |
| 371 | ||
| 371 | ||
| 372 | 372 | case SECOND_STOP_BIT: |
| 373 | 373 | ay31015->rx_pulses--; |
| 374 | 374 | if (!ay31015->rx_pulses) |
| r5932 | r5933 | |
| 442 | 442 | |
| 443 | 443 | ay31015->tx_data >>= 1; // adjust the shift register |
| 444 | 444 | } |
| 445 | ||
| 445 | ||
| 446 | 446 | ay31015->tx_pulses--; |
| 447 | 447 | if (!ay31015->tx_pulses) // all data bits sent |
| 448 | 448 | { |
| r5932 | r5933 | |
| 737 | 737 | |
| 738 | 738 | /*------------------------------------------------- |
| 739 | 739 | DEVICE_GET_INFO(ay31015) - device getinfo |
| 740 | ||
| 740 | function | |
| 741 | 741 | -------------------------------------------------*/ |
| 742 | 742 | |
| 743 | 743 | DEVICE_GET_INFO( ay31015 ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | TI-99 P-Code Card emulation. | |
| 3 | Michael Zapf, July 2009 | |
| 4 | ||
| 5 | The P-Code card is part of the UCSD p-System support for the TI-99 | |
| 6 | computer family. This system is a comprehensive development system for | |
| 7 | creating, running, and debugging programs written in UCSD Pascal. | |
| 8 | ||
| 9 | The complete system consists of | |
| 10 | - P-Code card, plugged into the Peripheral Expansion Box (PEB) | |
| 11 | - Software on disk: | |
| 12 | + PHD5063: UCSD p-System Compiler | |
| 13 | + PHD5064: UCSD p-System Assembler/Linker | |
| 14 | + PHD5065: UCSD p-System Editor/Filer (2 disks) | |
| 15 | ||
| 16 | The card has a switch on the circuit board extending outside the PEB | |
| 17 | which allows to turn off the card without removing it. Unlike other | |
| 18 | expansion cards for the TI system, the P-Code card immediately takes | |
| 19 | over control after the system is turned on. | |
| 20 | ||
| 21 | When the p-System is booted, the screen turns cyan and remains empty. | |
| 22 | There are two beeps, a pause for about 15 seconds, another three beeps, | |
| 23 | and then a welcome text is displayed with a one-line menu at the screen | |
| 24 | top. (Delay times seem unrealistically short; the manual says | |
| 25 | 30-60 seconds. To be checked.) | |
| 26 | Many of the functions require one of the disks be inserted in one | |
| 27 | of the disk drives. You can leave the p-System by waiting for the menu | |
| 28 | to appear, and typing H (halt). This returns you to the Master Title | |
| 29 | Screen, and the card is inactive until the system is reset. | |
| 2 | TI-99 P-Code Card emulation. | |
| 3 | Michael Zapf, July 2009 | |
| 30 | 4 | |
| 31 | The P-Code card contains the P-Code interpreter which is somewhat | |
| 32 | comparable to today's Java virtual machine. Programs written for the | |
| 33 | p-System are interchangeable between different platforms. | |
| 34 | ||
| 35 | On the P-Code card we find 12 KiB of ROM, visible in the DSR memory area | |
| 36 | (>4000 to >5FFF). The first 4 KiB (>4000->4FFF) are from the 4732 ROM, | |
| 37 | the second and third 4 KiB (>5000->5FFF) are from a 4764 ROM, switched | |
| 38 | by setting the CRU bit 4 to 1 on the CRU base >1F00. | |
| 39 | ||
| 40 | CRU base >1F00 | |
| 41 | Bit 0: Activate card | |
| 42 | Bit 4: Select bank 2 of the 4764 ROM (0 = bank 1) | |
| 43 | Bit 7: May be connected to an indicator LED which is by default | |
| 44 | wired to bit 0 (on the PCB) | |
| 45 | ||
| 46 | The lines are used in a slightly uncommon way: the three bits of the | |
| 47 | CRU bit address are A8, A13, and A14 (A15=LSB). Hence, bit 4 is at | |
| 48 | address >1F80, and bit 7 is at address >1F86. These bits are purely | |
| 49 | write-only. | |
| 50 | ||
| 51 | Moreover, the card contains 48 KiB of GROM memory, occupying the address | |
| 52 | space from G>0000 to G>FFFF in portions of 6KiB at every 8KiB boundary. | |
| 53 | ||
| 54 | Another specialty of the card is that the GROM contents are accessed via | |
| 55 | another GROM base address than what is used in the console: | |
| 56 | - >5BFC = read GROM data | |
| 57 | - >5BFE = read GROM address | |
| 58 | - >5FFC = write GROM data | |
| 59 | - >5FFE = write GROM address | |
| 60 | ||
| 61 | This makes the GROM memory "private" to the card; together with the | |
| 62 | rest of the ROM space the ports become invisible when the card is | |
| 63 | deactivated. | |
| 64 | ||
| 65 | Emulation information: | |
| 66 | ||
| 67 | The P-Code card switch is mapped to a DIP switch in the configuration | |
| 68 | menu. If the switch is turned on, the system assumes that ROM dumps are | |
| 69 | present called "pcode_r0.bin" (4 KiB), "pcode_r1.bin" (8KiB), | |
| 70 | "pcode_g0.bin" (64 KiB). The switch is turned off by default. Check the | |
| 71 | switch position if the Master Title Screen does not appear as expected. | |
| 5 | The P-Code card is part of the UCSD p-System support for the TI-99 | |
| 6 | computer family. This system is a comprehensive development system for | |
| 7 | creating, running, and debugging programs written in UCSD Pascal. | |
| 8 | ||
| 9 | The complete system consists of | |
| 10 | - P-Code card, plugged into the Peripheral Expansion Box (PEB) | |
| 11 | - Software on disk: | |
| 12 | + PHD5063: UCSD p-System Compiler | |
| 13 | + PHD5064: UCSD p-System Assembler/Linker | |
| 14 | + PHD5065: UCSD p-System Editor/Filer (2 disks) | |
| 15 | ||
| 16 | The card has a switch on the circuit board extending outside the PEB | |
| 17 | which allows to turn off the card without removing it. Unlike other | |
| 18 | expansion cards for the TI system, the P-Code card immediately takes | |
| 19 | over control after the system is turned on. | |
| 20 | ||
| 21 | When the p-System is booted, the screen turns cyan and remains empty. | |
| 22 | There are two beeps, a pause for about 15 seconds, another three beeps, | |
| 23 | and then a welcome text is displayed with a one-line menu at the screen | |
| 24 | top. (Delay times seem unrealistically short; the manual says | |
| 25 | 30-60 seconds. To be checked.) | |
| 26 | Many of the functions require one of the disks be inserted in one | |
| 27 | of the disk drives. You can leave the p-System by waiting for the menu | |
| 28 | to appear, and typing H (halt). This returns you to the Master Title | |
| 29 | Screen, and the card is inactive until the system is reset. | |
| 30 | ||
| 31 | The P-Code card contains the P-Code interpreter which is somewhat | |
| 32 | comparable to today's Java virtual machine. Programs written for the | |
| 33 | p-System are interchangeable between different platforms. | |
| 34 | ||
| 35 | On the P-Code card we find 12 KiB of ROM, visible in the DSR memory area | |
| 36 | (>4000 to >5FFF). The first 4 KiB (>4000->4FFF) are from the 4732 ROM, | |
| 37 | the second and third 4 KiB (>5000->5FFF) are from a 4764 ROM, switched | |
| 38 | by setting the CRU bit 4 to 1 on the CRU base >1F00. | |
| 39 | ||
| 40 | CRU base >1F00 | |
| 41 | Bit 0: Activate card | |
| 42 | Bit 4: Select bank 2 of the 4764 ROM (0 = bank 1) | |
| 43 | Bit 7: May be connected to an indicator LED which is by default | |
| 44 | wired to bit 0 (on the PCB) | |
| 45 | ||
| 46 | The lines are used in a slightly uncommon way: the three bits of the | |
| 47 | CRU bit address are A8, A13, and A14 (A15=LSB). Hence, bit 4 is at | |
| 48 | address >1F80, and bit 7 is at address >1F86. These bits are purely | |
| 49 | write-only. | |
| 50 | ||
| 51 | Moreover, the card contains 48 KiB of GROM memory, occupying the address | |
| 52 | space from G>0000 to G>FFFF in portions of 6KiB at every 8KiB boundary. | |
| 53 | ||
| 54 | Another specialty of the card is that the GROM contents are accessed via | |
| 55 | another GROM base address than what is used in the console: | |
| 56 | - >5BFC = read GROM data | |
| 57 | - >5BFE = read GROM address | |
| 58 | - >5FFC = write GROM data | |
| 59 | - >5FFE = write GROM address | |
| 60 | ||
| 61 | This makes the GROM memory "private" to the card; together with the | |
| 62 | rest of the ROM space the ports become invisible when the card is | |
| 63 | deactivated. | |
| 64 | ||
| 65 | Emulation information: | |
| 66 | ||
| 67 | The P-Code card switch is mapped to a DIP switch in the configuration | |
| 68 | menu. If the switch is turned on, the system assumes that ROM dumps are | |
| 69 | present called "pcode_r0.bin" (4 KiB), "pcode_r1.bin" (8KiB), | |
| 70 | "pcode_g0.bin" (64 KiB). The switch is turned off by default. Check the | |
| 71 | switch position if the Master Title Screen does not appear as expected. | |
| 72 | 72 | */ |
| 73 | 73 | #include "driver.h" |
| 74 | 74 | #include "99_peb.h" |
| 75 | 75 | #include "devices/ti99cart.h" |
| 76 | #include "ti99_4x.h" | |
| 76 | #include "ti99_4x.h" | |
| 77 | 77 | |
| 78 | 78 | static const int GROM_base = 0x1bfc; |
| 79 | 79 | static int bank_select; // 0 or 1 |
| 80 | /* | |
| 81 | Pointer to the pcode ROM data. We have three sections of the ROM | |
| 82 | code: 4K from one chip, 2 banks with 4K each from the second chip. | |
| 80 | /* | |
| 81 | Pointer to the pcode ROM data. We have three sections of the ROM | |
| 82 | code: 4K from one chip, 2 banks with 4K each from the second chip. | |
| 83 | 83 | */ |
| 84 | 84 | UINT8 *ti99_pcode_rom0; |
| 85 | 85 | UINT8 *ti99_pcode_rom1; |
| r5932 | r5933 | |
| 115 | 115 | static UINT8 GROM_dataread(void) |
| 116 | 116 | { |
| 117 | 117 | UINT8 reply; |
| 118 | /* GROMs are buffered. Data is retrieved from a buffer, | |
| 119 | while the buffer is replaced with the next cell | |
| 120 | content. */ | |
| 118 | /* GROMs are buffered. Data is retrieved from a buffer, | |
| 119 | while the buffer is replaced with the next cell | |
| 120 | content. */ | |
| 121 | 121 | reply = pcode_GROMs.buf; |
| 122 | ||
| 122 | ||
| 123 | 123 | /* Get next value, put it in buffer. Note that the |
| 124 | ||
| 124 | GROM wraps at 8K boundaries. */ | |
| 125 | 125 | pcode_GROMs.buf = pcode_GROMs.data_ptr[pcode_GROMs.addr]; |
| 126 | 126 | |
| 127 | /* The program counter wraps at each GROM chip size (8K), | |
| 128 | so 0x5fff + 1 = 0x4000. */ | |
| 127 | /* The program counter wraps at each GROM chip size (8K), | |
| 128 | so 0x5fff + 1 = 0x4000. */ | |
| 129 | 129 | pcode_GROMs.addr = ((pcode_GROMs.addr + 1) & 0x1FFF) | (pcode_GROMs.addr & 0xE000); |
| 130 | ||
| 130 | ||
| 131 | 131 | /* Reset the read and write address flipflops. */ |
| 132 | 132 | pcode_GROMs.raddr_LSB = pcode_GROMs.waddr_LSB = FALSE; |
| 133 | 133 | |
| r5932 | r5933 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /* |
| 138 | GROM read for P-Code card | |
| 139 | For comments, see the handler for TI-99/4A | |
| 138 | GROM read for P-Code card | |
| 139 | For comments, see the handler for TI-99/4A | |
| 140 | 140 | */ |
| 141 | 141 | static READ8_HANDLER ( ti99_pcode_grom_r ) |
| 142 | 142 | { |
| 143 | 143 | UINT8 reply; |
| 144 | 144 | |
| 145 | 145 | cpu_adjust_icount(space->machine->firstcpu,-4); |
| 146 | ||
| 146 | ||
| 147 | 147 | if (offset & 2) |
| 148 | { | |
| 148 | { | |
| 149 | 149 | pcode_GROMs.waddr_LSB = FALSE; |
| 150 | 150 | |
| 151 | 151 | if (pcode_GROMs.raddr_LSB) |
| r5932 | r5933 | |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | else |
| 163 | reply = GROM_dataread(); | |
| 163 | reply = GROM_dataread(); | |
| 164 | 164 | |
| 165 | 165 | return reply; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /* |
| 169 | GROM write for P-Code card. | |
| 170 | For comments, see the handler for TI-99/4A | |
| 169 | GROM write for P-Code card. | |
| 170 | For comments, see the handler for TI-99/4A | |
| 171 | 171 | */ |
| 172 | 172 | static WRITE8_HANDLER ( ti99_pcode_grom_w ) |
| 173 | 173 | { |
| r5932 | r5933 | |
| 179 | 179 | if (pcode_GROMs.waddr_LSB) |
| 180 | 180 | { |
| 181 | 181 | pcode_GROMs.addr = (pcode_GROMs.addr & 0xFF00) | (data & 0xFF); |
| 182 | ||
| 182 | ||
| 183 | 183 | GROM_dataread(); |
| 184 | 184 | pcode_GROMs.waddr_LSB = FALSE; |
| 185 | 185 | } |
| r5932 | r5933 | |
| 208 | 208 | bank_select = 0; |
| 209 | 209 | pcode_GROMs.addr = 0; |
| 210 | 210 | pcode_GROMs.data_ptr = ti99_pcode_grom; |
| 211 | ||
| 211 | ||
| 212 | 212 | ti99_peb_set_card_handlers(0x1f00, &pcode_handlers); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /* |
| 216 | The CRU write handler. The CRU is a serial interface in the console. | |
| 217 | Using the CRU we can switch the banks in the p-code card | |
| 218 | Bit 0 = activate card | |
| 219 | Bit 4 = select second bank of high ROM. | |
| 220 | Note that the CRU address is created from address lines A8, A13, and A14 | |
| 221 | so bit 0 is at 0x1f00, but bit 4 is at 0x1f80 (bit 7 would be 0x1f86 | |
| 222 | but it is not used) | |
| 216 | The CRU write handler. The CRU is a serial interface in the console. | |
| 217 | Using the CRU we can switch the banks in the p-code card | |
| 218 | Bit 0 = activate card | |
| 219 | Bit 4 = select second bank of high ROM. | |
| 220 | Note that the CRU address is created from address lines A8, A13, and A14 | |
| 221 | so bit 0 is at 0x1f00, but bit 4 is at 0x1f80 (bit 7 would be 0x1f86 | |
| 222 | but it is not used) | |
| 223 | 223 | */ |
| 224 | 224 | static void pcode_cru_w(running_machine *machine, int offset, int data) |
| 225 | 225 | { |
| r5932 | r5933 | |
| 227 | 227 | by 2. */ |
| 228 | 228 | if (offset == 0) |
| 229 | 229 | { |
| 230 | // | |
| 230 | // printf("pcode card state = %d\n", data); | |
| 231 | 231 | } |
| 232 | 232 | if (offset == 0x40) // Bit 4 is on A8 |
| 233 | 233 | { |
| 234 | if (data==0) | |
| 234 | if (data==0) | |
| 235 | 235 | bank_select = 0; |
| 236 | 236 | else |
| 237 | 237 | bank_select = 1; |
| 238 | // | |
| 238 | // printf("pcode bank select = %d\n", data); | |
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /* |
| 243 | The CRU read handler. The p-code card does not provide a CRU read | |
| 244 | functionality, so we assume that it only returns 0. | |
| 243 | The CRU read handler. The p-code card does not provide a CRU read | |
| 244 | functionality, so we assume that it only returns 0. | |
| 245 | 245 | */ |
| 246 | 246 | static int pcode_cru_r(running_machine *machine, int offset) |
| 247 | 247 | { |
| r5932 | r5933 | |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /* |
| 252 | ||
| 252 | Read a byte in pcode DSR space | |
| 253 | 253 | */ |
| 254 | 254 | static READ8_HANDLER( pcode_mem_r ) |
| 255 | 255 | { |
| r5932 | r5933 | |
| 265 | 265 | switch (offset) |
| 266 | 266 | { |
| 267 | 267 | /* GROMs only answer at even addresses. The odd addresses are |
| 268 | ||
| 268 | undefined, so we can as well just ignore these cases. */ | |
| 269 | 269 | case 0x1bfc: |
| 270 | 270 | case 0x1bfe: |
| 271 | 271 | reply = ti99_pcode_grom_r(space, offset); |
| r5932 | r5933 | |
| 277 | 277 | break; |
| 278 | 278 | default: |
| 279 | 279 | /* Accesses ROM 4764 (2*4K) |
| 280 | We have two banks here which are activated according | |
| 281 | to the setting of CRU bit 4 | |
| 282 | */ | |
| 280 | We have two banks here which are activated according | |
| 281 | to the setting of CRU bit 4 | |
| 282 | */ | |
| 283 | 283 | reply = (bank_select==0)? ti99_pcode_rom1[offset-0x1000] : ti99_pcode_rom2[offset-0x1000]; |
| 284 | 284 | } |
| 285 | 285 | } |
| r5932 | r5933 | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /* |
| 290 | Write a byte in P-Code ROM space. This is only useful for setting the | |
| 291 | GROM address. | |
| 290 | Write a byte in P-Code ROM space. This is only useful for setting the | |
| 291 | GROM address. | |
| 292 | 292 | */ |
| 293 | 293 | static WRITE8_HANDLER( pcode_mem_w ) |
| 294 | 294 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | 6551.h | |
| 4 | 4 | |
| 5 | ||
| 5 | MOS Technology 6551 Asynchronous Communications Interface Adapter | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* ay31015.h |
| 2 | 2 | |
| 3 | ||
| 3 | Written for MESS by Robbbert on May 29th, 2008. | |
| 4 | 4 | |
| 5 | 5 | */ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | TI-99 P-Code Card emulation. | |
| 3 | Michael Zapf, July 2009 | |
| 2 | TI-99 P-Code Card emulation. | |
| 3 | Michael Zapf, July 2009 | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | void ti99_pcode_reset(running_machine *machine); |
| r5932 | r5933 | |
|---|---|---|
| 84 | 84 | if (outa & 0x01) |
| 85 | 85 | { |
| 86 | 86 | data |= input_port_read(device->machine, "KEY7"); |
| 87 | ||
| 87 | ||
| 88 | 88 | /* At Power Up we fake a 'C-CE' pressure */ |
| 89 | 89 | if (power) |
| 90 | 90 | data |= 0x02; |
| r5932 | r5933 | |
| 116 | 116 | { |
| 117 | 117 | int data = outb; |
| 118 | 118 | |
| 119 | if (input_port_read(machine, "KEY13")) | |
| 119 | if (input_port_read(machine, "KEY13")) | |
| 120 | 120 | data |= 1; |
| 121 | 121 | |
| 122 | 122 | return data; |
| r5932 | r5933 | |
|---|---|---|
| 36 | 36 | break; |
| 37 | 37 | case WD17XX_IRQ_SET: |
| 38 | 38 | break; |
| 39 | case WD17XX_DRQ_CLR: | |
| 39 | case WD17XX_DRQ_CLR: | |
| 40 | 40 | break; |
| 41 | 41 | case WD17XX_DRQ_SET: |
| 42 | 42 | dma8257_drq_w(dma8257, 0, 1); |
| r5932 | r5933 | |
| 49 | 49 | MACHINE_START(partner) |
| 50 | 50 | { |
| 51 | 51 | const device_config *fdc = devtag_get_device(machine, "wd1793"); |
| 52 | wd17xx_set_density (fdc,DEN_MFM_HI); | |
| 52 | wd17xx_set_density (fdc,DEN_MFM_HI); | |
| 53 | 53 | wd17xx_set_pause_time(fdc,10); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | static void partner_window_1(running_machine *machine, UINT8 bank, UINT16 offset,UINT8 *rom) | |
| 56 | static void partner_window_1(running_machine *machine, UINT8 bank, UINT16 offset,UINT8 *rom) | |
| 57 | 57 | { |
| 58 | 58 | switch(partner_win_mem_page) { |
| 59 | 59 | case 2 : // FDD BIOS |
| r5932 | r5933 | |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | static void partner_window_2(running_machine *machine, UINT8 bank, UINT16 offset,UINT8 *rom) | |
| 71 | static void partner_window_2(running_machine *machine, UINT8 bank, UINT16 offset,UINT8 *rom) | |
| 72 | 72 | { |
| 73 | 73 | switch(partner_win_mem_page) { |
| 74 | 74 | case 4 : // MCPG FONT |
| r5932 | r5933 | |
| 82 | 82 | |
| 83 | 83 | static READ8_HANDLER ( partner_floppy_r ) { |
| 84 | 84 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 85 | ||
| 85 | ||
| 86 | 86 | if (offset<0x100) { |
| 87 | 87 | switch(offset & 3) { |
| 88 | case 0x00 : return wd17xx_status_r(fdc,0); | |
| 88 | case 0x00 : return wd17xx_status_r(fdc,0); | |
| 89 | 89 | case 0x01 : return wd17xx_track_r(fdc,0); |
| 90 | 90 | case 0x02 : return wd17xx_sector_r(fdc,0); |
| 91 | 91 | default : |
| r5932 | r5933 | |
| 93 | 93 | } |
| 94 | 94 | } else { |
| 95 | 95 | return 0; |
| 96 | } | |
| 96 | } | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | static WRITE8_HANDLER ( partner_floppy_w ) { |
| 100 | 100 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 101 | ||
| 101 | ||
| 102 | 102 | if (offset<0x100) { |
| 103 | 103 | switch(offset & 3) { |
| 104 | 104 | case 0x00 : wd17xx_command_w(fdc,0,data); break; |
| r5932 | r5933 | |
| 112 | 112 | } |
| 113 | 113 | if (((data >> 3) & 1)==1) { |
| 114 | 114 | wd17xx_set_drive(fdc,1); |
| 115 | } | |
| 116 | wd17xx_set_side(fdc,data >> 7); | |
| 115 | } | |
| 116 | wd17xx_set_side(fdc,data >> 7); | |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| r5932 | r5933 | |
| 126 | 126 | memory_install_write8_handler(space, 0xdc00, 0xddff, 0, 0, partner_floppy_w); |
| 127 | 127 | memory_install_read8_handler (space, 0xdc00, 0xddff, 0, 0, partner_floppy_r); |
| 128 | 128 | break; |
| 129 | case 4 : | |
| 129 | case 4 : | |
| 130 | 130 | // Timer |
| 131 | 131 | break; |
| 132 | 132 | default : // BIOS |
| r5932 | r5933 | |
| 138 | 138 | { |
| 139 | 139 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 140 | 140 | UINT8 *rom = memory_region(machine, "maincpu"); |
| 141 | ||
| 141 | ||
| 142 | 142 | memory_install_write8_handler(space, 0x0000, 0x07ff, 0, 0, SMH_BANK(1)); |
| 143 | 143 | memory_install_write8_handler(space, 0x0800, 0x3fff, 0, 0, SMH_BANK(2)); |
| 144 | 144 | memory_install_write8_handler(space, 0x4000, 0x5fff, 0, 0, SMH_BANK(3)); |
| r5932 | r5933 | |
| 196 | 196 | // BANK 5 (0x8000 - 0x9fff) |
| 197 | 197 | switch (partner_mem_page) { |
| 198 | 198 | case 5: |
| 199 | case 10: | |
| 199 | case 10: | |
| 200 | 200 | //window 2 |
| 201 | 201 | memory_install_write8_handler(space, 0x8000, 0x9fff, 0, 0, SMH_UNMAP); |
| 202 | 202 | partner_window_2(machine, 5, 0, rom); |
| 203 | 203 | break; |
| 204 | 204 | case 8: |
| 205 | case 9: | |
| 205 | case 9: | |
| 206 | 206 | //window 1 |
| 207 | 207 | memory_install_write8_handler(space, 0x8000, 0x9fff, 0, 0, SMH_UNMAP); |
| 208 | 208 | partner_window_1(machine, 5, 0, rom); |
| 209 | 209 | break; |
| 210 | case 7: | |
| 210 | case 7: | |
| 211 | 211 | memory_set_bankptr(machine, 5, mess_ram + 0x0000); |
| 212 | 212 | break; |
| 213 | default: | |
| 213 | default: | |
| 214 | 214 | memory_set_bankptr(machine, 5, mess_ram + 0x8000); |
| 215 | 215 | break; |
| 216 | 216 | } |
| 217 | ||
| 217 | ||
| 218 | 218 | // BANK 6 (0xa000 - 0xb7ff) |
| 219 | 219 | switch (partner_mem_page) { |
| 220 | 220 | case 5: |
| 221 | case 10: | |
| 221 | case 10: | |
| 222 | 222 | //window 2 |
| 223 | 223 | memory_install_write8_handler(space, 0xa000, 0xb7ff, 0, 0, SMH_UNMAP); |
| 224 | 224 | partner_window_2(machine, 6, 0, rom); |
| 225 | 225 | break; |
| 226 | 226 | case 6: |
| 227 | case 8: | |
| 227 | case 8: | |
| 228 | 228 | //BASIC |
| 229 | 229 | memory_install_write8_handler(space, 0xa000, 0xb7ff, 0, 0, SMH_UNMAP); |
| 230 | memory_set_bankptr(machine, 6, rom + 0x12000); // BASIC | |
| 230 | memory_set_bankptr(machine, 6, rom + 0x12000); // BASIC | |
| 231 | 231 | break; |
| 232 | case 7: | |
| 232 | case 7: | |
| 233 | 233 | memory_set_bankptr(machine, 6, mess_ram + 0x2000); |
| 234 | 234 | break; |
| 235 | default: | |
| 235 | default: | |
| 236 | 236 | memory_set_bankptr(machine, 6, mess_ram + 0xa000); |
| 237 | 237 | break; |
| 238 | } | |
| 238 | } | |
| 239 | 239 | |
| 240 | 240 | // BANK 7 (0xb800 - 0xbfff) |
| 241 | 241 | switch (partner_mem_page) { |
| 242 | 242 | case 4: |
| 243 | 243 | case 5: |
| 244 | case 10: | |
| 244 | case 10: | |
| 245 | 245 | //window 2 |
| 246 | 246 | memory_install_write8_handler(space, 0xb800, 0xbfff, 0, 0, SMH_UNMAP); |
| 247 | 247 | partner_window_2(machine, 7, 0x1800, rom); |
| 248 | 248 | break; |
| 249 | 249 | case 6: |
| 250 | case 8: | |
| 250 | case 8: | |
| 251 | 251 | //BASIC |
| 252 | 252 | memory_install_write8_handler(space, 0xb800, 0xbfff, 0, 0, SMH_UNMAP); |
| 253 | memory_set_bankptr(machine, 7, rom + 0x13800); // BASIC | |
| 253 | memory_set_bankptr(machine, 7, rom + 0x13800); // BASIC | |
| 254 | 254 | break; |
| 255 | case 7: | |
| 255 | case 7: | |
| 256 | 256 | memory_set_bankptr(machine, 7, mess_ram + 0x3800); |
| 257 | 257 | break; |
| 258 | default: | |
| 258 | default: | |
| 259 | 259 | memory_set_bankptr(machine, 7, mess_ram + 0xb800); |
| 260 | 260 | break; |
| 261 | } | |
| 262 | ||
| 261 | } | |
| 262 | ||
| 263 | 263 | // BANK 8 (0xc000 - 0xc7ff) |
| 264 | 264 | switch (partner_mem_page) { |
| 265 | 265 | case 7: |
| r5932 | r5933 | |
| 272 | 272 | break; |
| 273 | 273 | default: |
| 274 | 274 | memory_set_bankptr(machine, 8, mess_ram + 0xc000); |
| 275 | break; | |
| 275 | break; | |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // BANK 9 (0xc800 - 0xcfff) |
| r5932 | r5933 | |
| 292 | 292 | break; |
| 293 | 293 | default: |
| 294 | 294 | memory_set_bankptr(machine, 9, mess_ram + 0xc800); |
| 295 | break; | |
| 295 | break; | |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // BANK 10 (0xd000 - 0xd7ff) |
| r5932 | r5933 | |
| 308 | 308 | break; |
| 309 | 309 | default: |
| 310 | 310 | memory_set_bankptr(machine, 10, mess_ram + 0xd000); |
| 311 | break; | |
| 311 | break; | |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // BANK 11 (0xdc00 - 0xddff) |
| 315 | 315 | partner_iomap_bank(machine,rom); |
| 316 | ||
| 316 | ||
| 317 | 317 | // BANK 12 (0xe000 - 0xe7ff) |
| 318 | 318 | if (partner_mem_page==1) { |
| 319 | 319 | memory_set_bankptr(machine, 12, rom + 0x10000); |
| r5932 | r5933 | |
| 321 | 321 | //window 1 |
| 322 | 322 | partner_window_1(machine, 12, 0, rom); |
| 323 | 323 | } |
| 324 | ||
| 324 | ||
| 325 | 325 | // BANK 13 (0xe800 - 0xffff) |
| 326 | 326 | switch (partner_mem_page) { |
| 327 | 327 | case 3: |
| r5932 | r5933 | |
| 330 | 330 | // window 1 |
| 331 | 331 | partner_window_1(machine, 13, 0x800, rom); |
| 332 | 332 | break; |
| 333 | default: | |
| 334 | // BIOS | |
| 333 | default: | |
| 334 | // BIOS | |
| 335 | 335 | memory_set_bankptr(machine, 13, rom + 0x10800); |
| 336 | 336 | break; |
| 337 | } | |
| 337 | } | |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | WRITE8_HANDLER ( partner_win_memory_page_w ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | PC-style floppy disk controller emulation | |
| 4 | 4 | |
| 5 | TODO: | |
| 6 | - check how the drive select from DOR register, and the drive select | |
| 7 | from the fdc are related !!!! | |
| 8 | - if all drives do not have a disk in them, and the fdc is reset, is a int generated? | |
| 9 | (if yes, indicates drives are ready without discs, if no indicates no drives are ready) | |
| 10 | - status register a, status register b | |
| 5 | TODO: | |
| 6 | - check how the drive select from DOR register, and the drive select | |
| 7 | from the fdc are related !!!! | |
| 8 | - if all drives do not have a disk in them, and the fdc is reset, is a int generated? | |
| 9 | (if yes, indicates drives are ready without discs, if no indicates no drives are ready) | |
| 10 | - status register a, status register b | |
| 11 | 11 | |
| 12 | 12 | **********************************************************************/ |
| 13 | 13 | |
| r5932 | r5933 | |
| 237 | 237 | |
| 238 | 238 | |
| 239 | 239 | |
| 240 | /* | |
| 240 | /* FDC Digitial Output Register (DOR) | |
| 241 | 241 | |
| 242 | |7|6|5|4|3|2|1|0| | |
| 243 | | | | | | | `------ floppy drive select (0=A, 1=B, 2=floppy C, ...) | |
| 244 | | | | | | `-------- 1 = FDC enable, 0 = hold FDC at reset | |
| 245 | | | | | `---------- 1 = DMA & I/O interface enabled | |
| 246 | | | | `------------ 1 = turn floppy drive A motor on | |
| 247 | | | `-------------- 1 = turn floppy drive B motor on | |
| 248 | | `---------------- 1 = turn floppy drive C motor on | |
| 249 | `------------------ 1 = turn floppy drive D motor on | |
| 242 | |7|6|5|4|3|2|1|0| | |
| 243 | | | | | | | `------ floppy drive select (0=A, 1=B, 2=floppy C, ...) | |
| 244 | | | | | | `-------- 1 = FDC enable, 0 = hold FDC at reset | |
| 245 | | | | | `---------- 1 = DMA & I/O interface enabled | |
| 246 | | | | `------------ 1 = turn floppy drive A motor on | |
| 247 | | | `-------------- 1 = turn floppy drive B motor on | |
| 248 | | `---------------- 1 = turn floppy drive C motor on | |
| 249 | `------------------ 1 = turn floppy drive D motor on | |
| 250 | 250 | */ |
| 251 | 251 | |
| 252 | 252 | static void pc_fdc_dor_w(running_machine *machine, UINT8 data) |
| r5932 | r5933 | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /* changing the DMA enable bit, will affect the terminal count state |
| 283 | from reaching the fdc - if dma is enabled this will send it through | |
| 284 | otherwise it will be ignored */ | |
| 283 | from reaching the fdc - if dma is enabled this will send it through | |
| 284 | otherwise it will be ignored */ | |
| 285 | 285 | pc_fdc_set_tc_state(machine, fdc->tc_state); |
| 286 | 286 | |
| 287 | 287 | /* changing the DMA enable bit, will affect the dma drq state |
| 288 | from reaching us - if dma is enabled this will send it through | |
| 289 | otherwise it will be ignored */ | |
| 288 | from reaching us - if dma is enabled this will send it through | |
| 289 | otherwise it will be ignored */ | |
| 290 | 290 | pc_fdc_hw_dma_drq(pc_get_device(machine), fdc->dma_state, fdc->dma_read); |
| 291 | 291 | |
| 292 | 292 | /* changing the DMA enable bit, will affect the irq state |
| 293 | from reaching us - if dma is enabled this will send it through | |
| 294 | otherwise it will be ignored */ | |
| 293 | from reaching us - if dma is enabled this will send it through | |
| 294 | otherwise it will be ignored */ | |
| 295 | 295 | pc_fdc_hw_interrupt(pc_get_device(machine), fdc->int_state); |
| 296 | 296 | |
| 297 | 297 | /* reset? */ |
| r5932 | r5933 | |
| 300 | 300 | /* yes */ |
| 301 | 301 | |
| 302 | 302 | /* pc-xt expects a interrupt to be generated |
| 303 | when the fdc is reset. | |
| 304 | In the FDC docs, it states that a INT will | |
| 305 | be generated if READY input is true when the | |
| 306 | fdc is reset. | |
| 303 | when the fdc is reset. | |
| 304 | In the FDC docs, it states that a INT will | |
| 305 | be generated if READY input is true when the | |
| 306 | fdc is reset. | |
| 307 | 307 | |
| 308 | It also states, that outputs to drive are set to 0. | |
| 309 | Maybe this causes the drive motor to go on, and therefore | |
| 310 | the ready line is set. | |
| 308 | It also states, that outputs to drive are set to 0. | |
| 309 | Maybe this causes the drive motor to go on, and therefore | |
| 310 | the ready line is set. | |
| 311 | 311 | |
| 312 | ||
| 312 | This in return causes a int?? --- | |
| 313 | 313 | |
| 314 | 314 | |
| 315 | what is not yet clear is if this is a result of the drives ready state | |
| 316 | changing... | |
| 317 | */ | |
| 315 | what is not yet clear is if this is a result of the drives ready state | |
| 316 | changing... | |
| 317 | */ | |
| 318 | 318 | nec765_ready_w(pc_get_device(machine),1); |
| 319 | 319 | |
| 320 | 320 | /* set FDC at reset */ |
| r5932 | r5933 | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | |
| 333 | /* | |
| 333 | /* PCJr FDC Digitial Output Register (DOR) | |
| 334 | 334 | |
| 335 | On a PC Jr the DOR is wired up a bit differently: | |
| 336 | |7|6|5|4|3|2|1|0| | |
| 337 | | | | | | | | `--- Drive enable ( 0 = off, 1 = on ) | |
| 338 | | | | | | | `----- Reserved | |
| 339 | | | | | | `------- Reserved | |
| 340 | | | | | `--------- Reserved | |
| 341 | | | | `----------- Reserved | |
| 342 | | | `------------- Watchdog Timer Enable ( 0 = watchdog disabled, 1 = watchdog enabled ) | |
| 343 | | `--------------- Watchdog Timer Trigger ( on a 1->0 transition to strobe the trigger ) | |
| 344 | `----------------- FDC Reset ( 0 = hold reset, 1 = release reset ) | |
| 335 | On a PC Jr the DOR is wired up a bit differently: | |
| 336 | |7|6|5|4|3|2|1|0| | |
| 337 | | | | | | | | `--- Drive enable ( 0 = off, 1 = on ) | |
| 338 | | | | | | | `----- Reserved | |
| 339 | | | | | | `------- Reserved | |
| 340 | | | | | `--------- Reserved | |
| 341 | | | | `----------- Reserved | |
| 342 | | | `------------- Watchdog Timer Enable ( 0 = watchdog disabled, 1 = watchdog enabled ) | |
| 343 | | `--------------- Watchdog Timer Trigger ( on a 1->0 transition to strobe the trigger ) | |
| 344 | `----------------- FDC Reset ( 0 = hold reset, 1 = release reset ) | |
| 345 | 345 | */ |
| 346 | 346 | |
| 347 | 347 | static TIMER_CALLBACK( watchdog_timeout ) |
| r5932 | r5933 | |
| 396 | 396 | /* yes */ |
| 397 | 397 | |
| 398 | 398 | /* pc-xt expects a interrupt to be generated |
| 399 | when the fdc is reset. | |
| 400 | In the FDC docs, it states that a INT will | |
| 401 | be generated if READY input is true when the | |
| 402 | fdc is reset. | |
| 399 | when the fdc is reset. | |
| 400 | In the FDC docs, it states that a INT will | |
| 401 | be generated if READY input is true when the | |
| 402 | fdc is reset. | |
| 403 | 403 | |
| 404 | It also states, that outputs to drive are set to 0. | |
| 405 | Maybe this causes the drive motor to go on, and therefore | |
| 406 | the ready line is set. | |
| 404 | It also states, that outputs to drive are set to 0. | |
| 405 | Maybe this causes the drive motor to go on, and therefore | |
| 406 | the ready line is set. | |
| 407 | 407 | |
| 408 | ||
| 408 | This in return causes a int?? --- | |
| 409 | 409 | |
| 410 | 410 | |
| 411 | what is not yet clear is if this is a result of the drives ready state | |
| 412 | changing... | |
| 413 | */ | |
| 411 | what is not yet clear is if this is a result of the drives ready state | |
| 412 | changing... | |
| 413 | */ | |
| 414 | 414 | nec765_ready_w(pc_get_device(machine),1); |
| 415 | 415 | |
| 416 | 416 | /* set FDC at reset */ |
| r5932 | r5933 | |
| 491 | 491 | break; |
| 492 | 492 | case 7: |
| 493 | 493 | /* Configuration Control Register |
| 494 | * | |
| 495 | * Currently unimplemented; bits 1-0 are supposed to control data | |
| 496 | * flow rates: | |
| 497 | * 0 0 500 kbps | |
| 498 | * 0 1 300 kbps | |
| 499 | * 1 0 250 kbps | |
| 500 | * 1 1 1000 kbps | |
| 501 | */ | |
| 494 | * | |
| 495 | * Currently unimplemented; bits 1-0 are supposed to control data | |
| 496 | * flow rates: | |
| 497 | * 0 0 500 kbps | |
| 498 | * 0 1 300 kbps | |
| 499 | * 1 0 250 kbps | |
| 500 | * 1 1 1000 kbps | |
| 501 | */ | |
| 502 | 502 | break; |
| 503 | 503 | } |
| 504 | 504 | } |
| r5932 | r5933 | |
|---|---|---|
| 62 | 62 | static TIMER_CALLBACK(apple1_dsp_ready_end); |
| 63 | 63 | |
| 64 | 64 | /***************************************************************************** |
| 65 | ** | |
| 65 | ** Structures | |
| 66 | 66 | *****************************************************************************/ |
| 67 | 67 | |
| 68 | 68 | /* Handlers for the PIA. The inputs for Port B, CA1, and CB1 are |
| r5932 | r5933 | |
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | /***************************************************************************** |
| 142 | ** | |
| 142 | ** DRIVER_INIT: driver-specific setup, executed once at MESS startup. | |
| 143 | 143 | *****************************************************************************/ |
| 144 | 144 | |
| 145 | 145 | DRIVER_INIT( apple1 ) |
| r5932 | r5933 | |
| 153 | 153 | memory_set_bankptr(machine,1, mess_ram); |
| 154 | 154 | |
| 155 | 155 | /* Poll the keyboard input ports periodically. These include both |
| 156 | ordinary keys and the RESET and CLEAR SCREEN pushbutton | |
| 157 | switches. We can't handle these switches in a VBLANK_INT or | |
| 158 | PERIODIC_INT because both switches need to be monitored even | |
| 159 | while the CPU is suspended during RESET; VBLANK_INT and | |
| 160 | PERIODIC_INT callbacks aren't run while the CPU is in this | |
| 161 | state. | |
| 156 | ordinary keys and the RESET and CLEAR SCREEN pushbutton | |
| 157 | switches. We can't handle these switches in a VBLANK_INT or | |
| 158 | PERIODIC_INT because both switches need to be monitored even | |
| 159 | while the CPU is suspended during RESET; VBLANK_INT and | |
| 160 | PERIODIC_INT callbacks aren't run while the CPU is in this | |
| 161 | state. | |
| 162 | 162 | |
| 163 | A 120-Hz poll rate seems to be fast enough to ensure no | |
| 164 | keystrokes are missed. */ | |
| 163 | A 120-Hz poll rate seems to be fast enough to ensure no | |
| 164 | keystrokes are missed. */ | |
| 165 | 165 | timer_pulse(machine, ATTOTIME_IN_HZ(120), NULL, 0, apple1_kbd_poll); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | /***************************************************************************** |
| 170 | ** | |
| 170 | ** MACHINE_RESET: actions to perform on each cold boot. | |
| 171 | 171 | *****************************************************************************/ |
| 172 | 172 | |
| 173 | 173 | MACHINE_RESET( apple1 ) |
| r5932 | r5933 | |
| 178 | 178 | |
| 179 | 179 | |
| 180 | 180 | /***************************************************************************** |
| 181 | ** | |
| 181 | ** apple1_verify_header | |
| 182 | 182 | *****************************************************************************/ |
| 183 | 183 | static int apple1_verify_header (UINT8 *data) |
| 184 | 184 | { |
| r5932 | r5933 | |
| 205 | 205 | #define SNAP_HEADER_LEN 12 |
| 206 | 206 | |
| 207 | 207 | /***************************************************************************** |
| 208 | ** | |
| 208 | ** snapshot_load_apple1 | |
| 209 | 209 | ** |
| 210 | ** | |
| 210 | ** Format of the binary snapshot image is: | |
| 211 | 211 | ** |
| 212 | ** | |
| 212 | ** [ LOAD:xxyyDATA:zzzzzz...] | |
| 213 | 213 | ** |
| 214 | ** where xxyy is the binary starting address (in big-endian byte | |
| 215 | ** order) to load the binary data zzzzzz to. | |
| 214 | ** where xxyy is the binary starting address (in big-endian byte | |
| 215 | ** order) to load the binary data zzzzzz to. | |
| 216 | 216 | ** |
| 217 | ** The image can be of arbitrary length, but it must fit in available | |
| 218 | ** memory. | |
| 217 | ** The image can be of arbitrary length, but it must fit in available | |
| 218 | ** memory. | |
| 219 | 219 | *****************************************************************************/ |
| 220 | 220 | SNAPSHOT_LOAD(apple1) |
| 221 | 221 | { |
| r5932 | r5933 | |
| 266 | 266 | |
| 267 | 267 | |
| 268 | 268 | /***************************************************************************** |
| 269 | ** | |
| 269 | ** apple1_kbd_poll | |
| 270 | 270 | ** |
| 271 | ** Keyboard polling handles both ordinary keys and the special RESET | |
| 272 | ** and CLEAR SCREEN switches. | |
| 271 | ** Keyboard polling handles both ordinary keys and the special RESET | |
| 272 | ** and CLEAR SCREEN switches. | |
| 273 | 273 | ** |
| 274 | ** For ordinary keys, this implements 2-key rollover to reduce the | |
| 275 | ** chance of missed keypresses. If we press a key and then press a | |
| 276 | ** second key while the first hasn't been completely released, as | |
| 277 | ** might happen during rapid typing, only the second key is | |
| 278 | ** registered; the first key is ignored. | |
| 274 | ** For ordinary keys, this implements 2-key rollover to reduce the | |
| 275 | ** chance of missed keypresses. If we press a key and then press a | |
| 276 | ** second key while the first hasn't been completely released, as | |
| 277 | ** might happen during rapid typing, only the second key is | |
| 278 | ** registered; the first key is ignored. | |
| 279 | 279 | ** |
| 280 | ** If multiple newly-pressed keys are found, the one closest to the | |
| 281 | ** end of the input ports list is counted; the others are ignored. | |
| 280 | ** If multiple newly-pressed keys are found, the one closest to the | |
| 281 | ** end of the input ports list is counted; the others are ignored. | |
| 282 | 282 | *****************************************************************************/ |
| 283 | 283 | static TIMER_CALLBACK(apple1_kbd_poll) |
| 284 | 284 | { |
| r5932 | r5933 | |
| 289 | 289 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" }; |
| 290 | 290 | |
| 291 | 291 | /* This holds the values of all the input ports for ordinary keys |
| 292 | ||
| 292 | seen during the last scan. */ | |
| 293 | 293 | static UINT32 kbd_last_scan[] = { 0, 0, 0, 0 }; |
| 294 | 294 | |
| 295 | 295 | static int reset_flag = 0; |
| r5932 | r5933 | |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /* Now we scan all the input ports for ordinary keys, recording |
| 332 | new keypresses while ignoring keys that were already pressed in | |
| 333 | the last scan. */ | |
| 332 | new keypresses while ignoring keys that were already pressed in | |
| 333 | the last scan. */ | |
| 334 | 334 | |
| 335 | 335 | apple1_kbd_data = 0; |
| 336 | 336 | key_pressed = 0; |
| r5932 | r5933 | |
| 344 | 344 | for (port = 0; port < 4; port++) |
| 345 | 345 | { |
| 346 | 346 | UINT32 portval, newkeys; |
| 347 | ||
| 347 | ||
| 348 | 348 | portval = input_port_read(machine, keynames[port]); |
| 349 | 349 | newkeys = portval & ~(kbd_last_scan[port]); |
| 350 | 350 | |
| r5932 | r5933 | |
| 369 | 369 | if (key_pressed) |
| 370 | 370 | { |
| 371 | 371 | /* The keyboard will pulse its strobe line when a key is |
| 372 | ||
| 372 | pressed. A 10-usec pulse is typical. */ | |
| 373 | 373 | pia6821_ca1_w(pia, 0, 1); |
| 374 | 374 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, apple1_kbd_strobe_end); |
| 375 | 375 | } |
| r5932 | r5933 | |
| 385 | 385 | |
| 386 | 386 | |
| 387 | 387 | /***************************************************************************** |
| 388 | ** | |
| 388 | ** READ/WRITE HANDLERS | |
| 389 | 389 | *****************************************************************************/ |
| 390 | 390 | static READ8_DEVICE_HANDLER( apple1_pia0_kbdin ) |
| 391 | 391 | { |
| 392 | 392 | /* Bit 7 of the keyboard input is permanently wired high. This is |
| 393 | ||
| 393 | what the ROM Monitor software expects. */ | |
| 394 | 394 | return apple1_kbd_data | 0x80; |
| 395 | 395 | } |
| 396 | 396 | |
| r5932 | r5933 | |
| 403 | 403 | static WRITE8_DEVICE_HANDLER( apple1_pia0_dsp_write_signal ) |
| 404 | 404 | { |
| 405 | 405 | /* PIA output CB2 is inverted to become the DA signal, used to |
| 406 | ||
| 406 | signal a display write to the video hardware. */ | |
| 407 | 407 | |
| 408 | 408 | /* DA is directly connected to PIA input PB7, so the processor can |
| 409 | read bit 7 of port B to test whether the display has completed | |
| 410 | a write. */ | |
| 409 | read bit 7 of port B to test whether the display has completed | |
| 410 | a write. */ | |
| 411 | 411 | pia6821_portb_w(device, 0, (!data) << 7); |
| 412 | 412 | |
| 413 | 413 | /* Once DA is asserted, the display will wait until it can perform |
| 414 | the write, when the cursor position is about to be refreshed. | |
| 415 | Only then will it assert \RDA to signal readiness for another | |
| 416 | write. Thus the write delay depends on the cursor position and | |
| 417 | where the display is in the refresh cycle. */ | |
| 414 | the write, when the cursor position is about to be refreshed. | |
| 415 | Only then will it assert \RDA to signal readiness for another | |
| 416 | write. Thus the write delay depends on the cursor position and | |
| 417 | where the display is in the refresh cycle. */ | |
| 418 | 418 | if (!data) |
| 419 | 419 | timer_set(device->machine, apple1_vh_dsp_time_to_ready(device->machine), NULL, 0, apple1_dsp_ready_start); |
| 420 | 420 | } |
| r5932 | r5933 | |
| 424 | 424 | const device_config *pia = devtag_get_device( machine, "pia" ); |
| 425 | 425 | |
| 426 | 426 | /* When the display asserts \RDA to signal it is ready, it |
| 427 | triggers a 74123 one-shot to send a 3.5-usec low pulse to PIA | |
| 428 | input CB1. The end of this pulse will tell the PIA that the | |
| 429 | display is ready for another write. */ | |
| 427 | triggers a 74123 one-shot to send a 3.5-usec low pulse to PIA | |
| 428 | input CB1. The end of this pulse will tell the PIA that the | |
| 429 | display is ready for another write. */ | |
| 430 | 430 | pia6821_cb1_w(pia, 0, 0); |
| 431 | 431 | timer_set(machine, ATTOTIME_IN_NSEC(3500), NULL, 0, apple1_dsp_ready_end); |
| 432 | 432 | } |
| r5932 | r5933 | |
| 436 | 436 | const device_config *pia = devtag_get_device( machine, "pia" ); |
| 437 | 437 | |
| 438 | 438 | /* The one-shot pulse has ended; return CB1 to high, so we can do |
| 439 | ||
| 439 | another display write. */ | |
| 440 | 440 | pia6821_cb1_w(pia, 0, 1); |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | |
| 444 | 444 | /***************************************************************************** |
| 445 | ** | |
| 445 | ** Cassette interface I/O | |
| 446 | 446 | ** |
| 447 | ** The Apple I's cassette interface was a small card that plugged | |
| 448 | ** into the expansion connector on the motherboard. (This was a | |
| 449 | ** slot-type connector, separate from the motherboard's edge | |
| 450 | ** connector, but with the same signals.) The cassette interface | |
| 451 | ** provided separate cassette input and output jacks, some very | |
| 452 | ** simple interface hardware, and 256 bytes of ROM containing the | |
| 453 | ** cassette I/O code. | |
| 447 | ** The Apple I's cassette interface was a small card that plugged | |
| 448 | ** into the expansion connector on the motherboard. (This was a | |
| 449 | ** slot-type connector, separate from the motherboard's edge | |
| 450 | ** connector, but with the same signals.) The cassette interface | |
| 451 | ** provided separate cassette input and output jacks, some very | |
| 452 | ** simple interface hardware, and 256 bytes of ROM containing the | |
| 453 | ** cassette I/O code. | |
| 454 | 454 | ** |
| 455 | ** The interface was mostly software-controlled. The only hardware | |
| 456 | ** was an output flip-flop for generating the cassette output signal, | |
| 457 | ** a National Semiconductor LM311 voltage comparator for generating a | |
| 458 | ** digital signal from the analog cassette input, an input | |
| 459 | ** signal-level LED, and some gates to control the interface logic | |
| 460 | ** and address decoding. The cassette ROM code did most of the work | |
| 461 | ** of generating and interpreting tape signals. It also contained | |
| 462 | ** its own mini-monitor for issuing tape read and write commands. | |
| 455 | ** The interface was mostly software-controlled. The only hardware | |
| 456 | ** was an output flip-flop for generating the cassette output signal, | |
| 457 | ** a National Semiconductor LM311 voltage comparator for generating a | |
| 458 | ** digital signal from the analog cassette input, an input | |
| 459 | ** signal-level LED, and some gates to control the interface logic | |
| 460 | ** and address decoding. The cassette ROM code did most of the work | |
| 461 | ** of generating and interpreting tape signals. It also contained | |
| 462 | ** its own mini-monitor for issuing tape read and write commands. | |
| 463 | 463 | ** |
| 464 | ** The cassette interface was assigned to the $C000-$CFFF block of | |
| 465 | ** addresses, although it did not use most of the space in that | |
| 466 | ** block. Addresses were mapped as follows: | |
| 464 | ** The cassette interface was assigned to the $C000-$CFFF block of | |
| 465 | ** addresses, although it did not use most of the space in that | |
| 466 | ** block. Addresses were mapped as follows: | |
| 467 | 467 | ** |
| 468 | ** $C000-$C0FF: Cassette I/O space. | |
| 469 | ** Any access here toggles the output signal. | |
| 470 | ** $C000-$C07F: Cassette output only; input disabled. | |
| 471 | ** Mirrors $C100-$C17F on reads. | |
| 472 | ** $C080-$C0FF: Cassette input and output. | |
| 473 | ** When input low, mirrors $C180-$C1FF on reads. | |
| 474 | ** When input high, both odd and even addresses | |
| 475 | ** mirror even ROM addresses $C180-$C1FE. | |
| 476 | ** $C100-$C1FF: Cassette ROM code. | |
| 468 | ** $C000-$C0FF: Cassette I/O space. | |
| 469 | ** Any access here toggles the output signal. | |
| 470 | ** $C000-$C07F: Cassette output only; input disabled. | |
| 471 | ** Mirrors $C100-$C17F on reads. | |
| 472 | ** $C080-$C0FF: Cassette input and output. | |
| 473 | ** When input low, mirrors $C180-$C1FF on reads. | |
| 474 | ** When input high, both odd and even addresses | |
| 475 | ** mirror even ROM addresses $C180-$C1FE. | |
| 476 | ** $C100-$C1FF: Cassette ROM code. | |
| 477 | 477 | ** |
| 478 | ** Note the peculiar addressing scheme. Data was written simply | |
| 479 | ** through repeated accesses, rather than by writing to an address. | |
| 480 | ** Data was read by reading an odd input address and comparing the | |
| 481 | ** ROM byte returned to detect signal changes. | |
| 478 | ** Note the peculiar addressing scheme. Data was written simply | |
| 479 | ** through repeated accesses, rather than by writing to an address. | |
| 480 | ** Data was read by reading an odd input address and comparing the | |
| 481 | ** ROM byte returned to detect signal changes. | |
| 482 | 482 | ** |
| 483 | ** The standard tape signal was a simple square wave, although this | |
| 484 | ** was often greatly distorted by the cassette recorder. A single | |
| 485 | ** tape record consisted of a 10-second 800-Hz leader, followed by a | |
| 486 | ** single short square-wave cycle used as a sync bit, followed by the | |
| 487 | ** tape data. The data was encoded using a single square-wave cycle | |
| 488 | ** for each bit; "1" bits were at 1000 Hz, "0" bits at 2000 Hz. (All | |
| 489 | ** of these frequencies are approximate and could vary due to | |
| 490 | ** differences in recorder speed.) Each byte was written starting | |
| 491 | ** from the most significant bit; bytes were written from low to high | |
| 492 | ** addresses. No error detection was provided. Multiple records | |
| 493 | ** could be placed on a single tape. | |
| 483 | ** The standard tape signal was a simple square wave, although this | |
| 484 | ** was often greatly distorted by the cassette recorder. A single | |
| 485 | ** tape record consisted of a 10-second 800-Hz leader, followed by a | |
| 486 | ** single short square-wave cycle used as a sync bit, followed by the | |
| 487 | ** tape data. The data was encoded using a single square-wave cycle | |
| 488 | ** for each bit; "1" bits were at 1000 Hz, "0" bits at 2000 Hz. (All | |
| 489 | ** of these frequencies are approximate and could vary due to | |
| 490 | ** differences in recorder speed.) Each byte was written starting | |
| 491 | ** from the most significant bit; bytes were written from low to high | |
| 492 | ** addresses. No error detection was provided. Multiple records | |
| 493 | ** could be placed on a single tape. | |
| 494 | 494 | *****************************************************************************/ |
| 495 | 495 | |
| 496 | 496 | static const device_config *cassette_device_image(running_machine *machine) |
| r5932 | r5933 | |
| 518 | 518 | if (offset <= 0x7f) |
| 519 | 519 | { |
| 520 | 520 | /* If the access is to address range $C000-$C07F, the cassette |
| 521 | input signal is ignored . In this case the value read | |
| 522 | always comes from the corresponding cassette ROM location | |
| 523 | in $C100-$C17F. */ | |
| 521 | input signal is ignored . In this case the value read | |
| 522 | always comes from the corresponding cassette ROM location | |
| 523 | in $C100-$C17F. */ | |
| 524 | 524 | |
| 525 | 525 | return memory_read_byte(space, 0xc100 + offset); |
| 526 | 526 | } |
| 527 | 527 | else |
| 528 | 528 | { |
| 529 | 529 | /* For accesses to address range $C080-$C0FF, the cassette |
| 530 | input signal is enabled. If the signal is low, the value | |
| 531 | read comes from the corresponding cassette ROM location in | |
| 532 | $C180-$C1FF. If the signal is high, the low bit of the | |
| 533 | address is masked before the corresponding cassette ROM | |
| 534 | location is accessed; e.g., a read from $C081 would return | |
| 535 | the ROM byte at $C180. The cassette ROM routines detect | |
| 536 | changes in the cassette input signal by repeatedly reading | |
| 537 | from $C081 and comparing the values read. */ | |
| 530 | input signal is enabled. If the signal is low, the value | |
| 531 | read comes from the corresponding cassette ROM location in | |
| 532 | $C180-$C1FF. If the signal is high, the low bit of the | |
| 533 | address is masked before the corresponding cassette ROM | |
| 534 | location is accessed; e.g., a read from $C081 would return | |
| 535 | the ROM byte at $C180. The cassette ROM routines detect | |
| 536 | changes in the cassette input signal by repeatedly reading | |
| 537 | from $C081 and comparing the values read. */ | |
| 538 | 538 | |
| 539 | 539 | /* (Don't try putting a non-zero "noise threshhold" here, |
| 540 | because it can cause tape header bits on real cassette | |
| 541 | images to be misread as data bits.) */ | |
| 540 | because it can cause tape header bits on real cassette | |
| 541 | images to be misread as data bits.) */ | |
| 542 | 542 | if (cassette_input(cassette_device_image(space->machine)) > 0.0) |
| 543 | 543 | return memory_read_byte(space, 0xc100 + (offset & ~1)); |
| 544 | 544 | else |
| r5932 | r5933 | |
| 549 | 549 | WRITE8_HANDLER( apple1_cassette_w ) |
| 550 | 550 | { |
| 551 | 551 | /* Writes toggle the output flip-flop in the same way that reads |
| 552 | do; other than that they have no effect. Any repeated accesses | |
| 553 | to the cassette I/O address range can be used to write data to | |
| 554 | cassette, and the cassette ROM always uses reads to do this. | |
| 555 | However, we still have to handle writes, since they may be done | |
| 556 | by user code. */ | |
| 552 | do; other than that they have no effect. Any repeated accesses | |
| 553 | to the cassette I/O address range can be used to write data to | |
| 554 | cassette, and the cassette ROM always uses reads to do this. | |
| 555 | However, we still have to handle writes, since they may be done | |
| 556 | by user code. */ | |
| 557 | 557 | |
| 558 | 558 | cassette_toggle_output(space->machine); |
| 559 | 559 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Thierry Nouspikel's IDE card emulation | |
| 3 | 3 | |
| 4 | This card is just a prototype. It has been designed by Thierry Nouspikel, | |
| 5 | and its description was published in 2001. The card have been revised in | |
| 6 | 2004. | |
| 4 | This card is just a prototype. It has been designed by Thierry Nouspikel, | |
| 5 | and its description was published in 2001. The card have been revised in | |
| 6 | 2004. | |
| 7 | 7 | |
| 8 | ||
| 8 | The specs have been published in <http://www.nouspikel.com/ti99/ide.html>. | |
| 9 | 9 | |
| 10 | The IDE interface is quite simple, since it only implements PIO transfer. | |
| 11 | The card includes a clock chip to timestamp files, and an SRAM for the DSR. | |
| 12 | It should be possible to use a battery backed DSR SRAM, but since the clock | |
| 13 | chip includes 4kb of battery-backed RAM, a bootstrap loader can be saved in | |
| 14 | the clock SRAM in order to load the DSR from the HD when the computer | |
| 15 | starts. | |
| 10 | The IDE interface is quite simple, since it only implements PIO transfer. | |
| 11 | The card includes a clock chip to timestamp files, and an SRAM for the DSR. | |
| 12 | It should be possible to use a battery backed DSR SRAM, but since the clock | |
| 13 | chip includes 4kb of battery-backed RAM, a bootstrap loader can be saved in | |
| 14 | the clock SRAM in order to load the DSR from the HD when the computer | |
| 15 | starts. | |
| 16 | 16 | |
| 17 | ||
| 17 | Raphael Nabet, 2002-2004. | |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | #include "driver.h" |
| r5932 | r5933 | |
| 71 | 71 | static int tms9995_mode; |
| 72 | 72 | |
| 73 | 73 | /* |
| 74 | ||
| 74 | ti99_ide_interrupt() | |
| 75 | 75 | |
| 76 | ||
| 76 | IDE interrupt callback | |
| 77 | 77 | */ |
| 78 | 78 | void ti99_ide_interrupt(const device_config *device, int state) |
| 79 | 79 | { |
| r5932 | r5933 | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /* |
| 86 | ||
| 86 | clk_interrupt_callback() | |
| 87 | 87 | |
| 88 | ||
| 88 | clock interrupt callback | |
| 89 | 89 | */ |
| 90 | 90 | static void clk_interrupt_callback(running_machine *machine, int state) |
| 91 | 91 | { |
| r5932 | r5933 | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /* |
| 97 | ||
| 97 | Initializes the ide card, set up handlers | |
| 98 | 98 | */ |
| 99 | 99 | void ti99_ide_init(running_machine *machine) |
| 100 | 100 | { |
| r5932 | r5933 | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /* |
| 106 | ||
| 106 | Reset ide card, set up handlers | |
| 107 | 107 | */ |
| 108 | 108 | void ti99_ide_reset(running_machine *machine, int in_tms9995_mode) |
| 109 | 109 | { |
| r5932 | r5933 | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /* |
| 160 | ||
| 160 | Read ide CRU interface | |
| 161 | 161 | */ |
| 162 | 162 | static int ide_cru_r(running_machine *machine, int offset) |
| 163 | 163 | { |
| r5932 | r5933 | |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /* |
| 184 | ||
| 184 | Write ide CRU interface | |
| 185 | 185 | */ |
| 186 | 186 | static void ide_cru_w(running_machine *machine, int offset, int data) |
| 187 | 187 | { |
| r5932 | r5933 | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /* |
| 222 | ||
| 222 | read a byte in ide DSR space | |
| 223 | 223 | */ |
| 224 | 224 | static READ8_HANDLER(ide_mem_r) |
| 225 | 225 | { |
| r5932 | r5933 | |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /* |
| 287 | ||
| 287 | write a byte in ide DSR space | |
| 288 | 288 | */ |
| 289 | 289 | static WRITE8_HANDLER(ide_mem_w) |
| 290 | 290 | { |
| r5932 | r5933 | |
| 316 | 316 | case 2: /* IDE registers set 1 (CS1Fx) */ |
| 317 | 317 | /* latch write */ |
| 318 | 318 | /*if (offset & 1) |
| 319 | output_latch = (output_latch & 0xff00) | data; | |
| 320 | else | |
| 321 | output_latch = (output_latch & 0x00ff) | (data << 8);*/ | |
| 319 | output_latch = (output_latch & 0xff00) | data; | |
| 320 | else | |
| 321 | output_latch = (output_latch & 0x00ff) | (data << 8);*/ | |
| 322 | 322 | /* latch write - bytes are swapped in 2004 IDE card */ |
| 323 | 323 | if (offset & 1) |
| 324 | 324 | output_latch = (output_latch & 0x00ff) | (data << 8); |
| r5932 | r5933 | |
| 334 | 334 | case 3: /* IDE registers set 2 (CS3Fx) */ |
| 335 | 335 | /* latch write */ |
| 336 | 336 | /*if (offset & 1) |
| 337 | output_latch = (output_latch & 0xff00) | data; | |
| 338 | else | |
| 339 | output_latch = (output_latch & 0x00ff) | (data << 8);*/ | |
| 337 | output_latch = (output_latch & 0xff00) | data; | |
| 338 | else | |
| 339 | output_latch = (output_latch & 0x00ff) | (data << 8);*/ | |
| 340 | 340 | /* latch write - bytes are swapped in 2004 IDE card */ |
| 341 | 341 | if (offset & 1) |
| 342 | 342 | output_latch = (output_latch & 0x00ff) | (data << 8); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/pc_ide.c | |
| 4 | 4 | |
| 5 | Functions to emulate a IDE hard disk controller | |
| 6 | Not (currently) used, since an XT does not have IDE support in BIOS :( | |
| 5 | Functions to emulate a IDE hard disk controller | |
| 6 | Not (currently) used, since an XT does not have IDE support in BIOS :( | |
| 7 | 7 | |
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| r5932 | r5933 | |
| 64 | 64 | * 7 which drive failed (0 = master, 1 = slave) |
| 65 | 65 | * 6-3 reserved |
| 66 | 66 | * 2-0 error code |
| 67 | * 001 no error detected | |
| 68 | * 010 formatter device error | |
| 69 | * 011 sector buffer error | |
| 70 | * 100 ECC circuitry error | |
| 71 | * 101 controlling microprocessor error | |
| 67 | * 001 no error detected | |
| 68 | * 010 formatter device error | |
| 69 | * 011 sector buffer error | |
| 70 | * 100 ECC circuitry error | |
| 71 | * 101 controlling microprocessor error | |
| 72 | 72 | * ---operation mode--- |
| 73 | 73 | * 7 bad block detected |
| 74 | 74 | * 6 uncorrectable ECC error |
| r5932 | r5933 | |
| 224 | 224 | |
| 225 | 225 | /* |
| 226 | 226 | * Bit(s) Description |
| 227 | * 7 controller is executing a command | |
| 228 | * 6 drive is ready | |
| 229 | * 5 write fault | |
| 230 | * 4 seek complete | |
| 231 | * 3 sector buffer requires servicing | |
| 232 | * 2 disk data read successfully corrected | |
| 233 | * 1 index - set to 1 each disk revolution | |
| 234 | * 0 previous command ended in an error | |
| 227 | * 7 controller is executing a command | |
| 228 | * 6 drive is ready | |
| 229 | * 5 write fault | |
| 230 | * 4 seek complete | |
| 231 | * 3 sector buffer requires servicing | |
| 232 | * 2 disk data read successfully corrected | |
| 233 | * 1 index - set to 1 each disk revolution | |
| 234 | * 0 previous command ended in an error | |
| 235 | 235 | */ |
| 236 | 236 | static int pc_ide_status_r(DEVICE *This) |
| 237 | 237 | { |
| r5932 | r5933 | |
| 242 | 242 | |
| 243 | 243 | /************************************************************************* |
| 244 | 244 | * |
| 245 | * ATHD | |
| 246 | * AT hard disk | |
| 245 | * ATHD | |
| 246 | * AT hard disk | |
| 247 | 247 | * |
| 248 | 248 | *************************************************************************/ |
| 249 | 249 | WRITE8_HANDLER(at_mfm_0_w) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | PC-style floppy disk controller emulation | |
| 4 | 4 | |
| 5 | 5 | **********************************************************************/ |
| 6 | 6 | |
| r5932 | r5933 | |
| 25 | 25 | |
| 26 | 26 | /* main interface */ |
| 27 | 27 | struct pc_fdc_interface |
| 28 | { | |
| 28 | { | |
| 29 | 29 | void (*pc_fdc_interrupt)(running_machine*,int); |
| 30 | void (*pc_fdc_dma_drq)(running_machine*,int,int); | |
| 30 | void (*pc_fdc_dma_drq)(running_machine*,int,int); | |
| 31 | 31 | const device_config *(*get_image)(running_machine*, int floppy_index); |
| 32 | 32 | const device_config *(*get_device)(running_machine*); |
| 33 | 33 | }; |
| r5932 | r5933 | |
|---|---|---|
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | |
| 110 | INLINE mc6843_t* get_safe_token( const device_config *device ) | |
| 110 | INLINE mc6843_t* get_safe_token( const device_config *device ) | |
| 111 | 111 | { |
| 112 | 112 | assert( device != NULL ); |
| 113 | 113 | assert( device->token != NULL ); |
| r5932 | r5933 | |
| 700 | 700 | mc6843->data_size = 0; |
| 701 | 701 | |
| 702 | 702 | /* commands are initiated by updating some flags and scheduling |
| 703 | ||
| 703 | a bottom-half (mc6843_cont) after some delay */ | |
| 704 | 704 | |
| 705 | 705 | switch (cmd) |
| 706 | 706 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | mm58274c.c | |
| 4 | 4 | |
| 5 | ||
| 5 | mm58274c emulation | |
| 6 | 6 | |
| 7 | Reference: | |
| 8 | * National Semiconductor MM58274C Microprocessor Compatible Real Time Clock | |
| 9 | <http://www.national.com/ds/MM/MM58274C.pdf> | |
| 7 | Reference: | |
| 8 | * National Semiconductor MM58274C Microprocessor Compatible Real Time Clock | |
| 9 | <http://www.national.com/ds/MM/MM58274C.pdf> | |
| 10 | 10 | |
| 11 | Todo: | |
| 12 | * Clock initialization will only work with the BwG: we need to provide | |
| 13 | a way to customize it. | |
| 14 | * Save the config to NVRAM? | |
| 15 | * Support interrupt pin output | |
| 11 | Todo: | |
| 12 | * Clock initialization will only work with the BwG: we need to provide | |
| 13 | a way to customize it. | |
| 14 | * Save the config to NVRAM? | |
| 15 | * Support interrupt pin output | |
| 16 | 16 | |
| 17 | ||
| 17 | Raphael Nabet, 2002 | |
| 18 | 18 | |
| 19 | 19 | ***************************************************************************/ |
| 20 | 20 | |
| r5932 | r5933 | |
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | /* |
| 304 | ||
| 304 | Set RTC interrupt flag | |
| 305 | 305 | */ |
| 306 | 306 | static TIMER_CALLBACK(rtc_interrupt_callback) |
| 307 | 307 | { |
| r5932 | r5933 | |
| 312 | 312 | |
| 313 | 313 | |
| 314 | 314 | /* |
| 315 | ||
| 315 | Increment RTC clock (timed interrupt every 1/10s) | |
| 316 | 316 | */ |
| 317 | 317 | |
| 318 | 318 | static TIMER_CALLBACK(increment_rtc) |
| r5932 | r5933 | |
|---|---|---|
| 141 | 141 | |
| 142 | 142 | /************************************************************************* |
| 143 | 143 | * |
| 144 | * EXP | |
| 145 | * expansion port | |
| 144 | * EXP | |
| 145 | * expansion port | |
| 146 | 146 | * |
| 147 | 147 | *************************************************************************/ |
| 148 | 148 | |
| 149 | 149 | // I even don't know what it is! |
| 150 | 150 | static struct { |
| 151 | 151 | /* |
| 152 | reg 0 ram behaviour if in | |
| 153 | reg 3 write 1 to enable it | |
| 154 | reg 4 ram behaviour ??? | |
| 155 | reg 5,6 (5 hi, 6 lowbyte) ??? | |
| 156 | */ | |
| 152 | reg 0 ram behaviour if in | |
| 153 | reg 3 write 1 to enable it | |
| 154 | reg 4 ram behaviour ??? | |
| 155 | reg 5,6 (5 hi, 6 lowbyte) ??? | |
| 156 | */ | |
| 157 | 157 | /* selftest in ibmpc, ibmxt */ |
| 158 | 158 | UINT8 reg[8]; |
| 159 | 159 | } pc_expansion={ { 0,0,0,0,0,0,1 } }; |
| r5932 | r5933 | |
|---|---|---|
| 15 | 15 | DEVICE_GET_INFO( mm58274c ); |
| 16 | 16 | |
| 17 | 17 | /* interface */ |
| 18 | /* | |
| 19 | Initializes the clock chip. | |
| 20 | day1 must be set to a value from 0 (sunday), 1 (monday) ... | |
| 21 | to 6 (saturday) and is needed to correctly retrieve the day-of-week | |
| 22 | from the host system clock. | |
| 18 | /* | |
| 19 | Initializes the clock chip. | |
| 20 | day1 must be set to a value from 0 (sunday), 1 (monday) ... | |
| 21 | to 6 (saturday) and is needed to correctly retrieve the day-of-week | |
| 22 | from the host system clock. | |
| 23 | 23 | */ |
| 24 | 24 | typedef struct _mm58274c_interface mm58274c_interface; |
| 25 | 25 | struct _mm58274c_interface |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | COM8116 - Dual Baud Rate Generator (Programmable Divider) emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/bebox.c | |
| 4 | 4 | |
| 5 | ||
| 5 | BeBox | |
| 6 | 6 | |
| 7 | ||
| 7 | Memory map: | |
| 8 | 8 | |
| 9 | 00000000 - 3FFFFFFF Physical RAM | |
| 10 | 40000000 - 7FFFFFFF Motherboard glue registers | |
| 11 | 80000000 - 807FFFFF ISA I/O | |
| 12 | 81000000 - BF7FFFFF PCI I/O | |
| 13 | BFFFFFF0 - BFFFFFFF PCI/ISA interrupt acknowledge | |
| 14 | FF000000 - FFFFFFFF ROM/flash | |
| 9 | 00000000 - 3FFFFFFF Physical RAM | |
| 10 | 40000000 - 7FFFFFFF Motherboard glue registers | |
| 11 | 80000000 - 807FFFFF ISA I/O | |
| 12 | 81000000 - BF7FFFFF PCI I/O | |
| 13 | BFFFFFF0 - BFFFFFFF PCI/ISA interrupt acknowledge | |
| 14 | FF000000 - FFFFFFFF ROM/flash | |
| 15 | 15 | |
| 16 | In ISA space, peripherals are generally in similar places as they are on | |
| 17 | standard PC hardware (e.g. - the keyboard is 80000060 and 80000064). The | |
| 18 | following table shows more: | |
| 16 | In ISA space, peripherals are generally in similar places as they are on | |
| 17 | standard PC hardware (e.g. - the keyboard is 80000060 and 80000064). The | |
| 18 | following table shows more: | |
| 19 | 19 | |
| 20 | Keyboard/Mouse (Intel 8242) 80000060, 80000064 | |
| 21 | Real Time Clock (BQ3285) 80000070, 80000074 | |
| 22 | IDE ATA Interface 800001F0-F7, 800003F6-7 | |
| 23 | COM2 800002F8-F | |
| 24 | GeekPort A/D Control 80000360-1 | |
| 25 | GeekPort A/D Data 80000362-3 | |
| 26 | GeekPort A/D Rate 80000364 | |
| 27 | GeekPort OE 80000366 | |
| 28 | Infrared Interface 80000368-A | |
| 29 | COM3 80000380-7 | |
| 30 | COM4 80000388-F | |
| 31 | GeekPort D/A 80000390-3 | |
| 32 | GeekPort GPA/GPB 80000394 | |
| 33 | Joystick Buttons 80000397 | |
| 34 | SuperIO Config (PReP standard) 80000398-9 | |
| 35 | MIDI Port 1 800003A0-7 | |
| 36 | MIDI Port 2 800003A8-F | |
| 37 | Parallel 800003BC-E | |
| 38 | Floppy 800003F0-7 | |
| 39 | COM1 800003F8-F | |
| 40 | AD1848 80000830-4 | |
| 20 | Keyboard/Mouse (Intel 8242) 80000060, 80000064 | |
| 21 | Real Time Clock (BQ3285) 80000070, 80000074 | |
| 22 | IDE ATA Interface 800001F0-F7, 800003F6-7 | |
| 23 | COM2 800002F8-F | |
| 24 | GeekPort A/D Control 80000360-1 | |
| 25 | GeekPort A/D Data 80000362-3 | |
| 26 | GeekPort A/D Rate 80000364 | |
| 27 | GeekPort OE 80000366 | |
| 28 | Infrared Interface 80000368-A | |
| 29 | COM3 80000380-7 | |
| 30 | COM4 80000388-F | |
| 31 | GeekPort D/A 80000390-3 | |
| 32 | GeekPort GPA/GPB 80000394 | |
| 33 | Joystick Buttons 80000397 | |
| 34 | SuperIO Config (PReP standard) 80000398-9 | |
| 35 | MIDI Port 1 800003A0-7 | |
| 36 | MIDI Port 2 800003A8-F | |
| 37 | Parallel 800003BC-E | |
| 38 | Floppy 800003F0-7 | |
| 39 | COM1 800003F8-F | |
| 40 | AD1848 80000830-4 | |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | Interrupt bit masks: |
| 44 | 44 | |
| 45 | bit 31 - N/A (used to set/clear masks) | |
| 46 | bit 30 - SMI interrupt to CPU 0 (CPU 0 only) | |
| 47 | bit 29 - SMI interrupt to CPU 1 (CPU 1 only) | |
| 48 | bit 28 - Unused | |
| 49 | bit 27 - COM1 (PC IRQ #4) | |
| 50 | bit 26 - COM2 (PC IRQ #3) | |
| 51 | bit 25 - COM3 | |
| 52 | bit 24 - COM4 | |
| 53 | bit 23 - MIDI1 | |
| 54 | bit 22 - MIDI2 | |
| 55 | bit 21 - SCSI | |
| 56 | bit 20 - PCI Slot #1 | |
| 57 | bit 19 - PCI Slot #2 | |
| 58 | bit 18 - PCI Slot #3 | |
| 59 | bit 17 - Sound | |
| 60 | bit 16 - Keyboard (PC IRQ #1) | |
| 61 | bit 15 - Real Time Clock (PC IRQ #8) | |
| 62 | bit 14 - PC IRQ #5 | |
| 63 | bit 13 - Floppy Disk (PC IRQ #6) | |
| 64 | bit 12 - Parallel Port (PC IRQ #7) | |
| 65 | bit 11 - PC IRQ #9 | |
| 66 | bit 10 - PC IRQ #10 | |
| 67 | bit 9 - PC IRQ #11 | |
| 68 | bit 8 - Mouse (PC IRQ #12) | |
| 69 | bit 7 - IDE (PC IRQ #14) | |
| 70 | bit 6 - PC IRQ #15 | |
| 71 | bit 5 - PIC8259 | |
| 72 | bit 4 - Infrared Controller | |
| 73 | bit 3 - Analog To Digital | |
| 74 | bit 2 - GeekPort | |
| 75 | bit 1 - Unused | |
| 76 | bit 0 - Unused | |
| 45 | bit 31 - N/A (used to set/clear masks) | |
| 46 | bit 30 - SMI interrupt to CPU 0 (CPU 0 only) | |
| 47 | bit 29 - SMI interrupt to CPU 1 (CPU 1 only) | |
| 48 | bit 28 - Unused | |
| 49 | bit 27 - COM1 (PC IRQ #4) | |
| 50 | bit 26 - COM2 (PC IRQ #3) | |
| 51 | bit 25 - COM3 | |
| 52 | bit 24 - COM4 | |
| 53 | bit 23 - MIDI1 | |
| 54 | bit 22 - MIDI2 | |
| 55 | bit 21 - SCSI | |
| 56 | bit 20 - PCI Slot #1 | |
| 57 | bit 19 - PCI Slot #2 | |
| 58 | bit 18 - PCI Slot #3 | |
| 59 | bit 17 - Sound | |
| 60 | bit 16 - Keyboard (PC IRQ #1) | |
| 61 | bit 15 - Real Time Clock (PC IRQ #8) | |
| 62 | bit 14 - PC IRQ #5 | |
| 63 | bit 13 - Floppy Disk (PC IRQ #6) | |
| 64 | bit 12 - Parallel Port (PC IRQ #7) | |
| 65 | bit 11 - PC IRQ #9 | |
| 66 | bit 10 - PC IRQ #10 | |
| 67 | bit 9 - PC IRQ #11 | |
| 68 | bit 8 - Mouse (PC IRQ #12) | |
| 69 | bit 7 - IDE (PC IRQ #14) | |
| 70 | bit 6 - PC IRQ #15 | |
| 71 | bit 5 - PIC8259 | |
| 72 | bit 4 - Infrared Controller | |
| 73 | bit 3 - Analog To Digital | |
| 74 | bit 2 - GeekPort | |
| 75 | bit 1 - Unused | |
| 76 | bit 0 - Unused | |
| 77 | 77 | |
| 78 | Be documentation uses PowerPC bit numbering conventions (i.e. - bit #0 is | |
| 79 | the most significant bit) | |
| 78 | Be documentation uses PowerPC bit numbering conventions (i.e. - bit #0 is | |
| 79 | the most significant bit) | |
| 80 | 80 | |
| 81 | PCI Devices: | |
| 82 | #0 Motorola MPC105 | |
| 83 | #11 Intel 82378 PCI/ISA bridge | |
| 84 | #12 NCR 53C810 SCSI | |
| 81 | PCI Devices: | |
| 82 | #0 Motorola MPC105 | |
| 83 | #11 Intel 82378 PCI/ISA bridge | |
| 84 | #12 NCR 53C810 SCSI | |
| 85 | 85 | |
| 86 | ||
| 86 | More hardware information at http://www.netbsd.org/Ports/bebox/hardware.html | |
| 87 | 87 | |
| 88 | 88 | ***************************************************************************/ |
| 89 | 89 | |
| r5932 | r5933 | |
| 128 | 128 | |
| 129 | 129 | /************************************* |
| 130 | 130 | * |
| 131 | * | |
| 131 | * Interrupts and Motherboard Registers | |
| 132 | 132 | * |
| 133 | 133 | *************************************/ |
| 134 | 134 | |
| r5932 | r5933 | |
| 236 | 236 | if (LOG_INTERRUPTS) |
| 237 | 237 | { |
| 238 | 238 | /* |
| 239 | logerror("bebox_crossproc_interrupts_w(): CPU #%d %s %s\n", | |
| 240 | crossproc_map[i].cpunum, line ? "Asserting" : "Clearing", | |
| 241 | (crossproc_map[i].inputline == PPC_INPUT_LINE_SMI) ? "SMI" : "TLBISYNC"); | |
| 242 | */ | |
| 239 | logerror("bebox_crossproc_interrupts_w(): CPU #%d %s %s\n", | |
| 240 | crossproc_map[i].cpunum, line ? "Asserting" : "Clearing", | |
| 241 | (crossproc_map[i].inputline == PPC_INPUT_LINE_SMI) ? "SMI" : "TLBISYNC"); | |
| 242 | */ | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | cputag_set_input_line(space->machine, cputags[crossproc_map[i].cpunum], crossproc_map[i].inputline, line); |
| r5932 | r5933 | |
| 344 | 344 | |
| 345 | 345 | /************************************* |
| 346 | 346 | * |
| 347 | * | |
| 347 | * COM ports | |
| 348 | 348 | * |
| 349 | 349 | *************************************/ |
| 350 | 350 | |
| r5932 | r5933 | |
| 401 | 401 | |
| 402 | 402 | /************************************* |
| 403 | 403 | * |
| 404 | * | |
| 404 | * Floppy Disk Controller | |
| 405 | 405 | * |
| 406 | 406 | *************************************/ |
| 407 | 407 | |
| r5932 | r5933 | |
| 427 | 427 | static const device_config *bebox_fdc_get_image(running_machine *machine, int floppy_index) |
| 428 | 428 | { |
| 429 | 429 | /* the BeBox boot ROM seems to query for floppy #1 when it should be |
| 430 | ||
| 430 | * querying for floppy #0 */ | |
| 431 | 431 | return floppy_get_device(machine, 0); |
| 432 | 432 | } |
| 433 | 433 | |
| r5932 | r5933 | |
| 448 | 448 | |
| 449 | 449 | /************************************* |
| 450 | 450 | * |
| 451 | * | |
| 451 | * 8259 PIC | |
| 452 | 452 | * |
| 453 | 453 | *************************************/ |
| 454 | 454 | |
| r5932 | r5933 | |
| 468 | 468 | * pic8259 configuration |
| 469 | 469 | * |
| 470 | 470 | *************************************************************/ |
| 471 | ||
| 471 | ||
| 472 | 472 | static PIC8259_SET_INT_LINE( bebox_pic8259_master_set_int_line ) { |
| 473 | 473 | bebox_set_irq_bit(device->machine, 5, interrupt); |
| 474 | 474 | } |
| r5932 | r5933 | |
| 493 | 493 | |
| 494 | 494 | /************************************* |
| 495 | 495 | * |
| 496 | * | |
| 496 | * Floppy/IDE/ATA | |
| 497 | 497 | * |
| 498 | 498 | *************************************/ |
| 499 | 499 | |
| r5932 | r5933 | |
| 551 | 551 | |
| 552 | 552 | /************************************* |
| 553 | 553 | * |
| 554 | * | |
| 554 | * Video card (Cirrus Logic CL-GD5430) | |
| 555 | 555 | * |
| 556 | 556 | *************************************/ |
| 557 | 557 | |
| r5932 | r5933 | |
| 618 | 618 | |
| 619 | 619 | /************************************* |
| 620 | 620 | * |
| 621 | * | |
| 621 | * 8237 DMA | |
| 622 | 622 | * |
| 623 | 623 | *************************************/ |
| 624 | 624 | |
| r5932 | r5933 | |
| 794 | 794 | |
| 795 | 795 | /************************************* |
| 796 | 796 | * |
| 797 | * | |
| 797 | * 8254 PIT | |
| 798 | 798 | * |
| 799 | 799 | *************************************/ |
| 800 | 800 | |
| r5932 | r5933 | |
| 827 | 827 | |
| 828 | 828 | /************************************* |
| 829 | 829 | * |
| 830 | * | |
| 830 | * Flash ROM | |
| 831 | 831 | * |
| 832 | 832 | *************************************/ |
| 833 | 833 | |
| r5932 | r5933 | |
| 859 | 859 | |
| 860 | 860 | /************************************* |
| 861 | 861 | * |
| 862 | * | |
| 862 | * Keyboard | |
| 863 | 863 | * |
| 864 | 864 | *************************************/ |
| 865 | 865 | |
| r5932 | r5933 | |
| 886 | 886 | |
| 887 | 887 | /************************************* |
| 888 | 888 | * |
| 889 | * | |
| 889 | * SCSI | |
| 890 | 890 | * |
| 891 | 891 | *************************************/ |
| 892 | 892 | |
| r5932 | r5933 | |
| 1016 | 1016 | { |
| 1017 | 1017 | case 0x04: |
| 1018 | 1018 | /* command |
| 1019 | * | |
| 1020 | * bit 8: SERR/ Enable | |
| 1021 | * bit 6: Enable Parity Response | |
| 1022 | * bit 4: Write and Invalidate Mode | |
| 1023 | * bit 2: Enable Bus Mastering | |
| 1024 | * bit 1: Enable Memory Space | |
| 1025 | * bit 0: Enable IO Space | |
| 1026 | */ | |
| 1019 | * | |
| 1020 | * bit 8: SERR/ Enable | |
| 1021 | * bit 6: Enable Parity Response | |
| 1022 | * bit 4: Write and Invalidate Mode | |
| 1023 | * bit 2: Enable Bus Mastering | |
| 1024 | * bit 1: Enable Memory Space | |
| 1025 | * bit 0: Enable IO Space | |
| 1026 | */ | |
| 1027 | 1027 | if (data & 0x02) |
| 1028 | 1028 | { |
| 1029 | 1029 | /* brutal ugly hack; at some point the PCI code should be handling this stuff */ |
| r5932 | r5933 | |
| 1070 | 1070 | |
| 1071 | 1071 | /************************************* |
| 1072 | 1072 | * |
| 1073 | * | |
| 1073 | * Driver main | |
| 1074 | 1074 | * |
| 1075 | 1075 | *************************************/ |
| 1076 | 1076 | |
| r5932 | r5933 | |
| 1138 | 1138 | memory_install_write64_handler(space_1, vram_begin, vram_end, 0, 0, bebox_video_w); |
| 1139 | 1139 | |
| 1140 | 1140 | /* The following is a verrrry ugly hack put in to support NetBSD for |
| 1141 | * NetBSD. When NetBSD/bebox it does most of its work on CPU #0 and then | |
| 1142 | * lets CPU #1 go. However, it seems that CPU #1 jumps into never-never | |
| 1143 | * land, crashes, and then goes into NetBSD's crash handler which catches | |
| 1144 | * it. The current PowerPC core cannot catch this trip into never-never | |
| 1145 | * land properly, and MESS crashes. In the interim, this "mitten" catches | |
| 1146 | * the crash | |
| 1147 | */ | |
| 1141 | * NetBSD. When NetBSD/bebox it does most of its work on CPU #0 and then | |
| 1142 | * lets CPU #1 go. However, it seems that CPU #1 jumps into never-never | |
| 1143 | * land, crashes, and then goes into NetBSD's crash handler which catches | |
| 1144 | * it. The current PowerPC core cannot catch this trip into never-never | |
| 1145 | * land properly, and MESS crashes. In the interim, this "mitten" catches | |
| 1146 | * the crash | |
| 1147 | */ | |
| 1148 | 1148 | { |
| 1149 | 1149 | static UINT64 ops[2] = |
| 1150 | 1150 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | COM8116 - Dual Baud Rate Generator (Programmable Divider) emulation | |
| 4 | 4 | |
| 5 | ||
| 5 | Copyright MESS Team. | |
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | XTAL/EXT1 1 |* \_/ | 18 XTAL/EXT2 | |
| 11 | +5V 2 | | 17 fT | |
| 12 | fR 3 | | 16 Ta | |
| 13 | Ra 4 | COM8116 | 15 Tb | |
| 14 | Rb 5 | COM8116T | 14 Tc | |
| 15 | Rc 6 | COM8136 | 13 Td | |
| 16 | Rd 7 | COM8136T | 12 STT | |
| 17 | STR 8 | | 11 GND | |
| 18 | NC 9 |_____________| 10 fX/4 | |
| 9 | _____ _____ | |
| 10 | XTAL/EXT1 1 |* \_/ | 18 XTAL/EXT2 | |
| 11 | +5V 2 | | 17 fT | |
| 12 | fR 3 | | 16 Ta | |
| 13 | Ra 4 | COM8116 | 15 Tb | |
| 14 | Rb 5 | COM8116T | 14 Tc | |
| 15 | Rc 6 | COM8136 | 13 Td | |
| 16 | Rd 7 | COM8136T | 12 STT | |
| 17 | STR 8 | | 11 GND | |
| 18 | NC 9 |_____________| 10 fX/4 | |
| 19 | 19 | |
| 20 | 20 | **********************************************************************/ |
| 21 | 21 |
| r5932 | r5933 | |
|---|---|---|
| 58 | 58 | i8214_t *i8214 = get_safe_token(device); |
| 59 | 59 | |
| 60 | 60 | if (LOG) logerror("I8214 '%s' Interrupt Level %u\n", device->tag, level); |
| 61 | ||
| 61 | ||
| 62 | 62 | i8214->a = level; |
| 63 | 63 | |
| 64 | 64 | /* disable interrupts */ |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | _B0 1 |* \_/ | 24 Vcc | |
| 11 | _B1 2 | | 23 _ECS | |
| 12 | _B2 3 | | 22 _R7 | |
| 13 | _SGS 4 | | 21 _R6 | |
| 14 | _INT 5 | | 20 _R5 | |
| 15 | _CLK 6 | 8214 | 19 _R4 | |
| 16 | INTE 7 | | 18 _R3 | |
| 17 | _A0 8 | | 17 _R2 | |
| 18 | _A1 9 | | 16 _R1 | |
| 19 | _A2 10 | | 15 _R0 | |
| 20 | _ELR 11 | | 14 ENLG | |
| 21 | GND 12 |_____________| 13 ETLG | |
| 9 | _____ _____ | |
| 10 | _B0 1 |* \_/ | 24 Vcc | |
| 11 | _B1 2 | | 23 _ECS | |
| 12 | _B2 3 | | 22 _R7 | |
| 13 | _SGS 4 | | 21 _R6 | |
| 14 | _INT 5 | | 20 _R5 | |
| 15 | _CLK 6 | 8214 | 19 _R4 | |
| 16 | INTE 7 | | 18 _R3 | |
| 17 | _A0 8 | | 17 _R2 | |
| 18 | _A1 9 | | 16 _R1 | |
| 19 | _A2 10 | | 15 _R0 | |
| 20 | _ELR 11 | | 14 ENLG | |
| 21 | GND 12 |_____________| 13 ETLG | |
| 22 | 22 | |
| 23 | 23 | **********************************************************************/ |
| 24 | 24 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | mos tri port interface 6525 |
| 3 | ||
| 3 | mos triple interface adapter 6523 | |
| 4 | 4 | |
| 5 | 5 | peter.trauner@jk.uni-linz.ac.at |
| 6 | 6 | |
| 7 | used in commodore b series | |
| 8 | used in commodore c1551 floppy disk drive | |
| 7 | used in commodore b series | |
| 8 | used in commodore c1551 floppy disk drive | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | /* |
| r5932 | r5933 | |
| 114 | 114 | UINT8 port_a, ddr_a, in_a; |
| 115 | 115 | UINT8 port_b, ddr_b, in_b; |
| 116 | 116 | UINT8 port_c, ddr_c, in_c; |
| 117 | ||
| 117 | ||
| 118 | 118 | UINT8 ca_level, cb_level, interrupt_level; |
| 119 | ||
| 119 | ||
| 120 | 120 | UINT8 cr; |
| 121 | 121 | UINT8 air; |
| 122 | 122 | |
| r5932 | r5933 | |
| 343 | 343 | |
| 344 | 344 | data = (data & ~tpi6525->ddr_a) | (tpi6525->ddr_a & tpi6525->port_a); |
| 345 | 345 | |
| 346 | return data; | |
| 346 | return data; | |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | |
| r5932 | r5933 | |
| 418 | 418 | |
| 419 | 419 | case 1: |
| 420 | 420 | data = tpi6525->in_b; |
| 421 | ||
| 421 | ||
| 422 | 422 | if (tpi6525->intf->in_b_func) |
| 423 | 423 | data &= tpi6525->intf->in_b_func(device, 0); |
| 424 | 424 | |
| r5932 | r5933 | |
| 443 | 443 | else |
| 444 | 444 | { |
| 445 | 445 | data = tpi6525->in_c; |
| 446 | ||
| 446 | ||
| 447 | 447 | if (tpi6525->intf->in_c_func) |
| 448 | 448 | data &= tpi6525->intf->in_c_func(device, 0); |
| 449 | ||
| 449 | ||
| 450 | 450 | data = (data & ~tpi6525->ddr_c) | (tpi6525->ddr_c & tpi6525->port_c); |
| 451 | 451 | } |
| 452 | 452 | |
| r5932 | r5933 | |
| 503 | 503 | data = tpi6525->air; |
| 504 | 504 | tpi6525->air = 0; |
| 505 | 505 | } |
| 506 | ||
| 506 | ||
| 507 | 507 | tpi6525_clear_interrupt(device); |
| 508 | 508 | break; |
| 509 | 509 | |
| r5932 | r5933 | |
| 530 | 530 | tpi6525->intf->out_a_func(device, 0, tpi6525->port_a & tpi6525->ddr_a); |
| 531 | 531 | |
| 532 | 532 | break; |
| 533 | ||
| 533 | ||
| 534 | 534 | case 1: |
| 535 | 535 | tpi6525->port_b = data; |
| 536 | 536 | |
| r5932 | r5933 | |
| 573 | 573 | |
| 574 | 574 | case 6: |
| 575 | 575 | tpi6525->cr = data; |
| 576 | ||
| 576 | ||
| 577 | 577 | if (INTERRUPT_MODE) |
| 578 | 578 | { |
| 579 | 579 | if (CA_MANUAL_OUT) |
| r5932 | r5933 | |
| 591 | 591 | if (tpi6525->cb_level != CB_MANUAL_LEVEL) |
| 592 | 592 | { |
| 593 | 593 | tpi6525->cb_level = CB_MANUAL_LEVEL; |
| 594 | ||
| 594 | ||
| 595 | 595 | if (tpi6525->intf->out_cb_func) |
| 596 | 596 | tpi6525->intf->out_cb_func(device, 0, tpi6525->cb_level); |
| 597 | 597 | } |
| r5932 | r5933 | |
|---|---|---|
| 336 | 336 | |
| 337 | 337 | UINT8 *memory = memory_region(image->machine, "maincpu"); |
| 338 | 338 | const char *filetype = image_filetype(image); |
| 339 | ||
| 339 | ||
| 340 | 340 | /* if it is in .rom format, we enter here */ |
| 341 | 341 | if (!mame_stricmp (filetype, "rom")) |
| 342 | 342 | { |
| r5932 | r5933 | |
| 384 | 384 | return INIT_PASS; |
| 385 | 385 | } |
| 386 | 386 | /* otherwise, we load it as a .bin file, using extrainfo from intv.hsi in place of .cfg */ |
| 387 | else | |
| 387 | else | |
| 388 | 388 | { |
| 389 | 389 | /* This code is a blatant hack, due to impossibility to load a separate .cfg file in MESS. */ |
| 390 | 390 | /* It shall be eventually replaced by the .xml loading */ |
| r5932 | r5933 | |
| 392 | 392 | /* extrainfo format */ |
| 393 | 393 | // 1. mapper number (to deal with bankswitch). no bankswitch is mapper 0 (most games). |
| 394 | 394 | // 2.->5. current images have at most 4 chunks of data. we store here block size and location to load |
| 395 | // (value & 0xf0) >> 4 is the location / 0x1000 | |
| 396 | // (value & 0x0f) is the size / 0x800 | |
| 395 | // (value & 0xf0) >> 4 is the location / 0x1000 | |
| 396 | // (value & 0x0f) is the size / 0x800 | |
| 397 | 397 | // 6. some images have a ram chunk. as above we store location and size in 8 bits |
| 398 | 398 | // 7. extra = 1 ECS, 2 Intellivoice |
| 399 | 399 | int start, size; |
| r5932 | r5933 | |
| 415 | 415 | sscanf(image_extrainfo(image),"%d %d %d %d %d %d %d", &mapper, &rom[0], &rom[1], &rom[2], |
| 416 | 416 | &rom[3], &ram, &extra); |
| 417 | 417 | |
| 418 | // logerror("extrainfo: %d %d %d %d %d %d %d \n", mapper, rom[0], rom[1], rom[2], | |
| 419 | // rom[3], ram, extra); | |
| 418 | // logerror("extrainfo: %d %d %d %d %d %d %d \n", mapper, rom[0], rom[1], rom[2], | |
| 419 | // rom[3], ram, extra); | |
| 420 | 420 | |
| 421 | if (mapper) | |
| 421 | if (mapper) | |
| 422 | 422 | { |
| 423 | 423 | logerror("Bankswitch not yet implemented! \n"); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | if (ram) | |
| 426 | if (ram) | |
| 427 | 427 | { |
| 428 | 428 | logerror("RAM banks not yet implemented! \n"); |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | if (extra & INTELLIVOICE_MASK) | |
| 431 | if (extra & INTELLIVOICE_MASK) | |
| 432 | 432 | { |
| 433 | 433 | logerror("Intellivoice support not yet implemented! \n"); |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | if (extra & ECS_MASK) | |
| 436 | if (extra & ECS_MASK) | |
| 437 | 437 | { |
| 438 | 438 | logerror("ECS support is only partial\n"); |
| 439 | 439 | logerror("(even with the intvkbd driver)! \n"); |
| r5932 | r5933 | |
| 443 | 443 | { |
| 444 | 444 | start = (( rom[j] & 0xf0 ) >> 4) * 0x1000; |
| 445 | 445 | size = ( rom[j] & 0x0f ) * 0x800; |
| 446 | ||
| 446 | ||
| 447 | 447 | /* some cart has to be loaded to 0x4800, but none goes to 0x4000. Hence, we use */ |
| 448 | 448 | /* 0x04 << 4 in extrainfo (to reduce the stored values) and fix the value here. */ |
| 449 | 449 | if (start == 0x4000) start += 0x800; |
| 450 | ||
| 451 | // logerror("step %d: %d %d \n", j, start / 0x1000, size / 0x1000); | |
| 452 | ||
| 450 | ||
| 451 | // logerror("step %d: %d %d \n", j, start / 0x1000, size / 0x1000); | |
| 452 | ||
| 453 | 453 | for (i = 0; i < size; i++ ) |
| 454 | 454 | { |
| 455 | 455 | image_fread(image, &low_byte, 1); |
| r5932 | r5933 | |
| 467 | 467 | DEVICE_START( intv_cart ) |
| 468 | 468 | { |
| 469 | 469 | /* First, initialize these as empty so that the intellivision |
| 470 | ||
| 470 | * will think that the playcable and keyboard are not attached */ | |
| 471 | 471 | UINT8 *memory = memory_region(device->machine, "maincpu"); |
| 472 | 472 | |
| 473 | 473 | /* assume playcable is absent */ |
| r5932 | r5933 | |
| 482 | 482 | DEVICE_IMAGE_LOAD( intv_cart ) |
| 483 | 483 | { |
| 484 | 484 | /* First, initialize these as empty so that the intellivision |
| 485 | ||
| 485 | * will think that the playcable and keyboard are not attached */ | |
| 486 | 486 | UINT8 *memory = memory_region(image->machine, "maincpu"); |
| 487 | 487 | |
| 488 | 488 | /* assume playcable is absent */ |
| r5932 | r5933 | |
| 579 | 579 | if (strcmp(image->tag,"cart1") == 0) /* Legacy cartridge slot */ |
| 580 | 580 | { |
| 581 | 581 | /* First, initialize these as empty so that the intellivision |
| 582 | ||
| 582 | * will think that the playcable is not attached */ | |
| 583 | 583 | UINT8 *memory = memory_region(image->machine, "maincpu"); |
| 584 | 584 | |
| 585 | 585 | /* assume playcable is absent */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Specialist machine driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 20/03/2008 Cassette support | |
| 6 | 15/03/2008 Preliminary driver. | |
| 7 | ||
| 5 | 20/03/2008 Cassette support | |
| 6 | 15/03/2008 Preliminary driver. | |
| 7 | ||
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 | |
| 10 | 10 | |
| r5932 | r5933 | |
| 28 | 28 | DRIVER_INIT(special) |
| 29 | 29 | { |
| 30 | 30 | /* set initialy ROM to be visible on first bank */ |
| 31 | UINT8 *RAM = memory_region(machine, "maincpu"); | |
| 31 | UINT8 *RAM = memory_region(machine, "maincpu"); | |
| 32 | 32 | memset(RAM,0x0000,0x3000); // make frist page empty by default |
| 33 | 33 | memory_configure_bank(machine, 1, 1, 2, RAM, 0x0000); |
| 34 | memory_configure_bank(machine, 1, 0, 2, RAM, 0xc000); | |
| 34 | memory_configure_bank(machine, 1, 0, 2, RAM, 0xc000); | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | static READ8_DEVICE_HANDLER (specialist_8255_porta_r ) |
| r5932 | r5933 | |
| 43 | 43 | if (input_port_read(device->machine, "LINE4")!=0xff) return 0xef; |
| 44 | 44 | if (input_port_read(device->machine, "LINE5")!=0xff) return 0xdf; |
| 45 | 45 | if (input_port_read(device->machine, "LINE6")!=0xff) return 0xbf; |
| 46 | if (input_port_read(device->machine, "LINE7")!=0xff) return 0x7f; | |
| 46 | if (input_port_read(device->machine, "LINE7")!=0xff) return 0x7f; | |
| 47 | 47 | return 0xff; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | static READ8_DEVICE_HANDLER (specialist_8255_portb_r ) |
| 51 | 51 | { |
| 52 | ||
| 52 | ||
| 53 | 53 | int dat = 0; |
| 54 | double level; | |
| 54 | double level; | |
| 55 | 55 | |
| 56 | 56 | if ((specialist_8255_porta & 0x01)==0) dat ^= (input_port_read(device->machine, "LINE0") ^ 0xff); |
| 57 | 57 | if ((specialist_8255_porta & 0x02)==0) dat ^= (input_port_read(device->machine, "LINE1") ^ 0xff); |
| r5932 | r5933 | |
| 65 | 65 | if ((specialist_8255_portc & 0x02)==0) dat ^= (input_port_read(device->machine, "LINE9") ^ 0xff); |
| 66 | 66 | if ((specialist_8255_portc & 0x04)==0) dat ^= (input_port_read(device->machine, "LINE10") ^ 0xff); |
| 67 | 67 | if ((specialist_8255_portc & 0x08)==0) dat ^= (input_port_read(device->machine, "LINE11") ^ 0xff); |
| 68 | ||
| 69 | dat = (dat << 2) ^0xff; | |
| 68 | ||
| 69 | dat = (dat << 2) ^0xff; | |
| 70 | 70 | if (input_port_read(device->machine, "LINE12")!=0xff) dat ^= 0x02; |
| 71 | ||
| 72 | level = cassette_input(devtag_get_device(device->machine, "cassette")); | |
| 73 | if (level >= 0) | |
| 74 | { | |
| 71 | ||
| 72 | level = cassette_input(devtag_get_device(device->machine, "cassette")); | |
| 73 | if (level >= 0) | |
| 74 | { | |
| 75 | 75 | dat ^= 0x01; |
| 76 | } | |
| 76 | } | |
| 77 | 77 | return dat & 0xff; |
| 78 | 78 | } |
| 79 | 79 | |
| r5932 | r5933 | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | static WRITE8_DEVICE_HANDLER (specialist_8255_porta_w ) |
| 90 | { | |
| 90 | { | |
| 91 | 91 | specialist_8255_porta = data; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | static WRITE8_DEVICE_HANDLER (specialist_8255_portb_w ) |
| 95 | { | |
| 95 | { | |
| 96 | 96 | specialist_8255_portb = data; |
| 97 | 97 | } |
| 98 | 98 | static WRITE8_DEVICE_HANDLER (specialist_8255_portc_w ) |
| 99 | { | |
| 99 | { | |
| 100 | 100 | const device_config *dac_device = devtag_get_device(device->machine, "dac"); |
| 101 | 101 | |
| 102 | 102 | specialist_8255_portc = data; |
| 103 | ||
| 104 | cassette_output(devtag_get_device(device->machine, "cassette"),data & 0x80 ? 1 : -1); | |
| 105 | 103 | |
| 104 | cassette_output(devtag_get_device(device->machine, "cassette"),data & 0x80 ? 1 : -1); | |
| 105 | ||
| 106 | 106 | dac_data_w(dac_device, data & 0x20); //beeper |
| 107 | ||
| 107 | ||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | I8255A_INTERFACE( specialist_ppi8255_interface ) |
| r5932 | r5933 | |
| 126 | 126 | MACHINE_RESET( special ) |
| 127 | 127 | { |
| 128 | 128 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, special_reset); |
| 129 | memory_set_bank(machine, 1, 1); | |
| 129 | memory_set_bank(machine, 1, 1); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | READ8_HANDLER( specialist_keyboard_r ) |
| 133 | { | |
| 133 | { | |
| 134 | 134 | return i8255a_r(devtag_get_device(space->machine, "ppi8255"), (offset & 3)); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | WRITE8_HANDLER( specialist_keyboard_w ) |
| 138 | { | |
| 138 | { | |
| 139 | 139 | i8255a_w(devtag_get_device(space->machine, "ppi8255"), (offset & 3) , data ); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
| 143 | 143 | /* |
| 144 | ||
| 144 | Specialist MX | |
| 145 | 145 | */ |
| 146 | 146 | |
| 147 | 147 | static WRITE8_HANDLER( video_memory_w ) |
| r5932 | r5933 | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | WRITE8_HANDLER (specimx_video_color_w ) |
| 154 | { | |
| 154 | { | |
| 155 | 155 | specimx_color = data; |
| 156 | 156 | } |
| 157 | 157 | |
| r5932 | r5933 | |
| 166 | 166 | memory_install_write8_handler(space, 0xc000, 0xffbf, 0, 0, SMH_BANK(3)); |
| 167 | 167 | memory_install_write8_handler(space, 0xffc0, 0xffdf, 0, 0, SMH_BANK(4)); |
| 168 | 168 | memory_set_bankptr(machine, 4, mess_ram + 0xffc0); |
| 169 | switch(i) | |
| 169 | switch(i) | |
| 170 | 170 | { |
| 171 | case 0 : | |
| 171 | case 0 : | |
| 172 | 172 | memory_install_write8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK(1)); |
| 173 | 173 | memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, video_memory_w); |
| 174 | ||
| 174 | ||
| 175 | 175 | memory_set_bankptr(machine, 1, mess_ram); |
| 176 | 176 | memory_set_bankptr(machine, 2, mess_ram + 0x9000); |
| 177 | memory_set_bankptr(machine, 3, mess_ram + 0xc000); | |
| 177 | memory_set_bankptr(machine, 3, mess_ram + 0xc000); | |
| 178 | 178 | break; |
| 179 | 179 | case 1 : |
| 180 | 180 | memory_install_write8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK(1)); |
| 181 | 181 | memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, SMH_BANK(2)); |
| 182 | ||
| 182 | ||
| 183 | 183 | memory_set_bankptr(machine, 1, mess_ram + 0x10000); |
| 184 | 184 | memory_set_bankptr(machine, 2, mess_ram + 0x19000); |
| 185 | memory_set_bankptr(machine, 3, mess_ram + 0x1c000); | |
| 185 | memory_set_bankptr(machine, 3, mess_ram + 0x1c000); | |
| 186 | 186 | break; |
| 187 | 187 | case 2 : |
| 188 | 188 | memory_install_write8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_UNMAP); |
| 189 | 189 | memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, SMH_UNMAP); |
| 190 | ||
| 190 | ||
| 191 | 191 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x10000); |
| 192 | 192 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x19000); |
| 193 | if (data & 0x80) | |
| 193 | if (data & 0x80) | |
| 194 | 194 | { |
| 195 | memory_set_bankptr(machine, 3, mess_ram + 0x1c000); | |
| 196 | } | |
| 197 | else | |
| 195 | memory_set_bankptr(machine, 3, mess_ram + 0x1c000); | |
| 196 | } | |
| 197 | else | |
| 198 | 198 | { |
| 199 | memory_set_bankptr(machine, 3, mess_ram + 0xc000); | |
| 199 | memory_set_bankptr(machine, 3, mess_ram + 0xc000); | |
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | WRITE8_HANDLER( specimx_select_bank ) |
| 205 | { | |
| 206 | specimx_set_bank(space->machine, offset, data); | |
| 205 | { | |
| 206 | specimx_set_bank(space->machine, offset, data); | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | DRIVER_INIT(specimx) |
| r5932 | r5933 | |
| 256 | 256 | wd17xx_set_density (fdc,DEN_FM_HI); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | static TIMER_CALLBACK( setup_pit8253_gates ) | |
| 259 | static TIMER_CALLBACK( setup_pit8253_gates ) | |
| 260 | 260 | { |
| 261 | 261 | const device_config *pit8253 = devtag_get_device(machine, "pit8253"); |
| 262 | 262 | |
| r5932 | r5933 | |
| 268 | 268 | MACHINE_RESET( specimx ) |
| 269 | 269 | { |
| 270 | 270 | specimx_set_bank(machine, 2,0x00); // Initiali load ROM disk |
| 271 | specimx_color = 0x70; | |
| 271 | specimx_color = 0x70; | |
| 272 | 272 | timer_set(machine, attotime_zero, NULL, 0, setup_pit8253_gates ); |
| 273 | 273 | } |
| 274 | 274 | |
| r5932 | r5933 | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | WRITE8_HANDLER( specimx_disk_ctrl_w ) |
| 281 | { | |
| 281 | { | |
| 282 | 282 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 283 | 283 | |
| 284 | switch(offset) | |
| 285 | { | |
| 286 | case 2 : | |
| 287 | wd17xx_set_side(fdc,data & 1); | |
| 288 | break; | |
| 289 | case 3 : | |
| 290 | wd17xx_set_drive(fdc,data & 1); | |
| 284 | switch(offset) | |
| 285 | { | |
| 286 | case 2 : | |
| 287 | wd17xx_set_side(fdc,data & 1); | |
| 288 | break; | |
| 289 | case 3 : | |
| 290 | wd17xx_set_drive(fdc,data & 1); | |
| 291 | 291 | break; |
| 292 | ||
| 293 | } | |
| 292 | ||
| 293 | } | |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /* |
| 297 | ||
| 297 | Erik | |
| 298 | 298 | */ |
| 299 | 299 | static UINT8 RR_register; |
| 300 | 300 | static UINT8 RC_register; |
| 301 | 301 | |
| 302 | static void erik_set_bank(running_machine *machine) | |
| 303 | { | |
| 302 | static void erik_set_bank(running_machine *machine) | |
| 303 | { | |
| 304 | 304 | UINT8 bank1 = (RR_register & 3); |
| 305 | 305 | UINT8 bank2 = ((RR_register >> 2) & 3); |
| 306 | 306 | UINT8 bank3 = ((RR_register >> 4) & 3); |
| 307 | 307 | UINT8 bank4 = ((RR_register >> 6) & 3); |
| 308 | 308 | UINT8 *mem = memory_region(machine, "maincpu"); |
| 309 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); | |
| 310 | ||
| 309 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); | |
| 310 | ||
| 311 | 311 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| 312 | 312 | memory_install_write8_handler(space, 0x4000, 0x8fff, 0, 0, SMH_BANK(2)); |
| 313 | 313 | memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, SMH_BANK(3)); |
| 314 | 314 | memory_install_write8_handler(space, 0xc000, 0xefff, 0, 0, SMH_BANK(4)); |
| 315 | 315 | memory_install_write8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_BANK(5)); |
| 316 | 316 | memory_install_write8_handler(space, 0xf800, 0xffff, 0, 0, SMH_BANK(6)); |
| 317 | ||
| 318 | switch(bank1) | |
| 317 | ||
| 318 | switch(bank1) | |
| 319 | 319 | { |
| 320 | case 1: | |
| 320 | case 1: | |
| 321 | 321 | case 2: |
| 322 | case 3: | |
| 323 | memory_set_bankptr(machine, 1, mess_ram + 0x10000*(bank1-1)); | |
| 324 | break; | |
| 325 | case 0: | |
| 322 | case 3: | |
| 323 | memory_set_bankptr(machine, 1, mess_ram + 0x10000*(bank1-1)); | |
| 324 | break; | |
| 325 | case 0: | |
| 326 | 326 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 327 | memory_set_bankptr(machine, 1, mem + 0x10000); | |
| 327 | memory_set_bankptr(machine, 1, mem + 0x10000); | |
| 328 | 328 | break; |
| 329 | 329 | } |
| 330 | switch(bank2) | |
| 330 | switch(bank2) | |
| 331 | 331 | { |
| 332 | case 1: | |
| 332 | case 1: | |
| 333 | 333 | case 2: |
| 334 | case 3: | |
| 335 | memory_set_bankptr(machine, 2, mess_ram + 0x10000*(bank2-1) + 0x4000); | |
| 336 | break; | |
| 337 | case 0: | |
| 334 | case 3: | |
| 335 | memory_set_bankptr(machine, 2, mess_ram + 0x10000*(bank2-1) + 0x4000); | |
| 336 | break; | |
| 337 | case 0: | |
| 338 | 338 | memory_install_write8_handler(space, 0x4000, 0x8fff, 0, 0, SMH_UNMAP); |
| 339 | memory_set_bankptr(machine, 2, mem + 0x14000); | |
| 339 | memory_set_bankptr(machine, 2, mem + 0x14000); | |
| 340 | 340 | break; |
| 341 | 341 | } |
| 342 | switch(bank3) | |
| 342 | switch(bank3) | |
| 343 | 343 | { |
| 344 | case 1: | |
| 344 | case 1: | |
| 345 | 345 | case 2: |
| 346 | case 3: | |
| 347 | memory_set_bankptr(machine, 3, mess_ram + 0x10000*(bank3-1) + 0x9000); | |
| 348 | break; | |
| 349 | case 0: | |
| 346 | case 3: | |
| 347 | memory_set_bankptr(machine, 3, mess_ram + 0x10000*(bank3-1) + 0x9000); | |
| 348 | break; | |
| 349 | case 0: | |
| 350 | 350 | memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, SMH_UNMAP); |
| 351 | memory_set_bankptr(machine, 3, mem + 0x19000); | |
| 351 | memory_set_bankptr(machine, 3, mem + 0x19000); | |
| 352 | 352 | break; |
| 353 | 353 | } |
| 354 | switch(bank4) | |
| 354 | switch(bank4) | |
| 355 | 355 | { |
| 356 | case 1: | |
| 356 | case 1: | |
| 357 | 357 | case 2: |
| 358 | case 3: | |
| 359 | memory_set_bankptr(machine, 4, mess_ram + 0x10000*(bank4-1) + 0x0c000); | |
| 360 | memory_set_bankptr(machine, 5, mess_ram + 0x10000*(bank4-1) + 0x0f000); | |
| 361 | memory_set_bankptr(machine, 6, mess_ram + 0x10000*(bank4-1) + 0x0f800); | |
| 362 | break; | |
| 363 | case 0: | |
| 358 | case 3: | |
| 359 | memory_set_bankptr(machine, 4, mess_ram + 0x10000*(bank4-1) + 0x0c000); | |
| 360 | memory_set_bankptr(machine, 5, mess_ram + 0x10000*(bank4-1) + 0x0f000); | |
| 361 | memory_set_bankptr(machine, 6, mess_ram + 0x10000*(bank4-1) + 0x0f800); | |
| 362 | break; | |
| 363 | case 0: | |
| 364 | 364 | memory_install_write8_handler(space, 0xc000, 0xefff, 0, 0, SMH_UNMAP); |
| 365 | memory_set_bankptr(machine, 4, mem + 0x1c000); | |
| 365 | memory_set_bankptr(machine, 4, mem + 0x1c000); | |
| 366 | 366 | memory_install_write8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_UNMAP); |
| 367 | 367 | memory_install_read8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_NOP); |
| 368 | 368 | memory_install_write8_handler(space, 0xf800, 0xffff, 0, 0, specialist_keyboard_w); |
| r5932 | r5933 | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | DRIVER_INIT(erik) |
| 375 | { | |
| 376 | memset(mess_ram,0,192*1024); | |
| 375 | { | |
| 376 | memset(mess_ram,0,192*1024); | |
| 377 | 377 | erik_color_1 = 0; |
| 378 | 378 | erik_color_2 = 0; |
| 379 | 379 | erik_background = 0; |
| r5932 | r5933 | |
| 381 | 381 | |
| 382 | 382 | MACHINE_RESET( erik ) |
| 383 | 383 | { |
| 384 | RR_register = 0x00; | |
| 384 | RR_register = 0x00; | |
| 385 | 385 | RC_register = 0x00; |
| 386 | erik_set_bank(machine); | |
| 386 | erik_set_bank(machine); | |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | READ8_HANDLER ( erik_rr_reg_r ) |
| 390 | 390 | { |
| 391 | 391 | return RR_register; |
| 392 | 392 | } |
| 393 | WRITE8_HANDLER( erik_rr_reg_w ) | |
| 393 | WRITE8_HANDLER( erik_rr_reg_w ) | |
| 394 | 394 | { |
| 395 | 395 | RR_register = data; |
| 396 | 396 | erik_set_bank(space->machine); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | READ8_HANDLER ( erik_rc_reg_r ) | |
| 399 | READ8_HANDLER ( erik_rc_reg_r ) | |
| 400 | 400 | { |
| 401 | 401 | return RC_register; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
| 405 | WRITE8_HANDLER( erik_rc_reg_w ) | |
| 405 | WRITE8_HANDLER( erik_rc_reg_w ) | |
| 406 | 406 | { |
| 407 | 407 | RC_register = data; |
| 408 | 408 | erik_color_1 = RC_register & 7; |
| r5932 | r5933 | |
| 410 | 410 | erik_background = ((RC_register >> 6 ) & 1) + ((RC_register >> 7 ) & 1) * 4; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | READ8_HANDLER ( erik_disk_reg_r ) | |
| 413 | READ8_HANDLER ( erik_disk_reg_r ) | |
| 414 | 414 | { |
| 415 | return 0xff; | |
| 415 | return 0xff; | |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | WRITE8_HANDLER( erik_disk_reg_w ) | |
| 418 | WRITE8_HANDLER( erik_disk_reg_w ) | |
| 419 | 419 | { |
| 420 | 420 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 421 | ||
| 422 | wd17xx_set_side (fdc,data & 1); | |
| 421 | ||
| 422 | wd17xx_set_side (fdc,data & 1); | |
| 423 | 423 | wd17xx_set_drive(fdc,(data >> 1) & 1); |
| 424 | if((data >>2) & 1) | |
| 424 | if((data >>2) & 1) | |
| 425 | 425 | { |
| 426 | 426 | wd17xx_set_density (fdc,DEN_FM_LO); |
| 427 | } | |
| 428 | else | |
| 427 | } | |
| 428 | else | |
| 429 | 429 | { |
| 430 | 430 | wd17xx_set_density (fdc,DEN_FM_HI); |
| 431 | } | |
| 431 | } | |
| 432 | 432 | } |
| r5932 | r5933 | |
|---|---|---|
| 110 | 110 | /* Load in .ace files. These are memory images of 0x2000 to 0x7fff |
| 111 | 111 | and compressed as follows: |
| 112 | 112 | |
| 113 | ED 00 : End marker | |
| 114 | ED 01 ED : 0xED | |
| 115 | ED <cnt> <byt> : repeat <byt> count <cnt:3-240> times | |
| 116 | <byt> : <byt> | |
| 113 | ED 00 : End marker | |
| 114 | ED 01 ED : 0xED | |
| 115 | ED <cnt> <byt> : repeat <byt> count <cnt:3-240> times | |
| 116 | <byt> : <byt> | |
| 117 | 117 | */ |
| 118 | 118 | |
| 119 | 119 | DEVICE_IMAGE_LOAD( jupiter_ace ) |
| r5932 | r5933 | |
|---|---|---|
| 12 | 12 | #include "devices/cassette.h" |
| 13 | 13 | #include "sound/speaker.h" |
| 14 | 14 | #include "includes/mz80.h" |
| 15 | ||
| 15 | ||
| 16 | 16 | UINT8 mz80k_tempo_strobe = 0; |
| 17 | 17 | static UINT8 mz80k_8255_portc = 0; |
| 18 | 18 | UINT8 mz80k_vertical = 0; |
| r5932 | r5933 | |
| 58 | 58 | return val; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | static WRITE8_DEVICE_HANDLER(mz80k_8255_porta_w) | |
| 62 | { | |
| 63 | mz80k_keyboard_line = data & 0x0f; | |
| 61 | static WRITE8_DEVICE_HANDLER(mz80k_8255_porta_w) | |
| 62 | { | |
| 63 | mz80k_keyboard_line = data & 0x0f; | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | static WRITE8_DEVICE_HANDLER(mz80k_8255_portc_w) | |
| 67 | { | |
| 68 | // logerror("mz80k_8255_portc_w %02x\n",data); | |
| 66 | static WRITE8_DEVICE_HANDLER(mz80k_8255_portc_w) | |
| 67 | { | |
| 68 | // logerror("mz80k_8255_portc_w %02x\n",data); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | static UINT8 speaker_level = 0; |
| r5932 | r5933 | |
| 75 | 75 | const device_config *speaker = devtag_get_device(device->machine, "speaker"); |
| 76 | 76 | if((prev_state==0) && (state==1)) { |
| 77 | 77 | speaker_level ^= 1; |
| 78 | } | |
| 78 | } | |
| 79 | 79 | prev_state = state; |
| 80 | 80 | speaker_level_w( speaker, speaker_level); |
| 81 | 81 | } |
| r5932 | r5933 | |
| 105 | 105 | const struct pit8253_config mz80k_pit8253_config = |
| 106 | 106 | { |
| 107 | 107 | { |
| 108 | /* clockin irq callback */ | |
| 109 | { XTAL_8MHz/ 4, pit_out0_changed }, | |
| 108 | /* clockin irq callback */ | |
| 109 | { XTAL_8MHz/ 4, pit_out0_changed }, | |
| 110 | 110 | { XTAL_8MHz/256, pit_out1_changed }, |
| 111 | 111 | { 0, pit_out2_changed }, |
| 112 | 112 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | National Semiconductor 8250 UART interface and emulation | |
| 4 | 4 | |
| 5 | 5 | More information on the different models can be found in |
| 6 | 6 | section 1.6 at this location: |
| 7 | http://www.freebsd.org/doc/en_US.ISO8859-1/articles/serial-uart/ | |
| 7 | http://www.freebsd.org/doc/en_US.ISO8859-1/articles/serial-uart/ | |
| 8 | 8 | |
| 9 | 9 | Model overview (from page above): |
| 10 | 10 | |
| r5932 | r5933 | |
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | History: |
| 67 | KT - 14-Jun-2000 - Improved Interrupt setting/clearing | |
| 68 | KT - moved into seperate file so it can be used in Super I/O emulation and | |
| 69 | any other system which uses a PC type COM port | |
| 70 | KT - 24-Jun-2000 - removed pc specific input port tests. More compatible | |
| 71 | with PCW16 and PCW16 doesn't requre the PC input port definitions | |
| 72 | which are not required by the PCW16 hardware | |
| 67 | KT - 14-Jun-2000 - Improved Interrupt setting/clearing | |
| 68 | KT - moved into seperate file so it can be used in Super I/O emulation and | |
| 69 | any other system which uses a PC type COM port | |
| 70 | KT - 24-Jun-2000 - removed pc specific input port tests. More compatible | |
| 71 | with PCW16 and PCW16 doesn't requre the PC input port definitions | |
| 72 | which are not required by the PCW16 hardware | |
| 73 | 73 | |
| 74 | 74 | **********************************************************************/ |
| 75 | 75 | |
| r5932 | r5933 | |
| 333 | 333 | break; |
| 334 | 334 | case 5: |
| 335 | 335 | /* |
| 336 | This register can be written, but if you write a 1 bit into any of | |
| 337 | bits 5 - 0, you could cause an interrupt if the appropriate IER bit | |
| 338 | is set. | |
| 339 | */ | |
| 336 | This register can be written, but if you write a 1 bit into any of | |
| 337 | bits 5 - 0, you could cause an interrupt if the appropriate IER bit | |
| 338 | is set. | |
| 339 | */ | |
| 340 | 340 | COM_LOG(1,"COM_lsr_w",("COM \"%s\" $%02x\n", device->tag, data )); |
| 341 | 341 | |
| 342 | 342 | ins8250->lsr = data; |
| r5932 | r5933 | |
| 350 | 350 | break; |
| 351 | 351 | case 6: |
| 352 | 352 | /* |
| 353 | This register can be written, but if you write a 1 bit into any of | |
| 354 | bits 3 - 0, you could cause an interrupt if the appropriate IER bit | |
| 355 | is set. | |
| 356 | */ | |
| 353 | This register can be written, but if you write a 1 bit into any of | |
| 354 | bits 3 - 0, you could cause an interrupt if the appropriate IER bit | |
| 355 | is set. | |
| 356 | */ | |
| 357 | 357 | COM_LOG(1,"COM_msr_w",("COM \"%s\" $%02x\n", device->tag, data )); |
| 358 | 358 | |
| 359 | 359 | ins8250->msr = data; |
| r5932 | r5933 | |
| 416 | 416 | data = ins8250->iir; |
| 417 | 417 | COM_LOG(2,"COM_iir_r",("COM \"%s\" $%02x\n", device->tag, data)); |
| 418 | 418 | /* The documentation says that reading this register will |
| 419 | ||
| 419 | clear the int if this is the source of the int */ | |
| 420 | 420 | if ( ins8250->ier & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY ) |
| 421 | 421 | { |
| 422 | 422 | ins8250_clear_int(device, COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY); |
| r5932 | r5933 | |
| 502 | 502 | ins8250_trigger_int(device, COM_INT_PENDING_RECEIVED_DATA_AVAILABLE); |
| 503 | 503 | |
| 504 | 504 | |
| 505 | // /* OUT2 + received line data avail interrupt enabled? */ | |
| 506 | // if( (COM_mcr[n] & 0x08) && (COM_ier[n] & 0x01) ) | |
| 507 | // { | |
| 508 | // if (com_interface.interrupt) | |
| 509 | // com_interface.interrupt(4-(n&1), 1); | |
| 505 | // /* OUT2 + received line data avail interrupt enabled? */ | |
| 506 | // if( (COM_mcr[n] & 0x08) && (COM_ier[n] & 0x01) ) | |
| 507 | // { | |
| 508 | // if (com_interface.interrupt) | |
| 509 | // com_interface.interrupt(4-(n&1), 1); | |
| 510 | 510 | // |
| 511 | // | |
| 511 | // } | |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | /************************************************************************** |
| 515 | * | |
| 515 | * change the modem status register | |
| 516 | 516 | **************************************************************************/ |
| 517 | 517 | void ins8250_handshake_in(const device_config *device, int new_msr) |
| 518 | 518 | { |
| r5932 | r5933 | |
| 527 | 527 | |
| 528 | 528 | ins8250_trigger_int(device, COM_INT_PENDING_MODEM_STATUS_REGISTER); |
| 529 | 529 | |
| 530 | // | |
| 530 | // /* set up interrupt information register */ | |
| 531 | 531 | // COM_iir[n] &= ~(0x06 | 0x01); |
| 532 | 532 | |
| 533 | 533 | // /* OUT2 + modem status interrupt enabled? */ |
| 534 | // if( (COM_mcr[n] & 0x08) && (COM_ier[n] & 0x08) ) | |
| 535 | // { | |
| 536 | // if (com_interface.interrupt) | |
| 537 | // com_interface.interrupt(4-(n&1), 1); | |
| 538 | // } | |
| 534 | // if( (COM_mcr[n] & 0x08) && (COM_ier[n] & 0x08) ) | |
| 535 | // { | |
| 536 | // if (com_interface.interrupt) | |
| 537 | // com_interface.interrupt(4-(n&1), 1); | |
| 538 | // } | |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | UT88 machine driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 06/03/2008 Preliminary driver. | |
| 6 | ||
| 5 | 06/03/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| r5932 | r5933 | |
| 20 | 20 | DRIVER_INIT(ut88) |
| 21 | 21 | { |
| 22 | 22 | /* set initialy ROM to be visible on first bank */ |
| 23 | UINT8 *RAM = memory_region(machine, "maincpu"); | |
| 23 | UINT8 *RAM = memory_region(machine, "maincpu"); | |
| 24 | 24 | memset(RAM,0x0000,0x0800); // make frist page empty by default |
| 25 | 25 | memory_configure_bank(machine, 1, 1, 2, RAM, 0x0000); |
| 26 | 26 | memory_configure_bank(machine, 1, 0, 2, RAM, 0xf800); |
| r5932 | r5933 | |
| 42 | 42 | |
| 43 | 43 | static READ8_DEVICE_HANDLER (ut88_8255_portc_r ) |
| 44 | 44 | { |
| 45 | return input_port_read(device->machine, "LINE8"); | |
| 45 | return input_port_read(device->machine, "LINE8"); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | static WRITE8_DEVICE_HANDLER (ut88_8255_porta_w ) |
| 49 | 49 | { |
| 50 | ut88_keyboard_mask = data ^ 0xff; | |
| 50 | ut88_keyboard_mask = data ^ 0xff; | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | I8255A_INTERFACE( ut88_ppi8255_interface ) |
| r5932 | r5933 | |
| 68 | 68 | MACHINE_RESET( ut88 ) |
| 69 | 69 | { |
| 70 | 70 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, ut88_reset); |
| 71 | memory_set_bank(machine, 1, 1); | |
| 71 | memory_set_bank(machine, 1, 1); | |
| 72 | 72 | ut88_keyboard_mask = 0; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | READ8_DEVICE_HANDLER( ut88_keyboard_r ) |
| 77 | 77 | { |
| 78 | return i8255a_r(device, offset^0x03); | |
| 78 | return i8255a_r(device, offset^0x03); | |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| r5932 | r5933 | |
| 88 | 88 | { |
| 89 | 89 | const device_config *dac_device = devtag_get_device(space->machine, "dac"); |
| 90 | 90 | dac_data_w(dac_device, data); //beeper |
| 91 | cassette_output(devtag_get_device(space->machine, "cassette"),data & 0x01 ? 1 : -1); | |
| 91 | cassette_output(devtag_get_device(space->machine, "cassette"),data & 0x01 ? 1 : -1); | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | READ8_HANDLER( ut88_tape_r ) |
| 96 | 96 | { |
| 97 | double level = cassette_input(devtag_get_device(space->machine, "cassette")); | |
| 98 | if (level < 0) { | |
| 99 | return 0x00; | |
| 97 | double level = cassette_input(devtag_get_device(space->machine, "cassette")); | |
| 98 | if (level < 0) { | |
| 99 | return 0x00; | |
| 100 | 100 | } |
| 101 | return 0xff; | |
| 101 | return 0xff; | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | READ8_HANDLER( ut88mini_keyboard_r ) |
| r5932 | r5933 | |
| 106 | 106 | // This is real keyboard implementation |
| 107 | 107 | UINT8 *keyrom1 = memory_region(space->machine, "maincpu")+ 0x10000; |
| 108 | 108 | UINT8 *keyrom2 = memory_region(space->machine, "maincpu")+ 0x10100; |
| 109 | ||
| 109 | ||
| 110 | 110 | UINT8 key = keyrom2[input_port_read(space->machine, "LINE1")]; |
| 111 | // if keyboard 2nd part returned 0 on 4th bit output from | |
| 111 | // if keyboard 2nd part returned 0 on 4th bit output from | |
| 112 | 112 | // first part is used |
| 113 | if ((key & 0x08) ==0x00) { | |
| 114 | key = keyrom1[input_port_read(space->machine, "LINE0")]; | |
| 115 | } | |
| 113 | if ((key & 0x08) ==0x00) { | |
| 114 | key = keyrom1[input_port_read(space->machine, "LINE0")]; | |
| 115 | } | |
| 116 | 116 | // for delete key there is special key producing code 0x80 |
| 117 | key = (input_port_read(space->machine, "LINE2") & 0x80)==0x80 ? key : 0x80; | |
| 118 | // If key 0 is pressed it value is 0x10 this is done by additional | |
| 117 | key = (input_port_read(space->machine, "LINE2") & 0x80)==0x80 ? key : 0x80; | |
| 118 | // If key 0 is pressed it value is 0x10 this is done by additional | |
| 119 | 119 | // discrete logic |
| 120 | 120 | key = (input_port_read(space->machine, "LINE0") & 0x01)==0x01 ? key : 0x10; |
| 121 | 121 | return key; |
| r5932 | r5933 | |
| 126 | 126 | WRITE8_HANDLER( ut88mini_write_led ) |
| 127 | 127 | { |
| 128 | 128 | switch(offset) { |
| 129 | case 0 : lcd_digit[4] = (data >> 4) & 0x0f; | |
| 130 | lcd_digit[5] = data & 0x0f; | |
| 129 | case 0 : lcd_digit[4] = (data >> 4) & 0x0f; | |
| 130 | lcd_digit[5] = data & 0x0f; | |
| 131 | 131 | break; |
| 132 | case 1 : lcd_digit[2] = (data >> 4) & 0x0f; | |
| 133 | lcd_digit[3] = data & 0x0f; | |
| 132 | case 1 : lcd_digit[2] = (data >> 4) & 0x0f; | |
| 133 | lcd_digit[3] = data & 0x0f; | |
| 134 | 134 | break; |
| 135 | case 2 : lcd_digit[0] = (data >> 4) & 0x0f; | |
| 136 | lcd_digit[1] = data & 0x0f; | |
| 135 | case 2 : lcd_digit[0] = (data >> 4) & 0x0f; | |
| 136 | lcd_digit[1] = data & 0x0f; | |
| 137 | 137 | break; |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | static const UINT8 hex_to_7seg[16] = | |
| 142 | {0x3F, 0x06, 0x5B, 0x4F, | |
| 143 | 0x66, 0x6D, 0x7D, 0x07, | |
| 144 | 0x7F, 0x6F, 0x77, 0x7c, | |
| 141 | static const UINT8 hex_to_7seg[16] = | |
| 142 | {0x3F, 0x06, 0x5B, 0x4F, | |
| 143 | 0x66, 0x6D, 0x7D, 0x07, | |
| 144 | 0x7F, 0x6F, 0x77, 0x7c, | |
| 145 | 145 | 0x39, 0x5e, 0x79, 0x71 }; |
| 146 | 146 | |
| 147 | 147 | static TIMER_CALLBACK( update_display ) |
| 148 | { | |
| 148 | { | |
| 149 | 149 | int i; |
| 150 | 150 | for (i=0;i<6;i++) { |
| 151 | 151 | output_set_digit_value(i, hex_to_7seg[lcd_digit[i]]); |
| 152 | } | |
| 152 | } | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | DRIVER_INIT(ut88mini) |
| 157 | 157 | { |
| 158 | ||
| 158 | ||
| 159 | 159 | } |
| 160 | 160 | MACHINE_START( ut88mini ) |
| 161 | 161 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/pc_mouse.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for emulating PC-style serial mouses | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /************************************************************************** |
| 54 | * | |
| 54 | * Check for mouse moves and buttons. Build delta x/y packets | |
| 55 | 55 | **************************************************************************/ |
| 56 | 56 | static TIMER_CALLBACK(pc_mouse_scan) |
| 57 | 57 | { |
| r5932 | r5933 | |
| 124 | 124 | break; |
| 125 | 125 | |
| 126 | 126 | /* mouse systems mouse |
| 127 | ||
| 127 | from "PC Mouse information" by Tomi Engdahl */ | |
| 128 | 128 | |
| 129 | 129 | /* |
| 130 | The data is sent in 5 byte packets in following format: | |
| 131 | D7 D6 D5 D4 D3 D2 D1 D0 | |
| 130 | The data is sent in 5 byte packets in following format: | |
| 131 | D7 D6 D5 D4 D3 D2 D1 D0 | |
| 132 | 132 | |
| 133 | 1. 1 0 0 0 0 LB CB RB | |
| 134 | 2. X7 X6 X5 X4 X3 X2 X1 X0 | |
| 135 | 3. Y7 Y6 Y5 Y4 Y3 Y4 Y1 Y0 | |
| 136 | 4. X7' X6' X5' X4' X3' X2' X1' X0' | |
| 137 | 5. Y7' Y6' Y5' Y4' Y3' Y4' Y1' Y0' | |
| 133 | 1. 1 0 0 0 0 LB CB RB | |
| 134 | 2. X7 X6 X5 X4 X3 X2 X1 X0 | |
| 135 | 3. Y7 Y6 Y5 Y4 Y3 Y4 Y1 Y0 | |
| 136 | 4. X7' X6' X5' X4' X3' X2' X1' X0' | |
| 137 | 5. Y7' Y6' Y5' Y4' Y3' Y4' Y1' Y0' | |
| 138 | 138 | |
| 139 | LB is left button state (0=pressed, 1=released) | |
| 140 | CB is center button state (0=pressed, 1=released) | |
| 141 | RB is right button state (0=pressed, 1=released) | |
| 142 | X7-X0 movement in X direction since last packet in signed byte | |
| 143 | format (-128..+127), positive direction right | |
| 144 | Y7-Y0 movement in Y direction since last packet in signed byte | |
| 145 | format (-128..+127), positive direction up | |
| 146 | X7'-X0' movement in X direction since sending of X7-X0 packet in signed byte | |
| 147 | format (-128..+127), positive direction right | |
| 148 | Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte | |
| 149 | format (-128..+127), positive direction up | |
| 139 | LB is left button state (0=pressed, 1=released) | |
| 140 | CB is center button state (0=pressed, 1=released) | |
| 141 | RB is right button state (0=pressed, 1=released) | |
| 142 | X7-X0 movement in X direction since last packet in signed byte | |
| 143 | format (-128..+127), positive direction right | |
| 144 | Y7-Y0 movement in Y direction since last packet in signed byte | |
| 145 | format (-128..+127), positive direction up | |
| 146 | X7'-X0' movement in X direction since sending of X7-X0 packet in signed byte | |
| 147 | format (-128..+127), positive direction right | |
| 148 | Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte | |
| 149 | format (-128..+127), positive direction up | |
| 150 | 150 | |
| 151 | ||
| 151 | The last two bytes in the packet (bytes 4 and 5) contains information about movement data changes which have occured after data butes 2 and 3 have been sent. */ | |
| 152 | 152 | |
| 153 | 153 | case TYPE_MOUSE_SYSTEMS: |
| 154 | 154 | { |
| r5932 | r5933 | |
| 192 | 192 | |
| 193 | 193 | |
| 194 | 194 | /************************************************************************** |
| 195 | * | |
| 195 | * Check for mouse control line changes and (de-)install timer | |
| 196 | 196 | **************************************************************************/ |
| 197 | 197 | |
| 198 | 198 | INS8250_HANDSHAKE_OUT( pc_mouse_handshake_in ) |
| r5932 | r5933 | |
| 247 | 247 | |
| 248 | 248 | |
| 249 | 249 | /************************************************************************** |
| 250 | * | |
| 250 | * Mouse INPUT_PORT declarations | |
| 251 | 251 | **************************************************************************/ |
| 252 | 252 | |
| 253 | 253 | INPUT_PORTS_START( pc_mouse_mousesystems ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | 8250 UART interface and emulation | |
| 4 | 4 | |
| 5 | 5 | **********************************************************************/ |
| 6 | 6 |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | 14 | - microdrive |
| 15 | 15 | - RTC register write |
| r5932 | r5933 | |
| 159 | 159 | |
| 160 | 160 | /*------------------------------------------------- |
| 161 | 161 | zx8302_irq_status_r - interrupt status |
| 162 | ||
| 162 | register | |
| 163 | 163 | -------------------------------------------------*/ |
| 164 | 164 | |
| 165 | 165 | READ8_DEVICE_HANDLER( zx8302_irq_status_r ) |
| r5932 | r5933 | |
| 171 | 171 | |
| 172 | 172 | /*------------------------------------------------- |
| 173 | 173 | zx8302_irq_acknowledge_w - interrupt |
| 174 | ||
| 174 | acknowledge | |
| 175 | 175 | -------------------------------------------------*/ |
| 176 | 176 | |
| 177 | 177 | WRITE8_DEVICE_HANDLER( zx8302_irq_acknowledge_w ) |
| r5932 | r5933 | |
| 208 | 208 | { |
| 209 | 209 | /* |
| 210 | 210 | |
| 211 | IPC <-> ZX8302 serial link protocol | |
| 212 | *********************************** | |
| 211 | IPC <-> ZX8302 serial link protocol | |
| 212 | *********************************** | |
| 213 | 213 | |
| 214 | Send bit to IPC | |
| 215 | --------------- | |
| 214 | Send bit to IPC | |
| 215 | --------------- | |
| 216 | 216 | |
| 217 | 1. ZX start bit (COMDATA = 0) | |
| 218 | 2. IPC clock (COMCTL = 0, COMTL = 1) | |
| 219 | 3. ZX data bit (COMDATA = 0/1) | |
| 220 | 4. IPC clock (COMCTL = 0, COMTL = 1) | |
| 221 | 5. ZX stop bit (COMDATA = 1) | |
| 217 | 1. ZX start bit (COMDATA = 0) | |
| 218 | 2. IPC clock (COMCTL = 0, COMTL = 1) | |
| 219 | 3. ZX data bit (COMDATA = 0/1) | |
| 220 | 4. IPC clock (COMCTL = 0, COMTL = 1) | |
| 221 | 5. ZX stop bit (COMDATA = 1) | |
| 222 | 222 | |
| 223 | Receive bit from IPC | |
| 224 | -------------------- | |
| 223 | Receive bit from IPC | |
| 224 | -------------------- | |
| 225 | 225 | |
| 226 | 1. ZX start bit (COMDATA = 0) | |
| 227 | 2. IPC clock (COMCTL = 0, COMTL = 1) | |
| 228 | 3. IPC data bit (COMDATA = 0/1) | |
| 229 | 4. IPC clock (COMCTL = 0, COMTL = 1) | |
| 230 | 5. IPC stop bit (COMDATA = 1) | |
| 226 | 1. ZX start bit (COMDATA = 0) | |
| 227 | 2. IPC clock (COMCTL = 0, COMTL = 1) | |
| 228 | 3. IPC data bit (COMDATA = 0/1) | |
| 229 | 4. IPC clock (COMCTL = 0, COMTL = 1) | |
| 230 | 5. IPC stop bit (COMDATA = 1) | |
| 231 | 231 | |
| 232 | ||
| 232 | */ | |
| 233 | 233 | |
| 234 | 234 | zx8302_t *zx8302 = get_safe_token(device); |
| 235 | 235 | |
| r5932 | r5933 | |
| 472 | 472 | |
| 473 | 473 | WRITE8_DEVICE_HANDLER( zx8302_rtc_w ) |
| 474 | 474 | { |
| 475 | // | |
| 475 | // zx8302_t *zx8302 = get_safe_token(device); | |
| 476 | 476 | |
| 477 | 477 | if (LOG) logerror("ZX8302 Real Time Clock Register: %02x\n", data); |
| 478 | 478 | } |
| r5932 | r5933 | |
| 493 | 493 | |
| 494 | 494 | /*------------------------------------------------- |
| 495 | 495 | zx8302_get_selected_microdrive - gets the |
| 496 | ||
| 496 | index of the selected microdrive | |
| 497 | 497 | -------------------------------------------------*/ |
| 498 | 498 | |
| 499 | 499 | static int zx8302_get_selected_microdrive(const device_config *device) |
| r5932 | r5933 | |
| 512 | 512 | |
| 513 | 513 | /*------------------------------------------------- |
| 514 | 514 | zx8302_get_microdrive_status - gets the |
| 515 | ||
| 515 | status of the selected microdrive | |
| 516 | 516 | -------------------------------------------------*/ |
| 517 | 517 | |
| 518 | 518 | static UINT8 zx8302_get_microdrive_status(const device_config *device) |
| r5932 | r5933 | |
| 578 | 578 | |
| 579 | 579 | /*------------------------------------------------- |
| 580 | 580 | zx8302_mdv_control_w - microdrive control |
| 581 | ||
| 581 | register | |
| 582 | 582 | -------------------------------------------------*/ |
| 583 | 583 | |
| 584 | 584 | WRITE8_DEVICE_HANDLER( zx8302_mdv_control_w ) |
| r5932 | r5933 | |
| 749 | 749 | |
| 750 | 750 | static DEVICE_RESET( zx8302 ) |
| 751 | 751 | { |
| 752 | // | |
| 752 | // zx8302_t *zx8302 = get_safe_token(device); | |
| 753 | 753 | |
| 754 | 754 | } |
| 755 | 755 |
| r5932 | r5933 | |
|---|---|---|
| 30 | 30 | static void pp01_video_w(UINT8 block,UINT16 offset,UINT8 data,UINT8 part) |
| 31 | 31 | { |
| 32 | 32 | UINT16 addroffset = part ? 0x1000 : 0x0000; |
| 33 | ||
| 33 | ||
| 34 | 34 | if (BIT(pp01_video_write_mode,3)) { |
| 35 | 35 | // Copy mode |
| 36 | 36 | if(BIT(pp01_video_write_mode,0)) { |
| r5932 | r5933 | |
| 58 | 58 | if (block==2) { |
| 59 | 59 | mess_ram[0xe000+offset+addroffset] = data; |
| 60 | 60 | } |
| 61 | } | |
| 61 | } | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | static WRITE8_HANDLER (pp01_video_r_1_w) |
| r5932 | r5933 | |
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | static void pp01_set_memory(running_machine *machine,UINT8 block, UINT8 data) |
| 92 | { | |
| 93 | UINT8 *mem = memory_region(machine, "maincpu"); | |
| 92 | { | |
| 93 | UINT8 *mem = memory_region(machine, "maincpu"); | |
| 94 | 94 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 95 | 95 | UINT16 startaddr = block*0x1000; |
| 96 | 96 | UINT16 endaddr = ((block+1)*0x1000)-1; |
| r5932 | r5933 | |
| 99 | 99 | // This is RAM |
| 100 | 100 | memory_install_read8_handler (space, startaddr, endaddr, 0, 0, SMH_BANK(blocknum)); |
| 101 | 101 | switch(data) { |
| 102 | case 0xe6 : | |
| 103 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_r_1_w); | |
| 102 | case 0xe6 : | |
| 103 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_r_1_w); | |
| 104 | 104 | break; |
| 105 | case 0xe7 : | |
| 106 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_r_2_w); | |
| 105 | case 0xe7 : | |
| 106 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_r_2_w); | |
| 107 | 107 | break; |
| 108 | case 0xea : | |
| 109 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_g_1_w); | |
| 108 | case 0xea : | |
| 109 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_g_1_w); | |
| 110 | 110 | break; |
| 111 | case 0xeb : | |
| 112 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_g_2_w); | |
| 111 | case 0xeb : | |
| 112 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_g_2_w); | |
| 113 | 113 | break; |
| 114 | case 0xee : | |
| 115 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_b_1_w); | |
| 114 | case 0xee : | |
| 115 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_b_1_w); | |
| 116 | 116 | break; |
| 117 | case 0xef : | |
| 118 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_b_2_w); | |
| 117 | case 0xef : | |
| 118 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, pp01_video_b_2_w); | |
| 119 | 119 | break; |
| 120 | ||
| 120 | ||
| 121 | 121 | default : |
| 122 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, SMH_BANK(blocknum)); | |
| 122 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, SMH_BANK(blocknum)); | |
| 123 | 123 | break; |
| 124 | 124 | } |
| 125 | ||
| 125 | ||
| 126 | 126 | memory_set_bankptr(machine, blocknum, mess_ram + (data & 0x0F)* 0x1000); |
| 127 | 127 | } else if (data>=0xF8) { |
| 128 | 128 | memory_install_read8_handler (space, startaddr, endaddr, 0, 0, SMH_BANK(blocknum)); |
| 129 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, SMH_UNMAP); | |
| 129 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, SMH_UNMAP); | |
| 130 | 130 | memory_set_bankptr(machine, blocknum, mem + ((data & 0x0F)-8)* 0x1000+0x10000); |
| 131 | 131 | } else { |
| 132 | 132 | logerror("%02x %02x\n",block,data); |
| 133 | memory_install_read8_handler (space, startaddr, endaddr, 0, 0, SMH_UNMAP); | |
| 134 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, SMH_UNMAP); | |
| 133 | memory_install_read8_handler (space, startaddr, endaddr, 0, 0, SMH_UNMAP); | |
| 134 | memory_install_write8_handler(space, startaddr, endaddr, 0, 0, SMH_UNMAP); | |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | ||
| 137 | ||
| 138 | 138 | MACHINE_RESET( pp01 ) |
| 139 | 139 | { |
| 140 | 140 | int i; |
| r5932 | r5933 | |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | WRITE8_HANDLER (pp01_mem_block_w) | |
| 148 | WRITE8_HANDLER (pp01_mem_block_w) | |
| 149 | 149 | { |
| 150 | 150 | memory_block[offset] = data; |
| 151 | 151 | pp01_set_memory(space->machine, offset, data); |
| r5932 | r5933 | |
| 198 | 198 | return pp01_video_scroll; |
| 199 | 199 | } |
| 200 | 200 | static WRITE8_DEVICE_HANDLER (pp01_8255_porta_w ) |
| 201 | { | |
| 201 | { | |
| 202 | 202 | pp01_video_scroll = data; |
| 203 | 203 | } |
| 204 | 204 | |
| r5932 | r5933 | |
| 207 | 207 | { |
| 208 | 208 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", |
| 209 | 209 | "LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF" }; |
| 210 | ||
| 210 | ||
| 211 | 211 | return (input_port_read(device->machine,keynames[pp01_key_line]) & 0x3F) | (input_port_read(device->machine,"LINEALL") & 0xC0); |
| 212 | 212 | } |
| 213 | 213 | static WRITE8_DEVICE_HANDLER (pp01_8255_portb_w ) |
| 214 | { | |
| 214 | { | |
| 215 | 215 | //logerror("pp01_8255_portb_w %02x\n",data); |
| 216 | ||
| 216 | ||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | static WRITE8_DEVICE_HANDLER (pp01_8255_portc_w ) |
| 220 | { | |
| 220 | { | |
| 221 | 221 | pp01_key_line = data & 0x0f; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | static READ8_DEVICE_HANDLER (pp01_8255_portc_r ) |
| 225 | { | |
| 225 | { | |
| 226 | 226 | return 0xff; |
| 227 | 227 | } |
| 228 | 228 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | Cybiko Wireless Inter-tainment System | |
| 4 | 4 | |
| 5 | ||
| 5 | (c) 2001-2007 Tim Schuerewegen | |
| 6 | 6 | |
| 7 | Cybiko Classic (V1) | |
| 8 | Cybiko Classic (V2) | |
| 9 | Cybiko Xtreme | |
| 7 | Cybiko Classic (V1) | |
| 8 | Cybiko Classic (V2) | |
| 9 | Cybiko Xtreme | |
| 10 | 10 | |
| 11 | 11 | */ |
| 12 | 12 | |
| r5932 | r5933 | |
| 111 | 111 | /* |
| 112 | 112 | NVRAM_HANDLER( cybikov1 ) |
| 113 | 113 | { |
| 114 | _logerror( 0, ("nvram_handler_cybikov1 (%p/%d)\n", file, read_or_write)); | |
| 115 | nvram_handler_at45dbxx( machine, file, read_or_write); | |
| 116 | nvram_handler_pcf8593( machine, file, read_or_write); | |
| 114 | _logerror( 0, ("nvram_handler_cybikov1 (%p/%d)\n", file, read_or_write)); | |
| 115 | nvram_handler_at45dbxx( machine, file, read_or_write); | |
| 116 | nvram_handler_pcf8593( machine, file, read_or_write); | |
| 117 | 117 | } |
| 118 | 118 | */ |
| 119 | 119 | |
| 120 | 120 | /* |
| 121 | 121 | NVRAM_HANDLER( cybikov2 ) |
| 122 | 122 | { |
| 123 | _logerror( 0, ("nvram_handler_cybikov2 (%p/%d)\n", file, read_or_write)); | |
| 124 | nvram_handler_at45dbxx( machine, file, read_or_write); | |
| 125 | nvram_handler_sst39vfx( machine, file, read_or_write); | |
| 126 | nvram_handler_pcf8593( machine, file, read_or_write); | |
| 123 | _logerror( 0, ("nvram_handler_cybikov2 (%p/%d)\n", file, read_or_write)); | |
| 124 | nvram_handler_at45dbxx( machine, file, read_or_write); | |
| 125 | nvram_handler_sst39vfx( machine, file, read_or_write); | |
| 126 | nvram_handler_pcf8593( machine, file, read_or_write); | |
| 127 | 127 | } |
| 128 | 128 | */ |
| 129 | 129 | |
| 130 | 130 | /* |
| 131 | 131 | NVRAM_HANDLER( cybikoxt ) |
| 132 | 132 | { |
| 133 | _logerror( 0, ("nvram_handler_cybikoxt (%p/%d)\n", file, read_or_write)); | |
| 134 | nvram_handler_sst39vfx( machine, file, read_or_write); | |
| 135 | nvram_handler_pcf8593( machine, file, read_or_write); | |
| 133 | _logerror( 0, ("nvram_handler_cybikoxt (%p/%d)\n", file, read_or_write)); | |
| 134 | nvram_handler_sst39vfx( machine, file, read_or_write); | |
| 135 | nvram_handler_pcf8593( machine, file, read_or_write); | |
| 136 | 136 | } |
| 137 | 137 | */ |
| 138 | 138 | |
| r5932 | r5933 | |
| 235 | 235 | MACHINE_START( cybikov2 ) |
| 236 | 236 | { |
| 237 | 237 | const device_config *flash2 = devtag_get_device(machine, "flash2"); |
| 238 | ||
| 238 | ||
| 239 | 239 | _logerror( 0, ("machine_start_cybikov2\n")); |
| 240 | 240 | // real-time clock |
| 241 | 241 | nvram_system_load( machine, "rtc", cybiko_pcf8593_load, 0); |
| r5932 | r5933 | |
| 349 | 349 | { |
| 350 | 350 | _logerror( 0, ("cybiko_rs232_init\n")); |
| 351 | 351 | memset( &rs232, 0, sizeof( rs232)); |
| 352 | // | |
| 352 | // timer_pulse(machine, TIME_IN_HZ( 10), NULL, 0, rs232_timer_callback); | |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | static void cybiko_rs232_exit( void) |
| r5932 | r5933 | |
| 437 | 437 | UINT8 data = 0xFF; |
| 438 | 438 | int i; |
| 439 | 439 | static const char *const keynames[] = { "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9" }; |
| 440 | ||
| 440 | ||
| 441 | 441 | _logerror( 2, ("cybiko_key_r_byte (%08X)\n", offset)); |
| 442 | 442 | // A11 |
| 443 | if (!(offset & (1 << 11))) | |
| 443 | if (!(offset & (1 << 11))) | |
| 444 | 444 | data &= 0xFE; |
| 445 | 445 | // A1 .. A9 |
| 446 | for (i=1; i<10; i++) | |
| 446 | for (i=1; i<10; i++) | |
| 447 | 447 | { |
| 448 | if (!(offset & (1 << i))) | |
| 448 | if (!(offset & (1 << i))) | |
| 449 | 449 | data &= input_port_read(space->machine, keynames[i-1]); |
| 450 | 450 | } |
| 451 | 451 | // A0 |
| 452 | if (!(offset & (1 << 0))) | |
| 452 | if (!(offset & (1 << 0))) | |
| 453 | 453 | data |= 0xFF; |
| 454 | 454 | // |
| 455 | 455 | return data; |
| r5932 | r5933 | |
| 481 | 481 | // serial dataflash |
| 482 | 482 | case H8S_IO_PORT3 : { |
| 483 | 483 | const device_config *device = devtag_get_device(space->machine, "flash1"); |
| 484 | if (at45dbxx_pin_so(device)) data = data | H8S_P3_RXD1; | |
| 484 | if (at45dbxx_pin_so(device)) data = data | H8S_P3_RXD1; | |
| 485 | 485 | } |
| 486 | 486 | break; |
| 487 | ||
| 487 | ||
| 488 | 488 | // rs232 |
| 489 | 489 | case H8S_IO_PORT5 : if (cybiko_rs232_pin_rxd()) data = data | H8S_P5_RXD2; break; |
| 490 | 490 | // real-time clock |
| r5932 | r5933 | |
| 609 | 609 | case 0x000 : return 0xBA0B; // magic (part 1) |
| 610 | 610 | case 0x002 : return 0xAB15; // magic (part 2) |
| 611 | 611 | case 0x004 : return (0x07 << 8) | (0x07 ^0xFF); // brightness (or contrast) & value xor FF |
| 612 | // | |
| 612 | // case 0x006 : return 0x2B57; // do not show "Free Games and Applications at www.cybiko.com" screen | |
| 613 | 613 | case 0x008 : return 0xDEBA; // enable debug output |
| 614 | 614 | case 0x016 : return 0x5000 | 0x03FF; // ? |
| 615 | 615 | case 0x7FC : return 0x22A1; // crc32 (part 1) |
| r5932 | r5933 | |
|---|---|---|
| 131 | 131 | if (snes_cart.mode == SNES_MODE_20) |
| 132 | 132 | { |
| 133 | 133 | /* There could be some larger image needing banks 0x70 to 0x7f at address 0x8000 for ROM |
| 134 | ||
| 134 | * mirroring. These should be treated separately or data would be overwritten by SRAM */ | |
| 135 | 135 | for (ii = 0; ii < 16; ii++) |
| 136 | 136 | { |
| 137 | 137 | /* loading */ |
| r5932 | r5933 | |
| 236 | 236 | UINT8 mapper = infoblock[offset + 0x15] & ~0x10; //mask off irrelevent FastROM-capable bit |
| 237 | 237 | |
| 238 | 238 | /* $00:[000-7fff] contains uninitialized RAM and MMIO. |
| 239 | ||
| 239 | reset vector must point to ROM at $00:[8000-ffff] to be considered valid. */ | |
| 240 | 240 | if (reset_vector < 0x8000) |
| 241 | 241 | return 0; |
| 242 | 242 | |
| 243 | 243 | /* some images duplicate the header in multiple locations, and others have completely |
| 244 | invalid header information that cannot be relied upon. The code below will analyze | |
| 245 | the first opcode executed at the specified reset vector to determine the probability | |
| 246 | that this is the correct header. Score is assigned accordingly. */ | |
| 244 | invalid header information that cannot be relied upon. The code below will analyze | |
| 245 | the first opcode executed at the specified reset vector to determine the probability | |
| 246 | that this is the correct header. Score is assigned accordingly. */ | |
| 247 | 247 | |
| 248 | 248 | /* most likely opcodes */ |
| 249 | 249 | if (reset_opcode == 0x78 //sei |
| r5932 | r5933 | |
| 290 | 290 | score -= 8; |
| 291 | 291 | |
| 292 | 292 | /* Sometimes, both the header and reset vector's first opcode will match ... |
| 293 | ||
| 293 | fallback and rely on info validity in these cases to determine more likely header. */ | |
| 294 | 294 | |
| 295 | 295 | /* a valid checksum is the biggest indicator of a valid header. */ |
| 296 | 296 | if ((checksum + ichecksum) == 0xffff && (checksum != 0) && (ichecksum != 0)) |
| r5932 | r5933 | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /* We need to take a sample to test what mode we need to be in (the |
| 385 | ||
| 385 | sample has to be quite large to cope with large carts in ExHiRom) */ | |
| 386 | 386 | image_fread(image, temp_buffer, 0x40ffff); |
| 387 | 387 | image_fseek(image, offset, SEEK_SET); /* Rewind */ |
| 388 | 388 | |
| r5932 | r5933 | |
| 427 | 427 | read_blocks = 0; |
| 428 | 428 | |
| 429 | 429 | /* Loading all the data blocks from cart, we only partially cover banks 0x00 to 0x7f. Therefore, we |
| 430 | * have to mirror the blocks until we reach the end. E.g. for a 11Mbits image (44 blocks), we proceed | |
| 431 | * as follows: | |
| 432 | * 11 Mbits = 8 Mbits (blocks 1->32) + 2 Mbits (blocks 33->40) + 1 Mbit (blocks 41->44). | |
| 433 | * Hence, we fill memory up to 16 Mbits (banks 0x00 to 0x3f) mirroring as follows | |
| 434 | * 8 Mbits (blocks 1->32) + 2 Mbits (blocks 33->40) + 1 Mbit (blocks 41->44) + 1 Mbit (blocks 41->44) | |
| 435 | * + 2 Mbits (blocks 33->40) + 1 Mbit (blocks 41->44) + 1 Mbit (blocks 41->44) | |
| 436 | * and we repeat the same blocks in the second half of the banks (banks 0x40 to 0x7f). | |
| 437 | * This is likely what happens in the real SNES as well, because the unit cannot be aware of the exact | |
| 438 | * size of data in the cart (procedure confirmed by byuu) | |
| 439 | */ | |
| 430 | * have to mirror the blocks until we reach the end. E.g. for a 11Mbits image (44 blocks), we proceed | |
| 431 | * as follows: | |
| 432 | * 11 Mbits = 8 Mbits (blocks 1->32) + 2 Mbits (blocks 33->40) + 1 Mbit (blocks 41->44). | |
| 433 | * Hence, we fill memory up to 16 Mbits (banks 0x00 to 0x3f) mirroring as follows | |
| 434 | * 8 Mbits (blocks 1->32) + 2 Mbits (blocks 33->40) + 1 Mbit (blocks 41->44) + 1 Mbit (blocks 41->44) | |
| 435 | * + 2 Mbits (blocks 33->40) + 1 Mbit (blocks 41->44) + 1 Mbit (blocks 41->44) | |
| 436 | * and we repeat the same blocks in the second half of the banks (banks 0x40 to 0x7f). | |
| 437 | * This is likely what happens in the real SNES as well, because the unit cannot be aware of the exact | |
| 438 | * size of data in the cart (procedure confirmed by byuu) | |
| 439 | */ | |
| 440 | 440 | switch (snes_cart.mode) |
| 441 | 441 | { |
| 442 | 442 | case SNES_MODE_21: |
| 443 | 443 | /* HiROM carts load data in banks 0xc0 to 0xff. Each bank is fully mirrored in banks 0x40 to 0x7f |
| 444 | * (actually up to 0x7d, because 0x7e and 0x7f are overwritten by WRAM). The top half (address | |
| 445 | * range 0x8000 - 0xffff) of each bank is also mirrored in banks 0x00 to 0x3f and 0x80 to 0xbf. | |
| 446 | */ | |
| 444 | * (actually up to 0x7d, because 0x7e and 0x7f are overwritten by WRAM). The top half (address | |
| 445 | * range 0x8000 - 0xffff) of each bank is also mirrored in banks 0x00 to 0x3f and 0x80 to 0xbf. | |
| 446 | */ | |
| 447 | 447 | while (read_blocks < 64 && read_blocks < total_blocks) |
| 448 | 448 | { |
| 449 | 449 | /* Loading data */ |
| r5932 | r5933 | |
| 472 | 472 | |
| 473 | 473 | case SNES_MODE_25: |
| 474 | 474 | /* Extendend HiROM carts start to load data in banks 0xc0 to 0xff. However, they exceed the |
| 475 | * available space in these banks, and continue loading at banks 0x40 to 0x7f. The top half | |
| 476 | * (address range 0x8000 - 0xffff) of each bank is also mirrored either to banks 0x00 to 0x3f | |
| 477 | * (for data in banks 0x40 to 0x7f) or to banks 0x80 to 0xbf (for data in banks 0xc0 to 0xff). | |
| 478 | * Notice that banks 0x7e and 0x7f are overwritten by WRAM, but they could contain data at | |
| 479 | * address > 0x8000 because the mirrors at 0x3e and 0x3f are not overwritten. | |
| 480 | */ | |
| 475 | * available space in these banks, and continue loading at banks 0x40 to 0x7f. The top half | |
| 476 | * (address range 0x8000 - 0xffff) of each bank is also mirrored either to banks 0x00 to 0x3f | |
| 477 | * (for data in banks 0x40 to 0x7f) or to banks 0x80 to 0xbf (for data in banks 0xc0 to 0xff). | |
| 478 | * Notice that banks 0x7e and 0x7f are overwritten by WRAM, but they could contain data at | |
| 479 | * address > 0x8000 because the mirrors at 0x3e and 0x3f are not overwritten. | |
| 480 | */ | |
| 481 | 481 | /* Reading the first 64 blocks */ |
| 482 | 482 | while (read_blocks < 64 && read_blocks < total_blocks) |
| 483 | 483 | { |
| r5932 | r5933 | |
| 522 | 522 | |
| 523 | 523 | case SNES_MODE_22: |
| 524 | 524 | /* "Extendend LoROM" carts have their data loaded in banks 0x00 to 0x3f at address 0x8000. |
| 525 | * These are then mirrored in banks 0x40 to 0x7f, both at address 0x0000 and at address | |
| 526 | * 0x8000, in banks 0x80 to 0xbf at address 0x8000 and in banks 0xc0 to 0xff, both at address | |
| 527 | * 0x0000 and at address 0x8000. Notice that SDD-1 games (Star Ocean and Street Fighter Zero 2) | |
| 528 | * use SNES_MODE_22 | |
| 529 | */ | |
| 525 | * These are then mirrored in banks 0x40 to 0x7f, both at address 0x0000 and at address | |
| 526 | * 0x8000, in banks 0x80 to 0xbf at address 0x8000 and in banks 0xc0 to 0xff, both at address | |
| 527 | * 0x0000 and at address 0x8000. Notice that SDD-1 games (Star Ocean and Street Fighter Zero 2) | |
| 528 | * use SNES_MODE_22 | |
| 529 | */ | |
| 530 | 530 | while (read_blocks < 64 && read_blocks < total_blocks) |
| 531 | 531 | { |
| 532 | 532 | /* Loading and mirroring data */ |
| r5932 | r5933 | |
| 555 | 555 | default: |
| 556 | 556 | case SNES_MODE_20: |
| 557 | 557 | /* LoROM carts load data in banks 0x00 to 0x7f at address 0x8000 (actually up to 0x7d, because 0x7e and |
| 558 | * 0x7f are overwritten by WRAM). Each block is also mirrored in banks 0x80 to 0xff (up to 0xff for real) | |
| 559 | */ | |
| 558 | * 0x7f are overwritten by WRAM). Each block is also mirrored in banks 0x80 to 0xff (up to 0xff for real) | |
| 559 | */ | |
| 560 | 560 | /* SuperFX games needs this different loading routine */ |
| 561 | 561 | if(((temp_buffer[0x007fd6] >= 0x13 && temp_buffer[0x007fd6] <= 0x15) || temp_buffer[0x007fd6] == 0x1a) && (temp_buffer[0x007fd5] == 0x20)) |
| 562 | 562 | { |
| r5932 | r5933 | |
| 700 | 700 | |
| 701 | 701 | case 0xf6: |
| 702 | 702 | /* These Seta ST-01X chips have both 0x30 at 0x00ffd5, |
| 703 | ||
| 703 | they only differ for the 'size' at 0x00ffd7 */ | |
| 704 | 704 | if (snes_r_bank1(space, 0x00ffd7) < 0x0a) |
| 705 | 705 | { |
| 706 | 706 | snes_has_addon_chip = HAS_ST011; |
| r5932 | r5933 | |
|---|---|---|
| 7 | 7 | TODO: Make a standard set of peripherals work. |
| 8 | 8 | TODO: Allow swappable peripherals in each slot. |
| 9 | 9 | TODO: Verify correctness of C08X switches. |
| 10 | ||
| 10 | - need to do double-read before write-enable RAM | |
| 11 | 11 | |
| 12 | 12 | ***************************************************************************/ |
| 13 | 13 | |
| r5932 | r5933 | |
| 569 | 569 | |
| 570 | 570 | void apple2_setvar(running_machine *machine, UINT32 val, UINT32 mask) |
| 571 | 571 | { |
| 572 | LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, | |
| 572 | LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, | |
| 573 | 573 | (unsigned int) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC))); |
| 574 | 574 | |
| 575 | 575 | assert((val & mask) == val); |
| r5932 | r5933 | |
| 796 | 796 | |
| 797 | 797 | |
| 798 | 798 | /*************************************************************************** |
| 799 | apple2_mainram0400_w | |
| 800 | apple2_mainram2000_w | |
| 801 | apple2_auxram0400_w | |
| 802 | apple2_auxram2000_w | |
| 799 | apple2_mainram0400_w | |
| 800 | apple2_mainram2000_w | |
| 801 | apple2_auxram0400_w | |
| 802 | apple2_auxram2000_w | |
| 803 | 803 | ***************************************************************************/ |
| 804 | 804 | |
| 805 | 805 | static WRITE8_HANDLER ( apple2_mainram0400_w ) |
| r5932 | r5933 | |
| 849 | 849 | /*************************************************************************** |
| 850 | 850 | apple2_c00x_w |
| 851 | 851 | |
| 852 | C000 80STOREOFF | |
| 853 | C001 80STOREON - use 80-column memory mapping | |
| 854 | C002 RAMRDOFF | |
| 855 | C003 RAMRDON - read from aux 48k | |
| 856 | C004 RAMWRTOFF | |
| 857 | C005 RAMWRTON - write to aux 48k | |
| 858 | C006 INTCXROMOFF | |
| 859 | C007 INTCXROMON | |
| 860 | C008 ALTZPOFF | |
| 861 | C009 ALTZPON - use aux ZP, stack and language card area | |
| 862 | C00A SLOTC3ROMOFF | |
| 863 | C00B SLOTC3ROMON - use external slot 3 ROM | |
| 864 | C00C 80COLOFF | |
| 865 | C00D 80COLON - use 80-column display mode | |
| 866 | C00E ALTCHARSETOFF | |
| 867 | C00F ALTCHARSETON - use alt character set | |
| 852 | C000 80STOREOFF | |
| 853 | C001 80STOREON - use 80-column memory mapping | |
| 854 | C002 RAMRDOFF | |
| 855 | C003 RAMRDON - read from aux 48k | |
| 856 | C004 RAMWRTOFF | |
| 857 | C005 RAMWRTON - write to aux 48k | |
| 858 | C006 INTCXROMOFF | |
| 859 | C007 INTCXROMON | |
| 860 | C008 ALTZPOFF | |
| 861 | C009 ALTZPON - use aux ZP, stack and language card area | |
| 862 | C00A SLOTC3ROMOFF | |
| 863 | C00B SLOTC3ROMON - use external slot 3 ROM | |
| 864 | C00C 80COLOFF | |
| 865 | C00D 80COLON - use 80-column display mode | |
| 866 | C00E ALTCHARSETOFF | |
| 867 | C00F ALTCHARSETON - use alt character set | |
| 868 | 868 | ***************************************************************************/ |
| 869 | 869 | |
| 870 | 870 | WRITE8_HANDLER ( apple2_c00x_w ) |
| r5932 | r5933 | |
| 1056 | 1056 | break; |
| 1057 | 1057 | default: |
| 1058 | 1058 | /* c060 Empty Cassette head read |
| 1059 | * and any other non joystick c06 port returns this according to applewin | |
| 1060 | */ | |
| 1059 | * and any other non joystick c06 port returns this according to applewin | |
| 1060 | */ | |
| 1061 | 1061 | return apple2_getfloatingbusvalue(space->machine); |
| 1062 | 1062 | } |
| 1063 | 1063 | return result ? 0x80 : 0x00; |
| r5932 | r5933 | |
| 1281 | 1281 | memset(mess_ram, 0, mess_ram_size); |
| 1282 | 1282 | |
| 1283 | 1283 | /* --------------------------------------------- * |
| 1284 | * set up the softswitch mask/set * | |
| 1285 | * --------------------------------------------- */ | |
| 1284 | * set up the softswitch mask/set * | |
| 1285 | * --------------------------------------------- */ | |
| 1286 | 1286 | a2_mask = ~0; |
| 1287 | 1287 | a2_set = 0; |
| 1288 | 1288 | |
| r5932 | r5933 | |
| 1302 | 1302 | void *apple2cp_ce00_ram = NULL; |
| 1303 | 1303 | |
| 1304 | 1304 | /* there appears to be some hidden RAM that is swapped in on the Apple |
| 1305 | * IIc plus; I have not found any official documentation but the BIOS | |
| 1306 | * clearly uses this area as writeable memory */ | |
| 1305 | * IIc plus; I have not found any official documentation but the BIOS | |
| 1306 | * clearly uses this area as writeable memory */ | |
| 1307 | 1307 | if (!strcmp(machine->gamedrv->name, "apple2cp")) |
| 1308 | 1308 | apple2cp_ce00_ram = auto_alloc_array(machine, UINT8, 0x200); |
| 1309 | 1309 |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | ERASE 1 |* \_/ | 40 | |
| 11 | EXTINTL 2 | | 39 DB4 | |
| 12 | MDRDWL 3 | | 38 DB5 | |
| 13 | 4 | | 37 DB0 | |
| 14 | BAUDX4 5 | | 36 DB1 | |
| 15 | NETOUT 6 | | 35 COMDATA | |
| 16 | 7 | | 34 MDSELDH | |
| 17 | DCSML 8 | | 33 MDSELCKH | |
| 18 | 9 | | 32 VSYNCH | |
| 19 | PCENL 10 | ZX8302 | 31 XTAL2 | |
| 20 | 11 | ULA | 30 XTAL1 | |
| 21 | DB2 12 | | 29 | |
| 22 | 13 | | 28 RESETOUTL | |
| 23 | 14 | | 27 DB7 | |
| 24 | A5 15 | | 26 IPL1L | |
| 25 | NETIN 16 | | 25 CLKCPU | |
| 26 | A1 17 | | 24 DB3 | |
| 27 | A0 18 | | 23 DB6 | |
| 28 | RAW2 19 | | 22 COMCTL | |
| 29 | RESETOUTL 20 |_____________| 21 RAW1 | |
| 9 | _____ _____ | |
| 10 | ERASE 1 |* \_/ | 40 | |
| 11 | EXTINTL 2 | | 39 DB4 | |
| 12 | MDRDWL 3 | | 38 DB5 | |
| 13 | 4 | | 37 DB0 | |
| 14 | BAUDX4 5 | | 36 DB1 | |
| 15 | NETOUT 6 | | 35 COMDATA | |
| 16 | 7 | | 34 MDSELDH | |
| 17 | DCSML 8 | | 33 MDSELCKH | |
| 18 | 9 | | 32 VSYNCH | |
| 19 | PCENL 10 | ZX8302 | 31 XTAL2 | |
| 20 | 11 | ULA | 30 XTAL1 | |
| 21 | DB2 12 | | 29 | |
| 22 | 13 | | 28 RESETOUTL | |
| 23 | 14 | | 27 DB7 | |
| 24 | A5 15 | | 26 IPL1L | |
| 25 | NETIN 16 | | 25 CLKCPU | |
| 26 | A1 17 | | 24 DB3 | |
| 27 | A0 18 | | 23 DB6 | |
| 28 | RAW2 19 | | 22 COMCTL | |
| 29 | RESETOUTL 20 |_____________| 21 RAW1 | |
| 30 | 30 | |
| 31 | 31 | **********************************************************************/ |
| 32 | 32 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | snescart.h | |
| 3 | 3 | |
| 4 | 4 | */ |
| 5 | 5 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | Hitachi HD63450 DMA Controller |
| 3 | 3 | |
| 4 | ||
| 4 | Largely based on documentation of the Sharp X68000 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "machine/hd63450.h" |
| r5932 | r5933 | |
| 130 | 130 | case 0x00: // CSR / CER |
| 131 | 131 | if(ACCESSING_BITS_8_15) |
| 132 | 132 | { |
| 133 | // dmac->reg[channel].csr = (data & 0xff00) >> 8; | |
| 134 | // logerror("DMA#%i: Channel status write : %02x\n",channel,dmac.reg[channel].csr); | |
| 133 | // dmac->reg[channel].csr = (data & 0xff00) >> 8; | |
| 134 | // logerror("DMA#%i: Channel status write : %02x\n",channel,dmac.reg[channel].csr); | |
| 135 | 135 | } |
| 136 | 136 | // CER is read-only, so no action needed there. |
| 137 | 137 | break; |
| r5932 | r5933 | |
| 353 | 353 | break; |
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | // | |
| 356 | // logerror("DMA#%i: byte transfer %08lx -> %08lx (byte = %02x)\n",x,dmac.reg[x].dar,dmac.reg[x].mar,data); | |
| 357 | 357 | } |
| 358 | 358 | else // memory -> device |
| 359 | 359 | { |
| r5932 | r5933 | |
| 391 | 391 | break; |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | // | |
| 394 | // logerror("DMA#%i: byte transfer %08lx -> %08lx\n",x,dmac->reg[x].mar,dmac->reg[x].dar); | |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 |
| r5932 | r5933 | |
|---|---|---|
| 5 | 5 | Machine file to handle emulation of the Sega Mega Drive & Genesis. |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 2008-09: Moved here cart code and custom mapper handlers. Hopefully, | |
| 9 | it will make painless the future merging with HazeMD | |
| 10 | 2008-10: Fixed SRAM, matching as much as possible HazeMD. Some game is | |
| 11 | not detected, however. E.g. Sonic 3. Also some games seem false | |
| 12 | positives (e.g. Wonderboy 5: according to its headers it should | |
| 13 | have 1byte of SRAM). Better detection routines would be welcome. | |
| 14 | 2009-06: Changed SRAM code, fixing more games, including Sonic 3. The | |
| 15 | false positives seem only some of the games using EEPROM. Todo | |
| 16 | list in mess/drivers/genesis.c includes EEPROM emulation. | |
| 8 | 2008-09: Moved here cart code and custom mapper handlers. Hopefully, | |
| 9 | it will make painless the future merging with HazeMD | |
| 10 | 2008-10: Fixed SRAM, matching as much as possible HazeMD. Some game is | |
| 11 | not detected, however. E.g. Sonic 3. Also some games seem false | |
| 12 | positives (e.g. Wonderboy 5: according to its headers it should | |
| 13 | have 1byte of SRAM). Better detection routines would be welcome. | |
| 14 | 2009-06: Changed SRAM code, fixing more games, including Sonic 3. The | |
| 15 | false positives seem only some of the games using EEPROM. Todo | |
| 16 | list in mess/drivers/genesis.c includes EEPROM emulation. | |
| 17 | 17 | |
| 18 | 18 | ***************************************************************************/ |
| 19 | 19 | |
| r5932 | r5933 | |
| 91 | 91 | static int lastoffset = -1,lastdata = -1; |
| 92 | 92 | UINT8 *ROM = memory_region(space->machine, "maincpu"); |
| 93 | 93 | |
| 94 | if ((lastoffset != offset) || (lastdata != data)) | |
| 94 | if ((lastoffset != offset) || (lastdata != data)) | |
| 95 | 95 | { |
| 96 | 96 | lastoffset = offset; lastdata = data; |
| 97 | 97 | switch (offset << 1) |
| 98 | 98 | { |
| 99 | 99 | case 0x00: /* write protect register // this is not a write protect, but seems to do nothing useful but reset bank0 after the checksum test (red screen otherwise) */ |
| 100 | if (data == 2) | |
| 100 | if (data == 2) | |
| 101 | 101 | { |
| 102 | 102 | memcpy(ROM + 0x000000, ROM + 0x400000 + (((data & 0xf) - 2) * 0x080000), 0x080000); |
| 103 | 103 | } |
| r5932 | r5933 | |
| 129 | 129 | |
| 130 | 130 | /*static WRITE16_HANDLER( g_l3alt_pdat_w ) |
| 131 | 131 | { |
| 132 | ||
| 132 | g_l3alt_pdat = data; | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | static WRITE16_HANDLER( g_l3alt_pcmd_w ) |
| 136 | 136 | { |
| 137 | ||
| 137 | g_l3alt_pcmd = data; | |
| 138 | 138 | } |
| 139 | 139 | */ |
| 140 | 140 | |
| r5932 | r5933 | |
| 180 | 180 | break; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | /* | |
| 183 | /* printf("%06x: g_l3alt_pdat_w %04x g_l3alt_pcmd_w %04x return %04x\n", activecpu_get_pc(), g_l3alt_pdat, g_l3alt_pcmd, retdata); */ | |
| 184 | 184 | |
| 185 | 185 | return retdata; |
| 186 | 186 | } |
| r5932 | r5933 | |
| 308 | 308 | UINT32 retdat; |
| 309 | 309 | |
| 310 | 310 | /* not 100% correct, there may be some relationship between the reads here |
| 311 | ||
| 311 | and the writes made at the start of the game.. */ | |
| 312 | 312 | |
| 313 | 313 | /* |
| 314 | 04dc10 chifi3, prot_r? 2800 | |
| 315 | 04cefa chifi3, prot_r? 65262 | |
| 316 | */ | |
| 314 | 04dc10 chifi3, prot_r? 2800 | |
| 315 | 04cefa chifi3, prot_r? 65262 | |
| 316 | */ | |
| 317 | 317 | |
| 318 | 318 | if (cpu_get_pc(space->cpu) == 0x01782) // makes 'VS' screen appear |
| 319 | 319 | { |
| r5932 | r5933 | |
| 623 | 623 | { |
| 624 | 624 | |
| 625 | 625 | /* unsure if this is actually supposed to toggle or just switch on? |
| 626 | * Yet to encounter game that utilizes | |
| 627 | */ | |
| 626 | * Yet to encounter game that utilizes | |
| 627 | */ | |
| 628 | 628 | genesis_sram_active = (data & 1) ? 1 : 0; |
| 629 | 629 | genesis_sram_readonly = (data & 2) ? 1 : 0; |
| 630 | 630 | |
| r5932 | r5933 | |
| 830 | 830 | |
| 831 | 831 | memcpy(&ROM[0x400000], &ROM[relocate], 0x80000); |
| 832 | 832 | |
| 833 | for (mirroraddr = 0; mirroraddr < 0x400000; mirroraddr += 0x2000) | |
| 833 | for (mirroraddr = 0; mirroraddr < 0x400000; mirroraddr += 0x2000) | |
| 834 | 834 | { |
| 835 | 835 | memcpy(ROM + mirroraddr, ROM + relocate + 0x7e000, 0x002000); /* copy last 8kb across the whole rom region */ |
| 836 | 836 | } |
| r5932 | r5933 | |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | /* Disable SRAM handlers if it's a game using EEPROM to save |
| 856 | ||
| 856 | progresses. Currently EEPROM is not emulated. */ | |
| 857 | 857 | if (!has_serial_eeprom) |
| 858 | 858 | { |
| 859 | 859 | /* Info from DGen: If SRAM does not overlap main ROM, set it active by |
| 860 | ||
| 860 | default since a few games can't manage to properly switch it on/off. */ | |
| 861 | 861 | if (genesis_last_loaded_image_length <= genesis_sram_start) |
| 862 | 862 | genesis_sram_active = 1; |
| 863 | 863 | |
| 864 | 864 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa130f0, 0xa130f1, 0, 0, genesis_sram_toggle); |
| 865 | 865 | |
| 866 | 866 | /* Sonic 1 included in Sonic Classics doesn't have SRAM and |
| 867 | does lots of ROM access at this range, then only install read/ | |
| 868 | write handlers if SRAM is active to not slow down emulation. */ | |
| 867 | does lots of ROM access at this range, then only install read/ | |
| 868 | write handlers if SRAM is active to not slow down emulation. */ | |
| 869 | 869 | if (genesis_sram_active) |
| 870 | 870 | install_sram_rw_handlers (machine); |
| 871 | 871 | } |
| r5932 | r5933 | |
| 1095 | 1095 | |
| 1096 | 1096 | /* Detect carts which need additional handlers */ |
| 1097 | 1097 | { |
| 1098 | static const unsigned char smouse_sig[] = { 0x4d, 0xf9, 0x00, 0x40, 0x00, 0x02 }, | |
| 1098 | static const unsigned char smouse_sig[] = { 0x4d, 0xf9, 0x00, 0x40, 0x00, 0x02 }, | |
| 1099 | 1099 | mjlover_sig[] = { 0x13, 0xf9, 0x00, 0x40, 0x00, 0x00 }, // move.b ($400000).l,($FFFF0C).l (partial) |
| 1100 | 1100 | squir_sig[] = { 0x26, 0x79, 0x00, 0xff, 0x00, 0xfa }, |
| 1101 | 1101 | bugsl_sig[] = { 0x20, 0x12, 0x13, 0xc0, 0x00, 0xff }, |
| r5932 | r5933 | |
| 1226 | 1226 | /* check if cart has battery save */ |
| 1227 | 1227 | |
| 1228 | 1228 | /* For games using SRAM, unfortunately there are ROMs without info |
| 1229 | about it in header. The solution adopted is do the mapping anyway, | |
| 1230 | then active SRAM later if the game will access it. */ | |
| 1231 | ||
| 1229 | about it in header. The solution adopted is do the mapping anyway, | |
| 1230 | then active SRAM later if the game will access it. */ | |
| 1231 | ||
| 1232 | 1232 | if (ROM[0x1b1] == 'R' && ROM[0x1b0] == 'A') |
| 1233 | 1233 | { |
| 1234 | 1234 | /* SRAM info found in header */ |
| r5932 | r5933 | |
| 1239 | 1239 | genesis_sram_end = genesis_sram_start + 0x0FFFF; |
| 1240 | 1240 | |
| 1241 | 1241 | /* for some games using serial EEPROM, difference between SRAM |
| 1242 | ||
| 1242 | end to start is 0 or 1. Currently EEPROM is not emulated. */ | |
| 1243 | 1243 | if ((genesis_sram_end - genesis_sram_start) < 2) |
| 1244 | 1244 | has_serial_eeprom = 1; |
| 1245 | 1245 | else |
| r5932 | r5933 | |
| 1262 | 1262 | megadriv_backupram = (UINT16*) (ROM + (genesis_sram_start & 0x3fffff)); |
| 1263 | 1263 | |
| 1264 | 1264 | /* Until serial EEPROM is emulated, clears one byte at beginning of |
| 1265 | backup RAM, but only if the value is 0xFFFF, to not break MLBPA Sports | |
| 1266 | Talk Baseball. With this hack some games at least run (NBA Jam, Evander | |
| 1267 | Holyfield's Real Deal Boxing, Greatest Heavyweights of the Ring) */ | |
| 1265 | backup RAM, but only if the value is 0xFFFF, to not break MLBPA Sports | |
| 1266 | Talk Baseball. With this hack some games at least run (NBA Jam, Evander | |
| 1267 | Holyfield's Real Deal Boxing, Greatest Heavyweights of the Ring) */ | |
| 1268 | 1268 | if (has_serial_eeprom && megadriv_backupram[0] == 0xffff) |
| 1269 | 1269 | megadriv_backupram[0] = 0xff00; |
| 1270 | 1270 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | SNUG HSGPL card emulation. | |
| 3 | 3 | |
| 4 | ||
| 4 | Raphael Nabet, 2003. | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| r5932 | r5933 | |
| 11 | 11 | #include "at29040.h" |
| 12 | 12 | |
| 13 | 13 | /* |
| 14 | Supports 16 banks of 8 GROMs (8kbytes each) with 16 associated banks of | |
| 15 | 32kbytes (8kbytes*4) of module ROM, 2 banks of 8 GRAMs with 2 associated | |
| 16 | banks of 32 kbytes of RAM, and 512kbytes of DSR. Roms are implemented with | |
| 17 | 512kbyte EEPROMs (1 for DSR, 2 for GROMs, 1 for cartridge ROM). RAM is | |
| 18 | implemented with 128kbyte SRAMs (1 for GRAM, 1 for cartridge RAM - only the | |
| 19 | first 64kbytes of the cartridge RAM chip is used). | |
| 14 | Supports 16 banks of 8 GROMs (8kbytes each) with 16 associated banks of | |
| 15 | 32kbytes (8kbytes*4) of module ROM, 2 banks of 8 GRAMs with 2 associated | |
| 16 | banks of 32 kbytes of RAM, and 512kbytes of DSR. Roms are implemented with | |
| 17 | 512kbyte EEPROMs (1 for DSR, 2 for GROMs, 1 for cartridge ROM). RAM is | |
| 18 | implemented with 128kbyte SRAMs (1 for GRAM, 1 for cartridge RAM - only the | |
| 19 | first 64kbytes of the cartridge RAM chip is used). | |
| 20 | 20 | |
| 21 | CRU bits: | |
| 22 | Name Equates Meaning | |
| 23 | >0 DEN DSRENA DSR Enable | |
| 24 | >1 GRMENA GRMENA Enable GRAM instead of GROM in banks 0 and 1 | |
| 25 | >2 BNKINH* BNKENA Disable banking | |
| 26 | >3 PG0 PG0 | |
| 27 | >4 PG1 PG1 | |
| 28 | >5 PG2 PG2 Paging-Bits for DSR-area | |
| 29 | >6 PG3 PG3 | |
| 30 | >7 PG4 PG4 | |
| 31 | >8 PG5 PG5 | |
| 32 | >9 CRDENA CRDENA Activate memory areas of HSGPL (i.e. enable HSGPL GROM and ROM6 ports) | |
| 33 | >A WRIENA WRIENA write enable for RAM and GRAM (and flash GROM!) | |
| 34 | >B SCENA SCARTE Activate SuperCart-banking | |
| 35 | >C LEDENA LEDENA light LED on | |
| 36 | >D - - free | |
| 37 | >E MBXENA MBXENA Activate MBX-Banking | |
| 38 | >F RAMENA RAMENA Enable RAM6000 instead of ROM6000 in banks 0 and 1 | |
| 21 | CRU bits: | |
| 22 | Name Equates Meaning | |
| 23 | >0 DEN DSRENA DSR Enable | |
| 24 | >1 GRMENA GRMENA Enable GRAM instead of GROM in banks 0 and 1 | |
| 25 | >2 BNKINH* BNKENA Disable banking | |
| 26 | >3 PG0 PG0 | |
| 27 | >4 PG1 PG1 | |
| 28 | >5 PG2 PG2 Paging-Bits for DSR-area | |
| 29 | >6 PG3 PG3 | |
| 30 | >7 PG4 PG4 | |
| 31 | >8 PG5 PG5 | |
| 32 | >9 CRDENA CRDENA Activate memory areas of HSGPL (i.e. enable HSGPL GROM and ROM6 ports) | |
| 33 | >A WRIENA WRIENA write enable for RAM and GRAM (and flash GROM!) | |
| 34 | >B SCENA SCARTE Activate SuperCart-banking | |
| 35 | >C LEDENA LEDENA light LED on | |
| 36 | >D - - free | |
| 37 | >E MBXENA MBXENA Activate MBX-Banking | |
| 38 | >F RAMENA RAMENA Enable RAM6000 instead of ROM6000 in banks 0 and 1 | |
| 39 | 39 | |
| 40 | 40 | |
| 41 | Direct access ports for all memory areas (the original manual gives | |
| 42 | >9880->989C and >9C80->9C9C for ROM6000, but this is incorrect): | |
| 41 | Direct access ports for all memory areas (the original manual gives | |
| 42 | >9880->989C and >9C80->9C9C for ROM6000, but this is incorrect): | |
| 43 | 43 | |
| 44 | Module bank Read Write Read ROM6000 Write ROM6000 | |
| 45 | GROM GROM | |
| 46 | 0 >9800 >9C00 >9860 Offset >0000 >9C60 Offset >0000 | |
| 47 | 1 >9804 >9C04 >9860 Offset >8000 >9C60 Offset >8000 | |
| 48 | 2 >9808 >9C08 >9864 Offset >0000 >9C64 Offset >0000 | |
| 49 | 3 >980C >9C0C >9864 Offset >8000 >9C64 Offset >8000 | |
| 50 | 4 >9810 >9C10 >9868 Offset >0000 >9C68 Offset >0000 | |
| 51 | 5 >9814 >9C14 >9868 Offset >8000 >9C68 Offset >8000 | |
| 52 | 6 >9818 >9C18 >986C Offset >0000 >9C6C Offset >0000 | |
| 53 | 7 >981C >9C1C >986C Offset >8000 >9C6C Offset >8000 | |
| 54 | 8 >9820 >9C20 >9870 Offset >0000 >9C70 Offset >0000 | |
| 55 | 9 >9824 >9C24 >9870 Offset >8000 >9C70 Offset >8000 | |
| 56 | 10 >9828 >9C28 >9874 Offset >0000 >9C74 Offset >0000 | |
| 57 | 11 >982C >9C2C >9874 Offset >8000 >9C74 Offset >8000 | |
| 58 | 12 >9830 >9C30 >9878 Offset >0000 >9C78 Offset >0000 | |
| 59 | 13 >9834 >9C34 >9878 Offset >8000 >9C78 Offset >8000 | |
| 60 | 14 >9838 >9C38 >987C Offset >0000 >9C7C Offset >0000 | |
| 61 | 15 >983C >9C3C >987C Offset >8000 >9C7C Offset >8000 | |
| 44 | Module bank Read Write Read ROM6000 Write ROM6000 | |
| 45 | GROM GROM | |
| 46 | 0 >9800 >9C00 >9860 Offset >0000 >9C60 Offset >0000 | |
| 47 | 1 >9804 >9C04 >9860 Offset >8000 >9C60 Offset >8000 | |
| 48 | 2 >9808 >9C08 >9864 Offset >0000 >9C64 Offset >0000 | |
| 49 | 3 >980C >9C0C >9864 Offset >8000 >9C64 Offset >8000 | |
| 50 | 4 >9810 >9C10 >9868 Offset >0000 >9C68 Offset >0000 | |
| 51 | 5 >9814 >9C14 >9868 Offset >8000 >9C68 Offset >8000 | |
| 52 | 6 >9818 >9C18 >986C Offset >0000 >9C6C Offset >0000 | |
| 53 | 7 >981C >9C1C >986C Offset >8000 >9C6C Offset >8000 | |
| 54 | 8 >9820 >9C20 >9870 Offset >0000 >9C70 Offset >0000 | |
| 55 | 9 >9824 >9C24 >9870 Offset >8000 >9C70 Offset >8000 | |
| 56 | 10 >9828 >9C28 >9874 Offset >0000 >9C74 Offset >0000 | |
| 57 | 11 >982C >9C2C >9874 Offset >8000 >9C74 Offset >8000 | |
| 58 | 12 >9830 >9C30 >9878 Offset >0000 >9C78 Offset >0000 | |
| 59 | 13 >9834 >9C34 >9878 Offset >8000 >9C78 Offset >8000 | |
| 60 | 14 >9838 >9C38 >987C Offset >0000 >9C7C Offset >0000 | |
| 61 | 15 >983C >9C3C >987C Offset >8000 >9C7C Offset >8000 | |
| 62 | 62 | |
| 63 | Module bank Read Write Read RAM6000 Write RAM6000 | |
| 64 | GRAM GRAM | |
| 65 | 16 (Ram) >9880 >9C80 >98C0 Offset >0000 >9CC0 Offset >0000 | |
| 66 | 17 (Ram) >9884 >9C84 >98C0 Offset >8000 >9CC0 Offset >8000 | |
| 63 | Module bank Read Write Read RAM6000 Write RAM6000 | |
| 64 | GRAM GRAM | |
| 65 | 16 (Ram) >9880 >9C80 >98C0 Offset >0000 >9CC0 Offset >0000 | |
| 66 | 17 (Ram) >9884 >9C84 >98C0 Offset >8000 >9CC0 Offset >8000 | |
| 67 | 67 | |
| 68 | DSR bank Read Write | |
| 69 | 0 - 7 >9840 >9C40 | |
| 70 | 8 - 15 >9844 >9C44 | |
| 71 | 16 - 23 >9848 >9C48 | |
| 72 | 24 - 31 >984C >9C4C | |
| 73 | 32 - 39 >9850 >9C50 | |
| 74 | 40 - 47 >9854 >9C54 | |
| 75 | 48 - 55 >9858 >9C58 | |
| 76 | 56 - 63 >985C >9C5C | |
| 68 | DSR bank Read Write | |
| 69 | 0 - 7 >9840 >9C40 | |
| 70 | 8 - 15 >9844 >9C44 | |
| 71 | 16 - 23 >9848 >9C48 | |
| 72 | 24 - 31 >984C >9C4C | |
| 73 | 32 - 39 >9850 >9C50 | |
| 74 | 40 - 47 >9854 >9C54 | |
| 75 | 48 - 55 >9858 >9C58 | |
| 76 | 56 - 63 >985C >9C5C | |
| 77 | 77 | |
| 78 | Note: Writing only works for areas set up as RAM. To write to the | |
| 79 | FEEPROMs, you must used the algorithm specified by their respective | |
| 80 | manufacturer. | |
| 78 | Note: Writing only works for areas set up as RAM. To write to the | |
| 79 | FEEPROMs, you must used the algorithm specified by their respective | |
| 80 | manufacturer. | |
| 81 | 81 | */ |
| 82 | 82 | |
| 83 | 83 | static struct |
| r5932 | r5933 | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /* |
| 254 | ||
| 254 | Initialize hsgpl card, set up handlers | |
| 255 | 255 | */ |
| 256 | 256 | void ti99_hsgpl_init(running_machine *machine) |
| 257 | 257 | { |
| r5932 | r5933 | |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /* |
| 273 | ||
| 273 | Reset hsgpl card | |
| 274 | 274 | */ |
| 275 | 275 | void ti99_hsgpl_reset(running_machine *machine) |
| 276 | 276 | { |
| r5932 | r5933 | |
| 287 | 287 | |
| 288 | 288 | |
| 289 | 289 | /* |
| 290 | ||
| 290 | Write hsgpl CRU interface | |
| 291 | 291 | */ |
| 292 | 292 | static void hsgpl_cru_w(running_machine *machine, int offset, int data) |
| 293 | 293 | { |
| r5932 | r5933 | |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /* |
| 306 | ||
| 306 | read a byte in hsgpl DSR space | |
| 307 | 307 | */ |
| 308 | 308 | static READ8_HANDLER(hsgpl_dsr_r) |
| 309 | 309 | { |
| r5932 | r5933 | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /* |
| 316 | ||
| 316 | GPL read | |
| 317 | 317 | */ |
| 318 | 318 | READ16_HANDLER ( ti99_hsgpl_gpl_r ) |
| 319 | 319 | { |
| r5932 | r5933 | |
| 341 | 341 | } |
| 342 | 342 | else |
| 343 | 343 | { /* read GPL data */ |
| 344 | //reply = (data_ptr ? ((int) data_ptr[hsgpl.addr]) : 0) << 8; | |
| 344 | //reply = (data_ptr ? ((int) data_ptr[hsgpl.addr]) : 0) << 8; /* read data */ | |
| 345 | 345 | |
| 346 | 346 | switch (port) |
| 347 | 347 | { |
| r5932 | r5933 | |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /* |
| 428 | ||
| 428 | GPL write | |
| 429 | 429 | */ |
| 430 | 430 | WRITE16_HANDLER ( ti99_hsgpl_gpl_w ) |
| 431 | 431 | { |
| r5932 | r5933 | |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | /* |
| 538 | ||
| 538 | Cartridge space read | |
| 539 | 539 | */ |
| 540 | 540 | READ16_HANDLER ( ti99_hsgpl_rom6_r ) |
| 541 | 541 | { |
| r5932 | r5933 | |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | /* |
| 589 | ||
| 589 | Cartridge space write | |
| 590 | 590 | */ |
| 591 | 591 | WRITE16_HANDLER ( ti99_hsgpl_rom6_w ) |
| 592 | 592 | { |
| r5932 | r5933 | |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | /* MBX: RAM in 0x6c00-0x6ffd (it is unclear whether the MBX RAM area is |
| 608 | enabled/disabled by the wriena bit). I guess RAM is unpaged, but it is | |
| 609 | not implemented */ | |
| 608 | enabled/disabled by the wriena bit). I guess RAM is unpaged, but it is | |
| 609 | not implemented */ | |
| 610 | 610 | if ((hsgpl.cru_reg & cr_wriena) || ((hsgpl.cru_reg & cr_mbxena) && (offset >= 0x0600) && (offset <= 0x07fe))) |
| 611 | 611 | { |
| 612 | 612 | switch (port) |
| r5932 | r5933 | |
| 636 | 636 | case 14: |
| 637 | 637 | case 15: |
| 638 | 638 | /* feeprom is normally written to using GPL ports, and I don't know |
| 639 | ||
| 639 | writing through >6000 page is enabled */ | |
| 640 | 640 | /*at29c040a_w(feeprom_rom6, 1 + 2*offset + 0x2000*hsgpl.cur_bank + 0x8000*port, data); |
| 641 | ||
| 641 | at29c040a_w(feeprom_rom6, 2*offset + 0x2000*hsgpl.cur_bank + 0x8000*port, data >> 8);*/ | |
| 642 | 642 | break; |
| 643 | 643 | |
| 644 | 644 | case 32: |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | machine/pc.c | |
| 4 | 4 | |
| 5 | Functions to emulate general aspects of the machine | |
| 6 | (RAM, ROM, interrupts, I/O ports) | |
| 5 | Functions to emulate general aspects of the machine | |
| 6 | (RAM, ROM, interrupts, I/O ports) | |
| 7 | 7 | |
| 8 | The information herein is heavily based on | |
| 9 | 'Ralph Browns Interrupt List' | |
| 10 | Release 52, Last Change 20oct96 | |
| 8 | The information herein is heavily based on | |
| 9 | 'Ralph Browns Interrupt List' | |
| 10 | Release 52, Last Change 20oct96 | |
| 11 | 11 | |
| 12 | 12 | ***************************************************************************/ |
| 13 | 13 | |
| r5932 | r5933 | |
| 629 | 629 | if (pc_ppi.keyboard_clear) |
| 630 | 630 | { |
| 631 | 631 | /* 0 0 - no floppy drives |
| 632 | * 1 Not used | |
| 633 | * 2-3 The number of memory banks on the system board | |
| 634 | * 4-5 Display mode | |
| 635 | * 11 = monochrome | |
| 636 | * 10 - color 80x25 | |
| 637 | * 01 - color 40x25 | |
| 638 | * 6-7 The number of floppy disk drives | |
| 639 | */ | |
| 632 | * 1 Not used | |
| 633 | * 2-3 The number of memory banks on the system board | |
| 634 | * 4-5 Display mode | |
| 635 | * 11 = monochrome | |
| 636 | * 10 - color 80x25 | |
| 637 | * 01 - color 40x25 | |
| 638 | * 6-7 The number of floppy disk drives | |
| 639 | */ | |
| 640 | 640 | data = input_port_read(device->machine, "DSW0") & 0xF3; |
| 641 | 641 | switch ( mess_ram_size ) |
| 642 | 642 | { |
| r5932 | r5933 | |
| 856 | 856 | if (pc_ppi.keyboard_clear) |
| 857 | 857 | { |
| 858 | 858 | /* 0 0 - no floppy drives |
| 859 | * 1 Not used | |
| 860 | * 2-3 The number of memory banks on the system board | |
| 861 | * 4-5 Display mode | |
| 862 | * 11 = monochrome | |
| 863 | * 10 - color 80x25 | |
| 864 | * 01 - color 40x25 | |
| 865 | * 6-7 The number of floppy disk drives | |
| 866 | */ | |
| 859 | * 1 Not used | |
| 860 | * 2-3 The number of memory banks on the system board | |
| 861 | * 4-5 Display mode | |
| 862 | * 11 = monochrome | |
| 863 | * 10 - color 80x25 | |
| 864 | * 01 - color 40x25 | |
| 865 | * 6-7 The number of floppy disk drives | |
| 866 | */ | |
| 867 | 867 | data = input_port_read(device->machine, "DSW0"); |
| 868 | 868 | } |
| 869 | 869 | else |
| r5932 | r5933 | |
| 884 | 884 | data&=~0x80; // no parity error |
| 885 | 885 | data&=~0x40; // no error on expansion board |
| 886 | 886 | /* KB port C: equipment flags */ |
| 887 | // | |
| 887 | // if (pc_port[0x61] & 0x08) | |
| 888 | 888 | if (pc_ppi.portc_switch_high) |
| 889 | 889 | { |
| 890 | 890 | /* read hi nibble of S2 */ |
| r5932 | r5933 | |
| 951 | 951 | if (pc_ppi.keyboard_clear) |
| 952 | 952 | { |
| 953 | 953 | /* 0 0 - no floppy drives |
| 954 | * 1 Not used | |
| 955 | * 2-3 The number of memory banks on the system board | |
| 956 | * 4-5 Display mode | |
| 957 | * 11 = monochrome | |
| 958 | * 10 - color 80x25 | |
| 959 | * 01 - color 40x25 | |
| 960 | * 6-7 The number of floppy disk drives | |
| 961 | */ | |
| 954 | * 1 Not used | |
| 955 | * 2-3 The number of memory banks on the system board | |
| 956 | * 4-5 Display mode | |
| 957 | * 11 = monochrome | |
| 958 | * 10 - color 80x25 | |
| 959 | * 01 - color 40x25 | |
| 960 | * 6-7 The number of floppy disk drives | |
| 961 | */ | |
| 962 | 962 | data = input_port_read(device->machine, "DSW0"); |
| 963 | 963 | } |
| 964 | 964 | else |
| r5932 | r5933 | |
| 1206 | 1206 | gfx[i] = i; |
| 1207 | 1207 | |
| 1208 | 1208 | /* |
| 1209 | fix century rom bios bug ! | |
| 1210 | if year <79 month (and not CENTURY) is loaded with 0x20 | |
| 1211 | */ | |
| 1209 | fix century rom bios bug ! | |
| 1210 | if year <79 month (and not CENTURY) is loaded with 0x20 | |
| 1211 | */ | |
| 1212 | 1212 | if (rom[0xff93e]==0xb6){ // mov dh, |
| 1213 | 1213 | UINT8 a; |
| 1214 | 1214 | rom[0xff93e]=0xb5; // mov ch, |
| r5932 | r5933 | |
| 1219 | 1219 | mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); |
| 1220 | 1220 | |
| 1221 | 1221 | europc_rtc_init(machine); |
| 1222 | // | |
| 1222 | // europc_rtc_set_time(machine); | |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | 1225 | DRIVER_INIT( t1000hx ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | Hitachi HD63450 DMA Controller | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | #include "driver.h" |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | #include "sound/cdp1869.h" |
| 12 | 12 | #include "devices/cassette.h" |
| 13 | 13 | #include "includes/pecom.h" |
| 14 | ||
| 14 | ||
| 15 | 15 | static UINT8 pecom_caps_state = 4; |
| 16 | 16 | static UINT8 pecom_prev_caps_state = 4; |
| 17 | 17 | |
| r5932 | r5933 | |
| 38 | 38 | { |
| 39 | 39 | UINT8 *rom = memory_region(machine, "maincpu"); |
| 40 | 40 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 41 | ||
| 41 | ||
| 42 | 42 | pecom_state *state = machine->driver_data; |
| 43 | ||
| 43 | ||
| 44 | 44 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 45 | 45 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK(2)); |
| 46 | 46 | memory_install_write8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_UNMAP); |
| 47 | 47 | memory_install_write8_handler(space, 0xf800, 0xffff, 0, 0, SMH_UNMAP); |
| 48 | 48 | memory_install_read8_handler (space, 0xf000, 0xf7ff, 0, 0, SMH_BANK(3)); |
| 49 | 49 | memory_install_read8_handler (space, 0xf800, 0xffff, 0, 0, SMH_BANK(4)); |
| 50 | memory_set_bankptr(machine, 1, rom + 0x8000); | |
| 50 | memory_set_bankptr(machine, 1, rom + 0x8000); | |
| 51 | 51 | memory_set_bankptr(machine, 2, mess_ram + 0x4000); |
| 52 | 52 | memory_set_bankptr(machine, 3, rom + 0xf000); |
| 53 | 53 | memory_set_bankptr(machine, 4, rom + 0xf800); |
| 54 | ||
| 54 | ||
| 55 | 55 | pecom_caps_state = 4; |
| 56 | 56 | pecom_prev_caps_state = 4; |
| 57 | 57 | |
| r5932 | r5933 | |
| 67 | 67 | UINT8 *rom = memory_region(space->machine, "maincpu"); |
| 68 | 68 | memory_install_write8_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| 69 | 69 | memory_set_bankptr(space->machine, 1, mess_ram + 0x0000); |
| 70 | ||
| 71 | if (data==2) | |
| 70 | ||
| 71 | if (data==2) | |
| 72 | 72 | { |
| 73 | 73 | memory_install_read8_device_handler (space2, cdp1869, 0xf000, 0xf7ff, 0, 0, cdp1869_charram_r); |
| 74 | 74 | memory_install_write8_device_handler(space2, cdp1869, 0xf000, 0xf7ff, 0, 0, cdp1869_charram_w); |
| 75 | 75 | memory_install_read8_device_handler (space2, cdp1869, 0xf800, 0xffff, 0, 0, cdp1869_pageram_r); |
| 76 | memory_install_write8_device_handler(space2, cdp1869, 0xf800, 0xffff, 0, 0, cdp1869_pageram_w); | |
| 77 | } | |
| 78 | else | |
| 76 | memory_install_write8_device_handler(space2, cdp1869, 0xf800, 0xffff, 0, 0, cdp1869_pageram_w); | |
| 77 | } | |
| 78 | else | |
| 79 | 79 | { |
| 80 | 80 | memory_install_write8_handler(space2, 0xf000, 0xf7ff, 0, 0, SMH_UNMAP); |
| 81 | 81 | memory_install_write8_handler(space2, 0xf800, 0xffff, 0, 0, SMH_UNMAP); |
| r5932 | r5933 | |
| 91 | 91 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", |
| 92 | 92 | "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15", "LINE16", |
| 93 | 93 | "LINE17", "LINE18", "LINE19", "LINE20", "LINE21", "LINE22", "LINE23", "LINE24","LINE25" }; |
| 94 | /* | |
| 95 | INP command BUS -> M(R(X)) BUS -> D | |
| 96 | so on each input, address is also set, 8 lower bits are used as input for keyboard | |
| 97 | Address is available on address bus during reading of value from port, and that is | |
| 98 | used to determine keyboard line reading | |
| 99 | */ | |
| 94 | /* | |
| 95 | INP command BUS -> M(R(X)) BUS -> D | |
| 96 | so on each input, address is also set, 8 lower bits are used as input for keyboard | |
| 97 | Address is available on address bus during reading of value from port, and that is | |
| 98 | used to determine keyboard line reading | |
| 99 | */ | |
| 100 | 100 | UINT16 addr = cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), CDP1802_R0 + cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), CDP1802_X)); |
| 101 | 101 | /* just in case somone is reading non existing ports */ |
| 102 | if (addr<0x7cca || addr>0x7ce3) return 0; | |
| 102 | if (addr<0x7cca || addr>0x7ce3) return 0; | |
| 103 | 103 | return input_port_read(space->machine, keynames[addr - 0x7cca]) & 0x03; |
| 104 | 104 | } |
| 105 | 105 | |
| r5932 | r5933 | |
| 108 | 108 | { |
| 109 | 109 | pecom_state *state = device->machine->driver_data; |
| 110 | 110 | |
| 111 | return state->cdp1802_mode; | |
| 111 | return state->cdp1802_mode; | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | static const device_config *cassette_device_image(running_machine *machine) |
| r5932 | r5933 | |
| 121 | 121 | int flags = 0x0f; |
| 122 | 122 | double valcas = cassette_input(cassette_device_image(device->machine)); |
| 123 | 123 | UINT8 val = input_port_read(device->machine, "CNT"); |
| 124 | ||
| 125 | if ((val & 0x04)==0x04 && pecom_prev_caps_state==0) | |
| 124 | ||
| 125 | if ((val & 0x04)==0x04 && pecom_prev_caps_state==0) | |
| 126 | 126 | { |
| 127 | 127 | pecom_caps_state = (pecom_caps_state==4) ? 0 : 4; // Change CAPS state |
| 128 | 128 | } |
| 129 | 129 | pecom_prev_caps_state = val & 0x04; |
| 130 | if (valcas!=0.0) | |
| 130 | if (valcas!=0.0) | |
| 131 | 131 | { // If there is any cassette signal |
| 132 | 132 | val = (val & 0x0D); // remove EF2 from SHIFT |
| 133 | 133 | flags -= EF2; |
| 134 | 134 | if ( valcas > 0.00) flags += EF2; |
| 135 | } | |
| 135 | } | |
| 136 | 136 | flags -= (val & 0x0b) + pecom_caps_state; |
| 137 | 137 | return flags; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | static WRITE_LINE_DEVICE_HANDLER( pecom64_q_w ) |
| 141 | { | |
| 141 | { | |
| 142 | 142 | cassette_output(cassette_device_image(device->machine), state ? -1.0 : +1.0); |
| 143 | 143 | } |
| 144 | 144 | |
| r5932 | r5933 | |
| 152 | 152 | |
| 153 | 153 | case CDP1802_STATE_CODE_S1_EXECUTE: |
| 154 | 154 | break; |
| 155 | ||
| 155 | ||
| 156 | 156 | case CDP1802_STATE_CODE_S2_DMA: |
| 157 | 157 | // DMA acknowledge clears the DMAOUT request |
| 158 | 158 | cputag_set_input_line(device->machine, "maincpu", CDP1802_INPUT_LINE_DMAOUT, CLEAR_LINE); |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | ||
| 12 | TODO: | |
| 13 | 11 | |
| 14 | ||
| 12 | ||
| 15 | 13 | |
| 14 | - more accurate emulation of real chip | |
| 15 | ||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | #include "driver.h" |
| r5932 | r5933 | |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | ||
| 108 | ||
| 109 | 109 | if (!ako) |
| 110 | 110 | { |
| 111 | 111 | ay3600->b = -1; |
| r5932 | r5933 | |
|---|---|---|
| 97 | 97 | static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback ); |
| 98 | 98 | |
| 99 | 99 | |
| 100 | static WRITE8_HANDLER( pce_sf2_banking_w ) | |
| 100 | static WRITE8_HANDLER( pce_sf2_banking_w ) | |
| 101 | 101 | { |
| 102 | 102 | memory_set_bankptr( space->machine, 2, memory_region(space->machine, "user1") + offset * 0x080000 + 0x080000 ); |
| 103 | 103 | memory_set_bankptr( space->machine, 3, memory_region(space->machine, "user1") + offset * 0x080000 + 0x088000 ); |
| 104 | 104 | memory_set_bankptr( space->machine, 4, memory_region(space->machine, "user1") + offset * 0x080000 + 0x0D0000 ); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | static WRITE8_HANDLER( pce_cartridge_ram_w ) | |
| 107 | static WRITE8_HANDLER( pce_cartridge_ram_w ) | |
| 108 | 108 | { |
| 109 | 109 | cartridge_ram[ offset ] = data; |
| 110 | 110 | } |
| r5932 | r5933 | |
| 196 | 196 | memory_set_bankptr( image->machine, 4, ROM + 0x0D0000 ); |
| 197 | 197 | |
| 198 | 198 | /* Check for Street fighter 2 */ |
| 199 | if ( size == PCE_ROM_MAXSIZE ) | |
| 199 | if ( size == PCE_ROM_MAXSIZE ) | |
| 200 | 200 | { |
| 201 | 201 | memory_install_write8_handler(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x01ff0, 0x01ff3, 0, 0, pce_sf2_banking_w ); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /* Check for Populous */ |
| 205 | if ( ! memcmp( ROM + 0x1F26, "POPULOUS", 8 ) ) | |
| 205 | if ( ! memcmp( ROM + 0x1F26, "POPULOUS", 8 ) ) | |
| 206 | 206 | { |
| 207 | 207 | cartridge_ram = auto_alloc_array(image->machine, UINT8, 0x8000 ); |
| 208 | 208 | memory_set_bankptr( image->machine, 2, cartridge_ram ); |
| r5932 | r5933 | |
| 211 | 211 | |
| 212 | 212 | /* Check for CD system card */ |
| 213 | 213 | pce_sys3_card = 0; |
| 214 | if ( ! memcmp( ROM + 0x3FFB6, "PC Engine CD-ROM SYSTEM", 23 ) ) | |
| 214 | if ( ! memcmp( ROM + 0x3FFB6, "PC Engine CD-ROM SYSTEM", 23 ) ) | |
| 215 | 215 | { |
| 216 | 216 | /* Check if 192KB additional system card ram should be used */ |
| 217 | if ( ! memcmp( ROM + 0x29D1, "VER. 3.", 7 ) || ! memcmp( ROM + 0x29C4, "VER. 3.", 7 ) ) | |
| 217 | if ( ! memcmp( ROM + 0x29D1, "VER. 3.", 7 ) || ! memcmp( ROM + 0x29C4, "VER. 3.", 7 ) ) | |
| 218 | 218 | { |
| 219 | 219 | pce_sys3_card = 1; |
| 220 | 220 | cartridge_ram = auto_alloc_array(image->machine, UINT8, 0x30000 ); |
| r5932 | r5933 | |
| 225 | 225 | return 0; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | DRIVER_INIT( pce ) | |
| 228 | DRIVER_INIT( pce ) | |
| 229 | 229 | { |
| 230 | 230 | pce.io_port_options = PCE_JOY_SIG | CONST_SIG; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | DRIVER_INIT( tg16 ) | |
| 233 | DRIVER_INIT( tg16 ) | |
| 234 | 234 | { |
| 235 | 235 | pce.io_port_options = TG_16_JOY_SIG | CONST_SIG; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | DRIVER_INIT( sgx ) | |
| 238 | DRIVER_INIT( sgx ) | |
| 239 | 239 | { |
| 240 | 240 | pce.io_port_options = PCE_JOY_SIG | CONST_SIG; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | MACHINE_RESET( pce ) | |
| 243 | MACHINE_RESET( pce ) | |
| 244 | 244 | { |
| 245 | 245 | pce_cd_init( machine ); |
| 246 | 246 | } |
| r5932 | r5933 | |
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | static void pce_set_cd_bram( running_machine *machine ) | |
| 294 | static void pce_set_cd_bram( running_machine *machine ) | |
| 295 | 295 | { |
| 296 | 296 | memory_set_bankptr( machine, 10, pce_cd.bram + ( pce_cd.bram_locked ? PCE_BRAM_SIZE : 0 ) ); |
| 297 | 297 | } |
| r5932 | r5933 | |
| 304 | 304 | static void pce_cd_msm5205_int(const device_config *device) |
| 305 | 305 | { |
| 306 | 306 | pce_cd.adpcm_clock_count = ( pce_cd.adpcm_clock_count + 1 ) % pce_cd.adpcm_clock_divider; |
| 307 | if ( ! pce_cd.adpcm_clock_count ) | |
| 307 | if ( ! pce_cd.adpcm_clock_count ) | |
| 308 | 308 | { |
| 309 | 309 | /* Supply new ADPCM data */ |
| 310 | } | |
| 311 | else | |
| 310 | } | |
| 311 | else | |
| 312 | 312 | { |
| 313 | 313 | /* Make sure the sample does not change */ |
| 314 | 314 | } |
| r5932 | r5933 | |
| 317 | 317 | #define SCSI_STATUS_OK 0x00 |
| 318 | 318 | #define SCSI_CHECK_CONDITION 0x02 |
| 319 | 319 | |
| 320 | static void pce_cd_reply_status_byte( UINT8 status ) | |
| 320 | static void pce_cd_reply_status_byte( UINT8 status ) | |
| 321 | 321 | { |
| 322 | 322 | logerror("Setting CD in reply_status_byte\n"); |
| 323 | 323 | pce_cd.scsi_CD = pce_cd.scsi_IO = pce_cd.scsi_REQ = 1; |
| r5932 | r5933 | |
| 325 | 325 | pce_cd.message_after_status = 1; |
| 326 | 326 | pce_cd.status_sent = pce_cd.message_sent = 0; |
| 327 | 327 | |
| 328 | if ( status == SCSI_STATUS_OK ) | |
| 328 | if ( status == SCSI_STATUS_OK ) | |
| 329 | 329 | { |
| 330 | 330 | pce_cd.regs[0x01] = 0x00; |
| 331 | } | |
| 332 | else | |
| 331 | } | |
| 332 | else | |
| 333 | 333 | { |
| 334 | 334 | pce_cd.regs[0x01] = 0x01; |
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /* 0x00 - TEST UNIT READY */ |
| 339 | static void pce_cd_test_unit_ready( running_machine *machine ) | |
| 339 | static void pce_cd_test_unit_ready( running_machine *machine ) | |
| 340 | 340 | { |
| 341 | 341 | logerror("test unit ready\n"); |
| 342 | if ( pce_cd.cd ) | |
| 342 | if ( pce_cd.cd ) | |
| 343 | 343 | { |
| 344 | 344 | logerror( "Sending STATUS_OK status\n" ); |
| 345 | 345 | pce_cd_reply_status_byte( SCSI_STATUS_OK ); |
| 346 | } | |
| 347 | else | |
| 346 | } | |
| 347 | else | |
| 348 | 348 | { |
| 349 | 349 | logerror( "Sending CHECK_CONDITION status\n" ); |
| 350 | 350 | pce_cd_reply_status_byte( SCSI_CHECK_CONDITION ); |
| r5932 | r5933 | |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /* 0x08 - READ (6) */ |
| 355 | static void pce_cd_read_6( running_machine *machine ) | |
| 355 | static void pce_cd_read_6( running_machine *machine ) | |
| 356 | 356 | { |
| 357 | 357 | UINT32 frame = ( ( pce_cd.command_buffer[1] & 0x1F ) << 16 ) | ( pce_cd.command_buffer[2] << 8 ) | pce_cd.command_buffer[3]; |
| 358 | 358 | UINT32 frame_count = pce_cd.command_buffer[4]; |
| 359 | 359 | |
| 360 | 360 | /* Check for presence of a CD */ |
| 361 | if ( ! pce_cd.cd ) | |
| 361 | if ( ! pce_cd.cd ) | |
| 362 | 362 | { |
| 363 | 363 | pce_cd_reply_status_byte( SCSI_CHECK_CONDITION ); |
| 364 | 364 | return; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | if ( pce_cd.cdda_status != PCE_CD_CDDA_OFF ) | |
| 367 | if ( pce_cd.cdda_status != PCE_CD_CDDA_OFF ) | |
| 368 | 368 | { |
| 369 | 369 | pce_cd.cdda_status = PCE_CD_CDDA_OFF; |
| 370 | 370 | cdda_stop_audio( devtag_get_device( machine, "cdda" ) ); |
| r5932 | r5933 | |
| 373 | 373 | pce_cd.current_frame = frame; |
| 374 | 374 | pce_cd.end_frame = frame + frame_count; |
| 375 | 375 | |
| 376 | if ( frame_count == 0 ) | |
| 376 | if ( frame_count == 0 ) | |
| 377 | 377 | { |
| 378 | 378 | pce_cd_reply_status_byte( SCSI_STATUS_OK ); |
| 379 | } | |
| 380 | else | |
| 379 | } | |
| 380 | else | |
| 381 | 381 | { |
| 382 | 382 | timer_adjust_periodic(pce_cd.data_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND )); |
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /* 0xD8 - SET AUDIO PLAYBACK START POSITION (NEC) */ |
| 387 | static void pce_cd_nec_set_audio_start_position( running_machine *machine ) | |
| 387 | static void pce_cd_nec_set_audio_start_position( running_machine *machine ) | |
| 388 | 388 | { |
| 389 | 389 | UINT32 frame = 0; |
| 390 | 390 | |
| 391 | if ( ! pce_cd.cd ) | |
| 391 | if ( ! pce_cd.cd ) | |
| 392 | 392 | { |
| 393 | 393 | /* Throw some error here */ |
| 394 | 394 | pce_cd_reply_status_byte( SCSI_CHECK_CONDITION ); |
| 395 | 395 | return; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | switch( pce_cd.command_buffer[9] & 0xC0 ) | |
| 398 | switch( pce_cd.command_buffer[9] & 0xC0 ) | |
| 399 | 399 | { |
| 400 | 400 | case 0x00: |
| 401 | 401 | frame = ( pce_cd.command_buffer[3] << 16 ) | ( pce_cd.command_buffer[4] << 8 ) | pce_cd.command_buffer[5]; |
| r5932 | r5933 | |
| 413 | 413 | |
| 414 | 414 | pce_cd.current_frame = frame; |
| 415 | 415 | pce_cd.cdda_play_mode = pce_cd.command_buffer[1]; |
| 416 | if ( pce_cd.cdda_play_mode ) | |
| 416 | if ( pce_cd.cdda_play_mode ) | |
| 417 | 417 | { |
| 418 | 418 | pce_cd.cdda_status = PCE_CD_CDDA_PLAYING; |
| 419 | 419 | cdda_start_audio( devtag_get_device( machine, "cdda" ), pce_cd.current_frame, pce_cd.end_frame - pce_cd.current_frame ); |
| 420 | } | |
| 421 | else | |
| 420 | } | |
| 421 | else | |
| 422 | 422 | { |
| 423 | 423 | pce_cd.cdda_status = PCE_CD_CDDA_OFF; |
| 424 | 424 | cdda_stop_audio( devtag_get_device( machine, "cdda" ) ); |
| r5932 | r5933 | |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | /* 0xD9 - SET AUDIO PLAYBACK END POSITION (NEC) */ |
| 433 | static void pce_cd_nec_set_audio_stop_position( running_machine *machine ) | |
| 433 | static void pce_cd_nec_set_audio_stop_position( running_machine *machine ) | |
| 434 | 434 | { |
| 435 | 435 | UINT32 frame = 0; |
| 436 | 436 | |
| 437 | if ( ! pce_cd.cd ) | |
| 437 | if ( ! pce_cd.cd ) | |
| 438 | 438 | { |
| 439 | 439 | /* Throw some error here */ |
| 440 | 440 | pce_cd_reply_status_byte( SCSI_CHECK_CONDITION ); |
| 441 | 441 | return; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | switch( pce_cd.command_buffer[9] & 0xC0 ) | |
| 444 | switch( pce_cd.command_buffer[9] & 0xC0 ) | |
| 445 | 445 | { |
| 446 | 446 | case 0x00: |
| 447 | 447 | frame = ( pce_cd.command_buffer[3] << 16 ) | ( pce_cd.command_buffer[4] << 8 ) | pce_cd.command_buffer[5]; |
| r5932 | r5933 | |
| 459 | 459 | |
| 460 | 460 | pce_cd.end_frame = frame; |
| 461 | 461 | pce_cd.cdda_play_mode = pce_cd.command_buffer[1]; |
| 462 | if ( pce_cd.cdda_play_mode ) | |
| 462 | if ( pce_cd.cdda_play_mode ) | |
| 463 | 463 | { |
| 464 | if ( pce_cd.cdda_status == PCE_CD_CDDA_PAUSED ) | |
| 464 | if ( pce_cd.cdda_status == PCE_CD_CDDA_PAUSED ) | |
| 465 | 465 | { |
| 466 | 466 | cdda_pause_audio( devtag_get_device( machine, "cdda" ), 0 ); |
| 467 | } | |
| 468 | else | |
| 467 | } | |
| 468 | else | |
| 469 | 469 | { |
| 470 | 470 | cdda_start_audio( devtag_get_device( machine, "cdda" ), pce_cd.current_frame, pce_cd.end_frame - pce_cd.current_frame ); |
| 471 | 471 | } |
| 472 | 472 | pce_cd.cdda_status = PCE_CD_CDDA_PLAYING; |
| 473 | } | |
| 474 | else | |
| 473 | } | |
| 474 | else | |
| 475 | 475 | { |
| 476 | 476 | pce_cd.cdda_status = PCE_CD_CDDA_OFF; |
| 477 | 477 | cdda_stop_audio( devtag_get_device( machine, "cdda" ) ); |
| r5932 | r5933 | |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /* 0xDA - PAUSE (NEC) */ |
| 487 | static void pce_cd_nec_pause( running_machine *machine ) | |
| 487 | static void pce_cd_nec_pause( running_machine *machine ) | |
| 488 | 488 | { |
| 489 | 489 | |
| 490 | 490 | /* If no cd mounted throw an error */ |
| 491 | if ( ! pce_cd.cd ) | |
| 491 | if ( ! pce_cd.cd ) | |
| 492 | 492 | { |
| 493 | 493 | pce_cd_reply_status_byte( SCSI_CHECK_CONDITION ); |
| 494 | 494 | return; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | /* If there was no cdda playing, throw an error */ |
| 498 | if ( pce_cd.cdda_status == PCE_CD_CDDA_OFF ) | |
| 498 | if ( pce_cd.cdda_status == PCE_CD_CDDA_OFF ) | |
| 499 | 499 | { |
| 500 | 500 | pce_cd_reply_status_byte( SCSI_CHECK_CONDITION ); |
| 501 | 501 | return; |
| r5932 | r5933 | |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | /* 0xDD - READ SUBCHANNEL Q (NEC) */ |
| 511 | static void pce_cd_nec_get_subq( running_machine *machine ) | |
| 511 | static void pce_cd_nec_get_subq( running_machine *machine ) | |
| 512 | 512 | { |
| 513 | 513 | /* WP - I do not have access to chds with subchannel information yet, so I'm faking something here */ |
| 514 | 514 | UINT32 msf_abs, msf_rel, track, frame; |
| 515 | 515 | |
| 516 | if ( ! pce_cd.cd ) | |
| 516 | if ( ! pce_cd.cd ) | |
| 517 | 517 | { |
| 518 | 518 | /* Throw some error here */ |
| 519 | 519 | pce_cd_reply_status_byte( SCSI_CHECK_CONDITION ); |
| r5932 | r5933 | |
| 522 | 522 | |
| 523 | 523 | frame = pce_cd.current_frame; |
| 524 | 524 | |
| 525 | switch( pce_cd.cdda_status ) | |
| 525 | switch( pce_cd.cdda_status ) | |
| 526 | 526 | { |
| 527 | 527 | case PCE_CD_CDDA_PAUSED: |
| 528 | 528 | pce_cd.data_buffer[0] = 2; |
| r5932 | r5933 | |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | /* 0xDE - GET DIR INFO (NEC) */ |
| 562 | static void pce_cd_nec_get_dir_info( running_machine *machine ) | |
| 562 | static void pce_cd_nec_get_dir_info( running_machine *machine ) | |
| 563 | 563 | { |
| 564 | 564 | UINT32 frame, msf, track = 0; |
| 565 | 565 | const cdrom_toc *toc; |
| 566 | 566 | logerror("nec get dir info\n"); |
| 567 | 567 | |
| 568 | if ( ! pce_cd.cd ) | |
| 568 | if ( ! pce_cd.cd ) | |
| 569 | 569 | { |
| 570 | 570 | /* Throw some error here */ |
| 571 | 571 | pce_cd_reply_status_byte( SCSI_CHECK_CONDITION ); |
| r5932 | r5933 | |
| 573 | 573 | |
| 574 | 574 | toc = cdrom_get_toc( pce_cd.cd ); |
| 575 | 575 | |
| 576 | switch( pce_cd.command_buffer[1] ) | |
| 576 | switch( pce_cd.command_buffer[1] ) | |
| 577 | 577 | { |
| 578 | 578 | case 0x00: /* Get first and last track numbers */ |
| 579 | 579 | pce_cd.data_buffer[0] = dec_2_bcd(1); |
| r5932 | r5933 | |
| 591 | 591 | pce_cd.data_buffer_size = 3; |
| 592 | 592 | break; |
| 593 | 593 | case 0x02: /* Get track information */ |
| 594 | if ( pce_cd.command_buffer[2] == 0xAA ) | |
| 594 | if ( pce_cd.command_buffer[2] == 0xAA ) | |
| 595 | 595 | { |
| 596 | 596 | frame = toc->tracks[toc->numtrks-1].physframeofs; |
| 597 | 597 | frame += toc->tracks[toc->numtrks-1].frames; |
| 598 | 598 | pce_cd.data_buffer[3] = 0x04; /* correct? */ |
| 599 | } else | |
| 599 | } else | |
| 600 | 600 | { |
| 601 | 601 | track = MAX( bcd_2_dec( pce_cd.command_buffer[2] ), 1 ); |
| 602 | 602 | frame = toc->tracks[track-1].physframeofs; |
| r5932 | r5933 | |
| 620 | 620 | pce_cd.scsi_CD = 0; |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | static void pce_cd_handle_data_output( running_machine *machine ) | |
| 623 | static void pce_cd_handle_data_output( running_machine *machine ) | |
| 624 | 624 | { |
| 625 | 625 | static const struct { |
| 626 | 626 | UINT8 command_byte; |
| r5932 | r5933 | |
| 637 | 637 | { 0xFF, 0, NULL } /* end of list marker */ |
| 638 | 638 | }; |
| 639 | 639 | |
| 640 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 640 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 641 | 641 | { |
| 642 | 642 | /* Command byte received */ |
| 643 | 643 | logerror( "Command byte $%02X received\n", pce_cd.regs[0x01] ); |
| r5932 | r5933 | |
| 650 | 650 | pce_cd.scsi_REQ = 0; |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.command_buffer_index ) | |
| 653 | if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.command_buffer_index ) | |
| 654 | 654 | { |
| 655 | 655 | int i = 0; |
| 656 | 656 | |
| r5932 | r5933 | |
| 659 | 659 | for( i = 0; pce_cd.command_buffer[0] > pce_cd_commands[i].command_byte; i++ ); |
| 660 | 660 | |
| 661 | 661 | /* Check for unknown commands */ |
| 662 | if ( pce_cd.command_buffer[0] != pce_cd_commands[i].command_byte ) | |
| 662 | if ( pce_cd.command_buffer[0] != pce_cd_commands[i].command_byte ) | |
| 663 | 663 | { |
| 664 | 664 | logerror("Unrecognized command: %02X\n", pce_cd.command_buffer[0] ); |
| 665 | 665 | } |
| 666 | 666 | assert( pce_cd.command_buffer[0] == pce_cd_commands[i].command_byte ); |
| 667 | 667 | |
| 668 | if ( pce_cd.command_buffer_index == pce_cd_commands[i].command_size ) | |
| 668 | if ( pce_cd.command_buffer_index == pce_cd_commands[i].command_size ) | |
| 669 | 669 | { |
| 670 | 670 | (pce_cd_commands[i].command_handler)( machine ); |
| 671 | 671 | pce_cd.command_buffer_index = 0; |
| 672 | } | |
| 673 | else | |
| 672 | } | |
| 673 | else | |
| 674 | 674 | { |
| 675 | 675 | pce_cd.scsi_REQ = 1; |
| 676 | 676 | } |
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | static void pce_cd_handle_data_input( running_machine *machine ) | |
| 680 | static void pce_cd_handle_data_input( running_machine *machine ) | |
| 681 | 681 | { |
| 682 | if ( pce_cd.scsi_CD ) | |
| 682 | if ( pce_cd.scsi_CD ) | |
| 683 | 683 | { |
| 684 | 684 | /* Command / Status byte */ |
| 685 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 685 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 686 | 686 | { |
| 687 | 687 | logerror( "status sent\n" ); |
| 688 | 688 | pce_cd.scsi_REQ = 0; |
| 689 | 689 | pce_cd.status_sent = 1; |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.status_sent ) | |
| 692 | if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.status_sent ) | |
| 693 | 693 | { |
| 694 | 694 | pce_cd.status_sent = 0; |
| 695 | if ( pce_cd.message_after_status ) | |
| 695 | if ( pce_cd.message_after_status ) | |
| 696 | 696 | { |
| 697 | 697 | logerror( "message after status\n" ); |
| 698 | 698 | pce_cd.message_after_status = 0; |
| r5932 | r5933 | |
| 700 | 700 | pce_cd.regs[0x01] = 0; |
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | } | |
| 704 | else | |
| 703 | } | |
| 704 | else | |
| 705 | 705 | { |
| 706 | 706 | /* Data */ |
| 707 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 707 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 708 | 708 | { |
| 709 | 709 | pce_cd.scsi_REQ = 0; |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK ) | |
| 712 | if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK ) | |
| 713 | 713 | { |
| 714 | if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size ) | |
| 714 | if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size ) | |
| 715 | 715 | { |
| 716 | 716 | pce_cd_set_irq_line( machine, PCE_CD_IRQ_TRANSFER_READY, CLEAR_LINE ); |
| 717 | if ( pce_cd.data_transferred ) | |
| 717 | if ( pce_cd.data_transferred ) | |
| 718 | 718 | { |
| 719 | 719 | pce_cd.data_transferred = 0; |
| 720 | 720 | pce_cd_reply_status_byte( SCSI_STATUS_OK ); |
| 721 | 721 | pce_cd_set_irq_line( machine, PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE ); |
| 722 | 722 | } |
| 723 | } | |
| 724 | else | |
| 723 | } | |
| 724 | else | |
| 725 | 725 | { |
| 726 | 726 | logerror("Transfer byte from offset %d\n", pce_cd.data_buffer_index); |
| 727 | 727 | pce_cd.regs[0x01] = pce_cd.data_buffer[pce_cd.data_buffer_index]; |
| r5932 | r5933 | |
| 732 | 732 | } |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | static void pce_cd_handle_message_output( void ) | |
| 735 | static void pce_cd_handle_message_output( void ) | |
| 736 | 736 | { |
| 737 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 737 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 738 | 738 | { |
| 739 | 739 | pce_cd.scsi_REQ = 0; |
| 740 | 740 | } |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | static void pce_cd_handle_message_input( void ) | |
| 743 | static void pce_cd_handle_message_input( void ) | |
| 744 | 744 | { |
| 745 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 745 | if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK ) | |
| 746 | 746 | { |
| 747 | 747 | pce_cd.scsi_REQ = 0; |
| 748 | 748 | pce_cd.message_sent = 1; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.message_sent ) | |
| 751 | if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && pce_cd.message_sent ) | |
| 752 | 752 | { |
| 753 | 753 | pce_cd.message_sent = 0; |
| 754 | 754 | pce_cd.scsi_BSY = 0; |
| r5932 | r5933 | |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | /* Update internal CD statuses */ |
| 759 | static void pce_cd_update( running_machine *machine ) | |
| 759 | static void pce_cd_update( running_machine *machine ) | |
| 760 | 760 | { |
| 761 | 761 | /* Check for reset of CD unit */ |
| 762 | if ( pce_cd.scsi_RST != pce_cd.scsi_last_RST ) | |
| 762 | if ( pce_cd.scsi_RST != pce_cd.scsi_last_RST ) | |
| 763 | 763 | { |
| 764 | if ( pce_cd.scsi_RST ) | |
| 764 | if ( pce_cd.scsi_RST ) | |
| 765 | 765 | { |
| 766 | 766 | logerror("Performing CD reset\n"); |
| 767 | 767 | /* Reset internal data */ |
| r5932 | r5933 | |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | /* Check if bus can be freed */ |
| 777 | if ( ! pce_cd.scsi_SEL && ! pce_cd.scsi_BSY && pce_cd.selected ) | |
| 777 | if ( ! pce_cd.scsi_SEL && ! pce_cd.scsi_BSY && pce_cd.selected ) | |
| 778 | 778 | { |
| 779 | 779 | logerror( "freeing bus\n" ); |
| 780 | 780 | pce_cd.selected = 0; |
| r5932 | r5933 | |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | /* Select the CD device */ |
| 786 | if ( pce_cd.scsi_SEL ) | |
| 786 | if ( pce_cd.scsi_SEL ) | |
| 787 | 787 | { |
| 788 | if ( ! pce_cd.selected ) | |
| 788 | if ( ! pce_cd.selected ) | |
| 789 | 789 | { |
| 790 | 790 | pce_cd.selected = 1; |
| 791 | 791 | logerror("Setting CD in device selection\n"); |
| r5932 | r5933 | |
| 794 | 794 | } |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | if ( pce_cd.scsi_ATN ) | |
| 797 | if ( pce_cd.scsi_ATN ) | |
| 798 | 798 | { |
| 799 | } | |
| 800 | else | |
| 799 | } | |
| 800 | else | |
| 801 | 801 | { |
| 802 | 802 | /* Check for data and pessage phases */ |
| 803 | if ( pce_cd.scsi_BSY ) | |
| 803 | if ( pce_cd.scsi_BSY ) | |
| 804 | 804 | { |
| 805 | if ( pce_cd.scsi_MSG ) | |
| 805 | if ( pce_cd.scsi_MSG ) | |
| 806 | 806 | { |
| 807 | 807 | /* message phase */ |
| 808 | if ( pce_cd.scsi_IO ) | |
| 808 | if ( pce_cd.scsi_IO ) | |
| 809 | 809 | { |
| 810 | 810 | pce_cd_handle_message_input(); |
| 811 | } | |
| 812 | else | |
| 811 | } | |
| 812 | else | |
| 813 | 813 | { |
| 814 | 814 | pce_cd_handle_message_output(); |
| 815 | 815 | } |
| 816 | } | |
| 817 | else | |
| 816 | } | |
| 817 | else | |
| 818 | 818 | { |
| 819 | 819 | /* data phase */ |
| 820 | if ( pce_cd.scsi_IO ) | |
| 820 | if ( pce_cd.scsi_IO ) | |
| 821 | 821 | { |
| 822 | 822 | /* Reading data from target */ |
| 823 | 823 | pce_cd_handle_data_input( machine ); |
| 824 | } | |
| 825 | else | |
| 824 | } | |
| 825 | else | |
| 826 | 826 | { |
| 827 | 827 | /* Sending data to target */ |
| 828 | 828 | pce_cd_handle_data_output( machine ); |
| r5932 | r5933 | |
| 832 | 832 | } |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | static void pce_cd_set_irq_line( running_machine *machine, int num, int state ) | |
| 835 | static void pce_cd_set_irq_line( running_machine *machine, int num, int state ) | |
| 836 | 836 | { |
| 837 | switch( num ) | |
| 837 | switch( num ) | |
| 838 | 838 | { |
| 839 | 839 | case PCE_CD_IRQ_TRANSFER_DONE: |
| 840 | if ( state == ASSERT_LINE ) | |
| 840 | if ( state == ASSERT_LINE ) | |
| 841 | 841 | { |
| 842 | 842 | pce_cd.regs[0x03] |= PCE_CD_IRQ_TRANSFER_DONE; |
| 843 | } | |
| 844 | else | |
| 843 | } | |
| 844 | else | |
| 845 | 845 | { |
| 846 | 846 | pce_cd.regs[0x03] &= ~ PCE_CD_IRQ_TRANSFER_DONE; |
| 847 | 847 | } |
| 848 | 848 | break; |
| 849 | 849 | case PCE_CD_IRQ_TRANSFER_READY: |
| 850 | if ( state == ASSERT_LINE ) | |
| 850 | if ( state == ASSERT_LINE ) | |
| 851 | 851 | { |
| 852 | 852 | pce_cd.regs[0x03] |= PCE_CD_IRQ_TRANSFER_READY; |
| 853 | } | |
| 854 | else | |
| 853 | } | |
| 854 | else | |
| 855 | 855 | { |
| 856 | 856 | pce_cd.regs[0x03] &= ~ PCE_CD_IRQ_TRANSFER_READY; |
| 857 | 857 | } |
| r5932 | r5933 | |
| 860 | 860 | break; |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | if ( pce_cd.regs[0x02] & pce_cd.regs[0x03] & ( PCE_CD_IRQ_TRANSFER_DONE | PCE_CD_IRQ_TRANSFER_READY ) ) | |
| 863 | if ( pce_cd.regs[0x02] & pce_cd.regs[0x03] & ( PCE_CD_IRQ_TRANSFER_DONE | PCE_CD_IRQ_TRANSFER_READY ) ) | |
| 864 | 864 | { |
| 865 | 865 | cputag_set_input_line(machine, "maincpu", 1, ASSERT_LINE ); |
| 866 | } | |
| 867 | else | |
| 866 | } | |
| 867 | else | |
| 868 | 868 | { |
| 869 | 869 | cputag_set_input_line(machine, "maincpu", 1, CLEAR_LINE ); |
| 870 | 870 | } |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | static TIMER_CALLBACK( pce_cd_data_timer_callback ) | |
| 873 | static TIMER_CALLBACK( pce_cd_data_timer_callback ) | |
| 874 | 874 | { |
| 875 | if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size ) | |
| 875 | if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size ) | |
| 876 | 876 | { |
| 877 | 877 | /* Read next data sector */ |
| 878 | 878 | logerror("read sector %d\n", pce_cd.current_frame ); |
| 879 | if ( ! cdrom_read_data( pce_cd.cd, pce_cd.current_frame, pce_cd.data_buffer, CD_TRACK_MODE1 ) ) | |
| 879 | if ( ! cdrom_read_data( pce_cd.cd, pce_cd.current_frame, pce_cd.data_buffer, CD_TRACK_MODE1 ) ) | |
| 880 | 880 | { |
| 881 | 881 | logerror("Mode1 CD read failed for frame #%d\n", pce_cd.current_frame ); |
| 882 | } | |
| 883 | else | |
| 882 | } | |
| 883 | else | |
| 884 | 884 | { |
| 885 | 885 | logerror("Succesfully read mode1 frame #%d\n", pce_cd.current_frame ); |
| 886 | 886 | } |
| r5932 | r5933 | |
| 892 | 892 | pce_cd.scsi_IO = 1; |
| 893 | 893 | pce_cd.scsi_CD = 0; |
| 894 | 894 | |
| 895 | if ( pce_cd.current_frame == pce_cd.end_frame ) | |
| 895 | if ( pce_cd.current_frame == pce_cd.end_frame ) | |
| 896 | 896 | { |
| 897 | 897 | /* We are done, disable the timer */ |
| 898 | 898 | logerror("Last frame read from CD\n"); |
| 899 | 899 | pce_cd.data_transferred = 1; |
| 900 | 900 | timer_adjust_oneshot(pce_cd.data_timer, attotime_never, 0); |
| 901 | } | |
| 902 | else | |
| 901 | } | |
| 902 | else | |
| 903 | 903 | { |
| 904 | 904 | pce_cd.data_transferred = 0; |
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | 907 | } |
| 908 | 908 | |
| 909 | static void pce_cd_init( running_machine *machine ) | |
| 909 | static void pce_cd_init( running_machine *machine ) | |
| 910 | 910 | { |
| 911 | 911 | const device_config *device; |
| 912 | 912 | |
| r5932 | r5933 | |
| 957 | 957 | timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0); |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | WRITE8_HANDLER( pce_cd_bram_w ) | |
| 960 | WRITE8_HANDLER( pce_cd_bram_w ) | |
| 961 | 961 | { |
| 962 | if ( ! pce_cd.bram_locked ) | |
| 962 | if ( ! pce_cd.bram_locked ) | |
| 963 | 963 | { |
| 964 | 964 | pce_cd.bram[ offset ] = data; |
| 965 | 965 | } |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | WRITE8_HANDLER( pce_cd_intf_w ) | |
| 968 | WRITE8_HANDLER( pce_cd_intf_w ) | |
| 969 | 969 | { |
| 970 | 970 | logerror("%04X: write to CD interface offset %02X, data %02X\n", cpu_get_pc(space->cpu), offset, data ); |
| 971 | 971 | pce_cd_update(space->machine); |
| 972 | 972 | |
| 973 | switch( offset ) | |
| 973 | switch( offset ) | |
| 974 | 974 | { |
| 975 | 975 | case 0x00: /* CDC status */ |
| 976 | 976 | /* select device (which bits??) */ |
| r5932 | r5933 | |
| 999 | 999 | case 0x06: /* PCM data */ |
| 1000 | 1000 | break; |
| 1001 | 1001 | case 0x07: /* BRAM unlock / CD status */ |
| 1002 | if ( data & 0x80 ) | |
| 1002 | if ( data & 0x80 ) | |
| 1003 | 1003 | { |
| 1004 | 1004 | pce_cd.bram_locked = 0; |
| 1005 | 1005 | pce_set_cd_bram(space->machine); |
| r5932 | r5933 | |
| 1011 | 1011 | case 0x0A: /* ADPCM RAM data port */ |
| 1012 | 1012 | break; |
| 1013 | 1013 | case 0x0B: /* ADPCM DMA control */ |
| 1014 | if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) ) | |
| 1014 | if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) ) | |
| 1015 | 1015 | { |
| 1016 | 1016 | /* Start CD to ADPCM transfer */ |
| 1017 | 1017 | timer_adjust_periodic(pce_cd.adpcm_dma_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ) ); |
| 1018 | 1018 | } |
| 1019 | if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) ) | |
| 1019 | if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) ) | |
| 1020 | 1020 | { |
| 1021 | 1021 | /* Stop CD to ADPCM transfer (?) */ |
| 1022 | 1022 | timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0); |
| r5932 | r5933 | |
| 1025 | 1025 | case 0x0C: /* ADPCM status */ |
| 1026 | 1026 | break; |
| 1027 | 1027 | case 0x0D: /* ADPCM address control */ |
| 1028 | if ( ( pce_cd.regs[0x0D] & 0x80 ) && ! ( data & 0x80 ) ) | |
| 1028 | if ( ( pce_cd.regs[0x0D] & 0x80 ) && ! ( data & 0x80 ) ) | |
| 1029 | 1029 | { |
| 1030 | 1030 | /* Reset ADPCM hardware */ |
| 1031 | 1031 | pce_cd.adpcm_read_ptr = 0; |
| 1032 | 1032 | pce_cd.adpcm_write_ptr = 0; |
| 1033 | 1033 | msm5205_reset_w( devtag_get_device( space->machine, "msm5205"), 0 ); |
| 1034 | 1034 | } |
| 1035 | if ( data & 0x10 ) | |
| 1035 | if ( data & 0x10 ) | |
| 1036 | 1036 | { |
| 1037 | 1037 | pce_cd.adpcm_length = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08]; |
| 1038 | 1038 | } |
| 1039 | if ( data & 0x08 ) | |
| 1039 | if ( data & 0x08 ) | |
| 1040 | 1040 | { |
| 1041 | 1041 | pce_cd.adpcm_read_ptr = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08]; |
| 1042 | 1042 | } |
| 1043 | if ( ( data & 0x03 ) == 0x03 ) | |
| 1043 | if ( ( data & 0x03 ) == 0x03 ) | |
| 1044 | 1044 | { |
| 1045 | 1045 | pce_cd.adpcm_write_ptr = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08]; |
| 1046 | 1046 | } |
| r5932 | r5933 | |
| 1058 | 1058 | pce_cd_update(space->machine); |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | static TIMER_CALLBACK( pce_cd_clear_ack ) | |
| 1061 | static TIMER_CALLBACK( pce_cd_clear_ack ) | |
| 1062 | 1062 | { |
| 1063 | 1063 | pce_cd_update(machine); |
| 1064 | 1064 | pce_cd.scsi_ACK = 0; |
| 1065 | 1065 | pce_cd_update(machine); |
| 1066 | if ( pce_cd.scsi_CD ) | |
| 1066 | if ( pce_cd.scsi_CD ) | |
| 1067 | 1067 | { |
| 1068 | 1068 | pce_cd.regs[0x0B] &= 0xFE; |
| 1069 | 1069 | } |
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | static UINT8 pce_cd_get_cd_data_byte(running_machine *machine) | |
| 1072 | static UINT8 pce_cd_get_cd_data_byte(running_machine *machine) | |
| 1073 | 1073 | { |
| 1074 | 1074 | UINT8 data = pce_cd.regs[0x01]; |
| 1075 | if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD ) | |
| 1075 | if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD ) | |
| 1076 | 1076 | { |
| 1077 | if ( pce_cd.scsi_IO ) | |
| 1077 | if ( pce_cd.scsi_IO ) | |
| 1078 | 1078 | { |
| 1079 | 1079 | pce_cd.scsi_ACK = 1; |
| 1080 | 1080 | timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 15), NULL, 0, pce_cd_clear_ack ); |
| r5932 | r5933 | |
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | |
| 1087 | static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback ) | |
| 1087 | static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback ) | |
| 1088 | 1088 | { |
| 1089 | if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD && pce_cd.scsi_IO ) | |
| 1090 | { | |
| 1089 | if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD && pce_cd.scsi_IO ) | |
| 1090 | { | |
| 1091 | 1091 | pce_cd.adpcm_ram[pce_cd.adpcm_write_ptr] = pce_cd_get_cd_data_byte(machine); |
| 1092 | 1092 | pce_cd.adpcm_write_ptr = ( pce_cd.adpcm_write_ptr + 1 ) & 0xFFFF; |
| 1093 | 1093 | } |
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | READ8_HANDLER( pce_cd_intf_r ) | |
| 1096 | READ8_HANDLER( pce_cd_intf_r ) | |
| 1097 | 1097 | { |
| 1098 | 1098 | UINT8 data = pce_cd.regs[offset & 0x0F]; |
| 1099 | 1099 | |
| 1100 | 1100 | pce_cd_update(space->machine); |
| 1101 | 1101 | |
| 1102 | 1102 | logerror("%04X: read from CD interface offset %02X\n", cpu_get_pc(space->cpu), offset ); |
| 1103 | switch( offset ) | |
| 1103 | switch( offset ) | |
| 1104 | 1104 | { |
| 1105 | 1105 | case 0x00: /* CDC status */ |
| 1106 | 1106 | data &= 0x07; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | SMC9224 and SMC9234 Hard and Floppy Disk Controller (HFDC) | |
| 3 | 3 | |
| 4 | This controller handles MFM and FM encoded floppy disks and hard disks. | |
| 5 | The SMC9224 is used in some DEC systems. The SMC9234 is used in the Myarc | |
| 6 | HFDC card for the TI99/4a. The main difference between the two chips is | |
| 7 | the way the ECC bytes are computed; there are differences in the way seek | |
| 8 | times are computed, too. | |
| 4 | This controller handles MFM and FM encoded floppy disks and hard disks. | |
| 5 | The SMC9224 is used in some DEC systems. The SMC9234 is used in the Myarc | |
| 6 | HFDC card for the TI99/4a. The main difference between the two chips is | |
| 7 | the way the ECC bytes are computed; there are differences in the way seek | |
| 8 | times are computed, too. | |
| 9 | 9 | |
| 10 | References: | |
| 11 | * SMC HDC9234 preliminary data book (1988) | |
| 10 | References: | |
| 11 | * SMC HDC9234 preliminary data book (1988) | |
| 12 | 12 | |
| 13 | ||
| 13 | Raphael Nabet, 2003 | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | #include "driver.h" |
| r5932 | r5933 | |
| 22 | 22 | #define MAX_SECTOR_LEN 2048 /* ??? */ |
| 23 | 23 | |
| 24 | 24 | /* |
| 25 | ||
| 25 | hfdc state structure | |
| 26 | 26 | */ |
| 27 | 27 | typedef struct hfdc_t |
| 28 | 28 | { |
| 29 | 29 | UINT8 status; /* command status register */ |
| 30 | 30 | UINT8 disk_sel; /* disk selection state */ |
| 31 | 31 | UINT8 regs[10+6]; /* 4th through 10th registers are actually 2 distinct |
| 32 | registers each (one is r/o and the other w/o). The | |
| 33 | 11th register ("data") is only used for communication | |
| 34 | with the drive in non-DMA modes??? */ | |
| 32 | registers each (one is r/o and the other w/o). The | |
| 33 | 11th register ("data") is only used for communication | |
| 34 | with the drive in non-DMA modes??? */ | |
| 35 | 35 | int reg_ptr; |
| 36 | 36 | int (*select_callback)(int which, select_mode_t select_mode, int select_line, int gpos); |
| 37 | 37 | UINT8 (*dma_read_callback)(int which, offs_t offset); |
| r5932 | r5933 | |
| 65 | 65 | }; |
| 66 | 66 | |
| 67 | 67 | /* |
| 68 | ||
| 68 | Definition of bits in the status register | |
| 69 | 69 | */ |
| 70 | 70 | #define ST_INTPEND (1<<7) /* interrupt pending */ |
| 71 | 71 | #define ST_DMAREQ (1<<6) /* DMA request */ |
| r5932 | r5933 | |
| 76 | 76 | #define ST_BADSECT (1<<0) /* bad sector */ |
| 77 | 77 | |
| 78 | 78 | /* |
| 79 | ||
| 79 | Definition of the termination codes | |
| 80 | 80 | */ |
| 81 | 81 | #define ST_TC_SUCCESS (0<<3) /* Successful completion */ |
| 82 | 82 | #define ST_TC_RDIDERR (1<<3) /* Error in READ-ID sequence */ |
| r5932 | r5933 | |
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | /* |
| 88 | ||
| 88 | Definition of bits in the Termination-Conditions register | |
| 89 | 89 | */ |
| 90 | 90 | #define TC_CRCPRE (1<<7) /* CRC register preset, must be 1 */ |
| 91 | 91 | #define TC_UNUSED (1<<6) /* bit 6 is not used and must be 0 */ |
| r5932 | r5933 | |
| 97 | 97 | #define TC_TWRFLT (1<<0) /* interrupt on write-fault (HDD only) */ |
| 98 | 98 | |
| 99 | 99 | /* |
| 100 | ||
| 100 | Definition of bits in the Chip-Status register | |
| 101 | 101 | */ |
| 102 | 102 | #define CS_RETREQ (1<<7) /* retry required */ |
| 103 | 103 | #define CS_ECCATT (1<<6) /* ECC correction attempted */ |
| r5932 | r5933 | |
| 108 | 108 | #define CS_PRESDRV (3<<0) /* present drive selected */ |
| 109 | 109 | |
| 110 | 110 | /* |
| 111 | ||
| 111 | Definition of bits in the Disk-Status register | |
| 112 | 112 | */ |
| 113 | 113 | #define DS_SELACK (1<<7) /* select acknowledge (harddisk only!) */ |
| 114 | 114 | #define DS_INDEX (1<<6) /* index point */ |
| r5932 | r5933 | |
| 122 | 122 | static hfdc_t hfdc[MAX_HFDC]; |
| 123 | 123 | |
| 124 | 124 | /* |
| 125 | Perform the read id field sequence for a floppy disk (but do not perform | |
| 126 | any implied seek) | |
| 125 | Perform the read id field sequence for a floppy disk (but do not perform | |
| 126 | any implied seek) | |
| 127 | 127 | |
| 128 | which: udc controller index | |
| 129 | disk_unit: floppy drive index | |
| 130 | head: selected head | |
| 128 | which: udc controller index | |
| 129 | disk_unit: floppy drive index | |
| 130 | head: selected head | |
| 131 | 131 | */ |
| 132 | 132 | static int floppy_read_id(running_machine *machine,int which, int disk_unit, int head) |
| 133 | 133 | { |
| r5932 | r5933 | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /* |
| 159 | ||
| 159 | Perform the verify sequence for a floppy disk | |
| 160 | 160 | |
| 161 | which: udc controller index | |
| 162 | disk_unit: floppy drive index | |
| 161 | which: udc controller index | |
| 162 | disk_unit: floppy drive index | |
| 163 | 163 | */ |
| 164 | 164 | static int floppy_find_sector(running_machine *machine,int which, int disk_unit, int cylinder, int head, int check_secnum, int sector, int *sector_data_id, int *sector_len) |
| 165 | 165 | { |
| r5932 | r5933 | |
| 355 | 355 | hfdc[which].regs[hfdc_reg_cur_head] = ((hd[disk_unit].current_cylinder >> 4) & 0x70) | head; |
| 356 | 356 | hfdc[which].regs[hfdc_reg_read_6] = 0xfe; /* ident byte */ |
| 357 | 357 | /*if () |
| 358 | ||
| 358 | hfdc[which].regs[hfdc_reg_chip_stat] |= CS_DELDATA;*/ | |
| 359 | 359 | |
| 360 | 360 | return TRUE; |
| 361 | 361 | } |
| r5932 | r5933 | |
| 463 | 463 | { |
| 464 | 464 | reply |= DS_SELACK; |
| 465 | 465 | /*if () |
| 466 | ||
| 466 | reply |= DS_INDEX;*/ | |
| 467 | 467 | reply |= DS_SKCOM; |
| 468 | 468 | if (hd[disk_unit].current_cylinder == 0) |
| 469 | 469 | reply |= DS_TRK00; |
| r5932 | r5933 | |
| 472 | 472 | if (hd[disk_unit].hd_handle) |
| 473 | 473 | reply |= DS_READY; |
| 474 | 474 | /*if () |
| 475 | ||
| 475 | reply |= DS_WRFAULT;*/ | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | return reply; |
| r5932 | r5933 | |
| 481 | 481 | |
| 482 | 482 | |
| 483 | 483 | /* |
| 484 | ||
| 484 | Initialize the controller | |
| 485 | 485 | */ |
| 486 | 486 | void smc92x4_init(int which, const smc92x4_intf *intf) |
| 487 | 487 | { |
| r5932 | r5933 | |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | /* |
| 498 | ||
| 498 | Reset the controller | |
| 499 | 499 | */ |
| 500 | 500 | void smc92x4_reset(int which) |
| 501 | 501 | { |
| r5932 | r5933 | |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | /* |
| 513 | ||
| 513 | Change the state of IRQ | |
| 514 | 514 | */ |
| 515 | 515 | static void smc92x4_set_interrupt(int which, int state) |
| 516 | 516 | { |
| r5932 | r5933 | |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /* |
| 530 | ||
| 530 | Select currently selected drive | |
| 531 | 531 | */ |
| 532 | 532 | static int get_selected_drive(int which, select_mode_t *select_mode, int *disk_unit) |
| 533 | 533 | { |
| r5932 | r5933 | |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | /* |
| 563 | ||
| 563 | Assert Command Done status bit, triggering interrupts as needed | |
| 564 | 564 | */ |
| 565 | 565 | INLINE void set_command_done(int which) |
| 566 | 566 | { |
| r5932 | r5933 | |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | /* |
| 597 | ||
| 597 | Perform the read_id phase on a drive | |
| 598 | 598 | */ |
| 599 | 599 | INLINE int read_id(running_machine *machine,int which, select_mode_t select_mode, int disk_unit, int head, |
| 600 | 600 | int do_implied_seek, int desired_cylinder) |
| r5932 | r5933 | |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | /* |
| 678 | ||
| 678 | Get the status of a drive | |
| 679 | 679 | */ |
| 680 | 680 | INLINE UINT8 get_disk_status(running_machine *machine,int which, select_mode_t select_mode, int disk_unit) |
| 681 | 681 | { |
| r5932 | r5933 | |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | /* |
| 710 | ||
| 710 | Handle the step command | |
| 711 | 711 | */ |
| 712 | 712 | static void do_step(running_machine *machine,int which, int mode) |
| 713 | 713 | { |
| r5932 | r5933 | |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | /* |
| 741 | ||
| 741 | Handle the restore command | |
| 742 | 742 | */ |
| 743 | 743 | static void do_restore(running_machine *machine,int which, int mode) |
| 744 | 744 | { |
| r5932 | r5933 | |
| 755 | 755 | { |
| 756 | 756 | /* no unit has been selected */ |
| 757 | 757 | /* the drive status will be 0, therefore the SEEK_COMPLETE bit will be |
| 758 | ||
| 758 | cleared, which is what we want */ | |
| 759 | 759 | goto cleanup; |
| 760 | 760 | } |
| 761 | 761 | |
| r5932 | r5933 | |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /* |
| 793 | ||
| 793 | Handle the read command | |
| 794 | 794 | |
| 795 | which: disk controller selected | |
| 796 | physical_flag: if 1, read consecutive sectors, ignoring sector IDs | |
| 797 | mode: extra flags (ignored) | |
| 795 | which: disk controller selected | |
| 796 | physical_flag: if 1, read consecutive sectors, ignoring sector IDs | |
| 797 | mode: extra flags (ignored) | |
| 798 | 798 | */ |
| 799 | 799 | static void do_read(running_machine *machine,int which, int physical_flag, int mode) |
| 800 | 800 | { |
| r5932 | r5933 | |
| 835 | 835 | |
| 836 | 836 | #if 0 |
| 837 | 837 | /* if we enable write-protect test in read operations, the ti99 HFDC DSR is |
| 838 | ||
| 838 | unable to read write-protected floppies! */ | |
| 839 | 839 | if ((hfdc[which].regs[hfdc_reg_term] & TC_TWPROT) |
| 840 | 840 | && (get_disk_status(machine,which, select_mode, disk_unit) & DS_WRPROT)) |
| 841 | 841 | { |
| r5932 | r5933 | |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | /* |
| 905 | ||
| 905 | Handle the write command | |
| 906 | 906 | |
| 907 | which: disk controller selected | |
| 908 | physical_flag: if 1, ignore CRC/ECC bytes??? (ignored) | |
| 909 | mode: extra flags (ignored) | |
| 907 | which: disk controller selected | |
| 908 | physical_flag: if 1, ignore CRC/ECC bytes??? (ignored) | |
| 909 | mode: extra flags (ignored) | |
| 910 | 910 | */ |
| 911 | 911 | static void do_write(running_machine *machine,int which, int physical_flag, int mode) |
| 912 | 912 | { |
| r5932 | r5933 | |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | /* |
| 1014 | ||
| 1014 | Process a command | |
| 1015 | 1015 | */ |
| 1016 | 1016 | static void smc92x4_process_command(running_machine *machine,int which, int opcode) |
| 1017 | 1017 | { |
| r5932 | r5933 | |
| 1041 | 1041 | case 0x03: |
| 1042 | 1042 | /* RESTORE DRIVE */ |
| 1043 | 1043 | /* bit 0: 0 -> command ends after last seek pulse, 1 -> command |
| 1044 | ||
| 1044 | ends when the drive asserts the seek complete pin */ | |
| 1045 | 1045 | logerror("smc92x4 restore command %X\n", opcode & 0x01); |
| 1046 | 1046 | do_restore(machine,which, opcode & 0x01); |
| 1047 | 1047 | break; |
| r5932 | r5933 | |
| 1052 | 1052 | /* STEP IN/OUT ONE CYLINDER */ |
| 1053 | 1053 | /* bit 1: direction (0 -> inward, 1 -> outward i.e. toward cyl #0) */ |
| 1054 | 1054 | /* bit 0: 0 -> command ends after last seek pulse, 1 -> command |
| 1055 | ||
| 1055 | ends when the drive asserts the seek complete pin */ | |
| 1056 | 1056 | logerror("smc92x4 step command %X\n", opcode & 0x3); |
| 1057 | 1057 | do_step(machine,which, opcode & 0x03); |
| 1058 | 1058 | } |
| r5932 | r5933 | |
| 1072 | 1072 | /* DRSELECT */ |
| 1073 | 1073 | /* bit 4: if 1, apply head load delay */ |
| 1074 | 1074 | /* bit 3 & 2: disk type (0-3): 0 for hard disk in IBM-AT format, 1 |
| 1075 | for hard disk in standard SMC format, 2 for high-speed (8" or | |
| 1076 | HD(?)) floppy, 3 for low-speed (5"1/4 DD?) floppy disk */ | |
| 1075 | for hard disk in standard SMC format, 2 for high-speed (8" or | |
| 1076 | HD(?)) floppy, 3 for low-speed (5"1/4 DD?) floppy disk */ | |
| 1077 | 1077 | /* bit 1 & 0: unit number (0-3)*/ |
| 1078 | 1078 | logerror("smc92x4 drselect command %X\n", opcode & 0xf); |
| 1079 | 1079 | hfdc[which].disk_sel = opcode & 0xf; |
| r5932 | r5933 | |
| 1099 | 1099 | { |
| 1100 | 1100 | /* READ */ |
| 1101 | 1101 | /* bits 2-1: 0 -> read physical, 1 -> read track, 2 -> read |
| 1102 | logical with implied seek, 3 -> read logical with no | |
| 1103 | implied seek */ | |
| 1102 | logical with implied seek, 3 -> read logical with no | |
| 1103 | implied seek */ | |
| 1104 | 1104 | /* bit 0: 0 -> do not transfer data (transfer ID fields for |
| 1105 | ||
| 1105 | read track command), 1 -> transfer data */ | |
| 1106 | 1106 | switch ((opcode >> 1) & 0x3) |
| 1107 | 1107 | { |
| 1108 | 1108 | case 0: |
| r5932 | r5933 | |
| 1124 | 1124 | case 0x7: |
| 1125 | 1125 | /* FORMAT TRACK */ |
| 1126 | 1126 | /* bit 4: 0 -> write deleted data mark instead of normal address |
| 1127 | ||
| 1127 | mark */ | |
| 1128 | 1128 | /* bit 3: 1 -> write with reduced current */ |
| 1129 | 1129 | /* bit 2-0: write precompensation value */ |
| 1130 | 1130 | logerror("smc92x4 formattrack command %X\n", opcode & 0xf); |
| r5932 | r5933 | |
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | /* |
| 1166 | ||
| 1166 | Memory accessors | |
| 1167 | 1167 | */ |
| 1168 | 1168 | |
| 1169 | 1169 | /* |
| 1170 | ||
| 1170 | Read a byte of data from a smc99x4 controller | |
| 1171 | 1171 | */ |
| 1172 | 1172 | int smc92x4_r(running_machine *machine,int which, int offset) |
| 1173 | 1173 | { |
| r5932 | r5933 | |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | /* |
| 1209 | ||
| 1209 | Write a byte to a smc99x4 controller | |
| 1210 | 1210 | */ |
| 1211 | 1211 | void smc92x4_w(running_machine *machine,int which, int offset, int data) |
| 1212 | 1212 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | Machine code for TI99/4, TI-99/4A, TI-99/8, and SNUG SGCPU (a.k.a. 99/4P). | |
| 3 | Raphael Nabet, 1999-2003. | |
| 4 | Some code was originally derived from Ed Swartz's V9T9. | |
| 2 | Machine code for TI99/4, TI-99/4A, TI-99/8, and SNUG SGCPU (a.k.a. 99/4P). | |
| 3 | Raphael Nabet, 1999-2003. | |
| 4 | Some code was originally derived from Ed Swartz's V9T9. | |
| 5 | 5 | |
| 6 | References: | |
| 7 | * The TI-99/4A Tech Pages. Great site with complete technical description | |
| 8 | of the TI99/4a. | |
| 9 | <http://www.nouspikel.com/ti99/titech.htm> | |
| 10 | * ftp.whtech.com has schematics and hardware documentations. The documents | |
| 11 | of most general interest are: | |
| 12 | <ftp://ftp.whtech.com//datasheets/Hardware manuals/99-4 console specification and schematic.pdf> | |
| 13 | <ftp://ftp.whtech.com//datasheets/Hardware manuals/99-4A Console and peripheral Expansion System Technical Data.pdf> | |
| 14 | Schematics for various extension cards are available in the same directory. | |
| 15 | * V9T9 source code. This older emulator was often fairly accurate. | |
| 16 | * Harald Glaab's site has software and documentation for the various SNUG | |
| 17 | cards: 99/4P (nicknamed "SGCPU"), EVPC, BwG. | |
| 18 | <http://home.t-online.de/home/harald.glaab/snug/> | |
| 19 | * The TI-99/4 CPU ROM is the only source of information for the IR remote | |
| 20 | handset controller protocol. I have written a document that explains | |
| 21 | this protocol. | |
| 22 | * TI-99/8 ROM source code (6 PC99 disk images): | |
| 23 | <ftp://ftp.whtech.com//source/998Source Disk1.DSK> | |
| 24 | ... | |
| 25 | <ftp://ftp.whtech.com//source/998Source Disk6.DSK> | |
| 26 | * TI-99/8 schematics. This is a valuable source of information, BUT the | |
| 27 | schematics describe an early prototype (no Extended Basic, etc.). | |
| 28 | <ftp://ftp.whtech.com//datasheets & manuals/99-8 Computer/99-8 schematic.max> | |
| 29 | I have written an index for the signals on these schematics. | |
| 6 | References: | |
| 7 | * The TI-99/4A Tech Pages. Great site with complete technical description | |
| 8 | of the TI99/4a. | |
| 9 | <http://www.nouspikel.com/ti99/titech.htm> | |
| 10 | * ftp.whtech.com has schematics and hardware documentations. The documents | |
| 11 | of most general interest are: | |
| 12 | <ftp://ftp.whtech.com//datasheets/Hardware manuals/99-4 console specification and schematic.pdf> | |
| 13 | <ftp://ftp.whtech.com//datasheets/Hardware manuals/99-4A Console and peripheral Expansion System Technical Data.pdf> | |
| 14 | Schematics for various extension cards are available in the same directory. | |
| 15 | * V9T9 source code. This older emulator was often fairly accurate. | |
| 16 | * Harald Glaab's site has software and documentation for the various SNUG | |
| 17 | cards: 99/4P (nicknamed "SGCPU"), EVPC, BwG. | |
| 18 | <http://home.t-online.de/home/harald.glaab/snug/> | |
| 19 | * The TI-99/4 CPU ROM is the only source of information for the IR remote | |
| 20 | handset controller protocol. I have written a document that explains | |
| 21 | this protocol. | |
| 22 | * TI-99/8 ROM source code (6 PC99 disk images): | |
| 23 | <ftp://ftp.whtech.com//source/998Source Disk1.DSK> | |
| 24 | ... | |
| 25 | <ftp://ftp.whtech.com//source/998Source Disk6.DSK> | |
| 26 | * TI-99/8 schematics. This is a valuable source of information, BUT the | |
| 27 | schematics describe an early prototype (no Extended Basic, etc.). | |
| 28 | <ftp://ftp.whtech.com//datasheets & manuals/99-8 Computer/99-8 schematic.max> | |
| 29 | I have written an index for the signals on these schematics. | |
| 30 | 30 | |
| 31 | 31 | Emulated: |
| 32 | * All TI99 basic console hardware, except a few tricks in TMS9901 emulation. | |
| 33 | * Cartridges with ROM (either non-paged or paged), RAM (minimemory) and | |
| 34 | GROM. Supercart and MBX support are not finished. | |
| 35 | * Speech Synthesizer, with standard speech ROM (no speech ROM expansion). | |
| 36 | * Disk emulation (SSSD disk images with TI fdc, both SSSD and DSDD with | |
| 37 | SNUG's BwG and HFDC fdcs). | |
| 38 | * Hard disk (HFDC and IDE). | |
| 39 | * Mechatronics mouse. | |
| 40 | * save minimemory contents | |
| 32 | * All TI99 basic console hardware, except a few tricks in TMS9901 emulation. | |
| 33 | * Cartridges with ROM (either non-paged or paged), RAM (minimemory) and | |
| 34 | GROM. Supercart and MBX support are not finished. | |
| 35 | * Speech Synthesizer, with standard speech ROM (no speech ROM expansion). | |
| 36 | * Disk emulation (SSSD disk images with TI fdc, both SSSD and DSDD with | |
| 37 | SNUG's BwG and HFDC fdcs). | |
| 38 | * Hard disk (HFDC and IDE). | |
| 39 | * Mechatronics mouse. | |
| 40 | * save minimemory contents | |
| 41 | 41 | |
| 42 | ||
| 42 | Compatibility looks quite good. | |
| 43 | 43 | |
| 44 | 44 | Issues: |
| 45 | ||
| 45 | * floppy disk timings are not emulated (general issue) | |
| 46 | 46 | |
| 47 | 47 | TODO: |
| 48 | * support for other peripherals and DSRs as documentation permits | |
| 49 | * implement the EVPC palette chip | |
| 50 | * finish 99/4p support: ROM6, HSGPL (implemented, but not fully debugged) | |
| 48 | * support for other peripherals and DSRs as documentation permits | |
| 49 | * implement the EVPC palette chip | |
| 50 | * finish 99/4p support: ROM6, HSGPL (implemented, but not fully debugged) | |
| 51 | 51 | */ |
| 52 | 52 | |
| 53 | 53 | #include <math.h> |
| r5932 | r5933 | |
| 90 | 90 | static void ti99_evpc_reset(running_machine *machine); |
| 91 | 91 | |
| 92 | 92 | /* |
| 93 | ||
| 93 | pointer to extended RAM area | |
| 94 | 94 | */ |
| 95 | 95 | static UINT16 *xRAM_ptr; |
| 96 | 96 | |
| 97 | 97 | /* |
| 98 | ||
| 98 | Configuration | |
| 99 | 99 | */ |
| 100 | 100 | /* model of ti99 in emulation */ |
| 101 | 101 | static enum |
| r5932 | r5933 | |
| 150 | 150 | static int AlphaLockLine; |
| 151 | 151 | |
| 152 | 152 | /* |
| 153 | ||
| 153 | GROM support. | |
| 154 | 154 | |
| 155 | 155 | In short: |
| 156 | 156 | |
| 157 | TI99/4x hardware supports GROMs. GROMs are slow ROM devices, which are | |
| 158 | interfaced via a 8-bit data bus, and include an internal address pointer | |
| 159 | which is incremented after each read. This implies that accesses are | |
| 160 | faster when reading consecutive bytes, although the address pointer can be | |
| 161 | read and written at any time. | |
| 157 | TI99/4x hardware supports GROMs. GROMs are slow ROM devices, which are | |
| 158 | interfaced via a 8-bit data bus, and include an internal address pointer | |
| 159 | which is incremented after each read. This implies that accesses are | |
| 160 | faster when reading consecutive bytes, although the address pointer can be | |
| 161 | read and written at any time. | |
| 162 | 162 | |
| 163 | They are generally used to store programs in GPL (Graphic Programming | |
| 164 | Language: a proprietary, interpreted language - the interpreter takes most | |
| 165 | of a TI99/4(a) CPU ROMs). They can used to store large pieces of data, | |
| 166 | too. | |
| 163 | They are generally used to store programs in GPL (Graphic Programming | |
| 164 | Language: a proprietary, interpreted language - the interpreter takes most | |
| 165 | of a TI99/4(a) CPU ROMs). They can used to store large pieces of data, | |
| 166 | too. | |
| 167 | 167 | |
| 168 | Both TI-99/4 and TI-99/4a include three GROMs, with some start-up code, | |
| 169 | system routines and TI-Basic. TI99/4 includes an additional Equation | |
| 170 | Editor. According to the preliminary schematics found on ftp.whtech.com, | |
| 171 | TI-99/8 includes the three standard GROMs and 16 GROMs for the UCSD | |
| 172 | p-system. TI99/2 does not include GROMs at all, and was not designed to | |
| 173 | support any, although it should be relatively easy to create an expansion | |
| 174 | card with the GPL interpreter and a /4a cartridge port. | |
| 168 | Both TI-99/4 and TI-99/4a include three GROMs, with some start-up code, | |
| 169 | system routines and TI-Basic. TI99/4 includes an additional Equation | |
| 170 | Editor. According to the preliminary schematics found on ftp.whtech.com, | |
| 171 | TI-99/8 includes the three standard GROMs and 16 GROMs for the UCSD | |
| 172 | p-system. TI99/2 does not include GROMs at all, and was not designed to | |
| 173 | support any, although it should be relatively easy to create an expansion | |
| 174 | card with the GPL interpreter and a /4a cartridge port. | |
| 175 | 175 | |
| 176 | 176 | The simple way: |
| 177 | 177 | |
| 178 | ||
| 178 | Each GROM is logically 8kb long. | |
| 179 | 179 | |
| 180 | Communication with GROM is done with 4 memory-mapped locations. You can read or write | |
| 181 | a 16-bit address pointer, and read data from GROMs. One register allows to write data, too, | |
| 182 | which would support some GRAMs, but AFAIK TI never built such GRAMs (although docs from TI | |
| 183 | do refer to this possibility). | |
| 180 | Communication with GROM is done with 4 memory-mapped locations. You can read or write | |
| 181 | a 16-bit address pointer, and read data from GROMs. One register allows to write data, too, | |
| 182 | which would support some GRAMs, but AFAIK TI never built such GRAMs (although docs from TI | |
| 183 | do refer to this possibility). | |
| 184 | 184 | |
| 185 | Since address are 16-bit long, you can have up to 8 GROMs. So, a cartridge may | |
| 186 | include up to 5 GROMs. (Actually, there is a way more GROMs can be used - see below...) | |
| 185 | Since address are 16-bit long, you can have up to 8 GROMs. So, a cartridge may | |
| 186 | include up to 5 GROMs. (Actually, there is a way more GROMs can be used - see below...) | |
| 187 | 187 | |
| 188 | The address pointer is incremented after each GROM operation, but it will always remain | |
| 189 | within the bounds of the currently selected GROM (e.g. after 0x3fff comes 0x2000). | |
| 188 | The address pointer is incremented after each GROM operation, but it will always remain | |
| 189 | within the bounds of the currently selected GROM (e.g. after 0x3fff comes 0x2000). | |
| 190 | 190 | |
| 191 | 191 | Some details: |
| 192 | 192 | |
| 193 | Original TI-built GROM are 6kb long, but take 8kb in address space. The extra 2kb can be | |
| 194 | read, and follow the following formula: | |
| 195 | GROM[0x1800+offset] = GROM[0x0800+offset] | GROM[0x1000+offset]; | |
| 196 | (sounds like address decoding is incomplete - we are lucky we don't burn any silicon when | |
| 197 | doing so...) | |
| 193 | Original TI-built GROM are 6kb long, but take 8kb in address space. The extra 2kb can be | |
| 194 | read, and follow the following formula: | |
| 195 | GROM[0x1800+offset] = GROM[0x0800+offset] | GROM[0x1000+offset]; | |
| 196 | (sounds like address decoding is incomplete - we are lucky we don't burn any silicon when | |
| 197 | doing so...) | |
| 198 | 198 | |
| 199 | Needless to say, some hackers simulated 8kb GRAMs and GROMs with normal RAM/PROM chips and | |
| 200 | glue logic. | |
| 199 | Needless to say, some hackers simulated 8kb GRAMs and GROMs with normal RAM/PROM chips and | |
| 200 | glue logic. | |
| 201 | 201 | |
| 202 | 202 | GPL ports: |
| 203 | 203 | |
| 204 | When accessing the GROMs registers, 8 address bits (cpu_addr & 0x03FC) may | |
| 205 | be used as a port number, which permits the use of up to 256 independant | |
| 206 | GROM ports, with 64kb of address space in each. TI99/4(a) ROMs can take | |
| 207 | advantage of the first 16 ports: it will look for GPL programs in every | |
| 208 | GROM of the 16 first ports. Additionally, while the other 240 ports cannot | |
| 209 | contain standard GROMs with GPL code, they may still contain custom GROMs | |
| 210 | with data. | |
| 204 | When accessing the GROMs registers, 8 address bits (cpu_addr & 0x03FC) may | |
| 205 | be used as a port number, which permits the use of up to 256 independant | |
| 206 | GROM ports, with 64kb of address space in each. TI99/4(a) ROMs can take | |
| 207 | advantage of the first 16 ports: it will look for GPL programs in every | |
| 208 | GROM of the 16 first ports. Additionally, while the other 240 ports cannot | |
| 209 | contain standard GROMs with GPL code, they may still contain custom GROMs | |
| 210 | with data. | |
| 211 | 211 | |
| 212 | Note, however, that the TI99/4(a) console does not decode the page number, so console GROMs | |
| 213 | occupy the first 24kb of EVERY port, and cartridge GROMs occupy the next 40kb of EVERY port | |
| 214 | (with the exception of one demonstration from TI that implements several distinct ports). | |
| 215 | (Note that the TI99/8 console does have the required decoder.) Fortunately, GROM drivers | |
| 216 | have a relatively high impedance, and therefore extension cards can use TTL drivers to impose | |
| 217 | another value on the data bus with no risk of burning the console GROMs. This hack permits | |
| 218 | the addition of additionnal GROMs in other ports, with the only side effect that whenever | |
| 219 | the address pointer in port N is altered, the address pointer of console GROMs in port 0 | |
| 220 | is altered, too. Overriding the system GROMs with custom code is possible, too (some hackers | |
| 221 | have done so), but I would not recommended it, as connecting such a device to a TI99/8 might | |
| 222 | burn some drivers. | |
| 212 | Note, however, that the TI99/4(a) console does not decode the page number, so console GROMs | |
| 213 | occupy the first 24kb of EVERY port, and cartridge GROMs occupy the next 40kb of EVERY port | |
| 214 | (with the exception of one demonstration from TI that implements several distinct ports). | |
| 215 | (Note that the TI99/8 console does have the required decoder.) Fortunately, GROM drivers | |
| 216 | have a relatively high impedance, and therefore extension cards can use TTL drivers to impose | |
| 217 | another value on the data bus with no risk of burning the console GROMs. This hack permits | |
| 218 | the addition of additionnal GROMs in other ports, with the only side effect that whenever | |
| 219 | the address pointer in port N is altered, the address pointer of console GROMs in port 0 | |
| 220 | is altered, too. Overriding the system GROMs with custom code is possible, too (some hackers | |
| 221 | have done so), but I would not recommended it, as connecting such a device to a TI99/8 might | |
| 222 | burn some drivers. | |
| 223 | 223 | |
| 224 | The p-code card (-> UCSD Pascal system) contains 8 GROMs, all in port 16. This port is not | |
| 225 | in the range recognized by the TI ROMs (0-15), and therefore it is used by the p-code DSR ROMs | |
| 226 | as custom data. Additionally, some hackers used the extra ports to implement "GRAM" devices. | |
| 224 | The p-code card (-> UCSD Pascal system) contains 8 GROMs, all in port 16. This port is not | |
| 225 | in the range recognized by the TI ROMs (0-15), and therefore it is used by the p-code DSR ROMs | |
| 226 | as custom data. Additionally, some hackers used the extra ports to implement "GRAM" devices. | |
| 227 | 227 | |
| 228 | ||
| 228 | The handling of cartridge GROMs has moved to ti99cart.c. | |
| 229 | 229 | */ |
| 230 | 230 | |
| 231 | 231 | /* descriptor for console GROMs */ |
| r5932 | r5933 | |
| 265 | 265 | |
| 266 | 266 | /*===========================================================================*/ |
| 267 | 267 | /* |
| 268 | General purpose code: | |
| 269 | initialization, cart loading, etc. | |
| 268 | General purpose code: | |
| 269 | initialization, cart loading, etc. | |
| 270 | 270 | */ |
| 271 | 271 | |
| 272 | 272 | static void create_grom_high2k(int first, int last) |
| r5932 | r5933 | |
| 331 | 331 | UINT8 *mem = memory_region(machine, "maincpu"); |
| 332 | 332 | ti99_model = model_99_8; |
| 333 | 333 | has_evpc = FALSE; |
| 334 | ||
| 334 | ||
| 335 | 335 | /* set up memory pointers */ |
| 336 | 336 | xRAM_ptr_8 = mem + offset_xram_8; |
| 337 | 337 | ROM0_ptr_8 = mem + offset_rom0_8; |
| r5932 | r5933 | |
| 342 | 342 | |
| 343 | 343 | /* Pull this one up here. */ |
| 344 | 344 | ti99_8_enable_rom_and_ports = 1; |
| 345 | ||
| 345 | ||
| 346 | 346 | console_GROMs.data_ptr = memory_region(machine, region_grom); |
| 347 | 347 | create_grom_high2k(0x0000, 0x5fff); |
| 348 | 348 | |
| r5932 | r5933 | |
| 419 | 419 | ti99_common_init(machine, 0); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | void ti99_common_init(running_machine *machine, const TMS9928a_interface *gfxparm) | |
| 422 | void ti99_common_init(running_machine *machine, const TMS9928a_interface *gfxparm) | |
| 423 | 423 | { |
| 424 | 424 | if (gfxparm != 0) |
| 425 | 425 | TMS9928A_configure(gfxparm); |
| r5932 | r5933 | |
| 432 | 432 | ti99_ide_init(machine); |
| 433 | 433 | ti99_hsgpl_init(machine); |
| 434 | 434 | ti99_usbsm_init(machine); |
| 435 | ||
| 435 | ||
| 436 | 436 | /* Find the cartslot device and cache it. This is a string search, |
| 437 | ||
| 437 | and we don't want to repeat it on each memory access. */ | |
| 438 | 438 | cartslots = devtag_get_device(machine, "ti99_multicart"); |
| 439 | 439 | assert(cartslots != NULL); |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | |
| 443 | 443 | /* |
| 444 | ||
| 444 | ti99_init_machine(); called before ti99_load_rom... | |
| 445 | 445 | */ |
| 446 | 446 | MACHINE_RESET( ti99 ) |
| 447 | 447 | { |
| r5932 | r5933 | |
| 470 | 470 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + offset_sram); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | /* if (ti99_model != model_99_4p) | |
| 474 | { | |
| 475 | if (ti99_model == model_99_8) | |
| 476 | current_page_ptr_8 = cartridge_pages_8[0]; | |
| 477 | else | |
| 478 | current_page_ptr = cartridge_pages[0]; | |
| 479 | } */ | |
| 473 | /* if (ti99_model != model_99_4p) | |
| 474 | { | |
| 475 | if (ti99_model == model_99_8) | |
| 476 | current_page_ptr_8 = cartridge_pages_8[0]; | |
| 477 | else | |
| 478 | current_page_ptr = cartridge_pages[0]; | |
| 479 | } */ | |
| 480 | 480 | |
| 481 | 481 | if (!has_evpc) TMS9928A_reset(); |
| 482 | 482 | else v9938_reset(0); |
| r5932 | r5933 | |
| 510 | 510 | has_hsgpl = ((ti99_model == model_99_4p) || (input_port_read(machine, "CFG") >> config_hsgpl_bit) & config_hsgpl_mask); |
| 511 | 511 | has_usb_sm = (input_port_read(machine, "CFG") >> config_usbsm_bit) & config_usbsm_mask; |
| 512 | 512 | has_pcode = (input_port_read(machine, "CFG") >> config_pcode_bit) & config_pcode_mask; |
| 513 | ||
| 513 | ||
| 514 | 514 | /* set up optional expansion hardware */ |
| 515 | 515 | ti99_peb_reset(ti99_model == model_99_4p, tms9901_set_int1, NULL); |
| 516 | 516 | |
| r5932 | r5933 | |
| 520 | 520 | if (ti99_model == model_99_4p) |
| 521 | 521 | ti99_4p_internal_dsr_reset(machine); |
| 522 | 522 | |
| 523 | if (has_speech) | |
| 523 | if (has_speech) | |
| 524 | 524 | { |
| 525 | 525 | static const spchroms_interface speech_intf = { region_speech_rom }; |
| 526 | 526 | |
| r5932 | r5933 | |
| 635 | 635 | |
| 636 | 636 | |
| 637 | 637 | /* |
| 638 | ||
| 638 | video initialization. | |
| 639 | 639 | */ |
| 640 | 640 | VIDEO_START( ti99_4ev ) |
| 641 | 641 | { |
| r5932 | r5933 | |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | /* |
| 647 | VBL interrupt (mmm... actually, it happens when the beam enters the lower | |
| 648 | border, so it is not a genuine VBI, but who cares ?) | |
| 647 | VBL interrupt (mmm... actually, it happens when the beam enters the lower | |
| 648 | border, so it is not a genuine VBI, but who cares ?) | |
| 649 | 649 | */ |
| 650 | 650 | INTERRUPT_GEN( ti99_vblank_interrupt ) |
| 651 | 651 | { |
| r5932 | r5933 | |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | /* |
| 674 | Backdoor function that is called by hsgpl, so that the machine code knows | |
| 675 | whether hsgpl or console GROMs are active | |
| 674 | Backdoor function that is called by hsgpl, so that the machine code knows | |
| 675 | whether hsgpl or console GROMs are active | |
| 676 | 676 | */ |
| 677 | 677 | void set_hsgpl_crdena(int data) |
| 678 | 678 | { |
| r5932 | r5933 | |
| 685 | 685 | #pragma mark MEMORY HANDLERS |
| 686 | 686 | #endif |
| 687 | 687 | /* |
| 688 | ||
| 688 | Memory handlers. | |
| 689 | 689 | |
| 690 | TODO: | |
| 691 | * actually implement GRAM support and GPL port support | |
| 690 | TODO: | |
| 691 | * actually implement GRAM support and GPL port support | |
| 692 | 692 | */ |
| 693 | 693 | |
| 694 | 694 | /* |
| 695 | Same as MRA16_NOP, but with an additionnal delay caused by the 16->8 bit | |
| 696 | bus multiplexer. | |
| 695 | Same as MRA16_NOP, but with an additionnal delay caused by the 16->8 bit | |
| 696 | bus multiplexer. | |
| 697 | 697 | */ |
| 698 | 698 | READ16_HANDLER ( ti99_nop_8_r ) |
| 699 | 699 | { |
| 700 | 700 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 701 | // | |
| 701 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 702 | 702 | |
| 703 | 703 | return (0); |
| 704 | 704 | } |
| r5932 | r5933 | |
| 706 | 706 | WRITE16_HANDLER ( ti99_nop_8_w ) |
| 707 | 707 | { |
| 708 | 708 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 709 | // | |
| 709 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | /* |
| 713 | ||
| 713 | 99/4p cartridge space: mapped either to internal ROM6 or to HSGPL. | |
| 714 | 714 | */ |
| 715 | 715 | READ16_HANDLER ( ti99_4p_cart_r ) |
| 716 | 716 | { |
| r5932 | r5933 | |
| 718 | 718 | return ti99_4p_internal_ROM6[offset]; |
| 719 | 719 | |
| 720 | 720 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 721 | // | |
| 721 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 722 | 722 | |
| 723 | 723 | if (hsgpl_crdena) |
| 724 | 724 | /* hsgpl is enabled */ |
| r5932 | r5933 | |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 739 | // | |
| 739 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 740 | 740 | |
| 741 | 741 | if (hsgpl_crdena) |
| 742 | 742 | /* hsgpl is enabled */ |
| r5932 | r5933 | |
| 745 | 745 | |
| 746 | 746 | /*---------------------------------------------------------------------------*/ |
| 747 | 747 | /* |
| 748 | ||
| 748 | memory-mapped register handlers. | |
| 749 | 749 | |
| 750 | 750 | Theory: |
| 751 | 751 | |
| 752 | These are registers to communicate with several peripherals. | |
| 753 | These registers are all 8-bit-wide, and are located at even adresses between | |
| 754 | 0x8400 and 0x9FFE. | |
| 755 | The registers are identified by (addr & 1C00), and, for VDP and GPL access, | |
| 756 | by (addr & 2). These registers are either read-only or write-only. (Or, | |
| 757 | more accurately, (addr & 4000) disables register read, whereas | |
| 758 | !(addr & 4000) disables register write.) | |
| 752 | These are registers to communicate with several peripherals. | |
| 753 | These registers are all 8-bit-wide, and are located at even adresses between | |
| 754 | 0x8400 and 0x9FFE. | |
| 755 | The registers are identified by (addr & 1C00), and, for VDP and GPL access, | |
| 756 | by (addr & 2). These registers are either read-only or write-only. (Or, | |
| 757 | more accurately, (addr & 4000) disables register read, whereas | |
| 758 | !(addr & 4000) disables register write.) | |
| 759 | 759 | |
| 760 | Memory mapped registers list: | |
| 761 | - write sound chip. (8400-87FE) | |
| 762 | - read VDP memory. (8800-8BFC), (addr&2) == 0 | |
| 763 | - read VDP status. (8802-8BFE), (addr&2) == 2 | |
| 764 | - write VDP memory. (8C00-8FFC), (addr&2) == 0 | |
| 765 | - write VDP address and VDP register. (8C02-8FFE), (addr&2) == 2 | |
| 766 | - read speech synthesis chip. (9000-93FE) | |
| 767 | - write speech synthesis chip. (9400-97FE) | |
| 768 | - read GPL memory. (9800-9BFC), (addr&2) == 0 (1) | |
| 769 | - read GPL adress. (9802-9BFE), (addr&2) == 2 (1) | |
| 770 | - write GPL memory. (9C00-9FFC), (addr&2) == 0 (1) | |
| 771 | - write GPL adress. (9C02-9FFE), (addr&2) == 2 (1) | |
| 760 | Memory mapped registers list: | |
| 761 | - write sound chip. (8400-87FE) | |
| 762 | - read VDP memory. (8800-8BFC), (addr&2) == 0 | |
| 763 | - read VDP status. (8802-8BFE), (addr&2) == 2 | |
| 764 | - write VDP memory. (8C00-8FFC), (addr&2) == 0 | |
| 765 | - write VDP address and VDP register. (8C02-8FFE), (addr&2) == 2 | |
| 766 | - read speech synthesis chip. (9000-93FE) | |
| 767 | - write speech synthesis chip. (9400-97FE) | |
| 768 | - read GPL memory. (9800-9BFC), (addr&2) == 0 (1) | |
| 769 | - read GPL adress. (9802-9BFE), (addr&2) == 2 (1) | |
| 770 | - write GPL memory. (9C00-9FFC), (addr&2) == 0 (1) | |
| 771 | - write GPL adress. (9C02-9FFE), (addr&2) == 2 (1) | |
| 772 | 772 | |
| 773 | 773 | (1) on some hardware, (addr & 0x3FC) provides a GPL page number. |
| 774 | 774 | */ |
| 775 | 775 | |
| 776 | 776 | /* |
| 777 | ||
| 777 | TMS9919 sound chip write | |
| 778 | 778 | */ |
| 779 | 779 | WRITE16_HANDLER ( ti99_wsnd_w ) |
| 780 | 780 | { |
| 781 | 781 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 782 | // | |
| 782 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 783 | 783 | |
| 784 | 784 | sn76496_w(devtag_get_device(space->machine, "sn76496"), offset, (data >> 8) & 0xff); |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | /* |
| 788 | ||
| 788 | TMS9918(A)/9928(A)/9929(A) VDP read | |
| 789 | 789 | */ |
| 790 | 790 | READ16_HANDLER ( ti99_rvdp_r ) |
| 791 | 791 | { |
| 792 | 792 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 793 | // | |
| 793 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 794 | 794 | |
| 795 | 795 | if (offset & 1) |
| 796 | 796 | { /* read VDP status */ |
| r5932 | r5933 | |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | /* |
| 806 | ||
| 806 | TMS9918(A)/9928(A)/9929(A) vdp write | |
| 807 | 807 | */ |
| 808 | 808 | WRITE16_HANDLER ( ti99_wvdp_w ) |
| 809 | 809 | { |
| 810 | 810 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 811 | // | |
| 811 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 812 | 812 | |
| 813 | 813 | if (offset & 1) |
| 814 | 814 | { /* write VDP address */ |
| r5932 | r5933 | |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /* |
| 824 | ||
| 824 | V38 VDP read | |
| 825 | 825 | */ |
| 826 | 826 | READ16_HANDLER ( ti99_rv38_r ) |
| 827 | 827 | { |
| 828 | 828 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 829 | // | |
| 829 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 830 | 830 | |
| 831 | 831 | if (offset & 1) |
| 832 | 832 | { /* read VDP status */ |
| r5932 | r5933 | |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | /* |
| 842 | ||
| 842 | V38 vdp write | |
| 843 | 843 | */ |
| 844 | 844 | WRITE16_HANDLER ( ti99_wv38_w ) |
| 845 | 845 | { |
| 846 | 846 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 847 | // | |
| 847 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 848 | 848 | |
| 849 | 849 | switch (offset & 3) |
| 850 | 850 | { |
| r5932 | r5933 | |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | /* |
| 871 | ||
| 871 | TMS0285 speech chip read | |
| 872 | 872 | */ |
| 873 | 873 | static READ16_HANDLER ( ti99_rspeech_r ) |
| 874 | 874 | { |
| r5932 | r5933 | |
| 884 | 884 | if (! tms5220_readyq_r()) |
| 885 | 885 | { |
| 886 | 886 | /* Weirdly enough, we are always seeing some problems even though |
| 887 | ||
| 887 | everything is working fine. */ | |
| 888 | 888 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready()); |
| 889 | 889 | logerror("ti99/4a speech says aaargh!\n"); |
| 890 | 890 | logerror("(time to ready: %f -> %d)\n", time_to_ready, (int) ceil(3000000*time_to_ready)); |
| r5932 | r5933 | |
| 894 | 894 | #endif |
| 895 | 895 | |
| 896 | 896 | /* |
| 897 | ||
| 897 | TMS0285 speech chip write | |
| 898 | 898 | */ |
| 899 | 899 | static WRITE16_HANDLER ( ti99_wspeech_w ) |
| 900 | 900 | { |
| r5932 | r5933 | |
| 902 | 902 | |
| 903 | 903 | #if 1 |
| 904 | 904 | /* the stupid design of the tms5220 core means that ready is cleared when |
| 905 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the | |
| 906 | case, we would need to store the value on the bus, which would be more | |
| 907 | complex. */ | |
| 905 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the | |
| 906 | case, we would need to store the value on the bus, which would be more | |
| 907 | complex. */ | |
| 908 | 908 | if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220"))) |
| 909 | 909 | { |
| 910 | 910 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220"))); |
| r5932 | r5933 | |
| 925 | 925 | UINT8 reply; |
| 926 | 926 | if (console_GROMs.addr >= 0x6000) |
| 927 | 927 | { |
| 928 | /* Pass the (one and only) program counter for GROMs. The | |
| 929 | buffer is set and used in the cartridge chip. */ | |
| 928 | /* Pass the (one and only) program counter for GROMs. The | |
| 929 | buffer is set and used in the cartridge chip. */ | |
| 930 | 930 | reply = cartridge_grom_read(cartslots, console_GROMs.addr-0x6000); |
| 931 | 931 | } |
| 932 | else | |
| 932 | else | |
| 933 | 933 | { |
| 934 | /* GROMs are buffered. Data is retrieved from a buffer, | |
| 935 | while the buffer is replaced with the next cell | |
| 936 | content. */ | |
| 934 | /* GROMs are buffered. Data is retrieved from a buffer, | |
| 935 | while the buffer is replaced with the next cell | |
| 936 | content. */ | |
| 937 | 937 | reply = console_GROMs.buf; |
| 938 | ||
| 938 | ||
| 939 | 939 | /* Get next value, put it in buffer. Note that the |
| 940 | ||
| 940 | GROM wraps at 8K boundaries. */ | |
| 941 | 941 | console_GROMs.buf = console_GROMs.data_ptr[console_GROMs.addr]; |
| 942 | 942 | } |
| 943 | 943 | |
| 944 | // printf("GROM address = %04x, reply = %02x\n", console_GROMs.addr, reply>>8); | |
| 945 | /* The program counter wraps at each GROM chip size (8K), | |
| 946 | so 0x5fff + 1 = 0x4000. */ | |
| 944 | // printf("GROM address = %04x, reply = %02x\n", console_GROMs.addr, reply>>8); | |
| 945 | /* The program counter wraps at each GROM chip size (8K), | |
| 946 | so 0x5fff + 1 = 0x4000. */ | |
| 947 | 947 | console_GROMs.addr = ((console_GROMs.addr + 1) & 0x1FFF) | (console_GROMs.addr & 0xE000); |
| 948 | ||
| 948 | ||
| 949 | 949 | /* Reset the read and write address flipflops. */ |
| 950 | 950 | console_GROMs.raddr_LSB = console_GROMs.waddr_LSB = FALSE; |
| 951 | 951 | |
| r5932 | r5933 | |
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | /* |
| 956 | ||
| 956 | GPL read | |
| 957 | 957 | */ |
| 958 | 958 | READ16_HANDLER ( ti99_grom_r ) |
| 959 | 959 | { |
| 960 | 960 | UINT16 reply; |
| 961 | 961 | |
| 962 | 962 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4 /*20+3*/); /* from 4 to 23? */ |
| 963 | // | |
| 963 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 964 | 964 | |
| 965 | 965 | /* This implementation features a multislot cartridge system which |
| 966 | is based on multiple GROM base addresses. The standard base | |
| 967 | is >9800 (slot 0). When we access the port >9804, we switch to | |
| 968 | slot 1, >9808 is slot 2, ... >983C is slot 15. Although theoretically | |
| 969 | we could address up to 256 banks, the TI operating system does not | |
| 970 | check more than 16 banks. | |
| 971 | Cartridges may also contain ROMs which need to be banked | |
| 972 | simultaneously. We use the cartridge slot number to swap the ROM at | |
| 973 | >6000, or RAM if available. I don't know whether this is the way | |
| 974 | Texas Instruments envisaged it in the OS, but it is the only | |
| 975 | plausible way to allow for GROM+ROM cartridges. | |
| 976 | Note that some cartridges may have programming flaws which only | |
| 977 | appear when the cartridge is used in a higher-numbered slot. | |
| 978 | Parsec is one example which only runs in slot 0 as the | |
| 979 | programmers hard-coded an access to GROM port 0. Note: This *may* | |
| 980 | be worked around if we make sure that switching only occurs | |
| 981 | when the address is set, not when data is read or written. But | |
| 982 | it's not clear whether this has unwanted side effects. | |
| 983 | */ | |
| 984 | ||
| 966 | is based on multiple GROM base addresses. The standard base | |
| 967 | is >9800 (slot 0). When we access the port >9804, we switch to | |
| 968 | slot 1, >9808 is slot 2, ... >983C is slot 15. Although theoretically | |
| 969 | we could address up to 256 banks, the TI operating system does not | |
| 970 | check more than 16 banks. | |
| 971 | Cartridges may also contain ROMs which need to be banked | |
| 972 | simultaneously. We use the cartridge slot number to swap the ROM at | |
| 973 | >6000, or RAM if available. I don't know whether this is the way | |
| 974 | Texas Instruments envisaged it in the OS, but it is the only | |
| 975 | plausible way to allow for GROM+ROM cartridges. | |
| 976 | Note that some cartridges may have programming flaws which only | |
| 977 | appear when the cartridge is used in a higher-numbered slot. | |
| 978 | Parsec is one example which only runs in slot 0 as the | |
| 979 | programmers hard-coded an access to GROM port 0. Note: This *may* | |
| 980 | be worked around if we make sure that switching only occurs | |
| 981 | when the address is set, not when data is read or written. But | |
| 982 | it's not clear whether this has unwanted side effects. | |
| 983 | */ | |
| 984 | ||
| 985 | 985 | /* Activates a slot in the multi-cartridge extender. */ |
| 986 | 986 | cartridge_slot_set(cartslots, (offset & 0x01fe)/2); |
| 987 | ||
| 987 | ||
| 988 | 988 | if (offset & 1) |
| 989 | 989 | { /* Read GROM address |
| 990 | We only have one GROM program counter for the console GROMs | |
| 991 | and all cartridge GROMs in all banks(!). Hardware | |
| 992 | implementations must take this into account as well. Thus, | |
| 993 | we use a structure here in the console, rather than separate | |
| 994 | counters in each GROM chip. */ | |
| 995 | ||
| 996 | /* When reading, reset the hi/lo flag byte for writing. | |
| 997 | TODO: Verify this with a real machine. */ | |
| 990 | We only have one GROM program counter for the console GROMs | |
| 991 | and all cartridge GROMs in all banks(!). Hardware | |
| 992 | implementations must take this into account as well. Thus, | |
| 993 | we use a structure here in the console, rather than separate | |
| 994 | counters in each GROM chip. */ | |
| 995 | ||
| 996 | /* When reading, reset the hi/lo flag byte for writing. | |
| 997 | TODO: Verify this with a real machine. */ | |
| 998 | 998 | console_GROMs.waddr_LSB = FALSE; |
| 999 | 999 | |
| 1000 | 1000 | /* Address reading is done in two steps; first, the high byte |
| 1001 | ||
| 1001 | is transferred, then the low byte. */ | |
| 1002 | 1002 | if (console_GROMs.raddr_LSB) |
| 1003 | 1003 | { |
| 1004 | 1004 | /* second pass */ |
| r5932 | r5933 | |
| 1013 | 1013 | } |
| 1014 | 1014 | } |
| 1015 | 1015 | else |
| 1016 | { | |
| 1016 | { | |
| 1017 | 1017 | /* Read GROM data */ |
| 1018 | reply = ((UINT16)GROM_dataread()) << 8; | |
| 1018 | reply = ((UINT16)GROM_dataread()) << 8; | |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | if (hsgpl_crdena) |
| r5932 | r5933 | |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | /* |
| 1029 | ||
| 1029 | GPL write | |
| 1030 | 1030 | */ |
| 1031 | 1031 | WRITE16_HANDLER ( ti99_grom_w ) |
| 1032 | 1032 | { |
| 1033 | 1033 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4/*20+3*/); /* from 4 to 23? */ |
| 1034 | // | |
| 1034 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 1035 | 1035 | |
| 1036 | 1036 | /* Activates a slot in the multi-cartridge extender. */ |
| 1037 | 1037 | cartridge_slot_set(cartslots, (offset & 0x01fe)/2); |
| 1038 | 1038 | |
| 1039 | 1039 | // 1001 1wbb bbbb bbr0 |
| 1040 | ||
| 1040 | ||
| 1041 | 1041 | if (offset & 1) |
| 1042 | 1042 | { /* write GROM address */ |
| 1043 | 1043 | /* see comments above */ |
| 1044 | 1044 | console_GROMs.raddr_LSB = FALSE; |
| 1045 | ||
| 1045 | ||
| 1046 | 1046 | /* Implements the internal flipflop. |
| 1047 | The Editor/Assembler manuals says that the current address | |
| 1048 | plus one is returned. This effect is properly emulated | |
| 1049 | as we are using a read-ahead buffer. | |
| 1050 | */ | |
| 1047 | The Editor/Assembler manuals says that the current address | |
| 1048 | plus one is returned. This effect is properly emulated | |
| 1049 | as we are using a read-ahead buffer. | |
| 1050 | */ | |
| 1051 | 1051 | if (console_GROMs.waddr_LSB) |
| 1052 | 1052 | { |
| 1053 | 1053 | /* Accept low byte (2nd write) */ |
| 1054 | 1054 | console_GROMs.addr = (console_GROMs.addr & 0xFF00) | ((data >> 8) & 0xFF); |
| 1055 | ||
| 1056 | /* Setting the address causes a new read, putting the | |
| 1057 | value into the buffer. We don't need the value here. */ | |
| 1055 | ||
| 1056 | /* Setting the address causes a new read, putting the | |
| 1057 | value into the buffer. We don't need the value here. */ | |
| 1058 | 1058 | GROM_dataread(); |
| 1059 | 1059 | console_GROMs.waddr_LSB = FALSE; |
| 1060 | 1060 | } |
| r5932 | r5933 | |
| 1071 | 1071 | /* write GROM data */ |
| 1072 | 1072 | /* the console GROMs are always affected */ |
| 1073 | 1073 | /* BTW, console GROMs are never GRAMs, therefore there is no |
| 1074 | need to actually write anything, so we just read ahead | |
| 1075 | TODO: There could be cartridges with GRAM, so this must be | |
| 1076 | fixed. | |
| 1077 | */ | |
| 1074 | need to actually write anything, so we just read ahead | |
| 1075 | TODO: There could be cartridges with GRAM, so this must be | |
| 1076 | fixed. | |
| 1077 | */ | |
| 1078 | 1078 | GROM_dataread(); |
| 1079 | 1079 | console_GROMs.raddr_LSB = console_GROMs.waddr_LSB = FALSE; |
| 1080 | 1080 | } |
| r5932 | r5933 | |
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | /* |
| 1087 | GROM read for TI-99/8 | |
| 1088 | For comments, see the handler for TI-99/4A | |
| 1087 | GROM read for TI-99/8 | |
| 1088 | For comments, see the handler for TI-99/4A | |
| 1089 | 1089 | */ |
| 1090 | 1090 | static READ8_HANDLER ( ti99_grom_r8 ) |
| 1091 | 1091 | { |
| 1092 | 1092 | UINT8 reply; |
| 1093 | 1093 | |
| 1094 | 1094 | cpu_adjust_icount(space->machine->firstcpu,-4); |
| 1095 | ||
| 1095 | ||
| 1096 | 1096 | /* Activates a slot in the multi-cartridge extender. */ |
| 1097 | 1097 | // 1001 1wbb bbbb bbr0 |
| 1098 | 1098 | cartridge_slot_set(cartslots, (offset & 0x03fc)/4); |
| 1099 | ||
| 1099 | ||
| 1100 | 1100 | if (offset & 2) |
| 1101 | { | |
| 1101 | { | |
| 1102 | 1102 | console_GROMs.waddr_LSB = FALSE; |
| 1103 | 1103 | |
| 1104 | 1104 | if (console_GROMs.raddr_LSB) |
| r5932 | r5933 | |
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | else |
| 1116 | reply = GROM_dataread(); | |
| 1116 | reply = GROM_dataread(); | |
| 1117 | 1117 | |
| 1118 | 1118 | return reply; |
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 1121 | 1121 | /* |
| 1122 | GROM write for TI-99/8 | |
| 1123 | For comments, see the handler for TI-99/4A | |
| 1122 | GROM write for TI-99/8 | |
| 1123 | For comments, see the handler for TI-99/4A | |
| 1124 | 1124 | */ |
| 1125 | 1125 | static WRITE8_HANDLER ( ti99_grom_w8 ) |
| 1126 | 1126 | { |
| r5932 | r5933 | |
| 1128 | 1128 | |
| 1129 | 1129 | /* Activates a slot in the multi-cartridge extender. */ |
| 1130 | 1130 | cartridge_slot_set(cartslots, (offset & 0x03fc)/4); |
| 1131 | ||
| 1131 | ||
| 1132 | 1132 | if (offset & 2) |
| 1133 | 1133 | { |
| 1134 | 1134 | console_GROMs.raddr_LSB = FALSE; |
| 1135 | 1135 | if (console_GROMs.waddr_LSB) |
| 1136 | 1136 | { |
| 1137 | 1137 | console_GROMs.addr = (console_GROMs.addr & 0xFF00) | (data & 0xFF); |
| 1138 | ||
| 1138 | ||
| 1139 | 1139 | GROM_dataread(); |
| 1140 | 1140 | console_GROMs.waddr_LSB = FALSE; |
| 1141 | 1141 | } |
| r5932 | r5933 | |
| 1155 | 1155 | |
| 1156 | 1156 | |
| 1157 | 1157 | /* |
| 1158 | ||
| 1158 | GROM read for TI-99/4p | |
| 1159 | 1159 | */ |
| 1160 | 1160 | READ16_HANDLER ( ti99_4p_grom_r ) |
| 1161 | 1161 | { |
| 1162 | 1162 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); /* HSGPL is located on 8-bit bus? */ |
| 1163 | // | |
| 1163 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 1164 | 1164 | |
| 1165 | 1165 | return /*hsgpl_crdena ?*/ ti99_hsgpl_gpl_r(space, offset, mem_mask) /*: 0*/; |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | /* |
| 1169 | ||
| 1169 | GROM write | |
| 1170 | 1170 | */ |
| 1171 | 1171 | WRITE16_HANDLER ( ti99_4p_grom_w ) |
| 1172 | 1172 | { |
| 1173 | 1173 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); /* HSGPL is located on 8-bit bus? */ |
| 1174 | // | |
| 1174 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 1175 | 1175 | |
| 1176 | 1176 | /*if (hsgpl_crdena)*/ |
| 1177 | 1177 | ti99_hsgpl_gpl_w(space, offset, data, mem_mask); |
| r5932 | r5933 | |
| 1192 | 1192 | |
| 1193 | 1193 | if (ti99_8_enable_rom_and_ports) |
| 1194 | 1194 | { |
| 1195 | /* This is only important for address access 0000-1fff and | |
| 1196 | 8000-9fff. Outside, the mapper mode is used. */ | |
| 1195 | /* This is only important for address access 0000-1fff and | |
| 1196 | 8000-9fff. Outside, the mapper mode is used. */ | |
| 1197 | 1197 | if ((offset >= 0x0000) && (offset < 0x2000)) |
| 1198 | 1198 | { |
| 1199 | 1199 | /* ROM */ |
| r5932 | r5933 | |
| 1212 | 1212 | break; |
| 1213 | 1213 | |
| 1214 | 1214 | case 1: |
| 1215 | /* >8400 - >840f: sound (cannot read) | |
| 1216 | >8410 - >87ff: SRAM */ | |
| 1215 | /* >8400 - >840f: sound (cannot read) | |
| 1216 | >8410 - >87ff: SRAM */ | |
| 1217 | 1217 | if (offset >= 0x8410) |
| 1218 | 1218 | reply = sRAM_ptr_8[offset & 0x1fff]; |
| 1219 | 1219 | break; |
| r5932 | r5933 | |
| 1268 | 1268 | |
| 1269 | 1269 | /* test read protect */ |
| 1270 | 1270 | /*if (mapper_reg & 0x20000000) |
| 1271 | ||
| 1271 | ;*/ | |
| 1272 | 1272 | |
| 1273 | 1273 | /* test execute protect */ |
| 1274 | 1274 | /*if (mapper_reg & 0x40000000) |
| 1275 | ||
| 1275 | ;*/ | |
| 1276 | 1276 | |
| 1277 | 1277 | if (offset < 0x010000) |
| 1278 | 1278 | /* Read RAM */ |
| r5932 | r5933 | |
| 1304 | 1304 | /* ff6000 - ff7fff: cartridge ROM space */ |
| 1305 | 1305 | offset &= 0x1fff; |
| 1306 | 1306 | |
| 1307 | /* We do not support hsgpl here because it is a 16 bit | |
| 1308 | system. Just check the cartridges. */ | |
| 1309 | reply = ti99_multicart8_r(multicart8, offset); | |
| 1307 | /* We do not support hsgpl here because it is a 16 bit | |
| 1308 | system. Just check the cartridges. */ | |
| 1309 | reply = ti99_multicart8_r(multicart8, offset); | |
| 1310 | 1310 | break; |
| 1311 | 1311 | |
| 1312 | 1312 | case 5: |
| r5932 | r5933 | |
| 1406 | 1406 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-48*4); /* this is just an approx. minimum, it can be much more */ |
| 1407 | 1407 | |
| 1408 | 1408 | /* the stupid design of the tms5220 core means that ready is cleared when |
| 1409 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the | |
| 1410 | case, we would need to store the value on the bus, which would be more | |
| 1411 | complex. */ | |
| 1409 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the | |
| 1410 | case, we would need to store the value on the bus, which would be more | |
| 1411 | complex. */ | |
| 1412 | 1412 | if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220"))) |
| 1413 | 1413 | { |
| 1414 | 1414 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220"))); |
| r5932 | r5933 | |
| 1441 | 1441 | } |
| 1442 | 1442 | |
| 1443 | 1443 | mapper_reg = ti99_8_mapper_regs[page]; |
| 1444 | ||
| 1445 | /* 4 KiB page size */ | |
| 1444 | ||
| 1445 | /* 4 KiB page size */ | |
| 1446 | 1446 | offset = (mapper_reg + (offset & 0x0fff)) & 0x00ffffff; |
| 1447 | 1447 | |
| 1448 | 1448 | /* test write protect */ |
| 1449 | 1449 | /*if (mapper_reg & 0x80000000) |
| 1450 | ||
| 1450 | ;*/ | |
| 1451 | 1451 | |
| 1452 | 1452 | if (offset < 0x010000) |
| 1453 | 1453 | { /* Write RAM */ |
| r5932 | r5933 | |
| 1477 | 1477 | case 3: |
| 1478 | 1478 | /* cartridge space */ |
| 1479 | 1479 | /* We do not support HSGPL for the 99/8 at this time. */ |
| 1480 | ti99_multicart8_w(multicart8, offset & 0x1fff, data); | |
| 1480 | ti99_multicart8_w(multicart8, offset & 0x1fff, data); | |
| 1481 | 1481 | break; |
| 1482 | 1482 | |
| 1483 | 1483 | case 5: |
| r5932 | r5933 | |
| 1501 | 1501 | #pragma mark TI-99/4 HANDSETS |
| 1502 | 1502 | #endif |
| 1503 | 1503 | /* |
| 1504 | ||
| 1504 | Handset support (TI99/4 only) | |
| 1505 | 1505 | |
| 1506 | The ti99/4 was intended to support some so-called "IR remote handsets". | |
| 1507 | This feature was canceled at the last minute (reportedly ten minutes before | |
| 1508 | the introductory press conference in June 1979), but the first thousands of | |
| 1509 | 99/4 units had the required port, and the support code was seemingly not | |
| 1510 | deleted from ROMs until the introduction of the ti99/4a in 1981. You could | |
| 1511 | connect up to 4 20-key keypads, and up to 4 joysticks with a maximum | |
| 1512 | resolution of 15 levels on each axis. | |
| 1506 | The ti99/4 was intended to support some so-called "IR remote handsets". | |
| 1507 | This feature was canceled at the last minute (reportedly ten minutes before | |
| 1508 | the introductory press conference in June 1979), but the first thousands of | |
| 1509 | 99/4 units had the required port, and the support code was seemingly not | |
| 1510 | deleted from ROMs until the introduction of the ti99/4a in 1981. You could | |
| 1511 | connect up to 4 20-key keypads, and up to 4 joysticks with a maximum | |
| 1512 | resolution of 15 levels on each axis. | |
| 1513 | 1513 | |
| 1514 | The keyboard DSR was able to couple two 20-key keypads together to emulate | |
| 1515 | a full 40-key keyboard. Keyboard modes 0, 1 and 2 would select either the | |
| 1516 | console keyboard with its two wired remote controllers (i.e. joysticks), or | |
| 1517 | remote handsets 1 and 2 with their associated IR remote controllers (i.e. | |
| 1518 | joysticks), according to which was currently active. | |
| 1514 | The keyboard DSR was able to couple two 20-key keypads together to emulate | |
| 1515 | a full 40-key keyboard. Keyboard modes 0, 1 and 2 would select either the | |
| 1516 | console keyboard with its two wired remote controllers (i.e. joysticks), or | |
| 1517 | remote handsets 1 and 2 with their associated IR remote controllers (i.e. | |
| 1518 | joysticks), according to which was currently active. | |
| 1519 | 1519 | */ |
| 1520 | 1520 | |
| 1521 | 1521 | /* |
| 1522 | ||
| 1522 | ti99_handset_poll_bus() | |
| 1523 | 1523 | |
| 1524 | Poll the current state of the 4-bit data bus that goes from the I/R | |
| 1525 | receiver to the tms9901. | |
| 1524 | Poll the current state of the 4-bit data bus that goes from the I/R | |
| 1525 | receiver to the tms9901. | |
| 1526 | 1526 | */ |
| 1527 | 1527 | static int ti99_handset_poll_bus(void) |
| 1528 | 1528 | { |
| r5932 | r5933 | |
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | /* |
| 1533 | ||
| 1533 | ti99_handset_ack_callback() | |
| 1534 | 1534 | |
| 1535 | Handle data acknowledge sent by the ti-99/4 handset ISR (through tms9901 | |
| 1536 | line P0). This function is called by a delayed timer 30us after the state | |
| 1537 | of P0 is changed, because, in one occasion, the ISR asserts the line before | |
| 1538 | it reads the data, so we need to delay the acknowledge process. | |
| 1535 | Handle data acknowledge sent by the ti-99/4 handset ISR (through tms9901 | |
| 1536 | line P0). This function is called by a delayed timer 30us after the state | |
| 1537 | of P0 is changed, because, in one occasion, the ISR asserts the line before | |
| 1538 | it reads the data, so we need to delay the acknowledge process. | |
| 1539 | 1539 | */ |
| 1540 | 1540 | static TIMER_CALLBACK(ti99_handset_ack_callback) |
| 1541 | 1541 | { |
| r5932 | r5933 | |
| 1547 | 1547 | if (handset_buflen == 1) |
| 1548 | 1548 | { |
| 1549 | 1549 | /* Unless I am missing something, the third and last nybble of the |
| 1550 | message is not acknowledged by the DSR in any way, and the first nybble | |
| 1551 | of next message is not requested for either, so we need to decide on | |
| 1552 | our own when we can post a new event. Currently, we wait for 1000us | |
| 1553 | after the DSR acknowledges the second nybble. */ | |
| 1550 | message is not acknowledged by the DSR in any way, and the first nybble | |
| 1551 | of next message is not requested for either, so we need to decide on | |
| 1552 | our own when we can post a new event. Currently, we wait for 1000us | |
| 1553 | after the DSR acknowledges the second nybble. */ | |
| 1554 | 1554 | timer_set(machine, ATTOTIME_IN_USEC(1000), NULL, 0, ti99_handset_ack_callback); |
| 1555 | 1555 | } |
| 1556 | 1556 | |
| r5932 | r5933 | |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | /* |
| 1563 | ||
| 1563 | ti99_handset_set_ack() | |
| 1564 | 1564 | |
| 1565 | ||
| 1565 | Handler for tms9901 P0 pin (handset data acknowledge) | |
| 1566 | 1566 | */ |
| 1567 | 1567 | static WRITE8_DEVICE_HANDLER( ti99_handset_set_ack ) |
| 1568 | 1568 | { |
| r5932 | r5933 | |
| 1576 | 1576 | } |
| 1577 | 1577 | |
| 1578 | 1578 | /* |
| 1579 | ||
| 1579 | ti99_handset_post_message() | |
| 1580 | 1580 | |
| 1581 | Post a 12-bit message: trigger an interrupt on the tms9901, and store the | |
| 1582 | message in the I/R receiver buffer so that the handset ISR will read this | |
| 1583 | message. | |
| 1581 | Post a 12-bit message: trigger an interrupt on the tms9901, and store the | |
| 1582 | message in the I/R receiver buffer so that the handset ISR will read this | |
| 1583 | message. | |
| 1584 | 1584 | |
| 1585 | ||
| 1585 | message: 12-bit message to post (only the 12 LSBits are meaningful) | |
| 1586 | 1586 | */ |
| 1587 | 1587 | static void ti99_handset_post_message(running_machine *machine, int message) |
| 1588 | 1588 | { |
| r5932 | r5933 | |
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | 1596 | /* |
| 1597 | ||
| 1597 | ti99_handset_poll_keyboard() | |
| 1598 | 1598 | |
| 1599 | ||
| 1599 | Poll the current state of one given handset keypad. | |
| 1600 | 1600 | |
| 1601 | ||
| 1601 | num: number of the keypad to poll (0-3) | |
| 1602 | 1602 | |
| 1603 | ||
| 1603 | Returns TRUE if the handset state has changed and a message was posted. | |
| 1604 | 1604 | */ |
| 1605 | 1605 | static int ti99_handset_poll_keyboard(running_machine *machine, int num) |
| 1606 | 1606 | { |
| r5932 | r5933 | |
| 1615 | 1615 | key_buf = ( input_port_read(machine, keynames[num]) | (input_port_read(machine, keynames[num + 1]) << 16) ) >> (4*num); |
| 1616 | 1616 | |
| 1617 | 1617 | /* If a key was previously pressed, this key was not shift, and this key is |
| 1618 | ||
| 1618 | still down, then don't change the current key press. */ | |
| 1619 | 1619 | if (previous_key[num] && (previous_key[num] != 0x24) |
| 1620 | 1620 | && (key_buf & (1 << (previous_key[num] & 0x1f)))) |
| 1621 | 1621 | { |
| r5932 | r5933 | |
| 1626 | 1626 | else |
| 1627 | 1627 | { |
| 1628 | 1628 | /* the shift modifier state has changed: we need to update the |
| 1629 | ||
| 1629 | keyboard state */ | |
| 1630 | 1630 | if (key_buf & 0x0008) |
| 1631 | 1631 | { /* shift has been pressed down */ |
| 1632 | 1632 | previous_key[num] = current_key = previous_key[num] | 0x20; |
| r5932 | r5933 | |
| 1654 | 1654 | |
| 1655 | 1655 | if (current_key != 0x24) |
| 1656 | 1656 | /* If this is the shift key, any other key we may find will |
| 1657 | have higher priority; otherwise, we may exit the loop and keep | |
| 1658 | the key we have just found. */ | |
| 1657 | have higher priority; otherwise, we may exit the loop and keep | |
| 1658 | the key we have just found. */ | |
| 1659 | 1659 | break; |
| 1660 | 1660 | } |
| 1661 | 1661 | } |
| r5932 | r5933 | |
| 1674 | 1674 | } |
| 1675 | 1675 | |
| 1676 | 1676 | /* |
| 1677 | ||
| 1677 | ti99_handset_poll_joystick() | |
| 1678 | 1678 | |
| 1679 | ||
| 1679 | Poll the current state of one given handset joystick. | |
| 1680 | 1680 | |
| 1681 | ||
| 1681 | num: number of the joystick to poll (0-3) | |
| 1682 | 1682 | |
| 1683 | ||
| 1683 | Returns TRUE if the handset state has changed and a message was posted. | |
| 1684 | 1684 | */ |
| 1685 | 1685 | static int ti99_handset_poll_joystick(running_machine *machine, int num) |
| 1686 | 1686 | { |
| r5932 | r5933 | |
| 1712 | 1712 | |
| 1713 | 1713 | /* set sign */ |
| 1714 | 1714 | /* note that we set the sign if the joystick position is 0 to work |
| 1715 | ||
| 1715 | around a bug in the ti99/4 ROMs */ | |
| 1716 | 1716 | if (current_joy_x <= 0) |
| 1717 | 1717 | { |
| 1718 | 1718 | message |= 0x040; |
| r5932 | r5933 | |
| 1751 | 1751 | } |
| 1752 | 1752 | |
| 1753 | 1753 | /* |
| 1754 | ||
| 1754 | ti99_handset_task() | |
| 1755 | 1755 | |
| 1756 | ||
| 1756 | Manage handsets, posting an event if the state of any handset has changed. | |
| 1757 | 1757 | */ |
| 1758 | 1758 | static void ti99_handset_task(running_machine *machine) |
| 1759 | 1759 | { |
| r5932 | r5933 | |
| 1791 | 1791 | static void mecmouse_select(int selnow, int stick1, int stick2) |
| 1792 | 1792 | { |
| 1793 | 1793 | /* The Mechatronic mouse is connected to the joystick port and occupies |
| 1794 | both joystick select lines and the switch lines. From these five | |
| 1795 | lines, left/right/down are used for the motion (i.e. 3 motion steps | |
| 1796 | for positive and four for negative motion and one for rest), | |
| 1797 | the fire line is used for the secondary mouse button, and the up | |
| 1798 | line is used for the primary button. | |
| 1799 | The mouse motion is delivered by the same lines for both directions; | |
| 1800 | this requires swapping the axes. According to the source code of | |
| 1801 | the accompanying mouse driver, the readout of the current axis is | |
| 1802 | done by selecting joystick 1, then joystick 2. The axis swapping is | |
| 1803 | achieved by selecting stick 1 again. When selecting stick 2, the | |
| 1804 | second axis is seen on the input lines. | |
| 1805 | Interrupting this sequence will lead to swapped axes. This is | |
| 1806 | prevented by resetting the toggle when the mouse is deselected | |
| 1807 | (neither 1 nor 2 are selected). | |
| 1794 | both joystick select lines and the switch lines. From these five | |
| 1795 | lines, left/right/down are used for the motion (i.e. 3 motion steps | |
| 1796 | for positive and four for negative motion and one for rest), | |
| 1797 | the fire line is used for the secondary mouse button, and the up | |
| 1798 | line is used for the primary button. | |
| 1799 | The mouse motion is delivered by the same lines for both directions; | |
| 1800 | this requires swapping the axes. According to the source code of | |
| 1801 | the accompanying mouse driver, the readout of the current axis is | |
| 1802 | done by selecting joystick 1, then joystick 2. The axis swapping is | |
| 1803 | achieved by selecting stick 1 again. When selecting stick 2, the | |
| 1804 | second axis is seen on the input lines. | |
| 1805 | Interrupting this sequence will lead to swapped axes. This is | |
| 1806 | prevented by resetting the toggle when the mouse is deselected | |
| 1807 | (neither 1 nor 2 are selected). | |
| 1808 | 1808 | |
| 1809 | The joystick lines are selected as follows: | |
| 1810 | TI-99/4: Stick 1: P4=1, P3=0, P2=1 (5) | |
| 1811 | Stick 2: P4=1, P3=1, P2=0 (6) | |
| 1812 | ||
| 1813 | TI-99/4A: Stick 1: P4=1, P3=1, P2=0 (6) | |
| 1814 | Stick 2: P4=1, P3=1, P2=1 (7) | |
| 1809 | The joystick lines are selected as follows: | |
| 1810 | TI-99/4: Stick 1: P4=1, P3=0, P2=1 (5) | |
| 1811 | Stick 2: P4=1, P3=1, P2=0 (6) | |
| 1815 | 1812 | |
| 1816 | TI-99/8: Stick 1: P3=1, P2=1, P1=1, P0=0 (14) | |
| 1817 | Stick 2: P3=1, P2=1, P1=1, P0=1 (15) | |
| 1818 | ||
| 1819 | Geneve: n/a, has own mouse handling via v9938 | |
| 1820 | ||
| 1821 | As we can only deliver at max 3 steps positive and 4 steps negative, | |
| 1822 | we split the delta so that subsequent queries add up to the actual | |
| 1823 | delta. That is, one delta of +10 yields a 3+3+3+1. | |
| 1824 | ||
| 1825 | mecmouse_x holds the current delta to be counted down for x | |
| 1826 | (y accordingly) | |
| 1813 | TI-99/4A: Stick 1: P4=1, P3=1, P2=0 (6) | |
| 1814 | Stick 2: P4=1, P3=1, P2=1 (7) | |
| 1827 | 1815 | |
| 1828 | mecmouse_x_buf is the current step count reported to CRU | |
| 1829 | ||
| 1830 | Michael Zapf, 2008-01-22 | |
| 1831 | */ | |
| 1832 | ||
| 1816 | TI-99/8: Stick 1: P3=1, P2=1, P1=1, P0=0 (14) | |
| 1817 | Stick 2: P3=1, P2=1, P1=1, P0=1 (15) | |
| 1818 | ||
| 1819 | Geneve: n/a, has own mouse handling via v9938 | |
| 1820 | ||
| 1821 | As we can only deliver at max 3 steps positive and 4 steps negative, | |
| 1822 | we split the delta so that subsequent queries add up to the actual | |
| 1823 | delta. That is, one delta of +10 yields a 3+3+3+1. | |
| 1824 | ||
| 1825 | mecmouse_x holds the current delta to be counted down for x | |
| 1826 | (y accordingly) | |
| 1827 | ||
| 1828 | mecmouse_x_buf is the current step count reported to CRU | |
| 1829 | ||
| 1830 | Michael Zapf, 2008-01-22 | |
| 1831 | */ | |
| 1832 | ||
| 1833 | 1833 | if (selnow==stick2) { |
| 1834 | 1834 | if (mecmouse_sel==stick1) { |
| 1835 | 1835 | if (! mecmouse_read_y) |
| r5932 | r5933 | |
| 1844 | 1844 | mecmouse_x -= mecmouse_x_buf; |
| 1845 | 1845 | mecmouse_x_buf = (mecmouse_x_buf-1) & 7; |
| 1846 | 1846 | } |
| 1847 | else | |
| 1847 | else | |
| 1848 | 1848 | { |
| 1849 | 1849 | /* Sample y motion. */ |
| 1850 | 1850 | if (mecmouse_y < -4) |
| r5932 | r5933 | |
| 1859 | 1859 | } |
| 1860 | 1860 | mecmouse_sel = selnow; |
| 1861 | 1861 | } |
| 1862 | else if (selnow==stick1) | |
| 1862 | else if (selnow==stick1) | |
| 1863 | 1863 | { |
| 1864 | 1864 | if (mecmouse_sel==stick2) |
| 1865 | 1865 | { |
| r5932 | r5933 | |
| 1868 | 1868 | } |
| 1869 | 1869 | mecmouse_sel = selnow; |
| 1870 | 1870 | } |
| 1871 | else | |
| 1871 | else | |
| 1872 | 1872 | { |
| 1873 | 1873 | /* Reset the axis toggle when the mouse is deselected */ |
| 1874 | 1874 | mecmouse_read_y = 0; |
| r5932 | r5933 | |
| 1886 | 1886 | |
| 1887 | 1887 | /* compute x delta */ |
| 1888 | 1888 | delta_x = new_mx - last_mx; |
| 1889 | ||
| 1889 | ||
| 1890 | 1890 | /* check for wrap */ |
| 1891 | 1891 | if (delta_x > 0x80) |
| 1892 | 1892 | delta_x = -0x100+delta_x; |
| r5932 | r5933 | |
| 1922 | 1922 | #pragma mark TMS9901 INTERFACE |
| 1923 | 1923 | #endif |
| 1924 | 1924 | /* |
| 1925 | ||
| 1925 | TI99/4x-specific tms9901 I/O handlers | |
| 1926 | 1926 | |
| 1927 | ||
| 1927 | See mess/machine/tms9901.c for generic tms9901 CRU handlers. | |
| 1928 | 1928 | |
| 1929 | BTW, although TMS9900 is generally big-endian, it is little endian as far as CRU is | |
| 1930 | concerned. (i.e. bit 0 is the least significant) | |
| 1929 | BTW, although TMS9900 is generally big-endian, it is little endian as far as CRU is | |
| 1930 | concerned. (i.e. bit 0 is the least significant) | |
| 1931 | 1931 | |
| 1932 | 1932 | KNOWN PROBLEMS: |
| 1933 | * a read or write to bits 16-31 causes TMS9901 to quit timer mode. The problem is: | |
| 1934 | on a TI99/4A, any memory access causes a dummy CRU read. Therefore, TMS9901 can quit | |
| 1935 | timer mode even though the program did not explicitely ask... and THIS is impossible | |
| 1936 | to emulate efficiently (we would have to check every memory operation). | |
| 1933 | * a read or write to bits 16-31 causes TMS9901 to quit timer mode. The problem is: | |
| 1934 | on a TI99/4A, any memory access causes a dummy CRU read. Therefore, TMS9901 can quit | |
| 1935 | timer mode even though the program did not explicitely ask... and THIS is impossible | |
| 1936 | to emulate efficiently (we would have to check every memory operation). | |
| 1937 | 1937 | */ |
| 1938 | 1938 | /* |
| 1939 | ||
| 1939 | TMS9901 interrupt handling on a TI99/4(a). | |
| 1940 | 1940 | |
| 1941 | TI99/4(a) uses the following interrupts: | |
| 1942 | INT1: external interrupt (used by RS232 controller, for instance) | |
| 1943 | INT2: VDP interrupt | |
| 1944 | TMS9901 timer interrupt (overrides INT3) | |
| 1945 | INT12: handset interrupt (only on a TI-99/4 with the handset prototypes) | |
| 1941 | TI99/4(a) uses the following interrupts: | |
| 1942 | INT1: external interrupt (used by RS232 controller, for instance) | |
| 1943 | INT2: VDP interrupt | |
| 1944 | TMS9901 timer interrupt (overrides INT3) | |
| 1945 | INT12: handset interrupt (only on a TI-99/4 with the handset prototypes) | |
| 1946 | 1946 | |
| 1947 | Three (occasionally four) interrupts are used by the system (INT1, INT2, | |
| 1948 | timer, and INT12 on a TI-99/4 with remote handset prototypes), out of 15/16 | |
| 1949 | possible interrupts. Keyboard pins can be used as interrupt pins, too, but | |
| 1950 | this is not emulated (it's a trick, anyway, and I don't know any program | |
| 1951 | which uses it). | |
| 1947 | Three (occasionally four) interrupts are used by the system (INT1, INT2, | |
| 1948 | timer, and INT12 on a TI-99/4 with remote handset prototypes), out of 15/16 | |
| 1949 | possible interrupts. Keyboard pins can be used as interrupt pins, too, but | |
| 1950 | this is not emulated (it's a trick, anyway, and I don't know any program | |
| 1951 | which uses it). | |
| 1952 | 1952 | |
| 1953 | When an interrupt line is set (and the corresponding bit in the interrupt mask is set), | |
| 1954 | a level 1 interrupt is requested from the TMS9900. This interrupt request lasts as long as | |
| 1955 | the interrupt pin and the revelant bit in the interrupt mask are set. | |
| 1953 | When an interrupt line is set (and the corresponding bit in the interrupt mask is set), | |
| 1954 | a level 1 interrupt is requested from the TMS9900. This interrupt request lasts as long as | |
| 1955 | the interrupt pin and the revelant bit in the interrupt mask are set. | |
| 1956 | 1956 | |
| 1957 | TIMER interrupts are kind of an exception, since they are not associated with an external | |
| 1958 | interrupt pin, and I guess it takes a write to the 9901 CRU bit 3 ("SBO 3") to clear | |
| 1959 | the pending interrupt (or am I wrong once again ?). | |
| 1957 | TIMER interrupts are kind of an exception, since they are not associated with an external | |
| 1958 | interrupt pin, and I guess it takes a write to the 9901 CRU bit 3 ("SBO 3") to clear | |
| 1959 | the pending interrupt (or am I wrong once again ?). | |
| 1960 | 1960 | |
| 1961 | 1961 | nota: |
| 1962 | All interrupt routines notify (by software) the TMS9901 of interrupt | |
| 1963 | recognition (with a "SBO n"). However, unless I am missing something, this | |
| 1964 | has absolutely no consequence on the TMS9901 (except for the TIMER | |
| 1965 | interrupt routine), and interrupt routines would work fine without this | |
| 1966 | SBO instruction. This is quite weird. Maybe the interrupt recognition | |
| 1967 | notification is needed on TMS9985, or any other weird variant of TMS9900 | |
| 1968 | (how about the TI-99 development system connected to a TI990/10?). | |
| 1962 | All interrupt routines notify (by software) the TMS9901 of interrupt | |
| 1963 | recognition (with a "SBO n"). However, unless I am missing something, this | |
| 1964 | has absolutely no consequence on the TMS9901 (except for the TIMER | |
| 1965 | interrupt routine), and interrupt routines would work fine without this | |
| 1966 | SBO instruction. This is quite weird. Maybe the interrupt recognition | |
| 1967 | notification is needed on TMS9985, or any other weird variant of TMS9900 | |
| 1968 | (how about the TI-99 development system connected to a TI990/10?). | |
| 1969 | 1969 | */ |
| 1970 | 1970 | |
| 1971 | 1971 | /* |
| 1972 | ||
| 1972 | set the state of int1 (called by the peb core) | |
| 1973 | 1973 | */ |
| 1974 | 1974 | static void tms9901_set_int1(running_machine *machine, int state) |
| 1975 | 1975 | { |
| r5932 | r5933 | |
| 1977 | 1977 | } |
| 1978 | 1978 | |
| 1979 | 1979 | /* |
| 1980 | ||
| 1980 | set the state of int2 (called by the tms9928 core) | |
| 1981 | 1981 | */ |
| 1982 | 1982 | void tms9901_set_int2(running_machine *machine, int state) |
| 1983 | 1983 | { |
| r5932 | r5933 | |
| 1985 | 1985 | } |
| 1986 | 1986 | |
| 1987 | 1987 | /* |
| 1988 | ||
| 1988 | Called by the 9901 core whenever the state of INTREQ and IC0-3 changes | |
| 1989 | 1989 | */ |
| 1990 | 1990 | static TMS9901_INT_CALLBACK( tms9901_interrupt_callback ) |
| 1991 | 1991 | { |
| 1992 | 1992 | if (intreq) |
| 1993 | 1993 | { |
| 1994 | 1994 | /* On TI99, TMS9900 IC0-3 lines are not connected to TMS9901, |
| 1995 | ||
| 1995 | * but hard-wired to force level 1 interrupts */ | |
| 1996 | 1996 | cputag_set_input_line_and_vector(device->machine, "maincpu", 0, ASSERT_LINE, 1); /* interrupt it, baby */ |
| 1997 | 1997 | } |
| 1998 | 1998 | else |
| r5932 | r5933 | |
| 2002 | 2002 | } |
| 2003 | 2003 | |
| 2004 | 2004 | /* |
| 2005 | ||
| 2005 | Read pins INT3*-INT7* of TI99's 9901. | |
| 2006 | 2006 | |
| 2007 | signification: | |
| 2008 | (bit 1: INT1 status) | |
| 2009 | (bit 2: INT2 status) | |
| 2010 | bit 3-7: keyboard status bits 0 to 4 | |
| 2007 | signification: | |
| 2008 | (bit 1: INT1 status) | |
| 2009 | (bit 2: INT2 status) | |
| 2010 | bit 3-7: keyboard status bits 0 to 4 | |
| 2011 | 2011 | */ |
| 2012 | 2012 | static READ8_DEVICE_HANDLER( ti99_R9901_0 ) |
| 2013 | 2013 | { |
| r5932 | r5933 | |
| 2033 | 2033 | { |
| 2034 | 2034 | answer = ((input_port_read(device->machine, keynames[KeyCol >> 1]) >> ((KeyCol & 1) * 8)) << 3) & 0xF8; |
| 2035 | 2035 | } |
| 2036 | ||
| 2036 | ||
| 2037 | 2037 | if ((ti99_model == model_99_4a) || (ti99_model == model_99_4p)) |
| 2038 | 2038 | { |
| 2039 | 2039 | if (! AlphaLockLine) |
| r5932 | r5933 | |
| 2044 | 2044 | } |
| 2045 | 2045 | |
| 2046 | 2046 | /* |
| 2047 | ||
| 2047 | Read pins INT8*-INT15* of TI99's 9901. | |
| 2048 | 2048 | |
| 2049 | signification: | |
| 2050 | bit 0-2: keyboard status bits 5 to 7 | |
| 2051 | bit 3: tape input mirror | |
| 2052 | (bit 4: IR remote handset interrupt) | |
| 2053 | bit 5-7: weird, not emulated | |
| 2049 | signification: | |
| 2050 | bit 0-2: keyboard status bits 5 to 7 | |
| 2051 | bit 3: tape input mirror | |
| 2052 | (bit 4: IR remote handset interrupt) | |
| 2053 | bit 5-7: weird, not emulated | |
| 2054 | 2054 | */ |
| 2055 | 2055 | static READ8_DEVICE_HANDLER( ti99_R9901_1 ) |
| 2056 | 2056 | { |
| r5932 | r5933 | |
| 2063 | 2063 | { |
| 2064 | 2064 | answer = ((input_port_read(device->machine, keynames[KeyCol >> 1]) >> ((KeyCol & 1) * 8)) >> 5) & 0x07; |
| 2065 | 2065 | } |
| 2066 | ||
| 2066 | ||
| 2067 | 2067 | /* we don't take CS2 into account, as CS2 is a write-only unit */ |
| 2068 | 2068 | /*if (cassette_input(devtag_get_device(device->machine, "cassette1")) > 0) |
| 2069 | ||
| 2069 | answer |= 8;*/ | |
| 2070 | 2070 | |
| 2071 | 2071 | return answer; |
| 2072 | 2072 | } |
| 2073 | 2073 | |
| 2074 | 2074 | /* |
| 2075 | ||
| 2075 | Read pins P0-P7 of TI99's 9901. | |
| 2076 | 2076 | |
| 2077 | ||
| 2077 | bit 1: handset data clock pin | |
| 2078 | 2078 | */ |
| 2079 | 2079 | static READ8_DEVICE_HANDLER( ti99_R9901_2 ) |
| 2080 | 2080 | { |
| r5932 | r5933 | |
| 2082 | 2082 | } |
| 2083 | 2083 | |
| 2084 | 2084 | /* |
| 2085 | ||
| 2085 | Read pins P8-P15 of TI99's 9901. | |
| 2086 | 2086 | |
| 2087 | bit 26: IR handset interrupt | |
| 2088 | bit 27: tape input | |
| 2087 | bit 26: IR handset interrupt | |
| 2088 | bit 27: tape input | |
| 2089 | 2089 | */ |
| 2090 | 2090 | static READ8_DEVICE_HANDLER( ti99_R9901_3 ) |
| 2091 | 2091 | { |
| r5932 | r5933 | |
| 2113 | 2113 | |
| 2114 | 2114 | |
| 2115 | 2115 | /* |
| 2116 | ||
| 2116 | WRITE key column select (P2-P4) | |
| 2117 | 2117 | */ |
| 2118 | 2118 | static WRITE8_DEVICE_HANDLER( ti99_KeyC ) |
| 2119 | 2119 | { |
| r5932 | r5933 | |
| 2121 | 2121 | KeyCol |= 1 << (offset-2); |
| 2122 | 2122 | else |
| 2123 | 2123 | KeyCol &= ~ (1 << (offset-2)); |
| 2124 | ||
| 2124 | ||
| 2125 | 2125 | if (has_mecmouse) |
| 2126 | 2126 | mecmouse_select(KeyCol, (ti99_model == model_99_4) ? 5 : 6, |
| 2127 | (ti99_model == model_99_4) ? 6 : 7); | |
| 2127 | (ti99_model == model_99_4) ? 6 : 7); | |
| 2128 | 2128 | } |
| 2129 | 2129 | |
| 2130 | 2130 | /* |
| 2131 | ||
| 2131 | WRITE alpha lock line - TI99/4a only (P5) | |
| 2132 | 2132 | */ |
| 2133 | 2133 | static WRITE8_DEVICE_HANDLER( ti99_AlphaW ) |
| 2134 | 2134 | { |
| r5932 | r5933 | |
| 2137 | 2137 | } |
| 2138 | 2138 | |
| 2139 | 2139 | /* |
| 2140 | ||
| 2140 | Read pins INT3*-INT7* of TI99's 9901. | |
| 2141 | 2141 | |
| 2142 | signification: | |
| 2143 | (bit 1: INT1 status) | |
| 2144 | (bit 2: INT2 status) | |
| 2145 | bits 3-4: unused? | |
| 2146 | bit 5: ??? | |
| 2147 | bit 6-7: keyboard status bits 0 through 1 | |
| 2142 | signification: | |
| 2143 | (bit 1: INT1 status) | |
| 2144 | (bit 2: INT2 status) | |
| 2145 | bits 3-4: unused? | |
| 2146 | bit 5: ??? | |
| 2147 | bit 6-7: keyboard status bits 0 through 1 | |
| 2148 | 2148 | */ |
| 2149 | 2149 | static READ8_DEVICE_HANDLER( ti99_8_R9901_0 ) |
| 2150 | 2150 | { |
| r5932 | r5933 | |
| 2166 | 2166 | { |
| 2167 | 2167 | answer = (input_port_read(device->machine, keynames[KeyCol]) << 6) & 0xC0; |
| 2168 | 2168 | } |
| 2169 | ||
| 2169 | ||
| 2170 | 2170 | return answer; |
| 2171 | 2171 | } |
| 2172 | 2172 | |
| 2173 | 2173 | /* |
| 2174 | ||
| 2174 | Read pins INT8*-INT15* of TI99's 9901. | |
| 2175 | 2175 | |
| 2176 | signification: | |
| 2177 | bit 0-2: keyboard status bits 2 to 4 | |
| 2178 | bit 3: tape input mirror | |
| 2179 | (bit 4: IR remote handset interrupt) | |
| 2180 | bit 5-7: weird, not emulated | |
| 2176 | signification: | |
| 2177 | bit 0-2: keyboard status bits 2 to 4 | |
| 2178 | bit 3: tape input mirror | |
| 2179 | (bit 4: IR remote handset interrupt) | |
| 2180 | bit 5-7: weird, not emulated | |
| 2181 | 2181 | */ |
| 2182 | 2182 | static READ8_DEVICE_HANDLER( ti99_8_R9901_1 ) |
| 2183 | 2183 | { |
| r5932 | r5933 | |
| 2199 | 2199 | { |
| 2200 | 2200 | answer = (input_port_read(device->machine, keynames[KeyCol]) >> 2) & 0x07; |
| 2201 | 2201 | } |
| 2202 | ||
| 2202 | ||
| 2203 | 2203 | /* we don't take CS2 into account, as CS2 is a write-only unit */ |
| 2204 | 2204 | /*if (cassette_input(devtag_get_device(machine, "cassette")) > 0) |
| 2205 | ||
| 2205 | answer |= 8;*/ | |
| 2206 | 2206 | |
| 2207 | 2207 | return answer; |
| 2208 | 2208 | } |
| 2209 | 2209 | |
| 2210 | 2210 | /* |
| 2211 | ||
| 2211 | WRITE key column select (P0-P3) | |
| 2212 | 2212 | */ |
| 2213 | 2213 | static WRITE8_DEVICE_HANDLER( ti99_8_KeyC ) |
| 2214 | 2214 | { |
| r5932 | r5933 | |
| 2232 | 2232 | } |
| 2233 | 2233 | |
| 2234 | 2234 | /* |
| 2235 | ||
| 2235 | command CS1/CS2 tape unit motor (P6-P7) | |
| 2236 | 2236 | */ |
| 2237 | 2237 | static WRITE8_DEVICE_HANDLER( ti99_CS_motor ) |
| 2238 | 2238 | { |
| r5932 | r5933 | |
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | 2252 | /* |
| 2253 | ||
| 2253 | audio gate (P8) | |
| 2254 | 2254 | |
| 2255 | Set to 1 before using tape: this enables the mixing of tape input sound | |
| 2256 | with computer sound. | |
| 2255 | Set to 1 before using tape: this enables the mixing of tape input sound | |
| 2256 | with computer sound. | |
| 2257 | 2257 | |
| 2258 | We do not really need to emulate this as the tape recorder generates sound | |
| 2259 | on its own. | |
| 2258 | We do not really need to emulate this as the tape recorder generates sound | |
| 2259 | on its own. | |
| 2260 | 2260 | */ |
| 2261 | 2261 | static WRITE8_DEVICE_HANDLER( ti99_audio_gate ) |
| 2262 | 2262 | { |
| 2263 | 2263 | } |
| 2264 | 2264 | |
| 2265 | 2265 | /* |
| 2266 | tape output (P9) | |
| 2267 | I think polarity is correct, but don't take my word for it. | |
| 2266 | tape output (P9) | |
| 2267 | I think polarity is correct, but don't take my word for it. | |
| 2268 | 2268 | */ |
| 2269 | 2269 | static WRITE8_DEVICE_HANDLER( ti99_CS_output ) |
| 2270 | 2270 | { |
| r5932 | r5933 | |
| 2287 | 2287 | #pragma mark 99/8 INTERNAL DSR |
| 2288 | 2288 | #endif |
| 2289 | 2289 | /* |
| 2290 | ||
| 2290 | TI 99/8 internal DSR support. | |
| 2291 | 2291 | |
| 2292 | ||
| 2292 | Includes a few specific signals, and an extra ROM. | |
| 2293 | 2293 | */ |
| 2294 | 2294 | |
| 2295 | 2295 | /* prototypes */ |
| r5932 | r5933 | |
| 2318 | 2318 | } |
| 2319 | 2319 | |
| 2320 | 2320 | /* write CRU bit: |
| 2321 | bit0: enable/disable internal DSR ROM, | |
| 2322 | bit1: hard reset */ | |
| 2321 | bit0: enable/disable internal DSR ROM, | |
| 2322 | bit1: hard reset */ | |
| 2323 | 2323 | static void ti99_8_internal_dsr_cru_w(running_machine *machine, int offset, int data) |
| 2324 | 2324 | { |
| 2325 | 2325 | switch (offset) |
| r5932 | r5933 | |
| 2344 | 2344 | #pragma mark SGCPU INTERNAL DSR |
| 2345 | 2345 | #endif |
| 2346 | 2346 | /* |
| 2347 | ||
| 2347 | SNUG SGCPU (a.k.a. 99/4p) internal DSR support. | |
| 2348 | 2348 | |
| 2349 | ||
| 2349 | Includes a few specific signals, and an extra ROM. | |
| 2350 | 2350 | */ |
| 2351 | 2351 | |
| 2352 | 2352 | /* prototypes */ |
| r5932 | r5933 | |
| 2382 | 2382 | } |
| 2383 | 2383 | |
| 2384 | 2384 | /* write CRU bit: |
| 2385 | bit0: enable/disable internal DSR ROM, | |
| 2386 | bit1: enable/disable internal cartridge ROM | |
| 2387 | bit2: set/clear senila | |
| 2388 | bit3: set/clear senilb*/ | |
| 2385 | bit0: enable/disable internal DSR ROM, | |
| 2386 | bit1: enable/disable internal cartridge ROM | |
| 2387 | bit2: set/clear senila | |
| 2388 | bit3: set/clear senilb*/ | |
| 2389 | 2389 | static void ti99_4p_internal_dsr_cru_w(running_machine *machine, int offset, int data) |
| 2390 | 2390 | { |
| 2391 | 2391 | switch (offset) |
| r5932 | r5933 | |
| 2424 | 2424 | #endif |
| 2425 | 2425 | /*===========================================================================*/ |
| 2426 | 2426 | /* |
| 2427 | ||
| 2427 | TI memory extension support. | |
| 2428 | 2428 | |
| 2429 | Simple 8-bit DRAM: 32kb in two chunks of 8kb and 24kb repectively. | |
| 2430 | Since the RAM is on the 8-bit bus, there is an additionnal delay. | |
| 2429 | Simple 8-bit DRAM: 32kb in two chunks of 8kb and 24kb repectively. | |
| 2430 | Since the RAM is on the 8-bit bus, there is an additionnal delay. | |
| 2431 | 2431 | */ |
| 2432 | 2432 | |
| 2433 | 2433 | static READ16_HANDLER ( ti99_TIxramlow_r ); |
| r5932 | r5933 | |
| 2438 | 2438 | static void ti99_TIxram_init(running_machine *machine) |
| 2439 | 2439 | { |
| 2440 | 2440 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2441 | ||
| 2441 | ||
| 2442 | 2442 | memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_TIxramlow_r); |
| 2443 | 2443 | memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_TIxramlow_w); |
| 2444 | 2444 | memory_install_read16_handler(space, 0xa000, 0xffff, 0, 0, ti99_TIxramhigh_r); |
| r5932 | r5933 | |
| 2449 | 2449 | static READ16_HANDLER ( ti99_TIxramlow_r ) |
| 2450 | 2450 | { |
| 2451 | 2451 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2452 | // | |
| 2452 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2453 | 2453 | |
| 2454 | 2454 | return xRAM_ptr[offset]; |
| 2455 | 2455 | } |
| r5932 | r5933 | |
| 2457 | 2457 | static WRITE16_HANDLER ( ti99_TIxramlow_w ) |
| 2458 | 2458 | { |
| 2459 | 2459 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2460 | // | |
| 2460 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2461 | 2461 | |
| 2462 | 2462 | COMBINE_DATA(xRAM_ptr + offset); |
| 2463 | 2463 | } |
| r5932 | r5933 | |
| 2466 | 2466 | static READ16_HANDLER ( ti99_TIxramhigh_r ) |
| 2467 | 2467 | { |
| 2468 | 2468 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2469 | // | |
| 2469 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2470 | 2470 | |
| 2471 | 2471 | return xRAM_ptr[offset+0x1000]; |
| 2472 | 2472 | } |
| r5932 | r5933 | |
| 2474 | 2474 | static WRITE16_HANDLER ( ti99_TIxramhigh_w ) |
| 2475 | 2475 | { |
| 2476 | 2476 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2477 | // | |
| 2477 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2478 | 2478 | |
| 2479 | 2479 | COMBINE_DATA(xRAM_ptr + offset+0x1000); |
| 2480 | 2480 | } |
| r5932 | r5933 | |
| 2482 | 2482 | |
| 2483 | 2483 | /*===========================================================================*/ |
| 2484 | 2484 | /* |
| 2485 | ||
| 2485 | Super AMS memory extension support. | |
| 2486 | 2486 | |
| 2487 | Up to 1Mb of SRAM. Straightforward mapper, works with 4kb chunks. The mapper was designed | |
| 2488 | to be extendable with other RAM areas. | |
| 2487 | Up to 1Mb of SRAM. Straightforward mapper, works with 4kb chunks. The mapper was designed | |
| 2488 | to be extendable with other RAM areas. | |
| 2489 | 2489 | */ |
| 2490 | 2490 | |
| 2491 | 2491 | /* prototypes */ |
| r5932 | r5933 | |
| 2518 | 2518 | int i; |
| 2519 | 2519 | |
| 2520 | 2520 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2521 | ||
| 2521 | ||
| 2522 | 2522 | memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_sAMSxramlow_r); |
| 2523 | 2523 | memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_sAMSxramlow_w); |
| 2524 | 2524 | memory_install_read16_handler(space, 0xa000, 0xffff, 0, 0, ti99_sAMSxramhigh_r); |
| r5932 | r5933 | |
| 2533 | 2533 | } |
| 2534 | 2534 | |
| 2535 | 2535 | /* write CRU bit: |
| 2536 | bit0: enable/disable mapper registers in DSR space, | |
| 2537 | bit1: enable/disable address mapping */ | |
| 2536 | bit0: enable/disable mapper registers in DSR space, | |
| 2537 | bit1: enable/disable address mapping */ | |
| 2538 | 2538 | static void sAMS_cru_w(running_machine *machine, int offset, int data) |
| 2539 | 2539 | { |
| 2540 | 2540 | if (offset == 1) |
| r5932 | r5933 | |
| 2557 | 2557 | static READ16_HANDLER ( ti99_sAMSxramlow_r ) |
| 2558 | 2558 | { |
| 2559 | 2559 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2560 | // | |
| 2560 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2561 | 2561 | |
| 2562 | 2562 | if (sAMS_mapper_on) |
| 2563 | 2563 | return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]]; |
| r5932 | r5933 | |
| 2568 | 2568 | static WRITE16_HANDLER ( ti99_sAMSxramlow_w ) |
| 2569 | 2569 | { |
| 2570 | 2570 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2571 | // | |
| 2571 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2572 | 2572 | |
| 2573 | 2573 | if (sAMS_mapper_on) |
| 2574 | 2574 | COMBINE_DATA(xRAM_ptr + (offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]); |
| r5932 | r5933 | |
| 2580 | 2580 | static READ16_HANDLER ( ti99_sAMSxramhigh_r ) |
| 2581 | 2581 | { |
| 2582 | 2582 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2583 | // | |
| 2583 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2584 | 2584 | |
| 2585 | 2585 | if (sAMS_mapper_on) |
| 2586 | 2586 | return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x5000+offset)>>11]]; |
| r5932 | r5933 | |
| 2591 | 2591 | static WRITE16_HANDLER ( ti99_sAMSxramhigh_w ) |
| 2592 | 2592 | { |
| 2593 | 2593 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2594 | // | |
| 2594 | // cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2595 | 2595 | |
| 2596 | 2596 | if (sAMS_mapper_on) |
| 2597 | 2597 | COMBINE_DATA(xRAM_ptr + (offset&0x7ff)+sAMSlookup[(0x5000+offset)>>11]); |
| r5932 | r5933 | |
| 2602 | 2602 | |
| 2603 | 2603 | /*===========================================================================*/ |
| 2604 | 2604 | /* |
| 2605 | SNUG SGCPU (a.k.a. 99/4p) Super AMS clone support. | |
| 2606 | Compatible with Super AMS, but uses a 16-bit bus. | |
| 2605 | SNUG SGCPU (a.k.a. 99/4p) Super AMS clone support. | |
| 2606 | Compatible with Super AMS, but uses a 16-bit bus. | |
| 2607 | 2607 | |
| 2608 | ||
| 2608 | Up to 1Mb of SRAM. Straightforward mapper, works with 4kb chunks. | |
| 2609 | 2609 | */ |
| 2610 | 2610 | |
| 2611 | 2611 | /* prototypes */ |
| r5932 | r5933 | |
| 2634 | 2634 | |
| 2635 | 2635 | /* Not required at run-time */ |
| 2636 | 2636 | /*memory_install_read16_handler(space, 0x2000, 0x2fff, SMH_BANK(3)); |
| 2637 | memory_install_write16_handler(space, 0x2000, 0x2fff, SMH_BANK(3)); | |
| 2638 | memory_install_read16_handler(space, 0x3000, 0x3fff, SMH_BANK(4)); | |
| 2639 | memory_install_write16_handler(space, 0x3000, 0x3fff, SMH_BANK(4)); | |
| 2640 | memory_install_read16_handler(space, 0xa000, 0xafff, SMH_BANK(5)); | |
| 2641 | memory_install_write16_handler(space, 0xa000, 0xafff, SMH_BANK(5)); | |
| 2642 | memory_install_read16_handler(space, 0xb000, 0xbfff, SMH_BANK(6)); | |
| 2643 | memory_install_write16_handler(space, 0xb000, 0xbfff, SMH_BANK(6)); | |
| 2644 | memory_install_read16_handler(space, 0xc000, 0xcfff, SMH_BANK(7)); | |
| 2645 | memory_install_write16_handler(space, 0xc000, 0xcfff, SMH_BANK(7)); | |
| 2646 | memory_install_read16_handler(space, 0xd000, 0xdfff, SMH_BANK(8)); | |
| 2647 | memory_install_write16_handler(space, 0xd000, 0xdfff, SMH_BANK(8)); | |
| 2648 | memory_install_read16_handler(space, 0xe000, 0xefff, SMH_BANK(9)); | |
| 2649 | memory_install_write16_handler(space, 0xe000, 0xefff, SMH_BANK(9)); | |
| 2650 | memory_install_read16_handler(space, 0xf000, 0xffff, SMH_BANK(10)); | |
| 2651 | memory_install_write16_handler(space, 0xf000, 0xffff, SMH_BANK(10));*/ | |
| 2637 | memory_install_write16_handler(space, 0x2000, 0x2fff, SMH_BANK(3)); | |
| 2638 | memory_install_read16_handler(space, 0x3000, 0x3fff, SMH_BANK(4)); | |
| 2639 | memory_install_write16_handler(space, 0x3000, 0x3fff, SMH_BANK(4)); | |
| 2640 | memory_install_read16_handler(space, 0xa000, 0xafff, SMH_BANK(5)); | |
| 2641 | memory_install_write16_handler(space, 0xa000, 0xafff, SMH_BANK(5)); | |
| 2642 | memory_install_read16_handler(space, 0xb000, 0xbfff, SMH_BANK(6)); | |
| 2643 | memory_install_write16_handler(space, 0xb000, 0xbfff, SMH_BANK(6)); | |
| 2644 | memory_install_read16_handler(space, 0xc000, 0xcfff, SMH_BANK(7)); | |
| 2645 | memory_install_write16_handler(space, 0xc000, 0xcfff, SMH_BANK(7)); | |
| 2646 | memory_install_read16_handler(space, 0xd000, 0xdfff, SMH_BANK(8)); | |
| 2647 | memory_install_write16_handler(space, 0xd000, 0xdfff, SMH_BANK(8)); | |
| 2648 | memory_install_read16_handler(space, 0xe000, 0xefff, SMH_BANK(9)); | |
| 2649 | memory_install_write16_handler(space, 0xe000, 0xefff, SMH_BANK(9)); | |
| 2650 | memory_install_read16_handler(space, 0xf000, 0xffff, SMH_BANK(10)); | |
| 2651 | memory_install_write16_handler(space, 0xf000, 0xffff, SMH_BANK(10));*/ | |
| 2652 | 2652 | |
| 2653 | 2653 | ti99_peb_set_16bit_card_handlers(0x1e00, & ti99_4p_mapper_handlers); |
| 2654 | 2654 | |
| r5932 | r5933 | |
| 2679 | 2679 | } |
| 2680 | 2680 | |
| 2681 | 2681 | /* write CRU bit: |
| 2682 | bit0: enable/disable mapper registers in DSR space, | |
| 2683 | bit1: enable/disable address mapping */ | |
| 2682 | bit0: enable/disable mapper registers in DSR space, | |
| 2683 | bit1: enable/disable address mapping */ | |
| 2684 | 2684 | static void ti99_4p_mapper_cru_w(running_machine *machine, int offset, int data) |
| 2685 | 2685 | { |
| 2686 | 2686 | int i; |
| r5932 | r5933 | |
| 2754 | 2754 | |
| 2755 | 2755 | /*===========================================================================*/ |
| 2756 | 2756 | /* |
| 2757 | ||
| 2757 | myarc-ish memory extension support (foundation, and myarc clones). | |
| 2758 | 2758 | |
| 2759 | ||
| 2759 | Up to 512kb of RAM. Straightforward mapper, works with 32kb chunks. | |
| 2760 | 2760 | */ |
| 2761 | 2761 | |
| 2762 | 2762 | static int myarc_cru_r(running_machine *machine, int offset); |
| r5932 | r5933 | |
| 2785 | 2785 | static void ti99_myarcxram_init(running_machine *machine) |
| 2786 | 2786 | { |
| 2787 | 2787 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2788 | ||
| 2788 | ||
| 2789 | 2789 | memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_myarcxramlow_r); |
| 2790 | 2790 | memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_myarcxramlow_w); |
| 2791 | 2791 | memory_install_read16_handler(space, 0xa000, 0xffff, 0, 0, ti99_myarcxramhigh_r); |
| r5932 | r5933 | |
| 2824 | 2824 | } |
| 2825 | 2825 | |
| 2826 | 2826 | /* read CRU bit: |
| 2827 | ||
| 2827 | bit 1-2 (128kb) or 1-4 (512kb): read current map offset */ | |
| 2828 | 2828 | static int myarc_cru_r(running_machine *machine, int offset) |
| 2829 | 2829 | { |
| 2830 | 2830 | /*if (offset == 0)*/ /* right??? */ |
| r5932 | r5933 | |
| 2834 | 2834 | } |
| 2835 | 2835 | |
| 2836 | 2836 | /* write CRU bit: |
| 2837 | ||
| 2837 | bit 1-2 (128kb) or 1-4 (512kb): write map offset */ | |
| 2838 | 2838 | static void myarc_cru_w(running_machine *machine, int offset, int data) |
| 2839 | 2839 | { |
| 2840 | 2840 | offset &= 0x7; /* right??? */ |
| r5932 | r5933 | |
| 2888 | 2888 | #pragma mark EVPC VIDEO CARD |
| 2889 | 2889 | #endif |
| 2890 | 2890 | /* |
| 2891 | ||
| 2891 | SNUG's EVPC emulation | |
| 2892 | 2892 | */ |
| 2893 | 2893 | |
| 2894 | 2894 | /* prototypes */ |
| r5932 | r5933 | |
| 2917 | 2917 | |
| 2918 | 2918 | |
| 2919 | 2919 | /* |
| 2920 | ||
| 2920 | Reset evpc card, set up handlers | |
| 2921 | 2921 | */ |
| 2922 | 2922 | static void ti99_evpc_reset(running_machine *machine) |
| 2923 | 2923 | { |
| r5932 | r5933 | |
| 2930 | 2930 | } |
| 2931 | 2931 | |
| 2932 | 2932 | /* |
| 2933 | ||
| 2933 | Read evpc CRU interface | |
| 2934 | 2934 | */ |
| 2935 | 2935 | static int evpc_cru_r(running_machine *machine, int offset) |
| 2936 | 2936 | { |
| r5932 | r5933 | |
| 2938 | 2938 | } |
| 2939 | 2939 | |
| 2940 | 2940 | /* |
| 2941 | ||
| 2941 | Write evpc CRU interface | |
| 2942 | 2942 | */ |
| 2943 | 2943 | static void evpc_cru_w(running_machine *machine, int offset, int data) |
| 2944 | 2944 | { |
| r5932 | r5933 | |
| 2994 | 2994 | } evpc_palette; |
| 2995 | 2995 | |
| 2996 | 2996 | /* |
| 2997 | ||
| 2997 | read a byte in evpc DSR space | |
| 2998 | 2998 | */ |
| 2999 | 2999 | static READ8_HANDLER(evpc_mem_r) |
| 3000 | 3000 | { |
| r5932 | r5933 | |
| 3073 | 3073 | } |
| 3074 | 3074 | |
| 3075 | 3075 | /* |
| 3076 | ||
| 3076 | write a byte in evpc DSR space | |
| 3077 | 3077 | */ |
| 3078 | 3078 | static WRITE8_HANDLER(evpc_mem_w) |
| 3079 | 3079 | { |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | 1 |* \_/ | 40 X0 | |
| 11 | 2 | | 39 X1 | |
| 12 | 3 | | 38 X2 | |
| 13 | 4 | | 37 X3 | |
| 14 | 5 | | 36 X4 | |
| 15 | B9 6 | | 35 X5 | |
| 16 | B8 7 | | 34 X6 | |
| 17 | B7 8 | | 33 X7 | |
| 18 | B6 9 | | 32 X8 | |
| 19 | B5 10 | AY-5-3600 | 31 DELAY NODE | |
| 20 | B4 11 | | 30 Vcc | |
| 21 | B3 12 | | 29 SHIFT | |
| 22 | B2 13 | | 28 CONTROL | |
| 23 | B1 14 | | 27 Vgg | |
| 24 | Vdd 15 | | 26 Y9 | |
| 25 | DATA READY 16 | | 25 Y8 | |
| 26 | Y0 17 | | 24 Y7 | |
| 27 | Y1 18 | | 23 Y6 | |
| 28 | Y2 19 | | 22 Y5 | |
| 29 | Y3 20 |_____________| 21 Y4 | |
| 9 | _____ _____ | |
| 10 | 1 |* \_/ | 40 X0 | |
| 11 | 2 | | 39 X1 | |
| 12 | 3 | | 38 X2 | |
| 13 | 4 | | 37 X3 | |
| 14 | 5 | | 36 X4 | |
| 15 | B9 6 | | 35 X5 | |
| 16 | B8 7 | | 34 X6 | |
| 17 | B7 8 | | 33 X7 | |
| 18 | B6 9 | | 32 X8 | |
| 19 | B5 10 | AY-5-3600 | 31 DELAY NODE | |
| 20 | B4 11 | | 30 Vcc | |
| 21 | B3 12 | | 29 SHIFT | |
| 22 | B2 13 | | 28 CONTROL | |
| 23 | B1 14 | | 27 Vgg | |
| 24 | Vdd 15 | | 26 Y9 | |
| 25 | DATA READY 16 | | 25 Y8 | |
| 26 | Y0 17 | | 24 Y7 | |
| 27 | Y1 18 | | 23 Y6 | |
| 28 | Y2 19 | | 22 Y5 | |
| 29 | Y3 20 |_____________| 21 Y4 | |
| 30 | 30 | |
| 31 | _____ _____ | |
| 32 | Vcc 1 |* \_/ | 40 Vss | |
| 33 | B9 2 | | 39 Vgg | |
| 34 | B8 3 | | 38 _STCL? | |
| 35 | B7 4 | | 37 _MCLR | |
| 36 | TEST 5 | | 36 OSC | |
| 37 | B6 6 | | 35 CLK OUT | |
| 38 | B5 7 | | 34 X7 | |
| 39 | B4 8 | | 33 X6 | |
| 40 | B3 9 | | 32 X5 | |
| 41 | B2 10 | AY-5-3600 | 31 X4 | |
| 42 | B1 11 | PRO 002 | 30 X3 | |
| 43 | X8 12 | | 29 X2 | |
| 44 | AKO 13 | | 28 X1 | |
| 45 | CTRL 14 | | 27 X0 | |
| 46 | SHIFT 15 | | 26 Y9 | |
| 47 | DATA READY 16 | | 25 Y8 | |
| 48 | Y0 17 | | 24 Y7 | |
| 49 | Y1 18 | | 23 Y6 | |
| 50 | Y2 19 | | 22 Y5 | |
| 51 | Y3 20 |_____________| 21 Y4 | |
| 31 | _____ _____ | |
| 32 | Vcc 1 |* \_/ | 40 Vss | |
| 33 | B9 2 | | 39 Vgg | |
| 34 | B8 3 | | 38 _STCL? | |
| 35 | B7 4 | | 37 _MCLR | |
| 36 | TEST 5 | | 36 OSC | |
| 37 | B6 6 | | 35 CLK OUT | |
| 38 | B5 7 | | 34 X7 | |
| 39 | B4 8 | | 33 X6 | |
| 40 | B3 9 | | 32 X5 | |
| 41 | B2 10 | AY-5-3600 | 31 X4 | |
| 42 | B1 11 | PRO 002 | 30 X3 | |
| 43 | X8 12 | | 29 X2 | |
| 44 | AKO 13 | | 28 X1 | |
| 45 | CTRL 14 | | 27 X0 | |
| 46 | SHIFT 15 | | 26 Y9 | |
| 47 | DATA READY 16 | | 25 Y8 | |
| 48 | Y0 17 | | 24 Y7 | |
| 49 | Y1 18 | | 23 Y6 | |
| 50 | Y2 19 | | 22 Y5 | |
| 51 | Y3 20 |_____________| 21 Y4 | |
| 52 | 52 | |
| 53 | 53 | **********************************************************************/ |
| 54 | 54 |
| r5932 | r5933 | |
|---|---|---|
| 73 | 73 | { |
| 74 | 74 | int data = outb; |
| 75 | 75 | |
| 76 | if (outb & 0x08) | |
| 76 | if (outb & 0x08) | |
| 77 | 77 | data |= (input_port_read(device->machine, "MODE") & 0x07); |
| 78 | 78 | |
| 79 | 79 | return data; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | msm8251.c | |
| 4 | 4 | |
| 5 | ||
| 5 | MSM/Intel 8251 Universal Synchronous/Asynchronous Receiver Transmitter code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 228 | 228 | /* if transmit is not empty... transmit data */ |
| 229 | 229 | if ((uart->transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0) |
| 230 | 230 | { |
| 231 | // | |
| 231 | // logerror("MSM8251\n"); | |
| 232 | 232 | transmit_register_send_bit(device->machine,&uart->transmit_reg, &uart->connection); |
| 233 | 233 | } |
| 234 | 234 | } |
| r5932 | r5933 | |
| 276 | 276 | int tx_ready; |
| 277 | 277 | |
| 278 | 278 | /* tx ready output is set if: |
| 279 | DB Buffer Empty & | |
| 280 | CTS is set & | |
| 281 | Transmit enable is 1 | |
| 282 | */ | |
| 279 | DB Buffer Empty & | |
| 280 | CTS is set & | |
| 281 | Transmit enable is 1 | |
| 282 | */ | |
| 283 | 283 | |
| 284 | 284 | tx_ready = 0; |
| 285 | 285 | |
| r5932 | r5933 | |
| 392 | 392 | /* finished transfering sync bytes, now expecting command */ |
| 393 | 393 | uart->flags &= ~(MSM8251_EXPECTING_MODE | MSM8251_EXPECTING_SYNC_BYTE); |
| 394 | 394 | uart->sync_byte_offset = 0; |
| 395 | // | |
| 395 | // uart->status = MSM8251_STATUS_TX_EMPTY | MSM8251_STATUS_TX_READY; | |
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | else |
| r5932 | r5933 | |
| 404 | 404 | /* Synchronous or Asynchronous? */ |
| 405 | 405 | if ((data & 0x03)!=0) |
| 406 | 406 | { |
| 407 | /* | |
| 407 | /* Asynchronous | |
| 408 | 408 | |
| 409 | bit 7,6: stop bit length | |
| 410 | 0 = inhibit | |
| 411 | 1 = 1 bit | |
| 412 | 2 = 1.5 bits | |
| 413 | 3 = 2 bits | |
| 414 | bit 5: parity type | |
| 415 | 0 = parity odd | |
| 416 | 1 = parity even | |
| 417 | bit 4: parity test enable | |
| 418 | 0 = disable | |
| 419 | 1 = enable | |
| 420 | bit 3,2: character length | |
| 421 | 0 = 5 bits | |
| 422 | 1 = 6 bits | |
| 423 | 2 = 7 bits | |
| 424 | 3 = 8 bits | |
| 425 | bit 1,0: baud rate factor | |
| 426 | 0 = defines command byte for synchronous or asynchronous | |
| 427 | 1 = x1 | |
| 428 | 2 = x16 | |
| 429 | 3 = x64 | |
| 430 | */ | |
| 409 | bit 7,6: stop bit length | |
| 410 | 0 = inhibit | |
| 411 | 1 = 1 bit | |
| 412 | 2 = 1.5 bits | |
| 413 | 3 = 2 bits | |
| 414 | bit 5: parity type | |
| 415 | 0 = parity odd | |
| 416 | 1 = parity even | |
| 417 | bit 4: parity test enable | |
| 418 | 0 = disable | |
| 419 | 1 = enable | |
| 420 | bit 3,2: character length | |
| 421 | 0 = 5 bits | |
| 422 | 1 = 6 bits | |
| 423 | 2 = 7 bits | |
| 424 | 3 = 8 bits | |
| 425 | bit 1,0: baud rate factor | |
| 426 | 0 = defines command byte for synchronous or asynchronous | |
| 427 | 1 = x1 | |
| 428 | 2 = x16 | |
| 429 | 3 = x64 | |
| 430 | */ | |
| 431 | 431 | |
| 432 | 432 | LOG(("MSM8251: Asynchronous operation\n")); |
| 433 | 433 | |
| r5932 | r5933 | |
| 522 | 522 | #endif |
| 523 | 523 | /* not expecting mode byte now */ |
| 524 | 524 | uart->flags &= ~MSM8251_EXPECTING_MODE; |
| 525 | // | |
| 525 | // uart->status = MSM8251_STATUS_TX_EMPTY | MSM8251_STATUS_TX_READY; | |
| 526 | 526 | } |
| 527 | 527 | else |
| 528 | 528 | { |
| 529 | /* bit 7: Number of sync characters | |
| 530 | 0 = 1 character | |
| 531 | 1 = 2 character | |
| 532 | bit 6: Synchronous mode | |
| 533 | 0 = Internal synchronisation | |
| 534 | 1 = External synchronisation | |
| 535 | bit 5: parity type | |
| 536 | 0 = parity odd | |
| 537 | 1 = parity even | |
| 538 | bit 4: parity test enable | |
| 539 | 0 = disable | |
| 540 | 1 = enable | |
| 541 | bit 3,2: character length | |
| 542 | 0 = 5 bits | |
| 543 | 1 = 6 bits | |
| 544 | 2 = 7 bits | |
| 545 | 3 = 8 bits | |
| 546 | bit 1,0 = 0 | |
| 547 | */ | |
| 529 | /* bit 7: Number of sync characters | |
| 530 | 0 = 1 character | |
| 531 | 1 = 2 character | |
| 532 | bit 6: Synchronous mode | |
| 533 | 0 = Internal synchronisation | |
| 534 | 1 = External synchronisation | |
| 535 | bit 5: parity type | |
| 536 | 0 = parity odd | |
| 537 | 1 = parity even | |
| 538 | bit 4: parity test enable | |
| 539 | 0 = disable | |
| 540 | 1 = enable | |
| 541 | bit 3,2: character length | |
| 542 | 0 = 5 bits | |
| 543 | 1 = 6 bits | |
| 544 | 2 = 7 bits | |
| 545 | 3 = 8 bits | |
| 546 | bit 1,0 = 0 | |
| 547 | */ | |
| 548 | 548 | LOG(("MSM8251: Synchronous operation\n")); |
| 549 | 549 | |
| 550 | 550 | /* setup for sync byte(s) */ |
| r5932 | r5933 | |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | |
| 616 | /* bit 7: | |
| 617 | 0 = normal operation | |
| 618 | 1 = hunt mode | |
| 619 | bit 6: | |
| 620 | 0 = normal operation | |
| 621 | 1 = internal reset | |
| 622 | bit 5: | |
| 623 | 0 = /RTS set to 1 | |
| 624 | 1 = /RTS set to 0 | |
| 625 | bit 4: | |
| 626 | 0 = normal operation | |
| 627 | 1 = reset error flag | |
| 628 | bit 3: | |
| 629 | 0 = normal operation | |
| 630 | 1 = send break character | |
| 631 | bit 2: | |
| 632 | 0 = receive disable | |
| 633 | 1 = receive enable | |
| 634 | bit 1: | |
| 635 | 0 = /DTR set to 1 | |
| 636 | 1 = /DTR set to 0 | |
| 637 | bit 0: | |
| 638 | 0 = transmit disable | |
| 639 | 1 = transmit enable | |
| 640 | */ | |
| 616 | /* bit 7: | |
| 617 | 0 = normal operation | |
| 618 | 1 = hunt mode | |
| 619 | bit 6: | |
| 620 | 0 = normal operation | |
| 621 | 1 = internal reset | |
| 622 | bit 5: | |
| 623 | 0 = /RTS set to 1 | |
| 624 | 1 = /RTS set to 0 | |
| 625 | bit 4: | |
| 626 | 0 = normal operation | |
| 627 | 1 = reset error flag | |
| 628 | bit 3: | |
| 629 | 0 = normal operation | |
| 630 | 1 = send break character | |
| 631 | bit 2: | |
| 632 | 0 = receive disable | |
| 633 | 1 = receive enable | |
| 634 | bit 1: | |
| 635 | 0 = /DTR set to 1 | |
| 636 | 1 = /DTR set to 0 | |
| 637 | bit 0: | |
| 638 | 0 = transmit disable | |
| 639 | 1 = transmit enable | |
| 640 | */ | |
| 641 | 641 | |
| 642 | 642 | uart->connection.State &=~SERIAL_STATE_RTS; |
| 643 | 643 | if (data & (1<<5)) |
| r5932 | r5933 | |
| 718 | 718 | |
| 719 | 719 | /*------------------------------------------------- |
| 720 | 720 | msm8251_receive_character - called when last |
| 721 | ||
| 721 | bit of data has been received | |
| 722 | 722 | -------------------------------------------------*/ |
| 723 | 723 | |
| 724 | 724 | static void msm8251_receive_character(const device_config *device, UINT8 ch) |
| r5932 | r5933 | |
| 761 | 761 | |
| 762 | 762 | /*------------------------------------------------- |
| 763 | 763 | msm8251_connect_to_serial_device - initialise |
| 764 | transfer using serial device - set the callback | |
| 765 | which will be called when serial device has | |
| 766 | updated it's state | |
| 764 | transfer using serial device - set the callback | |
| 765 | which will be called when serial device has | |
| 766 | updated it's state | |
| 767 | 767 | -------------------------------------------------*/ |
| 768 | 768 | |
| 769 | 769 | void msm8251_connect_to_serial_device(const device_config *device, const device_config *image) |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | ||
| 14 | - attempt to direct-map | |
| 15 | 15 | |
| 16 | 16 | */ |
| 17 | 17 |
| r5932 | r5933 | |
|---|---|---|
| 34 | 34 | UINT8 serin_chksum; |
| 35 | 35 | int serin_delay; |
| 36 | 36 | } ATARI_FDC; |
| 37 | ||
| 37 | ||
| 38 | 38 | static ATARI_FDC atari_fdc; |
| 39 | 39 | |
| 40 | 40 | typedef struct _atari_drive atari_drive; |
| r5932 | r5933 | |
| 469 | 469 | switch (atari_fdc.serout_buff[1]) /* command ? */ |
| 470 | 470 | { |
| 471 | 471 | case 'S': /* status */ |
| 472 | atari_set_frame_message(machine, "DRIVE #%d STATUS", drive+1); | |
| 472 | atari_set_frame_message(machine, "DRIVE #%d STATUS", drive+1); | |
| 473 | 473 | |
| 474 | 474 | if (VERBOSE_SERIAL) |
| 475 | 475 | logerror("atari status\n"); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | smc92x4.h: header file for smc92x4.c | |
| 3 | 3 | |
| 4 | ||
| 4 | Raphael Nabet | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | /* this enum matches the possible values for bits 3-2 of the select register */ |
| r5932 | r5933 | |
| 17 | 17 | typedef struct smc92x4_intf |
| 18 | 18 | { |
| 19 | 19 | /* select_callback serves 2 purposes: |
| 20 | a) the emulated system may use other lines than the normal smc92x4 select | |
| 21 | lines | |
| 22 | b) if there is more than one smc92x4 controller, we need to have different | |
| 23 | drive numbers for each controller | |
| 24 | which: smc92x4 controller concerned | |
| 25 | select_mode: any of sm_harddisk, sm_floppy_slow or sm_floppy_fast | |
| 26 | select_line: state smc92x4 select lines (0: no line active, 1, 2, 3: first, | |
| 27 | second or third line active) | |
| 28 | gpos: state of 4 general prurpose outputs that are used as floppy select | |
| 29 | lines by the (4 LSBits of smc99x4 retry count register) | |
| 30 | return -1 if no drive is selected, or index of image in MESS IO_FLOPPY | |
| 31 | IO_HARDDISK device array. */ | |
| 20 | a) the emulated system may use other lines than the normal smc92x4 select | |
| 21 | lines | |
| 22 | b) if there is more than one smc92x4 controller, we need to have different | |
| 23 | drive numbers for each controller | |
| 24 | which: smc92x4 controller concerned | |
| 25 | select_mode: any of sm_harddisk, sm_floppy_slow or sm_floppy_fast | |
| 26 | select_line: state smc92x4 select lines (0: no line active, 1, 2, 3: first, | |
| 27 | second or third line active) | |
| 28 | gpos: state of 4 general prurpose outputs that are used as floppy select | |
| 29 | lines by the (4 LSBits of smc99x4 retry count register) | |
| 30 | return -1 if no drive is selected, or index of image in MESS IO_FLOPPY | |
| 31 | IO_HARDDISK device array. */ | |
| 32 | 32 | int (*select_callback)(int which, select_mode_t select_mode, int select_line, int gpos); |
| 33 | 33 | /* dma_read_callback will be called by the smc99x4 core to read the sector |
| 34 | ||
| 34 | buffer */ | |
| 35 | 35 | UINT8 (*dma_read_callback)(int which, offs_t offset); |
| 36 | 36 | /* dma_read_callback will be called by the smc99x4 core to write the sector |
| 37 | ||
| 37 | buffer */ | |
| 38 | 38 | void (*dma_write_callback)(int which, offs_t offset, UINT8 data); |
| 39 | 39 | /* int_callback will be called by the smc99x4 core whenever the state of |
| 40 | ||
| 40 | the interrupt lien changes */ | |
| 41 | 41 | void (*int_callback)(int which, int state); |
| 42 | 42 | } smc92x4_intf; |
| 43 | 43 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | header file for machine/ti99_4x.c | |
| 3 | 3 | */ |
| 4 | 4 | #include "video/tms9928a.h" |
| 5 | 5 | #include "machine/tms9901.h" |
| r5932 | r5933 | |
| 99 | 99 | fdc_kind_TI, /* TI fdc */ |
| 100 | 100 | fdc_kind_BwG, /* SNUG's BwG fdc */ |
| 101 | 101 | fdc_kind_hfdc /* Myarc's HFDC (handles SD and DD floppies (I |
| 102 | think an HD update existed) and prehistoric | |
| 103 | MFM hard disks) */ | |
| 102 | think an HD update existed) and prehistoric | |
| 103 | MFM hard disks) */ | |
| 104 | 104 | #if HAS_99CCFDC |
| 105 | 105 | , |
| 106 | 106 | fdc_kind_CC = 0x100 /* CorComp fdc */ |
| r5932 | r5933 | |
| 134 | 134 | config_cartslot_bit = 14, |
| 135 | 135 | config_cartslot_mask = 0xf, /* need four bits: covers all current and possibly future cartslots, and one auto mode */ |
| 136 | 136 | config_pcode_bit = 18, |
| 137 | config_pcode_mask = 0x1 | |
| 137 | config_pcode_mask = 0x1 | |
| 138 | 138 | }; |
| 139 | 139 | |
| 140 | 140 | enum { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | tms5501.c | |
| 4 | 4 | |
| 5 | ||
| 5 | TMS5501 input/output controller | |
| 6 | 6 | |
| 7 | Krzysztof Strzecha, Nathan Woods, 2003 | |
| 8 | Based on TMS9901 emulator by Raphael Nabet | |
| 7 | Krzysztof Strzecha, Nathan Woods, 2003 | |
| 8 | Based on TMS9901 emulator by Raphael Nabet | |
| 9 | 9 | |
| 10 | 21-May-2004 - Fixed interrupt queue overflow bug (not really fixed | |
| 11 | previously). | |
| 12 | 06-Mar-2004 - Fixed bug in sensor input. | |
| 13 | 01-Mar-2004 - Interrupt queue overrun problem fixed. | |
| 14 | 19-Oct-2003 - Status register added. Reset fixed. Some cleanups. | |
| 15 | INTA enable/disable. | |
| 10 | 21-May-2004 - Fixed interrupt queue overflow bug (not really fixed | |
| 11 | previously). | |
| 12 | 06-Mar-2004 - Fixed bug in sensor input. | |
| 13 | 01-Mar-2004 - Interrupt queue overrun problem fixed. | |
| 14 | 19-Oct-2003 - Status register added. Reset fixed. Some cleanups. | |
| 15 | INTA enable/disable. | |
| 16 | 16 | |
| 17 | TODO: | |
| 18 | - SIO | |
| 17 | TODO: | |
| 18 | - SIO | |
| 19 | 19 | |
| 20 | 20 | *********************************************************************/ |
| 21 | 21 | |
| r5932 | r5933 | |
| 427 | 427 | break; |
| 428 | 428 | case 0x04: |
| 429 | 429 | /* Command register |
| 430 | bit 0: reset | |
| 431 | bit 1: send break, '1' - serial output is high impedance | |
| 432 | bit 2: int 7 select: '0' - timer 5, '1' - IN7 of the DCE-bus | |
| 433 | bit 3: int ack enable, '0' - disabled, '1' - enabled | |
| 434 | bits 4-5: test bits, normally '0' | |
| 435 | bits 6-7: not used, normally '0' | |
| 436 | bits 1-5 are latched */ | |
| 430 | bit 0: reset | |
| 431 | bit 1: send break, '1' - serial output is high impedance | |
| 432 | bit 2: int 7 select: '0' - timer 5, '1' - IN7 of the DCE-bus | |
| 433 | bit 3: int ack enable, '0' - disabled, '1' - enabled | |
| 434 | bits 4-5: test bits, normally '0' | |
| 435 | bits 6-7: not used, normally '0' | |
| 436 | bits 1-5 are latched */ | |
| 437 | 437 | |
| 438 | 438 | tms->command = data & TMS5501_COMMAND_LATCHED_BITS; |
| 439 | 439 | LOG_TMS5501(device, "Command register write", data); |
| r5932 | r5933 | |
| 443 | 443 | break; |
| 444 | 444 | case 0x05: |
| 445 | 445 | /* Serial rate register |
| 446 | bit 0: 110 baud | |
| 447 | bit 1: 150 baud | |
| 448 | bit 2: 300 baud | |
| 449 | bit 3: 1200 baud | |
| 450 | bit 4: 2400 baud | |
| 451 | bit 5: 4800 baud | |
| 452 | bit 6: 9600 baud | |
| 453 | bit 7: '0' - two stop bits, '1' - one stop bit */ | |
| 446 | bit 0: 110 baud | |
| 447 | bit 1: 150 baud | |
| 448 | bit 2: 300 baud | |
| 449 | bit 3: 1200 baud | |
| 450 | bit 4: 2400 baud | |
| 451 | bit 5: 4800 baud | |
| 452 | bit 6: 9600 baud | |
| 453 | bit 7: '0' - two stop bits, '1' - one stop bit */ | |
| 454 | 454 | |
| 455 | 455 | tms->sio_rate = data; |
| 456 | 456 | LOG_TMS5501(device, "Serial rate write", data); |
| r5932 | r5933 | |
| 467 | 467 | break; |
| 468 | 468 | case 0x08: |
| 469 | 469 | /* Interrupt mask register |
| 470 | bit 0: Timer 1 has expired (UTIM) | |
| 471 | bit 1: Timer 2 has expired | |
| 472 | bit 2: External interrupt (STKIM) | |
| 473 | bit 3: Timer 3 has expired (SNDIM) | |
| 474 | bit 4: Serial receiver loaded | |
| 475 | bit 5: Serial transmitter empty | |
| 476 | bit 6: Timer 4 has expired (KBIM) | |
| 477 | bit 7: Timer 5 has expired or IN7 (CLKIM) */ | |
| 470 | bit 0: Timer 1 has expired (UTIM) | |
| 471 | bit 1: Timer 2 has expired | |
| 472 | bit 2: External interrupt (STKIM) | |
| 473 | bit 3: Timer 3 has expired (SNDIM) | |
| 474 | bit 4: Serial receiver loaded | |
| 475 | bit 5: Serial transmitter empty | |
| 476 | bit 6: Timer 4 has expired (KBIM) | |
| 477 | bit 7: Timer 5 has expired or IN7 (CLKIM) */ | |
| 478 | 478 | |
| 479 | 479 | tms->interrupt_mask = data; |
| 480 | 480 | LOG_TMS5501(device, "Interrupt mask write", data); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | msm8251.h | |
| 4 | 4 | |
| 5 | ||
| 5 | MSM/Intel 8251 Universal Synchronous/Asynchronous Receiver Transmitter code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | |
| 8 | 8 | ********************************************************************** |
| 9 | _____ _____ | |
| 10 | _CE1 1 |* \_/ | 40 Vcc | |
| 11 | CE2 2 | | 39 PB7 | |
| 12 | CLK 3 | | 38 PB6 | |
| 13 | RESET 4 | | 37 PB5 | |
| 14 | N.C. 5 | | 36 PB4 | |
| 15 | READY 6 | | 35 PB3 | |
| 16 | IO/_M 7 | | 34 PB2 | |
| 17 | _IOR 8 | | 33 PB1 | |
| 18 | _RD 9 | | 32 PB0 | |
| 19 | _IOW 10 | 8355 | 31 PA7 | |
| 20 | ALE 11 | 8355-2 | 30 PA6 | |
| 21 | AD0 12 | | 29 PA5 | |
| 22 | AD1 13 | | 28 PA4 | |
| 23 | AD2 14 | | 27 PA3 | |
| 24 | AD3 15 | | 26 PA2 | |
| 25 | AD4 16 | | 25 PA1 | |
| 26 | AD5 17 | | 24 PA0 | |
| 27 | AD6 18 | | 23 A10 | |
| 28 | AD7 19 | | 22 A9 | |
| 29 | Vss 20 |_____________| 21 A8 | |
| 9 | _____ _____ | |
| 10 | _CE1 1 |* \_/ | 40 Vcc | |
| 11 | CE2 2 | | 39 PB7 | |
| 12 | CLK 3 | | 38 PB6 | |
| 13 | RESET 4 | | 37 PB5 | |
| 14 | N.C. 5 | | 36 PB4 | |
| 15 | READY 6 | | 35 PB3 | |
| 16 | IO/_M 7 | | 34 PB2 | |
| 17 | _IOR 8 | | 33 PB1 | |
| 18 | _RD 9 | | 32 PB0 | |
| 19 | _IOW 10 | 8355 | 31 PA7 | |
| 20 | ALE 11 | 8355-2 | 30 PA6 | |
| 21 | AD0 12 | | 29 PA5 | |
| 22 | AD1 13 | | 28 PA4 | |
| 23 | AD2 14 | | 27 PA3 | |
| 24 | AD3 15 | | 26 PA2 | |
| 25 | AD4 16 | | 25 PA1 | |
| 26 | AD5 17 | | 24 PA0 | |
| 27 | AD6 18 | | 23 A10 | |
| 28 | AD7 19 | | 22 A9 | |
| 29 | Vss 20 |_____________| 21 A8 | |
| 30 | 30 | |
| 31 | 31 | **********************************************************************/ |
| 32 | 32 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | sgi.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Silicon Graphics MC (Memory Controller) code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 241 | 241 | case 0x203c: |
| 242 | 242 | verboselog( space->machine, 0, "DMA Zoom Count Read: %08x (%08x)\n", nMC_DMAZoomByteCnt, mem_mask ); |
| 243 | 243 | return nMC_DMAZoomByteCnt; |
| 244 | // case 0x2040: | |
| 245 | // case 0x2044: | |
| 246 | // verboselog( space->machine, 2, "DMA Start Write: %08x (%08x)\n", data, mem_mask ); | |
| 244 | // case 0x2040: | |
| 245 | // case 0x2044: | |
| 246 | // verboselog( space->machine, 2, "DMA Start Write: %08x (%08x)\n", data, mem_mask ); | |
| 247 | 247 | // Start DMA |
| 248 | // nMC_DMARunning = 1; | |
| 249 | // break; | |
| 248 | // nMC_DMARunning = 1; | |
| 249 | // break; | |
| 250 | 250 | case 0x2048: |
| 251 | 251 | case 0x204c: |
| 252 | 252 | verboselog( space->machine, 0, "VDMA Running Read: %08x (%08x)\n", nMC_DMARunning, mem_mask ); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | tms5501.h | |
| 4 | 4 | |
| 5 | ||
| 5 | TMS 5501 code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | static READ8_HANDLER(keyboard_r) |
| 34 | 34 | { |
| 35 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", | |
| 35 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", | |
| 36 | 36 | "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15" }; |
| 37 | UINT8 retVal=0x00; | |
| 37 | UINT8 retVal=0x00; | |
| 38 | 38 | UINT8 line = 0; |
| 39 | 39 | if (offset & 0x100) line=8; |
| 40 | ||
| 40 | ||
| 41 | 41 | if (offset & 0x0001) retVal|=input_port_read(space->machine,keynames[line]); |
| 42 | 42 | line++; |
| 43 | 43 | if (offset & 0x0002) retVal|=input_port_read(space->machine,keynames[line]); |
| r5932 | r5933 | |
| 68 | 68 | pk8020_set_bank(space->machine,data >> 2); |
| 69 | 69 | } else if (BIT(offset,6)==0) { |
| 70 | 70 | // Color |
| 71 | pk8020_color = data; | |
| 71 | pk8020_color = data; | |
| 72 | 72 | } else if (BIT(offset,2)==0) { |
| 73 | 73 | // Palette set |
| 74 | 74 | UINT8 number = data & 0x0f; |
| r5932 | r5933 | |
| 76 | 76 | UINT8 i = (color & 0x08) ? 0x3F : 0; |
| 77 | 77 | UINT8 r = ((color & 0x04) ? 0xC0 : 0) + i; |
| 78 | 78 | UINT8 g = ((color & 0x02) ? 0xC0 : 0) + i; |
| 79 | UINT8 b = ((color & 0x01) ? 0xC0 : 0) + i; | |
| 79 | UINT8 b = ((color & 0x01) ? 0xC0 : 0) + i; | |
| 80 | 80 | palette_set_color( space->machine, number, MAKE_RGB(r,g,b) ); |
| 81 | 81 | } |
| 82 | 82 | } |
| r5932 | r5933 | |
| 84 | 84 | static READ8_HANDLER(text_r) |
| 85 | 85 | { |
| 86 | 86 | if (attr == 3) text_attr=mess_ram[0x40400+offset]; |
| 87 | return mess_ram[0x40000+offset]; | |
| 87 | return mess_ram[0x40000+offset]; | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | static WRITE8_HANDLER(text_w) |
| 91 | 91 | { |
| 92 | 92 | mess_ram[0x40000+offset] = data; |
| 93 | 93 | switch (attr) { |
| 94 | case 0: break; | |
| 94 | case 0: break; | |
| 95 | 95 | case 1: mess_ram[0x40400+offset]=0x01;break; |
| 96 | 96 | case 2: mess_ram[0x40400+offset]=0x00;break; |
| 97 | 97 | case 3: mess_ram[0x40400+offset]=text_attr;break; |
| 98 | } | |
| 98 | } | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | static READ8_HANDLER(gzu_r) |
| 102 | { | |
| 102 | { | |
| 103 | 103 | UINT8 *addr = mess_ram + 0x10000 + (pk8020_video_page_access * 0xC000); |
| 104 | 104 | UINT8 p0 = addr[offset]; |
| 105 | 105 | UINT8 p1 = addr[offset + 0x4000]; |
| r5932 | r5933 | |
| 138 | 138 | UINT8 *plane_0 = addr; |
| 139 | 139 | UINT8 *plane_1 = addr + 0x4000; |
| 140 | 140 | UINT8 *plane_2 = addr + 0x8000; |
| 141 | ||
| 142 | if(pk8020_color & 0x80) | |
| 141 | ||
| 142 | if(pk8020_color & 0x80) | |
| 143 | 143 | { |
| 144 | 144 | // Color mode |
| 145 | 145 | plane_0[offset] = (plane_0[offset] & ~data) | ((pk8020_color & 2) ? data : 0); |
| r5932 | r5933 | |
| 169 | 169 | const device_config *pic = devtag_get_device(space->machine, "pic8259"); |
| 170 | 170 | const device_config *rs232 = devtag_get_device(space->machine, "rs232"); |
| 171 | 171 | const device_config *lan = devtag_get_device(space->machine, "lan"); |
| 172 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); | |
| 173 | ||
| 172 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); | |
| 173 | ||
| 174 | 174 | switch(offset & 0x38) |
| 175 | 175 | { |
| 176 | 176 | case 0x00: return pit8253_r(pit,offset & 3); |
| r5932 | r5933 | |
| 179 | 179 | case 0 : return msm8251_data_r(rs232,0); |
| 180 | 180 | case 1 : return msm8251_status_r(rs232,0); |
| 181 | 181 | } |
| 182 | break; | |
| 182 | break; | |
| 183 | 183 | case 0x18: switch(offset & 3) { |
| 184 | 184 | case 0 : return wd17xx_status_r(fdc,0); |
| 185 | 185 | case 1 : return wd17xx_track_r(fdc,0); |
| 186 | 186 | case 2 : return wd17xx_sector_r(fdc,0); |
| 187 | 187 | case 3 : return wd17xx_data_r(fdc,0); |
| 188 | } | |
| 188 | } | |
| 189 | 189 | break; |
| 190 | 190 | case 0x20: switch(offset & 1) { |
| 191 | 191 | case 0 : return msm8251_data_r(lan,0); |
| 192 | 192 | case 1 : return msm8251_status_r(lan,0); |
| 193 | 193 | } |
| 194 | break; | |
| 194 | break; | |
| 195 | 195 | case 0x28: return pic8259_r(pic,offset & 1); |
| 196 | 196 | case 0x30: return i8255a_r(ppi2,offset & 3); |
| 197 | 197 | case 0x38: return i8255a_r(ppi1,offset & 3); |
| r5932 | r5933 | |
| 209 | 209 | const device_config *rs232 = devtag_get_device(space->machine, "rs232"); |
| 210 | 210 | const device_config *lan = devtag_get_device(space->machine, "lan"); |
| 211 | 211 | const device_config *fdc = devtag_get_device(space->machine, "wd1793"); |
| 212 | ||
| 212 | ||
| 213 | 213 | switch(offset & 0x38) |
| 214 | 214 | { |
| 215 | 215 | case 0x00: pit8253_w(pit,offset & 3,data); break; |
| r5932 | r5933 | |
| 218 | 218 | case 0 : msm8251_data_w(rs232,0,data); break; |
| 219 | 219 | case 1 : msm8251_control_w(rs232,0,data); break; |
| 220 | 220 | } |
| 221 | break; | |
| 221 | break; | |
| 222 | 222 | case 0x18: switch(offset & 3) { |
| 223 | 223 | case 0 : wd17xx_command_w(fdc,0,data);break; |
| 224 | 224 | case 1 : wd17xx_track_w(fdc,0,data);break; |
| 225 | 225 | case 2 : wd17xx_sector_w(fdc,0,data);break; |
| 226 | 226 | case 3 : wd17xx_data_w(fdc,0,data);break; |
| 227 | } | |
| 228 | break; | |
| 227 | } | |
| 228 | break; | |
| 229 | 229 | case 0x20: switch(offset & 1) { |
| 230 | 230 | case 0 : msm8251_data_w(lan,0,data); break; |
| 231 | 231 | case 1 : msm8251_control_w(lan,0,data); break; |
| 232 | 232 | } |
| 233 | break; | |
| 233 | break; | |
| 234 | 234 | case 0x28: pic8259_w(pic,offset & 1,data);break; |
| 235 | 235 | case 0x30: i8255a_w(ppi2,offset & 3,data); break; |
| 236 | 236 | case 0x38: i8255a_w(ppi1,offset & 3,data); break; |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | static void pk8020_set_bank(running_machine *machine,UINT8 data) | |
| 241 | { | |
| 242 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); | |
| 240 | static void pk8020_set_bank(running_machine *machine,UINT8 data) | |
| 241 | { | |
| 242 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); | |
| 243 | 243 | switch(data & 0x1F) { |
| 244 | case 0x00 : | |
| 244 | case 0x00 : | |
| 245 | 245 | { |
| 246 | 246 | // ROM |
| 247 | 247 | memory_install_read8_handler (space, 0x0000, 0x37ff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 279 | 279 | memory_install_write8_handler(space, 0x2000, 0xffff, 0, 0, SMH_BANK(4)); |
| 280 | 280 | memory_set_bankptr(machine, 3, mess_ram + 0x2000); |
| 281 | 281 | memory_set_bankptr(machine, 4, mess_ram + 0x2000); |
| 282 | } | |
| 282 | } | |
| 283 | 283 | break; |
| 284 | 284 | case 0x02 : { |
| 285 | 285 | // ROM |
| r5932 | r5933 | |
| 292 | 292 | memory_install_write8_handler(space, 0x4000, 0xffff, 0, 0, SMH_BANK(4)); |
| 293 | 293 | memory_set_bankptr(machine, 3, mess_ram + 0x4000); |
| 294 | 294 | memory_set_bankptr(machine, 4, mess_ram + 0x4000); |
| 295 | } | |
| 295 | } | |
| 296 | 296 | break; |
| 297 | 297 | case 0x03 : { |
| 298 | 298 | // RAM |
| r5932 | r5933 | |
| 300 | 300 | memory_install_write8_handler(space, 0x0000, 0xffff, 0, 0, SMH_BANK(2)); |
| 301 | 301 | memory_set_bankptr(machine, 1, mess_ram); |
| 302 | 302 | memory_set_bankptr(machine, 2, mess_ram); |
| 303 | } | |
| 303 | } | |
| 304 | 304 | break; |
| 305 | case 0x04 : | |
| 306 | case 0x05 : | |
| 305 | case 0x04 : | |
| 306 | case 0x05 : | |
| 307 | 307 | { |
| 308 | 308 | // ROM |
| 309 | 309 | memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 330 | 330 | memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w); |
| 331 | 331 | } |
| 332 | 332 | break; |
| 333 | case 0x06 : | |
| 333 | case 0x06 : | |
| 334 | 334 | { |
| 335 | 335 | // ROM |
| 336 | 336 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 356 | 356 | memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r); |
| 357 | 357 | memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w); |
| 358 | 358 | } |
| 359 | break; | |
| 360 | case 0x07 : | |
| 359 | break; | |
| 360 | case 0x07 : | |
| 361 | 361 | { |
| 362 | 362 | // RAM |
| 363 | 363 | memory_install_read8_handler (space, 0x0000, 0xf7ff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 378 | 378 | memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r); |
| 379 | 379 | memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w); |
| 380 | 380 | } |
| 381 | break; | |
| 382 | case 0x08 : | |
| 381 | break; | |
| 382 | case 0x08 : | |
| 383 | 383 | { |
| 384 | 384 | // ROM |
| 385 | 385 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 407 | 407 | // Video RAM |
| 408 | 408 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 409 | 409 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 410 | ||
| 410 | ||
| 411 | 411 | } |
| 412 | 412 | break; |
| 413 | case 0x09 : | |
| 413 | case 0x09 : | |
| 414 | 414 | { |
| 415 | 415 | // ROM |
| 416 | 416 | memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 424 | 424 | memory_set_bankptr(machine, 4, mess_ram + 0x2000); |
| 425 | 425 | // Video RAM |
| 426 | 426 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 427 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); | |
| 427 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); | |
| 428 | 428 | } |
| 429 | 429 | break; |
| 430 | case 0x0A : | |
| 430 | case 0x0A : | |
| 431 | 431 | { |
| 432 | 432 | // ROM |
| 433 | 433 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 444 | 444 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 445 | 445 | } |
| 446 | 446 | break; |
| 447 | case 0x0B : | |
| 447 | case 0x0B : | |
| 448 | 448 | { |
| 449 | 449 | // RAM |
| 450 | 450 | memory_install_read8_handler (space, 0x0000, 0xbfff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 456 | 456 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 457 | 457 | } |
| 458 | 458 | break; |
| 459 | case 0x0C : | |
| 460 | case 0x0D : | |
| 459 | case 0x0C : | |
| 460 | case 0x0D : | |
| 461 | 461 | { |
| 462 | 462 | // ROM |
| 463 | 463 | memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 482 | 482 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| 483 | 483 | // System reg |
| 484 | 484 | memory_install_read8_handler (space, 0xff00, 0xffff, 0, 0, sysreg_r); |
| 485 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 485 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 486 | 486 | } |
| 487 | 487 | break; |
| 488 | case 0x0E : | |
| 488 | case 0x0E : | |
| 489 | 489 | { |
| 490 | 490 | // ROM |
| 491 | 491 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 505 | 505 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| 506 | 506 | // System reg |
| 507 | 507 | memory_install_read8_handler (space, 0xff00, 0xffff, 0, 0, sysreg_r); |
| 508 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 508 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 509 | 509 | } |
| 510 | 510 | break; |
| 511 | case 0x0F : | |
| 511 | case 0x0F : | |
| 512 | 512 | { |
| 513 | 513 | // RAM |
| 514 | 514 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 528 | 528 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| 529 | 529 | // System reg |
| 530 | 530 | memory_install_read8_handler (space, 0xff00, 0xffff, 0, 0, sysreg_r); |
| 531 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 531 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 532 | 532 | } |
| 533 | break; | |
| 534 | case 0x10 : | |
| 533 | break; | |
| 534 | case 0x10 : | |
| 535 | 535 | { |
| 536 | 536 | // ROM |
| 537 | 537 | memory_install_read8_handler (space, 0x0000, 0x5fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 542 | 542 | memory_install_read8_handler (space, 0x6000, 0xf7ff, 0, 0, SMH_BANK(3)); |
| 543 | 543 | memory_install_write8_handler(space, 0x6000, 0xf7ff, 0, 0, SMH_BANK(4)); |
| 544 | 544 | memory_set_bankptr(machine, 3, mess_ram + 0x6000); |
| 545 | memory_set_bankptr(machine, 4, mess_ram + 0x6000); | |
| 545 | memory_set_bankptr(machine, 4, mess_ram + 0x6000); | |
| 546 | 546 | // Keyboard |
| 547 | 547 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 548 | 548 | memory_install_write8_handler(space, 0xf800, 0xf9ff, 0, 0, SMH_BANK(5)); |
| r5932 | r5933 | |
| 557 | 557 | memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r); |
| 558 | 558 | memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w); |
| 559 | 559 | } |
| 560 | break; | |
| 561 | case 0x11 : | |
| 560 | break; | |
| 561 | case 0x11 : | |
| 562 | 562 | { |
| 563 | 563 | // ROM |
| 564 | 564 | memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 569 | 569 | memory_install_read8_handler (space, 0x2000, 0xf7ff, 0, 0, SMH_BANK(3)); |
| 570 | 570 | memory_install_write8_handler(space, 0x2000, 0xf7ff, 0, 0, SMH_BANK(4)); |
| 571 | 571 | memory_set_bankptr(machine, 3, mess_ram + 0x2000); |
| 572 | memory_set_bankptr(machine, 4, mess_ram + 0x2000); | |
| 572 | memory_set_bankptr(machine, 4, mess_ram + 0x2000); | |
| 573 | 573 | // Keyboard |
| 574 | 574 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 575 | 575 | memory_install_write8_handler(space, 0xf800, 0xf9ff, 0, 0, SMH_BANK(5)); |
| r5932 | r5933 | |
| 584 | 584 | memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r); |
| 585 | 585 | memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w); |
| 586 | 586 | } |
| 587 | break; | |
| 588 | case 0x12 : | |
| 587 | break; | |
| 588 | case 0x12 : | |
| 589 | 589 | { |
| 590 | 590 | // ROM |
| 591 | 591 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 596 | 596 | memory_install_read8_handler (space, 0x4000, 0xf7ff, 0, 0, SMH_BANK(3)); |
| 597 | 597 | memory_install_write8_handler(space, 0x4000, 0xf7ff, 0, 0, SMH_BANK(4)); |
| 598 | 598 | memory_set_bankptr(machine, 3, mess_ram + 0x4000); |
| 599 | memory_set_bankptr(machine, 4, mess_ram + 0x4000); | |
| 599 | memory_set_bankptr(machine, 4, mess_ram + 0x4000); | |
| 600 | 600 | // Keyboard |
| 601 | 601 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 602 | 602 | memory_install_write8_handler(space, 0xf800, 0xf9ff, 0, 0, SMH_BANK(5)); |
| r5932 | r5933 | |
| 611 | 611 | memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r); |
| 612 | 612 | memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w); |
| 613 | 613 | } |
| 614 | break; | |
| 615 | case 0x13 : | |
| 614 | break; | |
| 615 | case 0x13 : | |
| 616 | 616 | { |
| 617 | 617 | // RAM |
| 618 | 618 | memory_install_read8_handler (space, 0x0000, 0xf7ff, 0, 0, SMH_BANK(1)); |
| 619 | 619 | memory_install_write8_handler(space, 0x0000, 0xf7ff, 0, 0, SMH_BANK(2)); |
| 620 | 620 | memory_set_bankptr(machine, 1, mess_ram + 0x0000); |
| 621 | memory_set_bankptr(machine, 2, mess_ram + 0x0000); | |
| 621 | memory_set_bankptr(machine, 2, mess_ram + 0x0000); | |
| 622 | 622 | // Keyboard |
| 623 | 623 | memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r); |
| 624 | 624 | memory_install_write8_handler(space, 0xf800, 0xf9ff, 0, 0, SMH_BANK(3)); |
| r5932 | r5933 | |
| 633 | 633 | memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r); |
| 634 | 634 | memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w); |
| 635 | 635 | } |
| 636 | break; | |
| 637 | case 0x14 : | |
| 636 | break; | |
| 637 | case 0x14 : | |
| 638 | 638 | { |
| 639 | 639 | // ROM |
| 640 | 640 | memory_install_read8_handler (space, 0x0000, 0x5fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 651 | 651 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| 652 | 652 | // System reg |
| 653 | 653 | memory_install_read8_handler (space, 0xff00, 0xffff, 0, 0, sysreg_r); |
| 654 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 654 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 655 | 655 | } |
| 656 | 656 | break; |
| 657 | case 0x15 : | |
| 657 | case 0x15 : | |
| 658 | 658 | { |
| 659 | 659 | // ROM |
| 660 | 660 | memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 671 | 671 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| 672 | 672 | // System reg |
| 673 | 673 | memory_install_read8_handler (space, 0xff00, 0xffff, 0, 0, sysreg_r); |
| 674 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 674 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 675 | 675 | } |
| 676 | 676 | break; |
| 677 | case 0x16 : | |
| 677 | case 0x16 : | |
| 678 | 678 | { |
| 679 | 679 | // ROM |
| 680 | 680 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 691 | 691 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| 692 | 692 | // System reg |
| 693 | 693 | memory_install_read8_handler (space, 0xff00, 0xffff, 0, 0, sysreg_r); |
| 694 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 694 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 695 | 695 | } |
| 696 | 696 | break; |
| 697 | case 0x17 : | |
| 697 | case 0x17 : | |
| 698 | 698 | { |
| 699 | 699 | // RAM |
| 700 | 700 | memory_install_read8_handler (space, 0x0000, 0xfdff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 706 | 706 | memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w); |
| 707 | 707 | // System reg |
| 708 | 708 | memory_install_read8_handler (space, 0xff00, 0xffff, 0, 0, sysreg_r); |
| 709 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 709 | memory_install_write8_handler(space, 0xff00, 0xffff, 0, 0, sysreg_w); | |
| 710 | 710 | } |
| 711 | 711 | break; |
| 712 | case 0x18 : | |
| 712 | case 0x18 : | |
| 713 | 713 | { |
| 714 | 714 | // ROM |
| 715 | 715 | memory_install_read8_handler (space, 0x0000, 0x5fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 723 | 723 | memory_set_bankptr(machine, 4, mess_ram + 0x6000); |
| 724 | 724 | // System reg |
| 725 | 725 | memory_install_read8_handler (space, 0xbf00, 0xbfff, 0, 0, sysreg_r); |
| 726 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); | |
| 726 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); | |
| 727 | 727 | // Video RAM |
| 728 | 728 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 729 | 729 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 730 | 730 | } |
| 731 | 731 | break; |
| 732 | case 0x19 : | |
| 732 | case 0x19 : | |
| 733 | 733 | { |
| 734 | 734 | // ROM |
| 735 | 735 | memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 743 | 743 | memory_set_bankptr(machine, 4, mess_ram + 0x2000); |
| 744 | 744 | // System reg |
| 745 | 745 | memory_install_read8_handler (space, 0xbf00, 0xbfff, 0, 0, sysreg_r); |
| 746 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); | |
| 746 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); | |
| 747 | 747 | // Video RAM |
| 748 | 748 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 749 | 749 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 750 | 750 | } |
| 751 | 751 | break; |
| 752 | case 0x1A : | |
| 752 | case 0x1A : | |
| 753 | 753 | { |
| 754 | 754 | // ROM |
| 755 | 755 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 763 | 763 | memory_set_bankptr(machine, 4, mess_ram + 0x4000); |
| 764 | 764 | // System reg |
| 765 | 765 | memory_install_read8_handler (space, 0xbf00, 0xbfff, 0, 0, sysreg_r); |
| 766 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); | |
| 766 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); | |
| 767 | 767 | // Video RAM |
| 768 | 768 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 769 | 769 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 770 | 770 | } |
| 771 | 771 | break; |
| 772 | case 0x1B : | |
| 772 | case 0x1B : | |
| 773 | 773 | { |
| 774 | 774 | // RAM |
| 775 | 775 | memory_install_read8_handler (space, 0x0000, 0xbeff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 778 | 778 | memory_set_bankptr(machine, 2, mess_ram); |
| 779 | 779 | // System reg |
| 780 | 780 | memory_install_read8_handler (space, 0xbf00, 0xbfff, 0, 0, sysreg_r); |
| 781 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); | |
| 781 | memory_install_write8_handler(space, 0xbf00, 0xbfff, 0, 0, sysreg_w); | |
| 782 | 782 | // Video RAM |
| 783 | 783 | memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r); |
| 784 | 784 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 785 | 785 | } |
| 786 | 786 | break; |
| 787 | case 0x1C : | |
| 787 | case 0x1C : | |
| 788 | 788 | { |
| 789 | 789 | // ROM |
| 790 | 790 | memory_install_read8_handler (space, 0x0000, 0x5fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 801 | 801 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 802 | 802 | } |
| 803 | 803 | break; |
| 804 | case 0x1D : | |
| 804 | case 0x1D : | |
| 805 | 805 | { |
| 806 | 806 | // ROM |
| 807 | 807 | memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 818 | 818 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 819 | 819 | } |
| 820 | 820 | break; |
| 821 | case 0x1E : | |
| 821 | case 0x1E : | |
| 822 | 822 | { |
| 823 | 823 | // ROM |
| 824 | 824 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 835 | 835 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 836 | 836 | } |
| 837 | 837 | break; |
| 838 | case 0x1F : | |
| 838 | case 0x1F : | |
| 839 | 839 | { |
| 840 | 840 | // RAM |
| 841 | 841 | memory_install_read8_handler (space, 0x0000, 0xbfff, 0, 0, SMH_BANK(1)); |
| r5932 | r5933 | |
| 847 | 847 | memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w); |
| 848 | 848 | } |
| 849 | 849 | break; |
| 850 | ||
| 850 | ||
| 851 | 851 | } |
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | static READ8_DEVICE_HANDLER(pk8020_porta_r) |
| 855 | { | |
| 855 | { | |
| 856 | 856 | return 0xf0 | (takt <<1) | (text_attr)<<3; |
| 857 | 857 | } |
| 858 | 858 | |
| r5932 | r5933 | |
| 861 | 861 | pk8020_video_page_access =(data>>6) & 3; |
| 862 | 862 | attr = (data >> 4) & 3; |
| 863 | 863 | pk8020_wide = (data >> 3) & 1; |
| 864 | pk8020_font = (data >> 2) & 1; | |
| 865 | pk8020_video_page = (data & 3); | |
| 866 | ||
| 867 | ||
| 864 | pk8020_font = (data >> 2) & 1; | |
| 865 | pk8020_video_page = (data & 3); | |
| 866 | ||
| 867 | ||
| 868 | 868 | portc_data = data; |
| 869 | 869 | } |
| 870 | 870 | |
| r5932 | r5933 | |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | static READ8_DEVICE_HANDLER(pk8020_portc_r) |
| 887 | { | |
| 887 | { | |
| 888 | 888 | return portc_data; |
| 889 | 889 | } |
| 890 | 890 | |
| r5932 | r5933 | |
| 900 | 900 | }; |
| 901 | 901 | |
| 902 | 902 | static WRITE8_DEVICE_HANDLER(pk8020_2_portc_w) |
| 903 | { | |
| 903 | { | |
| 904 | 904 | const device_config *speaker = devtag_get_device(device->machine, "speaker"); |
| 905 | ||
| 905 | ||
| 906 | 906 | sound_gate = BIT(data,3); |
| 907 | ||
| 907 | ||
| 908 | 908 | speaker_level_w(speaker, sound_gate ? sound_level : 0); |
| 909 | 909 | } |
| 910 | 910 | |
| r5932 | r5933 | |
| 929 | 929 | }; |
| 930 | 930 | |
| 931 | 931 | static PIT8253_OUTPUT_CHANGED(pk8020_pit_out0) |
| 932 | { | |
| 932 | { | |
| 933 | 933 | const device_config *speaker = devtag_get_device(device->machine, "speaker"); |
| 934 | ||
| 934 | ||
| 935 | 935 | sound_level = state; |
| 936 | ||
| 936 | ||
| 937 | 937 | speaker_level_w(speaker, sound_gate ? sound_level : 0); |
| 938 | 938 | } |
| 939 | 939 | |
| r5932 | r5933 | |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | static PIT8253_OUTPUT_CHANGED(pk8020_pit_out2) |
| 946 | { | |
| 946 | { | |
| 947 | 947 | pic8259_set_irq_line(devtag_get_device(device->machine, "pic8259"),5,state); |
| 948 | 948 | } |
| 949 | 949 | |
| r5932 | r5933 | |
| 967 | 967 | }; |
| 968 | 968 | |
| 969 | 969 | static PIC8259_SET_INT_LINE( pk8020_pic_set_int_line ) |
| 970 | { | |
| 971 | cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE); | |
| 972 | } | |
| 970 | { | |
| 971 | cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE); | |
| 972 | } | |
| 973 | 973 | |
| 974 | 974 | const struct pic8259_interface pk8020_pic8259_config = { |
| 975 | 975 | pk8020_pic_set_int_line |
| 976 | 976 | }; |
| 977 | 977 | |
| 978 | 978 | static IRQ_CALLBACK(pk8020_irq_callback) |
| 979 | { | |
| 979 | { | |
| 980 | 980 | return pic8259_acknowledge(devtag_get_device(device->machine, "pic8259")); |
| 981 | } | |
| 981 | } | |
| 982 | 982 | |
| 983 | 983 | MACHINE_RESET( pk8020 ) |
| 984 | 984 | { |
| 985 | 985 | const device_config *fdc = devtag_get_device(machine, "wd1793"); |
| 986 | 986 | pk8020_set_bank(machine,0); |
| 987 | 987 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), pk8020_irq_callback); |
| 988 | ||
| 989 | wd17xx_set_density (fdc,DEN_FM_HI); | |
| 990 | ||
| 988 | ||
| 989 | wd17xx_set_density (fdc,DEN_FM_HI); | |
| 990 | ||
| 991 | 991 | sound_gate = 0; |
| 992 | sound_level = 0; | |
| 992 | sound_level = 0; | |
| 993 | 993 | } |
| 994 | 994 | |
| 995 | 995 | INTERRUPT_GEN( pk8020_interrupt ) |
| r5932 | r5933 | |
|---|---|---|
| 3 | 3 | |
| 4 | 4 | MESS Driver By: |
| 5 | 5 | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 6 | Gordon Jefferyes | |
| 7 | mess_bbc@gjeffery.dircon.co.uk | |
| 8 | 8 | |
| 9 | 9 | ******************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 85 | 85 | if (bbc_rombank!=1) |
| 86 | 86 | { |
| 87 | 87 | memory_set_bankptr(space->machine, 4, memory_region(space->machine, "user1") + (bbc_rombank << 14)); |
| 88 | } | |
| 89 | else | |
| 88 | } | |
| 89 | else | |
| 90 | 90 | { |
| 91 | 91 | memory_set_bankptr(space->machine, 4, memory_region(space->machine, "user2") + ((bbc_DFSType) << 14)); |
| 92 | 92 | } |
| r5932 | r5933 | |
| 95 | 95 | |
| 96 | 96 | WRITE8_HANDLER ( bbc_memoryb3_w ) |
| 97 | 97 | { |
| 98 | if (bbc_RAMSize) | |
| 98 | if (bbc_RAMSize) | |
| 99 | 99 | { |
| 100 | 100 | memory_region(space->machine, "maincpu")[offset + 0x4000] = data; |
| 101 | 101 | // this array is set so that the video emulator know which addresses to redraw |
| 102 | 102 | bbc_vidmem[offset + 0x4000] = 1; |
| 103 | } | |
| 104 | else | |
| 103 | } | |
| 104 | else | |
| 105 | 105 | { |
| 106 | 106 | memory_region(space->machine, "maincpu")[offset] = data; |
| 107 | 107 | bbc_vidmem[offset] = 1; |
| r5932 | r5933 | |
| 127 | 127 | if (bbc_DFSType == 3) memory_region(space->machine, "user2")[((bbc_DFSType) << 14) + offset] = data; |
| 128 | 128 | } else |
| 129 | 129 | { |
| 130 | switch (bbc_SWRAMtype) | |
| 130 | switch (bbc_SWRAMtype) | |
| 131 | 131 | { |
| 132 | 132 | case 1: if (bbc_SWRAMtype1[bbc_userport]) memory_region(space->machine, "user1")[(bbc_userport << 14) + offset] = data; |
| 133 | 133 | case 2: if (bbc_SWRAMtype2[bbc_rombank]) memory_region(space->machine, "user1")[(bbc_rombank << 14) + offset] = data; |
| r5932 | r5933 | |
| 144 | 144 | static int vdusel = 0; |
| 145 | 145 | |
| 146 | 146 | /* this function should return true if |
| 147 | the instruction is in the VDU driver address ranged | |
| 148 | these are set when: | |
| 149 | PC is in the range c000 to dfff | |
| 150 | or if pagedRAM set and PC is in the range a000 to afff | |
| 147 | the instruction is in the VDU driver address ranged | |
| 148 | these are set when: | |
| 149 | PC is in the range c000 to dfff | |
| 150 | or if pagedRAM set and PC is in the range a000 to afff | |
| 151 | 151 | */ |
| 152 | 152 | static int vdudriverset(running_machine *machine) |
| 153 | 153 | { |
| r5932 | r5933 | |
| 170 | 170 | { |
| 171 | 171 | /* if paged ram then set 8000 to afff to read from the ram 8000 to afff */ |
| 172 | 172 | memory_set_bankptr(space->machine, 4, memory_region(space->machine, "maincpu") + 0x8000); |
| 173 | } | |
| 174 | else | |
| 173 | } | |
| 174 | else | |
| 175 | 175 | { |
| 176 | 176 | /* if paged rom then set the rom to be read from 8000 to afff */ |
| 177 | 177 | memory_set_bankptr(space->machine, 4, memory_region(space->machine, "user1") + (bbc_rombank << 14)); |
| r5932 | r5933 | |
| 224 | 224 | { |
| 225 | 225 | // not in shadow ram mode so just read normal ram |
| 226 | 226 | memory_set_bankptr(space->machine, 2, ram + 0x3000); |
| 227 | } | |
| 228 | else | |
| 227 | } | |
| 228 | else | |
| 229 | 229 | { |
| 230 | 230 | if (vdudriverset(space->machine)) |
| 231 | 231 | { |
| 232 | 232 | // if VDUDriver set then read from shadow ram |
| 233 | 233 | memory_set_bankptr(space->machine, 2, ram + 0xb000); |
| 234 | } | |
| 235 | else | |
| 234 | } | |
| 235 | else | |
| 236 | 236 | { |
| 237 | 237 | // else read from normal ram |
| 238 | 238 | memory_set_bankptr(space->machine, 2, ram + 0x3000); |
| r5932 | r5933 | |
| 250 | 250 | // not in shadow ram mode so just write to normal ram |
| 251 | 251 | ram[offset + 0x3000] = data; |
| 252 | 252 | bbc_vidmem[offset + 0x3000] = 1; |
| 253 | } | |
| 254 | else | |
| 253 | } | |
| 254 | else | |
| 255 | 255 | { |
| 256 | 256 | if (vdudriverset(space->machine)) |
| 257 | 257 | { |
| 258 | 258 | // if VDUDriver set then write to shadow ram |
| 259 | 259 | ram[offset + 0xb000] = data; |
| 260 | 260 | bbc_vidmem[offset + 0xb000] = 1; |
| 261 | } | |
| 262 | else | |
| 261 | } | |
| 262 | else | |
| 263 | 263 | { |
| 264 | 264 | // else write to normal ram |
| 265 | 265 | ram[offset + 0x3000] = data; |
| r5932 | r5933 | |
| 323 | 323 | /* |
| 324 | 324 | ROMSEL - &FE30 write Only |
| 325 | 325 | B7 RAM 1=Page in ANDY &8000-&8FFF |
| 326 | ||
| 326 | 0=Page in ROM &8000-&8FFF | |
| 327 | 327 | B6 Not Used |
| 328 | 328 | B5 Not Used |
| 329 | 329 | B4 Not Used |
| r5932 | r5933 | |
| 331 | 331 | |
| 332 | 332 | ACCCON |
| 333 | 333 | |
| 334 | b7 IRR | |
| 334 | b7 IRR 1=Causes an IRQ to the processor | |
| 335 | 335 | b6 TST 1=Selects &FC00-&FEFF read from OS-ROM |
| 336 | 336 | b5 IFJ 1=Internal 1 MHz bus |
| 337 | ||
| 337 | 0=External 1MHz bus | |
| 338 | 338 | b4 ITU 1=Internal Tube |
| 339 | 0=External Tube | |
| 340 | b3 Y 1=Read/Write HAZEL &C000-&DFFF RAM | |
| 341 | 0=Read/Write ROM &C000-&DFFF OS-ROM | |
| 342 | b2 X 1=Read/Write LYNNE | |
| 343 | 0=Read/WRITE main memory &3000-&8000 | |
| 339 | 0=External Tube | |
| 340 | b3 Y 1=Read/Write HAZEL &C000-&DFFF RAM | |
| 341 | 0=Read/Write ROM &C000-&DFFF OS-ROM | |
| 342 | b2 X 1=Read/Write LYNNE | |
| 343 | 0=Read/WRITE main memory &3000-&8000 | |
| 344 | 344 | b1 E 1=Causes shadow if VDU code |
| 345 | 0=Main all the time | |
| 346 | b0 D 1=Display LYNNE as screen | |
| 347 | 0=Display main RAM screen | |
| 345 | 0=Main all the time | |
| 346 | b0 D 1=Display LYNNE as screen | |
| 347 | 0=Display main RAM screen | |
| 348 | 348 | |
| 349 | 349 | ACCCON is a read/write register |
| 350 | 350 | |
| r5932 | r5933 | |
| 409 | 409 | if (ACCCON_Y) |
| 410 | 410 | { |
| 411 | 411 | memory_set_bankptr(space->machine, 7, memory_region(space->machine, "maincpu") + 0x9000); |
| 412 | } | |
| 413 | else | |
| 412 | } | |
| 413 | else | |
| 414 | 414 | { |
| 415 | 415 | memory_set_bankptr(space->machine, 7, memory_region(space->machine, "user1") + 0x40000); |
| 416 | 416 | } |
| r5932 | r5933 | |
| 421 | 421 | if (ACCCON_X) |
| 422 | 422 | { |
| 423 | 423 | memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0xb000 ); |
| 424 | } | |
| 425 | else | |
| 424 | } | |
| 425 | else | |
| 426 | 426 | { |
| 427 | 427 | memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0x3000 ); |
| 428 | 428 | } |
| r5932 | r5933 | |
| 460 | 460 | { |
| 461 | 461 | memory_set_bankptr(space->machine, 4, memory_region(space->machine, "maincpu") + 0x8000); |
| 462 | 462 | memory_set_bank(space->machine, 5, bbc_rombank); |
| 463 | } | |
| 464 | else | |
| 463 | } | |
| 464 | else | |
| 465 | 465 | { |
| 466 | 466 | memory_set_bankptr(space->machine, 4, memory_region(space->machine, "user1") + ((bbc_rombank) << 14)); |
| 467 | 467 | memory_set_bank(space->machine, 5, bbc_rombank); |
| r5932 | r5933 | |
| 482 | 482 | if (ACCCON_X) |
| 483 | 483 | { |
| 484 | 484 | memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0xb000 ); |
| 485 | } | |
| 486 | else | |
| 485 | } | |
| 486 | else | |
| 487 | 487 | { |
| 488 | 488 | if (ACCCON_E && bbcm_vdudriverset(space->machine)) |
| 489 | 489 | { |
| 490 | 490 | memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0xb000 ); |
| 491 | } | |
| 492 | else | |
| 491 | } | |
| 492 | else | |
| 493 | 493 | { |
| 494 | 494 | memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0x3000 ); |
| 495 | 495 | } |
| r5932 | r5933 | |
| 507 | 507 | { |
| 508 | 508 | ram[offset + 0xb000] = data; |
| 509 | 509 | bbc_vidmem[offset + 0xb000] = 1; |
| 510 | } | |
| 511 | else | |
| 510 | } | |
| 511 | else | |
| 512 | 512 | { |
| 513 | 513 | if (ACCCON_E && bbcm_vdudriverset(space->machine)) |
| 514 | 514 | { |
| 515 | 515 | ram[offset + 0xb000] = data; |
| 516 | 516 | bbc_vidmem[offset + 0xb000] = 1; |
| 517 | } | |
| 518 | else | |
| 517 | } | |
| 518 | else | |
| 519 | 519 | { |
| 520 | 520 | ram[offset + 0x3000] = data; |
| 521 | 521 | bbc_vidmem[offset + 0x3000] = 1; |
| r5932 | r5933 | |
| 567 | 567 | /****************************************************************************** |
| 568 | 568 | &FC00-&FCFF FRED |
| 569 | 569 | &FD00-&FDFF JIM |
| 570 | &FE00-&FEFF SHEILA Read Write | |
| 571 | &00-&07 6845 CRTC Video controller Video Controller 8 ( 2 bytes x 4 ) | |
| 572 | &08-&0F 6850 ACIA Serial controller Serial Controller 8 ( 2 bytes x 4 ) | |
| 573 | &10-&17 Serial ULA - Serial system chip 8 ( 1 byte x 8 ) | |
| 574 | &18-&1F uPD7002 A to D converter A to D converter 8 ( 4 bytes x 2 ) | |
| 575 | &20-&23 Video ULA - Video system chip 4 ( 2 bytes x 2 ) | |
| 576 | &24-&27 FDC Latch 1770 Control latch 1770 Control latch 4 ( 1 byte x 4 ) | |
| 577 | &28-&2F 1770 registers 1770 Disc Controller 1170 Disc Controller 8 ( 4 bytes x 2 ) | |
| 578 | &30-&33 ROMSEL - ROM Select 4 ( 1 byte x 4 ) | |
| 579 | &34-&37 ACCCON ACCCON select reg. ACCCON select reg 4 ( 1 byte x 4 ) | |
| 580 | &38-&3F NC - - | |
| 581 | &40-&5F 6522 VIA SYSTEM VIA SYSTEM VIA 32 (16 bytes x 2 ) 1MHz | |
| 582 | &60-&7F 6522 VIA USER VIA USER VIA 32 (16 bytes x 2 ) 1MHz | |
| 583 | &80-&9F Int. Modem Int. Modem Int Modem | |
| 584 | &A0-&BF 68B54 ADLC ECONET controller ECONET controller 32 ( 4 bytes x 8 ) 2MHz | |
| 585 | &C0-&DF NC - - | |
| 586 | &E0-&FF Tube ULA Tube system interface Tube system interface 32 (32 bytes x 1 ) 2MHz | |
| 570 | &FE00-&FEFF SHEILA Read Write | |
| 571 | &00-&07 6845 CRTC Video controller Video Controller 8 ( 2 bytes x 4 ) | |
| 572 | &08-&0F 6850 ACIA Serial controller Serial Controller 8 ( 2 bytes x 4 ) | |
| 573 | &10-&17 Serial ULA - Serial system chip 8 ( 1 byte x 8 ) | |
| 574 | &18-&1F uPD7002 A to D converter A to D converter 8 ( 4 bytes x 2 ) | |
| 575 | &20-&23 Video ULA - Video system chip 4 ( 2 bytes x 2 ) | |
| 576 | &24-&27 FDC Latch 1770 Control latch 1770 Control latch 4 ( 1 byte x 4 ) | |
| 577 | &28-&2F 1770 registers 1770 Disc Controller 1170 Disc Controller 8 ( 4 bytes x 2 ) | |
| 578 | &30-&33 ROMSEL - ROM Select 4 ( 1 byte x 4 ) | |
| 579 | &34-&37 ACCCON ACCCON select reg. ACCCON select reg 4 ( 1 byte x 4 ) | |
| 580 | &38-&3F NC - - | |
| 581 | &40-&5F 6522 VIA SYSTEM VIA SYSTEM VIA 32 (16 bytes x 2 ) 1MHz | |
| 582 | &60-&7F 6522 VIA USER VIA USER VIA 32 (16 bytes x 2 ) 1MHz | |
| 583 | &80-&9F Int. Modem Int. Modem Int Modem | |
| 584 | &A0-&BF 68B54 ADLC ECONET controller ECONET controller 32 ( 4 bytes x 8 ) 2MHz | |
| 585 | &C0-&DF NC - - | |
| 586 | &E0-&FF Tube ULA Tube system interface Tube system interface 32 (32 bytes x 1 ) 2MHz | |
| 587 | 587 | ******************************************************************************/ |
| 588 | 588 | |
| 589 | 589 | READ8_HANDLER ( bbcm_r ) |
| r5932 | r5933 | |
| 591 | 591 | long myo; |
| 592 | 592 | |
| 593 | 593 | /* Now handled in bbcm_ACCCON_write PHS - 2008-10-11 */ |
| 594 | // if ( ACCCON_TST ) | |
| 595 | // { | |
| 596 | // return memory_region(space->machine, "user1")[offset+0x43c00]; | |
| 597 | // }; | |
| 594 | // if ( ACCCON_TST ) | |
| 595 | // { | |
| 596 | // return memory_region(space->machine, "user1")[offset+0x43c00]; | |
| 597 | // }; | |
| 598 | 598 | |
| 599 | 599 | if ((offset>=0x000) && (offset<=0x0ff)) /* FRED */ |
| 600 | 600 | { |
| r5932 | r5933 | |
| 669 | 669 | if ((myo>=0x28) && (myo<=0x2f)) bbcm_wd1770_write(space, myo-0x28,data); /* disc control latch */ |
| 670 | 670 | if ((myo>=0x30) && (myo<=0x33)) page_selectbm_w(space, myo-0x30,data); /* page select */ |
| 671 | 671 | if ((myo>=0x34) && (myo<=0x37)) bbcm_ACCCON_write(space, myo-0x34,data); /* ACCCON */ |
| 672 | //if ((myo>=0x38) && (myo<=0x3f)) | |
| 672 | //if ((myo>=0x38) && (myo<=0x3f)) /* NC ?? */ | |
| 673 | 673 | if ((myo>=0x40) && (myo<=0x5f)) via_w(via_0, myo-0x40, data); |
| 674 | 674 | if ((myo>=0x60) && (myo<=0x7f)) via_w(via_1, myo-0x60, data); |
| 675 | 675 | //if ((myo>=0x80) && (myo<=0x9f)) |
| r5932 | r5933 | |
| 687 | 687 | |
| 688 | 688 | PA0-PA7 |
| 689 | 689 | Port A forms a slow data bus to the keyboard sound and speech processors |
| 690 | PortA Keyboard | |
| 691 | D0 Pin 8 | |
| 692 | D1 Pin 9 | |
| 693 | D2 Pin 10 | |
| 694 | D3 Pin 11 | |
| 695 | D4 Pin 5 | |
| 696 | D5 Pin 6 | |
| 697 | D6 Pin 7 | |
| 698 | D7 Pin 12 | |
| 690 | PortA Keyboard | |
| 691 | D0 Pin 8 | |
| 692 | D1 Pin 9 | |
| 693 | D2 Pin 10 | |
| 694 | D3 Pin 11 | |
| 695 | D4 Pin 5 | |
| 696 | D5 Pin 6 | |
| 697 | D6 Pin 7 | |
| 698 | D7 Pin 12 | |
| 699 | 699 | |
| 700 | 700 | PB0-PB2 outputs |
| 701 | 701 | --------------- |
| r5932 | r5933 | |
| 772 | 772 | B3 - Keyboard write enable |
| 773 | 773 | B4,B5 - these two outputs define the number to be added to the |
| 774 | 774 | start of screen address in hardware to control hardware scrolling:- |
| 775 | Mode Size Start of screen Number to add B5 B4 | |
| 776 | 0,1,2 20K &3000 12K 1 1 | |
| 777 | 3 16K &4000 16K 0 0 | |
| 778 | 4,5 10K &5800 (or &1800) 22K 1 0 | |
| 779 | 6 8K &6000 (or &2000) 24K 0 1 | |
| 775 | Mode Size Start of screen Number to add B5 B4 | |
| 776 | 0,1,2 20K &3000 12K 1 1 | |
| 777 | 3 16K &4000 16K 0 0 | |
| 778 | 4,5 10K &5800 (or &1800) 22K 1 0 | |
| 779 | 6 8K &6000 (or &2000) 24K 0 1 | |
| 780 | 780 | B6 - Operates the CAPS lock LED (Pin 17 keyboard connector) |
| 781 | 781 | B7 - Operates the SHIFT lock LED (Pin 16 keyboard connector) |
| 782 | 782 | |
| r5932 | r5933 | |
| 823 | 823 | { |
| 824 | 824 | /* KBD IC4 8 input NAND gate */ |
| 825 | 825 | /* set the value of via_system ca2, by checking for any keys |
| 826 | | |
| 826 | being pressed on the selected column */ | |
| 827 | 827 | if ((input_port_read(device->machine, colnames[column]) | 0x01) != 0xff) |
| 828 | 828 | { |
| 829 | 829 | via_ca2_w(via_0, 0, 1); |
| r5932 | r5933 | |
| 861 | 861 | { |
| 862 | 862 | /* KBD IC4 8 input NAND gate */ |
| 863 | 863 | /* set the value of via_system ca2, by checking for any keys |
| 864 | ||
| 864 | being pressed on the selected column */ | |
| 865 | 865 | if ((input_port_read(device->machine, colnames[column]) | 0x01) != 0xff) |
| 866 | 866 | { |
| 867 | 867 | via_ca2_w(via_0, 0, 1); |
| 868 | } | |
| 869 | else | |
| 868 | } | |
| 869 | else | |
| 870 | 870 | { |
| 871 | 871 | via_ca2_w(via_0, 0, 0); |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | } | |
| 875 | else | |
| 874 | } | |
| 875 | else | |
| 876 | 876 | { |
| 877 | 877 | via_ca2_w(via_0, 0, 0); |
| 878 | 878 | } |
| r5932 | r5933 | |
| 952 | 952 | { |
| 953 | 953 | via_system_porta=mc146818_port_r(space, 1); |
| 954 | 954 | //logerror("read 146818 data %d \n",via_system_porta); |
| 955 | } | |
| 956 | else | |
| 955 | } | |
| 956 | else | |
| 957 | 957 | { |
| 958 | 958 | mc146818_port_w(space, 1, via_system_porta); |
| 959 | 959 | //logerror("write 146818 data %d \n",via_system_porta); |
| r5932 | r5933 | |
| 1000 | 1000 | |
| 1001 | 1001 | //logerror("SYSTEM write portb %d %d %d\n",data,bit,value); |
| 1002 | 1002 | |
| 1003 | if (value) | |
| 1003 | if (value) | |
| 1004 | 1004 | { |
| 1005 | switch (bit) | |
| 1005 | switch (bit) | |
| 1006 | 1006 | { |
| 1007 | 1007 | case 0: |
| 1008 | if (b0_sound == 0) | |
| 1008 | if (b0_sound == 0) | |
| 1009 | 1009 | { |
| 1010 | 1010 | b0_sound = 1; |
| 1011 | 1011 | } |
| r5932 | r5933 | |
| 1019 | 1019 | MC146818_WR = 1; |
| 1020 | 1020 | MC146818_set(space); |
| 1021 | 1021 | } |
| 1022 | } | |
| 1023 | else | |
| 1022 | } | |
| 1023 | else | |
| 1024 | 1024 | { |
| 1025 | 1025 | if (b1_speech_read == 0) |
| 1026 | 1026 | { |
| r5932 | r5933 | |
| 1038 | 1038 | MC146818_DS = 1; |
| 1039 | 1039 | MC146818_set(space); |
| 1040 | 1040 | } |
| 1041 | } | |
| 1042 | else | |
| 1041 | } | |
| 1042 | else | |
| 1043 | 1043 | { |
| 1044 | if (b2_speech_write == 0) | |
| 1044 | if (b2_speech_write == 0) | |
| 1045 | 1045 | { |
| 1046 | 1046 | /* VSP TMS 5220 */ |
| 1047 | 1047 | b2_speech_write = 1; |
| r5932 | r5933 | |
| 1049 | 1049 | } |
| 1050 | 1050 | break; |
| 1051 | 1051 | case 3: |
| 1052 | if (b3_keyboard == 0) | |
| 1052 | if (b3_keyboard == 0) | |
| 1053 | 1053 | { |
| 1054 | 1054 | b3_keyboard = 1; |
| 1055 | 1055 | } |
| 1056 | 1056 | break; |
| 1057 | 1057 | case 4: |
| 1058 | if (b4_video0 == 0) | |
| 1058 | if (b4_video0 == 0) | |
| 1059 | 1059 | { |
| 1060 | 1060 | b4_video0 = 1; |
| 1061 | 1061 | bbc_setscreenstart(b4_video0, b5_video1); |
| 1062 | 1062 | } |
| 1063 | 1063 | break; |
| 1064 | 1064 | case 5: |
| 1065 | if (b5_video1 == 0) | |
| 1065 | if (b5_video1 == 0) | |
| 1066 | 1066 | { |
| 1067 | 1067 | b5_video1 = 1; |
| 1068 | 1068 | bbc_setscreenstart(b4_video0, b5_video1); |
| 1069 | 1069 | } |
| 1070 | 1070 | break; |
| 1071 | 1071 | case 6: |
| 1072 | if (b6_caps_lock_led == 0) | |
| 1072 | if (b6_caps_lock_led == 0) | |
| 1073 | 1073 | { |
| 1074 | 1074 | b6_caps_lock_led = 1; |
| 1075 | 1075 | /* call caps lock led update */ |
| 1076 | 1076 | } |
| 1077 | 1077 | break; |
| 1078 | 1078 | case 7: |
| 1079 | if (b7_shift_lock_led == 0) | |
| 1079 | if (b7_shift_lock_led == 0) | |
| 1080 | 1080 | { |
| 1081 | 1081 | b7_shift_lock_led = 1; |
| 1082 | 1082 | /* call shift lock led update */ |
| 1083 | 1083 | } |
| 1084 | 1084 | break; |
| 1085 | 1085 | } |
| 1086 | } | |
| 1087 | else | |
| 1086 | } | |
| 1087 | else | |
| 1088 | 1088 | { |
| 1089 | switch (bit) | |
| 1089 | switch (bit) | |
| 1090 | 1090 | { |
| 1091 | 1091 | case 0: |
| 1092 | if (b0_sound == 1) | |
| 1092 | if (b0_sound == 1) | |
| 1093 | 1093 | { |
| 1094 | 1094 | b0_sound = 0; |
| 1095 | 1095 | sn76496_w(devtag_get_device(space->machine, "sn76489"), 0, via_system_porta); |
| r5932 | r5933 | |
| 1104 | 1104 | MC146818_WR = 0; |
| 1105 | 1105 | MC146818_set(space); |
| 1106 | 1106 | } |
| 1107 | } | |
| 1108 | else | |
| 1107 | } | |
| 1108 | else | |
| 1109 | 1109 | { |
| 1110 | if (b1_speech_read == 1) | |
| 1110 | if (b1_speech_read == 1) | |
| 1111 | 1111 | { |
| 1112 | 1112 | /* VSP TMS 5220 */ |
| 1113 | 1113 | b1_speech_read = 0; |
| r5932 | r5933 | |
| 1123 | 1123 | MC146818_DS = 0; |
| 1124 | 1124 | MC146818_set(space); |
| 1125 | 1125 | } |
| 1126 | } | |
| 1127 | else | |
| 1126 | } | |
| 1127 | else | |
| 1128 | 1128 | { |
| 1129 | if (b2_speech_write == 1) | |
| 1129 | if (b2_speech_write == 1) | |
| 1130 | 1130 | { |
| 1131 | 1131 | /* VSP TMS 5220 */ |
| 1132 | 1132 | b2_speech_write = 0; |
| r5932 | r5933 | |
| 1134 | 1134 | } |
| 1135 | 1135 | break; |
| 1136 | 1136 | case 3: |
| 1137 | if (b3_keyboard == 1) | |
| 1137 | if (b3_keyboard == 1) | |
| 1138 | 1138 | { |
| 1139 | 1139 | b3_keyboard = 0; |
| 1140 | 1140 | /* *** call keyboard enabled *** */ |
| r5932 | r5933 | |
| 1142 | 1142 | } |
| 1143 | 1143 | break; |
| 1144 | 1144 | case 4: |
| 1145 | if (b4_video0 == 1) | |
| 1145 | if (b4_video0 == 1) | |
| 1146 | 1146 | { |
| 1147 | 1147 | b4_video0 = 0; |
| 1148 | 1148 | bbc_setscreenstart(b4_video0, b5_video1); |
| 1149 | 1149 | } |
| 1150 | 1150 | break; |
| 1151 | 1151 | case 5: |
| 1152 | if (b5_video1 == 1) | |
| 1152 | if (b5_video1 == 1) | |
| 1153 | 1153 | { |
| 1154 | 1154 | b5_video1 = 0; |
| 1155 | 1155 | bbc_setscreenstart(b4_video0, b5_video1); |
| 1156 | 1156 | } |
| 1157 | 1157 | break; |
| 1158 | 1158 | case 6: |
| 1159 | if (b6_caps_lock_led == 1) | |
| 1159 | if (b6_caps_lock_led == 1) | |
| 1160 | 1160 | { |
| 1161 | 1161 | b6_caps_lock_led = 0; |
| 1162 | 1162 | /* call caps lock led update */ |
| 1163 | 1163 | } |
| 1164 | 1164 | break; |
| 1165 | 1165 | case 7: |
| 1166 | if (b7_shift_lock_led == 1) | |
| 1166 | if (b7_shift_lock_led == 1) | |
| 1167 | 1167 | { |
| 1168 | 1168 | b7_shift_lock_led = 0; |
| 1169 | 1169 | /* call shift lock led update */ |
| r5932 | r5933 | |
| 1210 | 1210 | |
| 1211 | 1211 | //void bbc_TMSint(int status) |
| 1212 | 1212 | //{ |
| 1213 | // TMSint=(!status)&1; | |
| 1214 | // TMSrdy=(!tms5220_readyq_r())&1; | |
| 1215 | // via_0_portb_w(0,(0xf | input_port_read(machine, "IN0")|(TMSint<<6)|(TMSrdy<<7))); | |
| 1213 | // TMSint=(!status)&1; | |
| 1214 | // TMSrdy=(!tms5220_readyq_r())&1; | |
| 1215 | // via_0_portb_w(0,(0xf | input_port_read(machine, "IN0")|(TMSint<<6)|(TMSrdy<<7))); | |
| 1216 | 1216 | //} |
| 1217 | 1217 | |
| 1218 | 1218 | |
| 1219 | 1219 | |
| 1220 | 1220 | static READ8_DEVICE_HANDLER( bbcb_via_system_read_portb ) |
| 1221 | 1221 | { |
| 1222 | // TMSint=(!tms5220_int_r())&1; | |
| 1223 | // TMSrdy=(!tms5220_readyq_r())&1; | |
| 1222 | // TMSint=(!tms5220_int_r())&1; | |
| 1223 | // TMSrdy=(!tms5220_readyq_r())&1; | |
| 1224 | 1224 | |
| 1225 | 1225 | //logerror("SYSTEM read portb %d\n",0xf | input_port(machine, "IN0")|(TMSint<<6)|(TMSrdy<<7)); |
| 1226 | 1226 | |
| r5932 | r5933 | |
| 1438 | 1438 | { |
| 1439 | 1439 | cassette_change_state(devtag_get_device(machine, "cassette"), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 1440 | 1440 | timer_adjust_periodic(bbc_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| 1441 | } | |
| 1442 | else | |
| 1441 | } | |
| 1442 | else | |
| 1443 | 1443 | { |
| 1444 | 1444 | cassette_change_state(devtag_get_device(machine, "cassette"), CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 1445 | 1445 | timer_reset(bbc_tape_timer, attotime_never); |
| r5932 | r5933 | |
| 1468 | 1468 | { |
| 1469 | 1469 | /* I'm assuming that the nmi is edge triggered */ |
| 1470 | 1470 | /* a interrupt from the fdc will cause a change in line state, and |
| 1471 | the nmi will be triggered, but when the state changes because the int | |
| 1472 | is cleared this will not cause another nmi */ | |
| 1471 | the nmi will be triggered, but when the state changes because the int | |
| 1472 | is cleared this will not cause another nmi */ | |
| 1473 | 1473 | /* I'll emulate it like this to be sure */ |
| 1474 | 1474 | |
| 1475 | 1475 | if (state!=previous_i8271_int_state) |
| r5932 | r5933 | |
| 1477 | 1477 | if (state) |
| 1478 | 1478 | { |
| 1479 | 1479 | /* I'll pulse it because if I used hold-line I'm not sure |
| 1480 | ||
| 1480 | it would clear - to be checked */ | |
| 1481 | 1481 | cpu_set_input_line(cputag_get_cpu(device->machine, "maincpu"), INPUT_LINE_NMI,PULSE_LINE); |
| 1482 | 1482 | } |
| 1483 | 1483 | } |
| r5932 | r5933 | |
| 1584 | 1584 | { |
| 1585 | 1585 | int bbc_state; |
| 1586 | 1586 | /* wd177x_IRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together |
| 1587 | wd177x_DRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together | |
| 1588 | the output of the above two NAND gates are then OR'ED together and sent to the 6502 NMI line. | |
| 1589 | DRQ and IRQ are active low outputs from wd177x. We use wd177x_DRQ_SET for DRQ = 0, | |
| 1590 | and wd177x_DRQ_CLR for DRQ = 1. Similarly wd177x_IRQ_SET for IRQ = 0 and wd177x_IRQ_CLR | |
| 1591 | for IRQ = 1. | |
| 1587 | wd177x_DRQ_SET and latch bit 4 (nmi_enable) are NAND'ED together | |
| 1588 | the output of the above two NAND gates are then OR'ED together and sent to the 6502 NMI line. | |
| 1589 | DRQ and IRQ are active low outputs from wd177x. We use wd177x_DRQ_SET for DRQ = 0, | |
| 1590 | and wd177x_DRQ_CLR for DRQ = 1. Similarly wd177x_IRQ_SET for IRQ = 0 and wd177x_IRQ_CLR | |
| 1591 | for IRQ = 1. | |
| 1592 | 1592 | |
| 1593 | The above means that if IRQ or DRQ are set, a interrupt should be generated. | |
| 1594 | The nmi_enable decides if interrupts are actually triggered. | |
| 1595 | The nmi is edge triggered, and triggers on a +ve edge. | |
| 1596 | */ | |
| 1593 | The above means that if IRQ or DRQ are set, a interrupt should be generated. | |
| 1594 | The nmi_enable decides if interrupts are actually triggered. | |
| 1595 | The nmi is edge triggered, and triggers on a +ve edge. | |
| 1596 | */ | |
| 1597 | 1597 | |
| 1598 | 1598 | logerror("callback $%02X\n", state); |
| 1599 | 1599 | |
| r5932 | r5933 | |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | /* nmi is edge triggered, and triggers when the state goes from clear->set. |
| 1642 | ||
| 1642 | Here we are checking this transition before triggering the nmi */ | |
| 1643 | 1643 | if (bbc_state!=previous_wd177x_int_state) |
| 1644 | 1644 | { |
| 1645 | 1645 | if (bbc_state) |
| 1646 | 1646 | { |
| 1647 | 1647 | /* I'll pulse it because if I used hold-line I'm not sure |
| 1648 | ||
| 1648 | it would clear - to be checked */ | |
| 1649 | 1649 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI,PULSE_LINE); |
| 1650 | 1650 | } |
| 1651 | 1651 | } |
| r5932 | r5933 | |
| 1745 | 1745 | |
| 1746 | 1746 | /********************************************* |
| 1747 | 1747 | OPUS CHALLENGER MEMORY MAP |
| 1748 | ||
| 1748 | Read Write | |
| 1749 | 1749 | |
| 1750 | &FCF8 1770 Status register 1770 command register | |
| 1751 | &FCF9 1770 track register | |
| 1752 | &FCFA 1770 sector register | |
| 1753 | &FCFB 1770 data register | |
| 1754 | &FCFC 1770 drive control | |
| 1750 | &FCF8 1770 Status register 1770 command register | |
| 1751 | &FCF9 1770 track register | |
| 1752 | &FCFA 1770 sector register | |
| 1753 | &FCFB 1770 data register | |
| 1754 | &FCFC 1770 drive control | |
| 1755 | 1755 | |
| 1756 | 1756 | |
| 1757 | 1757 | drive control register bits |
| 1758 | 0 | |
| 1758 | 0 select side 0= side 0 1= side 1 | |
| 1759 | 1759 | 1 select drive 0 |
| 1760 | 1760 | 2 select drive 1 |
| 1761 | 1761 | 3 ?unused? |
| r5932 | r5933 | |
| 1767 | 1767 | The RAM is accessible through JIM (page &FD). One page is visible in JIM at a time. |
| 1768 | 1768 | The selected page is controlled by the two paging registers: |
| 1769 | 1769 | |
| 1770 | &FCFE | |
| 1770 | &FCFE Paging register MSB | |
| 1771 | 1771 | &FCFF Paging register LSB |
| 1772 | 1772 | |
| 1773 | 1773 | 256K model has 1024 pages &000 to &3ff |
| 1774 | 1774 | 512K model has 2048 pages &000 to &7ff |
| 1775 | 1775 | |
| 1776 | AM_RANGE(0xfc00, 0xfdff) AM_READWRITE(bbc_opus_read , bbc_opus_write | |
| 1776 | AM_RANGE(0xfc00, 0xfdff) AM_READWRITE(bbc_opus_read , bbc_opus_write ) | |
| 1777 | 1777 | |
| 1778 | 1778 | |
| 1779 | 1779 | **********************************************/ |
| r5932 | r5933 | |
| 1829 | 1829 | return wd17xx_data_r(fdc, 0); |
| 1830 | 1830 | } |
| 1831 | 1831 | |
| 1832 | } | |
| 1833 | else | |
| 1832 | } | |
| 1833 | else | |
| 1834 | 1834 | { |
| 1835 | 1835 | return memory_region(space->machine, "disks")[offset + (opusbank << 8)]; |
| 1836 | 1836 | } |
| r5932 | r5933 | |
| 1871 | 1871 | opusbank=(opusbank & 0xff00) | data; |
| 1872 | 1872 | break; |
| 1873 | 1873 | } |
| 1874 | } | |
| 1875 | else | |
| 1874 | } | |
| 1875 | else | |
| 1876 | 1876 | { |
| 1877 | 1877 | memory_region(space->machine, "disks")[offset + (opusbank << 8)] = data; |
| 1878 | 1878 | } |
| r5932 | r5933 | |
| 1963 | 1963 | wd17xx_set_density(fdc,DEN_MFM_LO); |
| 1964 | 1964 | } |
| 1965 | 1965 | |
| 1966 | // | |
| 1966 | // bbc_1770_IntEnabled=(((data>>4) & 0x01)==0); | |
| 1967 | 1967 | bbc_1770_IntEnabled=1; |
| 1968 | 1968 | |
| 1969 | 1969 | } |
| r5932 | r5933 | |
| 2035 | 2035 | |
| 2036 | 2036 | size = image_length (image); |
| 2037 | 2037 | |
| 2038 | if (strcmp(image->tag,"cart1") == 0) | |
| 2038 | if (strcmp(image->tag,"cart1") == 0) | |
| 2039 | 2039 | { |
| 2040 | 2040 | index = 0; |
| 2041 | 2041 | } |
| 2042 | if (strcmp(image->tag,"cart2") == 0) | |
| 2042 | if (strcmp(image->tag,"cart2") == 0) | |
| 2043 | 2043 | { |
| 2044 | 2044 | index = 1; |
| 2045 | 2045 | } |
| 2046 | if (strcmp(image->tag,"cart3") == 0) | |
| 2046 | if (strcmp(image->tag,"cart3") == 0) | |
| 2047 | 2047 | { |
| 2048 | 2048 | index = 2; |
| 2049 | 2049 | } |
| 2050 | if (strcmp(image->tag,"cart4") == 0) | |
| 2050 | if (strcmp(image->tag,"cart4") == 0) | |
| 2051 | 2051 | { |
| 2052 | 2052 | index = 3; |
| 2053 | 2053 | } |
| r5932 | r5933 | |
| 2057 | 2057 | logerror("loading rom %s at %.4x size:%.4x\n", image_filename(image), addr, size); |
| 2058 | 2058 | |
| 2059 | 2059 | |
| 2060 | switch (size) | |
| 2060 | switch (size) | |
| 2061 | 2061 | { |
| 2062 | 2062 | case 0x2000: |
| 2063 | 2063 | read_ = image_fread(image, mem + addr, size); |
| r5932 | r5933 | |
| 2124 | 2124 | |
| 2125 | 2125 | /*set up the required disc controller*/ |
| 2126 | 2126 | //switch (bbc_DFSType) { |
| 2127 | //case 0: | |
| 2127 | //case 0: case 1: case 2: case 3: | |
| 2128 | 2128 | previous_i8271_int_state=0; |
| 2129 | // | |
| 2129 | // break; | |
| 2130 | 2130 | //case 4: case 5: case 6: |
| 2131 | 2131 | previous_wd177x_int_state=1; |
| 2132 | // | |
| 2132 | // break; | |
| 2133 | 2133 | //} |
| 2134 | 2134 | } |
| 2135 | 2135 | |
| r5932 | r5933 | |
| 2146 | 2146 | /* 32K Model B */ |
| 2147 | 2147 | memory_set_bankptr(machine, 3, ram + 0x4000); |
| 2148 | 2148 | bbc_set_video_memory_lookups(32); |
| 2149 | } | |
| 2150 | else | |
| 2149 | } | |
| 2150 | else | |
| 2151 | 2151 | { |
| 2152 | 2152 | /* 16K just repeat the lower 16K*/ |
| 2153 | 2153 | memory_set_bankptr(machine, 3, ram); |
| r5932 | r5933 | |
| 2163 | 2163 | opusbank = 0; |
| 2164 | 2164 | /*set up the required disc controller*/ |
| 2165 | 2165 | //switch (bbc_DFSType) { |
| 2166 | //case 0: case 1: case 2: case 3: | |
| 2167 | // break; | |
| 2166 | //case 0: case 1: case 2: case 3: | |
| 2167 | // break; | |
| 2168 | 2168 | //case 4: case 5: case 6: |
| 2169 | // | |
| 2169 | // break; | |
| 2170 | 2170 | //} |
| 2171 | 2171 | } |
| 2172 | 2172 | |
| r5932 | r5933 | |
| 2213 | 2213 | |
| 2214 | 2214 | MACHINE_RESET( bbcm ) |
| 2215 | 2215 | { |
| 2216 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu")); /* bank 1 regular lower ram from 0000 to 2fff */ | |
| 2217 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x3000); /* bank 2 screen/shadow ram from 3000 to 7fff */ | |
| 2216 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu")); /* bank 1 regular lower ram from 0000 to 2fff */ | |
| 2217 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x3000); /* bank 2 screen/shadow ram from 3000 to 7fff */ | |
| 2218 | 2218 | memory_set_bankptr(machine, 4, memory_region(machine, "user1")); /* bank 4 is paged ROM or RAM from 8000 to 8fff */ |
| 2219 | 2219 | memory_set_bank(machine, 5, 0); |
| 2220 | memory_set_bankptr(machine, 7, memory_region(machine, "user1") + 0x40000); /* bank 6 OS rom of RAM | |
| 2220 | memory_set_bankptr(machine, 7, memory_region(machine, "user1") + 0x40000); /* bank 6 OS rom of RAM from c000 to dfff */ | |
| 2221 | 2221 | |
| 2222 | 2222 | bbcb_IC32_initialise(); |
| 2223 | 2223 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | sgi.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Silicon Graphics MC (Memory Controller) code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5932 | r5933 | |
|---|---|---|
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | /* bits 1,0 of i/o address define 256 byte block to access. |
| 160 | ||
| 160 | bits 15-8 define the byte offset in the 256 byte block selected */ | |
| 161 | 161 | addr = ((offset & 0x03)<<8) | ((offset>>8) & 0x0ff); |
| 162 | 162 | |
| 163 | 163 | logerror("interface ram w: %04x %02x\n",addr,data); |
| r5932 | r5933 | |
| 243 | 243 | */ |
| 244 | 244 | |
| 245 | 245 | /* |
| 246 | ||
| 246 | Module ID Module Name Module Description | |
| 247 | 247 | |
| 248 | 248 | |
| 249 | D001 Basis Device | |
| 250 | D002 Bus Driver device | |
| 251 | a7 D004 Floppy Disk Interface Device | |
| 249 | D001 Basis Device | |
| 250 | D002 Bus Driver device | |
| 251 | a7 D004 Floppy Disk Interface Device | |
| 252 | 252 | |
| 253 | 253 | |
| 254 | ef M001 Digital IN/OUT | |
| 255 | ee M003 V24 | |
| 256 | M005 User (empty) | |
| 257 | M007 Adapter (empty) | |
| 258 | e7 M010 ADU1 | |
| 259 | f6 M011 64k RAM | |
| 260 | fb M012 Texor | |
| 261 | f4 M022 Expander RAM (16k) | |
| 262 | f7 M025 User PROM (8k) | |
| 263 | fb M026 Forth | |
| 264 | fb M027 Development | |
| 265 | e3 M029 DAU1 | |
| 254 | ef M001 Digital IN/OUT | |
| 255 | ee M003 V24 | |
| 256 | M005 User (empty) | |
| 257 | M007 Adapter (empty) | |
| 258 | e7 M010 ADU1 | |
| 259 | f6 M011 64k RAM | |
| 260 | fb M012 Texor | |
| 261 | f4 M022 Expander RAM (16k) | |
| 262 | f7 M025 User PROM (8k) | |
| 263 | fb M026 Forth | |
| 264 | fb M027 Development | |
| 265 | e3 M029 DAU1 | |
| 266 | 266 | */ |
| 267 | 267 | |
| 268 | 268 | |
| r5932 | r5933 | |
| 282 | 282 | /* |
| 283 | 283 | static const struct kc85_module kc85_v24_module= |
| 284 | 284 | { |
| 285 | 0x0ee, | |
| 286 | "M003", | |
| 287 | "V24" | |
| 285 | 0x0ee, | |
| 286 | "M003", | |
| 287 | "V24" | |
| 288 | 288 | }; |
| 289 | 289 | */ |
| 290 | 290 | static const struct kc85_module kc85_disk_interface_device= |
| r5932 | r5933 | |
| 297 | 297 | static const struct kc85_module *modules[256>>2]; |
| 298 | 298 | /* |
| 299 | 299 | |
| 300 | ||
| 300 | port xx80 | |
| 301 | 301 | |
| 302 | ||
| 302 | - xx is module id. | |
| 303 | 303 | |
| 304 | 304 | |
| 305 | Only addressess divisible by 4 are checked. | |
| 306 | If module does not exist, 0x0ff is returned. | |
| 305 | Only addressess divisible by 4 are checked. | |
| 306 | If module does not exist, 0x0ff is returned. | |
| 307 | 307 | |
| 308 | When xx80 is read, if a module exists a id will be returned. | |
| 309 | Id's for known modules are listed above. | |
| 308 | When xx80 is read, if a module exists a id will be returned. | |
| 309 | Id's for known modules are listed above. | |
| 310 | 310 | */ |
| 311 | 311 | |
| 312 | 312 | /* bus drivers 4 */ |
| r5932 | r5933 | |
| 362 | 362 | /**********************/ |
| 363 | 363 | /* used by KC85/4 and KC85/3 */ |
| 364 | 364 | /* |
| 365 | The cassette motor is controlled by bit 6 of PIO port A. | |
| 366 | The cassette read data is connected to /ASTB input of the PIO. | |
| 367 | A edge from the cassette therefore will trigger a interrupt | |
| 368 | from the PIO. | |
| 369 | The duration between two edges can be timed and the data-bit | |
| 370 | identified. | |
| 365 | The cassette motor is controlled by bit 6 of PIO port A. | |
| 366 | The cassette read data is connected to /ASTB input of the PIO. | |
| 367 | A edge from the cassette therefore will trigger a interrupt | |
| 368 | from the PIO. | |
| 369 | The duration between two edges can be timed and the data-bit | |
| 370 | identified. | |
| 371 | 371 | |
| 372 | I have used a timer to feed data into /ASTB. The timer is only | |
| 373 | active when the cassette motor is on. | |
| 372 | I have used a timer to feed data into /ASTB. The timer is only | |
| 373 | active when the cassette motor is on. | |
| 374 | 374 | */ |
| 375 | 375 | |
| 376 | 376 | |
| r5932 | r5933 | |
| 388 | 388 | int bit; |
| 389 | 389 | |
| 390 | 390 | /* the cassette data is linked to /astb input of |
| 391 | ||
| 391 | the pio. */ | |
| 392 | 392 | |
| 393 | 393 | bit = 0; |
| 394 | 394 | |
| r5932 | r5933 | |
| 434 | 434 | /* |
| 435 | 435 | pin 2 = gnd |
| 436 | 436 | pin 3 = read |
| 437 | pin 1 = k1 ?? modulating signal | |
| 438 | pin 4 = k0 ?? signal?? | |
| 437 | pin 1 = k1 ?? modulating signal | |
| 438 | pin 4 = k0 ?? signal?? | |
| 439 | 439 | pin 5 = motor on |
| 440 | 440 | |
| 441 | 441 | |
| 442 | Tape signals: | |
| 443 | K0, K1 ?? | |
| 444 | MOTON motor control | |
| 445 | ASTB read? | |
| 442 | Tape signals: | |
| 443 | K0, K1 ?? | |
| 444 | MOTON motor control | |
| 445 | ASTB read? | |
| 446 | 446 | |
| 447 | T1-T4 give 4 bit a/d tone sound? | |
| 448 | K1, K0 are mixed with tone. | |
| 447 | T1-T4 give 4 bit a/d tone sound? | |
| 448 | K1, K0 are mixed with tone. | |
| 449 | 449 | |
| 450 | Cassette read goes into ASTB of PIO. | |
| 451 | From this, KC must be able to detect the length | |
| 452 | of the pulses and can read the data. | |
| 450 | Cassette read goes into ASTB of PIO. | |
| 451 | From this, KC must be able to detect the length | |
| 452 | of the pulses and can read the data. | |
| 453 | 453 | |
| 454 | 454 | |
| 455 | Tape write: clock comes from CTC? | |
| 456 | truck signal resets, 5v signal for set. | |
| 457 | output gives k0 and k1. | |
| 455 | Tape write: clock comes from CTC? | |
| 456 | truck signal resets, 5v signal for set. | |
| 457 | output gives k0 and k1. | |
| 458 | 458 | |
| 459 | 459 | |
| 460 | 460 | |
| r5932 | r5933 | |
| 479 | 479 | |
| 480 | 480 | E-mail from Torsten Paul about the keyboard: |
| 481 | 481 | |
| 482 | ||
| 482 | Torsten.Paul@gmx.de | |
| 483 | 483 | |
| 484 | 484 | "> I hope that you will be able to help me so I can add keyboard |
| 485 | 485 | > emulation to it. |
| r5932 | r5933 | |
| 558 | 558 | |
| 559 | 559 | /* |
| 560 | 560 | |
| 561 | ||
| 561 | The CTC timer 3 count is initialised at 0x08f and counts down. | |
| 562 | 562 | |
| 563 | The pulses are connected into PIO /BSTB and generate a interrupt | |
| 564 | on a positive edge. A pulse will not get through if BRDY from PIO is | |
| 565 | not true! | |
| 563 | The pulses are connected into PIO /BSTB and generate a interrupt | |
| 564 | on a positive edge. A pulse will not get through if BRDY from PIO is | |
| 565 | not true! | |
| 566 | 566 | |
| 567 | Then the interrupt occurs, the CTC count is read. The time between | |
| 568 | pulses is therefore measured by the CTC. | |
| 567 | Then the interrupt occurs, the CTC count is read. The time between | |
| 568 | pulses is therefore measured by the CTC. | |
| 569 | 569 | |
| 570 | The time is checked and depending on the value the KC detects | |
| 571 | a 1 or 0 bit sent from the keyboard. | |
| 570 | The time is checked and depending on the value the KC detects | |
| 571 | a 1 or 0 bit sent from the keyboard. | |
| 572 | 572 | |
| 573 | ||
| 573 | Summary From code below: | |
| 574 | 574 | |
| 575 | 0x065<=count<0x078 -> 0 bit "short pulse" | |
| 576 | 0x042<=count<0x065 -> 1 bit "long pulse" | |
| 577 | count<0x014 -> ignore | |
| 578 | count>=0x078 -> ignore | |
| 579 | 0x014<=count<0x042 -> signal end of code "very long pulse" | |
| 575 | 0x065<=count<0x078 -> 0 bit "short pulse" | |
| 576 | 0x042<=count<0x065 -> 1 bit "long pulse" | |
| 577 | count<0x014 -> ignore | |
| 578 | count>=0x078 -> ignore | |
| 579 | 0x014<=count<0x042 -> signal end of code "very long pulse" | |
| 580 | 580 | |
| 581 | codes are sent bit 0, bit 1, bit 2...bit 7. bit 0 is the state | |
| 582 | of the shift key. | |
| 581 | codes are sent bit 0, bit 1, bit 2...bit 7. bit 0 is the state | |
| 582 | of the shift key. | |
| 583 | 583 | |
| 584 | Torsten's e-mail indicates "short pulse" for 1 bit, and "long | |
| 585 | pulse" for 0 bit, but I found this to be incorrect. However, | |
| 586 | the timings are correct. | |
| 584 | Torsten's e-mail indicates "short pulse" for 1 bit, and "long | |
| 585 | pulse" for 0 bit, but I found this to be incorrect. However, | |
| 586 | the timings are correct. | |
| 587 | 587 | |
| 588 | 588 | |
| 589 | ||
| 589 | Keyboard reading procedure extracted from KC85/4 system rom: | |
| 590 | 590 | |
| 591 | 591 | 0345 f5 push af |
| 592 | 0346 db8f in a,(#8f) | |
| 592 | 0346 db8f in a,(#8f) ; get CTC timer 3 count | |
| 593 | 593 | 0348 f5 push af |
| 594 | 0349 3ea7 ld a,#a7 ; channel 3, enable int, select counter mode, control word | |
| 595 | ; write, software reset, time constant follows | |
| 594 | 0349 3ea7 ld a,#a7 ; channel 3, enable int, select counter mode, control word | |
| 595 | ; write, software reset, time constant follows | |
| 596 | 596 | 034b d38f out (#8f),a |
| 597 | 034d 3e8f ld a,#8f | |
| 597 | 034d 3e8f ld a,#8f ; time constant | |
| 598 | 598 | 034f d38f out (#8f),a |
| 599 | 599 | 0351 f1 pop af |
| 600 | 600 | |
| 601 | 601 | 0352 fb ei |
| 602 | 0353 b7 or a | |
| 602 | 0353 b7 or a ; count is over | |
| 603 | 603 | 0354 284d jr z,#03a3 ; |
| 604 | 604 | |
| 605 | ||
| 605 | ;; check count is in range | |
| 606 | 606 | 0356 fe14 cp #14 |
| 607 | 607 | 0358 3849 jr c,#03a3 ; |
| 608 | 608 | 035a fe78 cp #78 |
| 609 | 609 | 035c 3045 jr nc,#03a3 ; |
| 610 | 610 | |
| 611 | ||
| 611 | ;; at this point, time must be between #14 and #77 to be valid | |
| 612 | 612 | |
| 613 | ||
| 613 | ;; if >=#65, then carry=0, and a 0 bit has been detected | |
| 614 | 614 | |
| 615 | 615 | 035e fe65 cp #65 |
| 616 | 616 | 0360 303d jr nc,#039f ; (61) |
| 617 | 617 | |
| 618 | ;; if <#65, then a 1 bit has been detected. carry is set with the addition below. | |
| 619 | ;; a carry will be generated if the count is >#42 | |
| 618 | ;; if <#65, then a 1 bit has been detected. carry is set with the addition below. | |
| 619 | ;; a carry will be generated if the count is >#42 | |
| 620 | 620 | |
| 621 | ;; therefore for a 1 bit to be generated, then #42<=time<#65 | |
| 622 | ;; must be true. | |
| 621 | ;; therefore for a 1 bit to be generated, then #42<=time<#65 | |
| 622 | ;; must be true. | |
| 623 | 623 | |
| 624 | 624 | 0362 c6be add a,#be |
| 625 | 625 | 0364 3839 jr c,#039f ; (57) |
| 626 | 626 | |
| 627 | ;; this code appears to take the transmitted scan-code | |
| 628 | ;; and converts it into a useable code by the os??? | |
| 627 | ;; this code appears to take the transmitted scan-code | |
| 628 | ;; and converts it into a useable code by the os??? | |
| 629 | 629 | 0366 e5 push hl |
| 630 | 630 | 0367 d5 push de |
| 631 | ||
| 631 | ;; convert hardware scan-code into os code | |
| 632 | 632 | 0368 dd7e0c ld a,(ix+#0c) |
| 633 | 633 | 036b 1f rra |
| 634 | 634 | 036c ee01 xor #01 |
| r5932 | r5933 | |
| 641 | 641 | 0379 d1 pop de |
| 642 | 642 | 037a e1 pop hl |
| 643 | 643 | |
| 644 | ||
| 644 | ;; shift lock pressed? | |
| 645 | 645 | 037b ddcb087e bit 7,(ix+#08) |
| 646 | 646 | 037f 200a jr nz,#038b |
| 647 | ||
| 647 | ;; no. | |
| 648 | 648 | |
| 649 | ||
| 649 | ;; alpha char? | |
| 650 | 650 | 0381 fe40 cp #40 |
| 651 | 651 | 0383 3806 jr c,#038b |
| 652 | 652 | 0385 fe80 cp #80 |
| 653 | 653 | 0387 3002 jr nc,#038b |
| 654 | ;; yes, it is a alpha char | |
| 655 | ;; force to lower case | |
| 654 | ;; yes, it is a alpha char | |
| 655 | ;; force to lower case | |
| 656 | 656 | 0389 ee20 xor #20 |
| 657 | 657 | |
| 658 | 038b ddbe0d cp (ix+#0d) | |
| 658 | 038b ddbe0d cp (ix+#0d) ;; same as stored? | |
| 659 | 659 | 038e 201d jr nz,#03ad |
| 660 | 660 | |
| 661 | ||
| 661 | ;; yes - must be held for a certain time before it can repeat? | |
| 662 | 662 | 0390 f5 push af |
| 663 | 663 | 0391 3ae0b7 ld a,(#b7e0) |
| 664 | 664 | 0394 ddbe0a cp (ix+#0a) |
| 665 | 665 | 0397 3811 jr c,#03aa |
| 666 | 666 | 0399 f1 pop af |
| 667 | 667 | |
| 668 | 039a dd340a inc (ix+#0a) | |
| 668 | 039a dd340a inc (ix+#0a) ;; incremenent repeat count? | |
| 669 | 669 | 039d 1804 jr #03a3 |
| 670 | 670 | |
| 671 | ||
| 671 | ;; update scan-code received so far | |
| 672 | 672 | |
| 673 | 039f ddcb0c1e rr (ix+#0c) | |
| 673 | 039f ddcb0c1e rr (ix+#0c) ; shift in 0 or 1 bit depending on what has been selected | |
| 674 | 674 | |
| 675 | 03a3 db89 in a,(#89) | |
| 675 | 03a3 db89 in a,(#89) ; used to clear brdy | |
| 676 | 676 | 03a5 d389 out (#89),a |
| 677 | 677 | 03a7 f1 pop af |
| 678 | 678 | 03a8 ed4d reti |
| r5932 | r5933 | |
| 738 | 738 | 01b3 3054 jr nc,#0209 |
| 739 | 739 | |
| 740 | 740 | |
| 741 | ;; count>=#65 = 0 bit | |
| 742 | ;; #44<=count<#65 = 1 bit | |
| 743 | ;; count<#44 = end of code | |
| 741 | ;; count>=#65 = 0 bit | |
| 742 | ;; #44<=count<#65 = 1 bit | |
| 743 | ;; count<#44 = end of code | |
| 744 | 744 | |
| 745 | 745 | 01b5 fe44 cp #44 |
| 746 | 746 | 01b7 3053 jr nc,#020c |
| r5932 | r5933 | |
| 823 | 823 | static unsigned char kc_brdy; |
| 824 | 824 | |
| 825 | 825 | /* |
| 826 | ||
| 826 | The kc keyboard is seperate from the kc base unit. | |
| 827 | 827 | |
| 828 | ||
| 828 | The keyboard emulation uses 2 timers: | |
| 829 | 829 | |
| 830 | update_timer is used to add scan-codes to the keycode list. | |
| 831 | transmit_timer is used to transmit the scan-code to the kc. | |
| 830 | update_timer is used to add scan-codes to the keycode list. | |
| 831 | transmit_timer is used to transmit the scan-code to the kc. | |
| 832 | 832 | */ |
| 833 | 833 | |
| 834 | 834 | static kc_keyboard keyboard_data; |
| r5932 | r5933 | |
| 1222 | 1222 | { |
| 1223 | 1223 | LOG(("no memory at ram0!\n")); |
| 1224 | 1224 | |
| 1225 | // | |
| 1225 | // memory_set_bankptr(machine, 1,memory_region(machine, "maincpu") + 0x013000); | |
| 1226 | 1226 | /* ram is disabled */ |
| 1227 | 1227 | memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_NOP); |
| 1228 | 1228 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_NOP); |
| r5932 | r5933 | |
| 1397 | 1397 | speaker_level = (data>>1) & 0x0f; |
| 1398 | 1398 | |
| 1399 | 1399 | /* this might not be correct, the range might |
| 1400 | ||
| 1400 | be logarithmic and not linear! */ | |
| 1401 | 1401 | speaker_level_w(speaker, (speaker_level<<4)); |
| 1402 | 1402 | } |
| 1403 | 1403 | break; |
| r5932 | r5933 | |
| 1643 | 1643 | speaker_level = (data>>1) & 0x0f; |
| 1644 | 1644 | |
| 1645 | 1645 | /* this might not be correct, the range might |
| 1646 | ||
| 1646 | be logarithmic and not linear! */ | |
| 1647 | 1647 | speaker_level_w(speaker, (speaker_level<<4)); |
| 1648 | 1648 | } |
| 1649 | 1649 | break; |
| r5932 | r5933 | |
| 1873 | 1873 | |
| 1874 | 1874 | #if 0 |
| 1875 | 1875 | /* this is temporary. Normally when a Z80 is reset, it will |
| 1876 | execute address 0. It appears the KC85 series pages the rom | |
| 1877 | at address 0x0000-0x01000 which has a single jump in it, | |
| 1878 | can't see yet where it disables it later!!!! so for now | |
| 1879 | here will be a override */ | |
| 1876 | execute address 0. It appears the KC85 series pages the rom | |
| 1877 | at address 0x0000-0x01000 which has a single jump in it, | |
| 1878 | can't see yet where it disables it later!!!! so for now | |
| 1879 | here will be a override */ | |
| 1880 | 1880 | memory_set_direct_update_handler(0, kc85_4_opbaseoverride); |
| 1881 | 1881 | #endif |
| 1882 | 1882 | } |
| r5932 | r5933 | |
| 1907 | 1907 | |
| 1908 | 1908 | #if 0 |
| 1909 | 1909 | /* this is temporary. Normally when a Z80 is reset, it will |
| 1910 | execute address 0. It appears the KC85 series pages the rom | |
| 1911 | at address 0x0000-0x01000 which has a single jump in it, | |
| 1912 | can't see yet where it disables it later!!!! so for now | |
| 1913 | here will be a override */ | |
| 1910 | execute address 0. It appears the KC85 series pages the rom | |
| 1911 | at address 0x0000-0x01000 which has a single jump in it, | |
| 1912 | can't see yet where it disables it later!!!! so for now | |
| 1913 | here will be a override */ | |
| 1914 | 1914 | memory_set_direct_update_handler(0, kc85_3_opbaseoverride); |
| 1915 | 1915 | #endif |
| 1916 | 1916 | } |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | ---------- |
| 7 | 7 | |
| 8 | 8 | |-------------------------------------------------------------------------------| |
| 9 | | |---------------CN1---------------| |---------------CN2---------------| | | |
| 10 | |CN6 | | |
| 11 | | |---------| |---------| 4050 4050 | | |
| 12 | | | CDPR566 | | CDP1861 | CN3 | | |
| 13 | | |---------| |---------| | | |
| 14 | | CN4 | | |
| 15 | | 7805 |---------| |--------| | | |
| 16 | | 2114 3.521280MHz | 4508 | | 4508 | CN5 | | |
| 17 | | |---------| |--------| | | |
| 18 | | 2114 |--------| | | |
| 19 | | 7474 7400 4049 4051 4028 | 4515 | CA3401 | | |
| 20 | | 2114 |--------| | | |
| 21 | | |-------------| | | |
| 22 | | 2114 | CDP1802 | | | |
| 23 | | |-------------| LED1 | | |
| 24 | | 2114 | | |
| 25 | | LED2 | | |
| 26 | | 2114 4556 4042 | | |
| 27 | | LED3 | | |
| 28 | | 555 2114 4011 4013 | | |
| 29 | | SW1 | | |
| 30 | | 2114 | | |
| 31 | | | | |
| 9 | | |---------------CN1---------------| |---------------CN2---------------| | | |
| 10 | |CN6 | | |
| 11 | | |---------| |---------| 4050 4050 | | |
| 12 | | | CDPR566 | | CDP1861 | CN3 | | |
| 13 | | |---------| |---------| | | |
| 14 | | CN4 | | |
| 15 | | 7805 |---------| |--------| | | |
| 16 | | 2114 3.521280MHz | 4508 | | 4508 | CN5 | | |
| 17 | | |---------| |--------| | | |
| 18 | | 2114 |--------| | | |
| 19 | | 7474 7400 4049 4051 4028 | 4515 | CA3401 | | |
| 20 | | 2114 |--------| | | |
| 21 | | |-------------| | | |
| 22 | | 2114 | CDP1802 | | | |
| 23 | | |-------------| LED1 | | |
| 24 | | 2114 | | |
| 25 | | LED2 | | |
| 26 | | 2114 4556 4042 | | |
| 27 | | LED3 | | |
| 28 | | 555 2114 4011 4013 | | |
| 29 | | SW1 | | |
| 30 | | 2114 | | |
| 31 | | | | |
| 32 | 32 | |-------------------------------------------------------------------------------| |
| 33 | 33 | |
| 34 | 34 | Notes: |
| 35 | 35 | All IC's shown. |
| 36 | ||
| 37 | CDPR566 - Programmed CDP1832 512 x 8-Bit Static ROM | |
| 38 | 2114 - 2114 4096 Bit (1024x4) NMOS Static RAM | |
| 39 | CDP1802 - RCA CDP1802 CMOS 8-Bit Microprocessor | |
| 40 | CDP1861 - RCA CDP1861 Video Display Controller | |
| 41 | CA3401 - Quad Single-Supply Op-Amp | |
| 42 | CN1 - expansion interface connector | |
| 43 | CN2 - parallel I/O interface connector | |
| 44 | CN3 - video connector | |
| 45 | CN4 - tape in connector | |
| 46 | CN5 - tape out connector | |
| 47 | CN6 - power connector | |
| 48 | LED1 - power led | |
| 49 | LED2 - Q led | |
| 50 | LED3 - tape led | |
| 51 | SW1 - Run/Reset switch | |
| 52 | 36 | |
| 37 | CDPR566 - Programmed CDP1832 512 x 8-Bit Static ROM | |
| 38 | 2114 - 2114 4096 Bit (1024x4) NMOS Static RAM | |
| 39 | CDP1802 - RCA CDP1802 CMOS 8-Bit Microprocessor | |
| 40 | CDP1861 - RCA CDP1861 Video Display Controller | |
| 41 | CA3401 - Quad Single-Supply Op-Amp | |
| 42 | CN1 - expansion interface connector | |
| 43 | CN2 - parallel I/O interface connector | |
| 44 | CN3 - video connector | |
| 45 | CN4 - tape in connector | |
| 46 | CN5 - tape out connector | |
| 47 | CN6 - power connector | |
| 48 | LED1 - power led | |
| 49 | LED2 - Q led | |
| 50 | LED3 - tape led | |
| 51 | SW1 - Run/Reset switch | |
| 52 | ||
| 53 | 53 | */ |
| 54 | 54 | |
| 55 | 55 | /* |
| 56 | 56 | |
| 57 | 57 | TODO: |
| 58 | 58 | |
| 59 | ||
| 59 | - second VP580 keypad | |
| 60 | 60 | |
| 61 | ||
| 61 | - VP-585 Expansion Keyboard Interface (2 keypad connectors for VP-580) | |
| 62 | 62 | - VP-551 Super Sound Board (4 channel sound) |
| 63 | 63 | - VP-601/611 ASCII Keyboard (VP-601 58 keys, VP611 58 keys + 16 keys numerical keypad) |
| 64 | 64 | - VP-700 Expanded Tiny Basic Board (4 KB ROM expansion) |
| r5932 | r5933 | |
| 67 | 67 | |
| 68 | 68 | /* |
| 69 | 69 | |
| 70 | VP-711 COSMAC MicroComputer $199 | |
| 71 | (CDP18S711) Features RCA COSMAC microprocessor. 2K RAM, expandable to | |
| 72 | 32K (4K on-board). Built-in cassette interface and video interface. | |
| 73 | 16 key hexidecimal keypad. ROM operating system. CHIP-8 language and | |
| 74 | machine language. Tone generator and speaker. 8-bit input port, 8-bit | |
| 75 | output port, and full system expansion connector. Power supply and 3 | |
| 76 | manuals (VP-311, VP-320, MPM201 B) included. Completely assembled. | |
| 70 | VP-711 COSMAC MicroComputer $199 | |
| 71 | (CDP18S711) Features RCA COSMAC microprocessor. 2K RAM, expandable to | |
| 72 | 32K (4K on-board). Built-in cassette interface and video interface. | |
| 73 | 16 key hexidecimal keypad. ROM operating system. CHIP-8 language and | |
| 74 | machine language. Tone generator and speaker. 8-bit input port, 8-bit | |
| 75 | output port, and full system expansion connector. Power supply and 3 | |
| 76 | manuals (VP-311, VP-320, MPM201 B) included. Completely assembled. | |
| 77 | 77 | |
| 78 | VP-44 VP-711 RAM On-Board Expansion Kit $36 | |
| 79 | Four type 2114 RAM IC's for expanding VP-711 on-board memory | |
| 80 | to 4K bytes. | |
| 78 | VP-44 VP-711 RAM On-Board Expansion Kit $36 | |
| 79 | Four type 2114 RAM IC's for expanding VP-711 on-board memory | |
| 80 | to 4K bytes. | |
| 81 | 81 | |
| 82 | VP-111 MicroComputer $99 | |
| 83 | RCA COSMAC microprocessor. 1 K RAM expandable to 32K (4K On- | |
| 84 | board). Built-in cassette interface and video interface. 16 key | |
| 85 | Hexidecimal keypad. ROM operating system. CHIP-8 language and Machine | |
| 86 | language. Tone generator. Assembled - user must install Cables | |
| 87 | (supplied) and furnish 5 volt power supply and speaker. | |
| 82 | VP-111 MicroComputer $99 | |
| 83 | RCA COSMAC microprocessor. 1 K RAM expandable to 32K (4K On- | |
| 84 | board). Built-in cassette interface and video interface. 16 key | |
| 85 | Hexidecimal keypad. ROM operating system. CHIP-8 language and Machine | |
| 86 | language. Tone generator. Assembled - user must install Cables | |
| 87 | (supplied) and furnish 5 volt power supply and speaker. | |
| 88 | 88 | |
| 89 | VP-114 VP-111 Expansion Kit $76 | |
| 90 | Includes I/O ports, system expansion connector and additional | |
| 91 | 3K of RAM. Expands VP-111 to VP-711 capability. | |
| 89 | VP-114 VP-111 Expansion Kit $76 | |
| 90 | Includes I/O ports, system expansion connector and additional | |
| 91 | 3K of RAM. Expands VP-111 to VP-711 capability. | |
| 92 | 92 | |
| 93 | VP-155 VP-111 Cover $12 | |
| 94 | Attractive protective plastic cover for VP-111. | |
| 93 | VP-155 VP-111 Cover $12 | |
| 94 | Attractive protective plastic cover for VP-111. | |
| 95 | 95 | |
| 96 | VP-3301 Interactive Data Terminal Available Approx. 6 Months | |
| 97 | Microprocessor Based Computer Terminal with keyboard, video | |
| 98 | Interface and color graphics - includes full resident and user | |
| 99 | Definable character font, switch selectable configuration, cursor | |
| 100 | Control, reverse video and many other features. | |
| 96 | VP-3301 Interactive Data Terminal Available Approx. 6 Months | |
| 97 | Microprocessor Based Computer Terminal with keyboard, video | |
| 98 | Interface and color graphics - includes full resident and user | |
| 99 | Definable character font, switch selectable configuration, cursor | |
| 100 | Control, reverse video and many other features. | |
| 101 | 101 | |
| 102 | VP-590 Color Board $69 | |
| 103 | Displays VP-711 output in color! Program control of four | |
| 104 | Background colors and eight foreground colors. CHIP-8X language | |
| 105 | Adds color commands. Includes two sockets for VP-580 Expansion | |
| 106 | Keyboards. | |
| 102 | VP-590 Color Board $69 | |
| 103 | Displays VP-711 output in color! Program control of four | |
| 104 | Background colors and eight foreground colors. CHIP-8X language | |
| 105 | Adds color commands. Includes two sockets for VP-580 Expansion | |
| 106 | Keyboards. | |
| 107 | 107 | |
| 108 | VP-595 Simple Sound Board $30 | |
| 109 | Provides 256 different frequencies in place of VP-711 single- | |
| 110 | tone Output. Use with VP-590 Color Board for simultaneous color and | |
| 111 | Sound. Great for simple music or sound effects! Includes speaker. | |
| 108 | VP-595 Simple Sound Board $30 | |
| 109 | Provides 256 different frequencies in place of VP-711 single- | |
| 110 | tone Output. Use with VP-590 Color Board for simultaneous color and | |
| 111 | Sound. Great for simple music or sound effects! Includes speaker. | |
| 112 | 112 | |
| 113 | VP-550 Super Sound Board $49 | |
| 114 | Turn your VP-711 into a music synthesizer! Two independent | |
| 115 | sound Channels. Frequency, duration and amplitude envelope (voice) of | |
| 116 | Each channel under program control. On-board tempo control. Provision | |
| 117 | for multi-track recording or slaving VP-711's. Output drives audio | |
| 118 | preamp. Does not permit simultaneous video display. | |
| 113 | VP-550 Super Sound Board $49 | |
| 114 | Turn your VP-711 into a music synthesizer! Two independent | |
| 115 | sound Channels. Frequency, duration and amplitude envelope (voice) of | |
| 116 | Each channel under program control. On-board tempo control. Provision | |
| 117 | for multi-track recording or slaving VP-711's. Output drives audio | |
| 118 | preamp. Does not permit simultaneous video display. | |
| 119 | 119 | |
| 120 | VP-551 Super Sound 4-Channel Expander Package $74 | |
| 121 | VP-551 provides four (4) independent sound channels with | |
| 122 | frequency duration and amplitude envelope for each channel. Package | |
| 123 | includes modified VP-550 super sound board, VP-576 two board | |
| 124 | expander, data cassette with 4-channel PIN-8 program, and instruction | |
| 125 | manual. Requires 4K RAM system and your VP-550 Super Sound Board. | |
| 120 | VP-551 Super Sound 4-Channel Expander Package $74 | |
| 121 | VP-551 provides four (4) independent sound channels with | |
| 122 | frequency duration and amplitude envelope for each channel. Package | |
| 123 | includes modified VP-550 super sound board, VP-576 two board | |
| 124 | expander, data cassette with 4-channel PIN-8 program, and instruction | |
| 125 | manual. Requires 4K RAM system and your VP-550 Super Sound Board. | |
| 126 | 126 | |
| 127 | VP-570 Memory Expansion Board $95 | |
| 128 | Plug-in 4K static RAM memory. Jumper locates RAM in any 4K | |
| 129 | block in first 32K of VP-711 memory space. | |
| 127 | VP-570 Memory Expansion Board $95 | |
| 128 | Plug-in 4K static RAM memory. Jumper locates RAM in any 4K | |
| 129 | block in first 32K of VP-711 memory space. | |
| 130 | 130 | |
| 131 | VP-580 Auxiliary Keyboard $20 | |
| 132 | Adds two-player interactive game capability to VP-711 16-key | |
| 133 | keypad with cable. Connects to sockets on VP-590 Color Board or VP- | |
| 134 | 585 Keyboard Interface. | |
| 131 | VP-580 Auxiliary Keyboard $20 | |
| 132 | Adds two-player interactive game capability to VP-711 16-key | |
| 133 | keypad with cable. Connects to sockets on VP-590 Color Board or VP- | |
| 134 | 585 Keyboard Interface. | |
| 135 | 135 | |
| 136 | VP-585 Keyboard Interface Board $15 | |
| 137 | Interfaces two VP-580 Expansion Keyboards directly to the VP- | |
| 138 | 711. Not required when VP-590 Color Board is used. | |
| 136 | VP-585 Keyboard Interface Board $15 | |
| 137 | Interfaces two VP-580 Expansion Keyboards directly to the VP- | |
| 138 | 711. Not required when VP-590 Color Board is used. | |
| 139 | 139 | |
| 140 | VP-560 EPROM Board $34 | |
| 141 | Interfaces two Intel 2716 EPROMs to VP-711. Places EPROMs any- | |
| 142 | where in memory space. Can also re-allocate on-board RAM in memory | |
| 143 | space. | |
| 140 | VP-560 EPROM Board $34 | |
| 141 | Interfaces two Intel 2716 EPROMs to VP-711. Places EPROMs any- | |
| 142 | where in memory space. Can also re-allocate on-board RAM in memory | |
| 143 | space. | |
| 144 | 144 | |
| 145 | VP-565 EPROM Programmer Board $99 | |
| 146 | Programs Intel 2716 EPROMs with VP-711. Complete with software | |
| 147 | to program, copy, and verify. On-board generation of all programming | |
| 148 | voltages. | |
| 145 | VP-565 EPROM Programmer Board $99 | |
| 146 | Programs Intel 2716 EPROMs with VP-711. Complete with software | |
| 147 | to program, copy, and verify. On-board generation of all programming | |
| 148 | voltages. | |
| 149 | 149 | |
| 150 | VP-575 Expansion Board $59 | |
| 151 | Plug-in board with 4 buffered and one unbuffered socket. | |
| 152 | Permits use of up to 5 Accessory Boards in VP-711 Expansion Socket. | |
| 150 | VP-575 Expansion Board $59 | |
| 151 | Plug-in board with 4 buffered and one unbuffered socket. | |
| 152 | Permits use of up to 5 Accessory Boards in VP-711 Expansion Socket. | |
| 153 | 153 | |
| 154 | VP-576 Two-Board Expander $20 | |
| 155 | Plug-in board for VP-711 I/O or Expansion Socket permits use | |
| 156 | of two Accessory Boards in either location. | |
| 154 | VP-576 Two-Board Expander $20 | |
| 155 | Plug-in board for VP-711 I/O or Expansion Socket permits use | |
| 156 | of two Accessory Boards in either location. | |
| 157 | 157 | |
| 158 | VP-601* ASCII Keyboard. 7-Bit Parallel Output $69 | |
| 159 | Fully encoded, 128-character ASCII alphanumeric keyboard. 58 | |
| 160 | light touch keys (2 user defined). Selectable "Upper-Case-Only". | |
| 158 | VP-601* ASCII Keyboard. 7-Bit Parallel Output $69 | |
| 159 | Fully encoded, 128-character ASCII alphanumeric keyboard. 58 | |
| 160 | light touch keys (2 user defined). Selectable "Upper-Case-Only". | |
| 161 | 161 | |
| 162 | VP-606* ASCII Keyboard - Serial Output $99 | |
| 163 | Same as VP-601. EIA RS232C compatible, 20 mA current loop and | |
| 164 | TTL outputs. Six selectable baud rates. Available mid-1980. | |
| 162 | VP-606* ASCII Keyboard - Serial Output $99 | |
| 163 | Same as VP-601. EIA RS232C compatible, 20 mA current loop and | |
| 164 | TTL outputs. Six selectable baud rates. Available mid-1980. | |
| 165 | 165 | |
| 166 | VP-611* ASCII/Numeric Keyboard. 7-Bit Parallel Output $89 | |
| 167 | ASCII Keyboard identical to VP-601 plus 16 key numeric entry | |
| 168 | keyboard for easier entry of numbers. | |
| 166 | VP-611* ASCII/Numeric Keyboard. 7-Bit Parallel Output $89 | |
| 167 | ASCII Keyboard identical to VP-601 plus 16 key numeric entry | |
| 168 | keyboard for easier entry of numbers. | |
| 169 | 169 | |
| 170 | VP-616* ASCII/Numeric Keyboard - Serial Output $119 | |
| 171 | Same as VP-611. EIA RS232C compatible, 20 mA current loop and | |
| 172 | TTL outputs. Six selectable baud rates. Available mid-1980. | |
| 170 | VP-616* ASCII/Numeric Keyboard - Serial Output $119 | |
| 171 | Same as VP-611. EIA RS232C compatible, 20 mA current loop and | |
| 172 | TTL outputs. Six selectable baud rates. Available mid-1980. | |
| 173 | 173 | |
| 174 | VP-620 Cable: ASCII Keyboards to VP-711 $20 | |
| 175 | Flat ribbon cable, 24" length, for connecting VP-601 or VP- | |
| 176 | 611 and VP-711. Includes matching connector on both ends. | |
| 174 | VP-620 Cable: ASCII Keyboards to VP-711 $20 | |
| 175 | Flat ribbon cable, 24" length, for connecting VP-601 or VP- | |
| 176 | 611 and VP-711. Includes matching connector on both ends. | |
| 177 | 177 | |
| 178 | VP-623 Cable: Parallel Output ASCII Keyboards $20 | |
| 179 | Flat ribbon cable, 36" length with mating connector for VP- | |
| 180 | 601 or VP-611 Keyboards. Other end is unterminated. | |
| 178 | VP-623 Cable: Parallel Output ASCII Keyboards $20 | |
| 179 | Flat ribbon cable, 36" length with mating connector for VP- | |
| 180 | 601 or VP-611 Keyboards. Other end is unterminated. | |
| 181 | 181 | |
| 182 | VP-626 Connector: Serial Output ASCII Keyboards & Terminal $7 | |
| 183 | 25 pin solderable male "D" connector mates to VP-606, VP-616 | |
| 184 | or VP-3301. | |
| 182 | VP-626 Connector: Serial Output ASCII Keyboards & Terminal $7 | |
| 183 | 25 pin solderable male "D" connector mates to VP-606, VP-616 | |
| 184 | or VP-3301. | |
| 185 | 185 | |
| 186 | TC1210 9" Video Monitor $195 | |
| 187 | Ideal, low-cost monochrome monitor for displaying the video | |
| 188 | output from your microcomputer or terminal. | |
| 186 | TC1210 9" Video Monitor $195 | |
| 187 | Ideal, low-cost monochrome monitor for displaying the video | |
| 188 | output from your microcomputer or terminal. | |
| 189 | 189 | |
| 190 | TC1217 17" Video Monitor $480 | |
| 191 | A really BIG monochrome monitor for use with your | |
| 192 | microcomputer or terminal 148 sq. in. pictures. | |
| 190 | TC1217 17" Video Monitor $480 | |
| 191 | A really BIG monochrome monitor for use with your | |
| 192 | microcomputer or terminal 148 sq. in. pictures. | |
| 193 | 193 | |
| 194 | VP-700 Tiny BASIC ROM Board $39 | |
| 195 | Run Tiny BASIC on your VP-711! All BASIC code stored in ROM. | |
| 196 | Requires separate ASCII keyboard. | |
| 194 | VP-700 Tiny BASIC ROM Board $39 | |
| 195 | Run Tiny BASIC on your VP-711! All BASIC code stored in ROM. | |
| 196 | Requires separate ASCII keyboard. | |
| 197 | 197 | |
| 198 | VP-701 Floating Point BASIC for VP-711 $49 | |
| 199 | 16K bytes on cassette tape, includes floating point and | |
| 200 | integer math, string capability and color graphics. More than 70 | |
| 201 | commands and statements. Available mid-1980. | |
| 198 | VP-701 Floating Point BASIC for VP-711 $49 | |
| 199 | 16K bytes on cassette tape, includes floating point and | |
| 200 | integer math, string capability and color graphics. More than 70 | |
| 201 | commands and statements. Available mid-1980. | |
| 202 | 202 | |
| 203 | VP-710 Game Manual $10 | |
| 204 | More exciting games for your VP-711! Includes Blackjack, | |
| 205 | Biorythm, Pinball, Bowling and 10 others. | |
| 203 | VP-710 Game Manual $10 | |
| 204 | More exciting games for your VP-711! Includes Blackjack, | |
| 205 | Biorythm, Pinball, Bowling and 10 others. | |
| 206 | 206 | |
| 207 | ||
| 207 | VP-720 Game Manual II More exciting games. Available mid-1980. $15 | |
| 208 | 208 | |
| 209 | ||
| 209 | VP-311 VP-711 Instruction Manual (Included with VP-711) $5 | |
| 210 | 210 | |
| 211 | ||
| 211 | VP-320 VP-711 User Guide Manual (Included with VP-711) $5 | |
| 212 | 212 | |
| 213 | ||
| 213 | MPM-201B CDP1802 User Manual (Included with VP-711) $5 | |
| 214 | 214 | |
| 215 | * Quantities of 15 or more available less case and speaker (Assembled | |
| 216 | keypad and circut board only). Price on request. | |
| 215 | * Quantities of 15 or more available less case and speaker (Assembled | |
| 216 | keypad and circut board only). Price on request. | |
| 217 | 217 | |
| 218 | 218 | */ |
| 219 | 219 | |
| r5932 | r5933 | |
| 310 | 310 | static ADDRESS_MAP_START( vip_io_map, ADDRESS_SPACE_IO, 8 ) |
| 311 | 311 | AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1861_TAG, vip_cdp1861_dispon_r, vip_cdp1861_dispoff_w) |
| 312 | 312 | AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w) |
| 313 | // | |
| 313 | // AM_RANGE(0x03, 0x03) AM_DEVWRITE(CDP1863_TAG, cdp1863_str_w) | |
| 314 | 314 | AM_RANGE(0x04, 0x04) AM_WRITE(bankswitch_w) |
| 315 | // | |
| 315 | // AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1862_TAG, cdp1862_bkg_w) | |
| 316 | 316 | ADDRESS_MAP_END |
| 317 | 317 | |
| 318 | 318 | /* Input Ports */ |
| r5932 | r5933 | |
| 364 | 364 | PORT_CONFSETTING( 0x02, "2x VP-580 Expansion Keyboard" ) |
| 365 | 365 | PORT_CONFSETTING( 0x03, "VP-601 ASCII Keyboard" ) |
| 366 | 366 | PORT_CONFSETTING( 0x04, "VP-611 ASCII/Numeric Keyboard" ) |
| 367 | ||
| 367 | ||
| 368 | 368 | PORT_START("VIDEO") |
| 369 | 369 | PORT_CONFNAME( 0x01, 0x00, "Video") |
| 370 | 370 | PORT_CONFSETTING( 0x00, "Standard" ) |
| r5932 | r5933 | |
| 440 | 440 | |
| 441 | 441 | state->a12 = (offset & 0x1000) ? 1 : 0; |
| 442 | 442 | |
| 443 | if (!state->a12) | |
| 443 | if (!state->a12) | |
| 444 | 444 | { |
| 445 | 445 | /* mask out A4 and A3 */ |
| 446 | 446 | mask = 0xe7; |
| r5932 | r5933 | |
| 535 | 535 | |
| 536 | 536 | static CDP1802_SC_WRITE( vip_sc_w ) |
| 537 | 537 | { |
| 538 | // | |
| 538 | // vip_state *driver_state = device->machine->driver_data; | |
| 539 | 539 | |
| 540 | 540 | switch (input_port_read(device->machine, "SOUND")) |
| 541 | 541 | { |
| r5932 | r5933 | |
| 595 | 595 | { |
| 596 | 596 | UINT8 mask = 0xff; |
| 597 | 597 | |
| 598 | if (!state->a12) | |
| 598 | if (!state->a12) | |
| 599 | 599 | { |
| 600 | 600 | /* mask out A4 and A3 */ |
| 601 | 601 | mask = 0xe7; |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | state->color = state->colorram[offset & mask]; |
| 605 | ||
| 605 | ||
| 606 | 606 | cdp1862_dma_w(state->cdp1862, offset, data); |
| 607 | 607 | } |
| 608 | 608 | break; |
| r5932 | r5933 | |
| 674 | 674 | static MACHINE_RESET( vip ) |
| 675 | 675 | { |
| 676 | 676 | vip_state *state = machine->driver_data; |
| 677 | ||
| 677 | ||
| 678 | 678 | const address_space *program = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM); |
| 679 | 679 | const address_space *io = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_IO); |
| 680 | 680 | |
| r5932 | r5933 | |
| 853 | 853 | |
| 854 | 854 | /* System Drivers */ |
| 855 | 855 | |
| 856 | /* | |
| 856 | /* | |
| 857 | 857 | COMP( 1977, vip, 0, 0, vip, vip, 0, vp711, "RCA", "Cosmac VIP (VP-711)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS ) |
| 858 | 858 | COMP( 1977, vp111, vip, 0, vip, vip, 0, vp111, "RCA", "Cosmac VIP (VP-111)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS ) |
| r5932 | r5933 | |
|---|---|---|
| 316 | 316 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 317 | 317 | |
| 318 | 318 | MDRV_VIDEO_UPDATE( dgnbeta ) |
| 319 | ||
| 319 | ||
| 320 | 320 | MDRV_PIA6821_ADD( "pia_0", dgnbeta_pia_intf[0] ) |
| 321 | 321 | MDRV_PIA6821_ADD( "pia_1", dgnbeta_pia_intf[1] ) |
| 322 | 322 | MDRV_PIA6821_ADD( "pia_2", dgnbeta_pia_intf[2] ) |
| 323 | 323 | |
| 324 | MDRV_WD179X_ADD("wd179x", dgnbeta_wd17xx_interface ) | |
| 325 | ||
| 324 | MDRV_WD179X_ADD("wd179x", dgnbeta_wd17xx_interface ) | |
| 325 | ||
| 326 | 326 | MDRV_FLOPPY_4_DRIVES_ADD(dgnbeta_floppy_config) |
| 327 | 327 | MACHINE_DRIVER_END |
| 328 | 328 |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | |
| 7 | 7 | /* |
| 8 | 8 | |
| 9 | ||
| 9 | TODO: | |
| 10 | 10 | |
| 11 | ||
| 11 | - proper layout | |
| 12 | 12 | |
| 13 | 13 | */ |
| 14 | 14 | |
| r5932 | r5933 | |
| 160 | 160 | { |
| 161 | 161 | /* |
| 162 | 162 | EF1 CDP1861 |
| 163 | EF2 | |
| 164 | EF3 | |
| 163 | EF2 | |
| 164 | EF3 | |
| 165 | 165 | EF4 input switch |
| 166 | 166 | */ |
| 167 | 167 | |
| r5932 | r5933 | |
| 365 | 365 | |
| 366 | 366 | /* System Drivers */ |
| 367 | 367 | |
| 368 | /* YEAR | |
| 368 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 369 | 369 | COMP( 1978, elf2, 0, 0, elf2, elf2, 0, elf2, "Netronics", "Elf II", GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | /* Address maps */ |
| 34 | 34 | static ADDRESS_MAP_START(homelab2_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 35 | AM_RANGE( 0x0000, 0x07ff ) AM_ROM // ROM 1 | |
| 36 | AM_RANGE( 0x0800, 0x0fff ) AM_ROM // ROM 2 | |
| 35 | AM_RANGE( 0x0000, 0x07ff ) AM_ROM // ROM 1 | |
| 36 | AM_RANGE( 0x0800, 0x0fff ) AM_ROM // ROM 2 | |
| 37 | 37 | AM_RANGE( 0x1000, 0x17ff ) AM_ROM // ROM 3 |
| 38 | 38 | AM_RANGE( 0x1800, 0x1fff ) AM_ROM // ROM 4 |
| 39 | 39 | AM_RANGE( 0x2000, 0x27ff ) AM_ROM // ROM 5 |
| r5932 | r5933 | |
| 41 | 41 | AM_RANGE( 0x3000, 0x37ff ) AM_ROM // Empty |
| 42 | 42 | AM_RANGE( 0x3800, 0x3fff ) AM_READWRITE(homelab_keyboard_r,homelab_keyboard_w) |
| 43 | 43 | AM_RANGE( 0x4000, 0x7fff ) AM_RAM |
| 44 | AM_RANGE( 0xc000, 0xc3ff ) AM_RAM AM_MIRROR(0x3c00) // Video RAM 1K | |
| 44 | AM_RANGE( 0xc000, 0xc3ff ) AM_RAM AM_MIRROR(0x3c00) // Video RAM 1K | |
| 45 | 45 | ADDRESS_MAP_END |
| 46 | 46 | |
| 47 | 47 | static ADDRESS_MAP_START(homelab3_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 48 | AM_RANGE( 0x0000, 0x3fff ) AM_ROM | |
| 48 | AM_RANGE( 0x0000, 0x3fff ) AM_ROM | |
| 49 | 49 | AM_RANGE( 0x4000, 0x7fff ) AM_RAM |
| 50 | 50 | //AM_RANGE( 0xe000, 0xefff ) AM_RAM // Keyboard |
| 51 | 51 | AM_RANGE( 0xf000, 0xf7ff ) AM_RAM AM_MIRROR(0x0800)// Video RAM |
| 52 | 52 | ADDRESS_MAP_END |
| 53 | ||
| 53 | ||
| 54 | 54 | /* Input ports */ |
| 55 | 55 | static INPUT_PORTS_START( homelab ) |
| 56 | 56 | PORT_START("LINE0") |
| r5932 | r5933 | |
| 63 | 63 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 64 | 64 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 65 | 65 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 66 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 66 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 67 | 67 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') |
| 68 | 68 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Run/Brk") PORT_CODE(KEYCODE_RCONTROL) |
| 69 | 69 | |
| r5932 | r5933 | |
| 150 | 150 | static MACHINE_DRIVER_START( homelab3 ) |
| 151 | 151 | /* basic machine hardware */ |
| 152 | 152 | MDRV_IMPORT_FROM(homelab) |
| 153 | MDRV_CPU_MODIFY("maincpu") | |
| 153 | MDRV_CPU_MODIFY("maincpu") | |
| 154 | 154 | MDRV_CPU_PROGRAM_MAP(homelab3_mem) |
| 155 | ||
| 155 | ||
| 156 | 156 | MDRV_SCREEN_MODIFY("screen") |
| 157 | 157 | MDRV_SCREEN_SIZE(80*8, 25*8) |
| 158 | 158 | MDRV_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*8-1) |
| 159 | 159 | MDRV_VIDEO_UPDATE( homelab3 ) |
| 160 | ||
| 160 | ||
| 161 | 161 | MACHINE_DRIVER_END |
| 162 | 162 | |
| 163 | 163 | /* ROM definition */ |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | * Special thanks to leeeeee for helping figure out what the led selftest codes actually mean |
| 12 | 12 | * |
| 13 | 13 | * TODO: |
| 14 | * * DUART: | |
| 14 | * * DUART: | |
| 15 | 15 | * * DUART needs to be reset on reset line activation. as is it works ok, but it should be done anyway. |
| 16 | * * DUART needs its i/o pins connected as well: | |
| 16 | * * DUART needs its i/o pins connected as well: | |
| 17 | 17 | * * pins IP0, IP2, and IP3 are connected to the primary serial port: |
| 18 | 18 | * * IP0 is CTS |
| 19 | 19 | * * IP2 is DSR |
| r5932 | r5933 | |
| 595 | 595 | /* |
| 596 | 596 | Address maps (x = ignored; * = selects address within this range) |
| 597 | 597 | 68k address map: |
| 598 | 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) | |
| 599 | 0 x x x 0 x * * * * * * * * * * * * * * * * * * R ROM | |
| 600 | 0 x x x 1 x x 0 * * * * * * * * * * * * * * * * RW RAM (first 4 chip pairs) | |
| 601 | 0 x x x 1 x x 1 0 0 * * * * * * * * * * * * * * RW RAM (last chip pair) | |
| 602 | 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 <d7-d0> | |
| 603 | 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) | |
| 604 | 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) | |
| 605 | 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) | |
| 606 | 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] | |
| 607 | 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) | |
| 608 | 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] | |
| 609 | 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 | |
| 610 | | | | | | | |
| 598 | 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) | |
| 599 | 0 x x x 0 x * * * * * * * * * * * * * * * * * * R ROM | |
| 600 | 0 x x x 1 x x 0 * * * * * * * * * * * * * * * * RW RAM (first 4 chip pairs) | |
| 601 | 0 x x x 1 x x 1 0 0 * * * * * * * * * * * * * * RW RAM (last chip pair) | |
| 602 | 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 <d7-d0> | |
| 603 | 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) | |
| 604 | 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) | |
| 605 | 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) | |
| 606 | 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] | |
| 607 | 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) | |
| 608 | 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] | |
| 609 | 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 | |
| 610 | | | | | | | |
| 611 | 611 | */ |
| 612 | 612 | |
| 613 | 613 | static ADDRESS_MAP_START(m68k_mem, ADDRESS_SPACE_PROGRAM, 16) |
| r5932 | r5933 | |
| 786 | 786 | Drivers |
| 787 | 787 | ******************************************************************************/ |
| 788 | 788 | |
| 789 | /* YEAR | |
| 789 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 790 | 790 | COMP( 1984, dectalk, 0, 0, dectalk, dectalk, dectalk, 0, "DEC", "DECTalk DTC-01", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 314 | 314 | int i; |
| 315 | 315 | static const char *const keynames[2][8] = |
| 316 | 316 | { |
| 317 | { "JOY0", "JOY1", "JOY2", "JOY3", | |
| 317 | { "JOY0", "JOY1", "JOY2", "JOY3", | |
| 318 | 318 | "JOY4", "JOY5", "JOY6", "JOY7" }, |
| 319 | { "BUTTONS0", "BUTTONS1", "BUTTONS2", "BUTTONS3", | |
| 319 | { "BUTTONS0", "BUTTONS1", "BUTTONS2", "BUTTONS3", | |
| 320 | 320 | "BUTTONS4", "BUTTONS5", "BUTTONS6", "BUTTONS7" } |
| 321 | 321 | }; |
| 322 | 322 | |
| r5932 | r5933 | |
| 469 | 469 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 470 | 470 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 471 | 471 | PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 472 | ||
| 472 | ||
| 473 | 473 | PORT_START("JOY1") |
| 474 | 474 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1) PORT_PLAYER(1) |
| 475 | 475 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4) PORT_PLAYER(1) |
| r5932 | r5933 | |
| 554 | 554 | PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 555 | 555 | |
| 556 | 556 | PORT_START("CONFIG") |
| 557 | // PORT_CONFNAME( 0x02, 0x02, "Show Logo") | |
| 558 | // PORT_CONFSETTING( 0x00, "Yes") | |
| 559 | // PORT_CONFSETTING( 0x02, "No") | |
| 557 | // PORT_CONFNAME( 0x02, 0x02, "Show Logo") | |
| 558 | // PORT_CONFSETTING( 0x00, "Yes") | |
| 559 | // PORT_CONFSETTING( 0x02, "No") | |
| 560 | 560 | PORT_CONFNAME( 0x04, 0x04, "TV System") |
| 561 | 561 | PORT_CONFSETTING( 0x00, "PAL") |
| 562 | 562 | PORT_CONFSETTING( 0x04, "NTSC") |
| r5932 | r5933 | |
|---|---|---|
| 23 | 23 | { |
| 24 | 24 | /* |
| 25 | 25 | |
| 26 | ||
| 26 | bit description | |
| 27 | 27 | |
| 28 | 0 Y motor phase A | |
| 29 | 1 Y motor phase B | |
| 30 | 2 Y motor phase C | |
| 31 | 3 Y motor phase D | |
| 32 | 4 ROM A12 | |
| 33 | 5 ROM CE /PT5 CK | |
| 34 | 6 PT4 OE | |
| 35 | 7 SW & PE ENABLE | |
| 28 | 0 Y motor phase A | |
| 29 | 1 Y motor phase B | |
| 30 | 2 Y motor phase C | |
| 31 | 3 Y motor phase D | |
| 32 | 4 ROM A12 | |
| 33 | 5 ROM CE /PT5 CK | |
| 34 | 6 PT4 OE | |
| 35 | 7 SW & PE ENABLE | |
| 36 | 36 | |
| 37 | ||
| 37 | */ | |
| 38 | 38 | |
| 39 | 39 | comxpl80_state *state = space->machine->driver_data; |
| 40 | 40 | |
| r5932 | r5933 | |
| 54 | 54 | |
| 55 | 55 | state->plotter_data = memory_region(space->machine, "gfx2")[font_rom | state->font_addr]; |
| 56 | 56 | } |
| 57 | ||
| 57 | ||
| 58 | 58 | if (!BIT(data, 6)) |
| 59 | 59 | { |
| 60 | 60 | // read data from Centronics bus |
| r5932 | r5933 | |
| 72 | 72 | { |
| 73 | 73 | /* |
| 74 | 74 | |
| 75 | ||
| 75 | bit description | |
| 76 | 76 | |
| 77 | 0 Z motor phase A | |
| 78 | 1 Z motor phase B | |
| 79 | 2 Z motor phase C | |
| 80 | 3 Z motor phase D | |
| 81 | 4 ROM A8 | |
| 82 | 5 ROM A9 | |
| 83 | 6 ROM A10 | |
| 84 | 7 ROM A11 | |
| 77 | 0 Z motor phase A | |
| 78 | 1 Z motor phase B | |
| 79 | 2 Z motor phase C | |
| 80 | 3 Z motor phase D | |
| 81 | 4 ROM A8 | |
| 82 | 5 ROM A9 | |
| 83 | 6 ROM A10 | |
| 84 | 7 ROM A11 | |
| 85 | 85 | |
| 86 | ||
| 86 | */ | |
| 87 | 87 | |
| 88 | 88 | comxpl80_state *state = space->machine->driver_data; |
| 89 | 89 | |
| r5932 | r5933 | |
| 96 | 96 | { |
| 97 | 97 | /* |
| 98 | 98 | |
| 99 | ||
| 99 | bit description | |
| 100 | 100 | |
| 101 | 0 ROM A0 /X motor phase A | |
| 102 | 1 ROM A1 /X motor phase B | |
| 103 | 2 ROM A2 /X motor phase C | |
| 104 | 3 ROM A3 /X motor phase D | |
| 105 | 4 ROM A4 /ACK | |
| 106 | 5 ROM A5 /On-line LED | |
| 107 | 6 ROM A6 | |
| 108 | 7 ROM A7 | |
| 101 | 0 ROM A0 /X motor phase A | |
| 102 | 1 ROM A1 /X motor phase B | |
| 103 | 2 ROM A2 /X motor phase C | |
| 104 | 3 ROM A3 /X motor phase D | |
| 105 | 4 ROM A4 /ACK | |
| 106 | 5 ROM A5 /On-line LED | |
| 107 | 6 ROM A6 | |
| 108 | 7 ROM A7 | |
| 109 | 109 | |
| 110 | ||
| 110 | */ | |
| 111 | 111 | |
| 112 | 112 | comxpl80_state *state = space->machine->driver_data; |
| 113 | 113 | |
| r5932 | r5933 | |
| 123 | 123 | { |
| 124 | 124 | /* |
| 125 | 125 | |
| 126 | ||
| 126 | bit description | |
| 127 | 127 | |
| 128 | 0 D0 /ROM D0 /DOWN SW | |
| 129 | 1 D1 /ROM D1 /PEN-SEL SW | |
| 130 | 2 D2 /ROM D2 /UP SW | |
| 131 | 3 D3 /ROM D3 /CRSW | |
| 132 | 4 D4 /ROM D4 /ON LINE SW | |
| 133 | 5 D5 /ROM D5 /PE Sensor | |
| 134 | 6 D6 /ROM D6 /RIGHT SW | |
| 135 | 7 D7 /ROM D7 /LEFT SW | |
| 128 | 0 D0 /ROM D0 /DOWN SW | |
| 129 | 1 D1 /ROM D1 /PEN-SEL SW | |
| 130 | 2 D2 /ROM D2 /UP SW | |
| 131 | 3 D3 /ROM D3 /CRSW | |
| 132 | 4 D4 /ROM D4 /ON LINE SW | |
| 133 | 5 D5 /ROM D5 /PE Sensor | |
| 134 | 6 D6 /ROM D6 /RIGHT SW | |
| 135 | 7 D7 /ROM D7 /LEFT SW | |
| 136 | 136 | |
| 137 | ||
| 137 | */ | |
| 138 | 138 | |
| 139 | 139 | comxpl80_state *state = space->machine->driver_data; |
| 140 | 140 | |
| r5932 | r5933 | |
| 145 | 145 | |
| 146 | 146 | static ADDRESS_MAP_START( pl80_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 147 | 147 | ADDRESS_MAP_UNMAP_HIGH |
| 148 | /* AM_RANGE(0x000, 0x000) AM_READWRITE(cx005_port_a_r, cx005_port_a_w) | |
| 149 | AM_RANGE(0x001, 0x001) AM_READWRITE(cx005_port_b_r, cx005_port_b_w) | |
| 150 | AM_RANGE(0x002, 0x002) AM_READWRITE(cx005_port_c_r, cx005_port_c_w) | |
| 151 | AM_RANGE(0x003, 0x003) AM_READ(cx005_port_d_digital_r) | |
| 152 | AM_RANGE(0x004, 0x004) AM_WRITE(cx005_port_a_ddr_w) | |
| 153 | AM_RANGE(0x005, 0x005) AM_WRITE(cx005_port_b_ddr_w) | |
| 154 | AM_RANGE(0x006, 0x006) AM_WRITE(cx005_port_c_ddr_w) | |
| 155 | AM_RANGE(0x007, 0x007) AM_READ(cx005_port_d_analog_r) | |
| 156 | AM_RANGE(0x008, 0x008) AM_READWRITE(cx005_timer_data_r, cx005_timer_data_w) | |
| 157 | AM_RANGE(0x008, 0x008) AM_READWRITE(cx005_timer_ctrl_r, cx005_timer_ctrl_w)*/ | |
| 148 | /* AM_RANGE(0x000, 0x000) AM_READWRITE(cx005_port_a_r, cx005_port_a_w) | |
| 149 | AM_RANGE(0x001, 0x001) AM_READWRITE(cx005_port_b_r, cx005_port_b_w) | |
| 150 | AM_RANGE(0x002, 0x002) AM_READWRITE(cx005_port_c_r, cx005_port_c_w) | |
| 151 | AM_RANGE(0x003, 0x003) AM_READ(cx005_port_d_digital_r) | |
| 152 | AM_RANGE(0x004, 0x004) AM_WRITE(cx005_port_a_ddr_w) | |
| 153 | AM_RANGE(0x005, 0x005) AM_WRITE(cx005_port_b_ddr_w) | |
| 154 | AM_RANGE(0x006, 0x006) AM_WRITE(cx005_port_c_ddr_w) | |
| 155 | AM_RANGE(0x007, 0x007) AM_READ(cx005_port_d_analog_r) | |
| 156 | AM_RANGE(0x008, 0x008) AM_READWRITE(cx005_timer_data_r, cx005_timer_data_w) | |
| 157 | AM_RANGE(0x008, 0x008) AM_READWRITE(cx005_timer_ctrl_r, cx005_timer_ctrl_w)*/ | |
| 158 | 158 | AM_RANGE(0x00a, 0x01f) AM_NOP // Not Used |
| 159 | 159 | AM_RANGE(0x020, 0x07f) AM_RAM // Internal RAM |
| 160 | 160 | AM_RANGE(0x080, 0xf7f) AM_ROM // Internal ROM |
| r5932 | r5933 | |
| 215 | 215 | |
| 216 | 216 | /* System Drivers */ |
| 217 | 217 | |
| 218 | // YEAR NAME | |
| 218 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS | |
| 219 | 219 | COMP( 1987, comxpl80, 0, 0, comxpl80, comxpl80, 0, 0, "Comx World Operations Ltd", "COMX PL-80", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| r5932 | r5933 | |
|---|---|---|
| 36 | 36 | case 0x20 : retVal = 0x85; break; |
| 37 | 37 | case 0x40 : retVal = 0x86; break; |
| 38 | 38 | case 0x80 : retVal = 0x87; break; |
| 39 | default : retVal = 0; break; | |
| 39 | default : retVal = 0; break; | |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | if (line1!=0) { |
| r5932 | r5933 | |
| 60 | 60 | case 0x08 : retVal |= 0xC0; break; |
| 61 | 61 | case 0x10 : retVal |= 0xD0; break; |
| 62 | 62 | case 0x20 : retVal |= 0xF0; break; |
| 63 | default : break; | |
| 63 | default : break; | |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | if (retVal != prev_key) { |
| r5932 | r5933 | |
| 71 | 71 | if (count_key <1) { |
| 72 | 72 | count_key++; |
| 73 | 73 | return retVal; |
| 74 | } else { | |
| 74 | } else { | |
| 75 | 75 | return 0; |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | ||
| 78 | ||
| 79 | 79 | if (retVal == 0) { |
| 80 | 80 | prev_key = 0; |
| 81 | 81 | count_key = 0; |
| 82 | } | |
| 83 | ||
| 82 | } | |
| 83 | ||
| 84 | 84 | return retVal; |
| 85 | 85 | } |
| 86 | 86 | |
| r5932 | r5933 | |
| 91 | 91 | |
| 92 | 92 | static ADDRESS_MAP_START( bob85_io , ADDRESS_SPACE_IO, 8) |
| 93 | 93 | ADDRESS_MAP_UNMAP_HIGH |
| 94 | AM_RANGE ( 0x0A, 0x0A ) AM_READ(bob85_keyboard_r) | |
| 95 | AM_RANGE ( 0x0A, 0x0F ) AM_WRITE(bob85_7seg_w) | |
| 94 | AM_RANGE ( 0x0A, 0x0A ) AM_READ(bob85_keyboard_r) | |
| 95 | AM_RANGE ( 0x0A, 0x0F ) AM_WRITE(bob85_7seg_w) | |
| 96 | 96 | ADDRESS_MAP_END |
| 97 | 97 | |
| 98 | 98 | /* Input ports */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | DEC VT520 |
| 4 | 4 | |
| 5 | 5 | 02/07/2009 Skeleton driver. |
| r5932 | r5933 | |
| 14 | 14 | ADDRESS_MAP_END |
| 15 | 15 | |
| 16 | 16 | /* |
| 17 | On the boardthere is TC160G41AF (1222) custom chip | |
| 18 | doing probably all video/uart logic | |
| 19 | there is 43.430MHz xtal near by | |
| 17 | On the boardthere is TC160G41AF (1222) custom chip | |
| 18 | doing probably all video/uart logic | |
| 19 | there is 43.430MHz xtal near by | |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | static READ8_HANDLER(vt520_some_r) |
| r5932 | r5933 | |
| 36 | 36 | INPUT_PORTS_END |
| 37 | 37 | |
| 38 | 38 | |
| 39 | static MACHINE_RESET(vt520) | |
| 40 | { | |
| 39 | static MACHINE_RESET(vt520) | |
| 40 | { | |
| 41 | 41 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 42 | 42 | UINT8 *rom = memory_region(machine, "maincpu"); |
| 43 | 43 | memory_install_write8_handler(space, 0x0000, 0xffff, 0, 0, SMH_UNMAP); |
| r5932 | r5933 | |
| 57 | 57 | /* basic machine hardware */ |
| 58 | 58 | MDRV_CPU_ADD("maincpu",I8032, XTAL_20MHz) |
| 59 | 59 | MDRV_CPU_PROGRAM_MAP(vt520_mem) |
| 60 | MDRV_CPU_IO_MAP(vt520_io) | |
| 60 | MDRV_CPU_IO_MAP(vt520_io) | |
| 61 | 61 | |
| 62 | 62 | MDRV_MACHINE_RESET(vt520) |
| 63 | ||
| 63 | ||
| 64 | 64 | /* video hardware */ |
| 65 | 65 | MDRV_SCREEN_ADD("screen", RASTER) |
| 66 | 66 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 90 | 90 | /* Driver */ |
| 91 | 91 | |
| 92 | 92 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 93 | //COMP( 1993, vt510, 0, 0, | |
| 93 | //COMP( 1993, vt510, 0, 0, vt520, vt520, | |
| 94 | 94 | COMP( 1994, vt520, 0, 0, vt520, vt520, 0, vt520, "DEC", "VT520", GAME_NOT_WORKING) |
| 95 | //COMP( 1994, vt525, 0, 0, | |
| 95 | //COMP( 1994, vt525, 0, 0, vt520, vt520, |
| r5932 | r5933 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | 12 | |
| 13 | NEC PC-8401A-LS "Starlet" | |
| 14 | NEC PC-8500 "Studley" | |
| 13 | NEC PC-8401A-LS "Starlet" | |
| 14 | NEC PC-8500 "Studley" | |
| 15 | 15 | |
| 16 | ||
| 16 | TODO: | |
| 17 | 17 | |
| 18 | - keyboard interrupt | |
| 19 | - RTC TP pulse | |
| 20 | - disassembler for NEC uPD70008C (RST mnemonics are different from Z80) | |
| 21 | - clock does not advance in menu | |
| 22 | - mirror e800-ffff to 6800-7fff | |
| 23 | - soft power on/off | |
| 24 | - NVRAM | |
| 25 | - 8251 USART | |
| 26 | - 8255 ports | |
| 27 | - MC6845 palette | |
| 28 | - MC6845 chargen ROM | |
| 18 | - keyboard interrupt | |
| 19 | - RTC TP pulse | |
| 20 | - disassembler for NEC uPD70008C (RST mnemonics are different from Z80) | |
| 21 | - clock does not advance in menu | |
| 22 | - mirror e800-ffff to 6800-7fff | |
| 23 | - soft power on/off | |
| 24 | - NVRAM | |
| 25 | - 8251 USART | |
| 26 | - 8255 ports | |
| 27 | - MC6845 palette | |
| 28 | - MC6845 chargen ROM | |
| 29 | 29 | |
| 30 | - peripherals | |
| 31 | * PC-8431A Dual Floppy Drive | |
| 32 | * PC-8441A CRT / Disk Interface | |
| 33 | * PC-8461A 1200 Baud Modem | |
| 34 | * PC-8407A 128KB RAM Expansion | |
| 35 | * PC-8508A ROM/RAM Cartridge | |
| 30 | - peripherals | |
| 31 | * PC-8431A Dual Floppy Drive | |
| 32 | * PC-8441A CRT / Disk Interface | |
| 33 | * PC-8461A 1200 Baud Modem | |
| 34 | * PC-8407A 128KB RAM Expansion | |
| 35 | * PC-8508A ROM/RAM Cartridge | |
| 36 | 36 | |
| 37 | ||
| 37 | - Use the 600 baud save rate (PIP CAS2:=A:<filename.ext> this is more reliable than the 1200 baud (PIP CAS:=A:<filename.ext> rate. | |
| 38 | 38 | |
| 39 | 39 | */ |
| 40 | 40 | |
| r5932 | r5933 | |
| 175 | 175 | { |
| 176 | 176 | /* |
| 177 | 177 | |
| 178 | ||
| 178 | bit description | |
| 179 | 179 | |
| 180 | 0 ROM section bit 0 | |
| 181 | 1 ROM section bit 1 | |
| 182 | 2 mapping for CPU addresses 0000H to 7FFFH bit 0 | |
| 183 | 3 mapping for CPU addresses 0000H to 7FFFH bit 1 | |
| 184 | 4 mapping for CPU addresses 8000H to BFFFH bit 0 | |
| 185 | 5 mapping for CPU addresses 8000H to BFFFH bit 1 | |
| 186 | 6 mapping for CPU addresses C000H to E7FFH | |
| 187 | 7 | |
| 180 | 0 ROM section bit 0 | |
| 181 | 1 ROM section bit 1 | |
| 182 | 2 mapping for CPU addresses 0000H to 7FFFH bit 0 | |
| 183 | 3 mapping for CPU addresses 0000H to 7FFFH bit 1 | |
| 184 | 4 mapping for CPU addresses 8000H to BFFFH bit 0 | |
| 185 | 5 mapping for CPU addresses 8000H to BFFFH bit 1 | |
| 186 | 6 mapping for CPU addresses C000H to E7FFH | |
| 187 | 7 | |
| 188 | 188 | |
| 189 | ||
| 189 | */ | |
| 190 | 190 | |
| 191 | 191 | pc8401a_state *state = space->machine->driver_data; |
| 192 | 192 | |
| r5932 | r5933 | |
| 209 | 209 | { |
| 210 | 210 | /* |
| 211 | 211 | |
| 212 | ||
| 212 | bit description | |
| 213 | 213 | |
| 214 | 0 RTC TP? | |
| 215 | 1 RTC DATA OUT | |
| 216 | 2 ? | |
| 217 | 3 | |
| 218 | 4 | |
| 219 | 5 | |
| 220 | 6 | |
| 221 | 7 | |
| 214 | 0 RTC TP? | |
| 215 | 1 RTC DATA OUT | |
| 216 | 2 ? | |
| 217 | 3 | |
| 218 | 4 | |
| 219 | 5 | |
| 220 | 6 | |
| 221 | 7 | |
| 222 | 222 | |
| 223 | ||
| 223 | */ | |
| 224 | 224 | |
| 225 | 225 | pc8401a_state *state = space->machine->driver_data; |
| 226 | 226 | |
| r5932 | r5933 | |
| 231 | 231 | { |
| 232 | 232 | /* |
| 233 | 233 | |
| 234 | ||
| 234 | bit description | |
| 235 | 235 | |
| 236 | 0 RTC C0 | |
| 237 | 1 RTC C1 | |
| 238 | 2 RTC C2 | |
| 239 | 3 RTC DATA IN? | |
| 240 | 4 | |
| 241 | 5 | |
| 242 | 6 | |
| 243 | 7 | |
| 236 | 0 RTC C0 | |
| 237 | 1 RTC C1 | |
| 238 | 2 RTC C2 | |
| 239 | 3 RTC DATA IN? | |
| 240 | 4 | |
| 241 | 5 | |
| 242 | 6 | |
| 243 | 7 | |
| 244 | 244 | |
| 245 | ||
| 245 | */ | |
| 246 | 246 | |
| 247 | 247 | pc8401a_state *state = space->machine->driver_data; |
| 248 | 248 | |
| r5932 | r5933 | |
| 256 | 256 | { |
| 257 | 257 | /* |
| 258 | 258 | |
| 259 | ||
| 259 | bit description | |
| 260 | 260 | |
| 261 | 0 RTC OE or CS? | |
| 262 | 1 RTC STB | |
| 263 | 2 RTC CLK | |
| 264 | 3 | |
| 265 | 4 | |
| 266 | 5 | |
| 267 | 6 | |
| 268 | 7 | |
| 261 | 0 RTC OE or CS? | |
| 262 | 1 RTC STB | |
| 263 | 2 RTC CLK | |
| 264 | 3 | |
| 265 | 4 | |
| 266 | 5 | |
| 267 | 6 | |
| 268 | 7 | |
| 269 | 269 | |
| 270 | ||
| 270 | */ | |
| 271 | 271 | |
| 272 | 272 | pc8401a_state *state = space->machine->driver_data; |
| 273 | 273 | |
| r5932 | r5933 | |
| 315 | 315 | { |
| 316 | 316 | /* |
| 317 | 317 | |
| 318 | ||
| 318 | bit description | |
| 319 | 319 | |
| 320 | 0 key pressed | |
| 321 | 1 | |
| 322 | 2 | |
| 323 | 3 | |
| 324 | 4 must be 1 or CPU goes to HALT | |
| 325 | 5 | |
| 326 | 6 | |
| 327 | 7 | |
| 320 | 0 key pressed | |
| 321 | 1 | |
| 322 | 2 | |
| 323 | 3 | |
| 324 | 4 must be 1 or CPU goes to HALT | |
| 325 | 5 | |
| 326 | 6 | |
| 327 | 7 | |
| 328 | 328 | |
| 329 | ||
| 329 | */ | |
| 330 | 330 | |
| 331 | 331 | pc8401a_state *state = space->machine->driver_data; |
| 332 | 332 | |
| r5932 | r5933 | |
| 383 | 383 | AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(MSM8251_TAG, msm8251_data_r, msm8251_data_w) |
| 384 | 384 | AM_RANGE(0x21, 0x21) AM_DEVREADWRITE(MSM8251_TAG, msm8251_status_r, msm8251_control_w) |
| 385 | 385 | AM_RANGE(0x30, 0x30) AM_READWRITE(mmr_r, mmr_w) |
| 386 | // | |
| 386 | // AM_RANGE(0x31, 0x31) | |
| 387 | 387 | AM_RANGE(0x40, 0x40) AM_READWRITE(rtc_r, rtc_ctrl_w) |
| 388 | // AM_RANGE(0x41, 0x41) | |
| 389 | // AM_RANGE(0x50, 0x51) | |
| 388 | // AM_RANGE(0x41, 0x41) | |
| 389 | // AM_RANGE(0x50, 0x51) | |
| 390 | 390 | AM_RANGE(0x60, 0x60) AM_DEVREADWRITE(SED1330_TAG, sed1330_status_r, sed1330_data_w) |
| 391 | 391 | AM_RANGE(0x61, 0x61) AM_DEVREADWRITE(SED1330_TAG, sed1330_data_r, sed1330_command_w) |
| 392 | 392 | AM_RANGE(0x70, 0x70) AM_READWRITE(port70_r, port70_w) |
| 393 | 393 | AM_RANGE(0x71, 0x71) AM_READWRITE(port71_r, port71_w) |
| 394 | // AM_RANGE(0x80, 0x80) modem status, set to 0xff to boot | |
| 395 | // AM_RANGE(0x8b, 0x8b) | |
| 396 | // AM_RANGE(0x90, 0x93) | |
| 397 | // AM_RANGE(0xa0, 0xa1) | |
| 394 | // AM_RANGE(0x80, 0x80) modem status, set to 0xff to boot | |
| 395 | // AM_RANGE(0x8b, 0x8b) | |
| 396 | // AM_RANGE(0x90, 0x93) | |
| 397 | // AM_RANGE(0xa0, 0xa1) | |
| 398 | 398 | AM_RANGE(0x98, 0x98) AM_DEVWRITE(MC6845_TAG, mc6845_address_w) |
| 399 | 399 | AM_RANGE(0x99, 0x99) AM_DEVREADWRITE(MC6845_TAG, mc6845_register_r, mc6845_register_w) |
| 400 | 400 | AM_RANGE(0xb0, 0xb3) AM_WRITE(io_rom_addr_w) |
| 401 | 401 | AM_RANGE(0xb3, 0xb3) AM_READ(io_rom_data_r) |
| 402 | // | |
| 402 | // AM_RANGE(0xc8, 0xc8) | |
| 403 | 403 | AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE(I8255A_TAG, i8255a_r, i8255a_w) |
| 404 | 404 | ADDRESS_MAP_END |
| 405 | 405 | |
| r5932 | r5933 | |
| 435 | 435 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 436 | 436 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 437 | 437 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 438 | ||
| 438 | ||
| 439 | 439 | PORT_START("KEY3") |
| 440 | 440 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 441 | 441 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| r5932 | r5933 | |
| 471 | 471 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('*') |
| 472 | 472 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('*') |
| 473 | 473 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 474 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) // | |
| 474 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ? | |
| 475 | 475 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('*') |
| 476 | 476 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('*') |
| 477 | 477 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| r5932 | r5933 | |
| 555 | 555 | { |
| 556 | 556 | /* |
| 557 | 557 | |
| 558 | ||
| 558 | bit signal description | |
| 559 | 559 | |
| 560 | PC0 | |
| 561 | PC1 | |
| 562 | PC2 | |
| 563 | PC3 | |
| 564 | PC4 PC-8431A DAV data valid | |
| 565 | PC5 PC-8431A RFD ready for data | |
| 566 | PC6 PC-8431A DAC data accepted | |
| 567 | PC7 PC-8431A ATN attention | |
| 560 | PC0 | |
| 561 | PC1 | |
| 562 | PC2 | |
| 563 | PC3 | |
| 564 | PC4 PC-8431A DAV data valid | |
| 565 | PC5 PC-8431A RFD ready for data | |
| 566 | PC6 PC-8431A DAC data accepted | |
| 567 | PC7 PC-8431A ATN attention | |
| 568 | 568 | |
| 569 | ||
| 569 | */ | |
| 570 | 570 | |
| 571 | 571 | return 0; |
| 572 | 572 | } |
| r5932 | r5933 | |
| 575 | 575 | { |
| 576 | 576 | /* |
| 577 | 577 | |
| 578 | ||
| 578 | bit signal description | |
| 579 | 579 | |
| 580 | PC0 | |
| 581 | PC1 | |
| 582 | PC2 | |
| 583 | PC3 | |
| 584 | PC4 PC-8431A DAV data valid | |
| 585 | PC5 PC-8431A RFD ready for data | |
| 586 | PC6 PC-8431A DAC data accepted | |
| 587 | PC7 PC-8431A ATN attention | |
| 580 | PC0 | |
| 581 | PC1 | |
| 582 | PC2 | |
| 583 | PC3 | |
| 584 | PC4 PC-8431A DAV data valid | |
| 585 | PC5 PC-8431A RFD ready for data | |
| 586 | PC6 PC-8431A DAC data accepted | |
| 587 | PC7 PC-8431A ATN attention | |
| 588 | 588 | |
| 589 | ||
| 589 | */ | |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | static I8255A_INTERFACE( pc8401a_8255_interface ) |
| r5932 | r5933 | |
| 638 | 638 | MDRV_CPU_ADD(Z80_TAG, Z80, 4000000) // NEC uPD70008C |
| 639 | 639 | MDRV_CPU_PROGRAM_MAP(pc8401a_mem) |
| 640 | 640 | MDRV_CPU_IO_MAP(pc8401a_io) |
| 641 | ||
| 641 | ||
| 642 | 642 | MDRV_MACHINE_START(pc8401a) |
| 643 | 643 | |
| 644 | 644 | /* fake keyboard */ |
| r5932 | r5933 | |
| 673 | 673 | /* basic machine hardware */ |
| 674 | 674 | MDRV_CPU_MODIFY(Z80_TAG) |
| 675 | 675 | MDRV_CPU_IO_MAP(pc8500_io) |
| 676 | ||
| 676 | ||
| 677 | 677 | /* video hardware */ |
| 678 | 678 | MDRV_IMPORT_FROM(pc8500_video) |
| 679 | 679 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
| 717 | 717 | |
| 718 | 718 | /* System Drivers */ |
| 719 | 719 | |
| 720 | /* YEAR NAME | |
| 720 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 721 | 721 | COMP( 1984, pc8401a, 0, 0, pc8401a, pc8401a, 0, pc8401a, "NEC", "PC-8401A-LS", GAME_NOT_WORKING ) |
| 722 | 722 | /* |
| 723 | COMP( 1984, | |
| 723 | COMP( 1984, pc8401bd, pc8401a,0, pc8401a, pc8401a, 0, pc8401a, "NEC", "PC-8401BD", GAME_NOT_WORKING ) | |
| 724 | 724 | */ |
| 725 | 725 | COMP( 1985, pc8500, 0, 0, pc8500, pc8401a, 0, pc8500, "NEC", "PC-8500", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 43 | 43 | /* |
| 44 | 44 | static void apple3_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 45 | 45 | { |
| 46 | switch(state) | |
| 47 | { | |
| 48 | case MESS_DEVINFO_INT_COUNT: info->i = 4; break; | |
| 46 | switch(state) | |
| 47 | { | |
| 48 | case MESS_DEVINFO_INT_COUNT: info->i = 4; break; | |
| 49 | 49 | |
| 50 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVIDEND: info->i = 1; break; | |
| 51 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVISOR: info->i = 4; break; | |
| 50 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVIDEND: info->i = 1; break; | |
| 51 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVISOR: info->i = 4; break; | |
| 52 | 52 | |
| 53 | case MESS_DEVINFO_STR_NAME+0: strcpy(info->s = device_temp_str(), "slot6disk1"); break; | |
| 54 | case MESS_DEVINFO_STR_NAME+1: strcpy(info->s = device_temp_str(), "slot6disk2"); break; | |
| 55 | case MESS_DEVINFO_STR_SHORT_NAME+0: strcpy(info->s = device_temp_str(), "s6d1"); break; | |
| 56 | case MESS_DEVINFO_STR_SHORT_NAME+1: strcpy(info->s = device_temp_str(), "s6d2"); break; | |
| 57 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "Slot 6 Disk #1"); break; | |
| 58 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "Slot 6 Disk #2"); break; | |
| 53 | case MESS_DEVINFO_STR_NAME+0: strcpy(info->s = device_temp_str(), "slot6disk1"); break; | |
| 54 | case MESS_DEVINFO_STR_NAME+1: strcpy(info->s = device_temp_str(), "slot6disk2"); break; | |
| 55 | case MESS_DEVINFO_STR_SHORT_NAME+0: strcpy(info->s = device_temp_str(), "s6d1"); break; | |
| 56 | case MESS_DEVINFO_STR_SHORT_NAME+1: strcpy(info->s = device_temp_str(), "s6d2"); break; | |
| 57 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "Slot 6 Disk #1"); break; | |
| 58 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "Slot 6 Disk #2"); break; | |
| 59 | 59 | |
| 60 | default: apple525_device_getinfo(devclass, state, info); break; | |
| 61 | } | |
| 60 | default: apple525_device_getinfo(devclass, state, info); break; | |
| 61 | } | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | */ |
| r5932 | r5933 | |
|---|---|---|
| 46 | 46 | | | | | | | | | | |
| 47 | 47 | | | | | | | | | | |
| 48 | 48 | |
| 49 | ||
| 50 | 49 | |
| 50 | ||
| 51 | 51 | NTS information from http://web.archive.org/web/19980205154137/nts.dreamwriter.com/dreamwt4.html: |
| 52 | 52 | |
| 53 | 53 | File Management & Memory: |
| 54 | 54 | |
| 55 | · Uniquely name up to 128 files | |
| 56 | · Recall, rename or delete files | |
| 57 | · Copy files to and from PCMCIA Memory card | |
| 58 | · PCMCIA Memory expansion cards available for 60 or 250 pages of text | |
| 59 | · Working memory allows up to 20 pages of text (50KB) to be displayed | |
| 60 | · Storage memory allows up to 80 pages of text (128KB) in total | |
| 61 | · DreamLink software exports and imports documents in RTF retaining all | |
| 55 | ?? Uniquely name up to 128 files | |
| 56 | ?? Recall, rename or delete files | |
| 57 | ?? Copy files to and from PCMCIA Memory card | |
| 58 | ?? PCMCIA Memory expansion cards available for 60 or 250 pages of text | |
| 59 | ?? Working memory allows up to 20 pages of text (50KB) to be displayed | |
| 60 | ?? Storage memory allows up to 80 pages of text (128KB) in total | |
| 61 | ?? DreamLink software exports and imports documents in RTF retaining all | |
| 62 | 62 | formatting to Macintosh or Windows PC to all commonly used Word Processing programs |
| 63 | · Transfer cable provided compatible to both Macintosh and Windows PC's. | |
| 64 | · T400 is field upgradeable to IR with the optional Infrared module. | |
| 63 | ?? Transfer cable provided compatible to both Macintosh and Windows PC's. | |
| 64 | ?? T400 is field upgradeable to IR with the optional Infrared module. | |
| 65 | 65 | |
| 66 | 66 | Hardware: |
| 67 | 67 | |
| 68 | · LCD Screen displays 8 lines by 80 characters raised and tilted 30 degrees | |
| 69 | · Contrast Dial and feet adjust to user preference | |
| 70 | · Parallel and Serial ports( IR Upgrade Optional) for connectivity to printers, Macintosh and Windows PC's | |
| 71 | · Full size 64 key keyboard with color coded keys and quick reference menu bar | |
| 72 | · NiCad rechargeable batteries for up to 8 hours of continuous use prior to recharging | |
| 73 | · AC adapter for recharging batteries is lightweight and compact design | |
| 74 | · NEC V20HL 9.83 MHz processor for fast response time | |
| 75 | · Durable solid state construction weighing 2.2 lbs including battery pack | |
| 76 | · Dimensions approximately 11" wide by 8" long by 1" deep | |
| 77 | · FCC and CSA approved | |
| 68 | ?? LCD Screen displays 8 lines by 80 characters raised and tilted 30 degrees | |
| 69 | ?? Contrast Dial and feet adjust to user preference | |
| 70 | ?? Parallel and Serial ports( IR Upgrade Optional) for connectivity to printers, Macintosh and Windows PC's | |
| 71 | ?? Full size 64 key keyboard with color coded keys and quick reference menu bar | |
| 72 | ?? NiCad rechargeable batteries for up to 8 hours of continuous use prior to recharging | |
| 73 | ?? AC adapter for recharging batteries is lightweight and compact design | |
| 74 | ?? NEC V20HL 9.83 MHz processor for fast response time | |
| 75 | ?? Durable solid state construction weighing 2.2 lbs including battery pack | |
| 76 | ?? Dimensions approximately 11" wide by 8" long by 1" deep | |
| 77 | ?? FCC and CSA approved | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | I/O Map: |
| r5932 | r5933 | |
| 253 | 253 | else |
| 254 | 254 | { |
| 255 | 255 | cpu_set_input_line( state->cpu, 0, CLEAR_LINE ); |
| 256 | } | |
| 256 | } | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | TEC-1 driver, written by Robbbert in April, 2009 for MESS. | |
| 4 | 4 | |
| 5 | 5 | The TEC-1 was a single-board "computer" described in Talking Electronics |
| 6 | 6 | magazine, issues number 10 and 11. Talking Electronics do not have dates on |
| r5932 | r5933 | |
| 57 | 57 | |
| 58 | 58 | /*************************************************************************** |
| 59 | 59 | |
| 60 | ||
| 60 | Display | |
| 61 | 61 | |
| 62 | 62 | ***************************************************************************/ |
| 63 | 63 | |
| r5932 | r5933 | |
| 71 | 71 | |
| 72 | 72 | static WRITE8_HANDLER( tec1_segment_w ) |
| 73 | 73 | { |
| 74 | /* d7 segment d | |
| 75 | d6 segment e | |
| 76 | d5 segment c | |
| 77 | d4 segment dot | |
| 78 | d3 segment b | |
| 79 | d2 segment g | |
| 80 | d1 segment f | |
| 81 | d0 segment a */ | |
| 74 | /* d7 segment d | |
| 75 | d6 segment e | |
| 76 | d5 segment c | |
| 77 | d4 segment dot | |
| 78 | d3 segment b | |
| 79 | d2 segment g | |
| 80 | d1 segment f | |
| 81 | d0 segment a */ | |
| 82 | 82 | |
| 83 | 83 | tec1_segment = BITSWAP8(data, 4, 2, 1, 6, 7, 5, 3, 0); |
| 84 | 84 | if (tec1_digit) tec1_display(); |
| r5932 | r5933 | |
| 86 | 86 | |
| 87 | 87 | static WRITE8_HANDLER( tec1_digit_w ) |
| 88 | 88 | { |
| 89 | /* d7 speaker | |
| 90 | d6 not used | |
| 91 | d5 data digit 1 | |
| 92 | d4 data digit 2 | |
| 93 | d3 address digit 1 | |
| 94 | d2 address digit 2 | |
| 95 | d1 address digit 3 | |
| 96 | d0 address digit 4 */ | |
| 89 | /* d7 speaker | |
| 90 | d6 not used | |
| 91 | d5 data digit 1 | |
| 92 | d4 data digit 2 | |
| 93 | d3 address digit 1 | |
| 94 | d2 address digit 2 | |
| 95 | d1 address digit 3 | |
| 96 | d0 address digit 4 */ | |
| 97 | 97 | |
| 98 | 98 | speaker_level_w(tec1_speaker, (data & 0x80) ? 1 : 0); |
| 99 | 99 | |
| r5932 | r5933 | |
| 104 | 104 | |
| 105 | 105 | /*************************************************************************** |
| 106 | 106 | |
| 107 | ||
| 107 | Keyboard | |
| 108 | 108 | |
| 109 | 109 | ***************************************************************************/ |
| 110 | 110 | |
| r5932 | r5933 | |
| 113 | 113 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 114 | 114 | return tec1_kbd; |
| 115 | 115 | } |
| 116 | ||
| 116 | ||
| 117 | 117 | static UINT8 tec1_convert_col_to_bin( UINT8 col, UINT8 row ) |
| 118 | 118 | { |
| 119 | 119 | UINT8 data = row; |
| r5932 | r5933 | |
| 146 | 146 | /* if previous key is still held, bail out */ |
| 147 | 147 | if (input_port_read(machine, keynames[row])) |
| 148 | 148 | if (tec1_convert_col_to_bin(input_port_read(machine, keynames[row]), row) == tec1_kbd) |
| 149 | return; | |
| 150 | ||
| 149 | return; | |
| 150 | ||
| 151 | 151 | row++; |
| 152 | 152 | row &= 3; |
| 153 | 153 | |
| r5932 | r5933 | |
| 162 | 162 | |
| 163 | 163 | /*************************************************************************** |
| 164 | 164 | |
| 165 | ||
| 165 | Machine | |
| 166 | 166 | |
| 167 | 167 | ***************************************************************************/ |
| 168 | 168 | |
| r5932 | r5933 | |
| 176 | 176 | |
| 177 | 177 | /*************************************************************************** |
| 178 | 178 | |
| 179 | ||
| 179 | Address Map | |
| 180 | 180 | |
| 181 | 181 | ***************************************************************************/ |
| 182 | 182 | |
| r5932 | r5933 | |
| 196 | 196 | |
| 197 | 197 | /************************************************************************** |
| 198 | 198 | |
| 199 | ||
| 199 | Keyboard Layout | |
| 200 | 200 | |
| 201 | 201 | ***************************************************************************/ |
| 202 | 202 | |
| r5932 | r5933 | |
| 233 | 233 | |
| 234 | 234 | /*************************************************************************** |
| 235 | 235 | |
| 236 | ||
| 236 | Machine driver | |
| 237 | 237 | |
| 238 | 238 | ***************************************************************************/ |
| 239 | 239 | |
| r5932 | r5933 | |
| 257 | 257 | |
| 258 | 258 | /*************************************************************************** |
| 259 | 259 | |
| 260 | ||
| 260 | Game driver | |
| 261 | 261 | |
| 262 | 262 | ***************************************************************************/ |
| 263 | 263 | |
| 264 | 264 | ROM_START(tec1) |
| 265 | 265 | ROM_REGION(0x10000, "maincpu", 0) |
| 266 | 266 | ROM_LOAD("tec1.rom", 0x0000, 0x0800, CRC(b3390c36) SHA1(18aabc68d473206b7fc4e365c6b57a4e218482c3) ) |
| 267 | // ROM_SYSTEM_BIOS(0, "tec1", "TEC-1") | |
| 268 | // ROMX_LOAD("tec1.rom", 0x0000, 0x0800, CRC(b3390c36) SHA1(18aabc68d473206b7fc4e365c6b57a4e218482c3), ROM_BIOS(1)) | |
| 269 | // ROM_SYSTEM_BIOS(1, "tec1a", "TEC-1A") | |
| 270 | // ROMX_LOAD("tec1a.rom", 0x0000, 0x0800, CRC(60daea3c) SHA1(383b7e7f02e91fb18c87eb03c5949e31156771d4), ROM_BIOS(2)) | |
| 267 | // ROM_SYSTEM_BIOS(0, "tec1", "TEC-1") | |
| 268 | // ROMX_LOAD("tec1.rom", 0x0000, 0x0800, CRC(b3390c36) SHA1(18aabc68d473206b7fc4e365c6b57a4e218482c3), ROM_BIOS(1)) | |
| 269 | // ROM_SYSTEM_BIOS(1, "tec1a", "TEC-1A") | |
| 270 | // ROMX_LOAD("tec1a.rom", 0x0000, 0x0800, CRC(60daea3c) SHA1(383b7e7f02e91fb18c87eb03c5949e31156771d4), ROM_BIOS(2)) | |
| 271 | 271 | ROM_END |
| 272 | 272 | |
| 273 | /* YEAR NAME PARENT COMPAT MACHINE | |
| 273 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 274 | 274 | COMP( 1984, tec1, 0, 0, tec1, tec1, 0, 0, "Talking Electronics magazine", "TEC-1" , 0 ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | MMD-1 & MMD-2 driver by Miodrag Milanovic |
| 4 | ||
| 4 | ||
| 5 | 5 | 12/05/2009 Initial version |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| r5932 | r5933 | |
| 67 | 67 | if (BIT(line2,5)==0) return 13; |
| 68 | 68 | if (BIT(line2,6)==0) return 14; |
| 69 | 69 | if (BIT(line2,7)==0) return 15; |
| 70 | ||
| 70 | ||
| 71 | 71 | return 0xff; |
| 72 | 72 | } |
| 73 | 73 | |
| r5932 | r5933 | |
| 76 | 76 | AM_RANGE( 0x0000, 0x00ff ) AM_ROM // Main ROM |
| 77 | 77 | AM_RANGE( 0x0100, 0x01ff ) AM_ROM // Expansion slot |
| 78 | 78 | AM_RANGE( 0x0200, 0x02ff ) AM_RAM |
| 79 | AM_RANGE( 0x0300, 0x03ff ) AM_RAM | |
| 79 | AM_RANGE( 0x0300, 0x03ff ) AM_RAM | |
| 80 | 80 | ADDRESS_MAP_END |
| 81 | 81 | |
| 82 | 82 | static ADDRESS_MAP_START( mmd1_io , ADDRESS_SPACE_IO, 8) |
| r5932 | r5933 | |
| 93 | 93 | AM_RANGE( 0x0400, 0x07ff ) AM_RAM // WE1 |
| 94 | 94 | AM_RANGE( 0x0800, 0x0bff ) AM_RAM // WE2 |
| 95 | 95 | AM_RANGE( 0x0c00, 0x0fff ) AM_RAM // WE3 |
| 96 | ||
| 96 | ||
| 97 | 97 | AM_RANGE( 0xd800, 0xdfff ) AM_ROM // ROM label 330 |
| 98 | 98 | AM_RANGE( 0xe000, 0xe7ff ) AM_ROM // ROM label 340 |
| 99 | 99 | AM_RANGE( 0xe800, 0xefff ) AM_RAM // ROM label 350 |
| r5932 | r5933 | |
| 116 | 116 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 117 | 117 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 118 | 118 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 119 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 119 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) | |
| 120 | 120 | PORT_START("LINE2") |
| 121 | 121 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) |
| 122 | 122 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| r5932 | r5933 | |
| 125 | 125 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 126 | 126 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) |
| 127 | 127 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 128 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 128 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 129 | 129 | PORT_START("LINE3") |
| 130 | 130 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) |
| 131 | 131 | INPUT_PORTS_END |
| r5932 | r5933 | |
| 133 | 133 | |
| 134 | 134 | static INPUT_PORTS_START( mmd2 ) |
| 135 | 135 | /* |
| 136 | DIP switches: | |
| 137 | WE 0 - Write enable for addresses $0000..$03FF | |
| 138 | WE 1 - Write enable for addresses $0400..$07FF | |
| 139 | WE 2 - Write enable for addresses $0800..$0BFF | |
| 140 | WE 3 - Write enable for addresses $0C00..$0FFF | |
| 141 | SPARE - ??? | |
| 142 | HEX OCT - choose display and entry to be in Hexadecimal or Octal | |
| 143 | PUP RESET - ??? | |
| 136 | DIP switches: | |
| 137 | WE 0 - Write enable for addresses $0000..$03FF | |
| 138 | WE 1 - Write enable for addresses $0400..$07FF | |
| 139 | WE 2 - Write enable for addresses $0800..$0BFF | |
| 140 | WE 3 - Write enable for addresses $0C00..$0FFF | |
| 141 | SPARE - ??? | |
| 142 | HEX OCT - choose display and entry to be in Hexadecimal or Octal | |
| 143 | PUP RESET - ??? | |
| 144 | 144 | EXEC USER - update binary LED's with data entry? Or not? |
| 145 | (in either setting, outputs to ports 0,1,2 still show) | |
| 145 | (in either setting, outputs to ports 0,1,2 still show) | |
| 146 | 146 | |
| 147 | 147 | Keyboard |
| 148 | 0 1 2 3 PREV STORE NEXT STEP | |
| 149 | 4 5 6 7 HIGH LOW GO OPTION | |
| 150 | 8 9 A B LOAD DUMP PROM COPY | |
| 151 | C D E F MEM REGS AUX CANCEL | |
| 148 | 0 1 2 3 PREV STORE NEXT STEP | |
| 149 | 4 5 6 7 HIGH LOW GO OPTION | |
| 150 | 8 9 A B LOAD DUMP PROM COPY | |
| 151 | C D E F MEM REGS AUX CANCEL | |
| 152 | 152 | |
| 153 | 153 | */ |
| 154 | 154 | INPUT_PORTS_END |
| 155 | 155 | |
| 156 | static MACHINE_RESET(mmd1) | |
| 157 | { | |
| 156 | static MACHINE_RESET(mmd1) | |
| 157 | { | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | static MACHINE_RESET(mmd2) | |
| 161 | { | |
| 160 | static MACHINE_RESET(mmd2) | |
| 161 | { | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | static MACHINE_DRIVER_START( mmd1 ) |
| 165 | 165 | /* basic machine hardware */ |
| 166 | 166 | MDRV_CPU_ADD("maincpu",8080, 6750000 / 9) |
| 167 | 167 | MDRV_CPU_PROGRAM_MAP(mmd1_mem) |
| 168 | MDRV_CPU_IO_MAP(mmd1_io) | |
| 168 | MDRV_CPU_IO_MAP(mmd1_io) | |
| 169 | 169 | |
| 170 | 170 | MDRV_MACHINE_RESET(mmd1) |
| 171 | ||
| 171 | ||
| 172 | 172 | /* video hardware */ |
| 173 | 173 | MDRV_DEFAULT_LAYOUT(layout_mmd1) |
| 174 | 174 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
| 177 | 177 | /* basic machine hardware */ |
| 178 | 178 | MDRV_CPU_ADD("maincpu",8080, 6750000 / 9) |
| 179 | 179 | MDRV_CPU_PROGRAM_MAP(mmd2_mem) |
| 180 | MDRV_CPU_IO_MAP(mmd2_io) | |
| 180 | MDRV_CPU_IO_MAP(mmd2_io) | |
| 181 | 181 | |
| 182 | 182 | MDRV_MACHINE_RESET(mmd2) |
| 183 | ||
| 183 | ||
| 184 | 184 | /* video hardware */ |
| 185 | 185 | MDRV_DEFAULT_LAYOUT(layout_mmd2) |
| 186 | 186 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | http://ensjo.wikispaces.com/MC-1000+on+JEMU | |
| 8 | http://ensjo.blogspot.com/2006/11/color-artifacting-no-mc-1000.html | |
| 7 | http://ensjo.wikispaces.com/MC-1000+on+JEMU | |
| 8 | http://ensjo.blogspot.com/2006/11/color-artifacting-no-mc-1000.html | |
| 9 | 9 | |
| 10 | 10 | ****************************************************************************/ |
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | 13 | |
| 14 | ||
| 14 | TODO: | |
| 15 | 15 | |
| 16 | - xtal frequency? | |
| 17 | - Z80 wait at 0x0000-0x1fff when !hsync & !vsync | |
| 18 | - 80-column card (MC6845) character generator ROM | |
| 19 | - Charlemagne / GEM-1000 / Junior Computer ROMs | |
| 16 | - xtal frequency? | |
| 17 | - Z80 wait at 0x0000-0x1fff when !hsync & !vsync | |
| 18 | - 80-column card (MC6845) character generator ROM | |
| 19 | - Charlemagne / GEM-1000 / Junior Computer ROMs | |
| 20 | 20 | |
| 21 | 21 | */ |
| 22 | 22 | |
| r5932 | r5933 | |
| 108 | 108 | { |
| 109 | 109 | /* |
| 110 | 110 | |
| 111 | ||
| 111 | bit description | |
| 112 | 112 | |
| 113 | 0 enable CPU video RAM access | |
| 114 | 1 CSS | |
| 115 | 2 GM0 | |
| 116 | 3 GM1 | |
| 117 | 4 GM2 | |
| 118 | 5 _INT/EXT | |
| 119 | 6 _A/S | |
| 120 | 7 _A/G | |
| 113 | 0 enable CPU video RAM access | |
| 114 | 1 CSS | |
| 115 | 2 GM0 | |
| 116 | 3 GM1 | |
| 117 | 4 GM2 | |
| 118 | 5 _INT/EXT | |
| 119 | 6 _A/S | |
| 120 | 7 _A/G | |
| 121 | 121 | |
| 122 | ||
| 122 | */ | |
| 123 | 123 | |
| 124 | 124 | mc1000_state *state = space->machine->driver_data; |
| 125 | 125 | |
| r5932 | r5933 | |
| 151 | 151 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 152 | 152 | AM_RANGE(0x04, 0x04) AM_READWRITE(printer_r, printer_w) |
| 153 | 153 | AM_RANGE(0x05, 0x05) AM_DEVWRITE(CENTRONICS_TAG, centronics_data_w) |
| 154 | // AM_RANGE(0x10, 0x10) AM_DEVWRITE(MC6845_TAG, mc6845_address_w) | |
| 155 | // AM_RANGE(0x11, 0x11) AM_DEVREADWRITE(MC6845_TAG, mc6845_register_r, mc6845_register_w) | |
| 154 | // AM_RANGE(0x10, 0x10) AM_DEVWRITE(MC6845_TAG, mc6845_address_w) | |
| 155 | // AM_RANGE(0x11, 0x11) AM_DEVREADWRITE(MC6845_TAG, mc6845_register_r, mc6845_register_w) | |
| 156 | 156 | AM_RANGE(0x12, 0x12) AM_WRITE(mc6845_ctrl_w) |
| 157 | 157 | AM_RANGE(0x20, 0x20) AM_DEVWRITE(AY8910_TAG, ay8910_address_w) |
| 158 | 158 | AM_RANGE(0x40, 0x40) AM_DEVREAD(AY8910_TAG, ay8910_r) |
| r5932 | r5933 | |
| 489 | 489 | |
| 490 | 490 | /* System Drivers */ |
| 491 | 491 | |
| 492 | /* YEAR | |
| 492 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 493 | 493 | COMP( 1985, mc1000, 0, 0, mc1000, mc1000, mc1000, mc1000, "CCE", "MC-1000", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 656 | 656 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 657 | 657 | MDRV_SOUND_ADD("sn76489a", SN76489A, 3579545) /* 3.579545 MHz */ |
| 658 | 658 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 659 | ||
| 659 | ||
| 660 | 660 | /* cartridge */ |
| 661 | 661 | MDRV_CARTSLOT_ADD("cart") |
| 662 | 662 | MDRV_CARTSLOT_EXTENSION_LIST("rom,col,bin") |
| 663 | 663 | MDRV_CARTSLOT_NOT_MANDATORY |
| 664 | ||
| 665 | MDRV_FLOPPY_4_DRIVES_ADD(adam_floppy_config) | |
| 664 | ||
| 665 | MDRV_FLOPPY_4_DRIVES_ADD(adam_floppy_config) | |
| 666 | 666 | MACHINE_DRIVER_END |
| 667 | 667 | |
| 668 | 668 |
| r5932 | r5933 | |
|---|---|---|
| 15 | 15 | ADDRESS_MAP_UNMAP_HIGH |
| 16 | 16 | AM_RANGE(0x0000, 0x0bff) AM_ROM |
| 17 | 17 | AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_BASE(&mc8020_video_ram)// 1KB RAM ZRE |
| 18 | AM_RANGE(0x2000, 0x5fff) AM_ROM | |
| 18 | AM_RANGE(0x2000, 0x5fff) AM_ROM | |
| 19 | 19 | AM_RANGE(0x6000, 0xffff) AM_RAM |
| 20 | 20 | ADDRESS_MAP_END |
| 21 | 21 | |
| 22 | 22 | static ADDRESS_MAP_START( mc8020_io , ADDRESS_SPACE_IO, 8) |
| 23 | 23 | ADDRESS_MAP_UNMAP_HIGH |
| 24 | 24 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 25 | AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("z80ctc", z80ctc_r, z80ctc_w) | |
| 25 | AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("z80ctc", z80ctc_r, z80ctc_w) | |
| 26 | 26 | AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w) |
| 27 | 27 | ADDRESS_MAP_END |
| 28 | 28 | |
| 29 | 29 | static ADDRESS_MAP_START(mc8030_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 30 | 30 | ADDRESS_MAP_UNMAP_HIGH |
| 31 | // ZRE 4 * 2KB | |
| 31 | // ZRE 4 * 2KB | |
| 32 | 32 | AM_RANGE(0x0000, 0x1fff) AM_ROM // ZRE ROM's 4 * 2716 |
| 33 | 33 | AM_RANGE(0x2000, 0x27ff) AM_ROM // SPE ROM's 2 * 2708 |
| 34 | 34 | AM_RANGE(0x2800, 0x3fff) AM_ROM // For extension |
| r5932 | r5933 | |
| 59 | 59 | MDRV_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) |
| 60 | 60 | MDRV_CPU_PROGRAM_MAP(mc8020_mem) |
| 61 | 61 | MDRV_CPU_IO_MAP(mc8020_io) |
| 62 | ||
| 62 | ||
| 63 | 63 | MDRV_MACHINE_RESET(mc8020) |
| 64 | ||
| 64 | ||
| 65 | 65 | /* video hardware */ |
| 66 | 66 | MDRV_SCREEN_ADD("screen", RASTER) |
| 67 | 67 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 74 | 74 | |
| 75 | 75 | MDRV_VIDEO_START(mc8020) |
| 76 | 76 | MDRV_VIDEO_UPDATE(mc8020) |
| 77 | ||
| 78 | MDRV_Z80PIO_ADD( "z80pio", mc8020_z80pio_intf ) | |
| 79 | MDRV_Z80CTC_ADD( "z80ctc", XTAL_2_4576MHz / 100, mc8020_ctc_intf ) | |
| 77 | ||
| 78 | MDRV_Z80PIO_ADD( "z80pio", mc8020_z80pio_intf ) | |
| 79 | MDRV_Z80CTC_ADD( "z80ctc", XTAL_2_4576MHz / 100, mc8020_ctc_intf ) | |
| 80 | 80 | MACHINE_DRIVER_END |
| 81 | 81 | |
| 82 | 82 | static MACHINE_DRIVER_START( mc8030 ) |
| r5932 | r5933 | |
| 86 | 86 | MDRV_CPU_IO_MAP(mc8030_io) |
| 87 | 87 | |
| 88 | 88 | MDRV_MACHINE_RESET(mc8030) |
| 89 | ||
| 89 | ||
| 90 | 90 | /* video hardware */ |
| 91 | 91 | MDRV_SCREEN_ADD("screen", RASTER) |
| 92 | 92 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 99 | 99 | |
| 100 | 100 | MDRV_VIDEO_START(mc8030) |
| 101 | 101 | MDRV_VIDEO_UPDATE(mc8030) |
| 102 | ||
| 103 | MDRV_Z80PIO_ADD( "zve_pio", zve_z80pio_intf ) | |
| 102 | ||
| 103 | MDRV_Z80PIO_ADD( "zve_pio", zve_z80pio_intf ) | |
| 104 | 104 | MDRV_Z80CTC_ADD( "zve_ctc", XTAL_2_4576MHz, zve_z80ctc_intf ) |
| 105 | ||
| 106 | MDRV_Z80PIO_ADD( "asp_pio", asp_z80pio_intf ) | |
| 105 | ||
| 106 | MDRV_Z80PIO_ADD( "asp_pio", asp_z80pio_intf ) | |
| 107 | 107 | MDRV_Z80CTC_ADD( "asp_ctc", XTAL_2_4576MHz, asp_z80ctc_intf ) |
| 108 | MDRV_Z80SIO_ADD( "asp_sio", 4800, asp_z80sio_intf ) | |
| 108 | MDRV_Z80SIO_ADD( "asp_sio", 4800, asp_z80sio_intf ) | |
| 109 | 109 | MACHINE_DRIVER_END |
| 110 | 110 | |
| 111 | 111 | /* ROM definition */ |
| 112 | 112 | ROM_START( mc8020 ) |
| 113 | 113 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 114 | ROM_SYSTEM_BIOS(0, "ver1", "Version 1") | |
| 114 | ROM_SYSTEM_BIOS(0, "ver1", "Version 1") | |
| 115 | 115 | ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(1)) |
| 116 | ROMX_LOAD( "s02.rom", 0x0400, 0x0400, CRC(93b5811c) SHA1(8559d24072c9b5908a2627ff986d818308f51d59), ROM_BIOS(1)) | |
| 117 | ROMX_LOAD( "s03.rom", 0x0800, 0x0400, CRC(3d32c334) SHA1(56d3012595540d03054ad3c6795ed5d929581a04), ROM_BIOS(1)) | |
| 116 | ROMX_LOAD( "s02.rom", 0x0400, 0x0400, CRC(93b5811c) SHA1(8559d24072c9b5908a2627ff986d818308f51d59), ROM_BIOS(1)) | |
| 117 | ROMX_LOAD( "s03.rom", 0x0800, 0x0400, CRC(3d32c334) SHA1(56d3012595540d03054ad3c6795ed5d929581a04), ROM_BIOS(1)) | |
| 118 | 118 | ROMX_LOAD( "mo01_v2.rom", 0x2000, 0x0400, CRC(7e47201c) SHA1(db49afdc5c1fe4065a979c56cbdbd3c58f5d942f), ROM_BIOS(1)) |
| 119 | 119 | |
| 120 | ROM_SYSTEM_BIOS(1, "ver2", "Version 2") | |
| 120 | ROM_SYSTEM_BIOS(1, "ver2", "Version 2") | |
| 121 | 121 | ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(2)) |
| 122 | ROMX_LOAD( "s02_v2.rom", 0x0400, 0x0400, CRC(dd26c90a) SHA1(1108c11362fa63d21110a3b17868c1854a318c09), ROM_BIOS(2)) | |
| 123 | ROMX_LOAD( "s03_v2.rom", 0x0800, 0x0400, CRC(5b64ee7b) SHA1(3b4cbfcb8e2dedcfd4a3680c81fe6ceb2211b275), ROM_BIOS(2)) | |
| 122 | ROMX_LOAD( "s02_v2.rom", 0x0400, 0x0400, CRC(dd26c90a) SHA1(1108c11362fa63d21110a3b17868c1854a318c09), ROM_BIOS(2)) | |
| 123 | ROMX_LOAD( "s03_v2.rom", 0x0800, 0x0400, CRC(5b64ee7b) SHA1(3b4cbfcb8e2dedcfd4a3680c81fe6ceb2211b275), ROM_BIOS(2)) | |
| 124 | 124 | ROMX_LOAD( "mo01.rom", 0x2000, 0x0400, CRC(c65a470f) SHA1(71325fed1a342149b5efc2234ecfc8adfff0a42d), ROM_BIOS(2)) |
| 125 | 125 | |
| 126 | ROM_SYSTEM_BIOS(2, "ver3", "Version 3") | |
| 126 | ROM_SYSTEM_BIOS(2, "ver3", "Version 3") | |
| 127 | 127 | ROMX_LOAD( "s01.rom", 0x0000, 0x0400, CRC(0f1c1a62) SHA1(270c0a9e8e165658f3b09d40a3e8bb3dc1b88184), ROM_BIOS(3)) |
| 128 | ROMX_LOAD( "s02_v3.rom", 0x0400, 0x0400, CRC(40c7a694) SHA1(bcdf382e8dad9bb6e06d23ec018e9df55c8d8d0c), ROM_BIOS(3)) | |
| 129 | ROMX_LOAD( "s03.rom", 0x0800, 0x0400, CRC(3d32c334) SHA1(56d3012595540d03054ad3c6795ed5d929581a04), ROM_BIOS(3)) | |
| 130 | ROMX_LOAD( "mo01_v2.rom",0x2000, 0x0400, CRC(7e47201c) SHA1(db49afdc5c1fe4065a979c56cbdbd3c58f5d942f), ROM_BIOS(3)) | |
| 131 | ||
| 128 | ROMX_LOAD( "s02_v3.rom", 0x0400, 0x0400, CRC(40c7a694) SHA1(bcdf382e8dad9bb6e06d23ec018e9df55c8d8d0c), ROM_BIOS(3)) | |
| 129 | ROMX_LOAD( "s03.rom", 0x0800, 0x0400, CRC(3d32c334) SHA1(56d3012595540d03054ad3c6795ed5d929581a04), ROM_BIOS(3)) | |
| 130 | ROMX_LOAD( "mo01_v2.rom",0x2000, 0x0400, CRC(7e47201c) SHA1(db49afdc5c1fe4065a979c56cbdbd3c58f5d942f), ROM_BIOS(3)) | |
| 131 | ||
| 132 | 132 | // m02 doesn't exist on board |
| 133 | 133 | ROM_LOAD( "mo03.rom", 0x2800, 0x0400, CRC(29685056) SHA1(39e77658fb7af5a28112341f0893e007d73c1b7a)) |
| 134 | 134 | ROM_LOAD( "mo04.rom", 0x2c00, 0x0400, CRC(fd315b73) SHA1(cfb943ec8c884a9b92562d05f92faf06fe42ad68)) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | ACT Apricot series | |
| 4 | 4 | |
| 5 | ||
| 5 | 07/2009 Skeleton driver. | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5932 | r5933 | |
| 89 | 89 | |
| 90 | 90 | /* Driver */ |
| 91 | 91 | |
| 92 | /* | |
| 92 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 93 | 93 | COMP( 1984, aprixi, 0, 0, act, act, 0, 0, "ACT", "Apricot Xi", GAME_NOT_WORKING) |
| 94 | 94 | COMP( 1984, aprif1, 0, 0, act, act, 0, 0, "ACT", "Apricot F1", GAME_NOT_WORKING) |
| 95 | 95 | COMP( 1985, aprif10, 0, 0, act, act, 0, 0, "ACT", "Apricot F10", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 32 | 32 | F800-FFFF PCG RAM (graphics), Colour RAM (banked) |
| 33 | 33 | |
| 34 | 34 | Commands to call up built-in roms (depends on the model): |
| 35 | NET - Jump to E000, usually the Telcom communications program. | |
| 36 | This rom can be replaced with the Dreamdisk Chip-8 rom. | |
| 37 | Note that Telcom 3.21 is 8k, it uses a rombank switch | |
| 38 | (by reading port 0A) to swap between the two halves. | |
| 35 | NET - Jump to E000, usually the Telcom communications program. | |
| 36 | This rom can be replaced with the Dreamdisk Chip-8 rom. | |
| 37 | Note that Telcom 3.21 is 8k, it uses a rombank switch | |
| 38 | (by reading port 0A) to swap between the two halves. | |
| 39 | 39 | |
| 40 | EDASM - Jump to C000, usually the editor/Assembler package. | |
| 41 | Currently this works properly only on the Standard model, | |
| 42 | there appears to be some sort of core issue causing it to | |
| 43 | freeze on the other models. | |
| 40 | EDASM - Jump to C000, usually the editor/Assembler package. | |
| 41 | Currently this works properly only on the Standard model, | |
| 42 | there appears to be some sort of core issue causing it to | |
| 43 | freeze on the other models. | |
| 44 | 44 | |
| 45 | ||
| 45 | MENU - Do a rombank switch to bank 5 and jump to C000 to start the Shell | |
| 46 | 46 | |
| 47 | ||
| 47 | PAK n - Do a rombank switch (write to port 0A) to bank "n" and jump to C000. | |
| 48 | 48 | |
| 49 | 49 | These early colour computers have a PROM to create the foreground palette. |
| 50 | 50 | |
| 51 | TODO: | |
| 52 | - Printer is working, but with improper code. This needs to be fixed. | |
| 53 | - Other models to be added (64k, 128k, 256k, 512k, PPC85, Teleterm) | |
| 54 | - Roms for mbeepc to be checked (I think they are correct) | |
| 55 | - Diskette code to be checked and made working | |
| 51 | TODO: | |
| 52 | - Printer is working, but with improper code. This needs to be fixed. | |
| 53 | - Other models to be added (64k, 128k, 256k, 512k, PPC85, Teleterm) | |
| 54 | - Roms for mbeepc to be checked (I think they are correct) | |
| 55 | - Diskette code to be checked and made working | |
| 56 | 56 | |
| 57 | Notes about the printer: | |
| 58 | - When computer turned on, defaults to 1200 baud serial printer | |
| 59 | - Change it to parallel by entering OUTL#1 | |
| 60 | - After you mount/create a printfile, you can LPRINT and LLIST. | |
| 57 | Notes about the printer: | |
| 58 | - When computer turned on, defaults to 1200 baud serial printer | |
| 59 | - Change it to parallel by entering OUTL#1 | |
| 60 | - After you mount/create a printfile, you can LPRINT and LLIST. | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | ***************************************************************************/ |
| r5932 | r5933 | |
| 73 | 73 | size_t mbee_size; |
| 74 | 74 | |
| 75 | 75 | /********** NOTE !!! *********************************************************** |
| 76 | The microbee uses lots of bankswitching and the memory maps are still | |
| 77 | being determined. Please don't merge memory maps !! | |
| 76 | The microbee uses lots of bankswitching and the memory maps are still | |
| 77 | being determined. Please don't merge memory maps !! | |
| 78 | 78 | ********************************************************************************/ |
| 79 | 79 | |
| 80 | 80 | |
| r5932 | r5933 | |
| 320 | 320 | PORT_CONFSETTING( 0x00, DEF_STR(No)) |
| 321 | 321 | PORT_CONFSETTING( 0x01, DEF_STR(Yes)) |
| 322 | 322 | PORT_BIT( 0x6, 0x6, IPT_UNUSED ) |
| 323 | // PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") | |
| 324 | // PORT_CONFSETTING( 0x08, DEF_STR(On)) | |
| 325 | // PORT_CONFSETTING( 0x00, DEF_STR(Off)) | |
| 323 | // PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") | |
| 324 | // PORT_CONFSETTING( 0x08, DEF_STR(On)) | |
| 325 | // PORT_CONFSETTING( 0x00, DEF_STR(Off)) | |
| 326 | 326 | INPUT_PORTS_END |
| 327 | 327 | |
| 328 | 328 | static const z80_daisy_chain mbee_daisy_chain[] = |
| r5932 | r5933 | |
| 355 | 355 | TRACKS([84]) |
| 356 | 356 | SECTORS([10]) |
| 357 | 357 | SECTOR_LENGTH([512]) |
| 358 | FIRST_SECTOR_ID([1])) | |
| 358 | FIRST_SECTOR_ID([1])) | |
| 359 | 359 | FLOPPY_OPTIONS_END |
| 360 | 360 | |
| 361 | 361 | static const floppy_config mbee_floppy_config = |
| r5932 | r5933 | |
| 584 | 584 | ROM_LOAD_OPTIONAL("edasmb.ic33", 0xd000, 0x1000, CRC(a23bf3c8) SHA1(73a57c2800a1c744b527d0440b170b8b03351753) ) |
| 585 | 585 | ROM_LOAD_OPTIONAL("telcom10.rom", 0xe000, 0x1000, CRC(cc9ac94d) SHA1(6804b5ff54d16f8e06180751d8681c44f351e0bb) ) |
| 586 | 586 | |
| 587 | /* Optional Dreamcards Chip-8 V2.2 rom, take out the Telcom rom and insert this in its place | |
| 588 | ROM_LOAD_OPTIONAL("chip8_22.rom", 0xe000, 0x1000, CRC(11fbb547) SHA1(7bd9dc4b67b33b8e1be99beb6a0ddff25bdbd3f7) ) */ | |
| 587 | /* Optional Dreamcards Chip-8 V2.2 rom, take out the Telcom rom and insert this in its place | |
| 588 | ROM_LOAD_OPTIONAL("chip8_22.rom", 0xe000, 0x1000, CRC(11fbb547) SHA1(7bd9dc4b67b33b8e1be99beb6a0ddff25bdbd3f7) ) */ | |
| 589 | 589 | |
| 590 | 590 | ROM_LOAD("charrom.ic13", 0x11000, 0x0800, CRC(b149737b) SHA1(a3cd4f5d0d3c71137cd1f0f650db83333a2e3597) ) |
| 591 | 591 | ROM_RELOAD( 0x17000, 0x0800 ) |
| r5932 | r5933 | |
| 602 | 602 | ROM_LOAD("charrom.bin", 0x11000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) ) |
| 603 | 603 | ROM_RELOAD( 0x17000, 0x1000 ) |
| 604 | 604 | |
| 605 | /* Telcom v1.1 was shipped with the first version of the IC model | |
| 606 | ROM_LOAD_OPTIONAL("telcom11.rom", 0xe000, 0x1000, CRC(15516499) SHA1(2d4953f994b66c5d3b1d457b8c92d9a0a69eb8b8) ) */ | |
| 605 | /* Telcom v1.1 was shipped with the first version of the IC model | |
| 606 | ROM_LOAD_OPTIONAL("telcom11.rom", 0xe000, 0x1000, CRC(15516499) SHA1(2d4953f994b66c5d3b1d457b8c92d9a0a69eb8b8) ) */ | |
| 607 | 607 | ROM_LOAD_OPTIONAL("telcom12.rom", 0xe000, 0x1000, CRC(0231bda3) SHA1(be7b32499034f985cc8f7865f2bc2b78c485585c) ) |
| 608 | 608 | |
| 609 | 609 | /* PAK option roms */ |
| r5932 | r5933 | |
| 707 | 707 | |
| 708 | 708 | ***************************************************************************/ |
| 709 | 709 | |
| 710 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY | |
| 710 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 711 | 711 | COMP( 1982, mbee, 0, 0, mbee, mbee, mbee, 0, "Applied Technology", "Microbee 16 Standard" , 0) |
| 712 | 712 | COMP( 1982, mbeeic, mbee, 0, mbeeic, mbee, mbeeic, 0, "Applied Technology", "Microbee 32 IC" , 0) |
| 713 | 713 | COMP( 1982, mbeepc, mbee, 0, mbeepc, mbee, mbeepc, 0, "Applied Technology", "Microbee 32 Personal Communicator" , 0) |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | Nate Woods (current maintainer) |
| 9 | 9 | Tim Lindner (VHD and other work) |
| 10 | 10 | |
| 11 | ||
| 11 | Version information: | |
| 12 | 12 | |
| 13 | Basic Extended Basic Disk Extended | |
| 14 | coco 1.0 - - | |
| 15 | cocoe 1.1 1.0 1.0 | |
| 16 | coco2 1.2 1.1 1.1 | |
| 17 | coco2b 1.3 1.1 1.1 | |
| 18 | coco3 1.2 2.0 1.1 | |
| 19 | coco3p 1.2 2.0 1.1 | |
| 20 | coco3h 1.2 2.0 1.1 | |
| 13 | Basic Extended Basic Disk Extended | |
| 14 | coco 1.0 - - | |
| 15 | cocoe 1.1 1.0 1.0 | |
| 16 | coco2 1.2 1.1 1.1 | |
| 17 | coco2b 1.3 1.1 1.1 | |
| 18 | coco3 1.2 2.0 1.1 | |
| 19 | coco3p 1.2 2.0 1.1 | |
| 20 | coco3h 1.2 2.0 1.1 | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | |
| r5932 | r5933 | |
| 542 | 542 | PORT_CONFSETTING( 0x01, "Cloud-9" ) |
| 543 | 543 | |
| 544 | 544 | /* Port Condition is used because you can plug Hi-Res joystick, |
| 545 | ||
| 545 | Rat Mouse and Lightgun in either ports, but not both */ | |
| 546 | 546 | /* Fix me: should Rat Mouse and Diecom Light Gun be available also for coco & coco2? */ |
| 547 | 547 | PORT_START("ctrl_sel") /* Select Controller Type */ |
| 548 | 548 | PORT_CATEGORY_CLASS( 0x0f, 0x01, "Right Controller Port (P1)") PORT_CHANGED( coco_joystick_mode_changed, 0 ) |
| r5932 | r5933 | |
| 661 | 661 | PORT_CONFSETTING( 0x01, "Cloud-9" ) |
| 662 | 662 | |
| 663 | 663 | /* Port Condition is used because you can plug Hi-Res joystick, |
| 664 | ||
| 664 | Rat Mouse and Lightgun in either ports, but not both */ | |
| 665 | 665 | /* Fix me: should Rat Mouse and Diecom Light Gun be available also for coco & coco2? */ |
| 666 | 666 | PORT_START("ctrl_sel") /* Select Controller Type */ |
| 667 | 667 | PORT_CATEGORY_CLASS( 0x0f, 0x01, "Right Controller Port (P1)") PORT_CHANGED( coco_joystick_mode_changed, 0 ) |
| r5932 | r5933 | |
|---|---|---|
| 148 | 148 | |
| 149 | 149 | Known Issues (MZ, 2009-04-26) |
| 150 | 150 | - Extended Basic II does not start when a floppy controller is present |
| 151 | - Multiple cartridges are not shown in the startup screen; only one | |
| 151 | - Multiple cartridges are not shown in the startup screen; only one | |
| 152 | 152 | cartridge is presented. The slots are scanned, though. Need to check whether |
| 153 | 153 | this is a bug of the operating system or of the emulation. |
| 154 | 154 | - Emulation speed must be checked. I have inserted adjust_icounts, but I need to |
| 155 | 155 | check whether the console experienced those delays actually. Unfortunately, |
| 156 | 156 | there is almost no real hardware available. |
| 157 | 157 | - Extended Basic II gets stuck with OLD MINIMEM. MiniMemory may be incompatible |
| 158 | due to the different memory layout. SAVE/OLD only works if the machine is | |
| 158 | due to the different memory layout. SAVE/OLD only works if the machine is | |
| 159 | 159 | neither reset nor restarted. |
| 160 | 160 | */ |
| 161 | 161 | |
| r5932 | r5933 | |
| 199 | 199 | */ |
| 200 | 200 | |
| 201 | 201 | static ADDRESS_MAP_START(ti99_8_cru_map, ADDRESS_SPACE_IO, 8) |
| 202 | // | |
| 202 | // AM_RANGE(0x0000, 0x00ff) AM_DEVREAD("tms9901", tms9901_cru_r) | |
| 203 | 203 | AM_RANGE(0x0000, 0x007f) AM_DEVREAD("tms9901", tms9901_cru_r) |
| 204 | 204 | AM_RANGE(0x0080, 0x00ff) AM_DEVREAD("ti99_multicart", ti99_multicart_cru_r) /* SuperSpace cartridge */ |
| 205 | 205 | AM_RANGE(0x0100, 0x02ff) AM_READ(ti99_8_peb_cru_r) |
| r5932 | r5933 | |
| 422 | 422 | |
| 423 | 423 | static const mm58274c_interface floppy_mm58274c_interface = |
| 424 | 424 | { |
| 425 | 1, /* | |
| 425 | 1, /* mode 24*/ | |
| 426 | 426 | 0 /* first day of week */ |
| 427 | 427 | }; |
| 428 | 428 | |
| r5932 | r5933 | |
| 471 | 471 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 472 | 472 | |
| 473 | 473 | /* rtc */ |
| 474 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 475 | ||
| 474 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 475 | ||
| 476 | 476 | /* tms9901 */ |
| 477 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_8) | |
| 477 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_8) | |
| 478 | 478 | |
| 479 | 479 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) |
| 480 | ||
| 481 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_8_floppy_config) | |
| 482 | ||
| 480 | ||
| 481 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_8_floppy_config) | |
| 482 | ||
| 483 | 483 | MDRV_TI99_CARTRIDGE_ADD("ti99_multicart") |
| 484 | 484 | MDRV_SMARTMEDIA_ADD("smartmedia") |
| 485 | 485 | MDRV_TI99_4_RS232_CARD_ADD("rs232") |
| r5932 | r5933 | |
| 524 | 524 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 525 | 525 | |
| 526 | 526 | /* rtc */ |
| 527 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 528 | ||
| 527 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 528 | ||
| 529 | 529 | /* tms9901 */ |
| 530 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_8) | |
| 530 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_8) | |
| 531 | 531 | |
| 532 | 532 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) |
| 533 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_8_floppy_config) | |
| 533 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_8_floppy_config) | |
| 534 | 534 | |
| 535 | 535 | MDRV_TI99_CARTRIDGE_ADD("ti99_multicart") |
| 536 | 536 | MDRV_SMARTMEDIA_ADD("smartmedia") |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /************************************************************************************************ |
| 2 | 2 | |
| 3 | ||
| 3 | Sharp X1 (c) 1983 Sharp Corporation | |
| 4 | 4 | |
| 5 | ||
| 5 | driver by Angelo Salese & Barry Rodewald | |
| 6 | 6 | |
| 7 | TODO: | |
| 8 | - Understand how keyboard works and decap/dump the keyboard MCU if possible; | |
| 9 | - Hook-up .tap image formats (.rom too?); | |
| 10 | - Implement tape commands; | |
| 11 | - Sort out / redump the BIOS gfx roms; | |
| 12 | - Implement the interrupts (uses IM 2), basically used by the keyboard. | |
| 13 | - Implement DMA,CTC and SIO, they are X1Turbo only features. | |
| 14 | - Improve the z80DMA core, it's so incomplete that nothing that uses it works; | |
| 15 | - clean-ups! | |
| 16 | - x1turbo: understand how irq generation works for the ym-2151; | |
| 17 | - There are various unclear video things, these are: | |
| 18 | - Understand why some games still doesn't upload the proper PCG index; | |
| 19 | - Implement PCG reading, used by Maison Ikkoku, Mule and Gyajiko for kanji reading. | |
| 20 | Is there a way to select which ROM to use? | |
| 21 | - Implement the scrn regs; | |
| 22 | - Interlace mode? | |
| 23 | - Implement the new features of the x1turbo, namely the 4096 color feature amongst other | |
| 24 | things | |
| 25 | - (anything else?) | |
| 7 | TODO: | |
| 8 | - Understand how keyboard works and decap/dump the keyboard MCU if possible; | |
| 9 | - Hook-up .tap image formats (.rom too?); | |
| 10 | - Implement tape commands; | |
| 11 | - Sort out / redump the BIOS gfx roms; | |
| 12 | - Implement the interrupts (uses IM 2), basically used by the keyboard. | |
| 13 | - Implement DMA,CTC and SIO, they are X1Turbo only features. | |
| 14 | - Improve the z80DMA core, it's so incomplete that nothing that uses it works; | |
| 15 | - clean-ups! | |
| 16 | - x1turbo: understand how irq generation works for the ym-2151; | |
| 17 | - There are various unclear video things, these are: | |
| 18 | - Understand why some games still doesn't upload the proper PCG index; | |
| 19 | - Implement PCG reading, used by Maison Ikkoku, Mule and Gyajiko for kanji reading. | |
| 20 | Is there a way to select which ROM to use? | |
| 21 | - Implement the scrn regs; | |
| 22 | - Interlace mode? | |
| 23 | - Implement the new features of the x1turbo, namely the 4096 color feature amongst other | |
| 24 | things | |
| 25 | - (anything else?) | |
| 26 | 26 | |
| 27 | per-game specific TODO: | |
| 28 | - Bosconian: title screen background is completely white because it reverts the pen used | |
| 29 | (it's gray in the Arcade version),could be either flickering for pseudo-alpha effect or it's | |
| 30 | a btanb; | |
| 31 | - Mappy/Gradius: they sets 320x200 with fps = 30 Hz, due of that they are too slow (they must run at 60 Hz), | |
| 32 | HW limitation/MC6845 bug? | |
| 33 | - Exoa II - Warroid: major tile width/height positioning bugs (especially during gameplay); | |
| 27 | per-game specific TODO: | |
| 28 | - Bosconian: title screen background is completely white because it reverts the pen used | |
| 29 | (it's gray in the Arcade version),could be either flickering for pseudo-alpha effect or it's | |
| 30 | a btanb; | |
| 31 | - Mappy/Gradius: they sets 320x200 with fps = 30 Hz, due of that they are too slow (they must run at 60 Hz), | |
| 32 | HW limitation/MC6845 bug? | |
| 33 | - Exoa II - Warroid: major tile width/height positioning bugs (especially during gameplay); | |
| 34 | 34 | |
| 35 | Notes: | |
| 36 | - An interesting feature of the Sharp X-1 is the extended i/o bank. When the ppi port c bit 5 | |
| 37 | does a 1->0 transition, any write to the i/o space accesses 2 or 3 banks gradients of the bitmap RAM | |
| 38 | with a single write (generally used for layer clearances and bitmap-style sprites). | |
| 39 | Any i/o read disables this extended bitmap ram. | |
| 35 | Notes: | |
| 36 | - An interesting feature of the Sharp X-1 is the extended i/o bank. When the ppi port c bit 5 | |
| 37 | does a 1->0 transition, any write to the i/o space accesses 2 or 3 banks gradients of the bitmap RAM | |
| 38 | with a single write (generally used for layer clearances and bitmap-style sprites). | |
| 39 | Any i/o read disables this extended bitmap ram. | |
| 40 | 40 | |
| 41 | 41 | ================================================================================================= |
| 42 | 42 | |
| 43 | X1 (CZ-800C) - November, 1982 | |
| 44 | * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) | |
| 45 | * ROM: IPL (4KB) + chargen (2KB) | |
| 46 | * RAM: Main memory (64KB) + VRAM (4KB) + RAM for PCG (6KB) + GRAM (48KB, Option) | |
| 47 | * Text Mode: 80x25 or 40x25 | |
| 48 | * Graphic Mode: 640x200 or 320x200, 8 colors | |
| 49 | * Sound: PSG 8 octave | |
| 50 | * I/O Ports: Centronic ports, 2 Joystick ports, Cassette port (2700 baud) | |
| 43 | X1 (CZ-800C) - November, 1982 | |
| 44 | * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) | |
| 45 | * ROM: IPL (4KB) + chargen (2KB) | |
| 46 | * RAM: Main memory (64KB) + VRAM (4KB) + RAM for PCG (6KB) + GRAM (48KB, Option) | |
| 47 | * Text Mode: 80x25 or 40x25 | |
| 48 | * Graphic Mode: 640x200 or 320x200, 8 colors | |
| 49 | * Sound: PSG 8 octave | |
| 50 | * I/O Ports: Centronic ports, 2 Joystick ports, Cassette port (2700 baud) | |
| 51 | 51 | |
| 52 | X1C (CZ-801C) - October, 1983 | |
| 53 | * same but only 48KB GRAM | |
| 52 | X1C (CZ-801C) - October, 1983 | |
| 53 | * same but only 48KB GRAM | |
| 54 | 54 | |
| 55 | X1D (CZ-802C) - October, 1983 | |
| 56 | * same as X1C but with a 3" floppy drive (notice: 3" not 3" 1/2!!) | |
| 55 | X1D (CZ-802C) - October, 1983 | |
| 56 | * same as X1C but with a 3" floppy drive (notice: 3" not 3" 1/2!!) | |
| 57 | 57 | |
| 58 | X1Cs (CZ-803C) - June, 1984 | |
| 59 | * two expansion I/O ports | |
| 58 | X1Cs (CZ-803C) - June, 1984 | |
| 59 | * two expansion I/O ports | |
| 60 | 60 | |
| 61 | X1Ck (CZ-804C) - June, 1984 | |
| 62 | * same as X1Cs | |
| 63 | * ROM: IPL (4KB) + chargen (2KB) + Kanji 1st level | |
| 61 | X1Ck (CZ-804C) - June, 1984 | |
| 62 | * same as X1Cs | |
| 63 | * ROM: IPL (4KB) + chargen (2KB) + Kanji 1st level | |
| 64 | 64 | |
| 65 | X1F Model 10 (CZ-811C) - July, 1985 | |
| 66 | * Re-designed | |
| 67 | * ROM: IPL (4KB) + chargen (2KB) | |
| 65 | X1F Model 10 (CZ-811C) - July, 1985 | |
| 66 | * Re-designed | |
| 67 | * ROM: IPL (4KB) + chargen (2KB) | |
| 68 | 68 | |
| 69 | X1F Model 20 (CZ-812C) - July, 1985 | |
| 70 | * Re-designed (same as Model 10) | |
| 71 | * ROM: IPL (4KB) + chargen (2KB) + Kanji | |
| 72 | * Built Tape drive plus a 5" floppy drive was available | |
| 69 | X1F Model 20 (CZ-812C) - July, 1985 | |
| 70 | * Re-designed (same as Model 10) | |
| 71 | * ROM: IPL (4KB) + chargen (2KB) + Kanji | |
| 72 | * Built Tape drive plus a 5" floppy drive was available | |
| 73 | 73 | |
| 74 | X1G Model 10 (CZ-820C) - July, 1986 | |
| 75 | * Re-designed again | |
| 76 | * ROM: IPL (4KB) + chargen (2KB) | |
| 74 | X1G Model 10 (CZ-820C) - July, 1986 | |
| 75 | * Re-designed again | |
| 76 | * ROM: IPL (4KB) + chargen (2KB) | |
| 77 | 77 | |
| 78 | X1G Model 30 (CZ-822C) - July, 1986 | |
| 79 | * Re-designed again (same as Model 10) | |
| 80 | * ROM: IPL (4KB) + chargen (2KB) + Kanji | |
| 81 | * Built Tape drive plus a 5" floppy drive was available | |
| 78 | X1G Model 30 (CZ-822C) - July, 1986 | |
| 79 | * Re-designed again (same as Model 10) | |
| 80 | * ROM: IPL (4KB) + chargen (2KB) + Kanji | |
| 81 | * Built Tape drive plus a 5" floppy drive was available | |
| 82 | 82 | |
| 83 | X1twin (CZ-830C) - December, 1986 | |
| 84 | * Re-designed again (same as Model 10) | |
| 85 | * ROM: IPL (4KB) + chargen (2KB) + Kanji | |
| 86 | * Built Tape drive plus a 5" floppy drive was available | |
| 87 | * It contains a PC-Engine | |
| 83 | X1twin (CZ-830C) - December, 1986 | |
| 84 | * Re-designed again (same as Model 10) | |
| 85 | * ROM: IPL (4KB) + chargen (2KB) + Kanji | |
| 86 | * Built Tape drive plus a 5" floppy drive was available | |
| 87 | * It contains a PC-Engine | |
| 88 | 88 | |
| 89 | ||
| 89 | ============= X1 Turbo series ============= | |
| 90 | 90 | |
| 91 | X1turbo Model 30 (CZ-852C) - October, 1984 | |
| 92 | * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) | |
| 93 | * ROM: IPL (32KB) + chargen (8KB) + Kanji (128KB) | |
| 94 | * RAM: Main memory (64KB) + VRAM (6KB) + RAM for PCG (6KB) + GRAM (96KB) | |
| 95 | * Text Mode: 80xCh or 40xCh with Ch = 10, 12, 20, 25 (same for Japanese display) | |
| 96 | * Graphic Mode: 640x200 or 320x200, 8 colors | |
| 97 | * Sound: PSG 8 octave | |
| 98 | * I/O Ports: Centronic ports, 2 Joystick ports, built-in Cassette interface, | |
| 99 | 2 Floppy drive for 5" disks, two expansion I/O ports | |
| 91 | X1turbo Model 30 (CZ-852C) - October, 1984 | |
| 92 | * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) | |
| 93 | * ROM: IPL (32KB) + chargen (8KB) + Kanji (128KB) | |
| 94 | * RAM: Main memory (64KB) + VRAM (6KB) + RAM for PCG (6KB) + GRAM (96KB) | |
| 95 | * Text Mode: 80xCh or 40xCh with Ch = 10, 12, 20, 25 (same for Japanese display) | |
| 96 | * Graphic Mode: 640x200 or 320x200, 8 colors | |
| 97 | * Sound: PSG 8 octave | |
| 98 | * I/O Ports: Centronic ports, 2 Joystick ports, built-in Cassette interface, | |
| 99 | 2 Floppy drive for 5" disks, two expansion I/O ports | |
| 100 | 100 | |
| 101 | X1turbo Model 20 (CZ-851C) - October, 1984 | |
| 102 | * same as Model 30, but only 1 Floppy drive is included | |
| 101 | X1turbo Model 20 (CZ-851C) - October, 1984 | |
| 102 | * same as Model 30, but only 1 Floppy drive is included | |
| 103 | 103 | |
| 104 | X1turbo Model 10 (CZ-850C) - October, 1984 | |
| 105 | * same as Model 30, but Floppy drive is optional and GRAM is 48KB (it can | |
| 106 | be expanded to 96KB however) | |
| 104 | X1turbo Model 10 (CZ-850C) - October, 1984 | |
| 105 | * same as Model 30, but Floppy drive is optional and GRAM is 48KB (it can | |
| 106 | be expanded to 96KB however) | |
| 107 | 107 | |
| 108 | X1turbo Model 40 (CZ-862C) - July, 1985 | |
| 109 | * same as Model 30, but uses tv screen (you could watch television with this) | |
| 108 | X1turbo Model 40 (CZ-862C) - July, 1985 | |
| 109 | * same as Model 30, but uses tv screen (you could watch television with this) | |
| 110 | 110 | |
| 111 | X1turboII (CZ-856C) - November, 1985 | |
| 112 | * same as Model 30, but restyled, cheaper and sold with utility software | |
| 111 | X1turboII (CZ-856C) - November, 1985 | |
| 112 | * same as Model 30, but restyled, cheaper and sold with utility software | |
| 113 | 113 | |
| 114 | X1turboIII (CZ-870C) - November, 1986 | |
| 115 | * with two High Density Floppy driver | |
| 114 | X1turboIII (CZ-870C) - November, 1986 | |
| 115 | * with two High Density Floppy driver | |
| 116 | 116 | |
| 117 | X1turboZ (CZ-880C) - December, 1986 | |
| 118 | * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) | |
| 119 | * ROM: IPL (32KB) + chargen (8KB) + Kanji 1st & 2nd level | |
| 120 | * RAM: Main memory (64KB) + VRAM (6KB) + RAM for PCG (6KB) + GRAM (96KB) | |
| 121 | * Text Mode: 80xCh or 40xCh with Ch = 10, 12, 20, 25 (same for Japanese display) | |
| 122 | * Graphic Mode: 640x200 or 320x200, 8 colors [in compatibility mode], | |
| 123 | 640x400, 8 colors (out of 4096); 320x400, 64 colors (out of 4096); | |
| 124 | 320x200, 4096 colors [in multimode], | |
| 125 | * Sound: PSG 8 octave + FM 8 octave | |
| 126 | * I/O Ports: Centronic ports, 2 Joystick ports, built-in Cassette interface, | |
| 127 | 2 Floppy drive for HD 5" disks, two expansion I/O ports | |
| 117 | X1turboZ (CZ-880C) - December, 1986 | |
| 118 | * CPU: z80A @ 4MHz, 80C49 x 2 (one for key scan, the other for TV & Cas Ctrl) | |
| 119 | * ROM: IPL (32KB) + chargen (8KB) + Kanji 1st & 2nd level | |
| 120 | * RAM: Main memory (64KB) + VRAM (6KB) + RAM for PCG (6KB) + GRAM (96KB) | |
| 121 | * Text Mode: 80xCh or 40xCh with Ch = 10, 12, 20, 25 (same for Japanese display) | |
| 122 | * Graphic Mode: 640x200 or 320x200, 8 colors [in compatibility mode], | |
| 123 | 640x400, 8 colors (out of 4096); 320x400, 64 colors (out of 4096); | |
| 124 | 320x200, 4096 colors [in multimode], | |
| 125 | * Sound: PSG 8 octave + FM 8 octave | |
| 126 | * I/O Ports: Centronic ports, 2 Joystick ports, built-in Cassette interface, | |
| 127 | 2 Floppy drive for HD 5" disks, two expansion I/O ports | |
| 128 | 128 | |
| 129 | X1turboZII (CZ-881C) - December, 1987 | |
| 130 | * same as turboZ, but added 64KB expansion RAM | |
| 129 | X1turboZII (CZ-881C) - December, 1987 | |
| 130 | * same as turboZ, but added 64KB expansion RAM | |
| 131 | 131 | |
| 132 | X1turboZIII (CZ-888C) - December, 1988 | |
| 133 | * same as turboZII, but no more built-in cassette drive | |
| 132 | X1turboZIII (CZ-888C) - December, 1988 | |
| 133 | * same as turboZII, but no more built-in cassette drive | |
| 134 | 134 | |
| 135 | Please refer to http://www2s.biglobe.ne.jp/~ITTO/x1/x1menu.html for | |
| 136 | more info | |
| 135 | Please refer to http://www2s.biglobe.ne.jp/~ITTO/x1/x1menu.html for | |
| 136 | more info | |
| 137 | 137 | |
| 138 | BASIC has to be loaded from external media (tape or disk), the | |
| 139 | computer only has an Initial Program Loader (IPL) | |
| 138 | BASIC has to be loaded from external media (tape or disk), the | |
| 139 | computer only has an Initial Program Loader (IPL) | |
| 140 | 140 | |
| 141 | 141 | ************************************************************************************************/ |
| 142 | 142 | |
| r5932 | r5933 | |
| 454 | 454 | draw_fgtilemap(screen->machine,bitmap,cliprect,w); |
| 455 | 455 | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,scrn_reg.disp_bank,scrn_reg.ply^0xff); |
| 456 | 456 | /* Y's uses the following as a normal buffer/work ram without anything reasonable to draw */ |
| 457 | // | |
| 457 | // draw_gfxbitmap(screen->machine,bitmap,cliprect,w,1); | |
| 458 | 458 | |
| 459 | 459 | return 0; |
| 460 | 460 | } |
| r5932 | r5933 | |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | /*if(key_flag == 1) |
| 604 | { | |
| 605 | key_flag = 0; | |
| 606 | return 0x82; //TODO: this is for shift/ctrl/kana lock etc. | |
| 607 | }*/ | |
| 604 | { | |
| 605 | key_flag = 0; | |
| 606 | return 0x82; //TODO: this is for shift/ctrl/kana lock etc. | |
| 607 | }*/ | |
| 608 | 608 | |
| 609 | 609 | sub_cmd_length--; |
| 610 | 610 | sub_obf = (sub_cmd_length) ? 0x00 : 0x20; |
| r5932 | r5933 | |
| 830 | 830 | { |
| 831 | 831 | //UINT8 *ROM = memory_region(space->machine, "rom"); |
| 832 | 832 | |
| 833 | // | |
| 833 | // popmessage("%06x",rom_index[0]<<16|rom_index[1]<<8|rom_index[2]<<0); | |
| 834 | 834 | |
| 835 | 835 | return 0; //ROM[rom_index[0]<<16|rom_index[1]<<8|rom_index[2]<<0]; |
| 836 | 836 | } |
| r5932 | r5933 | |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | /* |
| 1103 | ||
| 1103 | SCRN flags | |
| 1104 | 1104 | |
| 1105 | ||
| 1105 | d0(01) = 0:low res 1:high res | |
| 1106 | 1106 | d1(02) = 0:1 raster 1:2 raster <- 0=400-line mode, legal when 'd0=1' |
| 1107 | 1107 | d2(04) = 0:25(20) lines 1:12(10) lines |
| 1108 | 1108 | d3(08) = 0:bank 0 0:bank 1 <- display |
| r5932 | r5933 | |
| 1127 | 1127 | static WRITE8_HANDLER( x1_ply_w ) |
| 1128 | 1128 | { |
| 1129 | 1129 | scrn_reg.ply = data; |
| 1130 | // | |
| 1130 | // printf("PLY = %02x\n",data); | |
| 1131 | 1131 | } |
| 1132 | 1132 | |
| 1133 | 1133 | static WRITE8_HANDLER( x1_6845_w ) |
| r5932 | r5933 | |
| 1207 | 1207 | static UINT32 kanji_addr; |
| 1208 | 1208 | |
| 1209 | 1209 | /* |
| 1210 | * FIXME: recheck this once that the kanji rom is redumped, it's confirmed bad for the following reasons: | |
| 1211 | * - A game lets you type stuff that's typed with this function, the index doesn't match with the typed char; | |
| 1212 | * - It search for chars that are out of the rom range; | |
| 1210 | * FIXME: recheck this once that the kanji rom is redumped, it's confirmed bad for the following reasons: | |
| 1211 | * - A game lets you type stuff that's typed with this function, the index doesn't match with the typed char; | |
| 1212 | * - It search for chars that are out of the rom range; | |
| 1213 | 1213 | */ |
| 1214 | 1214 | static READ8_HANDLER( x1_kanji_r ) |
| 1215 | 1215 | { |
| r5932 | r5933 | |
| 1258 | 1258 | { |
| 1259 | 1259 | io_bank_mode = 0; //any read disables the extended mode. |
| 1260 | 1260 | |
| 1261 | //if(offset >= 0x0704 && offset <= 0x0707) | |
| 1261 | //if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); } | |
| 1262 | 1262 | if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| 1263 | 1263 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } |
| 1264 | 1264 | else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } |
| r5932 | r5933 | |
| 1270 | 1270 | else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); } |
| 1271 | 1271 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); } |
| 1272 | 1272 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); } |
| 1273 | // | |
| 1273 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } | |
| 1274 | 1274 | else if(offset == 0x1fe0) { return x1_blackclip_r(space,0); } |
| 1275 | 1275 | else if(offset >= 0x2000 && offset <= 0x2fff) { return colorram[offset-0x2000]; } |
| 1276 | 1276 | else if(offset >= 0x3000 && offset <= 0x3fff) { return videoram[offset-0x3000]; } |
| r5932 | r5933 | |
| 1285 | 1285 | static WRITE8_HANDLER( x1_io_w ) |
| 1286 | 1286 | { |
| 1287 | 1287 | if(io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| 1288 | // else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x0704,data); } | |
| 1289 | // else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(space->machine, 0, data); } | |
| 1288 | // else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x0704,data); } | |
| 1289 | // else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(space->machine, 0, data); } | |
| 1290 | 1290 | else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } |
| 1291 | // | |
| 1291 | // else if(offset >= 0x0e80 && offset <= 0x0e82) { x1_kanji_w(space->machine, offset-0xe80,data); } | |
| 1292 | 1292 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { x1_fdc_w(space, offset-0xff8,data); } |
| 1293 | 1293 | else if(offset >= 0x1000 && offset <= 0x10ff) { x1_pal_b_w(space, 0,data); } |
| 1294 | 1294 | else if(offset >= 0x1100 && offset <= 0x11ff) { x1_pal_r_w(space, 0,data); } |
| r5932 | r5933 | |
| 1307 | 1307 | else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); } |
| 1308 | 1308 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); } |
| 1309 | 1309 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); } |
| 1310 | // else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } | |
| 1311 | // else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } | |
| 1312 | // else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } | |
| 1313 | // else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } | |
| 1310 | // else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } | |
| 1311 | // else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } | |
| 1312 | // else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } | |
| 1313 | // else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } | |
| 1314 | 1314 | else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 1315 | 1315 | else if(offset == 0x1fe0) { x1_blackclip_w(space,0,data); } |
| 1316 | 1316 | else if(offset >= 0x2000 && offset <= 0x2fff) { colorram[offset-0x2000] = data; } |
| r5932 | r5933 | |
| 1344 | 1344 | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb8); } |
| 1345 | 1345 | else if(offset == 0x1fc0) { return x1turbo_txdisp_r(space,0); } |
| 1346 | 1346 | else if(offset == 0x1fc5) { return x1turbo_gfxpal_r(space,0); } |
| 1347 | // | |
| 1347 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } | |
| 1348 | 1348 | else if(offset == 0x1fe0) { return x1_blackclip_r(space,0); } |
| 1349 | 1349 | else if(offset >= 0x2000 && offset <= 0x2fff) { return colorram[offset-0x2000]; } |
| 1350 | 1350 | else if(offset >= 0x3000 && offset <= 0x3fff) { return videoram[offset-0x3000]; } |
| r5932 | r5933 | |
| 1363 | 1363 | if(io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| 1364 | 1364 | else if(offset == 0x0700 || offset == 0x0701) { ym2151_w(devtag_get_device(space->machine, "ym"), offset-0x0700,data); } |
| 1365 | 1365 | else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x0704,data); } |
| 1366 | // | |
| 1366 | // else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(space->machine, 0, data); } | |
| 1367 | 1367 | else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } |
| 1368 | 1368 | else if(offset >= 0x0e80 && offset <= 0x0e83) { x1_kanji_w(space, offset-0xe80,data); } |
| 1369 | 1369 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { x1_fdc_w(space, offset-0xff8,data); } |
| r5932 | r5933 | |
| 1433 | 1433 | { |
| 1434 | 1434 | //printf("PPI Port B read\n"); |
| 1435 | 1435 | /* |
| 1436 | x--- ---- "v disp" | |
| 1437 | -x-- ---- "sub cpu ibf" | |
| 1438 | --x- ---- "sub cpu obf" | |
| 1439 | ---x ---- ROM/RAM flag (0=ROM, 1=RAM) | |
| 1440 | ---- x--- "busy" | |
| 1441 | ---- -x-- "v sync" | |
| 1442 | ---- --x- "cmt read" | |
| 1443 | ---- ---x "cmt test" (active low) | |
| 1444 | */ | |
| 1436 | x--- ---- "v disp" | |
| 1437 | -x-- ---- "sub cpu ibf" | |
| 1438 | --x- ---- "sub cpu obf" | |
| 1439 | ---x ---- ROM/RAM flag (0=ROM, 1=RAM) | |
| 1440 | ---- x--- "busy" | |
| 1441 | ---- -x-- "v sync" | |
| 1442 | ---- --x- "cmt read" | |
| 1443 | ---- ---x "cmt test" (active low) | |
| 1444 | */ | |
| 1445 | 1445 | UINT8 dat = 0; |
| 1446 | 1446 | vdisp = (video_screen_get_vpos(device->machine->primary_screen) < 200) ? 0x80 : 0x00; |
| 1447 | 1447 | dat = (input_port_read(device->machine, "SYSTEM") & 0x10) | sub_obf | vsync | vdisp; |
| r5932 | r5933 | |
| 1449 | 1449 | if(cassette_input(devtag_get_device(device->machine,"cass")) > 0.03) |
| 1450 | 1450 | dat |= 0x02; |
| 1451 | 1451 | |
| 1452 | // if(cassette_get_state(devtag_get_device(device->machine,"cass")) & CASSETTE_MOTOR_DISABLED) | |
| 1453 | // dat &= ~0x02; // is zero if not playing | |
| 1452 | // if(cassette_get_state(devtag_get_device(device->machine,"cass")) & CASSETTE_MOTOR_DISABLED) | |
| 1453 | // dat &= ~0x02; // is zero if not playing | |
| 1454 | 1454 | |
| 1455 | 1455 | // CMT test bit is set low when the CMT Stop command is issued, and becomes |
| 1456 | 1456 | // high again when this bit is read. |
| r5932 | r5933 | |
| 1469 | 1469 | { |
| 1470 | 1470 | //printf("PPI Port C read\n"); |
| 1471 | 1471 | /* |
| 1472 | x--x xxxx <unknown> | |
| 1473 | -x-- ---- 320 mode (r/w) | |
| 1474 | --x- ---- i/o mode (r/w) | |
| 1475 | */ | |
| 1472 | x--x xxxx <unknown> | |
| 1473 | -x-- ---- 320 mode (r/w) | |
| 1474 | --x- ---- i/o mode (r/w) | |
| 1475 | */ | |
| 1476 | 1476 | return (io_sys & 0x9f) | hres_320 | ~io_switch; |
| 1477 | 1477 | } |
| 1478 | 1478 | |
| r5932 | r5933 | |
| 1877 | 1877 | GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8, 0x200, 0x20 ) |
| 1878 | 1878 | GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8, 0x000, 1 ) |
| 1879 | 1879 | GFXDECODE_ENTRY( "cgrom", 0x01800, x1_chars_8x16, 0x200, 0x20 ) |
| 1880 | // | |
| 1880 | // GFXDECODE_ENTRY( "kanji", 0x27000, x1_chars_16x16, 0, 0x20 ) //needs to be checked when the ROM will be redumped | |
| 1881 | 1881 | GFXDECODE_ENTRY( "cgrom", 0x02800, x1_chars_16x16, 0, 0x20 ) //needs to be checked when the ROM will be redumped |
| 1882 | 1882 | GFXDECODE_END |
| 1883 | 1883 | |
| r5932 | r5933 | |
| 1916 | 1916 | { |
| 1917 | 1917 | { "x1kb" }, |
| 1918 | 1918 | { "ctc" }, |
| 1919 | // { "dma" }, | |
| 1920 | // { "sio" }, | |
| 1919 | // { "dma" }, | |
| 1920 | // { "sio" }, | |
| 1921 | 1921 | { NULL } |
| 1922 | 1922 | }; |
| 1923 | 1923 | |
| r5932 | r5933 | |
| 1966 | 1966 | |
| 1967 | 1967 | /*static IRQ_CALLBACK(x1_irq_callback) |
| 1968 | 1968 | { |
| 1969 | if(ctc_irq_flag != 0) | |
| 1970 | { | |
| 1971 | ctc_irq_flag = 0; | |
| 1972 | if(key_irq_flag == 0) // if no other devices are pulling the IRQ line high | |
| 1973 | cpu_set_input_line(device, 0, CLEAR_LINE); | |
| 1974 | return x1_irq_vector; | |
| 1975 | } | |
| 1976 | if(key_irq_flag != 0) | |
| 1977 | { | |
| 1978 | key_irq_flag = 0; | |
| 1979 | if(ctc_irq_flag == 0) // if no other devices are pulling the IRQ line high | |
| 1980 | cpu_set_input_line(device, 0, CLEAR_LINE); | |
| 1981 | return key_irq_vector; | |
| 1982 | } | |
| 1983 | return x1_irq_vector; | |
| 1969 | if(ctc_irq_flag != 0) | |
| 1970 | { | |
| 1971 | ctc_irq_flag = 0; | |
| 1972 | if(key_irq_flag == 0) // if no other devices are pulling the IRQ line high | |
| 1973 | cpu_set_input_line(device, 0, CLEAR_LINE); | |
| 1974 | return x1_irq_vector; | |
| 1975 | } | |
| 1976 | if(key_irq_flag != 0) | |
| 1977 | { | |
| 1978 | key_irq_flag = 0; | |
| 1979 | if(ctc_irq_flag == 0) // if no other devices are pulling the IRQ line high | |
| 1980 | cpu_set_input_line(device, 0, CLEAR_LINE); | |
| 1981 | return key_irq_vector; | |
| 1982 | } | |
| 1983 | return x1_irq_vector; | |
| 1984 | 1984 | } |
| 1985 | 1985 | */ |
| 1986 | 1986 | static TIMER_CALLBACK(keyboard_callback) |
| r5932 | r5933 | |
| 2038 | 2038 | //cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), x1_irq_callback); |
| 2039 | 2039 | timer_pulse(machine, ATTOTIME_IN_HZ(240), NULL, 0, keyboard_callback); |
| 2040 | 2040 | timer_pulse(machine, ATTOTIME_IN_HZ(16), NULL, 0, cmt_wind_timer); |
| 2041 | ||
| 2041 | ||
| 2042 | 2042 | cmt_current_cmd = 0; |
| 2043 | 2043 | cmt_test = 0; |
| 2044 | 2044 | cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); |
| r5932 | r5933 | |
| 2152 | 2152 | MDRV_CPU_IO_MAP(x1turbo_io) |
| 2153 | 2153 | |
| 2154 | 2154 | MDRV_SOUND_ADD("ym", YM2151, XTAL_4MHz) //unknown clock / divider |
| 2155 | // | |
| 2155 | // MDRV_SOUND_CONFIG(ay8910_config) | |
| 2156 | 2156 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 2157 | 2157 | MACHINE_DRIVER_END |
| 2158 | 2158 |
| r5932 | r5933 | |
|---|---|---|
| 711 | 711 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 712 | 712 | ROM_END |
| 713 | 713 | |
| 714 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG | |
| 714 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 715 | 715 | CONS( 1990, gameboy, 0, 0, gameboy, gameboy, 0, 0, "Nintendo", "Game Boy", 0) |
| 716 | 716 | CONS( 1994, supergb, gameboy, 0, supergb, gameboy, 0, 0, "Nintendo", "Super Game Boy", 0) |
| 717 | 717 | CONS( 1996, gbpocket, gameboy, 0, gbpocket, gameboy, 0, 0, "Nintendo", "Game Boy Pocket", 0) |
| r5932 | r5933 | |
|---|---|---|
| 297 | 297 | |
| 298 | 298 | static INPUT_PORTS_START( pc1402 ) |
| 299 | 299 | PORT_INCLUDE( pc1401 ) |
| 300 | ||
| 300 | ||
| 301 | 301 | PORT_MODIFY("DSW0") |
| 302 | 302 | PORT_DIPNAME( 0xc0, 0x80, "RAM") |
| 303 | 303 | PORT_DIPSETTING( 0x00, "2KB" ) |
| r5932 | r5933 | |
| 447 | 447 | |
| 448 | 448 | static INPUT_PORTS_START( pc1403h ) |
| 449 | 449 | PORT_INCLUDE( pc1403 ) |
| 450 | ||
| 450 | ||
| 451 | 451 | PORT_MODIFY("DSW0") |
| 452 | 452 | PORT_DIPNAME( 0x80, 0x80, "RAM") |
| 453 | 453 | PORT_DIPSETTING( 0x00, "PC1403 (8KB)" ) |
| r5932 | r5933 | |
| 494 | 494 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R $") PORT_CODE(KEYCODE_R) |
| 495 | 495 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 496 | 496 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) |
| 497 | ||
| 497 | ||
| 498 | 498 | PORT_START("KEY4") |
| 499 | 499 | PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 500 | 500 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_QUOTE) |
| r5932 | r5933 | |
| 511 | 511 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y &") PORT_CODE(KEYCODE_Y) |
| 512 | 512 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 513 | 513 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) |
| 514 | ||
| 514 | ||
| 515 | 515 | PORT_START("KEY6") |
| 516 | 516 | PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 517 | 517 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) /* down? */ |
| r5932 | r5933 | |
| 784 | 784 | MDRV_SCREEN_SIZE(608, 300) |
| 785 | 785 | MDRV_SCREEN_VISIBLE_AREA(0, 608-1, 0, 300-1) |
| 786 | 786 | MDRV_GFXDECODE( pc1251 ) |
| 787 | ||
| 787 | ||
| 788 | 788 | MDRV_VIDEO_UPDATE( pc1251 ) |
| 789 | 789 | MACHINE_DRIVER_END |
| 790 | 790 | |
| r5932 | r5933 | |
| 827 | 827 | MDRV_IMPORT_FROM( pc1250) |
| 828 | 828 | MDRV_CPU_MODIFY( "maincpu" ) |
| 829 | 829 | MDRV_CPU_PROGRAM_MAP( pc1260_mem) |
| 830 | ||
| 830 | ||
| 831 | 831 | MDRV_NVRAM_HANDLER( pc1260 ) |
| 832 | 832 | MACHINE_DRIVER_END |
| 833 | 833 | |
| r5932 | r5933 | |
| 934 | 934 | ROM_START(pc1260) |
| 935 | 935 | ROM_REGION(0x10000,"maincpu",0) |
| 936 | 936 | ROM_LOAD( "cpu1260.rom", 0x0000, 0x2000, CRC(f46d23d3) SHA1(e00c9194570048185ec8358732adeba151c56b33)) |
| 937 | ROM_LOAD( "bas1260.rom", 0x8000, 0x8000, CRC(6c7e017d) SHA1(e2ae717438cea59416b0670e2a53989c147fb362)) | |
| 937 | ROM_LOAD( "bas1260.rom", 0x8000, 0x8000, CRC(6c7e017d) SHA1(e2ae717438cea59416b0670e2a53989c147fb362)) | |
| 938 | 938 | ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF) |
| 939 | 939 | ROM_END |
| 940 | 940 |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | ||
| 7 | Execution of this monitor rom starts at F800. | |
| 8 | 8 | |
| 9 | I/O sequence: read 0A, discard result | |
| 10 | read 0B, output result to 0B | |
| 11 | send the sequence AA 40 4E 37 to 01, then to 03 (programming a device?) | |
| 12 | L1:read 03 to see if display device is ready | |
| 13 | write ascii character to 02 goto L1 until signon message is displayed | |
| 14 | in same fashion display top of memory (F800) | |
| 15 | display prompt character (*) wait for input | |
| 16 | read 03 to see if a key is being input, if so read 02 and display it | |
| 17 | if illegal input, display ? then display prompt on a new line | |
| 9 | I/O sequence: read 0A, discard result | |
| 10 | read 0B, output result to 0B | |
| 11 | send the sequence AA 40 4E 37 to 01, then to 03 (programming a device?) | |
| 12 | L1:read 03 to see if display device is ready | |
| 13 | write ascii character to 02 goto L1 until signon message is displayed | |
| 14 | in same fashion display top of memory (F800) | |
| 15 | display prompt character (*) wait for input | |
| 16 | read 03 to see if a key is being input, if so read 02 and display it | |
| 17 | if illegal input, display ? then display prompt on a new line | |
| 18 | 18 | |
| 19 | To summarise: out 01 and out 03 - program a device | |
| 20 | out 02 - display a character | |
| 21 | in 02 - read character from keyboard | |
| 22 | in 03 - get busy status of display (bit 0) and keyboard (bit 1) High=ready | |
| 19 | To summarise: out 01 and out 03 - program a device | |
| 20 | out 02 - display a character | |
| 21 | in 02 - read character from keyboard | |
| 22 | in 03 - get busy status of display (bit 0) and keyboard (bit 1) High=ready | |
| 23 | 23 | |
| 24 | 24 | *****************************************************************************************************/ |
| 25 | 25 | |
| 26 | 26 | /* |
| 27 | 27 | |
| 28 | ||
| 28 | TODO: | |
| 29 | 29 | |
| 30 | - terminal | |
| 31 | - keyboard | |
| 32 | - ROM should be mirrored every 2K at boot | |
| 33 | - 2/4 MHz jumper J2 | |
| 34 | - floppy | |
| 35 | - memory expansion | |
| 36 | - COM5016 | |
| 37 | - CTC | |
| 30 | - terminal | |
| 31 | - keyboard | |
| 32 | - ROM should be mirrored every 2K at boot | |
| 33 | - 2/4 MHz jumper J2 | |
| 34 | - floppy | |
| 35 | - memory expansion | |
| 36 | - COM5016 | |
| 37 | - CTC | |
| 38 | 38 | |
| 39 | 39 | */ |
| 40 | 40 | |
| r5932 | r5933 | |
| 56 | 56 | { |
| 57 | 57 | /* |
| 58 | 58 | |
| 59 | bit description | |
| 60 | ||
| 61 | 0 A16 | |
| 62 | 1 A17 | |
| 59 | bit description | |
| 63 | 60 | |
| 64 | */ | |
| 61 | 0 A16 | |
| 62 | 1 A17 | |
| 63 | ||
| 64 | */ | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | static WRITE8_HANDLER( prom_toggle_w ) |
| r5932 | r5933 | |
| 181 | 181 | DEVCB_LINE(com5016_fr_w), /* fR output */ |
| 182 | 182 | DEVCB_LINE(com5016_ft_w), /* fT output */ |
| 183 | 183 | { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, // WRONG |
| 184 | { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, // WRONG | |
| 184 | { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 }, // WRONG | |
| 185 | 185 | }; |
| 186 | 186 | |
| 187 | 187 | /* Printer 8251A Interface */ |
| r5932 | r5933 | |
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | static const wd17xx_interface wd1795_intf = | |
| 266 | { | |
| 265 | static const wd17xx_interface wd1795_intf = | |
| 266 | { | |
| 267 | 267 | wd1795_callback, |
| 268 | 268 | NULL, |
| 269 | 269 | {FLOPPY_0,FLOPPY_1,NULL,NULL} |
| r5932 | r5933 | |
| 364 | 364 | MDRV_Z80CTC_ADD(Z80CTC_TAG, XTAL_8MHz/2, ctc_intf) |
| 365 | 365 | MDRV_COM8116_ADD(COM5016_TAG, 5000000, com5016_intf) // COM5016 |
| 366 | 366 | MDRV_WD179X_ADD(WD1795_TAG, /*XTAL_8MHz/8,*/ wd1795_intf ) // WD1795-02 |
| 367 | MDRV_FLOPPY_2_DRIVES_ADD(xor100_floppy_config) | |
| 367 | MDRV_FLOPPY_2_DRIVES_ADD(xor100_floppy_config) | |
| 368 | 368 | |
| 369 | 369 | MDRV_CASSETTE_ADD(CASSETTE_TAG, xor100_cassette_config) |
| 370 | 370 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
| 379 | 379 | /* System Configuration */ |
| 380 | 380 | |
| 381 | 381 | static SYSTEM_CONFIG_START( xor100 ) |
| 382 | CONFIG_RAM_DEFAULT( 64 * 1024 ) | |
| 382 | CONFIG_RAM_DEFAULT( 64 * 1024 ) | |
| 383 | 383 | SYSTEM_CONFIG_END |
| 384 | 384 | |
| 385 | 385 | /* System Drivers */ |
| 386 | 386 | |
| 387 | /* YEAR | |
| 387 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 388 | 388 | COMP( 1982, xor100, 0, 0, xor100, xor100, 0, xor100, "Xor Data Science", "XOR S-100-12", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | drivers/palm.c | |
| 4 | Palm (MC68328) emulation | |
| 3 | drivers/palm.c | |
| 4 | Palm (MC68328) emulation | |
| 5 | 5 | |
| 6 | ||
| 6 | Driver by MooglyGuy | |
| 7 | 7 | |
| 8 | ||
| 8 | Additional bug fixing by R. Belmont | |
| 9 | 9 | |
| 10 | 10 | ****************************************************************************/ |
| 11 | 11 |
| r5932 | r5933 | |
|---|---|---|
| 282 | 282 | for ( i = 0; i < 6; i++ ) |
| 283 | 283 | { |
| 284 | 284 | if ( kim1_led_time[i] ) |
| 285 | kim1_led_time[i]--; | |
| 285 | kim1_led_time[i]--; | |
| 286 | 286 | else |
| 287 | 287 | output_set_digit_value( i, 0 ); |
| 288 | 288 | } |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | BEEHIVE DM3270 | |
| 4 | 4 | |
| 5 | ||
| 5 | 25/05/2009 Skeleton driver [Robbbert] | |
| 6 | 6 | |
| 7 | ||
| 7 | This is a conventional computer terminal using a serial link. | |
| 8 | 8 | |
| 9 | 9 | ****************************************************************************/ |
| 10 | 10 |
| r5932 | r5933 | |
|---|---|---|
| 345 | 345 | |
| 346 | 346 | /* cassette */ |
| 347 | 347 | MDRV_CASSETTE_ADD(CASSETTE_TAG, tmc600_cassette_config) |
| 348 | ||
| 349 | MDRV_FLOPPY_4_DRIVES_ADD(tmc600_floppy_config) | |
| 348 | ||
| 349 | MDRV_FLOPPY_4_DRIVES_ADD(tmc600_floppy_config) | |
| 350 | 350 | MACHINE_DRIVER_END |
| 351 | 351 | |
| 352 | 352 | /* ROMs */ |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | /* |
| 10 | 10 | |
| 11 | ||
| 11 | TODO: | |
| 12 | 12 | |
| 13 | - Turtles music is monotonous | |
| 14 | - convert to discrete sound | |
| 15 | - screen pincushion distortion | |
| 13 | - Turtles music is monotonous | |
| 14 | - convert to discrete sound | |
| 15 | - screen pincushion distortion | |
| 16 | 16 | |
| 17 | 17 | */ |
| 18 | 18 | |
| r5932 | r5933 | |
| 24 | 24 | #include "sound/dac.h" |
| 25 | 25 | |
| 26 | 26 | /* Memory Maps */ |
| 27 | ||
| 27 | ||
| 28 | 28 | static ADDRESS_MAP_START( program_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 29 | 29 | AM_RANGE(0x0000, 0x03ff) AM_ROMBANK(1) |
| 30 | 30 | AM_RANGE(0x0400, 0x0fff) AM_ROM |
| r5932 | r5933 | |
| 122 | 122 | ROM_END |
| 123 | 123 | |
| 124 | 124 | /* Game Driver */ |
| 125 | ||
| 126 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 125 | ||
| 126 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 127 | 127 | CONS( 1982, advision, 0, 0, advision, advision, 0, 0, "Entex Electronics", "Adventure Vision", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| r5932 | r5933 | |
|---|---|---|
| 256 | 256 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 257 | 257 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 258 | 258 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) |
| 259 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 259 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 260 | 260 | |
| 261 | 261 | PORT_START("LINE8") |
| 262 | 262 | PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED) |
| r5932 | r5933 | |
| 337 | 337 | |
| 338 | 338 | MDRV_VIDEO_START(generic_bitmapped) |
| 339 | 339 | MDRV_VIDEO_UPDATE(radio86) |
| 340 | ||
| 340 | ||
| 341 | 341 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 342 | 342 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 343 | 343 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| r5932 | r5933 | |
| 360 | 360 | MDRV_IMPORT_FROM(radio86) |
| 361 | 361 | MDRV_CPU_MODIFY("maincpu") |
| 362 | 362 | MDRV_CPU_PROGRAM_MAP(radio86rom_mem) |
| 363 | ||
| 363 | ||
| 364 | 364 | MDRV_I8255A_ADD( "ppi8255_2", radio86_ppi8255_interface_2 ) |
| 365 | 365 | MACHINE_DRIVER_END |
| 366 | 366 | |
| r5932 | r5933 | |
| 381 | 381 | |
| 382 | 382 | MDRV_I8255A_ADD( "ms7007", rk7007_ppi8255_interface ) |
| 383 | 383 | MACHINE_DRIVER_END |
| 384 | ||
| 384 | ||
| 385 | 385 | static MACHINE_DRIVER_START( rk700716 ) |
| 386 | 386 | /* basic machine hardware */ |
| 387 | 387 | MDRV_IMPORT_FROM(radio16) |
| 388 | 388 | MDRV_CPU_MODIFY("maincpu") |
| 389 | 389 | MDRV_CPU_IO_MAP(rk7007_io) |
| 390 | ||
| 391 | MDRV_I8255A_ADD( "ms7007", rk7007_ppi8255_interface ) | |
| 390 | ||
| 391 | MDRV_I8255A_ADD( "ms7007", rk7007_ppi8255_interface ) | |
| 392 | 392 | MACHINE_DRIVER_END |
| 393 | 393 | |
| 394 | 394 | static MACHINE_DRIVER_START( mikron2 ) |
| r5932 | r5933 | |
| 415 | 415 | ROM_END |
| 416 | 416 | |
| 417 | 417 | ROM_START( spektr01 ) |
| 418 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) | |
| 418 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) | |
| 419 | 419 | ROM_LOAD( "spektr001.rom", 0xf800, 0x0800, CRC(5a38e6d5) SHA1(799c3bbe2a9f08f3aba55379cc093329048350ff)) |
| 420 | 420 | ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 ) |
| 421 | 421 | ROM_REGION(0x0800, "gfx1",0) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Bashkiria-2M driver by Miodrag Milanovic | |
| 4 | 4 | |
| 5 | 28/03/2008 Preliminary driver. | |
| 6 | ||
| 5 | 28/03/2008 Preliminary driver. | |
| 6 | ||
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | |
| r5932 | r5933 | |
| 19 | 19 | #include "formats/basicdsk.h" |
| 20 | 20 | #include "includes/b2m.h" |
| 21 | 21 | |
| 22 | ||
| 22 | ||
| 23 | 23 | /* Address maps */ |
| 24 | 24 | static ADDRESS_MAP_START(b2m_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 25 | 25 | AM_RANGE (0x0000, 0x27ff) AM_RAMBANK(1) |
| r5932 | r5933 | |
| 34 | 34 | AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253", pit8253_r,pit8253_w) |
| 35 | 35 | AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_2", i8255a_r, i8255a_w) |
| 36 | 36 | AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255a_r, i8255a_w) |
| 37 | AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w) | |
| 38 | AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) | |
| 37 | AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w) | |
| 38 | AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) | |
| 39 | 39 | AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_r, pic8259_w ) |
| 40 | 40 | AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", msm8251_data_r,msm8251_data_w) |
| 41 | 41 | AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", msm8251_status_r,msm8251_control_w) |
| 42 | AM_RANGE(0x1c, 0x1c) AM_DEVREADWRITE("wd1793", wd17xx_status_r,wd17xx_command_w) | |
| 43 | AM_RANGE(0x1d, 0x1d) AM_DEVREADWRITE("wd1793", wd17xx_track_r,wd17xx_track_w) | |
| 44 | AM_RANGE(0x1e, 0x1e) AM_DEVREADWRITE("wd1793", wd17xx_sector_r,wd17xx_sector_w) | |
| 45 | AM_RANGE(0x1f, 0x1f) AM_DEVREADWRITE("wd1793", wd17xx_data_r,wd17xx_data_w) | |
| 42 | AM_RANGE(0x1c, 0x1c) AM_DEVREADWRITE("wd1793", wd17xx_status_r,wd17xx_command_w) | |
| 43 | AM_RANGE(0x1d, 0x1d) AM_DEVREADWRITE("wd1793", wd17xx_track_r,wd17xx_track_w) | |
| 44 | AM_RANGE(0x1e, 0x1e) AM_DEVREADWRITE("wd1793", wd17xx_sector_r,wd17xx_sector_w) | |
| 45 | AM_RANGE(0x1f, 0x1f) AM_DEVREADWRITE("wd1793", wd17xx_data_r,wd17xx_data_w) | |
| 46 | 46 | ADDRESS_MAP_END |
| 47 | 47 | |
| 48 | 48 | static ADDRESS_MAP_START( b2m_rom_io, ADDRESS_SPACE_IO, 8 ) |
| r5932 | r5933 | |
| 50 | 50 | AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253", pit8253_r,pit8253_w) |
| 51 | 51 | AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_3", i8255a_r, i8255a_w) |
| 52 | 52 | AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255a_r, i8255a_w) |
| 53 | AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w) | |
| 54 | AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) | |
| 53 | AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w) | |
| 54 | AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) | |
| 55 | 55 | AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_r, pic8259_w ) |
| 56 | 56 | AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", msm8251_data_r, msm8251_data_w) |
| 57 | 57 | AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", msm8251_status_r, msm8251_control_w) |
| r5932 | r5933 | |
| 76 | 76 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') |
| 77 | 77 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') |
| 78 | 78 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') |
| 79 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') | |
| 79 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') | |
| 80 | 80 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') |
| 81 | 81 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('{') |
| 82 | 82 | |
| r5932 | r5933 | |
| 86 | 86 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') |
| 87 | 87 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') |
| 88 | 88 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') |
| 89 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') | |
| 89 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') | |
| 90 | 90 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') |
| 91 | 91 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') |
| 92 | 92 | |
| r5932 | r5933 | |
| 96 | 96 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') |
| 97 | 97 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 98 | 98 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') |
| 99 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') | |
| 99 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') | |
| 100 | 100 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') |
| 101 | 101 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') |
| 102 | 102 | |
| r5932 | r5933 | |
| 114 | 114 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',') |
| 115 | 115 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('\'') PORT_CHAR(';') |
| 116 | 116 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('+') PORT_CHAR('=') |
| 117 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) | |
| 117 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) | |
| 118 | 118 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1') |
| 119 | 119 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('|') PORT_CHAR('\\') |
| 120 | 120 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(')') PORT_CHAR('0') |
| r5932 | r5933 | |
| 142 | 142 | PORT_START("LINE8") |
| 143 | 143 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 144 | 144 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 145 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_TILDE) | |
| 145 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("??") PORT_CODE(KEYCODE_TILDE) | |
| 146 | 146 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 147 | 147 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgdN") PORT_CODE(KEYCODE_PGDN) |
| 148 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) | |
| 148 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) | |
| 149 | 149 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("end") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END)) |
| 150 | 150 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| 151 | 151 | |
| r5932 | r5933 | |
| 157 | 157 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 158 | 158 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 159 | 159 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("PgUp") PORT_CODE(KEYCODE_PGUP) |
| 160 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 160 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 161 | 161 | |
| 162 | 162 | PORT_START("LINE10") |
| 163 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 163 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 164 | 164 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 165 | 165 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 166 | 166 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| r5932 | r5933 | |
| 171 | 171 | |
| 172 | 172 | PORT_START("MONITOR") |
| 173 | 173 | PORT_CONFNAME(0x01, 0x01, "Monitor") |
| 174 | PORT_CONFSETTING( 0x01, "Color") | |
| 175 | PORT_CONFSETTING( 0x00, "B/W") | |
| 174 | PORT_CONFSETTING( 0x01, "Color") | |
| 175 | PORT_CONFSETTING( 0x00, "B/W") | |
| 176 | 176 | INPUT_PORTS_END |
| 177 | ||
| 177 | ||
| 178 | 178 | static FLOPPY_OPTIONS_START(b2m) |
| 179 | 179 | FLOPPY_OPTION(b2m, "cpm", "Bashkiria-2M disk image", basicdsk_identify_default, basicdsk_construct_default, |
| 180 | 180 | HEADS([2]) |
| r5932 | r5933 | |
| 199 | 199 | MDRV_CPU_PROGRAM_MAP(b2m_mem) |
| 200 | 200 | MDRV_CPU_IO_MAP(b2m_io) |
| 201 | 201 | MDRV_CPU_VBLANK_INT("screen", b2m_vblank_interrupt) |
| 202 | ||
| 202 | ||
| 203 | 203 | MDRV_MACHINE_START( b2m ) |
| 204 | 204 | MDRV_MACHINE_RESET( b2m ) |
| 205 | ||
| 206 | /* video hardware */ | |
| 207 | MDRV_SCREEN_ADD("screen", RASTER) | |
| 205 | ||
| 206 | /* video hardware */ | |
| 207 | MDRV_SCREEN_ADD("screen", RASTER) | |
| 208 | 208 | MDRV_SCREEN_REFRESH_RATE(50) |
| 209 | 209 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 210 | 210 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 211 | 211 | MDRV_SCREEN_SIZE(384, 256) |
| 212 | 212 | MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1) |
| 213 | 213 | MDRV_PALETTE_LENGTH(4) |
| 214 | MDRV_PALETTE_INIT(b2m) | |
| 215 | ||
| 214 | MDRV_PALETTE_INIT(b2m) | |
| 215 | ||
| 216 | 216 | MDRV_PIT8253_ADD( "pit8253", b2m_pit8253_intf ) |
| 217 | 217 | |
| 218 | 218 | MDRV_I8255A_ADD( "ppi8255_1", b2m_ppi8255_interface_1 ) |
| 219 | 219 | |
| 220 | 220 | MDRV_I8255A_ADD( "ppi8255_2", b2m_ppi8255_interface_2 ) |
| 221 | ||
| 221 | ||
| 222 | 222 | MDRV_I8255A_ADD( "ppi8255_3", b2m_ppi8255_interface_3 ) |
| 223 | 223 | |
| 224 | 224 | MDRV_PIC8259_ADD( "pic8259", b2m_pic8259_config ) |
| 225 | ||
| 225 | ||
| 226 | 226 | MDRV_VIDEO_START(b2m) |
| 227 | MDRV_VIDEO_UPDATE(b2m) | |
| 228 | ||
| 227 | MDRV_VIDEO_UPDATE(b2m) | |
| 228 | ||
| 229 | 229 | /* sound */ |
| 230 | 230 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 231 | MDRV_SOUND_ADD("speaker", SPEAKER, 0) | |
| 232 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 231 | MDRV_SOUND_ADD("speaker", SPEAKER, 0) | |
| 232 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) | |
| 233 | 233 | |
| 234 | 234 | /* uart */ |
| 235 | 235 | MDRV_MSM8251_ADD("uart", default_msm8251_interface) |
| 236 | ||
| 236 | ||
| 237 | 237 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) |
| 238 | ||
| 238 | ||
| 239 | 239 | MDRV_FLOPPY_2_DRIVES_ADD(b2m_floppy_config) |
| 240 | 240 | MACHINE_DRIVER_END |
| 241 | 241 | |
| 242 | 242 | static MACHINE_DRIVER_START( b2mrom ) |
| 243 | 243 | MDRV_IMPORT_FROM(b2m) |
| 244 | MDRV_CPU_MODIFY("maincpu") | |
| 244 | MDRV_CPU_MODIFY("maincpu") | |
| 245 | 245 | MDRV_CPU_IO_MAP(b2m_rom_io) |
| 246 | 246 | MACHINE_DRIVER_END |
| 247 | ||
| 247 | ||
| 248 | 248 | /* ROM definition */ |
| 249 | 249 | |
| 250 | 250 | ROM_START( b2m ) |
| r5932 | r5933 | |
| 258 | 258 | ROM_LOAD( "ramdos.sys", 0x12000, 0x60c0, CRC(91ed6df0) SHA1(4fd040f2647a6b7930c330c75560a035027d0606) ) |
| 259 | 259 | ROM_END |
| 260 | 260 | |
| 261 | static SYSTEM_CONFIG_START(b2m) | |
| 262 | CONFIG_RAM_DEFAULT(128 * 1024) | |
| 261 | static SYSTEM_CONFIG_START(b2m) | |
| 262 | CONFIG_RAM_DEFAULT(128 * 1024) | |
| 263 | 263 | SYSTEM_CONFIG_END |
| 264 | 264 | |
| 265 | 265 | /* Driver */ |
| 266 | ||
| 267 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 266 | ||
| 267 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 268 | 268 | COMP( 1989, b2m, 0, 0, b2m, b2m, b2m, b2m, "BNPO", "Bashkiria-2M", GAME_SUPPORTS_SAVE) |
| 269 | 269 | COMP( 1989, b2mrom, b2m, 0, b2mrom, b2m, b2m, b2m, "BNPO", "Bashkiria-2M ROM-disk", GAME_SUPPORTS_SAVE) |
| r5932 | r5933 | |
|---|---|---|
| 283 | 283 | GAME DRIVERS |
| 284 | 284 | ***************************************************************************/ |
| 285 | 285 | |
| 286 | /* | |
| 286 | /* | |
| 287 | 287 | COMP(1977, aim65, 0, 0, aim65, aim65, 0, aim65, "Rockwell", "AIM 65", 0) |
| 288 | 288 | COMP(1981, aim65_40, aim65, 0, aim65, aim65, 0, aim65, "Rockwell", "AIM 65/40", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 7 | 7 | TODO: implement the RESET key on the front panel |
| 8 | 8 | find a dump of the charactyer ROM |
| 9 | 9 | convert the drawing code to tilemap |
| 10 | ||
| 11 | ||
| 10 | ||
| 11 | ||
| 12 | 12 | 1. General |
| 13 | 13 | SYSTEM |
| 14 | 14 | - Signetics 2650 CPU at 3.58/4 MHz(for NTSC) or at 4,433/5 (for PAL) |
| r5932 | r5933 | |
| 27 | 27 | |
| 28 | 28 | 2. Memory map |
| 29 | 29 | The memory map of the 2001 is below. |
| 30 | 0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) | |
| 31 | 1000 - 13FF mirror of $1800-$1BFF | |
| 32 | 1400 - 17FF mirror of $1800-$1BFF | |
| 33 | 1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) | |
| 34 | 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits | |
| 35 | 18D0 - 18EF Free for user programs. | |
| 36 | 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 | |
| 37 | 18F8 - 1908 registers of UVI | |
| 38 | 1909 - 197F Unmapped | |
| 39 | 1980 - 19BF User defined characters (8 possible, 8 bytes per character) | |
| 40 | 19C0 - 19F7 Unmapped | |
| 41 | 19F8 - 19FF registers of UVI | |
| 42 | 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits | |
| 43 | 1AD0 - 1AFF User memory | |
| 44 | 1B00 - 1BFF mirror of 1900-19FF | |
| 45 | 1C00 - 1FFF mirror of 1800-1BFF | |
| 46 | 2000 - 2FFF 4k ROM Block 2 (for 8k carts such as Jungler) | |
| 47 | 3000 - 3FFF mirror of 1000-1FFF | |
| 48 | 4000 - 4FFF mirror of 0000-0FFF | |
| 49 | 5000 - 5FFF mirror of 1000-1FFF | |
| 50 | 6000 - 6FFF mirror of 0000-0FFF | |
| 51 | 7000 - 7FFF mirror of 1000-1FFF | |
| 30 | 0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) | |
| 31 | 1000 - 13FF mirror of $1800-$1BFF | |
| 32 | 1400 - 17FF mirror of $1800-$1BFF | |
| 33 | 1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) | |
| 34 | 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits | |
| 35 | 18D0 - 18EF Free for user programs. | |
| 36 | 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 | |
| 37 | 18F8 - 1908 registers of UVI | |
| 38 | 1909 - 197F Unmapped | |
| 39 | 1980 - 19BF User defined characters (8 possible, 8 bytes per character) | |
| 40 | 19C0 - 19F7 Unmapped | |
| 41 | 19F8 - 19FF registers of UVI | |
| 42 | 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits | |
| 43 | 1AD0 - 1AFF User memory | |
| 44 | 1B00 - 1BFF mirror of 1900-19FF | |
| 45 | 1C00 - 1FFF mirror of 1800-1BFF | |
| 46 | 2000 - 2FFF 4k ROM Block 2 (for 8k carts such as Jungler) | |
| 47 | 3000 - 3FFF mirror of 1000-1FFF | |
| 48 | 4000 - 4FFF mirror of 0000-0FFF | |
| 49 | 5000 - 5FFF mirror of 1000-1FFF | |
| 50 | 6000 - 6FFF mirror of 0000-0FFF | |
| 51 | 7000 - 7FFF mirror of 1000-1FFF | |
| 52 | 52 | |
| 53 | 53 | The Palladium VCG memory map is as follows. |
| 54 | 0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) | |
| 55 | 1000 - 17FF could be ROM or RAM but no Cartridge uses this | |
| 56 | 1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) | |
| 57 | 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits | |
| 58 | 18D0 - 18EF Free for user programs. | |
| 59 | 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 | |
| 60 | 18F8 - 1908 registers of UVI | |
| 61 | 1909 - 197F Unmapped | |
| 62 | 1980 - 19BF User defined characters (8 possible, 8 bytes per character) | |
| 63 | 19C0 - 19F7 Unmapped | |
| 64 | 19F8 - 19FF registers of UVI | |
| 65 | 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits | |
| 66 | 1AD0 - 1AFF User memory | |
| 67 | 1B00 - 1BFF mirror of 1900-19FF | |
| 68 | 1C00 - 1FFF could be ROM or RAM but no Cartridge uses this | |
| 69 | 2000 - 2FFF 4k ROM Block (for 8k carts such as Jungler) | |
| 70 | 3000 - 3FFF could be ROM or RAM but no Cartridge uses this | |
| 71 | 4000 - 4FFF 4k ROM Block (first 2K used by Golf) | |
| 72 | 5000 - 5FFF 4k ROM Block | |
| 73 | 6000 - 6FFF 4k ROM Block | |
| 74 | 7000 - 7FFF 4k ROM Block | |
| 54 | 0000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge) | |
| 55 | 1000 - 17FF could be ROM or RAM but no Cartridge uses this | |
| 56 | 1800 - 1BFF UVI2637 Area (detail description in video/arcadia.c) | |
| 57 | 1800 - 18CF Screen display , upper 13 lines, characters/palette high bits | |
| 58 | 18D0 - 18EF Free for user programs. | |
| 59 | 18F0 - 18F7 Sprite coordinates y0x0y1x1y2x2y3x3 | |
| 60 | 18F8 - 1908 registers of UVI | |
| 61 | 1909 - 197F Unmapped | |
| 62 | 1980 - 19BF User defined characters (8 possible, 8 bytes per character) | |
| 63 | 19C0 - 19F7 Unmapped | |
| 64 | 19F8 - 19FF registers of UVI | |
| 65 | 1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits | |
| 66 | 1AD0 - 1AFF User memory | |
| 67 | 1B00 - 1BFF mirror of 1900-19FF | |
| 68 | 1C00 - 1FFF could be ROM or RAM but no Cartridge uses this | |
| 69 | 2000 - 2FFF 4k ROM Block (for 8k carts such as Jungler) | |
| 70 | 3000 - 3FFF could be ROM or RAM but no Cartridge uses this | |
| 71 | 4000 - 4FFF 4k ROM Block (first 2K used by Golf) | |
| 72 | 5000 - 5FFF 4k ROM Block | |
| 73 | 6000 - 6FFF 4k ROM Block | |
| 74 | 7000 - 7FFF 4k ROM Block | |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | 3. ROM Images |
| 78 | 78 | ROM Images are loaded into 0000-0FFF. If the ROM is an 8k ROM the |
| 79 | 79 | second half of the Rom is located at 2000-2FFF. Except for the Golf cart |
| 80 | which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on | |
| 80 | which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on | |
| 81 | 81 | Palladium VCG. |
| 82 | 82 | |
| 83 | 83 | |
| r5932 | r5933 | |
| 106 | 106 | 1905 bit 3. |
| 107 | 107 | |
| 108 | 108 | Palladium has 4 additional key per keypad which are mapped at |
| 109 | 1903 palladium player 1 | |
| 110 | 1907 palladium player 2 | |
| 109 | 1903 palladium player 1 | |
| 110 | 1907 palladium player 2 | |
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | 5. Other information |
| r5932 | r5933 | |
| 417 | 417 | static const unsigned short arcadia_palette[128+8] = /* bgnd, fgnd */ |
| 418 | 418 | { |
| 419 | 419 | 0,1,2,3,4,5,6,7, |
| 420 | ||
| 420 | ||
| 421 | 421 | 0,0, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7, |
| 422 | 422 | 1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7, |
| 423 | 423 | 2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7, |
| r5932 | r5933 | |
|---|---|---|
| 116 | 116 | joy2y_timer = timer_alloc(machine, NULL, NULL); |
| 117 | 117 | |
| 118 | 118 | hold_load(machine); |
| 119 | ||
| 119 | ||
| 120 | 120 | TMS9928A_reset(); |
| 121 | 121 | } |
| 122 | 122 | |
| r5932 | r5933 | |
| 779 | 779 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 780 | 780 | |
| 781 | 781 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 782 | ||
| 782 | ||
| 783 | 783 | /* tms9901 */ |
| 784 | 784 | MDRV_TMS9901_ADD("tms9901_0", usr9901reset_param) |
| 785 | 785 | MDRV_TMS9901_ADD("tms9901_1", sys9901reset_param) |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | Everything in this driver has been worked out by reading the | |
| 8 | ROM and using the debugger, as no information is available. | |
| 7 | Everything in this driver has been worked out by reading the | |
| 8 | ROM and using the debugger, as no information is available. | |
| 9 | 9 | |
| 10 | ||
| 10 | Therefore, it is likely to be full of mistakes and omissions. | |
| 11 | 11 | |
| 12 | ||
| 12 | Note: The $ key makes a square symbol. | |
| 13 | 13 | |
| 14 | 14 | ****************************************************************************/ |
| 15 | 15 | |
| r5932 | r5933 | |
| 95 | 95 | static ADDRESS_MAP_START( bcs3_io, ADDRESS_SPACE_IO, 8) |
| 96 | 96 | ADDRESS_MAP_UNMAP_HIGH |
| 97 | 97 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 98 | // | |
| 98 | // AM_RANGE( 0xf8, 0xfb ) AM_DEVREADWRITE(Z80CTC,"z80ctc",z80ctc_r,z80ctc_w) | |
| 99 | 99 | ADDRESS_MAP_END |
| 100 | 100 | |
| 101 | 101 | /* Input ports */ |
| r5932 | r5933 | |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /* This has 100 lines of screen data. I'm assuming that it only shows a portion of this, |
| 255 | ||
| 255 | with the cursor always in sight. */ | |
| 256 | 256 | static VIDEO_UPDATE( bcs3a ) |
| 257 | 257 | { |
| 258 | 258 | UINT8 y,ra,chr,gfx,rat; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | NOTE: ****** Specbusy: press N, R, or E to boot ************* | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | Spectrum/Inves/TK90X etc. memory map: |
| r5932 | r5933 | |
| 203 | 203 | if ((scorpion_256_port_1ffd_data & 0x01)==0x01) |
| 204 | 204 | { |
| 205 | 205 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| 206 | memory_set_bankptr(machine, 1, mess_ram+(8<<14)); | |
| 207 | logerror("RAM\n"); | |
| 206 | memory_set_bankptr(machine, 1, mess_ram+(8<<14)); | |
| 207 | logerror("RAM\n"); | |
| 208 | 208 | } |
| 209 | 209 | else |
| 210 | 210 | { |
| 211 | 211 | if ((scorpion_256_port_1ffd_data & 0x02)==0x02) |
| 212 | 212 | { |
| 213 | ROMSelection = 2; | |
| 214 | } | |
| 215 | else | |
| 213 | ROMSelection = 2; | |
| 214 | } | |
| 215 | else | |
| 216 | 216 | { |
| 217 | 217 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 218 | } | |
| 218 | } | |
| 219 | 219 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 220 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x010000 + (ROMSelection<<14)); | |
| 220 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x010000 + (ROMSelection<<14)); | |
| 221 | 221 | } |
| 222 | ||
| 223 | ||
| 222 | ||
| 223 | ||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | static DIRECT_UPDATE_HANDLER( scorpion_direct ) |
| 227 | { | |
| 227 | { | |
| 228 | 228 | UINT16 pc = cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPCBASE); |
| 229 | if (betadisk_is_active(beta)) | |
| 229 | if (betadisk_is_active(beta)) | |
| 230 | 230 | { |
| 231 | if (pc >= 0x4000) | |
| 231 | if (pc >= 0x4000) | |
| 232 | 232 | { |
| 233 | 233 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 234 | 234 | betadisk_disable(beta); |
| 235 | 235 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 236 | 236 | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14)); |
| 237 | } | |
| 237 | } | |
| 238 | 238 | } else if (((pc & 0xff00) == 0x3d00) && (ROMSelection==1)) |
| 239 | 239 | { |
| 240 | 240 | ROMSelection = 3; |
| 241 | 241 | betadisk_enable(beta); |
| 242 | ||
| 243 | } | |
| 244 | if((address>=0x0000) && (address<=0x3fff)) | |
| 242 | ||
| 243 | } | |
| 244 | if((address>=0x0000) && (address<=0x3fff)) | |
| 245 | 245 | { |
| 246 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); | |
| 246 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); | |
| 247 | 247 | direct->raw = direct->decrypted = memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14); |
| 248 | 248 | memory_set_bankptr(space->machine, 1, direct->raw); |
| 249 | 249 | return ~0; |
| r5932 | r5933 | |
| 253 | 253 | |
| 254 | 254 | static TIMER_CALLBACK(nmi_check_callback) |
| 255 | 255 | { |
| 256 | if ((input_port_read(machine, "NMI") & 1)==1) | |
| 256 | if ((input_port_read(machine, "NMI") & 1)==1) | |
| 257 | 257 | { |
| 258 | 258 | scorpion_256_port_1ffd_data |= 0x02; |
| 259 | 259 | scorpion_update_memory(machine); |
| r5932 | r5933 | |
| 283 | 283 | scorpion_update_memory(space->machine); |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | ||
| 287 | static ADDRESS_MAP_START (scorpion_io, ADDRESS_SPACE_IO, 8) | |
| 286 | ||
| 287 | static ADDRESS_MAP_START (scorpion_io, ADDRESS_SPACE_IO, 8) | |
| 288 | 288 | ADDRESS_MAP_UNMAP_HIGH |
| 289 | 289 | AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_status_r,betadisk_command_w) AM_MIRROR(0xff00) |
| 290 | 290 | AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_track_r,betadisk_track_w) AM_MIRROR(0xff00) |
| 291 | 291 | AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_sector_r,betadisk_sector_w) AM_MIRROR(0xff00) |
| 292 | 292 | AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_data_r,betadisk_data_w) AM_MIRROR(0xff00) |
| 293 | AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) | |
| 293 | AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) | |
| 294 | 294 | AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_state_r, betadisk_param_w) AM_MIRROR(0xff00) |
| 295 | 295 | AM_RANGE(0x4000, 0x4000) AM_WRITE(scorpion_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 296 | 296 | AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd) |
| r5932 | r5933 | |
| 300 | 300 | |
| 301 | 301 | |
| 302 | 302 | static MACHINE_RESET( scorpion ) |
| 303 | { | |
| 303 | { | |
| 304 | 304 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 305 | beta = devtag_get_device(machine, BETA_DISK_TAG); | |
| 306 | ||
| 305 | beta = devtag_get_device(machine, BETA_DISK_TAG); | |
| 306 | ||
| 307 | 307 | memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| 308 | ||
| 308 | ||
| 309 | 309 | betadisk_disable(beta); |
| 310 | 310 | betadisk_clear_status(beta); |
| 311 | 311 | |
| 312 | memory_set_direct_update_handler(space, scorpion_direct ); | |
| 313 | ||
| 312 | memory_set_direct_update_handler(space, scorpion_direct ); | |
| 313 | ||
| 314 | 314 | memset(mess_ram,0,256*1024); |
| 315 | ||
| 315 | ||
| 316 | 316 | /* Bank 5 is always in 0x4000 - 0x7fff */ |
| 317 | 317 | memory_set_bankptr(machine, 2, mess_ram + (5<<14)); |
| 318 | 318 | |
| r5932 | r5933 | |
| 322 | 322 | spectrum_128_port_7ffd_data = 0; |
| 323 | 323 | scorpion_256_port_1ffd_data = 0; |
| 324 | 324 | |
| 325 | scorpion_update_memory(machine); | |
| 326 | ||
| 325 | scorpion_update_memory(machine); | |
| 326 | ||
| 327 | 327 | timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, nmi_check_callback); |
| 328 | 328 | } |
| 329 | 329 | |
| r5932 | r5933 | |
| 332 | 332 | MDRV_CPU_MODIFY("maincpu") |
| 333 | 333 | MDRV_CPU_IO_MAP(scorpion_io) |
| 334 | 334 | MDRV_MACHINE_RESET( scorpion ) |
| 335 | ||
| 335 | ||
| 336 | 336 | MDRV_BETA_DISK_ADD(BETA_DISK_TAG) |
| 337 | 337 | MACHINE_DRIVER_END |
| 338 | 338 | |
| r5932 | r5933 | |
| 360 | 360 | ROM_SYSTEM_BIOS(4, "v5", "ProfROM V.3.9f") |
| 361 | 361 | ROMX_LOAD( "prof_39f.rom", 0x010000, 0x20000, CRC(c55e64da) SHA1(cec7770fe26350f57f6c325a29db78787dc4521e), ROM_BIOS(5)) |
| 362 | 362 | ROM_SYSTEM_BIOS(5, "v6", "ProfROM V.4.01") |
| 363 | ROMX_LOAD( "profrom.rom", 0x010000, 0x80000, CRC(b02d89de) SHA1(4cb85341e2a400e0e88869304d80af430266cdd1), ROM_BIOS(6)) | |
| 363 | ROMX_LOAD( "profrom.rom", 0x010000, 0x80000, CRC(b02d89de) SHA1(4cb85341e2a400e0e88869304d80af430266cdd1), ROM_BIOS(6)) | |
| 364 | 364 | ROM_SYSTEM_BIOS(6, "v7", "NeOS 256") |
| 365 | 365 | ROMX_LOAD("neos_256.rom", 0x010000, 0x4000, CRC(364ae09a) SHA1(bb6db1947415503a6bc48f33c603fb3a0dbb3690), ROM_BIOS(7)) |
| 366 | 366 | ROMX_LOAD("scorp1.rom", 0x014000, 0x4000, CRC(9d513013) SHA1(367b5a102fb663beee8e7930b8c4acc219c1f7b3), ROM_BIOS(7)) |
| 367 | 367 | ROMX_LOAD("scorp2.rom", 0x018000, 0x4000, CRC(fd0d3ce1) SHA1(07783ee295274d8ff15d935bfd787c8ac1d54900), ROM_BIOS(7)) |
| 368 | 368 | ROMX_LOAD("scorp3.rom", 0x01c000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db), ROM_BIOS(7)) |
| 369 | 369 | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 370 | ||
| 370 | ||
| 371 | 371 | ROM_REGION(0x01000, "keyboard", 0) |
| 372 | ROM_LOAD( "scrpkey.rom", 0x0000, 0x1000, CRC(e938a510) SHA1(2753993c97ff0fc6cff26ed792929abc1288dc6f)) | |
| 372 | ROM_LOAD( "scrpkey.rom", 0x0000, 0x1000, CRC(e938a510) SHA1(2753993c97ff0fc6cff26ed792929abc1288dc6f)) | |
| 373 | 373 | |
| 374 | 374 | ROM_REGION(0x010000, "gsound", 0) |
| 375 | 375 | ROM_LOAD( "gs104.rom", 0x0000, 0x8000, CRC(7a365ba6) SHA1(c865121306eb3a7d811d82fbcc653b4dc1d6fa3d)) |
| r5932 | r5933 | |
| 385 | 385 | ROM_SYSTEM_BIOS(2, "v3", "ver 3") |
| 386 | 386 | ROMX_LOAD( "profi-p1.rom", 0x010000, 0x10000, CRC(537ddb81) SHA1(00a23e8dc722b248d4f98cb14a600ce7487f2b9c), ROM_BIOS(3)) |
| 387 | 387 | ROM_SYSTEM_BIOS(3, "v4", "ver 4") |
| 388 | ROMX_LOAD( "profi_1.rom", 0x010000, 0x10000, CRC(f07fbee8) SHA1(b29c81a94658a4d50274ba953775a49e855534de), ROM_BIOS(4)) | |
| 389 | ROM_SYSTEM_BIOS(4, "v5", "T-Rex") | |
| 388 | ROMX_LOAD( "profi_1.rom", 0x010000, 0x10000, CRC(f07fbee8) SHA1(b29c81a94658a4d50274ba953775a49e855534de), ROM_BIOS(4)) | |
| 389 | ROM_SYSTEM_BIOS(4, "v5", "T-Rex") | |
| 390 | 390 | ROMX_LOAD( "profi-p.rom", 0x010000, 0x10000, CRC(314f6b57) SHA1(1507f53ec64dcf5154b5cfce6922f69f70296a53), ROM_BIOS(5)) |
| 391 | 391 | ROM_SYSTEM_BIOS(5, "v6", "JV Kramis V0.2") |
| 392 | 392 | ROMX_LOAD( "profi32.rom", 0x010000, 0x10000, CRC(77327f52) SHA1(019bd00cc7939741d99b99beac6ae1298652e652), ROM_BIOS(6)) |
| 393 | 393 | ROM_SYSTEM_BIOS(6, "v7", "Power Of Sound Group") |
| 394 | ROMX_LOAD( "profi1k.rom", 0x010000, 0x10000, CRC(a932676f) SHA1(907ac56219f325949a7c2fe8168799d9cdd5ba6c), ROM_BIOS(7)) | |
| 394 | ROMX_LOAD( "profi1k.rom", 0x010000, 0x10000, CRC(a932676f) SHA1(907ac56219f325949a7c2fe8168799d9cdd5ba6c), ROM_BIOS(7)) | |
| 395 | 395 | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 396 | 396 | ROM_END |
| 397 | 397 | |
| 398 | 398 | ROM_START(quorum) |
| 399 | 399 | ROM_REGION(0x020000, "maincpu", 0) |
| 400 | ROM_LOAD("qu7v42.rom", 0x010000, 0x10000, CRC(e950eee5) SHA1(f8e22672722b0038689c6c8bc4acf5392acc9d8c)) | |
| 400 | ROM_LOAD("qu7v42.rom", 0x010000, 0x10000, CRC(e950eee5) SHA1(f8e22672722b0038689c6c8bc4acf5392acc9d8c)) | |
| 401 | 401 | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 402 | 402 | ROM_END |
| 403 | 403 | |
| 404 | 404 | ROM_START( kay1024 ) |
| 405 | 405 | ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF) |
| 406 | 406 | ROM_SYSTEM_BIOS(0, "v1", "ver 1") |
| 407 | ROMX_LOAD( "kay98.rom", 0x010000, 0x08000, CRC(7fbf2d43) SHA1(e555f2ed01ecf2231d493bd70a4d79b436e9f10e), ROM_BIOS(1)) | |
| 407 | ROMX_LOAD( "kay98.rom", 0x010000, 0x08000, CRC(7fbf2d43) SHA1(e555f2ed01ecf2231d493bd70a4d79b436e9f10e), ROM_BIOS(1)) | |
| 408 | 408 | ROMX_LOAD( "trd503.rom", 0x01c000, 0x04000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c), ROM_BIOS(1)) |
| 409 | 409 | ROM_SYSTEM_BIOS(1, "v2", "Kramis V0.2") |
| 410 | 410 | ROMX_LOAD( "kay1024b.rom", 0x010000, 0x10000, CRC(ab99c31e) SHA1(cfa9e6553aea72956fce4f0130c007981d684734), ROM_BIOS(2)) |
| r5932 | r5933 | |
|---|---|---|
| 45 | 45 | 74S263 - Texas Instruments SN74S263N Row Output Character Generator |
| 46 | 46 | MC1488 - Texas Instruments MC1488 Quadruple Line Driver |
| 47 | 47 | MC1489 - Texas Instruments MC1489 Quadruple Line Receiver |
| 48 | ||
| 48 | 8205 - ? | |
| 49 | 49 | CN1 - RS-232 connector |
| 50 | 50 | CN2 - ABC bus connector (DIN 41612) |
| 51 | 51 | CN3 - video connector |
| r5932 | r5933 | |
| 62 | 62 | |
| 63 | 63 | TODO: |
| 64 | 64 | |
| 65 | - memory bank switching using ABC80/13 PROM | |
| 66 | - proper keyboard controller emulation | |
| 67 | - get BASIC v1 dump | |
| 68 | - MyAB 80-column card | |
| 69 | - GeJo 80-column card | |
| 70 | - Mikrodatorn 64K expansion | |
| 65 | - memory bank switching using ABC80/13 PROM | |
| 66 | - proper keyboard controller emulation | |
| 67 | - get BASIC v1 dump | |
| 68 | - MyAB 80-column card | |
| 69 | - GeJo 80-column card | |
| 70 | - Mikrodatorn 64K expansion | |
| 71 | 71 | - floppy |
| 72 | 72 | - printer |
| 73 | 73 | - IEC |
| r5932 | r5933 | |
| 97 | 97 | { |
| 98 | 98 | /* |
| 99 | 99 | |
| 100 | ||
| 100 | Bit Name Description | |
| 101 | 101 | |
| 102 | 0 SYSENA 1 On, 0 Off (inverted) | |
| 103 | 1 EXTVCO 00 High freq, 01 Low freq | |
| 104 | 2 VCOSEL 10 SLF cntrl, 11 SLF ctrl | |
| 105 | 3 MIXSELB 000 VCO, 001 Noise, 010 SLF | |
| 106 | 4 MIXSELA 011 VCO+Noise, 100 SLF+Noise, 101 SLF+VCO | |
| 107 | 5 MIXSELC 110 SLF+VCO+Noise, 111 Quiet | |
| 108 | 6 ENVSEL2 00 VCO, 01 Rakt igenom | |
| 109 | 7 ENVSEL1 10 Monovippa, 11 VCO alt.pol. | |
| 102 | 0 SYSENA 1 On, 0 Off (inverted) | |
| 103 | 1 EXTVCO 00 High freq, 01 Low freq | |
| 104 | 2 VCOSEL 10 SLF cntrl, 11 SLF ctrl | |
| 105 | 3 MIXSELB 000 VCO, 001 Noise, 010 SLF | |
| 106 | 4 MIXSELA 011 VCO+Noise, 100 SLF+Noise, 101 SLF+VCO | |
| 107 | 5 MIXSELC 110 SLF+VCO+Noise, 111 Quiet | |
| 108 | 6 ENVSEL2 00 VCO, 01 Rakt igenom | |
| 109 | 7 ENVSEL1 10 Monovippa, 11 VCO alt.pol. | |
| 110 | 110 | |
| 111 | ||
| 111 | */ | |
| 112 | 112 | const device_config *sn76477 = devtag_get_device(space->machine, "sn76477"); |
| 113 | 113 | |
| 114 | 114 | sn76477_enable_w(sn76477, ~data & 0x01); |
| r5932 | r5933 | |
| 374 | 374 | { |
| 375 | 375 | /* |
| 376 | 376 | |
| 377 | ||
| 377 | PIO Port A | |
| 378 | 378 | |
| 379 | ||
| 379 | bit description | |
| 380 | 380 | |
| 381 | 0 keyboard data | |
| 382 | 1 keyboard data | |
| 383 | 2 keyboard data | |
| 384 | 3 keyboard data | |
| 385 | 4 keyboard data | |
| 386 | 5 keyboard data | |
| 387 | 6 keyboard data | |
| 388 | 7 keyboard strobe | |
| 381 | 0 keyboard data | |
| 382 | 1 keyboard data | |
| 383 | 2 keyboard data | |
| 384 | 3 keyboard data | |
| 385 | 4 keyboard data | |
| 386 | 5 keyboard data | |
| 387 | 6 keyboard data | |
| 388 | 7 keyboard strobe | |
| 389 | 389 | |
| 390 | ||
| 390 | */ | |
| 391 | 391 | |
| 392 | 392 | abc80_state *state = device->machine->driver_data; |
| 393 | 393 | |
| r5932 | r5933 | |
| 398 | 398 | { |
| 399 | 399 | /* |
| 400 | 400 | |
| 401 | ||
| 401 | PIO Channel B | |
| 402 | 402 | |
| 403 | 0 R RS-232C RxD | |
| 404 | 1 R RS-232C _CTS | |
| 405 | 2 R RS-232C _DCD | |
| 406 | 3 W RS-232C TxD | |
| 407 | 4 W RS-232C _RTS | |
| 408 | 5 W Cassette Motor | |
| 409 | 6 W Cassette Data | |
| 410 | 7 R Cassette Data | |
| 403 | 0 R RS-232C RxD | |
| 404 | 1 R RS-232C _CTS | |
| 405 | 2 R RS-232C _DCD | |
| 406 | 3 W RS-232C TxD | |
| 407 | 4 W RS-232C _RTS | |
| 408 | 5 W Cassette Motor | |
| 409 | 6 W Cassette Data | |
| 410 | 7 R Cassette Data | |
| 411 | 411 | |
| 412 | ||
| 412 | */ | |
| 413 | 413 | |
| 414 | 414 | abc80_state *state = device->machine->driver_data; |
| 415 | 415 | |
| r5932 | r5933 | |
| 423 | 423 | { |
| 424 | 424 | /* |
| 425 | 425 | |
| 426 | ||
| 426 | PIO Channel B | |
| 427 | 427 | |
| 428 | 0 R RS-232C RxD | |
| 429 | 1 R RS-232C _CTS | |
| 430 | 2 R RS-232C _DCD | |
| 431 | 3 W RS-232C TxD | |
| 432 | 4 W RS-232C _RTS | |
| 433 | 5 W Cassette Motor | |
| 434 | 6 W Cassette Data | |
| 435 | 7 R Cassette Data | |
| 428 | 0 R RS-232C RxD | |
| 429 | 1 R RS-232C _CTS | |
| 430 | 2 R RS-232C _DCD | |
| 431 | 3 W RS-232C TxD | |
| 432 | 4 W RS-232C _RTS | |
| 433 | 5 W Cassette Motor | |
| 434 | 6 W Cassette Data | |
| 435 | 7 R Cassette Data | |
| 436 | 436 | |
| 437 | ||
| 437 | */ | |
| 438 | 438 | |
| 439 | 439 | abc80_state *state = device->machine->driver_data; |
| 440 | 440 | |
| r5932 | r5933 | |
| 549 | 549 | |
| 550 | 550 | /* cassette */ |
| 551 | 551 | MDRV_CASSETTE_ADD("cassette", default_cassette_config) |
| 552 | ||
| 552 | ||
| 553 | 553 | MDRV_FLOPPY_2_DRIVES_ADD(abc80_floppy_config) |
| 554 | 554 | MACHINE_DRIVER_END |
| 555 | 555 | |
| r5932 | r5933 | |
| 640 | 640 | |
| 641 | 641 | /* Drivers */ |
| 642 | 642 | |
| 643 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY | |
| 643 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 644 | 644 | COMP( 1978, abc80, 0, 0, abc80, abc80, 0, abc80, "Luxor Datorer AB", "ABC 80 (Sweden, Finland)", GAME_SUPPORTS_SAVE ) |
| 645 | 645 | COMP( 1978, abc80h, abc80, 0, abc80, abc80, 0, abc80, "Budapesti Radiotechnikai Gyar", "ABC 80 (Hungary)", GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 257 | 257 | |
| 258 | 258 | static INPUT_PORTS_START( pmd85 ) |
| 259 | 259 | PORT_START("KEY0") /* port 0x00 */ |
| 260 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K0") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F1)) | |
| 260 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K0") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(F1)) | |
| 261 | 261 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 262 | 262 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 263 | 263 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 264 | 264 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 265 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 266 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 267 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 265 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 266 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 267 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 268 | 268 | |
| 269 | 269 | PORT_START("KEY1") /* port 0x01 */ |
| 270 | 270 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| r5932 | r5933 | |
| 272 | 272 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 273 | 273 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 274 | 274 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 275 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 276 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 277 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 275 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 276 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 277 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 278 | 278 | |
| 279 | 279 | PORT_START("KEY2") /* port 0x02 */ |
| 280 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) | |
| 280 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) | |
| 281 | 281 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 282 | 282 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 283 | 283 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 284 | 284 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 285 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 286 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 287 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 285 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 286 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 287 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 288 | 288 | |
| 289 | 289 | PORT_START("KEY3") /* port 0x03 */ |
| 290 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F4)) | |
| 290 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F4)) | |
| 291 | 291 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 292 | 292 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 293 | 293 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 294 | 294 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 295 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 296 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 297 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 295 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 296 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 297 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 298 | 298 | |
| 299 | 299 | PORT_START("KEY4") /* port 0x04 */ |
| 300 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F5)) | |
| 300 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F5)) | |
| 301 | 301 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 302 | 302 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 303 | 303 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| 304 | 304 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 305 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 306 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 307 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 305 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 306 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 307 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 308 | 308 | |
| 309 | 309 | PORT_START("KEY5") /* port 0x05 */ |
| 310 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F6)) | |
| 310 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F6)) | |
| 311 | 311 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 312 | 312 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 313 | 313 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') |
| 314 | 314 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 315 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 316 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 317 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 315 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 316 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 317 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 318 | 318 | |
| 319 | 319 | PORT_START("KEY6") /* port 0x06 */ |
| 320 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F7)) | |
| 320 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F7)) | |
| 321 | 321 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 322 | 322 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') |
| 323 | 323 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 324 | 324 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 325 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 326 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 327 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 325 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 326 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 327 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 328 | 328 | |
| 329 | 329 | PORT_START("KEY7") /* port 0x07 */ |
| 330 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F8)) | |
| 330 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K7") PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F8)) | |
| 331 | 331 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 332 | 332 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') |
| 333 | 333 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 334 | 334 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 335 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 336 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 337 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 335 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 336 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 337 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 338 | 338 | |
| 339 | 339 | PORT_START("KEY8") /* port 0x08 */ |
| 340 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F9)) | |
| 340 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K8") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F9)) | |
| 341 | 341 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 342 | 342 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| 343 | 343 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 344 | 344 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 345 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 346 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 347 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 345 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 346 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 347 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 348 | 348 | |
| 349 | 349 | PORT_START("KEY9") /* port 0x09 */ |
| 350 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F10)) | |
| 350 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K9") PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F10)) | |
| 351 | 351 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('-') |
| 352 | 352 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 353 | 353 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') |
| 354 | 354 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 355 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 356 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 357 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 355 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 356 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 357 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 358 | 358 | |
| 359 | PORT_START("KEY10") /* port 0x0a */ | |
| 360 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F11)) | |
| 359 | PORT_START("KEY10") /* port 0x0a */ | |
| 360 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K10") PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F11)) | |
| 361 | 361 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_CHAR('=') |
| 362 | 362 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') PORT_CHAR('`') |
| 363 | 363 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') |
| 364 | 364 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 365 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 366 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 367 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 365 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 366 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 367 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 368 | 368 | |
| 369 | PORT_START("KEY11") /* port 0x0b */ | |
| 370 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F12)) | |
| 369 | PORT_START("KEY11") /* port 0x0b */ | |
| 370 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K11") PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F12)) | |
| 371 | 371 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('{') PORT_CHAR('}') |
| 372 | 372 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('^') |
| 373 | 373 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('[') PORT_CHAR(']') |
| 374 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 375 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 376 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 377 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 374 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 375 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 376 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 377 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 378 | 378 | |
| 379 | PORT_START("KEY12") /* port 0x0c */ | |
| 380 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("WRK") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) | |
| 381 | 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)) | |
| 382 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<-") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 383 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<-") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) | |
| 384 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 385 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 386 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 387 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 379 | PORT_START("KEY12") /* port 0x0c */ | |
| 380 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("WRK") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) | |
| 381 | 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)) | |
| 382 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("<-") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 383 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("|<-") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT)) | |
| 384 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 385 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 386 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 387 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 388 | 388 | |
| 389 | PORT_START("KEY13") /* port 0x0d */ | |
| 390 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C-D") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) | |
| 389 | PORT_START("KEY13") /* port 0x0d */ | |
| 390 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C-D") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) | |
| 391 | 391 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(DEL)) |
| 392 | 392 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("^\\") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 393 | 393 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("END") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(END)) |
| 394 | 394 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL1") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) |
| 395 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 396 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 397 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 395 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 396 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 397 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 398 | 398 | |
| 399 | PORT_START("KEY14") /* port 0x0e */ | |
| 399 | PORT_START("KEY14") /* port 0x0e */ | |
| 400 | 400 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) |
| 401 | 401 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RCL") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) |
| 402 | 402 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("->") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 403 | 403 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("->|") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) |
| 404 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL2") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) | |
| 405 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 406 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 407 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 404 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EOL2") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) | |
| 405 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 406 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 407 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 408 | 408 | |
| 409 | PORT_START("KEY15") /* port 0x0f */ | |
| 410 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 411 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 412 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 413 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 414 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 415 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) | |
| 409 | PORT_START("KEY15") /* port 0x0f */ | |
| 410 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 411 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 412 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 413 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 414 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 415 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) | |
| 416 | 416 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| 417 | 417 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 418 | 418 | |
| 419 | PORT_START("RESET") /* port 0x10 */ | |
| 419 | PORT_START("RESET") /* port 0x10 */ | |
| 420 | 420 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE)) |
| 421 | 421 | |
| 422 | PORT_START("DSW0") /* port 0x11 */ | |
| 422 | PORT_START("DSW0") /* port 0x11 */ | |
| 423 | 423 | PORT_CONFNAME( 0x01, 0x00, "Basic ROM Module" ) |
| 424 | 424 | PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) |
| 425 | 425 | PORT_CONFSETTING( 0x01, DEF_STR( On ) ) |
| r5932 | r5933 | |
| 438 | 438 | |
| 439 | 439 | |
| 440 | 440 | static INPUT_PORTS_START (mato) |
| 441 | PORT_START("KEY0") /* port 0x00 */ | |
| 441 | PORT_START("KEY0") /* port 0x00 */ | |
| 442 | 442 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 443 | 443 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('\"') |
| 444 | 444 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* Olivetti M20 skeleton driver, by incog (19/05/2009) */ |
| 2 | ||
| 2 | ||
| 3 | 3 | #include "driver.h" |
| 4 | 4 | #include "cpu/z8000/z8000.h" |
| 5 | ||
| 5 | ||
| 6 | 6 | #define MAIN_CLOCK 4000000 /* 4 MHz */ |
| 7 | ||
| 8 | ||
| 7 | ||
| 8 | ||
| 9 | 9 | static ADDRESS_MAP_START(m20_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 10 | 10 | ADDRESS_MAP_UNMAP_HIGH |
| 11 | 11 | AM_RANGE( 0x0000, 0x1fff ) AM_ROM |
| 12 | 12 | AM_RANGE( 0x2000, 0xffff ) AM_RAM |
| 13 | 13 | ADDRESS_MAP_END |
| 14 | ||
| 14 | ||
| 15 | 15 | static ADDRESS_MAP_START( m20_io , ADDRESS_SPACE_IO, 16) |
| 16 | 16 | ADDRESS_MAP_UNMAP_HIGH |
| 17 | 17 | ADDRESS_MAP_END |
| 18 | ||
| 18 | ||
| 19 | 19 | static INPUT_PORTS_START( m20 ) |
| 20 | 20 | INPUT_PORTS_END |
| 21 | ||
| 21 | ||
| 22 | 22 | static DRIVER_INIT( m20 ) |
| 23 | 23 | { |
| 24 | 24 | } |
| 25 | ||
| 25 | ||
| 26 | 26 | static MACHINE_RESET( m20 ) |
| 27 | 27 | { |
| 28 | 28 | } |
| 29 | ||
| 29 | ||
| 30 | 30 | static VIDEO_START( m20 ) |
| 31 | 31 | { |
| 32 | 32 | } |
| 33 | ||
| 33 | ||
| 34 | 34 | static VIDEO_UPDATE( m20 ) |
| 35 | 35 | { |
| 36 | 36 | return 0; |
| 37 | 37 | } |
| 38 | ||
| 38 | ||
| 39 | 39 | static MACHINE_DRIVER_START( m20 ) |
| 40 | 40 | /* basic machine hardware */ |
| 41 | 41 | MDRV_CPU_ADD("maincpu", Z8000, MAIN_CLOCK) |
| 42 | 42 | MDRV_CPU_PROGRAM_MAP(m20_mem) |
| 43 | 43 | MDRV_CPU_IO_MAP(m20_io) |
| 44 | ||
| 44 | ||
| 45 | 45 | MDRV_MACHINE_RESET(m20) |
| 46 | ||
| 46 | ||
| 47 | 47 | /* video hardware */ |
| 48 | 48 | MDRV_SCREEN_ADD("screen", RASTER) |
| 49 | 49 | MDRV_SCREEN_REFRESH_RATE(60) |
| 50 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ | |
| 50 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ | |
| 51 | 51 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 52 | 52 | MDRV_SCREEN_SIZE(512, 256) |
| 53 | 53 | MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) |
| 54 | 54 | MDRV_PALETTE_LENGTH(2) |
| 55 | 55 | MDRV_PALETTE_INIT(black_and_white) |
| 56 | ||
| 56 | ||
| 57 | 57 | MDRV_VIDEO_START(m20) |
| 58 | 58 | MDRV_VIDEO_UPDATE(m20) |
| 59 | 59 | MACHINE_DRIVER_END |
| 60 | ||
| 60 | ||
| 61 | 61 | ROM_START(m20) |
| 62 | 62 | ROM_REGION(0x12000,"maincpu",0) |
| 63 | 63 | ROM_SYSTEM_BIOS( 0, "m20", "M20 1.0" ) |
| r5932 | r5933 | |
| 81 | 81 | ROM_SYSTEM_BIOS( 3, "m40-60", "M40 6.0" ) |
| 82 | 82 | ROMX_LOAD( "m40rom-6.0", 0x0000, 0x4000, CRC(8114ebec) SHA1(4e2c65b95718c77a87dbee0288f323bd1c8837a3), ROM_BIOS(4)) |
| 83 | 83 | ROM_END |
| 84 | ||
| 85 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 84 | ||
| 85 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 86 | 86 | COMP( 1981, m20, 0, 0, m20, m20, m20, 0, "Olivetti", "Olivetti L1 M20", GAME_NOT_WORKING) |
| 87 | 87 | COMP( 1981, m40, m20, 0, m20, m20, m20, 0, "Olivetti", "Olivetti L1 M40", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 666 | 666 | ROMX_LOAD( "boot80k_v1.bin", 0x0000, 0x0800, CRC(f42d2342) SHA1(8aa1b3b056e311674a051ffc6a49af60cae409f3), ROM_BIOS(1)) |
| 667 | 667 | ROM_SYSTEM_BIOS(1, "v2", "V2") |
| 668 | 668 | ROMX_LOAD( "boot80k_v2.bin", 0x0000, 0x0800, CRC(df6bd954) SHA1(5b858b59e697d0368ea631ead14f5b2aa7954ccd), ROM_BIOS(2)) |
| 669 | ROM_SYSTEM_BIOS(2, "v3", "V3") | |
| 669 | ROM_SYSTEM_BIOS(2, "v3", "V3") | |
| 670 | 670 | ROMX_LOAD( "boot80k_v3.bin", 0x0000, 0x0800, CRC(8580494c) SHA1(91af3f3fa50f2071f8ff081536bdf7e21e9823d9), ROM_BIOS(3)) |
| 671 | 671 | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 672 | 672 | ROM_END |
| r5932 | r5933 | |
|---|---|---|
| 46 | 46 | * right gives lower numbers, and twisting to the left gives larger numbers. |
| 47 | 47 | * Paddle games like Clowns have more intuitive behavior -- twisting to the |
| 48 | 48 | * right moves the character right. |
| 49 | * | |
| 49 | * | |
| 50 | 50 | * There is a 24-key keypad on the system itself (6 rows, 4 columns). It is |
| 51 | 51 | * labeled for the built-in calculator, but overlays were released for other |
| 52 | 52 | * programs, the most popular being the BASIC cartridges, which allowed a |
| r5932 | r5933 | |
| 167 | 167 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 168 | 168 | MDRV_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4) |
| 169 | 169 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 170 | ||
| 170 | ||
| 171 | 171 | MDRV_CARTSLOT_ADD("cart") |
| 172 | 172 | MACHINE_DRIVER_END |
| 173 | 173 |
| r5932 | r5933 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | TODO: |
| 22 | 22 | |
| 23 | ||
| 23 | - move static variables to driver state | |
| 24 | 24 | - fix floppy interface |
| 25 | 25 | - fix mouse |
| 26 | 26 | - MSA disk image support |
| r5932 | r5933 | |
| 1846 | 1846 | MDRV_ACIA6850_ADD("acia_1", acia_midi_intf) |
| 1847 | 1847 | |
| 1848 | 1848 | MDRV_WD1772_ADD(WD1772_TAG, atarist_wd17xx_interface ) |
| 1849 | ||
| 1849 | ||
| 1850 | 1850 | MDRV_FLOPPY_2_DRIVES_ADD(atarist_floppy_config) |
| 1851 | 1851 | |
| 1852 | 1852 | MDRV_IMPORT_FROM(atarist_cartslot) |
| r5932 | r5933 | |
| 1910 | 1910 | MDRV_ACIA6850_ADD("acia_1", acia_midi_intf) |
| 1911 | 1911 | |
| 1912 | 1912 | MDRV_WD1772_ADD(WD1772_TAG, atarist_wd17xx_interface ) |
| 1913 | ||
| 1913 | ||
| 1914 | 1914 | MDRV_FLOPPY_2_DRIVES_ADD(atarist_floppy_config) |
| 1915 | 1915 | |
| 1916 | 1916 | MDRV_IMPORT_FROM(atarist_cartslot) |
| r5932 | r5933 | |
| 1968 | 1968 | MDRV_ACIA6850_ADD("acia_1", acia_midi_intf) |
| 1969 | 1969 | |
| 1970 | 1970 | MDRV_WD1772_ADD(WD1772_TAG, atarist_wd17xx_interface ) |
| 1971 | ||
| 1971 | ||
| 1972 | 1972 | MDRV_FLOPPY_2_DRIVES_ADD(atarist_floppy_config) |
| 1973 | 1973 | |
| 1974 | 1974 | MDRV_IMPORT_FROM(atarist_cartslot) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Canon Cat driver by Miodrag Milanovic |
| 4 | 4 | |
| 5 | 5 | 12/06/2009 Skeleton driver. |
| r5932 | r5933 | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | static WRITE16_HANDLER( cat_test_mode_w ) |
| 26 | { | |
| 26 | { | |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | static READ16_HANDLER( cat_modem_r ) |
| r5932 | r5933 | |
| 56 | 56 | { |
| 57 | 57 | UINT16 retVal = 0; |
| 58 | 58 | // Read country code |
| 59 | if (pr_cont == 0x0900) | |
| 59 | if (pr_cont == 0x0900) | |
| 60 | 60 | { |
| 61 | retVal = input_port_read(space->machine, "DIPSW1"); | |
| 61 | retVal = input_port_read(space->machine, "DIPSW1"); | |
| 62 | 62 | } |
| 63 | 63 | // Regular keyboard read |
| 64 | if (pr_cont == 0x0800 || pr_cont == 0x0a00) | |
| 64 | if (pr_cont == 0x0800 || pr_cont == 0x0a00) | |
| 65 | 65 | { |
| 66 | 66 | retVal=0xff00; |
| 67 | switch(keyboard_line) | |
| 67 | switch(keyboard_line) | |
| 68 | 68 | { |
| 69 | 69 | case 0x01: retVal = input_port_read(space->machine, "LINE0") << 8; break; |
| 70 | 70 | case 0x02: retVal = input_port_read(space->machine, "LINE1") << 8; break; |
| r5932 | r5933 | |
| 79 | 79 | return retVal; |
| 80 | 80 | } |
| 81 | 81 | static WRITE16_HANDLER( cat_keyboard_w ) |
| 82 | { | |
| 82 | { | |
| 83 | 83 | keyboard_line = data >> 8; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | static WRITE16_HANDLER( cat_video_w ) |
| 87 | 87 | { |
| 88 | /* | |
| 88 | /* | |
| 89 | 89 | 006500AE , ( HSS HSync Strart 89 ) |
| 90 | 90 | 006480C2 , ( HST End HSync 96 ) |
| 91 | 91 | 006400CE , ( HSE End H Line 104 ) |
| r5932 | r5933 | |
| 115 | 115 | AM_RANGE(0x0080000e, 0x0080000f) AM_READWRITE(cat_battery_r,cat_printer_w) |
| 116 | 116 | AM_RANGE(0x00810000, 0x0081001f) AM_DEVREADWRITE8( "duart68681", duart68681_r, duart68681_w, 0xff ) |
| 117 | 117 | AM_RANGE(0x00820000, 0x008200ff) AM_READWRITE(cat_modem_r, cat_modem_w)// modem |
| 118 | AM_RANGE(0x00840000, 0x00840001) AM_WRITE(cat_video_status_w) // Video status | |
| 119 | AM_RANGE(0x00860000, 0x00860001) AM_WRITE(cat_test_mode_w) // Test mode | |
| 118 | AM_RANGE(0x00840000, 0x00840001) AM_WRITE(cat_video_status_w) // Video status | |
| 119 | AM_RANGE(0x00860000, 0x00860001) AM_WRITE(cat_test_mode_w) // Test mode | |
| 120 | 120 | ADDRESS_MAP_END |
| 121 | 121 | |
| 122 | 122 | static UINT16 *swyft_video_ram; |
| r5932 | r5933 | |
| 124 | 124 | static ADDRESS_MAP_START(swyft_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 125 | 125 | ADDRESS_MAP_UNMAP_HIGH |
| 126 | 126 | AM_RANGE(0x00000000, 0x0000ffff) AM_ROM // 64 KB ROM |
| 127 | AM_RANGE(0x00040000, 0x000fffff) AM_RAM AM_BASE(&swyft_video_ram) | |
| 127 | AM_RANGE(0x00040000, 0x000fffff) AM_RAM AM_BASE(&swyft_video_ram) | |
| 128 | 128 | ADDRESS_MAP_END |
| 129 | 129 | |
| 130 | 130 | /* Input ports */ |
| r5932 | r5933 | |
| 153 | 153 | PORT_DIPSETTING( 0x7200, "South Africa" ) |
| 154 | 154 | PORT_DIPSETTING( 0x7100, "Switzerland" ) |
| 155 | 155 | PORT_DIPSETTING( 0x7000, "ASCII" ) |
| 156 | ||
| 156 | ||
| 157 | 157 | PORT_START("LINE0") |
| 158 | 158 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 159 | 159 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| r5932 | r5933 | |
| 250 | 250 | return M68K_INT_ACK_AUTOVECTOR; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | static MACHINE_RESET(cat) | |
| 254 | { | |
| 253 | static MACHINE_RESET(cat) | |
| 254 | { | |
| 255 | 255 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), cat_int_ack); |
| 256 | 256 | timer_pulse(machine, ATTOTIME_IN_HZ(120), NULL, 0, keyboard_callback); |
| 257 | 257 | } |
| r5932 | r5933 | |
| 264 | 264 | { |
| 265 | 265 | UINT16 code; |
| 266 | 266 | int y, x, b; |
| 267 | ||
| 268 | int addr = 0; | |
| 269 | if (video_enable == 1) | |
| 267 | ||
| 268 | int addr = 0; | |
| 269 | if (video_enable == 1) | |
| 270 | 270 | { |
| 271 | 271 | for (y = 0; y < 344; y++) |
| 272 | 272 | { |
| 273 | 273 | int horpos = 0; |
| 274 | 274 | for (x = 0; x < 42; x++) |
| 275 | { | |
| 275 | { | |
| 276 | 276 | code = cat_video_ram[addr++]; |
| 277 | 277 | for (b = 15; b >= 0; b--) |
| 278 | { | |
| 278 | { | |
| 279 | 279 | *BITMAP_ADDR16(bitmap, y, horpos++) = (code >> b) & 0x01; |
| 280 | 280 | } |
| 281 | 281 | } |
| r5932 | r5933 | |
| 292 | 292 | memset(memory_get_read_ptr(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe2341), 0xff, 1); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | static MACHINE_RESET(swyft) | |
| 295 | static MACHINE_RESET(swyft) | |
| 296 | 296 | { |
| 297 | 297 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, swyft_reset); |
| 298 | 298 | |
| r5932 | r5933 | |
| 306 | 306 | { |
| 307 | 307 | UINT16 code; |
| 308 | 308 | int y, x, b; |
| 309 | ||
| 310 | int addr = 0; | |
| 309 | ||
| 310 | int addr = 0; | |
| 311 | 311 | for (y = 0; y < 242; y++) |
| 312 | 312 | { |
| 313 | 313 | int horpos = 0; |
| 314 | 314 | for (x = 0; x < 20; x++) |
| 315 | { | |
| 315 | { | |
| 316 | 316 | code = swyft_video_ram[addr++]; |
| 317 | 317 | for (b = 15; b >= 0; b--) |
| 318 | { | |
| 318 | { | |
| 319 | 319 | *BITMAP_ADDR16(bitmap, y, horpos++) = (code >> b) & 0x01; |
| 320 | 320 | } |
| 321 | 321 | } |
| r5932 | r5933 | |
| 336 | 336 | |
| 337 | 337 | static UINT8 duart_input(const device_config *device) |
| 338 | 338 | { |
| 339 | if (duart_inp != 0) | |
| 339 | if (duart_inp != 0) | |
| 340 | 340 | { |
| 341 | 341 | duart_inp = 0; |
| 342 | 342 | return 0x0e; |
| 343 | } | |
| 344 | else | |
| 343 | } | |
| 344 | else | |
| 345 | 345 | { |
| 346 | 346 | duart_inp = 0x0e; |
| 347 | 347 | return 0x00; |
| r5932 | r5933 | |
| 425 | 425 | ROM_END |
| 426 | 426 | |
| 427 | 427 | ROM_START( cat ) |
| 428 | ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF ) | |
| 428 | ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF ) | |
| 429 | 429 | // SYS ROM |
| 430 | 430 | ROM_LOAD16_BYTE( "r240l0.bin", 0x00001, 0x10000, CRC(1b89bdc4) SHA1(39c639587dc30f9d6636b46d0465f06272838432) ) |
| 431 | 431 | ROM_LOAD16_BYTE( "r240h0.bin", 0x00000, 0x10000, CRC(94f89b8c) SHA1(6c336bc30636a02c625d31f3057ec86bf4d155fc) ) |
| 432 | 432 | ROM_LOAD16_BYTE( "r240l1.bin", 0x20001, 0x10000, CRC(1a73be4f) SHA1(e2de2cb485f78963368fb8ceba8fb66ca56dba34) ) |
| 433 | 433 | ROM_LOAD16_BYTE( "r240h1.bin", 0x20000, 0x10000, CRC(898dd9f6) SHA1(93e791dd4ed7e4afa47a04df6fdde359e41c2075) ) |
| 434 | 434 | |
| 435 | ROM_REGION( 0x80000, "svrom", ROMREGION_ERASEFF ) | |
| 435 | ROM_REGION( 0x80000, "svrom", ROMREGION_ERASEFF ) | |
| 436 | 436 | ROM_END |
| 437 | 437 | |
| 438 | 438 | /* Driver */ |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | 171-5078 (C) SEGA 1983 |
| 9 | 9 | 171-5046 REV. A (C) SEGA 1983 |
| 10 | 10 | |
| 11 | |---------------------------| |----------------------------| | |
| 12 | | SW1 CN2 | |------|---------------| | SW2 CN4 | | |
| 13 | | |---| CN3 |---| | | |
| 14 | | CN1 CN5 | | |
| 15 | | | | |
| 16 | | 10.738635MHz |------------------------------| 7805 | | |
| 17 | | |---| |------------------------------| | | |
| 18 | | | | CN6 | | |
| 19 | | | 9 | | | |
| 20 | | | 9 | LS32 | | |
| 21 | | | 1 | |---------| | | |
| 22 | | | 8 | | TMM2009 | LS139 | | |
| 23 | | | A | |---------| |------------------| | | |
| 24 | | | | | Z80 | | | |
| 25 | | |---| |------------------| | | |
| 26 | | | | |
| 27 | | | | |
| 28 | | MB8118 MB8118 MB8118 MB8118 SN76489A SW3 | | |
| 29 | | MB8118 MB8118 MB8118 MB8118 LS257 LS257 | | |
| 11 | |---------------------------| |----------------------------| | |
| 12 | | SW1 CN2 | |------|---------------| | SW2 CN4 | | |
| 13 | | |---| CN3 |---| | | |
| 14 | | CN1 CN5 | | |
| 15 | | | | |
| 16 | | 10.738635MHz |------------------------------| 7805 | | |
| 17 | | |---| |------------------------------| | | |
| 18 | | | | CN6 | | |
| 19 | | | 9 | | | |
| 20 | | | 9 | LS32 | | |
| 21 | | | 1 | |---------| | | |
| 22 | | | 8 | | TMM2009 | LS139 | | |
| 23 | | | A | |---------| |------------------| | | |
| 24 | | | | | Z80 | | | |
| 25 | | |---| |------------------| | | |
| 26 | | | | |
| 27 | | | | |
| 28 | | MB8118 MB8118 MB8118 MB8118 SN76489A SW3 | | |
| 29 | | MB8118 MB8118 MB8118 MB8118 LS257 LS257 | | |
| 30 | 30 | |---------------------------------------------------------------------------------------| |
| 31 | 31 | |
| 32 | 32 | Notes: |
| 33 | 33 | All IC's shown. |
| 34 | 34 | |
| 35 | Z80 - NEC D780C-1 / Zilog Z8400A (REV.A) Z80A CPU @ 3.579545 | |
| 36 | TMS9918A- Texas Instruments TMS9918ANL Video Display Processor @ 10.738635MHz | |
| 37 | MB8118 - Fujitsu MB8118-12 16K x 1 Dynamic RAM | |
| 38 | TMM2009 - Toshiba TMM2009P-A / TMM2009P-B (REV.A) | |
| 39 | SN76489A- Texas Instruments SN76489AN Digital Complex Sound Generator @ 3.579545 | |
| 40 | CN1 - player 1 joystick connector | |
| 41 | CN2 - RF video connector | |
| 42 | CN3 - keyboard connector | |
| 43 | CN4 - power connector (+9VDC) | |
| 44 | CN5 - player 2 joystick connector | |
| 45 | CN6 - cartridge connector | |
| 46 | SW1 - TV channel select switch | |
| 47 | SW2 - power switch | |
| 48 | SW3 - hold switch | |
| 35 | Z80 - NEC D780C-1 / Zilog Z8400A (REV.A) Z80A CPU @ 3.579545 | |
| 36 | TMS9918A- Texas Instruments TMS9918ANL Video Display Processor @ 10.738635MHz | |
| 37 | MB8118 - Fujitsu MB8118-12 16K x 1 Dynamic RAM | |
| 38 | TMM2009 - Toshiba TMM2009P-A / TMM2009P-B (REV.A) | |
| 39 | SN76489A- Texas Instruments SN76489AN Digital Complex Sound Generator @ 3.579545 | |
| 40 | CN1 - player 1 joystick connector | |
| 41 | CN2 - RF video connector | |
| 42 | CN3 - keyboard connector | |
| 43 | CN4 - power connector (+9VDC) | |
| 44 | CN5 - player 2 joystick connector | |
| 45 | CN6 - cartridge connector | |
| 46 | SW1 - TV channel select switch | |
| 47 | SW2 - power switch | |
| 48 | SW3 - hold switch | |
| 49 | 49 | |
| 50 | 50 | */ |
| 51 | 51 | |
| r5932 | r5933 | |
| 53 | 53 | |
| 54 | 54 | TODO: |
| 55 | 55 | |
| 56 | - OMV keyboard | |
| 57 | - SC-3000 return instruction referenced by R when reading ports 60-7f,e0-ff | |
| 58 | - connect the PSG /READY signal | |
| 59 | - accurate video timing | |
| 56 | - OMV keyboard | |
| 57 | - SC-3000 return instruction referenced by R when reading ports 60-7f,e0-ff | |
| 58 | - connect the PSG /READY signal | |
| 59 | - accurate video timing | |
| 60 | 60 | - SP-400 serial printer |
| 61 | ||
| 61 | - SH-400 racing controller | |
| 62 | 62 | - SF-7000 serial comms |
| 63 | 63 | |
| 64 | 64 | */ |
| r5932 | r5933 | |
| 169 | 169 | |
| 170 | 170 | /* This is how the I/O ports are really mapped, but MAME does not support overlapping ranges |
| 171 | 171 | static ADDRESS_MAP_START( sc3000_io_map, ADDRESS_SPACE_IO, 8 ) |
| 172 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 173 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xdf) AM_DEVREADWRITE("ppi8255", i8255a_r, i8255a_w) | |
| 174 | AM_RANGE(0x00, 0x00) AM_MIRROR(0x7f) AM_WRITE(sn76496_0_w) | |
| 175 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xae) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w) | |
| 176 | AM_RANGE(0x01, 0x01) AM_MIRROR(0xae) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w) | |
| 177 | AM_RANGE(0x60, 0x60) AM_MIRROR(0x9f) AM_READ(sc3000_r_r) | |
| 172 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 173 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xdf) AM_DEVREADWRITE("ppi8255", i8255a_r, i8255a_w) | |
| 174 | AM_RANGE(0x00, 0x00) AM_MIRROR(0x7f) AM_WRITE(sn76496_0_w) | |
| 175 | AM_RANGE(0x00, 0x00) AM_MIRROR(0xae) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w) | |
| 176 | AM_RANGE(0x01, 0x01) AM_MIRROR(0xae) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w) | |
| 177 | AM_RANGE(0x60, 0x60) AM_MIRROR(0x9f) AM_READ(sc3000_r_r) | |
| 178 | 178 | ADDRESS_MAP_END |
| 179 | 179 | */ |
| 180 | 180 | |
| r5932 | r5933 | |
| 398 | 398 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 399 | 399 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 400 | 400 | /* |
| 401 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') | |
| 402 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') | |
| 403 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') | |
| 404 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') | |
| 405 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') | |
| 406 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') | |
| 407 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') | |
| 408 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') | |
| 409 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') | |
| 410 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') | |
| 401 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') | |
| 402 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') | |
| 403 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') | |
| 404 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') | |
| 405 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') | |
| 406 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') | |
| 407 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') | |
| 408 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') | |
| 409 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') | |
| 410 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') | |
| 411 | 411 | |
| 412 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') | |
| 413 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') | |
| 414 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') | |
| 415 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') | |
| 416 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') | |
| 417 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') | |
| 418 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') | |
| 419 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') | |
| 412 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') | |
| 413 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') | |
| 414 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') | |
| 415 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') | |
| 416 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') | |
| 417 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') | |
| 418 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') | |
| 419 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') | |
| 420 | 420 | |
| 421 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S-1") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) | |
| 422 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S-1") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) | |
| 421 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S-1") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) | |
| 422 | PORT_BIT( 0x, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("S-1") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) | |
| 423 | 423 | */ |
| 424 | 424 | PORT_START("NMI") |
| 425 | 425 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_P) PORT_CHANGED(trigger_nmi, 0) |
| r5932 | r5933 | |
| 809 | 809 | |
| 810 | 810 | static DEVICE_IMAGE_LOAD( sc3000_cart ) |
| 811 | 811 | { |
| 812 | // | |
| 812 | // const address_space *program = cputag_get_address_space(image->machine, Z80_TAG, ADDRESS_SPACE_PROGRAM); | |
| 813 | 813 | int size = image_length(image); |
| 814 | 814 | UINT8 *ptr = memory_region(image->machine, Z80_TAG); |
| 815 | 815 | |
| r5932 | r5933 | |
| 961 | 961 | MDRV_MSM8251_ADD("uart", default_msm8251_interface) |
| 962 | 962 | |
| 963 | 963 | MDRV_NEC765A_ADD(NEC765_TAG, sf7000_nec765_interface) |
| 964 | ||
| 964 | ||
| 965 | 965 | MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, sf7000_floppy_config) |
| 966 | 966 | MACHINE_DRIVER_END |
| 967 | 967 | |
| r5932 | r5933 | |
| 1027 | 1027 | SYSTEM_CONFIG_END |
| 1028 | 1028 | |
| 1029 | 1029 | static SYSTEM_CONFIG_START( sf7000 ) |
| 1030 | CONFIG_RAM_DEFAULT (64 * 1024) | |
| 1030 | CONFIG_RAM_DEFAULT (64 * 1024) | |
| 1031 | 1031 | CONFIG_DEVICE(sf7000_serial_getinfo) |
| 1032 | 1032 | SYSTEM_CONFIG_END |
| 1033 | 1033 |
| r5932 | r5933 | |
|---|---|---|
| 1355 | 1355 | { |
| 1356 | 1356 | 1, /* 1 SCSI device */ |
| 1357 | 1357 | { { SCSI_ID_4, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 4, using CD 0, and it's a CD-ROM */ |
| 1358 | // | |
| 1358 | // { SCSI_ID_2, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */ | |
| 1359 | 1359 | }; |
| 1360 | 1360 | |
| 1361 | 1361 | static const struct WD33C93interface scsi_intf = |
| r5932 | r5933 | |
|---|---|---|
| 15 | 15 | |
| 16 | 16 | /* |
| 17 | 17 | |
| 18 | ||
| 18 | TODO: | |
| 19 | 19 | |
| 20 | - floppy RECALL | |
| 21 | - keyboard (arrows, CAPS LOCK, punctuation, keypad stop) | |
| 22 | - CP/M loading crashes | |
| 23 | - ALL RAM CHIPS FAIL shows a screenful of garbage (DMA error?) | |
| 24 | - PCB layout | |
| 25 | - NEC µPD7220 (devicify Intel 82720 GDC) | |
| 26 | - NEC µPD7201 | |
| 20 | - floppy RECALL | |
| 21 | - keyboard (arrows, CAPS LOCK, punctuation, keypad stop) | |
| 22 | - CP/M loading crashes | |
| 23 | - ALL RAM CHIPS FAIL shows a screenful of garbage (DMA error?) | |
| 24 | - PCB layout | |
| 25 | - NEC ?PD7220 (devicify Intel 82720 GDC) | |
| 26 | - NEC ?PD7201 | |
| 27 | 27 | |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | 30 | /* |
| 31 | 31 | |
| 32 | Nokia Elektroniikka pj | |
| 33 | Controller ILC 9534 | |
| 32 | Nokia Elektroniikka pj | |
| 33 | Controller ILC 9534 | |
| 34 | 34 | |
| 35 | ||
| 35 | Parts: | |
| 36 | 36 | |
| 37 | 6,144 MHz xtal (CPU clock) | |
| 38 | 18,720 MHz xtal (pixel clock) | |
| 39 | 16 MHz xtal (FDC clock) | |
| 40 | Intel 8085AP (CPU) | |
| 41 | Intel 8253-5P (PIT) | |
| 42 | Intel 8275P (CRTC) | |
| 43 | Intel 8212P (I/OP) | |
| 44 | Intel 8237A-5P (DMAC) | |
| 45 | NEC µPD7220C (GDC) | |
| 46 | NEC µPD7201P (MPSC=uart) | |
| 47 | NEC µPD765 (FDC) | |
| 48 | TMS4116-15 (16Kx4 DRAM)*4 = 32KB Video RAM for 7220 | |
| 49 | 2164-6P (64Kx1 DRAM)*8 = 64KB Work RAM | |
| 37 | 6,144 MHz xtal (CPU clock) | |
| 38 | 18,720 MHz xtal (pixel clock) | |
| 39 | 16 MHz xtal (FDC clock) | |
| 40 | Intel 8085AP (CPU) | |
| 41 | Intel 8253-5P (PIT) | |
| 42 | Intel 8275P (CRTC) | |
| 43 | Intel 8212P (I/OP) | |
| 44 | Intel 8237A-5P (DMAC) | |
| 45 | NEC ?PD7220C (GDC) | |
| 46 | NEC ?PD7201P (MPSC=uart) | |
| 47 | NEC ?PD765 (FDC) | |
| 48 | TMS4116-15 (16Kx4 DRAM)*4 = 32KB Video RAM for 7220 | |
| 49 | 2164-6P (64Kx1 DRAM)*8 = 64KB Work RAM | |
| 50 | 50 | |
| 51 | DMA channels: | |
| 52 | ||
| 53 | 0 CRT | |
| 54 | 1 MPSC transmit | |
| 55 | 2 MPSC receive | |
| 56 | 3 FDC | |
| 51 | DMA channels: | |
| 57 | 52 | |
| 58 | Interrupts: | |
| 53 | 0 CRT | |
| 54 | 1 MPSC transmit | |
| 55 | 2 MPSC receive | |
| 56 | 3 FDC | |
| 59 | 57 | |
| 60 | INTR MPSC INT | |
| 61 | RST5.5 FDC IRQ | |
| 62 | RST6.5 8212 INT | |
| 63 | RST7.5 DMA EOP | |
| 58 | Interrupts: | |
| 64 | 59 | |
| 60 | INTR MPSC INT | |
| 61 | RST5.5 FDC IRQ | |
| 62 | RST6.5 8212 INT | |
| 63 | RST7.5 DMA EOP | |
| 64 | ||
| 65 | 65 | */ |
| 66 | 66 | |
| 67 | 67 | INLINE const device_config *get_floppy_image(running_machine *machine, int drive) |
| r5932 | r5933 | |
| 138 | 138 | AM_RANGE(0xff50, 0xff50) AM_MIRROR(0x8e) AM_DEVREAD(UPD765_TAG, nec765_status_r) |
| 139 | 139 | AM_RANGE(0xff51, 0xff51) AM_MIRROR(0x8e) AM_DEVREADWRITE(UPD765_TAG, nec765_data_r, nec765_data_w) |
| 140 | 140 | AM_RANGE(0xff60, 0xff67) AM_MIRROR(0x88) AM_WRITE(ls259_w) |
| 141 | // | |
| 141 | // AM_RANGE(0xff70, 0xff7f) AM_MIRROR(0x80) AM_DEVREADWRITE(UPD7220_TAG, i82720_r, i82720_w) | |
| 142 | 142 | ADDRESS_MAP_END |
| 143 | 143 | |
| 144 | 144 | /* Input Ports */ |
| r5932 | r5933 | |
| 196 | 196 | |
| 197 | 197 | PORT_START("ROW5") |
| 198 | 198 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?') |
| 199 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(' | |
| 199 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('?') PORT_CHAR('`') | |
| 200 | 200 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 201 | 201 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') |
| 202 | 202 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| r5932 | r5933 | |
| 270 | 270 | |
| 271 | 271 | UINT8 data = state->char_rom[(charcode << 4) | linecount]; |
| 272 | 272 | int i; |
| 273 | ||
| 273 | ||
| 274 | 274 | for (i = 0; i < 8; i++) |
| 275 | 275 | { |
| 276 | 276 | *BITMAP_ADDR16(tmpbitmap, y, x + i) = BIT(data, i); |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | static const i8275_interface mm1_i8275_intf = | |
| 280 | static const i8275_interface mm1_i8275_intf = | |
| 281 | 281 | { |
| 282 | 282 | SCREEN_TAG, |
| 283 | 283 | 8, |
| r5932 | r5933 | |
| 332 | 332 | 1, |
| 333 | 333 | { 0 }, |
| 334 | 334 | { 7, 6, 5, 4, 3, 2, 1, 0 }, |
| 335 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, | |
| 335 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, | |
| 336 | 336 | 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, |
| 337 | 337 | 8*16 |
| 338 | 338 | }; |
| r5932 | r5933 | |
| 370 | 370 | static DMA8237_MEM_READ( memory_dma_r ) |
| 371 | 371 | { |
| 372 | 372 | const address_space *program = cputag_get_address_space(device->machine, I8085A_TAG, ADDRESS_SPACE_PROGRAM); |
| 373 | // | |
| 373 | // logerror("DMA read %04x\n", offset); | |
| 374 | 374 | return memory_read_byte(program, offset); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | static DMA8237_MEM_WRITE( memory_dma_w ) |
| 378 | 378 | { |
| 379 | 379 | const address_space *program = cputag_get_address_space(device->machine, I8085A_TAG, ADDRESS_SPACE_PROGRAM); |
| 380 | // | |
| 380 | // logerror("DMA write %04x:%02x\n", offset, data); | |
| 381 | 381 | memory_write_byte(program, offset, data); |
| 382 | 382 | } |
| 383 | 383 | |
| r5932 | r5933 | |
| 394 | 394 | |
| 395 | 395 | /* clear data request */ |
| 396 | 396 | dma8237_drq_write(state->i8237, DMA_MPSC_RX, CLEAR_LINE); |
| 397 | ||
| 397 | ||
| 398 | 398 | return upd7201_hai_r(state->upd7201, 0); |
| 399 | 399 | } |
| 400 | 400 | |
| r5932 | r5933 | |
| 445 | 445 | tc_w |
| 446 | 446 | }; |
| 447 | 447 | |
| 448 | /* | |
| 448 | /* ?PD765 Interface */ | |
| 449 | 449 | |
| 450 | 450 | static NEC765_DMA_REQUEST( drq_w ) |
| 451 | 451 | { |
| r5932 | r5933 | |
| 509 | 509 | } |
| 510 | 510 | }; |
| 511 | 511 | |
| 512 | /* | |
| 512 | /* ?PD7201 Interface */ | |
| 513 | 513 | |
| 514 | 514 | static WRITE_LINE_DEVICE_HANDLER( drq2_w ) |
| 515 | 515 | { |
| r5932 | r5933 | |
| 670 | 670 | /* get key data from PROM */ |
| 671 | 671 | keydata = state->key_rom[(ctrl << 8) | (shift << 7) | (state->drive << 3) | (state->sense)]; |
| 672 | 672 | } |
| 673 | ||
| 673 | ||
| 674 | 674 | if (state->keydata != keydata) |
| 675 | 675 | { |
| 676 | 676 | /* latch key data */ |
| r5932 | r5933 | |
| 744 | 744 | MDRV_PIT8253_ADD(I8253_TAG, mm1_pit8253_intf) |
| 745 | 745 | MDRV_NEC765A_ADD(UPD765_TAG, /* XTAL_16MHz/2/2, */ mm1_nec765_intf) |
| 746 | 746 | MDRV_UPD7201_ADD(UPD7201_TAG, XTAL_6_144MHz/2, mm1_upd7201_intf) |
| 747 | ||
| 747 | ||
| 748 | 748 | MDRV_FLOPPY_2_DRIVES_ADD(mm1_floppy_config) |
| 749 | 749 | MACHINE_DRIVER_END |
| 750 | 750 | |
| r5932 | r5933 | |
| 762 | 762 | |
| 763 | 763 | /* |
| 764 | 764 | |
| 765 | ||
| 765 | Address Decoder PROM outputs | |
| 766 | 766 | |
| 767 | D0 IOEN/_MEMEN | |
| 768 | D1 RAMEN | |
| 769 | D2 not connected | |
| 770 | D3 _CE4 | |
| 771 | D4 _CE0 | |
| 772 | D5 _CE1 | |
| 773 | D6 _CE2 | |
| 774 | D7 _CE3 | |
| 767 | D0 IOEN/_MEMEN | |
| 768 | D1 RAMEN | |
| 769 | D2 not connected | |
| 770 | D3 _CE4 | |
| 771 | D4 _CE0 | |
| 772 | D5 _CE1 | |
| 773 | D6 _CE2 | |
| 774 | D7 _CE3 | |
| 775 | 775 | |
| 776 | ||
| 776 | */ | |
| 777 | 777 | ROM_REGION( 0x200, "address", 0 ) /* address decoder */ |
| 778 | 778 | ROM_LOAD( "720793a.ic24", 0x0000, 0x0200, CRC(deea87a6) SHA1(8f19e43252c9a0b1befd02fc9d34fe1437477f3a) ) |
| 779 | 779 | |
| r5932 | r5933 | |
| 798 | 798 | |
| 799 | 799 | /* System Drivers */ |
| 800 | 800 | |
| 801 | // YEAR NAME | |
| 801 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS | |
| 802 | 802 | COMP( 1981, mm1m6, 0, 0, mm1m6, mm1, 0, mm1m6, "Nokia Data", "MikroMikko 1 M6", GAME_NOT_WORKING ) |
| 803 | 803 | COMP( 1981, mm1m7, mm1m6, 0, mm1m6, mm1, 0, mm1m7, "Nokia Data", "MikroMikko 1 M7", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 3 | 3 | NEC PC-98 computer series |
| 4 | 4 | |
| 5 | 5 | This series features a huge number of models released between 1982 and 1997. They |
| 6 | were not IBM PC-compatible, but they had similar hardware (and software: in the | |
| 6 | were not IBM PC-compatible, but they had similar hardware (and software: in the | |
| 7 | 7 | 1990s, they run MS Windows as OS) |
| 8 | 8 | |
| 9 | ||
| 9 | Models: | |
| 10 | 10 | |
| 11 | 11 | | CPU | RAM | Drives | CBus| Release | |
| 12 | 12 | PC-9801 | 8086 @ 5 | 128 KB | - | 6 | 1982/10 | |
| 13 | 13 | PC-9801F1 | 8086-2 @ 5/8 | 128 KB | 5"2DDx1 | 4 | 1983/10 | |
| 14 | PC-9801F2 | 8086-2 @ 5/8 | 128 KB | 5"2DDx2 | 4 | 1983/10 | | |
| 15 | PC-9801E | 8086-2 @ 5/8 | 128 KB | - | 6 | 1983/11 | | |
| 14 | PC-9801F2 | 8086-2 @ 5/8 | 128 KB | 5"2DDx2 | 4 | 1983/10 | | |
| 15 | PC-9801E | 8086-2 @ 5/8 | 128 KB | - | 6 | 1983/11 | | |
| 16 | 16 | PC-9801F3 | 8086-2 @ 5/8 | 256 KB | 5"2DDx1, 10M SASI HDD | 2 | 1984/10 | |
| 17 | 17 | PC-9801M2 | 8086-2 @ 5/8 | 256 KB | 5"2HDx2 | 4 | 1984/11 | |
| 18 | 18 | PC-9801M3 | 8086-2 @ 5/8 | 256 KB | 5"2HDx1, 20M SASI HDD | 3 | 1985/02 | |
| 19 | 19 | PC-9801U2 | V30 @ 8 | 128 KB | 3.5"2HDx2 | 2 | 1985/05 | |
| 20 | 20 | PC-98XA1 | 80286 @ 8 | 512 KB | - | 6 | 1985/05 | |
| 21 | 21 | PC-98XA2 | 80286 @ 8 | 512 KB | 5"2DD/2HDx2 | 6 | 1985/05 | |
| 22 | PC-98XA3 | 80286 @ 8 | 512 KB | 5"2DD/2HDx1, 20M SASI HDD | 6 | 1985/05 | | |
| 22 | PC-98XA3 | 80286 @ 8 | 512 KB | 5"2DD/2HDx1, 20M SASI HDD | 6 | 1985/05 | | |
| 23 | 23 | PC-9801VF2 | V30 @ 8 | 384 KB | 5"2DDx2 | 4 | 1985/07 | |
| 24 | 24 | PC-9801VM0 | V30 @ 8/10 | 384 KB | - | 4 | 1985/07 | |
| 25 | 25 | PC-9801VM2 | V30 @ 8/10 | 384 KB | 5"2DD/2HDx2 | 4 | 1985/07 | |
| 26 | 26 | PC-9801VM4 | V30 @ 8/10 | 384 KB | 5"2DD/2HDx2, 20M SASI HDD | 4 | 1985/10 | |
| 27 | PC-98XA11 | 80286 @ 8 | 512 KB | - | 6 | 1986/05 | | |
| 27 | PC-98XA11 | 80286 @ 8 | 512 KB | - | 6 | 1986/05 | | |
| 28 | 28 | PC-98XA21 | 80286 @ 8 | 512 KB | 5"2DD/2HDx2 | 6 | 1986/05 | |
| 29 | 29 | PC-98XA31 | 80286 @ 8 | 512 KB | 5"2DD/2HDx1, 20M SASI HDD | 6 | 1986/05 | |
| 30 | 30 | PC-9801UV2 | V30 @ 8/10 | 384 KB | 3.5"2DD/2HDx2 | 2 | 1986/05 | |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | NOTE: ****** Specbusy: press N, R, or E to boot ************* | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | Spectrum/Inves/TK90X etc. memory map: |
| r5932 | r5933 | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | static ADDRESS_MAP_START (spectrum_128_io, ADDRESS_SPACE_IO, 8) |
| 229 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) | |
| 229 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) | |
| 230 | 230 | AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) |
| 231 | 231 | AM_RANGE(0x007f, 0x007f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) |
| 232 | 232 | AM_RANGE(0x00df, 0x00df) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) |
| 233 | 233 | AM_RANGE(0x4000, 0x4000) AM_WRITE(spectrum_128_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 234 | 234 | AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd) |
| 235 | 235 | AM_RANGE(0xc000, 0xc000) AM_DEVREADWRITE("ay8912", ay8910_r, ay8910_address_w) AM_MIRROR(0x3ffd) |
| 236 | AM_RANGE(0x0001, 0x0001) AM_READ(spectrum_128_ula_r) AM_MIRROR(0xfffe) | |
| 236 | AM_RANGE(0x0001, 0x0001) AM_READ(spectrum_128_ula_r) AM_MIRROR(0xfffe) | |
| 237 | 237 | ADDRESS_MAP_END |
| 238 | 238 | |
| 239 | 239 | static ADDRESS_MAP_START (spectrum_128_mem, ADDRESS_SPACE_PROGRAM, 8) |
| r5932 | r5933 | |
| 280 | 280 | /* sound hardware */ |
| 281 | 281 | MDRV_SOUND_ADD("ay8912", AY8912, 1773400) |
| 282 | 282 | MDRV_SOUND_CONFIG(spectrum_ay_interface) |
| 283 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 283 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 284 | 284 | MACHINE_DRIVER_END |
| 285 | 285 | |
| 286 | 286 | |
| r5932 | r5933 | |
| 297 | 297 | ROM_REGION(0x18000,"maincpu",0) |
| 298 | 298 | ROM_SYSTEM_BIOS( 0, "en", "English" ) |
| 299 | 299 | ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(1)) |
| 300 | ROMX_LOAD("zx128_1.rom",0x14000,0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(1)) | |
| 300 | ROMX_LOAD("zx128_1.rom",0x14000,0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(1)) | |
| 301 | 301 | ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) |
| 302 | 302 | ROMX_LOAD("zx128s0.rom",0x10000,0x4000, CRC(453d86b2) SHA1(968937b1c750f0ef6205f01c6db4148da4cca4e3), ROM_BIOS(2)) |
| 303 | 303 | ROMX_LOAD("zx128s1.rom",0x14000,0x4000, CRC(6010e796) SHA1(bea3f397cc705eafee995ea629f4a82550562f90), ROM_BIOS(2)) |
| r5932 | r5933 | |
| 317 | 317 | ROMX_LOAD("plus2sp1.rom",0x14000,0x4000, CRC(41981d4b) SHA1(ec0d5a158842d20601b4fbeaefc6668db979d0e1), ROM_BIOS(3)) |
| 318 | 318 | ROM_SYSTEM_BIOS( 3, "ao", "ZX Spectrum +2c (Andrew Owen)" ) |
| 319 | 319 | ROMX_LOAD("plus2c-0.rom",0x10000,0x4000, CRC(bfddf748) SHA1(3eba870bcb2c5efa906f2ca3febe960fc35d66bb), ROM_BIOS(4)) |
| 320 | ROMX_LOAD("plus2c-1.rom",0x14000,0x4000, CRC(fd8552b6) SHA1(5ffcf79f2154ba2cf42cc1d9cb4be93cb5043e73), ROM_BIOS(4)) | |
| 320 | ROMX_LOAD("plus2c-1.rom",0x14000,0x4000, CRC(fd8552b6) SHA1(5ffcf79f2154ba2cf42cc1d9cb4be93cb5043e73), ROM_BIOS(4)) | |
| 321 | 321 | ROM_SYSTEM_BIOS( 4, "namco", "ZX Spectrum +2c (Namco)" ) |
| 322 | 322 | ROMX_LOAD("pl2namco.rom",0x10000,0x8000, CRC(72a54e75) SHA1(311400157df689450dadc3620f4c4afa960b05ad), ROM_BIOS(5)) |
| 323 | 323 | ROM_CART_LOAD("cart", 0x10000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| r5932 | r5933 | |
| 326 | 326 | ROM_START(hc128) |
| 327 | 327 | ROM_REGION(0x18000,"maincpu",0) |
| 328 | 328 | ROM_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5)) |
| 329 | ROM_LOAD("hc128.rom", 0x14000,0x4000, CRC(0241e960) SHA1(cea0d14391b9e571460a816088a1c00ecb24afa3)) | |
| 329 | ROM_LOAD("hc128.rom", 0x14000,0x4000, CRC(0241e960) SHA1(cea0d14391b9e571460a816088a1c00ecb24afa3)) | |
| 330 | 330 | ROM_CART_LOAD("cart", 0x10000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 331 | 331 | ROM_END |
| 332 | 332 | |
| r5932 | r5933 | |
| 334 | 334 | ROM_REGION(0x18000,"maincpu",0) |
| 335 | 335 | ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) |
| 336 | 336 | ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(1)) |
| 337 | ROMX_LOAD("hc2000.v1", 0x14000,0x4000, CRC(453c1a5a) SHA1(f8139fc38478691cf44944dc83fd6e70b0f002fb), ROM_BIOS(1)) | |
| 337 | ROMX_LOAD("hc2000.v1", 0x14000,0x4000, CRC(453c1a5a) SHA1(f8139fc38478691cf44944dc83fd6e70b0f002fb), ROM_BIOS(1)) | |
| 338 | 338 | ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) |
| 339 | 339 | ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(2)) |
| 340 | 340 | ROMX_LOAD("hc2000.v2", 0x14000,0x4000, CRC(65d90464) SHA1(5e2096e6460ff2120c8ada97579fdf82c1199c09), ROM_BIOS(2)) |
| r5932 | r5933 | |
|---|---|---|
| 95 | 95 | |
| 96 | 96 | /* 2008-05 FP: |
| 97 | 97 | TO DO: verify position of the following keys: '1/4 3/4', '-> <-', '@ up', 'Clrln' |
| 98 | Also, notice that pictures of p2000 units shows slightly different key mappings, suggesting | |
| 98 | Also, notice that pictures of p2000 units shows slightly different key mappings, suggesting | |
| 99 | 99 | many different .chr roms could exist |
| 100 | 100 | |
| 101 | 101 | Small note about natural keyboard support: currently, |
| r5932 | r5933 | |
|---|---|---|
| 533 | 533 | } |
| 534 | 534 | /* Check the reset vector does not point into the super chip RAM area */ |
| 535 | 535 | i = ( cart[0x0FFD] << 8 ) | cart[0x0FFC]; |
| 536 | if ( ( i & 0x0FFF ) < 0x0100 ) | |
| 536 | if ( ( i & 0x0FFF ) < 0x0100 ) | |
| 537 | 537 | { |
| 538 | 538 | return 0; |
| 539 | 539 | } |
| r5932 | r5933 | |
| 579 | 579 | |
| 580 | 580 | image_fread(image, cart, cart_size); |
| 581 | 581 | |
| 582 | if (!(cart_size == 0x4000 && detect_modef6(image->machine))) | |
| 582 | if (!(cart_size == 0x4000 && detect_modef6(image->machine))) | |
| 583 | 583 | { |
| 584 | while (cart_size > 0x00800) | |
| 584 | while (cart_size > 0x00800) | |
| 585 | 585 | { |
| 586 | 586 | if (!memcmp(cart, &cart[cart_size/2],cart_size/2)) cart_size /= 2; |
| 587 | 587 | else break; |
| r5932 | r5933 | |
| 590 | 590 | |
| 591 | 591 | extrainfo = image_extrainfo( image ); |
| 592 | 592 | |
| 593 | if ( extrainfo && extrainfo[0] ) | |
| 593 | if ( extrainfo && extrainfo[0] ) | |
| 594 | 594 | { |
| 595 | for ( eibd = extrainfo_banking_defs; eibd->extrainfo[0]; eibd++ ) | |
| 595 | for ( eibd = extrainfo_banking_defs; eibd->extrainfo[0]; eibd++ ) | |
| 596 | 596 | { |
| 597 | if ( ! mame_stricmp( eibd->extrainfo, extrainfo ) ) | |
| 597 | if ( ! mame_stricmp( eibd->extrainfo, extrainfo ) ) | |
| 598 | 598 | { |
| 599 | 599 | banking_mode = eibd->bank_mode; |
| 600 | 600 | } |
| r5932 | r5933 | |
| 675 | 675 | static void modeFV_switch(running_machine *machine, UINT16 offset, UINT8 data) |
| 676 | 676 | { |
| 677 | 677 | //printf("ModeFV %04x\n",offset); |
| 678 | if (!FVlocked && ( cpu_get_pc(cputag_get_cpu(machine, "maincpu")) & 0x1F00 ) == 0x1F00 ) | |
| 678 | if (!FVlocked && ( cpu_get_pc(cputag_get_cpu(machine, "maincpu")) & 0x1F00 ) == 0x1F00 ) | |
| 679 | 679 | { |
| 680 | 680 | FVlocked = 1; |
| 681 | 681 | current_bank = current_bank ^ 0x01; |
| r5932 | r5933 | |
| 685 | 685 | } |
| 686 | 686 | static void modeJVP_switch(running_machine *machine, UINT16 offset, UINT8 data) |
| 687 | 687 | { |
| 688 | switch( offset ) | |
| 688 | switch( offset ) | |
| 689 | 689 | { |
| 690 | 690 | case 0x00: |
| 691 | 691 | case 0x20: |
| r5932 | r5933 | |
| 726 | 726 | static WRITE8_HANDLER(modeDC_switch_w) { modeDC_switch(space->machine, offset, data); } |
| 727 | 727 | static WRITE8_HANDLER(mode3E_switch_w) { mode3E_switch(space->machine, offset, data); } |
| 728 | 728 | static WRITE8_HANDLER(mode3E_RAM_switch_w) { mode3E_RAM_switch(space->machine, offset, data); } |
| 729 | static WRITE8_HANDLER(mode3E_RAM_w) | |
| 729 | static WRITE8_HANDLER(mode3E_RAM_w) | |
| 730 | 730 | { |
| 731 | if ( mode3E_ram_enabled ) | |
| 731 | if ( mode3E_ram_enabled ) | |
| 732 | 732 | { |
| 733 | 733 | ram_base[offset] = data; |
| 734 | 734 | } |
| r5932 | r5933 | |
| 739 | 739 | |
| 740 | 740 | static DIRECT_UPDATE_HANDLER( modeF6_opbase ) |
| 741 | 741 | { |
| 742 | if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 ) | |
| 742 | if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 ) | |
| 743 | 743 | { |
| 744 | 744 | modeF6_switch_w( space, ( address & 0x1FFF ) - 0x1FF6, 0 ); |
| 745 | 745 | } |
| r5932 | r5933 | |
| 748 | 748 | |
| 749 | 749 | static DIRECT_UPDATE_HANDLER( modeSS_opbase ) |
| 750 | 750 | { |
| 751 | if ( address & 0x1000 ) | |
| 751 | if ( address & 0x1000 ) | |
| 752 | 752 | { |
| 753 | 753 | direct->bytemask = 0x7ff; |
| 754 | 754 | direct->bytestart = ( address & 0xf800 ); |
| 755 | 755 | direct->byteend = ( address & 0xf800 ) | 0x7ff; |
| 756 | if ( address & 0x800 ) | |
| 756 | if ( address & 0x800 ) | |
| 757 | 757 | { |
| 758 | 758 | direct->decrypted = bank_base[2]; |
| 759 | 759 | direct->raw = bank_base[2]; |
| 760 | } | |
| 761 | else | |
| 760 | } | |
| 761 | else | |
| 762 | 762 | { |
| 763 | 763 | direct->decrypted = bank_base[1]; |
| 764 | 764 | direct->raw = bank_base[1]; |
| r5932 | r5933 | |
| 774 | 774 | |
| 775 | 775 | //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset); |
| 776 | 776 | /* Check for control register "write" */ |
| 777 | if ( offset == 0xFF8 ) | |
| 777 | if ( offset == 0xFF8 ) | |
| 778 | 778 | { |
| 779 | 779 | //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), modeSS_byte); |
| 780 | 780 | modeSS_write_enabled = modeSS_byte & 0x02; |
| 781 | 781 | modeSS_write_delay = modeSS_byte >> 5; |
| 782 | switch ( modeSS_byte & 0x1C ) | |
| 782 | switch ( modeSS_byte & 0x1C ) | |
| 783 | 783 | { |
| 784 | 784 | case 0x00: |
| 785 | 785 | bank_base[1] = extra_RAM + 2 * 0x800; |
| r5932 | r5933 | |
| 826 | 826 | memory_set_bankptr(space->machine, 2, bank_base[2] ); |
| 827 | 827 | |
| 828 | 828 | /* Check if we should stop the tape */ |
| 829 | if ( cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) == 0x00FD ) | |
| 829 | if ( cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) == 0x00FD ) | |
| 830 | 830 | { |
| 831 | 831 | const device_config *img = devtag_get_device(space->machine, "cassette"); |
| 832 | if ( img ) | |
| 832 | if ( img ) | |
| 833 | 833 | { |
| 834 | 834 | cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 835 | 835 | } |
| 836 | 836 | } |
| 837 | } | |
| 838 | else if ( offset == 0xFF9 ) | |
| 837 | } | |
| 838 | else if ( offset == 0xFF9 ) | |
| 839 | 839 | { |
| 840 | 840 | /* Cassette port read */ |
| 841 | 841 | double tap_val = cassette_input( devtag_get_device(space->machine, "cassette") ); |
| 842 | 842 | //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), tap_val); |
| 843 | if ( tap_val < 0 ) | |
| 843 | if ( tap_val < 0 ) | |
| 844 | 844 | { |
| 845 | 845 | data = 0x00; |
| 846 | } | |
| 847 | else | |
| 846 | } | |
| 847 | else | |
| 848 | 848 | { |
| 849 | 849 | data = 0x01; |
| 850 | 850 | } |
| 851 | } | |
| 852 | else | |
| 851 | } | |
| 852 | else | |
| 853 | 853 | { |
| 854 | 854 | /* Possible RAM write */ |
| 855 | if ( modeSS_write_enabled ) | |
| 855 | if ( modeSS_write_enabled ) | |
| 856 | 856 | { |
| 857 | 857 | int diff = cputag_get_total_cycles(space->machine, "maincpu") - modeSS_byte_started; |
| 858 | 858 | //logerror("%04X: offset = %04X, %d\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, diff); |
| 859 | if ( diff - modeSS_diff_adjust == 5 ) | |
| 859 | if ( diff - modeSS_diff_adjust == 5 ) | |
| 860 | 860 | { |
| 861 | 861 | //logerror("%04X: RAM write offset = %04X, data = %02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, modeSS_byte ); |
| 862 | if ( offset & 0x800 ) | |
| 862 | if ( offset & 0x800 ) | |
| 863 | 863 | { |
| 864 | if ( modeSS_high_ram_enabled ) | |
| 864 | if ( modeSS_high_ram_enabled ) | |
| 865 | 865 | { |
| 866 | 866 | bank_base[2][offset & 0x7FF] = modeSS_byte; |
| 867 | 867 | data = modeSS_byte; |
| 868 | 868 | } |
| 869 | } | |
| 870 | else | |
| 869 | } | |
| 870 | else | |
| 871 | 871 | { |
| 872 | 872 | bank_base[1][offset] = modeSS_byte; |
| 873 | 873 | data = modeSS_byte; |
| 874 | 874 | } |
| 875 | } | |
| 876 | else if ( offset < 0x0100 ) | |
| 875 | } | |
| 876 | else if ( offset < 0x0100 ) | |
| 877 | 877 | { |
| 878 | 878 | modeSS_byte = offset; |
| 879 | 879 | modeSS_byte_started = cputag_get_total_cycles(space->machine, "maincpu"); |
| 880 | 880 | } |
| 881 | 881 | /* Check for dummy read from same address */ |
| 882 | if ( diff == 2 ) | |
| 882 | if ( diff == 2 ) | |
| 883 | 883 | { |
| 884 | 884 | modeSS_diff_adjust = 1; |
| 885 | } | |
| 886 | else | |
| 885 | } | |
| 886 | else | |
| 887 | 887 | { |
| 888 | 888 | modeSS_diff_adjust = 0; |
| 889 | 889 | } |
| 890 | } | |
| 891 | else if ( offset < 0x0100 ) | |
| 890 | } | |
| 891 | else if ( offset < 0x0100 ) | |
| 892 | 892 | { |
| 893 | 893 | modeSS_byte = offset; |
| 894 | 894 | modeSS_byte_started = cputag_get_total_cycles(space->machine, "maincpu"); |
| r5932 | r5933 | |
| 896 | 896 | } |
| 897 | 897 | /* Because the mame core caches opcode data and doesn't perform reads like normal */ |
| 898 | 898 | /* we have to put in this little hack here to get Suicide Mission to work. */ |
| 899 | if ( offset != 0xFF8 && ( cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) & 0x1FFF ) == 0x1FF8 ) | |
| 899 | if ( offset != 0xFF8 && ( cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) & 0x1FFF ) == 0x1FF8 ) | |
| 900 | 900 | { |
| 901 | 901 | modeSS_r( space, 0xFF8 ); |
| 902 | 902 | } |
| 903 | 903 | return data; |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | INLINE void modeDPC_check_flag(UINT8 data_fetcher) | |
| 906 | INLINE void modeDPC_check_flag(UINT8 data_fetcher) | |
| 907 | 907 | { |
| 908 | 908 | /* Set flag when low counter equals top */ |
| 909 | if ( dpc.df[data_fetcher].low == dpc.df[data_fetcher].top ) | |
| 909 | if ( dpc.df[data_fetcher].low == dpc.df[data_fetcher].top ) | |
| 910 | 910 | { |
| 911 | 911 | dpc.df[data_fetcher].flag = 1; |
| 912 | 912 | } |
| 913 | 913 | /* Reset flag when low counter equals bottom */ |
| 914 | if ( dpc.df[data_fetcher].low == dpc.df[data_fetcher].bottom ) | |
| 914 | if ( dpc.df[data_fetcher].low == dpc.df[data_fetcher].bottom ) | |
| 915 | 915 | { |
| 916 | 916 | dpc.df[data_fetcher].flag = 0; |
| 917 | 917 | } |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | INLINE void modeDPC_decrement_counter(UINT8 data_fetcher) | |
| 920 | INLINE void modeDPC_decrement_counter(UINT8 data_fetcher) | |
| 921 | 921 | { |
| 922 | 922 | dpc.df[data_fetcher].low -= 1; |
| 923 | if ( dpc.df[data_fetcher].low == 0xFF ) | |
| 923 | if ( dpc.df[data_fetcher].low == 0xFF ) | |
| 924 | 924 | { |
| 925 | 925 | dpc.df[data_fetcher].high -= 1; |
| 926 | if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode ) | |
| 926 | if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode ) | |
| 927 | 927 | { |
| 928 | 928 | dpc.df[data_fetcher].low = dpc.df[data_fetcher].top; |
| 929 | 929 | } |
| r5932 | r5933 | |
| 935 | 935 | static TIMER_CALLBACK(modeDPC_timer_callback) |
| 936 | 936 | { |
| 937 | 937 | int data_fetcher; |
| 938 | for( data_fetcher = 5; data_fetcher < 8; data_fetcher++ ) | |
| 938 | for( data_fetcher = 5; data_fetcher < 8; data_fetcher++ ) | |
| 939 | 939 | { |
| 940 | if ( dpc.df[data_fetcher].osc_clk ) | |
| 940 | if ( dpc.df[data_fetcher].osc_clk ) | |
| 941 | 941 | { |
| 942 | 942 | modeDPC_decrement_counter( data_fetcher ); |
| 943 | 943 | } |
| r5932 | r5933 | |
| 961 | 961 | UINT8 data = 0xFF; |
| 962 | 962 | |
| 963 | 963 | logerror("%04X: Read from DPC offset $%02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset); |
| 964 | if ( offset < 0x08 ) | |
| 964 | if ( offset < 0x08 ) | |
| 965 | 965 | { |
| 966 | switch( offset & 0x06 ) | |
| 966 | switch( offset & 0x06 ) | |
| 967 | 967 | { |
| 968 | 968 | case 0x00: /* Random number generator */ |
| 969 | 969 | case 0x02: |
| r5932 | r5933 | |
| 974 | 974 | dpc.latch_64 = dpc.latch_62 + dpc.df[4].top; |
| 975 | 975 | dpc.dlc = ( dpc.latch_62 + dpc.df[4].top > 0xFF ) ? 1 : 0; |
| 976 | 976 | data = 0; |
| 977 | if ( dpc.df[5].music_mode && dpc.df[5].flag ) | |
| 977 | if ( dpc.df[5].music_mode && dpc.df[5].flag ) | |
| 978 | 978 | { |
| 979 | 979 | data |= 0x01; |
| 980 | 980 | } |
| 981 | if ( dpc.df[6].music_mode && dpc.df[6].flag ) | |
| 981 | if ( dpc.df[6].music_mode && dpc.df[6].flag ) | |
| 982 | 982 | { |
| 983 | 983 | data |= 0x02; |
| 984 | 984 | } |
| 985 | if ( dpc.df[7].music_mode && dpc.df[7].flag ) | |
| 985 | if ( dpc.df[7].music_mode && dpc.df[7].flag ) | |
| 986 | 986 | { |
| 987 | 987 | data |= 0x04; |
| 988 | 988 | } |
| 989 | 989 | return ( dpc.dlc ? dpc.movamt & 0xF0 : 0 ) | dpc_amplitude[data]; |
| 990 | 990 | } |
| 991 | } | |
| 992 | else | |
| 991 | } | |
| 992 | else | |
| 993 | 993 | { |
| 994 | 994 | UINT8 display_data = memory_region(space->machine, "user1")[0x2000 + ( ~ ( ( dpc.df[data_fetcher].low | ( dpc.df[data_fetcher].high << 8 ) ) ) & 0x7FF ) ]; |
| 995 | 995 | |
| 996 | switch( offset & 0x38 ) | |
| 996 | switch( offset & 0x38 ) | |
| 997 | 997 | { |
| 998 | 998 | case 0x08: /* display data */ |
| 999 | 999 | data = display_data; |
| r5932 | r5933 | |
| 1018 | 1018 | break; |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | if ( data_fetcher < 5 || ! dpc.df[data_fetcher].osc_clk ) | |
| 1021 | if ( data_fetcher < 5 || ! dpc.df[data_fetcher].osc_clk ) | |
| 1022 | 1022 | { |
| 1023 | 1023 | modeDPC_decrement_counter( data_fetcher ); |
| 1024 | 1024 | } |
| r5932 | r5933 | |
| 1030 | 1030 | { |
| 1031 | 1031 | UINT8 data_fetcher = offset & 0x07; |
| 1032 | 1032 | |
| 1033 | switch( offset & 0x38 ) | |
| 1033 | switch( offset & 0x38 ) | |
| 1034 | 1034 | { |
| 1035 | 1035 | case 0x00: /* Top count */ |
| 1036 | 1036 | dpc.df[data_fetcher].top = data; |
| r5932 | r5933 | |
| 1043 | 1043 | break; |
| 1044 | 1044 | case 0x10: /* Counter low */ |
| 1045 | 1045 | dpc.df[data_fetcher].low = data; |
| 1046 | if ( data_fetcher == 4 ) | |
| 1046 | if ( data_fetcher == 4 ) | |
| 1047 | 1047 | { |
| 1048 | 1048 | dpc.latch_64 = data; |
| 1049 | 1049 | } |
| 1050 | if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode ) | |
| 1050 | if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode ) | |
| 1051 | 1051 | { |
| 1052 | 1052 | dpc.df[data_fetcher].low = dpc.df[data_fetcher].top; |
| 1053 | 1053 | } |
| r5932 | r5933 | |
| 1057 | 1057 | dpc.df[data_fetcher].high = data; |
| 1058 | 1058 | dpc.df[data_fetcher].music_mode = data & 0x10; |
| 1059 | 1059 | dpc.df[data_fetcher].osc_clk = data & 0x20; |
| 1060 | if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode && dpc.df[data_fetcher].low == 0xFF ) | |
| 1060 | if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode && dpc.df[data_fetcher].low == 0xFF ) | |
| 1061 | 1061 | { |
| 1062 | 1062 | dpc.df[data_fetcher].low = dpc.df[data_fetcher].top; |
| 1063 | 1063 | modeDPC_check_flag( data_fetcher ); |
| r5932 | r5933 | |
| 1153 | 1153 | running_machine *machine = device->machine; |
| 1154 | 1154 | |
| 1155 | 1155 | /* Left controller port */ |
| 1156 | if ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT == 0x03 ) | |
| 1156 | if ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT == 0x03 ) | |
| 1157 | 1157 | { |
| 1158 | 1158 | keypad_left_column = data / 16; |
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | /* Right controller port */ |
| 1162 | switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1162 | switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1163 | 1163 | { |
| 1164 | 1164 | case 0x03: /* Keypad */ |
| 1165 | 1165 | keypad_right_column = data & 0x0F; |
| r5932 | r5933 | |
| 1177 | 1177 | UINT8 val = 0; |
| 1178 | 1178 | |
| 1179 | 1179 | /* Left controller port PINs 1-4 ( 4321 ) */ |
| 1180 | switch( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) | |
| 1180 | switch( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) | |
| 1181 | 1181 | { |
| 1182 | 1182 | case 0x00: /* Joystick */ |
| 1183 | 1183 | case 0x05: /* Joystick w/Boostergrip */ |
| r5932 | r5933 | |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | /* Right controller port PINs 1-4 ( 4321 ) */ |
| 1202 | switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1202 | switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1203 | 1203 | { |
| 1204 | 1204 | case 0x00: /* Joystick */ |
| 1205 | 1205 | case 0x05: /* Joystick w/Boostergrip */ |
| r5932 | r5933 | |
| 1270 | 1270 | } |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | static READ16_HANDLER(a2600_read_input_port) | |
| 1273 | static READ16_HANDLER(a2600_read_input_port) | |
| 1274 | 1274 | { |
| 1275 | 1275 | int i; |
| 1276 | 1276 | |
| 1277 | switch( offset ) | |
| 1277 | switch( offset ) | |
| 1278 | 1278 | { |
| 1279 | 1279 | case 0: /* Left controller port PIN 5 */ |
| 1280 | switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) | |
| 1280 | switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) | |
| 1281 | 1281 | { |
| 1282 | 1282 | case 0x00: /* Joystick */ |
| 1283 | 1283 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1284 | 1284 | case 0x01: /* Paddle */ |
| 1285 | 1285 | return input_port_read(space->machine, "PADDLE1"); |
| 1286 | 1286 | case 0x03: /* Keypad */ |
| 1287 | for ( i = 0; i < 4; i++ ) | |
| 1287 | for ( i = 0; i < 4; i++ ) | |
| 1288 | 1288 | { |
| 1289 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) | |
| 1289 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) | |
| 1290 | 1290 | { |
| 1291 | if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x01 ) | |
| 1291 | if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x01 ) | |
| 1292 | 1292 | { |
| 1293 | 1293 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1294 | } | |
| 1295 | else | |
| 1294 | } | |
| 1295 | else | |
| 1296 | 1296 | { |
| 1297 | 1297 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1298 | 1298 | } |
| r5932 | r5933 | |
| 1306 | 1306 | } |
| 1307 | 1307 | break; |
| 1308 | 1308 | case 1: /* Right controller port PIN 5 */ |
| 1309 | switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) | |
| 1309 | switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) | |
| 1310 | 1310 | { |
| 1311 | 1311 | case 0x00: /* Joystick */ |
| 1312 | 1312 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1313 | 1313 | case 0x01: /* Paddle */ |
| 1314 | 1314 | return input_port_read(space->machine, "PADDLE3"); |
| 1315 | 1315 | case 0x03: /* Keypad */ |
| 1316 | for ( i = 0; i < 4; i++ ) | |
| 1316 | for ( i = 0; i < 4; i++ ) | |
| 1317 | 1317 | { |
| 1318 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) | |
| 1318 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) | |
| 1319 | 1319 | { |
| 1320 | if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x02 ) | |
| 1320 | if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x02 ) | |
| 1321 | 1321 | { |
| 1322 | 1322 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1323 | } | |
| 1324 | else | |
| 1323 | } | |
| 1324 | else | |
| 1325 | 1325 | { |
| 1326 | 1326 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1327 | 1327 | } |
| r5932 | r5933 | |
| 1335 | 1335 | } |
| 1336 | 1336 | break; |
| 1337 | 1337 | case 2: /* Left controller port PIN 9 */ |
| 1338 | switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1338 | switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1339 | 1339 | { |
| 1340 | 1340 | case 0x00: /* Joystick */ |
| 1341 | 1341 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1342 | 1342 | case 0x01: /* Paddle */ |
| 1343 | 1343 | return input_port_read(space->machine, "PADDLE2"); |
| 1344 | 1344 | case 0x03: /* Keypad */ |
| 1345 | for ( i = 0; i < 4; i++ ) | |
| 1345 | for ( i = 0; i < 4; i++ ) | |
| 1346 | 1346 | { |
| 1347 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) | |
| 1347 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) | |
| 1348 | 1348 | { |
| 1349 | if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x01 ) | |
| 1349 | if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x01 ) | |
| 1350 | 1350 | { |
| 1351 | 1351 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1352 | } | |
| 1353 | else | |
| 1352 | } | |
| 1353 | else | |
| 1354 | 1354 | { |
| 1355 | 1355 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1356 | 1356 | } |
| r5932 | r5933 | |
| 1364 | 1364 | } |
| 1365 | 1365 | break; |
| 1366 | 1366 | case 3: /* Right controller port PIN 9 */ |
| 1367 | switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1367 | switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1368 | 1368 | { |
| 1369 | 1369 | case 0x00: /* Joystick */ |
| 1370 | 1370 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1371 | 1371 | case 0x01: /* Paddle */ |
| 1372 | 1372 | return input_port_read(space->machine, "PADDLE4"); |
| 1373 | 1373 | case 0x03: /* Keypad */ |
| 1374 | for ( i = 0; i < 4; i++ ) | |
| 1374 | for ( i = 0; i < 4; i++ ) | |
| 1375 | 1375 | { |
| 1376 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) | |
| 1376 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) | |
| 1377 | 1377 | { |
| 1378 | if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x02 ) | |
| 1378 | if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x02 ) | |
| 1379 | 1379 | { |
| 1380 | 1380 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1381 | } | |
| 1382 | else | |
| 1381 | } | |
| 1382 | else | |
| 1383 | 1383 | { |
| 1384 | 1384 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1385 | 1385 | } |
| r5932 | r5933 | |
| 1393 | 1393 | } |
| 1394 | 1394 | break; |
| 1395 | 1395 | case 4: /* Left controller port PIN 6 */ |
| 1396 | switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) | |
| 1396 | switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) | |
| 1397 | 1397 | { |
| 1398 | 1398 | case 0x00: /* Joystick */ |
| 1399 | 1399 | case 0x05: /* Joystick w/Boostergrip */ |
| r5932 | r5933 | |
| 1403 | 1403 | case 0x02: /* Driving */ |
| 1404 | 1404 | return input_port_read(space->machine, "BUTTONS_L") << 3; |
| 1405 | 1405 | case 0x03: /* Keypad */ |
| 1406 | for ( i = 0; i < 4; i++ ) | |
| 1406 | for ( i = 0; i < 4; i++ ) | |
| 1407 | 1407 | { |
| 1408 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) | |
| 1408 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) | |
| 1409 | 1409 | { |
| 1410 | if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x04 ) | |
| 1410 | if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x04 ) | |
| 1411 | 1411 | { |
| 1412 | 1412 | return 0xff; |
| 1413 | } | |
| 1414 | else | |
| 1413 | } | |
| 1414 | else | |
| 1415 | 1415 | { |
| 1416 | 1416 | return 0x00; |
| 1417 | 1417 | } |
| r5932 | r5933 | |
| 1425 | 1425 | } |
| 1426 | 1426 | break; |
| 1427 | 1427 | case 5: /* Right controller port PIN 6 */ |
| 1428 | switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1428 | switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) | |
| 1429 | 1429 | { |
| 1430 | 1430 | case 0x00: /* Joystick */ |
| 1431 | 1431 | case 0x05: /* Joystick w/Boostergrip */ |
| r5932 | r5933 | |
| 1435 | 1435 | case 0x02: /* Driving */ |
| 1436 | 1436 | return input_port_read(space->machine, "BUTTONS_R") << 3; |
| 1437 | 1437 | case 0x03: /* Keypad */ |
| 1438 | for ( i = 0; i < 4; i++ ) | |
| 1438 | for ( i = 0; i < 4; i++ ) | |
| 1439 | 1439 | { |
| 1440 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) | |
| 1440 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) | |
| 1441 | 1441 | { |
| 1442 | if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x04 ) | |
| 1442 | if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x04 ) | |
| 1443 | 1443 | { |
| 1444 | 1444 | return 0xff; |
| 1445 | } | |
| 1446 | else | |
| 1445 | } | |
| 1446 | else | |
| 1447 | 1447 | { |
| 1448 | 1448 | return 0x00; |
| 1449 | 1449 | } |
| r5932 | r5933 | |
| 1468 | 1468 | Q-Bert's Qubes (NTSC,F6) at 0x1594 |
| 1469 | 1469 | Berzerk at 0xF093. |
| 1470 | 1470 | */ |
| 1471 | static READ8_HANDLER(a2600_get_databus_contents) | |
| 1471 | static READ8_HANDLER(a2600_get_databus_contents) | |
| 1472 | 1472 | { |
| 1473 | 1473 | UINT16 last_address, prev_address; |
| 1474 | 1474 | UINT8 last_byte, prev_byte; |
| 1475 | 1475 | |
| 1476 | 1476 | last_address = cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) - 1; |
| 1477 | if ( ! ( last_address & 0x1080 ) ) | |
| 1477 | if ( ! ( last_address & 0x1080 ) ) | |
| 1478 | 1478 | { |
| 1479 | 1479 | return offset; |
| 1480 | 1480 | } |
| 1481 | 1481 | last_byte = memory_read_byte(space, last_address ); |
| 1482 | if ( last_byte < 0x80 || last_byte == 0xFF ) | |
| 1482 | if ( last_byte < 0x80 || last_byte == 0xFF ) | |
| 1483 | 1483 | { |
| 1484 | 1484 | return last_byte; |
| 1485 | 1485 | } |
| 1486 | 1486 | prev_address = last_address - 1; |
| 1487 | if ( ! ( prev_address & 0x1080 ) ) | |
| 1487 | if ( ! ( prev_address & 0x1080 ) ) | |
| 1488 | 1488 | { |
| 1489 | 1489 | return last_byte; |
| 1490 | 1490 | } |
| 1491 | 1491 | prev_byte = memory_read_byte(space, prev_address ); |
| 1492 | if ( prev_byte == 0xB1 ) | |
| 1492 | if ( prev_byte == 0xB1 ) | |
| 1493 | 1493 | { /* LDA (XX),Y */ |
| 1494 | 1494 | return memory_read_byte(space, last_byte + 1 ); |
| 1495 | 1495 | } |
| r5932 | r5933 | |
| 1503 | 1503 | { 26, 26 + 160 + 16, 48, 48 + 240 + 31 } /* 342 */ |
| 1504 | 1504 | }; |
| 1505 | 1505 | |
| 1506 | static WRITE16_HANDLER( a2600_tia_vsync_callback ) | |
| 1506 | static WRITE16_HANDLER( a2600_tia_vsync_callback ) | |
| 1507 | 1507 | { |
| 1508 | 1508 | int i; |
| 1509 | 1509 | |
| 1510 | for ( i = 0; i < sizeof( supported_screen_heights ) / sizeof( supported_screen_heights[0] ); i++ ) | |
| 1510 | for ( i = 0; i < sizeof( supported_screen_heights ) / sizeof( supported_screen_heights[0] ); i++ ) | |
| 1511 | 1511 | { |
| 1512 | if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) | |
| 1512 | if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) | |
| 1513 | 1513 | { |
| 1514 | if ( supported_screen_heights[i] != current_screen_height ) | |
| 1514 | if ( supported_screen_heights[i] != current_screen_height ) | |
| 1515 | 1515 | { |
| 1516 | 1516 | current_screen_height = supported_screen_heights[i]; |
| 1517 | 1517 | // video_screen_configure( machine->primary_screen, 228, current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * current_screen_height ); |
| r5932 | r5933 | |
| 1520 | 1520 | } |
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | static WRITE16_HANDLER( a2600_tia_vsync_callback_pal ) | |
| 1523 | static WRITE16_HANDLER( a2600_tia_vsync_callback_pal ) | |
| 1524 | 1524 | { |
| 1525 | 1525 | int i; |
| 1526 | 1526 | |
| 1527 | for ( i = 0; i < sizeof( supported_screen_heights ) / sizeof( supported_screen_heights[0] ); i++ ) | |
| 1527 | for ( i = 0; i < sizeof( supported_screen_heights ) / sizeof( supported_screen_heights[0] ); i++ ) | |
| 1528 | 1528 | { |
| 1529 | if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) | |
| 1529 | if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) | |
| 1530 | 1530 | { |
| 1531 | if ( supported_screen_heights[i] != current_screen_height ) | |
| 1531 | if ( supported_screen_heights[i] != current_screen_height ) | |
| 1532 | 1532 | { |
| 1533 | 1533 | current_screen_height = supported_screen_heights[i]; |
| 1534 | 1534 | // video_screen_configure( machine->primary_screen, 228, current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * current_screen_height ); |
| r5932 | r5933 | |
| 1571 | 1571 | current_reset_bank_counter = 0xFF; |
| 1572 | 1572 | } |
| 1573 | 1573 | |
| 1574 | static void set_category_value( running_machine *machine, const char* cat, const char *cat_selection ) | |
| 1574 | static void set_category_value( running_machine *machine, const char* cat, const char *cat_selection ) | |
| 1575 | 1575 | { |
| 1576 | 1576 | /* NPW 22-May-2008 - FIXME */ |
| 1577 | 1577 | #if 0 |
| 1578 | 1578 | input_port_entry *cat_in = NULL; |
| 1579 | 1579 | input_port_entry *in; |
| 1580 | 1580 | |
| 1581 | for( in = machine->input_ports; in->type != IPT_END; in++ ) | |
| 1581 | for( in = machine->input_ports; in->type != IPT_END; in++ ) | |
| 1582 | 1582 | { |
| 1583 | if ( in->type == IPT_CATEGORY_NAME && ! mame_stricmp( cat, input_port_name(in) ) ) | |
| 1583 | if ( in->type == IPT_CATEGORY_NAME && ! mame_stricmp( cat, input_port_name(in) ) ) | |
| 1584 | 1584 | { |
| 1585 | 1585 | cat_in = in; |
| 1586 | 1586 | } |
| 1587 | if ( cat_in && in->type == IPT_CATEGORY_SETTING && ! mame_stricmp( cat_selection, input_port_name(in) ) ) | |
| 1587 | if ( cat_in && in->type == IPT_CATEGORY_SETTING && ! mame_stricmp( cat_selection, input_port_name(in) ) ) | |
| 1588 | 1588 | { |
| 1589 | 1589 | cat_in->default_value = in->default_value; |
| 1590 | 1590 | return; |
| r5932 | r5933 | |
| 1593 | 1593 | #endif |
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | static void set_controller( running_machine *machine, const char *controller, unsigned int selection ) | |
| 1596 | static void set_controller( running_machine *machine, const char *controller, unsigned int selection ) | |
| 1597 | 1597 | { |
| 1598 | 1598 | /* Defaulting to only joystick when joysstick and paddle are set for now... */ |
| 1599 | 1599 | if ( selection == JOYS + PADD ) |
| 1600 | 1600 | selection = JOYS; |
| 1601 | 1601 | |
| 1602 | switch( selection ) | |
| 1602 | switch( selection ) | |
| 1603 | 1603 | { |
| 1604 | 1604 | case JOYS: set_category_value( machine, controller, "Joystick" ); break; |
| 1605 | 1605 | case PADD: set_category_value( machine, controller, STR_PADDLES ); break; |
| r5932 | r5933 | |
| 1645 | 1645 | if (banking_mode == 0xff) if (detect_32K_mode3F(machine)) banking_mode = mode3F; |
| 1646 | 1646 | if (banking_mode == 0xff) if (detect_modeE7(machine)) banking_mode = modeE7; |
| 1647 | 1647 | |
| 1648 | if (banking_mode == 0xff) | |
| 1648 | if (banking_mode == 0xff) | |
| 1649 | 1649 | { |
| 1650 | 1650 | switch (cart_size) |
| 1651 | 1651 | { |
| r5932 | r5933 | |
| 1708 | 1708 | break; |
| 1709 | 1709 | |
| 1710 | 1710 | case modeF8: |
| 1711 | if (!memcmp(&CART[0x1ffc],snowwhite,sizeof(snowwhite))) | |
| 1711 | if (!memcmp(&CART[0x1ffc],snowwhite,sizeof(snowwhite))) | |
| 1712 | 1712 | { |
| 1713 | 1713 | install_banks(machine, 1, 0x0000); |
| 1714 | } | |
| 1715 | else | |
| 1714 | } | |
| 1715 | else | |
| 1716 | 1716 | { |
| 1717 | 1717 | install_banks(machine, 1, 0x1000); |
| 1718 | 1718 | } |
| r5932 | r5933 | |
| 1890 | 1890 | memory_set_direct_update_handler(space, modeDPC_opbase_handler ); |
| 1891 | 1891 | { |
| 1892 | 1892 | int data_fetcher; |
| 1893 | for( data_fetcher = 0; data_fetcher < 8; data_fetcher++ ) | |
| 1893 | for( data_fetcher = 0; data_fetcher < 8; data_fetcher++ ) | |
| 1894 | 1894 | { |
| 1895 | 1895 | dpc.df[data_fetcher].osc_clk = 0; |
| 1896 | 1896 | dpc.df[data_fetcher].flag = 0; |
| r5932 | r5933 | |
|---|---|---|
| 78 | 78 | TMM331 - Toshiba TMM331AP 2k x8 MASKROM (DIP24) |
| 79 | 79 | Pinout (preliminary): |
| 80 | 80 | TMM331 |
| 81 | |----\/----| | |
| 82 | A7 |1 24| VCC | |
| 83 | A8 |2 23| D0 | |
| 84 | A9 |3 22| D1 | |
| 85 | A10 |4 21| D2 | |
| 86 | A0 |5 20| D3 | |
| 87 | A1 |6 19| D4 | |
| 88 | A2 |7 18| D5 | |
| 89 | A3 |8 17| D6 | |
| 90 | A4 |9 16| D7 | |
| 91 | A5 |10 15| CE (LOW) | |
| 92 | A6 |11 14| ? (unknown, leave NC?) | |
| 93 | GND |12 13| OE (LOW) | |
| 94 | |----------| | |
| 81 | ? ? ?|----\/----| | |
| 82 | ?A7?|1 ? ? ? 24| VCC | |
| 83 | ? A8?|2 ? ? ? 23| D0 | |
| 84 | ? A9?|3 ? ? ? 22| D1 | |
| 85 | ? A10 |4 ? ? ? 21| D2 | |
| 86 | ?A0?|5 ? ? ? 20| D3 | |
| 87 | ? A1?|6 ? ? ? 19| D4 | |
| 88 | ?A2?|7 ? ? ? 18| D5 | |
| 89 | ?A3?|8 ? ? ? 17| D6 | |
| 90 | ?A4?|9 ? ? ? 16| D7 | |
| 91 | ? A5?|10 ? ? ?15| CE (LOW) | |
| 92 | ? A6?|11 ? ? ?14| ? (unknown, leave NC?) | |
| 93 | GND?|12 ? ? ?13| OE (LOW) | |
| 94 | ? ? ? |----------| | |
| 95 | 95 | |
| 96 | 96 | */ |
| 97 | 97 | |
| r5932 | r5933 | |
| 140 | 140 | |
| 141 | 141 | /* |
| 142 | 142 | |
| 143 | ||
| 143 | RCA Studio II games list | |
| 144 | 144 | |
| 145 | Title Series Dumped | |
| 146 | ---------------------------------------------------------------------------- | |
| 147 | Bowling built-in yes | |
| 148 | Doodles built-in yes | |
| 149 | Freeway built-in yes | |
| 150 | Math built-in yes | |
| 151 | Patterns built-in yes | |
| 152 | Gunfighter/Moonship Battle TV Arcade no, but Guru has one | |
| 153 | Space War TV Arcade I yes | |
| 154 | Fun with Numbers TV Arcade II no, but Guru has one | |
| 155 | Tennis/Squash TV Arcade III yes | |
| 156 | Baseball TV Arcade IV yes | |
| 157 | Speedway/Tag TV Arcade yes | |
| 158 | Blackjack TV Casino I yes | |
| 159 | Bingo TV Casino no | |
| 160 | Math and Social Studies TV School House I no, but Guru has one | |
| 161 | Math Fun TV School House II no, but Guru has one | |
| 162 | Biorhythm TV Mystic no, but Guru has one | |
| 145 | Title Series Dumped | |
| 146 | ---------------------------------------------------------------------------- | |
| 147 | Bowling built-in yes | |
| 148 | Doodles built-in yes | |
| 149 | Freeway built-in yes | |
| 150 | Math built-in yes | |
| 151 | Patterns built-in yes | |
| 152 | Gunfighter/Moonship Battle TV Arcade no, but Guru has one | |
| 153 | Space War TV Arcade I yes | |
| 154 | Fun with Numbers TV Arcade II no, but Guru has one | |
| 155 | Tennis/Squash TV Arcade III yes | |
| 156 | Baseball TV Arcade IV yes | |
| 157 | Speedway/Tag TV Arcade yes | |
| 158 | Blackjack TV Casino I yes | |
| 159 | Bingo TV Casino no | |
| 160 | Math and Social Studies TV School House I no, but Guru has one | |
| 161 | Math Fun TV School House II no, but Guru has one | |
| 162 | Biorhythm TV Mystic no, but Guru has one | |
| 163 | 163 | |
| 164 | 164 | |
| 165 | ||
| 165 | MPT-02 games list | |
| 166 | 166 | |
| 167 | ID Title Series Dumped | |
| 168 | ---------------------------------------------------------------------------- | |
| 169 | MG-201 Bingo no | |
| 170 | MG-202 Concentration Match no, but Guru has one | |
| 171 | MG-203 Star Wars no, but Guru has one | |
| 172 | MG-204 Math Fun School House II no, but Guru has one | |
| 173 | MG-205 Pinball no, but Guru has one | |
| 174 | MG-206 Biorythm no | |
| 175 | MG-207 Tennis/Squash no | |
| 176 | MG-208 Fun with Numbers no | |
| 177 | MG-209 Computer Quiz School House I no | |
| 178 | MG-210 Baseball no | |
| 179 | MG-211 Speedway/Tag no | |
| 180 | MG-212 Spacewar Intercept no | |
| 181 | MG-213 Gun Fight/Moon Ship no | |
| 167 | ID Title Series Dumped | |
| 168 | ---------------------------------------------------------------------------- | |
| 169 | MG-201 Bingo no | |
| 170 | MG-202 Concentration Match no, but Guru has one | |
| 171 | MG-203 Star Wars no, but Guru has one | |
| 172 | MG-204 Math Fun School House II no, but Guru has one | |
| 173 | MG-205 Pinball no, but Guru has one | |
| 174 | MG-206 Biorythm no | |
| 175 | MG-207 Tennis/Squash no | |
| 176 | MG-208 Fun with Numbers no | |
| 177 | MG-209 Computer Quiz School House I no | |
| 178 | MG-210 Baseball no | |
| 179 | MG-211 Speedway/Tag no | |
| 180 | MG-212 Spacewar Intercept no | |
| 181 | MG-213 Gun Fight/Moon Ship no | |
| 182 | 182 | |
| 183 | 183 | */ |
| 184 | 184 | |
| r5932 | r5933 | |
| 186 | 186 | |
| 187 | 187 | TODO: |
| 188 | 188 | |
| 189 | - studio2 cpu clock from schematics | |
| 190 | - visicom alternate videoram @ 0x1300 ? | |
| 189 | - studio2 cpu clock from schematics | |
| 190 | - visicom alternate videoram @ 0x1300 ? | |
| 191 | 191 | - mpt02/mustang cdp1864 colors |
| 192 | 192 | - discrete sound |
| 193 | ||
| 193 | - Academy Apollo 80 (Germany) | |
| 194 | 194 | |
| 195 | 195 | */ |
| 196 | 196 | |
| r5932 | r5933 | |
| 242 | 242 | AM_RANGE(0x0000, 0x07ff) AM_ROM |
| 243 | 243 | AM_RANGE(0x1000, 0x10ff) AM_MIRROR(0x200) AM_RAM |
| 244 | 244 | AM_RANGE(0x1100, 0x11ff) AM_RAM |
| 245 | // | |
| 245 | // AM_RANGE(0x1200, 0x12ff) AM_RAM | |
| 246 | 246 | AM_RANGE(0x1300, 0x13ff) AM_RAM |
| 247 | 247 | ADDRESS_MAP_END |
| 248 | 248 | |
| r5932 | r5933 | |
| 465 | 465 | |
| 466 | 466 | /* find devices */ |
| 467 | 467 | state->cdp1864 = devtag_get_device(machine, CDP1864_TAG); |
| 468 | ||
| 468 | ||
| 469 | 469 | /* register for state saving */ |
| 470 | 470 | state_save_register_global(machine, state->cdp1802_mode); |
| 471 | 471 | state_save_register_global(machine, state->keylatch); |
| r5932 | r5933 | |
| 559 | 559 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 560 | 560 | MDRV_SOUND_ADD("beep", BEEP, 0) |
| 561 | 561 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 562 | ||
| 562 | ||
| 563 | 563 | MDRV_IMPORT_FROM( studio2_cartslot ) |
| 564 | 564 | MACHINE_DRIVER_END |
| 565 | 565 | |
| r5932 | r5933 | |
| 590 | 590 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 591 | 591 | MDRV_SOUND_ADD("beep", BEEP, 0) |
| 592 | 592 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 593 | ||
| 593 | ||
| 594 | 594 | MDRV_IMPORT_FROM( studio2_cartslot ) |
| 595 | 595 | MACHINE_DRIVER_END |
| 596 | 596 | |
| r5932 | r5933 | |
| 618 | 618 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 619 | 619 | MDRV_CDP1864_ADD(CDP1864_TAG, CDP1864_CLOCK, mpt02_cdp1864_intf) |
| 620 | 620 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 621 | ||
| 621 | ||
| 622 | 622 | MDRV_IMPORT_FROM( studio2_cartslot ) |
| 623 | 623 | MACHINE_DRIVER_END |
| 624 | 624 |
| r5932 | r5933 | |
|---|---|---|
| 156 | 156 | else |
| 157 | 157 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 158 | 158 | |
| 159 | // set IRQ line, timer pulses IRQ line, all other devices hold it as necessary | |
| 159 | // set IRQ line, timer pulses IRQ line, all other devices hold it as necessary | |
| 160 | 160 | if(fdc_interrupt_code == 1 && (pcw_system_status & 0x20)) |
| 161 | 161 | { |
| 162 | 162 | cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); |
| 163 | 163 | return; |
| 164 | 164 | } |
| 165 | ||
| 165 | ||
| 166 | 166 | if(pcw_timer_irq_flag != 0) |
| 167 | 167 | { |
| 168 | 168 | cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); |
| r5932 | r5933 | |
| 244 | 244 | memory_install_read8_handler(space, |
| 245 | 245 | block * 0x04000 + 0x3ff0, block * 0x04000 + 0x3fff, 0, 0, |
| 246 | 246 | pcw_keyboard_r); |
| 247 | // | |
| 247 | // LOG(("MEM: read block %i -> bank %i\n",block,bank)); | |
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| r5932 | r5933 | |
| 252 | 252 | memory_install_read8_handler(space, |
| 253 | 253 | block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff, 0, 0, |
| 254 | 254 | (read8_space_func) (STATIC_BANK1 + (FPTR)block)); |
| 255 | // | |
| 255 | // LOG(("MEM: read block %i -> bank %i\n",block,bank)); | |
| 256 | 256 | } |
| 257 | 257 | memory_set_bankptr(machine, block + 1, mess_ram + ((bank * 0x4000) % mess_ram_size)); |
| 258 | 258 | } |
| r5932 | r5933 | |
| 262 | 262 | static void pcw_update_write_memory_block(running_machine *machine, int block, int bank) |
| 263 | 263 | { |
| 264 | 264 | memory_set_bankptr(machine, block + 5, mess_ram + ((bank * 0x4000) % mess_ram_size)); |
| 265 | // | |
| 265 | // LOG(("MEM: write block %i -> bank %i\n",block,bank)); | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
| r5932 | r5933 | |
| 376 | 376 | pcw_banks[offset] = data; |
| 377 | 377 | |
| 378 | 378 | pcw_update_mem(space->machine, offset, data); |
| 379 | //popmessage("RAM Banks: %02x %02x %02x %02x",pcw_banks[0],pcw_banks[1],pcw_banks[2],pcw_banks[3]); | |
| 379 | //popmessage("RAM Banks: %02x %02x %02x %02x",pcw_banks[0],pcw_banks[1],pcw_banks[2],pcw_banks[3]); | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | static WRITE8_HANDLER(pcw_bank_force_selection_w) |
| r5932 | r5933 | |
| 568 | 568 | { |
| 569 | 569 | /* from Jacob Nevins docs */ |
| 570 | 570 | UINT8 ret = pcw_get_sys_status(space->machine); |
| 571 | ||
| 572 | // LOG(("SYS: Status port returning %02x\n",ret)); | |
| 571 | ||
| 572 | // LOG(("SYS: Status port returning %02x\n",ret)); | |
| 573 | 573 | return ret; |
| 574 | 574 | } |
| 575 | 575 | |
| r5932 | r5933 | |
| 693 | 693 | |
| 694 | 694 | static ADDRESS_MAP_START(pcw_io, ADDRESS_SPACE_IO, 8) |
| 695 | 695 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 696 | AM_RANGE(0x000, 0x07f) AM_READWRITE(pcw_fdc_r, pcw_fdc_w) | |
| 696 | AM_RANGE(0x000, 0x07f) AM_READWRITE(pcw_fdc_r, pcw_fdc_w) | |
| 697 | 697 | AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r, pcw_expansion_w) |
| 698 | 698 | AM_RANGE(0x0f0, 0x0f3) AM_WRITE( pcw_bank_select_w) |
| 699 | 699 | AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r, pcw_bank_force_selection_w) |
| r5932 | r5933 | |
| 739 | 739 | { |
| 740 | 740 | /* ram paging is actually undefined at power-on */ |
| 741 | 741 | pcw_bank_force = 0x00; |
| 742 | ||
| 742 | ||
| 743 | 743 | pcw_banks[0] = 0x80; |
| 744 | 744 | pcw_banks[1] = 0x81; |
| 745 | 745 | pcw_banks[2] = 0x82; |
| r5932 | r5933 | |
| 759 | 759 | |
| 760 | 760 | cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0x0ff); |
| 761 | 761 | |
| 762 | /* copy boot code into RAM - yes, it's skipping a step, | |
| 763 | but there is no verified dump of the boot sequence */ | |
| 762 | /* copy boot code into RAM - yes, it's skipping a step, | |
| 763 | but there is no verified dump of the boot sequence */ | |
| 764 | 764 | |
| 765 | memset(mess_ram,0x00,mess_ram_size); | |
| 765 | memset(mess_ram,0x00,mess_ram_size); | |
| 766 | 766 | for(x=0;x<256;x++) |
| 767 | 767 | mess_ram[x+2] = code[x]; |
| 768 | 768 | |
| r5932 | r5933 | |
| 792 | 792 | b0: f4 exit del> = 0 8 6 4 1 f6 |
| 793 | 793 | &3FF0 &3FF1 &3FF2 &3FF3 &3FF4 &3FF5 &3FF6 &3FF7 &3FF8 &3FF9 &3FFA |
| 794 | 794 | |
| 795 | 2008-05 FP: | |
| 795 | 2008-05 FP: | |
| 796 | 796 | Small note about atural keyboard: currently, |
| 797 | 797 | - "Paste" is mapped to 'F9' |
| 798 | 798 | - "Exit" is mapped to 'F10' |
| r5932 | r5933 | |
| 921 | 921 | PORT_START("LINE12") /* 0x03ffc */ |
| 922 | 922 | PORT_BIT(0xff, 0x00, IPT_UNUSED) |
| 923 | 923 | |
| 924 | /* 2008-05 FP: not sure if this key is correct, "Caps Lock" is already mapped above. | |
| 925 | For now, I let it with no default mapping. */ | |
| 924 | /* 2008-05 FP: not sure if this key is correct, "Caps Lock" is already mapped above. | |
| 925 | For now, I let it with no default mapping. */ | |
| 926 | 926 | PORT_START("LINE13") /* 0x03ffd */ |
| 927 | 927 | PORT_BIT(0x3f, 0x000, IPT_UNUSED) |
| 928 | 928 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") //PORT_CODE(KEYCODE_CAPSLOCK) |
| r5932 | r5933 | |
| 1008 | 1008 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1009 | 1009 | MDRV_SOUND_ADD("beep", BEEP, 0) |
| 1010 | 1010 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1011 | ||
| 1011 | ||
| 1012 | 1012 | MDRV_NEC765A_ADD("nec765", pcw_nec765_interface) |
| 1013 | ||
| 1013 | ||
| 1014 | 1014 | MDRV_FLOPPY_2_DRIVES_ADD(pcw_floppy_config) |
| 1015 | 1015 | MACHINE_DRIVER_END |
| 1016 | 1016 | |
| r5932 | r5933 | |
| 1032 | 1032 | /* I am loading the boot-program outside of the Z80 memory area, because it |
| 1033 | 1033 | is banked. */ |
| 1034 | 1034 | /* 8256boot.bin is not a real ROM, it is what is loaded into RAM by the boot sequence |
| 1035 | It was typed in by hand based on the disassembly found at | |
| 1035 | It was typed in by hand based on the disassembly found at | |
| 1036 | 1036 | http://www.chiark.greenend.org.uk/~jacobn/cpm/pcwboot.html */ |
| 1037 | 1037 | |
| 1038 | 1038 | // for now all models use the same rom |
| r5932 | r5933 | |
| 1040 | 1040 | ROM_START(model) \ |
| 1041 | 1041 | ROM_REGION(0x010000, "maincpu",0) \ |
| 1042 | 1042 | ROM_FILL(0x0000,0x10000,0x00) \ |
| 1043 | /* | |
| 1043 | /* ROM_LOAD("pcwboot.bin", 0x010000, 608, BAD_DUMP CRC(679b0287) SHA1(5dde974304e3376ace00850d6b4c8ec3b674199e))*/ \ | |
| 1044 | 1044 | ROM_REGION(256,"bootcode",0) \ |
| 1045 | 1045 | ROM_LOAD("8256boot.bin", 0, 256, NO_DUMP CRC(d55925bd) SHA1(bca6a47d657557be99cb8580d4bf90968d8dde4a)) \ |
| 1046 | 1046 | ROM_END \ |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | OHIO SCIENTIFIC MODEL 600 REV D |
| 9 | 9 | |
| 10 | 10 | |-------------------------------------------------------------------------------------------| |
| 11 | | 2114 2114 | | |
| 12 | | LS138 CN1 | | |
| 13 | | IC1 2114 2114 | | |
| 14 | | LS04 LS75 LS75 | | |
| 15 | | 2114 2114 | | |
| 16 | | LS138 | | |
| 17 | | 2114 2114 LS125 LS125 | | |
| 18 | | LS138 | | |
| 19 | | - 2114 2114 8T28 8T28 | | |
| 20 | | | | | |
| 21 | |C| 2114 2114 | | |
| 22 | |N| | | |
| 23 | |3| 2114 2114 6502 | | |
| 24 | | | | | |
| 25 | | - 2114 2114 | | |
| 26 | | | | |
| 27 | | 2114 8T28 ROM0 | | |
| 28 | | LS163 LS157 LS174 | | |
| 29 | | 2114 8T28 ROM1 | | |
| 30 | | CA3130 LS163 LS157 LS02 | | |
| 31 | | 2114 8T28 ROM2 | | |
| 32 | | LS14 LS163 LS157 LS04 | | |
| 33 | | SW1 ROM3 | | |
| 34 | | 7417 7404 LS20 ROM5 7408 LS139 | | |
| 35 | | ROM4 | | |
| 36 | | - 74123 7474 LS163 LS165 7474 | | |
| 37 | |C| | | |
| 38 | |N| 7476 7400 LS157 LS93 LS04 6850 | | |
| 39 | |2| | | |
| 40 | | - 7403 74123 3.7MHz LS86 LS163 LS20 CN4 | | |
| 11 | | 2114 2114 | | |
| 12 | | LS138 CN1 | | |
| 13 | | IC1 2114 2114 | | |
| 14 | | LS04 LS75 LS75 | | |
| 15 | | 2114 2114 | | |
| 16 | | LS138 | | |
| 17 | | 2114 2114 LS125 LS125 | | |
| 18 | | LS138 | | |
| 19 | | - 2114 2114 8T28 8T28 | | |
| 20 | | | | | |
| 21 | |C| 2114 2114 | | |
| 22 | |N| | | |
| 23 | |3| 2114 2114 6502 | | |
| 24 | | | | | |
| 25 | | - 2114 2114 | | |
| 26 | | | | |
| 27 | | 2114 8T28 ROM0 | | |
| 28 | | LS163 LS157 LS174 | | |
| 29 | | 2114 8T28 ROM1 | | |
| 30 | | CA3130 LS163 LS157 LS02 | | |
| 31 | | 2114 8T28 ROM2 | | |
| 32 | | LS14 LS163 LS157 LS04 | | |
| 33 | | SW1 ROM3 | | |
| 34 | | 7417 7404 LS20 ROM5 7408 LS139 | | |
| 35 | | ROM4 | | |
| 36 | | - 74123 7474 LS163 LS165 7474 | | |
| 37 | |C| | | |
| 38 | |N| 7476 7400 LS157 LS93 LS04 6850 | | |
| 39 | |2| | | |
| 40 | | - 7403 74123 3.7MHz LS86 LS163 LS20 CN4 | | |
| 41 | 41 | |-------------------------------------------------------------------------------------------| |
| 42 | 42 | |
| 43 | 43 | Notes: |
| 44 | 44 | All IC's shown. |
| 45 | 45 | |
| 46 | ROM0-5 - | |
| 47 | 6502 - | |
| 48 | 6850 - Asynchronous Communications Interface Adapter | |
| 49 | 8T28 - 4-Bit Bidirectional Bus Transceiver | |
| 50 | CA3130 - Operational Amplifier | |
| 51 | CN1 - OSI-48 bus connector | |
| 52 | CN2 - | |
| 53 | CN3 - | |
| 54 | CN4 - sound connector | |
| 55 | SW1 - | |
| 46 | ROM0-5 - | |
| 47 | 6502 - | |
| 48 | 6850 - Asynchronous Communications Interface Adapter | |
| 49 | 8T28 - 4-Bit Bidirectional Bus Transceiver | |
| 50 | CA3130 - Operational Amplifier | |
| 51 | CN1 - OSI-48 bus connector | |
| 52 | CN2 - | |
| 53 | CN3 - | |
| 54 | CN4 - sound connector | |
| 55 | SW1 - | |
| 56 | 56 | |
| 57 | 57 | */ |
| 58 | 58 | |
| r5932 | r5933 | |
| 64 | 64 | ---------- |
| 65 | 65 | |
| 66 | 66 | |-------------------------------------------------------------------------------------------| |
| 67 | | 2114 2114 | | |
| 68 | | LS138 CN1 | | |
| 69 | | IC1 2114 2114 | | |
| 70 | | 7404 LS75 LS75 | | |
| 71 | | 2114 2114 | | |
| 72 | | LS138 | | |
| 73 | | 2114 2114 LS125 LS125 | | |
| 74 | | LS138 | | |
| 75 | | - 2114* 2114* 8T28* 8T28* | | |
| 76 | | | | | |
| 77 | |C| 2114* 2114* | | |
| 78 | |N| CN4 | | |
| 79 | |3| 2114* 2114* 6502 | | |
| 80 | | | | | |
| 81 | | - 2114* 2114* | | |
| 82 | | | | |
| 83 | | 2114 8T28 ROM0 | | |
| 84 | | 74163 LS157 | | |
| 85 | | 2114 8T28 ROM1 | | |
| 86 | | IC66' 74163 LS157 7402 | | |
| 87 | | ROM2 | | |
| 88 | | IC67' 74163 LS157 7404 | | |
| 89 | | ROM3 | | |
| 90 | | IC68' 7404 7420 ROM5 LS139 | | |
| 91 | | ROM4 | | |
| 92 | | - LS123 7474 74163 74165 LS123 | | |
| 93 | |C| | | |
| 94 | |N| 7476 7400 7493 7404 6850 | | |
| 95 | |2| | | |
| 96 | | - 7403 LS123 8MHz 74163 LS20 | | |
| 67 | | 2114 2114 | | |
| 68 | | LS138 CN1 | | |
| 69 | | IC1 2114 2114 | | |
| 70 | | 7404 LS75 LS75 | | |
| 71 | | 2114 2114 | | |
| 72 | | LS138 | | |
| 73 | | 2114 2114 LS125 LS125 | | |
| 74 | | LS138 | | |
| 75 | | - 2114* 2114* 8T28* 8T28* | | |
| 76 | | | | | |
| 77 | |C| 2114* 2114* | | |
| 78 | |N| CN4 | | |
| 79 | |3| 2114* 2114* 6502 | | |
| 80 | | | | | |
| 81 | | - 2114* 2114* | | |
| 82 | | | | |
| 83 | | 2114 8T28 ROM0 | | |
| 84 | | 74163 LS157 | | |
| 85 | | 2114 8T28 ROM1 | | |
| 86 | | IC66' 74163 LS157 7402 | | |
| 87 | | ROM2 | | |
| 88 | | IC67' 74163 LS157 7404 | | |
| 89 | | ROM3 | | |
| 90 | | IC68' 7404 7420 ROM5 LS139 | | |
| 91 | | ROM4 | | |
| 92 | | - LS123 7474 74163 74165 LS123 | | |
| 93 | |C| | | |
| 94 | |N| 7476 7400 7493 7404 6850 | | |
| 95 | |2| | | |
| 96 | | - 7403 LS123 8MHz 74163 LS20 | | |
| 97 | 97 | |-------------------------------------------------------------------------------------------| |
| 98 | 98 | |
| 99 | 99 | Notes: |
| 100 | 100 | All IC's shown. |
| 101 | 101 | |
| 102 | ROM0-5 - | |
| 103 | 6502 - | |
| 104 | 6850 - Asynchronous Communications Interface Adapter | |
| 105 | 8T28 - 4-Bit Bidirectional Bus Transceiver | |
| 106 | CN1 - OSI-48 Bus Connector | |
| 107 | CN2 - | |
| 108 | CN3 - | |
| 109 | CN4 - UHF Modulator Output | |
| 110 | * - present when 8KB of RAM installed | |
| 111 | ' - present when cassette option installed | |
| 102 | ROM0-5 - | |
| 103 | 6502 - | |
| 104 | 6850 - Asynchronous Communications Interface Adapter | |
| 105 | 8T28 - 4-Bit Bidirectional Bus Transceiver | |
| 106 | CN1 - OSI-48 Bus Connector | |
| 107 | CN2 - | |
| 108 | CN3 - | |
| 109 | CN4 - UHF Modulator Output | |
| 110 | * - present when 8KB of RAM installed | |
| 111 | ' - present when cassette option installed | |
| 112 | 112 | |
| 113 | 113 | */ |
| 114 | 114 | |
| r5932 | r5933 | |
| 122 | 122 | OSI 470 REV B |
| 123 | 123 | |
| 124 | 124 | |-------------------------------------------------------------------| |
| 125 | | | | |
| 126 | | 8T26 8T26 | | |
| 127 | | | | |
| 128 | | 7417 | | |
| 129 | | | | |
| 130 | | 6820 6850 7400 U2C | | |
| 131 | | 7417 | | |
| 132 | | | | |
| 133 | | | | |
| 134 | | 7417 7404 | | |
| 135 | | | | |
| 136 | | | | |
| 137 | | 7417 | | |
| 138 | | | | |
| 139 | | 7400 7404 74123 74123 7410 | | |
| 140 | | 4MHz | | |
| 141 | | | | |
| 142 | | | | |
| 143 | | 7400 7493 74390 74390 74390 7404 7430 7404 | | |
| 144 | | | | |
| 145 | | | | |
| 146 | | U6A | | |
| 147 | | | | |
| 125 | | | | |
| 126 | | 8T26 8T26 | | |
| 127 | | | | |
| 128 | | 7417 | | |
| 129 | | | | |
| 130 | | 6820 6850 7400 U2C | | |
| 131 | | 7417 | | |
| 132 | | | | |
| 133 | | | | |
| 134 | | 7417 7404 | | |
| 135 | | | | |
| 136 | | | | |
| 137 | | 7417 | | |
| 138 | | | | |
| 139 | | 7400 7404 74123 74123 7410 | | |
| 140 | | 4MHz | | |
| 141 | | | | |
| 142 | | | | |
| 143 | | 7400 7493 74390 74390 74390 7404 7430 7404 | | |
| 144 | | | | |
| 145 | | | | |
| 146 | | U6A | | |
| 147 | | | | |
| 148 | 148 | |-------------------------------------------------------------------| |
| 149 | 149 | |
| 150 | 150 | Notes: |
| 151 | 151 | All IC's shown. |
| 152 | 152 | |
| 153 | 6850 - Asynchronous Communications Interface Adapter | |
| 154 | 6820 - Peripheral Interface Adapter | |
| 155 | 8T26 - 4-Bit Bidirectional Bus Transceiver | |
| 156 | U2C - PROTO? | |
| 157 | U6A - PROTO? | |
| 153 | 6850 - Asynchronous Communications Interface Adapter | |
| 154 | 6820 - Peripheral Interface Adapter | |
| 155 | 8T26 - 4-Bit Bidirectional Bus Transceiver | |
| 156 | U2C - PROTO? | |
| 157 | U6A - PROTO? | |
| 158 | 158 | |
| 159 | 159 | */ |
| 160 | 160 | |
| 161 | 161 | /* |
| 162 | 162 | |
| 163 | ||
| 163 | TODO: | |
| 164 | 164 | |
| 165 | - fix uk101 video to 64x16 | |
| 166 | - floppy PIA is actually a 6820 | |
| 167 | - break key | |
| 168 | - power on reset | |
| 169 | - Superboard II revisions A/C/D | |
| 170 | - uk101 medium resolution graphics | |
| 171 | - uk101 ay-3-8910 sound | |
| 172 | - cassette | |
| 173 | - faster cassette | |
| 174 | - floppy | |
| 175 | - wemon? | |
| 165 | - fix uk101 video to 64x16 | |
| 166 | - floppy PIA is actually a 6820 | |
| 167 | - break key | |
| 168 | - power on reset | |
| 169 | - Superboard II revisions A/C/D | |
| 170 | - uk101 medium resolution graphics | |
| 171 | - uk101 ay-3-8910 sound | |
| 172 | - cassette | |
| 173 | - faster cassette | |
| 174 | - floppy | |
| 175 | - wemon? | |
| 176 | 176 | |
| 177 | 177 | */ |
| 178 | 178 | |
| r5932 | r5933 | |
| 268 | 268 | { |
| 269 | 269 | /* |
| 270 | 270 | |
| 271 | ||
| 271 | bit signal description | |
| 272 | 272 | |
| 273 | 0 _32 screen size (0=32x32, 1=64x16) | |
| 274 | 1 COLOR EN color enable | |
| 275 | 2 BK0 | |
| 276 | 3 BK1 | |
| 277 | 4 DAC DISABLE DAC sound enable | |
| 278 | 5 | |
| 279 | 6 | |
| 280 | 7 | |
| 273 | 0 _32 screen size (0=32x32, 1=64x16) | |
| 274 | 1 COLOR EN color enable | |
| 275 | 2 BK0 | |
| 276 | 3 BK1 | |
| 277 | 4 DAC DISABLE DAC sound enable | |
| 278 | 5 | |
| 279 | 6 | |
| 280 | 7 | |
| 281 | 281 | |
| 282 | ||
| 282 | */ | |
| 283 | 283 | |
| 284 | 284 | const device_config *discrete = devtag_get_device(space->machine, "discrete"); |
| 285 | 285 | osi_state *state = space->machine->driver_data; |
| r5932 | r5933 | |
| 295 | 295 | const device_config *speaker = devtag_get_device(space->machine, "beep"); |
| 296 | 296 | /* |
| 297 | 297 | |
| 298 | ||
| 298 | bit description | |
| 299 | 299 | |
| 300 | 0 AC control enable | |
| 301 | 1 tone generator enable | |
| 302 | 2 modem select (0 = printer, 1 = modem) | |
| 303 | 3 | |
| 304 | 4 | |
| 305 | 5 | |
| 306 | 6 | |
| 307 | 7 | |
| 300 | 0 AC control enable | |
| 301 | 1 tone generator enable | |
| 302 | 2 modem select (0 = printer, 1 = modem) | |
| 303 | 3 | |
| 304 | 4 | |
| 305 | 5 | |
| 306 | 6 | |
| 307 | 7 | |
| 308 | 308 | |
| 309 | ||
| 309 | */ | |
| 310 | 310 | |
| 311 | 311 | beep_set_state(speaker, BIT(data, 1)); |
| 312 | 312 | } |
| r5932 | r5933 | |
| 320 | 320 | /* Disk Drive */ |
| 321 | 321 | |
| 322 | 322 | /* |
| 323 | ||
| 323 | C000 FLOPIN FLOPPY DISK STATUS PORT | |
| 324 | 324 | |
| 325 | BIT FUNCTION | |
| 326 | 0 DRIVE 0 READY (0 IF READY) | |
| 327 | 1 TRACK 0 (0 IF AT TRACK 0) | |
| 328 | 2 FAULT (0 IF FAULT) | |
| 329 | 3 | |
| 330 | 4 DRIVE 1 READY (0 IF READY) | |
| 331 | 5 WRITE PROTECT (0 IF WRITE PROTECT) | |
| 332 | 6 DRIVE SELECT (1 = A OR C, 0 = B OR D) | |
| 333 | 7 INDEX (0 IF AT INDEX HOLE) | |
| 325 | BIT FUNCTION | |
| 326 | 0 DRIVE 0 READY (0 IF READY) | |
| 327 | 1 TRACK 0 (0 IF AT TRACK 0) | |
| 328 | 2 FAULT (0 IF FAULT) | |
| 329 | 3 | |
| 330 | 4 DRIVE 1 READY (0 IF READY) | |
| 331 | 5 WRITE PROTECT (0 IF WRITE PROTECT) | |
| 332 | 6 DRIVE SELECT (1 = A OR C, 0 = B OR D) | |
| 333 | 7 INDEX (0 IF AT INDEX HOLE) | |
| 334 | 334 | |
| 335 | ||
| 335 | C002 FLOPOT FLOPPY DISK CONTROL PORT | |
| 336 | 336 | |
| 337 | BIT FUNCTION | |
| 338 | 0 WRITE ENABLE (0 ALLOWS WRITING) | |
| 339 | 1 ERASE ENABLE (0 ALLOWS ERASING) | |
| 340 | ERASE ENABLE IS ON 200us AFTER WRITE IS ON | |
| 341 | ERASE ENABLE IS OFF 530us AFTER WRITE IS OFF | |
| 342 | 2 STEP BIT : INDICATES DIRECTION OF STEP (WAIT 10us FIRST) | |
| 343 | 0 INDICATES STEP TOWARD 76 | |
| 344 | 1 INDICATES STEP TOWARD 0 | |
| 345 | 3 STEP (TRANSITION FROM 1 TO 0) | |
| 346 | MUST HOLD AT LEAST 10us, MIN 8us BETWEEN | |
| 347 | 4 FAULT RESET (0 RESETS) | |
| 348 | 5 SIDE SELECT (1 = A OR B, 0 = C OR D) | |
| 349 | 6 LOW CURRENT (0 FOR TRKS 43-76, 1 FOR TRKS 0-42) | |
| 350 | 7 HEAD LOAD (0 TO LOAD : MUST WAIT 40ms AFTER) | |
| 337 | BIT FUNCTION | |
| 338 | 0 WRITE ENABLE (0 ALLOWS WRITING) | |
| 339 | 1 ERASE ENABLE (0 ALLOWS ERASING) | |
| 340 | ERASE ENABLE IS ON 200us AFTER WRITE IS ON | |
| 341 | ERASE ENABLE IS OFF 530us AFTER WRITE IS OFF | |
| 342 | 2 STEP BIT : INDICATES DIRECTION OF STEP (WAIT 10us FIRST) | |
| 343 | 0 INDICATES STEP TOWARD 76 | |
| 344 | 1 INDICATES STEP TOWARD 0 | |
| 345 | 3 STEP (TRANSITION FROM 1 TO 0) | |
| 346 | MUST HOLD AT LEAST 10us, MIN 8us BETWEEN | |
| 347 | 4 FAULT RESET (0 RESETS) | |
| 348 | 5 SIDE SELECT (1 = A OR B, 0 = C OR D) | |
| 349 | 6 LOW CURRENT (0 FOR TRKS 43-76, 1 FOR TRKS 0-42) | |
| 350 | 7 HEAD LOAD (0 TO LOAD : MUST WAIT 40ms AFTER) | |
| 351 | 351 | |
| 352 | C010 ACIA DISK CONTROLLER ACIA STATUS PORT | |
| 353 | C011 ACIAIO DISK CONTROLLER ACIA I/O PORT | |
| 352 | C010 ACIA DISK CONTROLLER ACIA STATUS PORT | |
| 353 | C011 ACIAIO DISK CONTROLLER ACIA I/O PORT | |
| 354 | 354 | */ |
| 355 | 355 | |
| 356 | 356 | static void osi470_index_callback(const device_config *controller, const device_config *img, int state) |
| r5932 | r5933 | |
| 365 | 365 | |
| 366 | 366 | /* |
| 367 | 367 | |
| 368 | ||
| 368 | bit description | |
| 369 | 369 | |
| 370 | 0 _READY DRIVE 1 | |
| 371 | 1 _TRACK 00 | |
| 372 | 2 _FAULT | |
| 373 | 3 _SECTOR | |
| 374 | 4 _READY DRIVE 2 | |
| 375 | 5 _WRITE PROTECT | |
| 376 | 6 | |
| 377 | 7 _INDEX | |
| 370 | 0 _READY DRIVE 1 | |
| 371 | 1 _TRACK 00 | |
| 372 | 2 _FAULT | |
| 373 | 3 _SECTOR | |
| 374 | 4 _READY DRIVE 2 | |
| 375 | 5 _WRITE PROTECT | |
| 376 | 6 | |
| 377 | 7 _INDEX | |
| 378 | 378 | |
| 379 | ||
| 379 | */ | |
| 380 | 380 | |
| 381 | 381 | osi_state *state = device->machine->driver_data; |
| 382 | 382 | |
| r5932 | r5933 | |
| 387 | 387 | { |
| 388 | 388 | /* |
| 389 | 389 | |
| 390 | ||
| 390 | bit description | |
| 391 | 391 | |
| 392 | 0 | |
| 393 | 1 | |
| 394 | 2 | |
| 395 | 3 | |
| 396 | 4 | |
| 397 | 5 | |
| 398 | 6 drive select | |
| 399 | 7 | |
| 392 | 0 | |
| 393 | 1 | |
| 394 | 2 | |
| 395 | 3 | |
| 396 | 4 | |
| 397 | 5 | |
| 398 | 6 drive select | |
| 399 | 7 | |
| 400 | 400 | |
| 401 | ||
| 401 | */ | |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | static WRITE8_DEVICE_HANDLER( osi470_pia_b_w ) |
| 405 | 405 | { |
| 406 | 406 | /* |
| 407 | 407 | |
| 408 | ||
| 408 | bit description | |
| 409 | 409 | |
| 410 | 0 _WRITE ENABLE | |
| 411 | 1 _ERASE ENABLE | |
| 412 | 2 _STEP IN | |
| 413 | 3 _STEP | |
| 414 | 4 _FAULT RESET | |
| 415 | 5 side select | |
| 416 | 6 _LOW CURRENT | |
| 417 | 7 _HEAD LOAD | |
| 410 | 0 _WRITE ENABLE | |
| 411 | 1 _ERASE ENABLE | |
| 412 | 2 _STEP IN | |
| 413 | 3 _STEP | |
| 414 | 4 _FAULT RESET | |
| 415 | 5 side select | |
| 416 | 6 _LOW CURRENT | |
| 417 | 7 _HEAD LOAD | |
| 418 | 418 | |
| 419 | ||
| 419 | */ | |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | static WRITE8_DEVICE_HANDLER( osi470_pia_cb2_w ) |
| r5932 | r5933 | |
| 838 | 838 | |
| 839 | 839 | /* floppy ACIA */ |
| 840 | 840 | MDRV_ACIA6850_ADD("acia_1", osi470_acia_intf) |
| 841 | ||
| 841 | ||
| 842 | 842 | MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, osi_floppy_config) |
| 843 | 843 | MACHINE_DRIVER_END |
| 844 | 844 | |
| r5932 | r5933 | |
| 908 | 908 | |
| 909 | 909 | /* System Drivers */ |
| 910 | 910 | |
| 911 | // YEAR NAME | |
| 911 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME | |
| 912 | 912 | COMP( 1978, sb2m600b, 0, 0, osi600, osi600, 0, osi600, "Ohio Scientific", "Superboard II Model 600 (Rev. B)", 0) |
| 913 | //COMP( 1980, sb2m600c, | |
| 913 | //COMP( 1980, sb2m600c, 0, 0, osi600c, osi600, 0, osi600, "Ohio Scientific", "Superboard II Model 600 (Rev. C)", 0) | |
| 914 | 914 | COMP( 1980, c1p, sb2m600b, 0, c1p, osi600, c1p, c1p, "Ohio Scientific", "Challenger 1P Series 2", GAME_NOT_WORKING) |
| 915 | 915 | COMP( 1980, c1pmf, sb2m600b, 0, c1pmf, osi600, c1p, c1pmf, "Ohio Scientific", "Challenger 1P MF Series 2", GAME_NOT_WORKING) |
| 916 | 916 | COMP( 1979, uk101, sb2m600b, 0, uk101, uk101, 0, uk101, "Compukit", "UK101", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 414 | 414 | MDRV_VIA6522_ADD( "via6522_0", 1000000, oric_6522_interface ) |
| 415 | 415 | |
| 416 | 416 | MDRV_WD179X_ADD("wd179x", oric_wd17xx_interface ) |
| 417 | ||
| 417 | ||
| 418 | 418 | MDRV_FLOPPY_4_DRIVES_ADD(oric1_floppy_config) |
| 419 | 419 | MACHINE_DRIVER_END |
| 420 | 420 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Bandai Pippin |
| 4 | 4 | |
| 5 | 5 | 17/07/2009 Skeleton driver. |
| r5932 | r5933 | |
| 12 | 12 | #include "sound/cdda.h" |
| 13 | 13 | |
| 14 | 14 | static ADDRESS_MAP_START( pippin_mem, ADDRESS_SPACE_PROGRAM, 64 ) |
| 15 | ADDRESS_MAP_UNMAP_HIGH | |
| 15 | ADDRESS_MAP_UNMAP_HIGH | |
| 16 | 16 | AM_RANGE(0x00000000, 0x005fffff) AM_RAM |
| 17 | 17 | AM_RANGE(0xf3016000, 0xf3016007) AM_NOP // ADB PORTB |
| 18 | 18 | AM_RANGE(0xf3016400, 0xf3016407) AM_NOP // ADB DDRB |
| r5932 | r5933 | |
| 34 | 34 | INPUT_PORTS_END |
| 35 | 35 | |
| 36 | 36 | |
| 37 | static MACHINE_RESET(pippin) | |
| 38 | { | |
| 37 | static MACHINE_RESET(pippin) | |
| 38 | { | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | static VIDEO_START( pippin ) |
| r5932 | r5933 | |
| 53 | 53 | MDRV_CPU_PROGRAM_MAP(pippin_mem) |
| 54 | 54 | |
| 55 | 55 | MDRV_MACHINE_RESET(pippin) |
| 56 | ||
| 56 | ||
| 57 | 57 | /* video hardware */ |
| 58 | 58 | MDRV_SCREEN_ADD("screen", RASTER) |
| 59 | 59 | MDRV_SCREEN_REFRESH_RATE(60) |
| r5932 | r5933 | |
| 80 | 80 | /* ROM definition */ |
| 81 | 81 | /* |
| 82 | 82 | |
| 83 | ||
| 83 | BIOS versions | |
| 84 | 84 | |
| 85 | dev | |
| 86 | monitor 341S0241 - 245,247,248,250 | |
| 87 | 1.0 341S0251..254 U1-U4 | |
| 88 | 1.2 341S0297..300 U15,U20,U31,U35 | |
| 89 | 1.3 341S0328..331 U1/U31, U2/U35, U3/U15 and U4/U20 | |
| 85 | dev | |
| 86 | monitor 341S0241 - 245,247,248,250 | |
| 87 | 1.0 341S0251..254 U1-U4 | |
| 88 | 1.2 341S0297..300 U15,U20,U31,U35 | |
| 89 | 1.3 341S0328..331 U1/U31, U2/U35, U3/U15 and U4/U20 | |
| 90 | 90 | |
| 91 | 91 | */ |
| 92 | 92 | |
| r5932 | r5933 | |
| 95 | 95 | ROM_LOAD64_WORD_SWAP( "341s0251.u1", 0x000006, 0x100000, CRC(aaea2449) SHA1(2f63e215260a42fb7c5f2364682d5e8c0604646f) ) |
| 96 | 96 | ROM_LOAD64_WORD_SWAP( "341s0252.u2", 0x000004, 0x100000, CRC(3d584419) SHA1(e29c764816755662693b25f1fb3c24faef4e9470) ) |
| 97 | 97 | ROM_LOAD64_WORD_SWAP( "341s0253.u3", 0x000002, 0x100000, CRC(d8ae5037) SHA1(d46ce4d87ca1120dfe2cf2ba01451f035992b6f6) ) |
| 98 | ROM_LOAD64_WORD_SWAP( "341s0254.u4", 0x000000, 0x100000, CRC(3e2851ba) SHA1(7cbf5d6999e890f5e9ab2bc4b10ca897c4dc2016) ) | |
| 98 | ROM_LOAD64_WORD_SWAP( "341s0254.u4", 0x000000, 0x100000, CRC(3e2851ba) SHA1(7cbf5d6999e890f5e9ab2bc4b10ca897c4dc2016) ) | |
| 99 | 99 | |
| 100 | 100 | ROM_REGION( 0x10000, "cdrom", 0 ) /* MATSUSHITA CR504-L OEM */ |
| 101 | 101 | ROM_LOAD( "504par4.0i.ic7", 0x0000, 0x10000, CRC(25f7dd46) SHA1(ec3b3031742807924c6259af865e701827208fec) ) |
| r5932 | r5933 | |
|---|---|---|
| 124 | 124 | PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 125 | 125 | PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 126 | 126 | PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 127 | ||
| 127 | ||
| 128 | 128 | PORT_START("KEY1") |
| 129 | 129 | PORT_BIT(0x80, 0x80, IPT_UNUSED) |
| 130 | 130 | PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| r5932 | r5933 | |
| 221 | 221 | |
| 222 | 222 | MDRV_SOUND_ADD("dac", DAC, 0) |
| 223 | 223 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 224 | ||
| 224 | ||
| 225 | 225 | MDRV_CARTSLOT_ADD("cart") |
| 226 | 226 | MDRV_CARTSLOT_EXTENSION_LIST("d2") |
| 227 | 227 | MDRV_CARTSLOT_NOT_MANDATORY |
| r5932 | r5933 | |
|---|---|---|
| 83 | 83 | |
| 84 | 84 | static ADDRESS_MAP_START( at16_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 85 | 85 | AM_RANGE(0x000000, 0x09ffff) AM_MIRROR(0xff000000) AM_RAMBANK(10) |
| 86 | // | |
| 86 | // AM_RANGE(0x0a0000, 0x0bffff) AM_READWRITE(SMH_RAM, pc_video_videoram16le_w) AM_BASE((UINT16 **)&videoram) AM_SIZE(&videoram_size) | |
| 87 | 87 | AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM |
| 88 | 88 | AM_RANGE(0x0c8000, 0x0cffff) AM_ROM |
| 89 | 89 | AM_RANGE(0x0d0000, 0x0effff) AM_RAM |
| r5932 | r5933 | |
| 96 | 96 | ADDRESS_MAP_GLOBAL_MASK(0x00ffffff) |
| 97 | 97 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK(10) |
| 98 | 98 | AM_RANGE(0x000a0000, 0x000bffff) AM_NOP |
| 99 | // | |
| 99 | // AM_RANGE(0x000b8000, 0x000bffff) AM_READWRITE(SMH_RAM, pc_video_videoram32_w) AM_BASE((UINT32 **) &videoram) AM_SIZE(&videoram_size) | |
| 100 | 100 | AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM |
| 101 | 101 | AM_RANGE(0x000c8000, 0x000cffff) AM_ROM |
| 102 | 102 | AM_RANGE(0x000d0000, 0x000effff) AM_ROM |
| r5932 | r5933 | |
| 107 | 107 | static ADDRESS_MAP_START( at586_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 108 | 108 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK(10) |
| 109 | 109 | AM_RANGE(0x000a0000, 0x000bffff) AM_NOP |
| 110 | // | |
| 110 | // AM_RANGE(0x000b8000, 0x000bffff) AM_READWRITE(SMH_RAM, pc_video_videoram32_w) AM_BASE((UINT32 **) &videoram) AM_SIZE(&videoram_size) | |
| 111 | 111 | AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("user1", 0x20000) |
| 112 | 112 | ADDRESS_MAP_END |
| 113 | 113 | |
| r5932 | r5933 | |
| 163 | 163 | AM_RANGE(0x0278, 0x027f) AM_DEVREADWRITE8("lpt_2", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 164 | 164 | AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ns16450_3", ins8250_r, ins8250_w, 0xffff) |
| 165 | 165 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ns16450_1", ins8250_r, ins8250_w, 0xffff) |
| 166 | // AM_RANGE(0x0320, 0x0323) AM_READWRITE8(pc_HDC1_r, pc_HDC1_w, 0xffff) | |
| 167 | // AM_RANGE(0x0324, 0x0327) AM_READWRITE8(pc_HDC2_r, pc_HDC2_w, 0xffff) | |
| 166 | // AM_RANGE(0x0320, 0x0323) AM_READWRITE8(pc_HDC1_r, pc_HDC1_w, 0xffff) | |
| 167 | // AM_RANGE(0x0324, 0x0327) AM_READWRITE8(pc_HDC2_r, pc_HDC2_w, 0xffff) | |
| 168 | 168 | AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_1", pc_lpt_r, pc_lpt_w, 0x00ff) |
| 169 | 169 | #ifdef ADLIB |
| 170 | 170 | AM_RANGE(0x0388, 0x0389) AM_DEVREADWRITE("ym3812", at16_388_r, at16_388_w ) |
| r5932 | r5933 | |
| 494 | 494 | MDRV_IMPORT_FROM( pc_hdc ) |
| 495 | 495 | |
| 496 | 496 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 497 | ||
| 497 | ||
| 498 | 498 | MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config) |
| 499 | 499 | MACHINE_DRIVER_END |
| 500 | 500 | |
| r5932 | r5933 | |
| 559 | 559 | MDRV_IMPORT_FROM( pc_hdc ) |
| 560 | 560 | |
| 561 | 561 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 562 | ||
| 562 | ||
| 563 | 563 | MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config) |
| 564 | 564 | MACHINE_DRIVER_END |
| 565 | 565 | |
| r5932 | r5933 | |
| 626 | 626 | MDRV_IMPORT_FROM( pc_hdc ) |
| 627 | 627 | |
| 628 | 628 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 629 | ||
| 629 | ||
| 630 | 630 | MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config) |
| 631 | 631 | MACHINE_DRIVER_END |
| 632 | 632 | |
| r5932 | r5933 | |
| 695 | 695 | MDRV_IMPORT_FROM( pc_hdc ) |
| 696 | 696 | |
| 697 | 697 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 698 | ||
| 698 | ||
| 699 | 699 | MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config) |
| 700 | 700 | MACHINE_DRIVER_END |
| 701 | 701 | |
| r5932 | r5933 | |
| 761 | 761 | MDRV_IMPORT_FROM( pc_hdc ) |
| 762 | 762 | |
| 763 | 763 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 764 | ||
| 764 | ||
| 765 | 765 | MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config) |
| 766 | 766 | MACHINE_DRIVER_END |
| 767 | 767 | |
| r5932 | r5933 | |
| 825 | 825 | ROMX_LOAD("6480090.u27", 0xf0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(2)) |
| 826 | 826 | ROMX_LOAD("6480091.u47", 0xf0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(2)) |
| 827 | 827 | |
| 828 | // ROM_SYSTEM_BIOS( 2, "atdiag", "IBM PC/AT 5170 w/Super Diagnostics") | |
| 829 | // ROMX_LOAD("atdiage.bin", 0xf8000, 0x4000, CRC(e8855d0c) SHA1(c9d53e61c08da0a64f43d691bf6cadae5393843a), ROM_SKIP(1) | ROM_BIOS(3)) | |
| 830 | // ROMX_LOAD("atdiago.bin", 0xf8001, 0x4000, CRC(606fa71d) SHA1(165e45bae7ae2da274f1e645c763c5bfcbde027b), ROM_SKIP(1) | ROM_BIOS(3)) | |
| 828 | // ROM_SYSTEM_BIOS( 2, "atdiag", "IBM PC/AT 5170 w/Super Diagnostics") | |
| 829 | // ROMX_LOAD("atdiage.bin", 0xf8000, 0x4000, CRC(e8855d0c) SHA1(c9d53e61c08da0a64f43d691bf6cadae5393843a), ROM_SKIP(1) | ROM_BIOS(3)) | |
| 830 | // ROMX_LOAD("atdiago.bin", 0xf8001, 0x4000, CRC(606fa71d) SHA1(165e45bae7ae2da274f1e645c763c5bfcbde027b), ROM_SKIP(1) | ROM_BIOS(3)) | |
| 831 | 831 | |
| 832 | 832 | ROM_REGION(0x08100, "gfx1", 0) |
| 833 | 833 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| r5932 | r5933 | |
| 902 | 902 | ROM_END |
| 903 | 903 | |
| 904 | 904 | |
| 905 | ROM_START( ibm5162 ) //MB p/n 62x1168 | |
| 905 | ROM_START( ibm5162 ) //MB p/n 62x1168 | |
| 906 | 906 | ROM_REGION16_LE(0x1000000,"maincpu", 0) |
| 907 | 907 | ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) |
| 908 | 908 | |
| r5932 | r5933 | |
| 1078 | 1078 | ROM_END |
| 1079 | 1079 | |
| 1080 | 1080 | static SYSTEM_CONFIG_START(ibmat) |
| 1081 | CONFIG_RAM_DEFAULT( (640+1024) * 1024 ) | |
| 1081 | CONFIG_RAM_DEFAULT( (640+1024) * 1024 ) | |
| 1082 | 1082 | SYSTEM_CONFIG_END |
| 1083 | 1083 | |
| 1084 | 1084 | /*************************************************************************** |
| r5932 | r5933 | |
|---|---|---|
| 31 | 31 | AM_RANGE( 0x00, 0x03) AM_READWRITE(vector_8255_1_r, vector_8255_1_w ) |
| 32 | 32 | AM_RANGE( 0x04, 0x07) AM_READWRITE(vector_8255_2_r, vector_8255_2_w ) |
| 33 | 33 | AM_RANGE( 0x0C, 0x0C) AM_WRITE ( vector06_color_set ) |
| 34 | AM_RANGE( 0x18, 0x18) AM_DEVREADWRITE("wd1793", wd17xx_data_r,wd17xx_data_w) | |
| 35 | AM_RANGE( 0x19, 0x19) AM_DEVREADWRITE("wd1793", wd17xx_sector_r,wd17xx_sector_w) | |
| 36 | AM_RANGE( 0x1A, 0x1A) AM_DEVREADWRITE("wd1793", wd17xx_track_r,wd17xx_track_w) | |
| 37 | AM_RANGE( 0x1B, 0x1B) AM_DEVREADWRITE("wd1793", wd17xx_status_r,wd17xx_command_w) | |
| 34 | AM_RANGE( 0x18, 0x18) AM_DEVREADWRITE("wd1793", wd17xx_data_r,wd17xx_data_w) | |
| 35 | AM_RANGE( 0x19, 0x19) AM_DEVREADWRITE("wd1793", wd17xx_sector_r,wd17xx_sector_w) | |
| 36 | AM_RANGE( 0x1A, 0x1A) AM_DEVREADWRITE("wd1793", wd17xx_track_r,wd17xx_track_w) | |
| 37 | AM_RANGE( 0x1B, 0x1B) AM_DEVREADWRITE("wd1793", wd17xx_status_r,wd17xx_command_w) | |
| 38 | 38 | AM_RANGE( 0x1C, 0x1C) AM_WRITE(vector_disc_w) |
| 39 | 39 | ADDRESS_MAP_END |
| 40 | 40 | |
| r5932 | r5933 | |
| 122 | 122 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) |
| 123 | 123 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) |
| 124 | 124 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) |
| 125 | PORT_START("RESET") | |
| 126 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) | |
| 127 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset 2") PORT_CODE(KEYCODE_F12) | |
| 128 | ||
| 125 | PORT_START("RESET") | |
| 126 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) | |
| 127 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset 2") PORT_CODE(KEYCODE_F12) | |
| 128 | ||
| 129 | 129 | INPUT_PORTS_END |
| 130 | 130 | |
| 131 | 131 | static const cassette_config vector_cassette_config = |
| r5932 | r5933 | |
| 155 | 155 | static MACHINE_DRIVER_START( vector06 ) |
| 156 | 156 | /* basic machine hardware */ |
| 157 | 157 | MDRV_CPU_ADD("maincpu", 8080, 3000000) |
| 158 | // | |
| 158 | // MDRV_CPU_ADD("maincpu", Z80, 3000000) | |
| 159 | 159 | MDRV_CPU_PROGRAM_MAP(vector06_mem) |
| 160 | 160 | MDRV_CPU_IO_MAP(vector06_io) |
| 161 | 161 | MDRV_CPU_VBLANK_INT("screen", vector06_interrupt) |
| r5932 | r5933 | |
| 185 | 185 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 186 | 186 | |
| 187 | 187 | MDRV_CASSETTE_ADD( "cassette", vector_cassette_config ) |
| 188 | ||
| 189 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) | |
| 190 | MDRV_FLOPPY_2_DRIVES_ADD(vector_floppy_config) | |
| 191 | 188 | |
| 189 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) | |
| 190 | MDRV_FLOPPY_2_DRIVES_ADD(vector_floppy_config) | |
| 191 | ||
| 192 | 192 | /* cartridge */ |
| 193 | 193 | MDRV_CARTSLOT_ADD("cart") |
| 194 | 194 | MDRV_CARTSLOT_EXTENSION_LIST("emr") |
| r5932 | r5933 | |
| 219 | 219 | ROM_LOAD( "vec1200.bin", 0x10000, 0x2000, CRC(37349224) SHA1(060fbb2c1a89040c929521cfd58cb6f1431a8b75)) |
| 220 | 220 | ROM_CART_LOAD("cart", 0x18000, 0x8000, ROM_FILL_FF | ROM_OPTIONAL) |
| 221 | 221 | ROM_REGION( 0x0200, "palette", 0 ) |
| 222 | ROM_LOAD( "palette.bin", 0x0000, 0x0200, CRC(74b7376b) SHA1(fb56b60babd7e6ed68e5f4e791ad2800d7ef6729)) | |
| 222 | ROM_LOAD( "palette.bin", 0x0000, 0x0200, CRC(74b7376b) SHA1(fb56b60babd7e6ed68e5f4e791ad2800d7ef6729)) | |
| 223 | 223 | ROM_END |
| 224 | 224 | ROM_START( pk6128c ) |
| 225 | 225 | ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) |
| r5932 | r5933 | |
| 233 | 233 | |
| 234 | 234 | /* Driver */ |
| 235 | 235 | |
| 236 | /* YEAR NAME | |
| 236 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 237 | 237 | COMP( 1987, vector06, 0, 0, vector06, vector06, vector06, vector06, "", "Vector 06c", GAME_NOT_WORKING) |
| 238 | 238 | COMP( 1987, vec1200, vector06, 0, vector06, vector06, vector06, vector06, "", "Vector 1200", GAME_NOT_WORKING) |
| 239 | 239 | COMP( 1987, pk6128c, vector06, 0, vector06, vector06, vector06, vector06, "", "PK-6128c", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 18 | 18 | - Support for ROM images |
| 19 | 19 | - Support for floppy disks |
| 20 | 20 | - Other peripherals |
| 21 | ||
| 21 | - Keyboard is missing the 'Break' key | |
| 22 | 22 | |
| 23 | 23 | ******************************************************************************/ |
| 24 | 24 | |
| r5932 | r5933 | |
| 57 | 57 | ADDRESS_MAP_END |
| 58 | 58 | |
| 59 | 59 | static INPUT_PORTS_START( electron ) |
| 60 | ||
| 60 | ||
| 61 | 61 | PORT_START("LINE0") /* Keyboard line 0 */ |
| 62 | 62 | 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 |
| 63 | 63 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR('[') PORT_CHAR(']') |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | REV B-1 |
| 9 | 9 | |
| 10 | 10 | |---------------------------------------------------------------------------------------------------| |
| 11 | | |----------| | | |
| 12 | | 9216 | ROM0 | LS74 | | |
| 13 | | |----------| | | |
| 14 | -- LS00 7406 LS255 LS393 4164 4164 | | |
| 15 | || |-----------| |----------| | | |
| 16 | || | WD1793 | LS14 7407 - LS393 LS74 | 8251A | 4164 4164 | | |
| 17 | || |-----------| | |----------| | | |
| 18 | |C | 4164 4164 | | |
| 19 | |N 7406 LS00 LS74 LS14 |C LS20 LS08 LS75 | | |
| 20 | |1 |N 4164 4164 | | |
| 21 | || |5 | | |
| 22 | || 7406 LS195 LS244 | LS04 LS32 LS08 4164 4164 | | |
| 23 | || - | | |
| 24 | || |------------| |--------| 4164 4164 | | |
| 25 | -- BAT | 8255A | | 8214 | LS139 LS32 LS138 LS17 | | |
| 26 | -- |------------| |--------| - 4164 4164 | | |
| 27 | || |C | | |
| 28 | || |--------| LS00 LS00 |N LS00 LS32 LS138 4164 4164 | | |
| 29 | |C | 8251A | |6 | | |
| 30 | |N |--------| |------------| - |------------| | | |
| 31 | |2 | 8255A | | Z80A | | | |
| 32 | || 1488 1489 RTC |------------| LS00 LS32 |------------| LS257 LS257 | | |
| 33 | || | | |
| 34 | -- |------------| |------------| | | |
| 35 | | LS04 | 8255A | | 8255A | | | |
| 36 | | |------------| |------------| | | |
| 37 | | | | |
| 38 | | 7404 LS257 LS257 | | |
| 39 | | 16MHz | | |
| 40 | | LS04 LS74 LS257 9016 9016 | | |
| 41 | | | | |
| 42 | -- LS74 LS04 LS74 LS163 9016 9016 | | |
| 43 | || | | |
| 44 | || 9016 9016 | | |
| 45 | || LS02 LS163 LS74 7404 7404 | | |
| 46 | || 9016 9016 | | |
| 47 | || | | |
| 48 | |C LS244 LS10 LS257 LS362 |----------| 9016 9016 | | |
| 49 | |N | ROM1 | | | |
| 50 | |3 LS245 7404 LS273 LS32 |----------| 9016 9016 | | |
| 51 | || | | |
| 52 | || 7407 LS174 LS32 9016 9016 | | |
| 53 | || 15.36MHz | | |
| 54 | || |------------| 9016 9016 | | |
| 55 | -- LS09 LS04 LS12 | 6502 | | | |
| 56 | | |------------| 9016 9016 | | |
| 57 | -- | | |
| 58 | |C LS175 LS86 LS164 LS164 9016 9016 | | |
| 59 | |N |------------| | | |
| 60 | |4 | 6845 | LS253 LS253 | | |
| 61 | -- 7426 LS02 LS74 LS00 LS164 |------------| | | |
| 62 | | LS253 LS253 | | |
| 63 | | REV B-1 W/O 1059 S/N 492 | | |
| 11 | | |----------| | | |
| 12 | | 9216 | ROM0 | LS74 | | |
| 13 | | |----------| | | |
| 14 | -- LS00 7406 LS255 LS393 4164 4164 | | |
| 15 | || |-----------| |----------| | | |
| 16 | || | WD1793 | LS14 7407 - LS393 LS74 | 8251A | 4164 4164 | | |
| 17 | || |-----------| | |----------| | | |
| 18 | |C | 4164 4164 | | |
| 19 | |N 7406 LS00 LS74 LS14 |C LS20 LS08 LS75 | | |
| 20 | |1 |N 4164 4164 | | |
| 21 | || |5 | | |
| 22 | || 7406 LS195 LS244 | LS04 LS32 LS08 4164 4164 | | |
| 23 | || - | | |
| 24 | || |------------| |--------| 4164 4164 | | |
| 25 | -- BAT | 8255A | | 8214 | LS139 LS32 LS138 LS17 | | |
| 26 | -- |------------| |--------| - 4164 4164 | | |
| 27 | || |C | | |
| 28 | || |--------| LS00 LS00 |N LS00 LS32 LS138 4164 4164 | | |
| 29 | |C | 8251A | |6 | | |
| 30 | |N |--------| |------------| - |------------| | | |
| 31 | |2 | 8255A | | Z80A | | | |
| 32 | || 1488 1489 RTC |------------| LS00 LS32 |------------| LS257 LS257 | | |
| 33 | || | | |
| 34 | -- |------------| |------------| | | |
| 35 | | LS04 | 8255A | | 8255A | | | |
| 36 | | |------------| |------------| | | |
| 37 | | | | |
| 38 | | 7404 LS257 LS257 | | |
| 39 | | 16MHz | | |
| 40 | | LS04 LS74 LS257 9016 9016 | | |
| 41 | | | | |
| 42 | -- LS74 LS04 LS74 LS163 9016 9016 | | |
| 43 | || | | |
| 44 | || 9016 9016 | | |
| 45 | || LS02 LS163 LS74 7404 7404 | | |
| 46 | || 9016 9016 | | |
| 47 | || | | |
| 48 | |C LS244 LS10 LS257 LS362 |----------| 9016 9016 | | |
| 49 | |N | ROM1 | | | |
| 50 | |3 LS245 7404 LS273 LS32 |----------| 9016 9016 | | |
| 51 | || | | |
| 52 | || 7407 LS174 LS32 9016 9016 | | |
| 53 | || 15.36MHz | | |
| 54 | || |------------| 9016 9016 | | |
| 55 | -- LS09 LS04 LS12 | 6502 | | | |
| 56 | | |------------| 9016 9016 | | |
| 57 | -- | | |
| 58 | |C LS175 LS86 LS164 LS164 9016 9016 | | |
| 59 | |N |------------| | | |
| 60 | |4 | 6845 | LS253 LS253 | | |
| 61 | -- 7426 LS02 LS74 LS00 LS164 |------------| | | |
| 62 | | LS253 LS253 | | |
| 63 | | REV B-1 W/O 1059 S/N 492 | | |
| 64 | 64 | |---------------------------------------------------------------------------------------------------| |
| 65 | 65 | |
| 66 | 66 | Notes: |
| 67 | 67 | All IC's shown. |
| 68 | 68 | |
| 69 | ROM0 - "IC 244-032 V1.0" | |
| 70 | ROM1 - "IC 244-033 V1.0" | |
| 71 | Z80A - Zilog Z8400APS Z80A CPU | |
| 72 | 6502 - Synertek SY6502A CPU | |
| 73 | 4164 - NEC D4164-2 64Kx1 Dynamic RAM | |
| 74 | 9016 - AMD AM9016EPC 16Kx1 Dynamic RAM | |
| 75 | 8214 - NEC µPB8214C Priority Interrupt Control Unit | |
| 76 | 8255A - NEC D8255AC-5 Programmable Peripheral Interface | |
| 77 | 8251A - NEC D8251AC Programmable Communication Interface | |
| 78 | WD1793 - Mitsubishi MB8877 Floppy Disc Controller | |
| 79 | 9216 - SMC FDC9216 Floppy Disk Data Separator | |
| 80 | 1488 - Motorola MC1488 Quad Line EIA-232D Driver | |
| 81 | 1489 - Motorola MC1489 Quad Line Receivers | |
| 82 | 6845 - Hitachi HD46505SP CRT Controller | |
| 83 | RTC - OKI MSM58321RS Real Time Clock | |
| 84 | BAT - 3.4V battery | |
| 85 | CN1 - parallel connector | |
| 86 | CN2 - serial connector | |
| 87 | CN3 - winchester connector | |
| 88 | CN4 - monitor connector | |
| 89 | CN5 - floppy data connector | |
| 90 | CN6 - floppy power connector | |
| 69 | ROM0 - "IC 244-032 V1.0" | |
| 70 | ROM1 - "IC 244-033 V1.0" | |
| 71 | Z80A - Zilog Z8400APS Z80A CPU | |
| 72 | 6502 - Synertek SY6502A CPU | |
| 73 | 4164 - NEC D4164-2 64Kx1 Dynamic RAM | |
| 74 | 9016 - AMD AM9016EPC 16Kx1 Dynamic RAM | |
| 75 | 8214 - NEC ?PB8214C Priority Interrupt Control Unit | |
| 76 | 8255A - NEC D8255AC-5 Programmable Peripheral Interface | |
| 77 | 8251A - NEC D8251AC Programmable Communication Interface | |
| 78 | WD1793 - Mitsubishi MB8877 Floppy Disc Controller | |
| 79 | 9216 - SMC FDC9216 Floppy Disk Data Separator | |
| 80 | 1488 - Motorola MC1488 Quad Line EIA-232D Driver | |
| 81 | 1489 - Motorola MC1489 Quad Line Receivers | |
| 82 | 6845 - Hitachi HD46505SP CRT Controller | |
| 83 | RTC - OKI MSM58321RS Real Time Clock | |
| 84 | BAT - 3.4V battery | |
| 85 | CN1 - parallel connector | |
| 86 | CN2 - serial connector | |
| 87 | CN3 - winchester connector | |
| 88 | CN4 - monitor connector | |
| 89 | CN5 - floppy data connector | |
| 90 | CN6 - floppy power connector | |
| 91 | 91 | |
| 92 | 92 | */ |
| 93 | 93 | |
| 94 | 94 | /* |
| 95 | 95 | |
| 96 | ||
| 96 | TODO: | |
| 97 | 97 | |
| 98 | - ? | |
| 99 | Device 'u76': warning - attempt to direct-map address 00001FFD in program space | |
| 100 | Device 'u76': warning - attempt to direct-map address 00001FFE in program space | |
| 101 | Device 'u76': warning - attempt to direct-map address 00001FFF in program space | |
| 98 | - ? | |
| 99 | Device 'u76': warning - attempt to direct-map address 00001FFD in program space | |
| 100 | Device 'u76': warning - attempt to direct-map address 00001FFE in program space | |
| 101 | Device 'u76': warning - attempt to direct-map address 00001FFF in program space | |
| 102 | 102 | |
| 103 | - write to banked RAM at 0x0000-0x1fff when ROM is active | |
| 104 | - real keyboard w/i8049 | |
| 105 | - keyboard beeper | |
| 106 | - Winchester (Tandon TM501/CMI CM-5412 10MB drive on Xebec S1410 controller) | |
| 103 | - write to banked RAM at 0x0000-0x1fff when ROM is active | |
| 104 | - real keyboard w/i8049 | |
| 105 | - keyboard beeper | |
| 106 | - Winchester (Tandon TM501/CMI CM-5412 10MB drive on Xebec S1410 controller) | |
| 107 | 107 | |
| 108 | 108 | */ |
| 109 | 109 | |
| r5932 | r5933 | |
| 185 | 185 | { |
| 186 | 186 | { /* unshifted */ |
| 187 | 187 | { 0xc0, 0xd4, 0xd8, 0xdc, 0xe0, 0xe4, 0xe8, 0xec }, |
| 188 | { 0xf0, 0xfc, 0x90, 0xf4, 0xf8, 0x94, 0xc4, 0xc8 }, | |
| 188 | { 0xf0, 0xfc, 0x90, 0xf4, 0xf8, 0x94, 0xc4, 0xc8 }, | |
| 189 | 189 | { 0xcc, 0xd0, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35 }, |
| 190 | { 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x60 }, | |
| 191 | { 0x08, 0x88, 0x8c, 0x71, 0x77, 0x65, 0x72, 0x74 }, | |
| 190 | { 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x60 }, | |
| 191 | { 0x08, 0x88, 0x8c, 0x71, 0x77, 0x65, 0x72, 0x74 }, | |
| 192 | 192 | { 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d }, |
| 193 | 193 | { 0x7f, 0x00, 0x80, 0x61, 0x73, 0x64, 0x66, 0x67 }, |
| 194 | { 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27, 0x5c, 0x84 }, | |
| 194 | { 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27, 0x5c, 0x84 }, | |
| 195 | 195 | { 0x00, 0x7a, 0x78, 0x63, 0x76, 0x62, 0x6e, 0x6d }, |
| 196 | { 0x2c, 0x2e, 0x2f, 0x00, 0x0a, 0x20, 0x81, 0x82 }, | |
| 197 | { 0xb7, 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac }, | |
| 196 | { 0x2c, 0x2e, 0x2f, 0x00, 0x0a, 0x20, 0x81, 0x82 }, | |
| 197 | { 0xb7, 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac }, | |
| 198 | 198 | { 0xb1, 0xb2, 0xb3, 0x83, 0xb0, 0xae, 0x00, 0x00 }, |
| 199 | 199 | }, |
| 200 | 200 | |
| 201 | 201 | { /* shifted */ |
| 202 | 202 | { 0xc1, 0xd5, 0xd9, 0xdd, 0xe1, 0xe5, 0xe9, 0xed }, |
| 203 | { 0xf1, 0xfd, 0x91, 0xf5, 0xf9, 0x95, 0xc5, 0xc9 }, | |
| 203 | { 0xf1, 0xfd, 0x91, 0xf5, 0xf9, 0x95, 0xc5, 0xc9 }, | |
| 204 | 204 | { 0xcd, 0xd1, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25 }, |
| 205 | { 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x7e }, | |
| 206 | { 0x08, 0x89, 0x8d, 0x51, 0x57, 0x45, 0x52, 0x54 }, | |
| 205 | { 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x7e }, | |
| 206 | { 0x08, 0x89, 0x8d, 0x51, 0x57, 0x45, 0x52, 0x54 }, | |
| 207 | 207 | { 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d, 0x0d }, |
| 208 | 208 | { 0x7f, 0x00, 0x80, 0x41, 0x53, 0x44, 0x46, 0x47 }, |
| 209 | { 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22, 0x7c, 0x85 }, | |
| 209 | { 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22, 0x7c, 0x85 }, | |
| 210 | 210 | { 0x00, 0x5a, 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d }, |
| 211 | { 0x3c, 0x3e, 0x3f, 0x0a, 0x20, 0x81, 0x82, 0xb7 }, | |
| 212 | { 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac, 0xb1 }, | |
| 211 | { 0x3c, 0x3e, 0x3f, 0x0a, 0x20, 0x81, 0x82, 0xb7 }, | |
| 212 | { 0xb8, 0xb9, 0xad, 0xb4, 0xb5, 0xb6, 0xac, 0xb1 }, | |
| 213 | 213 | { 0xb2, 0xb3, 0x83, 0xb0, 0xa0, 0x00, 0x00, 0x00 }, |
| 214 | 214 | }, |
| 215 | 215 | |
| r5932 | r5933 | |
| 378 | 378 | static READ8_HANDLER( keyboard_r ) |
| 379 | 379 | { |
| 380 | 380 | v1050_state *state = space->machine->driver_data; |
| 381 | ||
| 381 | ||
| 382 | 382 | static const char *const KEY_ROW[] = { "X0", "X1", "X2", "X3", "X4", "X5", "X6", "X7", "X8", "X9", "XA", "XB" }; |
| 383 | ||
| 383 | ||
| 384 | 384 | return input_port_read(space->machine, KEY_ROW[state->keylatch]); |
| 385 | 385 | } |
| 386 | 386 | |
| r5932 | r5933 | |
| 395 | 395 | { |
| 396 | 396 | /* |
| 397 | 397 | |
| 398 | ||
| 398 | bit description | |
| 399 | 399 | |
| 400 | P20 | |
| 401 | P21 | |
| 402 | P22 | |
| 403 | P23 | |
| 404 | P24 | |
| 405 | P25 led output | |
| 406 | P26 speaker (NE555) output | |
| 407 | P27 serial output | |
| 400 | P20 | |
| 401 | P21 | |
| 402 | P22 | |
| 403 | P23 | |
| 404 | P24 | |
| 405 | P25 led output | |
| 406 | P26 speaker (NE555) output | |
| 407 | P27 serial output | |
| 408 | 408 | |
| 409 | ||
| 409 | */ | |
| 410 | 410 | |
| 411 | 411 | v1050_state *state = space->machine->driver_data; |
| 412 | 412 | |
| 413 | 413 | output_set_led_value(0, BIT(data, 5)); |
| 414 | // | |
| 414 | // discrete_sound_w(discrete, NODE_01, BIT(data, 6)); | |
| 415 | 415 | state->kb_so = BIT(data, 7); |
| 416 | 416 | } |
| 417 | 417 | |
| r5932 | r5933 | |
| 430 | 430 | ADDRESS_MAP_UNMAP_HIGH |
| 431 | 431 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 432 | 432 | AM_RANGE(0x84, 0x87) AM_DEVREADWRITE(I8255A_DISP_TAG, i8255a_r, i8255a_w) |
| 433 | // AM_RANGE(0x88, 0x88) AM_DEVREADWRITE(I8251A_KB_TAG, msm8251_data_r, msm8251_data_w) | |
| 434 | // AM_RANGE(0x89, 0x89) AM_DEVREADWRITE(I8251A_KB_TAG, msm8251_status_r, msm8251_control_w) | |
| 433 | // AM_RANGE(0x88, 0x88) AM_DEVREADWRITE(I8251A_KB_TAG, msm8251_data_r, msm8251_data_w) | |
| 434 | // AM_RANGE(0x89, 0x89) AM_DEVREADWRITE(I8251A_KB_TAG, msm8251_status_r, msm8251_control_w) | |
| 435 | 435 | AM_RANGE(0x88, 0x88) AM_READ(v1050_get_key) AM_DEVWRITE(I8251A_KB_TAG, msm8251_data_w) |
| 436 | 436 | AM_RANGE(0x89, 0x89) AM_READ(v1050_get_key_status) AM_DEVWRITE(I8251A_KB_TAG, msm8251_control_w) |
| 437 | 437 | AM_RANGE(0x8c, 0x8c) AM_DEVREADWRITE(I8251A_SIO_TAG, msm8251_data_r, msm8251_data_w) |
| r5932 | r5933 | |
| 441 | 441 | AM_RANGE(0x9c, 0x9f) AM_DEVREADWRITE(I8255A_RTC_TAG, i8255a_r, i8255a_w) |
| 442 | 442 | AM_RANGE(0xa0, 0xa0) AM_READWRITE(vint_clr_r, vint_clr_w) |
| 443 | 443 | AM_RANGE(0xb0, 0xb0) AM_READWRITE(dint_clr_r, dint_clr_w) |
| 444 | AM_RANGE(0xc0, 0xc0) AM_WRITE(v1050_i8214_w) | |
| 444 | AM_RANGE(0xc0, 0xc0) AM_WRITE(v1050_i8214_w) | |
| 445 | 445 | AM_RANGE(0xd0, 0xd0) AM_WRITE(bank_w) |
| 446 | // | |
| 446 | // AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE(S1410_TAG, s1410_r, s1410_w) | |
| 447 | 447 | ADDRESS_MAP_END |
| 448 | 448 | |
| 449 | 449 | static ADDRESS_MAP_START( v1050_crt_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r5932 | r5933 | |
| 479 | 479 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter DelCh") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) |
| 480 | 480 | 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)) |
| 481 | 481 | 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)) |
| 482 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 482 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 483 | 483 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad - DelLn") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 484 | 484 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 End") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 485 | 485 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad , DelWd") |
| r5932 | r5933 | |
| 506 | 506 | 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)) |
| 507 | 507 | |
| 508 | 508 | PORT_START("X4") |
| 509 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 509 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 510 | 510 | 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)) |
| 511 | 511 | 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)) |
| 512 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 512 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 513 | 513 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 514 | 514 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 Last") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 515 | 515 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 PgUp") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| r5932 | r5933 | |
| 583 | 583 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 584 | 584 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 585 | 585 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 586 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 586 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 587 | 587 | INPUT_PORTS_END |
| 588 | 588 | |
| 589 | 589 | static INPUT_PORTS_START( v1050 ) |
| r5932 | r5933 | |
| 676 | 676 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') |
| 677 | 677 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 678 | 678 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 679 | ||
| 679 | ||
| 680 | 680 | PORT_START("ROW9") |
| 681 | 681 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 682 | 682 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| r5932 | r5933 | |
| 696 | 696 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) |
| 697 | 697 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) |
| 698 | 698 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 699 | ||
| 699 | ||
| 700 | 700 | PORT_START("ROW11") |
| 701 | 701 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) |
| 702 | 702 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) |
| r5932 | r5933 | |
| 706 | 706 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 707 | 707 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 708 | 708 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) |
| 709 | ||
| 709 | ||
| 710 | 710 | PORT_START("ROW12") |
| 711 | 711 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 712 | 712 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| r5932 | r5933 | |
| 782 | 782 | { |
| 783 | 783 | /* |
| 784 | 784 | |
| 785 | bit | |
| 785 | bit signal description | |
| 786 | 786 | |
| 787 | PA0 f_ds<0> drive 0 select | |
| 788 | PA1 f_ds<1> drive 1 select | |
| 789 | PA2 f_ds<2> drive 2 select | |
| 790 | PA3 f_ds<3> drive 3 select | |
| 791 | PA4 f_side_1 floppy side select | |
| 792 | PA5 f_pre_comp precompensation | |
| 793 | PA6 f_motor_on* floppy motor | |
| 794 | PA7 f_dden* double density select | |
| 795 | ||
| 796 | */ | |
| 787 | PA0 f_ds<0> drive 0 select | |
| 788 | PA1 f_ds<1> drive 1 select | |
| 789 | PA2 f_ds<2> drive 2 select | |
| 790 | PA3 f_ds<3> drive 3 select | |
| 791 | PA4 f_side_1 floppy side select | |
| 792 | PA5 f_pre_comp precompensation | |
| 793 | PA6 f_motor_on* floppy motor | |
| 794 | PA7 f_dden* double density select | |
| 797 | 795 | |
| 796 | */ | |
| 797 | ||
| 798 | 798 | v1050_state *state = device->machine->driver_data; |
| 799 | 799 | |
| 800 | 800 | int f_motor_on = !BIT(data, 6); |
| r5932 | r5933 | |
| 829 | 829 | { |
| 830 | 830 | /* |
| 831 | 831 | |
| 832 | bit | |
| 832 | bit signal description | |
| 833 | 833 | |
| 834 | PC0 pr_strobe printer strobe | |
| 835 | PC1 f_int_enb floppy interrupt enable | |
| 834 | PC0 pr_strobe printer strobe | |
| 835 | PC1 f_int_enb floppy interrupt enable | |
| 836 | 836 | PC2 baud_sel_a |
| 837 | 837 | PC3 baud_sel_b |
| 838 | PC4 pr_busy* printer busy | |
| 839 | PC5 pr_pe* printer paper end | |
| 840 | PC6 | |
| 841 | PC7 | |
| 842 | ||
| 843 | */ | |
| 838 | PC4 pr_busy* printer busy | |
| 839 | PC5 pr_pe* printer paper end | |
| 840 | PC6 | |
| 841 | PC7 | |
| 844 | 842 | |
| 843 | */ | |
| 844 | ||
| 845 | 845 | v1050_state *state = device->machine->driver_data; |
| 846 | 846 | |
| 847 | 847 | UINT8 data = 0; |
| r5932 | r5933 | |
| 856 | 856 | { |
| 857 | 857 | /* |
| 858 | 858 | |
| 859 | bit | |
| 859 | bit signal description | |
| 860 | 860 | |
| 861 | PC0 pr_strobe printer strobe | |
| 862 | PC1 f_int_enb floppy interrupt enable | |
| 861 | PC0 pr_strobe printer strobe | |
| 862 | PC1 f_int_enb floppy interrupt enable | |
| 863 | 863 | PC2 baud_sel_a |
| 864 | 864 | PC3 baud_sel_b |
| 865 | PC4 pr_busy* printer busy | |
| 866 | PC5 pr_pe* printer paper end | |
| 867 | PC6 | |
| 868 | PC7 | |
| 869 | ||
| 870 | */ | |
| 865 | PC4 pr_busy* printer busy | |
| 866 | PC5 pr_pe* printer paper end | |
| 867 | PC6 | |
| 868 | PC7 | |
| 871 | 869 | |
| 870 | */ | |
| 871 | ||
| 872 | 872 | v1050_state *state = device->machine->driver_data; |
| 873 | 873 | |
| 874 | 874 | int baud_sel = (data >> 2) & 0x03; |
| r5932 | r5933 | |
| 914 | 914 | { |
| 915 | 915 | /* |
| 916 | 916 | |
| 917 | bit | |
| 917 | bit signal description | |
| 918 | 918 | |
| 919 | PB0 RS-232 | |
| 920 | PB1 Winchester | |
| 921 | PB2 keyboard | |
| 922 | PB3 floppy disk interrupt | |
| 923 | PB4 vertical interrupt | |
| 924 | PB5 display interrupt | |
| 925 | PB6 expansion B | |
| 926 | PB7 expansion A | |
| 927 | ||
| 928 | */ | |
| 919 | PB0 RS-232 | |
| 920 | PB1 Winchester | |
| 921 | PB2 keyboard | |
| 922 | PB3 floppy disk interrupt | |
| 923 | PB4 vertical interrupt | |
| 924 | PB5 display interrupt | |
| 925 | PB6 expansion B | |
| 926 | PB7 expansion A | |
| 929 | 927 | |
| 928 | */ | |
| 929 | ||
| 930 | 930 | v1050_state *state = device->machine->driver_data; |
| 931 | 931 | |
| 932 | 932 | state->int_mask = data; |
| r5932 | r5933 | |
| 936 | 936 | { |
| 937 | 937 | /* |
| 938 | 938 | |
| 939 | bit | |
| 939 | bit signal description | |
| 940 | 940 | |
| 941 | PC0 | |
| 942 | PC1 | |
| 943 | PC2 | |
| 944 | PC3 clock busy | |
| 945 | PC4 clock address write | |
| 946 | PC5 clock data write | |
| 947 | PC6 clock data read | |
| 948 | PC7 clock device select | |
| 949 | ||
| 950 | */ | |
| 941 | PC0 | |
| 942 | PC1 | |
| 943 | PC2 | |
| 944 | PC3 clock busy | |
| 945 | PC4 clock address write | |
| 946 | PC5 clock data write | |
| 947 | PC6 clock data read | |
| 948 | PC7 clock device select | |
| 951 | 949 | |
| 950 | */ | |
| 951 | ||
| 952 | 952 | v1050_state *state = device->machine->driver_data; |
| 953 | 953 | |
| 954 | 954 | return msm58321_busy_r(state->msm58321) << 3; |
| r5932 | r5933 | |
| 958 | 958 | { |
| 959 | 959 | /* |
| 960 | 960 | |
| 961 | bit | |
| 961 | bit signal description | |
| 962 | 962 | |
| 963 | PC0 | |
| 964 | PC1 | |
| 965 | PC2 | |
| 966 | PC3 clock busy | |
| 967 | PC4 clock address write | |
| 968 | PC5 clock data write | |
| 969 | PC6 clock data read | |
| 970 | PC7 clock device select | |
| 971 | ||
| 972 | */ | |
| 963 | PC0 | |
| 964 | PC1 | |
| 965 | PC2 | |
| 966 | PC3 clock busy | |
| 967 | PC4 clock address write | |
| 968 | PC5 clock data write | |
| 969 | PC6 clock data read | |
| 970 | PC7 clock device select | |
| 973 | 971 | |
| 972 | */ | |
| 973 | ||
| 974 | 974 | v1050_state *state = device->machine->driver_data; |
| 975 | 975 | |
| 976 | 976 | msm58321_address_write_w(state->msm58321, BIT(data, 4)); |
| r5932 | r5933 | |
| 1080 | 1080 | } |
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | static const wd17xx_interface v1050_wd17xx_intf = | |
| 1084 | { | |
| 1083 | static const wd17xx_interface v1050_wd17xx_intf = | |
| 1084 | { | |
| 1085 | 1085 | v1050_mb8877_callback, |
| 1086 | 1086 | NULL, |
| 1087 | 1087 | {FLOPPY_0,FLOPPY_1,NULL,NULL} |
| r5932 | r5933 | |
| 1121 | 1121 | /* initialize I8214 */ |
| 1122 | 1122 | i8214_etlg_w(state->i8214, 1); |
| 1123 | 1123 | i8214_inte_w(state->i8214, 1); |
| 1124 | ||
| 1124 | ||
| 1125 | 1125 | /* initialize RTC */ |
| 1126 | 1126 | msm58321_cs1_w(state->msm58321, 1); |
| 1127 | 1127 | |
| r5932 | r5933 | |
| 1202 | 1202 | MDRV_CPU_PROGRAM_MAP(v1050_crt_mem) |
| 1203 | 1203 | MDRV_QUANTUM_PERFECT_CPU(M6502_TAG) |
| 1204 | 1204 | |
| 1205 | // MDRV_CPU_ADD(I8049_TAG, I8049, XTAL_4_608MHz) | |
| 1206 | // MDRV_CPU_IO_MAP(v1050_kbd_io) | |
| 1205 | // MDRV_CPU_ADD(I8049_TAG, I8049, XTAL_4_608MHz) | |
| 1206 | // MDRV_CPU_IO_MAP(v1050_kbd_io) | |
| 1207 | 1207 | |
| 1208 | 1208 | MDRV_MACHINE_START(v1050) |
| 1209 | 1209 | MDRV_MACHINE_RESET(v1050) |
| r5932 | r5933 | |
| 1215 | 1215 | MDRV_IMPORT_FROM(v1050_video) |
| 1216 | 1216 | |
| 1217 | 1217 | /* sound hardware */ |
| 1218 | /* MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 1219 | MDRV_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) | |
| 1220 | MDRV_SOUND_CONFIG_DISCRETE(v1050) | |
| 1221 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)*/ | |
| 1218 | /* MDRV_SPEAKER_STANDARD_MONO("mono") | |
| 1219 | MDRV_SOUND_ADD(DISCRETE_TAG, DISCRETE, 0) | |
| 1220 | MDRV_SOUND_CONFIG_DISCRETE(v1050) | |
| 1221 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)*/ | |
| 1222 | 1222 | |
| 1223 | 1223 | /* devices */ |
| 1224 | 1224 | MDRV_I8214_ADD(UPB8214_TAG, XTAL_16MHz/4, v1050_8214_intf) |
| r5932 | r5933 | |
| 1230 | 1230 | MDRV_MSM8251_ADD(I8251A_KB_TAG, /*XTAL_16MHz/8,*/ kb_8251_intf) |
| 1231 | 1231 | MDRV_MSM8251_ADD(I8251A_SIO_TAG, /*XTAL_16MHz/8,*/ sio_8251_intf) |
| 1232 | 1232 | MDRV_WD1793_ADD(MB8877_TAG, /*XTAL_16MHz/16,*/ v1050_wd17xx_intf ) |
| 1233 | MDRV_FLOPPY_2_DRIVES_ADD(v1050_floppy_config) | |
| 1233 | MDRV_FLOPPY_2_DRIVES_ADD(v1050_floppy_config) | |
| 1234 | 1234 | MDRV_TIMER_ADD_PERIODIC(TIMER_KB_TAG, kb_8251_tick, HZ((double)XTAL_16MHz/4/13/8)) |
| 1235 | 1235 | MDRV_TIMER_ADD_PERIODIC(TIMER_SIO_TAG, sio_8251_tick, HZ((double)XTAL_16MHz/4/13/16)) |
| 1236 | 1236 | |
| r5932 | r5933 | |
| 1259 | 1259 | |
| 1260 | 1260 | /* System Drivers */ |
| 1261 | 1261 | |
| 1262 | /* YEAR | |
| 1262 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 1263 | 1263 | COMP( 1983, v1050, 0, 0, v1050, v1050, 0, v1050, "Visual Technology Incorporated", "Visual 1050", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | TODO: |
| 12 | 12 | |
| 13 | - Tyche bios is broken | |
| 14 | - several disk interfaces (720K/1.44MB/3.2MB) | |
| 15 | - discrete sound | |
| 16 | - Gold Card (68000 @ 16MHz, 2MB RAM) | |
| 17 | - Super Gold Card (68020 @ 24MHz, 4MB RAM) | |
| 18 | - QLToolkit II ROM | |
| 19 | - GST 68kOS ROM | |
| 20 | - natural keyboard SHIFT does not work, it causes characters to be skipped altogether | |
| 21 | - get modified Danish version to boot (e.g. MD_DESEL was patched to jump to 0x1cd5e) | |
| 22 | - ICL One Per Desk / British Telecom Merlin Tonto / Telecom Australia Computerphone / Mega OPD (US) | |
| 23 | - 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 | |
| 24 | - Sandy Q-XT 640 (original motherboard, Super QBoard 512KB, Centronics, Super Toolkit II, FDC, 1 or 2 3.5" 1MB drives, 3 expansion slots) | |
| 25 | - CST Thor PC 1F (720K 3.5") | |
| 26 | - CST Thor PC 2F (2x 720k 3.5") | |
| 27 | - CST Thor PC 2FW (20MB Winchester + 720K 3.5") | |
| 28 | - CST Thor 20 (68020) | |
| 29 | - CST Thor 21 (68020+68881) | |
| 13 | - Tyche bios is broken | |
| 14 | - several disk interfaces (720K/1.44MB/3.2MB) | |
| 15 | - discrete sound | |
| 16 | - Gold Card (68000 @ 16MHz, 2MB RAM) | |
| 17 | - Super Gold Card (68020 @ 24MHz, 4MB RAM) | |
| 18 | - QLToolkit II ROM | |
| 19 | - GST 68kOS ROM | |
| 20 | - natural keyboard SHIFT does not work, it causes characters to be skipped altogether | |
| 21 | - get modified Danish version to boot (e.g. MD_DESEL was patched to jump to 0x1cd5e) | |
| 22 | - ICL One Per Desk / British Telecom Merlin Tonto / Telecom Australia Computerphone / Mega OPD (US) | |
| 23 | - 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 | |
| 24 | - Sandy Q-XT 640 (original motherboard, Super QBoard 512KB, Centronics, Super Toolkit II, FDC, 1 or 2 3.5" 1MB drives, 3 expansion slots) | |
| 25 | - CST Thor PC 1F (720K 3.5") | |
| 26 | - CST Thor PC 2F (2x 720k 3.5") | |
| 27 | - CST Thor PC 2FW (20MB Winchester + 720K 3.5") | |
| 28 | - CST Thor 20 (68020) | |
| 29 | - CST Thor 21 (68020+68881) | |
| 30 | 30 | - CST Thor XVI CF (Workstation, 68000 @ 8 MHz, M6802, 68682 DUART) |
| 31 | 31 | - CST Thor XVI IF (Single Floppy) |
| 32 | 32 | - CST Thor XVI FF (Dual Floppy) |
| r5932 | r5933 | |
| 641 | 641 | TRACKS([80]) |
| 642 | 642 | SECTORS([40]) |
| 643 | 643 | SECTOR_LENGTH([512]) |
| 644 | FIRST_SECTOR_ID([1])) | |
| 644 | FIRST_SECTOR_ID([1])) | |
| 645 | 645 | FLOPPY_OPTIONS_END |
| 646 | 646 | |
| 647 | 647 | static const floppy_config ql_floppy_config = |
| r5932 | r5933 | |
| 696 | 696 | MDRV_CARTSLOT_EXTENSION_LIST("bin") |
| 697 | 697 | MDRV_CARTSLOT_NOT_MANDATORY |
| 698 | 698 | MDRV_CARTSLOT_LOAD(ql_cart) |
| 699 | ||
| 699 | ||
| 700 | 700 | MDRV_FLOPPY_2_DRIVES_ADD(ql_floppy_config) |
| 701 | 701 | MACHINE_DRIVER_END |
| 702 | 702 | |
| r5932 | r5933 | |
| 709 | 709 | |
| 710 | 710 | MDRV_CPU_ADD(I8051_TAG, I8051, X4) |
| 711 | 711 | MDRV_CPU_IO_MAP(ipc_io_map) |
| 712 | ||
| 712 | ||
| 713 | 713 | MDRV_DEVICE_REMOVE("cart") |
| 714 | ||
| 714 | ||
| 715 | 715 | MDRV_FLOPPY_2_DRIVES_REMOVE() |
| 716 | 716 | MACHINE_DRIVER_END |
| 717 | 717 | |
| r5932 | r5933 | |
| 721 | 721 | MDRV_SCREEN_MODIFY(SCREEN_TAG) |
| 722 | 722 | MDRV_SCREEN_REFRESH_RATE(60) |
| 723 | 723 | MDRV_SCREEN_SIZE(960, 262) |
| 724 | MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) | |
| 724 | MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1) | |
| 725 | 725 | MACHINE_DRIVER_END |
| 726 | 726 | |
| 727 | 727 | /* ROMs */ |
| r5932 | r5933 | |
| 765 | 765 | |
| 766 | 766 | ROM_IPC |
| 767 | 767 | /* |
| 768 | ROM_REGION( 0x400, "plds", 0 ) | |
| 769 | ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) | |
| 770 | */ | |
| 768 | ROM_REGION( 0x400, "plds", 0 ) | |
| 769 | ROM_LOAD( "hal16l8.ic38", 0x0000, 0x0400, NO_DUMP ) | |
| 770 | */ | |
| 771 | 771 | ROM_END |
| 772 | 772 | |
| 773 | 773 | ROM_START( ql_us ) |
| r5932 | r5933 | |
| 920 | 920 | CONFIG_RAM (384 * 1024) // 256K expansion |
| 921 | 921 | CONFIG_RAM (640 * 1024) // 512K expansion |
| 922 | 922 | CONFIG_RAM (896 * 1024) // Trump Card |
| 923 | CONFIG_DEVICE(ql_serial_getinfo) | |
| 923 | CONFIG_DEVICE(ql_serial_getinfo) | |
| 924 | 924 | SYSTEM_CONFIG_END |
| 925 | 925 | |
| 926 | 926 | static SYSTEM_CONFIG_START( opd ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | DEC VT220 |
| 4 | 4 | |
| 5 | 5 | 30/06/2009 Skeleton driver. |
| r5932 | r5933 | |
| 20 | 20 | INPUT_PORTS_START( vt220 ) |
| 21 | 21 | INPUT_PORTS_END |
| 22 | 22 | |
| 23 | static MACHINE_RESET(vt220) | |
| 24 | { | |
| 23 | static MACHINE_RESET(vt220) | |
| 24 | { | |
| 25 | 25 | memset(mess_ram,0,16*1024); |
| 26 | 26 | } |
| 27 | 27 | |
| r5932 | r5933 | |
| 39 | 39 | /* basic machine hardware */ |
| 40 | 40 | MDRV_CPU_ADD("maincpu", I8051, XTAL_16MHz) |
| 41 | 41 | MDRV_CPU_PROGRAM_MAP(vt220_mem) |
| 42 | MDRV_CPU_IO_MAP(vt220_io) | |
| 42 | MDRV_CPU_IO_MAP(vt220_io) | |
| 43 | 43 | |
| 44 | 44 | MDRV_MACHINE_RESET(vt220) |
| 45 | ||
| 45 | ||
| 46 | 46 | /* video hardware */ |
| 47 | 47 | MDRV_SCREEN_ADD("screen", RASTER) |
| 48 | 48 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 71 | 71 | |
| 72 | 72 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 73 | 73 | COMP( 1983, vt220, 0, 0, vt220, vt220, 0, vt220, "DEC", "VT220", GAME_NOT_WORKING) |
| 74 | //COMP( 1983, vt240, 0, 0, vt220, vt220, 0, vt220, "DEC", "VT240", GAME_NOT_WORKING) | |
| 75 | //COMP( 1983, vt241, 0, 0, vt220, vt220, 0, vt220, "DEC", "VT241", GAME_NOT_WORKING) | |
| 74 | //COMP( 1983, vt240, 0, 0, vt220, vt220, 0, vt220, "DEC", "VT240", GAME_NOT_WORKING) | |
| 75 | //COMP( 1983, vt241, 0, 0, vt220, vt220, 0, vt220, "DEC", "VT241", GAME_NOT_WORKING) | |
| 76 | 76 |
| r5932 | r5933 | |
|---|---|---|
| 426 | 426 | MDRV_CPU_ADD("rcmcu", M6502, XTAL_1MHz) /* 1 MHz? */ |
| 427 | 427 | MDRV_CPU_PROGRAM_MAP(cdtv_rcmcu_mem) |
| 428 | 428 | |
| 429 | // MDRV_CPU_ADD("lcd", LC6554, XTAL_4MHz) /* 4 MHz? */ | |
| 430 | // MDRV_CPU_PROGRAM_MAP(cdtv_lcd_mem) | |
| 429 | // MDRV_CPU_ADD("lcd", LC6554, XTAL_4MHz) /* 4 MHz? */ | |
| 430 | // MDRV_CPU_PROGRAM_MAP(cdtv_lcd_mem) | |
| 431 | 431 | |
| 432 | 432 | MDRV_MACHINE_START( cdtv ) |
| 433 | 433 | MDRV_MACHINE_RESET( cdtv ) |
| r5932 | r5933 | |
|---|---|---|
| 54 | 54 | |
| 55 | 55 | TODO: |
| 56 | 56 | |
| 57 | - ABC 77 keyboard | |
| 58 | - bit accurate Z80 SIO/2 (cassette) | |
| 57 | - ABC 77 keyboard | |
| 58 | - bit accurate Z80 SIO/2 (cassette) | |
| 59 | 59 | - floppy controller board |
| 60 | 60 | - hard disks (ABC-850 10MB, ABC-852 20MB, ABC-856 60MB) |
| 61 | 61 | |
| r5932 | r5933 | |
| 387 | 387 | { |
| 388 | 388 | /* |
| 389 | 389 | |
| 390 | ||
| 390 | bit description | |
| 391 | 391 | |
| 392 | 0 physical block address bit 0 | |
| 393 | 1 physical block address bit 1 | |
| 394 | 2 physical block address bit 2 | |
| 395 | 3 physical block address bit 3 | |
| 396 | 4 physical block address bit 4 | |
| 397 | 5 | |
| 398 | 6 | |
| 399 | 7 allocate block | |
| 392 | 0 physical block address bit 0 | |
| 393 | 1 physical block address bit 1 | |
| 394 | 2 physical block address bit 2 | |
| 395 | 3 physical block address bit 3 | |
| 396 | 4 physical block address bit 4 | |
| 397 | 5 | |
| 398 | 6 | |
| 399 | 7 allocate block | |
| 400 | 400 | |
| 401 | ||
| 401 | */ | |
| 402 | 402 | |
| 403 | 403 | abc806_state *state = space->machine->driver_data; |
| 404 | 404 | |
| r5932 | r5933 | |
| 668 | 668 | INPUT_PORTS_END |
| 669 | 669 | |
| 670 | 670 | static INPUT_PORTS_START( abc800 ) |
| 671 | // | |
| 671 | // PORT_INCLUDE(abc77) | |
| 672 | 672 | PORT_INCLUDE(fake_keyboard) |
| 673 | 673 | |
| 674 | 674 | PORT_START("SB") |
| r5932 | r5933 | |
| 1017 | 1017 | |
| 1018 | 1018 | static ABCBUS_CONFIG( abc802_abcbus_config ) |
| 1019 | 1019 | { |
| 1020 | // | |
| 1020 | // { LUXOR_55_21046, CONKORT_TAG }, won't boot with this enabled | |
| 1021 | 1021 | { NULL } |
| 1022 | 1022 | }; |
| 1023 | 1023 | |
| r5932 | r5933 | |
| 1203 | 1203 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1204 | 1204 | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1205 | 1205 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf) |
| 1206 | // | |
| 1206 | // MDRV_ABC77_ADD(abc800_abc77_intf) | |
| 1207 | 1207 | MDRV_LUXOR_55_21046_ADD |
| 1208 | 1208 | MDRV_PRINTER_ADD("printer") |
| 1209 | 1209 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 1210 | 1210 | |
| 1211 | 1211 | /* fake keyboard */ |
| 1212 | 1212 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1213 | ||
| 1213 | ||
| 1214 | 1214 | MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config) |
| 1215 | 1215 | MACHINE_DRIVER_END |
| 1216 | 1216 | |
| r5932 | r5933 | |
| 1240 | 1240 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1241 | 1241 | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1242 | 1242 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf) |
| 1243 | // | |
| 1243 | // MDRV_ABC77_ADD(abc800_abc77_intf) | |
| 1244 | 1244 | MDRV_LUXOR_55_21046_ADD |
| 1245 | 1245 | MDRV_PRINTER_ADD("printer") |
| 1246 | 1246 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 1247 | 1247 | |
| 1248 | 1248 | /* fake keyboard */ |
| 1249 | 1249 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1250 | ||
| 1250 | ||
| 1251 | 1251 | MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config) |
| 1252 | 1252 | MACHINE_DRIVER_END |
| 1253 | 1253 | |
| r5932 | r5933 | |
| 1277 | 1277 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1278 | 1278 | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1279 | 1279 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc802_dart_intf) |
| 1280 | // | |
| 1280 | // MDRV_ABC77_ADD(abc802_abc77_intf) | |
| 1281 | 1281 | MDRV_LUXOR_55_21046_ADD |
| 1282 | 1282 | MDRV_PRINTER_ADD("printer") |
| 1283 | 1283 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 1284 | 1284 | |
| 1285 | 1285 | /* fake keyboard */ |
| 1286 | 1286 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1287 | ||
| 1287 | ||
| 1288 | 1288 | MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config) |
| 1289 | 1289 | MACHINE_DRIVER_END |
| 1290 | 1290 | |
| r5932 | r5933 | |
| 1312 | 1312 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2)) |
| 1313 | 1313 | MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf) |
| 1314 | 1314 | MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc806_dart_intf) |
| 1315 | // | |
| 1315 | // MDRV_ABC77_ADD(abc806_abc77_intf) | |
| 1316 | 1316 | MDRV_LUXOR_55_21046_ADD |
| 1317 | 1317 | MDRV_PRINTER_ADD("printer") |
| 1318 | 1318 | MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) |
| 1319 | 1319 | |
| 1320 | 1320 | /* fake keyboard */ |
| 1321 | 1321 | MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500)) |
| 1322 | ||
| 1322 | ||
| 1323 | 1323 | MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config) |
| 1324 | 1324 | MACHINE_DRIVER_END |
| 1325 | 1325 | |
| r5932 | r5933 | |
| 1335 | 1335 | 800 8" DD88 |
| 1336 | 1336 | ABC 6-2X ABC832 |
| 1337 | 1337 | ABC 6-3X ABC838 |
| 1338 | ||
| 1338 | ABC 6-52 ABC834 | |
| 1339 | 1339 | UFD 6.XX Winchester |
| 1340 | 1340 | |
| 1341 | 1341 | |
| 1342 | ||
| 1342 | Floppy Controllers | |
| 1343 | 1343 | |
| 1344 | Art N/O | |
| 1345 | -------- | |
| 1346 | 55 10761-01 "old" controller | |
| 1347 | 55 10828-01 "old" controller | |
| 1348 | 55 20900-0x | |
| 1349 | 55 21046-11 Luxor Conkort 25 pin D-sub connector | |
| 1350 | 55 21046-21 Luxor Conkort 34 pin FDD connector | |
| 1351 | 55 21046-41 Luxor Conkort both of the above | |
| 1344 | Art N/O | |
| 1345 | -------- | |
| 1346 | 55 10761-01 "old" controller | |
| 1347 | 55 10828-01 "old" controller | |
| 1348 | 55 20900-0x | |
| 1349 | 55 21046-11 Luxor Conkort 25 pin D-sub connector | |
| 1350 | 55 21046-21 Luxor Conkort 34 pin FDD connector | |
| 1351 | 55 21046-41 Luxor Conkort both of the above | |
| 1352 | 1352 | |
| 1353 | 1353 | */ |
| 1354 | 1354 | |
| r5932 | r5933 | |
| 1436 | 1436 | |
| 1437 | 1437 | ROM_REGION( 0x200, "hru2", 0 ) |
| 1438 | 1438 | ROM_LOAD( "fgctl.bin", 0x0000, 0x0200, BAD_DUMP CRC(7a19de8d) SHA1(e7cc49e749b37f7d7dd14f3feda53eae843a8fe0) ) |
| 1439 | // | |
| 1439 | // ROM_LOAD( "64 90127-01.12g", 0x0000, 0x0200, NO_DUMP ) // "HRU II" 7621 (82S131), ABC800C HR compatibility mode palette | |
| 1440 | 1440 | |
| 1441 | 1441 | ROM_REGION( 0x400, "v50", 0 ) |
| 1442 | 1442 | ROM_LOAD( "64 90242-01.7e", 0x0000, 0x0200, NO_DUMP ) // "V50" 7621 (82S131), HR vertical timing 50Hz |
| r5932 | r5933 | |
| 1596 | 1596 | |
| 1597 | 1597 | /* System Drivers */ |
| 1598 | 1598 | |
| 1599 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME | |
| 1599 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 1600 | 1600 | COMP( 1981, abc800m, 0, 0, abc800m, abc800, abc800, abc800, "Luxor Datorer AB", "ABC 800 M/HR", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 1601 | 1601 | COMP( 1981, abc800c, abc800m, 0, abc800c, abc800, abc800, abc800, "Luxor Datorer AB", "ABC 800 C/HR", GAME_NOT_WORKING ) |
| 1602 | 1602 | COMP( 1983, abc802, 0, 0, abc802, abc802, abc802, abc802, "Luxor Datorer AB", "ABC 802", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| r5932 | r5933 | |
|---|---|---|
| 140 | 140 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 141 | 141 | |
| 142 | 142 | MDRV_CASSETTE_ADD( "cassette", orion_cassette_config ) |
| 143 | ||
| 144 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface ) | |
| 145 | ||
| 143 | ||
| 144 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface ) | |
| 145 | ||
| 146 | 146 | MDRV_FLOPPY_4_DRIVES_ADD(orion_floppy_config) |
| 147 | ||
| 147 | ||
| 148 | 148 | MDRV_CARTSLOT_ADD("cart") |
| 149 | 149 | MACHINE_DRIVER_END |
| 150 | 150 | |
| 151 | 151 | static MACHINE_DRIVER_START( orion128ms ) |
| 152 | 152 | MDRV_IMPORT_FROM(orion128) |
| 153 | 153 | MDRV_DEVICE_REMOVE("ppi8255_2") |
| 154 | MDRV_I8255A_ADD( "ppi8255_2", rk7007_ppi8255_interface ) | |
| 155 | MACHINE_DRIVER_END | |
| 154 | MDRV_I8255A_ADD( "ppi8255_2", rk7007_ppi8255_interface ) | |
| 155 | MACHINE_DRIVER_END | |
| 156 | 156 | |
| 157 | 157 | static const ay8910_interface orionz80_ay_interface = |
| 158 | 158 | { |
| r5932 | r5933 | |
| 200 | 200 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 201 | 201 | |
| 202 | 202 | MDRV_CASSETTE_ADD( "cassette", orion_cassette_config ) |
| 203 | ||
| 204 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface ) | |
| 205 | ||
| 203 | ||
| 204 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface ) | |
| 205 | ||
| 206 | 206 | MDRV_FLOPPY_4_DRIVES_ADD(orion_floppy_config) |
| 207 | ||
| 207 | ||
| 208 | 208 | MDRV_CARTSLOT_ADD("cart") |
| 209 | 209 | MACHINE_DRIVER_END |
| 210 | 210 | |
| r5932 | r5933 | |
| 212 | 212 | MDRV_IMPORT_FROM(orionz80) |
| 213 | 213 | |
| 214 | 214 | MDRV_DEVICE_REMOVE("ppi8255_2") |
| 215 | MDRV_I8255A_ADD( "ppi8255_2", rk7007_ppi8255_interface ) | |
| 216 | MACHINE_DRIVER_END | |
| 215 | MDRV_I8255A_ADD( "ppi8255_2", rk7007_ppi8255_interface ) | |
| 216 | MACHINE_DRIVER_END | |
| 217 | 217 | |
| 218 | 218 | static MACHINE_DRIVER_START( orionpro ) |
| 219 | 219 | MDRV_CPU_ADD("maincpu", Z80, 5000000) |
| r5932 | r5933 | |
| 251 | 251 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 252 | 252 | |
| 253 | 253 | MDRV_CASSETTE_ADD( "cassette", orion_cassette_config ) |
| 254 | ||
| 254 | ||
| 255 | 255 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface ) |
| 256 | ||
| 256 | ||
| 257 | 257 | MDRV_FLOPPY_4_DRIVES_ADD(orion_floppy_config) |
| 258 | ||
| 258 | ||
| 259 | 259 | MDRV_CARTSLOT_ADD("cart") |
| 260 | 260 | MACHINE_DRIVER_END |
| 261 | 261 |
| r5932 | r5933 | |
|---|---|---|
| 66 | 66 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 67 | 67 | ROM_LOAD( "qx10boot.bin", 0x0000, 0x0800, CRC(f8dfcba5) SHA1(a7608f8aa7da355dcaf257ee28b66ded8974ce3a)) |
| 68 | 68 | /* The first part of this rom looks like code for an embedded controller? |
| 69 | ||
| 69 | From 8300 on, looks like a characters generator */ | |
| 70 | 70 | ROM_LOAD( "mfboard.bin", 0x8000, 0x0800, CRC(fa27f333) SHA1(73d27084ca7b002d5f370220d8da6623a6e82132)) |
| 71 | 71 | /* This rom looks like a character generator */ |
| 72 | 72 | ROM_LOAD( "qge.bin", 0x8800, 0x0800, CRC(ed93cb81) SHA1(579e68bde3f4184ded7d89b72c6936824f48d10b)) |
| r5932 | r5933 | |
|---|---|---|
| 6 | 6 | ---------- |
| 7 | 7 | |
| 8 | 8 | |-----------------------------------------------------------| |
| 9 | | | | |
| 10 | | | 4051 4042 2114 2114 | | |
| 11 | | CN1 | | |
| 12 | | | 4051 4042 2114 2114 | | |
| 13 | | | | |
| 14 | | 4011 4013 |--------| 2114 2114 | | |
| 15 | | | 4515 | | | |
| 16 | | 4013 |--------| 2114 2114 | | |
| 17 | | 4042 | | |
| 18 | | 4011 2114 2114 | | |
| 19 | | 4011 | | |
| 20 | | 4011 2114 2114 | | |
| 21 | |SW1 | | |
| 22 | | 4011 |--------| 2114 2114 | | |
| 23 | | | PROM | | | |
| 24 | | 40107 |--------| 2114 2114 | | |
| 25 | | 4050 1.75MHz | | |
| 26 | | |-------------| 2114 2114 | | |
| 27 | | | CDP1802 | | | |
| 28 | | |-------------| 2114 2114 | | |
| 29 | | 4049 | | |
| 30 | | |-------------| 2114 2114 | | |
| 31 | | 4.43MHz | CDP1864 | | | |
| 32 | | |-------------| 2114 2114 | | |
| 33 | | | | |
| 34 | | 741 4502 2114 2114 | | |
| 35 | | - | | |
| 36 | | | 2114 2114 2114 | | |
| 37 | | CN2 | | |
| 38 | | | 4001 4051 2114 2114 | | |
| 39 | | - | | |
| 40 | | 2114 2114 | | |
| 9 | | | | |
| 10 | | | 4051 4042 2114 2114 | | |
| 11 | | CN1 | | |
| 12 | | | 4051 4042 2114 2114 | | |
| 13 | | | | |
| 14 | | 4011 4013 |--------| 2114 2114 | | |
| 15 | | | 4515 | | | |
| 16 | | 4013 |--------| 2114 2114 | | |
| 17 | | 4042 | | |
| 18 | | 4011 2114 2114 | | |
| 19 | | 4011 | | |
| 20 | | 4011 2114 2114 | | |
| 21 | |SW1 | | |
| 22 | | 4011 |--------| 2114 2114 | | |
| 23 | | | PROM | | | |
| 24 | | 40107 |--------| 2114 2114 | | |
| 25 | | 4050 1.75MHz | | |
| 26 | | |-------------| 2114 2114 | | |
| 27 | | | CDP1802 | | | |
| 28 | | |-------------| 2114 2114 | | |
| 29 | | 4049 | | |
| 30 | | |-------------| 2114 2114 | | |
| 31 | | 4.43MHz | CDP1864 | | | |
| 32 | | |-------------| 2114 2114 | | |
| 33 | | | | |
| 34 | | 741 4502 2114 2114 | | |
| 35 | | - | | |
| 36 | | | 2114 2114 2114 | | |
| 37 | | CN2 | | |
| 38 | | | 4001 4051 2114 2114 | | |
| 39 | | - | | |
| 40 | | 2114 2114 | | |
| 41 | 41 | |-----------------------------------------------------------| |
| 42 | 42 | |
| 43 | 43 | Notes: |
| 44 | 44 | All IC's shown. |
| 45 | ||
| 46 | PROM - MMI6341 | |
| 47 | 2114 - 2114 4096 Bit (1024x4) NMOS Static RAM | |
| 48 | CDP1802 - RCA CDP1802 CMOS 8-Bit Microprocessor @ 1.75 MHz | |
| 49 | CDP1864 - RCA CDP1864CE COS/MOS PAL Compatible Color TV Interface @ 1.75 MHz | |
| 50 | CN1 - keyboard connector | |
| 51 | CN2 - ASTEC RF modulator connector | |
| 52 | SW1 - Run/Reset switch | |
| 53 | 45 | |
| 46 | PROM - MMI6341 | |
| 47 | 2114 - 2114 4096 Bit (1024x4) NMOS Static RAM | |
| 48 | CDP1802 - RCA CDP1802 CMOS 8-Bit Microprocessor @ 1.75 MHz | |
| 49 | CDP1864 - RCA CDP1864CE COS/MOS PAL Compatible Color TV Interface @ 1.75 MHz | |
| 50 | CN1 - keyboard connector | |
| 51 | CN2 - ASTEC RF modulator connector | |
| 52 | SW1 - Run/Reset switch | |
| 53 | ||
| 54 | 54 | */ |
| 55 | 55 | |
| 56 | 56 | /* |
| r5932 | r5933 | |
| 63 | 63 | OK 30379 |
| 64 | 64 | |
| 65 | 65 | |-------------------------------------------------| |
| 66 | | CN1 CN2 CN3 7805 | | |
| 67 | | 1.75MHz | | |
| 68 | | 741 | | |
| 69 | | |-------------| - | | |
| 70 | | 741 741 4011 | CDP1864 | | | | |
| 71 | | |-------------| | | | |
| 72 | | 4013 |-------------| | | | |
| 73 | | | CDP1802 | | | | |
| 74 | | 4093 |-------------| | | | |
| 75 | | C | | |
| 76 | | 4051 4042 4017 4042 N | | |
| 77 | | |-------| 4 | | |
| 78 | | | ROM | 14556 | | | |
| 79 | | |-------| | | | |
| 80 | | 2114 2114 | | | |
| 81 | | | | | |
| 82 | | 2114 2114 | | | |
| 83 | | - | | |
| 84 | | 2114 2114 | | |
| 85 | | | | |
| 86 | | 2114 2114 | | |
| 66 | | CN1 CN2 CN3 7805 | | |
| 67 | | 1.75MHz | | |
| 68 | | 741 | | |
| 69 | | |-------------| - | | |
| 70 | | 741 741 4011 | CDP1864 | | | | |
| 71 | | |-------------| | | | |
| 72 | | 4013 |-------------| | | | |
| 73 | | | CDP1802 | | | | |
| 74 | | 4093 |-------------| | | | |
| 75 | | C | | |
| 76 | | 4051 4042 4017 4042 N | | |
| 77 | | |-------| 4 | | |
| 78 | | | ROM | 14556 | | | |
| 79 | | |-------| | | | |
| 80 | | 2114 2114 | | | |
| 81 | | | | | |
| 82 | | 2114 2114 | | | |
| 83 | | - | | |
| 84 | | 2114 2114 | | |
| 85 | | | | |
| 86 | | 2114 2114 | | |
| 87 | 87 | |-------------------------------------------------| |
| 88 | 88 | |
| 89 | 89 | Notes: |
| 90 | 90 | All IC's shown. |
| 91 | ||
| 92 | ROM - Intersil 5504? | |
| 93 | 2114 - 2114UCB 4096 Bit (1024x4) NMOS Static RAM | |
| 94 | CDP1802 - RCA CDP1802E CMOS 8-Bit Microprocessor @ 1.75 MHz | |
| 95 | CDP1864 - RCA CDP1864CE COS/MOS PAL Compatible Color TV Interface @ 1.75 MHz | |
| 96 | CN1 - tape connector | |
| 97 | CN2 - video connector | |
| 98 | CN3 - power connector | |
| 99 | CN4 - expansion connector | |
| 100 | 91 | |
| 92 | ROM - Intersil 5504? | |
| 93 | 2114 - 2114UCB 4096 Bit (1024x4) NMOS Static RAM | |
| 94 | CDP1802 - RCA CDP1802E CMOS 8-Bit Microprocessor @ 1.75 MHz | |
| 95 | CDP1864 - RCA CDP1864CE COS/MOS PAL Compatible Color TV Interface @ 1.75 MHz | |
| 96 | CN1 - tape connector | |
| 97 | CN2 - video connector | |
| 98 | CN3 - power connector | |
| 99 | CN4 - expansion connector | |
| 100 | ||
| 101 | 101 | */ |
| 102 | 102 | |
| 103 | 103 | /* |
| 104 | 104 | |
| 105 | ||
| 105 | TODO: | |
| 106 | 106 | |
| 107 | - tape input/output | |
| 108 | - tmc2000: add missing keys | |
| 109 | - tmc2000: TOOL-2000 rom banking | |
| 110 | - oscnano: correct time constant for EF4 RC circuit | |
| 107 | - tape input/output | |
| 108 | - tmc2000: add missing keys | |
| 109 | - tmc2000: TOOL-2000 rom banking | |
| 110 | - oscnano: correct time constant for EF4 RC circuit | |
| 111 | 111 | |
| 112 | 112 | */ |
| 113 | 113 | |
| r5932 | r5933 | |
| 149 | 149 | { |
| 150 | 150 | /* |
| 151 | 151 | |
| 152 | bit description | |
| 153 | ||
| 154 | 0 X0 | |
| 155 | 1 X1 | |
| 156 | 2 X2 | |
| 157 | 3 Y0 | |
| 158 | 4 Y1 | |
| 159 | 5 Y2 | |
| 160 | 6 EXP1 | |
| 161 | 7 EXP2 | |
| 152 | bit description | |
| 162 | 153 | |
| 163 | */ | |
| 154 | 0 X0 | |
| 155 | 1 X1 | |
| 156 | 2 X2 | |
| 157 | 3 Y0 | |
| 158 | 4 Y1 | |
| 159 | 5 Y2 | |
| 160 | 6 EXP1 | |
| 161 | 7 EXP2 | |
| 164 | 162 | |
| 163 | */ | |
| 164 | ||
| 165 | 165 | tmc2000_state *state = space->machine->driver_data; |
| 166 | 166 | |
| 167 | 167 | state->keylatch = data & 0x3f; |
| r5932 | r5933 | |
| 171 | 171 | { |
| 172 | 172 | /* |
| 173 | 173 | |
| 174 | bit description | |
| 175 | ||
| 176 | 0 X0 | |
| 177 | 1 X1 | |
| 178 | 2 X2 | |
| 179 | 3 Y0 | |
| 180 | 4 not connected | |
| 181 | 5 not connected | |
| 182 | 6 not connected | |
| 183 | 7 not connected | |
| 174 | bit description | |
| 184 | 175 | |
| 185 | */ | |
| 176 | 0 X0 | |
| 177 | 1 X1 | |
| 178 | 2 X2 | |
| 179 | 3 Y0 | |
| 180 | 4 not connected | |
| 181 | 5 not connected | |
| 182 | 6 not connected | |
| 183 | 7 not connected | |
| 186 | 184 | |
| 185 | */ | |
| 186 | ||
| 187 | 187 | oscnano_state *state = space->machine->driver_data; |
| 188 | 188 | |
| 189 | 189 | state->keylatch = data & 0x0f; |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | This 1980s computer was manufactured by Vtech of Hong Kong. | |
| 3 | known as: creatiVision, Dick Smith Wizzard, Funvision, Hanimex Ramses, Laser2001 and possibly others. | |
| 2 | This 1980s computer was manufactured by Vtech of Hong Kong. | |
| 3 | known as: creatiVision, Dick Smith Wizzard, Funvision, Hanimex Ramses, Laser2001 and possibly others. | |
| 4 | 4 | |
| 5 | There is also a CreatiVision Mk 2, possibly also known as the Laser 500. This was a proper computer, | |
| 6 | containing a CreatiVision cartridge slot. | |
| 5 | There is also a CreatiVision Mk 2, possibly also known as the Laser 500. This was a proper computer, | |
| 6 | containing a CreatiVision cartridge slot. | |
| 7 | 7 | |
| 8 | ||
| 8 | NOTE: | |
| 9 | 9 | |
| 10 | If you find that the keys R,D,F,G are not working while using the BASIC cartridge, | |
| 11 | please remap the Joystick 2 keys to somewhere else. By default they overlap those keys. | |
| 10 | If you find that the keys R,D,F,G are not working while using the BASIC cartridge, | |
| 11 | please remap the Joystick 2 keys to somewhere else. By default they overlap those keys. | |
| 12 | 12 | |
| 13 | 13 | TODO: |
| 14 | 14 | |
| 15 | ||
| 15 | - BASIC v1,v2 numbers are invisible | |
| 16 | 16 | - proper keyboard emulation, need keyboard schematics |
| 17 | - memory expansion 16K/32K, can be chained | |
| 18 | - centronics control/status port | |
| 19 | - convert to use new cartridge system | |
| 20 | - non-working cartridges: | |
| 21 | * Deep Sea Adventure (6K) | |
| 22 | * Locomotive (10K) | |
| 23 | * Planet Defender (6K) | |
| 24 | * Tennis (Dick Smith 6K) | |
| 25 | * Tennis (Wimbledon 6K) | |
| 26 | - homebrew roms with graphics issues: | |
| 27 | * Christmas Demo 1.0 | |
| 28 | * Titanic Frogger Demo 1.0 | |
| 29 | * Titanic Frogger Demo 1.1 | |
| 17 | - memory expansion 16K/32K, can be chained | |
| 18 | - centronics control/status port | |
| 19 | - convert to use new cartridge system | |
| 20 | - non-working cartridges: | |
| 21 | * Deep Sea Adventure (6K) | |
| 22 | * Locomotive (10K) | |
| 23 | * Planet Defender (6K) | |
| 24 | * Tennis (Dick Smith 6K) | |
| 25 | * Tennis (Wimbledon 6K) | |
| 26 | - homebrew roms with graphics issues: | |
| 27 | * Christmas Demo 1.0 | |
| 28 | * Titanic Frogger Demo 1.0 | |
| 29 | * Titanic Frogger Demo 1.1 | |
| 30 | 30 | |
| 31 | 31 | */ |
| 32 | 32 | |
| r5932 | r5933 | |
| 60 | 60 | /* Memory Map */ |
| 61 | 61 | |
| 62 | 62 | static ADDRESS_MAP_START( crvision_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 63 | AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM | |
| 63 | AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM | |
| 64 | 64 | AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_r, pia6821_w) |
| 65 | 65 | AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_READ(TMS9928A_vram_r) |
| 66 | 66 | AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_READ(TMS9928A_register_r) |
| r5932 | r5933 | |
| 72 | 72 | ADDRESS_MAP_END |
| 73 | 73 | |
| 74 | 74 | static ADDRESS_MAP_START( wizzard_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 75 | AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM | |
| 75 | AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM | |
| 76 | 76 | AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_r, pia6821_w) |
| 77 | 77 | AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_READ(TMS9928A_vram_r) |
| 78 | 78 | AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_READ(TMS9928A_register_r) |
| r5932 | r5933 | |
| 80 | 80 | AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_WRITE(TMS9928A_register_w) |
| 81 | 81 | AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(BANK_ROM2) |
| 82 | 82 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(BANK_ROM1) |
| 83 | // | |
| 83 | // AM_RANGE(0xc000, 0xe7ff) AM_RAMBANK(3) | |
| 84 | 84 | AM_RANGE(0xe800, 0xe800) AM_DEVWRITE(CENTRONICS_TAG, centronics_data_w) |
| 85 | 85 | AM_RANGE(0xe801, 0xe801) AM_DEVREADWRITE(CENTRONICS_TAG, centronics_status_r, centronics_ctrl_w) |
| 86 | // | |
| 86 | // AM_RANGE(0xf000, 0xf7ff) AM_RAMBANK(4) | |
| 87 | 87 | AM_RANGE(0xf800, 0xffff) AM_ROM |
| 88 | 88 | ADDRESS_MAP_END |
| 89 | 89 | |
| r5932 | r5933 | |
| 635 | 635 | |
| 636 | 636 | /* System Drivers */ |
| 637 | 637 | |
| 638 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG | |
| 638 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 639 | 639 | CONS( 1982, crvision, 0, 0, pal, crvision, 0, 0, "Video Technology", "CreatiVision", 0 ) |
| 640 | 640 | CONS( 1982, fnvision, crvision, 0, pal, crvision, 0, 0, "Video Technology", "FunVision", 0 ) |
| 641 | 641 | CONS( 1982, crvisioj, crvision, 0, ntsc, crvision, 0, 0, "Cheryco", "CreatiVision (Japan)", 0 ) |
| r5932 | r5933 | |
| 644 | 644 | CONS( 1983, vz2000, crvision, 0, pal, crvision, 0, 0, "Dick Smith Electronics", "VZ 2000 (Oceania)", 0 ) |
| 645 | 645 | CONS( 1983, crvisio2, crvision, 0, pal, crvision, 0, 0, "Sanyo Video", "CreatiVision MK-II (Germany)", 0 ) |
| 646 | 646 | /* |
| 647 | COMP( 1983, lasr2001, 0, 0, lasr2001, lasr2001, 0, lasr2001, "Video Technology", "Laser 2001", GAME_NOT_WORKING ) | |
| 648 | COMP( 1983, vz2001, lasr2001, 0, lasr2001, lasr2001, 0, lasr2001, "Dick Smith Electronics", "VZ 2001 (Oceania)", GAME_NOT_WORKING ) | |
| 649 | COMP( 1983, manager, lasr2001, 0, lasr2001, lasr2001, 0, lasr2001, "Salora", "Manager (Finland)", GAME_NOT_WORKING ) | |
| 647 | COMP( 1983, lasr2001, 0, 0, lasr2001, lasr2001, 0, lasr2001, "Video Technology", "Laser 2001", GAME_NOT_WORKING ) | |
| 648 | COMP( 1983, vz2001, lasr2001, 0, lasr2001, lasr2001, 0, lasr2001, "Dick Smith Electronics", "VZ 2001 (Oceania)", GAME_NOT_WORKING ) | |
| 649 | COMP( 1983, manager, lasr2001, 0, lasr2001, lasr2001, 0, lasr2001, "Salora", "Manager (Finland)", GAME_NOT_WORKING ) | |
| 650 | 650 | */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Videotone TVC 32/64 driver |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 14 | 14 | |
| 15 | 15 | static void tvc_set_mem_page(running_machine *machine, UINT8 data) |
| 16 | 16 | { |
| 17 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); | |
| 17 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); | |
| 18 | 18 | switch(data & 0x18) { |
| 19 | 19 | case 0x00 : // system ROM selected |
| 20 | 20 | memory_install_readwrite8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1), SMH_NOP); |
| 21 | memory_set_bankptr(space->machine, 1, memory_region(machine, "sys")); | |
| 21 | memory_set_bankptr(space->machine, 1, memory_region(machine, "sys")); | |
| 22 | 22 | break; |
| 23 | 23 | case 0x08 : // Cart ROM selected |
| 24 | 24 | memory_install_readwrite8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1), SMH_NOP); |
| 25 | memory_set_bankptr(space->machine, 1, memory_region(machine, "cart")); | |
| 25 | memory_set_bankptr(space->machine, 1, memory_region(machine, "cart")); | |
| 26 | 26 | break; |
| 27 | 27 | case 0x10 : // RAM selected |
| 28 | 28 | memory_install_readwrite8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1), SMH_BANK(1)); |
| 29 | memory_set_bankptr(space->machine, 1, mess_ram); | |
| 30 | break; | |
| 29 | memory_set_bankptr(space->machine, 1, mess_ram); | |
| 30 | break; | |
| 31 | 31 | } |
| 32 | 32 | // Bank 2 is always RAM |
| 33 | memory_set_bankptr(space->machine, 2, mess_ram + 0x4000); | |
| 33 | memory_set_bankptr(space->machine, 2, mess_ram + 0x4000); | |
| 34 | 34 | if ((data & 0x20)==0) { |
| 35 | 35 | // Video RAM |
| 36 | memory_set_bankptr(space->machine, 3, mess_ram + 0x10000); | |
| 36 | memory_set_bankptr(space->machine, 3, mess_ram + 0x10000); | |
| 37 | 37 | } else { |
| 38 | 38 | // System RAM page 3 |
| 39 | memory_set_bankptr(space->machine, 3, mess_ram + 0x8000); | |
| 39 | memory_set_bankptr(space->machine, 3, mess_ram + 0x8000); | |
| 40 | 40 | } |
| 41 | 41 | switch(data & 0xc0) { |
| 42 | 42 | case 0x00 : // Cart ROM selected |
| 43 | 43 | memory_install_readwrite8_handler(space, 0xc000, 0xffff, 0, 0, SMH_BANK(4), SMH_NOP); |
| 44 | memory_set_bankptr(space->machine, 4, memory_region(machine, "cart")); | |
| 44 | memory_set_bankptr(space->machine, 4, memory_region(machine, "cart")); | |
| 45 | 45 | break; |
| 46 | 46 | case 0x40 : // System ROM selected |
| 47 | 47 | memory_install_readwrite8_handler(space, 0xc000, 0xffff, 0, 0, SMH_BANK(4), SMH_NOP); |
| 48 | memory_set_bankptr(space->machine, 4, memory_region(machine, "sys")); | |
| 48 | memory_set_bankptr(space->machine, 4, memory_region(machine, "sys")); | |
| 49 | 49 | break; |
| 50 | 50 | case 0x80 : // RAM selected |
| 51 | 51 | memory_install_readwrite8_handler(space, 0xc000, 0xffff, 0, 0, SMH_BANK(4), SMH_BANK(4)); |
| 52 | memory_set_bankptr(space->machine, 4, mess_ram); | |
| 52 | memory_set_bankptr(space->machine, 4, mess_ram); | |
| 53 | 53 | break; |
| 54 | 54 | case 0xc0 : // External ROM selected |
| 55 | 55 | memory_install_readwrite8_handler(space, 0xc000, 0xffff, 0, 0, SMH_BANK(4), SMH_NOP); |
| 56 | memory_set_bankptr(space->machine, 4, memory_region(machine, "ext")); | |
| 56 | memory_set_bankptr(space->machine, 4, memory_region(machine, "ext")); | |
| 57 | 57 | break; |
| 58 | ||
| 59 | } | |
| 58 | ||
| 59 | } | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | static WRITE8_HANDLER( tvc_bank_w ) |
| r5932 | r5933 | |
| 76 | 76 | // 0 I 0 G | 0 R 0 B |
| 77 | 77 | // 0 0 0 0 | I R G B |
| 78 | 78 | int i = ((data&0x40)>>3) | ((data&0x10)>>3) | (data&0x04) | (data&0x01); |
| 79 | ||
| 79 | ||
| 80 | 80 | col[offset] = i; |
| 81 | 81 | } |
| 82 | 82 | |
| r5932 | r5933 | |
| 102 | 102 | INPUT_PORTS_END |
| 103 | 103 | |
| 104 | 104 | |
| 105 | static MACHINE_RESET(tvc) | |
| 106 | { | |
| 105 | static MACHINE_RESET(tvc) | |
| 106 | { | |
| 107 | 107 | memset(mess_ram,0,(64+14)*1024); |
| 108 | 108 | tvc_set_mem_page(machine, 0); |
| 109 | 109 | tvc_video_mode = 0; |
| r5932 | r5933 | |
| 124 | 124 | { |
| 125 | 125 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 126 | 126 | int i; |
| 127 | ||
| 127 | ||
| 128 | 128 | switch(tvc_video_mode) { |
| 129 | case 0 : | |
| 129 | case 0 : | |
| 130 | 130 | for ( i = 0; i < x_count; i++ ) |
| 131 | { | |
| 131 | { | |
| 132 | 132 | UINT16 offset = i + (y * 64); |
| 133 | 133 | UINT8 data = mess_ram[ offset + 0x10000]; |
| 134 | 134 | *p = col[(data >> 7)]; p++; |
| r5932 | r5933 | |
| 143 | 143 | break; |
| 144 | 144 | case 1 : |
| 145 | 145 | for ( i = 0; i < x_count; i++ ) |
| 146 | { | |
| 146 | { | |
| 147 | 147 | UINT16 offset = i + (y * 64); |
| 148 | 148 | UINT8 data = mess_ram[ offset + 0x10000]; |
| 149 | 149 | *p = col[BIT(data,7)*2 + BIT(data,3)]; p++; |
| r5932 | r5933 | |
| 158 | 158 | break; |
| 159 | 159 | default: |
| 160 | 160 | for ( i = 0; i < x_count; i++ ) |
| 161 | { | |
| 161 | { | |
| 162 | 162 | UINT16 offset = i + (y * 64); |
| 163 | 163 | UINT8 data = mess_ram[ offset + 0x10000]; |
| 164 | 164 | *p = col[(data >> 4) & 0xf]; p++; |
| r5932 | r5933 | |
| 171 | 171 | *p = col[(data >> 0) & 0xf]; p++; |
| 172 | 172 | } |
| 173 | 173 | break; |
| 174 | ||
| 175 | } | |
| 174 | ||
| 175 | } | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | static PALETTE_INIT( tvc ) |
| r5932 | r5933 | |
| 194 | 194 | { 0xff,0x00,0x00 }, |
| 195 | 195 | { 0xff,0x00,0xff }, |
| 196 | 196 | { 0xff,0xff,0x00 }, |
| 197 | { 0xff,0xff,0xff } | |
| 197 | { 0xff,0xff,0xff } | |
| 198 | 198 | }; |
| 199 | 199 | int i; |
| 200 | 200 | |
| r5932 | r5933 | |
| 220 | 220 | /* basic machine hardware */ |
| 221 | 221 | MDRV_CPU_ADD("maincpu",Z80, 3125000) |
| 222 | 222 | MDRV_CPU_PROGRAM_MAP(tvc_mem) |
| 223 | MDRV_CPU_IO_MAP(tvc_io) | |
| 223 | MDRV_CPU_IO_MAP(tvc_io) | |
| 224 | 224 | |
| 225 | 225 | MDRV_MACHINE_RESET(tvc) |
| 226 | ||
| 226 | ||
| 227 | 227 | /* video hardware */ |
| 228 | 228 | MDRV_SCREEN_ADD("screen", RASTER) |
| 229 | 229 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 233 | 233 | MDRV_SCREEN_VISIBLE_AREA(0, 512 - 1, 0, 240 - 1) |
| 234 | 234 | MDRV_PALETTE_LENGTH( 16 ) |
| 235 | 235 | MDRV_PALETTE_INIT(tvc) |
| 236 | ||
| 236 | ||
| 237 | 237 | MDRV_MC6845_ADD("crtc", MC6845, 3125000, tvc_crtc6845_interface) // clk taken from schematics |
| 238 | 238 | |
| 239 | 239 | MDRV_VIDEO_START(tvc) |
| r5932 | r5933 | |
| 261 | 261 | ROM_REGION( 0x4000, "cart", ROMREGION_ERASEFF ) |
| 262 | 262 | ROM_REGION( 0x4000, "ext", ROMREGION_ERASEFF ) |
| 263 | 263 | ROM_LOAD( "tvc22_d7.64k", 0x2000, 0x2000, CRC(05e1c3a8) SHA1(abf119cf947ea32defd08b29a8a25d75f6bd4987)) |
| 264 | /* | |
| 264 | /* | |
| 265 | 265 | |
| 266 | ROM_LOAD( "tvcru_d4.bin", 0x0000, 0x2000, CRC(bac5dd4f) SHA1(665a1b8c80b6ad82090803621f0c73ef9243c7d4)) | |
| 267 | ROM_LOAD( "tvcru_d6.bin", 0x2000, 0x2000, CRC(1e0fa0b8) SHA1(9bebb6c8f03f9641bd35c9fd45ffc13a48e5c572)) | |
| 268 | ROM_LOAD( "tvcru_d7.bin", 0x2000, 0x2000, CRC(70cde756) SHA1(c49662af9f6653347ead641e85777c3463cc161b)) | |
| 269 | */ | |
| 266 | ROM_LOAD( "tvcru_d4.bin", 0x0000, 0x2000, CRC(bac5dd4f) SHA1(665a1b8c80b6ad82090803621f0c73ef9243c7d4)) | |
| 267 | ROM_LOAD( "tvcru_d6.bin", 0x2000, 0x2000, CRC(1e0fa0b8) SHA1(9bebb6c8f03f9641bd35c9fd45ffc13a48e5c572)) | |
| 268 | ROM_LOAD( "tvcru_d7.bin", 0x2000, 0x2000, CRC(70cde756) SHA1(c49662af9f6653347ead641e85777c3463cc161b)) | |
| 269 | */ | |
| 270 | 270 | ROM_END |
| 271 | 271 | |
| 272 | 272 | ROM_START( tvc64pru ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | Fujitsu FM-Towns | |
| 4 | ||
| 5 | Japanese computer system released in 1989. | |
| 6 | ||
| 7 | CPU: AMD 80386SX(DX?) (80387 available as add-on?) | |
| 8 | Sound: Yamaha YM3438 | |
| 9 | Ricoh RF5c68 | |
| 10 | Video: VGA + some custom extra video hardware | |
| 11 | 320x200 - 640x480 | |
| 12 | 16 - 32768 colours from a possible palette of between 4096 and | |
| 13 | 16.7m colours (depending on video mode) | |
| 14 | 1024 sprites (16x16) | |
| 15 | ||
| 16 | ||
| 17 | Fujitsu FM-Towns Marty | |
| 18 | ||
| 19 | Japanese console, based on the FM-Towns computer, using an AMD 80386SX CPU, | |
| 20 | released in 1993 | |
| 3 | Fujitsu FM-Towns | |
| 21 | 4 | |
| 5 | Japanese computer system released in 1989. | |
| 22 | 6 | |
| 23 | 16/5/09: Skeleton driver. | |
| 7 | CPU: AMD 80386SX(DX?) (80387 available as add-on?) | |
| 8 | Sound: Yamaha YM3438 | |
| 9 | Ricoh RF5c68 | |
| 10 | Video: VGA + some custom extra video hardware | |
| 11 | 320x200 - 640x480 | |
| 12 | 16 - 32768 colours from a possible palette of between 4096 and | |
| 13 | 16.7m colours (depending on video mode) | |
| 14 | 1024 sprites (16x16) | |
| 24 | 15 | |
| 25 | Issues: BIOS requires 386 protected mode. | |
| 26 | 16 | |
| 17 | Fujitsu FM-Towns Marty | |
| 18 | ||
| 19 | Japanese console, based on the FM-Towns computer, using an AMD 80386SX CPU, | |
| 20 | released in 1993 | |
| 21 | ||
| 22 | ||
| 23 | 16/5/09: Skeleton driver. | |
| 24 | ||
| 25 | Issues: BIOS requires 386 protected mode. | |
| 26 | ||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | /* I/O port map (incomplete, could well be incorrect too) |
| 30 | 30 | * |
| 31 | 31 | * 0x0000 : Master 8259 PIC |
| 32 | * 0x0002 : Master 8259 PIC | |
| 32 | * 0x0002 : Master 8259 PIC | |
| 33 | 33 | * 0x0010 : Slave 8259 PIC |
| 34 | * 0x0012 : Slave 8259 PIC | |
| 34 | * 0x0012 : Slave 8259 PIC | |
| 35 | 35 | * 0x0020 RW: bit 0 = soft reset (read/write), bit 6 = power off (write), bit 7 = NMI vector protect |
| 36 | 36 | * 0x0022 W: bit 7 = power off (write) |
| 37 | 37 | * 0x0025 R : returns 0x00? (read) |
| r5932 | r5933 | |
| 320 | 320 | static WRITE8_HANDLER( towns_cmos8_w ) |
| 321 | 321 | { |
| 322 | 322 | UINT8* cmos = (UINT8*)towns_cmos; |
| 323 | ||
| 323 | ||
| 324 | 324 | cmos[offset] = data; |
| 325 | 325 | } |
| 326 | 326 | |
| r5932 | r5933 | |
| 350 | 350 | static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32) |
| 351 | 351 | // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns) |
| 352 | 352 | // may not be (and probably is not) correct |
| 353 | AM_RANGE(0x00000000, 0x000bffff) AM_RAM | |
| 353 | AM_RANGE(0x00000000, 0x000bffff) AM_RAM | |
| 354 | 354 | AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_BASE(&towns_gfxvram) // GVRAM |
| 355 | 355 | AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_BASE(&towns_txtvram) // TVRAM |
| 356 | 356 | // AM_RANGE(0x000ca000, 0x000cafff) AM_RAM AM_BASE(&towns_txtvram) // TVRAM |
| r5932 | r5933 | |
| 445 | 445 | { |
| 446 | 446 | int x,y; |
| 447 | 447 | int pixel = 0; |
| 448 | ||
| 448 | ||
| 449 | 449 | for(y=0;y<480;y++) |
| 450 | 450 | { |
| 451 | 451 | for(x=0;x<640;x++) |
| r5932 | r5933 | |
| 455 | 455 | pixel = 0; |
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | ||
| 458 | ||
| 459 | 459 | return 0; |
| 460 | 460 | } |
| 461 | 461 | |
| r5932 | r5933 | |
| 465 | 465 | { |
| 466 | 466 | 307200, |
| 467 | 467 | NULL |
| 468 | }, | |
| 468 | }, | |
| 469 | 469 | { |
| 470 | 470 | 307200, |
| 471 | 471 | NULL |
| 472 | }, | |
| 472 | }, | |
| 473 | 473 | { |
| 474 | 474 | 307200, |
| 475 | 475 | NULL |
| r5932 | r5933 | |
| 477 | 477 | } |
| 478 | 478 | }; |
| 479 | 479 | |
| 480 | static const struct pic8259_interface towns_pic8259_master_config = | |
| 480 | static const struct pic8259_interface towns_pic8259_master_config = | |
| 481 | 481 | { |
| 482 | 482 | NULL |
| 483 | 483 | }; |
| 484 | 484 | |
| 485 | 485 | |
| 486 | static const struct pic8259_interface towns_pic8259_slave_config = | |
| 486 | static const struct pic8259_interface towns_pic8259_slave_config = | |
| 487 | 487 | { |
| 488 | 488 | NULL |
| 489 | 489 | }; |
| r5932 | r5933 | |
| 503 | 503 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 504 | 504 | MDRV_SCREEN_SIZE(640, 480) |
| 505 | 505 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 506 | ||
| 506 | ||
| 507 | 507 | /* sound hardware */ |
| 508 | 508 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 509 | 509 | MDRV_SOUND_ADD("fm", YM3438, 53693100 / 7) // actual clock speed unknown |
| 510 | // | |
| 510 | // MDRV_SOUND_CONFIG(ym3438_interface) | |
| 511 | 511 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 512 | 512 | MDRV_SOUND_ADD("pcm", RF5C68, 2150000) // actual clock speed unknown |
| 513 | // | |
| 513 | // MDRV_SOUND_CONFIG(rf5c68_interface) | |
| 514 | 514 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 515 | ||
| 515 | ||
| 516 | 516 | MDRV_PIT8253_ADD("pit",towns_pit8253_config) |
| 517 | ||
| 517 | ||
| 518 | 518 | MDRV_PIC8259_ADD( "pic8259_master", towns_pic8259_master_config ) |
| 519 | 519 | |
| 520 | 520 | MDRV_PIC8259_ADD( "pic8259_slave", towns_pic8259_slave_config ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | UKNC |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 12 | 12 | static ADDRESS_MAP_START(uknc_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 13 | 13 | ADDRESS_MAP_UNMAP_HIGH |
| 14 | 14 | AM_RANGE( 0x0000, 0x7fff ) AM_RAM // RAM |
| 15 | AM_RANGE( 0x8000, 0xffff ) AM_ROM // ROM | |
| 15 | AM_RANGE( 0x8000, 0xffff ) AM_ROM // ROM | |
| 16 | 16 | ADDRESS_MAP_END |
| 17 | 17 | |
| 18 | 18 | static ADDRESS_MAP_START(uknc_sub_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 19 | 19 | ADDRESS_MAP_UNMAP_HIGH |
| 20 | 20 | AM_RANGE( 0x0000, 0x7fff ) AM_RAM // RAM |
| 21 | AM_RANGE( 0x8000, 0xffff ) AM_ROM // ROM | |
| 21 | AM_RANGE( 0x8000, 0xffff ) AM_ROM // ROM | |
| 22 | 22 | ADDRESS_MAP_END |
| 23 | 23 | |
| 24 | 24 | /* Input ports */ |
| r5932 | r5933 | |
| 26 | 26 | INPUT_PORTS_END |
| 27 | 27 | |
| 28 | 28 | |
| 29 | static MACHINE_RESET(uknc) | |
| 30 | { | |
| 29 | static MACHINE_RESET(uknc) | |
| 30 | { | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | static VIDEO_START( uknc ) |
| r5932 | r5933 | |
| 48 | 48 | static MACHINE_DRIVER_START( uknc ) |
| 49 | 49 | /* basic machine hardware */ |
| 50 | 50 | MDRV_CPU_ADD("maincpu", T11, 8000000) |
| 51 | MDRV_CPU_CONFIG(t11_data) | |
| 51 | MDRV_CPU_CONFIG(t11_data) | |
| 52 | 52 | MDRV_CPU_PROGRAM_MAP(uknc_mem) |
| 53 | ||
| 53 | ||
| 54 | 54 | MDRV_CPU_ADD("subcpu", T11, 6000000) |
| 55 | MDRV_CPU_CONFIG(t11_data) | |
| 55 | MDRV_CPU_CONFIG(t11_data) | |
| 56 | 56 | MDRV_CPU_PROGRAM_MAP(uknc_sub_mem) |
| 57 | 57 | |
| 58 | 58 | MDRV_MACHINE_RESET(uknc) |
| 59 | ||
| 59 | ||
| 60 | 60 | /* video hardware */ |
| 61 | 61 | MDRV_SCREEN_ADD("screen", RASTER) |
| 62 | 62 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
|---|---|---|
| 341 | 341 | MDRV_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 14 - 1) |
| 342 | 342 | MDRV_GFXDECODE(nascom2) |
| 343 | 343 | MDRV_VIDEO_UPDATE(nascom2) |
| 344 | ||
| 344 | ||
| 345 | 345 | MDRV_WD1793_ADD("wd1793", nascom2_wd17xx_interface ) |
| 346 | ||
| 346 | ||
| 347 | 347 | MDRV_FLOPPY_4_DRIVES_ADD(nascom2_floppy_config) |
| 348 | 348 | MACHINE_DRIVER_END |
| 349 | 349 | |
| r5932 | r5933 | |
| 391 | 391 | |
| 392 | 392 | //static void nascom1_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 393 | 393 | //{ |
| 394 | // /* cassette */ | |
| 395 | // switch(state) | |
| 396 | // { | |
| 397 | // /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 398 | // case MESS_DEVINFO_INT_TYPE: info->i = IO_CASSETTE; break; | |
| 399 | // case MESS_DEVINFO_INT_READABLE: info->i = 1; break; | |
| 400 | // case MESS_DEVINFO_INT_WRITEABLE: info->i = 0; break; | |
| 401 | // case MESS_DEVINFO_INT_CREATABLE: info->i = 0; break; | |
| 402 | // case MESS_DEVINFO_INT_COUNT: info->i = 1; break; | |
| 394 | // /* cassette */ | |
| 395 | // switch(state) | |
| 396 | // { | |
| 397 | // /* --- the following bits of info are returned as 64-bit signed integers --- */ | |
| 398 | // case MESS_DEVINFO_INT_TYPE: info->i = IO_CASSETTE; break; | |
| 399 | // case MESS_DEVINFO_INT_READABLE: info->i = 1; break; | |
| 400 | // case MESS_DEVINFO_INT_WRITEABLE: info->i = 0; break; | |
| 401 | // case MESS_DEVINFO_INT_CREATABLE: info->i = 0; break; | |
| 402 | // case MESS_DEVINFO_INT_COUNT: info->i = 1; break; | |
| 403 | 403 | // |
| 404 | // /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 405 | // case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(nascom1_cassette); break; | |
| 406 | // case MESS_DEVINFO_PTR_UNLOAD: info->unload = DEVICE_IMAGE_UNLOAD_NAME(nascom1_cassette); break; | |
| 404 | // /* --- the following bits of info are returned as pointers to data or functions --- */ | |
| 405 | // case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(nascom1_cassette); break; | |
| 406 | // case MESS_DEVINFO_PTR_UNLOAD: info->unload = DEVICE_IMAGE_UNLOAD_NAME(nascom1_cassette); break; | |
| 407 | 407 | // |
| 408 | // /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 409 | // case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "cas"); break; | |
| 410 | // } | |
| 408 | // /* --- the following bits of info are returned as NULL-terminated strings --- */ | |
| 409 | // case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "cas"); break; | |
| 410 | // } | |
| 411 | 411 | //} |
| 412 | 412 | |
| 413 | 413 | |
| r5932 | r5933 | |
| 416 | 416 | CONFIG_RAM(16 * 1024) |
| 417 | 417 | CONFIG_RAM(32 * 1024) |
| 418 | 418 | CONFIG_RAM_DEFAULT(40 * 1024) |
| 419 | // | |
| 419 | // CONFIG_DEVICE(nascom1_cassette_getinfo) | |
| 420 | 420 | SYSTEM_CONFIG_END |
| 421 | 421 | |
| 422 | 422 | |
| 423 | 423 | static SYSTEM_CONFIG_START( nascom2 ) |
| 424 | CONFIG_IMPORT_FROM(nascom1) | |
| 424 | CONFIG_IMPORT_FROM(nascom1) | |
| 425 | 425 | SYSTEM_CONFIG_END |
| 426 | 426 | |
| 427 | 427 |
| r5932 | r5933 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | /* |
| 18 | 18 | |
| 19 | NewBrain | |
| 20 | Grundy Business Systems Ltd. | |
| 19 | NewBrain | |
| 20 | Grundy Business Systems Ltd. | |
| 21 | 21 | |
| 22 | 32K RAM | |
| 23 | 28K ROM | |
| 22 | 32K RAM | |
| 23 | 28K ROM | |
| 24 | 24 | |
| 25 | Z80 @ 2MHz | |
| 26 | COP420 @ 2MHz | |
| 25 | Z80 @ 2MHz | |
| 26 | COP420 @ 2MHz | |
| 27 | 27 | |
| 28 | Z80 @ 4MHz (416): INT/NMI=+5V, WAIT=EXTBUSRQ|BUSAKD, RESET=_FDC RESET, | |
| 29 | NEC 765AC @ 4 MHz (418) | |
| 30 | MC6850 ACIA (459) | |
| 31 | Z80CTC (458) | |
| 32 | ADC0809 (427) | |
| 33 | DAC0808 (461) | |
| 28 | Z80 @ 4MHz (416): INT/NMI=+5V, WAIT=EXTBUSRQ|BUSAKD, RESET=_FDC RESET, | |
| 29 | NEC 765AC @ 4 MHz (418) | |
| 30 | MC6850 ACIA (459) | |
| 31 | Z80CTC (458) | |
| 32 | ADC0809 (427) | |
| 33 | DAC0808 (461) | |
| 34 | 34 | |
| 35 | ||
| 35 | Models according to the Software Technical Manual: | |
| 36 | 36 | |
| 37 | Model M: 'Page Register', Expansion Port onto Z80 bus, Video, ACIA/CTC, User Port | |
| 38 | Model A: Expansion Port, Video, no User Port but has software driver serial port - s/w Printer, s/w V24 | |
| 39 | Model V: ACIA/CTC, User Port | |
| 37 | Model M: 'Page Register', Expansion Port onto Z80 bus, Video, ACIA/CTC, User Port | |
| 38 | Model A: Expansion Port, Video, no User Port but has software driver serial port - s/w Printer, s/w V24 | |
| 39 | Model V: ACIA/CTC, User Port | |
| 40 | 40 | |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | 43 | /* |
| 44 | 44 | |
| 45 | ||
| 45 | TODO: | |
| 46 | 46 | |
| 47 | - bitmapped graphics mode | |
| 48 | - COP420 microbus access | |
| 49 | - escape key is missing | |
| 50 | - layout for the 16-segment displays | |
| 51 | - CP/M 2.2 ROMs | |
| 52 | - floppy disc controller | |
| 53 | - convert FDC into a device | |
| 54 | - convert EIM into a device | |
| 47 | - bitmapped graphics mode | |
| 48 | - COP420 microbus access | |
| 49 | - escape key is missing | |
| 50 | - layout for the 16-segment displays | |
| 51 | - CP/M 2.2 ROMs | |
| 52 | - floppy disc controller | |
| 53 | - convert FDC into a device | |
| 54 | - convert EIM into a device | |
| 55 | 55 | |
| 56 | - Micropage ROM/RAM card | |
| 57 | - Z80 PIO board | |
| 58 | - peripheral (PI) box | |
| 59 | - sound card | |
| 56 | - Micropage ROM/RAM card | |
| 57 | - Z80 PIO board | |
| 58 | - peripheral (PI) box | |
| 59 | - sound card | |
| 60 | 60 | |
| 61 | 61 | */ |
| 62 | 62 | |
| r5932 | r5933 | |
| 210 | 210 | { |
| 211 | 211 | /* |
| 212 | 212 | |
| 213 | ||
| 213 | bit signal description | |
| 214 | 214 | |
| 215 | 0 _CLK enable frame frequency clock interrupts | |
| 216 | 1 enable user interrupt | |
| 217 | 2 TVP enable video display | |
| 218 | 3 enable V24 | |
| 219 | 4 V24 Select Receive Bit 0 | |
| 220 | 5 V24 Select Receive Bit 1 | |
| 221 | 6 V24 Select Transmit Bit 0 | |
| 222 | 7 V24 Select Transmit Bit 1 | |
| 215 | 0 _CLK enable frame frequency clock interrupts | |
| 216 | 1 enable user interrupt | |
| 217 | 2 TVP enable video display | |
| 218 | 3 enable V24 | |
| 219 | 4 V24 Select Receive Bit 0 | |
| 220 | 5 V24 Select Receive Bit 1 | |
| 221 | 6 V24 Select Transmit Bit 0 | |
| 222 | 7 V24 Select Transmit Bit 1 | |
| 223 | 223 | |
| 224 | ||
| 224 | */ | |
| 225 | 225 | |
| 226 | 226 | newbrain_state *state = space->machine->driver_data; |
| 227 | 227 | |
| r5932 | r5933 | |
| 232 | 232 | { |
| 233 | 233 | /* |
| 234 | 234 | |
| 235 | ||
| 235 | bit signal description | |
| 236 | 236 | |
| 237 | 0 _CLK Clock Enable | |
| 238 | 1 | |
| 239 | 2 TVP TV Enable | |
| 240 | 3 IOPOWER | |
| 241 | 4 _CTS Clear to Send V24 | |
| 242 | 5 DO Transmit Data V24 | |
| 243 | 6 | |
| 244 | 7 PO Transmit Data Printer | |
| 237 | 0 _CLK Clock Enable | |
| 238 | 1 | |
| 239 | 2 TVP TV Enable | |
| 240 | 3 IOPOWER | |
| 241 | 4 _CTS Clear to Send V24 | |
| 242 | 5 DO Transmit Data V24 | |
| 243 | 6 | |
| 244 | 7 PO Transmit Data Printer | |
| 245 | 245 | |
| 246 | ||
| 246 | */ | |
| 247 | 247 | |
| 248 | 248 | newbrain_state *state = space->machine->driver_data; |
| 249 | 249 | |
| r5932 | r5933 | |
| 255 | 255 | { |
| 256 | 256 | /* |
| 257 | 257 | |
| 258 | ||
| 258 | bit signal description | |
| 259 | 259 | |
| 260 | 0 variable | |
| 261 | 1 variable | |
| 262 | 2 MNS mains present | |
| 263 | 3 _USRINT0 user status | |
| 264 | 4 _USRINT user interrupt | |
| 265 | 5 _CLKINT clock interrupt | |
| 266 | 6 _ACINT ACIA interrupt | |
| 267 | 7 _COPINT COP interrupt | |
| 260 | 0 variable | |
| 261 | 1 variable | |
| 262 | 2 MNS mains present | |
| 263 | 3 _USRINT0 user status | |
| 264 | 4 _USRINT user interrupt | |
| 265 | 5 _CLKINT clock interrupt | |
| 266 | 6 _ACINT ACIA interrupt | |
| 267 | 7 _COPINT COP interrupt | |
| 268 | 268 | |
| 269 | ||
| 269 | */ | |
| 270 | 270 | |
| 271 | 271 | newbrain_state *state = space->machine->driver_data; |
| 272 | 272 | |
| r5932 | r5933 | |
| 339 | 339 | { |
| 340 | 340 | /* |
| 341 | 341 | |
| 342 | ||
| 342 | bit signal description | |
| 343 | 343 | |
| 344 | 0 +5V | |
| 345 | 1 PWRUP | |
| 346 | 2 | |
| 347 | 3 | |
| 348 | 4 | |
| 349 | 5 _CLKINT clock interrupt | |
| 350 | 6 | |
| 351 | 7 _COPINT COP interrupt | |
| 344 | 0 +5V | |
| 345 | 1 PWRUP | |
| 346 | 2 | |
| 347 | 3 | |
| 348 | 4 | |
| 349 | 5 _CLKINT clock interrupt | |
| 350 | 6 | |
| 351 | 7 _COPINT COP interrupt | |
| 352 | 352 | |
| 353 | ||
| 353 | */ | |
| 354 | 354 | |
| 355 | 355 | newbrain_state *state = space->machine->driver_data; |
| 356 | 356 | |
| r5932 | r5933 | |
| 361 | 361 | { |
| 362 | 362 | /* |
| 363 | 363 | |
| 364 | ||
| 364 | bit signal description | |
| 365 | 365 | |
| 366 | 0 RDDK Received Data V24 | |
| 367 | 1 _CTSD _Clear to Send V24 | |
| 368 | 2 | |
| 369 | 3 | |
| 370 | 4 | |
| 371 | 5 TPIN Tape in | |
| 372 | 6 | |
| 373 | 7 _CTSP _Clear to Send Printer | |
| 366 | 0 RDDK Received Data V24 | |
| 367 | 1 _CTSD _Clear to Send V24 | |
| 368 | 2 | |
| 369 | 3 | |
| 370 | 4 | |
| 371 | 5 TPIN Tape in | |
| 372 | 6 | |
| 373 | 7 _CTSP _Clear to Send Printer | |
| 374 | 374 | |
| 375 | ||
| 375 | */ | |
| 376 | 376 | |
| 377 | 377 | newbrain_state *state = space->machine->driver_data; |
| 378 | 378 | |
| r5932 | r5933 | |
| 448 | 448 | { |
| 449 | 449 | /* |
| 450 | 450 | |
| 451 | ||
| 451 | bit description | |
| 452 | 452 | |
| 453 | G0 _COPINT | |
| 454 | G1 _TM1 | |
| 455 | G2 not connected | |
| 456 | G3 _TM2 | |
| 453 | G0 _COPINT | |
| 454 | G1 _TM1 | |
| 455 | G2 not connected | |
| 456 | G3 _TM2 | |
| 457 | 457 | |
| 458 | ||
| 458 | */ | |
| 459 | 459 | |
| 460 | 460 | newbrain_state *state = space->machine->driver_data; |
| 461 | 461 | |
| r5932 | r5933 | |
| 472 | 472 | { |
| 473 | 473 | /* |
| 474 | 474 | |
| 475 | ||
| 475 | bit description | |
| 476 | 476 | |
| 477 | G0 not connected | |
| 478 | G1 K9 | |
| 479 | G2 K7 | |
| 480 | G3 K3 | |
| 477 | G0 not connected | |
| 478 | G1 K9 | |
| 479 | G2 K7 | |
| 480 | G3 K3 | |
| 481 | 481 | |
| 482 | ||
| 482 | */ | |
| 483 | 483 | |
| 484 | 484 | newbrain_state *state = space->machine->driver_data; |
| 485 | 485 | |
| r5932 | r5933 | |
| 490 | 490 | { |
| 491 | 491 | /* |
| 492 | 492 | |
| 493 | ||
| 493 | bit description | |
| 494 | 494 | |
| 495 | D0 inverted to K4 -> CD4024 pin 2 (reset) | |
| 496 | D1 TDO | |
| 497 | D2 inverted to K6 -> CD4024 pin 1 (clock), CD4076 pin 7 (clock), inverted to DS8881 pin 3 (enable) | |
| 498 | D3 not connected | |
| 495 | D0 inverted to K4 -> CD4024 pin 2 (reset) | |
| 496 | D1 TDO | |
| 497 | D2 inverted to K6 -> CD4024 pin 1 (clock), CD4076 pin 7 (clock), inverted to DS8881 pin 3 (enable) | |
| 498 | D3 not connected | |
| 499 | 499 | |
| 500 | ||
| 500 | */ | |
| 501 | 501 | |
| 502 | 502 | newbrain_state *state = space->machine->driver_data; |
| 503 | ||
| 503 | ||
| 504 | 504 | static const char *const keynames[] = { "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", |
| 505 | 505 | "D8", "D9", "D10", "D11", "D12", "D13", "D14", "D15" }; |
| 506 | 506 | |
| r5932 | r5933 | |
| 539 | 539 | { |
| 540 | 540 | /* |
| 541 | 541 | |
| 542 | ||
| 542 | bit description | |
| 543 | 543 | |
| 544 | IN0 K8 | |
| 545 | IN1 _RD | |
| 546 | IN2 _COP | |
| 547 | IN3 _WR | |
| 544 | IN0 K8 | |
| 545 | IN1 _RD | |
| 546 | IN2 _COP | |
| 547 | IN3 _WR | |
| 548 | 548 | |
| 549 | ||
| 549 | */ | |
| 550 | 550 | |
| 551 | 551 | newbrain_state *state = space->machine->driver_data; |
| 552 | 552 | |
| r5932 | r5933 | |
| 617 | 617 | { |
| 618 | 618 | /* |
| 619 | 619 | |
| 620 | ||
| 620 | bit signal description | |
| 621 | 621 | |
| 622 | 0 RV 1 reverses video over entire field, ie. black on white | |
| 623 | 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 | |
| 624 | 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 | |
| 625 | 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 | |
| 626 | 4 | |
| 627 | 5 | |
| 628 | 6 80L 0 selects 40 character line length. 1 selects 80 character line length | |
| 629 | 7 | |
| 622 | 0 RV 1 reverses video over entire field, ie. black on white | |
| 623 | 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 | |
| 624 | 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 | |
| 625 | 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 | |
| 626 | 4 | |
| 627 | 5 | |
| 628 | 6 80L 0 selects 40 character line length. 1 selects 80 character line length | |
| 629 | 7 | |
| 630 | 630 | |
| 631 | ||
| 631 | */ | |
| 632 | 632 | |
| 633 | 633 | newbrain_state *state = space->machine->driver_data; |
| 634 | 634 | |
| r5932 | r5933 | |
| 641 | 641 | { |
| 642 | 642 | /* |
| 643 | 643 | |
| 644 | ||
| 644 | bit description | |
| 645 | 645 | |
| 646 | 0 MOTON | |
| 647 | 1 765 RESET | |
| 648 | 2 TC | |
| 649 | 3 | |
| 650 | 4 | |
| 651 | 5 PA15 | |
| 652 | 6 | |
| 653 | 7 | |
| 646 | 0 MOTON | |
| 647 | 1 765 RESET | |
| 648 | 2 TC | |
| 649 | 3 | |
| 650 | 4 | |
| 651 | 5 PA15 | |
| 652 | 6 | |
| 653 | 7 | |
| 654 | 654 | |
| 655 | ||
| 655 | */ | |
| 656 | 656 | |
| 657 | 657 | newbrain_state *state = space->machine->driver_data; |
| 658 | 658 | |
| r5932 | r5933 | |
| 668 | 668 | { |
| 669 | 669 | /* |
| 670 | 670 | |
| 671 | ||
| 671 | bit description | |
| 672 | 672 | |
| 673 | 0 | |
| 674 | 1 | |
| 675 | 2 | |
| 676 | 3 | |
| 677 | 4 | |
| 678 | 5 FDC INT | |
| 679 | 6 PAGING | |
| 680 | 7 FDC ATT | |
| 673 | 0 | |
| 674 | 1 | |
| 675 | 2 | |
| 676 | 3 | |
| 677 | 4 | |
| 678 | 5 FDC INT | |
| 679 | 6 PAGING | |
| 680 | 7 FDC ATT | |
| 681 | 681 | |
| 682 | ||
| 682 | */ | |
| 683 | 683 | |
| 684 | 684 | newbrain_state *state = space->machine->driver_data; |
| 685 | 685 | |
| r5932 | r5933 | |
| 691 | 691 | { |
| 692 | 692 | /* |
| 693 | 693 | |
| 694 | ||
| 694 | bit description | |
| 695 | 695 | |
| 696 | 0 RDDK (V24 RxD) | |
| 697 | 1 _CTSD (V24 Clear to Send) | |
| 698 | 2 | |
| 699 | 3 | |
| 700 | 4 | |
| 701 | 5 TPIN | |
| 702 | 6 | |
| 703 | 7 _CTSP (Printer Clear to Send) | |
| 696 | 0 RDDK (V24 RxD) | |
| 697 | 1 _CTSD (V24 Clear to Send) | |
| 698 | 2 | |
| 699 | 3 | |
| 700 | 4 | |
| 701 | 5 TPIN | |
| 702 | 6 | |
| 703 | 7 _CTSP (Printer Clear to Send) | |
| 704 | 704 | |
| 705 | ||
| 705 | */ | |
| 706 | 706 | |
| 707 | 707 | return 0; |
| 708 | 708 | } |
| r5932 | r5933 | |
| 710 | 710 | |
| 711 | 711 | #define NEWBRAIN_COPCMD_NULLCOM 0xd0 |
| 712 | 712 | #define NEWBRAIN_COPCMD_DISPCOM 0xa0 |
| 713 | //#define NEWBRAIN_COPCMD_TIMCOM | |
| 713 | //#define NEWBRAIN_COPCMD_TIMCOM 0x | |
| 714 | 714 | #define NEWBRAIN_COPCMD_PDNCOM 0xb8 |
| 715 | 715 | #define NEWBRAIN_COPCMD_TAPECOM 0x80 |
| 716 | 716 | |
| r5932 | r5933 | |
| 725 | 725 | #define NEWBRAIN_COP_BREAK_PRESSED 0x02 |
| 726 | 726 | |
| 727 | 727 | #define NEWBRAIN_COP_REGINT 0x00 |
| 728 | /*#define NEWBRAIN_COP_CASSERR 0x | |
| 729 | #define NEWBRAIN_COP_CASSIN 0x | |
| 730 | #define NEWBRAIN_COP_KBD 0x | |
| 731 | #define NEWBRAIN_COP_CASSOUT 0x*/ | |
| 728 | /*#define NEWBRAIN_COP_CASSERR 0x | |
| 729 | #define NEWBRAIN_COP_CASSIN 0x | |
| 730 | #define NEWBRAIN_COP_KBD 0x | |
| 731 | #define NEWBRAIN_COP_CASSOUT 0x*/ | |
| 732 | 732 | |
| 733 | 733 | enum |
| 734 | 734 | { |
| r5932 | r5933 | |
| 776 | 776 | |
| 777 | 777 | break; |
| 778 | 778 | |
| 779 | /* case NEWBRAIN_COPCMD_TIMCOM: | |
| 780 | copregint = 0; | |
| 781 | copbytes = 6; | |
| 782 | copstate = NEWBRAIN_COP_STATE_DATA; | |
| 783 | break; | |
| 779 | /* case NEWBRAIN_COPCMD_TIMCOM: | |
| 780 | copregint = 0; | |
| 781 | copbytes = 6; | |
| 782 | copstate = NEWBRAIN_COP_STATE_DATA; | |
| 783 | break; | |
| 784 | 784 | */ |
| 785 | 785 | case NEWBRAIN_COPCMD_PDNCOM: |
| 786 | 786 | /* power down */ |
| r5932 | r5933 | |
| 808 | 808 | copdata = NEWBRAIN_COP_NO_DATA; |
| 809 | 809 | state->copint = 0; |
| 810 | 810 | check_interrupt(space->machine); |
| 811 | ||
| 811 | ||
| 812 | 812 | break; |
| 813 | 813 | } |
| 814 | 814 | } |
| r5932 | r5933 | |
| 831 | 831 | { |
| 832 | 832 | /* |
| 833 | 833 | |
| 834 | ||
| 834 | bit signal description | |
| 835 | 835 | |
| 836 | 0 _USERP 0 enables user data bus interrupt and also parallel latched data output (or centronics printer) interrupt | |
| 837 | 1 ANP 1 enables ADC conversion complete interrupt and also calling indicator interrupt | |
| 838 | 2 MLTMD 1 enables serial receive clock into multiplier input of DAC and signals data terminal not ready | |
| 839 | 3 MSPD 1 enables 50K Baud serial data rate to be obtained ie. CTC input clock of 800 kHz. 0 selects xxx.692 kHz | |
| 840 | 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 | |
| 841 | 5 ANSW 1 enables second bank of 4 analogue inputs (voltage, non-ratiometric), ie. ch4-7, and enabled sound output, 0 selects ch03 | |
| 842 | 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 | |
| 843 | 7 9th output bit for centronics printer port | |
| 836 | 0 _USERP 0 enables user data bus interrupt and also parallel latched data output (or centronics printer) interrupt | |
| 837 | 1 ANP 1 enables ADC conversion complete interrupt and also calling indicator interrupt | |
| 838 | 2 MLTMD 1 enables serial receive clock into multiplier input of DAC and signals data terminal not ready | |
| 839 | 3 MSPD 1 enables 50K Baud serial data rate to be obtained ie. CTC input clock of 800 kHz. 0 selects xxx.692 kHz | |
| 840 | 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 | |
| 841 | 5 ANSW 1 enables second bank of 4 analogue inputs (voltage, non-ratiometric), ie. ch4-7, and enabled sound output, 0 selects ch03 | |
| 842 | 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 | |
| 843 | 7 9th output bit for centronics printer port | |
| 844 | 844 | |
| 845 | ||
| 845 | */ | |
| 846 | 846 | |
| 847 | 847 | newbrain_state *state = space->machine->driver_data; |
| 848 | 848 | |
| r5932 | r5933 | |
| 853 | 853 | { |
| 854 | 854 | /* |
| 855 | 855 | |
| 856 | ||
| 856 | bit signal description | |
| 857 | 857 | |
| 858 | 0 HP0 | |
| 859 | 1 HP1 | |
| 860 | 2 HP2 | |
| 861 | 3 HP3 | |
| 862 | 4 HP4 | |
| 863 | 5 HP5 | |
| 864 | 6 HP6 | |
| 865 | 7 HP11 | |
| 858 | 0 HP0 | |
| 859 | 1 HP1 | |
| 860 | 2 HP2 | |
| 861 | 3 HP3 | |
| 862 | 4 HP4 | |
| 863 | 5 HP5 | |
| 864 | 6 HP6 | |
| 865 | 7 HP11 | |
| 866 | 866 | |
| 867 | HP0-HP2 are decoded to _ROM0..._ROM7 signals | |
| 868 | HP3-HP4 are decoded to _CH0..._CH3 signals | |
| 867 | HP0-HP2 are decoded to _ROM0..._ROM7 signals | |
| 868 | HP3-HP4 are decoded to _CH0..._CH3 signals | |
| 869 | 869 | |
| 870 | ||
| 870 | */ | |
| 871 | 871 | |
| 872 | 872 | newbrain_state *state = space->machine->driver_data; |
| 873 | 873 | |
| r5932 | r5933 | |
| 906 | 906 | |
| 907 | 907 | static READ8_HANDLER( ei_anin_r ) |
| 908 | 908 | { |
| 909 | // | |
| 909 | // int channel = offset & 0x03; | |
| 910 | 910 | |
| 911 | 911 | return 0; |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | static WRITE8_HANDLER( ei_anio_w ) |
| 915 | 915 | { |
| 916 | // | |
| 916 | // int channel = offset & 0x03; | |
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | static READ8_HANDLER( ei_st0_r ) |
| 920 | 920 | { |
| 921 | 921 | /* |
| 922 | 922 | |
| 923 | ||
| 923 | bit signal description | |
| 924 | 924 | |
| 925 | 0 fixed at 1 - indicates excess of 24 or 48, obsolete | |
| 926 | 1 PWRUP 1 indicates power up from 'cold' - necessary in battery machines with power switching | |
| 927 | 2 1 indicates analogue or calling indicator interrupts | |
| 928 | 3 _USRINT0 0 indicates centronics printer (latched output data) port interrupt | |
| 929 | 4 _USRINT 0 indicates parallel data bus port interrupt | |
| 930 | 5 _CLKINT 0 indicates frame frequency clock interrupt | |
| 931 | 6 _ACINT 0 indicates ACIA interrupt | |
| 932 | 7 _COPINT 0 indicates interrupt from micro-controller COP420M | |
| 925 | 0 fixed at 1 - indicates excess of 24 or 48, obsolete | |
| 926 | 1 PWRUP 1 indicates power up from 'cold' - necessary in battery machines with power switching | |
| 927 | 2 1 indicates analogue or calling indicator interrupts | |
| 928 | 3 _USRINT0 0 indicates centronics printer (latched output data) port interrupt | |
| 929 | 4 _USRINT 0 indicates parallel data bus port interrupt | |
| 930 | 5 _CLKINT 0 indicates frame frequency clock interrupt | |
| 931 | 6 _ACINT 0 indicates ACIA interrupt | |
| 932 | 7 _COPINT 0 indicates interrupt from micro-controller COP420M | |
| 933 | 933 | |
| 934 | ||
| 934 | */ | |
| 935 | 935 | |
| 936 | 936 | newbrain_state *state = space->machine->driver_data; |
| 937 | 937 | |
| r5932 | r5933 | |
| 942 | 942 | { |
| 943 | 943 | /* |
| 944 | 944 | |
| 945 | ||
| 945 | bit signal description | |
| 946 | 946 | |
| 947 | 0 | |
| 948 | 1 | |
| 949 | 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) | |
| 950 | 3 ANCH 1 indicates power is being taken from the mains supply | |
| 951 | 4 40/_80 1 indicates that 40 column video is selected on power up. 0 selects 80 column video | |
| 952 | 5 | |
| 953 | 6 TVCNSL 1 indicates that a video display is required on power up | |
| 954 | 7 | |
| 947 | 0 | |
| 948 | 1 | |
| 949 | 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) | |
| 950 | 3 ANCH 1 indicates power is being taken from the mains supply | |
| 951 | 4 40/_80 1 indicates that 40 column video is selected on power up. 0 selects 80 column video | |
| 952 | 5 | |
| 953 | 6 TVCNSL 1 indicates that a video display is required on power up | |
| 954 | 7 | |
| 955 | 955 | |
| 956 | ||
| 956 | */ | |
| 957 | 957 | |
| 958 | 958 | newbrain_state *state = space->machine->driver_data; |
| 959 | 959 | |
| r5932 | r5933 | |
| 964 | 964 | { |
| 965 | 965 | /* |
| 966 | 966 | |
| 967 | ||
| 967 | bit signal description | |
| 968 | 968 | |
| 969 | 0 received serial data from communications port | |
| 970 | 1 0 indicates 'clear-to-send' condition at communications port | |
| 971 | 2 | |
| 972 | 3 | |
| 973 | 4 | |
| 974 | 5 logic level tape input | |
| 975 | 6 | |
| 976 | 7 0 indicates 'clear-to-send' condition at printer port | |
| 969 | 0 received serial data from communications port | |
| 970 | 1 0 indicates 'clear-to-send' condition at communications port | |
| 971 | 2 | |
| 972 | 3 | |
| 973 | 4 | |
| 974 | 5 logic level tape input | |
| 975 | 6 | |
| 976 | 7 0 indicates 'clear-to-send' condition at printer port | |
| 977 | 977 | |
| 978 | ||
| 978 | */ | |
| 979 | 979 | |
| 980 | 980 | return 0; |
| 981 | 981 | } |
| r5932 | r5933 | |
| 999 | 999 | |
| 1000 | 1000 | /* |
| 1001 | 1001 | |
| 1002 | ||
| 1002 | bit signal description | |
| 1003 | 1003 | |
| 1004 | 0 PG 1 enables paging circuits | |
| 1005 | 1 WPL unused | |
| 1006 | 2 A16 1 sets local A16 to 1 (ie. causes second set of 8 page registers to select addressed memory) | |
| 1007 | 3 _MPM 0 selects multi-processing mode. among other effects this extends the page registers from 8 to 12 bits in length | |
| 1008 | 4 HISLT 1 isolates the local machine. this is used in multi-processing mode | |
| 1009 | 5 | |
| 1010 | 6 | |
| 1011 | 7 | |
| 1004 | 0 PG 1 enables paging circuits | |
| 1005 | 1 WPL unused | |
| 1006 | 2 A16 1 sets local A16 to 1 (ie. causes second set of 8 page registers to select addressed memory) | |
| 1007 | 3 _MPM 0 selects multi-processing mode. among other effects this extends the page registers from 8 to 12 bits in length | |
| 1008 | 4 HISLT 1 isolates the local machine. this is used in multi-processing mode | |
| 1009 | 5 | |
| 1010 | 6 | |
| 1011 | 7 | |
| 1012 | 1012 | |
| 1013 | ||
| 1013 | */ | |
| 1014 | 1014 | |
| 1015 | 1015 | state->paging = BIT(data, 0); |
| 1016 | 1016 | state->a16 = BIT(data, 2); |
| r5932 | r5933 | |
| 1022 | 1022 | |
| 1023 | 1023 | /* |
| 1024 | 1024 | |
| 1025 | ||
| 1025 | bit signal description | |
| 1026 | 1026 | |
| 1027 | 0 PAGING 1 enables paging circuits | |
| 1028 | 1 | |
| 1029 | 2 HA16 1 sets local A16 to 1 (ie. causes second set of 8 page registers to select addressed memory) | |
| 1030 | 3 MPM 0 selects multi-processing mode. among other effects this extends the page registers from 8 to 12 bits in length | |
| 1031 | 4 | |
| 1032 | 5 _FDC RESET | |
| 1033 | 6 | |
| 1034 | 7 FDC ATT | |
| 1027 | 0 PAGING 1 enables paging circuits | |
| 1028 | 1 | |
| 1029 | 2 HA16 1 sets local A16 to 1 (ie. causes second set of 8 page registers to select addressed memory) | |
| 1030 | 3 MPM 0 selects multi-processing mode. among other effects this extends the page registers from 8 to 12 bits in length | |
| 1031 | 4 | |
| 1032 | 5 _FDC RESET | |
| 1033 | 6 | |
| 1034 | 7 FDC ATT | |
| 1035 | 1035 | |
| 1036 | ||
| 1036 | */ | |
| 1037 | 1037 | |
| 1038 | 1038 | cputag_set_input_line(space->machine, FDC_Z80_TAG, INPUT_LINE_RESET, BIT(data, 5) ? HOLD_LINE : CLEAR_LINE); |
| 1039 | 1039 | |
| r5932 | r5933 | |
| 1374 | 1374 | static MACHINE_START( newbrain ) |
| 1375 | 1375 | { |
| 1376 | 1376 | newbrain_state *state = machine->driver_data; |
| 1377 | ||
| 1377 | ||
| 1378 | 1378 | /* find devices */ |
| 1379 | 1379 | state->cassette1 = devtag_get_device(machine, CASSETTE1_TAG); |
| 1380 | 1380 | state->cassette2 = devtag_get_device(machine, CASSETTE2_TAG); |
| r5932 | r5933 | |
| 1523 | 1523 | |
| 1524 | 1524 | static MACHINE_DRIVER_START( newbrain_eim ) |
| 1525 | 1525 | MDRV_IMPORT_FROM(newbrain_a) |
| 1526 | ||
| 1526 | ||
| 1527 | 1527 | /* basic system hardware */ |
| 1528 | 1528 | MDRV_CPU_MODIFY(Z80_TAG) |
| 1529 | 1529 | MDRV_CPU_IO_MAP(newbrain_ei_io_map) |
| r5932 | r5933 | |
| 1543 | 1543 | |
| 1544 | 1544 | /* MC6850 */ |
| 1545 | 1545 | MDRV_ACIA6850_ADD(MC6850_TAG, newbrain_acia_intf) |
| 1546 | ||
| 1546 | ||
| 1547 | 1547 | /* NEC765 */ |
| 1548 | 1548 | MDRV_NEC765A_ADD(NEC765_TAG, newbrain_nec765_interface) |
| 1549 | ||
| 1549 | ||
| 1550 | 1550 | MDRV_FLOPPY_2_DRIVES_ADD(newbrain_floppy_config) |
| 1551 | 1551 | MACHINE_DRIVER_END |
| 1552 | 1552 | |
| r5932 | r5933 | |
| 1692 | 1692 | SYSTEM_CONFIG_END |
| 1693 | 1693 | |
| 1694 | 1694 | static SYSTEM_CONFIG_START( newbrain_eim ) |
| 1695 | CONFIG_RAM_DEFAULT (96 * 1024) | |
| 1695 | CONFIG_RAM_DEFAULT (96 * 1024) | |
| 1696 | 1696 | CONFIG_DEVICE(newbrain_serial_getinfo) |
| 1697 | 1697 | SYSTEM_CONFIG_END |
| 1698 | 1698 | |
| 1699 | 1699 | /* System Drivers */ |
| 1700 | 1700 | |
| 1701 | // YEAR NAME | |
| 1701 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS | |
| 1702 | 1702 | COMP( 1981, newbrain, 0, 0, newbrain_a, newbrain, 0, newbrain_a, "Grundy Business Systems Ltd.", "NewBrain AD", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1703 | 1703 | COMP( 1981, newbraie, newbrain, 0, newbrain_eim, newbrain, 0, newbrain_eim, "Grundy Business Systems Ltd.", "NewBrain AD with Expansion Interface", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1704 | 1704 | COMP( 1981, newbraia, newbrain, 0, newbrain_a, newbrain, 0, newbrain_a, "Grundy Business Systems Ltd.", "NewBrain A", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| r5932 | r5933 | |
|---|---|---|
| 96 | 96 | |
| 97 | 97 | PORT_START("ROW2") |
| 98 | 98 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') |
| 99 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') | |
| 99 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') | |
| 100 | 100 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 101 | 101 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') |
| 102 | 102 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') |
| r5932 | r5933 | |
|---|---|---|
| 18 | 18 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 19 | 19 | AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM |
| 20 | 20 | AM_RANGE(0x2000, 0x23ff) AM_RAM |
| 21 | AM_RANGE(0x2400, 0x27ff) AM_READWRITE(sapi1_keyboard_r, sapi1_keyboard_w) // PORT 0 - keyboard | |
| 21 | AM_RANGE(0x2400, 0x27ff) AM_READWRITE(sapi1_keyboard_r, sapi1_keyboard_w) // PORT 0 - keyboard | |
| 22 | 22 | //AM_RANGE(0x2800, 0x2bff) AM_NOP // PORT 1 |
| 23 | 23 | //AM_RANGE(0x2c00, 0x2fff) AM_NOP // PORT 2 |
| 24 | //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214 | |
| 24 | //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214 | |
| 25 | 25 | AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE(&sapi_video_ram) // AND-1 (video RAM) |
| 26 | 26 | AM_RANGE(0x4000, 0x4000) AM_RAM // REM-1 |
| 27 | 27 | ADDRESS_MAP_END |
| r5932 | r5933 | |
|---|---|---|
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | /**************************************************************** |
| 179 | ||
| 179 | EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT | |
| 180 | 180 | ****************************************************************/ |
| 181 | 181 | |
| 182 | 182 | static DEVICE_START( einstein_daisy ) { } |
| r5932 | r5933 | |
| 898 | 898 | MDRV_MACHINE_RESET(einstein) |
| 899 | 899 | |
| 900 | 900 | /* this is actually clocked at the system clock 4 MHz, but this would be too fast for our |
| 901 | ||
| 901 | driver. So we update at 50Hz and hope this is good enough. */ | |
| 902 | 902 | MDRV_TIMER_ADD_PERIODIC("keyboard", einstein_keyboard_timer_callback, HZ(50)) |
| 903 | 903 | |
| 904 | 904 | MDRV_Z80PIO_ADD(IC_I063, einstein_pio_intf) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 3 | Nintendo Virtual Boy | |
| 4 | 2 | |
| 3 | Nintendo Virtual Boy | |
| 4 | ||
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | Great info at http://www.goliathindustries.com/vb/ and http://www.vr32.de/modules/dokuwiki/doku.php? | |
| 7 | Great info at http://www.goliathindustries.com/vb/ and http://www.vr32.de/modules/dokuwiki/doku.php? | |
| 8 | 8 | |
| 9 | 9 | ****************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 53 | 53 | UINT16 VER; |
| 54 | 54 | UINT16 SPT[4]; |
| 55 | 55 | UINT16 GPLT[4]; |
| 56 | UINT16 JPLT[4]; | |
| 57 | UINT16 BKCOL; | |
| 56 | UINT16 JPLT[4]; | |
| 57 | UINT16 BKCOL; | |
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | 60 | static struct VIP_REGS_STRUCT vip_regs; |
| r5932 | r5933 | |
| 92 | 92 | default: |
| 93 | 93 | logerror("Unemulated read: offset %08x\n", 0x02000000 + (offset << 2)); |
| 94 | 94 | break; |
| 95 | } | |
| 95 | } | |
| 96 | 96 | return value; |
| 97 | 97 | } |
| 98 | 98 | |
| r5932 | r5933 | |
| 130 | 130 | case 0x18: // TLB (Timer Low Byte) |
| 131 | 131 | case 0x1c: // THB (Timer High Byte) |
| 132 | 132 | default: |
| 133 | logerror("Unemulated write: offset %08x, data %04x\n", 0x02000000 + (offset << 2), data); | |
| 133 | logerror("Unemulated write: offset %08x, data %04x\n", 0x02000000 + (offset << 2), data); | |
| 134 | 134 | break; |
| 135 | 135 | } |
| 136 | 136 | } |
| r5932 | r5933 | |
| 153 | 153 | case 0x22: //DPCTRL |
| 154 | 154 | return vip_regs.DPCTRL; |
| 155 | 155 | break; |
| 156 | case 0x24: //BRTA | |
| 156 | case 0x24: //BRTA | |
| 157 | 157 | return vip_regs.BRTA; |
| 158 | break; | |
| 158 | break; | |
| 159 | 159 | case 0x26: //BRTB |
| 160 | 160 | return vip_regs.BRTB; |
| 161 | 161 | break; |
| r5932 | r5933 | |
| 221 | 221 | break; |
| 222 | 222 | default: |
| 223 | 223 | logerror("Unemulated read: addr %08x\n", offset * 2 + 0x0005f800); |
| 224 | break; | |
| 224 | break; | |
| 225 | 225 | } |
| 226 | 226 | return 0xffff; |
| 227 | 227 | } |
| r5932 | r5933 | |
| 247 | 247 | case 0x24: //BRTA |
| 248 | 248 | vip_regs.BRTA = data; |
| 249 | 249 | palette_set_color_rgb(space->machine, 1,(vip_regs.BRTA) & 0xff,0,0); |
| 250 | break; | |
| 250 | break; | |
| 251 | 251 | case 0x26: //BRTB |
| 252 | 252 | vip_regs.BRTB = data; |
| 253 | 253 | palette_set_color_rgb(space->machine, 2,(vip_regs.BRTA + vip_regs.BRTB) & 0xff,0,0); |
| 254 | 254 | break; |
| 255 | case 0x28: //BRTC | |
| 255 | case 0x28: //BRTC | |
| 256 | 256 | vip_regs.BRTC = data; |
| 257 | palette_set_color_rgb(space->machine, 3,(vip_regs.BRTA + vip_regs.BRTB + vip_regs.BRTC) & 0xff,0,0); | |
| 257 | palette_set_color_rgb(space->machine, 3,(vip_regs.BRTA + vip_regs.BRTB + vip_regs.BRTC) & 0xff,0,0); | |
| 258 | 258 | break; |
| 259 | 259 | case 0x2A: //REST |
| 260 | 260 | vip_regs.REST = data; |
| r5932 | r5933 | |
| 315 | 315 | break; |
| 316 | 316 | default: |
| 317 | 317 | logerror("Unemulated write: addr %08x, data %04x\n", offset * 2 + 0x0005f800, data); |
| 318 | break; | |
| 318 | break; | |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | static WRITE16_HANDLER( vboy_font0_w ) |
| 323 | 323 | { |
| 324 | vboy_font[offset] = data | (vboy_font[offset] & (mem_mask ^ 0xffff)); | |
| 324 | vboy_font[offset] = data | (vboy_font[offset] & (mem_mask ^ 0xffff)); | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | static WRITE16_HANDLER( vboy_font1_w ) |
| 328 | 328 | { |
| 329 | vboy_font[offset + 0x1000] = data | (vboy_font[offset + 0x1000] & (mem_mask ^ 0xffff)); | |
| 329 | vboy_font[offset + 0x1000] = data | (vboy_font[offset + 0x1000] & (mem_mask ^ 0xffff)); | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | static WRITE16_HANDLER( vboy_font2_w ) |
| 333 | 333 | { |
| 334 | vboy_font[offset + 0x2000] = data | (vboy_font[offset + 0x2000] & (mem_mask ^ 0xffff)); | |
| 334 | vboy_font[offset + 0x2000] = data | (vboy_font[offset + 0x2000] & (mem_mask ^ 0xffff)); | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | static WRITE16_HANDLER( vboy_font3_w ) |
| 338 | 338 | { |
| 339 | vboy_font[offset + 0x3000] = data | (vboy_font[offset + 0x3000] & (mem_mask ^ 0xffff)); | |
| 339 | vboy_font[offset + 0x3000] = data | (vboy_font[offset + 0x3000] & (mem_mask ^ 0xffff)); | |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | static READ16_HANDLER( vboy_font0_r ) |
| r5932 | r5933 | |
| 363 | 363 | { |
| 364 | 364 | UINT16 code = ch; |
| 365 | 365 | int i, b; |
| 366 | ||
| 367 | for(i = 0; i < 8; i++) | |
| 366 | ||
| 367 | for(i = 0; i < 8; i++) | |
| 368 | 368 | { |
| 369 | 369 | UINT16 data; |
| 370 | 370 | if(flipy==0) { |
| 371 | data =vboy_font[code * 8 + i]; | |
| 371 | data =vboy_font[code * 8 + i]; | |
| 372 | 372 | } else { |
| 373 | data =vboy_font[code * 8 + (7-i)]; | |
| 373 | data =vboy_font[code * 8 + (7-i)]; | |
| 374 | 374 | } |
| 375 | 375 | for (b = 0; b < 8; b++) |
| 376 | { | |
| 376 | { | |
| 377 | 377 | UINT8 dat,col; |
| 378 | 378 | if(flipx==0) { |
| 379 | 379 | dat = ((data >> (b << 1)) & 0x03); |
| r5932 | r5933 | |
| 383 | 383 | col = (pal >> (dat*2)) & 3; |
| 384 | 384 | // This is how emulator works, but need to check |
| 385 | 385 | if (dat==0) col=0; |
| 386 | ||
| 387 | if (!trans || ( trans && col!=0)) { | |
| 386 | ||
| 387 | if (!trans || ( trans && col!=0)) { | |
| 388 | 388 | *BITMAP_ADDR16(bitmap, (y + i) & 0x1ff, (x + b) & 0x1ff) = col; |
| 389 | 389 | } |
| 390 | } | |
| 391 | } | |
| 390 | } | |
| 391 | } | |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | static WRITE16_HANDLER( vboy_bgmap_w ) |
| 395 | { | |
| 395 | { | |
| 396 | 396 | vboy_bgmap[offset] = data | (vboy_bgmap[offset] & (mem_mask ^ 0xffff)); |
| 397 | 397 | } |
| 398 | 398 | |
| r5932 | r5933 | |
| 411 | 411 | AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 |
| 412 | 412 | AM_RANGE( 0x00018000, 0x0001dfff ) AM_RAM AM_BASE((UINT32**)&vboy_r_frame_1) // R frame buffer 1 |
| 413 | 413 | AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 |
| 414 | ||
| 414 | ||
| 415 | 415 | AM_RANGE( 0x00020000, 0x0003ffff ) AM_RAM AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory |
| 416 | ||
| 417 | //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC | |
| 416 | ||
| 417 | //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC | |
| 418 | 418 | AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff) |
| 419 | ||
| 419 | ||
| 420 | 420 | AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 mirror |
| 421 | 421 | AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 mirror |
| 422 | 422 | AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 mirror |
| 423 | 423 | AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 mirror |
| 424 | ||
| 425 | AM_RANGE( 0x01000000, 0x010005ff ) AM_RAM // Sound RAM | |
| 424 | ||
| 425 | AM_RANGE( 0x01000000, 0x010005ff ) AM_RAM // Sound RAM | |
| 426 | 426 | AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(port_02_read, port_02_write) // Hardware control registers mask 0xff |
| 427 | 427 | //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area |
| 428 | 428 | AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM // Main RAM - 64K mask 0xffff |
| r5932 | r5933 | |
| 440 | 440 | AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 |
| 441 | 441 | AM_RANGE( 0x00018000, 0x0001dfff ) AM_RAM AM_BASE((UINT32**)&vboy_r_frame_1) // R frame buffer 1 |
| 442 | 442 | AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 |
| 443 | ||
| 443 | ||
| 444 | 444 | AM_RANGE( 0x00020000, 0x0003ffff ) AM_RAM AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory |
| 445 | ||
| 446 | //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC | |
| 445 | ||
| 446 | //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC | |
| 447 | 447 | AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff) |
| 448 | ||
| 448 | ||
| 449 | 449 | AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 mirror |
| 450 | 450 | AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 mirror |
| 451 | 451 | AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 mirror |
| 452 | 452 | AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 mirror |
| 453 | ||
| 454 | AM_RANGE( 0x01000000, 0x010005ff ) AM_RAM // Sound RAM | |
| 453 | ||
| 454 | AM_RANGE( 0x01000000, 0x010005ff ) AM_RAM // Sound RAM | |
| 455 | 455 | AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(port_02_read, port_02_write) // Hardware control registers mask 0xff |
| 456 | 456 | //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area |
| 457 | 457 | AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM // Main RAM - 64K mask 0xffff |
| r5932 | r5933 | |
| 463 | 463 | static INPUT_PORTS_START( vboy ) |
| 464 | 464 | PORT_START("INPUT") |
| 465 | 465 | PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) |
| 466 | PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) | |
| 466 | PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) | |
| 467 | 467 | PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1) |
| 468 | 468 | PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1) |
| 469 | 469 | PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1) |
| 470 | 470 | PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1) |
| 471 | 471 | PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1) |
| 472 | 472 | PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(1) |
| 473 | PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) | |
| 473 | PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) | |
| 474 | 474 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) |
| 475 | 475 | PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("L") PORT_PLAYER(1) // Left button on back |
| 476 | 476 | PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("R") PORT_PLAYER(1) // Right button on back |
| r5932 | r5933 | |
| 481 | 481 | INPUT_PORTS_END |
| 482 | 482 | |
| 483 | 483 | |
| 484 | static MACHINE_RESET(vboy) | |
| 484 | static MACHINE_RESET(vboy) | |
| 485 | 485 | { |
| 486 | 486 | /* Initial values taken from Reality Boy, to be verified when emulation improves */ |
| 487 | 487 | vboy_regs.lpc = 0x6d; |
| 488 | 488 | vboy_regs.lpc2 = 0xff; |
| 489 | vboy_regs.lpt = 0x00; | |
| 489 | vboy_regs.lpt = 0x00; | |
| 490 | 490 | vboy_regs.lpr = 0x00; |
| 491 | 491 | vboy_regs.klb = 0x00; |
| 492 | 492 | vboy_regs.khb = 0x00; |
| r5932 | r5933 | |
| 502 | 502 | { |
| 503 | 503 | int i; |
| 504 | 504 | // Allocate memory for temporary screens |
| 505 | for(i = 0; i < 16; i++) | |
| 505 | for(i = 0; i < 16; i++) | |
| 506 | 506 | { |
| 507 | 507 | bg_map[i] = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16); |
| 508 | 508 | } |
| 509 | 509 | screen_output = auto_bitmap_alloc(machine, 384, 224, BITMAP_FORMAT_INDEXED16); |
| 510 | ||
| 510 | ||
| 511 | 511 | vboy_font = auto_alloc_array(machine, UINT16, 2048 * 8); |
| 512 | 512 | vboy_bgmap = auto_alloc_array(machine, UINT16, 0x20000 >> 1);; |
| 513 | vboy_objects = vboy_bgmap + (0x1E000 >> 1); | |
| 513 | vboy_objects = vboy_bgmap + (0x1E000 >> 1); | |
| 514 | 514 | vboy_columntab1 = vboy_bgmap + (0x1dc00 >> 1); |
| 515 | 515 | vboy_columntab2 = vboy_bgmap + (0x1de00 >> 1); |
| 516 | 516 | vboy_world = vboy_bgmap + (0x1d800 >> 1); |
| r5932 | r5933 | |
| 518 | 518 | |
| 519 | 519 | static void fill_bg_map(int num, bitmap_t *bitmap) |
| 520 | 520 | { |
| 521 | int i, j; | |
| 521 | int i, j; | |
| 522 | 522 | // Fill background map |
| 523 | for (i = 0; i < 64; i++) | |
| 523 | for (i = 0; i < 64; i++) | |
| 524 | 524 | { |
| 525 | for (j = 0; j < 64; j++) | |
| 525 | for (j = 0; j < 64; j++) | |
| 526 | 526 | { |
| 527 | 527 | UINT16 val = vboy_bgmap[j + 64 * i + (num * 0x1000)]; |
| 528 | 528 | put_char(j * 8, i * 8, val & 0x7ff, bitmap,BIT(val,13),BIT(val,12),0, vip_regs.GPLT[(val >> 14) & 3]); |
| r5932 | r5933 | |
| 542 | 542 | UINT16 w = vboy_world[num*16+7]; |
| 543 | 543 | UINT16 h = vboy_world[num*16+8]; |
| 544 | 544 | UINT16 param_base = vboy_world[num*16+9] & 0xfff0; |
| 545 | // | |
| 545 | // UINT16 overplane = vboy_world[num*16+10]; | |
| 546 | 546 | UINT8 bg_map_num = def & 0x0f; |
| 547 | INT16 x,y,i; | |
| 547 | INT16 x,y,i; | |
| 548 | 548 | UINT8 mode = (def >> 12) & 3; |
| 549 | 549 | vboy_paramtab = vboy_bgmap + param_base; |
| 550 | if ((mode==0) || (mode==1)) { | |
| 551 | fill_bg_map(bg_map_num,bg_map[bg_map_num]); | |
| 550 | if ((mode==0) || (mode==1)) { | |
| 551 | fill_bg_map(bg_map_num,bg_map[bg_map_num]); | |
| 552 | 552 | if (BIT(def,15) && (right==0)) { |
| 553 | // Left screen | |
| 553 | // Left screen | |
| 554 | 554 | for(y=0;y<=h;y++) { |
| 555 | 555 | for(x=0;x<=w;x++) { |
| 556 | 556 | INT16 y1 = (y+gy); |
| 557 | INT16 x1 = (x+gx-gp); | |
| 557 | INT16 x1 = (x+gx-gp); | |
| 558 | 558 | UINT16 pix = 0; |
| 559 | 559 | if (mode==1) { |
| 560 | 560 | x1 += vboy_paramtab[y*2]; |
| 561 | 561 | } |
| 562 | pix = *BITMAP_ADDR16(bg_map[bg_map_num], (y+my) & 0x1ff, (x+mx-mp) & 0x1ff); | |
| 562 | pix = *BITMAP_ADDR16(bg_map[bg_map_num], (y+my) & 0x1ff, (x+mx-mp) & 0x1ff); | |
| 563 | 563 | if (pix!=0) { |
| 564 | 564 | if (y1>=0 && y1<224) { |
| 565 | 565 | if (x1>=0 && x1<384) { |
| r5932 | r5933 | |
| 571 | 571 | } |
| 572 | 572 | } |
| 573 | 573 | if (BIT(def,14) && (right==1)) { |
| 574 | // Right screen | |
| 574 | // Right screen | |
| 575 | 575 | for(y=0;y<=h;y++) { |
| 576 | 576 | for(x=0;x<=w;x++) { |
| 577 | 577 | INT16 y1 = (y+gy); |
| r5932 | r5933 | |
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | 595 | if(mode==2) { |
| 596 | ||
| 596 | ||
| 597 | 597 | } |
| 598 | 598 | if(mode==3) { |
| 599 | 599 | // just for test |
| r5932 | r5933 | |
| 608 | 608 | } else { |
| 609 | 609 | put_char((jx+jp) & 0x1ff,jy,jca,bitmap,BIT(vboy_objects[start_ndx+3],13),BIT(vboy_objects[start_ndx+3],12),1,vip_regs.JPLT[(vboy_objects[start_ndx+3]>>14) & 3]); |
| 610 | 610 | } |
| 611 | } | |
| 611 | } | |
| 612 | 612 | } |
| 613 | 613 | // Return END world status |
| 614 | 614 | return BIT(def,6); |
| r5932 | r5933 | |
| 619 | 619 | int i; |
| 620 | 620 | UINT8 right = 0; |
| 621 | 621 | const device_config *_3d_right_screen = devtag_get_device(screen->machine, "3dright"); |
| 622 | ||
| 622 | ||
| 623 | 623 | bitmap_fill(screen_output, cliprect, vip_regs.BKCOL); |
| 624 | ||
| 624 | ||
| 625 | 625 | if (screen == _3d_right_screen) right = 1; |
| 626 | 626 | |
| 627 | 627 | for(i=31;i>=0;i--) { |
| 628 | 628 | if (display_world(i,screen_output,right)) break; |
| 629 | 629 | } |
| 630 | 630 | copybitmap(bitmap, screen_output, 0, 0, 0, 0, cliprect); |
| 631 | ||
| 631 | ||
| 632 | 632 | vip_regs.DPSTTS = ((vip_regs.DPCTRL&0x0302)|0x7c); |
| 633 | 633 | return 0; |
| 634 | 634 | } |
| r5932 | r5933 | |
| 641 | 641 | static const rgb_t vboy_palette[18] = { |
| 642 | 642 | MAKE_RGB(0x00, 0x00, 0x00), // 0 |
| 643 | 643 | MAKE_RGB(0x00, 0x00, 0x00), // 1 |
| 644 | MAKE_RGB(0x00, 0x00, 0x00), // 2 | |
| 645 | MAKE_RGB(0x00, 0x00, 0x00) // 3 | |
| 644 | MAKE_RGB(0x00, 0x00, 0x00), // 2 | |
| 645 | MAKE_RGB(0x00, 0x00, 0x00) // 3 | |
| 646 | 646 | }; |
| 647 | 647 | |
| 648 | 648 | PALETTE_INIT( vboy ) |
| r5932 | r5933 | |
| 659 | 659 | MDRV_MACHINE_RESET(vboy) |
| 660 | 660 | |
| 661 | 661 | MDRV_TIMER_ADD_PERIODIC("video", video_tick, HZ(100)) |
| 662 | ||
| 663 | /* video hardware */ | |
| 664 | MDRV_DEFAULT_LAYOUT(layout_vboy) | |
| 665 | 662 | |
| 663 | /* video hardware */ | |
| 664 | MDRV_DEFAULT_LAYOUT(layout_vboy) | |
| 665 | ||
| 666 | 666 | MDRV_PALETTE_LENGTH(4) |
| 667 | 667 | MDRV_PALETTE_INIT(vboy) |
| 668 | 668 | |
| 669 | 669 | MDRV_VIDEO_START(vboy) |
| 670 | 670 | MDRV_VIDEO_UPDATE(vboy) |
| 671 | ||
| 671 | ||
| 672 | 672 | /* Left screen */ |
| 673 | 673 | MDRV_SCREEN_ADD("3dleft", RASTER) |
| 674 | 674 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| r5932 | r5933 | |
| 698 | 698 | |
| 699 | 699 | /* Driver */ |
| 700 | 700 | |
| 701 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY | |
| 701 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 702 | 702 | CONS( 1995, vboy, 0, 0, vboy, vboy, 0, 0, "Nintendo", "Virtual Boy", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 19 | 19 | <kevtris> IOA6 = strobe (SC-01) |
| 20 | 20 | <kevtris> IOA7 = vochord control, 0 = off, 1 = on |
| 21 | 21 | <kevtris> IOB0-IOB7 = dip switches |
| 22 | <kevtris> there ya go, complete IO port map | |
| 22 | <kevtris> there ya go, complete IO port map | |
| 23 | 23 | <LordNLptp> cool :) |
| 24 | 24 | <kevtris> I pinned the IO to the serial port from the 8251 but I don't think it's too useful |
| 25 | 25 | <LordNLptp> eh, its useful |
| r5932 | r5933 | |
| 34 | 34 | <kevtris> 4MHz for the Z80 |
| 35 | 35 | <kevtris> 2MHz for the 8253 and '8910 |
| 36 | 36 | <kevtris> then the dividers also generate the system reset signals for the 8251 |
| 37 | <kevtris> and a periodic IRQ | |
| 37 | <kevtris> and a periodic IRQ | |
| 38 | 38 | <LordNLptp> on the z80? |
| 39 | 39 | <LordNLptp> ok how does that work? |
| 40 | 40 | <kevtris> IRQ rate is umm |
| r5932 | r5933 | |
|---|---|---|
| 15 | 15 | UINT8 fk1_video_rol; |
| 16 | 16 | /* |
| 17 | 17 | Port A: |
| 18 | Printer | |
| 19 | Port B: | |
| 20 | Keyboard | |
| 18 | Printer | |
| 19 | Port B: | |
| 20 | Keyboard | |
| 21 | 21 | Port C: |
| 22 | READING : | |
| 23 | 7 - / OBF(buffer overflow for the printer) | |
| 24 | 6 - INTE printer | |
| 25 | 5 - ERROR printer | |
| 26 | 4 - /PEND, lack of paper | |
| 27 | 3 - INTR printer | |
| 28 | 2 - INTE keyboard | |
| 29 | 1 - IBF (data from the keyboard) | |
| 30 | 0 - INTR keyboard | |
| 31 | WRITING : | |
| 32 | 6 - INTE printer | |
| 33 | 2 - INTE keyboard | |
| 22 | READING : | |
| 23 | 7 - / OBF(buffer overflow for the printer) | |
| 24 | 6 - INTE printer | |
| 25 | 5 - ERROR printer | |
| 26 | 4 - /PEND, lack of paper | |
| 27 | 3 - INTR printer | |
| 28 | 2 - INTE keyboard | |
| 29 | 1 - IBF (data from the keyboard) | |
| 30 | 0 - INTR keyboard | |
| 31 | WRITING : | |
| 32 | 6 - INTE printer | |
| 33 | 2 - INTE keyboard | |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | 36 | static WRITE8_DEVICE_HANDLER (fk1_ppi_1_a_w ) |
| 37 | 37 | { |
| 38 | // | |
| 38 | // logerror("fk1_ppi_1_a_w %02x\n",data); | |
| 39 | 39 | } |
| 40 | 40 | static WRITE8_DEVICE_HANDLER (fk1_ppi_1_b_w ) |
| 41 | 41 | { |
| 42 | // | |
| 42 | // logerror("fk1_ppi_1_b_w %02x\n",data); | |
| 43 | 43 | } |
| 44 | 44 | static WRITE8_DEVICE_HANDLER (fk1_ppi_1_c_w ) |
| 45 | 45 | { |
| r5932 | r5933 | |
| 53 | 53 | } |
| 54 | 54 | static READ8_DEVICE_HANDLER (fk1_ppi_1_b_r ) |
| 55 | 55 | { |
| 56 | // | |
| 56 | // logerror("fk1_ppi_1_b_r\n"); | |
| 57 | 57 | return 0; |
| 58 | 58 | } |
| 59 | 59 | static READ8_DEVICE_HANDLER (fk1_ppi_1_c_r ) |
| 60 | 60 | { |
| 61 | // | |
| 61 | // logerror("fk1_ppi_1_c_r\n"); | |
| 62 | 62 | return 0; |
| 63 | 63 | } |
| 64 | 64 | I8255A_INTERFACE( fk1_ppi8255_interface_1 ) |
| r5932 | r5933 | |
| 66 | 66 | DEVCB_HANDLER(fk1_ppi_1_a_r), |
| 67 | 67 | DEVCB_HANDLER(fk1_ppi_1_b_r), |
| 68 | 68 | DEVCB_HANDLER(fk1_ppi_1_c_r), |
| 69 | DEVCB_HANDLER(fk1_ppi_1_a_w), | |
| 69 | DEVCB_HANDLER(fk1_ppi_1_a_w), | |
| 70 | 70 | DEVCB_HANDLER(fk1_ppi_1_b_w), |
| 71 | 71 | DEVCB_HANDLER(fk1_ppi_1_c_w) |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | 74 | /* |
| 75 | Port A: | |
| 76 | Writing data to disk | |
| 75 | Port A: | |
| 76 | Writing data to disk | |
| 77 | 77 | Port B: |
| 78 | Reading data from disk | |
| 79 | Port C: | |
| 80 | READING: | |
| 81 | 7 - / OF A data write to disk, | |
| 82 | 6 - INTE A, | |
| 83 | 5 - Select the drive A, B, | |
| 84 | 4 - Not connected | |
| 85 | 3 - INTR A | |
| 86 | 2 - INTE B read data, | |
| 87 | 1 - IBF B read data, | |
| 88 | 0 - INTR B | |
| 78 | Reading data from disk | |
| 79 | Port C: | |
| 80 | READING: | |
| 81 | 7 - / OF A data write to disk, | |
| 82 | 6 - INTE A, | |
| 83 | 5 - Select the drive A, B, | |
| 84 | 4 - Not connected | |
| 85 | 3 - INTR A | |
| 86 | 2 - INTE B read data, | |
| 87 | 1 - IBF B read data, | |
| 88 | 0 - INTR B | |
| 89 | 89 | |
| 90 | WRITING: | |
| 91 | 6 - INTE A - reading data | |
| 92 | 2 - INTE B - writing data | |
| 90 | WRITING: | |
| 91 | 6 - INTE A - reading data | |
| 92 | 2 - INTE B - writing data | |
| 93 | 93 | */ |
| 94 | 94 | static WRITE8_DEVICE_HANDLER (fk1_ppi_2_a_w ) |
| 95 | 95 | { |
| 96 | // | |
| 96 | // logerror("write to disk %02x\n",data); | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | static WRITE8_DEVICE_HANDLER (fk1_ppi_2_c_w ) |
| 100 | 100 | { |
| 101 | // | |
| 101 | // logerror("fk1_ppi_2_c_w %02x\n",data); | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | static READ8_DEVICE_HANDLER (fk1_ppi_2_b_r ) |
| 105 | 105 | { |
| 106 | // | |
| 106 | // logerror("read from disk\n"); | |
| 107 | 107 | return 0; |
| 108 | 108 | } |
| 109 | 109 | static READ8_DEVICE_HANDLER (fk1_ppi_2_c_r ) |
| 110 | 110 | { |
| 111 | // | |
| 111 | // logerror("fk1_ppi_2_c_r\n"); | |
| 112 | 112 | return 0; |
| 113 | 113 | } |
| 114 | 114 | I8255A_INTERFACE( fk1_ppi8255_interface_2 ) |
| r5932 | r5933 | |
| 116 | 116 | DEVCB_NULL, |
| 117 | 117 | DEVCB_HANDLER(fk1_ppi_2_b_r), |
| 118 | 118 | DEVCB_HANDLER(fk1_ppi_2_c_r), |
| 119 | DEVCB_HANDLER(fk1_ppi_2_a_w), | |
| 119 | DEVCB_HANDLER(fk1_ppi_2_a_w), | |
| 120 | 120 | DEVCB_NULL, |
| 121 | 121 | DEVCB_HANDLER(fk1_ppi_2_c_w) |
| 122 | 122 | }; |
| r5932 | r5933 | |
| 125 | 125 | /* |
| 126 | 126 | |
| 127 | 127 | Port A: |
| 128 | 6 - / disk, authorization disk operations, | |
| 129 | 3 - INTE MOUSE, permit suspension from mouse, | |
| 130 | 2 - INTE RTC from the system clock of 50 Hz, | |
| 131 | 1 and 0 - to set the type for hours write to the disk (01 index, 11 address mark, mark the date, 00 other). | |
| 128 | 6 - / disk, authorization disk operations, | |
| 129 | 3 - INTE MOUSE, permit suspension from mouse, | |
| 130 | 2 - INTE RTC from the system clock of 50 Hz, | |
| 131 | 1 and 0 - to set the type for hours write to the disk (01 index, 11 address mark, mark the date, 00 other). | |
| 132 | 132 | |
| 133 | 133 | Port B: |
| 134 | Video ROL register | |
| 135 | Port C | |
| 134 | Video ROL register | |
| 135 | Port C | |
| 136 | 136 | |
| 137 | READING: | |
| 138 | 7 - INDEX ( index mark on the disk) | |
| 139 | 6 - I do not know, | |
| 140 | 5 - WRITE_PROTECT the protected disk, | |
| 141 | 4 - TRAC_00 as a sign of trace | |
| 142 | ||
| 143 | WRITING: | |
| 144 | 3 - HEAD LOAD | |
| 145 | 2 - TRACK_43 | |
| 146 | 1 - DIRC - direction to set the direction of stepping disk | |
| 147 | 0 - STEP, move disk (0 1 .. 0.). | |
| 137 | READING: | |
| 138 | 7 - INDEX ( index mark on the disk) | |
| 139 | 6 - I do not know, | |
| 140 | 5 - WRITE_PROTECT the protected disk, | |
| 141 | 4 - TRAC_00 as a sign of trace | |
| 148 | 142 | |
| 143 | WRITING: | |
| 144 | 3 - HEAD LOAD | |
| 145 | 2 - TRACK_43 | |
| 146 | 1 - DIRC - direction to set the direction of stepping disk | |
| 147 | 0 - STEP, move disk (0 1 .. 0.). | |
| 148 | ||
| 149 | 149 | */ |
| 150 | 150 | static WRITE8_DEVICE_HANDLER (fk1_ppi_3_a_w ) |
| 151 | 151 | { |
| 152 | // | |
| 152 | // logerror("fk1_ppi_3_a_w %02x\n",data); | |
| 153 | 153 | } |
| 154 | 154 | static WRITE8_DEVICE_HANDLER (fk1_ppi_3_b_w ) |
| 155 | 155 | { |
| r5932 | r5933 | |
| 157 | 157 | } |
| 158 | 158 | static WRITE8_DEVICE_HANDLER (fk1_ppi_3_c_w ) |
| 159 | 159 | { |
| 160 | // | |
| 160 | // logerror("fk1_ppi_3_c_w %02x\n",data); | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | static READ8_DEVICE_HANDLER (fk1_ppi_3_a_r ) |
| 164 | 164 | { |
| 165 | // | |
| 165 | // logerror("fk1_ppi_3_a_r\n"); | |
| 166 | 166 | return 0; |
| 167 | 167 | } |
| 168 | 168 | static READ8_DEVICE_HANDLER (fk1_ppi_3_b_r ) |
| r5932 | r5933 | |
| 171 | 171 | } |
| 172 | 172 | static READ8_DEVICE_HANDLER (fk1_ppi_3_c_r ) |
| 173 | 173 | { |
| 174 | // | |
| 174 | // logerror("fk1_ppi_3_c_r\n"); | |
| 175 | 175 | return 0; |
| 176 | 176 | } |
| 177 | 177 | I8255A_INTERFACE( fk1_ppi8255_interface_3 ) |
| r5932 | r5933 | |
| 179 | 179 | DEVCB_HANDLER(fk1_ppi_3_a_r), |
| 180 | 180 | DEVCB_HANDLER(fk1_ppi_3_b_r), |
| 181 | 181 | DEVCB_HANDLER(fk1_ppi_3_c_r), |
| 182 | DEVCB_HANDLER(fk1_ppi_3_a_w), | |
| 182 | DEVCB_HANDLER(fk1_ppi_3_a_w), | |
| 183 | 183 | DEVCB_HANDLER(fk1_ppi_3_b_w), |
| 184 | 184 | DEVCB_HANDLER(fk1_ppi_3_c_w) |
| 185 | 185 | }; |
| r5932 | r5933 | |
| 192 | 192 | |
| 193 | 193 | static PIT8253_OUTPUT_CHANGED(fk1_pit_out1) |
| 194 | 194 | { |
| 195 | // Timeout for disk operation | |
| 195 | // Timeout for disk operation | |
| 196 | 196 | logerror("PIT8253_OUTPUT_CHANGED(fk1_pit_out1)\n"); |
| 197 | 197 | } |
| 198 | 198 | |
| r5932 | r5933 | |
| 222 | 222 | }; |
| 223 | 223 | |
| 224 | 224 | /* |
| 225 | 0 no interrupt allowed, | |
| 226 | 1 allowed INTR-7, | |
| 227 | 2 allowed INTR-7 and INTR-6, | |
| 228 | 8 any interruption allowed. | |
| 225 | 0 no interrupt allowed, | |
| 226 | 1 allowed INTR-7, | |
| 227 | 2 allowed INTR-7 and INTR-6, | |
| 228 | 8 any interruption allowed. | |
| 229 | 229 | */ |
| 230 | 230 | |
| 231 | 231 | WRITE8_HANDLER( fk1_intr_w ) |
| r5932 | r5933 | |
| 237 | 237 | { |
| 238 | 238 | const address_space *space_mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 239 | 239 | memory_install_write8_handler(space_mem, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| 240 | memory_set_bankptr(space->machine, 1, mess_ram); | |
| 241 | memory_set_bankptr(space->machine, 2, mess_ram + 0x4000); | |
| 240 | memory_set_bankptr(space->machine, 1, mess_ram); | |
| 241 | memory_set_bankptr(space->machine, 2, mess_ram + 0x4000); | |
| 242 | 242 | return 0; |
| 243 | 243 | } |
| 244 | 244 | |
| r5932 | r5933 | |
| 246 | 246 | { |
| 247 | 247 | const address_space *space_mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 248 | 248 | memory_install_write8_handler(space_mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 249 | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu")); | |
| 250 | memory_set_bankptr(space->machine, 2, mess_ram + 0x10000); | |
| 249 | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu")); | |
| 250 | memory_set_bankptr(space->machine, 2, mess_ram + 0x10000); | |
| 251 | 251 | return 0; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /* |
| 255 | 4 - FORMAT authorization | |
| 256 | 3 - READ_ADDRESS_MARK | |
| 257 | 2 - READ_DATA_MARK | |
| 258 | 1 - WRITE | |
| 259 | 0 - READ | |
| 260 | Functions are allowed in one. | |
| 255 | 4 - FORMAT authorization | |
| 256 | 3 - READ_ADDRESS_MARK | |
| 257 | 2 - READ_DATA_MARK | |
| 258 | 1 - WRITE | |
| 259 | 0 - READ | |
| 260 | Functions are allowed in one. | |
| 261 | 261 | */ |
| 262 | 262 | WRITE8_HANDLER( fk1_disk_w ) |
| 263 | 263 | { |
| 264 | // | |
| 264 | // logerror("fk1_disk_w %02x\n",data); | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /* |
| 268 | 7 and 6 - 1 to connected mouse and 0 if not connected, | |
| 268 | 7 and 6 - 1 to connected mouse and 0 if not connected, | |
| 269 | 269 | 5 - / T2, right-click |
| 270 | 270 | 4 - / T1, left-click |
| 271 | 3 - / BY, Y-axis | |
| 272 | 2 - / AY, Y-axis | |
| 273 | 1 - / BX, X-axis | |
| 271 | 3 - / BY, Y-axis | |
| 272 | 2 - / AY, Y-axis | |
| 273 | 1 - / BX, X-axis | |
| 274 | 274 | 0 - / AX, X-axis |
| 275 | 275 | */ |
| 276 | 276 | READ8_HANDLER( fk1_mouse_r ) |
| 277 | 277 | { |
| 278 | // | |
| 278 | // logerror("fk1_mouse_r\n"); | |
| 279 | 279 | return 0; |
| 280 | 280 | } |
| 281 | 281 | |
| r5932 | r5933 | |
| 283 | 283 | |
| 284 | 284 | WRITE8_HANDLER( fk1_reset_int_w ) |
| 285 | 285 | { |
| 286 | logerror("fk1_reset_int_w\n"); | |
| 286 | logerror("fk1_reset_int_w\n"); | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | static ADDRESS_MAP_START(fk1_mem, ADDRESS_SPACE_PROGRAM, 8) |
| r5932 | r5933 | |
| 324 | 324 | |
| 325 | 325 | static TIMER_CALLBACK(keyboard_callback) |
| 326 | 326 | { |
| 327 | if (input_port_read(machine, "LINE0")) { | |
| 328 | int_vector = 6; | |
| 327 | if (input_port_read(machine, "LINE0")) { | |
| 328 | int_vector = 6; | |
| 329 | 329 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /* |
| 334 | 7 – DATA_READY | |
| 335 | 6 – TIMEOUT | |
| 336 | 5 – OVERFLOW | |
| 337 | 4 – RTC_50HZ | |
| 338 | 3 – MOUSE | |
| 339 | 2 – SIO | |
| 340 | 1 – KEYBOARD | |
| 341 | 0 – PRINTER | |
| 334 | 7 ? DATA_READY | |
| 335 | 6 ? TIMEOUT | |
| 336 | 5 ? OVERFLOW | |
| 337 | 4 ? RTC_50HZ | |
| 338 | 3 ? MOUSE | |
| 339 | 2 ? SIO | |
| 340 | 1 ? KEYBOARD | |
| 341 | 0 ? PRINTER | |
| 342 | 342 | */ |
| 343 | 343 | |
| 344 | 344 | static IRQ_CALLBACK (fk1_irq_callback) |
| 345 | { | |
| 345 | { | |
| 346 | 346 | logerror("IRQ %02x\n",int_vector*2); |
| 347 | 347 | return int_vector * 2; |
| 348 | 348 | } |
| r5932 | r5933 | |
| 362 | 362 | memory_set_bankptr(machine, 2, mess_ram + 0x10000); // VRAM |
| 363 | 363 | memory_set_bankptr(machine, 3, mess_ram + 0x8000); |
| 364 | 364 | memory_set_bankptr(machine, 4, mess_ram + 0xc000); |
| 365 | ||
| 365 | ||
| 366 | 366 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), fk1_irq_callback); |
| 367 | 367 | timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback); |
| 368 | 368 | timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, vsync_callback); |
| r5932 | r5933 | |
| 411 | 411 | |
| 412 | 412 | MDRV_VIDEO_START(fk1) |
| 413 | 413 | MDRV_VIDEO_UPDATE(fk1) |
| 414 | ||
| 414 | ||
| 415 | 415 | MDRV_PIT8253_ADD( "pit8253", fk1_pit8253_intf ) |
| 416 | 416 | MDRV_I8255A_ADD( "ppi8255_1", fk1_ppi8255_interface_1 ) |
| 417 | MDRV_I8255A_ADD( "ppi8255_2", fk1_ppi8255_interface_2 ) | |
| 418 | MDRV_I8255A_ADD( "ppi8255_3", fk1_ppi8255_interface_3 ) | |
| 417 | MDRV_I8255A_ADD( "ppi8255_2", fk1_ppi8255_interface_2 ) | |
| 418 | MDRV_I8255A_ADD( "ppi8255_3", fk1_ppi8255_interface_3 ) | |
| 419 | 419 | /* uart */ |
| 420 | MDRV_MSM8251_ADD("uart", default_msm8251_interface) | |
| 420 | MDRV_MSM8251_ADD("uart", default_msm8251_interface) | |
| 421 | 421 | MACHINE_DRIVER_END |
| 422 | 422 | |
| 423 | 423 | static SYSTEM_CONFIG_START(fk1) |
| r5932 | r5933 | |
| 428 | 428 | ROM_START( fk1 ) |
| 429 | 429 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 430 | 430 | ROM_SYSTEM_BIOS( 0, "orig", "Original BIOS" ) |
| 431 | ROMX_LOAD( "fk1.u65", 0x0000, 0x0800, CRC(145561f8) SHA1(a4eb17d773e51b34620c508b6cebcb4531ae99c2), ROM_BIOS(1)) | |
| 431 | ROMX_LOAD( "fk1.u65", 0x0000, 0x0800, CRC(145561f8) SHA1(a4eb17d773e51b34620c508b6cebcb4531ae99c2), ROM_BIOS(1)) | |
| 432 | 432 | ROM_SYSTEM_BIOS( 1, "diag", "Diag BIOS" ) |
| 433 | ROMX_LOAD( "fk1-diag.u65", 0x0000, 0x0800, CRC(e0660ae1) SHA1(6ad609049b28f27126af0a8a6224362351073dee), ROM_BIOS(2)) | |
| 433 | ROMX_LOAD( "fk1-diag.u65", 0x0000, 0x0800, CRC(e0660ae1) SHA1(6ad609049b28f27126af0a8a6224362351073dee), ROM_BIOS(2)) | |
| 434 | 434 | ROM_END |
| 435 | 435 | |
| 436 | 436 | /* Driver */ |
| r5932 | r5933 | |
|---|---|---|
| 160 | 160 | |
| 161 | 161 | static const z80_daisy_chain osborne1_daisy_chain[] = |
| 162 | 162 | { |
| 163 | /* | |
| 163 | /* { osborne1_z80_reset, osborne1_z80_irq_state, osborne1_z80_irq_ack, osborne1_z80_irq_reti, 0 }, */ | |
| 164 | 164 | { "osborne1_daisy" }, |
| 165 | 165 | { NULL } |
| 166 | 166 | }; |
| r5932 | r5933 | |
| 180 | 180 | TRACKS([40]) |
| 181 | 181 | SECTORS([10]) |
| 182 | 182 | SECTOR_LENGTH([256]) |
| 183 | FIRST_SECTOR_ID([1])) | |
| 183 | FIRST_SECTOR_ID([1])) | |
| 184 | 184 | FLOPPY_OPTION( odd, "img", "Osborne double density", basicdsk_identify_default, basicdsk_construct_default, |
| 185 | 185 | HEADS([1]) |
| 186 | 186 | TRACKS([40]) |
| r5932 | r5933 | |
| 192 | 192 | TRACKS([40]) |
| 193 | 193 | SECTORS([8]) |
| 194 | 194 | SECTOR_LENGTH([512]) |
| 195 | FIRST_SECTOR_ID([1])) | |
| 195 | FIRST_SECTOR_ID([1])) | |
| 196 | 196 | FLOPPY_OPTION( xerox, "img", "Xerox 820 Computer", basicdsk_identify_default, basicdsk_construct_default, |
| 197 | 197 | HEADS([1]) |
| 198 | 198 | TRACKS([40]) |
| 199 | 199 | SECTORS([18]) |
| 200 | 200 | SECTOR_LENGTH([128]) |
| 201 | FIRST_SECTOR_ID([1])) | |
| 201 | FIRST_SECTOR_ID([1])) | |
| 202 | 202 | FLOPPY_OPTION( dec, "img", "DEC 1820 double density", basicdsk_identify_default, basicdsk_construct_default, |
| 203 | 203 | HEADS([1]) |
| 204 | 204 | TRACKS([40]) |
| 205 | 205 | SECTORS([9]) |
| 206 | 206 | SECTOR_LENGTH([512]) |
| 207 | FIRST_SECTOR_ID([1])) | |
| 207 | FIRST_SECTOR_ID([1])) | |
| 208 | 208 | FLOPPY_OPTIONS_END |
| 209 | 209 | |
| 210 | 210 | static const floppy_config osborne1_floppy_config = |
| r5932 | r5933 | |
| 235 | 235 | MDRV_SPEAKER_STANDARD_MONO( "mono" ) |
| 236 | 236 | MDRV_SOUND_ADD( "beep", BEEP, 0 ) |
| 237 | 237 | MDRV_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) |
| 238 | ||
| 238 | ||
| 239 | 239 | MDRV_PIA6821_ADD( "pia_0", osborne1_ieee_pia_config ) |
| 240 | 240 | MDRV_PIA6821_ADD( "pia_1", osborne1_video_pia_config ) |
| 241 | 241 | |
| 242 | 242 | MDRV_MB8877_ADD("mb8877", default_wd17xx_interface_2_drives ) |
| 243 | ||
| 244 | MDRV_FLOPPY_2_DRIVES_ADD(osborne1_floppy_config) | |
| 243 | ||
| 244 | MDRV_FLOPPY_2_DRIVES_ADD(osborne1_floppy_config) | |
| 245 | 245 | MACHINE_DRIVER_END |
| 246 | 246 | |
| 247 | 247 |
| r5932 | r5933 | |
|---|---|---|
| 282 | 282 | PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload") |
| 283 | 283 | PORT_CONFSETTING( 0x00, DEF_STR(No)) |
| 284 | 284 | PORT_CONFSETTING( 0x01, DEF_STR(Yes)) |
| 285 | // PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") | |
| 286 | // PORT_CONFSETTING( 0x08, DEF_STR(On)) | |
| 287 | // PORT_CONFSETTING( 0x00, DEF_STR(Off)) | |
| 285 | // PORT_CONFNAME( 0x08, 0x08, "Cassette Speaker") | |
| 286 | // PORT_CONFSETTING( 0x08, DEF_STR(On)) | |
| 287 | // PORT_CONFSETTING( 0x00, DEF_STR(Off)) | |
| 288 | 288 | INPUT_PORTS_END |
| 289 | 289 | |
| 290 | 290 | |
| r5932 | r5933 | |
| 475 | 475 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 476 | 476 | |
| 477 | 477 | /* A Microsoft Basic program needs some manipulation before it can be run. |
| 478 | 1. A start address of 7ae9 indicates a basic program which needs its pointers fixed up. | |
| 479 | 2. If autorun is turned off, the pointers still need fixing, but then display READY. | |
| 480 | Important addresses: | |
| 481 | 7ae9 = start (load) address of a conventional basic program | |
| 482 | 791e = custom routine to fix basic pointers */ | |
| 478 | 1. A start address of 7ae9 indicates a basic program which needs its pointers fixed up. | |
| 479 | 2. If autorun is turned off, the pointers still need fixing, but then display READY. | |
| 480 | Important addresses: | |
| 481 | 7ae9 = start (load) address of a conventional basic program | |
| 482 | 791e = custom routine to fix basic pointers */ | |
| 483 | 483 | |
| 484 | 484 | memory_write_word_16le(space, 0x791c, end_address + 1); |
| 485 | 485 | memory_write_word_16le(space, 0x781e, execute_address); |
| r5932 | r5933 | |
| 487 | 487 | if (start_address == 0x7ae9) |
| 488 | 488 | { |
| 489 | 489 | UINT8 i, data[]={ |
| 490 | 0xe5, // PUSH HL ;save pcode pointer | |
| 491 | 0x2a, 0x1c, 0x79, // LD HL,(791C) ;get saved end_addr+1 | |
| 492 | 0x22, 0xf9, 0x78, // LD (78F9),HL ;move it to correct place | |
| 493 | 0x21, 0x39, 0x78, // LD HL,7839 ;point to control flag | |
| 494 | 0xcb, 0xf6, // SET 6,(HL) ;turn on autorun (cb b6 = manual run) | |
| 495 | 0xcb, 0x9e, // RES 3,(HL) ;turn off verify (just in case) | |
| 496 | 0xc3, 0xcf, 0x36,}; // JP 36CF ;enter bios at autorun point | |
| 490 | 0xe5, // PUSH HL ;save pcode pointer | |
| 491 | 0x2a, 0x1c, 0x79, // LD HL,(791C) ;get saved end_addr+1 | |
| 492 | 0x22, 0xf9, 0x78, // LD (78F9),HL ;move it to correct place | |
| 493 | 0x21, 0x39, 0x78, // LD HL,7839 ;point to control flag | |
| 494 | 0xcb, 0xf6, // SET 6,(HL) ;turn on autorun (cb b6 = manual run) | |
| 495 | 0xcb, 0x9e, // RES 3,(HL) ;turn off verify (just in case) | |
| 496 | 0xc3, 0xcf, 0x36,}; // JP 36CF ;enter bios at autorun point | |
| 497 | 497 | |
| 498 | 498 | for (i = 0; i < ARRAY_LENGTH(data); i++) |
| 499 | 499 | memory_write_byte(space, 0x791e + i, data[i]); |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | 05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | The Lynx was an 8-bit British home computer that was first released | |
| 8 | in early 1983 as a 48 kB model. | |
| 9 | The designer of the Lynx was John Shireff and several models were | |
| 10 | available with 48 kB, 96 kB (from Sep 1983) or 128 kB RAM (from Dec | |
| 7 | The Lynx was an 8-bit British home computer that was first released | |
| 8 | in early 1983 as a 48 kB model. | |
| 9 | The designer of the Lynx was John Shireff and several models were | |
| 10 | available with 48 kB, 96 kB (from Sep 1983) or 128 kB RAM (from Dec | |
| 11 | 11 | 1983). It was possible reach 192 kB with RAM expansions on-board. |
| 12 | 12 | |
| 13 | The machine was based around a Z80A CPU clocked at 4 MHz, and featured | |
| 14 | a Motorola 6845 as video controller. It was possible to run CP/M with | |
| 13 | The machine was based around a Z80A CPU clocked at 4 MHz, and featured | |
| 14 | a Motorola 6845 as video controller. It was possible to run CP/M with | |
| 15 | 15 | the optional 5.25" floppy disk-drive on the 96 kB and 128 kB models. |
| 16 | 16 | Approximately 30,000 Lynx units were sold world-wide. |
| 17 | 17 | |
| 18 | Camputers ceased trading in June 1984. Anston Technology took over in | |
| 19 | November the same year and a re-launch was planned but never happened. | |
| 18 | Camputers ceased trading in June 1984. Anston Technology took over in | |
| 19 | November the same year and a re-launch was planned but never happened. | |
| 20 | 20 | |
| 21 | In June 1986, Anston sold everything - hardware, design rights and | |
| 22 | thousands of cassettes - to the National Lynx User Group. The group | |
| 23 | planned to produce a Super-Lynx but was too busy supplying spares and | |
| 24 | technical information to owners of existing models, and the project never | |
| 21 | In June 1986, Anston sold everything - hardware, design rights and | |
| 22 | thousands of cassettes - to the National Lynx User Group. The group | |
| 23 | planned to produce a Super-Lynx but was too busy supplying spares and | |
| 24 | technical information to owners of existing models, and the project never | |
| 25 | 25 | came into being. |
| 26 | 26 | |
| 27 | 27 | Hardware info: |
| r5932 | r5933 | |
| 42 | 42 | Bank 0 | BASIC ROM | Not Available | Ext | Ext |
| 43 | 43 | | | | ROM1 | ROM2 |
| 44 | 44 | ------------------------------------------------------------------------- |
| 45 | | | | |
| 45 | | | | |
| 46 | 46 | Bank 1 | STORE | Workspace RAM |
| 47 | | | | |
| 47 | | | | |
| 48 | 48 | ------------------------------------------------------------------------- |
| 49 | 49 | | | | | |
| 50 | 50 | Bank 2 | RED | BLUE | GREEN | Alt |
| 51 | 51 | | | | | Green |
| 52 | 52 | ------------------------------------------------------------------------- |
| 53 | | | |
| 53 | | | |
| 54 | 54 | Bank 3 | Available for Video Expansion |
| 55 | | | |
| 55 | | | |
| 56 | 56 | ------------------------------------------------------------------------- |
| 57 | | | |
| 57 | | | |
| 58 | 58 | Bank 4 | Available for User RAM Expansion |
| 59 | | | |
| 59 | | | |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | ||
| 63 | 48k and 96k are basically the same machine. 128k is different. | |
| 64 | 64 | |
| 65 | ||
| 65 | The work so far is without the benefit of manuals, schematic etc [Robbbert] | |
| 66 | 66 | |
| 67 | 48k, 96k: | |
| 68 | Cassette operation is strange indeed. Save takes the dac output and directs | |
| 69 | it to the tape. Load takes over line 0 of the keyboard and uses bits 0 and 5. | |
| 67 | 48k, 96k: | |
| 68 | Cassette operation is strange indeed. Save takes the dac output and directs | |
| 69 | it to the tape. Load takes over line 0 of the keyboard and uses bits 0 and 5. | |
| 70 | 70 | |
| 71 | To Do: | |
| 72 | - find Break key | |
| 73 | - banking (it is incomplete atm) | |
| 74 | - devices (cassette, disk, printer, joysticks) | |
| 75 | - find out the mc6845 clock frequency | |
| 71 | To Do: | |
| 72 | - find Break key | |
| 73 | - banking (it is incomplete atm) | |
| 74 | - devices (cassette, disk, printer, joysticks) | |
| 75 | - find out the mc6845 clock frequency | |
| 76 | 76 | |
| 77 | 77 | ****************************************************************************/ |
| 78 | 78 | |
| r5932 | r5933 | |
| 84 | 84 | static const device_config *mc6845; |
| 85 | 85 | |
| 86 | 86 | /* These bankswitch handlers are very incomplete, just enough to get the |
| 87 | computer working. Also, as it happens 6 times for every scanline | |
| 88 | of every character, it causes a huge slowdown. */ | |
| 87 | computer working. Also, as it happens 6 times for every scanline | |
| 88 | of every character, it causes a huge slowdown. */ | |
| 89 | 89 | |
| 90 | 90 | static WRITE8_HANDLER( lynx48k_bank_w ) |
| 91 | 91 | { |
| r5932 | r5933 | |
| 196 | 196 | |
| 197 | 197 | static ADDRESS_MAP_START( lynx128k_io , ADDRESS_SPACE_IO, 8) |
| 198 | 198 | ADDRESS_MAP_UNMAP_HIGH |
| 199 | // AM_RANGE(0x0050,0x0053) AM_MIRROR(0xff80) AM_READ(wd179x_r) // uses a 1793 | |
| 200 | // AM_RANGE(0x0054,0x0057) AM_MIRROR(0xff80) AM_WRITE(wd179x_w) | |
| 201 | // AM_RANGE(0x0058,0x0058) AM_MIRROR(0xff80) AM_WRITE(lynx128k_disk_w) | |
| 202 | // AM_RANGE(0x007a,0x007b) AM_MIRROR(0xff80) AM_READ(lynx128k_joysticks_r) | |
| 203 | // AM_RANGE(0x007c,0x007c) AM_MIRROR(0xff80) AM_READ(lynx128k_printer_r) | |
| 204 | // AM_RANGE(0x007d,0x007d) AM_MIRROR(0xff80) AM_WRITE(lynx128k_printer_init_w) // this is rw | |
| 205 | // AM_RANGE(0x007e,0x007e) AM_MIRROR(0xff80) AM_WRITE(lynx128k_printer_w) | |
| 199 | // AM_RANGE(0x0050,0x0053) AM_MIRROR(0xff80) AM_READ(wd179x_r) // uses a 1793 | |
| 200 | // AM_RANGE(0x0054,0x0057) AM_MIRROR(0xff80) AM_WRITE(wd179x_w) | |
| 201 | // AM_RANGE(0x0058,0x0058) AM_MIRROR(0xff80) AM_WRITE(lynx128k_disk_w) | |
| 202 | // AM_RANGE(0x007a,0x007b) AM_MIRROR(0xff80) AM_READ(lynx128k_joysticks_r) | |
| 203 | // AM_RANGE(0x007c,0x007c) AM_MIRROR(0xff80) AM_READ(lynx128k_printer_r) | |
| 204 | // AM_RANGE(0x007d,0x007d) AM_MIRROR(0xff80) AM_WRITE(lynx128k_printer_init_w) // this is rw | |
| 205 | // AM_RANGE(0x007e,0x007e) AM_MIRROR(0xff80) AM_WRITE(lynx128k_printer_w) | |
| 206 | 206 | AM_RANGE(0x0080,0x0080) AM_MIRROR(0xff00) AM_WRITE(SMH_NOP) /* to be emulated */ |
| 207 | 207 | AM_RANGE(0x0080,0x0080) AM_READ_PORT("LINE0") |
| 208 | 208 | AM_RANGE(0x0180,0x0180) AM_READ_PORT("LINE1") |
| r5932 | r5933 | |
| 323 | 323 | |
| 324 | 324 | static const UINT8 lynx48k_palette[8*3] = |
| 325 | 325 | { |
| 326 | 0x00, 0x00, 0x00, /* 0 Black */ | |
| 327 | 0x00, 0x00, 0xff, /* 1 Blue */ | |
| 328 | 0xff, 0x00, 0x00, /* 2 Red */ | |
| 329 | 0xff, 0x00, 0xff, /* 3 Magenta */ | |
| 330 | 0x00, 0xff, 0x00, /* 4 Green */ | |
| 331 | 0x00, 0xff, 0xff, /* 5 Cyan */ | |
| 332 | 0xff, 0xff, 0x00, /* 6 Yellow */ | |
| 333 | 0xff, 0xff, 0xff, /* 7 White */ | |
| 326 | 0x00, 0x00, 0x00, /* 0 Black */ | |
| 327 | 0x00, 0x00, 0xff, /* 1 Blue */ | |
| 328 | 0xff, 0x00, 0x00, /* 2 Red */ | |
| 329 | 0xff, 0x00, 0xff, /* 3 Magenta */ | |
| 330 | 0x00, 0xff, 0x00, /* 4 Green */ | |
| 331 | 0x00, 0xff, 0xff, /* 5 Cyan */ | |
| 332 | 0xff, 0xff, 0x00, /* 6 Yellow */ | |
| 333 | 0xff, 0xff, 0xff, /* 7 White */ | |
| 334 | 334 | }; |
| 335 | 335 | |
| 336 | 336 | static PALETTE_INIT( lynx48k ) |
| r5932 | r5933 | |
|---|---|---|
| 58 | 58 | |
| 59 | 59 | January 2008 - added preliminary Aleste 520EX support |
| 60 | 60 | The Aleste 520EX is a Russian clone of the CPC6128, that expands on existing video mode, and can run MSX-DOS. |
| 61 | It also adds an MC146818 RTC/NVRAM, an Intel 8253 timer, and the "Magic Sound" board, a 4-channel DMA-based | |
| 62 | sample player. Also includes a software emulation of the MSX2 VDP, used in the ports of MSX games. | |
| 61 | It also adds an MC146818 RTC/NVRAM, an Intel 8253 timer, and the "Magic Sound" board, a 4-channel DMA-based | |
| 62 | sample player. Also includes a software emulation of the MSX2 VDP, used in the ports of MSX games. | |
| 63 | 63 | |
| 64 | Known issues: | |
| 65 | - The RTC doesn't always update in setup. It expects bit 4 of register C (Update End Interrupt) to be high. | |
| 66 | - Title screens appear then disappear quickly (probably because the 8253 hasn't been plugged in yet). | |
| 67 | - Some video modes display wrong (still needs some work here). | |
| 68 | - Vampire Killer crashes after collecting a certain key part way through stage 1. | |
| 69 | - Magic Sound isn't emulated. | |
| 64 | Known issues: | |
| 65 | - The RTC doesn't always update in setup. It expects bit 4 of register C (Update End Interrupt) to be high. | |
| 66 | - Title screens appear then disappear quickly (probably because the 8253 hasn't been plugged in yet). | |
| 67 | - Some video modes display wrong (still needs some work here). | |
| 68 | - Vampire Killer crashes after collecting a certain key part way through stage 1. | |
| 69 | - Magic Sound isn't emulated. | |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | January 2009 - changed drivers to use the mc6845 device implementation |
| 73 | To get rid of duplicated code the drivers have been changed to use the new mc6845 device | |
| 74 | implementation. As a result the (runtime) selection of CRTC type has been removed. | |
| 73 | To get rid of duplicated code the drivers have been changed to use the new mc6845 device | |
| 74 | implementation. As a result the (runtime) selection of CRTC type has been removed. | |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | Some bugs left : |
| r5932 | r5933 | |
| 79 | 79 | - CRTC all type support (0,1,2,3,4) ? |
| 80 | 80 | - 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)! |
| 81 | 81 | - Implement full Asic for CPC+ emulation. Soft scroll is rather dodgy. |
| 82 | ||
| 82 | - The KC Compact should not reuse the gate array functionality. Instead z8536 support should be added. (bug #42) | |
| 83 | 83 | |
| 84 | 84 | ******************************************************************************/ |
| 85 | 85 | |
| r5932 | r5933 | |
| 374 | 374 | Pre-ASIC??? Amstrad? 4 In the "cost-down" CPC6128, the CRTC functionality is integrated into a single ASIC IC. This ASIC is often refered to as the "Pre-ASIC" because it preceeded the CPC+ ASIC |
| 375 | 375 | As far as I know, the KC compact used HD6845S only. |
| 376 | 376 | */ |
| 377 | // PORT_START("crtc") | |
| 378 | // PORT_CONFNAME( 0xFF, M6845_PERSONALITY_UM6845R, "CRTC Type") | |
| 379 | // PORT_CONFSETTING(M6845_PERSONALITY_UM6845, "Type 0 - UM6845") | |
| 380 | // PORT_CONFSETTING(M6845_PERSONALITY_HD6845S, "Type 0 - HD6845S") | |
| 381 | // PORT_CONFSETTING(M6845_PERSONALITY_UM6845R, "Type 1 - UM6845R") | |
| 382 | // PORT_CONFSETTING(M6845_PERSONALITY_GENUINE, "Type 2 - MC6845") | |
| 383 | // PORT_CONFSETTING(M6845_PERSONALITY_AMS40489, "Type 3 - AMS40489") | |
| 384 | // PORT_CONFSETTING(M6845_PERSONALITY_PREASIC, "Type 4 - Pre-ASIC") | |
| 377 | // PORT_START("crtc") | |
| 378 | // PORT_CONFNAME( 0xFF, M6845_PERSONALITY_UM6845R, "CRTC Type") | |
| 379 | // PORT_CONFSETTING(M6845_PERSONALITY_UM6845, "Type 0 - UM6845") | |
| 380 | // PORT_CONFSETTING(M6845_PERSONALITY_HD6845S, "Type 0 - HD6845S") | |
| 381 | // PORT_CONFSETTING(M6845_PERSONALITY_UM6845R, "Type 1 - UM6845R") | |
| 382 | // PORT_CONFSETTING(M6845_PERSONALITY_GENUINE, "Type 2 - MC6845") | |
| 383 | // PORT_CONFSETTING(M6845_PERSONALITY_AMS40489, "Type 3 - AMS40489") | |
| 384 | // PORT_CONFSETTING(M6845_PERSONALITY_PREASIC, "Type 4 - Pre-ASIC") | |
| 385 | 385 | |
| 386 | 386 | PORT_START("multiface") |
| 387 | 387 | PORT_CONFNAME(0x01, 0x00, "Multiface Two" ) |
| r5932 | r5933 | |
| 901 | 901 | MDRV_CASSETTE_ADD( "cassette", amstrad_cassette_config ) |
| 902 | 902 | |
| 903 | 903 | MDRV_NEC765A_ADD("nec765", amstrad_nec765_interface) |
| 904 | ||
| 904 | ||
| 905 | 905 | MDRV_FLOPPY_2_DRIVES_ADD(cpc6128_floppy_config) |
| 906 | 906 | MACHINE_DRIVER_END |
| 907 | 907 | |
| r5932 | r5933 | |
| 961 | 961 | MDRV_NEC765A_ADD("nec765", amstrad_nec765_interface) |
| 962 | 962 | |
| 963 | 963 | MDRV_IMPORT_FROM(cpcplus_cartslot) |
| 964 | ||
| 964 | ||
| 965 | 965 | MDRV_FLOPPY_2_DRIVES_ADD(cpc6128_floppy_config) |
| 966 | 966 | MACHINE_DRIVER_END |
| 967 | 967 | |
| r5932 | r5933 | |
| 1015 | 1015 | MDRV_PALETTE_INIT(aleste) |
| 1016 | 1016 | MDRV_NVRAM_HANDLER(mc146818) |
| 1017 | 1017 | MDRV_NEC765A_MODIFY("nec765", aleste_8272_interface) |
| 1018 | ||
| 1018 | ||
| 1019 | 1019 | MDRV_FLOPPY_2_DRIVES_MODIFY(aleste_floppy_config) |
| 1020 | 1020 | MACHINE_DRIVER_END |
| 1021 | 1021 |
| r5932 | r5933 | |
|---|---|---|
| 20 | 20 | MESS cartridge support by R. Belmont based on work by Michael Zapf |
| 21 | 21 | |
| 22 | 22 | Current status: |
| 23 | | |
| 23 | - Cartridges run. | |
| 24 | 24 | |
| 25 | ToDo : | |
| 25 | ToDo : | |
| 26 | 26 | - Change input code to allow selection of the mahjong panel in PORT_CATEGORY. |
| 27 | 27 | - Clean up code, to reduce duplication of MAME source |
| 28 | 28 | |
| r5932 | r5933 | |
| 310 | 310 | switch (offset) |
| 311 | 311 | { |
| 312 | 312 | case 0x00: select_controller(data & 0x00ff); break; |
| 313 | // case 0x18: set_output_latch(space->machine, data & 0x00ff); break; | |
| 314 | // case 0x20: set_output_data(data & 0x00ff); break; | |
| 313 | // case 0x18: set_output_latch(space->machine, data & 0x00ff); break; | |
| 314 | // case 0x20: set_output_data(data & 0x00ff); break; | |
| 315 | 315 | case 0x28: upd4990a_control_16_w(upd4990a, 0, data, mem_mask); break; |
| 316 | 316 | // case 0x30: break; // coin counters |
| 317 | 317 | // case 0x31: break; // coin counters |
| r5932 | r5933 | |
| 382 | 382 | |
| 383 | 383 | static void calendar_clock(void) |
| 384 | 384 | { |
| 385 | // | |
| 385 | // pd4990a_addretrace(); | |
| 386 | 386 | } |
| 387 | 387 | #endif |
| 388 | 388 | |
| r5932 | r5933 | |
| 807 | 807 | create_interrupt_timers(machine); |
| 808 | 808 | |
| 809 | 809 | /* initialize the celander IC to 'right now' */ |
| 810 | // | |
| 810 | // calendar_init(machine); | |
| 811 | 811 | |
| 812 | 812 | /* initialize the memcard data structure */ |
| 813 | 813 | memcard_data = auto_alloc_array_clear(machine, UINT8, MEMCARD_SIZE); |
| r5932 | r5933 | |
| 1137 | 1137 | |
| 1138 | 1138 | static INPUT_PORTS_START( aes ) |
| 1139 | 1139 | // was there anyting in place of dipswitch in the home console? |
| 1140 | /* PORT_START("IN0") | |
| 1141 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1142 | // PORT_DIPNAME( 0x0001, 0x0001, "Test Switch" ) PORT_DIPLOCATION("SW:1") | |
| 1143 | // PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 1144 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1145 | // PORT_DIPNAME( 0x0002, 0x0002, "Coin Chutes?" ) PORT_DIPLOCATION("SW:2") | |
| 1146 | // PORT_DIPSETTING( 0x0000, "1?" ) | |
| 1147 | // PORT_DIPSETTING( 0x0002, "2?" ) | |
| 1148 | // PORT_DIPNAME( 0x0004, 0x0000, "Mahjong Control Panel (or Auto Fire)" ) PORT_DIPLOCATION("SW:3") | |
| 1149 | // PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 1150 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1151 | // PORT_DIPNAME( 0x0018, 0x0018, "COMM Setting (Cabinet No.)" ) PORT_DIPLOCATION("SW:4,5") | |
| 1152 | // PORT_DIPSETTING( 0x0018, "1" ) | |
| 1153 | // PORT_DIPSETTING( 0x0008, "2" ) | |
| 1154 | // PORT_DIPSETTING( 0x0010, "3" ) | |
| 1155 | // PORT_DIPSETTING( 0x0000, "4" ) | |
| 1156 | // PORT_DIPNAME( 0x0020, 0x0020, "COMM Setting (Link Enable)" ) PORT_DIPLOCATION("SW:6") | |
| 1157 | // PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 1158 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1159 | // PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW:7") | |
| 1160 | // PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1161 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1162 | // PORT_DIPNAME( 0x0080, 0x0080, "Freeze" ) PORT_DIPLOCATION("SW:8") | |
| 1163 | // PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 1164 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1165 | PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(aes_controller_r, NULL) */ | |
| 1140 | /* PORT_START("IN0") | |
| 1141 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 1142 | // PORT_DIPNAME( 0x0001, 0x0001, "Test Switch" ) PORT_DIPLOCATION("SW:1") | |
| 1143 | // PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) | |
| 1144 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1145 | // PORT_DIPNAME( 0x0002, 0x0002, "Coin Chutes?" ) PORT_DIPLOCATION("SW:2") | |
| 1146 | // PORT_DIPSETTING( 0x0000, "1?" ) | |
| 1147 | // PORT_DIPSETTING( 0x0002, "2?" ) | |
| 1148 | // PORT_DIPNAME( 0x0004, 0x0000, "Mahjong Control Panel (or Auto Fire)" ) PORT_DIPLOCATION("SW:3") | |
| 1149 | // PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) | |
| 1150 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1151 | // PORT_DIPNAME( 0x0018, 0x0018, "COMM Setting (Cabinet No.)" ) PORT_DIPLOCATION("SW:4,5") | |
| 1152 | // PORT_DIPSETTING( 0x0018, "1" ) | |
| 1153 | // PORT_DIPSETTING( 0x0008, "2" ) | |
| 1154 | // PORT_DIPSETTING( 0x0010, "3" ) | |
| 1155 | // PORT_DIPSETTING( 0x0000, "4" ) | |
| 1156 | // PORT_DIPNAME( 0x0020, 0x0020, "COMM Setting (Link Enable)" ) PORT_DIPLOCATION("SW:6") | |
| 1157 | // PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) | |
| 1158 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1159 | // PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW:7") | |
| 1160 | // PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) | |
| 1161 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1162 | // PORT_DIPNAME( 0x0080, 0x0080, "Freeze" ) PORT_DIPLOCATION("SW:8") | |
| 1163 | // PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) | |
| 1164 | // PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) | |
| 1165 | PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(aes_controller_r, NULL) */ | |
| 1166 | 1166 | |
| 1167 | 1167 | PORT_START("CTRLSEL") /* Select Controller Type */ |
| 1168 | 1168 | PORT_CATEGORY_CLASS( 0x0f, 0x01, "P1 Controller") |
| r5932 | r5933 | |
| 1241 | 1241 | * |
| 1242 | 1242 | * Driver initalization |
| 1243 | 1243 | * |
| 1244 | ||
| 1244 | ? *************************************/ | |
| 1245 | 1245 | |
| 1246 | 1246 | static DRIVER_INIT( neogeo ) |
| 1247 | 1247 | { |
| r5932 | r5933 | |
| 1296 | 1296 | |
| 1297 | 1297 | ROM_REGION( 0x10000, "ym", ROMREGION_ERASEFF ) |
| 1298 | 1298 | |
| 1299 | // | |
| 1299 | // NO_DELTAT_REGION | |
| 1300 | 1300 | |
| 1301 | 1301 | ROM_REGION( 0x100000, "sprites", ROMREGION_ERASEFF ) |
| 1302 | 1302 | ROM_END |
| r5932 | r5933 | |
| 1320 | 1320 | |
| 1321 | 1321 | ROM_REGION( 0x10000, "ym", ROMREGION_ERASEFF ) |
| 1322 | 1322 | |
| 1323 | // | |
| 1323 | // NO_DELTAT_REGION | |
| 1324 | 1324 | |
| 1325 | 1325 | ROM_REGION( 0x100000, "sprites", ROMREGION_ERASEFF ) |
| 1326 | 1326 | ROM_END |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /****************************************************************************************** |
| 2 | 2 | |
| 3 | Kyocera Kyotronics 85 (and similar laptop computers) | |
| 4 | ||
| 5 | 2009/04 Very Preliminary Driver (video emulation courtesy of very old code by | |
| 6 | Hamish Coleman) | |
| 3 | Kyocera Kyotronics 85 (and similar laptop computers) | |
| 7 | 4 | |
| 8 | Comments about bit usage from Tech References and Virtual T source. | |
| 5 | 2009/04 Very Preliminary Driver (video emulation courtesy of very old code by | |
| 6 | Hamish Coleman) | |
| 9 | 7 | |
| 10 | Supported systems: | |
| 11 | - Kyosei Kyotronic 85 | |
| 12 | - Olivetti M10 (slightly diff hw, BIOS is shifted by 2 words) | |
| 13 | - NEC PC-8201A (slightly diff hw) | |
| 14 | - TRS-80 Model 100 | |
| 15 | - Tandy Model 102 (slightly diff hw) | |
| 16 | - Tandy Model 200 (diff video & rtc) | |
| 17 | ||
| 18 | To Do: | |
| 19 | - Find dumps of systems which could easily be added: | |
| 20 | * Olivetti M10 Modem (US) (diff BIOS than the European version) | |
| 21 | * NEC PC-8201 (original Japanese version of PC-8201A) | |
| 22 | * NEC PC-8300 (similar hardware to PC-8201) | |
| 23 | * NEC PC-8300 w/BradyWriter II ROMs | |
| 8 | Comments about bit usage from Tech References and Virtual T source. | |
| 24 | 9 | |
| 10 | Supported systems: | |
| 11 | - Kyosei Kyotronic 85 | |
| 12 | - Olivetti M10 (slightly diff hw, BIOS is shifted by 2 words) | |
| 13 | - NEC PC-8201A (slightly diff hw) | |
| 14 | - TRS-80 Model 100 | |
| 15 | - Tandy Model 102 (slightly diff hw) | |
| 16 | - Tandy Model 200 (diff video & rtc) | |
| 17 | ||
| 18 | To Do: | |
| 19 | - Find dumps of systems which could easily be added: | |
| 20 | * Olivetti M10 Modem (US) (diff BIOS than the European version) | |
| 21 | * NEC PC-8201 (original Japanese version of PC-8201A) | |
| 22 | * NEC PC-8300 (similar hardware to PC-8201) | |
| 23 | * NEC PC-8300 w/BradyWriter II ROMs | |
| 24 | ||
| 25 | 25 | ******************************************************************************************/ |
| 26 | 26 | |
| 27 | 27 | /* |
| 28 | 28 | |
| 29 | ||
| 29 | TODO: | |
| 30 | 30 | |
| 31 | - --- memory leak warning --- | |
| 32 | allocation #004834, 256 bytes (src/lib/util/astring.c:127) | |
| 33 | a total of 256 bytes were not free()'d | |
| 34 | - un-Y2K-hack tandy200 | |
| 35 | - keyboard is unresponsive for couple of seconds after boot | |
| 36 | - soft power on/off | |
| 37 | - IM6042 UART | |
| 38 | - pc8201 48K RAM option | |
| 39 | - pc8201 NEC PC-8241A video interface (TMS9918, 16K videoRAM, 8K ROM) | |
| 40 | - pc8201 128K ROM cartridge | |
| 41 | - pc8201 NEC PC-8233 floppy controller | |
| 42 | - pc8201 NEC floppy disc drives (PC-8031-1W, PC-8031-2W, PC-80S31) | |
| 43 | - trsm100 Tandy Portable Disk Drive (TPDD: 100k 3½", TPDD2: 200k 3½") (undumped HD63A01V1 MCU + full custom uPD65002, serial comms via the missing IM6042, not going to happen anytime soon) | |
| 44 | - trsm100 Chipmunk disk drive (384k 3½") (full custom logic, not going to happen) | |
| 45 | - trsm100 RS232/modem select | |
| 46 | - tandy200 UART8251 | |
| 47 | - tandy200 RTC alarm | |
| 48 | - tandy200 TCM5089 sound | |
| 49 | - international keyboard option ROMs | |
| 31 | - --- memory leak warning --- | |
| 32 | allocation #004834, 256 bytes (src/lib/util/astring.c:127) | |
| 33 | a total of 256 bytes were not free()'d | |
| 34 | - un-Y2K-hack tandy200 | |
| 35 | - keyboard is unresponsive for couple of seconds after boot | |
| 36 | - soft power on/off | |
| 37 | - IM6042 UART | |
| 38 | - pc8201 48K RAM option | |
| 39 | - pc8201 NEC PC-8241A video interface (TMS9918, 16K videoRAM, 8K ROM) | |
| 40 | - pc8201 128K ROM cartridge | |
| 41 | - pc8201 NEC PC-8233 floppy controller | |
| 42 | - pc8201 NEC floppy disc drives (PC-8031-1W, PC-8031-2W, PC-80S31) | |
| 43 | - trsm100 Tandy Portable Disk Drive (TPDD: 100k 3?", TPDD2: 200k 3?") (undumped HD63A01V1 MCU + full custom uPD65002, serial comms via the missing IM6042, not going to happen anytime soon) | |
| 44 | - trsm100 Chipmunk disk drive (384k 3?") (full custom logic, not going to happen) | |
| 45 | - trsm100 RS232/modem select | |
| 46 | - tandy200 UART8251 | |
| 47 | - tandy200 RTC alarm | |
| 48 | - tandy200 TCM5089 sound | |
| 49 | - international keyboard option ROMs | |
| 50 | 50 | |
| 51 | 51 | */ |
| 52 | 52 | |
| 53 | 53 | /* |
| 54 | 54 | |
| 55 | ||
| 55 | * PC-8201/8300 HARDWARE PORT DEFINITIONS * | |
| 56 | 56 | |
| 57 | -Port- | |
| 58 | Name Hex Dec Notes | |
| 59 | -------- --- --- ----------------------------------------- | |
| 60 | A8255 070 112 Video interface port A (8255) | |
| 61 | B8255 071 113 Video interface port B (8255) | |
| 62 | C8255 072 114 Video interface port C (8255) | |
| 63 | CW8255 073 115 Video interface command/mode port (8255) | |
| 64 | ROMAH 080 128 128k ROM select and MSBIT of address | |
| 65 | ROMAL 084 132 Lowest 8 bits of extended ROM address | |
| 66 | ROMAM 088 136 Middle eight bits of 128k ROM address | |
| 67 | ROMRD 08C 140 Read data port for 128k ROM | |
| 57 | -Port- | |
| 58 | Name Hex Dec Notes | |
| 59 | -------- --- --- ----------------------------------------- | |
| 60 | A8255 070 112 Video interface port A (8255) | |
| 61 | B8255 071 113 Video interface port B (8255) | |
| 62 | C8255 072 114 Video interface port C (8255) | |
| 63 | CW8255 073 115 Video interface command/mode port (8255) | |
| 64 | ROMAH 080 128 128k ROM select and MSBIT of address | |
| 65 | ROMAL 084 132 Lowest 8 bits of extended ROM address | |
| 66 | ROMAM 088 136 Middle eight bits of 128k ROM address | |
| 67 | ROMRD 08C 140 Read data port for 128k ROM | |
| 68 | 68 | |
| 69 | 69 | */ |
| 70 | 70 | |
| r5932 | r5933 | |
| 91 | 91 | static READ8_HANDLER( pc8201_bank_r ) |
| 92 | 92 | { |
| 93 | 93 | /* |
| 94 | ||
| 95 | bit signal description | |
| 96 | 94 | |
| 97 | 0 LADR1 select address 0 to 7fff | |
| 98 | 1 LADR2 select address 0 to 7fff | |
| 99 | 2 HADR1 select address 8000 to ffff | |
| 100 | 3 HADR2 select address 8000 to ffff | |
| 101 | 4 | |
| 102 | 5 | |
| 103 | 6 SELB serial interface status bit 1 | |
| 104 | 7 SELA serial interface status bit 0 | |
| 95 | bit signal description | |
| 105 | 96 | |
| 106 | */ | |
| 97 | 0 LADR1 select address 0 to 7fff | |
| 98 | 1 LADR2 select address 0 to 7fff | |
| 99 | 2 HADR1 select address 8000 to ffff | |
| 100 | 3 HADR2 select address 8000 to ffff | |
| 101 | 4 | |
| 102 | 5 | |
| 103 | 6 SELB serial interface status bit 1 | |
| 104 | 7 SELA serial interface status bit 0 | |
| 107 | 105 | |
| 106 | */ | |
| 107 | ||
| 108 | 108 | kc85_state *state = space->machine->driver_data; |
| 109 | 109 | |
| 110 | 110 | return (state->iosel << 5) | state->bank; |
| r5932 | r5933 | |
| 173 | 173 | static WRITE8_HANDLER( pc8201_bank_w ) |
| 174 | 174 | { |
| 175 | 175 | /* |
| 176 | ||
| 177 | bit signal description | |
| 178 | 176 | |
| 179 | 0 LADR1 select address 0 to 7fff | |
| 180 | 1 LADR2 select address 0 to 7fff | |
| 181 | 2 HADR1 select address 8000 to ffff | |
| 182 | 3 HADR2 select address 8000 to ffff | |
| 183 | 4 | |
| 184 | 5 | |
| 185 | 6 | |
| 186 | 7 | |
| 177 | bit signal description | |
| 187 | 178 | |
| 188 | */ | |
| 179 | 0 LADR1 select address 0 to 7fff | |
| 180 | 1 LADR2 select address 0 to 7fff | |
| 181 | 2 HADR1 select address 8000 to ffff | |
| 182 | 3 HADR2 select address 8000 to ffff | |
| 183 | 4 | |
| 184 | 5 | |
| 185 | 6 | |
| 186 | 7 | |
| 189 | 187 | |
| 188 | */ | |
| 189 | ||
| 190 | 190 | pc8201_bankswitch(space->machine, data & 0x0f); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | static WRITE8_HANDLER( pc8201_ctrl_w ) |
| 194 | 194 | { |
| 195 | 195 | /* |
| 196 | ||
| 197 | bit signal description | |
| 198 | 196 | |
| 199 | 0 | |
| 200 | 1 | |
| 201 | 2 | |
| 202 | 3 REMOTE cassette motor | |
| 203 | 4 TSTB RTC strobe | |
| 204 | 5 PSTB printer strobe | |
| 205 | 6 SELB serial interface select bit 1 | |
| 206 | 7 SELA serial interface select bit 0 | |
| 197 | bit signal description | |
| 207 | 198 | |
| 208 | */ | |
| 199 | 0 | |
| 200 | 1 | |
| 201 | 2 | |
| 202 | 3 REMOTE cassette motor | |
| 203 | 4 TSTB RTC strobe | |
| 204 | 5 PSTB printer strobe | |
| 205 | 6 SELB serial interface select bit 1 | |
| 206 | 7 SELA serial interface select bit 0 | |
| 209 | 207 | |
| 208 | */ | |
| 209 | ||
| 210 | 210 | kc85_state *state = space->machine->driver_data; |
| 211 | ||
| 211 | ||
| 212 | 212 | /* cassette motor */ |
| 213 | 213 | cassette_change_state(state->cassette, BIT(data, 3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 214 | 214 | |
| r5932 | r5933 | |
| 226 | 226 | { |
| 227 | 227 | /* |
| 228 | 228 | |
| 229 | ||
| 229 | bit signal description | |
| 230 | 230 | |
| 231 | 0 SBS stop bit select | |
| 232 | 1 EPE even parity enable | |
| 233 | 2 PI parity inhibit | |
| 234 | 3 CLS1 character length select bit 1 | |
| 235 | 4 CLS2 character length select bit 2 | |
| 236 | 5 | |
| 237 | 6 | |
| 238 | 7 | |
| 231 | 0 SBS stop bit select | |
| 232 | 1 EPE even parity enable | |
| 233 | 2 PI parity inhibit | |
| 234 | 3 CLS1 character length select bit 1 | |
| 235 | 4 CLS2 character length select bit 2 | |
| 236 | 5 | |
| 237 | 6 | |
| 238 | 7 | |
| 239 | 239 | |
| 240 | ||
| 240 | */ | |
| 241 | 241 | /* |
| 242 | ||
| 242 | kc85_state *state = space->machine->driver_data; | |
| 243 | 243 | |
| 244 | im6402_sbs_w(state->im6402, BIT(data, 0)); | |
| 245 | im6402_epe_w(state->im6402, BIT(data, 1)); | |
| 246 | im6402_pi_w(state->im6402, BIT(data, 2)); | |
| 247 | im6402_cls1_w(state->im6402, BIT(data, 3)); | |
| 248 | im6402_cls2_w(state->im6402, BIT(data, 4)); | |
| 244 | im6402_sbs_w(state->im6402, BIT(data, 0)); | |
| 245 | im6402_epe_w(state->im6402, BIT(data, 1)); | |
| 246 | im6402_pi_w(state->im6402, BIT(data, 2)); | |
| 247 | im6402_cls1_w(state->im6402, BIT(data, 3)); | |
| 248 | im6402_cls2_w(state->im6402, BIT(data, 4)); | |
| 249 | 249 | */ |
| 250 | 250 | } |
| 251 | 251 | |
| r5932 | r5933 | |
| 253 | 253 | { |
| 254 | 254 | /* |
| 255 | 255 | |
| 256 | ||
| 256 | bit signal description | |
| 257 | 257 | |
| 258 | 0 CD carrier detect | |
| 259 | 1 OE overrun error | |
| 260 | 2 FE framing error | |
| 261 | 3 PE parity error | |
| 262 | 4 TBRE transmit buffer register empty | |
| 263 | 5 RP | |
| 264 | 6 +5V | |
| 265 | 7 _LPS low power sensor | |
| 258 | 0 CD carrier detect | |
| 259 | 1 OE overrun error | |
| 260 | 2 FE framing error | |
| 261 | 3 PE parity error | |
| 262 | 4 TBRE transmit buffer register empty | |
| 263 | 5 RP | |
| 264 | 6 +5V | |
| 265 | 7 _LPS low power sensor | |
| 266 | 266 | |
| 267 | ||
| 267 | */ | |
| 268 | 268 | /* |
| 269 | ||
| 269 | kc85_state *state = space->machine->driver_data; | |
| 270 | 270 | |
| 271 | ||
| 271 | UINT8 data = 0; | |
| 272 | 272 | |
| 273 | int cd = im6402_cd_r(state->im6402); | |
| 274 | int oe = im6402_oe_r(state->im6402); | |
| 275 | int fe = im6402_fe_r(state->im6402); | |
| 276 | int pe = im6402_pe_r(state->im6402); | |
| 277 | int tbre = im6402_tbre_r(state->im6402); | |
| 273 | int cd = im6402_cd_r(state->im6402); | |
| 274 | int oe = im6402_oe_r(state->im6402); | |
| 275 | int fe = im6402_fe_r(state->im6402); | |
| 276 | int pe = im6402_pe_r(state->im6402); | |
| 277 | int tbre = im6402_tbre_r(state->im6402); | |
| 278 | 278 | |
| 279 | ||
| 279 | data = (tbre << 4) | (pe << 3) | (fe << 2) | (oe << 1) | cd; | |
| 280 | 280 | |
| 281 | ||
| 281 | return data; | |
| 282 | 282 | */ |
| 283 | 283 | |
| 284 | 284 | return 0xf0; |
| r5932 | r5933 | |
| 288 | 288 | { |
| 289 | 289 | /* |
| 290 | 290 | |
| 291 | ||
| 291 | bit signal description | |
| 292 | 292 | |
| 293 | 0 _DCD/_RD data carrier detect / ring detect | |
| 294 | 1 OE overrun error | |
| 295 | 2 FE framing error | |
| 296 | 3 PE parity error | |
| 297 | 4 TBRE transmit buffer register empty | |
| 298 | 5 RP | |
| 299 | 6 +5V | |
| 300 | 7 _LPS low power signal | |
| 293 | 0 _DCD/_RD data carrier detect / ring detect | |
| 294 | 1 OE overrun error | |
| 295 | 2 FE framing error | |
| 296 | 3 PE parity error | |
| 297 | 4 TBRE transmit buffer register empty | |
| 298 | 5 RP | |
| 299 | 6 +5V | |
| 300 | 7 _LPS low power signal | |
| 301 | 301 | |
| 302 | ||
| 302 | */ | |
| 303 | 303 | /* |
| 304 | ||
| 304 | kc85_state *state = space->machine->driver_data; | |
| 305 | 305 | |
| 306 | ||
| 306 | UINT8 data = 0; | |
| 307 | 307 | |
| 308 | int cd = im6402_cd_r(state->im6402); | |
| 309 | int oe = im6402_oe_r(state->im6402); | |
| 310 | int fe = im6402_fe_r(state->im6402); | |
| 311 | int pe = im6402_pe_r(state->im6402); | |
| 312 | int tbre = im6402_tbre_r(state->im6402); | |
| 308 | int cd = im6402_cd_r(state->im6402); | |
| 309 | int oe = im6402_oe_r(state->im6402); | |
| 310 | int fe = im6402_fe_r(state->im6402); | |
| 311 | int pe = im6402_pe_r(state->im6402); | |
| 312 | int tbre = im6402_tbre_r(state->im6402); | |
| 313 | 313 | |
| 314 | ||
| 314 | data = (tbre << 4) | (pe << 3) | (fe << 2) | (oe << 1) | cd; | |
| 315 | 315 | |
| 316 | ||
| 316 | return data; | |
| 317 | 317 | */ |
| 318 | 318 | |
| 319 | 319 | return 0xf0; |
| r5932 | r5933 | |
| 323 | 323 | { |
| 324 | 324 | /* |
| 325 | 325 | |
| 326 | ||
| 326 | bit signal description | |
| 327 | 327 | |
| 328 | 0 telephone line signal selection relay output | |
| 329 | 1 EN MC14412 enable output | |
| 330 | 2 | |
| 331 | 3 | |
| 332 | 4 | |
| 333 | 5 | |
| 334 | 6 | |
| 335 | 7 | |
| 328 | 0 telephone line signal selection relay output | |
| 329 | 1 EN MC14412 enable output | |
| 330 | 2 | |
| 331 | 3 | |
| 332 | 4 | |
| 333 | 5 | |
| 334 | 6 | |
| 335 | 7 | |
| 336 | 336 | |
| 337 | ||
| 337 | */ | |
| 338 | 338 | /* |
| 339 | ||
| 339 | kc85_state *state = space->machine->driver_data; | |
| 340 | 340 | |
| 341 | ||
| 341 | mc14412_en_w(state->mc14412, BIT(data, 1)); | |
| 342 | 342 | */ |
| 343 | 343 | } |
| 344 | 344 | |
| r5932 | r5933 | |
| 346 | 346 | { |
| 347 | 347 | /* |
| 348 | 348 | |
| 349 | ||
| 349 | bit signal description | |
| 350 | 350 | |
| 351 | 0 _STROM ROM selection (0=standard, 1=option) | |
| 352 | 1 _STROBE printer strobe output | |
| 353 | 2 STB RTC strobe output | |
| 354 | 3 _REMOTE cassette motor | |
| 355 | 4 | |
| 356 | 5 | |
| 357 | 6 | |
| 358 | 7 | |
| 351 | 0 _STROM ROM selection (0=standard, 1=option) | |
| 352 | 1 _STROBE printer strobe output | |
| 353 | 2 STB RTC strobe output | |
| 354 | 3 _REMOTE cassette motor | |
| 355 | 4 | |
| 356 | 5 | |
| 357 | 6 | |
| 358 | 7 | |
| 359 | 359 | |
| 360 | ||
| 360 | */ | |
| 361 | 361 | |
| 362 | 362 | kc85_state *state = space->machine->driver_data; |
| 363 | 363 | |
| r5932 | r5933 | |
| 449 | 449 | static WRITE8_HANDLER( tandy200_stbk_w ) |
| 450 | 450 | { |
| 451 | 451 | /* |
| 452 | ||
| 453 | bit signal description | |
| 454 | 452 | |
| 455 | 0 _PSTB printer strobe output | |
| 456 | 1 REMOTE cassette motor | |
| 457 | 2 | |
| 458 | 3 | |
| 459 | 4 | |
| 460 | 5 | |
| 461 | 6 | |
| 462 | 7 | |
| 453 | bit signal description | |
| 463 | 454 | |
| 464 | */ | |
| 455 | 0 _PSTB printer strobe output | |
| 456 | 1 REMOTE cassette motor | |
| 457 | 2 | |
| 458 | 3 | |
| 459 | 4 | |
| 460 | 5 | |
| 461 | 6 | |
| 462 | 7 | |
| 465 | 463 | |
| 464 | */ | |
| 465 | ||
| 466 | 466 | tandy200_state *state = space->machine->driver_data; |
| 467 | 467 | |
| 468 | 468 | /* printer strobe */ |
| r5932 | r5933 | |
| 495 | 495 | |
| 496 | 496 | static ADDRESS_MAP_START( kc85_io, ADDRESS_SPACE_IO, 8 ) |
| 497 | 497 | ADDRESS_MAP_UNMAP_HIGH |
| 498 | // AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional RAM unit | |
| 499 | // AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional I/O controller unit | |
| 500 | // AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) optional answering telephone unit | |
| 501 | // AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) optional modem | |
| 498 | // AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional RAM unit | |
| 499 | // AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional I/O controller unit | |
| 500 | // AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) optional answering telephone unit | |
| 501 | // AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) optional modem | |
| 502 | 502 | AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w) |
| 503 | // | |
| 503 | // AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w) | |
| 504 | 504 | AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(uart_status_r, uart_ctrl_w) |
| 505 | 505 | AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(keyboard_r, kc85_ctrl_w) |
| 506 | 506 | AM_RANGE(0xf0, 0xf0) AM_MIRROR(0x0e) AM_READWRITE(kc85_lcd_status_r, kc85_lcd_command_w) |
| r5932 | r5933 | |
| 509 | 509 | |
| 510 | 510 | static ADDRESS_MAP_START( trsm100_io, ADDRESS_SPACE_IO, 8 ) |
| 511 | 511 | ADDRESS_MAP_UNMAP_HIGH |
| 512 | // AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional RAM unit | |
| 513 | // AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional I/O controller unit | |
| 514 | // AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) optional answering telephone unit | |
| 512 | // AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional RAM unit | |
| 513 | // AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional I/O controller unit | |
| 514 | // AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) optional answering telephone unit | |
| 515 | 515 | AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(modem_w) |
| 516 | 516 | AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w) |
| 517 | // | |
| 517 | // AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w) | |
| 518 | 518 | AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(uart_status_r, uart_ctrl_w) |
| 519 | 519 | AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(keyboard_r, kc85_ctrl_w) |
| 520 | 520 | AM_RANGE(0xf0, 0xf0) AM_MIRROR(0x0e) AM_READWRITE(kc85_lcd_status_r, kc85_lcd_command_w) |
| r5932 | r5933 | |
| 523 | 523 | |
| 524 | 524 | static ADDRESS_MAP_START( pc8201_io, ADDRESS_SPACE_IO, 8 ) |
| 525 | 525 | ADDRESS_MAP_UNMAP_HIGH |
| 526 | // AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional video interface 8255 | |
| 527 | // AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional 128K ROM cartridge | |
| 526 | // AM_RANGE(0x70, 0x70) AM_MIRROR(0x0f) optional video interface 8255 | |
| 527 | // AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional 128K ROM cartridge | |
| 528 | 528 | AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) AM_WRITE(pc8201_ctrl_w) |
| 529 | 529 | AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_READWRITE(pc8201_bank_r, pc8201_bank_w) |
| 530 | 530 | AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w ) |
| 531 | // | |
| 531 | // AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w) | |
| 532 | 532 | AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(pc8201_uart_status_r, uart_ctrl_w) |
| 533 | 533 | AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READ(keyboard_r) |
| 534 | 534 | AM_RANGE(0xf0, 0xf0) AM_MIRROR(0x0e) AM_READWRITE(kc85_lcd_status_r, kc85_lcd_command_w) |
| r5932 | r5933 | |
| 538 | 538 | static ADDRESS_MAP_START( tandy200_io, ADDRESS_SPACE_IO, 8 ) |
| 539 | 539 | ADDRESS_MAP_UNMAP_HIGH |
| 540 | 540 | AM_RANGE(0x90, 0x9f) AM_DEVREADWRITE(RP5C01A_TAG, rp5c01a_r, rp5c01a_w) |
| 541 | // | |
| 541 | // AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_DEVWRITE(TCM5089_TAG, tcm5089_w) | |
| 542 | 542 | AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w) |
| 543 | 543 | AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0e) AM_DEVREADWRITE(MSM8251_TAG, msm8251_data_r, msm8251_data_w) |
| 544 | 544 | AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x0e) AM_DEVREADWRITE(MSM8251_TAG, msm8251_status_r, msm8251_control_w) |
| r5932 | r5933 | |
| 677 | 677 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 678 | 678 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 679 | 679 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 680 | ||
| 680 | ||
| 681 | 681 | PORT_MODIFY("KEY7") |
| 682 | 682 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP") PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 683 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 684 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 683 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 684 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 685 | 685 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) |
| 686 | 686 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 687 | 687 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) |
| r5932 | r5933 | |
| 815 | 815 | static READ8_DEVICE_HANDLER( kc85_8155_port_c_r ) |
| 816 | 816 | { |
| 817 | 817 | /* |
| 818 | ||
| 819 | bit description | |
| 820 | 818 | |
| 821 | 0 serial data input from clock chip | |
| 822 | 1 _BUSY signal from printer | |
| 823 | 2 BUSY signal from printer | |
| 824 | 3 data from BCR | |
| 825 | 4 _CTS from RS232 | |
| 826 | 5 _DSR from RS232 | |
| 819 | bit description | |
| 827 | 820 | |
| 828 | */ | |
| 821 | 0 serial data input from clock chip | |
| 822 | 1 _BUSY signal from printer | |
| 823 | 2 BUSY signal from printer | |
| 824 | 3 data from BCR | |
| 825 | 4 _CTS from RS232 | |
| 826 | 5 _DSR from RS232 | |
| 829 | 827 | |
| 828 | */ | |
| 829 | ||
| 830 | 830 | kc85_state *state = device->machine->driver_data; |
| 831 | 831 | |
| 832 | 832 | UINT8 data = 0; |
| r5932 | r5933 | |
| 842 | 842 | { |
| 843 | 843 | /* |
| 844 | 844 | |
| 845 | ||
| 845 | bit description | |
| 846 | 846 | |
| 847 | 0 LCD chip select 0, key scan 0, RTC C0 | |
| 848 | 1 LCD chip select 1, key scan 1, RTC C1 | |
| 849 | 2 LCD chip select 2, key scan 2, RTC C2 | |
| 850 | 3 LCD chip select 3, key scan 3, RTC CLK | |
| 851 | 4 LCD chip select 4, key scan 4, RTC DATA IN | |
| 852 | 5 LCD chip select 5, key scan 5 | |
| 853 | 6 LCD chip select 6, key scan 6 | |
| 854 | 7 LCD chip select 7, key scan 7 | |
| 847 | 0 LCD chip select 0, key scan 0, RTC C0 | |
| 848 | 1 LCD chip select 1, key scan 1, RTC C1 | |
| 849 | 2 LCD chip select 2, key scan 2, RTC C2 | |
| 850 | 3 LCD chip select 3, key scan 3, RTC CLK | |
| 851 | 4 LCD chip select 4, key scan 4, RTC DATA IN | |
| 852 | 5 LCD chip select 5, key scan 5 | |
| 853 | 6 LCD chip select 6, key scan 6 | |
| 854 | 7 LCD chip select 7, key scan 7 | |
| 855 | 855 | |
| 856 | ||
| 856 | */ | |
| 857 | 857 | |
| 858 | 858 | kc85_state *state = device->machine->driver_data; |
| 859 | 859 | |
| r5932 | r5933 | |
| 882 | 882 | { |
| 883 | 883 | /* |
| 884 | 884 | |
| 885 | ||
| 885 | bit signal description | |
| 886 | 886 | |
| 887 | 0 LCD chip select 8, key scan 8 | |
| 888 | 1 LCD chip select 9 | |
| 889 | 2 beeper data output | |
| 890 | 3 _RS232 modem select (0=RS232, 1=modem) | |
| 891 | 4 PCS soft power off | |
| 892 | 5 beeper data input select (0=data from 8155 TO, 1=data from PB2) | |
| 893 | 6 _DTR RS232 data terminal ready output | |
| 894 | 7 _RTS RS232 request to send output | |
| 887 | 0 LCD chip select 8, key scan 8 | |
| 888 | 1 LCD chip select 9 | |
| 889 | 2 beeper data output | |
| 890 | 3 _RS232 modem select (0=RS232, 1=modem) | |
| 891 | 4 PCS soft power off | |
| 892 | 5 beeper data input select (0=data from 8155 TO, 1=data from PB2) | |
| 893 | 6 _DTR RS232 data terminal ready output | |
| 894 | 7 _RTS RS232 request to send output | |
| 895 | 895 | |
| 896 | ||
| 896 | */ | |
| 897 | 897 | |
| 898 | 898 | kc85_state *state = device->machine->driver_data; |
| 899 | 899 | |
| r5932 | r5933 | |
| 935 | 935 | static READ8_DEVICE_HANDLER( pc8201_8155_port_c_r ) |
| 936 | 936 | { |
| 937 | 937 | /* |
| 938 | ||
| 939 | bit signal description | |
| 940 | 938 | |
| 941 | 0 CDI clock data input | |
| 942 | 1 SLCT _BUSY signal from printer | |
| 943 | 2 BUSY BUSY signal from printer | |
| 944 | 3 BCR bar code reader data input | |
| 945 | 4 _CTS RS232 clear to send input | |
| 946 | 5 _DSR RS232 DSR input | |
| 939 | bit signal description | |
| 947 | 940 | |
| 948 | */ | |
| 941 | 0 CDI clock data input | |
| 942 | 1 SLCT _BUSY signal from printer | |
| 943 | 2 BUSY BUSY signal from printer | |
| 944 | 3 BCR bar code reader data input | |
| 945 | 4 _CTS RS232 clear to send input | |
| 946 | 5 _DSR RS232 DSR input | |
| 949 | 947 | |
| 948 | */ | |
| 949 | ||
| 950 | 950 | kc85_state *state = device->machine->driver_data; |
| 951 | 951 | |
| 952 | 952 | UINT8 data = 0; |
| r5932 | r5933 | |
| 962 | 962 | { |
| 963 | 963 | /* |
| 964 | 964 | |
| 965 | ||
| 965 | bit signal description | |
| 966 | 966 | |
| 967 | 0 LCD chip select 8, key scan 8 | |
| 968 | 1 LCD chip select 9 | |
| 969 | 2 _MC melody control output | |
| 970 | 3 DCD/_RD RS232 DCD/_RD select | |
| 971 | 4 APO auto power off output | |
| 972 | 5 BELL buzzer output (0=ring, 1=not ring) | |
| 973 | 6 _DTR RS232 data terminal ready output | |
| 974 | 7 _RTS RS232 request to send output | |
| 967 | 0 LCD chip select 8, key scan 8 | |
| 968 | 1 LCD chip select 9 | |
| 969 | 2 _MC melody control output | |
| 970 | 3 DCD/_RD RS232 DCD/_RD select | |
| 971 | 4 APO auto power off output | |
| 972 | 5 BELL buzzer output (0=ring, 1=not ring) | |
| 973 | 6 _DTR RS232 data terminal ready output | |
| 974 | 7 _RTS RS232 request to send output | |
| 975 | 975 | |
| 976 | ||
| 976 | */ | |
| 977 | 977 | |
| 978 | 978 | kc85_state *state = device->machine->driver_data; |
| 979 | 979 | |
| r5932 | r5933 | |
| 1005 | 1005 | static READ8_DEVICE_HANDLER( tandy200_8155_port_c_r ) |
| 1006 | 1006 | { |
| 1007 | 1007 | /* |
| 1008 | ||
| 1009 | bit signal description | |
| 1010 | 1008 | |
| 1011 | 0 _LPS low power sense input | |
| 1012 | 1 _BUSY not busy input | |
| 1013 | 2 BUSY busy input | |
| 1014 | 3 BCR bar code reader data input | |
| 1015 | 4 CD carrier detect input | |
| 1016 | 5 CDBD carrier detect break down input | |
| 1009 | bit signal description | |
| 1017 | 1010 | |
| 1018 | */ | |
| 1011 | 0 _LPS low power sense input | |
| 1012 | 1 _BUSY not busy input | |
| 1013 | 2 BUSY busy input | |
| 1014 | 3 BCR bar code reader data input | |
| 1015 | 4 CD carrier detect input | |
| 1016 | 5 CDBD carrier detect break down input | |
| 1019 | 1017 | |
| 1018 | */ | |
| 1019 | ||
| 1020 | 1020 | tandy200_state *state = device->machine->driver_data; |
| 1021 | 1021 | |
| 1022 | 1022 | UINT8 data = 0x01; |
| r5932 | r5933 | |
| 1031 | 1031 | { |
| 1032 | 1032 | /* |
| 1033 | 1033 | |
| 1034 | ||
| 1034 | bit description | |
| 1035 | 1035 | |
| 1036 | 0 print data 0, key scan 0 | |
| 1037 | 1 print data 1, key scan 1 | |
| 1038 | 2 print data 2, key scan 2 | |
| 1039 | 3 print data 3, key scan 3 | |
| 1040 | 4 print data 4, key scan 4 | |
| 1041 | 5 print data 5, key scan 5 | |
| 1042 | 6 print data 6, key scan 6 | |
| 1043 | 7 print data 7, key scan 7 | |
| 1036 | 0 print data 0, key scan 0 | |
| 1037 | 1 print data 1, key scan 1 | |
| 1038 | 2 print data 2, key scan 2 | |
| 1039 | 3 print data 3, key scan 3 | |
| 1040 | 4 print data 4, key scan 4 | |
| 1041 | 5 print data 5, key scan 5 | |
| 1042 | 6 print data 6, key scan 6 | |
| 1043 | 7 print data 7, key scan 7 | |
| 1044 | 1044 | |
| 1045 | ||
| 1045 | */ | |
| 1046 | 1046 | |
| 1047 | 1047 | tandy200_state *state = device->machine->driver_data; |
| 1048 | 1048 | |
| r5932 | r5933 | |
| 1055 | 1055 | { |
| 1056 | 1056 | /* |
| 1057 | 1057 | |
| 1058 | ||
| 1058 | bit signal description | |
| 1059 | 1059 | |
| 1060 | 0 key scan 8 | |
| 1061 | 1 ORIG/ANS (1=ORIG, 0=ANS) | |
| 1062 | 2 _BUZZER (0=data from 8155 TO, 1=data from PB2) | |
| 1063 | 3 _RS232C (1=modem, 0=RS-232) | |
| 1064 | 4 PCS power cut signal | |
| 1065 | 5 BELL buzzer data output | |
| 1066 | 6 MEN modem enable output | |
| 1067 | 7 CALL connects and disconnects the phone line | |
| 1060 | 0 key scan 8 | |
| 1061 | 1 ORIG/ANS (1=ORIG, 0=ANS) | |
| 1062 | 2 _BUZZER (0=data from 8155 TO, 1=data from PB2) | |
| 1063 | 3 _RS232C (1=modem, 0=RS-232) | |
| 1064 | 4 PCS power cut signal | |
| 1065 | 5 BELL buzzer data output | |
| 1066 | 6 MEN modem enable output | |
| 1067 | 7 CALL connects and disconnects the phone line | |
| 1068 | 1068 | |
| 1069 | ||
| 1069 | */ | |
| 1070 | 1070 | |
| 1071 | 1071 | tandy200_state *state = device->machine->driver_data; |
| 1072 | 1072 | |
| r5932 | r5933 | |
| 1198 | 1198 | kc85_state *state = machine->driver_data; |
| 1199 | 1199 | |
| 1200 | 1200 | const address_space *program = cputag_get_address_space(machine, I8085_TAG, ADDRESS_SPACE_PROGRAM); |
| 1201 | ||
| 1201 | ||
| 1202 | 1202 | /* find devices */ |
| 1203 | 1203 | state->upd1990a = devtag_get_device(machine, UPD1990A_TAG); |
| 1204 | 1204 | state->centronics = devtag_get_device(machine, CENTRONICS_TAG); |
| r5932 | r5933 | |
| 1390 | 1390 | MDRV_MACHINE_START(trsm100) |
| 1391 | 1391 | |
| 1392 | 1392 | /* devices */ |
| 1393 | // | |
| 1393 | // MDRV_MC14412_ADD(MC14412_TAG, XTAL_1MHz) | |
| 1394 | 1394 | MACHINE_DRIVER_END |
| 1395 | 1395 | |
| 1396 | 1396 | static MACHINE_DRIVER_START( tandy200 ) |
| r5932 | r5933 | |
| 1414 | 1414 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1415 | 1415 | MDRV_SOUND_ADD("speaker", SPEAKER, 0) |
| 1416 | 1416 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 1417 | // | |
| 1417 | // MDRV_TCM5089_ADD(TCM5089_TAG, XTAL_3_579545MHz) | |
| 1418 | 1418 | |
| 1419 | 1419 | /* devices */ |
| 1420 | 1420 | MDRV_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, tandy200_8155_intf) |
| 1421 | 1421 | MDRV_RP5C01A_ADD(RP5C01A_TAG, XTAL_32_768kHz, tandy200_rp5c01a_intf) |
| 1422 | 1422 | MDRV_MSM8251_ADD(MSM8251_TAG, /*XTAL_4_9152MHz/2,*/ tandy200_msm8251_interface) |
| 1423 | // | |
| 1423 | // MDRV_MC14412_ADD(MC14412_TAG, XTAL_1MHz) | |
| 1424 | 1424 | |
| 1425 | 1425 | /* printer */ |
| 1426 | 1426 | MDRV_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics) |
| r5932 | r5933 | |
| 1454 | 1454 | |
| 1455 | 1455 | ROM_START( trsm100 ) |
| 1456 | 1456 | /* |
| 1457 | Board Code ROM type ROM Code Comment | |
| 1458 | ------------------------------------------------------------------- | |
| 1459 | PLX110CH1X custom LH535618 early North America | |
| 1460 | PLX110EH1X 27C256 compatible 3256C07-3J1/11US late North America | |
| 1461 | PLX120CH1X 27C256 compatible 3256C05-3E1/11EP European/Italian | |
| 1462 | */ | |
| 1457 | Board Code ROM type ROM Code Comment | |
| 1458 | ------------------------------------------------------------------- | |
| 1459 | PLX110CH1X custom LH535618 early North America | |
| 1460 | PLX110EH1X 27C256 compatible 3256C07-3J1/11US late North America | |
| 1461 | PLX120CH1X 27C256 compatible 3256C05-3E1/11EP European/Italian | |
| 1462 | */ | |
| 1463 | 1463 | ROM_REGION( 0x8000, I8085_TAG, 0 ) |
| 1464 | 1464 | ROM_LOAD( "m100rom.m12", 0x0000, 0x8000, CRC(730a3611) SHA1(094dbc4ac5a4ea5cdf51a1ac581a40a9622bb25d) ) |
| 1465 | 1465 | |
| r5932 | r5933 | |
| 1468 | 1468 | ROM_END |
| 1469 | 1469 | |
| 1470 | 1470 | ROM_START( olivm10 ) |
| 1471 | // 3256C02-4B3/I | |
| 1471 | // 3256C02-4B3/I Italian | |
| 1472 | 1472 | ROM_REGION( 0x8010, I8085_TAG, 0 ) |
| 1473 | 1473 | ROM_LOAD( "m10rom.m12", 0x0000, 0x8000, CRC(f0e8447a) SHA1(d58867276213116a79f7074109b7d7ce02e8a3af) ) |
| 1474 | 1474 | |
| r5932 | r5933 | |
| 1506 | 1506 | static SYSTEM_CONFIG_START( pc8201 ) |
| 1507 | 1507 | CONFIG_RAM_DEFAULT (16 * 1024) |
| 1508 | 1508 | CONFIG_RAM (32 * 1024) |
| 1509 | // | |
| 1509 | // CONFIG_RAM (48 * 1024) | |
| 1510 | 1510 | CONFIG_RAM (64 * 1024) |
| 1511 | 1511 | CONFIG_RAM (96 * 1024) |
| 1512 | 1512 | SYSTEM_CONFIG_END |
| r5932 | r5933 | |
| 1531 | 1531 | |
| 1532 | 1532 | /* System Drivers */ |
| 1533 | 1533 | |
| 1534 | /* YEAR NAME | |
| 1534 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 1535 | 1535 | COMP( 1983, kc85, 0, 0, kc85, kc85, 0, kc85, "Kyosei", "Kyotronic 85 (Japan)", 0 ) |
| 1536 | 1536 | COMP( 1983, olivm10, kc85, 0, kc85, olivm10, 0, kc85, "Olivetti", "M-10", 0 ) |
| 1537 | //COMP( 1983, olivm10m, | |
| 1537 | //COMP( 1983, olivm10m, kc85, 0, kc85, olivm10, 0, kc85, "Olivetti", "M-10 Modem (US)", 0 ) | |
| 1538 | 1538 | COMP( 1983, trsm100, 0, 0, trsm100, kc85, 0, trsm100, "Tandy Radio Shack", "TRS-80 Model 100", 0 ) |
| 1539 | 1539 | COMP( 1986, tandy102, trsm100,0, trsm100, kc85, 0, tandy102, "Tandy Radio Shack", "Tandy 102", 0 ) |
| 1540 | //COMP( 1983, npc8201, | |
| 1540 | //COMP( 1983, npc8201, 0, 0, pc8201, pc8201a, 0, pc8201, "NEC", "PC-8201 (Japan)", 0 ) | |
| 1541 | 1541 | COMP( 1983, npc8201a, 0, 0, pc8201, pc8201a, 0, pc8201, "NEC", "PC-8201A", 0 ) |
| 1542 | //COMP( 1987, npc8300, | |
| 1542 | //COMP( 1987, npc8300, npc8201,0, pc8300, pc8300, 0, pc8300, "NEC", "PC-8300", 0 ) | |
| 1543 | 1543 | COMP( 1984, tandy200, 0, 0, tandy200, kc85, 0, tandy200, "Tandy Radio Shack", "Tandy 200", 0 ) |
| r5932 | r5933 | |
|---|---|---|
| 1793 | 1793 | //fflush(stdout); |
| 1794 | 1794 | |
| 1795 | 1795 | /* |
| 1796 | switch(mcd212.channel[channel].ddr & MCD212_DDR_FT) | |
| 1797 | { | |
| 1798 | case MCD212_DDR_FT_BMP: | |
| 1799 | case MCD212_DDR_FT_BMP2: | |
| 1800 | if(mcd212.channel[channel].dcr & MCD212_DCR_CM) | |
| 1801 | { | |
| 1802 | printf( "4-bit Bitmap: " ); | |
| 1803 | } | |
| 1804 | else | |
| 1805 | { | |
| 1806 | static UINT8 fuck = 0; | |
| 1807 | printf( "8-bit Bitmap: " ); | |
| 1808 | if(!fuck) | |
| 1809 | { | |
| 1810 | FILE* out = fopen("planea.bin","wb"); | |
| 1811 | int i = 0; | |
| 1812 | for(i = 0; i < 0x80000; i += 2) | |
| 1813 | { | |
| 1814 | UINT8 temp1, temp2; | |
| 1815 | temp1 = planea[i/2] >> 8; | |
| 1816 | temp2 = planea[i/2] & 0x00ff; | |
| 1817 | fwrite(&temp1, 1, 1, out); | |
| 1818 | fwrite(&temp2, 1, 1, out); | |
| 1819 | } | |
| 1820 | fflush(out); | |
| 1821 | fclose(out); | |
| 1822 | out = fopen("planeb.bin","wb"); | |
| 1823 | for(i = 0; i < 0x80000; i += 2) | |
| 1824 | { | |
| 1825 | UINT8 temp1, temp2; | |
| 1826 | temp1 = planeb[i/2] >> 8; | |
| 1827 | temp2 = planeb[i/2] & 0x00ff; | |
| 1828 | fwrite(&temp1, 1, 1, out); | |
| 1829 | fwrite(&temp2, 1, 1, out); | |
| 1830 | } | |
| 1831 | fflush(out); | |
| 1832 | fclose(out); | |
| 1833 | fuck++; | |
| 1796 | switch(mcd212.channel[channel].ddr & MCD212_DDR_FT) | |
| 1797 | { | |
| 1798 | case MCD212_DDR_FT_BMP: | |
| 1799 | case MCD212_DDR_FT_BMP2: | |
| 1800 | if(mcd212.channel[channel].dcr & MCD212_DCR_CM) | |
| 1801 | { | |
| 1802 | printf( "4-bit Bitmap: " ); | |
| 1803 | } | |
| 1804 | else | |
| 1805 | { | |
| 1806 | static UINT8 fuck = 0; | |
| 1807 | printf( "8-bit Bitmap: " ); | |
| 1808 | if(!fuck) | |
| 1809 | { | |
| 1810 | FILE* out = fopen("planea.bin","wb"); | |
| 1811 | int i = 0; | |
| 1812 | for(i = 0; i < 0x80000; i += 2) | |
| 1813 | { | |
| 1814 | UINT8 temp1, temp2; | |
| 1815 | temp1 = planea[i/2] >> 8; | |
| 1816 | temp2 = planea[i/2] & 0x00ff; | |
| 1817 | fwrite(&temp1, 1, 1, out); | |
| 1818 | fwrite(&temp2, 1, 1, out); | |
| 1819 | } | |
| 1820 | fflush(out); | |
| 1821 | fclose(out); | |
| 1822 | out = fopen("planeb.bin","wb"); | |
| 1823 | for(i = 0; i < 0x80000; i += 2) | |
| 1824 | { | |
| 1825 | UINT8 temp1, temp2; | |
| 1826 | temp1 = planeb[i/2] >> 8; | |
| 1827 | temp2 = planeb[i/2] & 0x00ff; | |
| 1828 | fwrite(&temp1, 1, 1, out); | |
| 1829 | fwrite(&temp2, 1, 1, out); | |
| 1830 | } | |
| 1831 | fflush(out); | |
| 1832 | fclose(out); | |
| 1833 | fuck++; | |
| 1834 | 1834 | |
| 1835 | } | |
| 1836 | } | |
| 1837 | break; | |
| 1838 | case MCD212_DDR_FT_RLE: | |
| 1839 | if(mcd212.channel[channel].dcr & MCD212_DCR_CM) | |
| 1840 | { | |
| 1841 | printf( "4-bit RLE: " ); | |
| 1842 | } | |
| 1843 | else | |
| 1844 | { | |
| 1845 | printf( "8-bit RLE: " ); | |
| 1846 | } | |
| 1847 | break; | |
| 1848 | case MCD212_DDR_FT_MOSAIC: | |
| 1849 | if(mcd212.channel[channel].dcr & MCD212_DCR_CM) | |
| 1850 | { | |
| 1851 | printf( "4-bit Mosaic: " ); | |
| 1852 | } | |
| 1853 | else | |
| 1854 | { | |
| 1855 | printf( "8-bit Mosaic: " ); | |
| 1856 | } | |
| 1857 | break; | |
| 1858 | } | |
| 1859 | */ | |
| 1835 | } | |
| 1836 | } | |
| 1837 | break; | |
| 1838 | case MCD212_DDR_FT_RLE: | |
| 1839 | if(mcd212.channel[channel].dcr & MCD212_DCR_CM) | |
| 1840 | { | |
| 1841 | printf( "4-bit RLE: " ); | |
| 1842 | } | |
| 1843 | else | |
| 1844 | { | |
| 1845 | printf( "8-bit RLE: " ); | |
| 1846 | } | |
| 1847 | break; | |
| 1848 | case MCD212_DDR_FT_MOSAIC: | |
| 1849 | if(mcd212.channel[channel].dcr & MCD212_DCR_CM) | |
| 1850 | { | |
| 1851 | printf( "4-bit Mosaic: " ); | |
| 1852 | } | |
| 1853 | else | |
| 1854 | { | |
| 1855 | printf( "8-bit Mosaic: " ); | |
| 1856 | } | |
| 1857 | break; | |
| 1858 | } | |
| 1859 | */ | |
| 1860 | 1860 | |
| 1861 | 1861 | while(!done) |
| 1862 | 1862 | { |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Intel SDK-86 |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 23 | 23 | INPUT_PORTS_END |
| 24 | 24 | |
| 25 | 25 | |
| 26 | static MACHINE_RESET(sdk86) | |
| 27 | { | |
| 26 | static MACHINE_RESET(sdk86) | |
| 27 | { | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | static VIDEO_START( sdk86 ) |
| r5932 | r5933 | |
| 40 | 40 | /* basic machine hardware */ |
| 41 | 41 | MDRV_CPU_ADD("maincpu",I8086, XTAL_5MHz) /* jumper selection slow it down on 2.5MHz*/ |
| 42 | 42 | MDRV_CPU_PROGRAM_MAP(sdk86_mem) |
| 43 | MDRV_CPU_IO_MAP(sdk86_io) | |
| 43 | MDRV_CPU_IO_MAP(sdk86_io) | |
| 44 | 44 | |
| 45 | 45 | MDRV_MACHINE_RESET(sdk86) |
| 46 | ||
| 46 | ||
| 47 | 47 | /* video hardware */ |
| 48 | 48 | MDRV_SCREEN_ADD("screen", RASTER) |
| 49 | 49 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 65 | 65 | ROM_LOAD16_BYTE( "0456_104531-001.a36", 0xfe000, 0x0800, CRC(f9c4a809) SHA1(aea324c3f52dd393f1eed2b856ba11f050a35b93)) |
| 66 | 66 | ROM_LOAD16_BYTE( "0457_104532-001.a37", 0xfe001, 0x0800, CRC(a245ba5c) SHA1(7f67277f866fca5377cb123e9cc405b5fdfe61d3)) |
| 67 | 67 | ROM_LOAD16_BYTE( "0169_102042-001.a27", 0xff000, 0x0800, CRC(3f46311a) SHA1(a97e6861b736f26230b9adbf5cd2576a9f60d626)) |
| 68 | ROM_LOAD16_BYTE( "0170_102043-001.a30", 0xff001, 0x0800, CRC(65924471) SHA1(5d258695bf585f89179dfa0a113a0eeeabd5ee2b)) | |
| 68 | ROM_LOAD16_BYTE( "0170_102043-001.a30", 0xff001, 0x0800, CRC(65924471) SHA1(5d258695bf585f89179dfa0a113a0eeeabd5ee2b)) | |
| 69 | 69 | ROM_END |
| 70 | 70 | |
| 71 | 71 | /* Driver */ |
| r5932 | r5933 | |
|---|---|---|
| 246 | 246 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */ |
| 247 | 247 | INPUT_PORTS_END |
| 248 | 248 | |
| 249 | static PALETTE_INIT( sms ) | |
| 249 | static PALETTE_INIT( sms ) | |
| 250 | 250 | { |
| 251 | 251 | int i; |
| 252 | for( i = 0; i < 64; i++ ) | |
| 252 | for( i = 0; i < 64; i++ ) | |
| 253 | 253 | { |
| 254 | 254 | int r = i & 0x03; |
| 255 | 255 | int g = ( i & 0x0C ) >> 2; |
| r5932 | r5933 | |
| 275 | 275 | palette_set_color_rgb(machine, 64+15, 255, 255, 255 ); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | static PALETTE_INIT( gamegear ) | |
| 278 | static PALETTE_INIT( gamegear ) | |
| 279 | 279 | { |
| 280 | 280 | int i; |
| 281 | for( i = 0; i < 4096; i++ ) | |
| 281 | for( i = 0; i < 4096; i++ ) | |
| 282 | 282 | { |
| 283 | 283 | int r = i & 0x000F; |
| 284 | 284 | int g = ( i & 0x00F0 ) >> 4; |
| r5932 | r5933 | |
| 292 | 292 | static const smsvdp_configuration config_315_5378 = { MODEL_315_5378, sms_int_callback }; |
| 293 | 293 | static const smsvdp_configuration config_store = { MODEL_315_5124, sms_store_int_callback }; |
| 294 | 294 | |
| 295 | static VIDEO_START(sega_315_5124) | |
| 295 | static VIDEO_START(sega_315_5124) | |
| 296 | 296 | { |
| 297 | 297 | smsvdp_video_init( machine, &config_315_5124 ); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | static VIDEO_START(sega_315_5246) | |
| 300 | static VIDEO_START(sega_315_5246) | |
| 301 | 301 | { |
| 302 | 302 | smsvdp_video_init( machine, &config_315_5246 ); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | static VIDEO_START(sega_315_5378) | |
| 305 | static VIDEO_START(sega_315_5378) | |
| 306 | 306 | { |
| 307 | 307 | smsvdp_video_init( machine, &config_315_5378 ); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | static VIDEO_START(sega_store_315_5124) | |
| 310 | static VIDEO_START(sega_store_315_5124) | |
| 311 | 311 | { |
| 312 | 312 | smsvdp_video_init( machine, &config_store ); |
| 313 | 313 | } |
| r5932 | r5933 | |
| 346 | 346 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 347 | 347 | MDRV_SOUND_ADD("smsiii", SMSIII, XTAL_53_693175MHz/15) |
| 348 | 348 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 349 | ||
| 349 | ||
| 350 | 350 | MDRV_IMPORT_FROM( sms_cartslot ) |
| 351 | 351 | MACHINE_DRIVER_END |
| 352 | 352 | |
| r5932 | r5933 | |
| 413 | 413 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 414 | 414 | MDRV_SOUND_ADD("smsiii", SMSIII, MASTER_CLOCK_PAL/15) |
| 415 | 415 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 416 | ||
| 416 | ||
| 417 | 417 | MDRV_IMPORT_FROM( sms_cartslot ) |
| 418 | 418 | MACHINE_DRIVER_END |
| 419 | 419 |
| r5932 | r5933 | |
|---|---|---|
| 26 | 26 | static ADDRESS_MAP_START( poly88_io , ADDRESS_SPACE_IO, 8) |
| 27 | 27 | ADDRESS_MAP_UNMAP_HIGH |
| 28 | 28 | AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("uart", msm8251_data_r,msm8251_data_w) |
| 29 | AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart", msm8251_status_r,msm8251_control_w) | |
| 29 | AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("uart", msm8251_status_r,msm8251_control_w) | |
| 30 | 30 | AM_RANGE(0x04, 0x04) AM_WRITE(poly_baud_rate_w) |
| 31 | 31 | AM_RANGE(0x08, 0x08) AM_WRITE(poly_intr_w) |
| 32 | 32 | AM_RANGE(0xf8, 0xf8) AM_READ(poly_keyboard_r) |
| r5932 | r5933 | |
| 38 | 38 | AM_RANGE(0x0400, 0x0bff) AM_ROM // Disk System ROM |
| 39 | 39 | AM_RANGE(0x0c00, 0x0fff) AM_RAM // System RAM |
| 40 | 40 | AM_RANGE(0x1800, 0x1bff) AM_RAM AM_BASE(&poly_video_ram) // Video RAM |
| 41 | AM_RANGE(0x2000, 0xffff) AM_RAM // RAM | |
| 41 | AM_RANGE(0x2000, 0xffff) AM_RAM // RAM | |
| 42 | 42 | ADDRESS_MAP_END |
| 43 | 43 | |
| 44 | 44 | static ADDRESS_MAP_START( poly8813_io , ADDRESS_SPACE_IO, 8) |
| r5932 | r5933 | |
| 47 | 47 | |
| 48 | 48 | /* Input ports */ |
| 49 | 49 | static INPUT_PORTS_START( poly88 ) |
| 50 | PORT_START("LINEC") | |
| 50 | PORT_START("LINEC") | |
| 51 | 51 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 52 | 52 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 53 | 53 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) |
| r5932 | r5933 | |
| 70 | 70 | PORT_START("LINE1") |
| 71 | 71 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 72 | 72 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 73 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) | |
| 74 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) | |
| 75 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 76 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) | |
| 73 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) | |
| 74 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) | |
| 75 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 76 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) | |
| 77 | 77 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) |
| 78 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 78 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 79 | 79 | |
| 80 | 80 | PORT_START("LINE2") |
| 81 | 81 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_END) |
| r5932 | r5933 | |
| 96 | 96 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) |
| 97 | 97 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) |
| 98 | 98 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 99 | ||
| 99 | ||
| 100 | 100 | PORT_START("LINE4") |
| 101 | 101 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 102 | 102 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| r5932 | r5933 | |
| 106 | 106 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) |
| 107 | 107 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) |
| 108 | 108 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 109 | ||
| 109 | ||
| 110 | 110 | PORT_START("LINE5") |
| 111 | 111 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) |
| 112 | 112 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) |
| 113 | 113 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) |
| 114 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) | |
| 114 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) | |
| 115 | 115 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) |
| 116 | 116 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 117 | 117 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) |
| 118 | 118 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL")PORT_CODE(KEYCODE_BACKSPACE) |
| 119 | ||
| 119 | ||
| 120 | 120 | PORT_START("LINE6") |
| 121 | 121 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) |
| 122 | 122 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) |
| 123 | 123 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) |
| 124 | 124 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) |
| 125 | 125 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 126 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) | |
| 127 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) | |
| 128 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) | |
| 126 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) | |
| 127 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) | |
| 128 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) | |
| 129 | 129 | INPUT_PORTS_END |
| 130 | 130 | |
| 131 | 131 | static const struct CassetteOptions poly88_cassette_options = |
| r5932 | r5933 | |
| 164 | 164 | |
| 165 | 165 | MDRV_VIDEO_START(poly88) |
| 166 | 166 | MDRV_VIDEO_UPDATE(poly88) |
| 167 | ||
| 167 | ||
| 168 | 168 | /* audio hardware */ |
| 169 | 169 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 170 | 170 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| r5932 | r5933 | |
| 172 | 172 | |
| 173 | 173 | /* cassette */ |
| 174 | 174 | MDRV_CASSETTE_ADD( "cassette", poly88_cassette_config ) |
| 175 | ||
| 175 | ||
| 176 | 176 | /* uart */ |
| 177 | 177 | MDRV_MSM8251_ADD("uart", poly88_usart_interface) |
| 178 | ||
| 178 | ||
| 179 | 179 | /* snapshot */ |
| 180 | MDRV_SNAPSHOT_ADD("snapshot", poly88, "img", 0) | |
| 180 | MDRV_SNAPSHOT_ADD("snapshot", poly88, "img", 0) | |
| 181 | 181 | MACHINE_DRIVER_END |
| 182 | 182 | |
| 183 | 183 | static MACHINE_DRIVER_START( poly8813 ) |
| 184 | 184 | MDRV_IMPORT_FROM(poly88) |
| 185 | ||
| 185 | ||
| 186 | 186 | MDRV_CPU_MODIFY("maincpu") |
| 187 | 187 | MDRV_CPU_PROGRAM_MAP(poly8813_mem) |
| 188 | 188 | MDRV_CPU_IO_MAP(poly8813_io) |
| r5932 | r5933 | |
| 204 | 204 | ROM_END |
| 205 | 205 | /* Driver */ |
| 206 | 206 | |
| 207 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY | |
| 207 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 208 | 208 | COMP( 1976, poly88, 0, 0, poly88, poly88, poly88, 0,"PolyMorphic Systems", "Poly-88", 0) |
| 209 | 209 | COMP( 1977, poly8813,poly88,0, poly8813, poly88, poly88, 0,"PolyMorphic Systems", "Poly-8813",GAME_NOT_WORKING) |
| 210 | 210 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Elektor Junior |
| 4 | 4 | |
| 5 | 5 | 17/07/2009 Skeleton driver. |
| r5932 | r5933 | |
| 14 | 14 | static UINT8 junior_port_a; |
| 15 | 15 | static UINT8 junior_port_b; |
| 16 | 16 | static UINT8 junior_led_time[6]; |
| 17 | ||
| 18 | 17 | |
| 18 | ||
| 19 | 19 | static ADDRESS_MAP_START(junior_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 20 | 20 | ADDRESS_MAP_GLOBAL_MASK(0x1FFF) |
| 21 | 21 | ADDRESS_MAP_UNMAP_HIGH |
| r5932 | r5933 | |
| 163 | 163 | for ( i = 0; i < 6; i++ ) |
| 164 | 164 | { |
| 165 | 165 | if ( junior_led_time[i] ) |
| 166 | junior_led_time[i]--; | |
| 166 | junior_led_time[i]--; | |
| 167 | 167 | else |
| 168 | 168 | output_set_digit_value( i, 0 ); |
| 169 | 169 | } |
| r5932 | r5933 | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
| 180 | static MACHINE_RESET(junior) | |
| 181 | { | |
| 180 | static MACHINE_RESET(junior) | |
| 181 | { | |
| 182 | 182 | int i; |
| 183 | 183 | |
| 184 | 184 | timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, junior_update_leds ); |
| r5932 | r5933 | |
| 198 | 198 | |
| 199 | 199 | MDRV_MACHINE_START( junior ) |
| 200 | 200 | MDRV_MACHINE_RESET(junior) |
| 201 | ||
| 201 | ||
| 202 | 202 | /* video hardware */ |
| 203 | 203 | MDRV_DEFAULT_LAYOUT( layout_junior ) |
| 204 | 204 |
| r5932 | r5933 | |
|---|---|---|
| 19 | 19 | AM_RANGE(0x0000, 0x07ff) AM_ROM // Monitor ROM |
| 20 | 20 | AM_RANGE(0x0800, 0x13ff) AM_ROM // BASIC ROM |
| 21 | 21 | AM_RANGE(0x1400, 0x1bff) AM_RAM // RAM |
| 22 | AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_BASE(&llc_video_ram) // Video RAM | |
| 22 | AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_BASE(&llc_video_ram) // Video RAM | |
| 23 | 23 | AM_RANGE(0x2000, 0xffff) AM_RAM // RAM |
| 24 | 24 | ADDRESS_MAP_END |
| 25 | 25 | |
| 26 | 26 | static ADDRESS_MAP_START( llc1_io, ADDRESS_SPACE_IO, 8 ) |
| 27 | 27 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 28 | ADDRESS_MAP_UNMAP_HIGH | |
| 28 | ADDRESS_MAP_UNMAP_HIGH | |
| 29 | 29 | AM_RANGE(0xEC, 0xEF) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w) |
| 30 | 30 | //AM_RANGE(0xF4, 0xF7) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w) |
| 31 | 31 | AM_RANGE(0xF8, 0xFB) AM_DEVREADWRITE("z80ctc", z80ctc_r, z80ctc_w) |
| r5932 | r5933 | |
| 40 | 40 | |
| 41 | 41 | static ADDRESS_MAP_START( llc2_io, ADDRESS_SPACE_IO, 8 ) |
| 42 | 42 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 43 | ADDRESS_MAP_UNMAP_HIGH | |
| 43 | ADDRESS_MAP_UNMAP_HIGH | |
| 44 | 44 | AM_RANGE(0xE0, 0xE3) AM_WRITE(llc2_rom_disable_w) |
| 45 | 45 | AM_RANGE(0xE8, 0xEB) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w) |
| 46 | 46 | AM_RANGE(0xEC, 0xEC) AM_WRITE(llc2_basic_enable_w) |
| r5932 | r5933 | |
| 59 | 59 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 60 | 60 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 61 | 61 | PORT_START("LINE1") |
| 62 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 63 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 64 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 65 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 66 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 62 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 63 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 64 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 65 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 66 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 67 | 67 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) // Enter |
| 68 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 69 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 68 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 69 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 70 | 70 | PORT_START("LINE2") |
| 71 | 71 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_TILDE) |
| 72 | 72 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_TILDE) |
| 73 | 73 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\"")PORT_CODE(KEYCODE_TILDE) |
| 74 | 74 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_TILDE) |
| 75 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("%") PORT_CODE(KEYCODE_TILDE) | |
| 76 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("&") PORT_CODE(KEYCODE_TILDE) | |
| 77 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_TILDE) | |
| 78 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_TILDE) | |
| 75 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("%") PORT_CODE(KEYCODE_TILDE) | |
| 76 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("&") PORT_CODE(KEYCODE_TILDE) | |
| 77 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_TILDE) | |
| 78 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_TILDE) | |
| 79 | 79 | PORT_START("LINE3") |
| 80 | 80 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 81 | 81 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) |
| r5932 | r5933 | |
| 156 | 156 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') |
| 157 | 157 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 158 | 158 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) // this alone gives nothing and gives ` with Shift! |
| 159 | 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 | |
| 159 | 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 | |
| 160 | 160 | INPUT_PORTS_END |
| 161 | 161 | |
| 162 | 162 | INPUT_PORTS_START( k7659 ) |
| r5932 | r5933 | |
| 169 | 169 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 170 | 170 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) |
| 171 | 171 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) |
| 172 | PORT_START("A2") | |
| 172 | PORT_START("A2") | |
| 173 | 173 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 174 | 174 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) |
| 175 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) | |
| 175 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) | |
| 176 | 176 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 177 | 177 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 178 | 178 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) |
| 179 | 179 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 180 | 180 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) |
| 181 | PORT_START("A3") | |
| 181 | PORT_START("A3") | |
| 182 | 182 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 183 | 183 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| 184 | 184 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) |
| r5932 | r5933 | |
| 196 | 196 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| 197 | 197 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) |
| 198 | 198 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) |
| 199 | PORT_START("A5") | |
| 199 | PORT_START("A5") | |
| 200 | 200 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 201 | 201 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 202 | 202 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) |
| r5932 | r5933 | |
| 223 | 223 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) |
| 224 | 224 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_TILDE) |
| 225 | 225 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("}") PORT_CODE(KEYCODE_TILDE) |
| 226 | PORT_START("A8") | |
| 227 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 228 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 229 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 230 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 231 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 226 | PORT_START("A8") | |
| 227 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 228 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 229 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 230 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 231 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 232 | 232 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 233 | 233 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) |
| 234 | 234 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) |
| 235 | 235 | PORT_START("A9") |
| 236 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) | |
| 236 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) | |
| 237 | 237 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_TILDE) |
| 238 | 238 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_TILDE) |
| 239 | 239 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F01") PORT_CODE(KEYCODE_TILDE) |
| r5932 | r5933 | |
| 250 | 250 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_TILDE) |
| 251 | 251 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F13") PORT_CODE(KEYCODE_TILDE) |
| 252 | 252 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F14") PORT_CODE(KEYCODE_TILDE) |
| 253 | PORT_START("A11") | |
| 254 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F05") PORT_CODE(KEYCODE_TILDE) | |
| 255 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 253 | PORT_START("A11") | |
| 254 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F05") PORT_CODE(KEYCODE_TILDE) | |
| 255 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 256 | 256 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) |
| 257 | 257 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) |
| 258 | 258 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 259 | 259 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 260 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 260 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 261 | 261 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E95") PORT_CODE(KEYCODE_TILDE) |
| 262 | 262 | PORT_START("A12") |
| 263 | 263 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_TILDE) |
| 264 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 265 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 266 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 264 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 265 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 266 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 267 | 267 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_TILDE) |
| 268 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 268 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 269 | 269 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 270 | 270 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 271 | 271 | INPUT_PORTS_END |
| r5932 | r5933 | |
| 284 | 284 | MDRV_CPU_CONFIG(llc1_daisy_chain) |
| 285 | 285 | MDRV_CPU_PROGRAM_MAP(llc1_mem) |
| 286 | 286 | MDRV_CPU_IO_MAP(llc1_io) |
| 287 | ||
| 287 | ||
| 288 | 288 | MDRV_MACHINE_START( llc1 ) |
| 289 | 289 | MDRV_MACHINE_RESET( llc1 ) |
| 290 | 290 | |
| r5932 | r5933 | |
| 299 | 299 | MDRV_PALETTE_INIT(black_and_white) |
| 300 | 300 | |
| 301 | 301 | MDRV_VIDEO_START(llc1) |
| 302 | MDRV_VIDEO_UPDATE(llc1) | |
| 303 | ||
| 304 | MDRV_Z80PIO_ADD( "z80pio", llc1_z80pio_intf ) | |
| 302 | MDRV_VIDEO_UPDATE(llc1) | |
| 303 | ||
| 304 | MDRV_Z80PIO_ADD( "z80pio", llc1_z80pio_intf ) | |
| 305 | 305 | MDRV_Z80CTC_ADD( "z80ctc", XTAL_3MHz, llc1_ctc_intf ) |
| 306 | 306 | MACHINE_DRIVER_END |
| 307 | 307 | |
| r5932 | r5933 | |
| 310 | 310 | MDRV_CPU_ADD("maincpu", Z80, XTAL_3MHz) |
| 311 | 311 | MDRV_CPU_PROGRAM_MAP(llc2_mem) |
| 312 | 312 | MDRV_CPU_IO_MAP(llc2_io) |
| 313 | ||
| 313 | ||
| 314 | 314 | MDRV_MACHINE_RESET( llc2 ) |
| 315 | 315 | |
| 316 | 316 | /* video hardware */ |
| r5932 | r5933 | |
| 324 | 324 | MDRV_PALETTE_INIT(black_and_white) |
| 325 | 325 | |
| 326 | 326 | MDRV_VIDEO_START(llc2) |
| 327 | MDRV_VIDEO_UPDATE(llc2) | |
| 328 | ||
| 329 | MDRV_Z80PIO_ADD( "z80pio", llc2_z80pio_intf ) | |
| 327 | MDRV_VIDEO_UPDATE(llc2) | |
| 328 | ||
| 329 | MDRV_Z80PIO_ADD( "z80pio", llc2_z80pio_intf ) | |
| 330 | 330 | MDRV_Z80CTC_ADD( "z80ctc", XTAL_3MHz, llc2_ctc_intf ) |
| 331 | 331 | MACHINE_DRIVER_END |
| 332 | 332 | /* ROM definition */ |
| r5932 | r5933 | |
| 350 | 350 | ROM_REGION(0x0800, "k7659",0) |
| 351 | 351 | ROM_LOAD ("k7659n.bin", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) |
| 352 | 352 | ROM_END |
| 353 | ||
| 353 | ||
| 354 | 354 | static SYSTEM_CONFIG_START(llc2) |
| 355 | 355 | CONFIG_RAM_DEFAULT(64 * 1024) |
| 356 | 356 | SYSTEM_CONFIG_END |
| 357 | 357 | |
| 358 | 358 | /* Driver */ |
| 359 | 359 | |
| 360 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME | |
| 360 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 361 | 361 | COMP( 1984, llc1, 0, 0, llc1, llc1, llc1, 0, "", "LLC-1", GAME_NOT_WORKING) |
| 362 | 362 | COMP( 1984, llc2, llc1, 0, llc2, k7659, llc2, llc2, "", "LLC-2", 0) |
| r5932 | r5933 | |
|---|---|---|
| 379 | 379 | load_cpe( cpu, exe_buffer, exe_size ) || |
| 380 | 380 | load_psf( cpu, exe_buffer, exe_size ) ) |
| 381 | 381 | { |
| 382 | /* | |
| 382 | /* DEBUGGER_BREAK; */ | |
| 383 | 383 | |
| 384 | 384 | address = cpu_get_reg( cpu, PSXCPU_PC ); |
| 385 | 385 | } |
| r5932 | r5933 | |
|---|---|---|
| 546 | 546 | SECTORS(1-[10]-12) |
| 547 | 547 | SECTOR_LENGTH(128/256/[512]/1024) |
| 548 | 548 | FIRST_SECTOR_ID([1]) |
| 549 | ) | |
| 549 | ) | |
| 550 | 550 | FLOPPY_OPTIONS_END |
| 551 | 551 | |
| 552 | 552 | static const floppy_config samcoupe_floppy_config = |
| r5932 | r5933 | |
| 589 | 589 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 590 | 590 | MDRV_SOUND_ADD("saa1099", SAA1099, SAMCOUPE_XTAL_X1/3) /* 8 MHz */ |
| 591 | 591 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 592 | ||
| 592 | ||
| 593 | 593 | MDRV_FLOPPY_2_DRIVES_ADD(samcoupe_floppy_config) |
| 594 | 594 | MACHINE_DRIVER_END |
| 595 | 595 |
| r5932 | r5933 | |
|---|---|---|
| 78 | 78 | *** $0000-$7FFF is the 32K BIOS *** |
| 79 | 79 | it is also possible to replace the BIOS with an external ROM (see $E000 range) |
| 80 | 80 | |
| 81 | 0000 | |
| 81 | 0000 | |
| 82 | 82 | reset vector (level 0) |
| 83 | 83 | 0000-0001: WP 0002-0003: PC (%) |
| 84 | 84 | 0004 |
| r5932 | r5933 | |
| 88 | 88 | additional vectors |
| 89 | 89 | 0040 |
| 90 | 90 | XOP vectors (%) |
| 91 | The BIOS doesn't seem to use these for XOPs. | |
| 92 | Instead, this is a branch table. | |
| 91 | The BIOS doesn't seem to use these for XOPs. | |
| 92 | Instead, this is a branch table. | |
| 93 | 93 | 0080 |
| 94 | BIOS code | |
| 95 | (CRU only: $1EE0-FE: 9995 flag register; | |
| 96 | $1FDA: MID flag) | |
| 94 | BIOS code | |
| 95 | (CRU only: $1EE0-FE: 9995 flag register; | |
| 96 | $1FDA: MID flag) | |
| 97 | 97 | 4000 |
| 98 | GBASIC | |
| 99 | (on the American v2.3 firmware, the GPL | |
| 100 | interpreter and VDP RAMLUT co-exist | |
| 101 | with GBASIC in this range) | |
| 98 | GBASIC | |
| 99 | (on the American v2.3 firmware, the GPL | |
| 100 | interpreter and VDP RAMLUT co-exist | |
| 101 | with GBASIC in this range) | |
| 102 | 102 | |
| 103 | 103 | *** $8000-$BFFF is the 16K option ROM area *** |
| 104 | 104 | |
| 105 | 105 | 8000 |
| 106 | BASIC (Tutor only) and/or cartridge ROM | |
| 107 | (controlled by $E100) | |
| 108 | To be recognized, a cartridge must have a | |
| 109 | $55, $66 or $aa header sequence. | |
| 106 | BASIC (Tutor only) and/or cartridge ROM | |
| 107 | (controlled by $E100) | |
| 108 | To be recognized, a cartridge must have a | |
| 109 | $55, $66 or $aa header sequence. | |
| 110 | 110 | |
| 111 | 111 | *** end ROM *** |
| 112 | 112 | C000 |
| 113 | ||
| 113 | unmapped (possible use in 24K cartridges) | |
| 114 | 114 | E000 |
| 115 | I/O range | |
| 116 | --------- | |
| 117 | 9918A VDP data/register ports: $E000, E002 | |
| 118 | "MMU" banking controls: $E100-E1FF | |
| 119 | $E100 write: enable cartridge, disable | |
| 120 | BIOS at $0000 (???) -- magic | |
| 121 | required at $E110 for this | |
| 122 | $E108 write: enable BASIC ROM, disable | |
| 123 | cartridge at $8000 | |
| 124 | $E10C write: enable cartridge, disable | |
| 125 | BASIC ROM at $8000 | |
| 126 | $E110 must be $42 to enable $E100 | |
| 127 | and to replace the BIOS with | |
| 128 | an installed cartridge ROM. | |
| 129 | BLWP assumed at $0000 (??). | |
| 130 | SN76489AN sound data port: $E200 | |
| 131 | Device handshaking: $E600 | |
| 132 | Unknown purpose, disk drive maybe? | |
| 133 | Printer handshaking: $E800 | |
| 134 | This is a standard Centronics port. | |
| 135 | $E810 write: parallel data bus | |
| 136 | $E820 read: parallel port busy | |
| 137 | $E840 write: port handshake output | |
| 138 | Keyboard lines: $EC00-$EC7E (*CRU*) | |
| 139 | (CRU physical address $7600-$763F) | |
| 140 | Cassette lines: $ED00-$EEFF | |
| 141 | $ED00 (*CRU*): input level | |
| 142 | (physical address $7680) | |
| 143 | $EE00 write: tape output zero | |
| 144 | $EE20 write: tape output one | |
| 145 | $EE40 write: tape IRQ on | |
| 146 | $EE60 write: tape IRQ off | |
| 147 | $EE80, A0, C0, E0: ??? | |
| 148 | ||
| 115 | I/O range | |
| 116 | --------- | |
| 117 | 9918A VDP data/register ports: $E000, E002 | |
| 118 | "MMU" banking controls: $E100-E1FF | |
| 119 | $E100 write: enable cartridge, disable | |
| 120 | BIOS at $0000 (???) -- magic | |
| 121 | required at $E110 for this | |
| 122 | $E108 write: enable BASIC ROM, disable | |
| 123 | cartridge at $8000 | |
| 124 | $E10C write: enable cartridge, disable | |
| 125 | BASIC ROM at $8000 | |
| 126 | $E110 must be $42 to enable $E100 | |
| 127 | and to replace the BIOS with | |
| 128 | an installed cartridge ROM. | |
| 129 | BLWP assumed at $0000 (??). | |
| 130 | SN76489AN sound data port: $E200 | |
| 131 | Device handshaking: $E600 | |
| 132 | Unknown purpose, disk drive maybe? | |
| 133 | Printer handshaking: $E800 | |
| 134 | This is a standard Centronics port. | |
| 135 | $E810 write: parallel data bus | |
| 136 | $E820 read: parallel port busy | |
| 137 | $E840 write: port handshake output | |
| 138 | Keyboard lines: $EC00-$EC7E (*CRU*) | |
| 139 | (CRU physical address $7600-$763F) | |
| 140 | Cassette lines: $ED00-$EEFF | |
| 141 | $ED00 (*CRU*): input level | |
| 142 | (physical address $7680) | |
| 143 | $EE00 write: tape output zero | |
| 144 | $EE20 write: tape output one | |
| 145 | $EE40 write: tape IRQ on | |
| 146 | $EE60 write: tape IRQ off | |
| 147 | $EE80, A0, C0, E0: ??? | |
| 148 | ||
| 149 | 149 | F000 |
| 150 | 150 | TMS9995 RAM (*) |
| 151 | 151 | F0FC |
| r5932 | r5933 | |
| 411 | 411 | switch (offset) |
| 412 | 412 | { |
| 413 | 413 | case 0x20: |
| 414 | /* busy */ | |
| 414 | /* busy */ | |
| 415 | 415 | reply = centronics_busy_r(device) ? 0x00 : 0xff; |
| 416 | 416 | break; |
| 417 | 417 | |
| r5932 | r5933 | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | static WRITE8_DEVICE_HANDLER(tutor_printer_w) |
| 429 | { | |
| 429 | { | |
| 430 | 430 | switch (offset) |
| 431 | 431 | { |
| 432 | 432 | case 0x10: |
| r5932 | r5933 | |
| 521 | 521 | AM_RANGE(0xed0, 0xed0) AM_READ(tutor_cassette_r) /*cassette interface*/ |
| 522 | 522 | ADDRESS_MAP_END |
| 523 | 523 | |
| 524 | /* tutor keyboard: 56 keys | |
| 524 | /* tutor keyboard: 56 keys | |
| 525 | 525 | |
| 526 | 2008-05 FP: | |
| 526 | 2008-05 FP: | |
| 527 | 527 | Small note about natural keyboard support: currently, |
| 528 | 528 | - "MON" is mapped to 'F1' |
| 529 | 529 | - "MOD" is mapped to 'F2' |
| r5932 | r5933 | |
| 677 | 677 | MDRV_CARTSLOT_NOT_MANDATORY |
| 678 | 678 | MDRV_CARTSLOT_LOAD(tutor_cart) |
| 679 | 679 | MDRV_CARTSLOT_UNLOAD(tutor_cart) |
| 680 | ||
| 680 | ||
| 681 | 681 | MDRV_CENTRONICS_ADD("printer", standard_centronics) |
| 682 | 682 | MACHINE_DRIVER_END |
| 683 | 683 |
| r5932 | r5933 | |
|---|---|---|
| 16 | 16 | static ADDRESS_MAP_START(z1013_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 17 | 17 | AM_RANGE( 0x0000, 0xefff ) AM_RAM |
| 18 | 18 | AM_RANGE( 0xec00, 0xefff ) AM_RAM AM_BASE(&z1013_video_ram) |
| 19 | AM_RANGE( 0xf000, 0xffff ) AM_ROM // ROM | |
| 19 | AM_RANGE( 0xf000, 0xffff ) AM_ROM // ROM | |
| 20 | 20 | ADDRESS_MAP_END |
| 21 | 21 | |
| 22 | 22 | static ADDRESS_MAP_START( z1013_io, ADDRESS_SPACE_IO, 8 ) |
| r5932 | r5933 | |
| 31 | 31 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TAB) |
| 32 | 32 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 33 | 33 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 34 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_LSHIFT) | |
| 34 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S1") PORT_CODE(KEYCODE_LSHIFT) | |
| 35 | 35 | PORT_START("LINE1") |
| 36 | 36 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 37 | 37 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| r5932 | r5933 | |
| 63 | 63 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) |
| 64 | 64 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 65 | 65 | PORT_START("LINE7") |
| 66 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 66 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) | |
| 67 | 67 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 68 | 68 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 69 | 69 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER) |
| 70 | 70 | INPUT_PORTS_END |
| 71 | ||
| 71 | ||
| 72 | 72 | static INPUT_PORTS_START( z1013_8x8 ) |
| 73 | 73 | PORT_START("LINE0") |
| 74 | 74 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 75 | 75 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| 76 | 76 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 77 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) | |
| 77 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) | |
| 78 | 78 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 79 | 79 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 80 | 80 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) |
| 81 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) | |
| 81 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) | |
| 82 | 82 | PORT_START("LINE1") |
| 83 | 83 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 84 | 84 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) |
| r5932 | r5933 | |
| 87 | 87 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 88 | 88 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) |
| 89 | 89 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 90 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) | |
| 90 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) | |
| 91 | 91 | PORT_START("LINE2") |
| 92 | 92 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 93 | 93 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| r5932 | r5933 | |
| 96 | 96 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 97 | 97 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) |
| 98 | 98 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 99 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_V) | |
| 99 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_V) | |
| 100 | 100 | PORT_START("LINE3") |
| 101 | 101 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| 102 | 102 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) |
| 103 | 103 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) |
| 104 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) | |
| 104 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) | |
| 105 | 105 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 106 | 106 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| 107 | 107 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) |
| 108 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 108 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 109 | 109 | PORT_START("LINE4") |
| 110 | 110 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 111 | 111 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| r5932 | r5933 | |
| 114 | 114 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| 115 | 115 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 116 | 116 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_COLON) |
| 117 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 117 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 118 | 118 | PORT_START("LINE5") |
| 119 | 119 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS) |
| 120 | 120 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) |
| r5932 | r5933 | |
| 123 | 123 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) |
| 124 | 124 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 125 | 125 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) |
| 126 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS) | |
| 126 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS) | |
| 127 | 127 | PORT_START("LINE6") |
| 128 | 128 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) |
| 129 | 129 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER) |
| r5932 | r5933 | |
| 133 | 133 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 134 | 134 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) |
| 135 | 135 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) |
| 136 | PORT_START("LINE7") | |
| 136 | PORT_START("LINE7") | |
| 137 | 137 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) |
| 138 | 138 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) |
| 139 | 139 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) |
| r5932 | r5933 | |
| 152 | 152 | MDRV_CPU_ADD("maincpu", Z80, XTAL_1MHz ) |
| 153 | 153 | MDRV_CPU_PROGRAM_MAP(z1013_mem) |
| 154 | 154 | MDRV_CPU_IO_MAP(z1013_io) |
| 155 | ||
| 155 | ||
| 156 | 156 | MDRV_MACHINE_RESET( z1013 ) |
| 157 | 157 | |
| 158 | 158 | /* video hardware */ |
| r5932 | r5933 | |
| 167 | 167 | MDRV_PALETTE_INIT(black_and_white) |
| 168 | 168 | |
| 169 | 169 | MDRV_VIDEO_START(z1013) |
| 170 | MDRV_VIDEO_UPDATE(z1013) | |
| 171 | ||
| 170 | MDRV_VIDEO_UPDATE(z1013) | |
| 171 | ||
| 172 | 172 | MDRV_Z80PIO_ADD( "z80pio", z1013_z80pio_intf ) |
| 173 | ||
| 173 | ||
| 174 | 174 | /* snapshot */ |
| 175 | 175 | MDRV_SNAPSHOT_ADD("snapshot", z1013, "z80", 0) |
| 176 | 176 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
| 187 | 187 | ROM_SYSTEM_BIOS( 0, "202", "Original" ) |
| 188 | 188 | ROMX_LOAD( "mon_202.bin", 0xf000, 0x0800, CRC(5884edab) SHA1(c3a45ea5cc4da2b7c270068ba1e2d75916960709), ROM_BIOS(1)) |
| 189 | 189 | ROM_SYSTEM_BIOS( 1, "jm", "Jens Muller version" ) |
| 190 | ROMX_LOAD( "mon_jm_1992.bin", 0xf000, 0x0800, CRC(186d2888) SHA1(b52ccb557c41c96bace7db4c4f5031a0cd736168), ROM_BIOS(2)) | |
| 190 | ROMX_LOAD( "mon_jm_1992.bin", 0xf000, 0x0800, CRC(186d2888) SHA1(b52ccb557c41c96bace7db4c4f5031a0cd736168), ROM_BIOS(2)) | |
| 191 | 191 | ROM_REGION(0x1000, "gfx1",0) |
| 192 | 192 | ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) |
| 193 | 193 | ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) |
| r5932 | r5933 | |
| 195 | 195 | |
| 196 | 196 | ROM_START( z1013a2 ) |
| 197 | 197 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 198 | ROM_LOAD( "mon_a2.bin", 0xf000, 0x0800, CRC(98b19b10) SHA1(97e158f589198cb96aae1567ee0aa6e47824027e)) | |
| 198 | ROM_LOAD( "mon_a2.bin", 0xf000, 0x0800, CRC(98b19b10) SHA1(97e158f589198cb96aae1567ee0aa6e47824027e)) | |
| 199 | 199 | ROM_REGION(0x1000, "gfx1",0) |
| 200 | 200 | ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) |
| 201 | 201 | ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) |
| r5932 | r5933 | |
| 203 | 203 | |
| 204 | 204 | ROM_START( z1013k76 ) |
| 205 | 205 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 206 | ROM_LOAD( "mon_rb_k7659.bin", 0xf000, 0x1000, CRC(b3d88c45) SHA1(0bcd20338cf0706b384f40901b7f8498c6f6c320)) | |
| 206 | ROM_LOAD( "mon_rb_k7659.bin", 0xf000, 0x1000, CRC(b3d88c45) SHA1(0bcd20338cf0706b384f40901b7f8498c6f6c320)) | |
| 207 | 207 | ROM_REGION(0x1000, "gfx1",0) |
| 208 | 208 | ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) |
| 209 | 209 | ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) |
| 210 | 210 | ROM_REGION(0x1000, "k7659",0) |
| 211 | ROM_LOAD ("k7659n.bin", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) | |
| 211 | ROM_LOAD ("k7659n.bin", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) | |
| 212 | 212 | ROM_END |
| 213 | 213 | |
| 214 | 214 | ROM_START( z1013s60 ) |
| 215 | 215 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 216 | 216 | ROM_SYSTEM_BIOS( 0, "v1", "Version 1" ) |
| 217 | ROMX_LOAD( "mon_rb_s6009.bin", 0xf000, 0x1000, CRC(b37faeed) SHA1(ce2e69af5378d39284e8b3be23da50416a0b0fbe), ROM_BIOS(1)) | |
| 217 | ROMX_LOAD( "mon_rb_s6009.bin", 0xf000, 0x1000, CRC(b37faeed) SHA1(ce2e69af5378d39284e8b3be23da50416a0b0fbe), ROM_BIOS(1)) | |
| 218 | 218 | ROM_SYSTEM_BIOS( 1, "v2", "Version 2" ) |
| 219 | ROMX_LOAD( "4k-moni-k7652.bin", 0xf000, 0x1000, CRC(a1625fce) SHA1(f0847399502b38a73ad26b38ee2d85ba04ab85ec), ROM_BIOS(2)) | |
| 219 | ROMX_LOAD( "4k-moni-k7652.bin", 0xf000, 0x1000, CRC(a1625fce) SHA1(f0847399502b38a73ad26b38ee2d85ba04ab85ec), ROM_BIOS(2)) | |
| 220 | 220 | ROM_REGION(0x1000, "gfx1",0) |
| 221 | 221 | ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) |
| 222 | 222 | ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) |
| r5932 | r5933 | |
| 224 | 224 | |
| 225 | 225 | ROM_START( z1013k69 ) |
| 226 | 226 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 227 | ROM_LOAD( "4k-moni-k7669.bin", 0xf000, 0x1000, CRC(09cd2a7a) SHA1(0b8500320d464469868a6b48db31105f34710c41)) | |
| 227 | ROM_LOAD( "4k-moni-k7669.bin", 0xf000, 0x1000, CRC(09cd2a7a) SHA1(0b8500320d464469868a6b48db31105f34710c41)) | |
| 228 | 228 | ROM_REGION(0x1000, "gfx1",0) |
| 229 | 229 | ROM_LOAD ("z1013font.bin", 0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c)) |
| 230 | 230 | ROM_LOAD ("altfont.bin", 0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979)) |
| 231 | 231 | ROM_END |
| 232 | 232 | /* Driver */ |
| 233 | 233 | |
| 234 | /* YEAR NAME PARENT COMPAT MACHINE | |
| 234 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 235 | 235 | COMP( 1985, z1013, 0, 0, z1013, z1013_8x4, z1013, 0, "VEB Robotron Electronics Riesa", "Z1013 (matrix 8x4)", 0) |
| 236 | 236 | COMP( 1985, z1013a2, z1013, 0, z1013, z1013_8x8, z1013, 0, "VEB Robotron Electronics Riesa", "Z1013 (matrix 8x8)", 0) |
| 237 | 237 | COMP( 1985, z1013k76, z1013, 0, z1013k76, k7659, z1013, 0, "VEB Robotron Electronics Riesa", "Z1013 (K7659)", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | TODO: | |
| 4 | 4 | |
| 5 | - unreliable DOS commands? | |
| 6 | - tape input/output | |
| 7 | - PL-80 plotter | |
| 8 | - serial printer | |
| 9 | - thermal printer | |
| 5 | - unreliable DOS commands? | |
| 6 | - tape input/output | |
| 7 | - PL-80 plotter | |
| 8 | - serial printer | |
| 9 | - thermal printer | |
| 10 | 10 | |
| 11 | 11 | */ |
| 12 | 12 | |
| r5932 | r5933 | |
| 71 | 71 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 72 | 72 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 73 | 73 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 74 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(' | |
| 74 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('?') | |
| 75 | 75 | |
| 76 | 76 | PORT_START("D2") |
| 77 | 77 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('[') |
| r5932 | r5933 | |
| 386 | 386 | |
| 387 | 387 | /* peripheral hardware */ |
| 388 | 388 | MDRV_CDP1871_ADD(CDP1871_TAG, comx35_cdp1871_intf, CDP1869_CPU_CLK_PAL / 8) |
| 389 | MDRV_WD1770_ADD(WD1770_TAG, comx35_wd17xx_interface ) | |
| 389 | MDRV_WD1770_ADD(WD1770_TAG, comx35_wd17xx_interface ) | |
| 390 | 390 | MDRV_QUICKLOAD_ADD("quickload", comx35, "comx", 0) |
| 391 | 391 | MDRV_CASSETTE_ADD(CASSETTE_TAG, comx35_cassette_config) |
| 392 | 392 | MDRV_PRINTER_ADD("printer") |
| 393 | ||
| 393 | ||
| 394 | 394 | MDRV_FLOPPY_2_DRIVES_ADD(comx35_floppy_config) |
| 395 | 395 | MACHINE_DRIVER_END |
| 396 | 396 | |
| r5932 | r5933 | |
| 411 | 411 | |
| 412 | 412 | /* peripheral hardware */ |
| 413 | 413 | MDRV_CDP1871_ADD(CDP1871_TAG, comx35_cdp1871_intf, CDP1869_CPU_CLK_NTSC / 8) |
| 414 | MDRV_WD1770_ADD(WD1770_TAG, comx35_wd17xx_interface ) | |
| 414 | MDRV_WD1770_ADD(WD1770_TAG, comx35_wd17xx_interface ) | |
| 415 | 415 | MDRV_QUICKLOAD_ADD("quickload", comx35, "comx", 0) |
| 416 | 416 | MDRV_CASSETTE_ADD(CASSETTE_TAG, comx35_cassette_config) |
| 417 | 417 | MDRV_PRINTER_ADD("printer") |
| 418 | ||
| 418 | ||
| 419 | 419 | MDRV_FLOPPY_2_DRIVES_ADD(comx35_floppy_config) |
| 420 | 420 | MACHINE_DRIVER_END |
| 421 | 421 | |
| r5932 | r5933 | |
| 467 | 467 | |
| 468 | 468 | /* System Drivers */ |
| 469 | 469 | |
| 470 | // YEAR NAME | |
| 470 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS | |
| 471 | 471 | COMP( 1983, comx35p, 0, 0, comx35_pal, comx35, 0, comx35, "Comx World Operations Ltd", "COMX 35 (PAL)", GAME_IMPERFECT_SOUND ) |
| 472 | 472 | COMP( 1983, comx35n, comx35p,0, comx35_ntsc,comx35, 0, comx35, "Comx World Operations Ltd", "COMX 35 (NTSC)", GAME_IMPERFECT_SOUND ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Jugend+Technik CompJU+TEr |
| 4 | 4 | |
| 5 | 5 | 15/07/2009 Skeleton driver. |
| r5932 | r5933 | |
| 20 | 20 | { |
| 21 | 21 | /* |
| 22 | 22 | |
| 23 | ||
| 23 | bit description | |
| 24 | 24 | |
| 25 | P20 | |
| 26 | P21 | |
| 27 | P22 | |
| 28 | P23 | |
| 29 | P24 | |
| 30 | P25 centronics strobe output | |
| 31 | P26 V4093 pins 1,2 | |
| 32 | P27 DL299 pin 18 | |
| 25 | P20 | |
| 26 | P21 | |
| 27 | P22 | |
| 28 | P23 | |
| 29 | P24 | |
| 30 | P25 centronics strobe output | |
| 31 | P26 V4093 pins 1,2 | |
| 32 | P27 DL299 pin 18 | |
| 33 | 33 | |
| 34 | ||
| 34 | */ | |
| 35 | 35 | |
| 36 | 36 | jtc_state *state = space->machine->driver_data; |
| 37 | 37 | |
| r5932 | r5933 | |
| 42 | 42 | { |
| 43 | 43 | /* |
| 44 | 44 | |
| 45 | ||
| 45 | bit description | |
| 46 | 46 | |
| 47 | P30 tape input | |
| 48 | P31 | |
| 49 | P32 | |
| 50 | P33 centronics busy input | |
| 51 | P34 | |
| 52 | P35 | |
| 53 | P36 tape output | |
| 54 | P37 speaker output | |
| 47 | P30 tape input | |
| 48 | P31 | |
| 49 | P32 | |
| 50 | P33 centronics busy input | |
| 51 | P34 | |
| 52 | P35 | |
| 53 | P36 tape output | |
| 54 | P37 speaker output | |
| 55 | 55 | |
| 56 | ||
| 56 | */ | |
| 57 | 57 | |
| 58 | 58 | jtc_state *state = space->machine->driver_data; |
| 59 | 59 | |
| 60 | 60 | UINT8 data = 0; |
| 61 | 61 | |
| 62 | data |= (cassette_input(state->cassette) < 0.0) ? 1 : 0; | |
| 62 | data |= (cassette_input(state->cassette) < 0.0) ? 1 : 0; | |
| 63 | 63 | data |= centronics_busy_r(state->centronics) << 3; |
| 64 | 64 | |
| 65 | 65 | return data; |
| r5932 | r5933 | |
| 69 | 69 | { |
| 70 | 70 | /* |
| 71 | 71 | |
| 72 | ||
| 72 | bit description | |
| 73 | 73 | |
| 74 | P30 tape input | |
| 75 | P31 | |
| 76 | P32 | |
| 77 | P33 centronics busy input | |
| 78 | P34 | |
| 79 | P35 | |
| 80 | P36 tape output | |
| 81 | P37 speaker output | |
| 74 | P30 tape input | |
| 75 | P31 | |
| 76 | P32 | |
| 77 | P33 centronics busy input | |
| 78 | P34 | |
| 79 | P35 | |
| 80 | P36 tape output | |
| 81 | P37 speaker output | |
| 82 | 82 | |
| 83 | ||
| 83 | */ | |
| 84 | 84 | |
| 85 | 85 | jtc_state *state = space->machine->driver_data; |
| 86 | 86 | |
| r5932 | r5933 | |
| 246 | 246 | |
| 247 | 247 | PORT_START("Y5") |
| 248 | 248 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 249 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR(' | |
| 249 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('?') | |
| 250 | 250 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 251 | 251 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 252 | 252 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| r5932 | r5933 | |
| 608 | 608 | |
| 609 | 609 | /* Machine Initialization */ |
| 610 | 610 | |
| 611 | static MACHINE_START( jtc ) | |
| 611 | static MACHINE_START( jtc ) | |
| 612 | 612 | { |
| 613 | 613 | jtc_state *state = machine->driver_data; |
| 614 | 614 | |
| r5932 | r5933 | |
| 636 | 636 | /* basic machine hardware */ |
| 637 | 637 | MDRV_CPU_ADD(UB8830D_TAG, UB8830D, XTAL_8MHz) |
| 638 | 638 | MDRV_CPU_PROGRAM_MAP(jtc_mem) |
| 639 | MDRV_CPU_IO_MAP(jtc_io) | |
| 639 | MDRV_CPU_IO_MAP(jtc_io) | |
| 640 | 640 | |
| 641 | 641 | MDRV_MACHINE_START(jtc) |
| 642 | ||
| 642 | ||
| 643 | 643 | /* sound hardware */ |
| 644 | 644 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 645 | 645 | MDRV_SOUND_ADD(SPEAKER_TAG, SPEAKER, 0) |
| r5932 | r5933 | |
| 657 | 657 | |
| 658 | 658 | static MACHINE_DRIVER_START( jtc ) |
| 659 | 659 | MDRV_IMPORT_FROM(basic) |
| 660 | ||
| 660 | ||
| 661 | 661 | /* video hardware */ |
| 662 | 662 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 663 | 663 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 686 | 686 | /* basic machine hardware */ |
| 687 | 687 | MDRV_CPU_MODIFY(UB8830D_TAG) |
| 688 | 688 | MDRV_CPU_PROGRAM_MAP(jtc_es23_mem) |
| 689 | ||
| 689 | ||
| 690 | 690 | /* video hardware */ |
| 691 | 691 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 692 | 692 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 707 | 707 | /* basic machine hardware */ |
| 708 | 708 | MDRV_CPU_MODIFY(UB8830D_TAG) |
| 709 | 709 | MDRV_CPU_PROGRAM_MAP(jtc_es40_mem) |
| 710 | ||
| 710 | ||
| 711 | 711 | /* video hardware */ |
| 712 | 712 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 713 | 713 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 772 | 772 | |
| 773 | 773 | /* System Drivers */ |
| 774 | 774 | |
| 775 | /* YEAR | |
| 775 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 776 | 776 | COMP( 1987, jtc, 0, 0, jtc, jtc, 0, jtc, "Jugend+Technik", "CompJU+TEr", GAME_NOT_WORKING ) |
| 777 | 777 | COMP( 1988, jtces88, jtc, 0, jtces88,jtc, 0, jtces88, "Jugend+Technik", "CompJU+TEr (EMR-ES 1988)", GAME_NOT_WORKING ) |
| 778 | 778 | COMP( 1989, jtces23, jtc, 0, jtces23,jtces23, 0, jtces23, "Jugend+Technik", "CompJU+TEr (ES 2.3)", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 39 | 39 | It is assumed that the TRS80L2 UART setup is identical to the System80, apart from the address ports used. |
| 40 | 40 | Due to the above, the only working emulated UART is for the Model 3. |
| 41 | 41 | |
| 42 | Cassette baud rates: Model I level I - 250 baud | |
| 43 | Model I level II and all clones - 500 baud | |
| 44 | Model III/4 - 500 and 1500 baud selectable at boot time | |
| 45 | - When it says "Cass?" press L for 500 baud, or Enter otherwise. | |
| 46 | LNW-80 - 500 baud @1.77MHz and 1000 baud @4MHz. | |
| 42 | Cassette baud rates: Model I level I - 250 baud | |
| 43 | Model I level II and all clones - 500 baud | |
| 44 | Model III/4 - 500 and 1500 baud selectable at boot time | |
| 45 | - When it says "Cass?" press L for 500 baud, or Enter otherwise. | |
| 46 | LNW-80 - 500 baud @1.77MHz and 1000 baud @4MHz. | |
| 47 | 47 | |
| 48 | 48 | I/O ports |
| 49 | 49 | FF: |
| r5932 | r5933 | |
| 86 | 86 | - UART Master Reset (write) on a Model III/4 |
| 87 | 87 | |
| 88 | 88 | Model 4 - C0-CF = hard drive (optional) |
| 89 | - 90-93 write sound (optional) | |
| 90 | - 80-8F hires graphics (optional) | |
| 89 | - 90-93 write sound (optional) | |
| 90 | - 80-8F hires graphics (optional) | |
| 91 | 91 | |
| 92 | 92 | About the Model II - this runs a boostrap rom, and boots a floppy. The rom is then bankswitched |
| 93 | 93 | out, and RAM takes its place. There is no rom basic, and no cassette support. Display sizes are |
| r5932 | r5933 | |
| 96 | 96 | It was extremely expensive, non-standard, and not many were sold. A rom dump does not seem to exist. |
| 97 | 97 | |
| 98 | 98 | About the ht1080z - This was made for schools in Hungary. Each comes with a BASIC extension roms |
| 99 | which activated Hungarian features. To activate - start emulation - enter SYSTEM | |
| 100 | Enter /12288 and the extensions will be installed and you are returned to READY. | |
| 101 | The ht1080z is identical to the System 80, apart from the character rom. | |
| 102 | The ht1080z2 has a modified extension rom and character generator. | |
| 99 | which activated Hungarian features. To activate - start emulation - enter SYSTEM | |
| 100 | Enter /12288 and the extensions will be installed and you are returned to READY. | |
| 101 | The ht1080z is identical to the System 80, apart from the character rom. | |
| 102 | The ht1080z2 has a modified extension rom and character generator. | |
| 103 | 103 | |
| 104 | 104 | About the RTC - The time is incremented while ever the cursor is flashing. It is stored in a series |
| 105 | of bytes in the computer's work area. The bytes are in a certain order, this is: | |
| 106 | seconds, minutes, hours, year, day, month. On a model 1, the seconds are stored at | |
| 107 | 0x4041, while on the model 4 it is 0x4217. A reboot always sets the time to zero. | |
| 105 | of bytes in the computer's work area. The bytes are in a certain order, this is: | |
| 106 | seconds, minutes, hours, year, day, month. On a model 1, the seconds are stored at | |
| 107 | 0x4041, while on the model 4 it is 0x4217. A reboot always sets the time to zero. | |
| 108 | 108 | |
| 109 | 109 | Model 4 memory organisation - |
| 110 | Mode 0: ROM=0-37E7 and 37EA-3FFF; Printer=37E8-37E9; Keyboard=3800-3BFF; Video=3C00-3FFF | |
| 111 | Mode 1: Keyboard and Video as above; 0-3FFF read=ROM and write=RAM | |
| 112 | Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM | |
| 113 | Mode 3: All RAM | |
| 114 | In the "maincpu" memory map, the first 64k is given to the ROM, keyboard, printer and video, | |
| 115 | while the second 64k is RAM that is switched in as needed. The area from 4800-FFFF | |
| 116 | is considered a "black hole", any writes to there will disappear. | |
| 117 | The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous. | |
| 110 | Mode 0: ROM=0-37E7 and 37EA-3FFF; Printer=37E8-37E9; Keyboard=3800-3BFF; Video=3C00-3FFF | |
| 111 | Mode 1: Keyboard and Video as above; 0-3FFF read=ROM and write=RAM | |
| 112 | Mode 2: Keyboard=F400-F7FF; Video=F800-FFFF; the rest is RAM | |
| 113 | Mode 3: All RAM | |
| 114 | In the "maincpu" memory map, the first 64k is given to the ROM, keyboard, printer and video, | |
| 115 | while the second 64k is RAM that is switched in as needed. The area from 4800-FFFF | |
| 116 | is considered a "black hole", any writes to there will disappear. | |
| 117 | The video is organised as 2 banks of 0x400 bytes, except in Mode 2 where it becomes contiguous. | |
| 118 | 118 | |
| 119 | 119 | Model 4P - is the same as Model 4 except: |
| 120 | - ROM is only 0000-0FFF, while 1000-37FF is given over to RAM | |
| 121 | - There is no cassette support in hardware. | |
| 120 | - ROM is only 0000-0FFF, while 1000-37FF is given over to RAM | |
| 121 | - There is no cassette support in hardware. | |
| 122 | 122 | |
| 123 | 123 | *************************************************************************** |
| 124 | 124 | |
| r5932 | r5933 | |
| 305 | 305 | +--+---+---+---+---+---+---+---+---+ +--+---+---+---+---+---+---+---+---+ |
| 306 | 306 | NB: row 7 contains some originally unused bits |
| 307 | 307 | only the shift bit was there in the TRS80 |
| 308 | ||
| 309 | 2008-05 FP: | |
| 310 | NB2: 3:3 -> 3:7 have no correspondent keys (see | |
| 311 | below) in the usual 53-keys keyboard ( + | |
| 312 | 12-keys keypad) for Model I, III and 4. Where | |
| 313 | are the symbols above coming from? | |
| 314 | NB3: the 12-keys keypad present in later models | |
| 315 | is mapped to the corrispondent keys of the | |
| 316 | keyboard: '0' -> '9', 'Enter', '.' | |
| 308 | ||
| 309 | 2008-05 FP: | |
| 310 | NB2: 3:3 -> 3:7 have no correspondent keys (see | |
| 311 | below) in the usual 53-keys keyboard ( + | |
| 312 | 12-keys keypad) for Model I, III and 4. Where | |
| 313 | are the symbols above coming from? | |
| 314 | NB3: the 12-keys keypad present in later models | |
| 315 | is mapped to the corrispondent keys of the | |
| 316 | keyboard: '0' -> '9', 'Enter', '.' | |
| 317 | 317 | NB4: when it was added a 15-key keypad, there were |
| 318 | three functions key 'F1', 'F2', 'F3'. I found no | |
| 319 | doc about their position in the matrix above, | |
| 320 | but the schematics of the clone System-80 MkII | |
| 321 | (which had 4 function keys) put these keys in | |
| 322 | 3:4 -> 3:7. Right now they're not implemented | |
| 323 | below. | |
| 318 | three functions key 'F1', 'F2', 'F3'. I found no | |
| 319 | doc about their position in the matrix above, | |
| 320 | but the schematics of the clone System-80 MkII | |
| 321 | (which had 4 function keys) put these keys in | |
| 322 | 3:4 -> 3:7. Right now they're not implemented | |
| 323 | below. | |
| 324 | 324 | |
| 325 | 325 | ***************************************************************************/ |
| 326 | 326 | |
| r5932 | r5933 | |
| 366 | 366 | PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| 367 | 367 | PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 368 | 368 | /* on Model I and Model III keyboards, there are only 53 keys (+ 12 keypad keys) and these are not connected: |
| 369 | on Model I, they produce arrows and '_', on Model III either produce garbage or overlap with other keys; | |
| 370 | on Model 4 (which has a 15-key with 3 function keys) here are mapped 'F1', 'F2', 'F3' */ | |
| 369 | on Model I, they produce arrows and '_', on Model III either produce garbage or overlap with other keys; | |
| 370 | on Model 4 (which has a 15-key with 3 function keys) here are mapped 'F1', 'F2', 'F3' */ | |
| 371 | 371 | PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") |
| 372 | 372 | PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") |
| 373 | 373 | PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)") |
| r5932 | r5933 | |
| 503 | 503 | MDRV_CASSETTE_MODIFY( "cassette", trs80l2_cassette_config ) |
| 504 | 504 | MDRV_QUICKLOAD_ADD("quickload", trs80_cmd, "cmd", 0.5) |
| 505 | 505 | MDRV_WD179X_ADD("wd179x", trs80_wd17xx_interface ) |
| 506 | MDRV_FLOPPY_4_DRIVES_ADD(trs80_floppy_config) | |
| 506 | MDRV_FLOPPY_4_DRIVES_ADD(trs80_floppy_config) | |
| 507 | 507 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 508 | 508 | MDRV_AY31015_ADD( "tr1602", trs80_ay31015_config ) |
| 509 | 509 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
| 644 | 644 | |
| 645 | 645 | ROM_START(trs80m3) |
| 646 | 646 | /* ROMS we have and are missing: |
| 647 | HAVE TRS-80 Model III Level 1 ROM (U104) | |
| 648 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC BBC4 | |
| 649 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC DA75 | |
| 650 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC 9639 | |
| 651 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM B (U105) ver. CRC 407C | |
| 652 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2B91 - early mfg. #80040316 | |
| 653 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 278A - no production REV A | |
| 654 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2EF8 - Manufacturing #80040316 REV B | |
| 655 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2F84 - Manufacturing #80040316 REV C | |
| 656 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 2764 - Network III v1 | |
| 657 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 276A - Network III v2 | |
| 658 | MISSING TRS-80 Model III Level 2 (BELGIUM) CRC ???? | |
| 647 | HAVE TRS-80 Model III Level 1 ROM (U104) | |
| 648 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC BBC4 | |
| 649 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC DA75 | |
| 650 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC 9639 | |
| 651 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM B (U105) ver. CRC 407C | |
| 652 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2B91 - early mfg. #80040316 | |
| 653 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 278A - no production REV A | |
| 654 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2EF8 - Manufacturing #80040316 REV B | |
| 655 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2F84 - Manufacturing #80040316 REV C | |
| 656 | MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 2764 - Network III v1 | |
| 657 | HAVE TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 276A - Network III v2 | |
| 658 | MISSING TRS-80 Model III Level 2 (BELGIUM) CRC ???? | |
| 659 | 659 | Note: Be careful when dumping rom C: if dumped on the trs-80 m3 with software, bytes 0x7e8 and 0x7e9 (addresses 0x37e8, 0x0x37e9) |
| 660 | 660 | 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. |
| 661 | 661 | */ |
| r5932 | r5933 | |
| 761 | 761 | videoram = memory_region(machine, "gfx2")+0x4000; |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | /* YEAR NAME PARENT COMPAT MACHINE | |
| 764 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 765 | 765 | COMP( 1977, trs80, 0, 0, trs80, trs80, trs80, 0, "Tandy Radio Shack", "TRS-80 Model I (Level I Basic)" , 0 ) |
| 766 | 766 | COMP( 1978, trs80l2, trs80, 0, model1, trs80, trs80l2, 0, "Tandy Radio Shack", "TRS-80 Model I (Level II Basic)" , 0 ) |
| 767 | 767 | COMP( 1983, radionic, trs80, 0, radionic, trs80, trs80, 0, "Komtek", "Radionic" , 0 ) |
| r5932 | r5933 | |
|---|---|---|
| 13 | 13 | static const device_config* beta; |
| 14 | 14 | |
| 15 | 15 | static DIRECT_UPDATE_HANDLER( atm_direct ) |
| 16 | { | |
| 16 | { | |
| 17 | 17 | UINT16 pc = cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPCBASE); |
| 18 | ||
| 19 | if (beta->started && betadisk_is_active(beta)) | |
| 18 | ||
| 19 | if (beta->started && betadisk_is_active(beta)) | |
| 20 | 20 | { |
| 21 | if (pc >= 0x4000) | |
| 21 | if (pc >= 0x4000) | |
| 22 | 22 | { |
| 23 | 23 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 24 | 24 | betadisk_disable(beta); |
| 25 | 25 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 26 | 26 | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14)); |
| 27 | } | |
| 27 | } | |
| 28 | 28 | } else if (((pc & 0xff00) == 0x3d00) && (ROMSelection==1)) |
| 29 | 29 | { |
| 30 | 30 | ROMSelection = 3; |
| 31 | if (beta->started) | |
| 31 | if (beta->started) | |
| 32 | 32 | betadisk_enable(beta); |
| 33 | ||
| 34 | } | |
| 35 | if((address>=0x0000) && (address<=0x3fff)) | |
| 36 | { | |
| 33 | ||
| 34 | } | |
| 35 | if((address>=0x0000) && (address<=0x3fff)) | |
| 36 | { | |
| 37 | 37 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 38 | if (ROMSelection == 3) { | |
| 38 | if (ROMSelection == 3) { | |
| 39 | 39 | direct->raw = direct->decrypted = memory_region(space->machine, "maincpu") + 0x018000 ; |
| 40 | 40 | } else { |
| 41 | 41 | direct->raw = direct->decrypted = memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14); |
| r5932 | r5933 | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | static void atm_update_memory(running_machine *machine) |
| 50 | { | |
| 50 | { | |
| 51 | 51 | spectrum_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14)); |
| 52 | 52 | |
| 53 | 53 | memory_set_bankptr(machine, 4, mess_ram + ((spectrum_128_port_7ffd_data & 0x07) * 0x4000)); |
| 54 | 54 | |
| 55 | if (beta->started && betadisk_is_active(beta) && !( spectrum_128_port_7ffd_data & 0x10 ) ) | |
| 56 | { | |
| 55 | if (beta->started && betadisk_is_active(beta) && !( spectrum_128_port_7ffd_data & 0x10 ) ) | |
| 56 | { | |
| 57 | 57 | ROMSelection = 3; |
| 58 | 58 | } |
| 59 | else { | |
| 59 | else { | |
| 60 | 60 | /* ROM switching */ |
| 61 | 61 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ; |
| 62 | 62 | } |
| r5932 | r5933 | |
| 77 | 77 | atm_update_memory(space->machine); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | static ADDRESS_MAP_START (atm_io, ADDRESS_SPACE_IO, 8) | |
| 80 | static ADDRESS_MAP_START (atm_io, ADDRESS_SPACE_IO, 8) | |
| 81 | 81 | ADDRESS_MAP_UNMAP_HIGH |
| 82 | 82 | AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_status_r,betadisk_command_w) AM_MIRROR(0xff00) |
| 83 | 83 | AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_track_r,betadisk_track_w) AM_MIRROR(0xff00) |
| 84 | 84 | AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_sector_r,betadisk_sector_w) AM_MIRROR(0xff00) |
| 85 | 85 | AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_data_r,betadisk_data_w) AM_MIRROR(0xff00) |
| 86 | AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) | |
| 86 | AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) | |
| 87 | 87 | AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_state_r, betadisk_param_w) AM_MIRROR(0xff00) |
| 88 | 88 | AM_RANGE(0x4000, 0x4000) AM_WRITE(atm_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 89 | 89 | AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd) |
| r5932 | r5933 | |
| 94 | 94 | { |
| 95 | 95 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 96 | 96 | beta = devtag_get_device(machine, BETA_DISK_TAG); |
| 97 | ||
| 97 | ||
| 98 | 98 | memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| 99 | 99 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 100 | 100 | |
| r5932 | r5933 | |
| 103 | 103 | betadisk_clear_status(beta); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | memory_set_direct_update_handler( space, atm_direct ); | |
| 107 | ||
| 106 | memory_set_direct_update_handler( space, atm_direct ); | |
| 107 | ||
| 108 | 108 | memset(mess_ram,0,128*1024); |
| 109 | ||
| 109 | ||
| 110 | 110 | /* Bank 5 is always in 0x4000 - 0x7fff */ |
| 111 | 111 | memory_set_bankptr(machine, 2, mess_ram + (5<<14)); |
| 112 | 112 | |
| r5932 | r5933 | |
| 115 | 115 | |
| 116 | 116 | spectrum_128_port_7ffd_data = 0; |
| 117 | 117 | |
| 118 | atm_update_memory(machine); | |
| 118 | atm_update_memory(machine); | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | static MACHINE_DRIVER_START( atm ) |
| r5932 | r5933 | |
| 123 | 123 | MDRV_CPU_MODIFY("maincpu") |
| 124 | 124 | MDRV_CPU_IO_MAP(atm_io) |
| 125 | 125 | MDRV_MACHINE_RESET( atm ) |
| 126 | ||
| 126 | ||
| 127 | 127 | MDRV_BETA_DISK_ADD(BETA_DISK_TAG) |
| 128 | 128 | MACHINE_DRIVER_END |
| 129 | 129 | |
| r5932 | r5933 | |
| 151 | 151 | |
| 152 | 152 | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 153 | 153 | ROM_END |
| 154 | ||
| 154 | ||
| 155 | 155 | ROM_START(atm2) |
| 156 | 156 | ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF) |
| 157 | 157 | ROM_SYSTEM_BIOS(0, "v1", "v.1.07.12 joined") |
| r5932 | r5933 | |
| 163 | 163 | ROMX_LOAD( "atmtb2-4.rom", 0x01c000, 0x4000, CRC(5869d8c4) SHA1(c3e198138f528ac4a8dff3c76cd289fd4713abff), ROM_BIOS(2)) |
| 164 | 164 | ROM_SYSTEM_BIOS(2, "v3", "v.1.07.13") |
| 165 | 165 | ROMX_LOAD( "atmtb213.rom", 0x010000, 0x10000, CRC(34a91d53) SHA1(8f0af0f3c0ff1644535f20545c73d01576d6e52f), ROM_BIOS(3)) |
| 166 | ||
| 166 | ||
| 167 | 167 | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 168 | ROM_REGION(0x01000, "keyboard", ROMREGION_ERASEFF) | |
| 168 | ROM_REGION(0x01000, "keyboard", ROMREGION_ERASEFF) | |
| 169 | 169 | // XT Keyboard |
| 170 | 170 | ROM_LOAD( "rf2ve3.rom", 0x0000, 0x0580, CRC(35e0f9ec) SHA1(adcf14758fab8472cfa0167af7e8326c66416416)) |
| 171 | 171 | // AT Keyboard |
| 172 | 172 | ROM_LOAD( "rfat710.rom", 0x0600, 0x0680, CRC(03734365) SHA1(6cb6311727fad9bc4ccb18919c3c39b37529b8e6)) |
| 173 | 173 | ROM_REGION(0x08000, "charrom", ROMREGION_ERASEFF) |
| 174 | 174 | // Char gen rom |
| 175 | ROM_LOAD( "sgen.rom", 0x0000, 0x0800, CRC(1f4387d6) SHA1(93b3774dc8a486643a1bdd48c606b0c84fa0e22b)) | |
| 175 | ROM_LOAD( "sgen.rom", 0x0000, 0x0800, CRC(1f4387d6) SHA1(93b3774dc8a486643a1bdd48c606b0c84fa0e22b)) | |
| 176 | 176 | ROM_END |
| 177 | 177 | |
| 178 | 178 | static SYSTEM_CONFIG_START(atm) |
| r5932 | r5933 | |
|---|---|---|
| 202 | 202 | MDRV_SOUND_CONFIG(the_voice_sp0256) |
| 203 | 203 | /* The Voice uses a speaker with its own volume control so the relative volumes to use are subjective, these sound good */ |
| 204 | 204 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 205 | ||
| 205 | ||
| 206 | 206 | MDRV_IMPORT_FROM(odyssey2_cartslot) |
| 207 | 207 | MACHINE_DRIVER_END |
| 208 | 208 | |
| r5932 | r5933 | |
| 235 | 235 | MDRV_SOUND_ADD("sp0256_speech", SP0256, 3120000) |
| 236 | 236 | MDRV_SOUND_CONFIG(the_voice_sp0256) |
| 237 | 237 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 238 | ||
| 238 | ||
| 239 | 239 | MDRV_IMPORT_FROM(odyssey2_cartslot) |
| 240 | 240 | MACHINE_DRIVER_END |
| 241 | 241 | |
| r5932 | r5933 | |
| 258 | 258 | MDRV_PALETTE_INIT( odyssey2 ) |
| 259 | 259 | |
| 260 | 260 | MDRV_VIDEO_START( odyssey2 ) |
| 261 | // | |
| 261 | // MDRV_VIDEO_UPDATE( odyssey2 ) | |
| 262 | 262 | |
| 263 | 263 | /* sound hardware */ |
| 264 | 264 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 265 | 265 | MDRV_SOUND_ADD("custom", ODYSSEY2, 3547000) |
| 266 | 266 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 267 | ||
| 267 | ||
| 268 | 268 | MDRV_IMPORT_FROM(odyssey2_cartslot) |
| 269 | 269 | MACHINE_DRIVER_END |
| 270 | 270 | |
| r5932 | r5933 | |
| 281 | 281 | ROM_LOAD( "sp0256b-019.bin", 0x1000, 0x0800, CRC(19355075) SHA1(13bc08f08d161c30ff386d1f0d15676d82afde63) ) |
| 282 | 282 | |
| 283 | 283 | /* A note about "The Voice": Two versions of "The Voice" exist: |
| 284 | * An earlier version with eight 2KiB speech roms, spr016-??? thru spr016-??? on a small daughterboard | |
| 285 | <note to self: fill in numbers later> | |
| 286 | * A later version with one 16KiB speech rom, spr128-003, mounted directly on the mainboard | |
| 287 | The rom contents of these two versions are EXACTLY the same. | |
| 288 | Both versions have an sp0256b-019 speech chip, which has 2KiB of its own internal speech data | |
| 289 | Thanks to kevtris for this info. - LN | |
| 290 | */ | |
| 284 | * An earlier version with eight 2KiB speech roms, spr016-??? thru spr016-??? on a small daughterboard | |
| 285 | <note to self: fill in numbers later> | |
| 286 | * A later version with one 16KiB speech rom, spr128-003, mounted directly on the mainboard | |
| 287 | The rom contents of these two versions are EXACTLY the same. | |
| 288 | Both versions have an sp0256b-019 speech chip, which has 2KiB of its own internal speech data | |
| 289 | Thanks to kevtris for this info. - LN | |
| 290 | */ | |
| 291 | 291 | /* External 16KiB speech ROM (spr128-003) from "The Voice" */ |
| 292 | 292 | ROM_LOAD( "spr128-003.bin", 0x4000, 0x4000, CRC(66041b03) SHA1(31acbaf1ae92b3efbb5093d63b0472170699da85) ) |
| 293 | 293 | /* Additional External 16KiB ROM (spr128-004) from S.I.D. the Spellbinder */ |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | ||
| 7 | http://www.djupdal.org/tiki/ | |
| 8 | 8 | |
| 9 | 9 | ****************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | 12 | |
| 13 | ||
| 13 | TODO: | |
| 14 | 14 | |
| 15 | - palette RAM should be written during HBLANK | |
| 16 | - double sided disks have t0s0,t0s1,t1s0,t1s1... format | |
| 17 | - DART clocks | |
| 18 | - daisy chain order? | |
| 19 | - winchester hard disk | |
| 20 | - analog/digital I/O | |
| 21 | - light pen | |
| 22 | - 8088 CPU card | |
| 15 | - palette RAM should be written during HBLANK | |
| 16 | - double sided disks have t0s0,t0s1,t1s0,t1s1... format | |
| 17 | - DART clocks | |
| 18 | - daisy chain order? | |
| 19 | - winchester hard disk | |
| 20 | - analog/digital I/O | |
| 21 | - light pen | |
| 22 | - 8088 CPU card | |
| 23 | 23 | |
| 24 | 24 | */ |
| 25 | 25 | |
| r5932 | r5933 | |
| 129 | 129 | static WRITE8_HANDLER( keyboard_w ) |
| 130 | 130 | { |
| 131 | 131 | tiki100_state *state = space->machine->driver_data; |
| 132 | ||
| 132 | ||
| 133 | 133 | state->keylatch = 0; |
| 134 | 134 | } |
| 135 | 135 | |
| r5932 | r5933 | |
| 137 | 137 | { |
| 138 | 138 | /* |
| 139 | 139 | |
| 140 | ||
| 140 | bit description | |
| 141 | 141 | |
| 142 | 0 palette entry bit 0 | |
| 143 | 1 palette entry bit 1 | |
| 144 | 2 palette entry bit 2 | |
| 145 | 3 palette entry bit 3 | |
| 146 | 4 mode select bit 0 | |
| 147 | 5 mode select bit 1 | |
| 148 | 6 unused | |
| 149 | 7 write color during HBLANK | |
| 142 | 0 palette entry bit 0 | |
| 143 | 1 palette entry bit 1 | |
| 144 | 2 palette entry bit 2 | |
| 145 | 3 palette entry bit 3 | |
| 146 | 4 mode select bit 0 | |
| 147 | 5 mode select bit 1 | |
| 148 | 6 unused | |
| 149 | 7 write color during HBLANK | |
| 150 | 150 | |
| 151 | ||
| 151 | */ | |
| 152 | 152 | |
| 153 | 153 | tiki100_state *state = space->machine->driver_data; |
| 154 | ||
| 154 | ||
| 155 | 155 | state->mode = data; |
| 156 | 156 | |
| 157 | 157 | if (BIT(data, 7)) |
| r5932 | r5933 | |
| 167 | 167 | { |
| 168 | 168 | /* |
| 169 | 169 | |
| 170 | ||
| 170 | bit description | |
| 171 | 171 | |
| 172 | 0 blue intensity bit 0 | |
| 173 | 1 blue intensity bit 1 | |
| 174 | 2 green intensity bit 0 | |
| 175 | 3 green intensity bit 1 | |
| 176 | 4 green intensity bit 2 | |
| 177 | 5 red intensity bit 0 | |
| 178 | 6 red intensity bit 1 | |
| 179 | 7 red intensity bit 2 | |
| 172 | 0 blue intensity bit 0 | |
| 173 | 1 blue intensity bit 1 | |
| 174 | 2 green intensity bit 0 | |
| 175 | 3 green intensity bit 1 | |
| 176 | 4 green intensity bit 2 | |
| 177 | 5 red intensity bit 0 | |
| 178 | 6 red intensity bit 1 | |
| 179 | 7 red intensity bit 2 | |
| 180 | 180 | |
| 181 | ||
| 181 | */ | |
| 182 | 182 | |
| 183 | 183 | tiki100_state *state = space->machine->driver_data; |
| 184 | ||
| 184 | ||
| 185 | 185 | state->palette = data; |
| 186 | 186 | } |
| 187 | 187 | |
| r5932 | r5933 | |
| 189 | 189 | { |
| 190 | 190 | /* |
| 191 | 191 | |
| 192 | ||
| 192 | bit signal description | |
| 193 | 193 | |
| 194 | 0 DRIS0 drive select 0 | |
| 195 | 1 DRIS1 drive select 1 | |
| 196 | 2 _ROME enable ROM at 0000-3fff | |
| 197 | 3 VIRE enable video RAM at 0000-7fff | |
| 198 | 4 SDEN single density select (0=DD, 1=SD) | |
| 199 | 5 _LMP0 GRAFIKK key led | |
| 200 | 6 MOTON floppy motor | |
| 201 | 7 _LMP1 LOCK key led | |
| 194 | 0 DRIS0 drive select 0 | |
| 195 | 1 DRIS1 drive select 1 | |
| 196 | 2 _ROME enable ROM at 0000-3fff | |
| 197 | 3 VIRE enable video RAM at 0000-7fff | |
| 198 | 4 SDEN single density select (0=DD, 1=SD) | |
| 199 | 5 _LMP0 GRAFIKK key led | |
| 200 | 6 MOTON floppy motor | |
| 201 | 7 _LMP1 LOCK key led | |
| 202 | 202 | |
| 203 | ||
| 203 | */ | |
| 204 | 204 | |
| 205 | 205 | tiki100_state *state = space->machine->driver_data; |
| 206 | 206 | |
| r5932 | r5933 | |
| 252 | 252 | AM_RANGE(0x17, 0x17) AM_DEVREADWRITE(AY8912_TAG, ay8910_r, ay8910_data_w) |
| 253 | 253 | AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w) |
| 254 | 254 | AM_RANGE(0x1c, 0x1c) AM_MIRROR(0x03) AM_WRITE(system_w) |
| 255 | // AM_RANGE(0x20, 0x27) winchester controller | |
| 256 | // AM_RANGE(0x60, 0x6f) analog I/O (SINTEF) | |
| 257 | // AM_RANGE(0x60, 0x67) digital I/O (RVO) | |
| 258 | // AM_RANGE(0x70, 0x77) analog/digital I/O | |
| 259 | // AM_RANGE(0x78, 0x7b) light pen | |
| 260 | // AM_RANGE(0x7e, 0x7f) 8088/87 processor w/128KB RAM | |
| 255 | // AM_RANGE(0x20, 0x27) winchester controller | |
| 256 | // AM_RANGE(0x60, 0x6f) analog I/O (SINTEF) | |
| 257 | // AM_RANGE(0x60, 0x67) digital I/O (RVO) | |
| 258 | // AM_RANGE(0x70, 0x77) analog/digital I/O | |
| 259 | // AM_RANGE(0x78, 0x7b) light pen | |
| 260 | // AM_RANGE(0x7e, 0x7f) 8088/87 processor w/128KB RAM | |
| 261 | 261 | ADDRESS_MAP_END |
| 262 | 262 | |
| 263 | 263 | /* Input Ports */ |
| 264 | 264 | |
| 265 | 265 | static INPUT_PORTS_START( tiki100 ) |
| 266 | 266 | /* |
| 267 | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | |
| 268 | ----+---------+---------+---------+---------+---------+---------+---------+---------+ | |
| 269 | 1 | CTRL | SHIFT | BRYT | RETUR | MLMROM | / (num) | SLETT | | | |
| 270 | 2 | GRAFIKK | 1 | ANGRE | a | < | z | q | LOCK | | |
| 271 | 3 | 2 | w | s | x | 3 | e | d | c | | |
| 272 | 4 | 4 | r | f | v | 5 | t | g | b | | |
| 273 | 5 | 6 | y | h | n | 7 | u | j | m | | |
| 274 | 6 | 8 | i | k | , | 9 | o | l | . | | |
| 275 | 7 | 0 | p | ø | - | + | å | æ | HJELP | | |
| 276 | 8 | @ | ^ | ' | VENSTRE | UTVID | F1 | F4 | SIDEOPP | | |
| 277 | 9 | F2 | F3 | F5 | F6 | OPP | SIDENED | VTAB | NED | | |
| 278 | 10 | + (num) | - (num) | * (num) | 7 (num) | 8 (num) | 9 (num) | % (num) | = (num) | | |
| 279 | 11 | 4 (num) | 5 (num) | 6 (num) | HTAB | 1 (num) | 0 (num) | . (num) | | | |
| 280 | 12 | HJEM | HØYRE | 2 (num) | 3 (num) | ENTER | | | | | |
| 281 | ----+---------+---------+---------+---------+---------+---------+---------+---------+ | |
| 267 | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | |
| 268 | ----+---------+---------+---------+---------+---------+---------+---------+---------+ | |
| 269 | 1 | CTRL | SHIFT | BRYT | RETUR | MLMROM | / (num) | SLETT | | | |
| 270 | 2 | GRAFIKK | 1 | ANGRE | a | < | z | q | LOCK | | |
| 271 | 3 | 2 | w | s | x | 3 | e | d | c | | |
| 272 | 4 | 4 | r | f | v | 5 | t | g | b | | |
| 273 | 5 | 6 | y | h | n | 7 | u | j | m | | |
| 274 | 6 | 8 | i | k | , | 9 | o | l | . | | |
| 275 | 7 | 0 | p | ? | - | + | ? | ? | HJELP | | |
| 276 | 8 | @ | ^ | ' | VENSTRE | UTVID | F1 | F4 | SIDEOPP | | |
| 277 | 9 | F2 | F3 | F5 | F6 | OPP | SIDENED | VTAB | NED | | |
| 278 | 10 | + (num) | - (num) | * (num) | 7 (num) | 8 (num) | 9 (num) | % (num) | = (num) | | |
| 279 | 11 | 4 (num) | 5 (num) | 6 (num) | HTAB | 1 (num) | 0 (num) | . (num) | | | |
| 280 | 12 | HJEM | H?YRE | 2 (num) | 3 (num) | ENTER | | | | | |
| 281 | ----+---------+---------+---------+---------+---------+---------+---------+---------+ | |
| 282 | 282 | */ |
| 283 | 283 | PORT_START("ROW1") |
| 284 | 284 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) |
| r5932 | r5933 | |
| 388 | 388 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) |
| 389 | 389 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) |
| 390 | 390 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD) |
| 391 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 391 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 392 | 392 | |
| 393 | 393 | PORT_START("ROW12") |
| 394 | 394 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HJEM") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| r5932 | r5933 | |
| 396 | 396 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) |
| 397 | 397 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) |
| 398 | 398 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad ENTER") PORT_CODE(KEYCODE_ENTER_PAD) |
| 399 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 400 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 401 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 399 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 400 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 401 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 402 | 402 | INPUT_PORTS_END |
| 403 | 403 | |
| 404 | 404 | /* Video */ |
| r5932 | r5933 | |
| 552 | 552 | /* FD1797 Interface */ |
| 553 | 553 | |
| 554 | 554 | static const wd17xx_interface tiki100_wd17xx_interface = |
| 555 | { | |
| 555 | { | |
| 556 | 556 | NULL, |
| 557 | 557 | NULL, |
| 558 | 558 | {FLOPPY_0,FLOPPY_1,NULL,NULL} |
| r5932 | r5933 | |
| 676 | 676 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 677 | 677 | MDRV_SCREEN_SIZE(1024, 256) |
| 678 | 678 | MDRV_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 256-1) |
| 679 | ||
| 679 | ||
| 680 | 680 | MDRV_PALETTE_LENGTH(16) |
| 681 | 681 | |
| 682 | 682 | MDRV_VIDEO_UPDATE(tiki100) |
| r5932 | r5933 | |
| 687 | 687 | MDRV_Z80CTC_ADD(Z80CTC_TAG, 2000000, ctc_intf) |
| 688 | 688 | MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(2000000)) |
| 689 | 689 | MDRV_WD179X_ADD(FD1797_TAG, tiki100_wd17xx_interface) // FD1767PL-02 or FD1797-PL |
| 690 | MDRV_FLOPPY_2_DRIVES_ADD(tiki100_floppy_config) | |
| 690 | MDRV_FLOPPY_2_DRIVES_ADD(tiki100_floppy_config) | |
| 691 | 691 | /* sound hardware */ |
| 692 | 692 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 693 | 693 | MDRV_SOUND_ADD(AY8912_TAG, AY8912, 2000000) |
| r5932 | r5933 | |
| 719 | 719 | |
| 720 | 720 | /* System Drivers */ |
| 721 | 721 | |
| 722 | /* YEAR | |
| 722 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 723 | 723 | COMP( 1984, kontiki, 0, 0, tiki100, tiki100, 0, tiki100, "Kontiki Data A/S", "KONTIKI 100", GAME_SUPPORTS_SAVE ) |
| 724 | 724 | COMP( 1984, tiki100, kontiki, 0, tiki100, tiki100, 0, tiki100, "Tiki Data A/S", "TIKI 100", GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 26 | 26 | A-48 - 32kB RAM + 16KB ROM |
| 27 | 27 | A-64 - 48kB RAM + 16KB ROM |
| 28 | 28 | B-32 - 16kB RAM + 16KB ROM |
| 29 | B-48 - 32kB RAM + 16KB ROM | |
| 30 | B-64 - 48kB RAM + 16KB ROM | |
| 29 | B-48 - 32kB RAM + 16KB ROM | |
| 30 | B-64 - 48kB RAM + 16KB ROM | |
| 31 | 31 | |
| 32 | 32 | CPU: |
| 33 | 33 | U880D (DDR clone of Z80), 2.5 MHz |
| r5932 | r5933 | |
| 282 | 282 | |
| 283 | 283 | /* floppy from serial bus */ |
| 284 | 284 | /* for some reason machine/primo.c sets up the serial bus |
| 285 | ||
| 285 | but no floppy drive has been apparently added... incomplete driver? */ | |
| 286 | 286 | MDRV_IMPORT_FROM(simulated_drive) |
| 287 | 287 | |
| 288 | 288 | /* cartridge */ |
| r5932 | r5933 | |
| 406 | 406 | |
| 407 | 407 | /*static void primo_cartslot_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 408 | 408 | { |
| 409 | switch(state) | |
| 410 | { | |
| 411 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "EPROM Expansion Bank #1"); break; | |
| 412 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "EPROM Expansion Bank #2"); break; | |
| 413 | case MESS_DEVINFO_STR_DESCRIPTION+2: strcpy(info->s = device_temp_str(), "EPROM Expansion Bank #3"); break; | |
| 414 | case MESS_DEVINFO_STR_DESCRIPTION+3: strcpy(info->s = device_temp_str(), "EPROM Expansion Bank #4"); break; | |
| 409 | switch(state) | |
| 410 | { | |
| 411 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "EPROM Expansion Bank #1"); break; | |
| 412 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "EPROM Expansion Bank #2"); break; | |
| 413 | case MESS_DEVINFO_STR_DESCRIPTION+2: strcpy(info->s = device_temp_str(), "EPROM Expansion Bank #3"); break; | |
| 414 | case MESS_DEVINFO_STR_DESCRIPTION+3: strcpy(info->s = device_temp_str(), "EPROM Expansion Bank #4"); break; | |
| 415 | 415 | |
| 416 | default: cartslot_device_getinfo(devclass, state, info); break; | |
| 417 | } | |
| 416 | default: cartslot_device_getinfo(devclass, state, info); break; | |
| 417 | } | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | */ |
| r5932 | r5933 | |
|---|---|---|
| 5 | 5 | 05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | 7 | |
| 8 | This should be emulated alongside PS1 (and especially its memory cards, | |
| 8 | This should be emulated alongside PS1 (and especially its memory cards, | |
| 9 | 9 | since Pocket Station games were dowloaded from PS1 games into flash RAM |
| 10 | after the unit had been inserted in the memory card slot). | |
| 11 | While waiting for full PS1 emulation in MESS, we collect here info on the | |
| 10 | after the unit had been inserted in the memory card slot). | |
| 11 | While waiting for full PS1 emulation in MESS, we collect here info on the | |
| 12 | 12 | system and its BIOS. |
| 13 | 13 | |
| 14 | 14 | CPU: ARM7T (32 bit RISC Processor) |
| r5932 | r5933 | |
| 16 | 16 | Graphics: 32 x 32 dot monochrome LCD |
| 17 | 17 | Sound: Miniature speaker (12 bit PCM) x 1 unit |
| 18 | 18 | Input: 5 input buttons, 1 reset button |
| 19 | Infrared communication: Bi-directional (supports IrDA based and | |
| 19 | Infrared communication: Bi-directional (supports IrDA based and | |
| 20 | 20 | conventional remote control systems) |
| 21 | 21 | Other: 1 LED indicator |
| 22 | 22 | |
| r5932 | r5933 | |
| 30 | 30 | #include "cpu/arm7/arm7.h" |
| 31 | 31 | |
| 32 | 32 | static ADDRESS_MAP_START(pockstat_mem, ADDRESS_SPACE_PROGRAM, 32) |
| 33 | /* AM_RANGE(0x00000000, 0x000007ff) AM_RAM | |
| 34 | AM_RANGE(0x02000000, 0x0201ffff) Flash ROM | |
| 35 | AM_RANGE(0x04000000, 0x04003fff) AM_ROM | |
| 36 | AM_RANGE(0x08000000, 0x0801ffff) Same as 0x02 above. Mirrors every 128KB. | |
| 37 | AM_RANGE(0x0a000000, 0x0a000003) IRQs currently triggered | |
| 38 | AM_RANGE(0x0a000004, 0x0a000007) Raw status | |
| 39 | AM_RANGE(0x0a000008, 0x0a00000b) Which IRQs are enabled | |
| 40 | AM_RANGE(0x0a00000c, 0x0a00000f) Disable IRQs (write only) | |
| 41 | AM_RANGE(0x0a000010, 0x0a000013) IRQ service signal (write only) | |
| 42 | AM_RANGE(0x0a800000, 0x0a800003) Timer 0 period | |
| 43 | AM_RANGE(0x0a800004, 0x0a800007) Timer 0 current value | |
| 44 | AM_RANGE(0x0a800008, 0x0a80000b) Timer 0 control | |
| 45 | AM_RANGE(0x0a800010, 0x0a800013) Timer 1 period | |
| 46 | AM_RANGE(0x0a800014, 0x0a800017) Timer 1 current value | |
| 47 | AM_RANGE(0x0a800018, 0x0a80001b) Timer 1 control | |
| 48 | AM_RANGE(0x0a800020, 0x0a800023) Timer 2 period | |
| 49 | AM_RANGE(0x0a800024, 0x0a800027) Timer 2 current value | |
| 50 | AM_RANGE(0x0a800028, 0x0a80002b) Timer 2 control | |
| 51 | AM_RANGE(0x0b000000, 0x0b000003) Internal CPU Clock control | |
| 52 | AM_RANGE(0x0b800000, 0x0b800003) RTC control word | |
| 53 | AM_RANGE(0x0b800004, 0x0b800007) RTC Modify value (write only) | |
| 54 | AM_RANGE(0x0b800008, 0x0b80000b) RTC Time of day + day of week (read only) | |
| 55 | AM_RANGE(0x0b80000c, 0x0b80000f) RTC Date (read only) | |
| 56 | AM_RANGE(0x0d000000, 0x0b000003) LCD control word | |
| 57 | AM_RANGE(0x0d000100, 0x0b00017f) LCD buffer - 1 word per scanline */ | |
| 33 | /* AM_RANGE(0x00000000, 0x000007ff) AM_RAM | |
| 34 | AM_RANGE(0x02000000, 0x0201ffff) Flash ROM | |
| 35 | AM_RANGE(0x04000000, 0x04003fff) AM_ROM | |
| 36 | AM_RANGE(0x08000000, 0x0801ffff) Same as 0x02 above. Mirrors every 128KB. | |
| 37 | AM_RANGE(0x0a000000, 0x0a000003) IRQs currently triggered | |
| 38 | AM_RANGE(0x0a000004, 0x0a000007) Raw status | |
| 39 | AM_RANGE(0x0a000008, 0x0a00000b) Which IRQs are enabled | |
| 40 | AM_RANGE(0x0a00000c, 0x0a00000f) Disable IRQs (write only) | |
| 41 | AM_RANGE(0x0a000010, 0x0a000013) IRQ service signal (write only) | |
| 42 | AM_RANGE(0x0a800000, 0x0a800003) Timer 0 period | |
| 43 | AM_RANGE(0x0a800004, 0x0a800007) Timer 0 current value | |
| 44 | AM_RANGE(0x0a800008, 0x0a80000b) Timer 0 control | |
| 45 | AM_RANGE(0x0a800010, 0x0a800013) Timer 1 period | |
| 46 | AM_RANGE(0x0a800014, 0x0a800017) Timer 1 current value | |
| 47 | AM_RANGE(0x0a800018, 0x0a80001b) Timer 1 control | |
| 48 | AM_RANGE(0x0a800020, 0x0a800023) Timer 2 period | |
| 49 | AM_RANGE(0x0a800024, 0x0a800027) Timer 2 current value | |
| 50 | AM_RANGE(0x0a800028, 0x0a80002b) Timer 2 control | |
| 51 | AM_RANGE(0x0b000000, 0x0b000003) Internal CPU Clock control | |
| 52 | AM_RANGE(0x0b800000, 0x0b800003) RTC control word | |
| 53 | AM_RANGE(0x0b800004, 0x0b800007) RTC Modify value (write only) | |
| 54 | AM_RANGE(0x0b800008, 0x0b80000b) RTC Time of day + day of week (read only) | |
| 55 | AM_RANGE(0x0b80000c, 0x0b80000f) RTC Date (read only) | |
| 56 | AM_RANGE(0x0d000000, 0x0b000003) LCD control word | |
| 57 | AM_RANGE(0x0d000100, 0x0b00017f) LCD buffer - 1 word per scanline */ | |
| 58 | 58 | ADDRESS_MAP_END |
| 59 | 59 | |
| 60 | 60 | /* Input ports */ |
| r5932 | r5933 | |
|---|---|---|
| 162 | 162 | 7: Memory page 2 |
| 163 | 163 | 10: Controll port for the display controller |
| 164 | 164 | 11: Data port for the display controller |
| 165 | ||
| 165 | ||
| 166 | 166 | TI-85 ports: |
| 167 | 167 | 0: Video buffer offset (write only) |
| 168 | 168 | 1: Keypad |
| r5932 | r5933 | |
| 477 | 477 | |
| 478 | 478 | static INPUT_PORTS_START (ti83) |
| 479 | 479 | PORT_INCLUDE( ti82 ) |
| 480 | ||
| 480 | ||
| 481 | 481 | PORT_START("BATTERY") |
| 482 | 482 | PORT_DIPNAME( 0x01, 0x01, "Battery Status" ) |
| 483 | 483 | PORT_DIPSETTING( 0x01, DEF_STR( Normal ) ) |
| r5932 | r5933 | |
| 571 | 571 | MDRV_CPU_MODIFY("maincpu") |
| 572 | 572 | MDRV_CPU_PROGRAM_MAP(ti86_mem) |
| 573 | 573 | MDRV_CPU_IO_MAP(ti83p_io) |
| 574 | ||
| 574 | ||
| 575 | 575 | MDRV_MACHINE_START( ti83p ) |
| 576 | 576 | MDRV_VIDEO_UPDATE( ti82 ) |
| 577 | 577 | |
| r5932 | r5933 | |
| 611 | 611 | ROMX_LOAD( "ti82v18.bin", 0x10000, 0x20000, CRC(6a320f03) SHA1(9ee15ebf0a1f8bde5bef982b5db4ce120c605d29), ROM_BIOS(3) ) |
| 612 | 612 | ROM_SYSTEM_BIOS( 3, "v19", "V 19.0" ) |
| 613 | 613 | ROMX_LOAD( "ti82v19.bin", 0x10000, 0x20000, CRC(ed4cf9ff) SHA1(10dc2d01c62b4e971a6ed7ebc75ca0f2e3dc4f95), ROM_BIOS(4) ) |
| 614 | //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 | |
| 614 | //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 | |
| 615 | 615 | ROM_END |
| 616 | 616 | |
| 617 | 617 | ROM_START (ti83) |
| r5932 | r5933 | |
| 644 | 644 | ROM_SYSTEM_BIOS( 1, "v103m", "V 1.03 [m]" ) |
| 645 | 645 | ROMX_LOAD( "ti83pv103m.bin", 0x10000, 0x80000, CRC(281c9375) SHA1(80d698fed42976015a3e53fd59ebe7f49699b27e), ROM_BIOS(2)) |
| 646 | 646 | ROM_SYSTEM_BIOS( 2, "v103m2", "V 1.03 [m2]" ) |
| 647 | ROMX_LOAD( "ti83pv103m2.bin", 0x10000, 0x80000, CRC(690d9d30) SHA1(d215d3880e06c2ae31ec24b21d542d5bb2f3935b), ROM_BIOS(3)) | |
| 647 | ROMX_LOAD( "ti83pv103m2.bin", 0x10000, 0x80000, CRC(690d9d30) SHA1(d215d3880e06c2ae31ec24b21d542d5bb2f3935b), ROM_BIOS(3)) | |
| 648 | 648 | ROM_SYSTEM_BIOS( 3, "v110", "V 1.10" ) |
| 649 | 649 | ROMX_LOAD( "ti83pv110.bin", 0x10000, 0x80000, CRC(62683990) SHA1(F86CDEFE4ED5EF9965CD9EB667CB859E2CB10E19), ROM_BIOS(4) ) |
| 650 | 650 | ROM_SYSTEM_BIOS( 4, "v112", "V 1.12" ) |
| r5932 | r5933 | |
| 696 | 696 | ROMX_LOAD( "ti86v15.bin", 0x10000, 0x40000, BAD_DUMP CRC(e6e10546) SHA1(5ca63fdfc965ae3fb8e0695263cf9da41f6ecb90), ROM_BIOS(4) ) |
| 697 | 697 | ROM_SYSTEM_BIOS( 4, "v16", "V 1.6" ) |
| 698 | 698 | ROMX_LOAD( "ti86v16.bin", 0x10000, 0x40000, CRC(37e02acc) SHA1(b5ad204885e5dde23a22f18f8d5eaffca69d638d), ROM_BIOS(5) ) |
| 699 | //Rom versions according to ticalc.org 1.2, 1.3, 1.4, 1.5, 1.6 | |
| 699 | //Rom versions according to ticalc.org 1.2, 1.3, 1.4, 1.5, 1.6 | |
| 700 | 700 | ROM_END |
| 701 | 701 | |
| 702 | 702 | |
| r5932 | r5933 | |
| 713 | 713 | ROM_SYSTEM_BIOS( 0, "v241", "V 2.41" ) |
| 714 | 714 | ROMX_LOAD( "ti84sev241.bin", 0x10000, 0x200000, CRC(5758db36) SHA1(7daa4f22e9b5dc8a1cc8fd31bceece9fa8b43515), ROM_BIOS(1) ) |
| 715 | 715 | ROM_END |
| 716 | ||
| 716 | ||
| 717 | 717 | static void ti85_serial_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 718 | 718 | { |
| 719 | 719 | /* serial */ |
| r5932 | r5933 | |
|---|---|---|
| 325 | 325 | MDRV_CASSETTE_ADD( "cassette", svi318_cassette_config ) |
| 326 | 326 | |
| 327 | 327 | MDRV_WD179X_ADD("wd179x", svi_wd17xx_interface ) |
| 328 | ||
| 328 | ||
| 329 | 329 | MDRV_FLOPPY_2_DRIVES_ADD(svi318_floppy_config) |
| 330 | 330 | |
| 331 | 331 | MDRV_IMPORT_FROM( svi318_cartslot ) |
| r5932 | r5933 | |
| 410 | 410 | MDRV_WD179X_ADD("wd179x", svi_wd17xx_interface ) |
| 411 | 411 | |
| 412 | 412 | MDRV_FLOPPY_2_DRIVES_ADD(svi318_floppy_config) |
| 413 | ||
| 413 | ||
| 414 | 414 | MDRV_IMPORT_FROM( svi318_cartslot ) |
| 415 | 415 | MACHINE_DRIVER_END |
| 416 | 416 |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | ||
| 7 | http://hc-ddr.hucki.net/entwicklungssysteme.htm#VCS_80_von_Eckhard_Schiller | |
| 8 | 8 | |
| 9 | 9 | ****************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 92 | 92 | static TIMER_DEVICE_CALLBACK( vcs80_keyboard_tick ) |
| 93 | 93 | { |
| 94 | 94 | /* |
| 95 | ||
| 96 | bit description | |
| 97 | 95 | |
| 98 | PA0 keyboard and led latch bit 0 | |
| 99 | PA1 keyboard and led latch bit 1 | |
| 100 | PA2 keyboard and led latch bit 2 | |
| 101 | PA3 GND | |
| 102 | PA4 keyboard row input 0 | |
| 103 | PA5 keyboard row input 1 | |
| 104 | PA6 keyboard row input 2 | |
| 105 | PA7 demultiplexer clock input | |
| 96 | bit description | |
| 106 | 97 | |
| 107 | */ | |
| 98 | PA0 keyboard and led latch bit 0 | |
| 99 | PA1 keyboard and led latch bit 1 | |
| 100 | PA2 keyboard and led latch bit 2 | |
| 101 | PA3 GND | |
| 102 | PA4 keyboard row input 0 | |
| 103 | PA5 keyboard row input 1 | |
| 104 | PA6 keyboard row input 2 | |
| 105 | PA7 demultiplexer clock input | |
| 108 | 106 | |
| 107 | */ | |
| 108 | ||
| 109 | 109 | vcs80_state *state = timer->machine->driver_data; |
| 110 | 110 | |
| 111 | 111 | UINT8 data = 0; |
| r5932 | r5933 | |
| 130 | 130 | static WRITE8_DEVICE_HANDLER( pio_port_b_w ) |
| 131 | 131 | { |
| 132 | 132 | /* |
| 133 | ||
| 134 | bit description | |
| 135 | 133 | |
| 136 | PB0 VQD30 segment A | |
| 137 | PB1 VQD30 segment B | |
| 138 | PB2 VQD30 segment C | |
| 139 | PB3 VQD30 segment D | |
| 140 | PB4 VQD30 segment E | |
| 141 | PB5 VQD30 segment G | |
| 142 | PB6 VQD30 segment F | |
| 143 | PB7 _A0 | |
| 134 | bit description | |
| 144 | 135 | |
| 145 | */ | |
| 136 | PB0 VQD30 segment A | |
| 137 | PB1 VQD30 segment B | |
| 138 | PB2 VQD30 segment C | |
| 139 | PB3 VQD30 segment D | |
| 140 | PB4 VQD30 segment E | |
| 141 | PB5 VQD30 segment G | |
| 142 | PB6 VQD30 segment F | |
| 143 | PB7 _A0 | |
| 146 | 144 | |
| 145 | */ | |
| 146 | ||
| 147 | 147 | vcs80_state *state = device->machine->driver_data; |
| 148 | 148 | |
| 149 | 149 | UINT8 led_data = BITSWAP8(data & 0x7f, 7, 5, 6, 4, 3, 2, 1, 0); |
| r5932 | r5933 | |
| 244 | 244 | |
| 245 | 245 | /* System Drivers */ |
| 246 | 246 | |
| 247 | /* YEAR | |
| 247 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 248 | 248 | COMP( 1983, vcs80, 0, 0, vcs80, vcs80, vcs80, vcs80, "Eckhard Schiller", "VCS-80", GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 3 | 3 | Interact Family Computer |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver - Micko |
| 6 | ||
| 6 | 31/05/2009 Added notes and video - Robbbert | |
| 7 | 7 | |
| 8 | This was made by Interact Company of Ann Arbor, Michigan. However, | |
| 9 | just after launch, the company collapsed. The liquidator, Protecto, | |
| 10 | sold some and MicroVideo sold the rest. MicroVideo continued to | |
| 11 | develop but went under 2 years later. Meanwhile, the French company | |
| 12 | Lambda Systems sold a clone called the Victor Lambda. But, like the | |
| 13 | Americans, Lambda Systems also collapsed. Another French company, | |
| 14 | Micronique, purchased all remaining stock and intellectual rights | |
| 15 | from Lambda Systems, Microvideo and Interact, and the computer becomes | |
| 16 | wholly French. The computer has a name change, becoming the Hector. | |
| 17 | This in turn gets upgraded (2HR, HRX, MX). The line is finally | |
| 18 | retired in about 1985. | |
| 8 | This was made by Interact Company of Ann Arbor, Michigan. However, | |
| 9 | just after launch, the company collapsed. The liquidator, Protecto, | |
| 10 | sold some and MicroVideo sold the rest. MicroVideo continued to | |
| 11 | develop but went under 2 years later. Meanwhile, the French company | |
| 12 | Lambda Systems sold a clone called the Victor Lambda. But, like the | |
| 13 | Americans, Lambda Systems also collapsed. Another French company, | |
| 14 | Micronique, purchased all remaining stock and intellectual rights | |
| 15 | from Lambda Systems, Microvideo and Interact, and the computer becomes | |
| 16 | wholly French. The computer has a name change, becoming the Hector. | |
| 17 | This in turn gets upgraded (2HR, HRX, MX). The line is finally | |
| 18 | retired in about 1985. | |
| 19 | 19 | |
| 20 | TO DO: | |
| 21 | Keyboard | |
| 22 | Cassette | |
| 23 | SN76477 / Sound | |
| 24 | Colour | |
| 25 | Cartload | |
| 20 | TO DO: | |
| 21 | Keyboard | |
| 22 | Cassette | |
| 23 | SN76477 / Sound | |
| 24 | Colour | |
| 25 | Cartload | |
| 26 | 26 | |
| 27 | 27 | ****************************************************************************/ |
| 28 | 28 | |
| r5932 | r5933 | |
| 97 | 97 | /* basic machine hardware */ |
| 98 | 98 | MDRV_CPU_ADD("maincpu",8080, XTAL_2MHz) |
| 99 | 99 | MDRV_CPU_PROGRAM_MAP(interact_mem) |
| 100 | // | |
| 100 | // MDRV_CPU_VBLANK_INT("maincpu", interact_interrupt) | |
| 101 | 101 | |
| 102 | 102 | MDRV_MACHINE_RESET(interact) |
| 103 | 103 | |
| r5932 | r5933 | |
| 129 | 129 | |
| 130 | 130 | /* Driver */ |
| 131 | 131 | |
| 132 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG | |
| 132 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 133 | 133 | COMP(1979, interact, 0, 0, interact, interact, 0, 0, "Interact", "Interact Family Computer", GAME_NOT_WORKING) |
| 134 | 134 | COMP(????, hector1, interact, 0, interact, interact, 0, 0, "Micronique", "Hector 1", GAME_NOT_WORKING) |
| 135 | 135 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Nanos |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 109 | 109 | }; |
| 110 | 110 | static ADDRESS_MAP_START( nanos_io , ADDRESS_SPACE_IO, 8) |
| 111 | 111 | ADDRESS_MAP_UNMAP_HIGH |
| 112 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 112 | ADDRESS_MAP_GLOBAL_MASK(0xff) | |
| 113 | 113 | /* CPU card */ |
| 114 | 114 | AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w) |
| 115 | ||
| 115 | ||
| 116 | 116 | /* I/O card */ |
| 117 | 117 | AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80pio_0", z80pio_r, z80pio_w) |
| 118 | 118 | AM_RANGE(0x84, 0x84) AM_DEVREADWRITE("z80sio_0", z80sio_d_r, z80sio_d_w) |
| r5932 | r5933 | |
| 121 | 121 | AM_RANGE(0x87, 0x87) AM_DEVREADWRITE("z80sio_0", z80sio_c_r, z80sio_c_w) |
| 122 | 122 | AM_RANGE(0x88, 0x8B) AM_DEVREADWRITE("z80pio_1", z80pio_r, z80pio_w) |
| 123 | 123 | AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE("z80ctc_0", z80ctc_r, z80ctc_w) |
| 124 | ||
| 124 | ||
| 125 | 125 | /* FDC card */ |
| 126 | 126 | AM_RANGE(0x92, 0x92) AM_WRITE(nanos_tc_w) |
| 127 | 127 | AM_RANGE(0x94, 0x94) AM_DEVREAD("nec765", nec765_status_r) |
| r5932 | r5933 | |
| 132 | 132 | AM_RANGE(0xA2, 0xA2) AM_DEVREADWRITE("z80sio_1", z80sio_d_r, z80sio_d_w) |
| 133 | 133 | AM_RANGE(0xA3, 0xA3) AM_DEVREADWRITE("z80sio_1", z80sio_c_r, z80sio_c_w) |
| 134 | 134 | AM_RANGE(0xA4, 0xA7) AM_DEVREADWRITE("z80ctc_1", z80ctc_r, z80ctc_w) |
| 135 | ||
| 136 | /* 256-k RAM card I - 64k OS-Memory + 192k-RAM-Floppy */ | |
| 135 | ||
| 136 | /* 256-k RAM card I - 64k OS-Memory + 192k-RAM-Floppy */ | |
| 137 | 137 | //AM_RANGE(0xC0, 0xC7) |
| 138 | ||
| 139 | /* 256-k RAM card II - 64k OS-Memory + 192k-RAM-Floppy */ | |
| 138 | ||
| 139 | /* 256-k RAM card II - 64k OS-Memory + 192k-RAM-Floppy */ | |
| 140 | 140 | //AM_RANGE(0xC8, 0xCF) |
| 141 | 141 | ADDRESS_MAP_END |
| 142 | 142 | |
| 143 | 143 | /* Input ports */ |
| 144 | 144 | static INPUT_PORTS_START( nanos ) |
| 145 | PORT_START("LINEC") | |
| 145 | PORT_START("LINEC") | |
| 146 | 146 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 147 | 147 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 148 | 148 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) |
| r5932 | r5933 | |
| 165 | 165 | PORT_START("LINE1") |
| 166 | 166 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 167 | 167 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 168 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) | |
| 169 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) | |
| 170 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 171 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) | |
| 168 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) | |
| 169 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) | |
| 170 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) | |
| 171 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) | |
| 172 | 172 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) |
| 173 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 173 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) | |
| 174 | 174 | |
| 175 | 175 | PORT_START("LINE2") |
| 176 | 176 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_END) |
| r5932 | r5933 | |
| 191 | 191 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) |
| 192 | 192 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) |
| 193 | 193 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 194 | ||
| 194 | ||
| 195 | 195 | PORT_START("LINE4") |
| 196 | 196 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 197 | 197 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| r5932 | r5933 | |
| 201 | 201 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) |
| 202 | 202 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) |
| 203 | 203 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 204 | ||
| 204 | ||
| 205 | 205 | PORT_START("LINE5") |
| 206 | 206 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) |
| 207 | 207 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) |
| 208 | 208 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) |
| 209 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) | |
| 209 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) | |
| 210 | 210 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) |
| 211 | 211 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 212 | 212 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~") PORT_CODE(KEYCODE_TILDE) |
| 213 | 213 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL")PORT_CODE(KEYCODE_BACKSPACE) |
| 214 | ||
| 214 | ||
| 215 | 215 | PORT_START("LINE6") |
| 216 | 216 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) |
| 217 | 217 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) |
| 218 | 218 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) |
| 219 | 219 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) |
| 220 | 220 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 221 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) | |
| 222 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) | |
| 223 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) | |
| 221 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) | |
| 222 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) | |
| 223 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) | |
| 224 | 224 | INPUT_PORTS_END |
| 225 | 225 | |
| 226 | 226 | |
| r5932 | r5933 | |
| 231 | 231 | |
| 232 | 232 | static VIDEO_UPDATE( nanos ) |
| 233 | 233 | { |
| 234 | // | |
| 234 | // static UINT8 framecnt=0; | |
| 235 | 235 | UINT8 y,ra,chr,gfx; |
| 236 | 236 | UINT16 sy=0,ma=0,x; |
| 237 | 237 | |
| 238 | // | |
| 238 | // framecnt++; | |
| 239 | 239 | |
| 240 | 240 | for (y = 0; y < 25; y++) |
| 241 | 241 | { |
| r5932 | r5933 | |
| 275 | 275 | UINT8 last_code = 0; |
| 276 | 276 | UINT8 key_pressed = 0xff; |
| 277 | 277 | static READ8_DEVICE_HANDLER (nanos_port_a_r) |
| 278 | { | |
| 278 | { | |
| 279 | 279 | UINT8 retVal; |
| 280 | 280 | if (key_command==0) { |
| 281 | 281 | return key_pressed; |
| r5932 | r5933 | |
| 294 | 294 | |
| 295 | 295 | static WRITE8_DEVICE_HANDLER (nanos_port_b_w) |
| 296 | 296 | { |
| 297 | key_command = BIT(data,1); | |
| 297 | key_command = BIT(data,1); | |
| 298 | 298 | if (BIT(data,7)) { |
| 299 | 299 | memory_set_bankptr(device->machine, 1, memory_region(device->machine, "maincpu")); |
| 300 | 300 | } else { |
| r5932 | r5933 | |
| 309 | 309 | if BIT(code,4) return 4; |
| 310 | 310 | if BIT(code,5) return 5; |
| 311 | 311 | if BIT(code,6) return 6; |
| 312 | if BIT(code,7) return 7; | |
| 312 | if BIT(code,7) return 7; | |
| 313 | 313 | return 0; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | static TIMER_CALLBACK(keyboard_callback) |
| 317 | 317 | { |
| 318 | 318 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6" }; |
| 319 | ||
| 319 | ||
| 320 | 320 | int i; |
| 321 | 321 | UINT8 code; |
| 322 | 322 | UINT8 key_code = 0; |
| 323 | 323 | UINT8 shift = input_port_read(machine, "LINEC") & 0x02 ? 1 : 0; |
| 324 | 324 | UINT8 ctrl = input_port_read(machine, "LINEC") & 0x01 ? 1 : 0; |
| 325 | key_pressed = 0xff; | |
| 326 | for(i = 0; i < 7; i++) | |
| 325 | key_pressed = 0xff; | |
| 326 | for(i = 0; i < 7; i++) | |
| 327 | 327 | { |
| 328 | ||
| 328 | ||
| 329 | 329 | code = input_port_read(machine, keynames[i]); |
| 330 | if (code != 0) | |
| 330 | if (code != 0) | |
| 331 | 331 | { |
| 332 | 332 | if (i==0 && shift==0) { |
| 333 | 333 | key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs |
| r5932 | r5933 | |
| 376 | 376 | key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl |
| 377 | 377 | } |
| 378 | 378 | if (i==6) { |
| 379 | switch(row_number(code)) | |
| 379 | switch(row_number(code)) | |
| 380 | 380 | { |
| 381 | 381 | case 0: key_code = 0x11; break; |
| 382 | 382 | case 1: key_code = 0x12; break; |
| r5932 | r5933 | |
| 390 | 390 | } |
| 391 | 391 | last_code = key_code; |
| 392 | 392 | } |
| 393 | } | |
| 394 | if (key_code==0){ | |
| 395 | key_pressed = 0xf7; | |
| 396 | 393 | } |
| 394 | if (key_code==0){ | |
| 395 | key_pressed = 0xf7; | |
| 396 | } | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | static MACHINE_RESET(nanos) | |
| 400 | { | |
| 399 | static MACHINE_RESET(nanos) | |
| 400 | { | |
| 401 | 401 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 402 | ||
| 403 | memory_install_write8_handler(space, 0x0000, 0x0fff, 0, 0, SMH_BANK(3)); | |
| 404 | memory_install_write8_handler(space, 0x1000, 0xffff, 0, 0, SMH_BANK(2)); | |
| 405 | ||
| 402 | ||
| 403 | memory_install_write8_handler(space, 0x0000, 0x0fff, 0, 0, SMH_BANK(3)); | |
| 404 | memory_install_write8_handler(space, 0x1000, 0xffff, 0, 0, SMH_BANK(2)); | |
| 405 | ||
| 406 | 406 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu")); |
| 407 | 407 | memory_set_bankptr(machine, 2, mess_ram + 0x1000); |
| 408 | 408 | memory_set_bankptr(machine, 3, mess_ram); |
| 409 | ||
| 409 | ||
| 410 | 410 | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1); |
| 411 | ||
| 411 | ||
| 412 | 412 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1); |
| 413 | 413 | timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback); |
| 414 | 414 | } |
| r5932 | r5933 | |
| 454 | 454 | /* basic machine hardware */ |
| 455 | 455 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 456 | 456 | MDRV_CPU_PROGRAM_MAP(nanos_mem) |
| 457 | MDRV_CPU_IO_MAP(nanos_io) | |
| 457 | MDRV_CPU_IO_MAP(nanos_io) | |
| 458 | 458 | MDRV_CPU_CONFIG(nanos_daisy_chain) |
| 459 | 459 | |
| 460 | 460 | |
| 461 | 461 | MDRV_MACHINE_RESET(nanos) |
| 462 | ||
| 462 | ||
| 463 | 463 | /* video hardware */ |
| 464 | 464 | MDRV_SCREEN_ADD("screen", RASTER) |
| 465 | 465 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 472 | 472 | |
| 473 | 473 | MDRV_VIDEO_START(nanos) |
| 474 | 474 | MDRV_VIDEO_UPDATE(nanos) |
| 475 | ||
| 475 | ||
| 476 | 476 | /* devices */ |
| 477 | 477 | MDRV_Z80CTC_ADD( "z80ctc_0", XTAL_4MHz, ctc_intf) |
| 478 | 478 | MDRV_Z80CTC_ADD( "z80ctc_1", XTAL_4MHz, ctc_intf) |
| r5932 | r5933 | |
| 482 | 482 | MDRV_Z80SIO_ADD( "z80sio_1", XTAL_4MHz, sio_intf) |
| 483 | 483 | MDRV_Z80PIO_ADD( "z80pio", nanos_z80pio_intf ) |
| 484 | 484 | /* NEC765 */ |
| 485 | MDRV_NEC765A_ADD("nec765", nanos_nec765_interface) | |
| 486 | ||
| 485 | MDRV_NEC765A_ADD("nec765", nanos_nec765_interface) | |
| 486 | ||
| 487 | 487 | MDRV_FLOPPY_4_DRIVES_ADD(nanos_floppy_config) |
| 488 | 488 | MACHINE_DRIVER_END |
| 489 | 489 |
| r5932 | r5933 | |
|---|---|---|
| 38 | 38 | "", |
| 39 | 39 | "", |
| 40 | 40 | "", |
| 41 | "Active width", | |
| 41 | "Active width", | |
| 42 | 42 | "Active height", |
| 43 | 43 | "HSYNC width", |
| 44 | 44 | "HSYNC start", |
| r5932 | r5933 | |
| 108 | 108 | "V End region A top", |
| 109 | 109 | "V End region A bottom", |
| 110 | 110 | "YUV Source region A L", // a0 |
| 111 | "YUV Source region A H", | |
| 111 | "YUV Source region A H", | |
| 112 | 112 | }; |
| 113 | 113 | #endif |
| 114 | 114 | static VIDEO_UPDATE( gp2x ) |
| r5932 | r5933 | |
| 122 | 122 | int x, y; |
| 123 | 123 | UINT16 *vram = (UINT16 *)&gp2x_ram[0x2100000/4]; |
| 124 | 124 | |
| 125 | /* printf("RGB still image 1 enabled, bpp %d, size is %d %d %d %d\n", | |
| 126 | (gp2x_vidregs[(0xda/2)]>>9)&3, | |
| 127 | gp2x_vidregs[(0xe2/2)], | |
| 128 | gp2x_vidregs[(0xe4/2)], | |
| 129 | gp2x_vidregs[(0xe6/2)], | |
| 130 | gp2x_vidregs[(0xe8/2)]);*/ | |
| 125 | /* printf("RGB still image 1 enabled, bpp %d, size is %d %d %d %d\n", | |
| 126 | (gp2x_vidregs[(0xda/2)]>>9)&3, | |
| 127 | gp2x_vidregs[(0xe2/2)], | |
| 128 | gp2x_vidregs[(0xe4/2)], | |
| 129 | gp2x_vidregs[(0xe6/2)], | |
| 130 | gp2x_vidregs[(0xe8/2)]);*/ | |
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | for (y = 0; y < 240; y++) |
| r5932 | r5933 | |
| 157 | 157 | if (mem_mask == 0xffff) |
| 158 | 158 | { |
| 159 | 159 | gp2x_vidregs[offset*2] = data; |
| 160 | // | |
| 160 | // printf("%x to video reg %x (%s)\n", data, offset*2, gp2x_regnames[offset*2]); | |
| 161 | 161 | } |
| 162 | 162 | else if (mem_mask == 0xffff0000) |
| 163 | 163 | { |
| 164 | 164 | gp2x_vidregs[(offset*2)+1] = data>>16; |
| 165 | // | |
| 165 | // printf("%x to video reg %x (%s)\n", data>>16, (offset*2)+1, gp2x_regnames[(offset*2)+1]); | |
| 166 | 166 | } |
| 167 | 167 | else |
| 168 | 168 | { |
| r5932 | r5933 | |
| 213 | 213 | |
| 214 | 214 | case 0x90: // read ID |
| 215 | 215 | switch (nand_stage++) |
| 216 | { | |
| 216 | { | |
| 217 | 217 | case 0: |
| 218 | 218 | return 0xec; // Samsung |
| 219 | 219 | case 1: |
| r5932 | r5933 | |
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | // | |
| 230 | // printf("Read unknown nand offset %x\n", offset); | |
| 231 | 231 | |
| 232 | 232 | return 0; |
| 233 | 233 | } |
| r5932 | r5933 | |
| 238 | 238 | { |
| 239 | 239 | case 4: // command |
| 240 | 240 | nand_cmd = data; |
| 241 | // | |
| 241 | // printf("NAND: command %x (PC %x0)\n", data, cpu_get_pc(space->cpu)); | |
| 242 | 242 | nand_stage = 0; |
| 243 | 243 | nand_subword_stage = 0; |
| 244 | 244 | break; |
| r5932 | r5933 | |
| 264 | 264 | nand_ptr_temp &= ~0xff000000; |
| 265 | 265 | nand_ptr_temp |= data<<24; |
| 266 | 266 | |
| 267 | // | |
| 267 | // printf("NAND: ptr now %x, /2 %x, replacing %x\n", nand_ptr_temp, nand_ptr_temp/2, nand_ptr); | |
| 268 | 268 | nand_ptr = nand_ptr_temp/2; |
| 269 | 269 | break; |
| 270 | 270 | } |
| r5932 | r5933 | |
| 301 | 301 | |
| 302 | 302 | static WRITE32_HANDLER(nand_ctrl_w) |
| 303 | 303 | { |
| 304 | // | |
| 304 | // printf("%08x to nand_ctrl_w\n", data); | |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | static READ32_HANDLER(sdcard_r) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Robotron Z9001 (KC85/1) |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 12 | 12 | static UINT8 *z9001_video_ram; |
| 13 | 13 | |
| 14 | 14 | static ADDRESS_MAP_START(z9001_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 15 | ADDRESS_MAP_UNMAP_HIGH | |
| 16 | AM_RANGE( 0x0000, 0xebff ) AM_RAM | |
| 17 | AM_RANGE( 0xec00, 0xefff ) AM_RAM AM_BASE(&z9001_video_ram) | |
| 15 | ADDRESS_MAP_UNMAP_HIGH | |
| 16 | AM_RANGE( 0x0000, 0xebff ) AM_RAM | |
| 17 | AM_RANGE( 0xec00, 0xefff ) AM_RAM AM_BASE(&z9001_video_ram) | |
| 18 | 18 | AM_RANGE( 0xf000, 0xffff ) AM_ROM |
| 19 | 19 | ADDRESS_MAP_END |
| 20 | 20 | |
| r5932 | r5933 | |
| 27 | 27 | INPUT_PORTS_END |
| 28 | 28 | |
| 29 | 29 | |
| 30 | static MACHINE_RESET(z9001) | |
| 31 | { | |
| 30 | static MACHINE_RESET(z9001) | |
| 31 | { | |
| 32 | 32 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, 0xf000); |
| 33 | 33 | } |
| 34 | 34 | |
| r5932 | r5933 | |
| 41 | 41 | UINT8 code; |
| 42 | 42 | UINT8 line; |
| 43 | 43 | int y, x, j, b; |
| 44 | ||
| 44 | ||
| 45 | 45 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 46 | ||
| 46 | ||
| 47 | 47 | for (y = 0; y < 24; y++) |
| 48 | 48 | { |
| 49 | 49 | for (x = 0; x < 40; x++) |
| r5932 | r5933 | |
| 53 | 53 | { |
| 54 | 54 | line = gfx[code*8 + j]; |
| 55 | 55 | for (b = 0; b < 8; b++) |
| 56 | { | |
| 56 | { | |
| 57 | 57 | *BITMAP_ADDR16(bitmap, y*8+j, x * 8 + (7 - b)) = ((line >> b) & 0x01); |
| 58 | 58 | } |
| 59 | 59 | } |
| r5932 | r5933 | |
| 66 | 66 | /* basic machine hardware */ |
| 67 | 67 | MDRV_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) |
| 68 | 68 | MDRV_CPU_PROGRAM_MAP(z9001_mem) |
| 69 | MDRV_CPU_IO_MAP(z9001_io) | |
| 69 | MDRV_CPU_IO_MAP(z9001_io) | |
| 70 | 70 | |
| 71 | 71 | MDRV_MACHINE_RESET(z9001) |
| 72 | ||
| 72 | ||
| 73 | 73 | /* video hardware */ |
| 74 | 74 | MDRV_SCREEN_ADD("screen", RASTER) |
| 75 | 75 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 94 | 94 | ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) |
| 95 | 95 | ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) |
| 96 | 96 | ROM_REGION( 0x2000, "gfx1", 0 ) |
| 97 | ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) | |
| 97 | ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) | |
| 98 | 98 | ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) |
| 99 | 99 | ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) |
| 100 | 100 | ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) |
| r5932 | r5933 | |
| 110 | 110 | ROMX_LOAD( "os_rb20.rom", 0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2)) |
| 111 | 111 | ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) |
| 112 | 112 | ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) |
| 113 | ||
| 113 | ||
| 114 | 114 | ROM_LOAD( "basic_c0.87a", 0xc000, 0x2800, CRC(c508d45e) SHA1(ea85b53e21429c4cb85cdb81b92f278a8f4eb574)) |
| 115 | 115 | |
| 116 | 116 | ROM_REGION( 0x2000, "gfx1", 0 ) |
| 117 | ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) | |
| 117 | ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) | |
| 118 | 118 | ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) |
| 119 | 119 | ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) |
| 120 | 120 | ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) |
| r5932 | r5933 | |
| 130 | 130 | ROMX_LOAD( "os_rb20.rom", 0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2)) |
| 131 | 131 | ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" ) |
| 132 | 132 | ROMX_LOAD( "os_rb21.rom", 0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3)) |
| 133 | ||
| 133 | ||
| 134 | 134 | ROM_LOAD( "basic_c0.87b", 0xc000, 0x2800, CRC(9e8f6380) SHA1(8ffecc64ba35c953c93738f8568c83dc6af1ae72)) |
| 135 | 135 | |
| 136 | 136 | ROM_REGION( 0x2000, "gfx1", 0 ) |
| 137 | ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) | |
| 137 | ROM_LOAD( "chargen.851", 0x0000, 0x0800, CRC(dd9c0f4e) SHA1(2e4928ba7161f5cce7173b7d2ded3d6596ae2aa2)) | |
| 138 | 138 | ROM_LOAD( "zg_cga.rom", 0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff)) |
| 139 | 139 | ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621)) |
| 140 | 140 | ROM_LOAD( "zg_de.rom", 0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34)) |
| 141 | 141 | ROM_END |
| 142 | ||
| 142 | ||
| 143 | 143 | #define rom_kc87_21 rom_kc87_20 |
| 144 | ||
| 144 | ||
| 145 | 145 | /* Driver */ |
| 146 | 146 | |
| 147 | 147 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 148 | 148 | COMP( 198?, z9001, 0, 0, z9001, z9001, 0, 0, "Robotron", "Z9001 (KC 85/1.10)", GAME_NOT_WORKING) |
| 149 | COMP( 198?, kc85_111,z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 85/1.11", GAME_NOT_WORKING) | |
| 150 | COMP( 198?, kc87_10, z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 87.10", GAME_NOT_WORKING) | |
| 151 | COMP( 198?, kc87_11, z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 87.11", GAME_NOT_WORKING) | |
| 152 | COMP( 198?, kc87_20, z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 87.20", GAME_NOT_WORKING) | |
| 153 | COMP( 198?, kc87_21, z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 87.21", GAME_NOT_WORKING) | |
| 149 | COMP( 198?, kc85_111,z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 85/1.11", GAME_NOT_WORKING) | |
| 150 | COMP( 198?, kc87_10, z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 87.10", GAME_NOT_WORKING) | |
| 151 | COMP( 198?, kc87_11, z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 87.11", GAME_NOT_WORKING) | |
| 152 | COMP( 198?, kc87_20, z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 87.20", GAME_NOT_WORKING) | |
| 153 | COMP( 198?, kc87_21, z9001, 0, z9001, z9001, 0, 0, "Robotron", "KC 87.21", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 41 | 41 | static ADDRESS_MAP_START (galaxy_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 42 | 42 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 43 | 43 | AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ ( galaxy_keyboard_r ) |
| 44 | AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE ( galaxy_latch_w ) | |
| 44 | AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE ( galaxy_latch_w ) | |
| 45 | 45 | ADDRESS_MAP_END |
| 46 | 46 | |
| 47 | 47 | static ADDRESS_MAP_START (galaxyp_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 48 | 48 | AM_RANGE(0x0000, 0x0fff) AM_ROM // ROM A |
| 49 | 49 | AM_RANGE(0x1000, 0x1fff) AM_ROM // ROM B |
| 50 | 50 | AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ ( galaxy_keyboard_r ) |
| 51 | AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE ( galaxy_latch_w ) | |
| 51 | AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE ( galaxy_latch_w ) | |
| 52 | 52 | AM_RANGE(0xe000, 0xefff) AM_ROM // ROM C |
| 53 | 53 | AM_RANGE(0xf000, 0xffff) AM_ROM // ROM D |
| 54 | 54 | ADDRESS_MAP_END |
| r5932 | r5933 | |
| 211 | 211 | |
| 212 | 212 | MDRV_VIDEO_START( generic_bitmapped ) |
| 213 | 213 | MDRV_VIDEO_UPDATE( galaxy ) |
| 214 | ||
| 214 | ||
| 215 | 215 | /* snapshot */ |
| 216 | 216 | MDRV_SNAPSHOT_ADD("snapshot", galaxy, "gal", 0) |
| 217 | 217 |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | IC10 - Recorder PROM, yet to be found |
| 9 | 9 | IC6/IC7 - PROMs reconstructed by Luigi Serrantoni |
| 10 | 10 | |
| 11 | To Do: | |
| 12 | * Basically everything, in particular implement PROM (described in details | |
| 11 | To Do: | |
| 12 | * Basically everything, in particular implement PROM (described in details | |
| 13 | 13 | at the link below) and i8255 |
| 14 | 14 | |
| 15 | 15 | http://www.computerhistory.it/index.php?option=com_content&task=view&id=85&Itemid=117 |
| r5932 | r5933 | |
| 34 | 34 | static ADDRESS_MAP_START(amico2k_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 35 | 35 | ADDRESS_MAP_UNMAP_HIGH |
| 36 | 36 | AM_RANGE(0x0000, 0x03ff) AM_RAM |
| 37 | // | |
| 37 | // AM_RANGE(0x0400, 0x07ff) AM_RAM // optional expansion RAM | |
| 38 | 38 | AM_RANGE(0xfb00, 0xfcff) AM_ROM |
| 39 | 39 | AM_RANGE(0xfd00, 0xfd03) AM_DEVREADWRITE("i8255a", amico2k_i8255a_r, amico2k_i8255a_w) |
| 40 | 40 | AM_RANGE(0xfe00, 0xffff) AM_ROM |
| r5932 | r5933 | |
| 88 | 88 | |
| 89 | 89 | /* Driver */ |
| 90 | 90 | |
| 91 | /* | |
| 91 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 92 | 92 | COMP( 1978, amico2k, 0, 0, amico2k, amico2k, 0, 0, "A.S.EL.", "Amico 2000", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 254 | 254 | |
| 255 | 255 | /* System Drivers */ |
| 256 | 256 | |
| 257 | /* YEAR | |
| 257 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 258 | 258 | COMP( 1985, huebler, 0, 0, huebler, huebler, 0, huebler, "Bernd Hubler, Klaus-Peter Evert", "Hubler/Everts", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*********************************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Fujitsu Micro 7 (FM-7) | |
| 4 | 4 | |
| 5 | 12/05/2009 Skeleton driver. | |
| 6 | ||
| 7 | Computers in this series: | |
| 8 | ||
| 5 | 12/05/2009 Skeleton driver. | |
| 6 | ||
| 7 | Computers in this series: | |
| 8 | ||
| 9 | 9 | | Release | Main CPU | Sub CPU | RAM | |
| 10 | 10 | ===================================================================================== |
| 11 | 11 | FM-8 | 1981-05 | M68A09 @ 1MHz | M6809 | 64K (main) + 48K (VRAM) | |
| r5932 | r5933 | |
| 19 | 19 | FM-77AV40EX | 1987-11 | M68B09E @ 2MHz | M68B09 | 192/448K (main) + 144K (VRAM) | |
| 20 | 20 | FM-77AV40SX | 1988-11 | M68B09E @ 2MHz | M68B09 | 192/448K (main) + 144K (VRAM) | |
| 21 | 21 | |
| 22 | Note: FM-77AV dumps probably come from a FM-77AV40SX. Shall we confirm that both computers | |
| 23 | used the same BIOS components? | |
| 22 | Note: FM-77AV dumps probably come from a FM-77AV40SX. Shall we confirm that both computers | |
| 23 | used the same BIOS components? | |
| 24 | 24 | |
| 25 | memory map info from http://www.nausicaa.net/~lgreenf/fm7page.htm | |
| 26 | see also http://retropc.net/ryu/xm7/xm7.shtml | |
| 25 | memory map info from http://www.nausicaa.net/~lgreenf/fm7page.htm | |
| 26 | see also http://retropc.net/ryu/xm7/xm7.shtml | |
| 27 | 27 | |
| 28 | 28 | |
| 29 | Known issues: | |
| 30 | - Beeper is not implemented | |
| 31 | - Keyboard repeat is not implemented | |
| 32 | - Optional Kanji ROM use is not implemented | |
| 33 | - Other optional hardware is not implemented (RS232, Z80 card...) | |
| 34 | - FM-77AV and later aren't working (extra features not yet implemented) | |
| 29 | Known issues: | |
| 30 | - Beeper is not implemented | |
| 31 | - Keyboard repeat is not implemented | |
| 32 | - Optional Kanji ROM use is not implemented | |
| 33 | - Other optional hardware is not implemented (RS232, Z80 card...) | |
| 34 | - FM-77AV and later aren't working (extra features not yet implemented) | |
| 35 | 35 | |
| 36 | 36 | ************************************************************************************************/ |
| 37 | 37 | |
| r5932 | r5933 | |
| 55 | 55 | UINT8* fm7_boot_ram; // Boot RAM (AV only) |
| 56 | 56 | UINT8 fm7_type; |
| 57 | 57 | static UINT8 irq_flags; // active IRQ flags |
| 58 | static UINT8 irq_mask; // IRQ mask | |
| 58 | static UINT8 irq_mask; // IRQ mask | |
| 59 | 59 | emu_timer* fm7_timer; // main timer, triggered every 2.0345ms |
| 60 | 60 | emu_timer* fm7_subtimer; // sub-CPU timer, triggered every 20ms |
| 61 | 61 | emu_timer* fm7_keyboard_timer; |
| r5932 | r5933 | |
| 108 | 108 | * when kana is active. |
| 109 | 109 | */ |
| 110 | 110 | // TODO: fill in shift,ctrl,graph and kana code |
| 111 | static const UINT16 fm7_key_list[0x60][7] = | |
| 111 | static const UINT16 fm7_key_list[0x60][7] = | |
| 112 | 112 | { // norm shift ctrl graph kana sh.kana scan |
| 113 | 113 | {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, |
| 114 | 114 | {0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x01}, // ESC |
| r5932 | r5933 | |
| 139 | 139 | {0x70, 0x50, 0x10, 0x8d, 0xbe, 0x00, 0x1a}, // P |
| 140 | 140 | {0x40, 0x60, 0x00, 0x8a, 0xde, 0x00, 0x1b}, // @ |
| 141 | 141 | {0x5b, 0x7b, 0x1b, 0xed, 0xdf, 0xa2, 0x1c}, // [ |
| 142 | {0x0d, 0x0d, 0x00, 0x0d, 0x0d, 0x0d, 0x1d}, // Return | |
| 142 | {0x0d, 0x0d, 0x00, 0x0d, 0x0d, 0x0d, 0x1d}, // Return | |
| 143 | 143 | {0x61, 0x41, 0x01, 0x95, 0xc1, 0x00, 0x1e}, // A |
| 144 | 144 | {0x73, 0x53, 0x13, 0x96, 0xc4, 0x00, 0x1f}, // S |
| 145 | 145 | |
| r5932 | r5933 | |
| 162 | 162 | {0x6d, 0x4d, 0x0d, 0x86, 0xd3, 0x00, 0x30}, // M |
| 163 | 163 | {0x2c, 0x3c, 0x00, 0x87, 0xc8, 0xa4, 0x31}, // < |
| 164 | 164 | {0x2e, 0x3e, 0x00, 0x88, 0xd9, 0xa1, 0x32}, // > |
| 165 | {0x2f, 0x3f, 0x00, 0x97, 0xd2, 0xa5, 0x33}, // / | |
| 165 | {0x2f, 0x3f, 0x00, 0x97, 0xd2, 0xa5, 0x33}, // / | |
| 166 | 166 | {0x22, 0x5f, 0x1f, 0xe0, 0xdb, 0x00, 0x34}, // " |
| 167 | 167 | {0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x35}, // Space |
| 168 | 168 | {0x2a, 0x2a, 0x00, 0x98, 0x2a, 0x2a, 0x36}, // Tenkey |
| 169 | 169 | {0x2f, 0x2f, 0x00, 0x91, 0x2f, 0x2f, 0x37}, |
| 170 | 170 | {0x2b, 0x2b, 0x00, 0x99, 0x2b, 0x2b, 0x38}, |
| 171 | 171 | {0x2d, 0x2d, 0x00, 0xee, 0x2d, 0x2d, 0x39}, |
| 172 | {0x37, 0x37, 0x00, 0xe1, 0x37, 0x37, 0x3a}, | |
| 172 | {0x37, 0x37, 0x00, 0xe1, 0x37, 0x37, 0x3a}, | |
| 173 | 173 | {0x38, 0x38, 0x00, 0xe2, 0x38, 0x38, 0x3b}, |
| 174 | 174 | {0x39, 0x39, 0x00, 0xe3, 0x39, 0x39, 0x3c}, |
| 175 | 175 | {0x3d, 0x3d, 0x00, 0xef, 0x3d, 0x3d, 0x3d}, // Tenkey = |
| r5932 | r5933 | |
| 214 | 214 | static void main_irq_set_flag(running_machine* machine, UINT8 flag) |
| 215 | 215 | { |
| 216 | 216 | irq_flags |= flag; |
| 217 | ||
| 217 | ||
| 218 | 218 | if(irq_flags != 0) |
| 219 | 219 | cputag_set_input_line(machine,"maincpu",M6809_IRQ_LINE,ASSERT_LINE); |
| 220 | 220 | } |
| r5932 | r5933 | |
| 230 | 230 | |
| 231 | 231 | /* |
| 232 | 232 | * Main CPU: I/O port 0xfd02 |
| 233 | * | |
| 233 | * | |
| 234 | 234 | * On read: returns cassette data (bit 7) and printer status (bits 0-5) |
| 235 | * On write: sets IRQ masks | |
| 235 | * On write: sets IRQ masks | |
| 236 | 236 | * bit 0 - keypress |
| 237 | 237 | * bit 1 - printer |
| 238 | 238 | * bit 2 - timer |
| r5932 | r5933 | |
| 241 | 241 | * bit 5 - TXRDY |
| 242 | 242 | * bit 6 - RXRDY |
| 243 | 243 | * bit 7 - SYNDET |
| 244 | * | |
| 244 | * | |
| 245 | 245 | */ |
| 246 | 246 | static WRITE8_HANDLER( fm7_irq_mask_w ) |
| 247 | 247 | { |
| r5932 | r5933 | |
| 251 | 251 | |
| 252 | 252 | /* |
| 253 | 253 | * Main CPU: I/O port 0xfd03 |
| 254 | * | |
| 254 | * | |
| 255 | 255 | * On read: returns which IRQ is currently active (typically read by IRQ handler) |
| 256 | 256 | * bit 0 - keypress |
| 257 | 257 | * bit 1 - printer |
| r5932 | r5933 | |
| 265 | 265 | static READ8_HANDLER( fm7_irq_cause_r ) |
| 266 | 266 | { |
| 267 | 267 | UINT8 ret = ~irq_flags; |
| 268 | ||
| 268 | ||
| 269 | 269 | // Timer and Printer IRQ flags are cleared when this port is read |
| 270 | 270 | // Keyboard IRQ flag is cleared when the scancode is read from |
| 271 | // either keyboard data port (main CPU 0xfd01 or sub CPU 0xd401) | |
| 271 | // either keyboard data port (main CPU 0xfd01 or sub CPU 0xd401) | |
| 272 | 272 | if(irq_flags & 0x04) |
| 273 | 273 | main_irq_clear_flag(space->machine,IRQ_FLAG_TIMER); |
| 274 | 274 | if(irq_flags & 0x02) |
| 275 | 275 | main_irq_clear_flag(space->machine,IRQ_FLAG_PRINTER); |
| 276 | ||
| 276 | ||
| 277 | 277 | logerror("IRQ flags read: 0x%02x\n",ret); |
| 278 | 278 | return ret; |
| 279 | 279 | } |
| r5932 | r5933 | |
| 287 | 287 | static WRITE8_HANDLER( fm7_beeper_w ) |
| 288 | 288 | { |
| 289 | 289 | speaker_active = data & 0x01; |
| 290 | ||
| 290 | ||
| 291 | 291 | if(!speaker_active) // speaker not active, disable all beeper sound |
| 292 | 292 | { |
| 293 | 293 | beep_set_state(devtag_get_device(space->machine,"beeper"),0); |
| 294 | 294 | return; |
| 295 | 295 | } |
| 296 | ||
| 296 | ||
| 297 | 297 | if(data & 0x80) |
| 298 | 298 | { |
| 299 | 299 | if(speaker_active) |
| r5932 | r5933 | |
| 301 | 301 | } |
| 302 | 302 | else |
| 303 | 303 | beep_set_state(devtag_get_device(space->machine,"beeper"),0); |
| 304 | ||
| 304 | ||
| 305 | 305 | if(data & 0x40) |
| 306 | 306 | { |
| 307 | 307 | if(speaker_active) |
| r5932 | r5933 | |
| 349 | 349 | static WRITE8_HANDLER( vector_w ) |
| 350 | 350 | { |
| 351 | 351 | UINT8* RAM = memory_region(space->machine,"maincpu"); |
| 352 | ||
| 352 | ||
| 353 | 353 | if(fm7_type == SYS_FM7) |
| 354 | 354 | RAM[0xfff0+offset] = data; |
| 355 | 355 | else |
| r5932 | r5933 | |
| 358 | 358 | |
| 359 | 359 | /* |
| 360 | 360 | * Main CPU: I/O port 0xfd04 |
| 361 | * | |
| 361 | * | |
| 362 | 362 | * bit 0 - attention IRQ active, clears flag when read. |
| 363 | 363 | * bit 1 - break key active |
| 364 | 364 | */ |
| 365 | 365 | static READ8_HANDLER( fm7_fd04_r ) |
| 366 | 366 | { |
| 367 | 367 | UINT8 ret = 0xff; |
| 368 | ||
| 368 | ||
| 369 | 369 | if(fm7_video.attn_irq != 0) |
| 370 | 370 | { |
| 371 | 371 | ret &= ~0x01; |
| r5932 | r5933 | |
| 378 | 378 | return ret; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | /* | |
| 381 | /* | |
| 382 | 382 | * Main CPU: I/O port 0xfd0f |
| 383 | * | |
| 383 | * | |
| 384 | 384 | * On read, enables BASIC ROM at 0x8000 (default) |
| 385 | 385 | * On write, disables BASIC ROM, enables RAM (if more than 32kB) |
| 386 | 386 | */ |
| 387 | 387 | static READ8_HANDLER( fm7_rom_en_r ) |
| 388 | 388 | { |
| 389 | 389 | UINT8* RAM = memory_region(space->machine,"maincpu"); |
| 390 | ||
| 390 | ||
| 391 | 391 | basic_rom_en = 1; |
| 392 | 392 | if(fm7_type == SYS_FM7) |
| 393 | 393 | { |
| r5932 | r5933 | |
| 403 | 403 | static WRITE8_HANDLER( fm7_rom_en_w ) |
| 404 | 404 | { |
| 405 | 405 | UINT8* RAM = memory_region(space->machine,"maincpu"); |
| 406 | ||
| 406 | ||
| 407 | 407 | basic_rom_en = 0; |
| 408 | 408 | if(fm7_type == SYS_FM7) |
| 409 | 409 | { |
| r5932 | r5933 | |
| 419 | 419 | * Main CPU: port 0xfd10 |
| 420 | 420 | * Initiate ROM enable. (FM-77AV and later only) |
| 421 | 421 | * Port is write-only. Initiate ROM is on by default. |
| 422 | * | |
| 422 | * | |
| 423 | 423 | */ |
| 424 | 424 | WRITE8_HANDLER( fm7_init_en_w ) |
| 425 | 425 | { |
| r5932 | r5933 | |
| 457 | 457 | break; |
| 458 | 458 | } |
| 459 | 459 | } |
| 460 | ||
| 460 | ||
| 461 | 461 | static READ8_HANDLER( fm7_fdc_r ) |
| 462 | 462 | { |
| 463 | 463 | const device_config* dev = devtag_get_device(space->machine,"fdc"); |
| 464 | 464 | UINT8 ret = 0; |
| 465 | ||
| 465 | ||
| 466 | 466 | switch(offset) |
| 467 | 467 | { |
| 468 | 468 | case 0: |
| r5932 | r5933 | |
| 531 | 531 | case 6: |
| 532 | 532 | // FM77AV and later only. FM-7 returns 0xff; |
| 533 | 533 | // bit 6 = 320k(1)/640k(0) FDD |
| 534 | // bits 2,3 = logical drive | |
| 534 | // bits 2,3 = logical drive | |
| 535 | 535 | logerror("FDC: mode write - %02x\n",data); |
| 536 | 536 | break; |
| 537 | 537 | default: |
| r5932 | r5933 | |
| 542 | 542 | /* |
| 543 | 543 | * Main CPU: I/O ports 0xfd00-0xfd01 |
| 544 | 544 | * Sub CPU: I/O ports 0xd400-0xd401 |
| 545 | * | |
| 545 | * | |
| 546 | 546 | * The scancode of the last key pressed is stored in fd/d401, with the 9th |
| 547 | 547 | * bit (MSB) in bit 7 of fd/d400. 0xfd00 also holds a flag for the main |
| 548 | 548 | * CPU clock speed in bit 0 (0 = 1.2MHz, 1 = 2MHz) |
| r5932 | r5933 | |
| 584 | 584 | /* |
| 585 | 585 | * Sub CPU: port 0xd431, 0xd432 |
| 586 | 586 | * Keyboard encoder |
| 587 | * | |
| 587 | * | |
| 588 | 588 | * d431 (R/W): Data register (8 bit) |
| 589 | 589 | * d432 (R/O): Status register |
| 590 | 590 | * bit 0 - ACK |
| 591 | 591 | * bit 7 - LATCH (0 if ready to receive) |
| 592 | * | |
| 592 | * | |
| 593 | 593 | * Encoder commands: |
| 594 | * 00 xx : Set scancode format (FM-7, FM16B(?), Scan(Make/Break)) | |
| 595 | * 01 : Get scancode format | |
| 596 | * 02 xx : Set LED status | |
| 597 | * 03 : Get LED status | |
| 598 | * 04 xx : Enable/Disable key repeat | |
| 599 | * 05 xx xx : Set repeat rate and time | |
| 600 | * 80 00 : Get RTC | |
| 601 | * 80 01 xx xx xx xx xx xx xx : Set RTC | |
| 602 | * 81 xx : Video digitise | |
| 603 | * 82 xx : Set video mode(?) | |
| 604 | * 83 : Get video mode(?) | |
| 605 | * 84 xx : Video brightness (monitor?) | |
| 606 | * | |
| 594 | * 00 xx : Set scancode format (FM-7, FM16B(?), Scan(Make/Break)) | |
| 595 | * 01 : Get scancode format | |
| 596 | * 02 xx : Set LED status | |
| 597 | * 03 : Get LED status | |
| 598 | * 04 xx : Enable/Disable key repeat | |
| 599 | * 05 xx xx : Set repeat rate and time | |
| 600 | * 80 00 : Get RTC | |
| 601 | * 80 01 xx xx xx xx xx xx xx : Set RTC | |
| 602 | * 81 xx : Video digitise | |
| 603 | * 82 xx : Set video mode(?) | |
| 604 | * 83 : Get video mode(?) | |
| 605 | * 84 xx : Video brightness (monitor?) | |
| 606 | * | |
| 607 | 607 | * ACK is received after 5us. |
| 608 | 608 | */ |
| 609 | 609 | READ8_HANDLER( fm77av_key_encoder_r ) |
| r5932 | r5933 | |
| 629 | 629 | ret &= ~0x01; |
| 630 | 630 | break; |
| 631 | 631 | } |
| 632 | ||
| 632 | ||
| 633 | 633 | return ret; |
| 634 | 634 | } |
| 635 | 635 | |
| r5932 | r5933 | |
| 755 | 755 | { |
| 756 | 756 | if(fm7_encoder.buffer[0] == 0x80 || fm7_encoder.buffer[1] == 0x01) |
| 757 | 757 | { |
| 758 | fm7_encoder.tx_count = 8; // 80 01 command is 9 bytes | |
| 758 | fm7_encoder.tx_count = 8; // 80 01 command is 9 bytes | |
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | fm7_encoder.buffer[fm7_encoder.position] = data; |
| r5932 | r5933 | |
| 763 | 763 | fm7_encoder.tx_count--; |
| 764 | 764 | if(fm7_encoder.tx_count == 0) // last byte |
| 765 | 765 | fm77av_encoder_handle_command(); |
| 766 | ||
| 766 | ||
| 767 | 767 | // wait 5us to set ACK flag |
| 768 | 768 | timer_set(space->machine,ATTOTIME_IN_USEC(5),NULL,0,fm77av_encoder_ack); |
| 769 | ||
| 769 | ||
| 770 | 770 | //logerror("ENC: write 0x%02x to data register, moved to pos %i\n",data,fm7_encoder.position); |
| 771 | 771 | } |
| 772 | 772 | } |
| r5932 | r5933 | |
| 781 | 781 | // bit 1: printer error |
| 782 | 782 | // bit 0: printer busy |
| 783 | 783 | UINT8 ret = 0x00; |
| 784 | double data = cassette_input(devtag_get_device(space->machine,"cass")); | |
| 784 | double data = cassette_input(devtag_get_device(space->machine,"cass")); | |
| 785 | 785 | const device_config* printer_dev = devtag_get_device(space->machine,"lpt"); |
| 786 | 786 | UINT8 pdata; |
| 787 | 787 | int x; |
| 788 | ||
| 788 | ||
| 789 | 789 | if(data > 0.03) |
| 790 | 790 | ret |= 0x80; |
| 791 | ||
| 791 | ||
| 792 | 792 | if(cassette_get_state(devtag_get_device(space->machine,"cass")) & CASSETTE_MOTOR_DISABLED) |
| 793 | 793 | ret |= 0x80; // cassette input is high when not in use. |
| 794 | ||
| 794 | ||
| 795 | 795 | ret |= 0x70; |
| 796 | 796 | |
| 797 | 797 | if(input_port_read(space->machine,"config") & 0x01) |
| r5932 | r5933 | |
| 806 | 806 | } |
| 807 | 807 | } |
| 808 | 808 | else |
| 809 | { | |
| 809 | { | |
| 810 | 810 | if(image_exists(devtag_get_device(space->machine,"lpt:printer"))) |
| 811 | 811 | { |
| 812 | 812 | if(centronics_pe_r(printer_dev)) |
| r5932 | r5933 | |
| 850 | 850 | |
| 851 | 851 | /* |
| 852 | 852 | * Main CPU: 0xfd0b |
| 853 | * - bit 0: Boot mode: 0=BASIC, 1=DOS | |
| 853 | * - bit 0: Boot mode: 0=BASIC, 1=DOS | |
| 854 | 854 | */ |
| 855 | 855 | READ8_HANDLER( fm77av_boot_mode_r ) |
| 856 | 856 | { |
| 857 | 857 | UINT8 ret = 0xff; |
| 858 | ||
| 858 | ||
| 859 | 859 | if(input_port_read(space->machine,"DSW") & 0x02) |
| 860 | 860 | ret &= ~0x01; |
| 861 | ||
| 861 | ||
| 862 | 862 | return 0xff; |
| 863 | 863 | } |
| 864 | 864 | |
| r5932 | r5933 | |
| 946 | 946 | |
| 947 | 947 | static READ8_HANDLER( fm7_psg_data_r ) |
| 948 | 948 | { |
| 949 | // | |
| 949 | // fm7_update_psg(space->machine); | |
| 950 | 950 | return psg_data; |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | static WRITE8_HANDLER( fm7_psg_data_w ) |
| 954 | 954 | { |
| 955 | 955 | psg_data = data; |
| 956 | // | |
| 956 | // fm7_update_psg(space->machine); | |
| 957 | 957 | } |
| 958 | 958 | |
| 959 | 959 | static WRITE8_HANDLER( fm77av_bootram_w ) |
| r5932 | r5933 | |
| 981 | 981 | static READ8_HANDLER( fm7_fmirq_r ) |
| 982 | 982 | { |
| 983 | 983 | UINT8 ret = 0xff; |
| 984 | ||
| 984 | ||
| 985 | 985 | if(fm77av_ym_irq != 0) |
| 986 | 986 | ret &= ~0x08; |
| 987 | ||
| 987 | ||
| 988 | 988 | return ret; |
| 989 | 989 | } |
| 990 | 990 | |
| r5932 | r5933 | |
| 1011 | 1011 | /* |
| 1012 | 1012 | * Memory Management Register |
| 1013 | 1013 | * Main CPU: 0xfd80 - 0xfd93 (FM-77L4, FM-77AV and later only) |
| 1014 | * | |
| 1014 | * | |
| 1015 | 1015 | * fd80-fd8f (R/W): RAM bank select for current segment (A19-A12) |
| 1016 | 1016 | * fd90 (W/O): segment select register (3-bit, default = 0) |
| 1017 | 1017 | * fd92 (W/O): window offset register (OA15-OA8) |
| 1018 | 1018 | * fd93 (R/W): mode select register |
| 1019 | * - bit 7: MMR enable/disable | |
| 1020 | * - bit 6: window enable/disable | |
| 1021 | * - bit 0: boot RAM read-write/read-only | |
| 1022 | * | |
| 1019 | * - bit 7: MMR enable/disable | |
| 1020 | * - bit 6: window enable/disable | |
| 1021 | * - bit 0: boot RAM read-write/read-only | |
| 1022 | * | |
| 1023 | 1023 | */ |
| 1024 | 1024 | static READ8_HANDLER( fm7_mmr_r ) |
| 1025 | 1025 | { |
| r5932 | r5933 | |
| 1036 | 1036 | { |
| 1037 | 1037 | UINT8* RAM = memory_region(space->machine,"maincpu"); |
| 1038 | 1038 | UINT16 size = 0xfff; |
| 1039 | ||
| 1039 | ||
| 1040 | 1040 | if(bank == 15) |
| 1041 | 1041 | size = 0xbff; |
| 1042 | ||
| 1042 | ||
| 1043 | 1043 | if(physical >= 0x10 && physical <= 0x1b) |
| 1044 | 1044 | { |
| 1045 | 1045 | switch(physical) |
| r5932 | r5933 | |
| 1081 | 1081 | memory_install_readwrite8_handler(space,bank*0x1000,(bank*0x1000)+size,0,0,fm7_vramB_r,fm7_vramB_w); |
| 1082 | 1082 | break; |
| 1083 | 1083 | } |
| 1084 | // | |
| 1084 | // memory_set_bankptr(space->machine,bank+1,RAM+(physical<<12)-0x10000); | |
| 1085 | 1085 | return; |
| 1086 | 1086 | } |
| 1087 | 1087 | if(physical == 0x1c) |
| r5932 | r5933 | |
| 1123 | 1123 | int x; |
| 1124 | 1124 | UINT16 window_addr; |
| 1125 | 1125 | UINT8* RAM = memory_region(space->machine,"maincpu"); |
| 1126 | ||
| 1126 | ||
| 1127 | 1127 | if(fm7_mmr.enabled) |
| 1128 | 1128 | { |
| 1129 | 1129 | for(x=0;x<16;x++) |
| r5932 | r5933 | |
| 1142 | 1142 | // memory (0x00000-0x0ffff) defined by the window address register |
| 1143 | 1143 | // 0x00 = 0x07c00, 0x04 = 0x08000 ... 0xff = 0x07400. |
| 1144 | 1144 | window_addr = ((fm7_mmr.window_offset << 8) + 0x7c00) & 0xffff; |
| 1145 | // | |
| 1145 | // if(window_addr < 0xfc00) | |
| 1146 | 1146 | { |
| 1147 | 1147 | memory_install_readwrite8_handler(space,0x7c00,0x7fff,0,0,SMH_BANK(24),SMH_BANK(24)); |
| 1148 | 1148 | memory_set_bankptr(space->machine,24,RAM+window_addr); |
| r5932 | r5933 | |
| 1183 | 1183 | |
| 1184 | 1184 | /* |
| 1185 | 1185 | * Main CPU: ports 0xfd20-0xfd23 |
| 1186 | * | |
| 1186 | * Kanji ROM read ports | |
| 1187 | 1187 | * FD20 (W/O): ROM address high |
| 1188 | 1188 | * FD21 (W/O): ROM address low |
| 1189 | 1189 | * FD22 (R/O): Kanji data high |
| 1190 | 1190 | * FD23 (R/O): Kanji data low |
| 1191 | * | |
| 1192 | * Kanji ROM is visible at 0x20000 (first half only?) | |
| 1191 | * | |
| 1192 | * Kanji ROM is visible at 0x20000 (first half only?) | |
| 1193 | 1193 | */ |
| 1194 | 1194 | static READ8_HANDLER( fm7_kanji_r ) |
| 1195 | 1195 | { |
| 1196 | 1196 | UINT8* KROM = memory_region(space->machine,"kanji1"); |
| 1197 | 1197 | UINT32 addr = fm7_kanji_address << 1; |
| 1198 | ||
| 1198 | ||
| 1199 | 1199 | switch(offset) |
| 1200 | 1200 | { |
| 1201 | 1201 | case 0: |
| r5932 | r5933 | |
| 1215 | 1215 | static WRITE8_HANDLER( fm7_kanji_w ) |
| 1216 | 1216 | { |
| 1217 | 1217 | UINT16 addr; |
| 1218 | ||
| 1218 | ||
| 1219 | 1219 | switch(offset) |
| 1220 | 1220 | { |
| 1221 | 1221 | case 0: |
| r5932 | r5933 | |
| 1256 | 1256 | |
| 1257 | 1257 | if(scancode == 0) |
| 1258 | 1258 | return; |
| 1259 | ||
| 1259 | ||
| 1260 | 1260 | if(irq_mask & IRQ_FLAG_KEY) |
| 1261 | 1261 | { |
| 1262 | 1262 | main_irq_set_flag(machine,IRQ_FLAG_KEY); |
| r5932 | r5933 | |
| 1276 | 1276 | UINT32 keys; |
| 1277 | 1277 | UINT32 modifiers = input_port_read(machine,"key_modifiers"); |
| 1278 | 1278 | UINT16 modscancodes[6] = { 0x52, 0x53, 0x54, 0x55, 0x56, 0x5a }; |
| 1279 | ||
| 1279 | ||
| 1280 | 1280 | for(x=0;x<3;x++) |
| 1281 | 1281 | { |
| 1282 | 1282 | keys = input_port_read(machine,portnames[x]); |
| 1283 | ||
| 1283 | ||
| 1284 | 1284 | for(y=0;y<32;y++) // loop through each bit in the port |
| 1285 | 1285 | { |
| 1286 | 1286 | if((keys & (1<<y)) != 0 && (key_data[x] & (1<<y)) == 0) |
| r5932 | r5933 | |
| 1291 | 1291 | { |
| 1292 | 1292 | key_press(machine,fm7_key_list[bit][6] | 0x80); // key release |
| 1293 | 1293 | } |
| 1294 | bit++; | |
| 1294 | bit++; | |
| 1295 | 1295 | } |
| 1296 | ||
| 1296 | ||
| 1297 | 1297 | key_data[x] = keys; |
| 1298 | 1298 | } |
| 1299 | 1299 | // check modifier keys |
| r5932 | r5933 | |
| 1308 | 1308 | { |
| 1309 | 1309 | key_press(machine,modscancodes[bit] | 0x80); // key release |
| 1310 | 1310 | } |
| 1311 | bit++; | |
| 1311 | bit++; | |
| 1312 | 1312 | } |
| 1313 | 1313 | mod_data = modifiers; |
| 1314 | 1314 | } |
| r5932 | r5933 | |
| 1336 | 1336 | fm7_keyboard_poll_scan(machine); |
| 1337 | 1337 | return; |
| 1338 | 1338 | } |
| 1339 | ||
| 1339 | ||
| 1340 | 1340 | // check key modifiers (Shift, Ctrl, Kana, etc...) |
| 1341 | 1341 | if(modifiers & 0x02 || modifiers & 0x04) |
| 1342 | 1342 | mod = 1; // shift |
| r5932 | r5933 | |
| 1348 | 1348 | mod = 4; // kana (overrides all) |
| 1349 | 1349 | if((modifiers & 0x22) == 0x22 || (modifiers & 0x24) == 0x24) |
| 1350 | 1350 | mod = 5; // shifted kana |
| 1351 | ||
| 1351 | ||
| 1352 | 1352 | for(x=0;x<3;x++) |
| 1353 | 1353 | { |
| 1354 | 1354 | keys = input_port_read(machine,portnames[x]); |
| 1355 | ||
| 1355 | ||
| 1356 | 1356 | for(y=0;y<32;y++) // loop through each bit in the port |
| 1357 | 1357 | { |
| 1358 | 1358 | if((keys & (1<<y)) != 0 && (key_data[x] & (1<<y)) == 0) |
| 1359 | 1359 | { |
| 1360 | 1360 | key_press(machine,fm7_key_list[bit][mod]); // key press |
| 1361 | 1361 | } |
| 1362 | bit++; | |
| 1362 | bit++; | |
| 1363 | 1363 | } |
| 1364 | ||
| 1364 | ||
| 1365 | 1365 | key_data[x] = keys; |
| 1366 | 1366 | } |
| 1367 | 1367 | } |
| r5932 | r5933 | |
| 1407 | 1407 | */ |
| 1408 | 1408 | // The FM-7 has only 64kB RAM, so we'll worry about banking when we do the later models |
| 1409 | 1409 | static ADDRESS_MAP_START( fm7_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1410 | AM_RANGE(0x0000,0x7fff) AM_RAM | |
| 1410 | AM_RANGE(0x0000,0x7fff) AM_RAM | |
| 1411 | 1411 | AM_RANGE(0x8000,0xfbff) AM_ROMBANK(1) // also F-BASIC ROM, when enabled |
| 1412 | 1412 | AM_RANGE(0xfc00,0xfc7f) AM_RAM |
| 1413 | 1413 | AM_RANGE(0xfc80,0xfcff) AM_RAM AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) |
| r5932 | r5933 | |
| 1431 | 1431 | // Boot ROM |
| 1432 | 1432 | AM_RANGE(0xfe00,0xffdf) AM_ROMBANK(17) |
| 1433 | 1433 | AM_RANGE(0xffe0,0xffef) AM_RAM |
| 1434 | AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) | |
| 1434 | AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) | |
| 1435 | 1435 | ADDRESS_MAP_END |
| 1436 | 1436 | |
| 1437 | 1437 | /* |
| r5932 | r5933 | |
| 1478 | 1478 | AM_RANGE(0xc000,0xcfff) AM_RAMBANK(13) |
| 1479 | 1479 | AM_RANGE(0xd000,0xdfff) AM_RAMBANK(14) |
| 1480 | 1480 | AM_RANGE(0xe000,0xefff) AM_RAMBANK(15) |
| 1481 | AM_RANGE(0xf000,0xfbff) AM_RAMBANK(16) | |
| 1481 | AM_RANGE(0xf000,0xfbff) AM_RAMBANK(16) | |
| 1482 | 1482 | AM_RANGE(0xfc00,0xfc7f) AM_RAM |
| 1483 | 1483 | AM_RANGE(0xfc80,0xfcff) AM_RAM AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w) |
| 1484 | 1484 | // I/O space (FD00-FDFF) |
| r5932 | r5933 | |
| 1514 | 1514 | // Boot ROM (RAM on FM77AV and later) |
| 1515 | 1515 | AM_RANGE(0xfe00,0xffdf) AM_RAM_WRITE(fm77av_bootram_w) AM_BASE(&fm7_boot_ram) |
| 1516 | 1516 | AM_RANGE(0xffe0,0xffef) AM_RAM |
| 1517 | AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) | |
| 1517 | AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w) | |
| 1518 | 1518 | ADDRESS_MAP_END |
| 1519 | 1519 | |
| 1520 | 1520 | static ADDRESS_MAP_START( fm77av_sub_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r5932 | r5933 | |
| 1597 | 1597 | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') |
| 1598 | 1598 | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') |
| 1599 | 1599 | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') |
| 1600 | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") | |
| 1600 | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") | |
| 1601 | 1601 | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 1602 | 1602 | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK) |
| 1603 | 1603 | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD) |
| 1604 | 1604 | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD) |
| 1605 | 1605 | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD) |
| 1606 | 1606 | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 7") PORT_CODE(KEYCODE_7_PAD) |
| 1607 | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) | |
| 1607 | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 8") PORT_CODE(KEYCODE_8_PAD) | |
| 1608 | 1608 | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 9") PORT_CODE(KEYCODE_9_PAD) |
| 1609 | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") | |
| 1609 | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey =") | |
| 1610 | 1610 | PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD) |
| 1611 | 1611 | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD) |
| 1612 | 1612 | |
| r5932 | r5933 | |
| 1631 | 1631 | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 1632 | 1632 | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC) |
| 1633 | 1633 | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_F1) |
| 1634 | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) | |
| 1634 | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_F2) | |
| 1635 | 1635 | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_F3) |
| 1636 | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) | |
| 1636 | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_F4) | |
| 1637 | 1637 | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5) |
| 1638 | 1638 | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6) |
| 1639 | 1639 | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF7") PORT_CODE(KEYCODE_F7) |
| 1640 | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) | |
| 1640 | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF8") PORT_CODE(KEYCODE_F8) | |
| 1641 | 1641 | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9) |
| 1642 | 1642 | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10) |
| 1643 | 1643 | |
| r5932 | r5933 | |
| 1645 | 1645 | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) |
| 1646 | 1646 | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) |
| 1647 | 1647 | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) |
| 1648 | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAP") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE | |
| 1649 | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_RALT) | |
| 1648 | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAP") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE | |
| 1649 | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_RALT) | |
| 1650 | 1650 | PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE |
| 1651 | 1651 | |
| 1652 | 1652 | PORT_START("lptjoy") |
| r5932 | r5933 | |
| 1656 | 1656 | PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN) PORT_NAME("LPT Joystick Down") PORT_8WAY PORT_PLAYER(1) |
| 1657 | 1657 | PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_BUTTON2) PORT_NAME("LPT Joystick Button 2") PORT_PLAYER(1) |
| 1658 | 1658 | PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_BUTTON1) PORT_NAME("LPT Joystick Button 1") PORT_PLAYER(1) |
| 1659 | ||
| 1659 | ||
| 1660 | 1660 | PORT_START("joy1") |
| 1661 | 1661 | PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_JOYSTICK_UP) PORT_NAME("1P Joystick Up") PORT_8WAY PORT_PLAYER(1) |
| 1662 | 1662 | PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_JOYSTICK_DOWN) PORT_NAME("1P Joystick Down") PORT_8WAY PORT_PLAYER(1) |
| r5932 | r5933 | |
| 1676 | 1676 | PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_BUTTON1) PORT_NAME("2P Joystick Button 1") PORT_PLAYER(2) |
| 1677 | 1677 | PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_UNUSED) |
| 1678 | 1678 | PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED) |
| 1679 | ||
| 1680 | 1679 | |
| 1680 | ||
| 1681 | 1681 | PORT_START("DSW") |
| 1682 | 1682 | PORT_DIPNAME(0x01,0x01,"Switch A") PORT_DIPLOCATION("SWA:1") |
| 1683 | 1683 | PORT_DIPSETTING(0x00,DEF_STR( Off )) |
| r5932 | r5933 | |
| 1700 | 1700 | |
| 1701 | 1701 | static DRIVER_INIT(fm7) |
| 1702 | 1702 | { |
| 1703 | // | |
| 1703 | // shared_ram = auto_alloc_array(machine,UINT8,0x80); | |
| 1704 | 1704 | fm7_video_ram = auto_alloc_array(machine,UINT8,0x18000); // 2 pages on some systems |
| 1705 | 1705 | fm7_timer = timer_alloc(machine,fm7_timer_irq,NULL); |
| 1706 | 1706 | fm7_subtimer = timer_alloc(machine,fm7_subtimer_irq,NULL); |
| r5932 | r5933 | |
| 1716 | 1716 | // The FM-7 has no initialisation ROM, and no other obvious |
| 1717 | 1717 | // way to set the reset vector, so for now this will have to do. |
| 1718 | 1718 | UINT8* RAM = memory_region(machine,"maincpu"); |
| 1719 | ||
| 1719 | ||
| 1720 | 1720 | RAM[0xfffe] = 0xfe; |
| 1721 | RAM[0xffff] = 0x00; | |
| 1722 | ||
| 1721 | RAM[0xffff] = 0x00; | |
| 1722 | ||
| 1723 | 1723 | memset(shared_ram,0xff,0x80); |
| 1724 | 1724 | fm7_type = SYS_FM7; |
| 1725 | ||
| 1725 | ||
| 1726 | 1726 | beep_set_frequency(devtag_get_device(machine,"beeper"),1200); |
| 1727 | 1727 | beep_set_state(devtag_get_device(machine,"beeper"),0); |
| 1728 | 1728 | } |
| r5932 | r5933 | |
| 1734 | 1734 | |
| 1735 | 1735 | memset(shared_ram,0xff,0x80); |
| 1736 | 1736 | |
| 1737 | // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) | |
| 1737 | // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) | |
| 1738 | 1738 | memcpy(RAM+0x3fff0,ROM+0x1ff0,16); |
| 1739 | 1739 | |
| 1740 | 1740 | fm7_video.subrom = 0; // default sub CPU ROM is type C. |
| r5932 | r5933 | |
| 1742 | 1742 | memory_set_bankptr(machine,20,RAM); |
| 1743 | 1743 | RAM = memory_region(machine,"subsys_c"); |
| 1744 | 1744 | memory_set_bankptr(machine,21,RAM+0x800); |
| 1745 | ||
| 1745 | ||
| 1746 | 1746 | fm7_type = SYS_FM77AV; |
| 1747 | 1747 | beep_set_frequency(devtag_get_device(machine,"beeper"),1200); |
| 1748 | 1748 | beep_set_state(devtag_get_device(machine,"beeper"),0); |
| r5932 | r5933 | |
| 1752 | 1752 | { |
| 1753 | 1753 | UINT8* RAM = memory_region(machine,"maincpu"); |
| 1754 | 1754 | UINT8* ROM = memory_region(machine,"init"); |
| 1755 | ||
| 1755 | ||
| 1756 | 1756 | timer_adjust_periodic(fm7_timer,ATTOTIME_IN_NSEC(2034500),0,ATTOTIME_IN_NSEC(2034500)); |
| 1757 | 1757 | timer_adjust_periodic(fm7_subtimer,ATTOTIME_IN_MSEC(20),0,ATTOTIME_IN_MSEC(20)); |
| 1758 | 1758 | timer_adjust_periodic(fm7_keyboard_timer,attotime_zero,0,ATTOTIME_IN_MSEC(10)); |
| 1759 | 1759 | if(fm7_type != SYS_FM7) |
| 1760 | 1760 | timer_adjust_oneshot(fm77av_vsync_timer,video_screen_get_time_until_vblank_end(machine->primary_screen),0); |
| 1761 | ||
| 1761 | ||
| 1762 | 1762 | irq_mask = 0x00; |
| 1763 | 1763 | irq_flags = 0x00; |
| 1764 | 1764 | fm7_video.attn_irq = 0; |
| r5932 | r5933 | |
| 1769 | 1769 | else |
| 1770 | 1770 | { |
| 1771 | 1771 | init_rom_en = 1; |
| 1772 | // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) | |
| 1772 | // last part of Initiate ROM is visible at the end of RAM too (interrupt vectors) | |
| 1773 | 1773 | memcpy(RAM+0x3fff0,ROM+0x1ff0,16); |
| 1774 | } | |
| 1774 | } | |
| 1775 | 1775 | if(fm7_type == SYS_FM7) |
| 1776 | 1776 | memory_set_bankptr(machine,1,RAM+0x38000); |
| 1777 | 1777 | key_delay = 700; // 700ms on FM-7 |
| r5932 | r5933 | |
| 1859 | 1859 | MDRV_CPU_ADD("sub", M6809, XTAL_2MHz) |
| 1860 | 1860 | MDRV_CPU_PROGRAM_MAP(fm7_sub_mem) |
| 1861 | 1861 | MDRV_QUANTUM_PERFECT_CPU("sub") |
| 1862 | ||
| 1862 | ||
| 1863 | 1863 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1864 | 1864 | MDRV_SOUND_ADD("psg", AY8910, XTAL_4_9152MHz / 4) |
| 1865 | 1865 | MDRV_SOUND_CONFIG(fm7_psg_intf) |
| r5932 | r5933 | |
| 1874 | 1874 | |
| 1875 | 1875 | /* video hardware */ |
| 1876 | 1876 | MDRV_SCREEN_ADD("screen", RASTER) |
| 1877 | ||
| 1877 | ||
| 1878 | 1878 | MDRV_SCREEN_REFRESH_RATE(60) |
| 1879 | 1879 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1880 | 1880 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| r5932 | r5933 | |
| 1885 | 1885 | |
| 1886 | 1886 | MDRV_VIDEO_START(fm7) |
| 1887 | 1887 | MDRV_VIDEO_UPDATE(fm7) |
| 1888 | ||
| 1888 | ||
| 1889 | 1889 | MDRV_CASSETTE_ADD("cass",fm7_cassette_config) |
| 1890 | ||
| 1890 | ||
| 1891 | 1891 | MDRV_MB8877_ADD("fdc",fm7_mb8877a_interface) |
| 1892 | ||
| 1892 | ||
| 1893 | 1893 | MDRV_CENTRONICS_ADD("lpt",standard_centronics) |
| 1894 | ||
| 1894 | ||
| 1895 | 1895 | MDRV_FLOPPY_2_DRIVES_ADD(fm7_floppy_config) |
| 1896 | 1896 | MACHINE_DRIVER_END |
| 1897 | 1897 | |
| r5932 | r5933 | |
| 1931 | 1931 | MDRV_VIDEO_UPDATE(fm7) |
| 1932 | 1932 | |
| 1933 | 1933 | MDRV_CASSETTE_ADD("cass",fm7_cassette_config) |
| 1934 | ||
| 1934 | ||
| 1935 | 1935 | MDRV_MB8877_ADD("fdc",fm7_mb8877a_interface) |
| 1936 | ||
| 1936 | ||
| 1937 | 1937 | MDRV_CENTRONICS_ADD("lpt",standard_centronics) |
| 1938 | ||
| 1938 | ||
| 1939 | 1939 | MDRV_FLOPPY_2_DRIVES_ADD(fm7_floppy_config) |
| 1940 | 1940 | MACHINE_DRIVER_END |
| 1941 | 1941 | |
| r5932 | r5933 | |
| 1951 | 1951 | ROM_REGION( 0x200, "basic", 0 ) |
| 1952 | 1952 | ROM_LOAD( "boot_bas.rom", 0x0000, 0x0200, CRC(c70f0c74) SHA1(53b63a301cba7e3030e79c59a4d4291eab6e64b0) ) |
| 1953 | 1953 | |
| 1954 | ROM_REGION( 0x200, "dos", 0 ) | |
| 1954 | ROM_REGION( 0x200, "dos", 0 ) | |
| 1955 | 1955 | ROM_LOAD( "boot_dos.rom", 0x0000, 0x0200, CRC(198614ff) SHA1(037e5881bd3fed472a210ee894a6446965a8d2ef) ) |
| 1956 | 1956 | |
| 1957 | 1957 | // optional Kanji ROM |
| r5932 | r5933 | |
| 1973 | 1973 | ROM_REGION( 0x10000, "sub", 0 ) |
| 1974 | 1974 | ROM_FILL(0x0000,0x10000,0xff) |
| 1975 | 1975 | |
| 1976 | // sub CPU ROMs | |
| 1976 | // sub CPU ROMs | |
| 1977 | 1977 | ROM_REGION( 0x2800, "subsys_c", 0 ) |
| 1978 | 1978 | ROM_LOAD( "subsys_c.rom", 0x0000, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) |
| 1979 | 1979 | ROM_REGION( 0x2000, "subsys_a", 0 ) |
| r5932 | r5933 | |
| 2002 | 2002 | ROM_REGION( 0x10000, "sub", 0 ) |
| 2003 | 2003 | ROM_FILL(0x0000,0x10000,0xff) |
| 2004 | 2004 | |
| 2005 | // sub CPU ROMs | |
| 2005 | // sub CPU ROMs | |
| 2006 | 2006 | ROM_REGION( 0x2800, "subsys_c", 0 ) |
| 2007 | 2007 | ROM_LOAD( "subsys_c.rom", 0x0000, 0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) ) |
| 2008 | 2008 | ROM_REGION( 0x2000, "subsys_a", 0 ) |
| r5932 | r5933 | |
|---|---|---|
| 47 | 47 | static READ8_DEVICE_HANDLER( compis_ppi_r ) |
| 48 | 48 | { |
| 49 | 49 | /* Port 3 is the control port and mame returns a hardcoded FF, but compis |
| 50 | does not like it. Code at that point: | |
| 51 | F8DBD: mov dx, 3 | |
| 52 | in al, dx | |
| 53 | and al, 8 | |
| 54 | je F8DF1 | |
| 55 | The jump must be taken to succeed. It seems that the read should | |
| 56 | return some kind of status rather than FF. Until this matter is | |
| 57 | resolved, this will have to do. - R */ | |
| 50 | does not like it. Code at that point: | |
| 51 | F8DBD: mov dx, 3 | |
| 52 | in al, dx | |
| 53 | and al, 8 | |
| 54 | je F8DF1 | |
| 55 | The jump must be taken to succeed. It seems that the read should | |
| 56 | return some kind of status rather than FF. Until this matter is | |
| 57 | resolved, this will have to do. - R */ | |
| 58 | 58 | |
| 59 | 59 | if (offset == 3) return 0; |
| 60 | 60 | else |
| r5932 | r5933 | |
| 113 | 113 | - "Compis S" is mapped to 'F6' |
| 114 | 114 | - "Avbryt" is mapped to 'F7' |
| 115 | 115 | - "Inpassa" is mapped to 'Insert' |
| 116 | - "Sök" is mapped to "Print Screen" | |
| 117 | - "Utplåna"is mapped to 'Delete' | |
| 116 | - "S?k" is mapped to "Print Screen" | |
| 117 | - "Utpl?na"is mapped to 'Delete' | |
| 118 | 118 | - "Start / Stop" is mapped to 'Pause' |
| 119 | 119 | - "TabL" is mapped to 'Page Up' |
| 120 | 120 | - "TabR" is mapped to 'Page Down' |
| r5932 | r5933 | |
| 244 | 244 | |
| 245 | 245 | static const mm58274c_interface compis_mm58274c_interface = |
| 246 | 246 | { |
| 247 | 0, /* | |
| 247 | 0, /* mode 24*/ | |
| 248 | 248 | 1 /* first day of week */ |
| 249 | 249 | }; |
| 250 | 250 | |
| r5932 | r5933 | |
| 301 | 301 | MDRV_MM58274C_ADD("mm58274c", compis_mm58274c_interface) |
| 302 | 302 | |
| 303 | 303 | MDRV_NEC765A_ADD("nec765", compis_fdc_interface) |
| 304 | ||
| 304 | ||
| 305 | 305 | MDRV_FLOPPY_2_DRIVES_ADD(compis_floppy_config) |
| 306 | 306 | MACHINE_DRIVER_END |
| 307 | 307 |
| r5932 | r5933 | |
|---|---|---|
| 87 | 87 | AM_RANGE(0x45, 0x45) AM_WRITE(laser_two_color_w) |
| 88 | 88 | ADDRESS_MAP_END |
| 89 | 89 | |
| 90 | /* 2008-05 FP: | |
| 90 | /* 2008-05 FP: | |
| 91 | 91 | Small note about natural keyboard: currently, |
| 92 | 92 | - "Graph" is mapped to 'F11' |
| 93 | 93 | - "Del Line" is mapped to 'F12' |
| r5932 | r5933 | |
| 214 | 214 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| 215 | 215 | INPUT_PORTS_END |
| 216 | 216 | |
| 217 | /* 2008-05 FP: I wasn't able to find a good picture of the laser 350 to verify the mapping of the emulated keyboard. | |
| 218 | However, old-computers.com describes it as a laser 500/700 in a laser 300/310 case. The missing inputs seem to | |
| 217 | /* 2008-05 FP: I wasn't able to find a good picture of the laser 350 to verify the mapping of the emulated keyboard. | |
| 218 | However, old-computers.com describes it as a laser 500/700 in a laser 300/310 case. The missing inputs seem to | |
| 219 | 219 | confirm this. */ |
| 220 | 220 | static INPUT_PORTS_START( laser350 ) |
| 221 | 221 | PORT_INCLUDE( laser500 ) |
| r5932 | r5933 | |
|---|---|---|
| 158 | 158 | MDRV_SOUND_ADD("custom", WSWAN, 0) |
| 159 | 159 | MDRV_SOUND_ROUTE(0, "lspeaker", 0.50) |
| 160 | 160 | MDRV_SOUND_ROUTE(1, "rspeaker", 0.50) |
| 161 | ||
| 161 | ||
| 162 | 162 | /* cartridge */ |
| 163 | 163 | MDRV_CARTSLOT_ADD("cart") |
| 164 | 164 | MDRV_CARTSLOT_EXTENSION_LIST("ws,wsc,bin") |
| r5932 | r5933 | |
|---|---|---|
| 13 | 13 | 14.05.2004 Finally fixed and readded. |
| 14 | 14 | |
| 15 | 15 | Changes done by Robbbert in Jan 2009: |
| 16 | - Added the NTSC/PAL diode to all systems except pc8300 which doesn't support it. | |
| 17 | - Applied NTSC timings to pc8300 only, all others depend on the diode. | |
| 18 | - Many keyboard fixes, and descriptions added to keys. | |
| 19 | - Fixed .O files from causing an access violation. | |
| 20 | - Enabled cassette saving (wav only). | |
| 21 | - Many general fixes to pow3000/lambda. | |
| 22 | - Added sound to pc8300/pow3000/lambda. | |
| 16 | - Added the NTSC/PAL diode to all systems except pc8300 which doesn't support it. | |
| 17 | - Applied NTSC timings to pc8300 only, all others depend on the diode. | |
| 18 | - Many keyboard fixes, and descriptions added to keys. | |
| 19 | - Fixed .O files from causing an access violation. | |
| 20 | - Enabled cassette saving (wav only). | |
| 21 | - Many general fixes to pow3000/lambda. | |
| 22 | - Added sound to pc8300/pow3000/lambda. | |
| 23 | 23 | |
| 24 | 24 | To do / problems: |
| 25 | - Some memory areas are not mirrored as they should. | |
| 26 | - Video hardware is not fully emulated, so it does not support pseudo hi-res and hi-res modes. | |
| 27 | - The screen in pc8300/pow3000/lambda jumps when you type something. | |
| 28 | - lambda/pow3000 32k memory pack is unemulated, because where is the upper 16k mirror going to be? | |
| 29 | - h4th and tree4th need their address maps worked out (eg, the stack is set to FB80) | |
| 30 | - lambda/pow3000 joystick, connected in parallel with the 4,R,F,7,U keys, but the directions are unknown. | |
| 31 | - Currently, cassettes will be saved in .wav format, even if you choose something else. | |
| 32 | - Many games don't work. | |
| 25 | - Some memory areas are not mirrored as they should. | |
| 26 | - Video hardware is not fully emulated, so it does not support pseudo hi-res and hi-res modes. | |
| 27 | - The screen in pc8300/pow3000/lambda jumps when you type something. | |
| 28 | - lambda/pow3000 32k memory pack is unemulated, because where is the upper 16k mirror going to be? | |
| 29 | - h4th and tree4th need their address maps worked out (eg, the stack is set to FB80) | |
| 30 | - lambda/pow3000 joystick, connected in parallel with the 4,R,F,7,U keys, but the directions are unknown. | |
| 31 | - Currently, cassettes will be saved in .wav format, even if you choose something else. | |
| 32 | - Many games don't work. | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | ****************************************************************************/ |
| r5932 | r5933 | |
| 70 | 70 | |
| 71 | 71 | static INPUT_PORTS_START( zx80 ) |
| 72 | 72 | /* PORT_NAME = Key Mode (Press Key) Shift Mode (Press Key+Shift) BASIC Mode (Press Key at BASIC) */ |
| 73 | /* Some keys (e.g. A,S,D,F,G etc.) produce glyphs when used in Shift Mode. MESS currently cannot show | |
| 73 | /* Some keys (e.g. A,S,D,F,G etc.) produce glyphs when used in Shift Mode. MESS currently cannot show | |
| 74 | 74 | these functions in Input (This System) menu, hence we live some empty space in the menu */ |
| 75 | 75 | PORT_START("ROW0") |
| 76 | 76 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| r5932 | r5933 | |
| 332 | 332 | |
| 333 | 333 | static PALETTE_INIT( ts1000 ) |
| 334 | 334 | { |
| 335 | palette_set_color(machine,0,MAKE_RGB(64, 244, 244)); /* cyan */ | |
| 335 | palette_set_color(machine,0,MAKE_RGB(64, 244, 244)); /* cyan */ | |
| 336 | 336 | palette_set_color(machine,1,RGB_BLACK); /* black */ |
| 337 | 337 | palette_set_color(machine,2,RGB_BLACK); /* black */ |
| 338 | 338 | palette_set_color(machine,3,MAKE_RGB(64, 244, 244)); /* cyan */ |
| r5932 | r5933 | |
| 389 | 389 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 390 | 390 | MDRV_SCREEN_SIZE(ZX81_PIXELS_PER_SCANLINE, ZX81_PAL_SCANLINES) |
| 391 | 391 | MDRV_SCREEN_VISIBLE_AREA(0, ZX81_PIXELS_PER_SCANLINE-1, 0, ZX81_PAL_SCANLINES-1) |
| 392 | // | |
| 392 | // MDRV_GFXDECODE(zx80) | |
| 393 | 393 | MDRV_PALETTE_LENGTH(4) |
| 394 | 394 | MDRV_PALETTE_INIT(zx80) |
| 395 | 395 | |
| r5932 | r5933 | |
| 413 | 413 | MDRV_CPU_MODIFY("maincpu") |
| 414 | 414 | MDRV_CPU_IO_MAP(zx81_io_map) |
| 415 | 415 | |
| 416 | // | |
| 416 | // MDRV_GFXDECODE(zx81) | |
| 417 | 417 | |
| 418 | 418 | MDRV_CASSETTE_MODIFY( "cassette", zx81_cassette_config ) |
| 419 | 419 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
| 437 | 437 | MDRV_SCREEN_SIZE(ZX81_PIXELS_PER_SCANLINE, ZX81_NTSC_SCANLINES) |
| 438 | 438 | MDRV_SCREEN_VISIBLE_AREA(0, ZX81_PIXELS_PER_SCANLINE-1, 0, ZX81_NTSC_SCANLINES-1) |
| 439 | 439 | |
| 440 | // | |
| 440 | // MDRV_GFXDECODE(pc8300) | |
| 441 | 441 | MDRV_PALETTE_INIT(zx80) |
| 442 | 442 | MACHINE_DRIVER_END |
| 443 | 443 | |
| r5932 | r5933 | |
| 448 | 448 | MDRV_CPU_IO_MAP(pow3000_io_map) |
| 449 | 449 | |
| 450 | 450 | MDRV_MACHINE_RESET(pow3000) |
| 451 | // | |
| 451 | // MDRV_GFXDECODE(pc8300) | |
| 452 | 452 | MDRV_PALETTE_INIT(zx80) |
| 453 | 453 | MACHINE_DRIVER_END |
| 454 | 454 | |
| r5932 | r5933 | |
| 484 | 484 | |
| 485 | 485 | ROM_START(ts1500) |
| 486 | 486 | ROM_REGION( 0x10000, "maincpu",0 ) |
| 487 | ROM_LOAD( "ts1500.rom", 0x0000, 0x2000, CRC(7dd19c48) SHA1(3eb437359221b4406d236085ec66fa02278e7495) ) | |
| 487 | ROM_LOAD( "ts1500.rom", 0x0000, 0x2000, CRC(7dd19c48) SHA1(3eb437359221b4406d236085ec66fa02278e7495) ) | |
| 488 | 488 | ROM_END |
| 489 | 489 | |
| 490 | 490 | ROM_START(ringo470) |
| r5932 | r5933 | |
| 522 | 522 | ROM_END |
| 523 | 523 | |
| 524 | 524 | /* This homebrew has 192k of RAM and 32k of ROM via bankswitching. One of the primary bankswitching lines is /M1, |
| 525 | ||
| 525 | which is not emulated by MAME's z80. */ | |
| 526 | 526 | ROM_START( zx97 ) |
| 527 | 527 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 528 | 528 | ROM_LOAD( "zx97.rom", 0x0000, 0x2000, CRC(5cf49744) SHA1(b2a486efdc7b2bc3dc8e5a441ea5532bfa3207bd) ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | CPS Changer | |
| 4 | 4 | |
| 5 | Although this is split off from MAME, it still uses machine/kabuki.c | |
| 6 | This in turn includes cps1.h. | |
| 7 | Therefore we must call our include by the same name, in order to | |
| 8 | override the mame include, and thereby remove any compilation errors. | |
| 9 | It also means we can get rid of the various bodges of the past, and | |
| 10 | no more ifdefs are needed in the mame code. | |
| 5 | Although this is split off from MAME, it still uses machine/kabuki.c | |
| 6 | This in turn includes cps1.h. | |
| 7 | Therefore we must call our include by the same name, in order to | |
| 8 | override the mame include, and thereby remove any compilation errors. | |
| 9 | It also means we can get rid of the various bodges of the past, and | |
| 10 | no more ifdefs are needed in the mame code. | |
| 11 | 11 | |
| 12 | 12 | ***************************************************************************/ |
| 13 | 13 | |
| r5932 | r5933 | |
| 194 | 194 | |
| 195 | 195 | /*************************************** |
| 196 | 196 | |
| 197 | ||
| 197 | Address Maps | |
| 198 | 198 | |
| 199 | 199 | ****************************************/ |
| 200 | 200 | |
| r5932 | r5933 | |
| 254 | 254 | |
| 255 | 255 | /*********************************************************** |
| 256 | 256 | |
| 257 | ||
| 257 | Inputs and Dips | |
| 258 | 258 | |
| 259 | 259 | ***********************************************************/ |
| 260 | 260 | |
| r5932 | r5933 | |
| 310 | 310 | |
| 311 | 311 | /*************************************** |
| 312 | 312 | |
| 313 | ||
| 313 | Graphics Decode | |
| 314 | 314 | |
| 315 | 315 | ****************************************/ |
| 316 | 316 | |
| r5932 | r5933 | |
| 441 | 441 | |
| 442 | 442 | /*************************************** |
| 443 | 443 | |
| 444 | ||
| 444 | Driver Initialisation | |
| 445 | 445 | |
| 446 | 446 | ****************************************/ |
| 447 | 447 | |
| r5932 | r5933 | |
| 454 | 454 | |
| 455 | 455 | /*************************************** |
| 456 | 456 | |
| 457 | ||
| 457 | Roms | |
| 458 | 458 | |
| 459 | 459 | ***************************************/ |
| 460 | 460 | |
| r5932 | r5933 | |
| 599 | 599 | |
| 600 | 600 | /*************************************************************************** |
| 601 | 601 | |
| 602 | ||
| 602 | Game driver(s) | |
| 603 | 603 | |
| 604 | 604 | ***************************************************************************/ |
| 605 | 605 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Explorer 85 |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 8 | 8 | |
| 9 | 9 | /* |
| 10 | 10 | |
| 11 | ||
| 11 | TODO: | |
| 12 | 12 | |
| 13 | - needs a terminal, or a dump of the hexadecimal keyboard monitor ROM | |
| 14 | - serial input/output at SID/SOD pins | |
| 15 | - disable ROM mirror after boot | |
| 16 | - RAM expansions | |
| 13 | - needs a terminal, or a dump of the hexadecimal keyboard monitor ROM | |
| 14 | - serial input/output at SID/SOD pins | |
| 15 | - disable ROM mirror after boot | |
| 16 | - RAM expansions | |
| 17 | 17 | |
| 18 | 18 | */ |
| 19 | 19 | |
| r5932 | r5933 | |
| 39 | 39 | ADDRESS_MAP_UNMAP_HIGH |
| 40 | 40 | AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE(I8355_TAG, i8355_r, i8355_w) |
| 41 | 41 | AM_RANGE(0xf8, 0xfd) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w) |
| 42 | // | |
| 42 | // AM_RANGE(0xfe, 0xff) AM_DEVREADWRITE(I8279_TAG, i8279_r, i8279_w) | |
| 43 | 43 | ADDRESS_MAP_END |
| 44 | 44 | |
| 45 | 45 | /* Input Ports */ |
| r5932 | r5933 | |
| 90 | 90 | { |
| 91 | 91 | /* |
| 92 | 92 | |
| 93 | bit | |
| 93 | bit description | |
| 94 | 94 | |
| 95 | ||
| 95 | PA0 tape control | |
| 96 | 96 | PA1 jumper S17 (open=+5V closed=GND) |
| 97 | 97 | PA2 J5:13 |
| 98 | PA3 | |
| 99 | PA4 J2:22 | |
| 100 | PA5 | |
| 101 | PA6 | |
| 98 | PA3 | |
| 99 | PA4 J2:22 | |
| 100 | PA5 | |
| 101 | PA6 | |
| 102 | 102 | PA7 speaker output |
| 103 | ||
| 104 | */ | |
| 105 | 103 | |
| 104 | */ | |
| 105 | ||
| 106 | 106 | return 0x02; |
| 107 | 107 | } |
| 108 | 108 | |
| r5932 | r5933 | |
| 110 | 110 | { |
| 111 | 111 | /* |
| 112 | 112 | |
| 113 | bit | |
| 113 | bit description | |
| 114 | 114 | |
| 115 | ||
| 115 | PA0 tape control | |
| 116 | 116 | PA1 jumper S17 (open=+5V closed=GND) |
| 117 | 117 | PA2 J5:13 |
| 118 | PA3 | |
| 119 | PA4 J2:22 | |
| 120 | PA5 | |
| 121 | PA6 | |
| 118 | PA3 | |
| 119 | PA4 J2:22 | |
| 120 | PA5 | |
| 121 | PA6 | |
| 122 | 122 | PA7 speaker output |
| 123 | ||
| 124 | */ | |
| 125 | 123 | |
| 124 | */ | |
| 125 | ||
| 126 | 126 | exp85_state *state = device->machine->driver_data; |
| 127 | 127 | |
| 128 | 128 | /* tape control */ |
| r5932 | r5933 | |
| 174 | 174 | /* Machine Initialization */ |
| 175 | 175 | |
| 176 | 176 | static MACHINE_START( exp85 ) |
| 177 | { | |
| 177 | { | |
| 178 | 178 | exp85_state *state = machine->driver_data; |
| 179 | 179 | const address_space *program = cputag_get_address_space(machine, I8085A_TAG, ADDRESS_SPACE_PROGRAM); |
| 180 | ||
| 180 | ||
| 181 | 181 | /* setup memory banking */ |
| 182 | 182 | memory_install_readwrite8_handler(program, 0x0000, 0x07ff, 0, 0, SMH_BANK(1), SMH_UNMAP); |
| 183 | 183 | memory_configure_bank(machine, 1, 0, 1, memory_region(machine, I8085A_TAG) + 0xf000, 0); |
| r5932 | r5933 | |
| 204 | 204 | /* basic machine hardware */ |
| 205 | 205 | MDRV_CPU_ADD(I8085A_TAG, 8085A, XTAL_6_144MHz) |
| 206 | 206 | MDRV_CPU_PROGRAM_MAP(exp85_mem) |
| 207 | MDRV_CPU_IO_MAP(exp85_io) | |
| 207 | MDRV_CPU_IO_MAP(exp85_io) | |
| 208 | 208 | MDRV_CPU_CONFIG(exp85_i8085_config) |
| 209 | 209 | |
| 210 | 210 | MDRV_MACHINE_START(exp85) |
| 211 | ||
| 211 | ||
| 212 | 212 | /* video hardware */ |
| 213 | 213 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 214 | 214 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 216 | 216 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 217 | 217 | MDRV_SCREEN_SIZE(640, 480) |
| 218 | 218 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 219 | ||
| 219 | ||
| 220 | 220 | MDRV_PALETTE_LENGTH(2) |
| 221 | 221 | MDRV_PALETTE_INIT(black_and_white) |
| 222 | ||
| 222 | ||
| 223 | 223 | MDRV_VIDEO_START(exp85) |
| 224 | 224 | MDRV_VIDEO_UPDATE(exp85) |
| 225 | 225 | |
| r5932 | r5933 | |
| 250 | 250 | ROMX_LOAD( "hex.u105", 0xf000, 0x0800, NO_DUMP, ROM_BIOS(2) ) |
| 251 | 251 | |
| 252 | 252 | ROM_REGION( 0x800, I8355_TAG, ROMREGION_ERASE00 ) |
| 253 | /* ROM_DEFAULT_BIOS("terminal") | |
| 254 | ROM_SYSTEM_BIOS( 0, "terminal", "Terminal" ) | |
| 255 | ROMX_LOAD( "eia.u105", 0xf000, 0x0800, CRC(1a99d0d9) SHA1(57b6d48e71257bc4ef2d3dddc9b30edf6c1db766), ROM_BIOS(1) ) | |
| 256 | ROM_SYSTEM_BIOS( 1, "hexkbd", "Hex Keyboard" ) | |
| 257 | ROMX_LOAD( "hex.u105", 0xf000, 0x0800, NO_DUMP, ROM_BIOS(2) )*/ | |
| 253 | /* ROM_DEFAULT_BIOS("terminal") | |
| 254 | ROM_SYSTEM_BIOS( 0, "terminal", "Terminal" ) | |
| 255 | ROMX_LOAD( "eia.u105", 0xf000, 0x0800, CRC(1a99d0d9) SHA1(57b6d48e71257bc4ef2d3dddc9b30edf6c1db766), ROM_BIOS(1) ) | |
| 256 | ROM_SYSTEM_BIOS( 1, "hexkbd", "Hex Keyboard" ) | |
| 257 | ROMX_LOAD( "hex.u105", 0xf000, 0x0800, NO_DUMP, ROM_BIOS(2) )*/ | |
| 258 | 258 | ROM_END |
| 259 | 259 | |
| 260 | 260 | /* System Configuration */ |
| r5932 | r5933 | |
| 266 | 266 | |
| 267 | 267 | /* System Drivers */ |
| 268 | 268 | |
| 269 | /* YEAR | |
| 269 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 270 | 270 | COMP( 1979, exp85, 0, 0, exp85, exp85, 0, exp85, "Netronics", "Explorer/85", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 5 | 5 | Ensoniq ESQ-1 and SQ-80 Digital Wave Synthesizers |
| 6 | 6 | Preliminary driver by R. Belmont |
| 7 | 7 | |
| 8 | Map for ESQ-1: | |
| 9 | 0000-1fff: OS RAM | |
| 10 | 2000-3fff: Cartridge | |
| 11 | 4000-5fff: SEQRAM | |
| 12 | 6000-63ff: ES5503 DOC | |
| 13 | 6400-67ff: MC2681 DUART | |
| 14 | 6800-6fff: AD7524 (CV_MUX) | |
| 15 | 7000-7fff: OS ROM low (banked) | |
| 16 | 8000-ffff: OS ROM high (fixed) | |
| 8 | Map for ESQ-1: | |
| 9 | 0000-1fff: OS RAM | |
| 10 | 2000-3fff: Cartridge | |
| 11 | 4000-5fff: SEQRAM | |
| 12 | 6000-63ff: ES5503 DOC | |
| 13 | 6400-67ff: MC2681 DUART | |
| 14 | 6800-6fff: AD7524 (CV_MUX) | |
| 15 | 7000-7fff: OS ROM low (banked) | |
| 16 | 8000-ffff: OS ROM high (fixed) | |
| 17 | 17 | |
| 18 | Map for SQ-80: | |
| 19 | 0000-1fff: OS RAM | |
| 20 | 2000-3fff: Cartridge | |
| 21 | 4000-5fff: DOSRAM or SEQRAM (banked) | |
| 22 | 6000-63ff: ES5503 DOC | |
| 23 | 6400-67ff: MC2681 DUART | |
| 24 | 6800-6bff: AD7524 (CV_MUX) | |
| 25 | 6c00-6dff: Mapper (bit 0 only - determines DOSRAM or SEQRAM at 4000) | |
| 26 | 6e00-6fff: WD1772 FDC (not present on ESQ1) | |
| 27 | 7000-7fff: OS ROM low (banked) | |
| 28 | 8000-ffff: OS ROM high (fixed) | |
| 18 | Map for SQ-80: | |
| 19 | 0000-1fff: OS RAM | |
| 20 | 2000-3fff: Cartridge | |
| 21 | 4000-5fff: DOSRAM or SEQRAM (banked) | |
| 22 | 6000-63ff: ES5503 DOC | |
| 23 | 6400-67ff: MC2681 DUART | |
| 24 | 6800-6bff: AD7524 (CV_MUX) | |
| 25 | 6c00-6dff: Mapper (bit 0 only - determines DOSRAM or SEQRAM at 4000) | |
| 26 | 6e00-6fff: WD1772 FDC (not present on ESQ1) | |
| 27 | 7000-7fff: OS ROM low (banked) | |
| 28 | 8000-ffff: OS ROM high (fixed) | |
| 29 | 29 | |
| 30 | CV_MUX area: | |
| 31 | write to output goes to | |
| 32 | $68f8 $00 D/A converter | |
| 33 | $68f0 -$08 Filter Frequency (FF) | |
| 34 | $68e8 -$10 Filter Resonance (Q) | |
| 35 | $68d8 -$20 Final DCA (ENV4) | |
| 36 | $68b8 -$40 Panning (PAN) | |
| 37 | $6878 -$80 Floppy (Motor/LED on) | |
| 30 | CV_MUX area: | |
| 31 | write to output goes to | |
| 32 | $68f8 $00 D/A converter | |
| 33 | $68f0 -$08 Filter Frequency (FF) | |
| 34 | $68e8 -$10 Filter Resonance (Q) | |
| 35 | $68d8 -$20 Final DCA (ENV4) | |
| 36 | $68b8 -$40 Panning (PAN) | |
| 37 | $6878 -$80 Floppy (Motor/LED on) | |
| 38 | 38 | |
| 39 | 39 | If SEQRAM is mapped at 4000, DUART port 2 determines the 32KB "master bank" and ports 0 and 1 |
| 40 | 40 | determine which of the 4 8KB "sub banks" is visible. |
| r5932 | r5933 | |
| 45 | 45 | NMI is from the IRQ line on the FDC (again, SQ-80 only). |
| 46 | 46 | |
| 47 | 47 | TODO: |
| 48 | - Actual 2681 DUART emulation | |
| 49 | - VFD display | |
| 50 | - Keyboard | |
| 51 | - Analog filters and VCA on the back end of the 5503 | |
| 52 | - SQ-80 support (additional banking, FDC) | |
| 48 | - Actual 2681 DUART emulation | |
| 49 | - VFD display | |
| 50 | - Keyboard | |
| 51 | - Analog filters and VCA on the back end of the 5503 | |
| 52 | - SQ-80 support (additional banking, FDC) | |
| 53 | 53 | |
| 54 | 54 | ***************************************************************************/ |
| 55 | 55 | |
| r5932 | r5933 | |
| 97 | 97 | { |
| 98 | 98 | int bank = ((uart_outputport >> 1) & 0x7) ^ 7; |
| 99 | 99 | |
| 100 | // | |
| 100 | // printf("bank %d => offset %x (PC=%x)\n", bank, bank * 0x1000, cpu_get_pc(machine->cpu[0])); | |
| 101 | 101 | memory_set_bankptr(machine, 1, memory_region(machine, "osrom") + (bank * 0x1000) ); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | static READ8_HANDLER( uart_r ) |
| 105 | 105 | { |
| 106 | // | |
| 106 | // printf("Read UART @ %x\n", offset); | |
| 107 | 107 | |
| 108 | 108 | switch (offset) |
| 109 | 109 | { |
| r5932 | r5933 | |
| 119 | 119 | { |
| 120 | 120 | uart_regs[offset] = data; |
| 121 | 121 | |
| 122 | // | |
| 122 | // printf("%x to UART %x\n", data, offset); | |
| 123 | 123 | |
| 124 | 124 | switch (offset) |
| 125 | 125 | { |
| 126 | case 0xb: | |
| 127 | // printf("%02x to 6500\n", data); | |
| 126 | case 0xb: | |
| 127 | // printf("%02x to 6500\n", data); | |
| 128 | 128 | break; |
| 129 | 129 | |
| 130 | 130 | case 0xe: // set output port bits |
| r5932 | r5933 | |
| 193 | 193 | /* |
| 194 | 194 | |
| 195 | 195 | 7 to UART 6 counter/timer upper |
| 196 | d0 to UART 7 counter/timer lower | |
| 196 | d0 to UART 7 counter/timer lower | |
| 197 | 197 | 60 to UART 4 aux control (C/T timer mode using external clock) |
| 198 | 20 to UART a command register B | |
| 199 | 30 to UART a command register B | |
| 200 | 10 to UART a command register B | |
| 198 | 20 to UART a command register B | |
| 199 | 30 to UART a command register B | |
| 200 | 10 to UART a command register B | |
| 201 | 201 | 13 to UART 8 mode register B => 8 bits no parity |
| 202 | f to UART 8 mode register B => force odd parity, 8 bits (?) | |
| 202 | f to UART 8 mode register B => force odd parity, 8 bits (?) | |
| 203 | 203 | ee to UART 9 clock select register B |
| 204 | 204 | 5 to UART a command register B (Enable Tx/Enable Rx) |
| 205 | 205 | e7 to UART b Tx holding register B (send E7 to display) |
| r5932 | r5933 | |
|---|---|---|
| 22 | 22 | * 4 8-bit audio channels (2 for left, 2 for right) |
| 23 | 23 | * Gamepad, Serial port, 2 Gameports, Interfaces for keyboard |
| 24 | 24 | |
| 25 | 2009-05 Fabio Priuli: | |
| 26 | Amiga 1200 support is just sketched (I basically took cd32 and removed Akiko). I connected | |
| 27 | the floppy drive in the same way as in amiga.c but it seems to be not working, since I | |
| 28 | tried to load WB3.1 with no success. However, this problem may be due to anything: maybe | |
| 29 | the floppy code must be connected elsewhere, or the .adf image is broken, or I made some | |
| 30 | stupid mistake in the CIA interfaces. | |
| 31 | Later, it could be wise to re-factor this source and merge the non-AGA code with | |
| 32 | mess/drivers/amiga.c | |
| 25 | 2009-05 Fabio Priuli: | |
| 26 | Amiga 1200 support is just sketched (I basically took cd32 and removed Akiko). I connected | |
| 27 | the floppy drive in the same way as in amiga.c but it seems to be not working, since I | |
| 28 | tried to load WB3.1 with no success. However, this problem may be due to anything: maybe | |
| 29 | the floppy code must be connected elsewhere, or the .adf image is broken, or I made some | |
| 30 | stupid mistake in the CIA interfaces. | |
| 31 | Later, it could be wise to re-factor this source and merge the non-AGA code with | |
| 32 | mess/drivers/amiga.c | |
| 33 | 33 | */ |
| 34 | 34 | |
| 35 | 35 | #include "driver.h" |
| r5932 | r5933 | |
| 631 | 631 | |
| 632 | 632 | /***************************************************************************************************/ |
| 633 | 633 | |
| 634 | /* | |
| 634 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 635 | 635 | COMP( 1992, a1200n, 0, 0, a1200n, a1200, a1200, a1200, "Commodore", "Amiga 1200 (NTSC)" , GAME_NOT_WORKING ) |
| 636 | 636 | COMP( 1992, a1200p, a1200n, 0, a1200p, a1200, a1200, a1200, "Commodore", "Amiga 1200 (PAL)" , GAME_NOT_WORKING ) |
| 637 | 637 | CONS( 1993, cd32, 0, 0, cd32, cd32, cd32, 0, "Commodore", "Amiga CD32 (NTSC)" , GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 153 | 153 | /* |
| 154 | 154 | static void apple2gs_floppy35_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 155 | 155 | { |
| 156 | // 3.5" floppy | |
| 157 | switch(state) | |
| 158 | { | |
| 159 | case MESS_DEVINFO_INT_SONYDRIV_ALLOWABLE_SIZES: info->i = SONY_FLOPPY_ALLOW400K | SONY_FLOPPY_ALLOW800K | SONY_FLOPPY_SUPPORT2IMG; break; | |
| 156 | // 3.5" floppy | |
| 157 | switch(state) | |
| 158 | { | |
| 159 | case MESS_DEVINFO_INT_SONYDRIV_ALLOWABLE_SIZES: info->i = SONY_FLOPPY_ALLOW400K | SONY_FLOPPY_ALLOW800K | SONY_FLOPPY_SUPPORT2IMG; break; | |
| 160 | 160 | |
| 161 | case MESS_DEVINFO_STR_NAME+0: strcpy(info->s = device_temp_str(), "slot5disk1"); break; | |
| 162 | case MESS_DEVINFO_STR_NAME+1: strcpy(info->s = device_temp_str(), "slot5disk2"); break; | |
| 163 | case MESS_DEVINFO_STR_SHORT_NAME+0: strcpy(info->s = device_temp_str(), "s5d1"); break; | |
| 164 | case MESS_DEVINFO_STR_SHORT_NAME+1: strcpy(info->s = device_temp_str(), "s5d2"); break; | |
| 165 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "Slot 5 Disk #1"); break; | |
| 166 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "Slot 5 Disk #2"); break; | |
| 161 | case MESS_DEVINFO_STR_NAME+0: strcpy(info->s = device_temp_str(), "slot5disk1"); break; | |
| 162 | case MESS_DEVINFO_STR_NAME+1: strcpy(info->s = device_temp_str(), "slot5disk2"); break; | |
| 163 | case MESS_DEVINFO_STR_SHORT_NAME+0: strcpy(info->s = device_temp_str(), "s5d1"); break; | |
| 164 | case MESS_DEVINFO_STR_SHORT_NAME+1: strcpy(info->s = device_temp_str(), "s5d2"); break; | |
| 165 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "Slot 5 Disk #1"); break; | |
| 166 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "Slot 5 Disk #2"); break; | |
| 167 | 167 | |
| 168 | default: sonydriv_device_getinfo(devclass, state, info); break; | |
| 169 | } | |
| 168 | default: sonydriv_device_getinfo(devclass, state, info); break; | |
| 169 | } | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | static void apple2gs_floppy525_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 175 | 175 | { |
| 176 | // 5.25" floppy | |
| 177 | switch(state) | |
| 178 | { | |
| 179 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVIDEND: info->i = 15; break; | |
| 180 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVISOR: info->i = 16; break; | |
| 176 | // 5.25" floppy | |
| 177 | switch(state) | |
| 178 | { | |
| 179 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVIDEND: info->i = 15; break; | |
| 180 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVISOR: info->i = 16; break; | |
| 181 | 181 | |
| 182 | case MESS_DEVINFO_STR_NAME+0: strcpy(info->s = device_temp_str(), "slot6disk1"); break; | |
| 183 | case MESS_DEVINFO_STR_NAME+1: strcpy(info->s = device_temp_str(), "slot6disk2"); break; | |
| 184 | case MESS_DEVINFO_STR_SHORT_NAME+0: strcpy(info->s = device_temp_str(), "s6d1"); break; | |
| 185 | case MESS_DEVINFO_STR_SHORT_NAME+1: strcpy(info->s = device_temp_str(), "s6d2"); break; | |
| 186 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "Slot 6 Disk #1"); break; | |
| 187 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "Slot 6 Disk #2"); break; | |
| 182 | case MESS_DEVINFO_STR_NAME+0: strcpy(info->s = device_temp_str(), "slot6disk1"); break; | |
| 183 | case MESS_DEVINFO_STR_NAME+1: strcpy(info->s = device_temp_str(), "slot6disk2"); break; | |
| 184 | case MESS_DEVINFO_STR_SHORT_NAME+0: strcpy(info->s = device_temp_str(), "s6d1"); break; | |
| 185 | case MESS_DEVINFO_STR_SHORT_NAME+1: strcpy(info->s = device_temp_str(), "s6d2"); break; | |
| 186 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "Slot 6 Disk #1"); break; | |
| 187 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "Slot 6 Disk #2"); break; | |
| 188 | 188 | |
| 189 | default: apple525_device_getinfo(devclass, state, info); break; | |
| 190 | } | |
| 189 | default: apple525_device_getinfo(devclass, state, info); break; | |
| 190 | } | |
| 191 | 191 | }*/ |
| 192 | 192 | |
| 193 | 193 | static const floppy_config apple2gs_floppy35_floppy_config = |
| r5932 | r5933 | |
| 234 | 234 | /* replace the old-style FDC with an IWM */ |
| 235 | 235 | MDRV_DEVICE_REMOVE("fdc") |
| 236 | 236 | MDRV_IWM_ADD("fdc", apple2_fdc_interface) |
| 237 | /* SCC */ | |
| 237 | /* SCC */ | |
| 238 | 238 | MDRV_SCC8530_ADD("scc") |
| 239 | ||
| 239 | ||
| 240 | 240 | MDRV_FLOPPY_APPLE_2_DRIVES_REMOVE() |
| 241 | 241 | MDRV_FLOPPY_APPLE_2_DRIVES_ADD(apple2gs_floppy525_floppy_config,15,16) |
| 242 | 242 | MDRV_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(apple2gs_floppy35_floppy_config) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | DEC VT320 |
| 4 | 4 | |
| 5 | 5 | 30/06/2009 Skeleton driver. |
| r5932 | r5933 | |
| 21 | 21 | Toshiba TC5565APL-12, 2 off |
| 22 | 22 | Static RAM, 64K bit = 8K byte. |
| 23 | 23 | ST TDA1170N |
| 24 | Vertical deflection system IC. | |
| 24 | Vertical deflection system IC. | |
| 25 | 25 | UC 80343Q |
| 26 | 26 | 20 pins. Unknown. |
| 27 | 27 | UC 80068Q |
| r5932 | r5933 | |
| 33 | 33 | Texas Inst. 749X 75146 |
| 34 | 34 | 8 pins. Unknown. |
| 35 | 35 | Signetics? 74LS373N |
| 36 | 8-bit D-type latch. This has eight inputs and eight outputs. | |
| 36 | 8-bit D-type latch. This has eight inputs and eight outputs. | |
| 37 | 37 | */ |
| 38 | 38 | static ADDRESS_MAP_START(vt320_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 39 | 39 | AM_RANGE(0x0000, 0xffff) AM_ROM |
| r5932 | r5933 | |
| 46 | 46 | INPUT_PORTS_START( vt320 ) |
| 47 | 47 | INPUT_PORTS_END |
| 48 | 48 | |
| 49 | static MACHINE_RESET(vt320) | |
| 50 | { | |
| 49 | static MACHINE_RESET(vt320) | |
| 50 | { | |
| 51 | 51 | memset(mess_ram,0,16*1024); |
| 52 | 52 | } |
| 53 | 53 | |
| r5932 | r5933 | |
| 65 | 65 | /* basic machine hardware */ |
| 66 | 66 | MDRV_CPU_ADD("maincpu", I8051, XTAL_16MHz) |
| 67 | 67 | MDRV_CPU_PROGRAM_MAP(vt320_mem) |
| 68 | MDRV_CPU_IO_MAP(vt320_io) | |
| 68 | MDRV_CPU_IO_MAP(vt320_io) | |
| 69 | 69 | |
| 70 | 70 | MDRV_MACHINE_RESET(vt320) |
| 71 | ||
| 71 | ||
| 72 | 72 | /* video hardware */ |
| 73 | 73 | MDRV_SCREEN_ADD("screen", RASTER) |
| 74 | 74 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 97 | 97 | |
| 98 | 98 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 99 | 99 | COMP( 1987, vt320, 0, 0, vt320, vt320, 0, vt320, "DEC", "VT320", GAME_NOT_WORKING) |
| 100 | //COMP( 1989?, vt330, 0, 0, vt320, vt320, 0, vt320, "DEC", "VT330", GAME_NOT_WORKING) | |
| 101 | //COMP( 1989?, vt340, 0, 0, vt320, vt320, 0, vt320, "DEC", "VT340", GAME_NOT_WORKING) | |
| 102 | //COMP( 1990?, vt340p, 0, 0, vt320, vt320, 0, vt320, "DEC", "VT340+", GAME_NOT_WORKING) | |
| 100 | //COMP( 1989?, vt330, 0, 0, vt320, vt320, 0, vt320, "DEC", "VT330", GAME_NOT_WORKING) | |
| 101 | //COMP( 1989?, vt340, 0, 0, vt320, vt320, 0, vt320, "DEC", "VT340", GAME_NOT_WORKING) | |
| 102 | //COMP( 1990?, vt340p, 0, 0, vt320, vt320, 0, vt320, "DEC", "VT340+", GAME_NOT_WORKING) | |
| 103 | 103 |
| r5932 | r5933 | |
|---|---|---|
| 100 | 100 | /* |
| 101 | 101 | static ACIA6850_INTERFACE( acia_intf ) |
| 102 | 102 | { |
| 103 | 9600, // rx clock, actually based on dipswitches | |
| 104 | 9600, // tx clock, actually based on dipswitches | |
| 105 | DEVCB_NULL, // rx callback | |
| 106 | DEVCB_NULL, // tx callback | |
| 107 | DEVCB_NULL, | |
| 108 | DEVCB_NULL, | |
| 109 | DEVCB_NULL, | |
| 110 | DEVCB_NULL | |
| 103 | 9600, // rx clock, actually based on dipswitches | |
| 104 | 9600, // tx clock, actually based on dipswitches | |
| 105 | DEVCB_NULL, // rx callback | |
| 106 | DEVCB_NULL, // tx callback | |
| 107 | DEVCB_NULL, | |
| 108 | DEVCB_NULL, | |
| 109 | DEVCB_NULL, | |
| 110 | DEVCB_NULL | |
| 111 | 111 | };*/ |
| 112 | 112 | |
| 113 | 113 | /****************************************************************************** |
| r5932 | r5933 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | Juergen Buchmueller, June 1998 |
| 7 | 7 | |
| 8 | 2009-05 FP changes: | |
| 9 | Factored out MESS specific code from MAME | |
| 10 | Added skeleton support for other XL/XE machines (VERY preliminary): | |
| 11 | - a600xl based on maxaflex emulation in MAME | |
| 12 | - a1200xl sharing a800xl code without BASIC | |
| 13 | - a65xe, a65xea, a130xe, a800xe, xegs sharing a800xl code (and this is wrong | |
| 14 | at least for xegs) | |
| 15 | Added proper dumps and labels, thanks to Freddy Offenga researches (a few | |
| 16 | are still marked BAD_DUMP while waiting for crc confirmation, since they | |
| 17 | have been obtained by splitting whole dumps) | |
| 8 | 2009-05 FP changes: | |
| 9 | Factored out MESS specific code from MAME | |
| 10 | Added skeleton support for other XL/XE machines (VERY preliminary): | |
| 11 | - a600xl based on maxaflex emulation in MAME | |
| 12 | - a1200xl sharing a800xl code without BASIC | |
| 13 | - a65xe, a65xea, a130xe, a800xe, xegs sharing a800xl code (and this is wrong | |
| 14 | at least for xegs) | |
| 15 | Added proper dumps and labels, thanks to Freddy Offenga researches (a few | |
| 16 | are still marked BAD_DUMP while waiting for crc confirmation, since they | |
| 17 | have been obtained by splitting whole dumps) | |
| 18 | 18 | |
| 19 | To Do: | |
| 20 | - Find out why a600xl and a800xl don't work (xe machines should then follow) | |
| 21 | - Investigate supported RAM sizes and OS versions in different models | |
| 22 | - Implement differences between various models (currently most of the | |
| 23 | XL/XE are exactly an a800xl, but this will change as soon as emulation | |
| 24 | starts to work) | |
| 25 | - Fix various keyboard differences | |
| 26 | - Freddy emulation for 800XLF? | |
| 27 | - Add support for proto boards and expansions (a1400xl, C/PM board, etc.) | |
| 28 | - Clean up the whole driver + cart + floppy structure | |
| 19 | To Do: | |
| 20 | - Find out why a600xl and a800xl don't work (xe machines should then follow) | |
| 21 | - Investigate supported RAM sizes and OS versions in different models | |
| 22 | - Implement differences between various models (currently most of the | |
| 23 | XL/XE are exactly an a800xl, but this will change as soon as emulation | |
| 24 | starts to work) | |
| 25 | - Fix various keyboard differences | |
| 26 | - Freddy emulation for 800XLF? | |
| 27 | - Add support for proto boards and expansions (a1400xl, C/PM board, etc.) | |
| 28 | - Clean up the whole driver + cart + floppy structure | |
| 29 | 29 | |
| 30 | 30 | ******************************************************************************/ |
| 31 | 31 | |
| r5932 | r5933 | |
| 412 | 412 | Small note about natural keyboard support: currently, |
| 413 | 413 | - "Break" is mapped to 'F1' |
| 414 | 414 | - "Clear" is mapped to 'F2' |
| 415 | - "Atari" is mapped to 'F3' | |
| 415 | - "Atari" is mapped to 'F3' */ | |
| 416 | 416 | |
| 417 | 417 | static INPUT_PORTS_START( atari_keyboard ) |
| 418 | 418 | PORT_START("keyboard_0") |
| r5932 | r5933 | |
| 420 | 420 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') |
| 421 | 421 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 422 | 422 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 423 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 423 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 424 | 424 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| 425 | 425 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('\\') |
| 426 | 426 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('^') |
| r5932 | r5933 | |
| 480 | 480 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 481 | 481 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 482 | 482 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 483 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BackS Delete") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(DEL)) | |
| 483 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BackS Delete") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(DEL)) | |
| 484 | 484 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('@') |
| 485 | 485 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("< Clear") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('<') PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 486 | 486 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("> Insert") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('>') PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| r5932 | r5933 | |
| 713 | 713 | { |
| 714 | 714 | int i; |
| 715 | 715 | |
| 716 | for ( i = 0; i < sizeof(atari_palette) / 3; i++ ) | |
| 716 | for ( i = 0; i < sizeof(atari_palette) / 3; i++ ) | |
| 717 | 717 | { |
| 718 | 718 | palette_set_color_rgb(machine, i, atari_palette[i*3], atari_palette[i*3+1], atari_palette[i*3+2]); |
| 719 | 719 | } |
| r5932 | r5933 | |
| 791 | 791 | base2 = memory_region(machine, "maincpu") + 0x15000; /* 0x0800 bytes */ |
| 792 | 792 | } |
| 793 | 793 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5000, 0x57ff, 0, 0, rbank2, wbank2); |
| 794 | memory_set_bankptr(machine, 2, base2); | |
| 794 | memory_set_bankptr(machine, 2, base2); | |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /* BASIC was available in a separate cart, so we don't test it */ |
| r5932 | r5933 | |
| 843 | 843 | base2 = memory_region(machine, "maincpu") + 0x15000; /* 0x0800 bytes */ |
| 844 | 844 | } |
| 845 | 845 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5000, 0x57ff, 0, 0, rbank2, wbank2); |
| 846 | memory_set_bankptr(machine, 2, base2); | |
| 846 | memory_set_bankptr(machine, 2, base2); | |
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | /************************************************************** |
| r5932 | r5933 | |
| 1011 | 1011 | MDRV_SCREEN_MODIFY("screen") |
| 1012 | 1012 | MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) |
| 1013 | 1013 | MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) |
| 1014 | ||
| 1014 | ||
| 1015 | 1015 | MDRV_IMPORT_FROM(a400_cartslot) |
| 1016 | 1016 | MACHINE_DRIVER_END |
| 1017 | 1017 | |
| r5932 | r5933 | |
| 1028 | 1028 | MDRV_SCREEN_MODIFY("screen") |
| 1029 | 1029 | MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_50HZ) |
| 1030 | 1030 | MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_50HZ) |
| 1031 | ||
| 1031 | ||
| 1032 | 1032 | MDRV_IMPORT_FROM(a400_cartslot) |
| 1033 | 1033 | MACHINE_DRIVER_END |
| 1034 | 1034 | |
| r5932 | r5933 | |
| 1045 | 1045 | MDRV_SCREEN_MODIFY("screen") |
| 1046 | 1046 | MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) |
| 1047 | 1047 | MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) |
| 1048 | ||
| 1048 | ||
| 1049 | 1049 | MDRV_IMPORT_FROM(a800_cartslot) |
| 1050 | 1050 | MACHINE_DRIVER_END |
| 1051 | 1051 | |
| r5932 | r5933 | |
| 1081 | 1081 | MDRV_SCREEN_MODIFY("screen") |
| 1082 | 1082 | MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) |
| 1083 | 1083 | MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) |
| 1084 | ||
| 1084 | ||
| 1085 | 1085 | MDRV_IMPORT_FROM(a400_cartslot) |
| 1086 | 1086 | MACHINE_DRIVER_END |
| 1087 | 1087 | |
| r5932 | r5933 | |
| 1100 | 1100 | MDRV_SCREEN_MODIFY("screen") |
| 1101 | 1101 | MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) |
| 1102 | 1102 | MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) |
| 1103 | ||
| 1103 | ||
| 1104 | 1104 | MDRV_IMPORT_FROM(a400_cartslot) |
| 1105 | 1105 | MACHINE_DRIVER_END |
| 1106 | 1106 | |
| r5932 | r5933 | |
| 1124 | 1124 | MDRV_SCREEN_MODIFY( "screen" ) |
| 1125 | 1125 | MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ) |
| 1126 | 1126 | MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ) |
| 1127 | ||
| 1127 | ||
| 1128 | 1128 | MDRV_CARTSLOT_ADD("cart") |
| 1129 | 1129 | MDRV_CARTSLOT_EXTENSION_LIST("rom,bin,a52") |
| 1130 | 1130 | MDRV_CARTSLOT_NOT_MANDATORY |
| r5932 | r5933 | |
| 1206 | 1206 | ROM_START(a65xea) |
| 1207 | 1207 | ROM_REGION(0x18000, "maincpu", 0) |
| 1208 | 1208 | ROM_LOAD( "basic_ar.rom", 0x10000, 0x2000, CRC(c899f4d6) SHA1(043df191d1fe402e792266a108e147ffcda35130) ) // is this correct? or shall we use Rev. C? |
| 1209 | // | |
| 1209 | // ROM_LOAD( "c101700.rom", 0x14000, 0x4000, CRC(7f9a76c8) SHA1(57eb6d87850a763f11767f53d4eaede186f831a2) ) // this was from Savetz and has wrong bits! | |
| 1210 | 1210 | ROM_LOAD( "c101700.rom", 0x14000, 0x4000, CRC(45f47988) SHA1(a36b8b20f657580f172749bb0625c08706ed824c) ) // Rev. 3B ? |
| 1211 | 1211 | ROM_END |
| 1212 | 1212 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | drivers/mac.c | |
| 4 | Mac Plus & 512ke emulation | |
| 5 | ||
| 6 | Nate Woods, Raphael Nabet | |
| 7 | ||
| 8 | ||
| 9 | 0x000000 - 0x3fffff RAM/ROM (switches based on overlay) | |
| 10 | 0x400000 - 0x4fffff ROM | |
| 11 | 0x580000 - 0x5fffff 5380 NCR/Symbios SCSI peripherals chip (Mac Plus only) | |
| 12 | 0x600000 - 0x6fffff RAM | |
| 13 | 0x800000 - 0x9fffff Zilog 8530 SCC (Serial Control Chip) Read | |
| 14 | 0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Control Chip) Write | |
| 15 | 0xc00000 - 0xdfffff IWM (Integrated Woz Machine; floppy) | |
| 16 | 0xe80000 - 0xefffff Rockwell 6522 VIA | |
| 17 | 0xf00000 - 0xffffef ??? (the ROM appears to be accessing here) | |
| 18 | 0xfffff0 - 0xffffff Auto Vector | |
| 19 | ||
| 20 | ||
| 21 | Interrupts: | |
| 22 | M68K: | |
| 23 | Level 1 from VIA | |
| 24 | Level 2 from SCC | |
| 25 | Level 4 : Interrupt switch (not implemented) | |
| 26 | ||
| 27 | VIA: | |
| 28 | CA1 from VBLANK | |
| 29 | CA2 from 1 Hz clock (RTC) | |
| 30 | CB1 from Keyboard Clock | |
| 31 | CB2 from Keyboard Data | |
| 32 | SR from Keyboard Data Ready | |
| 33 | ||
| 34 | SCC: | |
| 35 | PB_EXT from mouse Y circuitry | |
| 36 | PA_EXT from mouse X circuitry | |
| 37 | ||
| 3 | drivers/mac.c | |
| 4 | Mac Plus & 512ke emulation | |
| 5 | ||
| 6 | Nate Woods, Raphael Nabet | |
| 7 | ||
| 8 | ||
| 9 | 0x000000 - 0x3fffff RAM/ROM (switches based on overlay) | |
| 10 | 0x400000 - 0x4fffff ROM | |
| 11 | 0x580000 - 0x5fffff 5380 NCR/Symbios SCSI peripherals chip (Mac Plus only) | |
| 12 | 0x600000 - 0x6fffff RAM | |
| 13 | 0x800000 - 0x9fffff Zilog 8530 SCC (Serial Control Chip) Read | |
| 14 | 0xa00000 - 0xbfffff Zilog 8530 SCC (Serial Control Chip) Write | |
| 15 | 0xc00000 - 0xdfffff IWM (Integrated Woz Machine; floppy) | |
| 16 | 0xe80000 - 0xefffff Rockwell 6522 VIA | |
| 17 | 0xf00000 - 0xffffef ??? (the ROM appears to be accessing here) | |
| 18 | 0xfffff0 - 0xffffff Auto Vector | |
| 19 | ||
| 20 | ||
| 21 | Interrupts: | |
| 22 | M68K: | |
| 23 | Level 1 from VIA | |
| 24 | Level 2 from SCC | |
| 25 | Level 4 : Interrupt switch (not implemented) | |
| 26 | ||
| 27 | VIA: | |
| 28 | CA1 from VBLANK | |
| 29 | CA2 from 1 Hz clock (RTC) | |
| 30 | CB1 from Keyboard Clock | |
| 31 | CB2 from Keyboard Data | |
| 32 | SR from Keyboard Data Ready | |
| 33 | ||
| 34 | SCC: | |
| 35 | PB_EXT from mouse Y circuitry | |
| 36 | PA_EXT from mouse X circuitry | |
| 37 | ||
| 38 | 38 | ****************************************************************************/ |
| 39 | 39 | |
| 40 | 40 | #include "driver.h" |
| r5932 | r5933 | |
| 50 | 50 | // LC: boot needs 50f04000 bit 0 to go "1" at a49f00. SCC. |
| 51 | 51 | |
| 52 | 52 | /* |
| 53 | ||
| 53 | Apple Sound Chip | |
| 54 | 54 | |
| 55 | Base is normally IOBase + 0x14000 | |
| 56 | First 0x800 bytes is buffer RAM | |
| 55 | Base is normally IOBase + 0x14000 | |
| 56 | First 0x800 bytes is buffer RAM | |
| 57 | 57 | |
| 58 | ||
| 58 | Verified to be only 8 bits wide by Apple documentation. | |
| 59 | 59 | |
| 60 | Registers: | |
| 61 | 0x800: CONTROL | |
| 62 | 0x801: ENABLE | |
| 63 | 0x802: MODE | |
| 64 | 0x806: VOLUME | |
| 65 | 0x807: CHAN | |
| 60 | Registers: | |
| 61 | 0x800: CONTROL | |
| 62 | 0x801: ENABLE | |
| 63 | 0x802: MODE | |
| 64 | 0x806: VOLUME | |
| 65 | 0x807: CHAN | |
| 66 | 66 | */ |
| 67 | 67 | |
| 68 | 68 | static UINT8 mac_asc_regs[0x2000]; |
| r5932 | r5933 | |
| 183 | 183 | /* devices */ |
| 184 | 184 | MDRV_IWM_ADD("fdc", mac_iwm_interface) |
| 185 | 185 | MDRV_FLOPPY_SONY_2_DRIVES_ADD(mac128512_floppy_config) |
| 186 | ||
| 186 | ||
| 187 | 187 | MDRV_SCC8530_ADD("scc") |
| 188 | 188 | MDRV_SCC8530_ACK(mac_scc_ack) |
| 189 | 189 | MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_intf) |
| r5932 | r5933 | |
| 198 | 198 | |
| 199 | 199 | MDRV_HARDDISK_ADD( "harddisk1" ) |
| 200 | 200 | MDRV_HARDDISK_ADD( "harddisk2" ) |
| 201 | ||
| 201 | ||
| 202 | 202 | MDRV_FLOPPY_SONY_2_DRIVES_MODIFY(mac_floppy_config) |
| 203 | 203 | MACHINE_DRIVER_END |
| 204 | 204 |
| r5932 | r5933 | |
|---|---|---|
| 1704 | 1704 | MDRV_DEVICE_REMOVE("rtc") |
| 1705 | 1705 | |
| 1706 | 1706 | MDRV_NEC765A_ADD("nec765", nc200_nec765_interface) |
| 1707 | ||
| 1707 | ||
| 1708 | 1708 | MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, nc200_floppy_config) |
| 1709 | 1709 | MACHINE_DRIVER_END |
| 1710 | 1710 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 3 | P8000 | |
| 4 | 2 | |
| 5 | 09/2009 Skeleton driver based on Matt Knoth's emulator. | |
| 3 | P8000 | |
| 4 | ||
| 5 | 09/2009 Skeleton driver based on Matt Knoth's emulator. | |
| 6 | 6 | P8000emu (http://knothusa.net/Home.php) has been a great source of info. |
| 7 | 7 | Other info from |
| 8 | 8 | * http://www.pofo.de/P8000/notes/books/ |
| 9 | 9 | * http://www.pofo.de/P8000/ |
| 10 | 10 | |
| 11 | 11 | TODO: |
| 12 | * add Z8001 core so that we can handle the 16bit IO Map (Z8000 uses a | |
| 12 | * add Z8001 core so that we can handle the 16bit IO Map (Z8000 uses a | |
| 13 | 13 | 8bit IO Map, and hence I commented out the whole map) |
| 14 | 14 | * add floppy emulation to 8 bit board |
| 15 | 15 | * properly implement Z80 daisy chain in 16 bit board |
| r5932 | r5933 | |
| 69 | 69 | ADDRESS_MAP_END |
| 70 | 70 | |
| 71 | 71 | static ADDRESS_MAP_START(p8k_iomap, ADDRESS_SPACE_IO, 8) |
| 72 | // | |
| 72 | // AM_RANGE(0x00, 0x07) // MH7489 | |
| 73 | 73 | AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80ctc_0", z80ctc_r, z80ctc_w) |
| 74 | 74 | AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80pio_0", z80pio_alt_r, z80pio_alt_w) |
| 75 | 75 | AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("z80pio_1", z80pio_alt_r, z80pio_alt_w) |
| 76 | 76 | AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_2", z80pio_alt_r, z80pio_alt_w) // we still need to add the FDC related part of this one |
| 77 | // | |
| 77 | // AM_RANGE(0x20, 0x23) // FDC | |
| 78 | 78 | AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("z80sio_0", sio2_r, sio2_w) |
| 79 | 79 | AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("z80sio_1", sio2_r, sio2_w) |
| 80 | 80 | AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80ctc_1", z80ctc_r, z80ctc_w) |
| r5932 | r5933 | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | static ADDRESS_MAP_START(p8k_16_iomap, ADDRESS_SPACE_IO, 16) |
| 153 | // | |
| 153 | // AM_RANGE(0x0fef0, 0x0feff) // clock | |
| 154 | 154 | AM_RANGE(0x0ff80, 0x0ff87) AM_DEVREADWRITE("z80sio_0", p8k_16_sio_r, p8k_16_sio_w) |
| 155 | 155 | AM_RANGE(0x0ff88, 0x0ff8f) AM_DEVREADWRITE("z80sio_1", p8k_16_sio_r, p8k_16_sio_w) |
| 156 | 156 | AM_RANGE(0x0ff90, 0x0ff97) AM_DEVREADWRITE("z80pio_0", p8k_16_pio_r, p8k_16_pio_w) |
| r5932 | r5933 | |
| 158 | 158 | AM_RANGE(0x0ffa0, 0x0ffa7) AM_DEVREADWRITE("z80pio_2", p8k_16_pio_r, p8k_16_pio_w) |
| 159 | 159 | AM_RANGE(0x0ffa8, 0x0ffaf) AM_DEVREADWRITE("z80ctc_0", p8k_16_ctc_r, p8k_16_ctc_w) |
| 160 | 160 | AM_RANGE(0x0ffb0, 0x0ffb7) AM_DEVREADWRITE("z80ctc_1", p8k_16_ctc_r, p8k_16_ctc_w) |
| 161 | // AM_RANGE(0x0ffc0, 0x0ffc1) // SCR | |
| 162 | // AM_RANGE(0x0ffc8, 0x0ffc9) // SBR | |
| 163 | // AM_RANGE(0x0ffd0, 0x0ffd1) // NBR | |
| 164 | // AM_RANGE(0x0ffd8, 0x0ffd9) // SNVR | |
| 165 | // AM_RANGE(0x0ffe0, 0x0ffe1) // RETI | |
| 166 | // AM_RANGE(0x0fff0, 0x0fff1) // TRPL | |
| 167 | // AM_RANGE(0x0fff8, 0x0fff9) // IF1L | |
| 161 | // AM_RANGE(0x0ffc0, 0x0ffc1) // SCR | |
| 162 | // AM_RANGE(0x0ffc8, 0x0ffc9) // SBR | |
| 163 | // AM_RANGE(0x0ffd0, 0x0ffd1) // NBR | |
| 164 | // AM_RANGE(0x0ffd8, 0x0ffd9) // SNVR | |
| 165 | // AM_RANGE(0x0ffe0, 0x0ffe1) // RETI | |
| 166 | // AM_RANGE(0x0fff0, 0x0fff1) // TRPL | |
| 167 | // AM_RANGE(0x0fff8, 0x0fff9) // IF1L | |
| 168 | 168 | ADDRESS_MAP_END |
| 169 | 169 | |
| 170 | 170 | #endif |
| r5932 | r5933 | |
| 175 | 175 | INPUT_PORTS_END |
| 176 | 176 | |
| 177 | 177 | |
| 178 | static MACHINE_RESET( p8k ) | |
| 178 | static MACHINE_RESET( p8k ) | |
| 179 | 179 | { |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | static MACHINE_RESET( p8k_16 ) | |
| 182 | static MACHINE_RESET( p8k_16 ) | |
| 183 | 183 | { |
| 184 | 184 | } |
| 185 | 185 | |
| r5932 | r5933 | |
| 194 | 194 | |
| 195 | 195 | |
| 196 | 196 | /*************************************************************************** |
| 197 | ||
| 197 | ||
| 198 | 198 | P8000 8bit Peripherals |
| 199 | 199 | |
| 200 | 200 | ****************************************************************************/ |
| r5932 | r5933 | |
| 245 | 245 | /* Z80 CTC 1 */ |
| 246 | 246 | // to implement: callbacks! |
| 247 | 247 | // manual states the callbacks should go to |
| 248 | // Baud Gen 0, Baud Gen 1, Baud Gen 2, | |
| 248 | // Baud Gen 0, Baud Gen 1, Baud Gen 2, | |
| 249 | 249 | |
| 250 | 250 | static const z80ctc_interface p8k_ctc_1_intf = |
| 251 | 251 | { |
| r5932 | r5933 | |
| 347 | 347 | |
| 348 | 348 | |
| 349 | 349 | /*************************************************************************** |
| 350 | ||
| 350 | ||
| 351 | 351 | P8000 16bit Peripherals |
| 352 | 352 | |
| 353 | 353 | ****************************************************************************/ |
| r5932 | r5933 | |
| 468 | 468 | }; |
| 469 | 469 | |
| 470 | 470 | /*************************************************************************** |
| 471 | ||
| 471 | ||
| 472 | 472 | Machine Drivers |
| 473 | 473 | |
| 474 | 474 | ****************************************************************************/ |
| r5932 | r5933 | |
| 480 | 480 | MDRV_CPU_PROGRAM_MAP(p8k_memmap) |
| 481 | 481 | MDRV_CPU_IO_MAP(p8k_iomap) |
| 482 | 482 | |
| 483 | // | |
| 483 | // MDRV_MACHINE_START( p8000_8 ) | |
| 484 | 484 | MDRV_MACHINE_RESET(p8k) |
| 485 | 485 | |
| 486 | 486 | /* peripheral hardware */ |
| r5932 | r5933 | |
| 517 | 517 | MDRV_CPU_ADD("maincpu", Z8000, XTAL_4MHz ) // actually z8001, appropriate changes pending |
| 518 | 518 | MDRV_CPU_CONFIG(p8k_16_daisy_chain) |
| 519 | 519 | MDRV_CPU_PROGRAM_MAP(p8k_16_memmap) |
| 520 | // | |
| 520 | // MDRV_CPU_IO_MAP(p8k_16_iomap) | |
| 521 | 521 | |
| 522 | // | |
| 522 | // MDRV_MACHINE_START( p8000_16 ) | |
| 523 | 523 | MDRV_MACHINE_RESET(p8k_16) |
| 524 | 524 | |
| 525 | 525 | /* peripheral hardware */ |
| r5932 | r5933 | |
|---|---|---|
| 20 | 20 | ADDRESS_MAP_UNMAP_HIGH |
| 21 | 21 | AM_RANGE( 0x0000, 0x07ff ) AM_ROM // Monitor |
| 22 | 22 | AM_RANGE( 0x0800, 0x0fff ) AM_ROM // BASIC |
| 23 | AM_RANGE( 0x1000, 0x17ff ) AM_RAM // Video RAM | |
| 23 | AM_RANGE( 0x1000, 0x17ff ) AM_RAM // Video RAM | |
| 24 | 24 | AM_RANGE( 0x1800, 0x1fff ) AM_RAM // RAM |
| 25 | 25 | ADDRESS_MAP_END |
| 26 | 26 | |
| r5932 | r5933 | |
| 28 | 28 | ADDRESS_MAP_UNMAP_HIGH |
| 29 | 29 | AM_RANGE( 0x0000, 0x07ff ) AM_ROM // Monitor |
| 30 | 30 | AM_RANGE( 0x0800, 0x0fff ) AM_ROM // BASIC |
| 31 | AM_RANGE( 0x1000, 0x17ff ) AM_RAM // Video RAM | |
| 31 | AM_RANGE( 0x1000, 0x17ff ) AM_RAM // Video RAM | |
| 32 | 32 | AM_RANGE( 0x1800, 0xffff ) AM_RAM // RAM |
| 33 | 33 | ADDRESS_MAP_END |
| 34 | 34 | |
| r5932 | r5933 | |
| 104 | 104 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 105 | 105 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 106 | 106 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 107 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 107 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) | |
| 108 | 108 | INPUT_PORTS_END |
| 109 | 109 | |
| 110 | 110 | /* Machine driver */ |
| r5932 | r5933 | |
| 133 | 133 | MDRV_VIDEO_UPDATE(ac1) |
| 134 | 134 | MACHINE_DRIVER_END |
| 135 | 135 | |
| 136 | static MACHINE_DRIVER_START( ac1_32 ) | |
| 136 | static MACHINE_DRIVER_START( ac1_32 ) | |
| 137 | 137 | MDRV_IMPORT_FROM( ac1 ) |
| 138 | ||
| 138 | ||
| 139 | 139 | MDRV_CPU_MODIFY("maincpu") |
| 140 | 140 | MDRV_CPU_PROGRAM_MAP(ac1_32_mem) |
| 141 | ||
| 141 | ||
| 142 | 142 | MDRV_SCREEN_MODIFY("screen") |
| 143 | 143 | MDRV_SCREEN_SIZE(64*6, 32*8) |
| 144 | 144 | MDRV_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1) |
| 145 | 145 | MDRV_VIDEO_UPDATE(ac1_32) |
| 146 | 146 | MACHINE_DRIVER_END |
| 147 | ||
| 147 | ||
| 148 | 148 | /* ROM definition */ |
| 149 | 149 | ROM_START( ac1 ) |
| 150 | 150 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 151 | 151 | ROM_SYSTEM_BIOS( 0, "v1", "Version 3.1 (orig)" ) |
| 152 | 152 | ROMX_LOAD( "mon_v31_16.bin", 0x0000, 0x0800, CRC(1ba65e4d) SHA1(3382b8d03f31166a56aea49fd1ec1e82a7108300), ROM_BIOS(1)) |
| 153 | 153 | ROM_SYSTEM_BIOS( 1, "v2", "Version 3.1 (fixed)" ) |
| 154 | ROMX_LOAD( "mon_v31_16_v2.bin", 0x0000, 0x0800, CRC(8904BEB4) SHA1(db8d00a2537ac3a662e3c91e55eb2bf824a72062), ROM_BIOS(2)) | |
| 155 | // from Funkamateur 01/85 | |
| 154 | ROMX_LOAD( "mon_v31_16_v2.bin", 0x0000, 0x0800, CRC(8904BEB4) SHA1(db8d00a2537ac3a662e3c91e55eb2bf824a72062), ROM_BIOS(2)) | |
| 155 | // from Funkamateur 01/85 | |
| 156 | 156 | ROM_LOAD( "minibasic.bin", 0x0800, 0x0800, CRC(06782639) SHA1(3fd57b3ae3f538374b0d794d8aa15d06bcaaddd8)) |
| 157 | 157 | ROM_REGION(0x0800, "gfx1",0) |
| 158 | 158 | // 64 chars - U402 BM513 |
| 159 | ROM_LOAD ("u402.bin", 0x0000, 0x0200, CRC(cfb67f28) SHA1(e3a62a3a8bce0d098887e31fd16410f38832fd18)) | |
| 159 | ROM_LOAD ("u402.bin", 0x0000, 0x0200, CRC(cfb67f28) SHA1(e3a62a3a8bce0d098887e31fd16410f38832fd18)) | |
| 160 | 160 | ROM_COPY("gfx1", 0x0000, 0x0200, 0x0200) |
| 161 | 161 | ROM_COPY("gfx1", 0x0000, 0x0400, 0x0200) |
| 162 | 162 | ROM_COPY("gfx1", 0x0000, 0x0600, 0x0200) |
| r5932 | r5933 | |
| 165 | 165 | ROM_START( ac1_32 ) |
| 166 | 166 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 167 | 167 | ROM_LOAD( "mon_v31_32.bin", 0x0000, 0x0800, CRC(bea78b1a) SHA1(8a3e2ac2033aa0bb016be742cfea7e4b09c0813b)) |
| 168 | // from Funkamateur 01/85 | |
| 168 | // from Funkamateur 01/85 | |
| 169 | 169 | ROM_LOAD( "minibasic.bin", 0x0800, 0x0800, CRC(06782639) SHA1(3fd57b3ae3f538374b0d794d8aa15d06bcaaddd8)) |
| 170 | 170 | ROM_REGION(0x0800, "gfx1",0) |
| 171 | 171 | ROM_SYSTEM_BIOS( 0, "128", "128 chars" ) |
| r5932 | r5933 | |
| 179 | 179 | |
| 180 | 180 | ROM_START( ac1scch ) |
| 181 | 181 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 182 | ROM_SYSTEM_BIOS( 0, "v7", "Version 7" ) | |
| 182 | ROM_SYSTEM_BIOS( 0, "v7", "Version 7" ) | |
| 183 | 183 | ROMX_LOAD( "mon_v7.bin", 0x0000, 0x1000, CRC(fd17b0cf) SHA1(e47113025bd9dadc1522425e21703f43e584b00f),ROM_BIOS(1)) |
| 184 | ROM_SYSTEM_BIOS( 1, "v8", "Version 8" ) | |
| 184 | ROM_SYSTEM_BIOS( 1, "v8", "Version 8" ) | |
| 185 | 185 | ROMX_LOAD( "mon_v8.bin", 0x0000, 0x1000, CRC(5af68da5) SHA1(e760d4400b9c937e7e789d52b8ec975ff253a122),ROM_BIOS(2)) |
| 186 | ROM_SYSTEM_BIOS( 2, "v10", "Version 10" ) | |
| 186 | ROM_SYSTEM_BIOS( 2, "v10", "Version 10" ) | |
| 187 | 187 | ROMX_LOAD( "mon_v10.bin", 0x0000, 0x1000, CRC(f8e67ecb) SHA1(7953676fc8c22824ceff464c7177e9ac0343b8ce),ROM_BIOS(3)) |
| 188 | ROM_SYSTEM_BIOS( 3, "v1088", "Version 10/88" ) | |
| 189 | ROMX_LOAD( "mon_v1088.bin", 0x0000, 0x1000, CRC(bbb0a6df) SHA1(de9389e142541a8b5ff238b59e98bf571c794bef),ROM_BIOS(4)) | |
| 190 | ROM_REGION(0x0800, "gfx1",0) | |
| 188 | ROM_SYSTEM_BIOS( 3, "v1088", "Version 10/88" ) | |
| 189 | ROMX_LOAD( "mon_v1088.bin", 0x0000, 0x1000, CRC(bbb0a6df) SHA1(de9389e142541a8b5ff238b59e98bf571c794bef),ROM_BIOS(4)) | |
| 190 | ROM_REGION(0x0800, "gfx1",0) | |
| 191 | 191 | ROM_LOAD ("zg_scch.bin", 0x0000, 0x0800, CRC(fbfaf5da) SHA1(667568c5909e9a17675cf09dfbce2fc090c420ab)) |
| 192 | 192 | ROM_END |
| 193 | 193 |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | Kevin Thacker [MESS driver] |
| 18 | 18 | |
| 19 | 19 | |
| 20 | ||
| 20 | TODO: | |
| 21 | 21 | |
| 22 | - There are 3 different 64K RAM expansions, Masterchess checks | |
| 23 | for all of them | |
| 24 | - Serial interface SI-5 | |
| 25 | - Floppy interface ROM isn't dumped | |
| 26 | - Interrupts are wrong | |
| 22 | - There are 3 different 64K RAM expansions, Masterchess checks | |
| 23 | for all of them | |
| 24 | - Serial interface SI-5 | |
| 25 | - Floppy interface ROM isn't dumped | |
| 26 | - Interrupts are wrong | |
| 27 | 27 | |
| 28 | 28 | ******************************************************************************/ |
| 29 | 29 | |
| r5932 | r5933 | |
| 590 | 590 | |
| 591 | 591 | MDRV_QUANTUM_TIME(HZ(1200)) |
| 592 | 592 | MDRV_MACHINE_RESET(sord_m5_fd5) |
| 593 | ||
| 593 | ||
| 594 | 594 | MDRV_FLOPPY_4_DRIVES_ADD(sordm5_floppy_config) |
| 595 | 595 | MACHINE_DRIVER_END |
| 596 | 596 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Bondwell 12/14 |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | - Z80A CPU 4MHz | |
| 8 | - 64KB RAM (BW 12), 128KB RAM (BW 14) | |
| 9 | - 4KB ROM System | |
| 10 | - NEC765A Floppy controller | |
| 11 | - 2 x 5.25" Floppy drives 48 tpi SSDD (BW 12), DSDD (BW 14) | |
| 12 | - MC6845 Video controller | |
| 13 | - 2KB RAM Video buffer | |
| 14 | - 4KB ROM Character set | |
| 15 | - Z80SIO Serial interface | |
| 16 | - MC6821 Parallel interface | |
| 17 | - I8253 Counter-timer | |
| 18 | - MC1408 8-bit DAC sound | |
| 19 | - KB3600 PRO (AY-5-3600 PRO) Keyboard controller | |
| 7 | - Z80A CPU 4MHz | |
| 8 | - 64KB RAM (BW 12), 128KB RAM (BW 14) | |
| 9 | - 4KB ROM System | |
| 10 | - NEC765A Floppy controller | |
| 11 | - 2 x 5.25" Floppy drives 48 tpi SSDD (BW 12), DSDD (BW 14) | |
| 12 | - MC6845 Video controller | |
| 13 | - 2KB RAM Video buffer | |
| 14 | - 4KB ROM Character set | |
| 15 | - Z80SIO Serial interface | |
| 16 | - MC6821 Parallel interface | |
| 17 | - I8253 Counter-timer | |
| 18 | - MC1408 8-bit DAC sound | |
| 19 | - KB3600 PRO (AY-5-3600 PRO) Keyboard controller | |
| 20 | 20 | |
| 21 | http://www.eld.leidenuniv.nl/~moene/Home/sitemap/ | |
| 22 | http://www.baltissen.org/newhtm/schemas.htm | |
| 21 | http://www.eld.leidenuniv.nl/~moene/Home/sitemap/ | |
| 22 | http://www.baltissen.org/newhtm/schemas.htm | |
| 23 | 23 | |
| 24 | 24 | ****************************************************************************/ |
| 25 | 25 | |
| r5932 | r5933 | |
| 40 | 40 | |
| 41 | 41 | /* |
| 42 | 42 | |
| 43 | ||
| 43 | TODO: | |
| 44 | 44 | |
| 45 | - Osborne 1 DD disk format | |
| 46 | - floppy motor off timer | |
| 45 | - Osborne 1 DD disk format | |
| 46 | - floppy motor off timer | |
| 47 | 47 | |
| 48 | 48 | */ |
| 49 | 49 | |
| r5932 | r5933 | |
| 110 | 110 | /* trigger floppy motor off NE556 timer */ |
| 111 | 111 | /* |
| 112 | 112 | |
| 113 | R18 = RES_K(100) | |
| 114 | C11 = CAP_U(4.7) | |
| 113 | R18 = RES_K(100) | |
| 114 | C11 = CAP_U(4.7) | |
| 115 | 115 | |
| 116 | ||
| 116 | */ | |
| 117 | 117 | timer_adjust_oneshot(state->floppy_motor_off_timer, attotime_zero, 0); |
| 118 | 118 | } |
| 119 | 119 | } |
| r5932 | r5933 | |
| 218 | 218 | static INPUT_PORTS_START( bw12 ) |
| 219 | 219 | /* |
| 220 | 220 | |
| 221 | ||
| 221 | KB3600 PRO2 Keyboard matrix | |
| 222 | 222 | |
| 223 | | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | | |
| 224 | | | | | | | | | | | | | |
| 225 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 226 | X0 | 7 | 8 | 9 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | | |
| 227 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 228 | X1 | U | I | O | P | Q | W | E | R | T | Y | | |
| 229 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 230 | X2 | F15 | F16 | RET | N. | SP | LOCK| F11 | F12 | F13 | F14 | | |
| 231 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 232 | X3 | F7 | F8 | F9 | F10 | F1 | F2 | F3 | F4 | F5 | F6 | | |
| 233 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 234 | X4 | LEFT|RIGHT| N3 | BS | @ | | - | ] | UP | DOWN| | |
| 235 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 236 | X5 | N9 | CL | N2 | LF | DEL | HT |ARROW| [ | N7 | N8 | | |
| 237 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 238 | X6 | M | , | . | / | Z | X | C | V | B | N | | |
| 239 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 240 | X7 | J | K | L | ; | A | S | D | F | G | H | | |
| 241 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 242 | X8 | N6 | - | N1 | N0 | ESC | | : | NRET| N4 | N5 | | |
| 243 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 223 | | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 | | |
| 224 | | | | | | | | | | | | | |
| 225 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 226 | X0 | 7 | 8 | 9 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | | |
| 227 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 228 | X1 | U | I | O | P | Q | W | E | R | T | Y | | |
| 229 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 230 | X2 | F15 | F16 | RET | N. | SP | LOCK| F11 | F12 | F13 | F14 | | |
| 231 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 232 | X3 | F7 | F8 | F9 | F10 | F1 | F2 | F3 | F4 | F5 | F6 | | |
| 233 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 234 | X4 | LEFT|RIGHT| N3 | BS | @ | | - | ] | UP | DOWN| | |
| 235 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 236 | X5 | N9 | CL | N2 | LF | DEL | HT |ARROW| [ | N7 | N8 | | |
| 237 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 238 | X6 | M | , | . | / | Z | X | C | V | B | N | | |
| 239 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 240 | X7 | J | K | L | ; | A | S | D | F | G | H | | |
| 241 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 242 | X8 | N6 | - | N1 | N0 | ESC | | : | NRET| N4 | N5 | | |
| 243 | ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| | |
| 244 | 244 | |
| 245 | ||
| 245 | */ | |
| 246 | 246 | |
| 247 | 247 | PORT_START("X0") |
| 248 | 248 | PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| r5932 | r5933 | |
| 380 | 380 | { |
| 381 | 381 | int x = (column * 8) + bit; |
| 382 | 382 | int color = BIT(data, 7); |
| 383 | ||
| 383 | ||
| 384 | 384 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 385 | 385 | |
| 386 | 386 | data <<= 1; |
| r5932 | r5933 | |
| 419 | 419 | |
| 420 | 420 | mc6845_update(state->mc6845, bitmap, cliprect); |
| 421 | 421 | |
| 422 | return 0; | |
| 422 | return 0; | |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /* NEC765 Interface */ |
| r5932 | r5933 | |
| 465 | 465 | static READ8_DEVICE_HANDLER( bw12_pia6821_pa_r ) |
| 466 | 466 | { |
| 467 | 467 | /* |
| 468 | ||
| 469 | bit description | |
| 470 | 468 | |
| 471 | PA0 Input from Centronics BUSY status | |
| 472 | PA1 Input from Centronics ERROR status | |
| 473 | PA2 Input from Centronics PAPER OUT status | |
| 474 | PA3 Input from FDC MOTOR | |
| 475 | PA4 Input from PIT OUT2 | |
| 476 | PA5 Input from keyboard strobe | |
| 477 | PA6 Input from keyboard serial data | |
| 478 | PA7 Input from FDC interrupt | |
| 469 | bit description | |
| 479 | 470 | |
| 480 | */ | |
| 481 | ||
| 471 | PA0 Input from Centronics BUSY status | |
| 472 | PA1 Input from Centronics ERROR status | |
| 473 | PA2 Input from Centronics PAPER OUT status | |
| 474 | PA3 Input from FDC MOTOR | |
| 475 | PA4 Input from PIT OUT2 | |
| 476 | PA5 Input from keyboard strobe | |
| 477 | PA6 Input from keyboard serial data | |
| 478 | PA7 Input from FDC interrupt | |
| 479 | ||
| 480 | */ | |
| 481 | ||
| 482 | 482 | bw12_state *state = device->machine->driver_data; |
| 483 | ||
| 483 | ||
| 484 | 484 | UINT8 data = 0; |
| 485 | 485 | |
| 486 | 486 | data |= centronics_busy_r(state->centronics); |
| r5932 | r5933 | |
| 524 | 524 | { |
| 525 | 525 | /* keyboard shift clock */ |
| 526 | 526 | driver_state->key_shift++; |
| 527 | ||
| 527 | ||
| 528 | 528 | if (driver_state->key_shift < 10) |
| 529 | 529 | { |
| 530 | 530 | driver_state->key_sin = driver_state->key_data[driver_state->key_shift]; |
| r5932 | r5933 | |
| 689 | 689 | |
| 690 | 690 | /* allocate floppy motor off timer */ |
| 691 | 691 | state->floppy_motor_off_timer = timer_alloc(machine, floppy_motor_off_tick, NULL); |
| 692 | ||
| 692 | ||
| 693 | 693 | /* setup memory banking */ |
| 694 | 694 | memory_configure_bank(machine, 1, 0, 1, memory_region(machine, Z80_TAG), 0); |
| 695 | 695 | memory_configure_bank(machine, 1, 1, 1, mess_ram, 0); |
| r5932 | r5933 | |
| 765 | 765 | /* basic machine hardware */ |
| 766 | 766 | MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4) |
| 767 | 767 | MDRV_CPU_PROGRAM_MAP(bw12_mem) |
| 768 | MDRV_CPU_IO_MAP(bw12_io) | |
| 768 | MDRV_CPU_IO_MAP(bw12_io) | |
| 769 | 769 | |
| 770 | 770 | MDRV_MACHINE_START(bw12) |
| 771 | 771 | MDRV_MACHINE_RESET(bw12) |
| 772 | ||
| 772 | ||
| 773 | 773 | /* video hardware */ |
| 774 | 774 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 775 | 775 | MDRV_SCREEN_REFRESH_RATE(60) |
| r5932 | r5933 | |
| 785 | 785 | MDRV_VIDEO_UPDATE(bw12) |
| 786 | 786 | |
| 787 | 787 | MDRV_MC6845_ADD(MC6845_TAG, MC6845, XTAL_16MHz/8, bw12_mc6845_interface) |
| 788 | ||
| 788 | ||
| 789 | 789 | /* sound hardware */ |
| 790 | 790 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 791 | 791 | |
| r5932 | r5933 | |
| 801 | 801 | |
| 802 | 802 | /* printer */ |
| 803 | 803 | MDRV_CENTRONICS_ADD(CENTRONICS_TAG, bw12_centronics_intf) |
| 804 | ||
| 804 | ||
| 805 | 805 | MDRV_FLOPPY_2_DRIVES_ADD(bw12_floppy_config) |
| 806 | 806 | MACHINE_DRIVER_END |
| 807 | 807 | |
| r5932 | r5933 | |
| 828 | 828 | |
| 829 | 829 | /* System Drivers */ |
| 830 | 830 | |
| 831 | /* YEAR | |
| 831 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 832 | 832 | COMP( 1984, bw12, 0, 0, bw12, bw12, 0, bw12, "Bondwell International Limited", "Bondwell 12", GAME_SUPPORTS_SAVE ) |
| 833 | 833 | COMP( 1984, bw14, bw12, 0, bw12, bw12, 0, bw14, "Bondwell International Limited", "Bondwell 14", GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 15 | 15 | static const device_config* beta; |
| 16 | 16 | |
| 17 | 17 | static DIRECT_UPDATE_HANDLER( pentagon_direct ) |
| 18 | { | |
| 18 | { | |
| 19 | 19 | UINT16 pc = cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPCBASE); |
| 20 | ||
| 21 | if (beta->started && betadisk_is_active(beta)) | |
| 20 | ||
| 21 | if (beta->started && betadisk_is_active(beta)) | |
| 22 | 22 | { |
| 23 | if (pc >= 0x4000) | |
| 23 | if (pc >= 0x4000) | |
| 24 | 24 | { |
| 25 | 25 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0; |
| 26 | 26 | betadisk_disable(beta); |
| 27 | 27 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 28 | 28 | memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14)); |
| 29 | } | |
| 29 | } | |
| 30 | 30 | } else if (((pc & 0xff00) == 0x3d00) && (ROMSelection==1)) |
| 31 | 31 | { |
| 32 | 32 | ROMSelection = 3; |
| 33 | if (beta->started) | |
| 33 | if (beta->started) | |
| 34 | 34 | betadisk_enable(beta); |
| 35 | ||
| 36 | } | |
| 37 | if((address>=0x0000) && (address<=0x3fff)) | |
| 38 | { | |
| 35 | ||
| 36 | } | |
| 37 | if((address>=0x0000) && (address<=0x3fff)) | |
| 38 | { | |
| 39 | 39 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 40 | if (ROMSelection == 3) { | |
| 41 | if (beta->started) | |
| 40 | if (ROMSelection == 3) { | |
| 41 | if (beta->started) | |
| 42 | 42 | direct->raw = direct->decrypted = memory_region(space->machine, "beta:beta"); |
| 43 | 43 | } else { |
| 44 | 44 | direct->raw = direct->decrypted = memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14); |
| r5932 | r5933 | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | static void pentagon_update_memory(running_machine *machine) |
| 53 | { | |
| 53 | { | |
| 54 | 54 | spectrum_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14)); |
| 55 | 55 | |
| 56 | 56 | memory_set_bankptr(machine, 4, mess_ram + ((spectrum_128_port_7ffd_data & 0x07) * 0x4000)); |
| 57 | 57 | |
| 58 | if (beta->started && betadisk_is_active(beta) && !( spectrum_128_port_7ffd_data & 0x10 ) ) | |
| 59 | { | |
| 58 | if (beta->started && betadisk_is_active(beta) && !( spectrum_128_port_7ffd_data & 0x10 ) ) | |
| 59 | { | |
| 60 | 60 | /* GLUK */ |
| 61 | 61 | if (strcmp(machine->gamedrv->name, "pent1024")==0) { |
| 62 | 62 | ROMSelection = 2; |
| r5932 | r5933 | |
| 64 | 64 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ; |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | else { | |
| 67 | else { | |
| 68 | 68 | /* ROM switching */ |
| 69 | 69 | ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ; |
| 70 | 70 | } |
| r5932 | r5933 | |
| 85 | 85 | pentagon_update_memory(space->machine); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | static ADDRESS_MAP_START (pentagon_io, ADDRESS_SPACE_IO, 8) | |
| 88 | static ADDRESS_MAP_START (pentagon_io, ADDRESS_SPACE_IO, 8) | |
| 89 | 89 | ADDRESS_MAP_UNMAP_HIGH |
| 90 | 90 | AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_status_r,betadisk_command_w) AM_MIRROR(0xff00) |
| 91 | 91 | AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_track_r,betadisk_track_w) AM_MIRROR(0xff00) |
| 92 | 92 | AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_sector_r,betadisk_sector_w) AM_MIRROR(0xff00) |
| 93 | 93 | AM_RANGE(0x007f, 0x007f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_data_r,betadisk_data_w) AM_MIRROR(0xff00) |
| 94 | AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) | |
| 94 | AM_RANGE(0x00fe, 0x00fe) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xff00) AM_MASK(0xffff) | |
| 95 | 95 | AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_state_r, betadisk_param_w) AM_MIRROR(0xff00) |
| 96 | 96 | AM_RANGE(0x4000, 0x4000) AM_WRITE(pentagon_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 97 | 97 | AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd) |
| r5932 | r5933 | |
| 102 | 102 | { |
| 103 | 103 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 104 | 104 | beta = devtag_get_device(machine, BETA_DISK_TAG); |
| 105 | ||
| 105 | ||
| 106 | 106 | memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1)); |
| 107 | 107 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 108 | 108 | |
| r5932 | r5933 | |
| 111 | 111 | betadisk_clear_status(beta); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | memory_set_direct_update_handler( space, pentagon_direct ); | |
| 115 | ||
| 114 | memory_set_direct_update_handler( space, pentagon_direct ); | |
| 115 | ||
| 116 | 116 | memset(mess_ram,0,128*1024); |
| 117 | ||
| 117 | ||
| 118 | 118 | /* Bank 5 is always in 0x4000 - 0x7fff */ |
| 119 | 119 | memory_set_bankptr(machine, 2, mess_ram + (5<<14)); |
| 120 | 120 | |
| r5932 | r5933 | |
| 123 | 123 | |
| 124 | 124 | spectrum_128_port_7ffd_data = 0; |
| 125 | 125 | |
| 126 | pentagon_update_memory(machine); | |
| 126 | pentagon_update_memory(machine); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | static MACHINE_DRIVER_START( pentagon ) |
| r5932 | r5933 | |
| 131 | 131 | MDRV_CPU_MODIFY("maincpu") |
| 132 | 132 | MDRV_CPU_IO_MAP(pentagon_io) |
| 133 | 133 | MDRV_MACHINE_RESET( pentagon ) |
| 134 | ||
| 134 | ||
| 135 | 135 | MDRV_BETA_DISK_ADD(BETA_DISK_TAG) |
| 136 | 136 | MACHINE_DRIVER_END |
| 137 | 137 | |
| r5932 | r5933 | |
| 151 | 151 | ROM_SYSTEM_BIOS(1, "v2", "Pentagon 128K 93") |
| 152 | 152 | ROMX_LOAD("128tr93.rom",0x010000, 0x4000, CRC(08ad241c) SHA1(16daba547c644ef01ce76d2686ccfbff72e13dbe), ROM_BIOS(2)) |
| 153 | 153 | ROMX_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(2)) |
| 154 | ROM_SYSTEM_BIOS(2, "v3", "Pentagon 128K (joined)") | |
| 154 | ROM_SYSTEM_BIOS(2, "v3", "Pentagon 128K (joined)") | |
| 155 | 155 | ROMX_LOAD( "pentagon.rom", 0x010000, 0x8000, CRC(aa1ce4bd) SHA1(a584272f21dc82c14b7d4f1ed440e23a976e71f0), ROM_BIOS(3)) |
| 156 | ROM_SYSTEM_BIOS(3, "v4", "Pentagon 128K Spanish") | |
| 156 | ROM_SYSTEM_BIOS(3, "v4", "Pentagon 128K Spanish") | |
| 157 | 157 | ROMX_LOAD( "pent-es.rom", 0x010000, 0x8000, CRC(34d04bae) SHA1(6782c8c0ee77c40d6d3170a254894dae44ddc93e), ROM_BIOS(4)) |
| 158 | ROM_SYSTEM_BIOS(4, "v5", "Pentagon 128K SOS89R Monitor") | |
| 159 | ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(5)) | |
| 158 | ROM_SYSTEM_BIOS(4, "v5", "Pentagon 128K SOS89R Monitor") | |
| 159 | ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(5)) | |
| 160 | 160 | ROMX_LOAD( "sos89r.rom",0x014000, 0x4000, CRC(09c9e7e1) SHA1(29c567921abd377d2f9c088352c392a5a0858651), ROM_BIOS(5)) |
| 161 | ROM_SYSTEM_BIOS(5, "v6", "Pentagon 128K 1990 Monitor") | |
| 161 | ROM_SYSTEM_BIOS(5, "v6", "Pentagon 128K 1990 Monitor") | |
| 162 | 162 | ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(6)) |
| 163 | 163 | ROMX_LOAD( "basic90.rom",0x014000, 0x4000, CRC(a41575ba) SHA1(44c5de86e765172b0af154fe3934643ce40bf378), ROM_BIOS(6)) |
| 164 | ROM_SYSTEM_BIOS(6, "v7", "Pentagon 128K RaK(c) 1991 Monitor") | |
| 164 | ROM_SYSTEM_BIOS(6, "v7", "Pentagon 128K RaK(c) 1991 Monitor") | |
| 165 | 165 | ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(7)) |
| 166 | 166 | ROMX_LOAD( "sos48.rom", 0x014000, 0x4000, CRC(ceb4005d) SHA1(d56c01ea7abdca178efb2b1c6b2866a9a38274ee), ROM_BIOS(7)) |
| 167 | ROM_SYSTEM_BIOS(7, "v8", "Pentagon 128K Dynaelectronics 1989") | |
| 167 | ROM_SYSTEM_BIOS(7, "v8", "Pentagon 128K Dynaelectronics 1989") | |
| 168 | 168 | ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(8)) |
| 169 | 169 | ROMX_LOAD( "m48a.rom", 0x014000, 0x4000, CRC(a3b4def6) SHA1(7ad59ca373876d452b0cf0ed5edb0e93c3176f1a), ROM_BIOS(8)) |
| 170 | ROM_SYSTEM_BIOS(8, "v9", "ZXVGS v0.22 by Yarek") | |
| 170 | ROM_SYSTEM_BIOS(8, "v9", "ZXVGS v0.22 by Yarek") | |
| 171 | 171 | ROMX_LOAD( "zxvgs-22-0.rom", 0x010000, 0x4000, CRC(63041c61) SHA1(f6718097d939afa8881b4436741a5a23d7e93d78), ROM_BIOS(9)) |
| 172 | ROMX_LOAD( "zxvgs-22-1.rom", 0x014000, 0x4000, CRC(f3736047) SHA1(f3739bf460a57e3f10e8dfb1e7120842938d27ea), ROM_BIOS(9)) | |
| 173 | ROM_SYSTEM_BIOS(9, "v10", "ZXVGS v0.29 by Yarek") | |
| 172 | ROMX_LOAD( "zxvgs-22-1.rom", 0x014000, 0x4000, CRC(f3736047) SHA1(f3739bf460a57e3f10e8dfb1e7120842938d27ea), ROM_BIOS(9)) | |
| 173 | ROM_SYSTEM_BIOS(9, "v10", "ZXVGS v0.29 by Yarek") | |
| 174 | 174 | ROMX_LOAD( "zxvg-29-0.rom", 0x010000, 0x4000, CRC(3b66f433) SHA1(d21df9e7f1ee99d8b38c2e6a32727aac0f1d5dc6), ROM_BIOS(10)) |
| 175 | 175 | ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(10)) |
| 176 | ROM_SYSTEM_BIOS(10, "v11", "ZXVGS v0.30 by Yarek") | |
| 176 | ROM_SYSTEM_BIOS(10, "v11", "ZXVGS v0.30 by Yarek") | |
| 177 | 177 | ROMX_LOAD( "zxvg-30-0.rom", 0x010000, 0x4000, CRC(533e0f26) SHA1(b5f157c5d0da414ec77e445fdc40b78450129709), ROM_BIOS(11)) |
| 178 | 178 | ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(11)) |
| 179 | ROM_SYSTEM_BIOS(11, "v12", "ZXVGS v0.31 by Yarek") | |
| 179 | ROM_SYSTEM_BIOS(11, "v12", "ZXVGS v0.31 by Yarek") | |
| 180 | 180 | ROMX_LOAD( "zxvg-31-0.rom", 0x010000, 0x4000, CRC(76f43500) SHA1(1c7cd52894847668418876d55b93b213d89d92ee), ROM_BIOS(12)) |
| 181 | 181 | ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(12)) |
| 182 | ROM_SYSTEM_BIOS(12, "v13", "ZXVGS v0.35 by Yarek") | |
| 182 | ROM_SYSTEM_BIOS(12, "v13", "ZXVGS v0.35 by Yarek") | |
| 183 | 183 | ROMX_LOAD( "zxvg-35-0.rom", 0x010000, 0x4000, CRC(5cc8b3b1) SHA1(6c6d0ef1b65d7dc4f607d17204488264575ce48c), ROM_BIOS(13)) |
| 184 | ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(13)) | |
| 185 | ROM_SYSTEM_BIOS(13, "v14", "NeOS 512") | |
| 184 | ROMX_LOAD( "zxvg-1.rom", 0x014000, 0x4000, CRC(a8baca3e) SHA1(f2f131eaa4de832eda76290e48f86e465d28ded7), ROM_BIOS(13)) | |
| 185 | ROM_SYSTEM_BIOS(13, "v14", "NeOS 512") | |
| 186 | 186 | ROMX_LOAD("neos_512.rom", 0x010000, 0x4000, CRC(1657fa43) SHA1(647545f06257bce9b1919fcb86b2a49a21c851a7), ROM_BIOS(14)) |
| 187 | 187 | ROMX_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(14)) |
| 188 | 188 | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| r5932 | r5933 | |
| 191 | 191 | ROM_START(pent1024) |
| 192 | 192 | ROM_REGION(0x01c000, "maincpu", ROMREGION_ERASEFF) |
| 193 | 193 | ROM_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca)) |
| 194 | ROM_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa)) | |
| 194 | ROM_LOAD("128p-1.rom", 0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa)) | |
| 195 | 195 | ROM_SYSTEM_BIOS(0, "v1", "Gluk 6.3r") |
| 196 | 196 | ROMX_LOAD( "gluk63r.rom",0x018000, 0x4000, CRC(ca321d79) SHA1(015eb96dafb273d4f4512c467e9b43c305fd1bc4), ROM_BIOS(1)) |
| 197 | 197 | ROM_SYSTEM_BIOS(1, "v2", "Gluk 5.2i") |
| r5932 | r5933 | |
| 205 | 205 | ROM_SYSTEM_BIOS(5, "v6", "Gluk 5.5rr") |
| 206 | 206 | ROMX_LOAD( "gluk55rr.rom",0x018000, 0x4000, CRC(6b60b818) SHA1(9d606275d17770c9341b33b43f40aee227078827), ROM_BIOS(6)) |
| 207 | 207 | ROM_SYSTEM_BIOS(6, "v7", "Gluk 6.0r") |
| 208 | ROMX_LOAD( "gluk60r.rom", 0x018000, 0x4000, CRC(d114a032) SHA1(5db3462ce7a51b473a3a7056e67c11a62cc1cc2a), ROM_BIOS(7)) | |
| 208 | ROMX_LOAD( "gluk60r.rom", 0x018000, 0x4000, CRC(d114a032) SHA1(5db3462ce7a51b473a3a7056e67c11a62cc1cc2a), ROM_BIOS(7)) | |
| 209 | 209 | ROM_SYSTEM_BIOS(7, "v8", "Gluk 6.0-1r") |
| 210 | ROMX_LOAD( "gluk601r.rom", 0x018000, 0x4000, CRC(daf6310b) SHA1(b8945168d4d136b731b33ec4758f8510c47fb8c4), ROM_BIOS(8)) | |
| 210 | ROMX_LOAD( "gluk601r.rom", 0x018000, 0x4000, CRC(daf6310b) SHA1(b8945168d4d136b731b33ec4758f8510c47fb8c4), ROM_BIOS(8)) | |
| 211 | 211 | ROM_SYSTEM_BIOS(8, "v9", "Gluk 5.1") |
| 212 | ROMX_LOAD( "gluk51.rom", 0x018000, 0x4000, CRC(ea8c760b) SHA1(adaab28066ca46fbcdcf084c3b53d5a1b82d94a9), ROM_BIOS(9)) | |
| 212 | ROMX_LOAD( "gluk51.rom", 0x018000, 0x4000, CRC(ea8c760b) SHA1(adaab28066ca46fbcdcf084c3b53d5a1b82d94a9), ROM_BIOS(9)) | |
| 213 | 213 | ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 214 | 214 | ROM_END |
| 215 | 215 |
| r5932 | r5933 | |
|---|---|---|
| 35 | 35 | |
| 36 | 36 | static MACHINE_DRIVER_START( et3400 ) |
| 37 | 37 | /* basic machine hardware */ |
| 38 | MDRV_CPU_ADD("maincpu", M6800, XTAL_1MHz ) | |
| 38 | MDRV_CPU_ADD("maincpu", M6800, XTAL_1MHz ) | |
| 39 | 39 | MDRV_CPU_PROGRAM_MAP(et3400_mem) |
| 40 | 40 | |
| 41 | 41 | MDRV_MACHINE_RESET(et3400) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | PK-8000 |
| 4 | 4 | |
| 5 | ||
| 5 | 18/07/2009 Mostly working driver | |
| 6 | 6 | 12/05/2009 Skeleton driver. |
| 7 | 7 | |
| 8 | 8 | ****************************************************************************/ |
| r5932 | r5933 | |
| 23 | 23 | return devtag_get_device(machine, "cassette"); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | static void pk8000_set_bank(running_machine *machine,UINT8 data) | |
| 27 | { | |
| 26 | static void pk8000_set_bank(running_machine *machine,UINT8 data) | |
| 27 | { | |
| 28 | 28 | UINT8 *rom = memory_region(machine, "maincpu"); |
| 29 | 29 | UINT8 block1 = data & 3; |
| 30 | 30 | UINT8 block2 = (data >> 2) & 3; |
| 31 | 31 | UINT8 block3 = (data >> 4) & 3; |
| 32 | 32 | UINT8 block4 = (data >> 6) & 3; |
| 33 | ||
| 33 | ||
| 34 | 34 | switch(block1) { |
| 35 | 35 | case 0: |
| 36 | 36 | memory_set_bankptr(machine, 1, rom + 0x10000); |
| r5932 | r5933 | |
| 38 | 38 | break; |
| 39 | 39 | case 1: break; |
| 40 | 40 | case 2: break; |
| 41 | case 3: | |
| 41 | case 3: | |
| 42 | 42 | memory_set_bankptr(machine, 1, mess_ram); |
| 43 | 43 | memory_set_bankptr(machine, 5, mess_ram); |
| 44 | 44 | break; |
| 45 | 45 | } |
| 46 | ||
| 46 | ||
| 47 | 47 | switch(block2) { |
| 48 | case 0: | |
| 48 | case 0: | |
| 49 | 49 | memory_set_bankptr(machine, 2, rom + 0x14000); |
| 50 | 50 | memory_set_bankptr(machine, 6, mess_ram + 0x4000); |
| 51 | 51 | break; |
| r5932 | r5933 | |
| 79 | 79 | memory_set_bankptr(machine, 4, mess_ram + 0xc000); |
| 80 | 80 | memory_set_bankptr(machine, 8, mess_ram + 0xc000); |
| 81 | 81 | break; |
| 82 | } | |
| 82 | } | |
| 83 | 83 | } |
| 84 | 84 | static WRITE8_DEVICE_HANDLER(pk8000_80_porta_w) |
| 85 | 85 | { |
| r5932 | r5933 | |
| 97 | 97 | |
| 98 | 98 | static WRITE8_DEVICE_HANDLER(pk8000_80_portc_w) |
| 99 | 99 | { |
| 100 | keyboard_line = data & 0x0f; | |
| 101 | ||
| 100 | keyboard_line = data & 0x0f; | |
| 101 | ||
| 102 | 102 | speaker_level_w(devtag_get_device(device->machine, "speaker"), BIT(data,7)); |
| 103 | ||
| 103 | ||
| 104 | 104 | cassette_change_state(cassette_device_image(device->machine), |
| 105 | 105 | (BIT(data,4)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 106 | 106 | CASSETTE_MASK_MOTOR); |
| 107 | cassette_output(cassette_device_image(device->machine), (BIT(data,6)) ? +1.0 : 0.0); | |
| 107 | cassette_output(cassette_device_image(device->machine), (BIT(data,6)) ? +1.0 : 0.0); | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | static I8255A_INTERFACE( pk8000_ppi8255_interface_1 ) |
| r5932 | r5933 | |
| 118 | 118 | }; |
| 119 | 119 | |
| 120 | 120 | static READ8_DEVICE_HANDLER(pk8000_84_porta_r) |
| 121 | { | |
| 121 | { | |
| 122 | 122 | return pk8000_video_mode; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | static WRITE8_DEVICE_HANDLER(pk8000_84_porta_w) |
| 126 | { | |
| 126 | { | |
| 127 | 127 | pk8000_video_mode = data; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | static WRITE8_DEVICE_HANDLER(pk8000_84_portc_w) |
| 131 | { | |
| 131 | { | |
| 132 | 132 | pk8000_video_enable = BIT(data,4); |
| 133 | 133 | } |
| 134 | 134 | static I8255A_INTERFACE( pk8000_ppi8255_interface_2 ) |
| r5932 | r5933 | |
| 166 | 166 | ADDRESS_MAP_UNMAP_HIGH |
| 167 | 167 | AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("ppi8255_1", i8255a_r, i8255a_w) |
| 168 | 168 | AM_RANGE(0x84, 0x87) AM_DEVREADWRITE("ppi8255_2", i8255a_r, i8255a_w) |
| 169 | AM_RANGE(0x88, 0x88) AM_READWRITE(pk8000_video_color_r,pk8000_video_color_w) | |
| 169 | AM_RANGE(0x88, 0x88) AM_READWRITE(pk8000_video_color_r,pk8000_video_color_w) | |
| 170 | 170 | AM_RANGE(0x8c, 0x8c) AM_READ(pk8000_joy_1_r) |
| 171 | 171 | AM_RANGE(0x8d, 0x8d) AM_READ(pk8000_joy_2_r) |
| 172 | 172 | AM_RANGE(0x90, 0x90) AM_READWRITE(pk8000_text_start_r,pk8000_text_start_w) |
| r5932 | r5933 | |
| 176 | 176 | AM_RANGE(0xa0, 0xbf) AM_READWRITE(pk8000_color_r,pk8000_color_w) |
| 177 | 177 | ADDRESS_MAP_END |
| 178 | 178 | |
| 179 | /* | |
| 179 | /* Input ports */ | |
| 180 | 180 | static INPUT_PORTS_START( pk8000 ) |
| 181 | 181 | PORT_START("LINE0") |
| 182 | 182 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| r5932 | r5933 | |
| 195 | 195 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) |
| 196 | 196 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) |
| 197 | 197 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) |
| 198 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) | |
| 198 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) | |
| 199 | 199 | PORT_START("LINE2") |
| 200 | 200 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) |
| 201 | 201 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("|") PORT_CODE(KEYCODE_BACKSLASH) |
| r5932 | r5933 | |
| 204 | 204 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) |
| 205 | 205 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_MINUS_PAD) |
| 206 | 206 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 207 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 207 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) | |
| 208 | 208 | PORT_START("LINE3") |
| 209 | 209 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 210 | 210 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) |
| r5932 | r5933 | |
| 213 | 213 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) |
| 214 | 214 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 215 | 215 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| 216 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) | |
| 216 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) | |
| 217 | 217 | PORT_START("LINE4") |
| 218 | 218 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) |
| 219 | 219 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) |
| r5932 | r5933 | |
| 222 | 222 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 223 | 223 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 224 | 224 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| 225 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) | |
| 225 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) | |
| 226 | 226 | PORT_START("LINE5") |
| 227 | 227 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) |
| 228 | 228 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| r5932 | r5933 | |
| 231 | 231 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 232 | 232 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) |
| 233 | 233 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) |
| 234 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) | |
| 234 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) | |
| 235 | 235 | PORT_START("LINE6") |
| 236 | 236 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rg") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 237 | 237 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Upr") PORT_CODE(KEYCODE_LCONTROL) |
| r5932 | r5933 | |
| 240 | 240 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("???") PORT_CODE(KEYCODE_LALT) |
| 241 | 241 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) |
| 242 | 242 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) |
| 243 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) | |
| 243 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) | |
| 244 | 244 | PORT_START("LINE7") |
| 245 | 245 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) |
| 246 | 246 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) |
| r5932 | r5933 | |
| 249 | 249 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_F12) |
| 250 | 250 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("VSh") PORT_CODE(KEYCODE_BACKSPACE) |
| 251 | 251 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Sel") PORT_CODE(KEYCODE_RCONTROL) |
| 252 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) | |
| 252 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) | |
| 253 | 253 | PORT_START("LINE8") |
| 254 | 254 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Probel") PORT_CODE(KEYCODE_SPACE) |
| 255 | 255 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cls") PORT_CODE(KEYCODE_HOME) |
| r5932 | r5933 | |
| 258 | 258 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 259 | 259 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) |
| 260 | 260 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) |
| 261 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) | |
| 261 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) | |
| 262 | 262 | PORT_START("LINE9") |
| 263 | 263 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up-Left") PORT_CODE(KEYCODE_7_PAD) |
| 264 | 264 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down-Right") PORT_CODE(KEYCODE_3_PAD) |
| r5932 | r5933 | |
| 270 | 270 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 271 | 271 | PORT_START("JOY1") |
| 272 | 272 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_CATEGORY(10) PORT_PLAYER(1) |
| 273 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_CATEGORY(10) PORT_PLAYER(1) | |
| 273 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_CATEGORY(10) PORT_PLAYER(1) | |
| 274 | 274 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_CATEGORY(10) PORT_PLAYER(1) |
| 275 | 275 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_CATEGORY(10) PORT_PLAYER(1) |
| 276 | 276 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CATEGORY(10) PORT_PLAYER(1) |
| r5932 | r5933 | |
| 279 | 279 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 280 | 280 | PORT_START("JOY2") |
| 281 | 281 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_CATEGORY(10) PORT_PLAYER(2) |
| 282 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_CATEGORY(10) PORT_PLAYER(2) | |
| 282 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_CATEGORY(10) PORT_PLAYER(2) | |
| 283 | 283 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_CATEGORY(10) PORT_PLAYER(2) |
| 284 | 284 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_CATEGORY(10) PORT_PLAYER(2) |
| 285 | 285 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CATEGORY(10) PORT_PLAYER(2) |
| r5932 | r5933 | |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | static IRQ_CALLBACK(pk8000_irq_callback) |
| 297 | { | |
| 297 | { | |
| 298 | 298 | return 0xff; |
| 299 | } | |
| 299 | } | |
| 300 | 300 | |
| 301 | 301 | |
| 302 | static MACHINE_RESET(pk8000) | |
| 302 | static MACHINE_RESET(pk8000) | |
| 303 | 303 | { |
| 304 | pk8000_set_bank(machine,0); | |
| 304 | pk8000_set_bank(machine,0); | |
| 305 | 305 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), pk8000_irq_callback); |
| 306 | 306 | } |
| 307 | 307 | |
| r5932 | r5933 | |
| 326 | 326 | /* basic machine hardware */ |
| 327 | 327 | MDRV_CPU_ADD("maincpu",8080, 1780000) |
| 328 | 328 | MDRV_CPU_PROGRAM_MAP(pk8000_mem) |
| 329 | MDRV_CPU_IO_MAP(pk8000_io) | |
| 329 | MDRV_CPU_IO_MAP(pk8000_io) | |
| 330 | 330 | MDRV_CPU_VBLANK_INT("screen", pk8000_interrupt) |
| 331 | 331 | |
| 332 | 332 | MDRV_MACHINE_RESET(pk8000) |
| 333 | ||
| 333 | ||
| 334 | 334 | /* video hardware */ |
| 335 | 335 | MDRV_SCREEN_ADD("screen", RASTER) |
| 336 | 336 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 343 | 343 | |
| 344 | 344 | MDRV_VIDEO_START(pk8000) |
| 345 | 345 | MDRV_VIDEO_UPDATE(pk8000) |
| 346 | ||
| 346 | ||
| 347 | 347 | MDRV_I8255A_ADD( "ppi8255_1", pk8000_ppi8255_interface_1 ) |
| 348 | 348 | MDRV_I8255A_ADD( "ppi8255_2", pk8000_ppi8255_interface_2 ) |
| 349 | ||
| 349 | ||
| 350 | 350 | /* audio hardware */ |
| 351 | 351 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 352 | 352 | MDRV_SOUND_ADD("speaker", SPEAKER, 0) |
| 353 | 353 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 354 | 354 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 355 | 355 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 356 | ||
| 356 | ||
| 357 | 357 | MDRV_CASSETTE_ADD( "cassette", pk8000_cassette_config ) |
| 358 | 358 | MACHINE_DRIVER_END |
| 359 | 359 |
| r5932 | r5933 | |
|---|---|---|
| 57 | 57 | |
| 58 | 58 | static const mm58274c_interface concept_mm58274c_interface = |
| 59 | 59 | { |
| 60 | 0, /* | |
| 60 | 0, /* mode 24*/ | |
| 61 | 61 | 1 /* first day of week */ |
| 62 | 62 | }; |
| 63 | 63 | |
| r5932 | r5933 | |
| 140 | 140 | /* no sound? */ |
| 141 | 141 | |
| 142 | 142 | MDRV_HARDDISK_ADD( "harddisk1" ) |
| 143 | ||
| 143 | ||
| 144 | 144 | /* rtc */ |
| 145 | 145 | MDRV_MM58274C_ADD("mm58274c", concept_mm58274c_interface) |
| 146 | 146 | |
| 147 | 147 | /* via */ |
| 148 | 148 | MDRV_VIA6522_ADD("via6522_0", 1022750, concept_via6522_intf) |
| 149 | ||
| 149 | ||
| 150 | 150 | MDRV_WD179X_ADD("wd179x", concept_wd17xx_interface ) |
| 151 | ||
| 151 | ||
| 152 | 152 | MDRV_FLOPPY_4_DRIVES_ADD(concept_floppy_config) |
| 153 | 153 | MACHINE_DRIVER_END |
| 154 | 154 |
| r5932 | r5933 | |
|---|---|---|
| 255 | 255 | MDRV_SOUND_ADD("beep", BEEP, 0) |
| 256 | 256 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 257 | 257 | #endif |
| 258 | MDRV_FLOPPY_4_DRIVES_ADD(ti990_4_floppy_config) | |
| 258 | MDRV_FLOPPY_4_DRIVES_ADD(ti990_4_floppy_config) | |
| 259 | 259 | |
| 260 | 260 | MACHINE_DRIVER_END |
| 261 | 261 |
| r5932 | r5933 | |
|---|---|---|
| 415 | 415 | |
| 416 | 416 | These keys corresponds to the following symbols |
| 417 | 417 | |
| 418 | input_port | msx | msxuk | msxjp | msxkr |hotbit |expert | | |
| 419 | ------------------------------------------------------------- | |
| 420 | BACKSLASH2 | \ | | \ | | ´ | | won | | \ ^ | { } | | |
| 421 | ------------------------------------------------------------- | |
| 422 | TILDE | DK* | DK* | _ | _ | < > | / ? | | |
| 418 | input_port | msx | msxuk | msxjp | msxkr |hotbit |expert | | |
| 419 | ------------------------------------------------------------- | |
| 420 | BACKSLASH2 | \ | | \ | | ? | | won | | \ ^ | { } | | |
| 421 | ------------------------------------------------------------- | |
| 422 | TILDE | DK* | DK* | _ | _ | < > | / ? | | |
| 423 | 423 | |
| 424 | 424 | * DK = "Dead Key" |
| 425 | 425 | Notice that 'expert' input_ports covers both versions 1.0 and 1.1. |
| r5932 | r5933 | |
| 1076 | 1076 | MDRV_CASSETTE_ADD( "cassette", msx_cassette_config ) |
| 1077 | 1077 | |
| 1078 | 1078 | MDRV_WD179X_ADD("wd179x", msx_wd17xx_interface ) |
| 1079 | ||
| 1079 | ||
| 1080 | 1080 | MDRV_FLOPPY_2_DRIVES_ADD(msx_floppy_config) |
| 1081 | ||
| 1081 | ||
| 1082 | 1082 | MDRV_IMPORT_FROM(msx_cartslot) |
| 1083 | 1083 | MACHINE_DRIVER_END |
| 1084 | 1084 | |
| r5932 | r5933 | |
| 1151 | 1151 | MDRV_WD179X_ADD("wd179x", msx_wd17xx_interface ) |
| 1152 | 1152 | |
| 1153 | 1153 | MDRV_FLOPPY_2_DRIVES_ADD(msx_floppy_config) |
| 1154 | ||
| 1154 | ||
| 1155 | 1155 | MDRV_IMPORT_FROM(msx_cartslot) |
| 1156 | 1156 | MACHINE_DRIVER_END |
| 1157 | 1157 | |
| r5932 | r5933 | |
| 2128 | 2128 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) |
| 2129 | 2129 | MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x10000, 0x0000) /* 64KB RAM */ |
| 2130 | 2130 | MSX_LAYOUT_END |
| 2131 | ||
| 2132 | ||
| 2131 | ||
| 2132 | ||
| 2133 | 2133 | /******************************** MSX 2 **********************************/ |
| 2134 | 2134 | |
| 2135 | 2135 | /* MSX2 */ |
| r5932 | r5933 | |
| 3303 | 3303 | |
| 3304 | 3304 | MSX_LAYOUT_INIT (hx23) |
| 3305 | 3305 | MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000) |
| 3306 | MSX_LAYOUT_SLOT (0, 0, 2, 2, RAM, 0x8000, 0x8000) /* 32KB RAM | |
| 3306 | MSX_LAYOUT_SLOT (0, 0, 2, 2, RAM, 0x8000, 0x8000) /* 32KB RAM */ | |
| 3307 | 3307 | MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000) |
| 3308 | 3308 | MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000) |
| 3309 | 3309 | MSX_LAYOUT_SLOT (3, 0, 0, 2, RAM, 0x8000, 0x0000) /* 32KB RAM */ |
| r5932 | r5933 | |
|---|---|---|
| 49 | 49 | // 7 - Keyboard TBMT H |
| 50 | 50 | static READ8_HANDLER(vt100_flags_r) |
| 51 | 51 | { |
| 52 | UINT8 retVal = 0; | |
| 53 | retVal |= lba7_r(devtag_get_device(space->machine, "vt100_video"),0) * 0x40; | |
| 54 | retVal |= vt100_keyboard_int * 0x80; | |
| 52 | UINT8 retVal = 0; | |
| 53 | retVal |= lba7_r(devtag_get_device(space->machine, "vt100_video"),0) * 0x40; | |
| 54 | retVal |= vt100_keyboard_int * 0x80; | |
| 55 | 55 | return retVal; |
| 56 | 56 | } |
| 57 | 57 | |
| r5932 | r5933 | |
| 60 | 60 | static TIMER_CALLBACK(keyboard_callback) |
| 61 | 61 | { |
| 62 | 62 | int i; |
| 63 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", | |
| 64 | "LINE4", "LINE5", "LINE6", "LINE7", | |
| 65 | "LINE8", "LINE9", "LINEA", "LINEB", | |
| 63 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", | |
| 64 | "LINE4", "LINE5", "LINE6", "LINE7", | |
| 65 | "LINE8", "LINE9", "LINEA", "LINEB", | |
| 66 | 66 | "LINEC", "LINED", "LINEE", "LINEF" }; |
| 67 | 67 | UINT8 code; |
| 68 | 68 | if (vt100_key_scan == 1) { |
| 69 | for(i = 0; i < 16; i++) | |
| 69 | for(i = 0; i < 16; i++) | |
| 70 | 70 | { |
| 71 | 71 | code = input_port_read(machine, keynames[i]); |
| 72 | 72 | if (code!=0xff) { |
| r5932 | r5933 | |
| 80 | 80 | |
| 81 | 81 | static WRITE8_HANDLER(vt100_keyboard_w) |
| 82 | 82 | { |
| 83 | ||
| 83 | ||
| 84 | 84 | const device_config *speaker = devtag_get_device(space->machine, "speaker"); |
| 85 | ||
| 85 | ||
| 86 | 86 | output_set_value("online_led",BIT(data,5) ? 0 : 1); |
| 87 | 87 | output_set_value("local_led", BIT(data,5)); |
| 88 | 88 | output_set_value("locked_led",BIT(data,4) ? 0 : 1); |
| 89 | 89 | output_set_value("l1_led", BIT(data,3) ? 0 : 1); |
| 90 | 90 | output_set_value("l2_led", BIT(data,2) ? 0 : 1); |
| 91 | 91 | output_set_value("l3_led", BIT(data,1) ? 0 : 1); |
| 92 | output_set_value("l4_led", BIT(data,0) ? 0 : 1); | |
| 92 | output_set_value("l4_led", BIT(data,0) ? 0 : 1); | |
| 93 | 93 | vt100_key_scan = BIT(data,6); |
| 94 | 94 | speaker_level_w(speaker, BIT(data,7)); |
| 95 | 95 | } |
| r5932 | r5933 | |
| 100 | 100 | } |
| 101 | 101 | static WRITE8_HANDLER(vt100_baud_rate_w) |
| 102 | 102 | { |
| 103 | double baud_rate[] = { 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, | |
| 103 | double baud_rate[] = { 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, | |
| 104 | 104 | 1800, 2000, 2400, 3600, 4800, 9600, 19200 }; |
| 105 | ||
| 105 | ||
| 106 | 106 | vt100_send_baud_rate = baud_rate[(data >>4) & 0x0f]; |
| 107 | 107 | vt100_recv_baud_rate = baud_rate[data & 0x0f]; |
| 108 | 108 | } |
| r5932 | r5933 | |
| 113 | 113 | |
| 114 | 114 | static ADDRESS_MAP_START( vt100_io , ADDRESS_SPACE_IO, 8) |
| 115 | 115 | ADDRESS_MAP_UNMAP_HIGH |
| 116 | // 0x00, 0x01 PUSART (Intel 8251) | |
| 117 | // AM_RANGE (0x00, 0x01) | |
| 118 | // 0x02 Baud rate generator | |
| 116 | // 0x00, 0x01 PUSART (Intel 8251) | |
| 117 | // AM_RANGE (0x00, 0x01) | |
| 118 | // 0x02 Baud rate generator | |
| 119 | 119 | AM_RANGE (0x02, 0x02) AM_WRITE(vt100_baud_rate_w) |
| 120 | 120 | // 0x22 Modem buffer |
| 121 | // AM_RANGE (0x22, 0x22) | |
| 121 | // AM_RANGE (0x22, 0x22) | |
| 122 | 122 | // 0x42 Flags buffer |
| 123 | 123 | AM_RANGE (0x42, 0x42) AM_READ(vt100_flags_r) |
| 124 | 124 | // 0x42 Brightness D/A latch |
| r5932 | r5933 | |
| 134 | 134 | // 0xC2 Video processor DC011 |
| 135 | 135 | AM_RANGE (0xc2, 0xc2) AM_DEVWRITE("vt100_video", dc011_w) |
| 136 | 136 | // 0xE2 Graphics port |
| 137 | // AM_RANGE (0xe2, 0xe2) | |
| 137 | // AM_RANGE (0xe2, 0xe2) | |
| 138 | 138 | ADDRESS_MAP_END |
| 139 | 139 | |
| 140 | 140 | /* Input ports */ |
| 141 | 141 | static INPUT_PORTS_START( vt100 ) |
| 142 | 142 | PORT_START("LINE0") |
| 143 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 143 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 144 | 144 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 145 | 145 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 146 | 146 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) |
| r5932 | r5933 | |
| 168 | 168 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD) |
| 169 | 169 | PORT_START("LINE3") |
| 170 | 170 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL) |
| 171 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 171 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 172 | 172 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6) |
| 173 | 173 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) |
| 174 | 174 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD) |
| r5932 | r5933 | |
| 269 | 269 | // A5 - vertical fequency |
| 270 | 270 | // all other set to 1 |
| 271 | 271 | static IRQ_CALLBACK(vt100_irq_callback) |
| 272 | { | |
| 272 | { | |
| 273 | 273 | UINT8 retVal = 0xc7 | (0x08 * vt100_keyboard_int) | (0x10 * vt100_receiver_int) | (0x20 * vt100_vertical_int); |
| 274 | 274 | vt100_receiver_int = 0; |
| 275 | 275 | return retVal; |
| 276 | } | |
| 276 | } | |
| 277 | 277 | |
| 278 | static MACHINE_RESET(vt100) | |
| 278 | static MACHINE_RESET(vt100) | |
| 279 | 279 | { |
| 280 | 280 | vt100_keyboard_int = 0; |
| 281 | 281 | vt100_receiver_int = 0; |
| r5932 | r5933 | |
| 286 | 286 | output_set_value("l1_led", 1); |
| 287 | 287 | output_set_value("l2_led", 1); |
| 288 | 288 | output_set_value("l3_led", 1); |
| 289 | output_set_value("l4_led", 1); | |
| 290 | ||
| 289 | output_set_value("l4_led", 1); | |
| 290 | ||
| 291 | 291 | vt100_key_scan = 0; |
| 292 | timer_pulse(machine, ATTOTIME_IN_HZ(240), NULL, 0, keyboard_callback); | |
| 293 | ||
| 294 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), vt100_irq_callback); | |
| 292 | timer_pulse(machine, ATTOTIME_IN_HZ(240), NULL, 0, keyboard_callback); | |
| 293 | ||
| 294 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), vt100_irq_callback); | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | static READ8_DEVICE_HANDLER (vt100_read_video_ram_r ) |
| r5932 | r5933 | |
| 301 | 301 | |
| 302 | 302 | static WRITE8_DEVICE_HANDLER (vt100_clear_video_interrupt) |
| 303 | 303 | { |
| 304 | vt100_vertical_int = 0; | |
| 304 | vt100_vertical_int = 0; | |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | static const vt_video_interface vt100_video_interface = { |
| r5932 | r5933 | |
| 327 | 327 | MDRV_CPU_VBLANK_INT("screen", vt100_vertical_interrupt) |
| 328 | 328 | |
| 329 | 329 | MDRV_MACHINE_RESET(vt100) |
| 330 | ||
| 330 | ||
| 331 | 331 | /* video hardware */ |
| 332 | 332 | MDRV_SCREEN_ADD("screen", RASTER) |
| 333 | 333 | MDRV_SCREEN_REFRESH_RATE(60) |
| r5932 | r5933 | |
| 341 | 341 | MDRV_DEFAULT_LAYOUT( layout_vt100 ) |
| 342 | 342 | MDRV_VIDEO_START(generic_bitmapped) |
| 343 | 343 | MDRV_VIDEO_UPDATE(vt100) |
| 344 | ||
| 344 | ||
| 345 | 345 | MDRV_VT100_VIDEO_ADD("vt100_video", vt100_video_interface) |
| 346 | ||
| 346 | ||
| 347 | 347 | /* audio hardware */ |
| 348 | 348 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 349 | 349 | MDRV_SOUND_ADD("speaker", SPEAKER, 0) |
| r5932 | r5933 | |
| 354 | 354 | * VT100 - 1978 base model. the 'later' rom is from 1979 or 1980. |
| 355 | 355 | * The vt100 had a whole series of -XX models branching off of it; the |
| 356 | 356 | ones I know of are described here, as well as anything special about |
| 357 | ||
| 357 | them: | |
| 358 | 358 | * VT100-AA - standard model with 120vac cable \__voltage can be switched |
| 359 | 359 | * VT100-AB - standard model with 240vac cable / inside any VT100 unit |
| 360 | 360 | * VT100-W* - word processing series: |
| r5932 | r5933 | |
| 396 | 396 | have the normal vt100 romset variant, and also can have the multiple word |
| 397 | 397 | processing variations (which use the same roms as the vt100 ones do). |
| 398 | 398 | * VT104 doesn't exist. |
| 399 | * VT105 - 1978 vt100 with the WG waveform generator board installed | |
| 399 | * VT105 - 1978 vt100 with the WG waveform generator board installed | |
| 400 | 400 | (for simple chart-type line-compare-made raster graphics using some built |
| 401 | 401 | in functions), AVO optional; was intended for use on the MINC analog data |
| 402 | 402 | acquisition computer. |
| r5932 | r5933 | |
| 415 | 415 | AVO character rom set. Has its own base firmware roms which support block |
| 416 | 416 | serial mode. |
| 417 | 417 | * vt180 - 1980 vt10x (w/vt100 expansion backplane) with a z80 daughterboard |
| 418 | installed; | |
| 418 | installed; | |
| 419 | 419 | The daughterboard has two roms on it: 23-017e3-00 and 23-021e3-00 |
| 420 | 420 | (both are 0x1000 long, 2332 mask roms) |
| 421 | 421 | * vk100 'gigi'- graphical terminal similar to the vt125, but somewhat more |
| 422 | primitive; more or less a vt125 without the screen; | |
| 422 | primitive; more or less a vt125 without the screen; | |
| 423 | 423 | very little info so far, more research needed |
| 424 | 424 | see vk100.c for current driver for this |
| 425 | ||
| 425 | ||
| 426 | 426 | * Upgrade kits for vt1xx: |
| 427 | 427 | * VT1xx-AA : p/n 5413206 20ma current loop interface pcb for vt100 |
| 428 | * VT1xx-AB : p/n 5413097 AVO board (AVO roms could be optionally ordered along with | |
| 428 | * VT1xx-AB : p/n 5413097 AVO board (AVO roms could be optionally ordered along with | |
| 429 | 429 | this board if needed) |
| 430 | 430 | * VT1xx-AC : STP serial printer board (includes a special romset) |
| 431 | 431 | * VT1xx-CA : p/n 5413206? 20ma current loop interface pcb for vt101/vt102/vt131 |
| 432 | 432 | * VT1xx-CB or CL: GPO "ReGIS" board vt100->vt125 upgrade kit (p/n 5414275 paddle board and 5414277 gpo board) |
| 433 | ||
| 433 | ||
| 434 | 434 | * Info about mask roms and other nasties: |
| 435 | 435 | * A normal 2716 rom has pin 18: /CE; pin 20: /OE; pin 21: VPP (acts as CE2) |
| 436 | 436 | * The vt100 23-031e2/23-061e2, 23-032e2, 23-033e2, and 23-034e2 mask roms |
| r5932 | r5933 | |
| 451 | 451 | 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. |
| 452 | 452 | * The optional AVO character set roms (see below) have: pin 18: /CS2*; pin 20: /CS1; pin 21: CS3 hence they match a normal 2716 |
| 453 | 453 | *(this is marked on the image as if it was CS2 but the input is tied to gnd meaning it must be /CS2) |
| 454 | ||
| 455 | * The AVO itself can hold up to four character set roms on it (see http://www.bitsavers.org/pdf/dec/terminal/vt100/MP00633_VT100_Mar80.pdf | |
| 454 | ||
| 455 | * The AVO itself can hold up to four character set roms on it (see http://www.bitsavers.org/pdf/dec/terminal/vt100/MP00633_VT100_Mar80.pdf | |
| 456 | 456 | and http://vt100.net/dec/ek-vt1ac-ug-002.pdf ) |
| 457 | 457 | at least eight of these AVO roms were made, and are used as such: |
| 458 | 458 | * No roms - normal vt100 system with AVO installed |
| r5932 | r5933 | |
| 487 | 487 | // 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) |
| 488 | 488 | // NOTE: according to dunnington's ROMList, this is actually the VT132 romset, but I'm not convinced. |
| 489 | 489 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 490 | ROM_LOAD( "23-180e2-00.e56", 0x0000, 0x0800, NO_DUMP) | |
| 491 | ROM_LOAD( "23-181e2-00.e52", 0x0800, 0x0800, NO_DUMP) | |
| 492 | ROM_LOAD( "23-182e2-00.e45", 0x1000, 0x0800, NO_DUMP) | |
| 493 | ROM_LOAD( "23-183e2-00.e40", 0x1800, 0x0800, NO_DUMP) | |
| 490 | ROM_LOAD( "23-180e2-00.e56", 0x0000, 0x0800, NO_DUMP) | |
| 491 | ROM_LOAD( "23-181e2-00.e52", 0x0800, 0x0800, NO_DUMP) | |
| 492 | ROM_LOAD( "23-182e2-00.e45", 0x1000, 0x0800, NO_DUMP) | |
| 493 | ROM_LOAD( "23-183e2-00.e40", 0x1800, 0x0800, NO_DUMP) | |
| 494 | 494 | |
| 495 | 495 | ROM_REGION(0x1000, "gfx1", 0) |
| 496 | 496 | ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, BAD_DUMP CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) // probably correct but needs redump |
| r5932 | r5933 | |
| 499 | 499 | |
| 500 | 500 | /* |
| 501 | 501 | 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 |
| 502 | // This is the standard vt100 cpu board, but with the rom set included with the VT1xx-AC kit | |
| 502 | // This is the standard vt100 cpu board, but with the rom set included with the VT1xx-AC kit | |
| 503 | 503 | // which is only used when the STP 'printer port expansion' card is installed into the terminal board. |
| 504 | 504 | // This romset adds the Set-up C page to the setup menu (press keypad 5 twice once you hit set-up) |
| 505 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) | |
| 506 | ROM_LOAD( "23-095e2-00.e56", 0x0000, 0x0800, NO_DUMP) | |
| 507 | ROM_LOAD( "23-096e2-00.e52", 0x0800, 0x0800, NO_DUMP) | |
| 508 | ROM_LOAD( "23-139e2-00.e45", 0x1000, 0x0800, NO_DUMP) // revision 2?; revision 1 is 23-097e2 | |
| 509 | ROM_LOAD( "23-140e2-00.e40", 0x1800, 0x0800, NO_DUMP) // revision 2?; revision 1 is 23-098e2 | |
| 510 | ROM_REGION(0x1000, "gfx1",0) | |
| 511 | ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, BAD_DUMP CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) // probably correct but needs redump | |
| 512 | ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional ?word processing? alternate character set rom | |
| 513 | ROM_REGION(0x10000, "stpcpu",ROMREGION_ERASEFF) | |
| 505 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) | |
| 506 | ROM_LOAD( "23-095e2-00.e56", 0x0000, 0x0800, NO_DUMP) | |
| 507 | ROM_LOAD( "23-096e2-00.e52", 0x0800, 0x0800, NO_DUMP) | |
| 508 | ROM_LOAD( "23-139e2-00.e45", 0x1000, 0x0800, NO_DUMP) // revision 2?; revision 1 is 23-097e2 | |
| 509 | ROM_LOAD( "23-140e2-00.e40", 0x1800, 0x0800, NO_DUMP) // revision 2?; revision 1 is 23-098e2 | |
| 510 | ROM_REGION(0x1000, "gfx1",0) | |
| 511 | ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, BAD_DUMP CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) // probably correct but needs redump | |
| 512 | ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional ?word processing? alternate character set rom | |
| 513 | ROM_REGION(0x10000, "stpcpu",ROMREGION_ERASEFF) | |
| 514 | 514 | // 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. |
| 515 | 515 | // 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. |
| 516 | 516 | // 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. |
| 517 | ROM_LOAD( "23-003e3-00.e10", 0x0000, 0x1000, NO_DUMP) // "EPROM 0" bank 0 | |
| 518 | ROM_LOAD( "23-004e3-00.e4", 0x1000, 0x1000, NO_DUMP) // "EPROM 1" bank 0 | |
| 519 | ROM_LOAD( "23-005e3-00.e9", 0x2000, 0x1000, NO_DUMP) // "EPROM 2" bank 1 | |
| 520 | ROM_LOAD( "23-006e3-00.e3", 0x3000, 0x1000, NO_DUMP) // "EPROM 3" bank 1 | |
| 521 | //ROM_REGION(0x0800, "gfx1",0) | |
| 522 | //ROM_LOAD( "23-???e2-00.e34", 0x0000, 0x0800, NO_DUMP) // ? second gfx rom? | |
| 523 | ROM_REGION(0x0400, "proms",0) | |
| 524 | ROM_LOAD( "23-312a1-07.e26", 0x0000, 0x0200, NO_DUMP) // "PROM A"; handles 8085 i/o? mapping (usart, timer, dma, comm, etc) | |
| 525 | 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 | |
| 517 | ROM_LOAD( "23-003e3-00.e10", 0x0000, 0x1000, NO_DUMP) // "EPROM 0" bank 0 | |
| 518 | ROM_LOAD( "23-004e3-00.e4", 0x1000, 0x1000, NO_DUMP) // "EPROM 1" bank 0 | |
| 519 | ROM_LOAD( "23-005e3-00.e9", 0x2000, 0x1000, NO_DUMP) // "EPROM 2" bank 1 | |
| 520 | ROM_LOAD( "23-006e3-00.e3", 0x3000, 0x1000, NO_DUMP) // "EPROM 3" bank 1 | |
| 521 | //ROM_REGION(0x0800, "gfx1",0) | |
| 522 | //ROM_LOAD( "23-???e2-00.e34", 0x0000, 0x0800, NO_DUMP) // ? second gfx rom? | |
| 523 | ROM_REGION(0x0400, "proms",0) | |
| 524 | ROM_LOAD( "23-312a1-07.e26", 0x0000, 0x0200, NO_DUMP) // "PROM A"; handles 8085 i/o? mapping (usart, timer, dma, comm, etc) | |
| 525 | 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 | |
| 526 | 526 | ROM_END |
| 527 | 527 | */ |
| 528 | 528 | |
| 529 | 529 | ROM_START( vt103 ) // This is from the schematics at http://www.bitsavers.org/pdf/dec/terminal/vt103/MP00731_VT103_Aug80.pdf |
| 530 | 530 | // This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with an |
| 531 | // LSI-11 backplane (instead of a normal VT100 one, hence it cannot use the AVO, WG, GPO, or VT180 Z80 boards) and | |
| 531 | // LSI-11 backplane (instead of a normal VT100 one, hence it cannot use the AVO, WG, GPO, or VT180 Z80 boards) and | |
| 532 | 532 | // DEC TU58 dual 256k tape drive integrated; It was intended that you would put an LSI-11 cpu card in there, which |
| 533 | 533 | // Would talk to the terminal as its input/output device. Several LSI-11 cpu cards were available? |
| 534 | 534 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| r5932 | r5933 | |
| 563 | 563 | ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom |
| 564 | 564 | ROM_END |
| 565 | 565 | |
| 566 | ROM_START( vt110 ) | |
| 566 | ROM_START( vt110 ) | |
| 567 | 567 | // This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a |
| 568 | 568 | // DECDataway DPM01 board, which adds 4 or 5 special network-addressable 50ohm? current loop serial lines |
| 569 | 569 | // and may add its own processor and ram to control them. see http://bitsavers.org/pdf/dec/terminal/EK-VT110_UG-001_Dec78.pdf |
| r5932 | r5933 | |
| 600 | 600 | // does not have integrated STP or AVO populated |
| 601 | 601 | // 8085 based instead of 8080 |
| 602 | 602 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 603 | ROM_LOAD( "23-???e4-00.e69", 0x0000, 0x2000, NO_DUMP) | |
| 603 | ROM_LOAD( "23-???e4-00.e69", 0x0000, 0x2000, NO_DUMP) | |
| 604 | 604 | ROM_LOAD( "23-???e4-00.e71", 0x2000, 0x2000, NO_DUMP) |
| 605 | 605 | |
| 606 | 606 | ROM_REGION(0x1000, "gfx1", 0) |
| r5932 | r5933 | |
| 639 | 639 | ROM_START( vt132 ) // This is from anecdotal evidence and vt100.net, as the vt132 schematics are not scanned |
| 640 | 640 | // VT100 board with ? roms, AVO, STP, custom firmware with block serial mode; dunnington insists these roms |
| 641 | 641 | // should be the 23-180e2/181e2/182e2/183e2 set, but I'm not convinced. |
| 642 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) | |
| 643 | ROM_LOAD( "23-???e2-00.e56", 0x0000, 0x0800, NO_DUMP) | |
| 644 | ROM_LOAD( "23-???e2-00.e52", 0x0800, 0x0800, NO_DUMP) | |
| 645 | ROM_LOAD( "23-???e2-00.e45", 0x1000, 0x0800, NO_DUMP) | |
| 646 | ROM_LOAD( "23-???e2-00.e40", 0x1800, 0x0800, NO_DUMP) | |
| 642 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) | |
| 643 | ROM_LOAD( "23-???e2-00.e56", 0x0000, 0x0800, NO_DUMP) | |
| 644 | ROM_LOAD( "23-???e2-00.e52", 0x0800, 0x0800, NO_DUMP) | |
| 645 | ROM_LOAD( "23-???e2-00.e45", 0x1000, 0x0800, NO_DUMP) | |
| 646 | ROM_LOAD( "23-???e2-00.e40", 0x1800, 0x0800, NO_DUMP) | |
| 647 | 647 | |
| 648 | ROM_REGION(0x1000, "gfx1", 0) | |
| 649 | ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, BAD_DUMP CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) // probably correct but needs redump | |
| 650 | ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom | |
| 648 | ROM_REGION(0x1000, "gfx1", 0) | |
| 649 | ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, BAD_DUMP CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) // probably correct but needs redump | |
| 650 | ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom | |
| 651 | 651 | ROM_END |
| 652 | 652 | */ |
| 653 | ROM_START( vt180 ) | |
| 653 | ROM_START( vt180 ) | |
| 654 | 654 | // This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a |
| 655 | 655 | // Z80 daughterboard added to the expansion slot, and replacing the STP adapter (STP roms are replaced with the normal set) |
| 656 | 656 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| r5932 | r5933 | |
| 673 | 673 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 674 | 674 | COMP( 1978, vt100, 0, 0, vt100, vt100, 0, 0, "DEC", "VT100", GAME_NOT_WORKING) |
| 675 | 675 | COMP( 1978, vt100wp, vt100, 0, vt100, vt100, 0, 0, "DEC", "VT100-Wx", GAME_NOT_WORKING) |
| 676 | //COMP( 1978, vt100stp, vt100, 0, | |
| 676 | //COMP( 1978, vt100stp, vt100, 0, vt100, | |
| 677 | 677 | COMP( 1981, vt101, 0, 0, vt100, vt100, 0, 0, "DEC", "VT101", GAME_NOT_WORKING) |
| 678 | 678 | COMP( 1981, vt102, vt101, 0, vt100, vt100, 0, 0, "DEC", "VT102", GAME_NOT_WORKING) |
| 679 | 679 | COMP( 1979, vt103, vt100, 0, vt100, vt100, 0, 0, "DEC", "VT103", GAME_NOT_WORKING) |
| r5932 | r5933 | |
| 681 | 681 | COMP( 1978, vt110, vt100, 0, vt100, vt100, 0, 0, "DEC", "VT110", GAME_NOT_WORKING) |
| 682 | 682 | COMP( 1981, vt125, vt100, 0, vt100, vt100, 0, 0, "DEC", "VT125", GAME_NOT_WORKING) |
| 683 | 683 | COMP( 1981, vt131, /*vt101*/0, 0, vt100, vt100, 0, 0, "DEC", "VT131", GAME_NOT_WORKING) // this should be a vt101 clone, once the vt101 has been enabled (i.e. its roms dumped) |
| 684 | //COMP( 1979, vt132, vt100, 0, vt100, vt100, | |
| 684 | //COMP( 1979, vt132, vt100, 0, vt100, vt100, | |
| 685 | 685 | COMP( 1983, vt180, vt100, 0, vt100, vt100, 0, 0, "DEC", "VT180", GAME_NOT_WORKING) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | PROF-80 (Prozessor RAM-Floppy Kontroller) | |
| 4 | GRIP-1/2/3/4/5 (Grafik-Interface-Prozessor) | |
| 5 | UNIO-1 (?) | |
| 3 | PROF-80 (Prozessor RAM-Floppy Kontroller) | |
| 4 | GRIP-1/2/3/4/5 (Grafik-Interface-Prozessor) | |
| 5 | UNIO-1 (?) | |
| 6 | 6 | |
| 7 | http://www.prof80.de/ | |
| 8 | http://oldcomputers.dyndns.org/public/pub/rechner/conitec/info.html | |
| 7 | http://www.prof80.de/ | |
| 8 | http://oldcomputers.dyndns.org/public/pub/rechner/conitec/info.html | |
| 9 | 9 | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | 13 | |
| 14 | ||
| 14 | TODO: | |
| 15 | 15 | |
| 16 | - PROF<>GRIP interface fails if IBFA is cleared after reading PA | |
| 17 | - keyboard | |
| 18 | - NE555 timeout is 10x too high | |
| 19 | - GRIP does not send keys back to PROF-80 | |
| 20 | - grip31 does not work | |
| 21 | - PROF-80 RAM banking | |
| 22 | - PROF-80 floppy format | |
| 23 | - GRIP model selection | |
| 24 | - UNIO card (Z80-STI, Z80-SIO, 2x centronics) | |
| 25 | - GRIP-COLOR (192kB color RAM) | |
| 26 | - GRIP-5 (HD6345, 256KB RAM) | |
| 27 | - XR color card | |
| 28 | ||
| 16 | - PROF<>GRIP interface fails if IBFA is cleared after reading PA | |
| 17 | - keyboard | |
| 18 | - NE555 timeout is 10x too high | |
| 19 | - GRIP does not send keys back to PROF-80 | |
| 20 | - grip31 does not work | |
| 21 | - PROF-80 RAM banking | |
| 22 | - PROF-80 floppy format | |
| 23 | - GRIP model selection | |
| 24 | - UNIO card (Z80-STI, Z80-SIO, 2x centronics) | |
| 25 | - GRIP-COLOR (192kB color RAM) | |
| 26 | - GRIP-5 (HD6345, 256KB RAM) | |
| 27 | - XR color card | |
| 28 | ||
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | 31 | #include "driver.h" |
| r5932 | r5933 | |
| 123 | 123 | { |
| 124 | 124 | /* latch key data */ |
| 125 | 125 | keydata = ~prof80_keycodes[table][row][col]; |
| 126 | ||
| 126 | ||
| 127 | 127 | if (state->keydata != keydata) |
| 128 | 128 | { |
| 129 | 129 | state->keydata = keydata; |
| r5932 | r5933 | |
| 184 | 184 | default: |
| 185 | 185 | memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank + 1), SMH_UNMAP); |
| 186 | 186 | } |
| 187 | ||
| 187 | ||
| 188 | 188 | //logerror("Segment %u address %04x-%04x block %u\n", bank, start_addr, end_addr, block); |
| 189 | 189 | } |
| 190 | 190 | } |
| r5932 | r5933 | |
| 298 | 298 | { |
| 299 | 299 | /* |
| 300 | 300 | |
| 301 | ||
| 301 | bit description | |
| 302 | 302 | |
| 303 | 0 FB | |
| 304 | 1 SB0 | |
| 305 | 2 SB1 | |
| 306 | 3 SB2 | |
| 307 | 4 SA0 | |
| 308 | 5 SA1 | |
| 309 | 6 SA2 | |
| 310 | 7 FA | |
| 303 | 0 FB | |
| 304 | 1 SB0 | |
| 305 | 2 SB1 | |
| 306 | 3 SB2 | |
| 307 | 4 SA0 | |
| 308 | 5 SA1 | |
| 309 | 6 SA2 | |
| 310 | 7 FA | |
| 311 | 311 | |
| 312 | ||
| 312 | */ | |
| 313 | 313 | |
| 314 | 314 | int fa = BIT(data, 7); |
| 315 | 315 | int sa = (data >> 4) & 0x07; |
| r5932 | r5933 | |
| 324 | 324 | { |
| 325 | 325 | /* |
| 326 | 326 | |
| 327 | ||
| 327 | bit signal description | |
| 328 | 328 | |
| 329 | 0 _RX | |
| 330 | 1 | |
| 331 | 2 | |
| 332 | 3 | |
| 333 | 4 CTS | |
| 334 | 5 _INDEX | |
| 335 | 6 | |
| 336 | 7 CTSP | |
| 329 | 0 _RX | |
| 330 | 1 | |
| 331 | 2 | |
| 332 | 3 | |
| 333 | 4 CTS | |
| 334 | 5 _INDEX | |
| 335 | 6 | |
| 336 | 7 CTSP | |
| 337 | 337 | |
| 338 | ||
| 338 | */ | |
| 339 | 339 | |
| 340 | 340 | prof80_state *state = space->machine->driver_data; |
| 341 | 341 | |
| r5932 | r5933 | |
| 346 | 346 | { |
| 347 | 347 | /* |
| 348 | 348 | |
| 349 | ||
| 349 | bit signal description | |
| 350 | 350 | |
| 351 | 0 _MOTOR floppy motor (0=on, 1=off) | |
| 352 | 1 | |
| 353 | 2 | |
| 354 | 3 | |
| 355 | 4 JS4 | |
| 356 | 5 JS5 | |
| 357 | 6 | |
| 358 | 7 _TDO | |
| 351 | 0 _MOTOR floppy motor (0=on, 1=off) | |
| 352 | 1 | |
| 353 | 2 | |
| 354 | 3 | |
| 355 | 4 JS4 | |
| 356 | 5 JS5 | |
| 357 | 6 | |
| 358 | 7 _TDO | |
| 359 | 359 | |
| 360 | ||
| 360 | */ | |
| 361 | 361 | |
| 362 | 362 | prof80_state *state = space->machine->driver_data; |
| 363 | 363 | |
| r5932 | r5933 | |
| 428 | 428 | { |
| 429 | 429 | /* |
| 430 | 430 | |
| 431 | ||
| 431 | bit signal description | |
| 432 | 432 | |
| 433 | 0 LPA0 | |
| 434 | 1 LPA1 | |
| 435 | 2 LPA2 | |
| 436 | 3 SENSE | |
| 437 | 4 JS0 | |
| 438 | 5 JS1 | |
| 439 | 6 _ERROR | |
| 440 | 7 LPSTB light pen strobe | |
| 433 | 0 LPA0 | |
| 434 | 1 LPA1 | |
| 435 | 2 LPA2 | |
| 436 | 3 SENSE | |
| 437 | 4 JS0 | |
| 438 | 5 JS1 | |
| 439 | 6 _ERROR | |
| 440 | 7 LPSTB light pen strobe | |
| 441 | 441 | |
| 442 | ||
| 442 | */ | |
| 443 | 443 | |
| 444 | 444 | prof80_state *state = space->machine->driver_data; |
| 445 | 445 | |
| r5932 | r5933 | |
| 484 | 484 | |
| 485 | 485 | static WRITE8_HANDLER( unio_ctrl_w ) |
| 486 | 486 | { |
| 487 | // | |
| 487 | // prof80_state *state = space->machine->driver_data; | |
| 488 | 488 | |
| 489 | // | |
| 489 | // int flag = BIT(data, 0); | |
| 490 | 490 | int flad = (data >> 1) & 0x07; |
| 491 | 491 | |
| 492 | 492 | switch (flad) |
| r5932 | r5933 | |
| 525 | 525 | ADDRESS_MAP_END |
| 526 | 526 | |
| 527 | 527 | static ADDRESS_MAP_START( prof80_io, ADDRESS_SPACE_IO, 8 ) |
| 528 | // AM_RANGE(0x80, 0x8f) AM_MIRROR(0xff00) AM_DEVREADWRITE(UNIO_Z80STI_TAG, z80sti_r, z80sti_w) | |
| 529 | // AM_RANGE(0x94, 0x95) AM_MIRROR(0xff00) AM_DEVREADWRITE(UNIO_Z80SIO_TAG, z80sio_d_r, z80sio_d_w) | |
| 530 | // AM_RANGE(0x96, 0x97) AM_MIRROR(0xff00) AM_DEVREADWRITE(UNIO_Z80SIO_TAG, z80sio_c_r, z80sio_c_w) | |
| 528 | // AM_RANGE(0x80, 0x8f) AM_MIRROR(0xff00) AM_DEVREADWRITE(UNIO_Z80STI_TAG, z80sti_r, z80sti_w) | |
| 529 | // AM_RANGE(0x94, 0x95) AM_MIRROR(0xff00) AM_DEVREADWRITE(UNIO_Z80SIO_TAG, z80sio_d_r, z80sio_d_w) | |
| 530 | // AM_RANGE(0x96, 0x97) AM_MIRROR(0xff00) AM_DEVREADWRITE(UNIO_Z80SIO_TAG, z80sio_c_r, z80sio_c_w) | |
| 531 | 531 | AM_RANGE(0x9e, 0x9e) AM_MIRROR(0xff00) AM_WRITE(unio_ctrl_w) |
| 532 | // AM_RANGE(0x9c, 0x9c) AM_MIRROR(0xff00) AM_DEVWRITE(UNIO_CENTRONICS1_TAG, centronics_data_w) | |
| 533 | // AM_RANGE(0x9d, 0x9d) AM_MIRROR(0xff00) AM_DEVWRITE(UNIO_CENTRONICS1_TAG, centronics_data_w) | |
| 532 | // AM_RANGE(0x9c, 0x9c) AM_MIRROR(0xff00) AM_DEVWRITE(UNIO_CENTRONICS1_TAG, centronics_data_w) | |
| 533 | // AM_RANGE(0x9d, 0x9d) AM_MIRROR(0xff00) AM_DEVWRITE(UNIO_CENTRONICS1_TAG, centronics_data_w) | |
| 534 | 534 | AM_RANGE(0xc0, 0xc0) AM_MIRROR(0xff00) AM_READ(gripc_r) |
| 535 | 535 | AM_RANGE(0xc1, 0xc1) AM_MIRROR(0xff00) AM_READWRITE(gripd_r, gripd_w) |
| 536 | 536 | AM_RANGE(0xd8, 0xd8) AM_MIRROR(0xff00) AM_WRITE(flr_w) |
| r5932 | r5933 | |
| 550 | 550 | static ADDRESS_MAP_START( grip_io, ADDRESS_SPACE_IO, 8 ) |
| 551 | 551 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 552 | 552 | AM_RANGE(0x00, 0x00) AM_READWRITE(cxstb_r, cxstb_w) |
| 553 | // AM_RANGE(0x10, 0x10) AM_WRITE(ccon_w) | |
| 554 | // AM_RANGE(0x11, 0x11) AM_WRITE(vol0_w) | |
| 555 | // AM_RANGE(0x12, 0x12) AM_WRITE(rts_w) | |
| 553 | // AM_RANGE(0x10, 0x10) AM_WRITE(ccon_w) | |
| 554 | // AM_RANGE(0x11, 0x11) AM_WRITE(vol0_w) | |
| 555 | // AM_RANGE(0x12, 0x12) AM_WRITE(rts_w) | |
| 556 | 556 | AM_RANGE(0x13, 0x13) AM_WRITE(page_w) |
| 557 | // AM_RANGE(0x14, 0x14) AM_WRITE(cc1_w) | |
| 558 | // AM_RANGE(0x15, 0x15) AM_WRITE(cc2_w) | |
| 557 | // AM_RANGE(0x14, 0x14) AM_WRITE(cc1_w) | |
| 558 | // AM_RANGE(0x15, 0x15) AM_WRITE(cc2_w) | |
| 559 | 559 | AM_RANGE(0x16, 0x16) AM_WRITE(flash_w) |
| 560 | // | |
| 560 | // AM_RANGE(0x17, 0x17) AM_WRITE(vol1_w) | |
| 561 | 561 | AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE(Z80STI_TAG, z80sti_r, z80sti_w) |
| 562 | 562 | AM_RANGE(0x30, 0x30) AM_READWRITE(lrs_r, lrs_w) |
| 563 | 563 | AM_RANGE(0x40, 0x40) AM_READ(stat_r) |
| r5932 | r5933 | |
| 566 | 566 | AM_RANGE(0x53, 0x53) AM_DEVREAD(MC6845_TAG, mc6845_register_r) |
| 567 | 567 | AM_RANGE(0x60, 0x60) AM_DEVWRITE("centronics", centronics_data_w) |
| 568 | 568 | AM_RANGE(0x70, 0x73) AM_DEVREADWRITE(I8255A_TAG, i8255a_r, i8255a_w) |
| 569 | // AM_RANGE(0x80, 0x80) AM_WRITE(bl2out_w) | |
| 570 | // AM_RANGE(0x90, 0x90) AM_WRITE(gr2out_w) | |
| 571 | // AM_RANGE(0xa0, 0xa0) AM_WRITE(rd2out_w) | |
| 572 | // AM_RANGE(0xb0, 0xb0) AM_WRITE(clrg2_w) | |
| 573 | // AM_RANGE(0xc0, 0xc0) AM_WRITE(bluout_w) | |
| 574 | // AM_RANGE(0xd0, 0xd0) AM_WRITE(grnout_w) | |
| 575 | // AM_RANGE(0xe0, 0xe0) AM_WRITE(redout_w) | |
| 576 | // AM_RANGE(0xf0, 0xf0) AM_WRITE(clrg1_w) | |
| 569 | // AM_RANGE(0x80, 0x80) AM_WRITE(bl2out_w) | |
| 570 | // AM_RANGE(0x90, 0x90) AM_WRITE(gr2out_w) | |
| 571 | // AM_RANGE(0xa0, 0xa0) AM_WRITE(rd2out_w) | |
| 572 | // AM_RANGE(0xb0, 0xb0) AM_WRITE(clrg2_w) | |
| 573 | // AM_RANGE(0xc0, 0xc0) AM_WRITE(bluout_w) | |
| 574 | // AM_RANGE(0xd0, 0xd0) AM_WRITE(grnout_w) | |
| 575 | // AM_RANGE(0xe0, 0xe0) AM_WRITE(redout_w) | |
| 576 | // AM_RANGE(0xf0, 0xf0) AM_WRITE(clrg1_w) | |
| 577 | 577 | ADDRESS_MAP_END |
| 578 | 578 | |
| 579 | 579 | static ADDRESS_MAP_START( grip5_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| r5932 | r5933 | |
| 585 | 585 | static ADDRESS_MAP_START( grip5_io, ADDRESS_SPACE_IO, 8 ) |
| 586 | 586 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 587 | 587 | AM_RANGE(0x00, 0x00) AM_READWRITE(cxstb_r, cxstb_w) |
| 588 | // AM_RANGE(0x10, 0x10) AM_WRITE(eprom_w) | |
| 589 | // AM_RANGE(0x11, 0x11) AM_WRITE(vol0_w) | |
| 590 | // AM_RANGE(0x12, 0x12) AM_WRITE(rts_w) | |
| 588 | // AM_RANGE(0x10, 0x10) AM_WRITE(eprom_w) | |
| 589 | // AM_RANGE(0x11, 0x11) AM_WRITE(vol0_w) | |
| 590 | // AM_RANGE(0x12, 0x12) AM_WRITE(rts_w) | |
| 591 | 591 | AM_RANGE(0x13, 0x13) AM_WRITE(page_w) |
| 592 | // AM_RANGE(0x14, 0x14) AM_WRITE(str_w) | |
| 593 | // AM_RANGE(0x15, 0x15) AM_WRITE(intl_w) | |
| 594 | // AM_RANGE(0x16, 0x16) AM_WRITE(dpage_w) | |
| 595 | // AM_RANGE(0x17, 0x17) AM_WRITE(vol1_w) | |
| 592 | // AM_RANGE(0x14, 0x14) AM_WRITE(str_w) | |
| 593 | // AM_RANGE(0x15, 0x15) AM_WRITE(intl_w) | |
| 594 | // AM_RANGE(0x16, 0x16) AM_WRITE(dpage_w) | |
| 595 | // AM_RANGE(0x17, 0x17) AM_WRITE(vol1_w) | |
| 596 | 596 | AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE(Z80STI_TAG, z80sti_r, z80sti_w) |
| 597 | 597 | AM_RANGE(0x30, 0x30) AM_READWRITE(lrs_r, lrs_w) |
| 598 | 598 | AM_RANGE(0x40, 0x40) AM_READ(stat_r) |
| r5932 | r5933 | |
| 602 | 602 | AM_RANGE(0x60, 0x60) AM_DEVWRITE("centronics", centronics_data_w) |
| 603 | 603 | AM_RANGE(0x70, 0x73) AM_DEVREADWRITE(I8255A_TAG, i8255a_r, i8255a_w) |
| 604 | 604 | |
| 605 | // AM_RANGE(0x80, 0x80) AM_WRITE(xrflgs_w) | |
| 606 | // AM_RANGE(0xc0, 0xc0) AM_WRITE(xrclrg_w) | |
| 607 | // AM_RANGE(0xe0, 0xe0) AM_WRITE(xrclu0_w) | |
| 608 | // AM_RANGE(0xe1, 0xe1) AM_WRITE(xrclu1_w) | |
| 609 | // AM_RANGE(0xe2, 0xe2) AM_WRITE(xrclu2_w) | |
| 605 | // AM_RANGE(0x80, 0x80) AM_WRITE(xrflgs_w) | |
| 606 | // AM_RANGE(0xc0, 0xc0) AM_WRITE(xrclrg_w) | |
| 607 | // AM_RANGE(0xe0, 0xe0) AM_WRITE(xrclu0_w) | |
| 608 | // AM_RANGE(0xe1, 0xe1) AM_WRITE(xrclu1_w) | |
| 609 | // AM_RANGE(0xe2, 0xe2) AM_WRITE(xrclu2_w) | |
| 610 | 610 | |
| 611 | // AM_RANGE(0x80, 0x80) AM_WRITE(bl2out_w) | |
| 612 | // AM_RANGE(0x90, 0x90) AM_WRITE(gr2out_w) | |
| 613 | // AM_RANGE(0xa0, 0xa0) AM_WRITE(rd2out_w) | |
| 614 | // AM_RANGE(0xb0, 0xb0) AM_WRITE(clrg2_w) | |
| 615 | // AM_RANGE(0xc0, 0xc0) AM_WRITE(bluout_w) | |
| 616 | // AM_RANGE(0xd0, 0xd0) AM_WRITE(grnout_w) | |
| 617 | // AM_RANGE(0xe0, 0xe0) AM_WRITE(redout_w) | |
| 618 | // AM_RANGE(0xf0, 0xf0) AM_WRITE(clrg1_w) | |
| 611 | // AM_RANGE(0x80, 0x80) AM_WRITE(bl2out_w) | |
| 612 | // AM_RANGE(0x90, 0x90) AM_WRITE(gr2out_w) | |
| 613 | // AM_RANGE(0xa0, 0xa0) AM_WRITE(rd2out_w) | |
| 614 | // AM_RANGE(0xb0, 0xb0) AM_WRITE(clrg2_w) | |
| 615 | // AM_RANGE(0xc0, 0xc0) AM_WRITE(bluout_w) | |
| 616 | // AM_RANGE(0xd0, 0xd0) AM_WRITE(grnout_w) | |
| 617 | // AM_RANGE(0xe0, 0xe0) AM_WRITE(redout_w) | |
| 618 | // AM_RANGE(0xf0, 0xf0) AM_WRITE(clrg1_w) | |
| 619 | 619 | ADDRESS_MAP_END |
| 620 | 620 | |
| 621 | 621 | /* Input Ports */ |
| r5932 | r5933 | |
| 650 | 650 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 651 | 651 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 652 | 652 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 653 | ||
| 653 | ||
| 654 | 654 | PORT_START("ROW3") |
| 655 | 655 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 656 | 656 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| r5932 | r5933 | |
| 660 | 660 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 661 | 661 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 662 | 662 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 663 | ||
| 663 | ||
| 664 | 664 | PORT_START("ROW4") |
| 665 | 665 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 666 | 666 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) |
| r5932 | r5933 | |
| 670 | 670 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 671 | 671 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 672 | 672 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 673 | ||
| 673 | ||
| 674 | 674 | PORT_START("ROW5") |
| 675 | 675 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 676 | 676 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| r5932 | r5933 | |
| 680 | 680 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 681 | 681 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 682 | 682 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 683 | ||
| 683 | ||
| 684 | 684 | PORT_START("ROW6") |
| 685 | 685 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') |
| 686 | 686 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) |
| r5932 | r5933 | |
| 690 | 690 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) |
| 691 | 691 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 692 | 692 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 693 | ||
| 693 | ||
| 694 | 694 | PORT_START("ROW7") |
| 695 | 695 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 696 | 696 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| r5932 | r5933 | |
| 700 | 700 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 701 | 701 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 702 | 702 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 703 | ||
| 703 | ||
| 704 | 704 | PORT_START("ROW8") |
| 705 | 705 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 706 | 706 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| r5932 | r5933 | |
| 708 | 708 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) |
| 709 | 709 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK) |
| 710 | 710 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 711 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 712 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 711 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 712 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 713 | 713 | |
| 714 | 714 | PORT_START("ROW9") |
| 715 | 715 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| r5932 | r5933 | |
| 881 | 881 | z80sti_i2_w(driver_state->z80sti, state); |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | static const mc6845_interface grip_mc6845_interface = | |
| 884 | static const mc6845_interface grip_mc6845_interface = | |
| 885 | 885 | { |
| 886 | 886 | SCREEN_TAG, |
| 887 | 887 | 8, |
| r5932 | r5933 | |
| 947 | 947 | { |
| 948 | 948 | /* |
| 949 | 949 | |
| 950 | bit | |
| 950 | bit description | |
| 951 | 951 | |
| 952 | 952 | PA0 ECB bus |
| 953 | 953 | PA1 ECB bus |
| r5932 | r5933 | |
| 957 | 957 | PA5 ECB bus |
| 958 | 958 | PA6 ECB bus |
| 959 | 959 | PA7 ECB bus |
| 960 | ||
| 961 | */ | |
| 962 | 960 | |
| 961 | */ | |
| 962 | ||
| 963 | 963 | prof80_state *state = device->machine->driver_data; |
| 964 | 964 | |
| 965 | 965 | return state->gripd; |
| r5932 | r5933 | |
| 969 | 969 | { |
| 970 | 970 | /* |
| 971 | 971 | |
| 972 | bit | |
| 972 | bit description | |
| 973 | 973 | |
| 974 | 974 | PA0 ECB bus |
| 975 | 975 | PA1 ECB bus |
| r5932 | r5933 | |
| 979 | 979 | PA5 ECB bus |
| 980 | 980 | PA6 ECB bus |
| 981 | 981 | PA7 ECB bus |
| 982 | ||
| 983 | */ | |
| 984 | 982 | |
| 983 | */ | |
| 984 | ||
| 985 | 985 | prof80_state *state = device->machine->driver_data; |
| 986 | 986 | |
| 987 | 987 | state->gripd = data; |
| r5932 | r5933 | |
| 991 | 991 | { |
| 992 | 992 | /* |
| 993 | 993 | |
| 994 | bit | |
| 994 | bit description | |
| 995 | 995 | |
| 996 | 996 | PB0 Keyboard input |
| 997 | 997 | PB1 Keyboard input |
| r5932 | r5933 | |
| 1001 | 1001 | PB5 Keyboard input |
| 1002 | 1002 | PB6 Keyboard input |
| 1003 | 1003 | PB7 Keyboard input |
| 1004 | ||
| 1005 | */ | |
| 1006 | 1004 | |
| 1005 | */ | |
| 1006 | ||
| 1007 | 1007 | prof80_state *state = device->machine->driver_data; |
| 1008 | 1008 | |
| 1009 | 1009 | return state->keydata; |
| r5932 | r5933 | |
| 1013 | 1013 | { |
| 1014 | 1014 | /* |
| 1015 | 1015 | |
| 1016 | bit | |
| 1016 | bit signal description | |
| 1017 | 1017 | |
| 1018 | PC0 INTRB interrupt B output (keyboard) | |
| 1019 | PC1 KBF input buffer B full output (keyboard) | |
| 1020 | PC2 _KBSTB strobe B input (keyboard) | |
| 1021 | PC3 INTRA interrupt A output (PROF-80) | |
| 1022 | PC4 _STBA strobe A input (PROF-80) | |
| 1023 | PC5 IBFA input buffer A full output (PROF-80) | |
| 1024 | PC6 _ACKA acknowledge A input (PROF-80) | |
| 1025 | PC7 _OBFA output buffer full output (PROF-80) | |
| 1026 | ||
| 1027 | */ | |
| 1018 | PC0 INTRB interrupt B output (keyboard) | |
| 1019 | PC1 KBF input buffer B full output (keyboard) | |
| 1020 | PC2 _KBSTB strobe B input (keyboard) | |
| 1021 | PC3 INTRA interrupt A output (PROF-80) | |
| 1022 | PC4 _STBA strobe A input (PROF-80) | |
| 1023 | PC5 IBFA input buffer A full output (PROF-80) | |
| 1024 | PC6 _ACKA acknowledge A input (PROF-80) | |
| 1025 | PC7 _OBFA output buffer full output (PROF-80) | |
| 1028 | 1026 | |
| 1027 | */ | |
| 1028 | ||
| 1029 | 1029 | prof80_state *state = device->machine->driver_data; |
| 1030 | 1030 | |
| 1031 | 1031 | /* keyboard interrupt */ |
| r5932 | r5933 | |
| 1057 | 1057 | { |
| 1058 | 1058 | /* |
| 1059 | 1059 | |
| 1060 | bit | |
| 1060 | bit signal description | |
| 1061 | 1061 | |
| 1062 | I0 CTS RS-232 clear to send input | |
| 1063 | I1 DE MC6845 display enable input | |
| 1064 | I2 CURSOR MC6845 cursor input | |
| 1065 | I3 BUSY Centronics busy input | |
| 1066 | I4 PC0 PPI8255 PC0 input | |
| 1067 | I5 SKBD Serial keyboard input | |
| 1068 | I6 EXIN External interrupt input | |
| 1069 | I7 PC3 PPI8255 PC3 input | |
| 1070 | ||
| 1071 | */ | |
| 1062 | I0 CTS RS-232 clear to send input | |
| 1063 | I1 DE MC6845 display enable input | |
| 1064 | I2 CURSOR MC6845 cursor input | |
| 1065 | I3 BUSY Centronics busy input | |
| 1066 | I4 PC0 PPI8255 PC0 input | |
| 1067 | I5 SKBD Serial keyboard input | |
| 1068 | I6 EXIN External interrupt input | |
| 1069 | I7 PC3 PPI8255 PC3 input | |
| 1072 | 1070 | |
| 1071 | */ | |
| 1072 | ||
| 1073 | 1073 | prof80_state *state = device->machine->driver_data; |
| 1074 | 1074 | |
| 1075 | 1075 | return centronics_busy_r(state->centronics) << 3; |
| r5932 | r5933 | |
| 1219 | 1219 | MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 479) |
| 1220 | 1220 | MDRV_PALETTE_LENGTH(2) |
| 1221 | 1221 | MDRV_PALETTE_INIT(black_and_white) |
| 1222 | ||
| 1222 | ||
| 1223 | 1223 | MDRV_VIDEO_START(prof80) |
| 1224 | 1224 | MDRV_VIDEO_UPDATE(prof80) |
| 1225 | 1225 | |
| r5932 | r5933 | |
| 1233 | 1233 | |
| 1234 | 1234 | /* printer */ |
| 1235 | 1235 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 1236 | ||
| 1236 | ||
| 1237 | 1237 | MDRV_FLOPPY_4_DRIVES_ADD(prof80_floppy_config) |
| 1238 | 1238 | MACHINE_DRIVER_END |
| 1239 | 1239 | |
| r5932 | r5933 | |
| 1242 | 1242 | ROM_START( prof80 ) |
| 1243 | 1243 | ROM_REGION( 0x100000, Z80_TAG, 0 ) |
| 1244 | 1244 | ROM_DEFAULT_BIOS( "v17" ) |
| 1245 | ||
| 1245 | ||
| 1246 | 1246 | ROM_SYSTEM_BIOS( 0, "v15", "v1.5" ) |
| 1247 | 1247 | ROMX_LOAD( "prof80v15.z7", 0xf0000, 0x02000, CRC(8f74134c) SHA1(83f9dcdbbe1a2f50006b41d406364f4d580daa1f), ROM_BIOS(1) ) |
| 1248 | 1248 | ROM_SYSTEM_BIOS( 1, "v16", "v1.6" ) |
| r5932 | r5933 | |
|---|---|---|
| 208 | 208 | /* via */ |
| 209 | 209 | MDRV_DEVICE_REMOVE("via6522_0") |
| 210 | 210 | MDRV_VIA6522_ADD("via6522_0", 0, spectrum1_via6522_interface) |
| 211 | ||
| 211 | ||
| 212 | 212 | MDRV_DEVICE_REMOVE("cart") |
| 213 | 213 | MACHINE_DRIVER_END |
| 214 | 214 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Epson HX20 |
| 4 | 4 | |
| 5 | 5 | 29/09/2009 Skeleton driver. |
| r5932 | r5933 | |
| 10 | 10 | #include "cpu/m6800/m6800.h" |
| 11 | 11 | |
| 12 | 12 | static ADDRESS_MAP_START(ehx20_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 13 | AM_RANGE(0x0000, 0x0fff) AM_RAM // I/O | |
| 13 | AM_RANGE(0x0000, 0x0fff) AM_RAM // I/O | |
| 14 | 14 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 15 | 15 | ADDRESS_MAP_END |
| 16 | 16 | |
| r5932 | r5933 | |
| 19 | 19 | INPUT_PORTS_END |
| 20 | 20 | |
| 21 | 21 | |
| 22 | static MACHINE_RESET(ehx20) | |
| 23 | { | |
| 22 | static MACHINE_RESET(ehx20) | |
| 23 | { | |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | static VIDEO_START( ehx20 ) |
| r5932 | r5933 | |
| 38 | 38 | MDRV_CPU_PROGRAM_MAP(ehx20_mem) |
| 39 | 39 | |
| 40 | 40 | MDRV_MACHINE_RESET(ehx20) |
| 41 | ||
| 41 | ||
| 42 | 42 | /* video hardware */ |
| 43 | 43 | MDRV_SCREEN_ADD("screen", RASTER) |
| 44 | 44 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
|---|---|---|
| 10 | 10 | GD-ROM drive (modified ATAPI interface) |
| 11 | 11 | |
| 12 | 12 | NTSC/N NTSC/I PAL/N PAL/I VGA |
| 13 | ||
| 13 | (x/240) (x/480) (x/240) (x/480) (640x480) | |
| 14 | 14 | VTOTAL 262 524 312 624 524 |
| 15 | 15 | HTOTAL 857 857 863 863 857 |
| 16 | 16 | |
| r5932 | r5933 | |
| 216 | 216 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 217 | 217 | |
| 218 | 218 | MDRV_PALETTE_LENGTH(0x1000) |
| 219 | ||
| 219 | ||
| 220 | 220 | MDRV_VIDEO_START(dc) |
| 221 | 221 | MDRV_VIDEO_UPDATE(dc) |
| 222 | 222 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | drivers/lisa.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Experimental LISA driver | |
| 6 | 6 | |
| 7 | 7 | Raphael Nabet, 2000 |
| 8 | 8 | |
| r5932 | r5933 | |
| 86 | 86 | /* |
| 87 | 87 | static void lisa_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 88 | 88 | { |
| 89 | switch(state) | |
| 90 | { | |
| 91 | case MESS_DEVINFO_INT_SONYDRIV_ALLOWABLE_SIZES: info->i = SONY_FLOPPY_ALLOW400K | SONY_FLOPPY_ALLOW800K; break; | |
| 89 | switch(state) | |
| 90 | { | |
| 91 | case MESS_DEVINFO_INT_SONYDRIV_ALLOWABLE_SIZES: info->i = SONY_FLOPPY_ALLOW400K | SONY_FLOPPY_ALLOW800K; break; | |
| 92 | 92 | |
| 93 | default: sonydriv_device_getinfo(devclass, state, info); break; | |
| 94 | } | |
| 93 | default: sonydriv_device_getinfo(devclass, state, info); break; | |
| 94 | } | |
| 95 | 95 | } |
| 96 | 96 | */ |
| 97 | 97 | |
| r5932 | r5933 | |
| 143 | 143 | /* devices */ |
| 144 | 144 | MDRV_IWM_ADD("fdc", lisa2_fdc_interface) |
| 145 | 145 | MDRV_FLOPPY_SONY_2_DRIVES_ADD(lisa_floppy_config) |
| 146 | ||
| 146 | ||
| 147 | 147 | /* via */ |
| 148 | 148 | MDRV_VIA6522_ADD("via6522_0", 500000, lisa_via6522_0_intf) |
| 149 | 149 | MDRV_VIA6522_ADD("via6522_1", 500000, lisa_via6522_1_intf) |
| r5932 | r5933 | |
| 155 | 155 | MDRV_CPU_MODIFY( "fdccpu" ) |
| 156 | 156 | MDRV_CPU_PROGRAM_MAP(lisa210_fdc_map) |
| 157 | 157 | |
| 158 | /* Lisa 2/10 and MacXL had a slightly different FDC interface */ | |
| 158 | /* Lisa 2/10 and MacXL had a slightly different FDC interface */ | |
| 159 | 159 | MDRV_IWM_MODIFY("fdc", lisa210_fdc_interface) |
| 160 | 160 | |
| 161 | 161 | /* via */ |
| r5932 | r5933 | |
| 226 | 226 | /* European layout */ |
| 227 | 227 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~ `") PORT_CODE(KEYCODE_BACKSLASH2) |
| 228 | 228 | /* 2008-05 FP: Differences in European Layout (based on a couple of pictures found in the web): |
| 229 | - at KEYCODE_ESC, "` ~" is replaced by "¤ #" | |
| 230 | - Shift + 3 gives the pound symbol (\xC2\xA3) | |
| 231 | - There is no "\ |" key after "] }" | |
| 232 | - There is an additional key at 3rd row, 3rd key from 'L', and it's "` ~" | |
| 233 | - Between Left Shift and Z there is another key, but the image is not clear on that key | |
| 234 | */ | |
| 229 | - at KEYCODE_ESC, "` ~" is replaced by "? #" | |
| 230 | - Shift + 3 gives the pound symbol (\xC2\xA3) | |
| 231 | - There is no "\ |" key after "] }" | |
| 232 | - There is an additional key at 3rd row, 3rd key from 'L', and it's "` ~" | |
| 233 | - Between Left Shift and Z there is another key, but the image is not clear on that key | |
| 234 | */ | |
| 235 | 235 | #endif |
| 236 | 236 | PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 237 | 237 | PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| r5932 | r5933 | |
| 301 | 301 | INPUT_PORTS_END |
| 302 | 302 | |
| 303 | 303 | /* Note we're missing a whole bunch of lisa bootrom revisions; based on http://www.cs.dartmouth.edu/~woz/bootrom.pdf : |
| 304 | ||
| 304 | ?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. */ | |
| 305 | 305 | /* Based on http://www.cs.dartmouth.edu/~woz/bootrom.pdf and other information, at least the following systems existed: |
| 306 | * 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) | |
| 307 | * 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 | |
| 308 | * 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 | |
| 309 | * 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 | |
| 310 | * 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 | |
| 311 | */ | |
| 306 | * 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) | |
| 307 | * 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 | |
| 308 | * 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 | |
| 309 | * 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 | |
| 310 | * 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 | |
| 311 | */ | |
| 312 | 312 | /* 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.*/ |
| 313 | 313 | /* 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 |
| 314 | ||
| 314 | 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. */ | |
| 315 | 315 | /* which systems used the 341-0193-A parallel interface card rom? */ |
| 316 | 316 | |
| 317 | 317 | |
| 318 | 318 | ROM_START( lisa ) /* with twiggy drives, io40 i/o rom; technically any of the bootroms will work on this. */ |
| 319 | 319 | ROM_REGION16_BE(0x204000,"maincpu",0) /* 68k rom and ram */ |
| 320 | 320 | ROM_DEFAULT_BIOS( "revh" ) |
| 321 | ||
| 321 | ||
| 322 | 322 | ROM_SYSTEM_BIOS( 0, "revh", "LISA Bootrom Rev H (2/24/84)") |
| 323 | 323 | 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) */ |
| 324 | 324 | 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) */ |
| r5932 | r5933 | |
| 334 | 334 | ROM_SYSTEM_BIOS( 3, "reve", "LISA Bootrom Rev E (10/20/83)") |
| 335 | 335 | 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) */ |
| 336 | 336 | 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) */ |
| 337 | ||
| 337 | ||
| 338 | 338 | ROM_SYSTEM_BIOS( 4, "revd", "LISA Bootrom Rev D (5/12/83)") |
| 339 | 339 | 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) */ |
| 340 | 340 | 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) */ |
| r5932 | r5933 | |
| 387 | 387 | ROM_SYSTEM_BIOS( 4, "rev3b", "LISA Bootrom Rev 3B (9/8/83)") /* Earliest lisa2 rom, prototype. */ |
| 388 | 388 | 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) */ |
| 389 | 389 | 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) */ |
| 390 | ||
| 390 | ||
| 391 | 391 | ROM_REGION(0x2000,"fdccpu",0) /* 6504 RAM and ROM */ |
| 392 | 392 | 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 */ |
| 393 | 393 | |
| r5932 | r5933 | |
| 427 | 427 | ROM_REGION(0x4000,"widget", 0) /* Widget HDD controller */ |
| 428 | 428 | ROM_LOAD( "341-0288-a", 0x0000, 0x800, CRC(a26ef1c6) SHA1(5aaeb6ff7f7d4f7ce7c70402f75e82533635dda4)) /* 341-0288-A z8 mcu piggyback rom */ |
| 429 | 429 | ROM_LOAD( "341-0289-d", 0x2000, 0x2000, CRC(25e86e95) SHA1(72a346c2074d2256adde491b930023ebdcb5f51a)) /* 341-0289-D external rom on widget board */ |
| 430 | ||
| 430 | ||
| 431 | 431 | ROM_REGION(0x100,"gfx1", 0) /* video ROM (includes S/N) */ |
| 432 | 432 | ROM_LOAD( "vidstate.rom", 0x00, 0x100, CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d)) |
| 433 | 433 | ROM_END |
| r5932 | r5933 | |
|---|---|---|
| 3 | 3 | Mattel Aquarius |
| 4 | 4 | |
| 5 | 5 | |
| 6 | ||
| 6 | TODO: | |
| 7 | 7 | |
| 8 | - hand controllers | |
| 9 | - scramble RAM also | |
| 10 | - CAQ tape support | |
| 11 | - memory mapper | |
| 12 | - proper video timings | |
| 13 | - PAL mode | |
| 14 | - floppy support | |
| 15 | - modem | |
| 16 | - "old" version of BASIC ROM | |
| 17 | - Aquarius II | |
| 8 | - hand controllers | |
| 9 | - scramble RAM also | |
| 10 | - CAQ tape support | |
| 11 | - memory mapper | |
| 12 | - proper video timings | |
| 13 | - PAL mode | |
| 14 | - floppy support | |
| 15 | - modem | |
| 16 | - "old" version of BASIC ROM | |
| 17 | - Aquarius II | |
| 18 | 18 | |
| 19 | 19 | ***************************************************************************/ |
| 20 | 20 | |
| r5932 | r5933 | |
| 50 | 50 | ***************************************************************************/ |
| 51 | 51 | |
| 52 | 52 | /* |
| 53 | To read stored data from cassette the program should look at bit zero of | |
| 54 | the cassette input port and measure the time difference between leading | |
| 55 | edges or trailing edges. This is to prevent DC level shifting from altering | |
| 56 | pulse width of data. The program should then look for sync bytes for data | |
| 57 | synchronisation before data block transfer. If there is any task that must | |
| 58 | be performed during cassette loading, the maximum allowable time to do the | |
| 59 | job after one byte from cassette, must be less than 80% of the period of a | |
| 60 | mark cycle. Control must be returned at that time to the cassette routine | |
| 61 | in order to maintain data integrity. | |
| 53 | To read stored data from cassette the program should look at bit zero of | |
| 54 | the cassette input port and measure the time difference between leading | |
| 55 | edges or trailing edges. This is to prevent DC level shifting from altering | |
| 56 | pulse width of data. The program should then look for sync bytes for data | |
| 57 | synchronisation before data block transfer. If there is any task that must | |
| 58 | be performed during cassette loading, the maximum allowable time to do the | |
| 59 | job after one byte from cassette, must be less than 80% of the period of a | |
| 60 | mark cycle. Control must be returned at that time to the cassette routine | |
| 61 | in order to maintain data integrity. | |
| 62 | 62 | */ |
| 63 | 63 | static READ8_HANDLER( cassette_r ) |
| 64 | 64 | { |
| r5932 | r5933 | |
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | /* |
| 71 | Sound and cassette port use a common pin. Therefore the signal to cassette | |
| 72 | will appear on audio output. Sound port is a simple one bit I/O and therefore | |
| 73 | it must be toggled at a specific rate under software control. | |
| 71 | Sound and cassette port use a common pin. Therefore the signal to cassette | |
| 72 | will appear on audio output. Sound port is a simple one bit I/O and therefore | |
| 73 | it must be toggled at a specific rate under software control. | |
| 74 | 74 | */ |
| 75 | 75 | static WRITE8_HANDLER( cassette_w ) |
| 76 | 76 | { |
| r5932 | r5933 | |
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | /* |
| 86 | The current state of the vertical sync will appear on bit 0 during a read of | |
| 87 | this port. The waveform and timing spec is shown as follows: | |
| 86 | The current state of the vertical sync will appear on bit 0 during a read of | |
| 87 | this port. The waveform and timing spec is shown as follows: | |
| 88 | 88 | |
| 89 | |<- Active scan period ->|V.sync |<- | |
| 90 | | 12.8 ms |3.6 ms (PAL) | |
| 91 | | |2.8 ms (NTSC) | |
| 92 | +++++++++++++++++++++++++++++++ ++++++++++++ | |
| 93 | + + + | |
| 94 | + + + | |
| 95 | +++++ +++++++++ | |
| 89 | |<- Active scan period ->|V.sync |<- | |
| 90 | | 12.8 ms |3.6 ms (PAL) | |
| 91 | | |2.8 ms (NTSC) | |
| 92 | +++++++++++++++++++++++++++++++ ++++++++++++ | |
| 93 | + + + | |
| 94 | + + + | |
| 95 | +++++ +++++++++ | |
| 96 | 96 | */ |
| 97 | 97 | static READ8_HANDLER( vsync_r ) |
| 98 | 98 | { |
| r5932 | r5933 | |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | /* |
| 105 | Bit D0 of this port controls the swapping of the lower 16K block in the memory | |
| 106 | map with the upper 16K. A 1 in this bit indicates swapping. This bit is reset | |
| 107 | after power up initialization. | |
| 105 | Bit D0 of this port controls the swapping of the lower 16K block in the memory | |
| 106 | map with the upper 16K. A 1 in this bit indicates swapping. This bit is reset | |
| 107 | after power up initialization. | |
| 108 | 108 | */ |
| 109 | 109 | static WRITE8_HANDLER( mapper_w ) |
| 110 | 110 | { |
| r5932 | r5933 | |
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | Printer handshaking port (read) Port 0xFE when read, presents the clear | |
| 116 | to send status from PRNHASK pin at bit D0. A 1 indicates printer is ready, | |
| 117 | 0 means not ready. | |
| 115 | Printer handshaking port (read) Port 0xFE when read, presents the clear | |
| 116 | to send status from PRNHASK pin at bit D0. A 1 indicates printer is ready, | |
| 117 | 0 means not ready. | |
| 118 | 118 | */ |
| 119 | 119 | static READ8_HANDLER( printer_r ) |
| 120 | 120 | { |
| r5932 | r5933 | |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | /* |
| 126 | This is a single bit I/O at D0, it will perform as a serial output | |
| 127 | port under software control. Since timing is done by software the | |
| 128 | baudrate is variable. In BASIC this is a 1200 baud printer port for | |
| 129 | the 40 column thermal printer. | |
| 126 | This is a single bit I/O at D0, it will perform as a serial output | |
| 127 | port under software control. Since timing is done by software the | |
| 128 | baudrate is variable. In BASIC this is a 1200 baud printer port for | |
| 129 | the 40 column thermal printer. | |
| 130 | 130 | */ |
| 131 | 131 | static WRITE8_HANDLER( printer_w ) |
| 132 | 132 | { |
| r5932 | r5933 | |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | /* |
| 137 | This port is 6 bits wide, when read, it returns the row data from the | |
| 138 | keyboard matrix. The keyboard is usually scanned in the following manner: | |
| 137 | This port is 6 bits wide, when read, it returns the row data from the | |
| 138 | keyboard matrix. The keyboard is usually scanned in the following manner: | |
| 139 | 139 | |
| 140 | The keyboard is a 6 row by 8 column matrix. The column is connected to | |
| 141 | the higher order address bus A15-A8. When Z80 executes its input | |
| 142 | instruction sets, either the current content of the accumulator (A) or | |
| 143 | the content of register (B) will go to the higher order address bus. | |
| 144 | Therefore the keyboard can be scanned by placing a specific scanning | |
| 145 | pattern in (A) or (B) and reading the result returned on rows. | |
| 140 | The keyboard is a 6 row by 8 column matrix. The column is connected to | |
| 141 | the higher order address bus A15-A8. When Z80 executes its input | |
| 142 | instruction sets, either the current content of the accumulator (A) or | |
| 143 | the content of register (B) will go to the higher order address bus. | |
| 144 | Therefore the keyboard can be scanned by placing a specific scanning | |
| 145 | pattern in (A) or (B) and reading the result returned on rows. | |
| 146 | 146 | */ |
| 147 | 147 | static READ8_HANDLER( keyboard_r ) |
| 148 | 148 | { |
| r5932 | r5933 | |
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | /* |
| 165 | Software lock: Writing this port with an 8 bit value will set the software | |
| 166 | scrambler pattern. The data that appears on the output side will be the | |
| 167 | result of the input bus EX-ORed with this pattern, bit by bit. The software | |
| 168 | lock is a scrambler built between the CPU and external interface. The | |
| 169 | scrambling pattern is contained in port 0xFF and is not readable. CPU data | |
| 170 | output to external bus will be XORed with this pattern in a bit by bit | |
| 171 | fashion to generate the real data on external bus. By the same mechanism, | |
| 172 | data from external bus is also XORed with this pattern and read by CPU. | |
| 165 | Software lock: Writing this port with an 8 bit value will set the software | |
| 166 | scrambler pattern. The data that appears on the output side will be the | |
| 167 | result of the input bus EX-ORed with this pattern, bit by bit. The software | |
| 168 | lock is a scrambler built between the CPU and external interface. The | |
| 169 | scrambling pattern is contained in port 0xFF and is not readable. CPU data | |
| 170 | output to external bus will be XORed with this pattern in a bit by bit | |
| 171 | fashion to generate the real data on external bus. By the same mechanism, | |
| 172 | data from external bus is also XORed with this pattern and read by CPU. | |
| 173 | 173 | |
| 174 | Therefore it the external device is RAM, the software lock simply has no | |
| 175 | effect as long as the scrambling pattern remains unchanged. For I/O | |
| 176 | operation the pattern is gated to 0 and thus scrambling action is nullified. | |
| 174 | Therefore it the external device is RAM, the software lock simply has no | |
| 175 | effect as long as the scrambling pattern remains unchanged. For I/O | |
| 176 | operation the pattern is gated to 0 and thus scrambling action is nullified. | |
| 177 | 177 | |
| 178 | In BASIC operation the scrambling pattern is generated by a random number | |
| 179 | routine. For game cartridge the lock pattern is generated from data in the | |
| 180 | game cartridge itself. | |
| 178 | In BASIC operation the scrambling pattern is generated by a random number | |
| 179 | routine. For game cartridge the lock pattern is generated from data in the | |
| 180 | game cartridge itself. | |
| 181 | 181 | */ |
| 182 | 182 | static WRITE8_HANDLER( scrambler_w ) |
| 183 | 183 | { |
| r5932 | r5933 | |
| 239 | 239 | ADDRESS_MAP_END |
| 240 | 240 | |
| 241 | 241 | static ADDRESS_MAP_START( aquarius_io, ADDRESS_SPACE_IO, 8 ) |
| 242 | // | |
| 242 | // AM_RANGE(0x7e, 0x7f) AM_MIRROR(0xff00) AM_READWRITE(modem_r, modem_w) | |
| 243 | 243 | AM_RANGE(0xf6, 0xf6) AM_MIRROR(0xff00) AM_DEVREADWRITE("ay8910", ay8910_r, ay8910_data_w) |
| 244 | 244 | AM_RANGE(0xf7, 0xf7) AM_MIRROR(0xff00) AM_DEVWRITE("ay8910", ay8910_address_w) |
| 245 | 245 | AM_RANGE(0xfc, 0xfc) AM_MIRROR(0xff00) AM_READWRITE(cassette_r, cassette_w) |
| r5932 | r5933 | |
| 451 | 451 | MDRV_CPU_IO_MAP(aquarius_qd_io) |
| 452 | 452 | |
| 453 | 453 | MDRV_DEVICE_REMOVE("cart") |
| 454 | ||
| 454 | ||
| 455 | 455 | MDRV_FLOPPY_2_DRIVES_ADD(aquarius_floppy_config) |
| 456 | 456 | MACHINE_DRIVER_END |
| 457 | 457 | |
| r5932 | r5933 | |
| 514 | 514 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 515 | 515 | COMP( 1983, aquarius, 0, 0, aquarius, aquarius, aquarius, aquarius, "Mattel", "Aquarius (NTSC)", 0 ) |
| 516 | 516 | COMP( 1983, aquarius_qd, aquarius, 0, aquarius_qd, aquarius, aquarius, aquarius, "Mattel", "Aquarius w/ Quick Disk (NTSC)", 0 ) |
| 517 | //COMP( | |
| 517 | //COMP( 1984, aquariu2, aquarius, 0, aquarius, aquarius, 0, aquarius, "Mattel", "Aquarius II", GAME_NOT_WORKING ) |
| r5932 | r5933 | |
|---|---|---|
| 175 | 175 | PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 176 | 176 | PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 177 | 177 | |
| 178 | /* 2008-05 FP: Below we still miss a 'Lock' key, two 'Rst' keys (used in pair, they should restart the | |
| 179 | system) and, I guess, two unused inputs (according to the user manual, there are no other keys on the | |
| 180 | keyboard) */ | |
| 178 | /* 2008-05 FP: Below we still miss a 'Lock' key, two 'Rst' keys (used in pair, they should restart the | |
| 179 | system) and, I guess, two unused inputs (according to the user manual, there are no other keys on the | |
| 180 | keyboard) */ | |
| 181 | 181 | PORT_START("ROW7") |
| 182 | 182 | PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 183 | 183 | PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Mod Sel") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| r5932 | r5933 | |
| 213 | 213 | /* FB/DF 2 [1] [4] [7] [*] */ |
| 214 | 214 | |
| 215 | 215 | /* 2008-05 FP: temporarily I mapped these as follows: |
| 216 | - Joy 1 at Keypad | |
| 217 | - Joy 2 at a Joystick buttons | |
| 218 | A better mapping would be needed... | |
| 219 | */ | |
| 216 | - Joy 1 at Keypad | |
| 217 | - Joy 2 at a Joystick buttons | |
| 218 | A better mapping would be needed... | |
| 219 | */ | |
| 220 | 220 | |
| 221 | PORT_START("KP0") | |
| 221 | PORT_START("KP0") | |
| 222 | 222 | PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [3]") PORT_CODE(KEYCODE_3_PAD) |
| 223 | 223 | PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [6]") PORT_CODE(KEYCODE_6_PAD) |
| 224 | 224 | PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [9]") PORT_CODE(KEYCODE_9_PAD) |
| r5932 | r5933 | |
| 230 | 230 | PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [8]") PORT_CODE(KEYCODE_8_PAD) |
| 231 | 231 | PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [0]") PORT_CODE(KEYCODE_0_PAD) |
| 232 | 232 | |
| 233 | PORT_START("KP2") | |
| 233 | PORT_START("KP2") | |
| 234 | 234 | PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [1]") PORT_CODE(KEYCODE_1_PAD) |
| 235 | 235 | PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [4]") PORT_CODE(KEYCODE_4_PAD) |
| 236 | 236 | PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [7]") PORT_CODE(KEYCODE_7_PAD) |
| r5932 | r5933 | |
| 242 | 242 | PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [9]") |
| 243 | 243 | PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [#]") PORT_CODE(JOYCODE_BUTTON1) |
| 244 | 244 | |
| 245 | PORT_START("KP4") | |
| 245 | PORT_START("KP4") | |
| 246 | 246 | PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [2]") PORT_CODE(JOYCODE_BUTTON2) |
| 247 | 247 | PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [5]") PORT_CODE(JOYCODE_BUTTON5) |
| 248 | 248 | PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [8]") |
| r5932 | r5933 | |
| 406 | 406 | TRACKS([40]) |
| 407 | 407 | SECTORS([10]) |
| 408 | 408 | SECTOR_LENGTH([256]) |
| 409 | FIRST_SECTOR_ID([1])) | |
| 409 | FIRST_SECTOR_ID([1])) | |
| 410 | 410 | FLOPPY_OPTIONS_END |
| 411 | 411 | |
| 412 | 412 | static const floppy_config cgenie_floppy_config = |
| r5932 | r5933 | |
| 490 | 490 | |
| 491 | 491 | // |
| 492 | 492 | // abbreviations used: |
| 493 | // GPL Granules Per Lump | |
| 494 | // GAT Granule Allocation Table | |
| 493 | // GPL Granules Per Lump | |
| 494 | // GAT Granule Allocation Table | |
| 495 | 495 | // GATL GAT Length |
| 496 | 496 | // GATM GAT Mask |
| 497 | 497 | // DDGA Disk Directory Granule Allocation |
| 498 | 498 | typedef struct |
| 499 | 499 | { |
| 500 | UINT8 DDSL; // Disk Directory Start Lump (lump number of GAT) | |
| 501 | UINT8 GATL; // # of bytes used in the Granule Allocation Table sector | |
| 502 | UINT8 STEPRATE; // step rate and somet SD/DD flag ... | |
| 503 | UINT8 TRK; // number of tracks | |
| 504 | UINT8 SPT; // sectors per track (both heads counted!) | |
| 505 | UINT8 GATM; // number of used bits per byte in the GAT sector (GAT mask) | |
| 506 | UINT8 P7; // ???? always zero | |
| 507 | UINT8 FLAGS; // ???? some flags (SS/DS bit 6) | |
| 508 | UINT8 GPL; // Sectors per granule (always 5 for the Colour Genie) | |
| 509 | UINT8 DDGA; // Disk Directory Granule allocation (number of driectory granules) | |
| 510 | } PDRIVE; | |
| 500 | UINT8 DDSL; // Disk Directory Start Lump (lump number of GAT) | |
| 501 | UINT8 GATL; // # of bytes used in the Granule Allocation Table sector | |
| 502 | UINT8 STEPRATE; // step rate and somet SD/DD flag ... | |
| 503 | UINT8 TRK; // number of tracks | |
| 504 | UINT8 SPT; // sectors per track (both heads counted!) | |
| 505 | UINT8 GATM; // number of used bits per byte in the GAT sector (GAT mask) | |
| 506 | UINT8 P7; // ???? always zero | |
| 507 | UINT8 FLAGS; // ???? some flags (SS/DS bit 6) | |
| 508 | UINT8 GPL; // Sectors per granule (always 5 for the Colour Genie) | |
| 509 | UINT8 DDGA; // Disk Directory Granule allocation (number of driectory granules) | |
| 510 | } PDRIVE; | |
| 511 | 511 | |
| 512 | 512 | static const PDRIVE pd_list[12] = { |
| 513 | {0x14, 0x28, 0x07, 0x28, 0x0A, 0x02, 0x00, 0x00, 0x05, 0x02}, // CMD"<0=A" 40 tracks, SS, SD | |
| 514 | {0x14, 0x28, 0x07, 0x28, 0x14, 0x04, 0x00, 0x40, 0x05, 0x04}, // CMD"<0=B" 40 tracks, DS, SD | |
| 515 | {0x18, 0x30, 0x53, 0x28, 0x12, 0x03, 0x00, 0x03, 0x05, 0x03}, // CMD"<0=C" 40 tracks, SS, DD | |
| 516 | {0x18, 0x30, 0x53, 0x28, 0x24, 0x06, 0x00, 0x43, 0x05, 0x06}, // CMD"<0=D" 40 tracks, DS, DD | |
| 517 | {0x14, 0x28, 0x07, 0x28, 0x0A, 0x02, 0x00, 0x04, 0x05, 0x02}, // CMD"<0=E" 40 tracks, SS, SD | |
| 518 | {0x14, 0x28, 0x07, 0x28, 0x14, 0x04, 0x00, 0x44, 0x05, 0x04}, // CMD"<0=F" 40 tracks, DS, SD | |
| 519 | {0x18, 0x30, 0x53, 0x28, 0x12, 0x03, 0x00, 0x07, 0x05, 0x03}, // CMD"<0=G" 40 tracks, SS, DD | |
| 520 | {0x18, 0x30, 0x53, 0x28, 0x24, 0x06, 0x00, 0x47, 0x05, 0x06}, // CMD"<0=H" 40 tracks, DS, DD | |
| 521 | {0x28, 0x50, 0x07, 0x50, 0x0A, 0x02, 0x00, 0x00, 0x05, 0x02}, // CMD"<0=I" 80 tracks, SS, SD | |
| 522 | {0x28, 0x50, 0x07, 0x50, 0x14, 0x04, 0x00, 0x40, 0x05, 0x04}, // CMD"<0=J" 80 tracks, DS, SD | |
| 523 | {0x30, 0x60, 0x53, 0x50, 0x12, 0x03, 0x00, 0x03, 0x05, 0x03}, // CMD"<0=K" 80 tracks, SS, DD | |
| 524 | {0x30, 0x60, 0x53, 0x50, 0x24, 0x06, 0x00, 0x43, 0x05, 0x06}, // CMD"<0=L" 80 tracks, DS, DD | |
| 513 | {0x14, 0x28, 0x07, 0x28, 0x0A, 0x02, 0x00, 0x00, 0x05, 0x02}, // CMD"<0=A" 40 tracks, SS, SD | |
| 514 | {0x14, 0x28, 0x07, 0x28, 0x14, 0x04, 0x00, 0x40, 0x05, 0x04}, // CMD"<0=B" 40 tracks, DS, SD | |
| 515 | {0x18, 0x30, 0x53, 0x28, 0x12, 0x03, 0x00, 0x03, 0x05, 0x03}, // CMD"<0=C" 40 tracks, SS, DD | |
| 516 | {0x18, 0x30, 0x53, 0x28, 0x24, 0x06, 0x00, 0x43, 0x05, 0x06}, // CMD"<0=D" 40 tracks, DS, DD | |
| 517 | {0x14, 0x28, 0x07, 0x28, 0x0A, 0x02, 0x00, 0x04, 0x05, 0x02}, // CMD"<0=E" 40 tracks, SS, SD | |
| 518 | {0x14, 0x28, 0x07, 0x28, 0x14, 0x04, 0x00, 0x44, 0x05, 0x04}, // CMD"<0=F" 40 tracks, DS, SD | |
| 519 | {0x18, 0x30, 0x53, 0x28, 0x12, 0x03, 0x00, 0x07, 0x05, 0x03}, // CMD"<0=G" 40 tracks, SS, DD | |
| 520 | {0x18, 0x30, 0x53, 0x28, 0x24, 0x06, 0x00, 0x47, 0x05, 0x06}, // CMD"<0=H" 40 tracks, DS, DD | |
| 521 | {0x28, 0x50, 0x07, 0x50, 0x0A, 0x02, 0x00, 0x00, 0x05, 0x02}, // CMD"<0=I" 80 tracks, SS, SD | |
| 522 | {0x28, 0x50, 0x07, 0x50, 0x14, 0x04, 0x00, 0x40, 0x05, 0x04}, // CMD"<0=J" 80 tracks, DS, SD | |
| 523 | {0x30, 0x60, 0x53, 0x50, 0x12, 0x03, 0x00, 0x03, 0x05, 0x03}, // CMD"<0=K" 80 tracks, SS, DD | |
| 524 | {0x30, 0x60, 0x53, 0x50, 0x24, 0x06, 0x00, 0x43, 0x05, 0x06}, // CMD"<0=L" 80 tracks, DS, DD | |
| 525 | 525 | }; |
| 526 | 526 | |
| 527 | 527 | // basic-dsk is a disk image format which has the tracks and sectors |
| r5932 | r5933 | |
| 531 | 531 | // |
| 532 | 532 | DEVICE_IMAGE_LOAD( cgenie_floppy ) |
| 533 | 533 | { |
| 534 | int i, j, dir_offset; | |
| 535 | UINT8 buff[16]; | |
| 536 | UINT8 tracks = 0; | |
| 537 | UINT8 heads = 0; | |
| 538 | UINT8 spt = 0; | |
| 539 | short dir_sector = 0; | |
| 540 | short dir_length = 0; | |
| 534 | int i, j, dir_offset; | |
| 535 | UINT8 buff[16]; | |
| 536 | UINT8 tracks = 0; | |
| 537 | UINT8 heads = 0; | |
| 538 | UINT8 spt = 0; | |
| 539 | short dir_sector = 0; | |
| 540 | short dir_length = 0; | |
| 541 | 541 | |
| 542 | // A Floppy Isnt manditory, so return if none | |
| 543 | if (device_load_basicdsk_floppy(image) != INIT_PASS) | |
| 544 | return INIT_FAIL; | |
| 542 | // A Floppy Isnt manditory, so return if none | |
| 543 | if (device_load_basicdsk_floppy(image) != INIT_PASS) | |
| 544 | return INIT_FAIL; | |
| 545 | 545 | |
| 546 | // determine image geometry | |
| 547 | image_fseek(image, 0, SEEK_SET); | |
| 546 | // determine image geometry | |
| 547 | image_fseek(image, 0, SEEK_SET); | |
| 548 | 548 | |
| 549 | // determine geometry from disk contents | |
| 550 | for( i = 0; i < 12; i++ ) | |
| 551 | { | |
| 552 | image_fseek(image, pd_list[i].SPT * 256, SEEK_SET); | |
| 553 | image_fread(image, buff, 16); | |
| 554 | // find an entry with matching DDSL | |
| 555 | if (buff[0] != 0x00 || buff[1] != 0xfe || buff[2] != pd_list[i].DDSL) | |
| 556 | continue; | |
| 557 | logerror("cgenie: checking format #%d\n", i); | |
| 549 | // determine geometry from disk contents | |
| 550 | for( i = 0; i < 12; i++ ) | |
| 551 | { | |
| 552 | image_fseek(image, pd_list[i].SPT * 256, SEEK_SET); | |
| 553 | image_fread(image, buff, 16); | |
| 554 | // find an entry with matching DDSL | |
| 555 | if (buff[0] != 0x00 || buff[1] != 0xfe || buff[2] != pd_list[i].DDSL) | |
| 556 | continue; | |
| 557 | logerror("cgenie: checking format #%d\n", i); | |
| 558 | 558 | |
| 559 | dir_sector = pd_list[i].DDSL * pd_list[i].GATM * pd_list[i].GPL + pd_list[i].SPT; | |
| 560 | dir_length = pd_list[i].DDGA * pd_list[i].GPL; | |
| 559 | dir_sector = pd_list[i].DDSL * pd_list[i].GATM * pd_list[i].GPL + pd_list[i].SPT; | |
| 560 | dir_length = pd_list[i].DDGA * pd_list[i].GPL; | |
| 561 | 561 | |
| 562 | // scan directory for DIR/SYS or NCW1983/JHL files | |
| 563 | // look into sector 2 and 3 first entry relative to DDSL | |
| 564 | for( j = 16; j < 32; j += 8 ) | |
| 565 | { | |
| 566 | dir_offset = dir_sector * 256 + j * 32; | |
| 567 | if( image_fseek(image, dir_offset, SEEK_SET) < 0 ) | |
| 568 | break; | |
| 569 | if( image_fread(image, buff, 16) != 16 ) | |
| 570 | break; | |
| 571 | if( !strncmp((char*)buff + 5, "DIR SYS", 11) || | |
| 572 | !strncmp((char*)buff + 5, "NCW1983 JHL", 11) ) | |
| 573 | { | |
| 574 | tracks = pd_list[i].TRK; | |
| 575 | heads = (pd_list[i].SPT > 18) ? 2 : 1; | |
| 576 | spt = pd_list[i].SPT / heads; | |
| 577 | dir_sector = pd_list[i].DDSL * pd_list[i].GATM * pd_list[i].GPL + pd_list[i].SPT; | |
| 578 | dir_length = pd_list[i].DDGA * pd_list[i].GPL; | |
| 579 | memcpy(memory_region(image->machine, "maincpu") + 0x5A71 + floppy_get_drive(image) * sizeof(PDRIVE), &pd_list[i], sizeof(PDRIVE)); | |
| 580 | break; | |
| 581 | } | |
| 582 | } | |
| 562 | // scan directory for DIR/SYS or NCW1983/JHL files | |
| 563 | // look into sector 2 and 3 first entry relative to DDSL | |
| 564 | for( j = 16; j < 32; j += 8 ) | |
| 565 | { | |
| 566 | dir_offset = dir_sector * 256 + j * 32; | |
| 567 | if( image_fseek(image, dir_offset, SEEK_SET) < 0 ) | |
| 568 | break; | |
| 569 | if( image_fread(image, buff, 16) != 16 ) | |
| 570 | break; | |
| 571 | if( !strncmp((char*)buff + 5, "DIR SYS", 11) || | |
| 572 | !strncmp((char*)buff + 5, "NCW1983 JHL", 11) ) | |
| 573 | { | |
| 574 | tracks = pd_list[i].TRK; | |
| 575 | heads = (pd_list[i].SPT > 18) ? 2 : 1; | |
| 576 | spt = pd_list[i].SPT / heads; | |
| 577 | dir_sector = pd_list[i].DDSL * pd_list[i].GATM * pd_list[i].GPL + pd_list[i].SPT; | |
| 578 | dir_length = pd_list[i].DDGA * pd_list[i].GPL; | |
| 579 | memcpy(memory_region(image->machine, "maincpu") + 0x5A71 + floppy_get_drive(image) * sizeof(PDRIVE), &pd_list[i], sizeof(PDRIVE)); | |
| 580 | break; | |
| 581 | } | |
| 582 | } | |
| 583 | 583 | |
| 584 | logerror("cgenie: geometry %d tracks, %d heads, %d sec/track\n", tracks, heads, spt); | |
| 585 | // set geometry so disk image can be read | |
| 586 | basicdsk_set_geometry(image, tracks, heads, spt, 256, 0, 0, FALSE); | |
| 584 | logerror("cgenie: geometry %d tracks, %d heads, %d sec/track\n", tracks, heads, spt); | |
| 585 | // set geometry so disk image can be read | |
| 586 | basicdsk_set_geometry(image, tracks, heads, spt, 256, 0, 0, FALSE); | |
| 587 | 587 | |
| 588 | logerror("cgenie: directory sectors %d - %d (%d sectors)\n", dir_sector, dir_sector + dir_length - 1, dir_length); | |
| 589 | // mark directory sectors with deleted data address mark | |
| 590 | // assumption dir_sector is a sector offset | |
| 591 | for (j = 0; j < dir_length; j++) | |
| 592 | { | |
| 593 | UINT8 track; | |
| 594 | UINT8 side; | |
| 595 | UINT8 sector_id; | |
| 596 | UINT16 track_offset; | |
| 597 | UINT16 sector_offset; | |
| 588 | logerror("cgenie: directory sectors %d - %d (%d sectors)\n", dir_sector, dir_sector + dir_length - 1, dir_length); | |
| 589 | // mark directory sectors with deleted data address mark | |
| 590 | // assumption dir_sector is a sector offset | |
| 591 | for (j = 0; j < dir_length; j++) | |
| 592 | { | |
| 593 | UINT8 track; | |
| 594 | UINT8 side; | |
| 595 | UINT8 sector_id; | |
| 596 | UINT16 track_offset; | |
| 597 | UINT16 sector_offset; | |
| 598 | 598 | |
| 599 | // calc sector offset | |
| 600 | sector_offset = dir_sector + j; | |
| 599 | // calc sector offset | |
| 600 | sector_offset = dir_sector + j; | |
| 601 | 601 | |
| 602 | // get track offset | |
| 603 | track_offset = sector_offset / spt; | |
| 602 | // get track offset | |
| 603 | track_offset = sector_offset / spt; | |
| 604 | 604 | |
| 605 | // calc track | |
| 606 | track = track_offset / heads; | |
| 605 | // calc track | |
| 606 | track = track_offset / heads; | |
| 607 | 607 | |
| 608 | // calc side | |
| 609 | side = track_offset % heads; | |
| 608 | // calc side | |
| 609 | side = track_offset % heads; | |
| 610 | 610 | |
| 611 | // calc sector id - first sector id is 0! | |
| 612 | sector_id = sector_offset % spt; | |
| 611 | // calc sector id - first sector id is 0! | |
| 612 | sector_id = sector_offset % spt; | |
| 613 | 613 | |
| 614 | // set deleted data address mark for sector specified | |
| 615 | basicdsk_set_ddam(image, track, side, sector_id, 1); | |
| 616 | } | |
| 614 | // set deleted data address mark for sector specified | |
| 615 | basicdsk_set_ddam(image, track, side, sector_id, 1); | |
| 616 | } | |
| 617 | 617 | |
| 618 | } | |
| 619 | return INIT_PASS; | |
| 618 | } | |
| 619 | return INIT_PASS; | |
| 620 | 620 | } |
| 621 | 621 | */ |
| 622 | 622 | static SYSTEM_CONFIG_START(cgenie) |
| r5932 | r5933 | |
|---|---|---|
| 91 | 91 | |
| 92 | 92 | /* devices */ |
| 93 | 93 | MDRV_QUICKLOAD_ADD("quickload", lynx, "o", 0) |
| 94 | ||
| 94 | ||
| 95 | 95 | MDRV_IMPORT_FROM(lynx_cartslot) |
| 96 | 96 | MACHINE_DRIVER_END |
| 97 | 97 | |
| r5932 | r5933 | |
| 173 | 173 | memory_write_byte(space, 0x1fc, start & 0xff); |
| 174 | 174 | memory_write_byte(space, 0x1fd, start >> 8); |
| 175 | 175 | |
| 176 | lynx_crc_keyword(devtag_get_device(image->machine, "quickload")); | |
| 176 | lynx_crc_keyword(devtag_get_device(image->machine, "quickload")); | |
| 177 | 177 | |
| 178 | 178 | cpu_set_reg(cpu, REG_GENPC, start); |
| 179 | 179 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | NOTE: ****** Specbusy: press N, R, or E to boot ************* | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | Spectrum/Inves/TK90X etc. memory map: |
| r5932 | r5933 | |
| 212 | 212 | void spectrum_plus3_update_memory(running_machine *machine) |
| 213 | 213 | { |
| 214 | 214 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 215 | ||
| 215 | ||
| 216 | 216 | if (spectrum_128_port_7ffd_data & 8) |
| 217 | 217 | { |
| 218 | 218 | logerror("+3 SCREEN 1: BLOCK 7\n"); |
| r5932 | r5933 | |
| 337 | 337 | The function decodes the ports appropriately */ |
| 338 | 338 | static ADDRESS_MAP_START (spectrum_plus3_io, ADDRESS_SPACE_IO, 8) |
| 339 | 339 | ADDRESS_MAP_UNMAP_HIGH |
| 340 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) | |
| 340 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) | |
| 341 | 341 | AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) |
| 342 | 342 | AM_RANGE(0x4000, 0x4000) AM_WRITE(spectrum_plus3_port_7ffd_w) AM_MIRROR(0x3ffd) |
| 343 | 343 | AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd) |
| r5932 | r5933 | |
| 350 | 350 | static MACHINE_RESET( spectrum_plus3 ) |
| 351 | 351 | { |
| 352 | 352 | memset(mess_ram,0,128*1024); |
| 353 | ||
| 353 | ||
| 354 | 354 | /* Initial configuration */ |
| 355 | 355 | spectrum_128_port_7ffd_data = 0; |
| 356 | 356 | spectrum_plus3_port_1ffd_data = 0; |
| r5932 | r5933 | |
| 374 | 374 | MDRV_SCREEN_REFRESH_RATE(50.01) |
| 375 | 375 | |
| 376 | 376 | MDRV_MACHINE_RESET( spectrum_plus3 ) |
| 377 | ||
| 377 | ||
| 378 | 378 | MDRV_NEC765A_ADD("nec765", spectrum_plus3_nec765_interface) |
| 379 | 379 | MDRV_FLOPPY_2_DRIVES_ADD(specpls3_floppy_config) |
| 380 | 380 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
| 424 | 424 | ROMX_LOAD("romb-en.rom",0x18000,0x8000, CRC(ef8d5d92) SHA1(983aa53aa76e25a3af123c896016bacf6829b72b), ROM_BIOS(1)) |
| 425 | 425 | ROM_SYSTEM_BIOS( 1, "sp", "Spanish" ) |
| 426 | 426 | ROMX_LOAD("roma-es.rom",0x10000,0x8000, CRC(ba694b4b) SHA1(d15d9e43950483cffc79f1cfa89ecb114a88f6c2), ROM_BIOS(2)) |
| 427 | ROMX_LOAD("romb-es.rom",0x18000,0x8000, CRC(61ed94db) SHA1(935b14c13db75d872de8ad0d591aade0adbbc355), ROM_BIOS(2)) | |
| 427 | ROMX_LOAD("romb-es.rom",0x18000,0x8000, CRC(61ed94db) SHA1(935b14c13db75d872de8ad0d591aade0adbbc355), ROM_BIOS(2)) | |
| 428 | 428 | ROM_CART_LOAD("cart", 0x10000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL) |
| 429 | 429 | ROM_END |
| 430 | 430 | |
| r5932 | r5933 | |
| 460 | 460 | SYSTEM_CONFIG_END |
| 461 | 461 | |
| 462 | 462 | |
| 463 | /* YEAR NAME PARENT COMPAT MACHINE | |
| 463 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 464 | 464 | COMP( 1987, specpl2a, spec128, 0, spectrum_plus3, spec_plus, 0, specpls3, "Amstrad plc", "ZX Spectrum +2a" , 0 ) |
| 465 | 465 | COMP( 1987, specpls3, spec128, 0, spectrum_plus3, spec_plus, 0, specpls3, "Amstrad plc", "ZX Spectrum +3" , 0 ) |
| 466 | 466 | COMP( 2000, specpl3e, spec128, 0, spectrum_plus3, spec_plus, 0, specpls3, "Amstrad plc", "ZX Spectrum +3e" , GAME_COMPUTER_MODIFIED ) |
| r5932 | r5933 | |
|---|---|---|
| 466 | 466 | x68k_sys.keyboard.headpos = 0; |
| 467 | 467 | // mfp_trigger_irq(MFP_IRQ_RX_ERROR); |
| 468 | 468 | current_vector[6] = 0x4b; |
| 469 | // | |
| 469 | // cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x4b); | |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | |
| r5932 | r5933 | |
| 637 | 637 | if(x68k_sys.mouse.bufferempty != 0) // nothing to do if the mouse data buffer is empty |
| 638 | 638 | return; |
| 639 | 639 | |
| 640 | // if((x68k_sys.ioc.irqstatus & 0xc0) != 0) | |
| 641 | // return; | |
| 640 | // if((x68k_sys.ioc.irqstatus & 0xc0) != 0) | |
| 641 | // return; | |
| 642 | 642 | |
| 643 | 643 | // hard-code the IRQ vector for now, until the SCC code is more complete |
| 644 | 644 | if((scc_get_reg_a(scc, 9) & 0x08) || (scc_get_reg_b(scc, 9) & 0x08)) // SCC reg WR9 is the same for both channels |
| r5932 | r5933 | |
| 694 | 694 | UINT8 porta = input_port_read(device->machine,"md3b") & 0xff; |
| 695 | 695 | UINT8 portb = (input_port_read(device->machine,"md3b") >> 8) & 0xff; |
| 696 | 696 | if(x68k_sys.mdctrl.mux1 & 0x10) |
| 697 | { | |
| 697 | { | |
| 698 | 698 | return porta | 0x90; |
| 699 | 699 | } |
| 700 | 700 | else |
| 701 | { | |
| 701 | { | |
| 702 | 702 | return (portb & 0x60) | (porta & 0x03) | 0x90; |
| 703 | 703 | } |
| 704 | 704 | } |
| r5932 | r5933 | |
| 707 | 707 | UINT8 porta = (input_port_read(device->machine,"md3b") >> 16) & 0xff; |
| 708 | 708 | UINT8 portb = (input_port_read(device->machine,"md3b") >> 24) & 0xff; |
| 709 | 709 | if(x68k_sys.mdctrl.mux2 & 0x20) |
| 710 | { | |
| 710 | { | |
| 711 | 711 | return porta | 0x90; |
| 712 | 712 | } |
| 713 | 713 | else |
| 714 | { | |
| 714 | { | |
| 715 | 715 | return (portb & 0x60) | (porta & 0x03) | 0x90; |
| 716 | 716 | } |
| 717 | 717 | } |
| r5932 | r5933 | |
| 742 | 742 | UINT8 porta = input_port_read(device->machine,"md6b") & 0xff; |
| 743 | 743 | UINT8 portb = (input_port_read(device->machine,"md6b") >> 8) & 0xff; |
| 744 | 744 | UINT8 extra = input_port_read(device->machine,"md6b_extra") & 0x0f; |
| 745 | ||
| 745 | ||
| 746 | 746 | switch(x68k_sys.mdctrl.seq1) |
| 747 | 747 | { |
| 748 | 748 | case 1: |
| 749 | 749 | default: |
| 750 | 750 | if(x68k_sys.mdctrl.mux1 & 0x10) |
| 751 | { | |
| 751 | { | |
| 752 | 752 | return porta | 0x90; |
| 753 | 753 | } |
| 754 | 754 | else |
| 755 | { | |
| 755 | { | |
| 756 | 756 | return (portb & 0x60) | (porta & 0x03) | 0x90; |
| 757 | 757 | } |
| 758 | 758 | case 2: |
| 759 | 759 | if(x68k_sys.mdctrl.mux1 & 0x10) |
| 760 | { | |
| 760 | { | |
| 761 | 761 | return porta | 0x90; |
| 762 | 762 | } |
| 763 | 763 | else |
| 764 | { | |
| 764 | { | |
| 765 | 765 | return (portb & 0x60) | 0x90; |
| 766 | 766 | } |
| 767 | 767 | case 3: |
| 768 | 768 | if(x68k_sys.mdctrl.mux1 & 0x10) |
| 769 | { | |
| 769 | { | |
| 770 | 770 | return (porta & 0x60) | (extra & 0x0f) | 0x90; |
| 771 | 771 | } |
| 772 | 772 | else |
| 773 | { | |
| 773 | { | |
| 774 | 774 | return (portb & 0x60) | 0x9f; |
| 775 | 775 | } |
| 776 | 776 | } |
| r5932 | r5933 | |
| 786 | 786 | case 1: |
| 787 | 787 | default: |
| 788 | 788 | if(x68k_sys.mdctrl.mux2 & 0x20) |
| 789 | { | |
| 789 | { | |
| 790 | 790 | return porta | 0x90; |
| 791 | 791 | } |
| 792 | 792 | else |
| 793 | { | |
| 793 | { | |
| 794 | 794 | return (portb & 0x60) | (porta & 0x03) | 0x90; |
| 795 | 795 | } |
| 796 | 796 | case 2: |
| 797 | 797 | if(x68k_sys.mdctrl.mux2 & 0x20) |
| 798 | { | |
| 798 | { | |
| 799 | 799 | return porta | 0x90; |
| 800 | 800 | } |
| 801 | 801 | else |
| 802 | { | |
| 802 | { | |
| 803 | 803 | return (portb & 0x60) | 0x90; |
| 804 | 804 | } |
| 805 | 805 | case 3: |
| 806 | 806 | if(x68k_sys.mdctrl.mux2 & 0x20) |
| 807 | { | |
| 807 | { | |
| 808 | 808 | return (porta & 0x60) | (extra & 0x0f) | 0x90; |
| 809 | 809 | } |
| 810 | 810 | else |
| 811 | { | |
| 811 | { | |
| 812 | 812 | return (portb & 0x60) | 0x9f; |
| 813 | 813 | } |
| 814 | 814 | } |
| r5932 | r5933 | |
| 830 | 830 | UINT8 porta = input_port_read(device->machine,"xpd1lr") & 0xff; |
| 831 | 831 | UINT8 portb = (input_port_read(device->machine,"xpd1lr") >> 8) & 0xff; |
| 832 | 832 | if(x68k_sys.mdctrl.mux1 & 0x10) |
| 833 | { | |
| 833 | { | |
| 834 | 834 | return porta; |
| 835 | 835 | } |
| 836 | 836 | else |
| 837 | { | |
| 837 | { | |
| 838 | 838 | return portb | (porta & 0x60); |
| 839 | 839 | } |
| 840 | 840 | } |
| r5932 | r5933 | |
| 843 | 843 | UINT8 porta = (input_port_read(device->machine,"xpd1lr") >> 16) & 0xff; |
| 844 | 844 | UINT8 portb = (input_port_read(device->machine,"xpd1lr") >> 24) & 0xff; |
| 845 | 845 | if(x68k_sys.mdctrl.mux2 & 0x20) |
| 846 | { | |
| 846 | { | |
| 847 | 847 | return porta; |
| 848 | 848 | } |
| 849 | 849 | else |
| 850 | { | |
| 850 | { | |
| 851 | 851 | return portb | (porta & 0x60); |
| 852 | 852 | } |
| 853 | 853 | } |
| r5932 | r5933 | |
| 858 | 858 | static READ8_DEVICE_HANDLER( ppi_port_a_r ) |
| 859 | 859 | { |
| 860 | 860 | int ctrl = input_port_read(device->machine,"ctrltype") & 0x0f; |
| 861 | ||
| 861 | ||
| 862 | 862 | switch(ctrl) |
| 863 | 863 | { |
| 864 | 864 | case 0x00: // standard MSX/FM-Towns joystick |
| r5932 | r5933 | |
| 873 | 873 | case 0x03: // XPD-1LR |
| 874 | 874 | return xpd1lr_r(device,1); |
| 875 | 875 | } |
| 876 | ||
| 876 | ||
| 877 | 877 | return 0xff; |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | static READ8_DEVICE_HANDLER( ppi_port_b_r ) |
| 881 | 881 | { |
| 882 | 882 | int ctrl = input_port_read(device->machine,"ctrltype") & 0xf0; |
| 883 | ||
| 883 | ||
| 884 | 884 | switch(ctrl) |
| 885 | 885 | { |
| 886 | 886 | case 0x00: // standard MSX/FM-Towns joystick |
| r5932 | r5933 | |
| 895 | 895 | case 0x30: // XPD-1LR |
| 896 | 896 | return xpd1lr_r(device,2); |
| 897 | 897 | } |
| 898 | ||
| 898 | ||
| 899 | 899 | return 0xff; |
| 900 | 900 | } |
| 901 | 901 | |
| r5932 | r5933 | |
| 919 | 919 | static UINT16 prev1; |
| 920 | 920 | static UINT16 prev2; |
| 921 | 921 | static UINT16 prevA; |
| 922 | ||
| 922 | ||
| 923 | 923 | ppi_port[2] = data; |
| 924 | 924 | if((data & 0x0f) != (prevA & 0x0f)) |
| 925 | 925 | { |
| r5932 | r5933 | |
| 929 | 929 | okim6258_set_divider(oki, (data >> 2) & 3); |
| 930 | 930 | } |
| 931 | 931 | prevA = data & 0x0f; |
| 932 | ||
| 932 | ||
| 933 | 933 | // The joystick enable bits also handle the multiplexer for various controllers |
| 934 | 934 | x68k_sys.joy.joy1_enable = data & 0x10; |
| 935 | 935 | x68k_sys.mdctrl.mux1 = data & 0x10; |
| r5932 | r5933 | |
| 1017 | 1017 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1),1,1); |
| 1018 | 1018 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 2),1,1); |
| 1019 | 1019 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 3),1,1); |
| 1020 | // for(drive=0;drive<4;drive++) | |
| 1021 | // { | |
| 1022 | // if(floppy_drive_get_flag_state(floppy_get_device(machine, drive),FLOPPY_DRIVE_MOTOR_ON)) | |
| 1023 | // output_set_indexed_value("access_drv",drive,0); | |
| 1024 | // else | |
| 1025 | // output_set_indexed_value("access_drv",drive,1); | |
| 1026 | // } | |
| 1020 | // for(drive=0;drive<4;drive++) | |
| 1021 | // { | |
| 1022 | // if(floppy_drive_get_flag_state(floppy_get_device(machine, drive),FLOPPY_DRIVE_MOTOR_ON)) | |
| 1023 | // output_set_indexed_value("access_drv",drive,0); | |
| 1024 | // else | |
| 1025 | // output_set_indexed_value("access_drv",drive,1); | |
| 1026 | // } | |
| 1027 | 1027 | logerror("FDC: Drive #%i: Drive selection set to %02x\n",data & 0x03,data); |
| 1028 | 1028 | break; |
| 1029 | 1029 | default: |
| r5932 | r5933 | |
| 1037 | 1037 | unsigned int ret; |
| 1038 | 1038 | int x; |
| 1039 | 1039 | const device_config *fdc = devtag_get_device(space->machine, "nec72065"); |
| 1040 | ||
| 1040 | ||
| 1041 | 1041 | switch(offset) |
| 1042 | 1042 | { |
| 1043 | 1043 | case 0x00: |
| r5932 | r5933 | |
| 1262 | 1262 | |
| 1263 | 1263 | /*static READ16_HANDLER( x68k_mfp_r ) |
| 1264 | 1264 | { |
| 1265 | ||
| 1265 | const device_config *x68k_mfp = devtag_get_device(space->machine, MC68901_TAG); | |
| 1266 | 1266 | |
| 1267 | ||
| 1267 | return mc68901_register_r(x68k_mfp, offset); | |
| 1268 | 1268 | }*/ |
| 1269 | 1269 | |
| 1270 | 1270 | static READ16_HANDLER( x68k_mfp_r ) |
| r5932 | r5933 | |
| 1507 | 1507 | static READ16_HANDLER( x68k_sram_r ) |
| 1508 | 1508 | { |
| 1509 | 1509 | // HACKS! |
| 1510 | // if(offset == 0x5a/2) // 0x5a should be 0 if no SASI HDs are present. | |
| 1511 | // return 0x0000; | |
| 1510 | // if(offset == 0x5a/2) // 0x5a should be 0 if no SASI HDs are present. | |
| 1511 | // return 0x0000; | |
| 1512 | 1512 | if(offset == 0x08/2) |
| 1513 | 1513 | return mess_ram_size >> 16; // RAM size |
| 1514 | 1514 | /*if(offset == 0x46/2) |
| r5932 | r5933 | |
| 1649 | 1649 | then access causes a bus error */ |
| 1650 | 1650 | current_vector[2] = 0x02; // bus error |
| 1651 | 1651 | current_irq_line = 2; |
| 1652 | // | |
| 1652 | // cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]); | |
| 1653 | 1653 | if(input_port_read(space->machine, "options") & 0x02) |
| 1654 | 1654 | { |
| 1655 | 1655 | offset *= 2; |
| r5932 | r5933 | |
| 1666 | 1666 | then access causes a bus error */ |
| 1667 | 1667 | current_vector[2] = 0x02; // bus error |
| 1668 | 1668 | current_irq_line = 2; |
| 1669 | // | |
| 1669 | // cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]); | |
| 1670 | 1670 | if(input_port_read(space->machine, "options") & 0x02) |
| 1671 | 1671 | { |
| 1672 | 1672 | offset *= 2; |
| r5932 | r5933 | |
| 1755 | 1755 | data &= ~(x68k_sys.crtc.vblank << 4); |
| 1756 | 1756 | data |= 0x23; // GPIP5 is unused, always 1 |
| 1757 | 1757 | |
| 1758 | // | |
| 1758 | // mc68901_tai_w(mfp, x68k_sys.crtc.vblank); | |
| 1759 | 1759 | |
| 1760 | 1760 | return data; |
| 1761 | 1761 | } |
| r5932 | r5933 | |
| 1765 | 1765 | static int prev; |
| 1766 | 1766 | if(prev == CLEAR_LINE && state == CLEAR_LINE) // eliminate unnecessary calls to set the IRQ line for speed reasons |
| 1767 | 1767 | return; |
| 1768 | // if((x68k_sys.ioc.irqstatus & 0xc0) != 0) // if the FDC is busy, then we don't want to miss that IRQ | |
| 1769 | // return; | |
| 1768 | // if((x68k_sys.ioc.irqstatus & 0xc0) != 0) // if the FDC is busy, then we don't want to miss that IRQ | |
| 1769 | // return; | |
| 1770 | 1770 | cputag_set_input_line(device->machine, "maincpu", 6, state); |
| 1771 | 1771 | current_vector[6] = 0; |
| 1772 | 1772 | prev = state; |
| r5932 | r5933 | |
| 1802 | 1802 | logerror("SYS: IRQ acknowledged (vector=0x%02x, line = %i)\n",current_vector[6],irqline); |
| 1803 | 1803 | return current_vector[6]; |
| 1804 | 1804 | } |
| 1805 | ||
| 1805 | ||
| 1806 | 1806 | cputag_set_input_line_and_vector(device->machine, "maincpu",irqline,CLEAR_LINE,current_vector[irqline]); |
| 1807 | 1807 | if(irqline == 1) // IOSC |
| 1808 | 1808 | { |
| r5932 | r5933 | |
| 2101 | 2101 | |
| 2102 | 2102 | PORT_START("mouse3") // Y-axis |
| 2103 | 2103 | PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) |
| 2104 | ||
| 2104 | ||
| 2105 | 2105 | // 3-button Megadrive gamepad |
| 2106 | 2106 | PORT_START("md3b") |
| 2107 | 2107 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 1 Up") PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11) |
| r5932 | r5933 | |
| 2139 | 2139 | PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 A Button") PORT_CATEGORY(21) |
| 2140 | 2140 | PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Start Button") PORT_CATEGORY(21) |
| 2141 | 2141 | PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CATEGORY(21) |
| 2142 | ||
| 2142 | ||
| 2143 | 2143 | // 6-button Megadrive gamepad |
| 2144 | 2144 | PORT_START("md6b") |
| 2145 | 2145 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 1 Up") PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(12) |
| r5932 | r5933 | |
| 2231 | 2231 | INPUT_PORTS_END |
| 2232 | 2232 | |
| 2233 | 2233 | static void x68k_load_proc(const device_config *image) |
| 2234 | { | |
| 2234 | { | |
| 2235 | 2235 | if(x68k_sys.ioc.irqstatus & 0x02) |
| 2236 | 2236 | { |
| 2237 | 2237 | current_vector[1] = 0x61; |
| r5932 | r5933 | |
| 2340 | 2340 | floppy_install_unload_proc(floppy_get_device(machine, drive), x68k_unload_proc); |
| 2341 | 2341 | floppy_install_load_proc(floppy_get_device(machine, drive), x68k_load_proc); |
| 2342 | 2342 | } |
| 2343 | ||
| 2343 | ||
| 2344 | 2344 | // reset CPU |
| 2345 | 2345 | device_reset(cputag_get_cpu(machine, "maincpu")); |
| 2346 | 2346 | } |
| r5932 | r5933 | |
| 2409 | 2409 | x68k_vblank_irq = timer_alloc(machine, x68k_crtc_vblank_irq,NULL); |
| 2410 | 2410 | mouse_timer = timer_alloc(machine, x68k_scc_ack,NULL); |
| 2411 | 2411 | led_timer = timer_alloc(machine, x68k_led_callback,NULL); |
| 2412 | ||
| 2412 | ||
| 2413 | 2413 | // Initialise timers for 6-button MD controllers |
| 2414 | 2414 | md_6button_init(machine); |
| 2415 | 2415 | } |
| r5932 | r5933 | |
| 2434 | 2434 | MDRV_X68KHDC_ADD( "x68k_hdc" ) |
| 2435 | 2435 | |
| 2436 | 2436 | MDRV_SCC8530_ADD( "scc" ) |
| 2437 | ||
| 2437 | ||
| 2438 | 2438 | MDRV_RP5C15_ADD( "rp5c15" , rtc_intf) |
| 2439 | 2439 | |
| 2440 | 2440 | /* video hardware */ |
| r5932 | r5933 | |
| 2466 | 2466 | |
| 2467 | 2467 | MDRV_NVRAM_HANDLER( generic_0fill ) |
| 2468 | 2468 | |
| 2469 | MDRV_NEC72065_ADD("nec72065", fdc_interface) | |
| 2470 | MDRV_FLOPPY_4_DRIVES_ADD(x68k_floppy_config) | |
| 2469 | MDRV_NEC72065_ADD("nec72065", fdc_interface) | |
| 2470 | MDRV_FLOPPY_4_DRIVES_ADD(x68k_floppy_config) | |
| 2471 | 2471 | MACHINE_DRIVER_END |
| 2472 | 2472 | |
| 2473 | 2473 | static SYSTEM_CONFIG_START(x68000) |
| r5932 | r5933 | |
|---|---|---|
| 23 | 23 | |
| 24 | 24 | /* |
| 25 | 25 | APEXC RAM loading/saving from cylinder image |
| 26 | ||
| 26 | ||
| 27 | 27 | Note that, in an actual APEXC, the RAM contents are not read from the cylinder : |
| 28 | 28 | the cylinder IS the RAM. |
| 29 | 29 |
| r5932 | r5933 | |
|---|---|---|
| 61 | 61 | PORT_START("LINE4") |
| 62 | 62 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) |
| 63 | 63 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0-9") PORT_CODE(KEYCODE_RALT) |
| 64 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CS") PORT_CODE(KEYCODE_LALT) | |
| 64 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CS") PORT_CODE(KEYCODE_LALT) | |
| 65 | 65 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) |
| 66 | 66 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UpCase") PORT_CODE(KEYCODE_LSHIFT) |
| 67 | 67 | PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) |
| r5932 | r5933 | |
| 100 | 100 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(1) |
| 101 | 101 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT)PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) |
| 102 | 102 | PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED) |
| 103 | PORT_START("NMI") | |
| 104 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_ESC) | |
| 103 | PORT_START("NMI") | |
| 104 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NMI") PORT_CODE(KEYCODE_ESC) | |
| 105 | 105 | INPUT_PORTS_END |
| 106 | 106 | |
| 107 | 107 | static INTERRUPT_GEN( ondra_interrupt ) |
| r5932 | r5933 | |
| 123 | 123 | MDRV_CPU_PROGRAM_MAP(ondra_mem) |
| 124 | 124 | MDRV_CPU_IO_MAP(ondra_io) |
| 125 | 125 | MDRV_CPU_VBLANK_INT("screen", ondra_interrupt) |
| 126 | ||
| 126 | ||
| 127 | 127 | MDRV_MACHINE_START( ondra ) |
| 128 | 128 | MDRV_MACHINE_RESET( ondra ) |
| 129 | 129 | |
| r5932 | r5933 | |
| 139 | 139 | |
| 140 | 140 | MDRV_VIDEO_START(ondra) |
| 141 | 141 | MDRV_VIDEO_UPDATE(ondra) |
| 142 | ||
| 143 | // sound hardware | |
| 142 | ||
| 143 | // sound hardware | |
| 144 | 144 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 145 | 145 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 146 | 146 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 147 | ||
| 148 | MDRV_CASSETTE_ADD( "cassette", ondra_cassette_config ) | |
| 147 | ||
| 148 | MDRV_CASSETTE_ADD( "cassette", ondra_cassette_config ) | |
| 149 | 149 | MACHINE_DRIVER_END |
| 150 | 150 | |
| 151 | 151 | static SYSTEM_CONFIG_START(ondra) |
| r5932 | r5933 | |
| 180 | 180 | |
| 181 | 181 | /* Driver */ |
| 182 | 182 | |
| 183 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME | |
| 183 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 184 | 184 | COMP( 1989, ondrat, 0, 0, ondra, ondra, ondra, ondra, "Tesla", "Ondra", 0) |
| 185 | 185 | COMP( 1989, ondrav, ondrat, 0, ondra, ondra, ondra, ondra, "ViLi", "Ondra ViLi", 0) |
| 186 | 186 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /************************************************************************************************* |
| 2 | 2 | |
| 3 | 3 | |
| 4 | Kaypro 2/83 computer - the very first Kaypro II - 2 full size floppy drives. | |
| 5 | Each disk was single sided, and could hold 191k. The computer had 2x pio | |
| 6 | and 1x sio. One of the sio ports communicated with the keyboard with a coiled | |
| 7 | telephone cord, complete with modular plug on each end. The keyboard carries | |
| 8 | its own Intel 8748 processor and is an intelligent device. | |
| 4 | Kaypro 2/83 computer - the very first Kaypro II - 2 full size floppy drives. | |
| 5 | Each disk was single sided, and could hold 191k. The computer had 2x pio | |
| 6 | and 1x sio. One of the sio ports communicated with the keyboard with a coiled | |
| 7 | telephone cord, complete with modular plug on each end. The keyboard carries | |
| 8 | its own Intel 8748 processor and is an intelligent device. | |
| 9 | 9 | |
| 10 | ||
| 10 | There are 2 major problems preventing this driver from working | |
| 11 | 11 | |
| 12 | ||
| 12 | - MESS is not capable of conducting realtime serial communications between devices | |
| 13 | 13 | |
| 14 | - MAME's z80sio implementation is lacking important deatures: | |
| 15 | -- cannot change baud rate on the fly | |
| 16 | -- cannot specify different rates for each channel | |
| 17 | -- cannot specify different rates for Receive and Transmit | |
| 18 | -- the callback doesn't appear to support channel B ?? | |
| 14 | - MAME's z80sio implementation is lacking important deatures: | |
| 15 | -- cannot change baud rate on the fly | |
| 16 | -- cannot specify different rates for each channel | |
| 17 | -- cannot specify different rates for Receive and Transmit | |
| 18 | -- the callback doesn't appear to support channel B ?? | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | ||
| 21 | Things that need doing: | |
| 22 | 22 | |
| 23 | - Need schematics of 2x and kaypro10 (used 2-84 which doesn't seem to be the same). | |
| 24 | They currently are not reading any data from disk. | |
| 23 | - Need schematics of 2x and kaypro10 (used 2-84 which doesn't seem to be the same). | |
| 24 | They currently are not reading any data from disk. | |
| 25 | 25 | |
| 26 | - omni2 and kaypro4 would (I believe) boot up if we had a proper boot disk. The IMD | |
| 27 | conversions seem to have the tracks scrambled (e.g reading side 0 track 1 gives us | |
| 28 | side 1 track 0). | |
| 26 | - omni2 and kaypro4 would (I believe) boot up if we had a proper boot disk. The IMD | |
| 27 | conversions seem to have the tracks scrambled (e.g reading side 0 track 1 gives us | |
| 28 | side 1 track 0). | |
| 29 | 29 | |
| 30 | - Kaypro2x and Kaypro10 don't centre the display at boot, but a soft reset fixes it. | |
| 31 | Perhaps the guesswork emulation of the video ULA is incomplete. | |
| 30 | - Kaypro2x and Kaypro10 don't centre the display at boot, but a soft reset fixes it. | |
| 31 | Perhaps the guesswork emulation of the video ULA is incomplete. | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | **************************************************************************************************/ |
| r5932 | r5933 | |
| 49 | 49 | |
| 50 | 50 | /*********************************************************** |
| 51 | 51 | |
| 52 | ||
| 52 | Address Maps | |
| 53 | 53 | |
| 54 | 54 | ************************************************************/ |
| 55 | 55 | |
| r5932 | r5933 | |
| 85 | 85 | AM_RANGE(0x1f, 0x1f) AM_READWRITE(kaypro2x_videoram_r,kaypro2x_videoram_w) |
| 86 | 86 | |
| 87 | 87 | /* The below are not emulated */ |
| 88 | /* AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80pio", kaypro2x_pio_r, kaypro2x_pio_w) - for RTC and Modem | |
| 89 | AM_RANGE(0x24, 0x27) communicate with MM58167A RTC. Modem uses TMS99531 and TMS99532 chips. | |
| 90 | AM_RANGE(0x80, 0x80) Hard drive controller card I/O port - 10MB hard drive only fitted to the Kaypro 10 | |
| 91 | AM_RANGE(0x81, 0x81) Hard Drive READ error register, WRITE precomp | |
| 92 | AM_RANGE(0x82, 0x82) Hard Drive Sector register count I/O | |
| 93 | AM_RANGE(0x83, 0x83) Hard Drive Sector register number I/O | |
| 94 | AM_RANGE(0x84, 0x84) Hard Drive Cylinder low register I/O | |
| 95 | AM_RANGE(0x85, 0x85) Hard Drive Cylinder high register I/O | |
| 96 | AM_RANGE(0x86, 0x86) Hard Drive Size / Drive / Head register I/O | |
| 97 | AM_RANGE(0x87, 0x87) Hard Drive READ status register, WRITE command register */ | |
| 88 | /* AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80pio", kaypro2x_pio_r, kaypro2x_pio_w) - for RTC and Modem | |
| 89 | AM_RANGE(0x24, 0x27) communicate with MM58167A RTC. Modem uses TMS99531 and TMS99532 chips. | |
| 90 | AM_RANGE(0x80, 0x80) Hard drive controller card I/O port - 10MB hard drive only fitted to the Kaypro 10 | |
| 91 | AM_RANGE(0x81, 0x81) Hard Drive READ error register, WRITE precomp | |
| 92 | AM_RANGE(0x82, 0x82) Hard Drive Sector register count I/O | |
| 93 | AM_RANGE(0x83, 0x83) Hard Drive Sector register number I/O | |
| 94 | AM_RANGE(0x84, 0x84) Hard Drive Cylinder low register I/O | |
| 95 | AM_RANGE(0x85, 0x85) Hard Drive Cylinder high register I/O | |
| 96 | AM_RANGE(0x86, 0x86) Hard Drive Size / Drive / Head register I/O | |
| 97 | AM_RANGE(0x87, 0x87) Hard Drive READ status register, WRITE command register */ | |
| 98 | 98 | AM_RANGE(0x20, 0x87) AM_NOP |
| 99 | 99 | ADDRESS_MAP_END |
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | /*************************************************************** |
| 103 | 103 | |
| 104 | ||
| 104 | Interfaces | |
| 105 | 105 | |
| 106 | 106 | ****************************************************************/ |
| 107 | 107 | |
| r5932 | r5933 | |
| 136 | 136 | |
| 137 | 137 | /*********************************************************** |
| 138 | 138 | |
| 139 | ||
| 139 | Machine Driver | |
| 140 | 140 | |
| 141 | 141 | ************************************************************/ |
| 142 | 142 | static FLOPPY_OPTIONS_START(kayproii) |
| r5932 | r5933 | |
| 205 | 205 | MDRV_Z80PIO_ADD( "z80pio_g", kayproii_pio_g_intf ) |
| 206 | 206 | MDRV_Z80PIO_ADD( "z80pio_s", kayproii_pio_s_intf ) |
| 207 | 207 | MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro_sio_intf ) /* start at 300 baud */ |
| 208 | ||
| 208 | ||
| 209 | 209 | MDRV_FLOPPY_2_DRIVES_ADD(kayproii_floppy_config) |
| 210 | 210 | MACHINE_DRIVER_END |
| 211 | 211 | |
| r5932 | r5933 | |
| 245 | 245 | MDRV_CENTRONICS_ADD("centronics", standard_centronics) |
| 246 | 246 | MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro_sio_intf ) |
| 247 | 247 | MDRV_Z80SIO_ADD( "z80sio_2x", 4800, kaypro_sio_intf ) /* extra sio for modem and printer */ |
| 248 | ||
| 248 | ||
| 249 | 249 | MDRV_FLOPPY_2_DRIVES_ADD(kaypro2x_floppy_config) |
| 250 | 250 | MACHINE_DRIVER_END |
| 251 | 251 | |
| r5932 | r5933 | |
| 256 | 256 | |
| 257 | 257 | /*********************************************************** |
| 258 | 258 | |
| 259 | ||
| 259 | Game driver | |
| 260 | 260 | |
| 261 | 261 | ************************************************************/ |
| 262 | 262 | |
| r5932 | r5933 | |
| 343 | 343 | ROM_LOAD("81-817.u31", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) ) |
| 344 | 344 | ROM_END |
| 345 | 345 | |
| 346 | /* YEAR NAME PARENT COMPAT MACHINE | |
| 346 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 347 | 347 | COMP( 1982, kayproii, 0, 0, kayproii, kay_kbd, 0, 0, "Non Linear Systems", "Kaypro II - 2/83" , 0 ) |
| 348 | COMP( 1983, kaypro4, kayproii, 0, kayproii, kay_kbd, 0, 0, "Non Linear Systems", "Kaypro 4 - 4/83" , GAME_NOT_WORKING ) // model 81-004 | |
| 348 | COMP( 1983, kaypro4, kayproii, 0, kayproii, kay_kbd, 0, 0, "Non Linear Systems", "Kaypro 4 - 4/83" , GAME_NOT_WORKING ) // model 81-004 | |
| 349 | 349 | COMP( 1983, kaypro4p88, kayproii, 0, kayproii, kay_kbd, 0, 0, "Non Linear Systems", "Kaypro 4 plus88 - 4/83" , GAME_NOT_WORKING ) // model 81-004 with an added 8088 daughterboard and rom |
| 350 | 350 | COMP( 198?, omni2, kayproii, 0, omni2, kay_kbd, 0, 0, "Non Linear Systems", "Omni II" , GAME_NOT_WORKING ) |
| 351 | 351 | COMP( 1984, kaypro2x, 0, 0, kaypro2x, kay_kbd, 0, 0, "Non Linear Systems", "Kaypro 2x" , GAME_NOT_WORKING ) // model 81-025 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | A51xx |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 12 | 12 | static ADDRESS_MAP_START(a5120_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 13 | 13 | ADDRESS_MAP_UNMAP_HIGH |
| 14 | 14 | AM_RANGE( 0x0000, 0x03ff ) AM_ROM |
| 15 | AM_RANGE( 0x0400, 0xffff ) AM_RAM | |
| 15 | AM_RANGE( 0x0400, 0xffff ) AM_RAM | |
| 16 | 16 | ADDRESS_MAP_END |
| 17 | 17 | |
| 18 | 18 | static ADDRESS_MAP_START( a5120_io , ADDRESS_SPACE_IO, 8) |
| r5932 | r5933 | |
| 22 | 22 | static ADDRESS_MAP_START(a5130_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 23 | 23 | ADDRESS_MAP_UNMAP_HIGH |
| 24 | 24 | AM_RANGE( 0x0000, 0x0fff ) AM_ROM |
| 25 | AM_RANGE( 0x1000, 0xffff ) AM_RAM | |
| 25 | AM_RANGE( 0x1000, 0xffff ) AM_RAM | |
| 26 | 26 | ADDRESS_MAP_END |
| 27 | 27 | |
| 28 | 28 | static ADDRESS_MAP_START( a5130_io , ADDRESS_SPACE_IO, 8) |
| r5932 | r5933 | |
| 35 | 35 | INPUT_PORTS_END |
| 36 | 36 | |
| 37 | 37 | |
| 38 | static MACHINE_RESET(a5120) | |
| 39 | { | |
| 38 | static MACHINE_RESET(a5120) | |
| 39 | { | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | static VIDEO_START( a5120 ) |
| r5932 | r5933 | |
| 54 | 54 | INPUT_PORTS_END |
| 55 | 55 | |
| 56 | 56 | |
| 57 | static MACHINE_RESET(a5130) | |
| 58 | { | |
| 57 | static MACHINE_RESET(a5130) | |
| 58 | { | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | static VIDEO_START( a5130 ) |
| r5932 | r5933 | |
| 73 | 73 | /* basic machine hardware */ |
| 74 | 74 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 75 | 75 | MDRV_CPU_PROGRAM_MAP(a5120_mem) |
| 76 | MDRV_CPU_IO_MAP(a5120_io) | |
| 76 | MDRV_CPU_IO_MAP(a5120_io) | |
| 77 | 77 | |
| 78 | 78 | MDRV_MACHINE_RESET(a5120) |
| 79 | ||
| 79 | ||
| 80 | 80 | /* video hardware */ |
| 81 | 81 | MDRV_SCREEN_ADD("screen", RASTER) |
| 82 | 82 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 95 | 95 | /* basic machine hardware */ |
| 96 | 96 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| 97 | 97 | MDRV_CPU_PROGRAM_MAP(a5130_mem) |
| 98 | MDRV_CPU_IO_MAP(a5130_io) | |
| 98 | MDRV_CPU_IO_MAP(a5130_io) | |
| 99 | 99 | |
| 100 | 100 | MDRV_MACHINE_RESET(a5130) |
| 101 | ||
| 101 | ||
| 102 | 102 | /* video hardware */ |
| 103 | 103 | MDRV_SCREEN_ADD("screen", RASTER) |
| 104 | 104 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
|---|---|---|
| 32 | 32 | /**************************** MEMORY AND I/O MAPPINGS *****************************************************************/ |
| 33 | 33 | |
| 34 | 34 | /* A read_byte or write_byte to unmapped memory crashes MESS, and UNMAP doesnt fix it. |
| 35 | ||
| 35 | This makes the H and E monitor commands show FF */ | |
| 36 | 36 | static READ8_HANDLER( super80_read_ff ) { return 0xff; } |
| 37 | 37 | |
| 38 | 38 | static ADDRESS_MAP_START( super80_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r5932 | r5933 | |
|---|---|---|
| 216 | 216 | #include "machine/smartmed.h" |
| 217 | 217 | #include "devices/harddriv.h" |
| 218 | 218 | #include "machine/idectrl.h" |
| 219 | #include "machine/smc92x4.h" | |
| 219 | #include "machine/smc92x4.h" | |
| 220 | 220 | #include "machine/mm58274c.h" |
| 221 | 221 | |
| 222 | 222 | |
| r5932 | r5933 | |
| 448 | 448 | |
| 449 | 449 | static const mm58274c_interface geneve_mm58274c_interface = |
| 450 | 450 | { |
| 451 | 1, /* | |
| 451 | 1, /* mode 24*/ | |
| 452 | 452 | 0 /* first day of week */ |
| 453 | 453 | }; |
| 454 | 454 | |
| 455 | 455 | |
| 456 | 456 | static const mm58274c_interface floppy_mm58274c_interface = |
| 457 | 457 | { |
| 458 | 1, /* | |
| 458 | 1, /* mode 24*/ | |
| 459 | 459 | 0 /* first day of week */ |
| 460 | 460 | }; |
| 461 | 461 | |
| r5932 | r5933 | |
| 505 | 505 | MDRV_IMPORT_FROM( smc92x4_hd ) |
| 506 | 506 | |
| 507 | 507 | MDRV_IDE_HARDDISK_ADD( "ide_harddisk" ) |
| 508 | ||
| 508 | ||
| 509 | 509 | /* rtc */ |
| 510 | 510 | MDRV_MM58274C_ADD("mm58274c", geneve_mm58274c_interface) |
| 511 | 511 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) |
| 512 | ||
| 512 | ||
| 513 | 513 | /* tms9901 */ |
| 514 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99) | |
| 515 | ||
| 514 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99) | |
| 515 | ||
| 516 | 516 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) |
| 517 | ||
| 517 | ||
| 518 | 518 | MDRV_FLOPPY_4_DRIVES_ADD(geneve_floppy_config) |
| 519 | ||
| 519 | ||
| 520 | 520 | MDRV_SMARTMEDIA_ADD("smartmedia") |
| 521 | ||
| 521 | ||
| 522 | 522 | MDRV_TI99_4_RS232_CARD_ADD("rs232") |
| 523 | 523 | MACHINE_DRIVER_END |
| 524 | 524 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Beta Computer |
| 4 | 4 | |
| 5 | ||
| 5 | http://retro.hansotten.nl/index.php?page=beta-computer | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | /* |
| 10 | 10 | |
| 11 | ||
| 11 | TODO: | |
| 12 | 12 | |
| 13 | - write EPROM back to file | |
| 14 | - fix display flickering | |
| 13 | - write EPROM back to file | |
| 14 | - fix display flickering | |
| 15 | 15 | |
| 16 | 16 | */ |
| 17 | 17 | |
| r5932 | r5933 | |
| 45 | 45 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 46 | 46 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 47 | 47 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) |
| 48 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 49 | ||
| 48 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 49 | ||
| 50 | 50 | PORT_START("Q7") |
| 51 | 51 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 52 | 52 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 53 | 53 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 54 | 54 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 55 | 55 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 56 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 57 | ||
| 56 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 57 | ||
| 58 | 58 | PORT_START("Q8") |
| 59 | 59 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 60 | 60 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 61 | 61 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 62 | 62 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 63 | 63 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DA") PORT_CODE(KEYCODE_F2) |
| 64 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 65 | ||
| 64 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 65 | ||
| 66 | 66 | PORT_START("Q9") |
| 67 | 67 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 68 | 68 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 69 | 69 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 70 | 70 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 71 | 71 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("AD") PORT_CODE(KEYCODE_F1) |
| 72 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 72 | PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 73 | 73 | |
| 74 | 74 | PORT_START("SPECIAL") |
| 75 | 75 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_R) PORT_CHANGED(trigger_reset, 0) |
| r5932 | r5933 | |
| 90 | 90 | { |
| 91 | 91 | /* |
| 92 | 92 | |
| 93 | ||
| 93 | bit description | |
| 94 | 94 | |
| 95 | PA0 2716 D0, segment D, key bit 0 | |
| 96 | PA1 2716 D1, segment E, key bit 1 | |
| 97 | PA2 2716 D2, segment C, key bit 2 | |
| 98 | PA3 2716 D3, segment G, key bit 3 | |
| 99 | PA4 2716 D4, segment F, key bit 4 | |
| 100 | PA5 2716 D5, segment B | |
| 101 | PA6 2716 D6, segment A | |
| 102 | PA7 2716 D7 | |
| 95 | PA0 2716 D0, segment D, key bit 0 | |
| 96 | PA1 2716 D1, segment E, key bit 1 | |
| 97 | PA2 2716 D2, segment C, key bit 2 | |
| 98 | PA3 2716 D3, segment G, key bit 3 | |
| 99 | PA4 2716 D4, segment F, key bit 4 | |
| 100 | PA5 2716 D5, segment B | |
| 101 | PA6 2716 D6, segment A | |
| 102 | PA7 2716 D7 | |
| 103 | 103 | |
| 104 | ||
| 104 | */ | |
| 105 | 105 | |
| 106 | 106 | beta_state *state = device->machine->driver_data; |
| 107 | 107 | |
| r5932 | r5933 | |
| 113 | 113 | case 7: data &= input_port_read(device->machine, "Q7"); break; |
| 114 | 114 | case 8: data &= input_port_read(device->machine, "Q8"); break; |
| 115 | 115 | case 9: data &= input_port_read(device->machine, "Q9"); break; |
| 116 | default: | |
| 117 | if (!state->eprom_oe && !state->eprom_ce) | |
| 116 | default: | |
| 117 | if (!state->eprom_oe && !state->eprom_ce) | |
| 118 | 118 | { |
| 119 | 119 | data = memory_region(device->machine, EPROM_TAG)[state->eprom_addr & 0x7ff]; |
| 120 | 120 | popmessage("EPROM read %04x = %02x\n", state->eprom_addr & 0x7ff, data); |
| r5932 | r5933 | |
| 128 | 128 | { |
| 129 | 129 | /* |
| 130 | 130 | |
| 131 | ||
| 131 | bit description | |
| 132 | 132 | |
| 133 | PA0 2716 D0, segment D, key bit 0 | |
| 134 | PA1 2716 D1, segment E, key bit 1 | |
| 135 | PA2 2716 D2, segment C, key bit 2 | |
| 136 | PA3 2716 D3, segment G, key bit 3 | |
| 137 | PA4 2716 D4, segment F, key bit 4 | |
| 138 | PA5 2716 D5, segment B | |
| 139 | PA6 2716 D6, segment A | |
| 140 | PA7 2716 D7 | |
| 133 | PA0 2716 D0, segment D, key bit 0 | |
| 134 | PA1 2716 D1, segment E, key bit 1 | |
| 135 | PA2 2716 D2, segment C, key bit 2 | |
| 136 | PA3 2716 D3, segment G, key bit 3 | |
| 137 | PA4 2716 D4, segment F, key bit 4 | |
| 138 | PA5 2716 D5, segment B | |
| 139 | PA6 2716 D6, segment A | |
| 140 | PA7 2716 D7 | |
| 141 | 141 | |
| 142 | ||
| 142 | */ | |
| 143 | 143 | |
| 144 | 144 | beta_state *state = device->machine->driver_data; |
| 145 | 145 | |
| 146 | // | |
| 146 | // logerror("PA %02x\n", data); | |
| 147 | 147 | |
| 148 | 148 | /* display */ |
| 149 | 149 | state->segment = BITSWAP8(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f; |
| r5932 | r5933 | |
| 162 | 162 | { |
| 163 | 163 | /* |
| 164 | 164 | |
| 165 | ||
| 165 | bit description | |
| 166 | 166 | |
| 167 | PB0 74LS145 P0 | |
| 168 | PB1 74LS145 P1 | |
| 169 | PB2 74LS145 P2 | |
| 170 | PB3 74LS145 P3, 74LS164 D | |
| 171 | PB4 loudspeaker, data led | |
| 172 | PB5 address led, 74LS164 CP | |
| 173 | PB6 2716 _OE | |
| 174 | PB7 2716 _CE | |
| 167 | PB0 74LS145 P0 | |
| 168 | PB1 74LS145 P1 | |
| 169 | PB2 74LS145 P2 | |
| 170 | PB3 74LS145 P3, 74LS164 D | |
| 171 | PB4 loudspeaker, data led | |
| 172 | PB5 address led, 74LS164 CP | |
| 173 | PB6 2716 _OE | |
| 174 | PB7 2716 _CE | |
| 175 | 175 | |
| 176 | ||
| 176 | */ | |
| 177 | 177 | |
| 178 | 178 | beta_state *state = device->machine->driver_data; |
| 179 | 179 | |
| r5932 | r5933 | |
| 238 | 238 | |
| 239 | 239 | /* Machine Initialization */ |
| 240 | 240 | |
| 241 | static MACHINE_START( beta ) | |
| 241 | static MACHINE_START( beta ) | |
| 242 | 242 | { |
| 243 | 243 | beta_state *state = machine->driver_data; |
| 244 | 244 | |
| r5932 | r5933 | |
| 265 | 265 | MDRV_CPU_PROGRAM_MAP(beta_mem) |
| 266 | 266 | |
| 267 | 267 | MDRV_MACHINE_START(beta) |
| 268 | ||
| 268 | ||
| 269 | 269 | /* video hardware */ |
| 270 | 270 | MDRV_DEFAULT_LAYOUT( layout_beta ) |
| 271 | 271 | |
| r5932 | r5933 | |
| 275 | 275 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 276 | 276 | |
| 277 | 277 | /* devices */ |
| 278 | MDRV_RIOT6532_ADD(M6532_TAG, XTAL_4MHz/4, beta_riot_interface) | |
| 278 | MDRV_RIOT6532_ADD(M6532_TAG, XTAL_4MHz/4, beta_riot_interface) | |
| 279 | 279 | |
| 280 | 280 | /* EPROM socket */ |
| 281 | 281 | MDRV_CARTSLOT_ADD(EPROM_TAG) |
| r5932 | r5933 | |
| 302 | 302 | |
| 303 | 303 | /* System Drivers */ |
| 304 | 304 | |
| 305 | /* YEAR | |
| 305 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 306 | 306 | COMP( 1984, beta, 0, 0, beta, beta, 0, beta, "Pitronics", "Beta", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | Epson PX-4 |
| 4 | 4 | |
| 5 | Note: We are missing a dump of the slave 7508 CPU that controls | |
| 6 | the keyboard and some other things. | |
| 5 | Note: We are missing a dump of the slave 7508 CPU that controls | |
| 6 | the keyboard and some other things. | |
| 7 | 7 | |
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 |
| r5932 | r5933 | |
|---|---|---|
| 71 | 71 | Interestingly the data on cassette is stored in xmodem-checksum. |
| 72 | 72 | |
| 73 | 73 | |
| 74 | Due to bugs in the hardware and software of a real Sorcerer, the serial | |
| 75 | interface misbehaves. | |
| 76 | 1. Sorcerer I had a hardware problem causing rs232 idle to be a space (+9v) | |
| 77 | instead of mark (-9v). Fixed in Sorcerer II. | |
| 78 | 2. When you select a different baud for rs232, it was "remembered" but not | |
| 79 | sent to port fe. It only gets sent when motor on was requested. Motor on is | |
| 80 | only meaningful in a cassette operation. | |
| 81 | 3. The monitor software always resets the device to cassette whenever the | |
| 82 | keyboard is scanned, motors altered, or an error occurred. | |
| 83 | 4. The above problems make rs232 communication impractical unless you write | |
| 84 | your own routines or create a corrected monitor rom. | |
| 74 | Due to bugs in the hardware and software of a real Sorcerer, the serial | |
| 75 | interface misbehaves. | |
| 76 | 1. Sorcerer I had a hardware problem causing rs232 idle to be a space (+9v) | |
| 77 | instead of mark (-9v). Fixed in Sorcerer II. | |
| 78 | 2. When you select a different baud for rs232, it was "remembered" but not | |
| 79 | sent to port fe. It only gets sent when motor on was requested. Motor on is | |
| 80 | only meaningful in a cassette operation. | |
| 81 | 3. The monitor software always resets the device to cassette whenever the | |
| 82 | keyboard is scanned, motors altered, or an error occurred. | |
| 83 | 4. The above problems make rs232 communication impractical unless you write | |
| 84 | your own routines or create a corrected monitor rom. | |
| 85 | 85 | |
| 86 | 86 | Sound: |
| 87 | 87 | |
| r5932 | r5933 | |
| 403 | 403 | MDRV_CARTSLOT_ADD("cart") |
| 404 | 404 | MDRV_CARTSLOT_EXTENSION_LIST("rom") |
| 405 | 405 | MDRV_CARTSLOT_NOT_MANDATORY |
| 406 | ||
| 406 | ||
| 407 | 407 | MDRV_FLOPPY_4_DRIVES_ADD(exidy_floppy_config) |
| 408 | 408 | MACHINE_DRIVER_END |
| 409 | 409 | |
| r5932 | r5933 | |
| 415 | 415 | |
| 416 | 416 | MDRV_MACHINE_START( exidy ) |
| 417 | 417 | MDRV_MACHINE_RESET( exidy ) |
| 418 | ||
| 418 | ||
| 419 | 419 | MDRV_FLOPPY_4_DRIVES_REMOVE() |
| 420 | 420 | MACHINE_DRIVER_END |
| 421 | 421 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /***************************************************************************************************** |
| 2 | 2 | |
| 3 | NEC PC-8801 MESS Emulation | |
| 4 | ||
| 5 | PC-88xx Models (and similar machines like PC-80xx and PC-98DO) | |
| 3 | NEC PC-8801 MESS Emulation | |
| 6 | 4 | |
| 7 | Model | release | CPU | BIOS components | | | |
| 8 | | | clock | N-BASIC | N88-BASIC | N88-BASIC Enh | Sound | CD | Dict | Disk | Notes | |
| 9 | ================================================================================================================================== | |
| 10 | PC-8001 | 1979-03 | z80A @ 4 | X | - | - | - | - | - | - | | |
| 11 | PC-8001A | ?? | z80A @ 4 | X | - | - | - | - | - | - | (U) | |
| 12 | PC-8801 | 1981-11 | z80A @ 4 | X | X | - | - | - | - | - | (KO) | |
| 13 | PC-8801A | ?? | z80A @ 4 | X | X | - | - | - | - | - | (U) | |
| 14 | PC-8001 mkII | 1983-03 | z80A @ 4 | X | - | - | - | - | - | - | (GE),(KO) | |
| 15 | PC-8001 mkIIA | ?? | z80A @ 4 | X | - | - | - | - | - | - | (U),(GE) | |
| 16 | PC-8801 mkII | 1983-11 | z80A @ 4 | X | X | - | - | - | - | (FDM) | (K1) | |
| 17 | PC-8001 mkII SR | 1985-01 | z80A @ 4 | X | - | - | - | - | - | - | (GE),(NE),(KO) | |
| 18 | PC-8801 mkII SR | 1985-03 | z80A @ 4 | X | X | X | X | - | - | (FDM) | (K1) | |
| 19 | PC-8801 mkII TR | 1985-10 | z80A @ 4 | X | X | X | X | - | - | (FD2) | (K1) | |
| 20 | PC-8801 mkII FR | 1985-11 | z80A @ 4 | X | X | X | X | - | - | (FDM) | (K1) | |
| 21 | PC-8801 mkII MR | 1985-11 | z80A @ 4 | X | X | X | X | - | - | (FDH) | (K2) | |
| 22 | PC-8801 FH | 1986-11 | z80H @ 4/8 | X | X | X | X | - | - | (FDM) | (K2) | |
| 23 | PC-8801 MH | 1986-11 | z80H @ 4/8 | X | X | X | X | - | - | (FDH) | (K2) | |
| 24 | PC-88 VA | 1987-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FDH) | (K2) | |
| 25 | PC-8801 FA | 1987-11 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) | |
| 26 | PC-8801 MA | 1987-11 | z80H @ 4/8 | X | X | X | X | - | X | (FDH) | (K2) | |
| 27 | PC-88 VA2 | 1988-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FDH) | (K2) | |
| 28 | PC-88 VA3 | 1988-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FD3) | (K2) | |
| 29 | PC-8801 FE | 1988-10 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) | |
| 30 | PC-8801 MA2 | 1988-10 | z80H @ 4/8 | X | X | X | X | - | X | (FDH) | (K2) | |
| 31 | PC-98 DO | 1989-06 | z80H @ 8 | X | X | X | X | - | - | (FDH) | (KE) | |
| 32 | PC-8801 FE2 | 1989-10 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) | |
| 33 | PC-8801 MC | 1989-11 | z80H @ 4/8 | X | X | X | X | X | X | (FDH) | (K2) | |
| 34 | PC-98 DO+ | 1990-10 | z80H @ 8 | X | X | X | X | - | - | (FDH) | (KE) | |
| 5 | PC-88xx Models (and similar machines like PC-80xx and PC-98DO) | |
| 35 | 6 | |
| 36 | info for PC-98 DO & DO+ refers to their 88-mode | |
| 37 | ||
| 38 | Disk Drive options: | |
| 39 | (FDM): there exist three model of this computer: Model 10 (base model, only optional floppy drive), Model 20 | |
| 40 | (1 floppy drive for 5.25" 2D disks) and Model 30 (2 floppy drive for 5.25" 2D disks) | |
| 41 | (FD2): 2 floppy drive for 5.25" 2D disks | |
| 42 | (FDH): 2 floppy drive for both 5.25" 2D disks and 5.25" HD disks | |
| 43 | (FD3): 2 floppy drive for both 5.25" 2D disks and 5.25" HD disks + 1 floppy drive for 3.5" 2TD disks | |
| 7 | Model | release | CPU | BIOS components | | | |
| 8 | | | clock | N-BASIC | N88-BASIC | N88-BASIC Enh | Sound | CD | Dict | Disk | Notes | |
| 9 | ================================================================================================================================== | |
| 10 | PC-8001 | 1979-03 | z80A @ 4 | X | - | - | - | - | - | - | | |
| 11 | PC-8001A | ?? | z80A @ 4 | X | - | - | - | - | - | - | (U) | |
| 12 | PC-8801 | 1981-11 | z80A @ 4 | X | X | - | - | - | - | - | (KO) | |
| 13 | PC-8801A | ?? | z80A @ 4 | X | X | - | - | - | - | - | (U) | |
| 14 | PC-8001 mkII | 1983-03 | z80A @ 4 | X | - | - | - | - | - | - | (GE),(KO) | |
| 15 | PC-8001 mkIIA | ?? | z80A @ 4 | X | - | - | - | - | - | - | (U),(GE) | |
| 16 | PC-8801 mkII | 1983-11 | z80A @ 4 | X | X | - | - | - | - | (FDM) | (K1) | |
| 17 | PC-8001 mkII SR | 1985-01 | z80A @ 4 | X | - | - | - | - | - | - | (GE),(NE),(KO) | |
| 18 | PC-8801 mkII SR | 1985-03 | z80A @ 4 | X | X | X | X | - | - | (FDM) | (K1) | |
| 19 | PC-8801 mkII TR | 1985-10 | z80A @ 4 | X | X | X | X | - | - | (FD2) | (K1) | |
| 20 | PC-8801 mkII FR | 1985-11 | z80A @ 4 | X | X | X | X | - | - | (FDM) | (K1) | |
| 21 | PC-8801 mkII MR | 1985-11 | z80A @ 4 | X | X | X | X | - | - | (FDH) | (K2) | |
| 22 | PC-8801 FH | 1986-11 | z80H @ 4/8 | X | X | X | X | - | - | (FDM) | (K2) | |
| 23 | PC-8801 MH | 1986-11 | z80H @ 4/8 | X | X | X | X | - | - | (FDH) | (K2) | |
| 24 | PC-88 VA | 1987-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FDH) | (K2) | |
| 25 | PC-8801 FA | 1987-11 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) | |
| 26 | PC-8801 MA | 1987-11 | z80H @ 4/8 | X | X | X | X | - | X | (FDH) | (K2) | |
| 27 | PC-88 VA2 | 1988-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FDH) | (K2) | |
| 28 | PC-88 VA3 | 1988-03 | z80H+v30 @ 8 | - | X | X | X | - | X | (FD3) | (K2) | |
| 29 | PC-8801 FE | 1988-10 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) | |
| 30 | PC-8801 MA2 | 1988-10 | z80H @ 4/8 | X | X | X | X | - | X | (FDH) | (K2) | |
| 31 | PC-98 DO | 1989-06 | z80H @ 8 | X | X | X | X | - | - | (FDH) | (KE) | |
| 32 | PC-8801 FE2 | 1989-10 | z80H @ 4/8 | X | X | X | X | - | - | (FD2) | (K2) | |
| 33 | PC-8801 MC | 1989-11 | z80H @ 4/8 | X | X | X | X | X | X | (FDH) | (K2) | |
| 34 | PC-98 DO+ | 1990-10 | z80H @ 8 | X | X | X | X | - | - | (FDH) | (KE) | |
| 44 | 35 | |
| 45 | Notes: | |
| 46 | (U): US version | |
| 47 | (GE): Graphic Expansion for PC-8001 | |
| 48 | (NE): N-BASIC Expansion for PC-8001 (similar to N88-BASIC Expansion for PC-88xx) | |
| 49 | (KO): Optional Kanji ROM | |
| 50 | (K1): Kanji 1st Level ROM | |
| 51 | (K2): Kanji 2nd Level ROM | |
| 52 | (KE): Kanji Enhanced ROM | |
| 36 | info for PC-98 DO & DO+ refers to their 88-mode | |
| 53 | 37 | |
| 54 | Memory mounting locations: | |
| 55 | * N-BASIC 0x0000 - 0x5fff, N-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff | |
| 56 | * N-BASIC 0x0000 - 0x5fff, N-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff | |
| 57 | * N88-BASIC 0x0000 - 0x7fff, N88-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff | |
| 58 | * Sound BIOS: 0x6000 - 0x7fff | |
| 59 | * CD-ROM BISO: 0x0000 - 0x7fff | |
| 60 | * Dictionary: 0xc000 - 0xffff (32 Banks) | |
| 38 | Disk Drive options: | |
| 39 | (FDM): there exist three model of this computer: Model 10 (base model, only optional floppy drive), Model 20 | |
| 40 | (1 floppy drive for 5.25" 2D disks) and Model 30 (2 floppy drive for 5.25" 2D disks) | |
| 41 | (FD2): 2 floppy drive for 5.25" 2D disks | |
| 42 | (FDH): 2 floppy drive for both 5.25" 2D disks and 5.25" HD disks | |
| 43 | (FD3): 2 floppy drive for both 5.25" 2D disks and 5.25" HD disks + 1 floppy drive for 3.5" 2TD disks | |
| 61 | 44 | |
| 62 | info from http://www.geocities.jp/retro_zzz/machines/nec/cmn_roms.html | |
| 63 | also, refer to http://www.geocities.jp/retro_zzz/machines/nec/cmn_vers.html for | |
| 64 | info about BASIC revisions in the various models (BASIC V2 is the BASIC | |
| 65 | Expansion, if I unerstood correctly) | |
| 45 | Notes: | |
| 46 | (U): US version | |
| 47 | (GE): Graphic Expansion for PC-8001 | |
| 48 | (NE): N-BASIC Expansion for PC-8001 (similar to N88-BASIC Expansion for PC-88xx) | |
| 49 | (KO): Optional Kanji ROM | |
| 50 | (K1): Kanji 1st Level ROM | |
| 51 | (K2): Kanji 2nd Level ROM | |
| 52 | (KE): Kanji Enhanced ROM | |
| 66 | 53 | |
| 67 | TODO: | |
| 68 | - Shouldn't it be possible to switch resolution during emulation, like many MAME | |
| 69 | games do? If yes, there would be no need of separate LoRes and HiRes drivers. | |
| 70 | - Add correct CPU to various computers (right now they all use the MkIISR settings) | |
| 71 | - Dump the Sound BIOS | |
| 72 | - We need to support no Expanded BASIC machines (early models). Right now emulation | |
| 73 | always start from BASIC V2, so machines without it only shows a black screen | |
| 74 | - We need to emulate the differences in the new sets (MkIIFR, MA, MA2, MC) compared | |
| 75 | to MkIISR. | |
| 54 | Memory mounting locations: | |
| 55 | * N-BASIC 0x0000 - 0x5fff, N-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff | |
| 56 | * N-BASIC 0x0000 - 0x5fff, N-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff | |
| 57 | * N88-BASIC 0x0000 - 0x7fff, N88-BASIC Expansion & Graph Enhhancement 0x6000 - 0x7fff | |
| 58 | * Sound BIOS: 0x6000 - 0x7fff | |
| 59 | * CD-ROM BISO: 0x0000 - 0x7fff | |
| 60 | * Dictionary: 0xc000 - 0xffff (32 Banks) | |
| 76 | 61 | |
| 77 | Usage: | |
| 78 | These machines take a long time to start. Be patient (or press Insert to FastForward) | |
| 62 | info from http://www.geocities.jp/retro_zzz/machines/nec/cmn_roms.html | |
| 63 | also, refer to http://www.geocities.jp/retro_zzz/machines/nec/cmn_vers.html for | |
| 64 | info about BASIC revisions in the various models (BASIC V2 is the BASIC | |
| 65 | Expansion, if I unerstood correctly) | |
| 79 | 66 | |
| 67 | TODO: | |
| 68 | - Shouldn't it be possible to switch resolution during emulation, like many MAME | |
| 69 | games do? If yes, there would be no need of separate LoRes and HiRes drivers. | |
| 70 | - Add correct CPU to various computers (right now they all use the MkIISR settings) | |
| 71 | - Dump the Sound BIOS | |
| 72 | - We need to support no Expanded BASIC machines (early models). Right now emulation | |
| 73 | always start from BASIC V2, so machines without it only shows a black screen | |
| 74 | - We need to emulate the differences in the new sets (MkIIFR, MA, MA2, MC) compared | |
| 75 | to MkIISR. | |
| 80 | 76 | |
| 77 | Usage: | |
| 78 | These machines take a long time to start. Be patient (or press Insert to FastForward) | |
| 81 | 79 | |
| 80 | ||
| 81 | ||
| 82 | 82 | *****************************************************************************************************/ |
| 83 | 83 | |
| 84 | 84 | #include "driver.h" |
| r5932 | r5933 | |
| 286 | 286 | Therefore, in Full Emulation mode, "F1" goes to 'F3' and so on |
| 287 | 287 | |
| 288 | 288 | Also, the Keypad has 16 keys, making impossible to map it in a satisfactory |
| 289 | way to a PC keypad. Therefore, default settings for these keys in Full | |
| 290 | Emulation are currently based on the effect of the key rather than on | |
| 289 | way to a PC keypad. Therefore, default settings for these keys in Full | |
| 290 | Emulation are currently based on the effect of the key rather than on | |
| 291 | 291 | their real position |
| 292 | 292 | |
| 293 | 293 | About natural keyboards: currently, |
| r5932 | r5933 | |
| 299 | 299 | - "Roll Up" and "Roll Down" are mapped to 'Page Up' and 'Page Down' |
| 300 | 300 | - "Help" is mapped to 'F8' |
| 301 | 301 | */ |
| 302 | ||
| 302 | ||
| 303 | 303 | static INPUT_PORTS_START( pc88sr ) |
| 304 | 304 | PORT_START("KEY0") |
| 305 | 305 | PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| r5932 | r5933 | |
| 418 | 418 | |
| 419 | 419 | PORT_START("KEY12") /* port 0x0c */ |
| 420 | 420 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 421 | ||
| 421 | ||
| 422 | 422 | PORT_START("KEY13") /* port 0x0d */ |
| 423 | 423 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 424 | ||
| 424 | ||
| 425 | 425 | PORT_START("KEY14") /* port 0x0e */ |
| 426 | 426 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 427 | ||
| 427 | ||
| 428 | 428 | PORT_START("KEY15") /* port 0x0f */ |
| 429 | 429 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 430 | 430 | |
| r5932 | r5933 | |
| 622 | 622 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 623 | 623 | MDRV_SOUND_ADD("beep", BEEP, 0) |
| 624 | 624 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) |
| 625 | ||
| 625 | ||
| 626 | 626 | MDRV_NEC765A_ADD("nec765", pc8801_fdc_interface) |
| 627 | ||
| 627 | ||
| 628 | 628 | MDRV_FLOPPY_2_DRIVES_ADD(pc88_floppy_config) |
| 629 | 629 | MACHINE_DRIVER_END |
| 630 | 630 | |
| r5932 | r5933 | |
| 704 | 704 | ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) ) |
| 705 | 705 | ROM_END |
| 706 | 706 | |
| 707 | /* The dump only included "maincpu". Other roms arbitrariely taken from PC-8801 & PC-8801 MkIISR (there should be | |
| 707 | /* The dump only included "maincpu". Other roms arbitrariely taken from PC-8801 & PC-8801 MkIISR (there should be | |
| 708 | 708 | at least 1 Kanji ROM). */ |
| 709 | 709 | ROM_START( pc88m2 ) |
| 710 | 710 | ROM_REGION( 0x18000, "maincpu", 0 ) |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | ||
| 7 | http://www.kc85-museum.de/books/poly880/index.html | |
| 8 | 8 | |
| 9 | 9 | ****************************************************************************/ |
| 10 | 10 | |
| r5932 | r5933 | |
| 19 | 19 | |
| 20 | 20 | /* |
| 21 | 21 | |
| 22 | ||
| 22 | TODO: | |
| 23 | 23 | |
| 24 | - SEND/SCON | |
| 25 | - MCYCL (activate single stepping) | |
| 26 | - CYCL (single step) | |
| 27 | - layout LEDs (address bus, data bus, command bus, MCYCL) | |
| 28 | - RAM expansion | |
| 24 | - SEND/SCON | |
| 25 | - MCYCL (activate single stepping) | |
| 26 | - CYCL (single step) | |
| 27 | - layout LEDs (address bus, data bus, command bus, MCYCL) | |
| 28 | - RAM expansion | |
| 29 | 29 | |
| 30 | 30 | */ |
| 31 | 31 | |
| r5932 | r5933 | |
| 84 | 84 | static INPUT_PORTS_START( poly880 ) |
| 85 | 85 | PORT_START("KI1") |
| 86 | 86 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("GO") PORT_CODE(KEYCODE_G) |
| 87 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 87 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) | |
| 88 | 88 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EXEC") PORT_CODE(KEYCODE_ENTER) |
| 89 | 89 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACK") PORT_CODE(KEYCODE_BACKSPACE) |
| 90 | 90 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R) |
| r5932 | r5933 | |
| 154 | 154 | static WRITE8_DEVICE_HANDLER( pio1_port_a_w ) |
| 155 | 155 | { |
| 156 | 156 | /* |
| 157 | ||
| 158 | bit signal description | |
| 159 | 157 | |
| 160 | PA0 SD0 segment E | |
| 161 | PA1 SD1 segment D | |
| 162 | PA2 SD2 segment C | |
| 163 | PA3 SD3 segment P | |
| 164 | PA4 SD4 segment G | |
| 165 | PA5 SD5 segment A | |
| 166 | PA6 SD6 segment F | |
| 167 | PA7 SD7 segment B | |
| 158 | bit signal description | |
| 168 | 159 | |
| 169 | */ | |
| 160 | PA0 SD0 segment E | |
| 161 | PA1 SD1 segment D | |
| 162 | PA2 SD2 segment C | |
| 163 | PA3 SD3 segment P | |
| 164 | PA4 SD4 segment G | |
| 165 | PA5 SD5 segment A | |
| 166 | PA6 SD6 segment F | |
| 167 | PA7 SD7 segment B | |
| 170 | 168 | |
| 169 | */ | |
| 170 | ||
| 171 | 171 | poly880_state *state = device->machine->driver_data; |
| 172 | 172 | |
| 173 | 173 | state->segment = BITSWAP8(data, 3, 4, 6, 0, 1, 2, 7, 5); |
| r5932 | r5933 | |
| 178 | 178 | static READ8_DEVICE_HANDLER( pio1_port_b_r ) |
| 179 | 179 | { |
| 180 | 180 | /* |
| 181 | ||
| 182 | bit signal description | |
| 183 | 181 | |
| 184 | PB0 TTY | |
| 185 | PB1 MIN tape input | |
| 186 | PB2 MOUT tape output | |
| 187 | PB3 | |
| 188 | PB4 KI1 key row 1 input | |
| 189 | PB5 KI2 key row 2 input | |
| 190 | PB6 SCON | |
| 191 | PB7 KI3 key row 3 input | |
| 182 | bit signal description | |
| 192 | 183 | |
| 193 | */ | |
| 184 | PB0 TTY | |
| 185 | PB1 MIN tape input | |
| 186 | PB2 MOUT tape output | |
| 187 | PB3 | |
| 188 | PB4 KI1 key row 1 input | |
| 189 | PB5 KI2 key row 2 input | |
| 190 | PB6 SCON | |
| 191 | PB7 KI3 key row 3 input | |
| 194 | 192 | |
| 193 | */ | |
| 194 | ||
| 195 | 195 | poly880_state *state = device->machine->driver_data; |
| 196 | 196 | |
| 197 | 197 | UINT8 data = 0xf0 | ((cassette_input(state->cassette) < +0.0) << 1); |
| r5932 | r5933 | |
| 213 | 213 | static WRITE8_DEVICE_HANDLER( pio1_port_b_w ) |
| 214 | 214 | { |
| 215 | 215 | /* |
| 216 | ||
| 217 | bit signal description | |
| 218 | 216 | |
| 219 | PB0 TTY teletype serial output | |
| 220 | PB1 MIN | |
| 221 | PB2 MOUT tape output | |
| 222 | PB3 | |
| 223 | PB4 KI1 key row 1 input | |
| 224 | PB5 KI2 key row 2 input | |
| 225 | PB6 SCON | |
| 226 | PB7 KI3 key row 3 input | |
| 217 | bit signal description | |
| 227 | 218 | |
| 228 | */ | |
| 219 | PB0 TTY teletype serial output | |
| 220 | PB1 MIN | |
| 221 | PB2 MOUT tape output | |
| 222 | PB3 | |
| 223 | PB4 KI1 key row 1 input | |
| 224 | PB5 KI2 key row 2 input | |
| 225 | PB6 SCON | |
| 226 | PB7 KI3 key row 3 input | |
| 229 | 227 | |
| 228 | */ | |
| 229 | ||
| 230 | 230 | poly880_state *state = device->machine->driver_data; |
| 231 | 231 | |
| 232 | 232 | /* tape output */ |
| r5932 | r5933 | |
| 325 | 325 | |
| 326 | 326 | /* System Drivers */ |
| 327 | 327 | |
| 328 | /* YEAR | |
| 328 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 329 | 329 | COMP( 1983, poly880, 0, 0, poly880, poly880, 0, poly880, "VEB Polytechnik", "Poly-Computer 880", GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 3 | 3 | * V-tech Socrates Driver |
| 4 | 4 | * By Jonathan Gevaryahu AKA Lord Nightmare |
| 5 | 5 | * with dumping help from Kevin 'kevtris' Horton |
| 6 | * | |
| 6 | * | |
| 7 | 7 | * (driver structure copied from vtech1.c) |
| 8 | 8 | TODO: |
| 9 | fix glitches with keyboard input (double keys still don't work, super painter letter entry still doesn't work) | |
| 10 | hook up hblank | |
| 11 | hook up mouse | |
| 12 | add waitstates for ram access (lack of this causes the system to run way too fast) | |
| 13 | find and hook up any timers/interrupt controls | |
| 14 | switch cartridges over to a CART system rather than abusing BIOS | |
| 15 | ||
| 9 | fix glitches with keyboard input (double keys still don't work, super painter letter entry still doesn't work) | |
| 10 | hook up hblank | |
| 11 | hook up mouse | |
| 12 | add waitstates for ram access (lack of this causes the system to run way too fast) | |
| 13 | find and hook up any timers/interrupt controls | |
| 14 | switch cartridges over to a CART system rather than abusing BIOS | |
| 16 | 15 | |
| 17 | 16 | |
| 17 | ||
| 18 | 18 | Socrates Educational Video System |
| 19 | 19 | FFFF|----------------| |
| 20 | 20 | | RAM (window 1) | |
| r5932 | r5933 | |
| 30 | 30 | | | |
| 31 | 31 | 0000|----------------| |
| 32 | 32 | |
| 33 | ||
| 33 | * cartridge lives in banks 10 onward, see below | |
| 34 | 34 | |
| 35 | 35 | Banked rom area (4000-7fff) bankswitching |
| 36 | 36 | Bankswitching is achieved by writing to I/O port 0 (mirrored on 1-7) |
| 37 | Bank ROM_REGION Contents | |
| 38 | 0 0x00000 - 0x03fff System ROM page 0 | |
| 39 | 1 0x04000 - 0x07fff System ROM page 1 | |
| 40 | 2 0x08000 - 0x0bfff System ROM page 2 | |
| 37 | Bank ROM_REGION Contents | |
| 38 | 0 0x00000 - 0x03fff System ROM page 0 | |
| 39 | 1 0x04000 - 0x07fff System ROM page 1 | |
| 40 | 2 0x08000 - 0x0bfff System ROM page 2 | |
| 41 | 41 | ... etc ... |
| 42 | E 0x38000 - 0x38fff System ROM page E | |
| 43 | F 0x3c000 - 0x3ffff System ROM page F | |
| 42 | E 0x38000 - 0x38fff System ROM page E | |
| 43 | F 0x3c000 - 0x3ffff System ROM page F | |
| 44 | 44 | 10 0x40000 - 0x43fff Expansion Cartridge page 0 (cart ROM 0x0000-0x3fff) |
| 45 | 45 | 11 0x44000 - 0x47fff Expansion Cartridge page 1 (cart ROM 0x4000-0x7fff) |
| 46 | 46 | ... etc ... |
| r5932 | r5933 | |
| 180 | 180 | socrates.kb_latch_low[0] = 0xFF; |
| 181 | 181 | socrates.kb_latch_high[0] = 0x8F; |
| 182 | 182 | socrates.kb_latch_low[1] = 0x00; |
| 183 | socrates.kb_latch_high[1] = 0x01; | |
| 183 | socrates.kb_latch_high[1] = 0x01; | |
| 184 | 184 | socrates.kb_latch_mouse = 0; |
| 185 | 185 | socrates.io40_latch = 0; |
| 186 | 186 | socrates.hblankstate = 0; |
| r5932 | r5933 | |
| 318 | 318 | /* all this really tells us is: 0x80 is the speech start command; |
| 319 | 319 | all commands are open bus on readback of 4 bits EXCEPT for 0x60 and 0xE0, which are the CTP active and inactive versions of the same command */ |
| 320 | 320 | /* following is hd38880 info: |
| 321 | microcomputer interface of hd38880 is usually 7 wires: | |
| 322 | FP frame pulse, involved with READ command somehow | |
| 323 | SYBS1 data line bit 0, bidirectional | |
| 324 | SYBS2 data line bit 1, " | |
| 325 | SYBS3 data line bit 2, " | |
| 326 | SYBS4 data line bit 3, " | |
| 327 | CTP Command pulse line, sort of a 'write' line | |
| 328 | CMV More or less the 'command is being written' line which is active whenenever any command sequence is being written and during readback. | |
| 321 | microcomputer interface of hd38880 is usually 7 wires: | |
| 322 | FP frame pulse, involved with READ command somehow | |
| 323 | SYBS1 data line bit 0, bidirectional | |
| 324 | SYBS2 data line bit 1, " | |
| 325 | SYBS3 data line bit 2, " | |
| 326 | SYBS4 data line bit 3, " | |
| 327 | CTP Command pulse line, sort of a 'write' line | |
| 328 | CMV More or less the 'command is being written' line which is active whenenever any command sequence is being written and during readback. | |
| 329 | 329 | |
| 330 | The instructions which the hd38880 can be sent are: (msb first/to the left), blank instructions are invalid | |
| 331 | 0000 (nop?, used as a dummy read/write during direction change??? invalid when used alone?) | |
| 332 | 0001 | |
| 333 | 0010 ADSET (Transfer address to "vsm-alike serial roms") <followed by 5 nybbles> | |
| 334 | 0011 READ (read nybble) <bus changes from cpu->speechchip to speechchip->sys and you get as many nybbles as you pulse the CTP line for, address auto-increments> | |
| 335 | 0100 INT1 (initialize 1) <followed by one nybble> | |
| 336 | 0101 | |
| 337 | 0110 INT2 (initialize 2) <followed by one nybble> | |
| 338 | 0111 | |
| 339 | 1000 SYSPD (set speed) <followed by one nybble> | |
| 340 | 1001 | |
| 341 | 1010 STOP | |
| 342 | 1011 CONDT (Read state P1) <bus changes from cpu->speechchip to speechchip->sys and you get one nybble> | |
| 343 | 1100 START | |
| 344 | 1101 | |
| 345 | 1110 SSTART (same as start but syspd speed is ignored and forced to be set to 9 (scale = 1.0)) | |
| 346 | 1111 | |
| 330 | The instructions which the hd38880 can be sent are: (msb first/to the left), blank instructions are invalid | |
| 331 | 0000 (nop?, used as a dummy read/write during direction change??? invalid when used alone?) | |
| 332 | 0001 | |
| 333 | 0010 ADSET (Transfer address to "vsm-alike serial roms") <followed by 5 nybbles> | |
| 334 | 0011 READ (read nybble) <bus changes from cpu->speechchip to speechchip->sys and you get as many nybbles as you pulse the CTP line for, address auto-increments> | |
| 335 | 0100 INT1 (initialize 1) <followed by one nybble> | |
| 336 | 0101 | |
| 337 | 0110 INT2 (initialize 2) <followed by one nybble> | |
| 338 | 0111 | |
| 339 | 1000 SYSPD (set speed) <followed by one nybble> | |
| 340 | 1001 | |
| 341 | 1010 STOP | |
| 342 | 1011 CONDT (Read state P1) <bus changes from cpu->speechchip to speechchip->sys and you get one nybble> | |
| 343 | 1100 START | |
| 344 | 1101 | |
| 345 | 1110 SSTART (same as start but syspd speed is ignored and forced to be set to 9 (scale = 1.0)) | |
| 346 | 1111 | |
| 347 | 347 | end hd38880 info.*/ |
| 348 | 348 | /* the socrates speech chip does not QUITE match the hd38880 though, but is very similar */ |
| 349 | 349 | switch(data&0xF0) |
| r5932 | r5933 | |
| 447 | 447 | /* NTSC-based Palette stuff */ |
| 448 | 448 | // max for I and Q |
| 449 | 449 | #define M_I 0.5957 |
| 450 | #define M_Q 0.5226 | |
| 450 | #define M_Q 0.5226 | |
| 451 | 451 | /* luma amplitudes, measured on scope */ |
| 452 | 452 | #define LUMAMAX 1.420 |
| 453 | 453 | #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, |
| 454 | 454 | #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, |
| 455 | 455 | #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, |
| 456 | 456 | #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, |
| 457 | #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 | |
| 457 | #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 | |
| 458 | 458 | /* chroma amplitudes, measured on scope */ |
| 459 | 459 | #define CHROMAMAX 0.42075 |
| 460 | 460 | #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, |
| r5932 | r5933 | |
| 466 | 466 | static rgb_t socrates_create_color(UINT8 color) |
| 467 | 467 | { |
| 468 | 468 | rgb_t composedcolor; |
| 469 | double lumatable[256] = { | |
| 469 | double lumatable[256] = { | |
| 470 | 470 | LUMA_COL_0 |
| 471 | 471 | LUMA_COL_COMMON |
| 472 | 472 | LUMA_COL_2 |
| r5932 | r5933 | |
| 484 | 484 | LUMA_COL_COMMON |
| 485 | 485 | LUMA_COL_F |
| 486 | 486 | }; |
| 487 | double chromaintensity[256] = { | |
| 487 | double chromaintensity[256] = { | |
| 488 | 488 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 489 | 489 | CHROMA_COL_COMMON |
| 490 | 490 | CHROMA_COL_2 |
| r5932 | r5933 | |
| 645 | 645 | 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 */ |
| 646 | 646 | AM_RANGE(0x10, 0x17) AM_READWRITE(read_f3, socrates_sound_w) AM_MIRROR (0x8) /* sound section: |
| 647 | 647 | 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) |
| 648 | 0x11 - W - frequency control for channel 2 (softer channel) - 01=high pitch, ff=low; same equation as above | |
| 649 | 0x12 - W - 0b***EVVVV enable, volume control for channel 1 | |
| 650 | 0x13 - W - 0b***EVVVV enable, volume control for channel 2 | |
| 651 | 0x14-0x17 - 0bE??????? enable, unknown for channel 3; produces well defined dmc waves when bit 7 is set, and one or two other bits | |
| 652 | This may be some sort of debug register for serial-dmc banging out some internal rom from the asic, maybe color data? | |
| 653 | No writes to ram seem to change the waveforms produced, in my limited testing. | |
| 654 | 0x80 produces about a very very quiet 1/8 duty cycle wave at 60hz or so | |
| 655 | 0xC0 produces a DMC wave read from an unknown address at around 342hz | |
| 656 | 0x | |
| 657 | */ | |
| 648 | 0x11 - W - frequency control for channel 2 (softer channel) - 01=high pitch, ff=low; same equation as above | |
| 649 | 0x12 - W - 0b***EVVVV enable, volume control for channel 1 | |
| 650 | 0x13 - W - 0b***EVVVV enable, volume control for channel 2 | |
| 651 | 0x14-0x17 - 0bE??????? enable, unknown for channel 3; produces well defined dmc waves when bit 7 is set, and one or two other bits | |
| 652 | This may be some sort of debug register for serial-dmc banging out some internal rom from the asic, maybe color data? | |
| 653 | No writes to ram seem to change the waveforms produced, in my limited testing. | |
| 654 | 0x80 produces about a very very quiet 1/8 duty cycle wave at 60hz or so | |
| 655 | 0xC0 produces a DMC wave read from an unknown address at around 342hz | |
| 656 | 0x | |
| 657 | */ | |
| 658 | 658 | AM_RANGE(0x20, 0x21) AM_READWRITE(read_f3, socrates_scroll_w) AM_MIRROR (0xe) /* graphics section: |
| 659 | 0x20 - W - lsb offset of screen display | |
| 660 | 0x21 - W - msb offset of screen display | |
| 661 | resulting screen line is one of 512 total offsets on 128-byte boundaries in the whole 64k ram | |
| 662 | */ | |
| 659 | 0x20 - W - lsb offset of screen display | |
| 660 | 0x21 - W - msb offset of screen display | |
| 661 | resulting screen line is one of 512 total offsets on 128-byte boundaries in the whole 64k ram | |
| 662 | */ | |
| 663 | 663 | AM_RANGE(0x30, 0x30) AM_READWRITE(read_f3, unknownlatch_30) AM_MIRROR (0xf) /* unknown, write only. may relate to waitstate timing? */ |
| 664 | 664 | 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 */ |
| 665 | 665 | 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 */ |
| r5932 | r5933 | |
| 677 | 677 | keycode low |
| 678 | 678 | | keycode high |
| 679 | 679 | | | key name |
| 680 | 00 | |
| 680 | 00 01 No key pressed | |
| 681 | 681 | // pads on the sides of the kb; this acts like a giant bitfield, both dpads/buttons can send data at once |
| 682 | 00 81 left dpad right | |
| 683 | 00 82 left dpad up | |
| 684 | 00 84 left dpad left | |
| 685 | 00 88 left dpad down | |
| 686 | 01 80 right dpad down | |
| 687 | 02 80 right dpad left | |
| 688 | 04 80 right dpad up | |
| 689 | 08 80 right dpad right | |
| 690 | 10 80 left red button | |
| 691 | 20 80 right red button | |
| 682 | 00 81 left dpad right | |
| 683 | 00 82 left dpad up | |
| 684 | 00 84 left dpad left | |
| 685 | 00 88 left dpad down | |
| 686 | 01 80 right dpad down | |
| 687 | 02 80 right dpad left | |
| 688 | 04 80 right dpad up | |
| 689 | 08 80 right dpad right | |
| 690 | 10 80 left red button | |
| 691 | 20 80 right red button | |
| 692 | 692 | // top row (right to left) |
| 693 | 44 82 ENTER | |
| 694 | 44 83 MENU | |
| 695 | 44 84 ANSWER | |
| 696 | 44 85 HELP | |
| 697 | 44 86 ERASE | |
| 698 | 44 87 divide_sign | |
| 699 | 44 88 multiply_sign | |
| 700 | 44 89 minus_sign | |
| 701 | 44 80 plus_sign | |
| 693 | 44 82 ENTER | |
| 694 | 44 83 MENU | |
| 695 | 44 84 ANSWER | |
| 696 | 44 85 HELP | |
| 697 | 44 86 ERASE | |
| 698 | 44 87 divide_sign | |
| 699 | 44 88 multiply_sign | |
| 700 | 44 89 minus_sign | |
| 701 | 44 80 plus_sign | |
| 702 | 702 | //second row (right to left) |
| 703 | 43 81 0 | |
| 704 | 43 82 9 | |
| 705 | 43 83 8 | |
| 706 | 43 84 7 | |
| 707 | 43 85 6 | |
| 708 | 43 86 5 | |
| 709 | 43 87 4 | |
| 710 | 43 88 3 | |
| 711 | 43 89 2 | |
| 712 | 43 80 1 | |
| 703 | 43 81 0 | |
| 704 | 43 82 9 | |
| 705 | 43 83 8 | |
| 706 | 43 84 7 | |
| 707 | 43 85 6 | |
| 708 | 43 86 5 | |
| 709 | 43 87 4 | |
| 710 | 43 88 3 | |
| 711 | 43 89 2 | |
| 712 | 43 80 1 | |
| 713 | 713 | // third row (right to left) |
| 714 | 42 82 I/La | |
| 715 | 42 83 H/So | |
| 716 | 42 84 G/Fa | |
| 717 | 42 85 F/Mi | |
| 718 | 42 86 E/Re | |
| 719 | 42 87 D/Do | |
| 720 | 42 88 C/Ti. | |
| 721 | 42 89 B/La. | |
| 722 | 42 80 A/So. | |
| 723 | 42 81 hyphen/period | |
| 714 | 42 82 I/La | |
| 715 | 42 83 H/So | |
| 716 | 42 84 G/Fa | |
| 717 | 42 85 F/Mi | |
| 718 | 42 86 E/Re | |
| 719 | 42 87 D/Do | |
| 720 | 42 88 C/Ti. | |
| 721 | 42 89 B/La. | |
| 722 | 42 80 A/So. | |
| 723 | 42 81 hyphen/period | |
| 724 | 724 | // fourth row (right to left) |
| 725 | 41 81 S | |
| 726 | 41 82 R | |
| 727 | 41 83 Q/NEW | |
| 728 | 41 84 P/PLAY | |
| 729 | 41 85 O/PAUSE | |
| 730 | 41 86 N/Fa` | |
| 731 | 41 87 M/Mi` | |
| 732 | 41 88 L/Re` | |
| 733 | 41 89 K/Do` | |
| 734 | 41 80 J/Ti | |
| 725 | 41 81 S | |
| 726 | 41 82 R | |
| 727 | 41 83 Q/NEW | |
| 728 | 41 84 P/PLAY | |
| 729 | 41 85 O/PAUSE | |
| 730 | 41 86 N/Fa` | |
| 731 | 41 87 M/Mi` | |
| 732 | 41 88 L/Re` | |
| 733 | 41 89 K/Do` | |
| 734 | 41 80 J/Ti | |
| 735 | 735 | // fifth row (right to left) |
| 736 | 40 82 SPACE | |
| 737 | 40 83 Z | |
| 738 | 40 84 Y | |
| 739 | 40 85 X | |
| 740 | 40 86 W | |
| 741 | 40 87 V | |
| 742 | 40 88 U | |
| 743 | 40 89 T | |
| 744 | 50 80 SHIFT | |
| 736 | 40 82 SPACE | |
| 737 | 40 83 Z | |
| 738 | 40 84 Y | |
| 739 | 40 85 X | |
| 740 | 40 86 W | |
| 741 | 40 87 V | |
| 742 | 40 88 U | |
| 743 | 40 89 T | |
| 744 | 50 80 SHIFT | |
| 745 | 745 | // socrates mouse pad (separate from keyboard) |
| 746 | 8x | |
| 746 | 8x 8y mouse movement | |
| 747 | 747 | x: down = 1 (small) thru 7 (large), up = 8 (small) thru F (large) |
| 748 | 748 | y: right = 1 (small) thru 7 (large), left = 8 (small) thru F (large) |
| 749 | 90 80 right click | |
| 750 | A0 80 left click | |
| 751 | B0 80 both buttons click | |
| 752 | 90 81 right click (mouse movement in queue, will be in regs after next latch clear) | |
| 753 | A0 81 left click (mouse movement in queue, will be in regs after next latch clear) | |
| 754 | B0 81 both buttons click (mouse movement in queue, will be in regs after next latch clear) | |
| 749 | 90 80 right click | |
| 750 | A0 80 left click | |
| 751 | B0 80 both buttons click | |
| 752 | 90 81 right click (mouse movement in queue, will be in regs after next latch clear) | |
| 753 | A0 81 left click (mouse movement in queue, will be in regs after next latch clear) | |
| 754 | B0 81 both buttons click (mouse movement in queue, will be in regs after next latch clear) | |
| 755 | 755 | // socrates touch pad |
| 756 | 756 | // unknown yet, but probably uses the 60/70/c0/d0/e0/f0 low reg vals |
| 757 | 757 | */ |
| r5932 | r5933 | |
| 770 | 770 | 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 |
| 771 | 771 | PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 772 | 772 | /* alt w/left and right keypad keys swapped |
| 773 | 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 | |
| 774 | 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 | |
| 775 | 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 | |
| 776 | 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 | |
| 777 | 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 | |
| 778 | 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 | |
| 779 | 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 | |
| 780 | 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 | |
| 781 | 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 | |
| 782 | 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 | |
| 783 | PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 784 | */ | |
| 773 | 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 | |
| 774 | 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 | |
| 775 | 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 | |
| 776 | 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 | |
| 777 | 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 | |
| 778 | 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 | |
| 779 | 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 | |
| 780 | 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 | |
| 781 | 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 | |
| 782 | 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 | |
| 783 | PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) | |
| 784 | */ | |
| 785 | 785 | |
| 786 | 786 | PORT_START("keyboard_50") // lowest 'row' (technically the shift key is on the 5th row but it has its own keycode) |
| 787 | 787 | 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 |
| r5932 | r5933 | |
| 801 | 801 | |
| 802 | 802 | PORT_START("keyboard_41") // 4th row |
| 803 | 803 | PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_NAME("J/Ti") // 41 80 |
| 804 | PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_NAME("S") // 41 81 | |
| 804 | PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_NAME("S") // 41 81 | |
| 805 | 805 | PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_NAME("R") // 41 82 |
| 806 | 806 | PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_NAME("Q/NEW") // 41 83 |
| 807 | 807 | PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_NAME("P/PLAY") // 41 84 |
| r5932 | r5933 | |
| 814 | 814 | |
| 815 | 815 | PORT_START("keyboard_42") // 3rd row |
| 816 | 816 | PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_NAME("A/So.") // 42 80 |
| 817 | PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('-') PORT_NAME("-/.") // 42 81 | |
| 817 | PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('-') PORT_NAME("-/.") // 42 81 | |
| 818 | 818 | PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_NAME("I/La") // 42 82 |
| 819 | 819 | PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_NAME("H/So") // 42 83 |
| 820 | 820 | PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_NAME("G/Fa") // 42 84 |
| r5932 | r5933 | |
| 827 | 827 | |
| 828 | 828 | PORT_START("keyboard_43") // 2nd row |
| 829 | 829 | PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_NAME("1") // 43 80 |
| 830 | PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_NAME("0") // 43 81 | |
| 830 | PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_NAME("0") // 43 81 | |
| 831 | 831 | PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9") // 43 82 |
| 832 | 832 | PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_NAME("8") // 43 83 |
| 833 | 833 | PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_NAME("7") // 43 84 |
| r5932 | r5933 | |
| 840 | 840 | |
| 841 | 841 | PORT_START("keyboard_44") // 1st row |
| 842 | 842 | PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_NAME("+") // 44 80 |
| 843 | PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_UNUSED) // 44 81 | |
| 843 | PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_UNUSED) // 44 81 | |
| 844 | 844 | PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_NAME("ENTER") // 44 82 |
| 845 | 845 | PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("MENU") // 44 83 |
| 846 | 846 | PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_NAME("ANSWER") // 44 84 |
| r5932 | r5933 | |
| 850 | 850 | PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') PORT_NAME("*") // 44 88 |
| 851 | 851 | PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("-") // 44 89 |
| 852 | 852 | PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 853 | ||
| 853 | ||
| 854 | 854 | // mouse goes here |
| 855 | 855 | INPUT_PORTS_END |
| 856 | 856 | |
| r5932 | r5933 | |
| 912 | 912 | /* Socrates US NTSC */ |
| 913 | 913 | /* all cart roms are 28 pin 23c1000/tc531000 128Kx8 roms */ |
| 914 | 914 | /* cart port pinout: |
| 915 | (looking into end of disk-shaped cartridge with label/top side pointing to the right) | |
| 916 | A15 -> 19 18 -- VCC | |
| 917 | A14 -> 20 17 <- A16 | |
| 918 | A13 -> 21 16 <- A12 | |
| 919 | A8 -> 22 15 <- A7 | |
| 920 | A9 -> 23 14 <- A6 | |
| 921 | A11 -> 24 13 <- A5 | |
| 922 | A3 -> 25 12 <- A4 | |
| 923 | A2 -> 26 11 <- A10 | |
| 924 | D7 <- 27 10 <- A1 | |
| 925 | D6 <- 28 9 <- A0 | |
| 926 | D5 <- 29 8 -> D0 | |
| 927 | D4 <- 30 7 -> D1 | |
| 928 | D3 <- 31 6 -> D2 | |
| 929 | ? ?? 32 5 ?? ? | |
| 930 | A17 -> 33 4 ?? ? | |
| 931 | ? ?? 34 3 ?? ? | |
| 932 | /CE -> 35 2 ?? ? | |
| 933 | GND -- 36 1 -- GND | |
| 934 | Note that a17 goes to what would be pin 2 if a 32 pin rom were installed, which is not the case. (pins 1, 31 and 32 would be tied to vcc) | |
| 935 | ||
| 936 | Cartridge check procedure by socrates is, after screen init and check for speech synth, | |
| 937 | bankswitch to bank 0x10 (i.e. first 0x4000 of cart appears at 4000-7fff in z80 space), | |
| 938 | do following tests; if any tests fail, jump to 0x0015 (socrates main menu) | |
| 939 | * read 0x7ff0(0x3ff0 in cart rom) and compare to 0xAA | |
| 940 | * read 0x7ff1(0x3ff1 in cart rom) and compare to 0x55 | |
| 941 | * read 0x7ff2(0x3ff2 in cart rom) and compare to 0xE7 | |
| 942 | * read 0x7ff3(0x3ff3 in cart rom) and compare to 0x18 | |
| 943 | if all tests passed, jump to 0x4000 (0x0000 in cart rom) | |
| 944 | */ | |
| 915 | (looking into end of disk-shaped cartridge with label/top side pointing to the right) | |
| 916 | A15 -> 19 18 -- VCC | |
| 917 | A14 -> 20 17 <- A16 | |
| 918 | A13 -> 21 16 <- A12 | |
| 919 | A8 -> 22 15 <- A7 | |
| 920 | A9 -> 23 14 <- A6 | |
| 921 | A11 -> 24 13 <- A5 | |
| 922 | A3 -> 25 12 <- A4 | |
| 923 | A2 -> 26 11 <- A10 | |
| 924 | D7 <- 27 10 <- A1 | |
| 925 | D6 <- 28 9 <- A0 | |
| 926 | D5 <- 29 8 -> D0 | |
| 927 | D4 <- 30 7 -> D1 | |
| 928 | D3 <- 31 6 -> D2 | |
| 929 | ? ?? 32 5 ?? ? | |
| 930 | A17 -> 33 4 ?? ? | |
| 931 | ? ?? 34 3 ?? ? | |
| 932 | /CE -> 35 2 ?? ? | |
| 933 | GND -- 36 1 -- GND | |
| 934 | Note that a17 goes to what would be pin 2 if a 32 pin rom were installed, which is not the case. (pins 1, 31 and 32 would be tied to vcc) | |
| 935 | ||
| 936 | Cartridge check procedure by socrates is, after screen init and check for speech synth, | |
| 937 | bankswitch to bank 0x10 (i.e. first 0x4000 of cart appears at 4000-7fff in z80 space), | |
| 938 | do following tests; if any tests fail, jump to 0x0015 (socrates main menu) | |
| 939 | * read 0x7ff0(0x3ff0 in cart rom) and compare to 0xAA | |
| 940 | * read 0x7ff1(0x3ff1 in cart rom) and compare to 0x55 | |
| 941 | * read 0x7ff2(0x3ff2 in cart rom) and compare to 0xE7 | |
| 942 | * read 0x7ff3(0x3ff3 in cart rom) and compare to 0x18 | |
| 943 | if all tests passed, jump to 0x4000 (0x0000 in cart rom) | |
| 944 | */ | |
| 945 | 945 | ROM_DEFAULT_BIOS("nocart") |
| 946 | 946 | 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" |
| 947 | 947 | ROM_SYSTEM_BIOS( 0, "nocart", "Socrates w/o cartridge installed") |
| r5932 | r5933 | |
| 977 | 977 | ROM_LOAD_OPTIONAL("speech_eng_vsm3.bin", 0x8000, 0x4000, CRC(972384aa) SHA1(FFCB1D633CA6BFFC7F481EC505DA447E5B847F16)) // 16k in serial rom |
| 978 | 978 | ROM_FILL(0xC000, 0x4000, 0xff) // last vsm isn't present, FF fill |
| 979 | 979 | ROM_END |
| 980 | ||
| 980 | ||
| 981 | 981 | ROM_START(socratfc) |
| 982 | 982 | ROM_REGION(0x80000, "maincpu", 0) |
| 983 | 983 | /* Socrates SAITOUT (French Canadian) NTSC */ |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Elektronika MK-85 |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 20 | 20 | INPUT_PORTS_END |
| 21 | 21 | |
| 22 | 22 | |
| 23 | static MACHINE_RESET(mk85) | |
| 24 | { | |
| 23 | static MACHINE_RESET(mk85) | |
| 24 | { | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | static VIDEO_START( mk85 ) |
| r5932 | r5933 | |
| 43 | 43 | MDRV_CPU_ADD("maincpu",T11, XTAL_4MHz) |
| 44 | 44 | MDRV_CPU_CONFIG(t11_data) |
| 45 | 45 | MDRV_CPU_PROGRAM_MAP(mk85_mem) |
| 46 | ||
| 46 | ||
| 47 | 47 | MDRV_MACHINE_RESET(mk85) |
| 48 | ||
| 48 | ||
| 49 | 49 | /* video hardware */ |
| 50 | 50 | MDRV_SCREEN_ADD("screen", RASTER) |
| 51 | 51 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Univac Terminals | |
| 4 | 4 | |
| 5 | The terminals are models UTS20, UTS30, UTS40, UTS50 and SVT1120, | |
| 6 | however only the UTS20 is dumped (program roms only). | |
| 5 | The terminals are models UTS20, UTS30, UTS40, UTS50 and SVT1120, | |
| 6 | however only the UTS20 is dumped (program roms only). | |
| 7 | 7 | |
| 8 | ||
| 8 | 25/05/2009 Skeleton driver [Robbbert]. | |
| 9 | 9 | |
| 10 | 10 | ****************************************************************************/ |
| 11 | 11 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | NOTE: ****** Specbusy: press N, R, or E to boot ************* | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | Spectrum/Inves/TK90X etc. memory map: |
| r5932 | r5933 | |
| 542 | 542 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, wh); |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | static ADDRESS_MAP_START (ts2068_io, ADDRESS_SPACE_IO, 8) | |
| 545 | static ADDRESS_MAP_START (ts2068_io, ADDRESS_SPACE_IO, 8) | |
| 546 | 546 | AM_RANGE(0x1f, 0x1f) AM_READ( spectrum_port_1f_r ) AM_MIRROR(0xff00) |
| 547 | 547 | AM_RANGE(0x7f, 0x7f) AM_READ( spectrum_port_7f_r ) AM_MIRROR(0xff00) |
| 548 | 548 | AM_RANGE(0xdf, 0xdf) AM_READ( spectrum_port_df_r ) AM_MIRROR(0xff00) |
| r5932 | r5933 | |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | static ADDRESS_MAP_START (tc2048_io, ADDRESS_SPACE_IO, 8) |
| 589 | AM_RANGE(0x00, 0x00) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) | |
| 589 | AM_RANGE(0x00, 0x00) AM_READWRITE(spectrum_port_fe_r,spectrum_port_fe_w) AM_MIRROR(0xfffe) AM_MASK(0xffff) | |
| 590 | 590 | AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00) |
| 591 | 591 | AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00) |
| 592 | 592 | AM_RANGE(0xdf, 0xdf) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00) |
| 593 | AM_RANGE(0xff, 0xff) AM_READWRITE(ts2068_port_ff_r,tc2048_port_ff_w) AM_MIRROR(0xff00) | |
| 593 | AM_RANGE(0xff, 0xff) AM_READWRITE(ts2068_port_ff_r,tc2048_port_ff_w) AM_MIRROR(0xff00) | |
| 594 | 594 | ADDRESS_MAP_END |
| 595 | 595 | |
| 596 | 596 | static ADDRESS_MAP_START (tc2048_mem, ADDRESS_SPACE_PROGRAM, 8) |
| r5932 | r5933 | |
| 628 | 628 | /* sound */ |
| 629 | 629 | MDRV_SOUND_REPLACE("ay8912", AY8912, XTAL_14_112MHz/8) /* From Schematic; 1.764 MHz */ |
| 630 | 630 | MDRV_SOUND_CONFIG(spectrum_ay_interface) |
| 631 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 631 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) | |
| 632 | 632 | |
| 633 | 633 | /* cartridge */ |
| 634 | 634 | MDRV_CARTSLOT_MODIFY("cart") |
| 635 | 635 | MDRV_CARTSLOT_EXTENSION_LIST("dck") |
| 636 | 636 | MDRV_CARTSLOT_NOT_MANDATORY |
| 637 | 637 | MDRV_CARTSLOT_LOAD(timex_cart) |
| 638 | MDRV_CARTSLOT_UNLOAD(timex_cart) | |
| 638 | MDRV_CARTSLOT_UNLOAD(timex_cart) | |
| 639 | 639 | MACHINE_DRIVER_END |
| 640 | 640 | |
| 641 | 641 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | drivers/bw2.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Bondwell BW 2 | |
| 6 | 6 | |
| 7 | - Z80L CPU 4MHz | |
| 8 | - 64KB RAM, expandable to 224KB RAM. | |
| 9 | - 4KB System ROM | |
| 10 | - MSM6255 LCD controller, 640x200 pixels | |
| 11 | - 16KB Video RAM | |
| 12 | - TMS2797 FDC controller | |
| 13 | - 8251 USART serial interface | |
| 14 | - 8253 PIT timer | |
| 15 | - 8255 PPI | |
| 7 | - Z80L CPU 4MHz | |
| 8 | - 64KB RAM, expandable to 224KB RAM. | |
| 9 | - 4KB System ROM | |
| 10 | - MSM6255 LCD controller, 640x200 pixels | |
| 11 | - 16KB Video RAM | |
| 12 | - TMS2797 FDC controller | |
| 13 | - 8251 USART serial interface | |
| 14 | - 8253 PIT timer | |
| 15 | - 8255 PPI | |
| 16 | 16 | |
| 17 | 17 | http://www.thebattles.net/bondwell/ |
| 18 | 18 | |
| r5932 | r5933 | |
| 21 | 21 | http://www2.okisemi.com/site/productscatalog/displaydrivers/availabledocuments/Intro-7090.html |
| 22 | 22 | |
| 23 | 23 | |
| 24 | ||
| 24 | TODO: | |
| 25 | 25 | |
| 26 | ||
| 26 | - modem card | |
| 27 | 27 | |
| 28 | 28 | ***************************************************************************/ |
| 29 | 29 | |
| r5932 | r5933 | |
| 57 | 57 | { |
| 58 | 58 | /* |
| 59 | 59 | |
| 60 | Y0 /RAM1 Memory bank 1 | |
| 61 | Y1 /VRAM Video memory | |
| 62 | Y2 /RAM2 Memory bank 2 | |
| 63 | Y3 /RAM3 Memory bank 3 | |
| 64 | Y4 /RAM4 Memory bank 4 | |
| 65 | Y5 /RAM5 Memory bank 5 | |
| 66 | Y6 /RAM6 Memory bank 6 | |
| 67 | Y7 /ROM ROM | |
| 60 | Y0 /RAM1 Memory bank 1 | |
| 61 | Y1 /VRAM Video memory | |
| 62 | Y2 /RAM2 Memory bank 2 | |
| 63 | Y3 /RAM3 Memory bank 3 | |
| 64 | Y4 /RAM4 Memory bank 4 | |
| 65 | Y5 /RAM5 Memory bank 5 | |
| 66 | Y6 /RAM6 Memory bank 6 | |
| 67 | Y7 /ROM ROM | |
| 68 | 68 | |
| 69 | ||
| 69 | */ | |
| 70 | 70 | |
| 71 | 71 | bw2_state *state = machine->driver_data; |
| 72 | 72 | |
| r5932 | r5933 | |
| 138 | 138 | { |
| 139 | 139 | /* |
| 140 | 140 | |
| 141 | Y0 /RAM1 Memory bank 1 | |
| 142 | Y1 /VRAM Video memory | |
| 143 | Y2 /RAM2 RAMCARD ROM | |
| 144 | Y3 /RAM3 Memory bank 3 | |
| 145 | Y4 /RAM4 Memory bank 4 | |
| 146 | Y5 /RAM5 RAMCARD RAM | |
| 147 | Y6 /RAM6 Memory bank 6 | |
| 148 | Y7 /ROM ROM | |
| 141 | Y0 /RAM1 Memory bank 1 | |
| 142 | Y1 /VRAM Video memory | |
| 143 | Y2 /RAM2 RAMCARD ROM | |
| 144 | Y3 /RAM3 Memory bank 3 | |
| 145 | Y4 /RAM4 Memory bank 4 | |
| 146 | Y5 /RAM5 RAMCARD RAM | |
| 147 | Y6 /RAM6 Memory bank 6 | |
| 148 | Y7 /ROM ROM | |
| 149 | 149 | |
| 150 | ||
| 150 | */ | |
| 151 | 151 | |
| 152 | 152 | bw2_state *state = machine->driver_data; |
| 153 | 153 | |
| r5932 | r5933 | |
| 352 | 352 | const device_config *fdc = devtag_get_device(device->machine, "wd179x"); |
| 353 | 353 | /* |
| 354 | 354 | |
| 355 | PA0 KB0 Keyboard line select 0 | |
| 356 | PA1 KB1 Keyboard line select 1 | |
| 357 | PA2 KB2 Keyboard line select 2 | |
| 358 | PA3 KB3 Keyboard line select 3 | |
| 359 | PA4 /DS0 Drive select 0 | |
| 360 | PA5 /DS1 Drive select 1 | |
| 361 | PA6 Select RS232 connector | |
| 362 | PA7 /STROBE to centronics printer | |
| 355 | PA0 KB0 Keyboard line select 0 | |
| 356 | PA1 KB1 Keyboard line select 1 | |
| 357 | PA2 KB2 Keyboard line select 2 | |
| 358 | PA3 KB3 Keyboard line select 3 | |
| 359 | PA4 /DS0 Drive select 0 | |
| 360 | PA5 /DS1 Drive select 1 | |
| 361 | PA6 Select RS232 connector | |
| 362 | PA7 /STROBE to centronics printer | |
| 363 | 363 | |
| 364 | ||
| 364 | */ | |
| 365 | 365 | |
| 366 | 366 | bw2_state *state = device->machine->driver_data; |
| 367 | 367 | |
| r5932 | r5933 | |
| 386 | 386 | { |
| 387 | 387 | /* |
| 388 | 388 | |
| 389 | PB0 Keyboard column status of selected line | |
| 390 | PB1 Keyboard column status of selected line | |
| 391 | PB2 Keyboard column status of selected line | |
| 392 | PB3 Keyboard column status of selected line | |
| 393 | PB4 Keyboard column status of selected line | |
| 394 | PB5 Keyboard column status of selected line | |
| 395 | PB6 Keyboard column status of selected line | |
| 396 | PB7 Keyboard column status of selected line | |
| 389 | PB0 Keyboard column status of selected line | |
| 390 | PB1 Keyboard column status of selected line | |
| 391 | PB2 Keyboard column status of selected line | |
| 392 | PB3 Keyboard column status of selected line | |
| 393 | PB4 Keyboard column status of selected line | |
| 394 | PB5 Keyboard column status of selected line | |
| 395 | PB6 Keyboard column status of selected line | |
| 396 | PB7 Keyboard column status of selected line | |
| 397 | 397 | |
| 398 | ||
| 398 | */ | |
| 399 | 399 | |
| 400 | 400 | bw2_state *state = device->machine->driver_data; |
| 401 | 401 | |
| r5932 | r5933 | |
| 414 | 414 | { |
| 415 | 415 | /* |
| 416 | 416 | |
| 417 | PC0 Memory bank select | |
| 418 | PC1 Memory bank select | |
| 419 | PC2 Memory bank select | |
| 420 | PC3 Not connected | |
| 417 | PC0 Memory bank select | |
| 418 | PC1 Memory bank select | |
| 419 | PC2 Memory bank select | |
| 420 | PC3 Not connected | |
| 421 | 421 | |
| 422 | ||
| 422 | */ | |
| 423 | 423 | |
| 424 | 424 | if (get_ramdisk_size(device->machine) > 0) |
| 425 | 425 | { |
| r5932 | r5933 | |
| 435 | 435 | { |
| 436 | 436 | /* |
| 437 | 437 | |
| 438 | PC4 BUSY from centronics printer | |
| 439 | PC5 M/FDBK motor feedback | |
| 440 | PC6 RLSD Carrier detect from RS232 | |
| 441 | PC7 /PROT Write protected disk | |
| 438 | PC4 BUSY from centronics printer | |
| 439 | PC5 M/FDBK motor feedback | |
| 440 | PC6 RLSD Carrier detect from RS232 | |
| 441 | PC7 /PROT Write protected disk | |
| 442 | 442 | |
| 443 | ||
| 443 | */ | |
| 444 | 444 | |
| 445 | 445 | bw2_state *state = device->machine->driver_data; |
| 446 | 446 | |
| r5932 | r5933 | |
| 617 | 617 | AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE(I8255A_TAG, i8255a_r, i8255a_w ) |
| 618 | 618 | AM_RANGE( 0x10, 0x13 ) AM_DEVREADWRITE(PIT8253_TAG, pit8253_r, pit8253_w ) |
| 619 | 619 | AM_RANGE( 0x20, 0x21 ) AM_DEVREADWRITE(MSM6255_TAG, msm6255_register_r, msm6255_register_w ) |
| 620 | // | |
| 620 | // AM_RANGE( 0x30, 0x3f ) SLOT | |
| 621 | 621 | AM_RANGE( 0x40, 0x40 ) AM_DEVREADWRITE( MSM8251_TAG, msm8251_data_r, msm8251_data_w ) |
| 622 | 622 | AM_RANGE( 0x41, 0x41 ) AM_DEVREADWRITE( MSM8251_TAG, msm8251_status_r, msm8251_control_w ) |
| 623 | 623 | AM_RANGE( 0x50, 0x50 ) AM_DEVWRITE(CENTRONICS_TAG, centronics_data_w) |
| 624 | 624 | AM_RANGE( 0x60, 0x63 ) AM_READWRITE( bw2_wd2797_r, bw2_wd2797_w ) |
| 625 | // | |
| 625 | // AM_RANGE( 0x70, 0x7f ) MODEMSEL | |
| 626 | 626 | ADDRESS_MAP_END |
| 627 | 627 | |
| 628 | 628 | /* |
| r5932 | r5933 | |
| 794 | 794 | TRACKS([80]) |
| 795 | 795 | SECTORS([18]) |
| 796 | 796 | SECTOR_LENGTH([256]) |
| 797 | FIRST_SECTOR_ID([0])) | |
| 797 | FIRST_SECTOR_ID([0])) | |
| 798 | 798 | FLOPPY_OPTIONS_END |
| 799 | 799 | |
| 800 | 800 | static const floppy_config bw2_floppy_config = |
| r5932 | r5933 | |
| 841 | 841 | MDRV_MSM8251_ADD(MSM8251_TAG, default_msm8251_interface) |
| 842 | 842 | |
| 843 | 843 | MDRV_WD179X_ADD("wd179x", bw2_wd17xx_interface ) |
| 844 | ||
| 844 | ||
| 845 | 845 | MDRV_FLOPPY_2_DRIVES_ADD(bw2_floppy_config) |
| 846 | 846 | MACHINE_DRIVER_END |
| 847 | 847 | |
| r5932 | r5933 | |
| 902 | 902 | } |
| 903 | 903 | } |
| 904 | 904 | |
| 905 | static SYSTEM_CONFIG_START( bw2 ) | |
| 905 | static SYSTEM_CONFIG_START( bw2 ) | |
| 906 | 906 | CONFIG_DEVICE( bw2_serial_getinfo ) |
| 907 | 907 | CONFIG_RAM_DEFAULT( 64 * 1024 ) |
| 908 | 908 | CONFIG_RAM( 96 * 1024 ) |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | ||
| 7 | http://www.armchairarcade.com/neo/node/1598 | |
| 8 | 8 | |
| 9 | 9 | ****************************************************************************/ |
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | 12 | |
| 13 | ||
| 13 | TODO: | |
| 14 | 14 | |
| 15 | ||
| 15 | - MN1544 4-bit CPU core and ROM dump | |
| 16 | 16 | |
| 17 | 17 | */ |
| 18 | 18 | |
| r5932 | r5933 | |
| 21 | 21 | |
| 22 | 22 | static UINT8 *textram; |
| 23 | 23 | static UINT8 *border; |
| 24 | static UINT8 io_reg[0x20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
| 24 | static UINT8 io_reg[0x20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
| 25 | 25 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 26 | 26 | |
| 27 | 27 | static const UINT8 jr200_keycodes[4][9][8] = |
| r5932 | r5933 | |
| 82 | 82 | /* |
| 83 | 83 | static READ8_HANDLER( test_r ) |
| 84 | 84 | { |
| 85 | ||
| 85 | return 0x00; | |
| 86 | 86 | } |
| 87 | 87 | */ |
| 88 | 88 | |
| r5932 | r5933 | |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | ||
| 126 | ||
| 127 | 127 | value = keydata; |
| 128 | 128 | } |
| 129 | 129 | break; |
| r5932 | r5933 | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /* |
| 170 | 0000-3fff RAM | |
| 171 | 4000-4fff RAM ( 4k expansion) | |
| 172 | 4000-7fff RAM (16k expansion) | |
| 173 | 4000-bfff RAM (32k expansion) | |
| 174 | c100-c3FF text code | |
| 175 | c500-c7ff text color | |
| 176 | ca00 border color | |
| 177 | */ | |
| 170 | 0000-3fff RAM | |
| 171 | 4000-4fff RAM ( 4k expansion) | |
| 172 | 4000-7fff RAM (16k expansion) | |
| 173 | 4000-bfff RAM (32k expansion) | |
| 174 | c100-c3FF text code | |
| 175 | c500-c7ff text color | |
| 176 | ca00 border color | |
| 177 | */ | |
| 178 | 178 | |
| 179 | 179 | static ADDRESS_MAP_START(jr200_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 180 | 180 | AM_RANGE(0x0000, 0x000c) AM_RAM |
| r5932 | r5933 | |
| 221 | 221 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 222 | 222 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 223 | 223 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 224 | ||
| 224 | ||
| 225 | 225 | PORT_START("ROW3") |
| 226 | 226 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 227 | 227 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| r5932 | r5933 | |
| 231 | 231 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 232 | 232 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 233 | 233 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 234 | ||
| 234 | ||
| 235 | 235 | PORT_START("ROW4") |
| 236 | 236 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 237 | 237 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) |
| r5932 | r5933 | |
| 241 | 241 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 242 | 242 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 243 | 243 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 244 | ||
| 244 | ||
| 245 | 245 | PORT_START("ROW5") |
| 246 | 246 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 247 | 247 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| r5932 | r5933 | |
| 251 | 251 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 252 | 252 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 253 | 253 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 254 | ||
| 254 | ||
| 255 | 255 | PORT_START("ROW6") |
| 256 | 256 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') |
| 257 | 257 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) |
| r5932 | r5933 | |
| 261 | 261 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) |
| 262 | 262 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 263 | 263 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 264 | ||
| 264 | ||
| 265 | 265 | PORT_START("ROW7") |
| 266 | 266 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 267 | 267 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| r5932 | r5933 | |
| 271 | 271 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 272 | 272 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 273 | 273 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 274 | ||
| 274 | ||
| 275 | 275 | PORT_START("ROW8") |
| 276 | 276 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 277 | 277 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| r5932 | r5933 | |
| 279 | 279 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) |
| 280 | 280 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK) |
| 281 | 281 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 282 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 283 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 282 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 283 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 284 | 284 | |
| 285 | 285 | PORT_START("ROW9") |
| 286 | 286 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| r5932 | r5933 | |
| 377 | 377 | MDRV_CPU_PERIODIC_INT(jr200_nmi,20) |
| 378 | 378 | MDRV_CPU_PERIODIC_INT(jr200_irq,20) |
| 379 | 379 | /* |
| 380 | ||
| 380 | MDRV_CPU_ADD("mn1544", MN1544, ?) | |
| 381 | 381 | */ |
| 382 | 382 | MDRV_MACHINE_RESET(jr200) |
| 383 | 383 |
| r5932 | r5933 | |
|---|---|---|
| 283 | 283 | 2008-05 FP: |
| 284 | 284 | Notice that I updated the matrix above with the following new info: |
| 285 | 285 | l1:b1 is LOCK: you press it with CTRL to switch to Caps, you press it again to switch back |
| 286 | ||
| 286 | (you can also use it with ALT) | |
| 287 | 287 | l3:b7 is ESC: you use it to exit from nested programs (e.g. if you start to write a program in BASIC, |
| 288 | ||
| 288 | then start EXDOS, you can use ESC to go back to BASIC without losing the program you were writing) | |
| 289 | 289 | |
| 290 | 290 | According to pictures and manuals, there seem to be no more keys connected, so I label the remaining N/C |
| 291 | 291 | as IPT_UNUSED. |
| r5932 | r5933 | |
| 460 | 460 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 461 | 461 | |
| 462 | 462 | MDRV_WD1770_ADD("wd1770", enterp_wd1770_interface ) |
| 463 | ||
| 463 | ||
| 464 | 464 | MDRV_FLOPPY_4_DRIVES_ADD(enterprise_floppy_config) |
| 465 | 465 | MACHINE_DRIVER_END |
| 466 | 466 |
| r5932 | r5933 | |
|---|---|---|
| 11 | 11 | Sean Young |
| 12 | 12 | |
| 13 | 13 | NEWS: |
| 14 | - Modified memory map, now it has only 1k of RAM mapped on 8k Slot | |
| 15 | - Modified I/O map, now it is handled as on a real ColecoVision: | |
| 14 | - Modified memory map, now it has only 1k of RAM mapped on 8k Slot | |
| 15 | - Modified I/O map, now it is handled as on a real ColecoVision: | |
| 16 | 16 | The I/O map is broken into 4 write and 4 read ports: |
| 17 | 17 | 80-9F (W) = Set both controllers to keypad mode |
| 18 | 18 | 80-9F (R) = Not Connected |
| r5932 | r5933 | |
| 26 | 26 | E0-FF (W) = Sound Chip (SN76489A) |
| 27 | 27 | E0-FF (R) = Read Controller data, A1=0 -> read controller 1, A1=1 -> read controller 2 |
| 28 | 28 | |
| 29 | - Modified paddle handler, now it is handled as on a real ColecoVision | |
| 30 | - Added support for a Driving Controller (Expansion Module #2), enabled via category | |
| 31 | - Added support for a Roller Controller (Trackball), enabled via category | |
| 32 | - Added support for two Super Action Controller, enabled via category | |
| 29 | - Modified paddle handler, now it is handled as on a real ColecoVision | |
| 30 | - Added support for a Driving Controller (Expansion Module #2), enabled via category | |
| 31 | - Added support for a Roller Controller (Trackball), enabled via category | |
| 32 | - Added support for two Super Action Controller, enabled via category | |
| 33 | 33 | |
| 34 | 34 | EXTRA CONTROLLERS INFO: |
| 35 | 35 | |
| 36 | -Driving Controller (Expansion Module #2). It consist of a steering wheel and a gas pedal. Only one | |
| 37 | can be used on a real ColecoVision. The gas pedal is not analog, internally it is just a switch. | |
| 38 | On a real ColecoVision, when the Driving Controller is enabled, the controller 1 do not work because | |
| 39 | have been replaced by the Driving Controller, and controller 2 have to be used to start game, gear | |
| 40 | shift, etc. | |
| 41 | Driving Controller is just a spinner on controller 1 socket similar to the one on Roller Controller | |
| 42 | and Super Action Controllers so you can use Roller Controller or Super Action Controllers to play | |
| 43 | games requiring Driving Controller. | |
| 36 | -Driving Controller (Expansion Module #2). It consist of a steering wheel and a gas pedal. Only one | |
| 37 | can be used on a real ColecoVision. The gas pedal is not analog, internally it is just a switch. | |
| 38 | On a real ColecoVision, when the Driving Controller is enabled, the controller 1 do not work because | |
| 39 | have been replaced by the Driving Controller, and controller 2 have to be used to start game, gear | |
| 40 | shift, etc. | |
| 41 | Driving Controller is just a spinner on controller 1 socket similar to the one on Roller Controller | |
| 42 | and Super Action Controllers so you can use Roller Controller or Super Action Controllers to play | |
| 43 | games requiring Driving Controller. | |
| 44 | 44 | |
| 45 | -Roller Controller. Basically a trackball with four buttons (the two fire buttons from player 1 and | |
| 46 | the two fire buttons from player 2). Only one Roller Controller can be used on a real ColecoVision. | |
| 47 | Roller Controller is connected to both controller sockets and both controllers are conected to the Roller | |
| 48 | Controller, it uses the spinner pins of both sockets to generate the X and Y signals (X from controller 1 | |
| 49 | and the Y from controller 2) | |
| 45 | -Roller Controller. Basically a trackball with four buttons (the two fire buttons from player 1 and | |
| 46 | the two fire buttons from player 2). Only one Roller Controller can be used on a real ColecoVision. | |
| 47 | Roller Controller is connected to both controller sockets and both controllers are conected to the Roller | |
| 48 | Controller, it uses the spinner pins of both sockets to generate the X and Y signals (X from controller 1 | |
| 49 | and the Y from controller 2) | |
| 50 | 50 | |
| 51 | -Super Action Controllers. It is a hand controller with a keypad, four buttons (the two from | |
| 52 | the player pad and two more), and a spinner. This was made primarily for two player sport games, but | |
| 53 | will work for every other ColecoVision game. | |
| 51 | -Super Action Controllers. It is a hand controller with a keypad, four buttons (the two from | |
| 52 | the player pad and two more), and a spinner. This was made primarily for two player sport games, but | |
| 53 | will work for every other ColecoVision game. | |
| 54 | 54 | |
| 55 | 55 | *******************************************************************************************************/ |
| 56 | 56 | |
| 57 | 57 | /* |
| 58 | 58 | |
| 59 | ||
| 59 | TODO: | |
| 60 | 60 | |
| 61 | ||
| 61 | - Dina SG-1000 mode | |
| 62 | 62 | |
| 63 | 63 | */ |
| 64 | 64 | |
| r5932 | r5933 | |
| 93 | 93 | ipt1 = input_port_read(space->machine, "SAC_KPD1"); |
| 94 | 94 | |
| 95 | 95 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more |
| 96 | than one, a real ColecoVision think that it is a third button, so we are going to emulate | |
| 97 | the right behaviour */ | |
| 96 | than one, a real ColecoVision think that it is a third button, so we are going to emulate | |
| 97 | the right behaviour */ | |
| 98 | 98 | /* Super Action Controller additional buttons are read in the same way */ |
| 99 | 99 | if ((ctrl_sel & 0x07) != 0x03) /* If Driving Controller enabled -> no keypad 1*/ |
| 100 | 100 | { |
| r5932 | r5933 | |
| 159 | 159 | ipt2 = input_port_read(space->machine, "SAC_KPD2"); |
| 160 | 160 | |
| 161 | 161 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more |
| 162 | than one, a real ColecoVision think that it is a third button, so we are going to emulate | |
| 163 | the right behaviour */ | |
| 162 | than one, a real ColecoVision think that it is a third button, so we are going to emulate | |
| 163 | the right behaviour */ | |
| 164 | 164 | /* Super Action Controller additional buttons are read in the same way */ |
| 165 | 165 | if (!(ipt2 & 0x0001)) data &= 0x0a; /* 0 */ |
| 166 | 166 | if (!(ipt2 & 0x0002)) data &= 0x0d; /* 1 */ |
| r5932 | r5933 | |
| 190 | 190 | data = input_port_read(space->machine, "SAC_JOY2") & 0xcf; |
| 191 | 191 | |
| 192 | 192 | /* If Roller Controller or P2 Super Action Controller enabled */ |
| 193 | if ((ctrl_sel & 0x80) || ((ctrl_sel & 0x70) == 0x20)) | |
| 193 | if ((ctrl_sel & 0x80) || ((ctrl_sel & 0x70) == 0x20)) | |
| 194 | 194 | { |
| 195 | 195 | if (joy_status[1] == 0) data |= 0x30; |
| 196 | 196 | else if (joy_status[1] == 1) data |= 0x20; |
| r5932 | r5933 | |
| 369 | 369 | PORT_START("DRIV") // Driving Controller |
| 370 | 370 | PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_CODE_DEC(KEYCODE_L) PORT_CODE_INC(KEYCODE_J) PORT_RESET PORT_CATEGORY(5) |
| 371 | 371 | |
| 372 | // PORT_START("IN8") // | |
| 373 | // PORT_BIT( 0x0f, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_PLAYER(2) PORT_CATEGORY(5) | |
| 372 | // PORT_START("IN8") // | |
| 373 | // PORT_BIT( 0x0f, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_PLAYER(2) PORT_CATEGORY(5) | |
| 374 | 374 | INPUT_PORTS_END |
| 375 | 375 | |
| 376 | 376 | static INPUT_PORTS_START( roller ) |
| r5932 | r5933 | |
| 467 | 467 | static void coleco_vdp_interrupt(running_machine *machine, int state) |
| 468 | 468 | { |
| 469 | 469 | // only if it goes up |
| 470 | if (state && !last_state) | |
| 470 | if (state && !last_state) | |
| 471 | 471 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 472 | 472 | |
| 473 | 473 | last_state = state; |
| r5932 | r5933 | |
| 476 | 476 | static TIMER_CALLBACK( paddle_callback ) |
| 477 | 477 | { |
| 478 | 478 | UINT8 analog1 = 0x00; |
| 479 | UINT8 analog2 = 0x00; | |
| 479 | UINT8 analog2 = 0x00; | |
| 480 | 480 | UINT8 ctrl_sel = input_port_read_safe(machine, "CTRLSEL", 0); |
| 481 | 481 | |
| 482 | 482 | /* which controller shall we read? */ |
| 483 | 483 | if ((ctrl_sel & 0x07) == 0x03) // Driving controller |
| 484 | 484 | analog1 = input_port_read_safe(machine, "DRIV", 0); |
| 485 | ||
| 485 | ||
| 486 | 486 | else |
| 487 | 487 | { |
| 488 | 488 | if ((ctrl_sel & 0x07) == 0x02) // Super Action Controller P1 |
| r5932 | r5933 | |
| 491 | 491 | if ((ctrl_sel & 0x70) == 0x20) // Super Action Controller P2 |
| 492 | 492 | analog2 = input_port_read_safe(machine, "SAC_SLIDE2", 0); |
| 493 | 493 | |
| 494 | /* In principle, even if not supported by any game, I guess we could have two Super | |
| 495 | Action Controllers plugged into the Roller controller ports. Since I found no info | |
| 496 | about the behavior of sliders in such a configuration, we overwrite SAC sliders with | |
| 497 | the Roller trackball inputs and actually use the latter ones, when both are selected. */ | |
| 494 | /* In principle, even if not supported by any game, I guess we could have two Super | |
| 495 | Action Controllers plugged into the Roller controller ports. Since I found no info | |
| 496 | about the behavior of sliders in such a configuration, we overwrite SAC sliders with | |
| 497 | the Roller trackball inputs and actually use the latter ones, when both are selected. */ | |
| 498 | 498 | if (ctrl_sel & 0x80) // Roller controller |
| 499 | 499 | { |
| 500 | 500 | analog1 = input_port_read_safe(machine, "ROLLER_X", 0); |
| r5932 | r5933 | |
| 545 | 545 | |
| 546 | 546 | //static int coleco_cart_verify(const UINT8 *cartdata, size_t size) |
| 547 | 547 | //{ |
| 548 | // | |
| 548 | // int retval = IMAGE_VERIFY_FAIL; | |
| 549 | 549 | // |
| 550 | // /* Verify the file is in Colecovision format */ | |
| 551 | // if ((cartdata[0] == 0xAA) && (cartdata[1] == 0x55)) /* Production Cartridge */ | |
| 552 | // retval = IMAGE_VERIFY_PASS; | |
| 553 | // if ((cartdata[0] == 0x55) && (cartdata[1] == 0xAA)) /* "Test" Cartridge. Some games use this method to skip ColecoVision title screen and delay */ | |
| 554 | // retval = IMAGE_VERIFY_PASS; | |
| 550 | // /* Verify the file is in Colecovision format */ | |
| 551 | // if ((cartdata[0] == 0xAA) && (cartdata[1] == 0x55)) /* Production Cartridge */ | |
| 552 | // retval = IMAGE_VERIFY_PASS; | |
| 553 | // if ((cartdata[0] == 0x55) && (cartdata[1] == 0xAA)) /* "Test" Cartridge. Some games use this method to skip ColecoVision title screen and delay */ | |
| 554 | // retval = IMAGE_VERIFY_PASS; | |
| 555 | 555 | // |
| 556 | // | |
| 556 | // return retval; | |
| 557 | 557 | //} |
| 558 | 558 | |
| 559 | 559 | static DEVICE_IMAGE_LOAD( czz50_cart ) |
| r5932 | r5933 | |
| 665 | 665 | |
| 666 | 666 | /* System Drivers */ |
| 667 | 667 | |
| 668 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY | |
| 668 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS | |
| 669 | 669 | CONS( 1982, coleco, 0, 0, coleco, coleco, 0, 0, "Coleco", "ColecoVision", 0 ) |
| 670 | 670 | CONS( 1982, colecoa, coleco, 0, coleco, coleco, 0, 0, "Coleco", "ColecoVision (Thick Characters)", 0 ) |
| 671 | 671 | CONS( 1983, colecob, coleco, 0, coleco, coleco, 0, 0, "Spectravideo", "SVI-603 Coleco Game Adapter", 0 ) |
| r5932 | r5933 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | /* |
| 10 | 10 | |
| 11 | ||
| 11 | TODO: | |
| 12 | 12 | |
| 13 | - HALT led | |
| 14 | - KSD11 switch | |
| 15 | - banking for ROM 4-5 | |
| 16 | - Schachcomputer SC-80 | |
| 17 | - CTC clock inputs | |
| 13 | - HALT led | |
| 14 | - KSD11 switch | |
| 15 | - banking for ROM 4-5 | |
| 16 | - Schachcomputer SC-80 | |
| 17 | - CTC clock inputs | |
| 18 | 18 | |
| 19 | 19 | */ |
| 20 | 20 | |
| r5932 | r5933 | |
| 144 | 144 | static WRITE8_DEVICE_HANDLER( pio1_port_a_w ) |
| 145 | 145 | { |
| 146 | 146 | /* |
| 147 | ||
| 148 | bit description | |
| 149 | 147 | |
| 150 | PA0 VQE23 segment B | |
| 151 | PA1 VQE23 segment F | |
| 152 | PA2 VQE23 segment A | |
| 153 | PA3 VQE23 segment G | |
| 154 | PA4 VQE23 segment DP | |
| 155 | PA5 VQE23 segment C | |
| 156 | PA6 VQE23 segment E | |
| 157 | PA7 VQE23 segment D | |
| 148 | bit description | |
| 158 | 149 | |
| 159 | */ | |
| 150 | PA0 VQE23 segment B | |
| 151 | PA1 VQE23 segment F | |
| 152 | PA2 VQE23 segment A | |
| 153 | PA3 VQE23 segment G | |
| 154 | PA4 VQE23 segment DP | |
| 155 | PA5 VQE23 segment C | |
| 156 | PA6 VQE23 segment E | |
| 157 | PA7 VQE23 segment D | |
| 160 | 158 | |
| 159 | */ | |
| 160 | ||
| 161 | 161 | lc80_state *state = device->machine->driver_data; |
| 162 | 162 | |
| 163 | 163 | state->segment = BITSWAP8(~data, 4, 3, 1, 6, 7, 5, 0, 2); |
| r5932 | r5933 | |
| 168 | 168 | static READ8_DEVICE_HANDLER( pio1_port_b_r ) |
| 169 | 169 | { |
| 170 | 170 | /* |
| 171 | ||
| 172 | bit description | |
| 173 | 171 | |
| 174 | PB0 tape input | |
| 175 | PB1 tape output | |
| 176 | PB2 digit 0 | |
| 177 | PB3 digit 1 | |
| 178 | PB4 digit 2 | |
| 179 | PB5 digit 3 | |
| 180 | PB6 digit 4 | |
| 181 | PB7 digit 5 | |
| 172 | bit description | |
| 182 | 173 | |
| 183 | */ | |
| 174 | PB0 tape input | |
| 175 | PB1 tape output | |
| 176 | PB2 digit 0 | |
| 177 | PB3 digit 1 | |
| 178 | PB4 digit 2 | |
| 179 | PB5 digit 3 | |
| 180 | PB6 digit 4 | |
| 181 | PB7 digit 5 | |
| 184 | 182 | |
| 183 | */ | |
| 184 | ||
| 185 | 185 | lc80_state *state = device->machine->driver_data; |
| 186 | 186 | |
| 187 | 187 | return (cassette_input(state->cassette) < +0.0); |
| r5932 | r5933 | |
| 190 | 190 | static WRITE8_DEVICE_HANDLER( pio1_port_b_w ) |
| 191 | 191 | { |
| 192 | 192 | /* |
| 193 | ||
| 194 | bit description | |
| 195 | 193 | |
| 196 | PB0 tape input | |
| 197 | PB1 tape output, speaker output, OUT led | |
| 198 | PB2 digit 0 | |
| 199 | PB3 digit 1 | |
| 200 | PB4 digit 2 | |
| 201 | PB5 digit 3 | |
| 202 | PB6 digit 4 | |
| 203 | PB7 digit 5 | |
| 194 | bit description | |
| 204 | 195 | |
| 205 | */ | |
| 196 | PB0 tape input | |
| 197 | PB1 tape output, speaker output, OUT led | |
| 198 | PB2 digit 0 | |
| 199 | PB3 digit 1 | |
| 200 | PB4 digit 2 | |
| 201 | PB5 digit 3 | |
| 202 | PB6 digit 4 | |
| 203 | PB7 digit 5 | |
| 206 | 204 | |
| 205 | */ | |
| 206 | ||
| 207 | 207 | lc80_state *state = device->machine->driver_data; |
| 208 | 208 | |
| 209 | 209 | /* tape output */ |
| r5932 | r5933 | |
| 236 | 236 | static READ8_DEVICE_HANDLER( pio2_port_b_r ) |
| 237 | 237 | { |
| 238 | 238 | /* |
| 239 | ||
| 240 | bit description | |
| 241 | 239 | |
| 242 | PB0 | |
| 243 | PB1 | |
| 244 | PB2 | |
| 245 | PB3 | |
| 246 | PB4 key row 0 | |
| 247 | PB5 key row 1 | |
| 248 | PB6 key row 2 | |
| 249 | PB7 key row 3 | |
| 240 | bit description | |
| 250 | 241 | |
| 251 | */ | |
| 242 | PB0 | |
| 243 | PB1 | |
| 244 | PB2 | |
| 245 | PB3 | |
| 246 | PB4 key row 0 | |
| 247 | PB5 key row 1 | |
| 248 | PB6 key row 2 | |
| 249 | PB7 key row 3 | |
| 252 | 250 | |
| 251 | */ | |
| 252 | ||
| 253 | 253 | lc80_state *state = device->machine->driver_data; |
| 254 | 254 | UINT8 data = 0xf0; |
| 255 | 255 | int i; |
| r5932 | r5933 | |
| 309 | 309 | memory_configure_bank(machine, 2, 0, 1, memory_region(machine, Z80_TAG) + 0x800, 0); // TODO |
| 310 | 310 | memory_configure_bank(machine, 2, 1, 1, memory_region(machine, Z80_TAG) + 0x800, 0); |
| 311 | 311 | memory_set_bank(machine, 2, 1); |
| 312 | ||
| 312 | ||
| 313 | 313 | memory_configure_bank(machine, 3, 0, 1, memory_region(machine, Z80_TAG) + 0x1000, 0); // TODO |
| 314 | 314 | memory_configure_bank(machine, 3, 1, 1, memory_region(machine, Z80_TAG) + 0x1000, 0); |
| 315 | 315 | memory_set_bank(machine, 3, 1); |
| r5932 | r5933 | |
| 411 | 411 | |
| 412 | 412 | static MACHINE_DRIVER_START( sc80 ) |
| 413 | 413 | MDRV_IMPORT_FROM( lc80_2 ) |
| 414 | ||
| 414 | ||
| 415 | 415 | /* basic machine hardware */ |
| 416 | 416 | MDRV_CPU_MODIFY(Z80_TAG) |
| 417 | 417 | MDRV_CPU_PROGRAM_MAP(sc80_mem) |
| r5932 | r5933 | |
| 455 | 455 | |
| 456 | 456 | /* System Drivers */ |
| 457 | 457 | |
| 458 | /* YEAR | |
| 458 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 459 | 459 | COMP( 1984, lc80, 0, 0, lc80, lc80, 0, lc80, "VEB Mikroelektronik", "Lerncomputer LC 80", GAME_SUPPORTS_SAVE ) |
| 460 | 460 | COMP( 1984, lc80_2, lc80, 0, lc80_2, lc80, 0, lc80_2, "VEB Mikroelektronik", "Lerncomputer LC 80.2", GAME_SUPPORTS_SAVE ) |
| 461 | 461 | COMP( 1984, sc80, lc80, 0, lc80_2, lc80, 0, lc80_2, "VEB Mikroelektronik", "Schachcomputer SC-80", GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 523 | 523 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 5") PORT_CODE(KEYCODE_5_PAD) PORT_PLAYER(2) |
| 524 | 524 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 8") PORT_CODE(KEYCODE_8_PAD) PORT_PLAYER(2) |
| 525 | 525 | |
| 526 | // | |
| 526 | // PORT_INCLUDE( m6847_artifacting ) // breaks apfimag keyboard | |
| 527 | 527 | INPUT_PORTS_END |
| 528 | 528 | |
| 529 | 529 | |
| r5932 | r5933 | |
| 667 | 667 | |
| 668 | 668 | static MACHINE_DRIVER_START( apf_imagination ) |
| 669 | 669 | /* basic machine hardware */ |
| 670 | // | |
| 670 | // MDRV_CPU_ADD("maincpu", M6800, 3750000) /* 7.8336 MHz, only 6800p type used 1 MHz max*/ | |
| 671 | 671 | MDRV_CPU_ADD("maincpu", M6800, 1000000 ) /* backgammon uses timing from vertical interrupt to switch between video modes during frame */ |
| 672 | 672 | MDRV_CPU_PROGRAM_MAP(apf_imagination_map) |
| 673 | 673 | MDRV_SCREEN_ADD("screen", RASTER) |
| r5932 | r5933 | |
| 728 | 728 | ROM_START(apfm1000) |
| 729 | 729 | ROM_REGION(0x10000+0x0800,"maincpu",0) |
| 730 | 730 | ROM_LOAD("apf_4000.rom",0x010000, 0x0800, CRC(2a331a33) SHA1(387b90882cd0b66c192d9cbaa3bec250f897e4f1)) |
| 731 | // | |
| 731 | // ROM_LOAD("apf-m1000rom.bin",0x010000, 0x0800, CRC(cc6ac840) SHA1(1110a234bcad99bd0894ad44c591389d16376ca4)) | |
| 732 | 732 | ROM_CART_LOAD("cart", 0x8000, 0x2000, ROM_OPTIONAL) |
| 733 | 733 | ROM_END |
| 734 | 734 |
| r5932 | r5933 | |
|---|---|---|
| 34 | 34 | vramaddr = (vramaddr & 0x1fffff); |
| 35 | 35 | vramaddr |= (s3c240x_vidregs[5]&0xffe00000)<<1; |
| 36 | 36 | |
| 37 | vram = (UINT8 *)&s3c240x_ram[(vramaddr-0x0c000000)/4]; | |
| 37 | vram = (UINT8 *)&s3c240x_ram[(vramaddr-0x0c000000)/4]; | |
| 38 | 38 | |
| 39 | 39 | for (y = 0; y < 240; y++) |
| 40 | 40 | { |
| 41 | 41 | UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0); |
| 42 | ||
| 42 | ||
| 43 | 43 | for (x = 0; x < 320; x++) |
| 44 | 44 | { |
| 45 | 45 | *scanline++ = vram[(160*y)+x]; |
| r5932 | r5933 | |
| 82 | 82 | |
| 83 | 83 | static WRITE32_HANDLER(s3c240x_irq_w) |
| 84 | 84 | { |
| 85 | // | |
| 85 | // printf("%08x to interrupt controller @ 0x144000%02x\n", data, offset<<2); | |
| 86 | 86 | |
| 87 | 87 | COMBINE_DATA(&s3c240x_irq_regs[offset]); |
| 88 | 88 | } |
| r5932 | r5933 | |
| 122 | 122 | { |
| 123 | 123 | if (ctrl_bits & 1) // timer start? |
| 124 | 124 | { |
| 125 | // | |
| 125 | // printf("starting timer %d\n", timer); | |
| 126 | 126 | } |
| 127 | 127 | else // stopping is easy |
| 128 | 128 | { |
| 129 | // | |
| 129 | // printf("stopping timer %d\n", timer); | |
| 130 | 130 | timer_adjust_oneshot(s3c240x_timers[timer], attotime_never, 0); |
| 131 | } | |
| 131 | } | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | static WRITE32_HANDLER(s3c240x_timer_w) |
| 135 | 135 | { |
| 136 | 136 | UINT32 old_value = s3c240x_timer_regs[offset]; |
| 137 | 137 | |
| 138 | // | |
| 138 | // printf("%08x to timer @ 0x151000%02x (%s)\n", data, offset<<2, timer_reg_names[offset]); | |
| 139 | 139 | |
| 140 | 140 | COMBINE_DATA(&s3c240x_timer_regs[offset]); |
| 141 | 141 | |
| r5932 | r5933 | |
| 155 | 155 | { |
| 156 | 156 | s3c240x_timer_recalc(space->machine, 2, (data>>12)&0xf, 0x24); |
| 157 | 157 | } |
| 158 | ||
| 158 | ||
| 159 | 159 | if ((data & 0x10000) != (old_value & 0x10000)) // timer 3 status change |
| 160 | 160 | { |
| 161 | 161 | s3c240x_timer_recalc(space->machine, 3, (data>>16)&0xf, 0x30); |
| r5932 | r5933 | |
| 188 | 188 | |
| 189 | 189 | static READ32_HANDLER( s3c240x_gpio_r ) |
| 190 | 190 | { |
| 191 | // | |
| 191 | // printf("read GPIO @ 0x156000%02x (PC %x)\n", offset*4, cpu_get_pc(space->cpu)); | |
| 192 | 192 | |
| 193 | 193 | return s3c240x_gpio[offset]; |
| 194 | 194 | } |
| r5932 | r5933 | |
| 197 | 197 | { |
| 198 | 198 | COMBINE_DATA(&s3c240x_gpio[offset]); |
| 199 | 199 | |
| 200 | // | |
| 200 | // printf("%08x to GPIO @ 0x156000%02x (PC %x)\n", data, offset*4, cpu_get_pc(space->cpu)); | |
| 201 | 201 | |
| 202 | // | |
| 202 | // if (offset == 0x30/4) printf("[%08x] %s %s\n", data, (data & 0x200) ? "SCL" : "scl", (data & 0x400) ? "SDL" : "sdl"); | |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | static ADDRESS_MAP_START( gp32_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| r5932 | r5933 | |
|---|---|---|
| 191 | 191 | MDRV_DMA8257_ADD("dma8257", XTAL_16MHz / 9, partner_dma) |
| 192 | 192 | |
| 193 | 193 | MDRV_CASSETTE_ADD( "cassette", partner_cassette_config ) |
| 194 | ||
| 194 | ||
| 195 | 195 | MDRV_WD1793_ADD("wd1793", partner_wd17xx_interface ) |
| 196 | ||
| 196 | ||
| 197 | 197 | MDRV_FLOPPY_2_DRIVES_ADD(partner_floppy_config) |
| 198 | 198 | MACHINE_DRIVER_END |
| 199 | 199 |
| r5932 | r5933 | |
|---|---|---|
| 488 | 488 | |
| 489 | 489 | pad = input_port_read(machine, padnames[intback_stage-2]); |
| 490 | 490 | |
| 491 | // | |
| 491 | // if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2); | |
| 492 | 492 | smpc_ram[33] = 0xf1; // no tap, direct connect |
| 493 | 493 | smpc_ram[35] = 0x02; // saturn pad |
| 494 | 494 | smpc_ram[37] = pad>>8; |
| r5932 | r5933 | |
| 526 | 526 | if (LOG_SMPC) logerror("SMPC: SH-2 direct mode, returning data for phase %d\n", hshake); |
| 527 | 527 | |
| 528 | 528 | return_data = 0x9f; |
| 529 | ||
| 529 | ||
| 530 | 530 | switch (hshake) |
| 531 | 531 | { |
| 532 | 532 | case 0: |
| 533 | 533 | return_data = 0x90; |
| 534 | // | |
| 534 | // return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>4) & 0xf); | |
| 535 | 535 | break; |
| 536 | 536 | |
| 537 | 537 | case 1: |
| 538 | // | |
| 538 | // return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>12) & 0xf); | |
| 539 | 539 | break; |
| 540 | 540 | |
| 541 | 541 | case 2: |
| 542 | // | |
| 542 | // return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>8) & 0xf); | |
| 543 | 543 | break; |
| 544 | 544 | |
| 545 | 545 | case 3: |
| 546 | 546 | return_data = 0x94; |
| 547 | // | |
| 547 | // return_data = 0xf0 | (input_port_read(space->machine, "JOY1")&0x8) | 0x4; | |
| 548 | 548 | break; |
| 549 | 549 | } |
| 550 | 550 | } |
| r5932 | r5933 | |
| 599 | 599 | |
| 600 | 600 | if (offset == 0x75) // PDR1 |
| 601 | 601 | { |
| 602 | PDR1 = (data & smpc_ram[0x79]); | |
| 602 | PDR1 = (data & smpc_ram[0x79]); | |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | if (offset == 0x77) // PDR2 |
| r5932 | r5933 | |
| 1947 | 1947 | AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x01f00000) AM_SHARE(3) AM_BASE(&stv_workram_h) |
| 1948 | 1948 | AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE(6) // bios mirror |
| 1949 | 1949 | AM_RANGE(0x22000000, 0x24ffffff) AM_ROM AM_SHARE(7) // cart mirror |
| 1950 | ADDRESS_MAP_END | |
| 1950 | ADDRESS_MAP_END | |
| 1951 | 1951 | |
| 1952 | 1952 | static ADDRESS_MAP_START( sound_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 1953 | 1953 | AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE(&sound_ram) |
| r5932 | r5933 | |
| 2214 | 2214 | smpc_ram[0x2d] = DectoBCD(systime.local_time.minute); |
| 2215 | 2215 | smpc_ram[0x2f] = DectoBCD(systime.local_time.second); |
| 2216 | 2216 | smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??) |
| 2217 | // | |
| 2217 | // smpc_ram[0x33] = input_port_read(machine, "???"); | |
| 2218 | 2218 | smpc_ram[0x5f] = 0x10; |
| 2219 | 2219 | } |
| 2220 | 2220 | |
| r5932 | r5933 | |
| 2257 | 2257 | state_save_register_global(machine, EXLE2); |
| 2258 | 2258 | state_save_register_global(machine, PDR1); |
| 2259 | 2259 | state_save_register_global(machine, PDR2); |
| 2260 | // state_save_register_global(machine, port_sel); | |
| 2261 | // state_save_register_global(machine, mux_data); | |
| 2260 | // state_save_register_global(machine, port_sel); | |
| 2261 | // state_save_register_global(machine, mux_data); | |
| 2262 | 2262 | state_save_register_global(machine, scsp_last_line); |
| 2263 | 2263 | state_save_register_global(machine, intback_stage); |
| 2264 | 2264 | state_save_register_global(machine, pmode); |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | 4004 Nixie Clock |
| 4 | 4 | |
| 5 | 5 | 03/08/2009 Initial driver |
| r5932 | r5933 | |
| 19 | 19 | const device_config *dac; |
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | static READ8_HANDLER(data_r) | |
| 22 | static READ8_HANDLER(data_r) | |
| 23 | 23 | { |
| 24 | 24 | return input_port_read(space->machine, "INPUT") & 0x0f; |
| 25 | 25 | } |
| r5932 | r5933 | |
| 49 | 49 | output_set_indexed_value("neon", index, value); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | static void update_nixie(running_machine *machine) | |
| 52 | static void update_nixie(running_machine *machine) | |
| 53 | 53 | { |
| 54 | 54 | _4004clk_state *state = machine->driver_data; |
| 55 | 55 | |
| r5932 | r5933 | |
| 61 | 61 | output_set_nixie_value(0,nixie_to_num((state->nixie[14] << 6) | (state->nixie[13] << 2) | (state->nixie[12] >>2))); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | static WRITE8_HANDLER(nixie_w) | |
| 64 | static WRITE8_HANDLER(nixie_w) | |
| 65 | 65 | { |
| 66 | 66 | _4004clk_state *state = space->machine->driver_data; |
| 67 | 67 | state->nixie[offset] = data; |
| 68 | 68 | update_nixie(space->machine); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | static WRITE8_HANDLER(neon_w) | |
| 71 | static WRITE8_HANDLER(neon_w) | |
| 72 | 72 | { |
| 73 | 73 | output_set_neon_value(0,BIT(data,3)); |
| 74 | 74 | output_set_neon_value(1,BIT(data,2)); |
| r5932 | r5933 | |
| 76 | 76 | output_set_neon_value(3,BIT(data,0)); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | static WRITE8_HANDLER(relays_w) | |
| 80 | { | |
| 79 | static WRITE8_HANDLER(relays_w) | |
| 80 | { | |
| 81 | 81 | _4004clk_state *state = space->machine->driver_data; |
| 82 | dac_data_w(state->dac, (data & 1) ? 0x80 : 0x40); //tick - tock | |
| 82 | dac_data_w(state->dac, (data & 1) ? 0x80 : 0x40); //tick - tock | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | static ADDRESS_MAP_START(4004clk_rom, ADDRESS_SPACE_PROGRAM, 8) |
| r5932 | r5933 | |
| 87 | 87 | ADDRESS_MAP_END |
| 88 | 88 | |
| 89 | 89 | static ADDRESS_MAP_START(4004clk_mem, ADDRESS_SPACE_DATA, 8) |
| 90 | ADDRESS_MAP_UNMAP_HIGH | |
| 90 | ADDRESS_MAP_UNMAP_HIGH | |
| 91 | 91 | AM_RANGE(0x0000, 0x007F) AM_RAM |
| 92 | 92 | ADDRESS_MAP_END |
| 93 | 93 | |
| 94 | 94 | static ADDRESS_MAP_START( 4004clk_io , ADDRESS_SPACE_IO, 8) |
| 95 | ADDRESS_MAP_UNMAP_HIGH | |
| 95 | ADDRESS_MAP_UNMAP_HIGH | |
| 96 | 96 | AM_RANGE(0x00, 0x0e) AM_WRITE(nixie_w) |
| 97 | 97 | AM_RANGE(0x00, 0x00) AM_READ(data_r) |
| 98 | 98 | AM_RANGE(0x0f, 0x0f) AM_WRITE(neon_w) |
| r5932 | r5933 | |
| 113 | 113 | INPUT_PORTS_END |
| 114 | 114 | |
| 115 | 115 | /* |
| 116 | 16ms Int generator | |
| 117 | __ __ | |
| 118 | _| |_| | |
| 119 | 0 1 0 1 | |
| 120 | ||
| 116 | 16ms Int generator | |
| 117 | __ __ | |
| 118 | _| |_| | |
| 119 | 0 1 0 1 | |
| 120 | ||
| 121 | 121 | */ |
| 122 | 122 | |
| 123 | 123 | static TIMER_CALLBACK(timer_callback) |
| r5932 | r5933 | |
| 127 | 127 | state->timer^=1; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | static MACHINE_START(4004clk) | |
| 130 | static MACHINE_START(4004clk) | |
| 131 | 131 | { |
| 132 | 132 | _4004clk_state *state = machine->driver_data; |
| 133 | 133 | state->timer = 0; |
| 134 | 134 | state->dac = devtag_get_device(machine, "dac"); |
| 135 | 135 | |
| 136 | 136 | timer_pulse(machine, ATTOTIME_IN_HZ(120), NULL, 0, timer_callback); |
| 137 | ||
| 137 | ||
| 138 | 138 | /* register for state saving */ |
| 139 | 139 | state_save_register_global(machine, state->timer); |
| 140 | 140 | state_save_register_global_pointer(machine, state->nixie, 6); |
| r5932 | r5933 | |
| 146 | 146 | MDRV_CPU_ADD("maincpu",I4004, XTAL_5MHz / 8) |
| 147 | 147 | MDRV_CPU_PROGRAM_MAP(4004clk_rom) |
| 148 | 148 | MDRV_CPU_DATA_MAP(4004clk_mem) |
| 149 | MDRV_CPU_IO_MAP(4004clk_io) | |
| 149 | MDRV_CPU_IO_MAP(4004clk_io) | |
| 150 | 150 | |
| 151 | 151 | MDRV_MACHINE_START(4004clk) |
| 152 | ||
| 152 | ||
| 153 | 153 | /* video hardware */ |
| 154 | MDRV_DEFAULT_LAYOUT(layout_4004clk) | |
| 155 | ||
| 154 | MDRV_DEFAULT_LAYOUT(layout_4004clk) | |
| 155 | ||
| 156 | 156 | /* sound hardware */ |
| 157 | 157 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 158 | 158 | MDRV_SOUND_ADD("dac", DAC, 0) |
| r5932 | r5933 | |
| 182 | 182 | |
| 183 | 183 | /* Driver */ |
| 184 | 184 | |
| 185 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY | |
| 185 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 186 | 186 | COMP( 2008, 4004clk, 0, 0, 4004clk, 4004clk, 0, 0, "John L. Weinrich", "4004 Nixie Clock", GAME_SUPPORTS_SAVE) |
| 187 | 187 |
| r5932 | r5933 | |
|---|---|---|
| 81 | 81 | static READ8_DEVICE_HANDLER( pio1_port_a_r ) |
| 82 | 82 | { |
| 83 | 83 | /* |
| 84 | ||
| 85 | bit description | |
| 86 | 84 | |
| 87 | PA0 keyboard row 0 input | |
| 88 | PA1 keyboard row 1 input | |
| 89 | PA2 keyboard row 2 input | |
| 90 | PA3 | |
| 91 | PA4 _BSTB input | |
| 92 | PA5 display enable output (0=enabled, 1=disabled) | |
| 93 | PA6 tape output | |
| 94 | PA7 tape input | |
| 85 | bit description | |
| 95 | 86 | |
| 96 | */ | |
| 87 | PA0 keyboard row 0 input | |
| 88 | PA1 keyboard row 1 input | |
| 89 | PA2 keyboard row 2 input | |
| 90 | PA3 | |
| 91 | PA4 _BSTB input | |
| 92 | PA5 display enable output (0=enabled, 1=disabled) | |
| 93 | PA6 tape output | |
| 94 | PA7 tape input | |
| 97 | 95 | |
| 96 | */ | |
| 97 | ||
| 98 | 98 | c80_state *state = device->machine->driver_data; |
| 99 | 99 | |
| 100 | 100 | UINT8 data = !state->pio1_brdy << 4 | 0x07; |
| r5932 | r5933 | |
| 119 | 119 | static WRITE8_DEVICE_HANDLER( pio1_port_a_w ) |
| 120 | 120 | { |
| 121 | 121 | /* |
| 122 | ||
| 123 | bit description | |
| 124 | 122 | |
| 125 | PA0 keyboard row 0 input | |
| 126 | PA1 keyboard row 1 input | |
| 127 | PA2 keyboard row 2 input | |
| 128 | PA3 | |
| 129 | PA4 _BSTB input | |
| 130 | PA5 display enable output (0=enabled, 1=disabled) | |
| 131 | PA6 tape output | |
| 132 | PA7 tape input | |
| 123 | bit description | |
| 133 | 124 | |
| 134 | */ | |
| 135 | ||
| 125 | PA0 keyboard row 0 input | |
| 126 | PA1 keyboard row 1 input | |
| 127 | PA2 keyboard row 2 input | |
| 128 | PA3 | |
| 129 | PA4 _BSTB input | |
| 130 | PA5 display enable output (0=enabled, 1=disabled) | |
| 131 | PA6 tape output | |
| 132 | PA7 tape input | |
| 133 | ||
| 134 | */ | |
| 135 | ||
| 136 | 136 | c80_state *state = device->machine->driver_data; |
| 137 | 137 | |
| 138 | 138 | state->pio1_a5 = BIT(data, 5); |
| r5932 | r5933 | |
| 148 | 148 | static WRITE8_DEVICE_HANDLER( pio1_port_b_w ) |
| 149 | 149 | { |
| 150 | 150 | /* |
| 151 | ||
| 152 | bit description | |
| 153 | 151 | |
| 154 | PB0 VQD30 segment A | |
| 155 | PB1 VQD30 segment B | |
| 156 | PB2 VQD30 segment C | |
| 157 | PB3 VQD30 segment D | |
| 158 | PB4 VQD30 segment E | |
| 159 | PB5 VQD30 segment F | |
| 160 | PB6 VQD30 segment G | |
| 161 | PB7 VQD30 segment P | |
| 152 | bit description | |
| 162 | 153 | |
| 163 | */ | |
| 154 | PB0 VQD30 segment A | |
| 155 | PB1 VQD30 segment B | |
| 156 | PB2 VQD30 segment C | |
| 157 | PB3 VQD30 segment D | |
| 158 | PB4 VQD30 segment E | |
| 159 | PB5 VQD30 segment F | |
| 160 | PB6 VQD30 segment G | |
| 161 | PB7 VQD30 segment P | |
| 164 | 162 | |
| 163 | */ | |
| 164 | ||
| 165 | 165 | c80_state *state = device->machine->driver_data; |
| 166 | 166 | |
| 167 | 167 | if (!state->pio1_a5) |
| r5932 | r5933 | |
| 281 | 281 | |
| 282 | 282 | /* System Drivers */ |
| 283 | 283 | |
| 284 | /* YEAR | |
| 284 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 285 | 285 | COMP( 1986, c80, 0, 0, c80, c80, 0, c80, "Joachim Czepa", "C-80", GAME_SUPPORTS_SAVE ) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | |
| 3 | ||
| 3 | Telmac 2000E | |
| 4 | 4 | ------------ |
| 5 | 5 | (c) 1980 Telercas Oy, Finland |
| 6 | 6 | |
| r5932 | r5933 | |
| 214 | 214 | // tape in |
| 215 | 215 | |
| 216 | 216 | if (cassette_input(state->cassette) > +1.0) flags -= EF2; |
| 217 | ||
| 217 | ||
| 218 | 218 | // keyboard |
| 219 | 219 | |
| 220 | 220 | if (~input_port_read(device->machine, keynames[state->keylatch / 8]) & (1 << (state->keylatch % 8))) flags -= EF3; |
| r5932 | r5933 | |
| 324 | 324 | |
| 325 | 325 | // video hardware |
| 326 | 326 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 327 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 327 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) | |
| 328 | 328 | MDRV_SCREEN_RAW_PARAMS(XTAL_1_75MHz, CDP1864_SCREEN_WIDTH, CDP1864_HBLANK_END, CDP1864_HBLANK_START, CDP1864_TOTAL_SCANLINES, CDP1864_SCANLINE_VBLANK_END, CDP1864_SCANLINE_VBLANK_START) |
| 329 | 329 | |
| 330 | 330 | MDRV_PALETTE_LENGTH(8) |
| r5932 | r5933 | |
| 338 | 338 | /* devices */ |
| 339 | 339 | MDRV_PRINTER_ADD("printer") |
| 340 | 340 | MDRV_CASSETTE_ADD("cassette", tmc2000_cassette_config) |
| 341 | ||
| 342 | MDRV_FLOPPY_4_DRIVES_ADD(tmc2000e_floppy_config) | |
| 341 | ||
| 342 | MDRV_FLOPPY_4_DRIVES_ADD(tmc2000e_floppy_config) | |
| 343 | 343 | MACHINE_DRIVER_END |
| 344 | 344 | |
| 345 | 345 | /* ROMs */ |
| r5932 | r5933 | |
|---|---|---|
| 3 | 3 | Hector 2HR+ |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver - Micko |
| 6 | ||
| 6 | 31/06/2009 Video - Robbbert | |
| 7 | 7 | |
| 8 | 8 | ****************************************************************************/ |
| 9 | 9 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Unior |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 24 | 24 | INPUT_PORTS_END |
| 25 | 25 | |
| 26 | 26 | |
| 27 | static MACHINE_RESET(unior) | |
| 28 | { | |
| 27 | static MACHINE_RESET(unior) | |
| 28 | { | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | static VIDEO_START( unior ) |
| r5932 | r5933 | |
| 41 | 41 | /* basic machine hardware */ |
| 42 | 42 | MDRV_CPU_ADD("maincpu",8080, 2222222) |
| 43 | 43 | MDRV_CPU_PROGRAM_MAP(unior_mem) |
| 44 | MDRV_CPU_IO_MAP(unior_io) | |
| 44 | MDRV_CPU_IO_MAP(unior_io) | |
| 45 | 45 | |
| 46 | 46 | MDRV_MACHINE_RESET(unior) |
| 47 | ||
| 47 | ||
| 48 | 48 | /* video hardware */ |
| 49 | 49 | MDRV_SCREEN_ADD("screen", RASTER) |
| 50 | 50 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
|---|---|---|
| 162 | 162 | /*MDRV_PCI_BUS_DEVICE(12, NULL, scsi53c810_pci_read, scsi53c810_pci_write)*/ |
| 163 | 163 | |
| 164 | 164 | MDRV_SMC37C78_ADD("smc37c78", pc_fdc_nec765_connected_1_drive_interface) |
| 165 | ||
| 165 | ||
| 166 | 166 | MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, bebox_floppy_config) |
| 167 | 167 | MACHINE_DRIVER_END |
| 168 | 168 |
| r5932 | r5933 | |
|---|---|---|
| 44 | 44 | PORT_START("LINE1") |
| 45 | 45 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') |
| 46 | 46 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 47 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 47 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 48 | 48 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 49 | 49 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 50 | 50 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| r5932 | r5933 | |
|---|---|---|
| 90 | 90 | //AM_RANGE (0x51, 0x51) AM_READ(uart_1) // UAR |
| 91 | 91 | //AM_RANGE (0x58, 0x58) AM_READ(unknown_58) |
| 92 | 92 | //AM_RANGE (0x60, 0x60) AM_READ(unknown_60) |
| 93 | //AM_RANGE (0x68, 0x68) AM_READ(unknown_68) // NOT USED | |
| 93 | //AM_RANGE (0x68, 0x68) AM_READ(unknown_68) // NOT USED | |
| 94 | 94 | //AM_RANGE (0x70, 0x70) AM_READ(unknown_70) |
| 95 | 95 | //AM_RANGE (0x78, 0x7f) AM_READ(unknown_78) |
| 96 | 96 | ADDRESS_MAP_END |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | EC-65 |
| 4 | 4 | |
| 5 | 5 | 16/07/2009 Initial driver. |
| r5932 | r5933 | |
| 34 | 34 | AM_RANGE(0xe110, 0xe11f) AM_DEVREADWRITE(VIA6522_1_TAG, via_r, via_w) |
| 35 | 35 | AM_RANGE(0xe130, 0xe133) AM_DEVREADWRITE(ACIA6551_TAG, acia_6551_r, acia_6551_w ) |
| 36 | 36 | AM_RANGE(0xe140, 0xe140) AM_DEVWRITE(MC6845_TAG, mc6845_address_w) |
| 37 | AM_RANGE(0xe141, 0xe141) AM_DEVREADWRITE(MC6845_TAG, mc6845_register_r , mc6845_register_w) | |
| 37 | AM_RANGE(0xe141, 0xe141) AM_DEVREADWRITE(MC6845_TAG, mc6845_register_r , mc6845_register_w) | |
| 38 | 38 | AM_RANGE(0xe400, 0xe7ff) AM_RAM // 1KB on-board RAM |
| 39 | 39 | AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&video_ram) |
| 40 | 40 | AM_RANGE(0xf000, 0xffff) AM_ROM |
| r5932 | r5933 | |
| 95 | 95 | |
| 96 | 96 | const via6522_interface ec65_via_1_intf= |
| 97 | 97 | { |
| 98 | DEVCB_NULL, /* in_a_func */ | |
| 99 | DEVCB_HANDLER(ec65_via_read_b), /* in_b_func */ | |
| 100 | DEVCB_NULL, /* in_ca1_func */ | |
| 101 | DEVCB_NULL, /* in_cb1_func */ | |
| 102 | DEVCB_NULL, /* in_ca2_func */ | |
| 103 | DEVCB_NULL, /* in_cb2_func */ | |
| 104 | DEVCB_HANDLER(ec65_via_write_a), /* out_a_func */ | |
| 105 | DEVCB_HANDLER(ec65_via_write_b), /* out_b_func */ | |
| 98 | DEVCB_NULL, /* in_a_func */ | |
| 99 | DEVCB_HANDLER(ec65_via_read_b), /* in_b_func */ | |
| 100 | DEVCB_NULL, /* in_ca1_func */ | |
| 101 | DEVCB_NULL, /* in_cb1_func */ | |
| 102 | DEVCB_NULL, /* in_ca2_func */ | |
| 103 | DEVCB_NULL, /* in_cb2_func */ | |
| 104 | DEVCB_HANDLER(ec65_via_write_a), /* out_a_func */ | |
| 105 | DEVCB_HANDLER(ec65_via_write_b), /* out_b_func */ | |
| 106 | 106 | DEVCB_NULL, /* out_ca1_func */ |
| 107 | 107 | DEVCB_NULL, /* out_cb1_func */ |
| 108 | 108 | DEVCB_NULL, /* out_ca2_func */ |
| 109 | 109 | DEVCB_NULL, /* out_cb2_func */ |
| 110 | DEVCB_NULL, /* irq_func */ | |
| 110 | DEVCB_NULL, /* irq_func */ | |
| 111 | 111 | }; |
| 112 | 112 | |
| 113 | 113 | const via6522_interface ec65_via_0_intf= |
| 114 | 114 | { |
| 115 | DEVCB_HANDLER(ec65_via_read_a), /* in_a_func */ | |
| 116 | DEVCB_NULL, /* in_b_func */ | |
| 117 | DEVCB_HANDLER(ec65_read_ca1), /* in_ca1_func */ | |
| 118 | DEVCB_NULL, /* in_cb1_func */ | |
| 119 | DEVCB_NULL, /* in_ca2_func */ | |
| 120 | DEVCB_NULL, /* in_cb2_func */ | |
| 121 | DEVCB_NULL, /* out_a_func */ | |
| 122 | DEVCB_NULL, /* out_b_func */ | |
| 115 | DEVCB_HANDLER(ec65_via_read_a), /* in_a_func */ | |
| 116 | DEVCB_NULL, /* in_b_func */ | |
| 117 | DEVCB_HANDLER(ec65_read_ca1), /* in_ca1_func */ | |
| 118 | DEVCB_NULL, /* in_cb1_func */ | |
| 119 | DEVCB_NULL, /* in_ca2_func */ | |
| 120 | DEVCB_NULL, /* in_cb2_func */ | |
| 121 | DEVCB_NULL, /* out_a_func */ | |
| 122 | DEVCB_NULL, /* out_b_func */ | |
| 123 | 123 | DEVCB_NULL, /* out_ca1_func */ |
| 124 | 124 | DEVCB_NULL, /* out_cb1_func */ |
| 125 | 125 | DEVCB_NULL, /* out_ca2_func */ |
| 126 | 126 | DEVCB_NULL, /* out_cb2_func */ |
| 127 | DEVCB_NULL, /* irq_func */ | |
| 127 | DEVCB_NULL, /* irq_func */ | |
| 128 | 128 | }; |
| 129 | 129 | |
| 130 | 130 | /* Input ports */ |
| r5932 | r5933 | |
| 133 | 133 | INPUT_PORTS_END |
| 134 | 134 | |
| 135 | 135 | |
| 136 | static MACHINE_RESET(ec65) | |
| 136 | static MACHINE_RESET(ec65) | |
| 137 | 137 | { |
| 138 | 138 | } |
| 139 | 139 | |
| r5932 | r5933 | |
| 162 | 162 | { |
| 163 | 163 | data = 0xff; |
| 164 | 164 | } |
| 165 | ||
| 165 | ||
| 166 | 166 | for (bit = 0; bit < 8; bit++) |
| 167 | 167 | { |
| 168 | 168 | int x = (column * 8) + bit; |
| 169 | 169 | int color = BIT(data, 7) ? 1 : 0; |
| 170 | ||
| 170 | ||
| 171 | 171 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 172 | 172 | |
| 173 | 173 | data <<= 1; |
| r5932 | r5933 | |
| 195 | 195 | MDRV_CPU_PROGRAM_MAP(ec65_mem) |
| 196 | 196 | |
| 197 | 197 | MDRV_MACHINE_RESET(ec65) |
| 198 | ||
| 198 | ||
| 199 | 199 | /* video hardware */ |
| 200 | 200 | MDRV_SCREEN_ADD("screen", RASTER) |
| 201 | 201 | MDRV_SCREEN_REFRESH_RATE(60) |
| r5932 | r5933 | |
| 206 | 206 | MDRV_PALETTE_LENGTH(2) |
| 207 | 207 | MDRV_PALETTE_INIT(black_and_white) |
| 208 | 208 | |
| 209 | MDRV_MC6845_ADD(MC6845_TAG, MC6845, XTAL_16MHz / 8, ec65_crtc6845_interface) | |
| 210 | ||
| 209 | MDRV_MC6845_ADD(MC6845_TAG, MC6845, XTAL_16MHz / 8, ec65_crtc6845_interface) | |
| 210 | ||
| 211 | 211 | MDRV_VIDEO_START(ec65) |
| 212 | 212 | MDRV_VIDEO_UPDATE(ec65) |
| 213 | ||
| 213 | ||
| 214 | 214 | /* devices */ |
| 215 | 215 | MDRV_PIA6821_ADD( PIA6821_TAG, ec65_pia_interface ) |
| 216 | 216 | MDRV_ACIA6850_ADD(ACIA6850_TAG, ec65_acia_intf) |
| r5932 | r5933 | |
| 225 | 225 | MDRV_CPU_PROGRAM_MAP(ec65k_mem) |
| 226 | 226 | |
| 227 | 227 | MDRV_MACHINE_RESET(ec65) |
| 228 | ||
| 228 | ||
| 229 | 229 | /* video hardware */ |
| 230 | 230 | MDRV_SCREEN_ADD("screen", RASTER) |
| 231 | 231 | MDRV_SCREEN_REFRESH_RATE(60) |
| r5932 | r5933 | |
| 236 | 236 | MDRV_PALETTE_LENGTH(2) |
| 237 | 237 | MDRV_PALETTE_INIT(black_and_white) |
| 238 | 238 | |
| 239 | MDRV_MC6845_ADD(MC6845_TAG, MC6845, XTAL_16MHz / 8, ec65_crtc6845_interface) | |
| 240 | ||
| 239 | MDRV_MC6845_ADD(MC6845_TAG, MC6845, XTAL_16MHz / 8, ec65_crtc6845_interface) | |
| 240 | ||
| 241 | 241 | MDRV_VIDEO_START(ec65) |
| 242 | 242 | MDRV_VIDEO_UPDATE(ec65) |
| 243 | 243 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | Philips VG-5000mu |
| 4 | 4 | |
| 5 | ||
| 5 | 05/2009 Skeleton driver. | |
| 6 | 6 | |
| 7 | 7 | Informations ( see the very informative http://vg5k.free.fr/ ): |
| 8 | 8 | - Variants: Radiola VG5000 and Schneider VG5000 |
| r5932 | r5933 | |
| 19 | 19 | - Keyboard: 63 keys AZERTY, Caps Lock, CTRL key to access 33 BASIC instructions |
| 20 | 20 | - I/O: Tape recorder connector (1200/2400 bauds), Scart connector to TV (RGB), |
| 21 | 21 | External PSU (VU0022) connector, Bus connector (2x25 pins) |
| 22 | - There are 2 versions of the VG5000 ROM, one with Basic v1.0, | |
| 22 | - There are 2 versions of the VG5000 ROM, one with Basic v1.0, | |
| 23 | 23 | contained in two 8 KB ROMs, and one with Basic 1.1, contained in |
| 24 | 24 | a single 16 KB ROM. |
| 25 | 25 | - RAM: 24 KB (3 x 8 KB) type SRAM D4168C, more precisely: |
| 26 | 26 | 2 x 8 KB, used by the system |
| 27 | 27 | 1 x 8 KB, used by the video processor |
| 28 | 28 | - Memory Map: |
| 29 | ||
| 29 | $0000 - $3fff BASIC + monitor | |
| 30 | 30 | $4000 - $47cf Screen |
| 31 | 31 | $47d0 - $7fff reserved area for BASIC, variables, etc |
| 32 | 32 | $8000 - $bfff Memory Expansion 16K or ROM cart |
| r5932 | r5933 | |
|---|---|---|
| 16 | 16 | * Separate stic & video better, get rid of *2 for kbd comp |
| 17 | 17 | * Add better runtime cart loading |
| 18 | 18 | * Switch to tilemap system |
| 19 | * | |
| 19 | * Add IntelliVoice Support | |
| 20 | 20 | * Note from kevtris about IntelliVoice Hookup: |
| 21 | 21 | <kevtris> the intv uses a special chip |
| 22 | 22 | <kevtris> called the SPB640 |
| r5932 | r5933 | |
| 214 | 214 | |
| 215 | 215 | 2008-05 FP: |
| 216 | 216 | The keyboard layout is quite strange, with '[' and ']' at the two ends of the 1st row, |
| 217 | 'Esc' in the 2nd row (between 'Tab' and 'Q'), and with Cursor keys and 'Enter' where | |
| 217 | 'Esc' in the 2nd row (between 'Tab' and 'Q'), and with Cursor keys and 'Enter' where | |
| 218 | 218 | you would expect the braces. Moreover, Shift + Cursor keys produce characters. |
| 219 | 219 | The emulated layout moves 'Esc', '[' and ']' to their usual position. |
| 220 | 220 | |
| r5932 | r5933 | |
| 334 | 334 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) |
| 335 | 335 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) |
| 336 | 336 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) |
| 337 | ||
| 337 | ||
| 338 | 338 | /* 2008-05 FP: I include here the controller inputs to make happy the read_handler. |
| 339 | Please remove this (and re-tag accordingly the inputs above) if intv_right_control_r | |
| 340 | is supposed to scan the keyboard inputs when the Keyboard Component is connected */ | |
| 339 | Please remove this (and re-tag accordingly the inputs above) if intv_right_control_r | |
| 340 | is supposed to scan the keyboard inputs when the Keyboard Component is connected */ | |
| 341 | 341 | PORT_INCLUDE( intv ) |
| 342 | 342 | INPUT_PORTS_END |
| 343 | 343 |
| r5932 | r5933 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | Driver by Mariusz Wojcieszek |
| 6 | 6 | |
| 7 | ToDo: | |
| 8 | - map keys with Polish characters | |
| 9 | - add reading of computer number (read of FE port when bit 4 of port F7 is set) | |
| 10 | - printing (LPRINT from ZX Basic) hangs waiting for bit 0 of DD register (port C of PPI8255), | |
| 11 | may be a bug in handshake implementation of PPI (both PPI implementations are affected) | |
| 12 | - 8251 DTR and DTS signals are connected (with some additional logic) to NMI of Z80, this | |
| 13 | is not emulated | |
| 14 | - 8251 is used for JUNET network (a network of Elwro 800 Junior computers, allows sharing | |
| 15 | floppy disc drives and printers) - network is not emulated | |
| 16 | - when RAM is mapped at 0x0000 - 0x1fff (in CP/J mode), reading a location 66 with /M1=0 | |
| 17 | (effectively reading NMI vector) is hardwired to return 0xDF (RST #18) - this is not emulated | |
| 18 | (note that in CP/J mode address 66 is used for FCB) | |
| 7 | ToDo: | |
| 8 | - map keys with Polish characters | |
| 9 | - add reading of computer number (read of FE port when bit 4 of port F7 is set) | |
| 10 | - printing (LPRINT from ZX Basic) hangs waiting for bit 0 of DD register (port C of PPI8255), | |
| 11 | may be a bug in handshake implementation of PPI (both PPI implementations are affected) | |
| 12 | - 8251 DTR and DTS signals are connected (with some additional logic) to NMI of Z80, this | |
| 13 | is not emulated | |
| 14 | - 8251 is used for JUNET network (a network of Elwro 800 Junior computers, allows sharing | |
| 15 | floppy disc drives and printers) - network is not emulated | |
| 16 | - when RAM is mapped at 0x0000 - 0x1fff (in CP/J mode), reading a location 66 with /M1=0 | |
| 17 | (effectively reading NMI vector) is hardwired to return 0xDF (RST #18) - this is not emulated | |
| 18 | (note that in CP/J mode address 66 is used for FCB) | |
| 19 | 19 | |
| 20 | 20 | ****************************************************************************/ |
| 21 | 21 | |
| r5932 | r5933 | |
| 76 | 76 | UINT8 *prom = memory_region(machine, "proms") + 0x200; |
| 77 | 77 | UINT8 cs; |
| 78 | 78 | UINT8 ls175; |
| 79 | ||
| 79 | ||
| 80 | 80 | ls175 = BITSWAP8(data, 7, 6, 5, 4, 4, 5, 7, 6) & 0x0f; |
| 81 | 81 | |
| 82 | 82 | cs = prom[((0x0000 >> 10) | (ls175 << 6)) & 0x1ff]; |
| r5932 | r5933 | |
| 519 | 519 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 520 | 520 | |
| 521 | 521 | MDRV_CASSETTE_ADD( "cassette", elwro800jr_cassette_config ) |
| 522 | ||
| 522 | ||
| 523 | 523 | MDRV_FLOPPY_2_DRIVES_ADD(elwro800jr_floppy_config) |
| 524 | 524 | MACHINE_DRIVER_END |
| 525 | 525 | |
| 526 | 526 | static SYSTEM_CONFIG_START(elwro800) |
| 527 | CONFIG_RAM_DEFAULT(64 * 1024) | |
| 527 | CONFIG_RAM_DEFAULT(64 * 1024) | |
| 528 | 528 | SYSTEM_CONFIG_END |
| 529 | 529 | |
| 530 | 530 | /************************************* |
| r5932 | r5933 | |
|---|---|---|
| 82 | 82 | /* Input ports */ |
| 83 | 83 | |
| 84 | 84 | /* Inputs will need to be adapted when/if support for non-latin keys is added to natural keyboard: |
| 85 | these systems have different keys to switch among alphabets! | |
| 85 | these systems have different keys to switch among alphabets! | |
| 86 | 86 | */ |
| 87 | 87 | static INPUT_PORTS_START( special ) |
| 88 | 88 | /* Alt switches between Latin and Cyrillic alphabets */ |
| r5932 | r5933 | |
| 443 | 443 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 444 | 444 | |
| 445 | 445 | MDRV_CASSETTE_ADD( "cassette", special_cassette_config ) |
| 446 | ||
| 446 | ||
| 447 | 447 | MACHINE_DRIVER_END |
| 448 | 448 | |
| 449 | 449 | static MACHINE_DRIVER_START( specialp ) |
| r5932 | r5933 | |
| 478 | 478 | /* audio hardware */ |
| 479 | 479 | MDRV_SOUND_ADD("custom", SPECIMX, 0) |
| 480 | 480 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 481 | ||
| 481 | ||
| 482 | 482 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) |
| 483 | ||
| 483 | ||
| 484 | 484 | MDRV_FLOPPY_2_DRIVES_ADD(specimx_floppy_config) |
| 485 | 485 | MACHINE_DRIVER_END |
| 486 | 486 | |
| r5932 | r5933 | |
| 514 | 514 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 515 | 515 | |
| 516 | 516 | MDRV_CASSETTE_ADD( "cassette", special_cassette_config ) |
| 517 | ||
| 518 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) | |
| 519 | ||
| 517 | ||
| 518 | MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) | |
| 519 | ||
| 520 | 520 | MDRV_FLOPPY_2_DRIVES_ADD(specimx_floppy_config) |
| 521 | 521 | MACHINE_DRIVER_END |
| 522 | 522 |
| r5932 | r5933 | |
|---|---|---|
| 61 | 61 | |
| 62 | 62 | /* port i/o functions */ |
| 63 | 63 | static ADDRESS_MAP_START( jupiter_io , ADDRESS_SPACE_IO, 8) |
| 64 | AM_RANGE( 0x0000, 0xffff ) AM_READWRITE( jupiter_io_r, jupiter_port_fe_w ) | |
| 64 | AM_RANGE( 0x0000, 0xffff ) AM_READWRITE( jupiter_io_r, jupiter_port_fe_w ) | |
| 65 | 65 | ADDRESS_MAP_END |
| 66 | 66 | |
| 67 | 67 | |
| r5932 | r5933 | |
| 170 | 170 | } |
| 171 | 171 | if ( ! ( offset & 0x8000 ) ) |
| 172 | 172 | { |
| 173 | // | |
| 173 | // cassette_output( devtag_get_device(space->machine, "cassette"), -1 ); | |
| 174 | 174 | speaker_level_w(speaker,0); |
| 175 | 175 | data = ( data & 0xe0 ) | ( data & input_port_read( space->machine, "KEY7" ) );; |
| 176 | 176 | } |
| r5932 | r5933 | |
| 185 | 185 | static WRITE8_HANDLER( jupiter_port_fe_w ) |
| 186 | 186 | { |
| 187 | 187 | const device_config *speaker = devtag_get_device(space->machine, "speaker"); |
| 188 | // | |
| 188 | // cassette_output( devtag_get_device(machine, "cassette"), 1 ); | |
| 189 | 189 | speaker_level_w(speaker,1); |
| 190 | 190 | } |
| 191 | 191 | |
| r5932 | r5933 | |
| 334 | 334 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 335 | 335 | |
| 336 | 336 | MDRV_CASSETTE_ADD( "cassette", jupiter_cassette_config ) |
| 337 | ||
| 337 | ||
| 338 | 338 | MDRV_CARTSLOT_ADD("cart") |
| 339 | 339 | MDRV_CARTSLOT_EXTENSION_LIST("ace") |
| 340 | 340 | MDRV_CARTSLOT_NOT_MANDATORY |
| r5932 | r5933 | |
|---|---|---|
| 41 | 41 | AM_RANGE( 0x04, 0x04) AM_DEVWRITE ( "dac", radio99_dac_w ) |
| 42 | 42 | AM_RANGE( 0x05, 0x05) AM_READWRITE ( mikro80_8255_portc_r, mikro80_8255_portc_w ) |
| 43 | 43 | AM_RANGE( 0x06, 0x06) AM_READ ( mikro80_8255_portb_r) |
| 44 | AM_RANGE( 0x07, 0x07) AM_WRITE ( mikro80_8255_porta_w) | |
| 44 | AM_RANGE( 0x07, 0x07) AM_WRITE ( mikro80_8255_porta_w) | |
| 45 | 45 | ADDRESS_MAP_END |
| 46 | 46 | |
| 47 | 47 | /* Input ports */ |
| r5932 | r5933 | |
| 180 | 180 | MDRV_IMPORT_FROM(mikro80) |
| 181 | 181 | MDRV_CPU_MODIFY("maincpu") |
| 182 | 182 | MDRV_CPU_IO_MAP(radio99_io) |
| 183 | ||
| 183 | ||
| 184 | 184 | MDRV_SOUND_ADD("dac", DAC, 0) |
| 185 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 16.00) | |
| 185 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 16.00) | |
| 186 | 186 | MACHINE_DRIVER_END |
| 187 | 187 | |
| 188 | 188 | |
| r5932 | r5933 | |
| 201 | 201 | ROM_REGION(0x0800, "gfx1",0) |
| 202 | 202 | ROM_LOAD ("mikro80.fnt", 0x0000, 0x0800, CRC(43eb72bb) SHA1(761319cc6747661b33e84aa449cec83800543b5b) ) |
| 203 | 203 | ROM_END |
| 204 | ||
| 205 | 204 | |
| 205 | ||
| 206 | 206 | /* Driver */ |
| 207 | 207 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 208 | 208 | COMP( 1983, mikro80, 0, 0, mikro80, mikro80, mikro80, 0, "", "Mikro-80", 0) |
| r5932 | r5933 | |
|---|---|---|
| 28 | 28 | static WRITE8_HANDLER (rom_page_w) |
| 29 | 29 | { |
| 30 | 30 | rom_page =data; |
| 31 | if (data & 8) | |
| 31 | if (data & 8) | |
| 32 | 32 | { |
| 33 | 33 | int chip = (data >> 4) % 5; |
| 34 | 34 | int page = data & 7; |
| r5932 | r5933 | |
| 38 | 38 | { |
| 39 | 39 | memory_set_bankptr(space->machine, 2, mess_ram + 0xc000); |
| 40 | 40 | } |
| 41 | } | |
| 41 | } | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | static WRITE8_HANDLER (vdisk_page_w) |
| 45 | 45 | { |
| 46 | vdisk_addr = (vdisk_addr & 0x0ffff) | ((data & 0x0f)<<16); | |
| 46 | vdisk_addr = (vdisk_addr & 0x0ffff) | ((data & 0x0f)<<16); | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | static WRITE8_HANDLER (vdisk_h_w) |
| 50 | 50 | { |
| 51 | vdisk_addr = (vdisk_addr & 0xf00ff) | (data<<8); | |
| 51 | vdisk_addr = (vdisk_addr & 0xf00ff) | (data<<8); | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | static WRITE8_HANDLER (vdisk_l_w) |
| 55 | 55 | { |
| 56 | vdisk_addr = (vdisk_addr & 0xfff00) | data; | |
| 56 | vdisk_addr = (vdisk_addr & 0xfff00) | data; | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | static WRITE8_HANDLER (vdisk_data_w) |
| r5932 | r5933 | |
| 71 | 71 | return retVal; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | UINT8 selectedline(UINT16 data) | |
| 74 | UINT8 selectedline(UINT16 data) | |
| 75 | 75 | { |
| 76 | 76 | UINT8 i; |
| 77 | for(i = 0; i < 16; i++) | |
| 77 | for(i = 0; i < 16; i++) | |
| 78 | 78 | { |
| 79 | if (BIT(data, i)) | |
| 79 | if (BIT(data, i)) | |
| 80 | 80 | { |
| 81 | 81 | return i; |
| 82 | 82 | } |
| 83 | } | |
| 83 | } | |
| 84 | 84 | return 0; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | static READ8_HANDLER ( keyboard_r ) |
| 88 | 88 | { |
| 89 | return key_code; | |
| 89 | return key_code; | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | static READ8_HANDLER ( keycheck_r ) |
| 93 | 93 | { |
| 94 | UINT8 retVal = 0x3f; | |
| 94 | UINT8 retVal = 0x3f; | |
| 95 | 95 | UINT8 *keyboard = memory_region(space->machine, "keyboard"); |
| 96 | 96 | UINT16 row1 = input_port_read(space->machine, "ROW1"); |
| 97 | 97 | UINT16 row2 = input_port_read(space->machine, "ROW2"); |
| 98 | 98 | UINT16 row3 = input_port_read(space->machine, "ROW3"); |
| 99 | 99 | UINT16 row4 = input_port_read(space->machine, "ROW4"); |
| 100 | UINT16 row5 = input_port_read(space->machine, "ROW5"); | |
| 100 | UINT16 row5 = input_port_read(space->machine, "ROW5"); | |
| 101 | 101 | UINT16 all = row1 | row2 | row3 | row4 | row5; |
| 102 | 102 | UINT16 addr = (input_port_read(space->machine, "SHIFT") & 1) | (input_port_read(space->machine, "CTRL") & 1) << 1; |
| 103 | 103 | if (all != 0xff) |
| r5932 | r5933 | |
| 113 | 113 | key_code = keyboard[addr]; |
| 114 | 114 | keyboard_clk = ~keyboard_clk; |
| 115 | 115 | |
| 116 | if (keyboard_clk) | |
| 116 | if (keyboard_clk) | |
| 117 | 117 | retVal |= 0x80; |
| 118 | } | |
| 118 | } | |
| 119 | 119 | return retVal; |
| 120 | 120 | } |
| 121 | 121 | |
| r5932 | r5933 | |
| 142 | 142 | |
| 143 | 143 | static WRITE8_HANDLER (led_w) |
| 144 | 144 | { |
| 145 | // | |
| 145 | // UINT8 caps_led = BIT(data,4); | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | INLINE const device_config *get_floppy_image(running_machine *machine, int drive) |
| 149 | 149 | { |
| 150 | 150 | return floppy_get_device(machine, drive); |
| 151 | } | |
| 151 | } | |
| 152 | 152 | |
| 153 | 153 | static NEC765_GET_IMAGE( pyldin_nec765_get_image ) |
| 154 | 154 | { |
| 155 | 155 | return get_floppy_image(device->machine, (floppy_index & 1)^1); |
| 156 | 156 | } |
| 157 | 157 | UINT8 floppy_ctrl = 0; |
| 158 | static WRITE8_HANDLER (floppy_w) | |
| 158 | static WRITE8_HANDLER (floppy_w) | |
| 159 | 159 | { |
| 160 | 160 | // bit 0 is reset (if zero) |
| 161 | 161 | // bit 1 is TC state |
| 162 | 162 | // bit 2 is drive selected |
| 163 | 163 | // bit 3 is motor state |
| 164 | 164 | const device_config *floppy = devtag_get_device(space->machine, "nec765"); |
| 165 | if (BIT(data,0)==0) { | |
| 166 | //reset | |
| 165 | if (BIT(data,0)==0) { | |
| 166 | //reset | |
| 167 | 167 | nec765_reset(floppy,0); |
| 168 | 168 | } |
| 169 | 169 | floppy_drive_set_motor_state(get_floppy_image(space->machine, BIT(data,2)), BIT(data,3)); |
| 170 | ||
| 170 | ||
| 171 | 171 | floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), BIT(data,2), 0); |
| 172 | ||
| 172 | ||
| 173 | 173 | nec765_tc_w(floppy, BIT(data,1)); |
| 174 | ||
| 174 | ||
| 175 | 175 | floppy_ctrl = data; |
| 176 | 176 | } |
| 177 | static READ8_HANDLER (floppy_r) | |
| 177 | static READ8_HANDLER (floppy_r) | |
| 178 | 178 | { |
| 179 | 179 | return floppy_ctrl; |
| 180 | 180 | } |
| r5932 | r5933 | |
| 202 | 202 | AM_RANGE( 0xe62a, 0xe62a ) AM_READWRITE(keycheck_r,led_w) |
| 203 | 203 | AM_RANGE( 0xe62b, 0xe62b ) AM_READWRITE(timer_r,speaker_w) |
| 204 | 204 | AM_RANGE( 0xe62d, 0xe62d ) AM_READ(video_mode_r) |
| 205 | AM_RANGE( 0xe62e, 0xe62e ) AM_READWRITE(keycheck_r,led_w) | |
| 205 | AM_RANGE( 0xe62e, 0xe62e ) AM_READWRITE(keycheck_r,led_w) | |
| 206 | 206 | AM_RANGE( 0xe680, 0xe680 ) AM_WRITE(vdisk_page_w) |
| 207 | 207 | AM_RANGE( 0xe681, 0xe681 ) AM_WRITE(vdisk_h_w) |
| 208 | 208 | AM_RANGE( 0xe682, 0xe682 ) AM_WRITE(vdisk_l_w) |
| r5932 | r5933 | |
| 318 | 318 | static MACHINE_RESET(pyl601) |
| 319 | 319 | { |
| 320 | 320 | memory_set_bankptr(machine, 1, mess_ram + 0x0000); |
| 321 | memory_set_bankptr(machine, 2, mess_ram + 0xc000); | |
| 322 | memory_set_bankptr(machine, 3, mess_ram + 0xe000); | |
| 323 | memory_set_bankptr(machine, 4, mess_ram + 0xe700); | |
| 324 | memory_set_bankptr(machine, 5, memory_region(machine, "maincpu") + 0xf000); | |
| 325 | memory_set_bankptr(machine, 6, mess_ram + 0xf000); | |
| 326 | ||
| 327 | device_reset(cputag_get_cpu(machine, "maincpu")); | |
| 321 | memory_set_bankptr(machine, 2, mess_ram + 0xc000); | |
| 322 | memory_set_bankptr(machine, 3, mess_ram + 0xe000); | |
| 323 | memory_set_bankptr(machine, 4, mess_ram + 0xe700); | |
| 324 | memory_set_bankptr(machine, 5, memory_region(machine, "maincpu") + 0xf000); | |
| 325 | memory_set_bankptr(machine, 6, mess_ram + 0xf000); | |
| 326 | ||
| 327 | device_reset(cputag_get_cpu(machine, "maincpu")); | |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | static VIDEO_START( pyl601 ) |
| r5932 | r5933 | |
| 344 | 344 | |
| 345 | 345 | int column, bit, i; |
| 346 | 346 | UINT8 data; |
| 347 | if (BIT(video_mode, 5) == 0) | |
| 347 | if (BIT(video_mode, 5) == 0) | |
| 348 | 348 | { |
| 349 | 349 | for (column = 0; column < x_count; column++) |
| 350 | 350 | { |
| 351 | UINT8 code = mess_ram[(((ma + column) & 0x0fff) + 0xf000)]; | |
| 351 | UINT8 code = mess_ram[(((ma + column) & 0x0fff) + 0xf000)]; | |
| 352 | 352 | code = ((code << 1) | (code >> 7)) & 0xff; |
| 353 | 353 | data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff]; |
| 354 | 354 | if (column == cursor_x-2) |
| r5932 | r5933 | |
| 359 | 359 | { |
| 360 | 360 | int x = (column * 8) + bit; |
| 361 | 361 | int color = BIT(data, 7) ? 1 : 0; |
| 362 | ||
| 362 | ||
| 363 | 363 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 364 | ||
| 364 | ||
| 365 | 365 | data <<= 1; |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | else | |
| 369 | else | |
| 370 | 370 | { |
| 371 | 371 | for (i = 0; i < x_count; i++) |
| 372 | { | |
| 372 | { | |
| 373 | 373 | UINT8 data = mess_ram[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; |
| 374 | 374 | for (bit = 0; bit < 8; bit++) |
| 375 | 375 | { |
| 376 | *BITMAP_ADDR16(bitmap, y, (i * 8) + bit) = BIT(data, 7) ? 1 : 0; | |
| 376 | *BITMAP_ADDR16(bitmap, y, (i * 8) + bit) = BIT(data, 7) ? 1 : 0; | |
| 377 | 377 | data <<= 1; |
| 378 | 378 | } |
| 379 | } | |
| 379 | } | |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
| r5932 | r5933 | |
| 390 | 390 | { |
| 391 | 391 | for (column = 0; column < x_count; column++) |
| 392 | 392 | { |
| 393 | UINT8 code = mess_ram[(((ma + column) & 0x0fff) + 0xf000)]; | |
| 393 | UINT8 code = mess_ram[(((ma + column) & 0x0fff) + 0xf000)]; | |
| 394 | 394 | data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; |
| 395 | 395 | if (column == cursor_x) |
| 396 | 396 | { |
| 397 | 397 | data = 0xff; |
| 398 | 398 | } |
| 399 | ||
| 399 | ||
| 400 | 400 | for (bit = 0; bit < 8; bit++) |
| 401 | 401 | { |
| 402 | 402 | int x = (column * 8) + bit; |
| 403 | 403 | int color = BIT(data, 7) ? 1 : 0; |
| 404 | ||
| 404 | ||
| 405 | 405 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 406 | ||
| 406 | ||
| 407 | 407 | data <<= 1; |
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | } | |
| 411 | else | |
| 410 | } | |
| 411 | else | |
| 412 | 412 | { |
| 413 | 413 | for (i = 0; i < x_count; i++) |
| 414 | { | |
| 414 | { | |
| 415 | 415 | UINT8 data = mess_ram[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; |
| 416 | 416 | for (bit = 0; bit < 8; bit++) |
| 417 | 417 | { |
| 418 | *BITMAP_ADDR16(bitmap, y, (i * 8) + bit) = BIT(data, 7) ? 1 : 0; | |
| 418 | *BITMAP_ADDR16(bitmap, y, (i * 8) + bit) = BIT(data, 7) ? 1 : 0; | |
| 419 | 419 | data <<= 1; |
| 420 | 420 | } |
| 421 | } | |
| 421 | } | |
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
| r5932 | r5933 | |
| 483 | 483 | MDRV_CPU_ADD("maincpu",M6800, XTAL_1MHz) |
| 484 | 484 | MDRV_CPU_PROGRAM_MAP(pyl601_mem) |
| 485 | 485 | MDRV_CPU_VBLANK_INT("screen", pyl601_interrupt) |
| 486 | ||
| 486 | ||
| 487 | 487 | MDRV_MACHINE_RESET(pyl601) |
| 488 | 488 | |
| 489 | /* video hardware */ | |
| 489 | /* video hardware */ | |
| 490 | 490 | MDRV_SCREEN_ADD("screen", RASTER) |
| 491 | 491 | MDRV_SCREEN_REFRESH_RATE(50) |
| 492 | 492 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| r5932 | r5933 | |
| 496 | 496 | MDRV_PALETTE_LENGTH(2) |
| 497 | 497 | MDRV_PALETTE_INIT(monochrome_green) |
| 498 | 498 | |
| 499 | MDRV_MC6845_ADD("crtc", MC6845, XTAL_2MHz, pyl601_crtc6845_interface) | |
| 499 | MDRV_MC6845_ADD("crtc", MC6845, XTAL_2MHz, pyl601_crtc6845_interface) | |
| 500 | 500 | |
| 501 | 501 | MDRV_VIDEO_START( pyl601 ) |
| 502 | MDRV_VIDEO_UPDATE( pyl601 ) | |
| 503 | ||
| 502 | MDRV_VIDEO_UPDATE( pyl601 ) | |
| 503 | ||
| 504 | 504 | MDRV_NEC765A_ADD("nec765", pyldin_nec765_interface) |
| 505 | ||
| 505 | ||
| 506 | 506 | MDRV_FLOPPY_2_DRIVES_ADD(pyldin_floppy_config) |
| 507 | 507 | MACHINE_DRIVER_END |
| 508 | 508 | |
| r5932 | r5933 | |
| 525 | 525 | ROM_REGION(0x0800, "gfx1",0) |
| 526 | 526 | ROM_LOAD( "video.rom", 0x0000, 0x0800, CRC(1c23ba43) SHA1(eb1cfc139858abd0aedbbf3d523f8ba55d27a11d)) |
| 527 | 527 | |
| 528 | ROM_REGION(0x50000, "romdisk",ROMREGION_ERASEFF) | |
| 528 | ROM_REGION(0x50000, "romdisk",ROMREGION_ERASEFF) | |
| 529 | 529 | ROM_LOAD( "rom0.rom", 0x00000, 0x10000, CRC(60103920) SHA1(ee5b4ee5b513c4a0204da751e53d63b8c6c0aab9)) |
| 530 | 530 | ROM_LOAD( "rom1.rom", 0x10000, 0x10000, CRC(cb4a9b22) SHA1(dd09e4ba35b8d1a6f60e6e262aaf2f156367e385)) |
| 531 | 531 | ROM_LOAD( "rom2.rom", 0x20000, 0x08000, CRC(0b7684bf) SHA1(c02ad1f2a6f484cd9d178d8b060c21c0d4e53442)) |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /* Note about natural keyboard support: |
| 20 | ||
| 20 | - Keys G1 -> G25 are not mapped in natural mode, switch to emulated mode to use them | |
| 21 | 21 | */ |
| 22 | 22 | static INPUT_PORTS_START( mz80k ) |
| 23 | 23 | PORT_START("LINE0") |
| r5932 | r5933 | |
| 118 | 118 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) |
| 119 | 119 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G21") PORT_CODE(KEYCODE_ENTER_PAD) |
| 120 | 120 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G23") PORT_CODE(KEYCODE_DEL_PAD) |
| 121 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G25") PORT_CODE(KEYCODE_TILDE) | |
| 121 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G25") PORT_CODE(KEYCODE_TILDE) | |
| 122 | 122 | INPUT_PORTS_END |
| 123 | 123 | |
| 124 | 124 | // 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 |
| r5932 | r5933 | |
| 199 | 199 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 200 | 200 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 201 | 201 | 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)) |
| 202 | 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)) | |
| 202 | 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)) | |
| 203 | 203 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') |
| 204 | 204 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 205 | 205 | |
| r5932 | r5933 | |
| 280 | 280 | |
| 281 | 281 | MDRV_VIDEO_START(mz80k) |
| 282 | 282 | MDRV_VIDEO_UPDATE(mz80k) |
| 283 | ||
| 283 | ||
| 284 | 284 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 285 | MDRV_GFXDECODE( mz80k ) | |
| 285 | MDRV_GFXDECODE( mz80k ) | |
| 286 | 286 | MDRV_PALETTE_LENGTH(2) |
| 287 | 287 | MDRV_PALETTE_INIT(black_and_white) |
| 288 | 288 | MDRV_SCREEN_SIZE(320, 200) |
| 289 | 289 | MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 199) |
| 290 | ||
| 290 | ||
| 291 | 291 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 292 | 292 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 293 | 293 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 294 | 294 | MDRV_SOUND_ADD("speaker", SPEAKER, 0) |
| 295 | 295 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 296 | ||
| 297 | MDRV_TIMER_ADD_PERIODIC("tempo", ne555_tempo_callback, HZ(34)) // 33.5Hz - 34.3Hz | |
| 298 | ||
| 299 | MDRV_CASSETTE_ADD( "cassette", mz80k_cassette_config ) | |
| 296 | ||
| 297 | MDRV_TIMER_ADD_PERIODIC("tempo", ne555_tempo_callback, HZ(34)) // 33.5Hz - 34.3Hz | |
| 298 | ||
| 299 | MDRV_CASSETTE_ADD( "cassette", mz80k_cassette_config ) | |
| 300 | 300 | MACHINE_DRIVER_END |
| 301 | 301 | |
| 302 | 302 | static MACHINE_DRIVER_START( mz80kj ) |
| 303 | 303 | MDRV_IMPORT_FROM( mz80k ) |
| 304 | MDRV_GFXDECODE( mz80kj ) | |
| 304 | MDRV_GFXDECODE( mz80kj ) | |
| 305 | 305 | MACHINE_DRIVER_END |
| 306 | 306 | |
| 307 | 307 |
| r5932 | r5933 | |
|---|---|---|
| 62 | 62 | { |
| 63 | 63 | int x = (column * 8) + bit; |
| 64 | 64 | int color = BIT(data, 7) ? 1 : 0; |
| 65 | ||
| 65 | ||
| 66 | 66 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 67 | 67 | |
| 68 | 68 | data <<= 1; |
| r5932 | r5933 | |
|---|---|---|
| 234 | 234 | MDRV_SPEAKER_STANDARD_MONO("a310") |
| 235 | 235 | MDRV_SOUND_ADD("dac", DAC, 0) |
| 236 | 236 | MDRV_SOUND_ROUTE(0, "a310", 1.00) |
| 237 | ||
| 237 | ||
| 238 | 238 | MDRV_WD1772_ADD("wd1772", a310_wd17xx_interface ) |
| 239 | ||
| 239 | ||
| 240 | 240 | //MDRV_FLOPPY_4_DRIVES_ADD(a310_floppy_config) |
| 241 | 241 | MACHINE_DRIVER_END |
| 242 | 242 |
| r5932 | r5933 | |
|---|---|---|
| 59 | 59 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 60 | 60 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 61 | 61 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| 62 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 63 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 62 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 63 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 64 | 64 | PORT_START("LINE2") |
| 65 | 65 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) |
| 66 | 66 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) |
| r5932 | r5933 | |
| 86 | 86 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 87 | 87 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) |
| 88 | 88 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| 89 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 90 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 89 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 90 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 91 | 91 | PORT_START("LINE5") |
| 92 | 92 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) |
| 93 | 93 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) |
| r5932 | r5933 | |
| 162 | 162 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 163 | 163 | PORT_START("LINED") |
| 164 | 164 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) |
| 165 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 166 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 165 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 166 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) | |
| 167 | 167 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) |
| 168 | 168 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) |
| 169 | 169 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) |
| r5932 | r5933 | |
| 189 | 189 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 190 | 190 | PORT_START("LINEALL") |
| 191 | 191 | PORT_BIT(0x3F, IP_ACTIVE_LOW, IPT_UNUSED) |
| 192 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) | |
| 192 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) | |
| 193 | 193 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 194 | 194 | INPUT_PORTS_END |
| 195 | 195 | |
| r5932 | r5933 | |
| 215 | 215 | |
| 216 | 216 | MDRV_VIDEO_START(pp01) |
| 217 | 217 | MDRV_VIDEO_UPDATE(pp01) |
| 218 | ||
| 218 | ||
| 219 | 219 | MDRV_PIT8253_ADD( "pit8253", pp01_pit8253_intf ) |
| 220 | 220 | |
| 221 | MDRV_I8255A_ADD( "ppi8255", pp01_ppi8255_interface ) | |
| 221 | MDRV_I8255A_ADD( "ppi8255", pp01_ppi8255_interface ) | |
| 222 | 222 | MACHINE_DRIVER_END |
| 223 | 223 | |
| 224 | 224 | static SYSTEM_CONFIG_START(pp01) |
| r5932 | r5933 | |
|---|---|---|
| 559 | 559 | /* |
| 560 | 560 | static void apple2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 561 | 561 | { |
| 562 | switch(state) | |
| 563 | { | |
| 564 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVIDEND: info->i = 15; break; | |
| 565 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVISOR: info->i = 16; break; | |
| 562 | switch(state) | |
| 563 | { | |
| 564 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVIDEND: info->i = 15; break; | |
| 565 | case MESS_DEVINFO_INT_APPLE525_SPINFRACT_DIVISOR: info->i = 16; break; | |
| 566 | 566 | |
| 567 | case MESS_DEVINFO_STR_NAME+0: strcpy(info->s = device_temp_str(), "slot6disk1"); break; | |
| 568 | case MESS_DEVINFO_STR_NAME+1: strcpy(info->s = device_temp_str(), "slot6disk2"); break; | |
| 569 | case MESS_DEVINFO_STR_SHORT_NAME+0: strcpy(info->s = device_temp_str(), "s6d1"); break; | |
| 570 | case MESS_DEVINFO_STR_SHORT_NAME+1: strcpy(info->s = device_temp_str(), "s6d2"); break; | |
| 571 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "Slot 6 Disk #1"); break; | |
| 572 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "Slot 6 Disk #2"); break; | |
| 567 | case MESS_DEVINFO_STR_NAME+0: strcpy(info->s = device_temp_str(), "slot6disk1"); break; | |
| 568 | case MESS_DEVINFO_STR_NAME+1: strcpy(info->s = device_temp_str(), "slot6disk2"); break; | |
| 569 | case MESS_DEVINFO_STR_SHORT_NAME+0: strcpy(info->s = device_temp_str(), "s6d1"); break; | |
| 570 | case MESS_DEVINFO_STR_SHORT_NAME+1: strcpy(info->s = device_temp_str(), "s6d2"); break; | |
| 571 | case MESS_DEVINFO_STR_DESCRIPTION+0: strcpy(info->s = device_temp_str(), "Slot 6 Disk #1"); break; | |
| 572 | case MESS_DEVINFO_STR_DESCRIPTION+1: strcpy(info->s = device_temp_str(), "Slot 6 Disk #2"); break; | |
| 573 | 573 | |
| 574 | default: apple525_device_getinfo(devclass, state, info); break; | |
| 575 | } | |
| 574 | default: apple525_device_getinfo(devclass, state, info); break; | |
| 575 | } | |
| 576 | 576 | } |
| 577 | 577 | */ |
| 578 | 578 | static const floppy_config apple2_floppy_config = |
| r5932 | r5933 | |
| 623 | 623 | MDRV_APPLE2_SLOT_ADD(0, "langcard", apple2_langcard_r, apple2_langcard_w) |
| 624 | 624 | MDRV_APPLE2_SLOT_ADD(4, "mockingboard", mockingboard_r, mockingboard_w) |
| 625 | 625 | MDRV_APPLE2_SLOT_ADD(6, "fdc", applefdc_r, applefdc_w) |
| 626 | ||
| 626 | ||
| 627 | 627 | MDRV_FLOPPY_APPLE_2_DRIVES_ADD(apple2_floppy_config,15,16) |
| 628 | 628 | MACHINE_DRIVER_END |
| 629 | 629 | |
| r5932 | r5933 | |
| 689 | 689 | ROM_LOAD ( "341-0003-00.f0", 0x3000, 0x0800, CRC(62230d38) SHA1(f268022da555e4c809ca1ae9e5d2f00b388ff61c)) /* Needs verification. From eBay: Label: S7908E // C48709 // 3410003 // CAPPLE78 F0 */ |
| 690 | 690 | ROM_LOAD ( "341-0004-00.f8", 0x3800, 0x0800, CRC(020a86d0) SHA1(52a18bd578a4694420009cad7a7a5779a8c00226)) |
| 691 | 691 | ROM_LOAD ( "341-0027-a.p5", 0x4500, 0x0100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16)) /* 341-0027-a: 16-sector disk drive (older version), PROM P5 */ |
| 692 | /* For the following bits, I'm not sure how to do this properly, since the P5 and P6 roms came in pairs and are in different address spaces... | |
| 693 | Also the 3.5" 400k? disk control rom, 341-0438-a should probably be here as well, assuming it could be used with an apple2/2+/2e */ | |
| 692 | /* For the following bits, I'm not sure how to do this properly, since the P5 and P6 roms came in pairs and are in different address spaces... | |
| 693 | Also the 3.5" 400k? disk control rom, 341-0438-a should probably be here as well, assuming it could be used with an apple2/2+/2e */ | |
| 694 | 694 | //ROMX_LOAD ( "341-0009.p5", 0x4500, 0x0100, CRC(d34eb2ff) SHA1(afd060e6f35faf3bb0146fa889fc787adf56330a), ROM_BIOS(1)) /* 341-0009: 13-sector disk drive, PROM P5 */ |
| 695 | 695 | //ROMX_LOAD ( "341-0027-a.p5", 0x4500, 0x0100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16), ROM_BIOS(2)) /* 341-0027-a: 16-sector disk drive (older version), PROM P5 */ |
| 696 | 696 | //ROMX_LOAD ( "341-0127-a.p5a", 0x4500, 0x0100, NO_DUMP, ROM_BIOS(3)) /* 341-0127-A: 16-sector disk drive (later version) PROM P5; Label: 341-0127-A // (C) APPLE 81 P5A (see 'Apple Disk II Interface Card.jpg') (I have a suspicion this rom is the same as the 341-0027-a one)*/ |
| r5932 | r5933 | |
| 752 | 752 | ROM_LOAD( "shugart7.rom", 0x4500, 0x0100, CRC(c6e4850c) SHA1(71626d3d2d4bbeeac2b77585b45a5566d20b8d34)) |
| 753 | 753 | ROM_LOAD( "teac.rom", 0x4500, 0x0100, CRC(94266928) SHA1(5d369bad6cdd6a70b0bb16480eba69640de87a2e)) |
| 754 | 754 | ROM_REGION(0x0800,"gfx1",0) |
| 755 | ROM_LOAD( "agathe7.fnt", 0x0000, 0x0800, CRC(fcffb490) SHA1(0bda26ae7ad75f74da835c0cf6d9928f9508844c)) | |
| 755 | ROM_LOAD( "agathe7.fnt", 0x0000, 0x0800, CRC(fcffb490) SHA1(0bda26ae7ad75f74da835c0cf6d9928f9508844c)) | |
| 756 | 756 | ROM_END |
| 757 | 757 | |
| 758 | 758 | ROM_START( agat9 ) |
| r5932 | r5933 | |
| 811 | 811 | |
| 812 | 812 | ROM_REGION(0x4700,"maincpu",0) |
| 813 | 813 | ROM_LOAD ( "mpf3-cd.rom", 0x0000, 0x2000, CRC(5b662e06) SHA1(aa0db775ca78986480829fcc10f00e57629e1a7c)) |
| 814 | ROM_LOAD ( "mpf3-ef.rom", 0x2000, 0x2000, CRC(2c5e8b92) SHA1(befeb03e04b7c3ef36ef5829948a53880df85e92)) | |
| 815 | ||
| 814 | ROM_LOAD ( "mpf3-ef.rom", 0x2000, 0x2000, CRC(2c5e8b92) SHA1(befeb03e04b7c3ef36ef5829948a53880df85e92)) | |
| 815 | ||
| 816 | 816 | ROM_LOAD ( "341-0027-a.p5", 0x4500, 0x0100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16)) /* Disk II ROM - DOS 3.3 version */ |
| 817 | 817 | ROM_END |
| 818 | 818 | |
| r5932 | r5933 | |
| 956 | 956 | SYSTEM_CONFIG_END |
| 957 | 957 | |
| 958 | 958 | |
| 959 | /* YEAR NAME PARENT COMPAT MACHINE | |
| 959 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 960 | 960 | COMP( 1977, apple2, 0, 0, apple2, apple2, 0, apple2, "Apple Computer", "Apple ][" , 0) |
| 961 | 961 | COMP( 1979, apple2p, apple2, 0, apple2p, apple2p, 0, apple2p, "Apple Computer", "Apple ][+" , 0) |
| 962 | 962 | COMP( 1982, prav82, apple2, 0, apple2p, apple2p, 0, apple2p, "Pravetz", "Pravetz 82" , 0) |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | DEC ZRT-80 |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 20 | 20 | AM_RANGE(0x4000, 0x43ff) AM_RAM // Board RAM |
| 21 | 21 | // Normaly video RAM is 0x800 but could be expanded up to 8K |
| 22 | 22 | AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE(&video_ram) // Video RAM |
| 23 | ||
| 23 | ||
| 24 | 24 | ADDRESS_MAP_END |
| 25 | 25 | |
| 26 | 26 | static ADDRESS_MAP_START( zrt80_io , ADDRESS_SPACE_IO, 8) |
| r5932 | r5933 | |
| 50 | 50 | PORT_DIPSETTING( 0x00, "Alternate Keyboard" ) |
| 51 | 51 | PORT_DIPNAME( 0x10, 0x10, "Horizontal Sync" ) |
| 52 | 52 | PORT_DIPSETTING( 0x10, "Negative" ) |
| 53 | PORT_DIPSETTING( 0x00, "Positive" ) | |
| 53 | PORT_DIPSETTING( 0x00, "Positive" ) | |
| 54 | 54 | PORT_DIPNAME( 0x20, 0x20, "CPU" ) |
| 55 | 55 | PORT_DIPSETTING( 0x20, "Operating" ) |
| 56 | 56 | PORT_DIPSETTING( 0x00, "Reset" ) |
| r5932 | r5933 | |
| 59 | 59 | PORT_DIPSETTING( 0x00, "Positive" ) |
| 60 | 60 | PORT_DIPNAME( 0x80, 0x00, "Beeper" ) |
| 61 | 61 | PORT_DIPSETTING( 0x80, "Silent" ) |
| 62 | PORT_DIPSETTING( 0x00, "Enable" ) | |
| 62 | PORT_DIPSETTING( 0x00, "Enable" ) | |
| 63 | 63 | PORT_START("DIPSW2") |
| 64 | 64 | PORT_DIPNAME( 0x0f, 0x05, "Baud rate" ) |
| 65 | 65 | PORT_DIPSETTING( 0x00, "50" ) |
| r5932 | r5933 | |
| 88 | 88 | PORT_DIPSETTING( 0x00, "XON/XOFF" ) |
| 89 | 89 | PORT_DIPNAME( 0x80, 0x80, "Line Feed" ) |
| 90 | 90 | PORT_DIPSETTING( 0x80, "No LF on CR" ) |
| 91 | PORT_DIPSETTING( 0x00, "Auto" ) | |
| 91 | PORT_DIPSETTING( 0x00, "Auto" ) | |
| 92 | 92 | PORT_START("DIPSW3") |
| 93 | 93 | PORT_DIPNAME( 0x07, 0x07, "Video" ) |
| 94 | 94 | PORT_DIPSETTING( 0x00, "96 x 24 15750Hz, 50Hz" ) |
| 95 | 95 | PORT_DIPSETTING( 0x01, "80 x 48 15750Hz, 50Hz" ) |
| 96 | PORT_DIPSETTING( 0x02, "80 x 24 15750Hz, 50Hz" ) | |
| 96 | PORT_DIPSETTING( 0x02, "80 x 24 15750Hz, 50Hz" ) | |
| 97 | 97 | PORT_DIPSETTING( 0x03, "96 x 24 15750Hz, 60Hz" ) |
| 98 | 98 | PORT_DIPSETTING( 0x04, "80 x 48 18700Hz, 50Hz" ) |
| 99 | 99 | PORT_DIPSETTING( 0x05, "80 x 24 17540Hz, 60Hz" ) |
| r5932 | r5933 | |
| 112 | 112 | PORT_DIPSETTING( 0x00, "Half" ) |
| 113 | 113 | PORT_DIPNAME( 0x80, 0x80, "Wraparound" ) |
| 114 | 114 | PORT_DIPSETTING( 0x80, "Disabled" ) |
| 115 | PORT_DIPSETTING( 0x00, "Enabled" ) | |
| 115 | PORT_DIPSETTING( 0x00, "Enabled" ) | |
| 116 | 116 | INPUT_PORTS_END |
| 117 | 117 | |
| 118 | 118 | |
| 119 | static MACHINE_RESET(zrt80) | |
| 120 | { | |
| 119 | static MACHINE_RESET(zrt80) | |
| 120 | { | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | static VIDEO_START( zrt80 ) |
| r5932 | r5933 | |
| 150 | 150 | if (input_port_read(device->machine, "DIPSW1") & 0x04) { |
| 151 | 151 | color = color ? 0 : 1; |
| 152 | 152 | } |
| 153 | ||
| 153 | ||
| 154 | 154 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 155 | 155 | |
| 156 | 156 | data <<= 1; |
| r5932 | r5933 | |
| 189 | 189 | /* basic machine hardware */ |
| 190 | 190 | MDRV_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz) |
| 191 | 191 | MDRV_CPU_PROGRAM_MAP(zrt80_mem) |
| 192 | MDRV_CPU_IO_MAP(zrt80_io) | |
| 192 | MDRV_CPU_IO_MAP(zrt80_io) | |
| 193 | 193 | |
| 194 | 194 | MDRV_MACHINE_RESET(zrt80) |
| 195 | ||
| 195 | ||
| 196 | 196 | /* video hardware */ |
| 197 | 197 | /* video hardware */ |
| 198 | 198 | MDRV_SCREEN_ADD("screen", RASTER) |
| r5932 | r5933 | |
| 204 | 204 | MDRV_PALETTE_LENGTH(2) |
| 205 | 205 | MDRV_PALETTE_INIT(black_and_white) |
| 206 | 206 | |
| 207 | MDRV_MC6845_ADD("crtc", MC6845, XTAL_20MHz / 8, zrt80_crtc6845_interface) | |
| 207 | MDRV_MC6845_ADD("crtc", MC6845, XTAL_20MHz / 8, zrt80_crtc6845_interface) | |
| 208 | 208 | |
| 209 | 209 | MDRV_VIDEO_START(zrt80) |
| 210 | 210 | MDRV_VIDEO_UPDATE(zrt80) |
| 211 | ||
| 211 | ||
| 212 | 212 | MDRV_INS8250_ADD( "ins8250", zrt80_com_interface ) |
| 213 | 213 | MACHINE_DRIVER_END |
| 214 | 214 |
| r5932 | r5933 | |
|---|---|---|
| 505 | 505 | MDRV_SOUND_ADD("custom", SVISION, 0) |
| 506 | 506 | MDRV_SOUND_ROUTE(0, "lspeaker", 0.50) |
| 507 | 507 | MDRV_SOUND_ROUTE(1, "rspeaker", 0.50) |
| 508 | ||
| 508 | ||
| 509 | 509 | /* cartridge */ |
| 510 | 510 | MDRV_CARTSLOT_ADD("cart") |
| 511 | 511 | MDRV_CARTSLOT_EXTENSION_LIST("bin,ws,sv") |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | TI-89 |
| 4 | 4 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| r5932 | r5933 | |
| 20 | 20 | INPUT_PORTS_END |
| 21 | 21 | |
| 22 | 22 | |
| 23 | static MACHINE_RESET(ti89) | |
| 24 | { | |
| 23 | static MACHINE_RESET(ti89) | |
| 24 | { | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | static VIDEO_START( ti89 ) |
| r5932 | r5933 | |
| 39 | 39 | MDRV_CPU_PROGRAM_MAP(ti89_mem) |
| 40 | 40 | |
| 41 | 41 | MDRV_MACHINE_RESET(ti89) |
| 42 | ||
| 42 | ||
| 43 | 43 | /* video hardware */ |
| 44 | 44 | MDRV_SCREEN_ADD("screen", RASTER) |
| 45 | 45 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 63 | 63 | ROMX_LOAD( "ti89v100a.rom", 0x000000, 0x200000, CRC(95199934) SHA1(b8e3cdeb4705b0c7e0a15ab6c6f62bcde14a3a55), ROM_BIOS(2)) |
| 64 | 64 | ROM_SYSTEM_BIOS( 2, "v100", "V 1.00 [m] - HW1" ) |
| 65 | 65 | ROMX_LOAD( "ti89v100m.rom", 0x000000, 0x200000, CRC(b9059e06) SHA1(b33a7c2935eb9f73b210bcf6e7c7f32d1548a9d5), ROM_BIOS(3)) |
| 66 | ROM_SYSTEM_BIOS( 3, "v100", "V 1.00 [m2] - HW1" ) | |
| 66 | ROM_SYSTEM_BIOS( 3, "v100", "V 1.00 [m2] - HW1" ) | |
| 67 | 67 | ROMX_LOAD( "ti89v100m2.rom", 0x000000, 0x200000, CRC(cdd69d34) SHA1(1686362b0997bb9597f39b443490d4d8d85b56cc), ROM_BIOS(4)) |
| 68 | 68 | ROM_SYSTEM_BIOS( 4, "v105", "V 1.05 - HW1" ) |
| 69 | 69 | ROMX_LOAD( "ti89v105.rom", 0x000000, 0x200000, CRC(3bc0b474) SHA1(46fe0cd511eb81d53dc12cc4bdacec8a5bba5171), ROM_BIOS(5)) |
| 70 | 70 | ROM_SYSTEM_BIOS( 5, "v201", "V 2.01 - HW1" ) |
| 71 | 71 | ROMX_LOAD( "ti89v201.rom", 0x000000, 0x200000, CRC(fa6745e9) SHA1(e4ee6067df9b975356cef6c5a81d0ec664371c1d), ROM_BIOS(6)) |
| 72 | 72 | ROM_SYSTEM_BIOS( 6, "v203", "V 2.03 - HW1" ) |
| 73 | ROMX_LOAD( "ti89v203.rom", 0x000000, 0x200000, CRC(a3a74eca) SHA1(55aae3561722a96973b430e3d4cb4f513298ea4e), ROM_BIOS(7)) | |
| 73 | ROMX_LOAD( "ti89v203.rom", 0x000000, 0x200000, CRC(a3a74eca) SHA1(55aae3561722a96973b430e3d4cb4f513298ea4e), ROM_BIOS(7)) | |
| 74 | 74 | ROM_SYSTEM_BIOS( 7, "v203m", "V 2.03 [m] - HW 1" ) |
| 75 | 75 | ROMX_LOAD( "ti89v203m.rom", 0x000000, 0x200000, CRC(d79068f7) SHA1(5b6f571417889b11ae19eef99a5fda4f027d5ec2), ROM_BIOS(8)) |
| 76 | 76 | ROM_SYSTEM_BIOS( 8, "v209", "V 2.09 - HW 1" ) |
| 77 | 77 | ROMX_LOAD( "ti89v209.rom", 0x000000, 0x200000, CRC(f76f9c15) SHA1(66409ef4b20190a3b7c0d48cbd30257580b47dcd), ROM_BIOS(9)) |
| 78 | ROM_SYSTEM_BIOS( 9, "v105-2","V 1.05 - HW2" ) | |
| 78 | ROM_SYSTEM_BIOS( 9, "v105-2","V 1.05 - HW2" ) | |
| 79 | 79 | ROMX_LOAD( "ti89v105-2.rom", 0x000000, 0x200000, CRC(83817402) SHA1(b2ddf785e973cc3f9a437d058a68abdf7ca52ea2), ROM_BIOS(10)) |
| 80 | 80 | ROM_SYSTEM_BIOS( 10, "v203-2", "V 2.03 - HW2" ) |
| 81 | ROMX_LOAD( "ti89v203-2.rom", 0x000000, 0x200000, CRC(5e0400a9) SHA1(43c608ee72f15aed56cb5762948ec6a3c93dd9d8), ROM_BIOS(11)) | |
| 82 | ROM_SYSTEM_BIOS( 11, "v203m-2", "V 2.03 [m] - HW2" ) | |
| 83 | ROMX_LOAD( "ti89v203m-2.rom", 0x000000, 0x200000, CRC(04d5d76d) SHA1(14ca44b64c29aa1bf274508ca40fe69224f5a7cc), ROM_BIOS(12)) | |
| 81 | ROMX_LOAD( "ti89v203-2.rom", 0x000000, 0x200000, CRC(5e0400a9) SHA1(43c608ee72f15aed56cb5762948ec6a3c93dd9d8), ROM_BIOS(11)) | |
| 82 | ROM_SYSTEM_BIOS( 11, "v203m-2", "V 2.03 [m] - HW2" ) | |
| 83 | ROMX_LOAD( "ti89v203m-2.rom", 0x000000, 0x200000, CRC(04d5d76d) SHA1(14ca44b64c29aa1bf274508ca40fe69224f5a7cc), ROM_BIOS(12)) | |
| 84 | 84 | ROM_SYSTEM_BIOS( 12, "v205-2", "V 2.05 - HW2" ) |
| 85 | ROMX_LOAD( "ti89v205-2.rom", 0x000000, 0x200000, CRC(37c4653c) SHA1(f48d00a57430230e489e243383513485009b1b98), ROM_BIOS(13)) | |
| 85 | ROMX_LOAD( "ti89v205-2.rom", 0x000000, 0x200000, CRC(37c4653c) SHA1(f48d00a57430230e489e243383513485009b1b98), ROM_BIOS(13)) | |
| 86 | 86 | ROM_SYSTEM_BIOS( 13, "v205-2m", "V 2.05[m] - HW2" ) |
| 87 | 87 | ROMX_LOAD( "ti89v205m-2.rom", 0x000000, 0x200000, CRC(e58a23f9) SHA1(d4cb23fb4b414a43802c37dc3c572a8ede670e0f), ROM_BIOS(14)) |
| 88 | 88 | ROM_SYSTEM_BIOS( 14, "v205-2m2","V 2.05[m2] - HW2" ) |
| r5932 | r5933 | |
| 94 | 94 | ROM_START( ti92 ) |
| 95 | 95 | ROM_REGION( 0x300000, "maincpu", ROMREGION_ERASEFF ) |
| 96 | 96 | // Internal ROM |
| 97 | ROM_LOAD( "ti92v111.rom", 0x000000, 0x100000, CRC(67878d52) SHA1(c0fdf162961922a76f286c93fd9b861ce20f23a3)) | |
| 98 | // External ROM | |
| 99 | ROM_SYSTEM_BIOS( 0, "v13", "V 1.3" ) | |
| 97 | ROM_LOAD( "ti92v111.rom", 0x000000, 0x100000, CRC(67878d52) SHA1(c0fdf162961922a76f286c93fd9b861ce20f23a3)) | |
| 98 | // External ROM | |
| 99 | ROM_SYSTEM_BIOS( 0, "v13", "V 1.3" ) | |
| 100 | 100 | ROMX_LOAD( "ti92v13e.rom", 0x100000, 0x100000, CRC(316c8196) SHA1(82c8cd484c6aebe36f814a2023d2afad6d87f840), ROM_BIOS(1)) |
| 101 | 101 | ROM_SYSTEM_BIOS( 1, "v14", "V 1.4" ) |
| 102 | 102 | ROMX_LOAD( "ti92v14e.rom", 0x100000, 0x100000, CRC(239e9405) SHA1(df2f1ab17d490fda43a02f5851b5a15052361b28), ROM_BIOS(2)) |
| r5932 | r5933 | |
| 130 | 130 | ROM_SYSTEM_BIOS( 7, "v204", "V 2.04 - HW2" ) |
| 131 | 131 | ROMX_LOAD( "ti92pv204.rom", 0x0000, 0x200000, CRC(86819be3) SHA1(78032a0f5f11d1e9a45ffbea91e7f9657fd1a8ae), ROM_BIOS(8)) |
| 132 | 132 | ROM_SYSTEM_BIOS( 8, "v205", "V 2.05 - HW2" ) |
| 133 | ROMX_LOAD( "ti92pv205.rom", 0x0000, 0x200000, CRC(9509c575) SHA1(703410d8bb98b8ec14277efcd8b7dda45a7cf358), ROM_BIOS(9)) | |
| 133 | ROMX_LOAD( "ti92pv205.rom", 0x0000, 0x200000, CRC(9509c575) SHA1(703410d8bb98b8ec14277efcd8b7dda45a7cf358), ROM_BIOS(9)) | |
| 134 | 134 | ROM_SYSTEM_BIOS( 9, "v205m", "V 2.05 [m] - HW2" ) |
| 135 | 135 | ROMX_LOAD( "ti92pv205m.rom", 0x000000, 0x200000, CRC(13ef4d57) SHA1(6ef290bb0dda72f645cd3eca9cc1185f6a2d32dc), ROM_BIOS(10)) |
| 136 | 136 | ROM_SYSTEM_BIOS( 10, "v209", "V 2.09 - HW2" ) |
| r5932 | r5933 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | ||
| 12 | TODO: | |
| 13 | 13 | |
| 14 | - Big Board (+ Italian version MK-82) | |
| 15 | - Big Board II (+ Italian version MK-83) | |
| 16 | - Xerox 820-II | |
| 17 | - Xerox 16/8 | |
| 18 | - Emerald Microware X120 board | |
| 19 | - type in Monitor v1.0 from manual | |
| 20 | - proper keyboard emulation (MCU?) | |
| 14 | - Big Board (+ Italian version MK-82) | |
| 15 | - Big Board II (+ Italian version MK-83) | |
| 16 | - Xerox 820-II | |
| 17 | - Xerox 16/8 | |
| 18 | - Emerald Microware X120 board | |
| 19 | - type in Monitor v1.0 from manual | |
| 20 | - proper keyboard emulation (MCU?) | |
| 21 | 21 | |
| 22 | http://users.telenet.be/lust/Xerox820/index.htm | |
| 23 | http://www.classiccmp.org/dunfield/img41867/system.htm | |
| 24 | http://www.microcodeconsulting.com/z80/plus2.htm | |
| 22 | http://users.telenet.be/lust/Xerox820/index.htm | |
| 23 | http://www.classiccmp.org/dunfield/img41867/system.htm | |
| 24 | http://www.microcodeconsulting.com/z80/plus2.htm | |
| 25 | 25 | |
| 26 | 26 | */ |
| 27 | 27 | |
| r5932 | r5933 | |
| 117 | 117 | { |
| 118 | 118 | /* latch key data */ |
| 119 | 119 | keydata = ~xerox820_keycodes[table][row][col]; |
| 120 | ||
| 120 | ||
| 121 | 121 | if (state->keydata != keydata) |
| 122 | 122 | { |
| 123 | 123 | state->keydata = keydata; |
| r5932 | r5933 | |
| 174 | 174 | { |
| 175 | 175 | /* |
| 176 | 176 | |
| 177 | ||
| 177 | bit signal description | |
| 178 | 178 | |
| 179 | 0 DSEL0 drive select bit 0 (01=A, 10=B, 00=C, 11=D) | |
| 180 | 1 DSEL1 drive select bit 1 | |
| 181 | 2 SIDE side select | |
| 182 | 3 VATT video attribute (0=inverse, 1=blinking) | |
| 183 | 4 BELL bell trigger | |
| 184 | 5 DENSITY density (0=double, 1=single) | |
| 185 | 6 _MOTOR disk motor (0=on, 1=off) | |
| 186 | 7 BANK memory bank switch (0=RAM, 1=ROM/video) | |
| 179 | 0 DSEL0 drive select bit 0 (01=A, 10=B, 00=C, 11=D) | |
| 180 | 1 DSEL1 drive select bit 1 | |
| 181 | 2 SIDE side select | |
| 182 | 3 VATT video attribute (0=inverse, 1=blinking) | |
| 183 | 4 BELL bell trigger | |
| 184 | 5 DENSITY density (0=double, 1=single) | |
| 185 | 6 _MOTOR disk motor (0=on, 1=off) | |
| 186 | 7 BANK memory bank switch (0=RAM, 1=ROM/video) | |
| 187 | 187 | |
| 188 | ||
| 188 | */ | |
| 189 | 189 | } |
| 190 | 190 | #endif |
| 191 | 191 | |
| r5932 | r5933 | |
| 243 | 243 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') |
| 244 | 244 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') |
| 245 | 245 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') |
| 246 | ||
| 246 | ||
| 247 | 247 | PORT_START("ROW3") |
| 248 | 248 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') |
| 249 | 249 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') |
| r5932 | r5933 | |
| 253 | 253 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| 254 | 254 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') |
| 255 | 255 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') |
| 256 | ||
| 256 | ||
| 257 | 257 | PORT_START("ROW4") |
| 258 | 258 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 259 | 259 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD) |
| r5932 | r5933 | |
| 263 | 263 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') |
| 264 | 264 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') |
| 265 | 265 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') |
| 266 | ||
| 266 | ||
| 267 | 267 | PORT_START("ROW5") |
| 268 | 268 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') |
| 269 | 269 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') |
| r5932 | r5933 | |
| 273 | 273 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| 274 | 274 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| 275 | 275 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 276 | ||
| 276 | ||
| 277 | 277 | PORT_START("ROW6") |
| 278 | 278 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r') |
| 279 | 279 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) |
| r5932 | r5933 | |
| 283 | 283 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) |
| 284 | 284 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 285 | 285 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 286 | ||
| 286 | ||
| 287 | 287 | PORT_START("ROW7") |
| 288 | 288 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 289 | 289 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| r5932 | r5933 | |
| 293 | 293 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 294 | 294 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 295 | 295 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 296 | ||
| 296 | ||
| 297 | 297 | PORT_START("ROW8") |
| 298 | 298 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 299 | 299 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| r5932 | r5933 | |
| 301 | 301 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) |
| 302 | 302 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK) |
| 303 | 303 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 304 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 305 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 304 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 305 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) | |
| 306 | 306 | |
| 307 | 307 | PORT_START("ROW9") |
| 308 | 308 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| r5932 | r5933 | |
| 330 | 330 | { |
| 331 | 331 | /* |
| 332 | 332 | |
| 333 | ||
| 333 | bit signal description | |
| 334 | 334 | |
| 335 | 0 | |
| 336 | 1 | |
| 337 | 2 | |
| 338 | 3 PBRDY keyboard data available | |
| 339 | 4 8/N5 8"/5.25" disk select (0=5.25", 1=8") | |
| 340 | 5 400/460 double sided disk detect (only on Etch 2 PCB) (0=SS, 1=DS) | |
| 341 | 6 | |
| 342 | 7 | |
| 335 | 0 | |
| 336 | 1 | |
| 337 | 2 | |
| 338 | 3 PBRDY keyboard data available | |
| 339 | 4 8/N5 8"/5.25" disk select (0=5.25", 1=8") | |
| 340 | 5 400/460 double sided disk detect (only on Etch 2 PCB) (0=SS, 1=DS) | |
| 341 | 6 | |
| 342 | 7 | |
| 343 | 343 | |
| 344 | ||
| 344 | */ | |
| 345 | 345 | |
| 346 | 346 | xerox820_state *state = device->machine->driver_data; |
| 347 | 347 | |
| r5932 | r5933 | |
| 352 | 352 | { |
| 353 | 353 | /* |
| 354 | 354 | |
| 355 | ||
| 355 | bit signal description | |
| 356 | 356 | |
| 357 | 0 _DVSEL1 drive select 1 | |
| 358 | 1 _DVSEL2 drive select 2 | |
| 359 | 2 _DVSEL3 side select | |
| 360 | 3 | |
| 361 | 4 | |
| 362 | 5 | |
| 363 | 6 NCSET2 display character set (inverted and connected to chargen A10) | |
| 364 | 7 BANK bank switching (0=RAM, 1=ROM/videoram) | |
| 357 | 0 _DVSEL1 drive select 1 | |
| 358 | 1 _DVSEL2 drive select 2 | |
| 359 | 2 _DVSEL3 side select | |
| 360 | 3 | |
| 361 | 4 | |
| 362 | 5 | |
| 363 | 6 NCSET2 display character set (inverted and connected to chargen A10) | |
| 364 | 7 BANK bank switching (0=RAM, 1=ROM/videoram) | |
| 365 | 365 | |
| 366 | ||
| 366 | */ | |
| 367 | 367 | |
| 368 | 368 | xerox820_state *state = device->machine->driver_data; |
| 369 | 369 | |
| r5932 | r5933 | |
| 393 | 393 | { |
| 394 | 394 | /* |
| 395 | 395 | |
| 396 | ||
| 396 | bit description | |
| 397 | 397 | |
| 398 | 0 KB0 | |
| 399 | 1 KB1 | |
| 400 | 2 KB2 | |
| 401 | 3 KB3 | |
| 402 | 4 KB4 | |
| 403 | 5 KB5 | |
| 404 | 6 KB6 | |
| 405 | 7 KB7 | |
| 398 | 0 KB0 | |
| 399 | 1 KB1 | |
| 400 | 2 KB2 | |
| 401 | 3 KB3 | |
| 402 | 4 KB4 | |
| 403 | 5 KB5 | |
| 404 | 6 KB6 | |
| 405 | 7 KB7 | |
| 406 | 406 | |
| 407 | ||
| 407 | */ | |
| 408 | 408 | |
| 409 | 409 | xerox820_state *state = device->machine->driver_data; |
| 410 | 410 | |
| r5932 | r5933 | |
| 457 | 457 | |
| 458 | 458 | static WRITE8_DEVICE_HANDLER( ctc_z0_w ) |
| 459 | 459 | { |
| 460 | // | |
| 460 | // z80ctc_trg_w(device, 1, data); | |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | static WRITE8_DEVICE_HANDLER( ctc_z1_w ) |
| r5932 | r5933 | |
| 467 | 467 | |
| 468 | 468 | static WRITE8_DEVICE_HANDLER( ctc_z2_w ) |
| 469 | 469 | { |
| 470 | // | |
| 470 | // z80ctc_trg_w(device, 3, data); | |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | static const z80ctc_interface ctc_intf = |
| r5932 | r5933 | |
| 518 | 518 | |
| 519 | 519 | static const wd17xx_interface wd1771_intf = |
| 520 | 520 | { |
| 521 | wd1771_callback, | |
| 521 | wd1771_callback, | |
| 522 | 522 | NULL, |
| 523 | 523 | {FLOPPY_0,FLOPPY_1,NULL,NULL} |
| 524 | 524 | }; |
| r5932 | r5933 | |
| 593 | 593 | return 0; |
| 594 | 594 | } |
| 595 | 595 | static void xerox820_load_proc(const device_config *image) |
| 596 | { | |
| 596 | { | |
| 597 | 597 | xerox820_state *state = image->machine->driver_data; |
| 598 | ||
| 598 | ||
| 599 | 599 | switch (image_length(image)) |
| 600 | 600 | { |
| 601 | 601 | case 77*1*26*128: // 250K 8" SSSD |
| r5932 | r5933 | |
| 603 | 603 | state->dsdd = 0; |
| 604 | 604 | return; |
| 605 | 605 | |
| 606 | case 77*1*26*256: // 500K 8" SSDD | |
| 606 | case 77*1*26*256: // 500K 8" SSDD | |
| 607 | 607 | state->_8n5 = 1; |
| 608 | 608 | state->dsdd = 0; |
| 609 | 609 | return; |
| 610 | 610 | |
| 611 | case 40*1*18*128: // 90K 5.25" SSSD | |
| 611 | case 40*1*18*128: // 90K 5.25" SSSD | |
| 612 | 612 | state->_8n5 = 0; |
| 613 | 613 | state->dsdd = 0; |
| 614 | 614 | return; |
| 615 | 615 | |
| 616 | case 40*2*18*128: // 180K 5.25" DSSD | |
| 616 | case 40*2*18*128: // 180K 5.25" DSSD | |
| 617 | 617 | state->_8n5 = 0; |
| 618 | 618 | state->dsdd = 1; |
| 619 | 619 | return; |
| r5932 | r5933 | |
| 648 | 648 | |
| 649 | 649 | /* bank switch */ |
| 650 | 650 | xerox820_bankswitch(machine, 1); |
| 651 | ||
| 651 | ||
| 652 | 652 | for(drive=0;drive<2;drive++) |
| 653 | 653 | { |
| 654 | 654 | floppy_install_load_proc(floppy_get_device(machine, drive), xerox820_load_proc); |
| r5932 | r5933 | |
| 674 | 674 | TRACKS([77]) |
| 675 | 675 | SECTORS([26]) |
| 676 | 676 | SECTOR_LENGTH([128]) |
| 677 | FIRST_SECTOR_ID([1])) | |
| 677 | FIRST_SECTOR_ID([1])) | |
| 678 | 678 | FLOPPY_OPTION( ssdd8, "dsk", "8\" SSDD", basicdsk_identify_default, basicdsk_construct_default, |
| 679 | 679 | HEADS([1]) |
| 680 | 680 | TRACKS([77]) |
| r5932 | r5933 | |
| 686 | 686 | TRACKS([40]) |
| 687 | 687 | SECTORS([18]) |
| 688 | 688 | SECTOR_LENGTH([128]) |
| 689 | FIRST_SECTOR_ID([1])) | |
| 689 | FIRST_SECTOR_ID([1])) | |
| 690 | 690 | FLOPPY_OPTION( ssdd5, "dsk", "5.25\" SSDD", basicdsk_identify_default, basicdsk_construct_default, |
| 691 | 691 | HEADS([2]) |
| 692 | 692 | TRACKS([40]) |
| 693 | 693 | SECTORS([18]) |
| 694 | 694 | SECTOR_LENGTH([128]) |
| 695 | FIRST_SECTOR_ID([1])) | |
| 695 | FIRST_SECTOR_ID([1])) | |
| 696 | 696 | FLOPPY_OPTIONS_END |
| 697 | 697 | |
| 698 | 698 | static const floppy_config xerox820_floppy_config = |
| r5932 | r5933 | |
| 736 | 736 | MDRV_Z80PIO_ADD(Z80GPPIO_TAG, gppio_intf) |
| 737 | 737 | MDRV_Z80CTC_ADD(Z80CTC_TAG, XTAL_20MHz/8, ctc_intf) |
| 738 | 738 | MDRV_WD1771_ADD(WD1771_TAG, wd1771_intf) |
| 739 | MDRV_FLOPPY_2_DRIVES_ADD(xerox820_floppy_config) | |
| 739 | MDRV_FLOPPY_2_DRIVES_ADD(xerox820_floppy_config) | |
| 740 | 740 | MDRV_COM8116_ADD(COM8116_TAG, XTAL_5_0688MHz, com8116_intf) |
| 741 | 741 | MACHINE_DRIVER_END |
| 742 | 742 | |
| r5932 | r5933 | |
| 783 | 783 | |
| 784 | 784 | /* System Configuration */ |
| 785 | 785 | static SYSTEM_CONFIG_START( xerox820 ) |
| 786 | CONFIG_RAM_DEFAULT (64 * 1024) | |
| 786 | CONFIG_RAM_DEFAULT (64 * 1024) | |
| 787 | 787 | SYSTEM_CONFIG_END |
| 788 | 788 | /* |
| 789 | 789 | static SYSTEM_CONFIG_START( xerox820ii ) |
| 790 | CONFIG_RAM_DEFAULT (64 * 1024) | |
| 791 | CONFIG_DEVICE(xerox820ii_floppy_getinfo) | |
| 792 | // CONFIG_DEVICE(xerox820_harddisk_getinfo) 10MB | |
| 790 | CONFIG_RAM_DEFAULT (64 * 1024) | |
| 791 | CONFIG_DEVICE(xerox820ii_floppy_getinfo) | |
| 792 | // CONFIG_DEVICE(xerox820_harddisk_getinfo) 10MB | |
| 793 | 793 | SYSTEM_CONFIG_END |
| 794 | 794 | */ |
| 795 | 795 | /* System Drivers */ |
| 796 | 796 | |
| 797 | /* YEAR NAME PARENT COMPAT MACHINE INPUT | |
| 797 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ | |
| 798 | 798 | COMP( 1981, xerox820, 0, 0, xerox820, xerox820, 0, xerox820, "Xerox", "Xerox 820", 0) |
| 799 | 799 | /* |
| 800 | COMP( 1980, bigboard, 0, 0, bigboard, bigboard, 0, bigboard, "Digital Research Computers", "Big Board", GAME_NOT_WORKING) | |
| 801 | COMP( 1983, bigbord2, 0, 0, bigbord2, bigboard, 0, bigbord2, "Digital Research Computers", "Big Board II", GAME_NOT_WORKING) | |
| 802 | COMP( 1983, xerox820ii, 0, 0, xerox820ii, xerox820, 0, xerox820ii, "Xerox", "Xerox 820-II", GAME_NOT_WORKING) | |
| 803 | COMP( 1983, xerox168, 0, 0, xerox168, xerox168, 0, xerox168, "Xerox", "Xerox 16/8", GAME_NOT_WORKING) | |
| 800 | COMP( 1980, bigboard, 0, 0, bigboard, bigboard, 0, bigboard, "Digital Research Computers", "Big Board", GAME_NOT_WORKING) | |
| 801 | COMP( 1983, bigbord2, 0, 0, bigbord2, bigboard, 0, bigbord2, "Digital Research Computers", "Big Board II", GAME_NOT_WORKING) | |
| 802 | COMP( 1983, xerox820ii, 0, 0, xerox820ii, xerox820, 0, xerox820ii, "Xerox", "Xerox 820-II", GAME_NOT_WORKING) | |
| 803 | COMP( 1983, xerox168, 0, 0, xerox168, xerox168, 0, xerox168, "Xerox", "Xerox 16/8", GAME_NOT_WORKING) | |
| 804 | 804 | */ |
| r5932 | r5933 | |
|---|---|---|
| 268 | 268 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 269 | 269 | MDRV_SOUND_ADD("dac", DAC, 0) |
| 270 | 270 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 271 | // MDRV_SOUND_WAVE_ADD("wave", "cassette") | |
| 272 | // MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) | |
| 271 | // MDRV_SOUND_WAVE_ADD("wave", "cassette") | |
| 272 | // MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) | |
| 273 | 273 | MDRV_SOUND_ADD("sn76496", SN76496, 3579545) /* 3.579545 MHz */ |
| 274 | 274 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 275 | 275 | MDRV_SOUND_ADD("tms5220", TMS5220, 680000L) |
| r5932 | r5933 | |
| 284 | 284 | MDRV_IDE_HARDDISK_ADD( "ide_harddisk" ) |
| 285 | 285 | |
| 286 | 286 | /* MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) */ |
| 287 | ||
| 287 | ||
| 288 | 288 | /* tms9901 */ |
| 289 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 289 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 290 | 290 | |
| 291 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4p_floppy_config) | |
| 292 | ||
| 291 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4p_floppy_config) | |
| 292 | ||
| 293 | 293 | MDRV_SMARTMEDIA_ADD("smartmedia") |
| 294 | ||
| 294 | ||
| 295 | 295 | MDRV_TI99_4_RS232_CARD_ADD("rs232") |
| 296 | 296 | MACHINE_DRIVER_END |
| 297 | 297 |
| r5932 | r5933 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | ||
| 2 | ||
| 3 | 3 | Busicom 141-PF |
| 4 | 4 | |
| 5 | 5 | 04/08/2009 Initial driver by Miodrag Milanovic |
| r5932 | r5933 | |
| 19 | 19 | int i; |
| 20 | 20 | for(i=0;i<num;i++) { |
| 21 | 21 | if (BIT(val,i)==0) return i; |
| 22 | } | |
| 22 | } | |
| 23 | 23 | return 0; |
| 24 | 24 | } |
| 25 | static READ8_HANDLER(keyboard_r) | |
| 25 | static READ8_HANDLER(keyboard_r) | |
| 26 | 26 | { |
| 27 | 27 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8" , "LINE9"}; |
| 28 | 28 | return input_port_read(space->machine,keynames[get_bit_selected(keyboard_shifter & 0x3ff,10)]); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | static READ8_HANDLER(printer_r) | |
| 31 | static READ8_HANDLER(printer_r) | |
| 32 | 32 | { |
| 33 | 33 | UINT8 retVal = 0; |
| 34 | 34 | if (drum_index==0) retVal |= 1; |
| r5932 | r5933 | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | static WRITE8_HANDLER(shifter_w) | |
| 40 | static WRITE8_HANDLER(shifter_w) | |
| 41 | 41 | { |
| 42 | 42 | if (BIT(data,0)) { |
| 43 | 43 | keyboard_shifter <<= 1; |
| r5932 | r5933 | |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | static WRITE8_HANDLER(printer_w) | |
| 52 | static WRITE8_HANDLER(printer_w) | |
| 53 | 53 | { |
| 54 | int i,j; | |
| 55 | if (BIT(data,0)) { | |
| 54 | int i,j; | |
| 55 | if (BIT(data,0)) { | |
| 56 | 56 | logerror("color : %02x %02x %d\n",BIT(data,0),data,drum_index); |
| 57 | busicom_printer_line_color[10] = 1; | |
| 58 | ||
| 57 | busicom_printer_line_color[10] = 1; | |
| 58 | ||
| 59 | 59 | } |
| 60 | 60 | if (BIT(data,1)) { |
| 61 | 61 | for(i=3;i<18;i++) { |
| 62 | 62 | if(BIT(printer_shifter,i)) { |
| 63 | busicom_printer_line[10][i-3] = drum_index + 1; | |
| 64 | } | |
| 63 | busicom_printer_line[10][i-3] = drum_index + 1; | |
| 64 | } | |
| 65 | 65 | } |
| 66 | 66 | if(BIT(printer_shifter,0)) { |
| 67 | 67 | busicom_printer_line[10][15] = drum_index + 13 + 1; |
| r5932 | r5933 | |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | if (BIT(data,3)) { |
| 74 | ||
| 74 | ||
| 75 | 75 | for(j=0;j<10;j++) { |
| 76 | 76 | for(i=0;i<17;i++) { |
| 77 | 77 | busicom_printer_line[j][i] = busicom_printer_line[j+1][i]; |
| r5932 | r5933 | |
| 80 | 80 | } |
| 81 | 81 | for(i=0;i<17;i++) { |
| 82 | 82 | busicom_printer_line[10][i] = 0; |
| 83 | } | |
| 83 | } | |
| 84 | 84 | busicom_printer_line_color[10] = 0; |
| 85 | ||
| 85 | ||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | static WRITE8_HANDLER(status_w) | |
| 88 | static WRITE8_HANDLER(status_w) | |
| 89 | 89 | { |
| 90 | /* UINT8 mem_lamp = BIT(data,0); | |
| 91 | UINT8 over_lamp = BIT(data,1); | |
| 92 | UINT8 minus_lamp = BIT(data,2); | |
| 93 | */ | |
| 90 | /* UINT8 mem_lamp = BIT(data,0); | |
| 91 | UINT8 over_lamp = BIT(data,1); | |
| 92 | UINT8 minus_lamp = BIT(data,2); | |
| 93 | */ | |
| 94 | 94 | //logerror("status %c %c %c\n",mem_lamp ? 'M':'x',over_lamp ? 'O':'x',minus_lamp ? '-':'x'); |
| 95 | 95 | } |
| 96 | 96 | |
| r5932 | r5933 | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | static ADDRESS_MAP_START(busicom_rom, ADDRESS_SPACE_PROGRAM, 8) |
| 102 | ADDRESS_MAP_UNMAP_HIGH | |
| 102 | ADDRESS_MAP_UNMAP_HIGH | |
| 103 | 103 | AM_RANGE(0x0000, 0x04FF) AM_ROM |
| 104 | 104 | ADDRESS_MAP_END |
| 105 | 105 | |
| r5932 | r5933 | |
| 168 | 168 | PORT_CONFSETTING( 0x04, "4" ) |
| 169 | 169 | PORT_CONFSETTING( 0x05, "5" ) |
| 170 | 170 | PORT_CONFSETTING( 0x06, "6" ) |
| 171 | PORT_CONFSETTING( 0x08, "8" ) | |
| 171 | PORT_CONFSETTING( 0x08, "8" ) | |
| 172 | 172 | PORT_START("LINE9") |
| 173 | 173 | PORT_CONFNAME( 0x0f, 0x00, "Rounding") |
| 174 | 174 | PORT_CONFSETTING( 0x01, "/N" ) |
| r5932 | r5933 | |
| 186 | 186 | timer ^=1; |
| 187 | 187 | if (timer==1) drum_index++; |
| 188 | 188 | if (drum_index==13) drum_index=0; |
| 189 | i4004_set_test(cputag_get_cpu(machine, "maincpu"),timer); | |
| 190 | ||
| 189 | i4004_set_test(cputag_get_cpu(machine, "maincpu"),timer); | |
| 190 | ||
| 191 | 191 | } |
| 192 | static MACHINE_RESET(busicom) | |
| 192 | static MACHINE_RESET(busicom) | |
| 193 | 193 | { |
| 194 | 194 | int i,j; |
| 195 | 195 | drum_index =0; |
| 196 | 196 | keyboard_shifter = 0; |
| 197 | 197 | printer_shifter = 0; |
| 198 | 198 | timer_pulse(machine, ATTOTIME_IN_MSEC(28*2), NULL, 0, timer_callback); |
| 199 | ||
| 199 | ||
| 200 | 200 | for(i=0;i<17;i++) { |
| 201 | 201 | for(j=0;j<11;j++) { |
| 202 | 202 | busicom_printer_line[j][i] = 0; |
| 203 | 203 | busicom_printer_line_color[j] = 0; |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | ||
| 206 | ||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | static const char layout_busicom [] = "busicom"; |
| r5932 | r5933 | |
| 213 | 213 | MDRV_CPU_ADD("maincpu",I4004, 750000) |
| 214 | 214 | MDRV_CPU_PROGRAM_MAP(busicom_rom) |
| 215 | 215 | MDRV_CPU_DATA_MAP(busicom_mem) |
| 216 | MDRV_CPU_IO_MAP(busicom_io) | |
| 216 | MDRV_CPU_IO_MAP(busicom_io) | |
| 217 | 217 | |
| 218 | 218 | MDRV_MACHINE_RESET(busicom) |
| 219 | ||
| 219 | ||
| 220 | 220 | /* video hardware */ |
| 221 | 221 | MDRV_SCREEN_ADD("screen", RASTER) |
| 222 | 222 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 226 | 226 | MDRV_SCREEN_VISIBLE_AREA(0, 40*17-1, 0, 44*11-1) |
| 227 | 227 | MDRV_PALETTE_LENGTH(16) |
| 228 | 228 | MDRV_PALETTE_INIT(busicom) |
| 229 | ||
| 229 | ||
| 230 | 230 | MDRV_VIDEO_START(busicom) |
| 231 | MDRV_VIDEO_UPDATE(busicom) | |
| 231 | MDRV_VIDEO_UPDATE(busicom) | |
| 232 | 232 | MACHINE_DRIVER_END |
| 233 | 233 | |
| 234 | 234 | /* ROM definition */ |
| r5932 | r5933 | |
|---|---|---|
| 77 | 77 | those added for the IBM PC Jr. |
| 78 | 78 | |
| 79 | 79 | Tandy 1000 (8088) variations: |
| 80 | 1000 128KB-640KB RAM 4.77 MHz v01.00.00, v01.01.00 | |
| 81 | 1000A/1000HD 128KB-640KB RAM 4.77 MHz v01.01.00 | |
| 82 | 1000SX/1000AX 384KB-640KB RAM 7.16/4.77 MHz v01.02.00 | |
| 83 | 1000EX 256KB-640KB RAM 7.16/4.77 MHz v01.02.00 | |
| 84 | 1000HX 256KB-640KB RAM 7.16/4.77 MHz v02.00.00 | |
| 80 | 1000 128KB-640KB RAM 4.77 MHz v01.00.00, v01.01.00 | |
| 81 | 1000A/1000HD 128KB-640KB RAM 4.77 MHz v01.01.00 | |
| 82 | 1000SX/1000AX 384KB-640KB RAM 7.16/4.77 MHz v01.02.00 | |
| 83 | 1000EX 256KB-640KB RAM 7.16/4.77 MHz v01.02.00 | |
| 84 | 1000HX 256KB-640KB RAM 7.16/4.77 MHz v02.00.00 | |
| 85 | 85 | |
| 86 | 86 | Tandy 1000 (8086) variations: |
| 87 | 1000RL/1000RL-HD | |
| 87 | 1000RL/1000RL-HD 512KB-768KB RAM 9.44/4.77 MHz v02.00.00, v02.00.01 | |
| 88 | 88 | 1000SL/1000PC 384KB-640KB RAM 8.0/4.77 MHz v01.04.00, v01.04.01, v01.04.02, v02.00.01 |
| 89 | 89 | 1000SL/2 512KB-640KB RAM 8.0/4.77 MHz v01.04.04 |
| 90 | 90 | |
| 91 | 91 | Tandy 1000 (80286) variations: |
| 92 | 1000TX 640KB-768KB RAM 8.0/4.77 MHz v01.03.00 | |
| 93 | 1000TL 640KB-768KB RAM 8.0/4.77 MHz v01.04.00, v01.04.01, v01.04.02 | |
| 94 | 1000TL/2 640KB-768KB RAM 8.0/4.77 MHz v02.00.00 | |
| 95 | 1000TL/3 640KB-768KB RAM 10.0/5.0 MHz v02.00.00 | |
| 96 | 1000RLX 512KB-1024KB RAM 10.0/5.0 MHz v02.00.00 | |
| 97 | 1000RLX-HD 1024MB RAM 10.0/5.0 MHz v02.00.00 | |
| 92 | 1000TX 640KB-768KB RAM 8.0/4.77 MHz v01.03.00 | |
| 93 | 1000TL 640KB-768KB RAM 8.0/4.77 MHz v01.04.00, v01.04.01, v01.04.02 | |
| 94 | 1000TL/2 640KB-768KB RAM 8.0/4.77 MHz v02.00.00 | |
| 95 | 1000TL/3 640KB-768KB RAM 10.0/5.0 MHz v02.00.00 | |
| 96 | 1000RLX 512KB-1024KB RAM 10.0/5.0 MHz v02.00.00 | |
| 97 | 1000RLX-HD 1024MB RAM 10.0/5.0 MHz v02.00.00 | |
| 98 | 98 | |
| 99 | 99 | Tandy 1000 (80386) variations: |
| 100 | 1000RSX/1000RSX-HD | |
| 100 | 1000RSX/1000RSX-HD 1M-9M RAM 25.0/8.0 MHz v01.10.00 | |
| 101 | 101 | |
| 102 | 102 | IBM PC Jr: |
| 103 | 103 | |
| r5932 | r5933 | |
| 329 | 329 | AM_RANGE(0x0388, 0x0388) AM_DEVREADWRITE("ym3812", ym3812_status_port_r,ym3812_control_port_w) |
| 330 | 330 | AM_RANGE(0x0389, 0x0389) AM_DEVWRITE("ym3812", ym3812_write_port_w) |
| 331 | 331 | #endif |
| 332 | // | |
| 332 | // AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w) | |
| 333 | 333 | AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_r, ins8250_w) |
| 334 | 334 | AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r, pc_fdc_w) |
| 335 | 335 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w) |
| r5932 | r5933 | |
| 854 | 854 | PORT_DIPSETTING( 0x02, "On (12 MHz)" ) |
| 855 | 855 | PORT_BIT( 0x01, 0x01, IPT_UNUSED ) |
| 856 | 856 | |
| 857 | // | |
| 857 | // PORT_INCLUDE( at_keyboard ) /* IN4 - IN11 */ | |
| 858 | 858 | PORT_INCLUDE( kb_keytronic_pc ) |
| 859 | 859 | PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ |
| 860 | 860 | PORT_INCLUDE( pc_joystick ) /* IN15 - IN19 */ |
| r5932 | r5933 | |
| 929 | 929 | PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)") |
| 930 | 930 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 931 | 931 | PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) |
| 932 | // PORT_DIPNAME( 0x02, 0x02, "Turbo Switch" ) | |
| 933 | // PORT_DIPSETTING( 0x00, "Off (4.77 MHz)" ) | |
| 934 | // PORT_DIPSETTING( 0x02, "On (12 MHz)" ) | |
| 932 | // PORT_DIPNAME( 0x02, 0x02, "Turbo Switch" ) | |
| 933 | // PORT_DIPSETTING( 0x00, "Off (4.77 MHz)" ) | |
| 934 | // PORT_DIPSETTING( 0x02, "On (12 MHz)" ) | |
| 935 | 935 | PORT_BIT( 0x01, 0x01, IPT_UNUSED ) |
| 936 | 936 | |
| 937 | 937 | PORT_INCLUDE( pc_keyboard ) /* IN4 - IN11 */ |
| r5932 | r5933 | |
| 1007 | 1007 | PORT_DIPSETTING( 0x08, "0x08" ) |
| 1008 | 1008 | /* 2008-05 FP: This Dip Switch overlaps the next one. |
| 1009 | 1009 | Since pc200 is anyway NOT_WORKING, I comment out this one */ |
| 1010 | /* PORT_DIPNAME( 0x10, 0x00, "37a 0x80") | |
| 1011 | PORT_DIPSETTING( 0x00, "0x00" ) | |
| 1012 | PORT_DIPSETTING( 0x10, "0x10" ) */ | |
| 1010 | /* PORT_DIPNAME( 0x10, 0x00, "37a 0x80") | |
| 1011 | PORT_DIPSETTING( 0x00, "0x00" ) | |
| 1012 | PORT_DIPSETTING( 0x10, "0x10" ) */ | |
| 1013 | 1013 | PORT_DIPNAME( 0x30, 0x00, "Integrated Graphics Adapter") |
| 1014 | 1014 | PORT_DIPSETTING( 0x00, "CGA 1" ) |
| 1015 | 1015 | PORT_DIPSETTING( 0x10, "CGA 2" ) |
| r5932 | r5933 | |
| 1172 | 1172 | |
| 1173 | 1173 | PORT_START("DSW0") /* IN1 */ |
| 1174 | 1174 | PORT_DIPNAME( 0x07, 0x07, "Name/Language") |
| 1175 | // | |
| 1175 | // PORT_DIPSETTING( 0x00, "PC 512k" ) // machine crashes with ega bios at 0xc0000 | |
| 1176 | 1176 | PORT_DIPSETTING( 0x01, DEF_STR( Italian ) ) //prego attendere |
| 1177 | 1177 | PORT_DIPSETTING( 0x02, "V.g. v\xC3\xA4nta" ) |
| 1178 | 1178 | PORT_DIPSETTING( 0x03, "Vent et cjeblik" ) // seldom c |
| r5932 | r5933 | |
| 1261 | 1261 | |
| 1262 | 1262 | PORT_INCLUDE( amstrad_keyboard ) /* IN4 - IN14 */ |
| 1263 | 1263 | |
| 1264 | // | |
| 1264 | // PORT_INCLUDE( pc_mouse_microsoft ) /* IN12 - IN14 */ | |
| 1265 | 1265 | |
| 1266 | 1266 | INPUT_PORTS_END |
| 1267 | 1267 | |
| r5932 | r5933 | |
| 1442 | 1442 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1443 | 1443 | |
| 1444 | 1444 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1445 | ||
| 1445 | ||
| 1446 | 1446 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1447 | 1447 | MACHINE_DRIVER_END |
| 1448 | 1448 | |
| r5932 | r5933 | |
| 1501 | 1501 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1502 | 1502 | |
| 1503 | 1503 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1504 | ||
| 1504 | ||
| 1505 | 1505 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1506 | 1506 | MACHINE_DRIVER_END |
| 1507 | 1507 | |
| r5932 | r5933 | |
| 1571 | 1571 | MDRV_CASSETTE_ADD( "cassette", ibm5150_cassette_config ) |
| 1572 | 1572 | |
| 1573 | 1573 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1574 | ||
| 1574 | ||
| 1575 | 1575 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1576 | 1576 | MACHINE_DRIVER_END |
| 1577 | 1577 | |
| r5932 | r5933 | |
| 1629 | 1629 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1630 | 1630 | |
| 1631 | 1631 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1632 | ||
| 1632 | ||
| 1633 | 1633 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1634 | 1634 | MACHINE_DRIVER_END |
| 1635 | 1635 | |
| r5932 | r5933 | |
| 1678 | 1678 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1679 | 1679 | |
| 1680 | 1680 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1681 | ||
| 1681 | ||
| 1682 | 1682 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1683 | 1683 | MACHINE_DRIVER_END |
| 1684 | 1684 | |
| r5932 | r5933 | |
| 1734 | 1734 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1735 | 1735 | |
| 1736 | 1736 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1737 | ||
| 1737 | ||
| 1738 | 1738 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1739 | 1739 | MACHINE_DRIVER_END |
| 1740 | 1740 | |
| r5932 | r5933 | |
| 1776 | 1776 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1777 | 1777 | |
| 1778 | 1778 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1779 | ||
| 1779 | ||
| 1780 | 1780 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1781 | 1781 | MACHINE_DRIVER_END |
| 1782 | 1782 | |
| r5932 | r5933 | |
| 1820 | 1820 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1821 | 1821 | |
| 1822 | 1822 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1823 | ||
| 1823 | ||
| 1824 | 1824 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1825 | 1825 | MACHINE_DRIVER_END |
| 1826 | 1826 | |
| r5932 | r5933 | |
| 1864 | 1864 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1865 | 1865 | |
| 1866 | 1866 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1867 | ||
| 1867 | ||
| 1868 | 1868 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1869 | 1869 | MACHINE_DRIVER_END |
| 1870 | 1870 | |
| r5932 | r5933 | |
| 1920 | 1920 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1921 | 1921 | |
| 1922 | 1922 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1923 | ||
| 1923 | ||
| 1924 | 1924 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1925 | 1925 | MACHINE_DRIVER_END |
| 1926 | 1926 | |
| r5932 | r5933 | |
| 1964 | 1964 | MDRV_IMPORT_FROM( pc_hdc ) |
| 1965 | 1965 | |
| 1966 | 1966 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 1967 | ||
| 1967 | ||
| 1968 | 1968 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 1969 | 1969 | MACHINE_DRIVER_END |
| 1970 | 1970 | |
| r5932 | r5933 | |
| 2008 | 2008 | MDRV_IMPORT_FROM( pc_hdc ) |
| 2009 | 2009 | |
| 2010 | 2010 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 2011 | ||
| 2011 | ||
| 2012 | 2012 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 2013 | 2013 | MACHINE_DRIVER_END |
| 2014 | 2014 | |
| r5932 | r5933 | |
| 2052 | 2052 | MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface) |
| 2053 | 2053 | |
| 2054 | 2054 | MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config) |
| 2055 | ||
| 2055 | ||
| 2056 | 2056 | /* cartridge */ |
| 2057 | 2057 | MDRV_CARTSLOT_ADD("cart1") |
| 2058 | 2058 | MDRV_CARTSLOT_EXTENSION_LIST("jrc") |
| r5932 | r5933 | |
| 2126 | 2126 | ROM_START( ibm5150 ) |
| 2127 | 2127 | ROM_REGION(0x100000,"maincpu", 0) |
| 2128 | 2128 | ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF */ |
| 2129 | // | |
| 2129 | // 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 */ | |
| 2130 | 2130 | |
| 2131 | 2131 | /* Xebec 1210 and 1220 Z80-based ST409/ST412 MFM controllers */ |
| 2132 | // 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) */ | |
| 2133 | // 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 changable without requiring soldering )*/ | |
| 2134 | // ROM_LOAD("unknown.12d", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1210 Non-IBM/Retail Fixed Disk Adapter - supports 4 hdd types, selectable by jumpers (changable without soldering) */ | |
| 2135 | // 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 (changable without soldering) */ | |
| 2132 | // 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) */ | |
| 2133 | // 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 changable without requiring soldering )*/ | |
| 2134 | // ROM_LOAD("unknown.12d", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1210 Non-IBM/Retail Fixed Disk Adapter - supports 4 hdd types, selectable by jumpers (changable without soldering) */ | |
| 2135 | // 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 (changable without soldering) */ | |
| 2136 | 2136 | |
| 2137 | 2137 | /* IBM PC 5150 (rev 3: 1501-476 10/27/82) 5-screw case 64-256k MB w/1501981 CGA Card, ROM Basic 1.1 */ |
| 2138 | 2138 | ROM_DEFAULT_BIOS( "rev3" ) |
| r5932 | r5933 | |
| 2161 | 2161 | ROMX_LOAD("5700671.u33", 0xfe000, 0x2000, CRC(b7d4ec46) SHA1(bdb06f846c4768f39eeff7e16b6dbff8cd2117d2), ROM_BIOS(3)) |
| 2162 | 2162 | |
| 2163 | 2163 | /* Z80 on the Xebec 1210 and 1220 Hard Disk Controllers */ |
| 2164 | // ROM_REGION(0x10000, "cpu1", 0) | |
| 2165 | // 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. */ | |
| 2166 | // /* Other versions probably exist for the non-IBM/Retail 1210 and the 1220 */ | |
| 2164 | // ROM_REGION(0x10000, "cpu1", 0) | |
| 2165 | // 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. */ | |
| 2166 | // /* Other versions probably exist for the non-IBM/Retail 1210 and the 1220 */ | |
| 2167 | 2167 | |
| 2168 | 2168 | /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ |
| 2169 | 2169 | ROM_REGION(0x2000,"gfx1", 0) |
| r5932 | r5933 | |
| 2236 | 2236 | ROM_START( pc ) |
| 2237 | 2237 | ROM_REGION(0x100000,"maincpu", 0) |
| 2238 | 2238 | ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF */ |
| 2239 | // | |
| 2239 | // ROM_LOAD("xthdd.rom", 0xc8000, 0x02000, CRC(a96317da)) | |
| 2240 | 2240 | ROM_LOAD("pcxt.rom", 0xfe000, 0x02000, CRC(031aafad) SHA1(a641b505bbac97b8775f91fe9b83d9afdf4d038f)) |
| 2241 | 2241 | |
| 2242 | 2242 | /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ |
| r5932 | r5933 | |
| 2360 | 2360 | |
| 2361 | 2361 | ROM_START( t1000rl ) |
| 2362 | 2362 | ROM_REGION(0x100000,"maincpu", 0) |
| 2363 | // | |
| 2363 | // ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF */ // not sure about this one | |
| 2364 | 2364 | |
| 2365 | 2365 | /* v2.0.0.1 */ |
| 2366 | 2366 | /* Rom is labeled "(C) TANDY CORP. 1990 // 8079073 // LH534G70 JAPAN // 9034 D" */ |
| r5932 | r5933 | |
| 2376 | 2376 | ROM_START( ibm5160 ) |
| 2377 | 2377 | ROM_REGION16_LE(0x100000,"maincpu", 0) |
| 2378 | 2378 | ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF */ |
| 2379 | // | |
| 2379 | // ROM_LOAD("600963.u12", 0xc8000, 0x02000, CRC(f3daf85f) SHA1(3bd29538832d3084cbddeec92593988772755283)) /* Tandon/Western Digital Fixed Disk Adapter 600963-001__TYPE_5.U12.2764.bin */ | |
| 2380 | 2380 | |
| 2381 | 2381 | /* PC/3270 has a 3270 keyboard controller card, plus a rom on that card to tell the pc how to run it. |
| 2382 | * Unlike the much more complex keyboard controller used in the AT/3270, this one only has one rom, | |
| 2383 | a motorola made "(M)1503828 // XE // 8434A XM // SC81155P" custom (an MCU?; the more complicated | |
| 2384 | 3270/AT keyboard card uses this same exact chip), an 8254, and some logic chips. | |
| 2385 | Thanks to high resolution pictures provided by John Elliott, I can see that the location of the | |
| 2382 | * Unlike the much more complex keyboard controller used in the AT/3270, this one only has one rom, | |
| 2383 | a motorola made "(M)1503828 // XE // 8434A XM // SC81155P" custom (an MCU?; the more complicated | |
| 2384 | 3270/AT keyboard card uses this same exact chip), an 8254, and some logic chips. | |
| 2385 | Thanks to high resolution pictures provided by John Elliott, I can see that the location of the | |
| 2386 | 2386 | chips is unlabeled (except for by absolute pin position on the back), and there are no pals or proms. |
| 2387 | * The board is stickered "2683114 // 874999 // 8446 SU" on the front. | |
| 2388 | * The board has a single DE-9 connector where the keyboard dongle connects to. | |
| 2389 | * The keyboard dongle has two connectors on it: a DIN-5 connector which connects to the Motherboard's | |
| 2390 | keyboard port, plus an RJ45-lookalike socket which the 3270 keyboard connects to. | |
| 2391 | * The rom is mapped very strangely to avoid hitting the hard disk controller: | |
| 2392 | The first 0x800 bytes appear at C0000-C07FF, and the last 0x1800 bytes appear at 0xCA000-CB7FF | |
| 2393 | */ | |
| 2394 | // ROM_LOAD("6323581.bin", 0xc0000, 0x00800, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81)) | |
| 2395 | // ROM_LOAD("6323581.bin", 0xca000, 0x01800, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81) ROM_SKIP(0x800)) | |
| 2387 | * The board is stickered "2683114 // 874999 // 8446 SU" on the front. | |
| 2388 | * The board has a single DE-9 connector where the keyboard dongle connects to. | |
| 2389 | * The keyboard dongle has two connectors on it: a DIN-5 connector which connects to the Motherboard's | |
| 2390 | keyboard port, plus an RJ45-lookalike socket which the 3270 keyboard connects to. | |
| 2391 | * The rom is mapped very strangely to avoid hitting the hard disk controller: | |
| 2392 | The first 0x800 bytes appear at C0000-C07FF, and the last 0x1800 bytes appear at 0xCA000-CB7FF | |
| 2393 | */ | |
| 2394 | // ROM_LOAD("6323581.bin", 0xc0000, 0x00800, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81)) | |
| 2395 | // ROM_LOAD("6323581.bin", 0xca000, 0x01800, CRC(cf323cbd) SHA1(93c1ef2ede02772a46dab075c32e179faa045f81) ROM_SKIP(0x800)) | |
| 2396 | 2396 | |
| 2397 | 2397 | /* Xebec 1210 and 1220 Z80-based ST409/ST412 MFM controllers */ |
| 2398 | // 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) */ | |
| 2399 | // 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 changable without requiring soldering )*/ | |
| 2400 | // ROM_LOAD("unknown.12d", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1210 Non-IBM/Retail Fixed Disk Adapter - supports 4 hdd types, selectable by jumpers (changable without soldering) */ | |
| 2401 | // 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 (changable without soldering) */ | |
| 2398 | // 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) */ | |
| 2399 | // 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 changable without requiring soldering )*/ | |
| 2400 | // ROM_LOAD("unknown.12d", 0xc8000, 0x02000, NO_DUMP ) /* Xebec 1210 Non-IBM/Retail Fixed Disk Adapter - supports 4 hdd types, selectable by jumpers (changable without soldering) */ | |
| 2401 | // 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 (changable without soldering) */ | |
| 2402 | 2402 | |
| 2403 | 2403 | |
| 2404 | 2404 | ROM_DEFAULT_BIOS( "rev4" ) |
| r5932 | r5933 | |
| 2419 | 2419 | ROMX_LOAD("68x4370.u19", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2), ROM_BIOS(4)) |
| 2420 | 2420 | ROMX_LOAD("62x0890.u18", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb), ROM_BIOS(4)) |
| 2421 | 2421 | |
| 2422 | // 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 */ | |
| 2423 | // ROMX_LOAD("basicc11.f6", 0xf6000, 0x2000, BAD_DUMP CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(5) ) | |
| 2424 | // ROMX_LOAD("basicc11.f8", 0xf8000, 0x2000, BAD_DUMP CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(5) ) | |
| 2425 | // ROMX_LOAD("basicc11.fa", 0xfa000, 0x2000, BAD_DUMP CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(5) ) | |
| 2426 | // ROMX_LOAD("basicc11.fc", 0xfc000, 0x2000, BAD_DUMP CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(5) ) | |
| 2427 | // ROMX_LOAD("xtdiag.bin", 0xfe000, 0x2000, CRC(4e89a4d8) SHA1(39a28fb2fe9f1aeea24ed2c0255cebca76e37ed7), ROM_BIOS(5) ) | |
| 2422 | // 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 */ | |
| 2423 | // ROMX_LOAD("basicc11.f6", 0xf6000, 0x2000, BAD_DUMP CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(5) ) | |
| 2424 | // ROMX_LOAD("basicc11.f8", 0xf8000, 0x2000, BAD_DUMP CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(5) ) | |
| 2425 | // ROMX_LOAD("basicc11.fa", 0xfa000, 0x2000, BAD_DUMP CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(5) ) | |
| 2426 | // ROMX_LOAD("basicc11.fc", 0xfc000, 0x2000, BAD_DUMP CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(5) ) | |
| 2427 | // ROMX_LOAD("xtdiag.bin", 0xfe000, 0x2000, CRC(4e89a4d8) SHA1(39a28fb2fe9f1aeea24ed2c0255cebca76e37ed7), ROM_BIOS(5) ) | |
| 2428 | 2428 | |
| 2429 | 2429 | /* IBM 1501981(CGA) and 1501985(MDA) Character rom */ |
| 2430 | 2430 | ROM_REGION(0x2000,"gfx1", 0) |
| 2431 | 2431 | ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */ |
| 2432 | 2432 | |
| 2433 | 2433 | /* Z80 ROM on the Xebec 1210 and 1220 Hard Disk Controllers */ |
| 2434 | // ROM_REGION(0x10000, "cpu1", 0) | |
| 2435 | // 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. */ | |
| 2436 | // /* Other versions probably exist for the non-IBM/Retail 1210 and the 1220 */ | |
| 2434 | // ROM_REGION(0x10000, "cpu1", 0) | |
| 2435 | // 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. */ | |
| 2436 | // /* Other versions probably exist for the non-IBM/Retail 1210 and the 1220 */ | |
| 2437 | 2437 | |
| 2438 | 2438 | |
| 2439 | 2439 | /* PC/3270 and AT/3270 have a set of two (optionally 3) 3270PGC programmable graphics controller cards on them which |
| 2440 | 2440 | have 2 extra roms, plus a number of custom chips and at least one MCU. |
| 2441 | Information on these three boards plus the keyboard interface can be found at: | |
| 2442 | http://www.seasip.info/VintagePC/5271.html | |
| 2443 | *** The descriptions below are based on the cards from the AT/3270, which are slightly | |
| 2444 | different from the PC/3270 cards. Changes between the PC/3270 and AT/3270 video cards are | |
| 2445 | listed: | |
| 2446 | 1. The card lip edge is changed on the APA and PS cards to allow them to be placed | |
| 2447 | in a 16-bit ISA slot. | |
| 2448 | 2. The Main Display board is exactly the same PCB (hence cannot be placed in a 16-bit | |
| 2449 | ISA slot), but the socket to the left of the 8255 is now populated, and has a lot of | |
| 2450 | rework wires connected to various places on the PCB. | |
| 2451 | 3. The APA board was completely redone, and no longer has an 8254 (though it does have an | |
| 2452 | empty socket) and has ?twice as much memory on it? (not sure about this). The APA | |
| 2453 | board also now connects to both main board connectors 1 and 3, instead of only | |
| 2454 | connector 1. | |
| 2455 | 4. The PS board has been minorly redone to allow clearance for a 16-bit ISA connector, | |
| 2456 | but no other significant chip changes were made. The connector 3 still exists on the | |
| 2457 | board but is unpopulated. Connector 2 still connects to the Main display board as | |
| 2458 | before. | |
| 2441 | Information on these three boards plus the keyboard interface can be found at: | |
| 2442 | http://www.seasip.info/VintagePC/5271.html | |
| 2443 | *** The descriptions below are based on the cards from the AT/3270, which are slightly | |
| 2444 | different from the PC/3270 cards. Changes between the PC/3270 and AT/3270 video cards are | |
| 2445 | listed: | |
| 2446 | 1. The card lip edge is changed on the APA and PS cards to allow them to be placed | |
| 2447 | in a 16-bit ISA slot. | |
| 2448 | 2. The Main Display board is exactly the same PCB (hence cannot be placed in a 16-bit | |
| 2449 | ISA slot), but the socket to the left of the 8255 is now populated, and has a lot of | |
| 2450 | rework wires connected to various places on the PCB. | |
| 2451 | 3. The APA board was completely redone, and no longer has an 8254 (though it does have an | |
| 2452 | empty socket) and has ?twice as much memory on it? (not sure about this). The APA | |
| 2453 | board also now connects to both main board connectors 1 and 3, instead of only | |
| 2454 | connector 1. | |
| 2455 | 4. The PS board has been minorly redone to allow clearance for a 16-bit ISA connector, | |
| 2456 | but no other significant chip changes were made. The connector 3 still exists on the | |
| 2457 | board but is unpopulated. Connector 2 still connects to the Main display board as | |
| 2458 | before. | |
| 2459 | 2459 | |
| 2460 | ** The Main Display Board (with one 48-pin custom, 3 40 pin customs at least one of which is | |
| 2461 | an MCU, four 2016BP-10 srams, an 8254 and an 8255 on it, two crystals (16.257MHz and | |
| 2462 | 21.676MHz) plus two mask roms ) is stickered "61X6579 // 983623 // 6390 SU" on the front. | |
| 2463 | * The pcb is trace-marked "6320987" on both the front and back. | |
| 2464 | * The card has a DE-9 connector on it for a monitor. | |
| 2465 | * The customs are marked: | |
| 2466 | "1503192 // TC15G008P-0009 // JAPAN 8549A" (40 pins, at U52) | |
| 2467 | "1503193 // TC15G008AP-0020 // JAPAN 8610A" (48 pins, at U29) | |
| 2468 | "(M)1503194 // XE KGA005 // 8616N XM // SC81156P" (40 pins, at U36, likely an MCU) | |
| 2469 | "S8613 // SCN2672B // C4N40 A // CP3303" (40 pins, at U24, also possibly an MCU) | |
| 2460 | ** The Main Display Board (with one 48-pin custom, 3 40 pin customs at least one of which is | |
| 2461 | an MCU, four 2016BP-10 srams, an 8254 and an 8255 on it, two crystals (16.257MHz and | |
| 2462 | 21.676MHz) plus two mask roms ) is stickered "61X6579 // 983623 // 6390 SU" on the front. | |
| 2463 | * The pcb is trace-marked "6320987" on both the front and back. | |
| 2464 | * The card has a DE-9 connector on it for a monitor. | |
| 2465 | * The customs are marked: | |
| 2466 | "1503192 // TC15G008P-0009 // JAPAN 8549A" (40 pins, at U52) | |
| 2467 | "1503193 // TC15G008AP-0020 // JAPAN 8610A" (48 pins, at U29) | |
| 2468 | "(M)1503194 // XE KGA005 // 8616N XM // SC81156P" (40 pins, at U36, likely an MCU) | |
| 2469 | "S8613 // SCN2672B // C4N40 A // CP3303" (40 pins, at U24, also possibly an MCU) | |
| 2470 | 2470 | |
| 2471 | ** The All Points Addressable (Frame buffer?) card (with 2 48-pin customs on it which are | |
| 2472 | probably gate arrays and not MCUs, an empty socket (28 pins, U46), an Intel Id2147H-3, | |
| 2473 | a bank of twelve 16k*4-bit inmos ims2620p-15 DRAMs (tms4416 equivalent), and an Intel | |
| 2474 | D2147K 4096*1 byte SRAM) is stickered | |
| 2475 | "6487836 // A24969 // 6400 SU" on the back. | |
| 2476 | * The pcb is trace-marked "EC 999040" on the back, and silkscreened "RC 2682819" on the front | |
| 2477 | * The customs are marked: | |
| 2478 | "6323259 // TC15G008AP-0028 // JAPAN 8606A" (48 pins, at U67) | |
| 2479 | "6323260 // TC15G022AP-0018 // JAPAN 8606A" (48 pins, at U45) | |
| 2471 | ** The All Points Addressable (Frame buffer?) card (with 2 48-pin customs on it which are | |
| 2472 | probably gate arrays and not MCUs, an empty socket (28 pins, U46), an Intel Id2147H-3, | |
| 2473 | a bank of twelve 16k*4-bit inmos ims2620p-15 DRAMs (tms4416 equivalent), and an Intel | |
| 2474 | D2147K 4096*1 byte SRAM) is stickered | |
| 2475 | "6487836 // A24969 // 6400 SU" on the back. | |
| 2476 | * The pcb is trace-marked "EC 999040" on the back, and silkscreened "RC 2682819" on the front | |
| 2477 | * The customs are marked: | |
| 2478 | "6323259 // TC15G008AP-0028 // JAPAN 8606A" (48 pins, at U67) | |
| 2479 | "6323260 // TC15G022AP-0018 // JAPAN 8606A" (48 pins, at U45) | |
| 2480 | 2480 | |
| 2481 | ** The optional Programmable Symbol Card (with an AMD AM9128-10PC, and six tms4416-15NL DRAMS, | |
| 2482 | and a fleet of discrete logic chips, but no roms, pals, or proms) is stickered | |
| 2483 | "6347750 // A24866 // 6285 SU" on the front. | |
| 2484 | * The PCB is trace-marked "PROGAMMABLE SYMBOL P/N 6347751 // ASSY. NO. 6347750" on the front, | |
| 2485 | and trace-marked "|||CIM0286 ECA2466 // 94V-O" on the back. | |
| 2486 | */ | |
| 2487 | // ROM_REGION(0x4000,"gfx2", 0) | |
| 2481 | ** The optional Programmable Symbol Card (with an AMD AM9128-10PC, and six tms4416-15NL DRAMS, | |
| 2482 | and a fleet of discrete logic chips, but no roms, pals, or proms) is stickered | |
| 2483 | "6347750 // A24866 // 6285 SU" on the front. | |
| 2484 | * The PCB is trace-marked "PROGAMMABLE SYMBOL P/N 6347751 // ASSY. NO. 6347750" on the front, | |
| 2485 | and trace-marked "|||CIM0286 ECA2466 // 94V-O" on the back. | |
| 2486 | */ | |
| 2487 | // ROM_REGION(0x4000,"gfx2", 0) | |
| 2488 | 2488 | // ROM_LOAD("1504161.u11", 0x00000, 0x2000, CRC(d9246cf5) SHA1(2eaed495893a4e6649b04d10dada7b5ef4abd140)) /* silkscreen: "AMI 8613MAJ // 9591-041 // S2364B // 1504161 // PHILIPPINES" - Purpose: Pixels 0 thru 7 of built-in 3270 terminal font*/ |
| 2489 | 2489 | // 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*/ |
| 2490 | 2490 | |
| r5932 | r5933 | |
| 2505 | 2505 | /* |
| 2506 | 2506 | Sinclair PC200 ROMs (from a v1.2 PC200): |
| 2507 | 2507 | |
| 2508 | 40109.ic159 -- Character set, the same as in the 1.5 PC200. Label: | |
| 2509 | ||
| 2510 | AMSTRAD | |
| 2511 | 40109 | |
| 2512 | 8827 B | |
| 2508 | 40109.ic159 -- Character set, the same as in the 1.5 PC200. Label: | |
| 2513 | 2509 | |
| 2514 | 40184.ic132 -- BIOS v1.2. | |
| 2515 | 40185.ic129 Labels are: | |
| 2510 | AMSTRAD | |
| 2511 | 40109 | |
| 2512 | 8827 B | |
| 2516 | 2513 | |
| 2517 | AMSTRAD AMSTRAD | |
| 2518 | 40184 40185 | |
| 2519 | V1.2:5EA8 V1.2:A058 | |
| 2514 | 40184.ic132 -- BIOS v1.2. | |
| 2515 | 40185.ic129 Labels are: | |
| 2516 | ||
| 2517 | AMSTRAD AMSTRAD | |
| 2518 | 40184 40185 | |
| 2519 | V1.2:5EA8 V1.2:A058 | |
| 2520 | 2520 | */ |
| 2521 | 2521 | ROM_START( pc200 ) |
| 2522 | 2522 | // ROM_REGION(0x100000,"maincpu", 0) |
| r5932 | r5933 | |
| 2644 | 2644 | SYSTEM_CONFIG_END |
| 2645 | 2645 | |
| 2646 | 2646 | static SYSTEM_CONFIG_START(pcjr) |
| 2647 | // | |
| 2647 | // CONFIG_RAM( 128 * 1024 ) | |
| 2648 | 2648 | CONFIG_RAM_DEFAULT( 640 * 1024 ) |
| 2649 | // | |
| 2649 | // CONFIG_RAM( 768 * 1024 ) | |
| 2650 | 2650 | SYSTEM_CONFIG_END |
| 2651 | 2651 | |
| 2652 | 2652 | /*************************************************************************** |
| r5932 | r5933 | |
|---|---|---|
| 31 | 31 | AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1869_TAG, cdp1869_out5_w) |
| 32 | 32 | AM_RANGE(0x06, 0x06) AM_DEVWRITE(CDP1869_TAG, cdp1869_out6_w) |
| 33 | 33 | AM_RANGE(0x07, 0x07) AM_DEVWRITE(CDP1869_TAG, cdp1869_out7_w) |
| 34 | ADDRESS_MAP_END | |
| 34 | ADDRESS_MAP_END | |
| 35 | 35 | |
| 36 | 36 | /* Input ports */ |
| 37 | 37 | /* Pecom 64 keyboard layout is as follows |
| r5932 | r5933 | |
| 156 | 156 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ch") PORT_CODE(KEYCODE_UP) //ch up |
| 157 | 157 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(DEL)) |
| 158 | 158 | |
| 159 | PORT_START("CNT") | |
| 159 | PORT_START("CNT") | |
| 160 | 160 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2) |
| 161 | 161 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_1) |
| 162 | 162 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| r5932 | r5933 | |
| 178 | 178 | /* Machine driver */ |
| 179 | 179 | static MACHINE_DRIVER_START( pecom64 ) |
| 180 | 180 | MDRV_DRIVER_DATA(pecom_state) |
| 181 | ||
| 182 | /* basic machine hardware */ | |
| 181 | ||
| 182 | /* basic machine hardware */ | |
| 183 | 183 | MDRV_CPU_ADD("maincpu", CDP1802, CDP1869_DOT_CLK_PAL/3) |
| 184 | 184 | MDRV_CPU_PROGRAM_MAP(pecom64_mem) |
| 185 | 185 | MDRV_CPU_IO_MAP(pecom64_io) |
| 186 | 186 | MDRV_CPU_CONFIG(pecom64_cdp1802_config) |
| 187 | ||
| 187 | ||
| 188 | 188 | MDRV_MACHINE_START( pecom ) |
| 189 | 189 | MDRV_MACHINE_RESET( pecom ) |
| 190 | ||
| 190 | ||
| 191 | 191 | // sound and video hardware |
| 192 | 192 | |
| 193 | 193 | MDRV_IMPORT_FROM(pecom_video) |
| 194 | ||
| 194 | ||
| 195 | 195 | MDRV_CASSETTE_ADD( "cassette", pecom_cassette_config ) |
| 196 | 196 | MACHINE_DRIVER_END |
| 197 | 197 | |
| r5932 | r5933 | |
| 208 | 208 | |
| 209 | 209 | /* Driver */ |
| 210 | 210 | |
| 211 | /* YEAR NAME PARENT COMPAT | |
| 211 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG | |
| 212 | 212 | COMP( 1987, pecom64, 0, 0, pecom64, pecom, pecom, pecom64, "Ei Nis", "Pecom 64", 0) |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | - DPMON (3rd party) |
| 18 | 18 | |
| 19 | 19 | Hardware variants (ever shipped?): |
| 20 | - SOL-10, i.e. a stripped down version without expansion backplane and | |
| 20 | - SOL-10, i.e. a stripped down version without expansion backplane and | |
| 21 | 21 | numeric keypad |
| 22 | - SOL-PC, i.e. the single board version, basically it consisted of the | |
| 22 | - SOL-PC, i.e. the single board version, basically it consisted of the | |
| 23 | 23 | SOL-20 board only |
| 24 | 24 | |
| 25 | 25 | ****************************************************************************/ |
| r5932 | r5933 | |
|---|---|---|
| 205 | 205 | MDRV_SOUND_ROUTE( 1, "rspeaker", 1.00 ) |
| 206 | 206 | |
| 207 | 207 | MDRV_CDROM_ADD( "cdrom" ) |
| 208 | ||
| 208 | ||
| 209 | 209 | MDRV_IMPORT_FROM( pce_cartslot ) |
| 210 | 210 | MACHINE_DRIVER_END |
| 211 | 211 | |
| r5932 | r5933 | |
| 246 | 246 | MDRV_SOUND_ADD( "cdda", CDDA, 0 ) |
| 247 | 247 | MDRV_SOUND_ROUTE( 0, "lspeaker", 1.00 ) |
| 248 | 248 | MDRV_SOUND_ROUTE( 1, "rspeaker", 1.00 ) |
| 249 | ||
| 249 | ||
| 250 | 250 | MDRV_IMPORT_FROM( pce_cartslot ) |
| 251 | 251 | MACHINE_DRIVER_END |
| 252 | 252 |
| r5932 | r5933 | |
|---|---|---|
| 53 | 53 | AM_RANGE(0x0000, 0x1fff) AM_ROM /*system ROM*/ |
| 54 | 54 | AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ti99_nop_8_r, ti99_nop_8_w) /*lower 8kb of RAM extension - installed dynamically*/ |
| 55 | 55 | AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4x_peb_r, ti99_4x_peb_w) /*DSR ROM space*/ |
| 56 | // | |
| 56 | // AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w) /*cartridge memory*/ | |
| 57 | 57 | AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w) |
| 58 | 58 | AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAMBANK(1) /*RAM PAD, mirrored 4 times*/ |
| 59 | 59 | AM_RANGE(0x8400, 0x87ff) AM_READWRITE(ti99_nop_8_r, ti99_wsnd_w) /*soundchip write*/ |
| r5932 | r5933 | |
| 144 | 144 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) |
| 145 | 145 | PORT_DIPSETTING( 1 << config_pcode_bit, DEF_STR( On ) ) |
| 146 | 146 | |
| 147 | PORT_DIPNAME( config_cartslot_mask << config_cartslot_bit, 0, "Active cartridge slot") | |
| 147 | PORT_DIPNAME( config_cartslot_mask << config_cartslot_bit, 0, "Active cartridge slot") | |
| 148 | 148 | PORT_DIPSETTING( 0, "auto" ) |
| 149 | 149 | PORT_DIPSETTING( 1 << config_cartslot_bit, "Slot 1" ) |
| 150 | 150 | PORT_DIPSETTING( 2 << config_cartslot_bit, "Slot 2" ) |
| r5932 | r5933 | |
| 510 | 510 | |
| 511 | 511 | static const mm58274c_interface floppy_mm58274c_interface = |
| 512 | 512 | { |
| 513 | 1, /* | |
| 513 | 1, /* mode 24*/ | |
| 514 | 514 | 0 /* first day of week */ |
| 515 | 515 | }; |
| 516 | 516 | |
| r5932 | r5933 | |
| 560 | 560 | |
| 561 | 561 | MDRV_CASSETTE_ADD( "cassette1", default_cassette_config ) |
| 562 | 562 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| 563 | ||
| 563 | ||
| 564 | 564 | /* rtc */ |
| 565 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 565 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 566 | 566 | /* tms9901 */ |
| 567 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 568 | ||
| 567 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 568 | ||
| 569 | 569 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) |
| 570 | ||
| 571 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 572 | ||
| 570 | ||
| 571 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 572 | ||
| 573 | 573 | MDRV_TI99_CARTRIDGE_ADD("ti99_multicart") |
| 574 | ||
| 574 | ||
| 575 | 575 | MDRV_SMARTMEDIA_ADD("smartmedia") |
| 576 | ||
| 576 | ||
| 577 | 577 | MDRV_TI99_4_RS232_CARD_ADD("rs232") |
| 578 | 578 | MACHINE_DRIVER_END |
| 579 | 579 | |
| r5932 | r5933 | |
| 615 | 615 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| 616 | 616 | |
| 617 | 617 | /* rtc */ |
| 618 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 618 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 619 | 619 | /* tms9901 */ |
| 620 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 621 | ||
| 620 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 621 | ||
| 622 | 622 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) |
| 623 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 624 | ||
| 623 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 624 | ||
| 625 | 625 | MDRV_TI99_CARTRIDGE_ADD("ti99_multicart") |
| 626 | ||
| 627 | MDRV_SMARTMEDIA_ADD("smartmedia") | |
| 628 | ||
| 626 | ||
| 627 | MDRV_SMARTMEDIA_ADD("smartmedia") | |
| 628 | ||
| 629 | 629 | MDRV_TI99_4_RS232_CARD_ADD("rs232") |
| 630 | 630 | MACHINE_DRIVER_END |
| 631 | 631 | |
| r5932 | r5933 | |
| 667 | 667 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| 668 | 668 | |
| 669 | 669 | /* rtc */ |
| 670 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 671 | ||
| 670 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 671 | ||
| 672 | 672 | /* tms9901 */ |
| 673 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 674 | ||
| 675 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) | |
| 676 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 677 | ||
| 673 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 674 | ||
| 675 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) | |
| 676 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 677 | ||
| 678 | 678 | MDRV_TI99_CARTRIDGE_ADD("ti99_multicart") |
| 679 | ||
| 680 | MDRV_SMARTMEDIA_ADD("smartmedia") | |
| 681 | ||
| 679 | ||
| 680 | MDRV_SMARTMEDIA_ADD("smartmedia") | |
| 681 | ||
| 682 | 682 | MDRV_TI99_4_RS232_CARD_ADD("rs232") |
| 683 | 683 | MACHINE_DRIVER_END |
| 684 | 684 | |
| r5932 | r5933 | |
| 721 | 721 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| 722 | 722 | |
| 723 | 723 | /* rtc */ |
| 724 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 724 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 725 | 725 | /* tms9901 */ |
| 726 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 727 | ||
| 726 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) | |
| 727 | ||
| 728 | 728 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) |
| 729 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 730 | ||
| 729 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 730 | ||
| 731 | 731 | MDRV_TI99_CARTRIDGE_ADD("ti99_multicart") |
| 732 | 732 | |
| 733 | 733 | MDRV_SMARTMEDIA_ADD("smartmedia") |
| 734 | ||
| 734 | ||
| 735 | 735 | MDRV_TI99_4_RS232_CARD_ADD("rs232") |
| 736 | 736 | MACHINE_DRIVER_END |
| 737 | 737 | |
| r5932 | r5933 | |
| 782 | 782 | MDRV_CASSETTE_ADD( "cassette2", default_cassette_config ) |
| 783 | 783 | |
| 784 | 784 | /* rtc */ |
| 785 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 785 | MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface) | |
| 786 | 786 | /* tms9901 */ |
| 787 | 787 | MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x) |
| 788 | ||
| 789 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) | |
| 790 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 788 | ||
| 789 | MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface ) | |
| 790 | MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config) | |
| 791 | 791 | MDRV_TI99_CARTRIDGE_ADD("ti99_multicart") |
| 792 | 792 | MDRV_SMARTMEDIA_ADD("smartmedia") |
| 793 | ||
| 793 | ||
| 794 | 794 | MDRV_TI99_4_RS232_CARD_ADD("rs232") |
| 795 | 795 | MACHINE_DRIVER_END |
| 796 | 796 | |
| r5932 | r5933 | |
| 849 | 849 | ROM_LOAD_OPTIONAL("bwg.bin", offset_bwg_dsr, 0x8000, CRC(06f1ec89) SHA1(6ad77033ed268f986d9a5439e65f7d391c4b7651)) /* BwG disk DSR ROM */ |
| 850 | 850 | ROM_LOAD_OPTIONAL("hfdc.bin", offset_hfdc_dsr, 0x4000, CRC(66fbe0ed) SHA1(11df2ecef51de6f543e4eaf8b2529d3e65d0bd59)) /* HFDC disk DSR ROM */ |
| 851 | 851 | ROM_LOAD_OPTIONAL("rs232.bin", offset_rs232_dsr, 0x1000, CRC(eab382fb) SHA1(ee609a18a21f1a3ddab334e8798d5f2a0fcefa91)) /* TI rs232 DSR ROM */ |
| 852 | ROM_LOAD_OPTIONAL("pcode_r0.bin", offset_pcode_rom, 0x1000, CRC(3881d5b0) SHA1(a60e0468bb15ff72f97cf6e80979ca8c11ed0426)) /* TI P-Code card rom4732 */ | |
| 853 | ROM_LOAD_OPTIONAL("pcode_r1.bin", offset_pcode_rom + 0x1000, 0x2000, CRC(46a06b8b) SHA1(24e2608179921aef312cdee6f455e3f46deb30d0)) /* TI P-Code card rom4764 */ | |
| 854 | ROM_LOAD_OPTIONAL("pcode_g0.bin", offset_pcode_grom, 0x10000, CRC(541b3860) SHA1(7be77c216737334ae997753a6a85136f117affb7)) /* TI P-Code card groms */ | |
| 855 | ||
| 852 | ROM_LOAD_OPTIONAL("pcode_r0.bin", offset_pcode_rom, 0x1000, CRC(3881d5b0) SHA1(a60e0468bb15ff72f97cf6e80979ca8c11ed0426)) /* TI P-Code card rom4732 */ | |
| 853 | ROM_LOAD_OPTIONAL("pcode_r1.bin", offset_pcode_rom + 0x1000, 0x2000, CRC(46a06b8b) SHA1(24e2608179921aef312cdee6f455e3f46deb30d0)) /* TI P-Code card rom4764 */ | |
| 854 | ROM_LOAD_OPTIONAL("pcode_g0.bin", offset_pcode_grom, 0x10000, CRC(541b3860) SHA1(7be77c216737334ae997753a6a85136f117affb7)) /* TI P-Code card groms */ | |
| 855 | ||
| 856 | 856 | /* HSGPL memory space */ |
| 857 | 857 | ROM_REGION(region_hsgpl_len, region_hsgpl, ROMREGION_ERASEFF) |
| 858 | 858 |
| r5932 | r5933 | |
|---|---|---|
| 29 | 29 | Type 1: 2K Rom or EPROM mapped from $0000 - $07FF |
| 30 | 30 | Type 2: 4K Rom or EPROM mapped from $0000 - $0FFF |
| 31 | 31 | Type 3: 4K Rom + 1K Ram |
| 32 | Rom is mapped from $0000 - $0FFF | |
| 33 | Ram is mapped from $1000 - $13FF and mirrored from $1800 - $1BFF | |
| 32 | Rom is mapped from $0000 - $0FFF | |
| 33 | Ram is mapped from $1000 - $13FF and mirrored from $1800 - $1BFF | |
| 34 | 34 | Type 4: 6K Rom + 1K Ram |
| 35 | Rom is mapped from $0000 - $15FF (only 5,5K ROM visible to the CPU) | |
| 36 | Ram is mapped from $1800 - $1BFF | |
| 35 | Rom is mapped from $0000 - $15FF (only 5,5K ROM visible to the CPU) | |
| 36 | Ram is mapped from $1800 - $1BFF | |
| 37 | 37 | |
| 38 | 38 | One other type is known for Radofin (compatible to VC4000, but not the Cartridge Pins) |
| 39 | 39 | which consisted of 2K ROM and 2K RAM which are properly mapped as follows: |
| r5932 | r5933 | |
| 44 | 44 | |
| 45 | 45 | Go to the bottom to see the game list and emulation status of each. |
| 46 | 46 | ******************************************************************************/ |
| 47 | ||
| 47 | ||
| 48 | 48 | #include "driver.h" |
| 49 | 49 | #include "cpu/s2650/s2650.h" |
| 50 | 50 | |
| 51 | 51 | #include "includes/vc4000.h" |
| 52 | 52 | #include "devices/cartslot.h" |
| 53 | #include "devices/snapquik.h" | |
| 53 | #include "devices/snapquik.h" | |
| 54 | 54 | |
| 55 | 55 | static QUICKLOAD_LOAD( vc4000 ); |
| 56 | 56 | |
| r5932 | r5933 | |
| 174 | 174 | MAKE_RGB(200, 200, 0), // yellow |
| 175 | 175 | MAKE_RGB(200, 200, 200), // white |
| 176 | 176 | /* sprite colors |
| 177 | The control line simply inverts the RGB lines all at once. | |
| 178 | We can do that in the code with ^7 */ | |
| 177 | The control line simply inverts the RGB lines all at once. | |
| 178 | We can do that in the code with ^7 */ | |
| 179 | 179 | }; |
| 180 | 180 | |
| 181 | 181 | static PALETTE_INIT( vc4000 ) |
| r5932 | r5933 | |
| 207 | 207 | memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x1000); |
| 208 | 208 | memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x1000); |
| 209 | 209 | } |
| 210 | ||
| 210 | ||
| 211 | 211 | if (size > 0) |
| 212 | 212 | { |
| 213 | 213 | image_fread(image, memory_region(machine, "maincpu") + 0x0000, size); |
| r5932 | r5933 | |
| 218 | 218 | |
| 219 | 219 | static MACHINE_DRIVER_START( vc4000 ) |
| 220 | 220 | /* basic machine hardware */ |
| 221 | // | |
| 221 | // MDRV_CPU_ADD("maincpu", S2650, 865000) /* 3550000/4, 3580000/3, 4430000/3 */ | |
| 222 | 222 | MDRV_CPU_ADD("maincpu", S2650, 3546875/4) |
| 223 | 223 | MDRV_CPU_PROGRAM_MAP(vc4000_mem) |
| 224 | 224 | MDRV_CPU_IO_MAP(vc4000_io) |
| r5932 | r5933 | |
| 274 | 274 | read_ = image_fread(image, quick_data, quick_length); |
| 275 | 275 | if (read_ != quick_length) |
| 276 | 276 | return INIT_FAIL; |
| 277 | ||
| 277 | ||
| 278 | 278 | if (quick_data[0] != 2) |
| 279 | 279 | return INIT_FAIL; |
| 280 | ||
| 281 | quick_addr = quick_data[1] * 256 + quick_data[2]; | |
| 282 | ||
| 280 | ||
| 281 | quick_addr = quick_data[1] * 256 + quick_data[2]; | |
| 282 | ||
| 283 | 283 | //if ((quick_addr + quick_length - 5) > 0x1000) |
| 284 | // return INIT_FAIL; | |
| 285 | ||
| 286 | memory_write_byte(space, 0x08be, quick_data[3]); | |
| 287 | memory_write_byte(space, 0x08bf, quick_data[4]); | |
| 288 | ||
| 284 | // return INIT_FAIL; | |
| 285 | ||
| 286 | memory_write_byte(space, 0x08be, quick_data[3]); | |
| 287 | memory_write_byte(space, 0x08bf, quick_data[4]); | |
| 288 | ||
| 289 | 289 | for (i = 0; i < quick_length - 5; i++) |
| 290 | 290 | { if ((quick_addr + i) < 0x1000) |
| 291 | 291 | memory_write_byte(space, i + quick_addr, quick_data[i+5]); |
| 292 | 292 | } |
| 293 | ||
| 293 | ||
| 294 | 294 | logerror("quick loading at %.4x size:%.4x\n", quick_addr, (quick_length-5)); |
| 295 | 295 | return INIT_PASS; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
| 299 | /* YEAR | |
| 299 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ | |
| 300 | 300 | CONS(1978, vc4000, 0, 0, vc4000, vc4000, 0, 0, "Interton", "VC 4000", GAME_IMPERFECT_GRAPHICS ) |
| 301 | 301 | |
| 302 | /* | |
| 302 | /* Game List and Emulation Status | |
| 303 | 303 | |
| 304 | 304 | When you load a game it will normally appear to be unresponsive. Most carts contain a number of variants |
| 305 | 305 | of each game (e.g. Difficulty, Player1 vs Player2 or Player1 vs Computer, etc). |
| r5932 | r5933 | |
| 318 | 318 | |
| 319 | 319 | The game names and numbers were obtained from the Amigan Software site. |
| 320 | 320 | |
| 321 | Cart Num | |
| 321 | Cart Num Name | |
| 322 | 322 | ---------------------------------------------- |
| 323 | 1. | |
| 323 | 1. Grand Prix / Car Races / Autosport / Motor Racing / Road Race | |
| 324 | 324 | Config: Paddle, NAC |
| 325 | 325 | Status: Working |
| 326 | 326 | Controls: Left-Right: Steer; Up: Accelerate |
| 327 | 327 | |
| 328 | 2. | |
| 328 | 2. Black Jack | |
| 329 | 329 | Status: Not working (some digits missing; indicator missing; dealer's cards missing) |
| 330 | 330 | Controls: set bet with S and D; A to deal; 1 to hit, 2 to stay; Q accept insurance, E to decline; double-up (unknown key) |
| 331 | 331 | Indicator: E make a bet then deal; I choose insurance; - you lost; + you won; X hit or stay |
| 332 | 332 | |
| 333 | 3. | |
| 333 | 3. Olympics / Paddle Games / Bat & Ball / Pro Sport 60 / Sportsworld | |
| 334 | 334 | Config: Paddle, NAC |
| 335 | 335 | Status: Working |
| 336 | 336 | |
| 337 | 4. | |
| 337 | 4. Tank Battle / Combat | |
| 338 | 338 | Config: Button, 90 |
| 339 | 339 | Status: Working |
| 340 | 340 | Controls: Left-Right: Steer; Up: Accelerate; Fire: Shoot |
| 341 | 341 | |
| 342 | 5. | |
| 342 | 5. Maths 1 | |
| 343 | 343 | Status: Working |
| 344 | 344 | Controls: Z difficulty; X = addition or subtraction; C ask question; A=1;S=2;D=3;Q=4;W=5;E=6;1=7;2=8;3=9;0=0; C enter |
| 345 | 345 | |
| 346 | 6. | |
| 346 | 6. Maths 2 | |
| 347 | 347 | Status: Not working |
| 348 | 348 | Controls: Same as above. |
| 349 | 349 | |
| 350 | 7. | |
| 350 | 7. Air Sea Attack / Air Sea Battle | |
| 351 | 351 | Config: Button, 90 |
| 352 | 352 | Status: Working |
| 353 | 353 | Controls: Left-Right: Move; Fire: Shoot |
| 354 | 354 | |
| 355 | 8. | |
| 355 | 8. Treasure Hunt / Capture the Flag / Concentration / Memory Match | |
| 356 | 356 | Config: Buttons |
| 357 | 357 | Status: Working |
| 358 | 358 | |
| 359 | 9. | |
| 359 | 9. Labyrinth / Maze / Intelligence 1 | |
| 360 | 360 | Config: Buttons |
| 361 | 361 | Status: Working |
| 362 | 362 | |
| 363 | 10. | |
| 363 | 10. Winter Sports | |
| 364 | 364 | Notes: Background colours should be Cyan and White instead of Red and Black |
| 365 | 365 | |
| 366 | 11. | |
| 366 | 11. Hippodrome / Horse Race | |
| 367 | 367 | |
| 368 | 12. | |
| 368 | 12. Hunting / Shooting Gallery | |
| 369 | 369 | |
| 370 | 13. | |
| 370 | 13. Chess 1 | |
| 371 | 371 | Status: Can't see what you're typing, wrong colours |
| 372 | 372 | |
| 373 | 14. | |
| 373 | 14. Moto-cros | |
| 374 | 374 | |
| 375 | 15. | |
| 375 | 15. Four in a row / Intelligence 2 | |
| 376 | 376 | Config: Buttons |
| 377 | 377 | Status: Working |
| 378 | 378 | Notes: Seems the unused squares should be black. The screen jumps about while the computer is "thinking". |
| 379 | 379 | |
| 380 | 16. | |
| 380 | 16. Code Breaker / Master Mind / Intelligence 3 / Challenge | |
| 381 | 381 | |
| 382 | 17. | |
| 382 | 17. Circus | |
| 383 | 383 | STatus: severe gfx issues |
| 384 | 384 | |
| 385 | 18. | |
| 385 | 18. Boxing / Prize Fight | |
| 386 | 386 | |
| 387 | 19. | |
| 387 | 19. Outer Space / Spacewar / Space Attack / Outer Space Combat | |
| 388 | 388 | |
| 389 | 20. | |
| 389 | 20. Melody Simon / Musical Memory / Follow the Leader / Musical Games / Electronic Music / Face the Music | |
| 390 | 390 | |
| 391 | 21. | |
| 391 | 21. Capture / Othello / Reversi / Attack / Intelligence 4 | |
| 392 | 392 | Config: Buttons |
| 393 | 393 | Status: Working |
| 394 | 394 | Notes: Seems the unused squares should be black |
| 395 | 395 | |
| 396 | 22. | |
| 396 | 22. Chess 2 | |
| 397 | 397 | Status: Can't see what you're typing, wrong colours |
| 398 | 398 | |
| 399 | 23. | |
| 399 | 23. Pinball / Flipper / Arcade | |
| 400 | 400 | Status: gfx issues |
| 401 | 401 | |
| 402 | 24. | |
| 402 | 24. Soccer | |
| 403 | 403 | |
| 404 | 25. | |
| 404 | 25. Bowling / NinePins | |
| 405 | 405 | Config: Paddle, rotated 90 degrees, up/down autocentre, left-right does not |
| 406 | 406 | Status: Working |
| 407 | 407 | |
| 408 | 26. | |
| 408 | 26. Draughts | |
| 409 | 409 | |
| 410 | 27. | |
| 410 | 27. Golf | |
| 411 | 411 | Status: gfx issues |
| 412 | 412 | |
| 413 | 28. | |
| 413 | 28. Cockpit | |
| 414 | 414 | Status: gfx issues |
| 415 | 415 | |
| 416 | 29. | |
| 416 | 29. Metropolis / Hangman | |
| 417 | 417 | Status: gfx issues |
| 418 | 418 | |
| 419 | 30. | |
| 419 | 30. Solitaire | |
| 420 | 420 | |
| 421 | 31. | |
| 421 | 31. Casino | |
| 422 | 422 | Status: gfx issues, items missing and unplayable |
| 423 | 423 | Controls: 1 or 3=START; q=GO; E=STOP; D=$; Z=^; X=tens; C=units |
| 424 | 424 | |
| 425 | 32. | |
| 425 | 32. Invaders / Alien Invasion / Earth Invasion | |
| 426 | 426 | Status: Works |
| 427 | 427 | Config: Buttons |
| 428 | 428 | |
| 429 | 33. | |
| 429 | 33. Super Invaders | |
| 430 | 430 | Status: Stars are missing, colours are wrong |
| 431 | 431 | Config: Buttons (90) |
| 432 | 432 | |
| 433 | 36. | |
| 433 | 36. BackGammon | |
| 434 | 434 | Status: Not all counters are visible, Dice & game number not visible. |
| 435 | 435 | Controls: Fire=Exec; 1=D+; 3=D-; Q,W,E=4,5,6; A,S,D=1,2,3; Z=CL; X=STOP; C=SET |
| 436 | 436 | |
| 437 | 37. | |
| 437 | 37. Monster Man / Spider's Web | |
| 438 | 438 | Status: Works |
| 439 | 439 | Config: Buttons |
| 440 | 440 | |
| 441 | 38. | |
| 441 | 38. Hyperspace | |
| 442 | 442 | Status: Works |
| 443 | 443 | Config: Buttons (90) |
| 444 | 444 | Controls: 3 - status button; Q,W,E,A,S,D,Z,X,C selects which galaxy to visit |
| 445 | 445 | |
| 446 | 446 | |
| 447 | 40. | |
| 447 | 40. Super Space | |
| 448 | 448 | Status: Works, some small gfx issues near the bottom |
| 449 | 449 | Config: Buttons |
| 450 | 450 |
| r5932 | r5933 | |
|---|---|---|
| 14 | 14 | static ADDRESS_MAP_START(pcm_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 15 | 15 | ADDRESS_MAP_UNMAP_HIGH |
| 16 | 16 | AM_RANGE( 0x0000, 0x1fff ) AM_ROM // ROM |
| 17 | AM_RANGE( 0x2000, 0xf7ff ) AM_RAM // RAM | |
| 17 | AM_RANGE( 0x2000, 0xf7ff ) AM_RAM // RAM | |
| 18 | 18 | AM_RANGE( 0xf800, 0xffff ) AM_RAM AM_BASE(&pcm_video_ram) // Video RAM |
| 19 | 19 | ADDRESS_MAP_END |
| 20 | 20 | |
| r5932 | r5933 | |
| 25 | 25 | /* Input ports */ |
| 26 | 26 | INPUT_PORTS_EXTERN( k7659 ); |
| 27 | 27 | |
| 28 | static MACHINE_RESET(pcm) | |
| 29 | { | |
| 28 | static MACHINE_RESET(pcm) | |
| 29 | { | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | static VIDEO_START( pcm ) |
| r5932 | r5933 | |
| 38 | 38 | UINT8 code; |
| 39 | 39 | UINT8 line; |
| 40 | 40 | int y, x, j, b; |
| 41 | ||
| 41 | ||
| 42 | 42 | UINT8 *gfx = memory_region(screen->machine, "gfx1"); |
| 43 | ||
| 43 | ||
| 44 | 44 | for (y = 0; y < 32; y++) |
| 45 | 45 | { |
| 46 | 46 | for (x = 0; x < 64; x++) |
| r5932 | r5933 | |
| 50 | 50 | { |
| 51 | 51 | line = gfx[code*8 + j]; |
| 52 | 52 | for (b = 0; b < 8; b++) |
| 53 | { | |
| 53 | { | |
| 54 | 54 | *BITMAP_ADDR16(bitmap, y*8+j, x * 8 + (7 - b)) = ((line >> b) & 0x01); |
| 55 | 55 | } |
| 56 | 56 | } |
| r5932 | r5933 | |
| 64 | 64 | /* basic machine hardware */ |
| 65 | 65 | MDRV_CPU_ADD("maincpu",Z80, XTAL_10MHz /4) |
| 66 | 66 | MDRV_CPU_PROGRAM_MAP(pcm_mem) |
| 67 | MDRV_CPU_IO_MAP(pcm_io) | |
| 67 | MDRV_CPU_IO_MAP(pcm_io) | |
| 68 | 68 | |
| 69 | 69 | MDRV_MACHINE_RESET(pcm) |
| 70 | ||
| 70 | ||
| 71 | 71 | /* video hardware */ |
| 72 | 72 | MDRV_SCREEN_ADD("screen", RASTER) |
| 73 | 73 | MDRV_SCREEN_REFRESH_RATE(50) |
| r5932 | r5933 | |
| 81 | 81 | MDRV_VIDEO_START(pcm) |
| 82 | 82 | MDRV_VIDEO_UPDATE(pcm) |
| 83 | 83 | MACHINE_DRIVER_END |
| 84 | ||
| 84 | ||
| 85 | 85 | /* ROM definition */ |
| 86 | 86 | ROM_START( pcm ) |
| 87 | 87 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| r5932 | r5933 | |
| 103 | 103 | ROM_REGION(0x0800, "gfx1",0) |
| 104 | 104 | ROM_LOAD( "charrom.d113", 0x0000, 0x0800, CRC(5684b3c3) SHA1(418054aa70a0fd120611e32059eb2051d3b82b5a)) |
| 105 | 105 | ROM_REGION(0x0800, "k7659",0) |
| 106 | ROM_LOAD ("k7659n.d8", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) | |
| 106 | ROM_LOAD ("k7659n.d8", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) ) | |
| 107 | 107 | ROM_END |
| 108 | 108 | |
| 109 | 109 | /* Driver */ |
| r5932 | r5933 | |
|---|---|---|
| 183 | 183 | |
| 184 | 184 | MDRV_VIDEO_START(pk8020) |
| 185 | 185 | MDRV_VIDEO_UPDATE(pk8020) |
| 186 | ||
| 186 | ||
| 187 | 187 | MDRV_I8255A_ADD( "ppi8255_1", pk8020_ppi8255_interface_1 ) |
| 188 | MDRV_I8255A_ADD( "ppi8255_2", pk8020_ppi8255_interface_2 ) | |
| 188 | MDRV_I8255A_ADD( "ppi8255_2", pk8020_ppi8255_interface_2 ) | |
| 189 | 189 | MDRV_I8255A_ADD( "ppi8255_3", pk8020_ppi8255_interface_3 ) |
| 190 | ||
| 190 | ||
| 191 | 191 | MDRV_PIT8253_ADD( "pit8253", pk8020_pit8253_intf ) |
| 192 | 192 | |
| 193 | MDRV_PIC8259_ADD( "pic8259", pk8020_pic8259_config ) | |
| 193 | MDRV_PIC8259_ADD( "pic8259", pk8020_pic8259_config ) | |
| 194 | 194 | MDRV_MSM8251_ADD( "rs232", default_msm8251_interface) |
| 195 | 195 | MDRV_MSM8251_ADD( "lan", default_msm8251_interface) |
| 196 | ||
| 197 | MDRV_WD1793_ADD( "wd1793", default_wd17xx_interface ) | |
| 198 | ||
| 196 | ||
| 197 | MDRV_WD1793_ADD( "wd1793", default_wd17xx_interface ) | |
| 198 | ||
| 199 | 199 | /* audio hardware */ |
| 200 | 200 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 201 | 201 | MDRV_SOUND_ADD("speaker", SPEAKER, 0) |
| 202 | 202 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 203 | 203 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 204 | 204 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 205 | ||
| 206 | MDRV_CASSETTE_ADD( "cassette", pk8020_cassette_config ) | |
| 207 | ||
| 205 | ||
| 206 | MDRV_CASSETTE_ADD( "cassette", pk8020_cassette_config ) | |
| 207 | ||
| 208 | 208 | MDRV_FLOPPY_4_DRIVES_ADD(pk8020_floppy_config) |
| 209 | 209 | MACHINE_DRIVER_END |
| 210 | 210 | |
| r5932 | r5933 | |
| 214 | 214 | ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF ) |
| 215 | 215 | ROM_LOAD( "korvet11.rom", 0x10000, 0x6000, CRC(81BDC2AF) SHA1(c3484c3f1f3d252475979283c073286b8661d2b9) ) |
| 216 | 216 | ROM_REGION( 0x2000, "gfx1", 0 ) |
| 217 | ROM_LOAD ( "korvet2.fnt", 0x0000, 0x2000, CRC(FB1CD3D4)) | |
| 217 | ROM_LOAD ( "korvet2.fnt", 0x0000, 0x2000, CRC(FB1CD3D4)) | |
| 218 | 218 | ROM_END |
| 219 | 219 | |
| 220 | 220 | static SYSTEM_CONFIG_START(pk8020) |
| r5932 | r5933 | |
|---|---|---|
| 268 | 268 | |
| 269 | 269 | AM_RANGE(0xfc00, 0xfeff) AM_READWRITE(SMH_BANK(8) , bbcm_w ) /* this is now processed directly because it can be ROM or hardware */ |
| 270 | 270 | |
| 271 | //AM_RANGE(0xfc00, 0xfeff) AM_READWRITE(bbcm_r | |
| 271 | //AM_RANGE(0xfc00, 0xfeff) AM_READWRITE(bbcm_r , bbcm_w ) /* this is now processed directly because it can be ROM or hardware */ | |
| 272 | 272 | /* |
| 273 | 273 | AM_RANGE(0xfc00, 0xfdff) AM_READWRITE(SMH_BANK(2) , SMH_ROM ) fc00-fdff FRED & JIM Pages |
| 274 | 274 | |
| 275 | 275 | fe00-feff Shiela Address Page |
| 276 | 276 | AM_RANGE(0xfe00, 0xfe07) AM_READWRITE(BBC_6845_r , BBC_6845_w ) fe00-fe07 6845 CRTC Video controller |
| 277 | AM_RANGE(0xfe08, 0xfe08) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_stat_r, acia6850_ctrl_w) | |
| 278 | AM_RANGE(0xfe09, 0xfe09) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_data_r, acia6850_data_w) | |
| 277 | AM_RANGE(0xfe08, 0xfe08) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_stat_r, acia6850_ctrl_w) | |
| 278 | AM_RANGE(0xfe09, 0xfe09) AM_MIRROR(0x06) AM_DEVREADWRITE("acia6850", acia6850_data_r, acia6850_data_w) | |
| 279 | 279 | AM_RANGE(0xfe10, 0xfe17) AM_NOP fe10-fe17 Serial ULA Serial system chip |
| 280 | 280 | AM_RANGE(0xfe18, 0xfe1f) M_DEVREADWRITE(UPD7002, "uPD7002",uPD7002_r, uPD7002_w ) fec0-fedf uPD7002 Analogue to digital converter |
| 281 | 281 | AM_RANGE(0xfe20, 0xfe23) AM_READWRITE(return8_FE , bbc_videoULA_w ) fe20-fe23 Video ULA Video system chip |
| r5932 | r5933 | |
| 827 | 827 | /* devices */ |
| 828 | 828 | MDRV_UPD7002_ADD("upd7002",BBC_uPD7002) |
| 829 | 829 | MDRV_VIA6522_ADD("via6522_0", 1000000, bbcb_system_via) |
| 830 | ||
| 830 | ||
| 831 | 831 | MDRV_I8271_ADD("i8271", bbc_i8271_interface) |
| 832 | 832 | MACHINE_DRIVER_END |
| 833 | 833 | |
| r5932 | r5933 | |
| 842 | 842 | MDRV_VIA6522_ADD("via6522_1", 1000000, bbcb_user_via) |
| 843 | 843 | MDRV_CENTRONICS_ADD("centronics", bbcb_centronics_config) |
| 844 | 844 | |
| 845 | MDRV_WD177X_ADD("wd177x", bbc_wd17xx_interface ) | |
| 845 | MDRV_WD177X_ADD("wd177x", bbc_wd17xx_interface ) | |
| 846 | 846 | MDRV_FLOPPY_2_DRIVES_ADD(bbc_floppy_config) |
| 847 | 847 | MDRV_IMPORT_FROM(bbc_cartslot) |
| 848 | 848 | MACHINE_DRIVER_END |
| r5932 | r5933 | |
| 926 | 926 | MDRV_UPD7002_ADD("upd7002",BBC_uPD7002) |
| 927 | 927 | MDRV_VIA6522_ADD("via6522_0", 1000000, bbcb_system_via) |
| 928 | 928 | MDRV_VIA6522_ADD("via6522_1", 1000000, bbcb_user_via) |
| 929 | ||
| 929 | ||
| 930 | 930 | MDRV_WD177X_ADD("wd177x", bbc_wd17xx_interface ) |
| 931 | 931 | MDRV_FLOPPY_2_DRIVES_ADD(bbc_floppy_config) |
| 932 | 932 |
| r5932 | r5933 | |
|---|---|---|
| 7 | 7 | By R. Belmont & Harmony |
| 8 | 8 | |
| 9 | 9 | TODO: |
| 10 | - Raster timing issues. Castlevania (HOD and AOS)'s raster effects | |
| 10 | - Raster timing issues. Castlevania (HOD and AOS)'s raster effects | |
| 11 | 11 | work if the VBlank is fired on scanline 0, else they're offset by |
| 12 | 12 | the height of the vblank region. Is scanline 0 the start of the |
| 13 | 13 | visible area? |
| r5932 | r5933 | |
| 100 | 100 | |
| 101 | 101 | ch = param; |
| 102 | 102 | |
| 103 | // | |
| 103 | // printf("dma complete: ch %d\n", ch); | |
| 104 | 104 | |
| 105 | 105 | timer_adjust_oneshot(gba_state->dma_timer[ch], attotime_never, 0); |
| 106 | 106 | |
| r5932 | r5933 | |
| 116 | 116 | // always clear active for immediate DMAs though |
| 117 | 117 | if (!((ctrl>>9) & 1) || ((ctrl & 0x3000) == 0)) |
| 118 | 118 | { |
| 119 | // | |
| 119 | // printf("clear active for ch %d\n", ch); | |
| 120 | 120 | gba_state->dma_regs[(ch*3)+2] &= ~0x80000000; // clear "active" bit |
| 121 | 121 | } |
| 122 | 122 | else |
| r5932 | r5933 | |
| 182 | 182 | } |
| 183 | 183 | else |
| 184 | 184 | { |
| 185 | // if (dst >= 0x6000000 && dst <= 0x6017fff) | |
| 186 | // printf("DMA exec: ch %d from %08x to %08x, mode %04x, count %04x (PC %x) (%s)\n", (int)ch, src, dst, ctrl, cnt, activecpu_get_pc(), ((ctrl>>10) & 1) ? "32" : "16"); | |
| 185 | // if (dst >= 0x6000000 && dst <= 0x6017fff) | |
| 186 | // printf("DMA exec: ch %d from %08x to %08x, mode %04x, count %04x (PC %x) (%s)\n", (int)ch, src, dst, ctrl, cnt, activecpu_get_pc(), ((ctrl>>10) & 1) ? "32" : "16"); | |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | for (i = 0; i < cnt; i++) |
| r5932 | r5933 | |
| 266 | 266 | gba_state->dma_src[ch] = src; |
| 267 | 267 | gba_state->dma_dst[ch] = dst; |
| 268 | 268 | |
| 269 | // printf("settng DMA timer %d for %d cycs (tmr %x)\n", ch, cnt, (UINT32)gba_state->dma_timer[ch]); | |
| 270 | // timer_adjust_oneshot(gba_state->dma_timer[ch], ATTOTIME_IN_CYCLES(0, cnt), ch); | |
| 269 | // printf("settng DMA timer %d for %d cycs (tmr %x)\n", ch, cnt, (UINT32)gba_state->dma_timer[ch]); | |
| 270 | // timer_adjust_oneshot(gba_state->dma_timer[ch], ATTOTIME_IN_CYCLES(0, cnt), ch); | |
| 271 | 271 | dma_complete(machine, NULL, ch); |
| 272 | 272 | } |
| 273 | 273 | |
| r5932 | r5933 | |
| 367 | 367 | FPTR tmr = (FPTR) param; |
| 368 | 368 | gba_state *gba_state = machine->driver_data; |
| 369 | 369 | |
| 370 | // | |
| 370 | // printf("Timer %d expired, SOUNDCNT_H %04x\n", tmr, gba_state->SOUNDCNT_H); | |
| 371 | 371 | |
| 372 | 372 | // check if timers 0 or 1 are feeding directsound |
| 373 | 373 | if (tmr == 0) |
| r5932 | r5933 | |
| 839 | 839 | double time, ticks; |
| 840 | 840 | int timer = offset-(0x100/4); |
| 841 | 841 | |
| 842 | // | |
| 842 | // printf("Read timer reg %x (PC=%x)\n", timer, cpu_get_pc(space->cpu)); | |
| 843 | 843 | |
| 844 | // update times for | |
| 844 | // update times for | |
| 845 | 845 | if (gba_state->timer_regs[timer] & 0x800000) |
| 846 | 846 | { |
| 847 | 847 | time = attotime_to_double(timer_timeelapsed(gba_state->tmr_timer[timer])); |
| 848 | 848 | |
| 849 | 849 | ticks = (double)(0x10000 - (gba_state->timer_regs[timer] & 0xffff)); |
| 850 | 850 | |
| 851 | // | |
| 851 | // printf("time %f ticks %f 1/hz %f\n", time, ticks, 1.0 / gba_state->timer_hz[timer]); | |
| 852 | 852 | |
| 853 | 853 | time *= ticks; |
| 854 | 854 | time /= (1.0 / gba_state->timer_hz[timer]); |
| 855 | 855 | |
| 856 | 856 | elapsed = (UINT32)time; |
| 857 | 857 | |
| 858 | // | |
| 858 | // printf("elapsed = %x\n", elapsed); | |
| 859 | 859 | } |
| 860 | 860 | else |
| 861 | 861 | { |
| 862 | // | |
| 862 | // printf("Reading inactive timer!\n"); | |
| 863 | 863 | elapsed = 0; |
| 864 | 864 | } |
| 865 | 865 | |
| r5932 | r5933 | |
| 973 | 973 | case 0x0200/4: |
| 974 | 974 | if( (mem_mask) & 0x0000ffff ) |
| 975 | 975 | { |
| 976 | // | |
| 976 | // printf("Read: IE (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), gba_state->IE ); | |
| 977 | 977 | } |
| 978 | 978 | if( (mem_mask) & 0xffff0000 ) |
| 979 | 979 | { |
| r5932 | r5933 | |
| 1008 | 1008 | retval = gba_state->HALTCNT << 8; |
| 1009 | 1009 | break; |
| 1010 | 1010 | default: |
| 1011 | // | |
| 1011 | // verboselog(machine, 0, "Unknown GBA I/O register Read: %08x (%08x)\n", 0x04000000 + ( offset << 2 ), ~mem_mask ); | |
| 1012 | 1012 | break; |
| 1013 | 1013 | } |
| 1014 | 1014 | return retval; |
| r5932 | r5933 | |
| 1586 | 1586 | |
| 1587 | 1587 | ch = offset / 3; |
| 1588 | 1588 | |
| 1589 | // | |
| 1589 | // printf("%08x: DMA(%d): %x to reg %d (mask %08x)\n", activecpu_get_pc(), ch, data, offset%3, ~mem_mask); | |
| 1590 | 1590 | |
| 1591 | 1591 | if (((offset % 3) == 2) && ((~mem_mask & 0xffff0000) == 0)) |
| 1592 | 1592 | { |
| r5932 | r5933 | |
| 1628 | 1628 | |
| 1629 | 1629 | COMBINE_DATA(&gba_state->timer_regs[offset]); |
| 1630 | 1630 | |
| 1631 | // | |
| 1631 | // printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, cpu_get_pc(space->cpu)); | |
| 1632 | 1632 | |
| 1633 | 1633 | if (ACCESSING_BITS_0_15) |
| 1634 | 1634 | { |
| r5932 | r5933 | |
| 1648 | 1648 | |
| 1649 | 1649 | gba_state->timer_hz[offset] = final; |
| 1650 | 1650 | |
| 1651 | // | |
| 1651 | // printf("Enabling timer %d @ %f Hz\n", offset, final); | |
| 1652 | 1652 | |
| 1653 | 1653 | // enable the timer |
| 1654 | 1654 | if( !(data & 0x40000) ) // if we're not in Count-Up mode |
| r5932 | r5933 | |
| 1697 | 1697 | case 0x0130/4: |
| 1698 | 1698 | if( (mem_mask) & 0xffff0000 ) |
| 1699 | 1699 | { |
| 1700 | // | |
| 1700 | // printf("KEYCNT = %04x\n", data>>16); | |
| 1701 | 1701 | verboselog(machine, 2, "GBA IO Register Write: KEYCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask ); |
| 1702 | 1702 | gba_state->KEYCNT = ( gba_state->KEYCNT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 ); |
| 1703 | 1703 | } |
| r5932 | r5933 | |
| 1763 | 1763 | case 0x0200/4: |
| 1764 | 1764 | if( (mem_mask) & 0x0000ffff ) |
| 1765 | 1765 | { |
| 1766 | // | |
| 1766 | // printf("IE (%08x) = %04x raw %x (%08x) (scan %d PC %x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, data, ~mem_mask, video_screen_get_vpos(machine->primary_screen), cpu_get_pc(space->cpu)); | |
| 1767 | 1767 | gba_state->IE = ( gba_state->IE & ~mem_mask ) | ( data & mem_mask ); |
| 1768 | 1768 | /* |
| 1769 | if (gba_state->IE & gba_state->IF) | |
| 1770 | { | |
| 1771 | gba_request_irq(machine, gba_state->IF); | |
| 1772 | } | |
| 1773 | */ | |
| 1769 | if (gba_state->IE & gba_state->IF) | |
| 1770 | { | |
| 1771 | gba_request_irq(machine, gba_state->IF); | |
| 1772 | } | |
| 1773 | */ | |
| 1774 | 1774 | } |
| 1775 | 1775 | if( (mem_mask) & 0xffff0000 ) |
| 1776 | 1776 | { |
| r5932 | r5933 | |
| 1832 | 1832 | } |
| 1833 | 1833 | break; |
| 1834 | 1834 | default: |
| 1835 | // | |
| 1835 | // verboselog(machine, 0, "Unknown GBA I/O register write: %08x = %08x (%08x)\n", 0x04000000 + ( offset << 2 ), data, ~mem_mask ); | |
| 1836 | 1836 | break; |
| 1837 | 1837 | } |
| 1838 | 1838 | } |
| r5932 | r5933 | |
| 2252 | 2252 | switch (gba_state->eeprom_state) |
| 2253 | 2253 | { |
| 2254 | 2254 | case EEP_IDLE: |
| 2255 | // | |
| 2255 | // printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), 1); | |
| 2256 | 2256 | return 0x00010001; // "ready" |
| 2257 | 2257 | break; |
| 2258 | 2258 | |
| r5932 | r5933 | |
| 2271 | 2271 | if ((gba_state->eeprom_bits == 0) && (gba_state->eeprom_count)) |
| 2272 | 2272 | { |
| 2273 | 2273 | gba_state->eep_data = gba_state->gba_eeprom[gba_state->eeprom_addr]; |
| 2274 | // | |
| 2274 | // printf("EEPROM read @ %x = %x (%x)\n", gba_state->eeprom_addr, gba_state->eep_data, (gba_state->eep_data & 0x80) ? 1 : 0); | |
| 2275 | 2275 | gba_state->eeprom_addr++; |
| 2276 | 2276 | gba_state->eeprom_bits = 8; |
| 2277 | 2277 | } |
| r5932 | r5933 | |
| 2288 | 2288 | gba_state->eeprom_state = EEP_IDLE; |
| 2289 | 2289 | } |
| 2290 | 2290 | |
| 2291 | // printf("out = %08x\n", out); | |
| 2292 | // printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %08x\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), out); | |
| 2291 | // printf("out = %08x\n", out); | |
| 2292 | // printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %08x\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), out); | |
| 2293 | 2293 | return out; |
| 2294 | 2294 | break; |
| 2295 | 2295 | } |
| 2296 | // | |
| 2296 | // printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), 0); | |
| 2297 | 2297 | return 0; |
| 2298 | 2298 | } |
| 2299 | 2299 | |
| r5932 | r5933 | |
| 2306 | 2306 | data >>= 16; |
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | // | |
| 2309 | // printf("eeprom_w: %x @ %x (state %d) (PC=%x)\n", data, offset, gba_state->eeprom_state, activecpu_get_pc()); | |
| 2310 | 2310 | |
| 2311 | 2311 | switch (gba_state->eeprom_state) |
| 2312 | 2312 | { |
| r5932 | r5933 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | #define MAIN_CLOCK XTAL_4_433619MHz |
| 19 | 19 | |
| 20 | ||
| 20 | ||
| 21 | 21 | static ADDRESS_MAP_START( bbcbc_prg, ADDRESS_SPACE_PROGRAM, 8 ) |
| 22 | 22 | AM_RANGE(0x00000, 0x03fff) AM_ROM |
| 23 | 23 | AM_RANGE(0x04000, 0x0bfff) AM_ROM |
| r5932 | r5933 | |
| 143 | 143 | MDRV_IMPORT_FROM( tms9928a ) |
| 144 | 144 | MDRV_SCREEN_MODIFY("screen") |
| 145 | 145 | MDRV_SCREEN_REFRESH_RATE( 50 ) |
| 146 | ||
| 146 | ||
| 147 | 147 | MDRV_CARTSLOT_ADD("cart") |
| 148 | 148 | MACHINE_DRIVER_END |
| 149 | 149 |
| r5932 | r5933 | |
|---|---|---|
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | |
| 207 | /* this is a fake keyboard layout. The keys are converted into codes | |
| 208 | which are transmitted by the keyboard to the base-unit. key code can | |
| 207 | /* this is a fake keyboard layout. The keys are converted into codes | |
| 208 | which are transmitted by the keyboard to the base-unit. key code can | |
| 209 | 209 | be calculated as (line*8)+bit_index */ |
| 210 | 210 | |
| 211 | 211 | /* 2008-05 FP: |
| r5932 | r5933 | |
| 367 | 367 | |
| 368 | 368 | //FIX: put right clock value for CTC |
| 369 | 369 | MDRV_Z80CTC_ADD( "z80ctc_1", KC85_4_CLOCK, kc85_disc_ctc_intf ) |
| 370 | ||
| 370 | ||
| 371 | 371 | MDRV_NEC765A_ADD("nec765", kc_fdc_interface) |
| 372 | 372 | MACHINE_DRIVER_END |
| 373 | 373 | |
| r5932 | r5933 | |
| 430 | 430 | MDRV_IMPORT_FROM( cpu_kc_disc ) |
| 431 | 431 | MDRV_QUANTUM_TIME(HZ(120)) |
| 432 | 432 | MDRV_MACHINE_RESET( kc85_4d ) |
| 433 | ||
| 433 | ||
| 434 | 434 | MDRV_FLOPPY_4_DRIVES_ADD(kc85_floppy_config) |
| 435 | 435 | MACHINE_DRIVER_END |
| 436 | 436 | |
| r5932 | r5933 | |
| 443 | 443 | ROM_SYSTEM_BIOS(0, "caos42", "CAOS 4.2" ) |
| 444 | 444 | ROMX_LOAD("caos__c0.854", 0x12000, 0x1000, CRC(57d9ab02) SHA1(774fc2496a59b77c7c392eb5aa46420e7722797e), ROM_BIOS(1)) |
| 445 | 445 | ROMX_LOAD("caos__e0.854", 0x13000, 0x2000, CRC(ee273933) SHA1(4300f7ff813c1fb2d5c928dbbf1c9e1fe52a9577), ROM_BIOS(1)) |
| 446 | ROM_SYSTEM_BIOS(1, "caos41", "CAOS 4.1" ) | |
| 446 | ROM_SYSTEM_BIOS(1, "caos41", "CAOS 4.1" ) | |
| 447 | 447 | ROMX_LOAD( "caos41c.854", 0x12000, 0x1000, CRC(c7e1c011) SHA1(acd998e3d9e8f592cd884aafc8ac4d291e40e097), ROM_BIOS(2)) |
| 448 | 448 | ROMX_LOAD( "caos41e.854", 0x13000, 0x2000, CRC(60e045e5) SHA1(e19819fb477dcb742a13729a9bf5943d63abe863), ROM_BIOS(2)) |
| 449 | 449 | ROM_END |
| r5932 | r5933 | |
| 454 | 454 | ROM_SYSTEM_BIOS(0, "caos42", "CAOS 4.2" ) |
| 455 | 455 | ROMX_LOAD("caos__c0.854", 0x12000, 0x1000, CRC(57d9ab02) SHA1(774fc2496a59b77c7c392eb5aa46420e7722797e), ROM_BIOS(1)) |
| 456 | 456 | ROMX_LOAD("caos__e0.854", 0x13000, 0x2000, CRC(ee273933) SHA1(4300f7ff813c1fb2d5c928dbbf1c9e1fe52a9577), ROM_BIOS(1)) |
| 457 | ROM_SYSTEM_BIOS(1, "caos41", "CAOS 4.1" ) | |
| 457 | ROM_SYSTEM_BIOS(1, "caos41", "CAOS 4.1" ) | |
| 458 | 458 | ROMX_LOAD( "caos41c.854", 0x12000, 0x1000, CRC(c7e1c011) SHA1(acd998e3d9e8f592cd884aafc8ac4d291e40e097), ROM_BIOS(2)) |
| 459 | 459 | ROMX_LOAD( "caos41e.854", 0x13000, 0x2000, CRC(60e045e5) SHA1(e19819fb477dcb742a13729a9bf5943d63abe863), ROM_BIOS(2)) |
| 460 | 460 | |
| r5932 | r5933 | |
| 475 | 475 | ROM_SYSTEM_BIOS(4, "pi88sw", "OS PI/88 (black/white)" ) |
| 476 | 476 | ROMX_LOAD( "pi88_sw.853", 0x12000, 0x2000, CRC(f7d2e8fc) SHA1(9b5c068f10ff34bc3253f5b51abad51c8da9dd5d), ROM_BIOS(5)) |
| 477 | 477 | ROM_SYSTEM_BIOS(5, "pi88ws", "OS PI/88 (white/blue)" ) |
| 478 | ROMX_LOAD( "pi88_ws.853", 0x12000, 0x2000, CRC(9ef4efbf) SHA1(b8b6f606b76bce9fb7fcd61a14120e5e026b6b6e), ROM_BIOS(6)) | |
| 478 | ROMX_LOAD( "pi88_ws.853", 0x12000, 0x2000, CRC(9ef4efbf) SHA1(b8b6f606b76bce9fb7fcd61a14120e5e026b6b6e), ROM_BIOS(6)) | |
| 479 | 479 | ROM_END |
| 480 | 480 | |
| 481 | 481 | ROM_START(kc85_2) |
| r5932 | r5933 | |
| 483 | 483 | ROM_SYSTEM_BIOS(0, "hc900", "HC900 CAOS" ) |
| 484 | 484 | ROMX_LOAD( "hc900.852", 0x12000, 0x2000, CRC(e6f4c0ab) SHA1(242a777788c774c5f764313361b1e0a65139ab32), ROM_BIOS(1)) |
| 485 | 485 | ROM_SYSTEM_BIOS(1, "caos22", "CAOS 2.2" ) |
| 486 | ROMX_LOAD( "caos__e0.852", 0x12000, 0x2000, CRC(48d5624c) SHA1(568dd59bfad4c604ba36bc05b094fc598a642f85), ROM_BIOS(2)) | |
| 486 | ROMX_LOAD( "caos__e0.852", 0x12000, 0x2000, CRC(48d5624c) SHA1(568dd59bfad4c604ba36bc05b094fc598a642f85), ROM_BIOS(2)) | |
| 487 | 487 | ROM_END |
| 488 | 488 | |
| 489 | 489 | ROM_START(kc85_5) |
| r5932 | r5933 | |
| 492 | 492 | ROM_LOAD("basic_c0.855", 0x10000, 0x8000, CRC(0ed9f8b0) SHA1(be2c68a5b461014c57e33a127c3ffb32b0ff2346)) |
| 493 | 493 | ROM_SYSTEM_BIOS(0, "caos44", "CAOS 4.4" ) |
| 494 | 494 | ROMX_LOAD( "caos__c0.855",0x18000, 0x2000, CRC(f56d5c18) SHA1(2cf8023ee71ca50b92f9f151b7519f59727d1c79), ROM_BIOS(1)) |
| 495 | ROMX_LOAD( "caos__e0.855",0x1A000, 0x2000, CRC(1dbc2e6d) SHA1(53ba4394d96e287ff8af01322af1e9879d4e77c4), ROM_BIOS(1)) | |
| 496 | ROM_SYSTEM_BIOS(1, "caos43", "CAOS 4.3" ) | |
| 495 | ROMX_LOAD( "caos__e0.855",0x1A000, 0x2000, CRC(1dbc2e6d) SHA1(53ba4394d96e287ff8af01322af1e9879d4e77c4), ROM_BIOS(1)) | |
| 496 | ROM_SYSTEM_BIOS(1, "caos43", "CAOS 4.3" ) | |
| 497 | 497 | ROMX_LOAD( "caos43c.855", 0x18000, 0x2000, CRC(2f0f9eaa) SHA1(5342be5104206d15e7471b094c7749a8a3d708ad), ROM_BIOS(2)) |
| 498 | 498 | ROMX_LOAD( "caos43e.855", 0x1A000, 0x2000, CRC(b66fc6c3) SHA1(521ac2fbded4148220f8af2d5a5ab99634364079), ROM_BIOS(2)) |
| 499 | 499 | ROM_END |
| Previous | 15994 Revisions | Next |