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

src/mess/tools/dat2html/dat2html.mak
r5932r5933
3131#-------------------------------------------------
3232# rules for building the dat2html executable
3333#-------------------------------------------------
34
34
3535$(DAT2HTML): $(DAT2HTML_OBJS) $(LIBUTIL) $(ZLIB) $(LIBOCORE)
3636   @echo Linking $@...
3737   $(LD) $(LDFLAGS) $^ $(LIBS) -o $@
src/mess/tools/messdocs/messdocs.mak
r5932r5933
1212
1313# messdocs will create this file
1414HELPOBJ = $(OBJ)/help
15MESSHELP = mess.chm
15MESSHELP = mess.chm
1616
1717# add our stuff to the global variables
1818OBJDIRS += $(MESSOBJ)/tools/messdocs
src/mess/tools/castool/main.c
r5932r5933
11/***************************************************************************
22
3   main.c
3    main.c
44
5   Castool command line front end
6   
7   27/03/2009 Initial version by Miodrag Milanovic
5    Castool command line front end
86
7    27/03/2009 Initial version by Miodrag Milanovic
8
99***************************************************************************/
1010
1111#include <stdio.h>
r5932r5933
2424
2525#include "devices/cassette.h"
2626
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"
5151
5252struct SupportedCassetteFormats
5353{
r5932r5933
5656   const char *desc;
5757};
5858
59const struct SupportedCassetteFormats formats[] = {   
59const struct SupportedCassetteFormats formats[] = {
6060   {"a26", a26_cassette_formats               ,"Atari 2600"},
6161   {"apf", apf_cassette_formats               ,"APF Imagination Machine"},
6262   {"cbm", cbm_cassette_formats               ,"Commodore"},
r5932r5933
9393   {"zx81_p", zx81_p_format                   ,"Sinclair ZX81"},
9494   {"zx80_o", zx80_o_format                   ,"Sinclair ZX80"},
9595   {NULL,NULL,NULL}
96}; 
96};
9797
9898
9999static const char *get_extension(const char *name)
r5932r5933
128128#else
129129int CLIB_DECL main(int argc, char *argv[])
130130#endif
131{   
131{
132132   int i;
133133   int found =0;
134134   const struct CassetteFormat * const *selected_formats = NULL;
r5932r5933
139139#endif /* WIN32 */
140140
141141
142   init_resource_tracking();   
142   init_resource_tracking();
143143   begin_resource_tracking();
144144
145145   if (argc > 1)
r5932r5933
156156               if (mame_stricmp(formats[i].name,argv[2])==0) {
157157                  selected_formats = formats[i].formats;
158158                  found = 1;
159               }               
159               }
160160            }
161161            if (found==0) {
162162               fprintf(stderr, "Wrong format name.\n\n");
163163               display_usage();
164164               fprintf(stderr, "\n");
165165               display_formats();
166               return -1;               
167            }           
168           
169            f = fopen(argv[3], "rb");   
166               return -1;
167            }
168
169            f = fopen(argv[3], "rb");
170170            if (!f) {
171171               fprintf(stderr, "File %s not found.\n",argv[3]);
172172               return -1;
173173            }
174   
174
175175            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");
177177               return -1;
178178            }
179         
179
180180            cassette_dump(cassette,argv[4]);
181181            cassette_close(cassette);
182182            goto theend;
183183         }
184184      }
185   }
185   }
186186
187187   /* Usage */
188188   fprintf(stderr, "castool - Generic cassette manipulation tool for use with MESS\n\n");
r5932r5933
190190   fprintf(stderr, "\n");
191191   display_formats();
192192   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");
194194
195195theend :
196196   /* clean up our tracked resources */
src/mess/tools/castool/castool.mak
r5932r5933
6262   $(MESS_FORMATS)/ioprocs.o         \
6363   $(MESS_FORMATS)/cassimg.o         \
6464   $(MESS_FORMATS)/wavfile.o         \
65   
6665
66
6767$(LIBCASTOOL): $(CASTOOL_LIB_OBJS)
6868
6969CASTOOL_OBJS = \
src/mess/tools/messtest/testimgt.c
r5932r5933
11/*********************************************************************
22
3   testimgt.c
3    testimgt.c
44
5   Imgtool testing code
5    Imgtool testing code
66
77*********************************************************************/
88
src/mess/tools/messtest/main.c
r5932r5933
11/*********************************************************************
22
3   main.c
3    main.c
44
5   MESS testing main module
5    MESS testing main module
66
77*********************************************************************/
88
r5932r5933
3434
3535/*************************************
3636 *
37 *   Main and argument parsing/handling
37 *  Main and argument parsing/handling
3838 *
3939 *************************************/
4040
r5932r5933
100100   /* run MAME's validity checks; if these fail cop out now */
101101   /* NPW 16-Sep-2006 - commenting this out because this cannot be run outside of MAME */
102102   //if (mame_validitychecks(-1))
103   //   goto done;
103   //  goto done;
104104   /* run Imgtool's validity checks; if these fail cop out now */
105105   if (imgtool_validitychecks())
106106      goto done;
src/mess/tools/messtest/testimgt.h
r5932r5933
11/*********************************************************************
22
3   testimgt.h
3    testimgt.h
44
5   Imgtool testing code
5    Imgtool testing code
66
77*********************************************************************/
88
src/mess/tools/messtest/testzpth.c
r5932r5933
11/*********************************************************************
22
3   testzpth.c
3    testzpth.c
44
5   Code for testing zip paths
5    Code for testing zip paths
66
77*********************************************************************/
88
r5932r5933
1212
1313/*-------------------------------------------------
1414    dir_entry_type_string - gets a string
15   representation of a osd_dir_entry_type
15    representation of a osd_dir_entry_type
1616-------------------------------------------------*/
1717
1818static const char *dir_entry_type_string(osd_dir_entry_type type)
r5932r5933
105105      {
106106         report_message(MSG_FAILURE, "File sizes match, but contents do not");
107107         goto done;
108      }     
108      }
109109   }
110110
111111   /* try doing a directory listing */
src/mess/tools/messtest/testmess.c
r5932r5933
11/*********************************************************************
22
3   testmess.c
3    testmess.c
44
5   MESS testing code
5    MESS testing code
66
77*********************************************************************/
88
r5932r5933
913913   }
914914
915915   /* very dirty hack - we unload the image because we cannot access it
916    * because the file is locked */
916    * because the file is locked */
917917   strcpy(filename_buf, filename);
918918   image_unload(image);
919919   filename = filename_buf;
r5932r5933
10741074   if (state == STATE_READY)
10751075   {
10761076      /* 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         */
10791079      if ((test_flags & MESSTEST_ALWAYS_DUMP_SCREENSHOT) &&
10801080         (current_command[0].command_type != MESSTEST_COMMAND_SCREENSHOT) &&
10811081         (current_command[1].command_type == MESSTEST_COMMAND_END))
src/mess/tools/messtest/core.c
r5932r5933
11/*********************************************************************
22
3   core.c
3    core.c
44
5   MESS testing code
5    MESS testing code
66
77*********************************************************************/
88
r5932r5933
365365
366366/* this external entity handler allows us to do things like this:
367367 *
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 *  ]>
372372 */
373373static int external_entity_handler(XML_Parser parser,
374374   const XML_Char *context,
r5932r5933
616616   while(buf[i++]);
617617
618618   /* 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    }
626626*/
627627}
628628
src/mess/tools/messtest/testzpth.h
r5932r5933
11/*********************************************************************
22
3   testzpth.h
3    testzpth.h
44
5   Code for testing zip paths
5    Code for testing zip paths
66
77*********************************************************************/
88
src/mess/tools/messtest/tststubs.c
r5932r5933
2424
2525
2626//============================================================
27//   osd_alloc_executable
27//  osd_alloc_executable
2828//============================================================
2929
3030void *osd_alloc_executable(size_t size)
r5932r5933
3939
4040
4141//============================================================
42//   osd_free_executable
42//  osd_free_executable
4343//============================================================
4444
4545void osd_free_executable(void *ptr, size_t size)
r5932r5933
5454
5555
5656//============================================================
57//   osd_is_bad_read_ptr
57//  osd_is_bad_read_ptr
5858//============================================================
5959
6060int osd_is_bad_read_ptr(const void *ptr, size_t size)
src/mess/tools/messtest/tstutils.c
r5932r5933
11/*********************************************************************
22
3   tstutils.c
3    tstutils.c
44
5   Utility code for testing
5    Utility code for testing
66
77*********************************************************************/
88
src/mess/tools/messtest/testmess.h
r5932r5933
11/*********************************************************************
22
3   testmess.h
3    testmess.h
44
5   Code for testing MESS
5    Code for testing MESS
66
77*********************************************************************/
88
src/mess/tools/messtest/core.h
r5932r5933
11/*********************************************************************
22
3   core.h
3    core.h
44
5   Automated testing for MAME/MESS
5    Automated testing for MAME/MESS
66
77*********************************************************************/
88
r5932r5933
1717
1818/***************************************************************************
1919
20   Type definitions
20    Type definitions
2121
2222***************************************************************************/
2323
r5932r5933
5555
5656/***************************************************************************
5757
58   Prototypes
58    Prototypes
5959
6060***************************************************************************/
6161
src/mess/tools/imgtool/stream.h
r5932r5933
11/***************************************************************************
22
3   stream.h
3    stream.h
44
5   Code for implementing Imgtool streams
5    Code for implementing Imgtool streams
66
77***************************************************************************/
88
src/mess/tools/imgtool/imgterrs.h
r5932r5933
11/***************************************************************************
22
3   imgterrs.h
3    imgterrs.h
44
5   Imgtool errors
5    Imgtool errors
66
77***************************************************************************/
88
src/mess/tools/imgtool/library.c
r5932r5933
11/****************************************************************************
22
3   library.c
3    library.c
44
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.
77
88****************************************************************************/
99
src/mess/tools/imgtool/iflopimg.c
r5932r5933
11/*********************************************************************
22
3   iflopimg.c
3    iflopimg.c
44
5   Bridge code for Imgtool into the standard floppy code
5    Bridge code for Imgtool into the standard floppy code
66
77*********************************************************************/
88
r5932r5933
3939
4040
4141/*********************************************************************
42   Imgtool ioprocs
42    Imgtool ioprocs
4343*********************************************************************/
4444
4545static void imgtool_floppy_closeproc(void *file)
r5932r5933
9090
9191
9292/*********************************************************************
93   Imgtool handlers
93    Imgtool handlers
9494*********************************************************************/
9595
9696struct imgtool_floppy_image
src/mess/tools/imgtool/imgtoolx.h
r5932r5933
11/***************************************************************************
22
3   imgtoolx.h
3    imgtoolx.h
44
5   Internal headers for Imgtool core
5    Internal headers for Imgtool core
66
77***************************************************************************/
88
src/mess/tools/imgtool/modules.c
r5932r5933
11/***************************************************************************
22
3   modules.c
3    modules.c
44
5   List of Imgtool modules
5    List of Imgtool modules
66
77***************************************************************************/
88
src/mess/tools/imgtool/windows/assocdlg.c
r5932r5933
11//============================================================
22//
3//   wimgtool.c - Win32 Imgtool File Association Dialog
3//  wimgtool.c - Win32 Imgtool File Association Dialog
44//
55//============================================================
66
src/mess/tools/imgtool/windows/wimgtool.c
r5932r5933
11//============================================================
22//
3//   wimgtool.c - Win32 GUI Imgtool
3//  wimgtool.c - Win32 GUI Imgtool
44//
55//============================================================
66
src/mess/tools/imgtool/windows/secview.c
r5932r5933
11//============================================================
22//
3//   secview.c - A Win32 sector editor dialog
3//  secview.c - A Win32 sector editor dialog
44//
55//============================================================
66
src/mess/tools/imgtool/windows/wimgtool.h
r5932r5933
11//============================================================
22//
3//   wimgtool.h - Win32 GUI Imgtool
3//  wimgtool.h - Win32 GUI Imgtool
44//
55//============================================================
66
src/mess/tools/imgtool/windows/secview.h
r5932r5933
11//============================================================
22//
3//   secview.h - A Win32 sector editor dialog
3//  secview.h - A Win32 sector editor dialog
44//
55//============================================================
66
src/mess/tools/imgtool/windows/wmain.c
r5932r5933
11//============================================================
22//
3//   wmain.h - Win32 GUI Imgtool main code
3//  wmain.h - Win32 GUI Imgtool main code
44//
55//============================================================
66
src/mess/tools/imgtool/windows/hexview.c
r5932r5933
11//============================================================
22//
3//   hexview.c - A Win32 hex editor control
3//  hexview.c - A Win32 hex editor control
44//
55//============================================================
66
src/mess/tools/imgtool/windows/hexview.h
r5932r5933
11//============================================================
22//
3//   hexview.h - A Win32 hex editor control
3//  hexview.h - A Win32 hex editor control
44//
55//============================================================
66
src/mess/tools/imgtool/imgtool.c
r5932r5933
11/***************************************************************************
22
3   imgtool.c
3    imgtool.c
44
5   Core code for Imgtool
5    Core code for Imgtool
66
77***************************************************************************/
88
r5932r5933
9191
9292/***************************************************************************
9393
94   Imgtool initialization and basics
94    Imgtool initialization and basics
9595
9696***************************************************************************/
9797
r5932r5933
127127
128128/*-------------------------------------------------
129129    internal_error - debug function for raising
130   internal errors
130    internal errors
131131-------------------------------------------------*/
132132
133133static void internal_error(const imgtool_module *module, const char *message)
r5932r5933
204204
205205/*-------------------------------------------------
206206    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
209209-------------------------------------------------*/
210210
211211imgtool_module_features imgtool_get_module_features(const imgtool_module *module)
r5932r5933
248248
249249/*-------------------------------------------------
250250    evaluate_module - evaluates a single file to
251   determine what module can best handle a file
251    determine what module can best handle a file
252252-------------------------------------------------*/
253253
254254static imgtoolerr_t evaluate_module(const char *fname,
r5932r5933
312312
313313/*-------------------------------------------------
314314    imgtool_partition_image - retrieves the image
315   associated with this partition
315    associated with this partition
316316-------------------------------------------------*/
317317
318318imgtool_image *imgtool_partition_image(imgtool_partition *partition)
r5932r5933
324324
325325/*-------------------------------------------------
326326    imgtool_identify_file - attempts to determine the module
327   for any given image
327    for any given image
328328-------------------------------------------------*/
329329
330330imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules, size_t count)
r5932r5933
401401
402402/*-------------------------------------------------
403403    imgtool_image_get_sector_size - gets the size
404   of a particular sector on an image
404    of a particular sector on an image
405405-------------------------------------------------*/
406406
407407imgtoolerr_t imgtool_image_get_sector_size(imgtool_image *image, UINT32 track, UINT32 head,
r5932r5933
418418
419419/*-------------------------------------------------
420420    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
424424-------------------------------------------------*/
425425
426426imgtoolerr_t imgtool_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors)
r5932r5933
481481
482482/*-------------------------------------------------
483483    imgtool_image_get_block_size - gets the size of
484   a standard block on an image
484    a standard block on an image
485485-------------------------------------------------*/
486486
487487imgtoolerr_t imgtool_image_get_block_size(imgtool_image *image, UINT32 *length)
r5932r5933
498498
499499/*-------------------------------------------------
500500    imgtool_image_read_block - reads a standard
501   block on an image
501    block on an image
502502-------------------------------------------------*/
503503
504504imgtoolerr_t imgtool_image_read_block(imgtool_image *image, UINT64 block, void *buffer)
r5932r5933
514514
515515/*-------------------------------------------------
516516    imgtool_image_write_block - writes a standard
517   block on an image
517    block on an image
518518-------------------------------------------------*/
519519
520520imgtoolerr_t imgtool_image_write_block(imgtool_image *image, UINT64 block, const void *buffer)
r5932r5933
530530
531531/*-------------------------------------------------
532532    imgtool_image_clear_block - clears a standard
533   block on an image
533    block on an image
534534-------------------------------------------------*/
535535
536536imgtoolerr_t imgtool_image_clear_block(imgtool_image *image, UINT64 block, UINT8 data)
r5932r5933
565565
566566/*-------------------------------------------------
567567    imgtool_image_list_partitions - lists the
568   partitions on an image
568    partitions on an image
569569-------------------------------------------------*/
570570
571571imgtoolerr_t imgtool_image_list_partitions(imgtool_image *image, imgtool_partition_info *partitions, size_t len)
r5932r5933
582582
583583/*-------------------------------------------------
584584    imgtool_image_malloc - allocates memory associated with an
585   image
585    image
586586-------------------------------------------------*/
587587
588588void *imgtool_image_malloc(imgtool_image *image, size_t size)
r5932r5933
594594
595595/*-------------------------------------------------
596596    imgtool_image_module - returns the module associated with
597   this image
597    this image
598598-------------------------------------------------*/
599599
600600const imgtool_module *imgtool_image_module(imgtool_image *img)
r5932r5933
637637
638638/***************************************************************************
639639
640   Imgtool partition management
640    Imgtool partition management
641641
642642***************************************************************************/
643643
r5932r5933
784784
785785/***************************************************************************
786786
787   Imgtool partition operations
787    Imgtool partition operations
788788
789789***************************************************************************/
790790
791791/*-------------------------------------------------
792792    imgtool_partition_get_attribute_name - retrieves the human readable
793   name for an attribute
793    name for an attribute
794794-------------------------------------------------*/
795795
796796void imgtool_partition_get_attribute_name(imgtool_partition *partition, UINT32 attribute, const imgtool_attribute *attr_value,
r5932r5933
866866
867867/*-------------------------------------------------
868868    imgtool_validitychecks - checks the validity
869   of the imgtool modules
869    of the imgtool modules
870870-------------------------------------------------*/
871871
872872int imgtool_validitychecks(void)
r5932r5933
10131013
10141014/*-------------------------------------------------
10151015    imgtool_temp_str - provides a temporary string
1016   buffer used for string passing
1016    buffer used for string passing
10171017-------------------------------------------------*/
10181018
10191019char *imgtool_temp_str(void)
r5932r5933
10271027
10281028/***************************************************************************
10291029
1030   Image handling functions
1030    Image handling functions
10311031
10321032***************************************************************************/
10331033
r5932r5933
12061206
12071207/*-------------------------------------------------
12081208    imgtool_image_info - returns format specific information
1209   about an image
1209    about an image
12101210-------------------------------------------------*/
12111211
12121212imgtoolerr_t imgtool_image_info(imgtool_image *image, char *string, size_t len)
r5932r5933
12281228
12291229/*-------------------------------------------------
12301230    cannonicalize_path - normalizes a path string
1231   into a NUL delimited list
1231    into a NUL delimited list
12321232-------------------------------------------------*/
12331233
12341234static imgtoolerr_t cannonicalize_path(imgtool_partition *partition, UINT32 flags,
r5932r5933
13331333
13341334/*-------------------------------------------------
13351335    imgtool_partition_get_directory_entry - retrieves
1336   the nth directory entry within a partition
1336    the nth directory entry within a partition
13371337-------------------------------------------------*/
13381338
13391339imgtoolerr_t imgtool_partition_get_directory_entry(imgtool_partition *partition, const char *path, int index, imgtool_dirent *ent)
r5932r5933
13771377
13781378/*-------------------------------------------------
13791379    imgtool_partition_get_file_size - returns free
1380   space on a partition, in bytes
1380    space on a partition, in bytes
13811381-------------------------------------------------*/
13821382
13831383imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const char *fname, UINT64 *filesize)
r5932r5933
14221422
14231423/*-------------------------------------------------
14241424    imgtool_partition_list_file_attributes - identifies
1425   all attributes on a file
1425    all attributes on a file
14261426-------------------------------------------------*/
14271427
14281428imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len)
r5932r5933
14691469
14701470/*-------------------------------------------------
14711471    imgtool_partition_get_file_attributes - retrieves
1472   attributes on a file
1472    attributes on a file
14731473-------------------------------------------------*/
14741474
14751475imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values)
r5932r5933
15141514
15151515/*-------------------------------------------------
15161516    imgtool_partition_put_file_attributes - sets
1517   attributes on a file
1517    attributes on a file
15181518-------------------------------------------------*/
15191519
15201520imgtoolerr_t imgtool_partition_put_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values)
r5932r5933
15471547
15481548/*-------------------------------------------------
15491549    imgtool_partition_get_file_attributes - retrieves
1550   an attribute on a single file
1550    an attribute on a single file
15511551-------------------------------------------------*/
15521552
15531553imgtoolerr_t imgtool_partition_get_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute *value)
r5932r5933
15621562
15631563/*-------------------------------------------------
15641564    imgtool_partition_put_file_attribute - sets
1565   attributes on a single file
1565    attributes on a single file
15661566-------------------------------------------------*/
15671567
15681568imgtoolerr_t imgtool_partition_put_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute value)
r5932r5933
15771577
15781578/*-------------------------------------------------
15791579    imgtool_partition_get_icon_info - retrieves the
1580   icon for a file stored on a partition
1580    icon for a file stored on a partition
15811581-------------------------------------------------*/
15821582
15831583imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo)
r5932r5933
16231623
16241624/*-------------------------------------------------
16251625    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
16281628-------------------------------------------------*/
16291629
16301630imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition, const char *path,
r5932r5933
16561656      goto done;
16571657
16581658   /* 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     */
16621662   i = j = 0;
16631663   while(suggestions[i].viability)
16641664   {
r5932r5933
17071707
17081708/*-------------------------------------------------
17091709    imgtool_partition_get_chain - retrieves the block
1710   chain for a file or directory on a partition
1710    chain for a file or directory on a partition
17111711-------------------------------------------------*/
17121712
17131713imgtoolerr_t imgtool_partition_get_chain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size)
r5932r5933
17331733
17341734/*-------------------------------------------------
17351735    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
17381738-------------------------------------------------*/
17391739
17401740imgtoolerr_t imgtool_partition_get_chain_string(imgtool_partition *partition, const char *path, char *buffer, size_t buffer_len)
r5932r5933
18041804
18051805/*-------------------------------------------------
18061806    imgtool_partition_get_free_space - returns the
1807   amount of free space on a partition
1807    amount of free space on a partition
18081808-------------------------------------------------*/
18091809
18101810imgtoolerr_t imgtool_partition_get_free_space(imgtool_partition *partition, UINT64 *sz)
r5932r5933
18281828
18291829/*-------------------------------------------------
18301830    imgtool_partition_read_file - starts reading
1831   from a file on a partition with a stream
1831    from a file on a partition with a stream
18321832-------------------------------------------------*/
18331833
18341834imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter)
r5932r5933
18931893
18941894/*-------------------------------------------------
18951895    imgtool_partition_write_file - starts writing
1896   to a new file on an image with a stream
1896    to a new file on an image with a stream
18971897-------------------------------------------------*/
18981898
18991899imgtoolerr_t imgtool_partition_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts, filter_getinfoproc filter)
r5932r5933
20152015
20162016/*-------------------------------------------------
20172017    imgtool_partition_get_file - read a file from
2018   an image, storing it into a native file
2018    an image, storing it into a native file
20192019-------------------------------------------------*/
20202020
20212021imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char *filename, const char *fork,
r5932r5933
20852085
20862086/*-------------------------------------------------
20872087    imgtool_partition_put_file - read a native file
2088   and store it on a partition
2088    and store it on a partition
20892089-------------------------------------------------*/
20902090
20912091imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char *newfname, const char *fork,
r5932r5933
21322132
21332133/*-------------------------------------------------
21342134    imgtool_partition_delete_file - delete a file
2135   on a partition
2135    on a partition
21362136-------------------------------------------------*/
21372137
21382138imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const char *fname)
r5932r5933
21802180
21812181/*-------------------------------------------------
21822182    imgtool_partition_list_file_forks - lists all
2183   forks on an image
2183    forks on an image
21842184-------------------------------------------------*/
21852185
21862186imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len)
r5932r5933
22252225
22262226/*-------------------------------------------------
22272227    imgtool_partition_create_directory - creates a
2228   directory on a partition
2228    directory on a partition
22292229-------------------------------------------------*/
22302230
22312231imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, const char *path)
r5932r5933
22712271
22722272/*-------------------------------------------------
22732273    imgtool_partition_delete_directory - deletes a
2274   directory on a partition
2274    directory on a partition
22752275-------------------------------------------------*/
22762276
22772277imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, const char *path)
r5932r5933
23172317
23182318/*-------------------------------------------------
23192319    imgtool_partition_get_block_size - gets the
2320   size of a standard block on a partition
2320    size of a standard block on a partition
23212321-------------------------------------------------*/
23222322
23232323imgtoolerr_t imgtool_partition_get_block_size(imgtool_partition *partition, UINT32 *length)
r5932r5933
23292329
23302330/*-------------------------------------------------
23312331    imgtool_partition_read_block - reads a standard
2332   block on a partition
2332    block on a partition
23332333-------------------------------------------------*/
23342334
23352335imgtoolerr_t imgtool_partition_read_block(imgtool_partition *partition, UINT64 block, void *buffer)
r5932r5933
23432343
23442344/*-------------------------------------------------
23452345    imgtool_partition_write_block - writes a
2346   standard block on a partition
2346    standard block on a partition
23472347-------------------------------------------------*/
23482348
23492349imgtoolerr_t imgtool_partition_write_block(imgtool_partition *partition, UINT64 block, const void *buffer)
r5932r5933
23572357
23582358/*-------------------------------------------------
23592359    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
23622362-------------------------------------------------*/
23632363
23642364imgtool_partition_features imgtool_partition_get_features(imgtool_partition *partition)
r5932r5933
23932393
23942394/*-------------------------------------------------
23952395    imgtool_partition_get_info_ptr - retrieves a
2396   pointer associated with a partition's format
2396    pointer associated with a partition's format
23972397-------------------------------------------------*/
23982398
23992399void *imgtool_partition_get_info_ptr(imgtool_partition *partition, UINT32 state)
r5932r5933
24052405
24062406/*-------------------------------------------------
24072407    imgtool_partition_get_info_string - retrieves a
2408   string associated with a partition's format
2408    string associated with a partition's format
24092409-------------------------------------------------*/
24102410
24112411const char *imgtool_partition_get_info_string(imgtool_partition *partition, UINT32 state)
r5932r5933
24172417
24182418/*-------------------------------------------------
24192419    imgtool_partition_get_info_int - retrieves a
2420   pointer associated with a partition's format
2420    pointer associated with a partition's format
24212421-------------------------------------------------*/
24222422
24232423UINT64 imgtool_partition_get_info_int(imgtool_partition *partition, UINT32 state)
r5932r5933
24292429
24302430/*-------------------------------------------------
24312431    imgtool_partition_extra_bytes - returns extra
2432   bytes on a partition
2432    bytes on a partition
24332433-------------------------------------------------*/
24342434
24352435void *imgtool_partition_extra_bytes(imgtool_partition *partition)
r5932r5933
24562456
24572457/***************************************************************************
24582458
2459   Path handling functions
2459    Path handling functions
24602460
24612461***************************************************************************/
24622462
24632463/*-------------------------------------------------
24642464    imgtool_partition_get_root_path - retrieves
2465   the path root of this partition
2465    the path root of this partition
24662466-------------------------------------------------*/
24672467
24682468const char *imgtool_partition_get_root_path(imgtool_partition *partition)
r5932r5933
24862486
24872487/*-------------------------------------------------
24882488    imgtool_partition_path_concatenate - retrieves
2489   a pointer associated with a partition's format
2489    a pointer associated with a partition's format
24902490-------------------------------------------------*/
24912491
24922492const char *imgtool_partition_path_concatenate(imgtool_partition *partition, const char *path1, const char *path2)
r5932r5933
25352535
25362536/*-------------------------------------------------
25372537    imgtool_partition_get_base_name - retrieves
2538   a base name for a partition specific path
2538    a base name for a partition specific path
25392539-------------------------------------------------*/
25402540
25412541const char *imgtool_partition_get_base_name(imgtool_partition *partition, const char *path)
r5932r5933
25582558
25592559/***************************************************************************
25602560
2561   Directory handling functions
2561    Directory handling functions
25622562
25632563***************************************************************************/
25642564
25652565/*-------------------------------------------------
25662566    imgtool_directory_open - begins
2567   enumerating files on a partition
2567    enumerating files on a partition
25682568-------------------------------------------------*/
25692569
25702570imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *path, imgtool_directory **outenum)
r5932r5933
26472647
26482648/*-------------------------------------------------
26492649    imgtool_directory_get_next - continues
2650   enumerating files within a partition
2650    enumerating files within a partition
26512651-------------------------------------------------*/
26522652
26532653imgtoolerr_t imgtool_directory_get_next(imgtool_directory *directory, imgtool_dirent *ent)
r5932r5933
26592659   partition = imgtool_directory_partition(directory);
26602660
26612661   /* 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     */
26642664   memset(ent, 0, sizeof(*ent));
26652665
26662666   err = partition->next_enum(directory, ent);
r5932r5933
27032703
27042704/*-------------------------------------------------
27052705    imgtool_directory_module - returns the module associated
2706   with this directory
2706    with this directory
27072707-------------------------------------------------*/
27082708
27092709const imgtool_module *imgtool_directory_module(imgtool_directory *directory)
r5932r5933
27152715
27162716/*-------------------------------------------------
27172717    imgtool_directory_extrabytes - returns extra
2718   bytes on a directory
2718    bytes on a directory
27192719-------------------------------------------------*/
27202720
27212721void *imgtool_directory_extrabytes(imgtool_directory *directory)
r5932r5933
27282728
27292729/*-------------------------------------------------
27302730    imgtool_directory_partition - returns the
2731   partition associated with this directory
2731    partition associated with this directory
27322732-------------------------------------------------*/
27332733
27342734imgtool_partition *imgtool_directory_partition(imgtool_directory *directory)
r5932r5933
27402740
27412741/*-------------------------------------------------
27422742    imgtool_directory_image - returns the image
2743   associated with this directory
2743    associated with this directory
27442744-------------------------------------------------*/
27452745
27462746imgtool_image *imgtool_directory_image(imgtool_directory *directory)
r5932r5933
27522752
27532753/*-------------------------------------------------
27542754    unknown_partition_get_info - represents an
2755   unknown partition
2755    unknown partition
27562756-------------------------------------------------*/
27572757
27582758void unknown_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info)
src/mess/tools/imgtool/iflopimg.h
r5932r5933
11/*********************************************************************
22
3   iflopimg.h
3    iflopimg.h
44
5   Bridge code for Imgtool into the standard floppy code
5    Bridge code for Imgtool into the standard floppy code
66
77*********************************************************************/
88
r5932r5933
1515
1616/***************************************************************************
1717
18   Prototypes
18    Prototypes
1919
2020***************************************************************************/
2121
src/mess/tools/imgtool/filteoln.c
r5932r5933
11/****************************************************************************
22
3   filteoln.c
3    filteoln.c
44
5   Native end-of-line filter
5    Native end-of-line filter
66
77*****************************************************************************/
88
src/mess/tools/imgtool/modules.h
r5932r5933
11/****************************************************************************
22
3   modules.h
3    modules.h
44
5   Code that creates the "canonical" Imgtool library
5    Code that creates the "canonical" Imgtool library
66
77****************************************************************************/
88
src/mess/tools/imgtool/imgtool.h
r5932r5933
11/***************************************************************************
22
3   imgtool.h
3    imgtool.h
44
5   Main headers for Imgtool core
5    Main headers for Imgtool core
66
77***************************************************************************/
88
src/mess/tools/imgtool/filtbas.c
r5932r5933
11/****************************************************************************
22
3   filtbas.c
3    filtbas.c
44
5   Filter for Microsoft-style tokenized BASIC files
5    Filter for Microsoft-style tokenized BASIC files
66
7   BASIC files typically follow the following format:
7    BASIC files typically follow the following format:
88
9      int8     $ff
10      int16    <TOTAL LENGTH>
11      ...
9        int8     $ff
10        int16    <TOTAL LENGTH>
11        ...
1212        int16    <PTR_NEXT_LINE>
1313        int16    <LINE_NUM>
1414        int8[]   <TOKENISED_DATA>
r5932r5933
6666
6767/*-------------------------------------------------
6868    basic_readfile - reads a file and decodes
69   BASIC tokens into ASCII text
69    BASIC tokens into ASCII text
7070-------------------------------------------------*/
7171
7272static imgtoolerr_t basic_readfile(const basictokens *tokens,
r5932r5933
169169
170170/*-------------------------------------------------
171171    basic_writefile - translates ASCII text to
172   BASIC tokens and writes it to a file
172    BASIC tokens and writes it to a file
173173-------------------------------------------------*/
174174
175175static imgtoolerr_t basic_writefile(const basictokens *tokens,
r5932r5933
234234            line_number *= 10;
235235            line_number += (buf[pos++] - '0');
236236         }
237         
237
238238         /* determine address */
239239         if (tokens->baseaddress != 0)
240240         {
r5932r5933
257257            place_integer_be(line_header, 0, 2, address);
258258            place_integer_be(line_header, 2, 2, line_number);
259259         }
260         
260
261261         /* emit line header */
262262         stream_write(mem_stream, line_header, sizeof(line_header));
263263
src/mess/tools/imgtool/main.c
r5932r5933
11/***************************************************************************
22
3   main.c
3    main.c
44
5   Imgtool command line front end
5    Imgtool command line front end
66
77***************************************************************************/
88
r5932r5933
345345   }
346346
347347   /* 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 */
350350   if (argc >= 2)
351351   {
352352      /* open up the image */
src/mess/tools/imgtool/filter.c
r5932r5933
11/***************************************************************************
22
3   filter.c
3    filter.c
44
5   Imgtool filters
5    Imgtool filters
66
77***************************************************************************/
88
src/mess/tools/imgtool/modules/ti99.c
r5932r5933
11/*
2   Handlers for ti99 disk images
2    Handlers for ti99 disk images
33
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).
1111
12   Raphael Nabet, 2002-2004
12    Raphael Nabet, 2002-2004
1313
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
1717*/
1818
1919#include <limits.h>
r5932r5933
2828#include "imghd.h"
2929
3030/*
31   Concepts shared by both disk structures:
32   ----------------------------------------
31    Concepts shared by both disk structures:
32    ----------------------------------------
3333
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".
4444
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.
4949
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".
5252
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).
6060
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".
6565
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.)
7878
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)
8787
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
9595
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                    ------------------------------
136136
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                  : :                            :
150150
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.
153153
154154
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.
162162
163163
164   DSK disk structure:
165   -------------------
164    DSK disk structure:
165    -------------------
166166
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).
170170
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).
174174
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).
182182
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.
185185
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.
192192
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.
200200
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).
208208
209209
210   WIN disk structure:
211   -------------------
210    WIN disk structure:
211    -------------------
212212
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.
215215
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.
218218
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.
222222
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.
237237
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.
247247
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.
251251*/
252252
253253/* Since string length is encoded with a byte, the maximum length of a string
r5932r5933
265265#endif
266266
267267/*
268   Miscellaneous utilities that are used to handle TI data types
268    Miscellaneous utilities that are used to handle TI data types
269269*/
270270
271271typedef struct UINT16BE
r5932r5933
301301}
302302
303303/*
304   Convert a C string to a 10-character file name (padded with spaces if necessary)
304    Convert a C string to a 10-character file name (padded with spaces if necessary)
305305
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
308308*/
309309static void str_to_fname(char dst[10], const char *src)
310310{
r5932r5933
330330}
331331
332332/*
333   Convert a 10-character file name to a C string (removing trailing spaces if necessary)
333    Convert a 10-character file name to a C string (removing trailing spaces if necessary)
334334
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)
338338*/
339339static void fname_to_str(char *dst, const char src[10], int n)
340340{
r5932r5933
363363}
364364
365365/*
366   Check a 10-character file name.
366    Check a 10-character file name.
367367
368   filename (I): 10-character array with file name
368    filename (I): 10-character array with file name
369369
370   Return non-zero if the file name is invalid.
370    Return non-zero if the file name is invalid.
371371*/
372372static int check_fname(const char filename[10])
373373{
r5932r5933
387387         return 1;
388388      case ' ':
389389         /* illegal in a file name, but file names shorter than 10
390         characters are padded with spaces */
390            characters are padded with spaces */
391391         space_found_flag = TRUE;
392392         break;
393393      default:
394394         /* 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) */
397397         if (space_found_flag)
398398            return 1;
399399         break;
r5932r5933
404404}
405405
406406/*
407   Check a file path.
407    Check a file path.
408408
409   fpath (I): C string with file path
409    fpath (I): C string with file path
410410
411   Return non-zero if the file path is invalid.
411    Return non-zero if the file path is invalid.
412412*/
413413static int check_fpath(const char *fpath)
414414{
r5932r5933
417417
418418
419419   /* first check that the path is not too long and that there is no space
420   character */
420    character */
421421   if ((strlen(fpath) > MAX_PATH_LEN) || strchr(fpath, ' '))
422422      return 1;
423423
r5932r5933
448448#endif
449449
450450/*
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).
453453
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.
456456*/
457457
458458/*
459   Disk geometry
459    Disk geometry
460460*/
461461typedef struct ti99_geometry
462462{
r5932r5933
466466} ti99_geometry;
467467
468468/*
469   Physical sector address
469    Physical sector address
470470*/
471471typedef struct ti99_sector_address
472472{
r5932r5933
476476} ti99_sector_address;
477477
478478/*
479   Time stamp (used in fdr, and WIN VIB/DDR)
479    Time stamp (used in fdr, and WIN VIB/DDR)
480480*/
481481typedef struct ti99_date_time
482482{
r5932r5933
485485} ti99_date_time;
486486
487487/*
488   Subdirectory descriptor (HFDC only)
488    Subdirectory descriptor (HFDC only)
489489
490   The HFDC supports up to 3 subdirectories.
490    The HFDC supports up to 3 subdirectories.
491491*/
492492typedef struct dsk_subdir
493493{
r5932r5933
496496} dsk_subdir;
497497
498498/*
499   DSK VIB record
499    DSK VIB record
500500
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.
503503*/
504504typedef struct dsk_vib
505505{
r5932r5933
540540} ti99_img_format;
541541
542542/*
543   level-1 disk image descriptor
543    level-1 disk image descriptor
544544*/
545545typedef struct ti99_lvl1_imgref
546546{
r5932r5933
553553} ti99_lvl1_imgref;
554554
555555/*
556   calculate CRC for data address marks or sector data
556    calculate CRC for data address marks or sector data
557557
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
561561*/
562562static void calc_crc(UINT16 *crc, UINT8 value)
563563{
r5932r5933
582582}
583583
584584/*
585   Parse a PC99 disk image
585    Parse a PC99 disk image
586586
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
595595
596   Return imgtool error code
596    Return imgtool error code
597597*/
598598#define MAX_TRACK_LEN 6872
599599#define DATA_OFFSET_NONE 0xffffffff
r5932r5933
763763
764764         /* CRC seems to be completely hosed */
765765         /*if (crc)
766            printf("aargh!");*/
766                printf("aargh!");*/
767767         if ((seclen != 256) || (crc1 != 0xf7) || (crc2 != 0xf7)
768768               || (cylinder != expected_cylinder) || (head != expected_head)
769769               || ((pass == 1) && ((cylinder >= geometry->cylinders)
r5932r5933
861861
862862         /* CRC seems to be completely hosed */
863863         /*if (crc)
864            printf("aargh!");*/
864                printf("aargh!");*/
865865         if ((crc1 != 0xf7) || (crc2 != 0xf7))
866866            continue;
867867
r5932r5933
912912
913913
914914/*
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.)
918918
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
922922
923   Return imgtool error code
923    Return imgtool error code
924924*/
925925static int read_image_vib_no_geometry(imgtool_stream *file_handle, ti99_img_format img_format, dsk_vib *dest)
926926{
r5932r5933
953953}
954954
955955/*
956   Open a disk image at level 1
956    Open a disk image at level 1
957957
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)
962962
963   Return imgtool error code
963    Return imgtool error code
964964*/
965965static imgtoolerr_t open_image_lvl1(imgtool_stream *file_handle, ti99_img_format img_format, ti99_lvl1_imgref *l1_img, dsk_vib *vib)
966966{
r5932r5933
992992
993993      /* read vib */
994994      /*reply = read_absolute_physrec(l1_img, 0, vib);
995      if (reply)
996         return reply;*/
995        if (reply)
996            return reply;*/
997997   }
998998   else
999999   {
r5932r5933
10081008      l1_img->geometry.secspertrack = vib->secspertrack;
10091009      if (l1_img->geometry.secspertrack == 0)
10101010         /* Some images might be like this, because the original SSSD TI
1011         controller always assumes 9. */
1011            controller always assumes 9. */
10121012         l1_img->geometry.secspertrack = 9;
10131013      l1_img->geometry.cylinders = vib->cylinders;
10141014      if (l1_img->geometry.cylinders == 0)
10151015         /* Some images are like this, because the original SSSD TI
1016         controller always assumes 40. */
1016            controller always assumes 40. */
10171017         l1_img->geometry.cylinders = 40;
10181018      l1_img->geometry.heads = vib->heads;
10191019      if (l1_img->geometry.heads == 0)
10201020         /* Some images are like this, because the original SSSD TI
1021         controller always assumes that tracks beyond 40 are on side 2. */
1021            controller always assumes that tracks beyond 40 are on side 2. */
10221022         l1_img->geometry.heads = totphysrecs / (l1_img->geometry.secspertrack * l1_img->geometry.cylinders);
10231023
10241024      /* check information */
r5932r5933
10471047}
10481048
10491049/*
1050   Close a disk image at level 1
1050    Close a disk image at level 1
10511051
1052   l1_img (I/O): level-1 image handle
1052    l1_img (I/O): level-1 image handle
10531053
1054   Return imgtool error code
1054    Return imgtool error code
10551055*/
10561056static void close_image_lvl1(ti99_lvl1_imgref *l1_img)
10571057{
r5932r5933
10671067}
10681068
10691069/*
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)
10721072
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
10751075
1076   Return offset in image
1076    Return offset in image
10771077*/
10781078INLINE int sector_address_to_image_offset(const ti99_lvl1_imgref *l1_img, const ti99_sector_address *address)
10791079{
r5932r5933
11081108}
11091109
11101110/*
1111   Read one 256-byte sector from a disk image
1111    Read one 256-byte sector from a disk image
11121112
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
11161116
1117   Return non-zero on error
1117    Return non-zero on error
11181118*/
11191119static int read_sector(ti99_lvl1_imgref *l1_img, const ti99_sector_address *address, void *dest)
11201120{
r5932r5933
11881188}
11891189
11901190/*
1191   Write one 256-byte sector to a disk image
1191    Write one 256-byte sector to a disk image
11921192
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
11961196
1197   Return non-zero on error
1197    Return non-zero on error
11981198*/
11991199static int write_sector(ti99_lvl1_imgref *l1_img, const ti99_sector_address *address, const void *src)
12001200{
r5932r5933
12681268}
12691269
12701270/*
1271   Convert physical record address to sector address (DSK format)
1271    Convert physical record address to sector address (DSK format)
12721272
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
12761276*/
12771277static void dsk_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address)
12781278{
r5932r5933
12861286}
12871287
12881288/*
1289   Convert physical record address to sector address (WIN format for HFDC)
1289    Convert physical record address to sector address (WIN format for HFDC)
12901290
1291   Note that physical address translation makes sense for HFDC, but not SCSI.
1291    Note that physical address translation makes sense for HFDC, but not SCSI.
12921292
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
12961296*/
12971297/*static void win_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address)
12981298{
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;
13031303}*/
13041304
13051305/*
1306   Read one 256-byte physical record from a disk image
1306    Read one 256-byte physical record from a disk image
13071307
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
13111311
1312   Return non-zero on error
1312    Return non-zero on error
13131313*/
13141314static int read_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, void *dest)
13151315{
r5932r5933
13201320   {
13211321      /*win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address);
13221322
1323      return read_sector(l1_img, & address, dest);*/
1323        return read_sector(l1_img, & address, dest);*/
13241324
13251325      return imghd_read(&l1_img->harddisk_handle, aphysrec, dest) != IMGTOOLERR_SUCCESS;
13261326   }
r5932r5933
13331333}
13341334
13351335/*
1336   Write one 256-byte physical record to a disk image
1336    Write one 256-byte physical record to a disk image
13371337
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
13411341
1342   Return non-zero on error
1342    Return non-zero on error
13431343*/
13441344static int write_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, const void *src)
13451345{
r5932r5933
13501350   {
13511351      /*win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address);
13521352
1353      return write_sector(l1_img, & address, dest);*/
1353        return write_sector(l1_img, & address, dest);*/
13541354
13551355      return imghd_write(&l1_img->harddisk_handle, aphysrec, src) != IMGTOOLERR_SUCCESS;
13561356   }
r5932r5933
13681368#endif
13691369
13701370/*
1371   Level 2 implements files as a succession of 256-byte-long physical records.
1371    Level 2 implements files as a succession of 256-byte-long physical records.
13721372
1373   Level 2 implements allocation bitmap (and AU), disk catalog, etc.
1373    Level 2 implements allocation bitmap (and AU), disk catalog, etc.
13741374*/
13751375
13761376/*
1377   WIN VIB/DDR record
1377    WIN VIB/DDR record
13781378*/
13791379typedef struct win_vib_ddr
13801380{
r5932r5933
14321432} win_vib_ddr;
14331433
14341434/*
1435   AU format
1435    AU format
14361436*/
14371437typedef struct ti99_AUformat
14381438{
r5932r5933
14411441} ti99_AUformat;
14421442
14431443/*
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
14461446*/
14471447/*typedef int dir_ref;*/
14481448
14491449/*
1450   catalog entry (used for in-memory catalog)
1450    catalog entry (used for in-memory catalog)
14511451*/
14521452typedef struct dir_entry
14531453{
r5932r5933
14721472} ti99_catalog;
14731473
14741474/*
1475   level-2 disk image descriptor
1475    level-2 disk image descriptor
14761476*/
14771477typedef struct ti99_lvl2_imgref_dsk
14781478{
14791479   UINT16 totphysrecs;            /* total number of aphysrecs (extracted from vib record in aphysrec 0) */
14801480   ti99_catalog catalogs[4];      /* catalog of root directory and up to 3 subdirectories */
14811481   UINT16 fdir_aphysrec[4];      /* fdir aphysrec address for root directory
1482                              and up to 3 subdirectories */
1482                                        and up to 3 subdirectories */
14831483} ti99_lvl2_imgref_dsk;
14841484
14851485typedef struct ti99_lvl2_imgref_win
r5932r5933
14961496   ti99_lvl1_imgref l1_img;/* image format, imgtool image handle, image geometry */
14971497   ti99_AUformat AUformat;   /* AU format */
14981498   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. */
15041504                     /* 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. */
15081508                     /* 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). */
15141514   char vol_name[10];      /* cached volume name (extracted from vib record in aphysrec 0) */
15151515
15161516   UINT8 abm[8192];      /* allocation bitmap */
r5932r5933
15291529} ti99_lvl2_imgref;
15301530
15311531/*
1532   file flags found in fdr (and tifiles)
1532    file flags found in fdr (and tifiles)
15331533*/
15341534enum
15351535{
15361536   fdr99_f_program   = 0x01,   /* set for program files */
15371537   fdr99_f_int      = 0x02,   /* set for binary files */
15381538   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) */
15411541   fdr99_f_var      = 0x80   /* set if file uses variable-length records*/
15421542};
15431543
15441544/*
1545   DSK FDR record
1545    DSK FDR record
15461546*/
15471547typedef struct dsk_fdr
15481548{
r5932r5933
15881588} dsk_fdr;
15891589
15901590/*
1591   WIN FDR record
1591    WIN FDR record
15921592*/
15931593typedef struct win_fdr
15941594{
r5932r5933
16501650} win_fdr;
16511651
16521652/*
1653   tifile header: stand-alone file
1653    tifile header: stand-alone file
16541654*/
16551655typedef struct tifile_header
16561656{
r5932r5933
16901690} tifile_header;
16911691
16921692/*
1693   level-2 file descriptor
1693    level-2 file descriptor
16941694*/
16951695typedef struct ti99_lvl2_fileref_dsk
16961696{
r5932r5933
17331733
17341734
17351735/*
1736   Compare two (possibly empty) catalog entry for qsort
1736    Compare two (possibly empty) catalog entry for qsort
17371737*/
17381738static int cat_file_compare_qsort(const void *p1, const void *p2)
17391739{
r5932r5933
17661766}
17671767
17681768/*
1769   Read a directory catalog from disk image
1769    Read a directory catalog from disk image
17701770
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
17741774
1775   Return an error code if there was an error, 0 otherwise.
1775    Return an error code if there was an error, 0 otherwise.
17761776*/
17771777static int dsk_read_catalog(ti99_lvl2_imgref *l2_img, int aphysrec, ti99_catalog *dest)
17781778{
r5932r5933
18371837}
18381838
18391839/*
1840   Read a directory catalog from disk image
1840    Read a directory catalog from disk image
18411841
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
18451845
1846   Return an error code if there was an error, 0 otherwise.
1846    Return an error code if there was an error, 0 otherwise.
18471847*/
18481848static int win_read_catalog(ti99_lvl2_imgref *l2_img, int DDR_AU, ti99_catalog *dest)
18491849{
r5932r5933
19581958}
19591959
19601960/*
1961   Search for a file path on a floppy image
1961    Search for a file path on a floppy image
19621962
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)
19701970*/
19711971static 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)
19721972{
r5932r5933
20572057}
20582058
20592059/*
2060   Search for a file path on a harddisk image
2060    Search for a file path on a harddisk image
20612061
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)
20702070*/
20712071static int win_find_catalog_entry(ti99_lvl2_imgref *l2_img, const char *fpath,
20722072                           int *parent_ref_valid, int *parent_ddr_AU, ti99_catalog *parent_catalog,
r5932r5933
21632163}
21642164
21652165/*
2166   Allocate one AU on disk, for use as a fdr record
2166    Allocate one AU on disk, for use as a fdr record
21672167
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
21702170*/
21712171static int alloc_fdr_AU(ti99_lvl2_imgref *l2_img, unsigned *fdr_AU)
21722172{
r5932r5933
22822282}
22832283
22842284/*
2285   Advance to next sibling FDR
2285    Advance to next sibling FDR
22862286*/
22872287static int win_goto_next_sibFDR(ti99_lvl2_fileref_win *win_file)
22882288{
r5932r5933
22972297}
22982298
22992299/*
2300   Back to previous sibling FDR
2300    Back to previous sibling FDR
23012301*/
23022302static int win_goto_prev_sibFDR(ti99_lvl2_fileref_win *win_file)
23032303{
r5932r5933
23122312}
23132313
23142314/*
2315   Append a new sibling FDR at the end of the sibling FDR list, and open it.
2315    Append a new sibling FDR at the end of the sibling FDR list, and open it.
23162316
2317   You must have gone to the end of the list.
2317    You must have gone to the end of the list.
23182318*/
23192319static int win_alloc_sibFDR(ti99_lvl2_fileref_win *win_file)
23202320{
r5932r5933
23772377}
23782378
23792379/*
2380   Extend a file with nb_alloc_physrecs extra physrecs
2380    Extend a file with nb_alloc_physrecs extra physrecs
23812381
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
23842384*/
23852385static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc_physrecs)
23862386{
r5932r5933
25652565}
25662566
25672567/*
2568   Extend a file with nb_alloc_physrecs extra physrecs
2568    Extend a file with nb_alloc_physrecs extra physrecs
25692569
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
25722572*/
25732573static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc_physrecs)
25742574{
r5932r5933
26072607   }
26082608   if ((get_UINT16BE(win_file->curfdr.clusters[0][0]) == 0) && (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) != 0))
26092609   {   /* this is annoying: we have found a sibling FDR filled with 0s: rewind
2610      to last non-empty sibling if applicable */
2610        to last non-empty sibling if applicable */
26112611      errorcode = win_goto_prev_sibFDR(win_file);
26122612      if (errorcode)
26132613         return errorcode;
r5932r5933
27822782}
27832783
27842784/*
2785   Allocate a new (empty) file
2785    Allocate a new (empty) file
27862786*/
27872787static int new_file_lvl2_dsk(ti99_lvl2_imgref *l2_img, int parent_ref, char filename[10], ti99_lvl2_fileref *l2_file)
27882788{
r5932r5933
27962796   if (catalog->num_files >= 127)
27972797      /* if num_files == 128, catalog is full */
27982798      /* 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) */
28022802      return IMGTOOLERR_NOSPACE;
28032803
28042804   /* find insertion point in catalog */
r5932r5933
28402840}
28412841
28422842/*
2843   Allocate a new (empty) file
2843    Allocate a new (empty) file
28442844*/
28452845static int new_file_lvl2_win(ti99_lvl2_imgref *l2_img, ti99_catalog *parent_catalog, char filename[10], ti99_lvl2_fileref *l2_file)
28462846{
r5932r5933
28942894}
28952895
28962896/*
2897   Allocate a new (empty) file
2897    Allocate a new (empty) file
28982898*/
28992899static int new_file_lvl2_tifiles(imgtool_stream *file_handle, ti99_lvl2_fileref *l2_file)
29002900{
r5932r5933
29152915}
29162916
29172917/*
2918   Open an existing file on a floppy image
2918    Open an existing file on a floppy image
29192919
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
29232923*/
29242924static int open_file_lvl2_dsk(ti99_lvl2_imgref *l2_img, const char *fpath, ti99_lvl2_fileref *l2_file)
29252925{
r5932r5933
29452945}
29462946
29472947/*
2948   Open an existing file on a harddisk image
2948    Open an existing file on a harddisk image
29492949
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
29532953*/
29542954static int open_file_lvl2_win(ti99_lvl2_imgref *l2_img, const char *fpath, ti99_lvl2_fileref *l2_file)
29552955{
r5932r5933
29752975
29762976   /* check integrity of FDR sibling chain */
29772977   /* 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 */
29802980   if (get_UINT16BE(l2_file->u.win.curfdr.prevsibFDR_AU) != 0)
29812981      return IMGTOOLERR_CORRUPTIMAGE;
29822982
r5932r5933
30143014         for (; i<54; i++)
30153015         {
30163016            /*set_UINT16BE(&cur_fdr->clusters[i][0], 0);
3017            set_UINT16BE(&cur_fdr->clusters[i][1], 0);*/
3017                set_UINT16BE(&cur_fdr->clusters[i][1], 0);*/
30183018            if ((get_UINT16BE(cur_fdr->clusters[i][0]) != 0) || (get_UINT16BE(cur_fdr->clusters[i][1]) != 0))
30193019               return IMGTOOLERR_CORRUPTIMAGE;
30203020         }
r5932r5933
30703070}
30713071
30723072/*
3073   Open an existing file in TIFILES format
3073    Open an existing file in TIFILES format
30743074*/
30753075static int open_file_lvl2_tifiles(imgtool_stream *file_handle, ti99_lvl2_fileref *l2_file)
30763076{
r5932r5933
30893089}
30903090
30913091/*
3092   compute the aphysrec address for a given file physical record (fphysrec)
3092    compute the aphysrec address for a given file physical record (fphysrec)
30933093
3094   l2_img: image where the file is located
3094    l2_img: image where the file is located
30953095*/
30963096static int dsk_fphysrec_to_aphysrec(ti99_lvl2_fileref_dsk *dsk_file, unsigned fphysrec, unsigned *aphysrec)
30973097{
r5932r5933
31273127}
31283128
31293129/*
3130   compute the aphysrec address for a given file physical record (fphysrec)
3130    compute the aphysrec address for a given file physical record (fphysrec)
31313131
3132   l2_img: image where the file is located
3132    l2_img: image where the file is located
31333133*/
31343134static int win_fphysrec_to_aphysrec(ti99_lvl2_fileref_win *win_file, unsigned fphysrec, unsigned *aphysrec)
31353135{
r5932r5933
31963196}
31973197
31983198/*
3199   read a 256-byte physical record from a file
3199    read a 256-byte physical record from a file
32003200*/
32013201static int read_file_physrec(ti99_lvl2_fileref *l2_file, unsigned fphysrec, void *dest)
32023202{
r5932r5933
32393239}
32403240
32413241/*
3242   read a 256-byte physical record from a file
3242    read a 256-byte physical record from a file
32433243*/
32443244static int write_file_physrec(ti99_lvl2_fileref *l2_file, unsigned fphysrec, const void *src)
32453245{
r5932r5933
32823282}
32833283
32843284/*
3285   Write a field in every fdr record associated to a file
3285    Write a field in every fdr record associated to a file
32863286*/
32873287/*static int set_win_fdr_field(ti99_lvl2_fileref *l2_file, size_t offset, size_t size, void *data)
32883288{
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;
32923292
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    }
33043304
3305   return errorcode;
3305    return errorcode;
33063306}*/
33073307
33083308static UINT8 get_file_flags(ti99_lvl2_fileref *l2_file)
r5932r5933
36733673#endif
36743674
36753675/*
3676   Level 3 implements files as a succession of logical records.
3676    Level 3 implements files as a succession of logical records.
36773677
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)
36823682*/
36833683
36843684typedef struct ti99_lvl3_fileref
r5932r5933
36923692
36933693#ifdef UNUSED_FUNCTION
36943694/*
3695   Open a file on level 3.
3695    Open a file on level 3.
36963696
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.
36993699*/
37003700static int open_file_lvl3(ti99_lvl3_fileref *l3_file)
37013701{
r5932r5933
37093709}
37103710
37113711/*
3712   Test a file for EOF
3712    Test a file for EOF
37133713*/
37143714static int is_eof(ti99_lvl3_fileref *l3_file)
37153715{
r5932r5933
37303730}
37313731
37323732/*
3733   Read next record from a file
3733    Read next record from a file
37343734*/
37353735static int read_next_record(ti99_lvl3_fileref *l3_file, void *dest, int *out_reclen)
37363736{
r5932r5933
38103810#endif
38113811
38123812/*
3813   ti99 catalog iterator, used when imgtool reads the catalog
3813    ti99 catalog iterator, used when imgtool reads the catalog
38143814*/
38153815typedef struct dsk_iterator
38163816{
r5932r5933
39763976
39773977
39783978/*
3979   Open a file as a ti99_image (common code).
3979    Open a file as a ti99_image (common code).
39803980*/
39813981static int dsk_image_init(imgtool_image *img, imgtool_stream *f, ti99_img_format img_format)
39823982{
r5932r5933
40174017
40184018   /* read and check subdirectory catalogs */
40194019   /* 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... */
40224022   image->u.dsk.catalogs[0].num_subdirs = 0;
40234023   for (i=0; i<3; i++)
40244024   {
r5932r5933
40744074}
40754075
40764076/*
4077   Open a file as a ti99_image (MESS format).
4077    Open a file as a ti99_image (MESS format).
40784078*/
40794079static imgtoolerr_t dsk_image_init_mess(imgtool_image *image, imgtool_stream *f)
40804080{
r5932r5933
40824082}
40834083
40844084/*
4085   Open a file as a ti99_image (V9T9 format).
4085    Open a file as a ti99_image (V9T9 format).
40864086*/
40874087static imgtoolerr_t dsk_image_init_v9t9(imgtool_image *image, imgtool_stream *f)
40884088{
r5932r5933
40904090}
40914091
40924092/*
4093   Open a file as a ti99_image (PC99 FM format).
4093    Open a file as a ti99_image (PC99 FM format).
40944094*/
40954095static imgtoolerr_t dsk_image_init_pc99_fm(imgtool_image *image, imgtool_stream *f)
40964096{
r5932r5933
40984098}
40994099
41004100/*
4101   Open a file as a ti99_image (PC99 MFM format).
4101    Open a file as a ti99_image (PC99 MFM format).
41024102*/
41034103static imgtoolerr_t dsk_image_init_pc99_mfm(imgtool_image *image, imgtool_stream *f)
41044104{
r5932r5933
41064106}
41074107
41084108/*
4109   Open a file as a ti99_image (harddisk format).
4109    Open a file as a ti99_image (harddisk format).
41104110*/
41114111static imgtoolerr_t win_image_init(imgtool_image *img, imgtool_stream *f)
41124112{
r5932r5933
41624162}
41634163
41644164/*
4165   close a ti99_image
4165    close a ti99_image
41664166*/
41674167static void ti99_image_exit(imgtool_image *img)
41684168{
r5932r5933
41724172}
41734173
41744174/*
4175   get basic information on a ti99_image
4175    get basic information on a ti99_image
41764176
4177   Currently returns the volume name
4177    Currently returns the volume name
41784178*/
41794179static void ti99_image_info(imgtool_image *img, char *string, size_t len)
41804180{
r5932r5933
41874187}
41884188
41894189/*
4190   Open the disk catalog for enumeration
4190    Open the disk catalog for enumeration
41914191*/
41924192static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path)
41934193{
r5932r5933
42044204}
42054205
42064206/*
4207   Enumerate disk catalog next entry
4207    Enumerate disk catalog next entry
42084208*/
42094209static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
42104210{
r5932r5933
42604260
42614261         /* recurse subdirectory */
42624262         iter->listing_subdirs = 0;   /* no need to list subdirs as only the
4263                              root dir has subdirs in DSK format */
4263                                        root dir has subdirs in DSK format */
42644264         iter->level = 1;
42654265         iter->cur_catalog = &iter->image->u.dsk.catalogs[iter->index[0]+1];
42664266         iter->index[iter->level] = 0;
r5932r5933
43084308}
43094309
43104310/*
4311   Open the disk catalog for enumeration
4311    Open the disk catalog for enumeration
43124312*/
43134313static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path)
43144314{
r5932r5933
43284328}
43294329
43304330/*
4331   Enumerate disk catalog next entry
4331    Enumerate disk catalog next entry
43324332*/
43334333static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
43344334{
r5932r5933
44484448}
44494449
44504450/*
4451   Compute free space on disk image (in AUs)
4451    Compute free space on disk image (in AUs)
44524452*/
44534453static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *size)
44544454{
r5932r5933
44704470}
44714471
44724472/*
4473   Extract a file from a ti99_image.  The file is saved in tifile format.
4473    Extract a file from a ti99_image.  The file is saved in tifile format.
44744474*/
44754475static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf)
44764476{
r5932r5933
45304530
45314531   get_file_creation_date(&src_file, &date_time);
45324532   /*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);*/
45354535   set_file_creation_date(&dst_file, date_time);
45364536
45374537   get_file_update_date(&src_file, &date_time);
45384538   /*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);*/
45414541   set_file_update_date(&dst_file, date_time);
45424542
45434543   if (stream_write(destf, & dst_file.u.tifiles.hdr, 128) != 128)
r5932r5933
46084608}
46094609
46104610/*
4611   Add a file to a ti99_image.  The file must be in tifile format.
4611    Add a file to a ti99_image.  The file must be in tifile format.
46124612*/
46134613static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions)
46144614{
r5932r5933
46954695
46964696   get_file_creation_date(&src_file, &date_time);
46974697   /*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);*/
47004700   set_file_creation_date(&dst_file, date_time);
47014701
47024702   get_file_update_date(&src_file, &date_time);
47034703   /*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);*/
47064706   set_file_update_date(&dst_file, date_time);
47074707
47084708   /* alloc data physrecs */
r5932r5933
48304830}
48314831
48324832/*
4833   Delete a file from a ti99_image.
4833    Delete a file from a ti99_image.
48344834*/
48354835static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const char *fpath)
48364836{
r5932r5933
49194919         while (i<=cluster_lastfphysrec)
49204920         {
49214921            /* the condition below is an error, but it should not prevent
4922            us from deleting the file */
4922                us from deleting the file */
49234923            if (cur_AU >= image->AUformat.totAUs)
49244924               /*return IMGTOOLERR_CORRUPTIMAGE;*/
49254925               break;
r5932r5933
49334933         cluster_index++;
49344934      }
49354935      /* the condition below is an error, but it should not prevent us from
4936      deleting the file */
4936        deleting the file */
49374937      /*if (i<fphysrecs)
4938         return IMGTOOLERR_CORRUPTIMAGE;*/
4938            return IMGTOOLERR_CORRUPTIMAGE;*/
49394939
49404940      /* free fdr AU */
49414941      cur_AU = catalog->files[catalog_index].fdr_ptr / image->AUformat.physrecsperAU;
r5932r5933
50435043   {
50445044      /* check integrity of FDR sibling chain, and go to last sibling */
50455045      /* 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 */
50485048      {
50495049         int pastendoflist_flag;
50505050         unsigned prevfdr_aphysrec;
r5932r5933
51145114               while (cur_AU<=end_AU)
51155115               {
51165116                  /* the condition below is an error, but it should not prevent
5117                  us from deleting the file */
5117                        us from deleting the file */
51185118                  if (cur_AU >= image->AUformat.totAUs)
51195119                     /*return IMGTOOLERR_CORRUPTIMAGE;*/
51205120                     break;
r5932r5933
51825182}
51835183
51845184/*
5185   Create a blank ti99_image (common code).
5185    Create a blank ti99_image (common code).
51865186
5187   Supports MESS and V9T9 formats only
5187    Supports MESS and V9T9 formats only
51885188*/
51895189static imgtoolerr_t dsk_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions, ti99_img_format img_format)
51905190{
r5932r5933
53045304}
53055305
53065306/*
5307   Create a blank ti99_image (MESS format).
5307    Create a blank ti99_image (MESS format).
53085308*/
53095309static imgtoolerr_t dsk_image_create_mess(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions)
53105310{
r5932r5933
53125312}
53135313
53145314/*
5315   Create a blank ti99_image (V9T9 format).
5315    Create a blank ti99_image (V9T9 format).
53165316*/
53175317static imgtoolerr_t dsk_image_create_v9t9(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions)
53185318{
src/mess/tools/imgtool/modules/pc_hard.c
r5932r5933
11/****************************************************************************
22
3   pc_hard.c
3    pc_hard.c
44
5   PC hard drives
5    PC hard drives
66
77*****************************************************************************
88
r5932r5933
1515     462      16  Partion #2 info
1616     478      16  Partion #3 info
1717     494      16  Partion #4 info
18    510       2  Magic bytes (0x55 0xAA)
18    510       2  Magic bytes (0x55 0xAA)
1919
2020
2121  Partition info format:
r5932r5933
2323  Offset  Length  Description
2424  ------  ------  -----------
2525       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
4848
4949****************************************************************************/
5050
src/mess/tools/imgtool/modules/fmsx_cas.c
r5932r5933
77#include "utils.h"
88
99/*
10   MSX module
10    MSX module
1111
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.
1414*/
1515
1616typedef struct {
src/mess/tools/imgtool/modules/rom16.c
r5932r5933
4343   rom16_image_beginenum,         /* begin enumeration */
4444   rom16_image_nextenum,         /* enumerate next */
4545   rom16_image_closeenum,         /* close enumeration */
46   NULL, //crt_image_freespace,         /* free space on image */
46   NULL, //crt_image_freespace,            /* free space on image */
4747   rom16_image_readfile,         /* read file */
4848   rom16_image_writefile,         /* write file */
4949   NULL,         /* delete file */
50   NULL,//   rom16_image_create,            /* create image */
50   NULL,// rom16_image_create,             /* create image */
5151   NULL,
5252   NULL,
5353   NULL,                     /* file options */
r5932r5933
209209#if 0
210210static int rom16_image_create(imgtool_stream *f, const ResolvedOption *options_)
211211{
212//   if (options_->label) strcpy(header.name, options->label);
212//  if (options_->label) strcpy(header.name, options->label);
213213   return (stream_write(f, &header, sizeof(crt_header)) == sizeof(crt_header))
214214      ? 0 : IMGTOOLERR_WRITEERROR;
215215}
src/mess/tools/imgtool/modules/os9.c
r5932r5933
11/****************************************************************************
22
3   os9.c
3    os9.c
44
5   CoCo OS-9 disk images
5    CoCo OS-9 disk images
66
77****************************************************************************/
88
r5932r5933
236236
237237/*-------------------------------------------------
238238    os9_decode_file_header - reads a file/directory
239   entry from an LSN, and decodes it
239    entry from an LSN, and decodes it
240240-------------------------------------------------*/
241241
242242static imgtoolerr_t os9_decode_file_header(imgtool_image *image,
r5932r5933
401401      }
402402
403403      /* keep in mind that the sector_map might not parallel our expected
404      * current LSN count; we should tolerate this abnormality */
404        * current LSN count; we should tolerate this abnormality */
405405      current_lsn_count = lsn;
406406
407407      while(current_lsn_count > new_lsn_count)
r5932r5933
477477
478478/*-------------------------------------------------
479479    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
482482-------------------------------------------------*/
483483
484484static imgtoolerr_t os9_lookup_path(imgtool_image *img, const char *path,
r5932r5933
551551      if (index >= dir_size)
552552      {
553553         /* if we're not creating, or we are creating but we have not fully
554          * transversed the directory, error out */
554            * transversed the directory, error out */
555555         if (!create || path[strlen(path) + 1])
556556         {
557557            err = IMGTOOLERR_PATHNOTFOUND;
r5932r5933
914914         pick_string(dir_entry, 0, 28, filename);
915915
916916         /* 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 ".." */
919919         switch(os9enum->index)
920920         {
921921            case 0:
src/mess/tools/imgtool/modules/amiga.c
r5932r5933
11/****************************************************************************
22
3   amiga.c
3    amiga.c
44
5   Amiga floppies
5    Amiga floppies
66
77****************************************************************************/
88
r5932r5933
10531053   }
10541054
10551055   /* if we haven't found the right filename but there are linked entries,
1056    * walk up the chain */
1056    * walk up the chain */
10571057   if ((*cmp)(name, path) != 0 && hash_chain != 0)
10581058   {
10591059      *prev_block = start_block;
src/mess/tools/imgtool/modules/cybiko.c
r5932r5933
11/*
22
3   Cybiko File System
3    Cybiko File System
44
5   (c) 2007 Tim Schuerewegen
5    (c) 2007 Tim Schuerewegen
66
77*/
88
r5932r5933
541541OPTION_GUIDE_END
542542
543543//OPTION_GUIDE_START( cybiko_image_writefile_optguide )
544//   OPTION_INT( 'B', "boot", "Boot Flag" )
544//  OPTION_INT( 'B', "boot", "Boot Flag" )
545545//OPTION_GUIDE_END
546546
547547void cybiko_get_info( const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info)
r5932r5933
551551      // --- the following bits of info are returned as 64-bit signed integers ---
552552      case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES          : info->i = sizeof( cybiko_file_system); break;
553553      case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES      : info->i = sizeof( cybiko_iter); break;
554//      case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME     : info->i = 1; break;
554//      case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME     : info->i = 1; break;
555555      case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME : info->i = 1; break;
556//      case IMGTOOLINFO_INT_BLOCK_SIZE                 : info->i = 264; break;
556//      case IMGTOOLINFO_INT_BLOCK_SIZE                 : info->i = 264; break;
557557      // --- the following bits of info are returned as pointers to data or functions ---
558558      case IMGTOOLINFO_PTR_OPEN        : info->open        = cybiko_image_open; break;
559559      case IMGTOOLINFO_PTR_CREATE      : info->create      = cybiko_image_create; break;
r5932r5933
566566      case IMGTOOLINFO_PTR_WRITE_FILE  : info->write_file  = cybiko_image_write_file; break;
567567      case IMGTOOLINFO_PTR_DELETE_FILE : info->delete_file = cybiko_image_delete_file; break;
568568      case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE : info->createimage_optguide = cybiko_image_createimage_optguide; break;
569//      case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE   : info->writefile_optguide   = cybiko_image_writefile_optguide; break;
569//      case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE   : info->writefile_optguide   = cybiko_image_writefile_optguide; break;
570570      // --- the following bits of info are returned as NULL-terminated strings ---
571571      case IMGTOOLINFO_STR_NAME            : strcpy( info->s = imgtool_temp_str(), "cybiko"); break;
572572      case IMGTOOLINFO_STR_DESCRIPTION     : strcpy( info->s = imgtool_temp_str(), "Cybiko File System"); break;
r5932r5933
574574      case IMGTOOLINFO_STR_FILE_EXTENSIONS : strcpy( info->s = imgtool_temp_str(), "bin,nv"); break;
575575      case IMGTOOLINFO_STR_EOLN            : strcpy( info->s = imgtool_temp_str(), "\r\n"); break;
576576      case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC : strcpy( info->s = imgtool_temp_str(), "F[0]-2"); break;
577//      case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC   : strcpy( info->s = imgtool_temp_str(), "B[0]-1"); break;
577//      case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC   : strcpy( info->s = imgtool_temp_str(), "B[0]-1"); break;
578578   }
579579}
src/mess/tools/imgtool/modules/thomson.c
r5932r5933
8787     - bytes 08-0A: file extension, padedd with whitespaces
8888     - byte  0B:    file type
8989                    . 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)
9393     - byte  0C:    format flag
94           . 00 = binary (tokenized)
94            . 00 = binary (tokenized)
9595                    . ff = ASCII
9696     - byte  0D:    first block
9797     - bytes 0E-0F: bytes used in the last sector
r5932r5933
14381438      if ( stream_read( org, &c, 1 ) < 1 ) break;
14391439      if ( c == 0 ) {
14401440   /* 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    */
14461446   if ( linelength > 256 ) break;
14471447      }
14481448      else if ( c == 0xff && ! in_str ) in_fun = 1; /* function prefix */
src/mess/tools/imgtool/modules/crt.c
r5932r5933
371371static int crt_image_create(const imgtool_module *mod, imgtool_stream *f, const ResolvedOption *_options);
372372
373373/*
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
377377*/
378378
379379static const struct OptionTemplate c64crt_fileeopts[] =
r5932r5933
416416   crt_image_beginenum,         /* begin enumeration */
417417   crt_image_nextenum,         /* enumerate next */
418418   crt_image_closeenum,         /* close enumeration */
419   NULL, //crt_image_freespace,         /* free space on image */
419   NULL, //crt_image_freespace,            /* free space on image */
420420   crt_image_readfile,         /* read file */
421421   crt_image_writefile,         /* write file */
422422   crt_image_deletefile,         /* delete file */
src/mess/tools/imgtool/modules/macbin.c
r5932r5933
11/****************************************************************************
22
3   macbin.c
3    macbin.c
44
5   MacBinary filter for use with Mac and ProDOS drivers
5    MacBinary filter for use with Mac and ProDOS drivers
66
77*****************************************************************************
88
r5932r5933
1111  Offset  Length  Description
1212  ------  ------  -----------
1313       0       1  [I]   Magic byte (0x00)
14      1      64  [I]   File name (Pascal String)
14       1      64  [I]   File name (Pascal String)
1515      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
2929     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
3838
39   For more information, consult http://www.lazerware.com/formats/macbinary.html
39    For more information, consult http://www.lazerware.com/formats/macbinary.html
4040
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
4444
4545*****************************************************************************/
4646
src/mess/tools/imgtool/modules/ti990hd.c
r5932r5933
11/*
2   Handlers for ti990 disk images
2    Handlers for ti990 disk images
33
4   Disk images are in MESS format.
4    Disk images are in MESS format.
55
6   Raphael Nabet, 2003
6    Raphael Nabet, 2003
77*/
88
99#include <stdio.h>
r5932r5933
7272}
7373
7474/*
75   disk image header
75    disk image header
7676*/
7777typedef struct disk_image_header
7878{
r5932r5933
8888};
8989
9090/*
91   Disk structure:
91    Disk structure:
9292
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.
101101*/
102102
103103/*
104   SC0 record (Disk sector 0)
104    SC0 record (Disk sector 0)
105105*/
106106typedef struct ti990_sc0
107107{
r5932r5933
144144   UINT16BE   wff;         /* WCS flag switch */
145145   UINT16BE   vif;         /* track 1 select flag (whatever it means) volume information copied flag */
146146   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 */
150150   UINT16BE   dct;         /* disk creation time */
151151   UINT16BE   fsf;         /* * * RESERVED * * */
152152   /* SCOSIZ = >AA */
153153} ti990_sc0;
154154
155155/*
156   DOR (Directory Overhead Record)
156    DOR (Directory Overhead Record)
157157*/
158158typedef struct ti990_dor
159159{
r5932r5933
169169} ti990_dor;
170170
171171/*
172   file flags found in fdr
172    file flags found in fdr
173173*/
174174enum
175175{
r5932r5933
198198};
199199
200200/*
201   ACE subrecord found in FDR
201    ACE subrecord found in FDR
202202*/
203203typedef struct ti990_ace
204204{
r5932r5933
207207} ti990_ace;
208208
209209/*
210   FDR record
210    FDR record
211211*/
212212typedef struct ti990_fdr
213213{
r5932r5933
248248} ti990_fdr;
249249
250250/*
251   ADR record: variant of FDR for Aliases
251    ADR record: variant of FDR for Aliases
252252
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.
255255*/
256256typedef struct ti990_adr
257257{
r5932r5933
271271} ti990_adr;
272272
273273/*
274   CDR record: variant of FDR for Channel
274    CDR record: variant of FDR for Channel
275275
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.
278278*/
279279typedef struct ti990_cdr
280280{
r5932r5933
300300} ti990_cdr;
301301
302302/*
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.
305305
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.
309309*/
310310typedef union directory_entry
311311{
r5932r5933
317317#if 0
318318
319319/*
320   tifile header: stand-alone file
320    tifile header: stand-alone file
321321*/
322322typedef struct tifile_header
323323{
r5932r5933
335335
336336
337337/*
338   catalog entry (used for in-memory catalog)
338    catalog entry (used for in-memory catalog)
339339*/
340340typedef struct catalog_entry
341341{
r5932r5933
346346#endif
347347
348348/*
349   Disk geometry
349    Disk geometry
350350*/
351351typedef struct ti990_geometry
352352{
r5932r5933
354354} ti990_geometry;
355355
356356/*
357   Physical sector address
357    Physical sector address
358358*/
359359typedef struct ti990_phys_sec_address
360360{
r5932r5933
364364} ti990_phys_sec_address;
365365
366366/*
367   ti99 disk image descriptor
367    ti99 disk image descriptor
368368*/
369369typedef struct ti990_image
370370{
r5932r5933
374374} ti990_image;
375375
376376/*
377   ti990 catalog iterator, used when imgtool reads the catalog
377    ti990 catalog iterator, used when imgtool reads the catalog
378378*/
379379typedef struct ti990_iterator
380380{
r5932r5933
410410};
411411
412412static OPTION_GUIDE_START( ti990_create_optionguide )
413   /*OPTION_STRING(ti990_createopts_volname, "label",   "Volume name" )*/
413   /*OPTION_STRING(ti990_createopts_volname, "label",  "Volume name" )*/
414414   OPTION_INT(ti990_createopts_cylinders, "cylinders", "Cylinders" )
415415   OPTION_INT(ti990_createopts_heads, "heads", "Heads" )
416416   OPTION_INT(ti990_createopts_sectors, "sectors", "Sectors" )
r5932r5933
449449
450450#ifdef UNUSED_FUNCTION
451451/*
452   Convert a C string to a 8-character file name (padded with spaces if necessary)
452    Convert a C string to a 8-character file name (padded with spaces if necessary)
453453*/
454454static void str_to_fname(char dst[8], const char *src)
455455{
r5932r5933
476476#endif
477477
478478/*
479   Convert a 8-character file name to a C string (removing trailing spaces if necessary)
479    Convert a 8-character file name to a C string (removing trailing spaces if necessary)
480480*/
481481static void fname_to_str(char *dst, const char src[8], int n)
482482{
r5932r5933
510510#endif
511511
512512/*
513   Convert physical sector address to offset
513    Convert physical sector address to offset
514514*/
515515static unsigned phys_address_to_offset(const ti990_phys_sec_address *address, const ti990_geometry *geometry)
516516{
r5932r5933
523523}
524524
525525/*
526   Read one sector from a disk image
526    Read one sector from a disk image
527527
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
533533*/
534534static int read_sector_physical_len(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest, int len)
535535{
r5932r5933
552552
553553#ifdef UNUSED_FUNCTION
554554/*
555   Read one sector from a disk image
555    Read one sector from a disk image
556556
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
561561*/
562562static int read_sector_physical(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest)
563563{
r5932r5933
566566#endif
567567
568568/*
569   Write one sector to a disk image
569    Write one sector to a disk image
570570
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
576576*/
577577static int write_sector_physical_len(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src, int len)
578578{
r5932r5933
603603
604604#ifdef UNUSED_FUNCTION
605605/*
606   Write one sector to a disk image
606    Write one sector to a disk image
607607
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
612612*/
613613static int write_sector_physical(imgtool_stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src)
614614{
r5932r5933
617617#endif
618618
619619/*
620   Convert logical sector address to physical sector address
620    Convert logical sector address to physical sector address
621621*/
622622static void log_address_to_phys_address(int secnum, const ti990_geometry *geometry, ti990_phys_sec_address *address)
623623{
r5932r5933
628628}
629629
630630/*
631   Read one sector from a disk image
631    Read one sector from a disk image
632632
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
638638*/
639639static int read_sector_logical_len(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest, int len)
640640{
r5932r5933
648648
649649#ifdef UNUSED_FUNCTION
650650/*
651   Read one sector from a disk image
651    Read one sector from a disk image
652652
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
657657*/
658658static int read_sector_logical(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest)
659659{
r5932r5933
662662#endif
663663
664664/*
665   Write one sector to a disk image
665    Write one sector to a disk image
666666
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
672672*/
673673static int write_sector_logical_len(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, const void *src, int len)
674674{
r5932r5933
681681}
682682
683683/*
684   Write one sector to a disk image
684    Write one sector to a disk image
685685
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
690690*/
691691static int write_sector_logical(imgtool_stream *file_handle, int secnum, const ti990_geometry *geometry, const void *src)
692692{
r5932r5933
700700
701701#ifdef UNUSED_FUNCTION
702702/*
703   Find the catalog entry and fdr record associated with a file name
703    Find the catalog entry and fdr record associated with a file name
704704
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)
712712*/
713713static 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)
714714{
r5932r5933
836836
837837#if 0
838838/*
839   Allocate one sector on disk, for use as a fdr record
839    Allocate one sector on disk, for use as a fdr record
840840
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
843843*/
844844static int alloc_fdr_sector(ti99_image *image, int *fdr_secnum)
845845{
r5932r5933
862862}
863863
864864/*
865   Extend a file with nb_alloc_sectors extra sectors
865    Extend a file with nb_alloc_sectors extra sectors
866866
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
870870*/
871871static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sectors)
872872{
r5932r5933
10321032}
10331033
10341034/*
1035   Allocate a new (empty) file
1035    Allocate a new (empty) file
10361036*/
10371037static int new_file(ti99_image *image, char filename[10], int *out_fdr_secnum/*, ti99_fdr *fdr,*/)
10381038{
r5932r5933
10851085}
10861086
10871087/*
1088   Compare two (possibly empty) catalog entry for qsort
1088    Compare two (possibly empty) catalog entry for qsort
10891089*/
10901090static int qsort_catalog_compare(const void *p1, const void *p2)
10911091{
r5932r5933
11041104#endif
11051105
11061106/*
1107   Open a file as a ti990_image.
1107    Open a file as a ti990_image.
11081108*/
11091109static imgtoolerr_t ti990_image_init(imgtool_image *img, imgtool_stream *f)
11101110{
r5932r5933
11601160}
11611161
11621162/*
1163   close a ti990_image
1163    close a ti990_image
11641164*/
11651165static void ti990_image_exit(imgtool_image *img)
11661166{
r5932r5933
11691169}
11701170
11711171/*
1172   get basic information on a ti990_image
1172    get basic information on a ti990_image
11731173
1174   Currently returns the volume name
1174    Currently returns the volume name
11751175*/
11761176static void ti990_image_info(imgtool_image *img, char *string, size_t len)
11771177{
r5932r5933
11841184}
11851185
11861186/*
1187   Open the disk catalog for enumeration
1187    Open the disk catalog for enumeration
11881188*/
11891189static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path)
11901190{
r5932r5933
12101210}
12111211
12121212/*
1213   Enumerate disk catalog next entry
1213    Enumerate disk catalog next entry
12141214*/
12151215static imgtoolerr_t ti990_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
12161216{
r5932r5933
13901390         iter->nrc[iter->level] = get_UINT16BE(dor.nrc)/*get_UINT32BE(iter->fdr[iter->level-1].eom)-1*/;
13911391         iter->index[iter->level] = 0;
13921392         /*if (get_UINT16BE(dor.nrc) != (get_UINT32BE(iter->xdr[iter->level-1].fdr.eom)-1))
1393            printf("hiha");*/
1393                printf("hiha");*/
13941394      }
13951395
13961396      /* go to upper level if applicable */
r5932r5933
14021402}
14031403
14041404/*
1405   Free enumerator
1405    Free enumerator
14061406*/
14071407static void ti990_image_closeenum(imgtool_directory *enumeration)
14081408{
14091409}
14101410
14111411/*
1412   Compute free space on disk image (in ADUs)
1412    Compute free space on disk image (in ADUs)
14131413*/
14141414static imgtoolerr_t ti990_image_freespace(imgtool_partition *partition, UINT64 *size)
14151415{
r5932r5933
14491449
14501450#ifdef UNUSED_FUNCTION
14511451/*
1452   Extract a file from a ti990_image.
1452    Extract a file from a ti990_image.
14531453*/
14541454static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const char *fpath, imgtool_stream *destf)
14551455{
r5932r5933
15461546}
15471547
15481548/*
1549   Add a file to a ti990_image.
1549    Add a file to a ti990_image.
15501550*/
15511551static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const char *fpath, imgtool_stream *sourcef, option_resolution *writeoptions)
15521552{
r5932r5933
16701670}
16711671
16721672/*
1673   Delete a file from a ti990_image.
1673    Delete a file from a ti990_image.
16741674*/
16751675static imgtoolerr_t ti990_image_deletefile(imgtool_partition *partition, const char *fpath)
16761676{
r5932r5933
17601760#endif
17611761
17621762/*
1763   Create a blank ti990_image.
1763    Create a blank ti990_image.
17641764*/
17651765static imgtoolerr_t ti990_image_create(imgtool_image *image, imgtool_stream *f, option_resolution *createoptions)
17661766{
src/mess/tools/imgtool/modules/nccard.c
r5932r5933
4444)
4545
4646/*
47   NC PCMCIA RAM Card uses a FAT-like filesystem
47    NC PCMCIA RAM Card uses a FAT-like filesystem
4848
49   Blocks are fixed at 256 bytes in size.
49    Blocks are fixed at 256 bytes in size.
5050
51   Block 0 and Block 1 are reserved for a boot program.
51    Block 0 and Block 1 are reserved for a boot program.
5252
53   Block 2 is reserved for root directory.
53    Block 2 is reserved for root directory.
5454
55   Block 3..(3+num_fat_blocks-1) are reserved for fat table.
55    Block 3..(3+num_fat_blocks-1) are reserved for fat table.
5656
57   Block (3+num_fat_blocks).. are used for data storage.
57    Block (3+num_fat_blocks).. are used for data storage.
5858
59   The FAT table uses two bytes for each entry.
59    The FAT table uses two bytes for each entry.
6060
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.
6363
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.
6969
70   0x0fffe indicates a reserved block.
70    0x0fffe indicates a reserved block.
7171
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??
7575
76   Maximum size of a file on the PCMCIA Ram card is 65536 bytes.
76    Maximum size of a file on the PCMCIA Ram card is 65536 bytes.
7777*/
7878struct nc_card_dir_entry
7979{
r5932r5933
9090   /* format unknown */
9191   unsigned char packed_date[4];
9292   /* 2-byte block index. first block used by file, other blocks
93   found in fat table */
93    found in fat table */
9494   unsigned char first_block_low;
9595   unsigned char first_block_high;
9696   /* unused?? */
r5932r5933
232232   }
233233
234234   /* out of entries within current blocks occupied by directory.
235   try to expand directory by one more block */
235    try to expand directory by one more block */
236236
237237   current_block = memcard_fat_get_free_block(memcard);
238238
r5932r5933
259259
260260      /* clear block */
261261      /* only really necessary to clear first byte of each dir entry - but I'll clear
262      it all to give decent compressable cards */
262        it all to give decent compressable cards */
263263      memset(&memcard->memcard_data[block_offset], 0, NC_BLOCK_SIZE);
264264
265265      /* setup fat */
src/mess/tools/imgtool/modules/lynx.c
r5932r5933
1717
1818   count of entries
1919    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
2323
2424   data for the entries
2525    filled up to 254 byte blocks
r5932r5933
6565   0,                           /* flags */
6666   lynx_image_init,            /* init function */
6767   lynx_image_exit,            /* exit function */
68   NULL,//lynx_image_info,      /* info function */
68   NULL,//lynx_image_info,     /* info function */
6969   lynx_image_beginenum,         /* begin enumeration */
7070   lynx_image_nextenum,         /* enumerate next */
7171   lynx_image_closeenum,         /* close enumeration */
src/mess/tools/imgtool/modules/d64.c
r5932r5933
850850   ent->eof=0;
851851
852852   while ((iter->track >= 1) && (iter->track <= iter->image->tracks)) //safer
853//   while (iter->track != 0)
853//  while (iter->track != 0)
854854   {
855855      pos = iter->image->get_offset(iter->track, iter->sector);
856856      for (; iter->offset<256; iter->offset += 32)
src/mess/tools/imgtool/modules/macutil.c
r5932r5933
11/****************************************************************************
22
3   macutil.c
3    macutil.c
44
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
77
88*****************************************************************************/
99
src/mess/tools/imgtool/modules/mac.c
r5932r5933
11/****************************************************************************
22
3   mac.c
3    mac.c
44
5   Handlers for Classic MacOS images (MFS and HFS formats).
5    Handlers for Classic MacOS images (MFS and HFS formats).
66
7   Raphael Nabet, 2003
7    Raphael Nabet, 2003
88
9   TODO:
10   * add support for HFS write
9    TODO:
10    * add support for HFS write
1111
1212*****************************************************************************
1313
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).
4646
47   Organization of an MFS volume:
47    Organization of an MFS volume:
4848
49   Logical      Contents                           Allocation block
50   block
49    Logical     Contents                                    Allocation block
50    block
5151
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
6262
6363
64   Master Directory Block:
64    Master Directory Block:
6565
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       ...
7575
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
8787
8888*****************************************************************************/
8989
r5932r5933
100100#include "formats/ap_dsk35.h"
101101
102102/* 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) */
105105#define BTREE_CHECKS 1
106106/* if 1, check consistency of tag data when we are at risk of corrupting the
107   disk (file write and allocation) */
107    disk (file write and allocation) */
108108#define TAG_CHECKS 1
109109/* if 1, check consistency of tag data when reading files (not recommended
110   IMHO) */
110    IMHO) */
111111#define TAG_EXTRA_CHECKS 0
112112
113113#if 0
r5932r5933
166166}
167167
168168/*
169   Macintosh string: first byte is length
169    Macintosh string: first byte is length
170170*/
171171typedef UINT8 mac_str27[28];
172172typedef UINT8 mac_str31[32];
r5932r5933
174174typedef UINT8 mac_str255[256];
175175
176176/*
177   Macintosh type/creator code: 4 char value
177    Macintosh type/creator code: 4 char value
178178*/
179179typedef UINT32BE mac_type;
180180
181181/*
182   point record, with the y and x coordinates
182    point record, with the y and x coordinates
183183*/
184184typedef struct mac_point
185185{
r5932r5933
188188} mac_point;
189189
190190/*
191   rect record, with the corner coordinates
191    rect record, with the corner coordinates
192192*/
193193typedef struct mac_rect
194194{
r5932r5933
199199} mac_rect;
200200
201201/*
202   FInfo (Finder file info) record
202    FInfo (Finder file info) record
203203*/
204204typedef struct mac_FInfo
205205{
r5932r5933
208208   UINT16BE  flags;      /* Finder flags */
209209   mac_point location;      /* file's location in window */
210210                        /* 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 */
213213   UINT16BE  fldr;         /* MFS: window that contains file */
214214                        /* -3: trash */
215215                        /* -2: desktop */
r5932r5933
217217                        /* 0: disk window ("root") */
218218                        /* > 0: specific folder, index of FOBJ resource??? */
219219                        /* The FOBJ resource contains some folder info;
220                        the name of the resource is the folder name. */
220                                the name of the resource is the folder name. */
221221                     /* 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) */
224224} mac_FInfo;
225225
226226/*
227   FXInfo (Finder extended file info) record -- not found in MFS
227    FXInfo (Finder extended file info) record -- not found in MFS
228228*/
229229typedef struct mac_FXInfo
230230{
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 */
234234                     /* System 8: Reserved (set to 0) */
235235   UINT16BE reserved[3];   /* Reserved (set to 0) */
236236   UINT8    script;      /* System 7: if high-bit is set, the script code
237                        for displaying the file name; ignored otherwise */
237                                for displaying the file name; ignored otherwise */
238238                     /* System 8: Extended flags MSB(?) */
239239   UINT8    XFlags;      /* Extended flags */
240240   UINT16BE comment;      /* System 7: Comment ID if high-bit is clear */
241241                     /* System 8: Reserved (set to 0) */
242242   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) */
246246} mac_FXInfo;
247247
248248/*
249   DInfo (Finder folder info) record -- not found in MFS
249    DInfo (Finder folder info) record -- not found in MFS
250250*/
251251typedef struct mac_DInfo
252252{
r5932r5933
254254   UINT16BE flags;         /* Finder flags, e.g. kIsInvisible, kNameLocked, etc */
255255   mac_point location;      /* Location of the folder in parent window */
256256                        /* 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 */
259259   UINT16BE view;         /* System 7: The manner in which folders are
260                        displayed */
260                                displayed */
261261                     /* System 8: reserved (set to 0) */
262262} mac_DInfo;
263263
264264/*
265   DXInfo (Finder extended folder info) record -- not found in MFS
265    DXInfo (Finder extended folder info) record -- not found in MFS
266266*/
267267typedef struct mac_DXInfo
268268{
r5932r5933
270270   UINT32BE openChain;      /* System 7: chain of directory IDs for open folders */
271271                     /* System 8: reserved (set to 0) */
272272   UINT8    script;      /* System 7: if high-bit is set, the script code
273                        for displaying the folder name; ignored otherwise */
273                                for displaying the folder name; ignored otherwise */
274274                     /* System 8: Extended flags MSB(?) */
275275   UINT8    XFlags;      /* Extended flags */
276276   UINT16BE comment;      /* System 7: Comment ID if high-bit is clear */
277277                     /* System 8: Reserved (set to 0) */
278278   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) */
282282} mac_DXInfo;
283283
284284/*
285   defines for FInfo & DInfo flags fields
285    defines for FInfo & DInfo flags fields
286286*/
287287enum
288288{
r5932r5933
302302                                 /* resource */
303303                              /* Otherwise, set to 0. */
304304   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. */
308308                              /* System 7? 8?: Clear if the file contains desktop database */
309309                                 /* resources ('BNDL', 'FREF', 'open', 'kind'...) */
310310                                 /* that have not been added yet. Set only by the Finder */
311311                                 /* Reserved for folders - make sure this bit is cleared for folders */
312312
313313   /* 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. */
316316
317317   fif_hasCustomIcon      = 0x0400,   /* (files and folders) */
318318   fif_isStationery      = 0x0800,   /* System 7: (files only) */
r5932r5933
323323};
324324
325325/*
326   mac_to_c_strncpy()
326    mac_to_c_strncpy()
327327
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'.
331331
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)
335335*/
336336static void mac_to_c_strncpy(char *dst, int n, UINT8 *src)
337337{
r5932r5933
375375}
376376
377377/*
378   c_to_mac_strncpy()
378    c_to_mac_strncpy()
379379
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'.
383383
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
387387*/
388388static void c_to_mac_strncpy(mac_str255 dst, const char *src, int n)
389389{
r5932r5933
421421}
422422
423423/*
424   mac_strcmp()
424    mac_strcmp()
425425
426   Compare two macintosh strings
426    Compare two macintosh strings
427427
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
430430
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.
433433*/
434434/*static int mac_strcmp(const UINT8 *s1, const UINT8 *s2)
435435{
436   size_t common_len;
436    size_t common_len;
437437
438   common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0];
438    common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0];
439439
440   return memcmp(s1+1, s2+1, common_len) || ((int)s1[0] - s2[0]);
440    return memcmp(s1+1, s2+1, common_len) || ((int)s1[0] - s2[0]);
441441}*/
442442
443443/*
444   mac_stricmp()
444    mac_stricmp()
445445
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.
448448
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.
452452
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
455455
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.
458458
459459Known 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.)
465465
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.)
471471
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.
480480*/
481481
482482static int mac_stricmp(const UINT8 *s1, const UINT8 *s2)
483483{
484484   static const unsigned char mac_char_sort_table[256] =
485485   {
486   /*   \x00   \x01   \x02   \x03   \x04   \x05   \x06   \x07 */
486   /*  \x00    \x01    \x02    \x03    \x04    \x05    \x06    \x07 */
487487      0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
488   /*   \x08   \x09   \x0a   \x0b   \x0c   \x0d   \x0e   \x0f */
488   /*  \x08    \x09    \x0a    \x0b    \x0c    \x0d    \x0e    \x0f */
489489      0x08,   0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
490   /*   \x10   \x11   \x12   \x13   \x14   \x15   \x16   \x17 */
490   /*  \x10    \x11    \x12    \x13    \x14    \x15    \x16    \x17 */
491491      0x10,   0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
492   /*   \x18   \x19   \x1a   \x1b   \x1c   \x1d   \x1e   \x1f */
492   /*  \x18    \x19    \x1a    \x1b    \x1c    \x1d    \x1e    \x1f */
493493      0x18,   0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
494   /*   \x20   \x21   \x22   \x23   \x24   \x25   \x26   \x27 */
494   /*  \x20    \x21    \x22    \x23    \x24    \x25    \x26    \x27 */
495495      0x20,   0x21,   0x22,   0x27,   0x28,   0x29,   0x2a,   0x2b,
496   /*   \x28   \x29   \x2a   \x2b   \x2c   \x2d   \x2e   \x2f */
496   /*  \x28    \x29    \x2a    \x2b    \x2c    \x2d    \x2e    \x2f */
497497      0x2e,   0x2f,   0x30,   0x31,   0x32,   0x33,   0x34,   0x35,
498   /*   \x30   \x31   \x32   \x33   \x34   \x35   \x36   \x37 */
498   /*  \x30    \x31    \x32    \x33    \x34    \x35    \x36    \x37 */
499499      0x36,   0x37,   0x38,   0x39,   0x3a,   0x3b,   0x3c,   0x3d,
500   /*   \x38   \x39   \x3a   \x3b   \x3c   \x3d   \x3e   \x3f */
500   /*  \x38    \x39    \x3a    \x3b    \x3c    \x3d    \x3e    \x3f */
501501      0x3e,   0x3f,   0x40,   0x41,   0x42,   0x43,   0x44,   0x45,
502   /*   \x40   \x41   \x42   \x43   \x44   \x45   \x46   \x47 */
502   /*  \x40    \x41    \x42    \x43    \x44    \x45    \x46    \x47 */
503503      0x46,   0x47,   0x51,   0x52,   0x54,   0x55,   0x5a,   0x5b,
504   /*   \x48   \x49   \x4a   \x4b   \x4c   \x4d   \x4e   \x4f */
504   /*  \x48    \x49    \x4a    \x4b    \x4c    \x4d    \x4e    \x4f */
505505      0x5c,   0x5d,   0x62,   0x63,   0x64,   0x65,   0x66,   0x68,
506   /*   \x50   \x51   \x52   \x53   \x54   \x55   \x56   \x57 */
506   /*  \x50    \x51    \x52    \x53    \x54    \x55    \x56    \x57 */
507507      0x71,   0x72,   0x73,   0x74,   0x76,   0x77,   0x7c,   0x7d,
508   /*   \x58   \x59   \x5a   \x5b   \x5c   \x5d   \x5e   \x5f */
508   /*  \x58    \x59    \x5a    \x5b    \x5c    \x5d    \x5e    \x5f */
509509      0x7e,   0x7f,   0x81,   0x82,   0x83,   0x84,   0x85,   0x86,
510   /*   \x60   \x61   \x62   \x63   \x64   \x65   \x66   \x67 */
510   /*  \x60    \x61    \x62    \x63    \x64    \x65    \x66    \x67 */
511511      0x4d,   0x47,   0x51,   0x52,   0x54,   0x55,   0x5a,   0x5b,
512   /*   \x68   \x69   \x6a   \x6b   \x6c   \x6d   \x6e   \x6f */
512   /*  \x68    \x69    \x6a    \x6b    \x6c    \x6d    \x6e    \x6f */
513513      0x5c,   0x5d,   0x62,   0x63,   0x64,   0x65,   0x66,   0x68,
514   /*   \x70   \x71   \x72   \x73   \x74   \x75   \x76   \x77 */
514   /*  \x70    \x71    \x72    \x73    \x74    \x75    \x76    \x77 */
515515      0x71,   0x72,   0x73,   0x74,   0x76,   0x77,   0x7c,   0x7d,
516   /*   \x78   \x79   \x7a   \x7b   \x7c   \x7d   \x7e   \x7f */
516   /*  \x78    \x79    \x7a    \x7b    \x7c    \x7d    \x7e    \x7f */
517517      0x7e,   0x7f,   0x81,   0x87,   0x88,   0x89,   0x8a,   0x8b,
518   /*   \x80   \x81   \x82   \x83   \x84   \x85   \x86   \x87 */
518   /*  \x80    \x81    \x82    \x83    \x84    \x85    \x86    \x87 */
519519      0x49,   0x4b,   0x53,   0x56,   0x67,   0x69,   0x78,   0x4e,
520   /*   \x88   \x89   \x8a   \x8b   \x8c   \x8d   \x8e   \x8f */
520   /*  \x88    \x89    \x8a    \x8b    \x8c    \x8d    \x8e    \x8f */
521521      0x48,   0x4f,   0x49,   0x4a,   0x4b,   0x53,   0x56,   0x57,
522   /*   \x90   \x91   \x92   \x93   \x94   \x95   \x96   \x97 */
522   /*  \x90    \x91    \x92    \x93    \x94    \x95    \x96    \x97 */
523523      0x58,   0x59,   0x5e,   0x5f,   0x60,   0x61,   0x67,   0x6d,
524   /*   \x98   \x99   \x9a   \x9b   \x9c   \x9d   \x9e   \x9f */
524   /*  \x98    \x99    \x9a    \x9b    \x9c    \x9d    \x9e    \x9f */
525525      0x6e,   0x6f,   0x69,   0x6a,   0x79,   0x7a,   0x7b,   0x78,
526   /*   \xa0   \xa1   \xa2   \xa3   \xa4   \xa5   \xa6   \xa7 */
526   /*  \xa0    \xa1    \xa2    \xa3    \xa4    \xa5    \xa6    \xa7 */
527527      0x8c,   0x8d,   0x8e,   0x8f,   0x90,   0x91,   0x92,   0x75,
528   /*   \xa8   \xa9   \xaa   \xab   \xac   \xad   \xae   \xaf */
528   /*  \xa8    \xa9    \xaa    \xab    \xac    \xad    \xae    \xaf */
529529      0x93,   0x94,   0x95,   0x96,   0x97,   0x98,   0x4c,   0x6b,
530   /*   \xb0   \xb1   \xb2   \xb3   \xb4   \xb5   \xb6   \xb7 */
530   /*  \xb0    \xb1    \xb2    \xb3    \xb4    \xb5    \xb6    \xb7 */
531531      0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,   0xa0,
532   /*   \xb8   \xb9   \xba   \xbb   \xbc   \xbd   \xbe   \xbf */
532   /*  \xb8    \xb9    \xba    \xbb    \xbc    \xbd    \xbe    \xbf */
533533      0xa1,   0xa2,   0xa3,   0x50,   0x70,   0xa4,   0x4c,   0x6b,
534   /*   \xc0   \xc1   \xc2   \xc3   \xc4   \xc5   \xc6   \xc7 */
534   /*  \xc0    \xc1    \xc2    \xc3    \xc4    \xc5    \xc6    \xc7 */
535535      0xa5,   0xa6,   0xa7,   0xa8,   0xa9,   0xaa,   0xab,   0x25,
536   /*   \xc8   \xc9   \xca   \xcb   \xcc   \xcd   \xce   \xcf */
536   /*  \xc8    \xc9    \xca    \xcb    \xcc    \xcd    \xce    \xcf */
537537      0x26,   0xac,   0x20,   0x48,   0x4a,   0x6a,   0x6c,   0x6c,
538   /*   \xd0   \xd1   \xd2   \xd3   \xd4   \xd5   \xd6   \xd7 */
538   /*  \xd0    \xd1    \xd2    \xd3    \xd4    \xd5    \xd6    \xd7 */
539539      0xad,   0xae,   0x23,   0x24,   0x2c,   0x2d,   0xaf,   0xb0,
540   /*   \xd8   \xd9   \xda   \xdb   \xdc   \xdd   \xde   \xdf */
540   /*  \xd8    \xd9    \xda    \xdb    \xdc    \xdd    \xde    \xdf */
541541      0x80,   0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
542   /*   \xe0   \xe1   \xe2   \xe3   \xe4   \xe5   \xe6   \xe7 */
542   /*  \xe0    \xe1    \xe2    \xe3    \xe4    \xe5    \xe6    \xe7 */
543543      0xb8,   0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
544   /*   \xe8   \xe9   \xea   \xeb   \xec   \xed   \xee   \xef */
544   /*  \xe8    \xe9    \xea    \xeb    \xec    \xed    \xee    \xef */
545545      0xc0,   0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
546   /*   \xf0   \xf1   \xf2   \xf3   \xf4   \xf5   \xf6   \xf7 */
546   /*  \xf0    \xf1    \xf2    \xf3    \xf4    \xf5    \xf6    \xf7 */
547547      0xc8,   0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
548   /*   \xf8   \xf9   \xfa   \xfb   \xfc   \xfd   \xfe   \xff */
548   /*  \xf8    \xf9    \xfa    \xfb    \xfc    \xfd    \xfe    \xff */
549549      0xd0,   0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7
550550   };
551551
r5932r5933
567567}
568568
569569/*
570   mac_strcpy()
570    mac_strcpy()
571571
572   Copy a macintosh string
572    Copy a macintosh string
573573
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)
576576
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.
579579*/
580580INLINE void mac_strcpy(UINT8 *dest, const UINT8 *src)
581581{
r5932r5933
584584
585585#ifdef UNUSED_FUNCTION
586586/*
587   mac_strncpy()
587    mac_strncpy()
588588
589   Copy a macintosh string
589    Copy a macintosh string
590590
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)
594594*/
595595static void mac_strncpy(UINT8 *dest, int n, const UINT8 *src)
596596{
r5932r5933
605605#endif
606606
607607/*
608   disk image reference
608    disk image reference
609609*/
610610typedef struct mac_l1_imgref
611611{
r5932r5933
634634
635635
636636/*
637   image_read_block()
637    image_read_block()
638638
639   Read one 512-byte block of data from a macintosh disk image
639    Read one 512-byte block of data from a macintosh disk image
640640
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
644644
645   Return imgtool error code
645    Return imgtool error code
646646*/
647647static imgtoolerr_t image_read_block(mac_l1_imgref *image, UINT32 block, void *dest)
648648{
r5932r5933
662662}
663663
664664/*
665   image_write_block()
665    image_write_block()
666666
667   Read one 512-byte block of data from a macintosh disk image
667    Read one 512-byte block of data from a macintosh disk image
668668
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
672672
673   Return imgtool error code
673    Return imgtool error code
674674*/
675675static imgtoolerr_t image_write_block(mac_l1_imgref *image, UINT32 block, const void *src)
676676{
r5932r5933
690690}
691691
692692/*
693   image_get_tag_len()
693    image_get_tag_len()
694694
695   Get length of tag data (12 for GCR floppies, 20 for HD20, 0 otherwise)
695    Get length of tag data (12 for GCR floppies, 20 for HD20, 0 otherwise)
696696
697   image (I/O): level-1 image reference
697    image (I/O): level-1 image reference
698698
699   Return tag length
699    Return tag length
700700*/
701701INLINE int image_get_tag_len(mac_l1_imgref *image)
702702{
r5932r5933
706706
707707
708708/*
709   image_read_tag()
709    image_read_tag()
710710
711   Read a 12- or 20-byte tag record associated with a disk block
711    Read a 12- or 20-byte tag record associated with a disk block
712712
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
716716
717   Return imgtool error code
717    Return imgtool error code
718718*/
719719static imgtoolerr_t image_read_tag(mac_l1_imgref *image, UINT32 block, void *dest)
720720{
r5932r5933
722722}
723723
724724/*
725   image_write_tag()
725    image_write_tag()
726726
727   Write a 12- or 20-byte tag record associated with a disk block
727    Write a 12- or 20-byte tag record associated with a disk block
728728
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
732732
733   Return imgtool error code
733    Return imgtool error code
734734*/
735735static imgtoolerr_t image_write_tag(mac_l1_imgref *image, UINT32 block, const void *src)
736736{
r5932r5933
753753typedef struct mac_l2_imgref mac_l2_imgref;
754754
755755/*
756   MFS image ref
756    MFS image ref
757757*/
758758typedef struct mfs_l2_imgref
759759{
r5932r5933
770770} mfs_l2_imgref;
771771
772772/*
773   HFS extent descriptor
773    HFS extent descriptor
774774*/
775775typedef struct hfs_extent
776776{
r5932r5933
779779} hfs_extent;
780780
781781/*
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.
784784*/
785785typedef hfs_extent hfs_extent_3[3];
786786
787787/*
788   MFS open file ref
788    MFS open file ref
789789*/
790790typedef struct mfs_fileref
791791{
r5932r5933
793793} mfs_fileref;
794794
795795/*
796   HFS open file ref
796    HFS open file ref
797797*/
798798typedef struct hfs_fileref
799799{
r5932r5933
804804} hfs_fileref;
805805
806806/*
807   MFS/HFS open file ref
807    MFS/HFS open file ref
808808*/
809809typedef struct mac_fileref
810810{
r5932r5933
830830} mac_fileref;
831831
832832/*
833   open BT ref
833    open BT ref
834834*/
835835typedef struct mac_BTref
836836{
r5932r5933
850850} mac_BTref;
851851
852852/*
853   Constants for BTHeaderRec attributes field
853    Constants for BTHeaderRec attributes field
854854*/
855855enum
856856{
r5932r5933
860860};
861861
862862/*
863   HFS image ref
863    HFS image ref
864864*/
865865typedef struct hfs_l2_imgref
866866{
r5932r5933
877877} hfs_l2_imgref;
878878
879879/*
880   MFS/HFS image ref
880    MFS/HFS image ref
881881*/
882882struct mac_l2_imgref
883883{
r5932r5933
899899};
900900
901901/*
902   MFS Master Directory Block
902    MFS Master Directory Block
903903*/
904904typedef struct mfs_mdb
905905{
r5932r5933
915915   UINT16BE nmAlBlks;      /* number of allocation blocks in volume (0x0187) */
916916   UINT32BE alBlkSiz;      /* size (in bytes) of allocation blocks (0x00000400) */
917917   UINT32BE clpSiz;      /* default clump size - number of bytes to allocate
918                        when a file grows (0x00002000) */
918                                when a file grows (0x00002000) */
919919   UINT16BE alBlSt;      /* first allocation block in volume (0x0010) */
920920
921921   UINT32BE nxtFNum;      /* next unused file number */
r5932r5933
924924   mac_str27 VN;         /* volume name */
925925
926926   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. */
939939} mfs_mdb;
940940
941941/*
942   HFS Master Directory Block
942    HFS Master Directory Block
943943*/
944944typedef struct hfs_mdb
945945{
r5932r5933
956956   UINT16BE nmAlBlks;      /* number of allocation blocks in volume */
957957   UINT32BE alBlkSiz;      /* size (in bytes) of allocation blocks */
958958   UINT32BE clpSiz;      /* default clump size - number of bytes to allocate
959                        when a file grows */
959                                when a file grows */
960960   UINT16BE alBlSt;      /* first allocation block in volume (0x0010) */
961961   UINT32BE nxtCNID;      /* next unused catalog node ID */
962962   UINT16BE freeABs;      /* number of unused allocation blocks */
r5932r5933
10041004} img_open_buf;
10051005
10061006/*
1007   Information extracted from catalog/directory
1007    Information extracted from catalog/directory
10081008*/
10091009typedef struct mac_dirent
10101010{
r5932r5933
10271027} mac_dirent;
10281028
10291029/*
1030   Tag record for GCR floppies (12 bytes)
1030    Tag record for GCR floppies (12 bytes)
10311031
1032   And, no, I don't know the format of the 20-byte tag record of the HD20
1032    And, no, I don't know the format of the 20-byte tag record of the HD20
10331033*/
10341034typedef struct floppy_tag_record
10351035{
r5932r5933
10371037                        /* a value of 1 seems to be the default for non-AB blocks, but this is not consistent */
10381038   UINT8 ftype;            /* bit 1 = 1 if resource fork */
10391039                        /* 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)??? */
10421042                        /* bit 7 seems to be used, but I don't know what it means */
10431043                        /* a value of $FF seems to be the default for non-AB blocks, but this is not consistent */
10441044   UINT8 fattr;            /* bit 0 = 1 if locked(?) */
r5932r5933
10461046   UINT16BE fblock;         /* relative file block number (enough for any volume up to 32 MBytes in size) */
10471047   UINT32BE wrCnt;            /* MFS: date and time of last write */
10481048                        /* 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 */
10511051                        /* (DV17 says "disk block number", but it cannot be true) */
10521052} floppy_tag_record;
10531053
r5932r5933
10711071
10721072#ifdef UNUSED_FUNCTION
10731073/*
1074   mac_image_close
1074    mac_image_close
10751075
1076   Close a macintosh image.
1076    Close a macintosh image.
10771077
1078   l2_img (I/O): level-2 image reference
1078    l2_img (I/O): level-2 image reference
10791079*/
10801080static void mac_image_close(mac_l2_imgref *l2_img)
10811081{
r5932r5933
10921092#endif
10931093
10941094/*
1095   mac_lookup_path
1095    mac_lookup_path
10961096
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).
11011101
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)
11111111
1112   Return imgtool error code
1112    Return imgtool error code
11131113*/
11141114static 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)
11151115{
r5932r5933
11301130}
11311131
11321132/*
1133   mac_file_open
1133    mac_file_open
11341134
1135   Open a file located on a macintosh image
1135    Open a file located on a macintosh image
11361136
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
11431143
1144   Return imgtool error code
1144    Return imgtool error code
11451145*/
11461146static imgtoolerr_t mac_file_open(mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, mac_fileref *fileref)
11471147{
r5932r5933
11581158}
11591159
11601160/*
1161   mac_file_read
1161    mac_file_read
11621162
1163   Read data from an open mac file, starting at current position in file
1163    Read data from an open mac file, starting at current position in file
11641164
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
11681168
1169   Return imgtool error code
1169    Return imgtool error code
11701170*/
11711171static imgtoolerr_t mac_file_read(mac_fileref *fileref, UINT32 len, void *dest)
11721172{
r5932r5933
12341234}
12351235
12361236/*
1237   mac_file_write
1237    mac_file_write
12381238
1239   Write data to an open mac file, starting at current position in file
1239    Write data to an open mac file, starting at current position in file
12401240
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
12441244
1245   Return imgtool error code
1245    Return imgtool error code
12461246*/
12471247static imgtoolerr_t mac_file_write(mac_fileref *fileref, UINT32 len, const void *src)
12481248{
r5932r5933
13401340
13411341#ifdef UNUSED_FUNCTION
13421342/*
1343   mac_file_tell
1343    mac_file_tell
13441344
1345   Get current position in an open mac file
1345    Get current position in an open mac file
13461346
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
13491349
1350   Return imgtool error code
1350    Return imgtool error code
13511351*/
13521352static imgtoolerr_t mac_file_tell(mac_fileref *fileref, UINT32 *filePos)
13531353{
r5932r5933
13581358#endif
13591359
13601360/*
1361   mac_file_seek
1361    mac_file_seek
13621362
1363   Set current position in an open mac file
1363    Set current position in an open mac file
13641364
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
13671367
1368   Return imgtool error code
1368    Return imgtool error code
13691369*/
13701370static imgtoolerr_t mac_file_seek(mac_fileref *fileref, UINT32 filePos)
13711371{
r5932r5933
13781378}
13791379
13801380/*
1381   mac_file_seteof
1381    mac_file_seteof
13821382
1383   Set the position of the EOF in an open mac file
1383    Set the position of the EOF in an open mac file
13841384
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
13871387
1388   Return imgtool error code
1388    Return imgtool error code
13891389*/
13901390static imgtoolerr_t mac_file_seteof(mac_fileref *fileref, UINT32 newEof)
13911391{
r5932r5933
13951395   newABEof = (newEof + fileref->l2_img->blocksperAB * 512 - 1) / (fileref->l2_img->blocksperAB * 512);
13961396
13971397   /*if (fileref->pLen % (fileref->l2_img->blocksperAB * 512))
1398      return IMGTOOLERR_CORRUPTIMAGE;*/
1398        return IMGTOOLERR_CORRUPTIMAGE;*/
13991399
14001400   if (newEof < fileref->eof)
14011401      fileref->eof = newEof;
r5932r5933
14211421
14221422   /* update current pos if beyond new EOF */
14231423   /*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;
14271427
1428      fileref->crPs = newEof;
1429   }*/
1428        fileref->crPs = newEof;
1429    }*/
14301430
14311431   return IMGTOOLERR_SUCCESS;
14321432}
r5932r5933
14371437#endif
14381438
14391439/*
1440   directory entry for use in the directory file
1440    directory entry for use in the directory file
14411441
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.
14441444
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.
14481448*/
14491449typedef struct mfs_dir_entry
14501450{
14511451   UINT8    flags;            /* bit 7=1 if entry used, bit 0=1 if file locked */
14521452                        /* 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 */
14551455   UINT8    flVersNum;         /* version number (usually 0x00, but I don't
1456                           have the IM volume that describes it) */
1456                                    have the IM volume that describes it) */
14571457   mac_FInfo flFinderInfo;      /* information used by the Finder */
14581458
14591459   UINT32BE fileID;         /* file ID */
r5932r5933
14711471   UINT8    name[1];         /* first char is length of file name */
14721472                        /* next chars are file name - 255 chars at most */
14731473                        /* IIRC, Finder 7 only supports 31 chars,
1474                        wheareas earlier versions support 63 chars */
1474                                wheareas earlier versions support 63 chars */
14751475} mfs_dir_entry;
14761476
14771477/*
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.
14801480
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.
14831483*/
14841484typedef struct mfs_FOBJ
14851485{
r5932r5933
15021502      struct
15031503      {
15041504         UINT16BE item_count;   /* number of items (folders and files) in
1505                              this folder */
1505                                        this folder */
15061506         UINT32BE item_descs[1];   /* this variable-length array has
1507                              item_count entries - meaning of entry is unknown */
1507                                        item_count entries - meaning of entry is unknown */
15081508      } v1;
15091509      struct
15101510      {
15111511         UINT16BE zerofill;      /* always 0? */
15121512         UINT16BE unknown0;      /* always 0??? */
15131513         UINT16BE item_count;   /* number of items (folders and files) in
1514                              this folder */
1514                                        this folder */
15151515         UINT8 unknown1[20];      /* ??? */
15161516         UINT8 name[1];         /* variable-length macintosh string */
15171517      } v2;
r5932r5933
15191519} mfs_FOBJ;
15201520
15211521/*
1522   MFS open dir ref
1522    MFS open dir ref
15231523*/
15241524typedef struct mfs_dirref
15251525{
r5932r5933
15851585
15861586
15871587/*
1588   mfs_image_open
1588    mfs_image_open
15891589
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.
15921592
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
15961596
1597   Return imgtool error code
1597    Return imgtool error code
15981598*/
15991599static imgtoolerr_t mfs_image_open(imgtool_image *image, imgtool_stream *stream)
16001600{
r5932r5933
16801680}
16811681
16821682/*
1683   mfs_update_mdb
1683    mfs_update_mdb
16841684
1685   Update MDB on disk
1685    Update MDB on disk
16861686
1687   l2_img (I/O): level-2 image reference
1687    l2_img (I/O): level-2 image reference
16881688
1689   Return imgtool error code
1689    Return imgtool error code
16901690*/
16911691static imgtoolerr_t mfs_update_mdb(mac_l2_imgref *l2_img)
16921692{
r5932r5933
17751775}
17761776
17771777/*
1778   mfs_dir_open
1778    mfs_dir_open
17791779
1780   Open the directory file
1780    Open the directory file
17811781
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
17841784
1785   Return imgtool error code
1785    Return imgtool error code
17861786*/
17871787static imgtoolerr_t mfs_dir_open(mac_l2_imgref *l2_img, const char *path, mfs_dirref *dirref)
17881788{
r5932r5933
18061806}
18071807
18081808/*
1809   mfs_dir_read
1809    mfs_dir_read
18101810
1811   Read one entry of directory file
1811    Read one entry of directory file
18121812
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
18151815
1816   Return imgtool error code
1816    Return imgtool error code
18171817*/
18181818static imgtoolerr_t mfs_dir_read(mfs_dirref *dirref, mfs_dir_entry **dir_entry)
18191819{
r5932r5933
18661866}
18671867
18681868/*
1869   mfs_dir_insert
1869    mfs_dir_insert
18701870
1871   Add an entry in the directory file
1871    Add an entry in the directory file
18721872
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
18781878
1879   Return imgtool error code
1879    Return imgtool error code
18801880*/
18811881static imgtoolerr_t mfs_dir_insert(mac_l2_imgref *l2_img, mfs_dirref *dirref, const UINT8 *new_fname, mfs_dir_entry **dir_entry)
18821882{
r5932r5933
19611961}
19621962
19631963/*
1964   mfs_dir_update
1964    mfs_dir_update
19651965
1966   Update one entry of directory file
1966    Update one entry of directory file
19671967
1968   fileref (I/O): open file reference
1968    fileref (I/O): open file reference
19691969
1970   Return imgtool error code
1970    Return imgtool error code
19711971*/
19721972static imgtoolerr_t mfs_dir_update(mac_fileref *fileref)
19731973{
r5932r5933
20292029
20302030
20312031/*
2032   mfs_find_dir_entry
2032    mfs_find_dir_entry
20332033
2034   Find a file in an MFS directory
2034    Find a file in an MFS directory
20352035
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
20392039
2040   Return imgtool error code
2040    Return imgtool error code
20412041*/
20422042static imgtoolerr_t mfs_find_dir_entry(mfs_dirref *dirref, const mac_str255 filename, mfs_dir_entry **dir_entry)
20432043{
r5932r5933
20702070}
20712071
20722072/*
2073   mfs_lookup_path
2073    mfs_lookup_path
20742074
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.
20772077
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
20882088
2089   Return imgtool error code
2089    Return imgtool error code
20902090*/
20912091static imgtoolerr_t mfs_lookup_path(mac_l2_imgref *l2_img, const char *fpath, mac_str255 filename, mac_dirent *cat_info, int create_it)
20922092{
r5932r5933
21452145}
21462146
21472147/*
2148   mfs_file_open_internal
2148    mfs_file_open_internal
21492149
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.
21522152
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
21572157
2158   Return imgtool error code
2158    Return imgtool error code
21592159*/
21602160static imgtoolerr_t mfs_file_open_internal(mac_l2_imgref *l2_img, const mfs_dir_entry *dir_entry, mac_forkID fork, mac_fileref *fileref)
21612161{
r5932r5933
21892189}
21902190
21912191/*
2192   mfs_file_open
2192    mfs_file_open
21932193
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.
21962196
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
22012201
2202   Return imgtool error code
2202    Return imgtool error code
22032203*/
22042204static imgtoolerr_t mfs_file_open(mac_l2_imgref *l2_img, const mac_str255 filename, mac_forkID fork, mac_fileref *fileref)
22052205{
r5932r5933
22202220}
22212221
22222222/*
2223   mfs_get_ABlink
2223    mfs_get_ABlink
22242224
2225   Read one entry of the Allocation Bitmap link array, on an MFS volume.
2225    Read one entry of the Allocation Bitmap link array, on an MFS volume.
22262226
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
22292229
2230   Returns the 12-bit value read in array.
2230    Returns the 12-bit value read in array.
22312231*/
22322232static UINT16 mfs_get_ABlink(mac_l2_imgref *l2_img, UINT16 AB_address)
22332233{
r5932r5933
22472247}
22482248
22492249/*
2250   mfs_set_ABlink
2250    mfs_set_ABlink
22512251
2252   Set one entry of the Allocation Bitmap link array, on an MFS volume.
2252    Set one entry of the Allocation Bitmap link array, on an MFS volume.
22532253
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
22572257*/
22582258static void mfs_set_ABlink(mac_l2_imgref *l2_img, UINT16 AB_address, UINT16 data)
22592259{
r5932r5933
22822282}
22832283
22842284/*
2285   mfs_file_get_nth_block_address
2285    mfs_file_get_nth_block_address
22862286
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.
22892289
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
22932293
2294   Return imgtool error code
2294    Return imgtool error code
22952295*/
22962296static imgtoolerr_t mfs_file_get_nth_block_address(mac_fileref *fileref, UINT32 block_num, UINT32 *block_address)
22972297{
r5932r5933
23162316      AB_address = mfs_get_ABlink(fileref->l2_img, AB_address);
23172317      if ((AB_address == 0) || (AB_address >= fileref->l2_img->numABs+2))
23182318         /* 0 -> empty block: there is no way an empty block could make it
2319         into the link chain!!! */
2319            into the link chain!!! */
23202320         return IMGTOOLERR_CORRUPTIMAGE;
23212321      if (AB_address == 1)
23222322         /* EOF */
r5932r5933
23312331}
23322332
23332333/*
2334   mfs_file_allocABs
2334    mfs_file_allocABs
23352335
2336   Allocate a chunk of ABs
2336    Allocate a chunk of ABs
23372337
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)
23442344
2345   Return imgtool error code
2345    Return imgtool error code
23462346*/
23472347static imgtoolerr_t mfs_file_allocABs(mac_fileref *fileref, UINT16 lastAB, UINT32 allocABs, UINT32 fblock)
23482348{
r5932r5933
25752575}
25762576
25772577/*
2578   mfs_file_setABeof
2578    mfs_file_setABeof
25792579
2580   Set physical file EOF in ABs
2580    Set physical file EOF in ABs
25812581
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
25842584
2585   Return imgtool error code
2585    Return imgtool error code
25862586*/
25872587static imgtoolerr_t mfs_file_setABeof(mac_fileref *fileref, UINT32 newABeof)
25882588{
r5932r5933
26072607      AB_link = mfs_get_ABlink(fileref->l2_img, AB_address);
26082608      if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2))
26092609         /* 0 -> empty block: there is no way an empty block could make it
2610         into the link chain!!! */
2610            into the link chain!!! */
26112611         return IMGTOOLERR_CORRUPTIMAGE;
26122612
26132613      if (TAG_CHECKS)
r5932r5933
26502650         AB_link = mfs_get_ABlink(fileref->l2_img, AB_address);
26512651         if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2))
26522652         {   /* 0 -> empty block: there is no way an empty block could make
2653            it into the link chain!!! */
2653                it into the link chain!!! */
26542654            if (MDB_dirty)
26552655            {   /* update MDB (freeABs field) and ABLink array */
26562656               err = mfs_update_mdb(fileref->l2_img);
r5932r5933
27202720
27212721#ifdef UNUSED_FUNCTION
27222722/*
2723   mfs_hashString
2723    mfs_hashString
27242724
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).
27282728
2729   Ripped from Apple technote TB06 (converted from 68k ASM to C)
2729    Ripped from Apple technote TB06 (converted from 68k ASM to C)
27302730
2731   string (I): string to hash
2731    string (I): string to hash
27322732
2733   Returns hash value
2733    Returns hash value
27342734*/
27352735static int mfs_hashString(const mac_str255 string)
27362736{
r5932r5933
27622762#endif
27632763
27642764/*
2765   HFS extents B-tree key
2765    HFS extents B-tree key
27662766*/
27672767typedef struct hfs_extentKey
27682768{
r5932r5933
27772777};
27782778
27792779/*
2780   HFS catalog B-tree key
2780    HFS catalog B-tree key
27812781*/
27822782typedef struct hfs_catKey
27832783{
r5932r5933
27862786   UINT32BE parID;         /* parent directory ID */
27872787   mac_str31 cName;      /* catalog node name */
27882788                     /* note that in index nodes, it is a mac_str31, but
2789                        in leaf keys it's a variable-length string */
2789                                in leaf keys it's a variable-length string */
27902790} hfs_catKey;
27912791
27922792/*
2793   HFS catalog data record for a folder - 70 bytes
2793    HFS catalog data record for a folder - 70 bytes
27942794*/
27952795typedef struct hfs_catFolderData
27962796{
r5932r5933
28072807} hfs_catFolderData;
28082808
28092809/*
2810   HFS catalog data record for a file - 102 bytes
2810    HFS catalog data record for a file - 102 bytes
28112811*/
28122812typedef struct hfs_catFileData
28132813{
r5932r5933
28332833} hfs_catFileData;
28342834
28352835/*
2836   HFS catalog data record for a thread - 46 bytes
2836    HFS catalog data record for a thread - 46 bytes
28372837
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.
28402840*/
28412841typedef struct hfs_catThreadData
28422842{
r5932r5933
28472847} hfs_catThreadData;
28482848
28492849/*
2850   union for all types at once
2850    union for all types at once
28512851*/
28522852typedef union hfs_catData
28532853{
r5932r5933
28582858} hfs_catData;
28592859
28602860/*
2861   HFS catalog record types
2861    HFS catalog record types
28622862*/
28632863enum
28642864{
r5932r5933
28692869};
28702870
28712871/*
2872   Catalog file record flags
2872    Catalog file record flags
28732873
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.
28772877*/
28782878enum
28792879{
r5932r5933
28822882};
28832883
28842884/*
2885   BT functions used by HFS functions
2885    BT functions used by HFS functions
28862886*/
28872887typedef struct BT_leaf_rec_enumerator
28882888{
r5932r5933
29092909} hfs_cat_enumerator;
29102910
29112911/*
2912   hfs_open_extents_file
2912    hfs_open_extents_file
29132913
2914   Open the file extents B-tree file
2914    Open the file extents B-tree file
29152915
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
29192919
2920   Return imgtool error code
2920    Return imgtool error code
29212921*/
29222922static imgtoolerr_t hfs_open_extents_file(mac_l2_imgref *l2_img, const hfs_mdb *mdb, mac_fileref *fileref)
29232923{
r5932r5933
29392939}
29402940
29412941/*
2942   hfs_open_cat_file
2942    hfs_open_cat_file
29432943
2944   Open the disk catalog B-tree file
2944    Open the disk catalog B-tree file
29452945
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
29492949
2950   Return imgtool error code
2950    Return imgtool error code
29512951*/
29522952static imgtoolerr_t hfs_open_cat_file(mac_l2_imgref *l2_img, const hfs_mdb *mdb, mac_fileref *fileref)
29532953{
r5932r5933
29692969}
29702970
29712971/*
2972   hfs_extentKey_compare
2972    hfs_extentKey_compare
29732973
2974   key compare function for file extents B-tree
2974    key compare function for file extents B-tree
29752975
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
29782978
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.
29822982*/
29832983static int hfs_extentKey_compare(const void *p1, const void *p2)
29842984{
r5932r5933
29902990}
29912991
29922992/*
2993   hfs_catKey_compare
2993    hfs_catKey_compare
29942994
2995   key compare function for disk catalog B-tree
2995    key compare function for disk catalog B-tree
29962996
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
29992999
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.
30033003*/
30043004static int hfs_catKey_compare(const void *p1, const void *p2)
30053005{
r5932r5933
30133013}
30143014
30153015/*
3016   hfs_image_open
3016    hfs_image_open
30173017
3018   Open a HFS image.  Image must already be open on level 1.
3018    Open a HFS image.  Image must already be open on level 1.
30193019
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
30233023
3024   Return imgtool error code
3024    Return imgtool error code
30253025*/
30263026static imgtoolerr_t hfs_image_open(imgtool_image *image, imgtool_stream *stream)
30273027{
r5932r5933
30723072         || (l2_img->u.hfs.extents_BT.maxKeyLength != 7))
30733073   {   /* This is not supported by the HFS format */
30743074      /* 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) */
30773077      BT_close(&l2_img->u.hfs.extents_BT);
30783078      return IMGTOOLERR_CORRUPTIMAGE;
30793079   }
r5932r5933
30933093         || (l2_img->u.hfs.cat_BT.maxKeyLength != 37))
30943094   {   /* This is not supported by the HFS format */
30953095      /* 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) */
30983098      BT_close(&l2_img->u.hfs.extents_BT);
30993099      BT_close(&l2_img->u.hfs.cat_BT);
31003100      return IMGTOOLERR_CORRUPTIMAGE;
r5932r5933
31253125
31263126#ifdef UNUSED_FUNCTION
31273127/*
3128   hfs_image_close
3128    hfs_image_close
31293129
3130   Close a HFS image.
3130    Close a HFS image.
31313131
3132   l2_img (I/O): level-2 image reference
3132    l2_img (I/O): level-2 image reference
31333133*/
31343134static void hfs_image_close(mac_l2_imgref *l2_img)
31353135{
r5932r5933
31413141#endif
31423142
31433143/*
3144   hfs_get_cat_record_data
3144    hfs_get_cat_record_data
31453145
3146   extract data from a catalog B-tree leaf record
3146    extract data from a catalog B-tree leaf record
31473147
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
31553155
3156   Return imgtool error code
3156    Return imgtool error code
31573157*/
31583158static 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)
31593159{
r5932r5933
32163216}
32173217
32183218/*
3219   hfs_cat_open
3219    hfs_cat_open
32203220
3221   Open an enumerator on the disk catalog
3221    Open an enumerator on the disk catalog
32223222
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
32253225
3226   Return imgtool error code
3226    Return imgtool error code
32273227*/
32283228static imgtoolerr_t hfs_cat_open(mac_l2_imgref *l2_img, const char *path, hfs_cat_enumerator *enumerator)
32293229{
r5932r5933
32483248}
32493249
32503250/*
3251   hfs_cat_read
3251    hfs_cat_read
32523252
3253   Enumerate the disk catalog
3253    Enumerate the disk catalog
32543254
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
32583258
3259   Return imgtool error code
3259    Return imgtool error code
32603260*/
32613261static imgtoolerr_t hfs_cat_read(hfs_cat_enumerator *enumerator, hfs_catKey **rec_key, hfs_catData **rec_data)
32623262{
r5932r5933
32863286}
32873287
32883288/*
3289   hfs_cat_search
3289    hfs_cat_search
32903290
3291   Search the catalog for a given file
3291    Search the catalog for a given file
32923292
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
32983298
3299   Return imgtool error code
3299    Return imgtool error code
33003300*/
33013301static imgtoolerr_t hfs_cat_search(mac_l2_imgref *l2_img, UINT32 parID, const mac_str31 cName, hfs_catKey **rec_key, hfs_catData **rec_data)
33023302{
r5932r5933
33123312
33133313   /* generate search key */
33143314   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 */
33173317   set_UINT32BE(&search_key.parID, parID);
33183318   mac_strcpy(search_key.cName, cName);
33193319
r5932r5933
33313331}
33323332
33333333/*
3334   hfs_lookup_path
3334    hfs_lookup_path
33353335
3336   Resolve a file path
3336    Resolve a file path
33373337
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)
33463346
3347   Return imgtool error code
3347    Return imgtool error code
33483348*/
33493349static imgtoolerr_t hfs_lookup_path(mac_l2_imgref *l2_img, const char *fpath, UINT32 *parID, mac_str255 filename, mac_dirent *cat_info)
33503350{
r5932r5933
34183418}
34193419
34203420/*
3421   hfs_file_open_internal
3421    hfs_file_open_internal
34223422
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.
34253425
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
34303430
3431   Return imgtool error code
3431    Return imgtool error code
34323432*/
34333433static imgtoolerr_t hfs_file_open_internal(mac_l2_imgref *l2_img, const hfs_catFileData *file_rec, mac_forkID fork, mac_fileref *fileref)
34343434{
r5932r5933
34623462}
34633463
34643464/*
3465   hfs_file_open
3465    hfs_file_open
34663466
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.
34693469
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
34753475
3476   Return imgtool error code
3476    Return imgtool error code
34773477*/
34783478static imgtoolerr_t hfs_file_open(mac_l2_imgref *l2_img, UINT32 parID, const mac_str255 filename, mac_forkID fork, mac_fileref *fileref)
34793479{
r5932r5933
35013501}
35023502
35033503/*
3504   hfs_file_get_nth_block_address
3504    hfs_file_get_nth_block_address
35053505
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.
35083508
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
35123512
3513   Return imgtool error code
3513    Return imgtool error code
35143514*/
35153515static imgtoolerr_t hfs_file_get_nth_block_address(mac_fileref *fileref, UINT32 block_num, UINT32 *block_address)
35163516{
r5932r5933
35503550      set_UINT16BE(&search_key.startBlock, AB_num);
35513551
35523552      /* 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. */
35553555      err = BT_search_leaf_rec(&fileref->l2_img->u.hfs.extents_BT, &search_key,
35563556                              NULL, NULL, &extents_BT_rec, &extents_BT_rec_len,
35573557                              FALSE, NULL);
r5932r5933
36063606#endif
36073607
36083608/*
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.
36113611
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.
36153615
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.)
36213621
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.
36303630*/
36313631
36323632/*
3633   BTNodeHeader
3633    BTNodeHeader
36343634
3635   Header of a node record
3635    Header of a node record
36363636*/
36373637typedef struct BTNodeHeader
36383638{
r5932r5933
36403640   UINT32BE bLink;         /* (index of) previous node at this level */
36413641   UINT8    kind;         /* kind of node (leaf, index, header, map) */
36423642   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) */
36453645   UINT16BE numRecords;   /* number of records in this node */
36463646   UINT16BE reserved;      /* reserved; set to zero */
36473647} BTNodeHeader;
36483648
36493649/*
3650   Constants for BTNodeHeader kind field
3650    Constants for BTNodeHeader kind field
36513651*/
36523652enum
36533653{
36543654   btnk_leafNode   = 0xff,   /* leaf nodes hold the actual user data records
3655                        with keys and data */
3655                                with keys and data */
36563656   btnk_indexNode   = 0,   /* root and branch node that enable to efficiently
3657                        search the leaf nodes for a specific key value */
3657                                search the leaf nodes for a specific key value */
36583658   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 */
36613661   btnk_mapNode   = 2      /* map nodes are created when the node allocation
3662                        bitmap outgrows the header node */
3662                                bitmap outgrows the header node */
36633663};
36643664
36653665/*
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).
36683668*/
36693669typedef struct BTHeaderRecord
36703670{
r5932r5933
36753675   UINT32BE lastLeafNode;   /* node number of last leaf node */
36763676   UINT16BE nodeSize;      /* size of a node, in bytes */
36773677   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 */
36803680   UINT32BE totalNodes;   /* total number of nodes in tree */
36813681   UINT32BE freeNodes;      /* number of unused (free) nodes in tree */
36823682
36833683   UINT16BE reserved1;      /* unused */
36843684   UINT32BE clumpSize;      /* used in some HFS implementations? (reserved in
3685                        early HFS implementations, and in HFS Plus) */
3685                                early HFS implementations, and in HFS Plus) */
36863686   UINT8    btreeType;      /* reserved - set to 0 */
36873687   UINT8    reserved2;      /* reserved */
36883688   UINT32BE attributes;   /* persistent attributes about the tree */
r5932r5933
36923692static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent);
36933693
36943694/*
3695   BT_open
3695    BT_open
36963696
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.
36993699
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)
37083708
3709   Return imgtool error code
3709    Return imgtool error code
37103710*/
37113711static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void *key1, const void *key2), int is_extent)
37123712{
r5932r5933
37293729      return IMGTOOLERR_CORRUPTIMAGE;   /* right??? */
37303730
37313731   /* 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. */
37353735   err = mac_file_read(&BTref->fileref, sizeof(header_rec), &header_rec);
37363736   if (err)
37373737      return err;
r5932r5933
37613761}
37623762
37633763/*
3764   BT_close
3764    BT_close
37653765
3766   Close a B-tree
3766    Close a B-tree
37673767
3768   BTref (I/O): open B-tree file handle
3768    BTref (I/O): open B-tree file handle
37693769*/
37703770static void BT_close(mac_BTref *BTref)
37713771{
r5932r5933
37733773}
37743774
37753775/*
3776   BT_read_node
3776    BT_read_node
37773777
3778   Read a node from a B-tree
3778    Read a node from a B-tree
37793779
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
37853785
3786   Return imgtool error code
3786    Return imgtool error code
37873787*/
37883788static imgtoolerr_t BT_read_node(mac_BTref *BTref, UINT32 node_ID, int expected_kind, int expected_depth, void *dest)
37893789{
r5932r5933
38083808}
38093809
38103810/*
3811   BT_node_get_record
3811    BT_node_get_record
38123812
3813   Extract a raw record from a B-tree node
3813    Extract a raw record from a B-tree node
38143814
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)
38203820
3821   Return imgtool error code
3821    Return imgtool error code
38223822*/
38233823static imgtoolerr_t BT_node_get_record(mac_BTref *BTref, void *node_buf, unsigned recnum, void **rec_ptr, int *rec_len)
38243824{
r5932r5933
38453845}
38463846
38473847/*
3848   BT_node_get_keyed_record
3848    BT_node_get_keyed_record
38493849
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.
38523852
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)
38593859
3860   Return imgtool error code
3860    Return imgtool error code
38613861*/
38623862static 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)
38633863{
r5932r5933
38963896}
38973897
38983898/*
3899   BT_get_keyed_record_data
3899    BT_get_keyed_record_data
39003900
3901   extract data from a keyed record
3901    extract data from a keyed record
39023902
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
39083908
3909   Return imgtool error code
3909    Return imgtool error code
39103910*/
39113911static imgtoolerr_t BT_get_keyed_record_data(mac_BTref *BTref, void *rec_ptr, int rec_len, void **data_ptr, int *data_len)
39123912{
r5932r5933
39363936}
39373937
39383938/*
3939   BT_check
3939    BT_check
39403940
3941   Check integrity of a complete B-tree
3941    Check integrity of a complete B-tree
39423942
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)
39493949
3950   Return imgtool error code
3950    Return imgtool error code
39513951*/
39523952static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
39533953{
r5932r5933
40854085         }
40864086         /* check that node has not been used for another purpose */
40874087         /* 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 */
40904090         /*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            }*/
40954095         /* add node in bitmap */
40964096         bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7));
40974097         /* read node */
r5932r5933
41424142      }
41434143
41444144      /* check that a) the root node has no successor, and b) that we have really
4145      read the first leaf node */
4145        read the first leaf node */
41464146      if (get_UINT32BE(((BTNodeHeader *) data_nodes[BTref->treeDepth-1].buf)->fLink)
41474147            || (cur_node != BTref->firstLeafNode))
41484148      {
r5932r5933
42004200                  goto bail;
42014201               }
42024202               /* next test is not necessary because we have checked that
4203               the root node has no successor */
4203                    the root node has no successor */
42044204               /*if (i < BTref->treeDepth-1)
4205               {*/
4205                    {*/
42064206                  data_nodes[i+1].cur_rec++;
42074207               /*}
4208               else
4209               {
4210                  err = IMGTOOLERR_CORRUPTIMAGE;
4211                  goto bail;
4212               }*/
4208                    else
4209                    {
4210                        err = IMGTOOLERR_CORRUPTIMAGE;
4211                        goto bail;
4212                    }*/
42134213            }
42144214            i++;
42154215         }
r5932r5933
42174217         if (is_extent && !extentEOL)
42184218         {
42194219            /* extract current leaf record and update maxExtentAB and
4220            maxExtentNode */
4220                maxExtentNode */
42214221            hfs_extentKey *extentKey;
42224222            hfs_extent *extentData;
42234223
r5932r5933
42304230            if ((extentKey->keyLength < 7) || (extentKey->forkType != 0) || (get_UINT32BE(extentKey->fileID) != 3)
42314231                  || (get_UINT16BE(extentKey->startBlock) != maxExtentAB))
42324232               /* 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 */
42354235               extentEOL = TRUE;
42364236            else
42374237            {   /* this key concerns the extent B-tree: update maxExtentAB
4238               and maxExtentNode */
4238                    and maxExtentNode */
42394239               /* extract record data ptr */
42404240               err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len);
42414241               if (err)
42424242                  goto bail;
42434243               if (rec1_data_len < sizeof(hfs_extent)*3)
42444244                  /* 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 */
42474247                  extentEOL = TRUE;
42484248               else
42494249               {
r5932r5933
43274327            cur_node = get_UINT32BE(* (UINT32BE *)rec1_data);
43284328
43294329            /* compare node index with data of current record of upper
4330            level */
4330                level */
43314331            if (cur_node != data_nodes[i].node_num)
43324332            {
43334333               err = IMGTOOLERR_CORRUPTIMAGE;
r5932r5933
43804380      prev_node = cur_node;
43814381      /* check that node has not been used for another purpose */
43824382      /* 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 */
43854385      /*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        }*/
43904390      /* add node in bitmap */
43914391      bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7));
43924392      /* read map node */
r5932r5933
44824482}
44834483
44844484/*
4485   BT_search_leaf_rec
4485    BT_search_leaf_rec
44864486
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).
44914491
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)
45044504
4505   Return imgtool error code
4505    Return imgtool error code
45064506*/
45074507static imgtoolerr_t BT_search_leaf_rec(mac_BTref *BTref, const void *search_key,
45084508                              UINT32 *node_ID, int *record_ID,
r5932r5933
45594559
45604560      if (! last_rec)
45614561      {   /* all keys are greater than the search key: the search key is
4562         nowhere in the tree */
4562            nowhere in the tree */
45634563         if (search_exact_match)
45644564            return IMGTOOLERR_FILENOTFOUND;
45654565
r5932r5933
46184618}
46194619
46204620/*
4621   BT_leaf_rec_enumerator_open
4621    BT_leaf_rec_enumerator_open
46224622
4623   Open enumerator for leaf records of a B-Tree
4623    Open enumerator for leaf records of a B-Tree
46244624
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
46274627
4628   Return imgtool error code
4628    Return imgtool error code
46294629*/
46304630static imgtoolerr_t BT_leaf_rec_enumerator_open(mac_BTref *BTref, BT_leaf_rec_enumerator *enumerator)
46314631{
r5932r5933
46374637}
46384638
46394639/*
4640   BT_leaf_rec_enumerator_read
4640    BT_leaf_rec_enumerator_read
46414641
4642   Read next leaf record of a B-Tree
4642    Read next leaf record of a B-Tree
46434643
4644   enumerator (I/O): open B-Tree enumerator
4644    enumerator (I/O): open B-Tree enumerator
46454645
4646   Return imgtool error code
4646    Return imgtool error code
46474647*/
46484648static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerator, void **record_ptr, int *rec_len)
46494649{
r5932r5933
46894689   enumerator->cur_rec++;
46904690   if (enumerator->cur_rec >= node_numRecords)
46914691   {   /* iterate to next node if last record (not required, but will improve
4692      performance on next iteration) */
4692        performance on next iteration) */
46934693      enumerator->cur_node = get_UINT32BE(((BTNodeHeader *) enumerator->BTref->node_buf)->fLink);
46944694      enumerator->cur_rec = 0;
46954695   }
r5932r5933
46974697}
46984698
46994699/*
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***
47074707
4708   Empty node alloc algorithm:
4708    Empty node alloc algorithm:
47094709
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
47144714
47154715
4716   Empty node delete algorithm:
4716    Empty node delete algorithm:
47174717
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
47264726
47274727
4728   Record shifting algorithm:
4728    Record shifting algorithm:
47294729
4730   For a given node and its first non-empty successor node:
4730    For a given node and its first non-empty successor node:
47314731
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)
47364736
47374737
4738   Node merging algorithm
4738    Node merging algorithm
47394739
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.
47434743
47444744
4745   Node splitting algorithm (non-first)
4745    Node splitting algorithm (non-first)
47464746
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.
47504750
47514751
4752   Node splitting algorithm (first node)
4752    Node splitting algorithm (first node)
47534753
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.
47564756
47574757
4758   Record delete algorithm:
4758    Record delete algorithm:
47594759
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.
47674767
47684768
4769   Record insert algorithm:
4769    Record insert algorithm:
47704770
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
47774777*/
47784778/*
4779   Possible additions:
4779    Possible additions:
47804780
4781   Node compaction algorithm:
4781    Node compaction algorithm:
47824782
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.
47854785
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???)
47894789*/
47904790
47914791/*static void*/
r5932r5933
47964796#endif
47974797
47984798/*
4799   Resource manager
4799    Resource manager
48004800
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.
48104810
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.
48134813
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
48184818
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.
48214821
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.
48244824*/
48254825
48264826/*
4827   Resource header
4827    Resource header
48284828*/
48294829typedef struct rsrc_header
48304830{
r5932r5933
48354835} rsrc_header;
48364836
48374837/*
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
48404840*/
48414841
48424842/*
4843   Resource map:
4843    Resource map:
48444844*/
48454845typedef struct rsrc_map_header
48464846{
r5932r5933
48564856} rsrc_map_header;
48574857
48584858/*
4859   Resource type list entry
4859    Resource type list entry
48604860*/
48614861typedef struct rsrc_type_entry
48624862{
r5932r5933
48664866} rsrc_type_entry;
48674867
48684868/*
4869   Resource reference list entry
4869    Resource reference list entry
48704870*/
48714871typedef struct rsrc_ref_entry
48724872{
r5932r5933
48794879} rsrc_ref_entry;
48804880
48814881/*
4882   Resource name list entry: this is just a standard macintosh string
4882    Resource name list entry: this is just a standard macintosh string
48834883*/
48844884
48854885typedef struct mac_resfileref
48864886{
48874887   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)) */
48914891   UINT32 data_offs;      /* Offset from beginning of resource file to resource data */
48924892   UINT32 map_offs;      /* Offset from beginning of resource file to resource data */
48934893
r5932r5933
48994899
49004900#ifdef UNUSED_FUNCTION
49014901/*
4902   resfile_open
4902    resfile_open
49034903
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.
49064906
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)
49094909
4910   Return imgtool error code
4910    Return imgtool error code
49114911*/
49124912static imgtoolerr_t resfile_open(mac_resfileref *resfileref)
49134913{
r5932r5933
49444944}
49454945
49464946/*
4947   resfile_get_entry
4947    resfile_get_entry
49484948
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.
49514951
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
49564956
4957   Return imgtool error code
4957    Return imgtool error code
49584958*/
49594959static imgtoolerr_t resfile_get_entry(mac_resfileref *resfileref, UINT32 type, UINT16 id, rsrc_ref_entry *entry)
49604960{
r5932r5933
50125012}
50135013
50145014/*
5015   resfile_get_resname
5015    resfile_get_resname
50165016
5017   Get the name of a resource.
5017    Get the name of a resource.
50185018
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
50235023
5024   Return imgtool error code
5024    Return imgtool error code
50255025*/
50265026static imgtoolerr_t resfile_get_resname(mac_resfileref *resfileref, const rsrc_ref_entry *entry, mac_str255 string)
50275027{
r5932r5933
50565056}
50575057
50585058/*
5059   resfile_get_reslen
5059    resfile_get_reslen
50605060
5061   Get the data length for a given resource.
5061    Get the data length for a given resource.
50625062
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
50675067
5068   Return imgtool error code
5068    Return imgtool error code
50695069*/
50705070static imgtoolerr_t resfile_get_reslen(mac_resfileref *resfileref, const rsrc_ref_entry *entry, UINT32 *len)
50715071{
r5932r5933
50915091}
50925092
50935093/*
5094   resfile_get_resdata
5094    resfile_get_resdata
50955095
5096   Get the data for a given resource.
5096    Get the data for a given resource.
50975097
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
51055105
5106   Return imgtool error code
5106    Return imgtool error code
51075107*/
51085108static imgtoolerr_t resfile_get_resdata(mac_resfileref *resfileref, const rsrc_ref_entry *entry, UINT32 offset, UINT32 len, void *dest)
51095109{
r5932r5933
51485148#pragma mark DESKTOP FILE IMPLEMENTATION
51495149#endif
51505150/*
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.
51535153
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.
51595159
51605160
5161   There have been two implementations of the desktop metadata:
5161    There have been two implementations of the desktop metadata:
51625162
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.
51715171
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.
51775177
51785178
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
51855185*/
51865186
51875187#ifdef UNUSED_FUNCTION
51885188/*
5189   get_comment
5189    get_comment
51905190
5191   Get a comment from the Desktop file
5191    Get a comment from the Desktop file
51925192
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
51965196
5197   Return imgtool error code
5197    Return imgtool error code
51985198*/
51995199static imgtoolerr_t get_comment(mac_l2_imgref *l2_img, UINT16 id, mac_str255 comment)
52005200{
r5932r5933
52305230      /* hurk */
52315231      /*return IMGTOOLERR_CORRUPTIMAGE;*/
52325232      /* 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 */
52355235      reslen = 256;
52365236
52375237   /* extract comment data */
r5932r5933
52615261
52625262#ifdef UNUSED_FUNCTION
52635263/*
5264   close a mfs/hfs image
5264    close a mfs/hfs image
52655265*/
52665266static void mac_image_exit(imgtool_image *img)
52675267{
r5932r5933
52725272#endif
52735273
52745274/*
5275   get basic information on a mfs/hfs image
5275    get basic information on a mfs/hfs image
52765276
5277   Currently returns the volume name
5277    Currently returns the volume name
52785278*/
52795279static void mac_image_info(imgtool_image *img, char *string, size_t len)
52805280{
r5932r5933
52935293}
52945294
52955295/*
5296   MFS/HFS catalog iterator, used when imgtool reads the catalog
5296    MFS/HFS catalog iterator, used when imgtool reads the catalog
52975297*/
52985298typedef struct mac_iterator
52995299{
r5932r5933
53135313} mac_iterator;
53145314
53155315/*
5316   Open the disk catalog for enumeration
5316    Open the disk catalog for enumeration
53175317*/
53185318static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path)
53195319{
r5932r5933
53425342}
53435343
53445344/*
5345   Enumerate disk catalog next entry (MFS)
5345    Enumerate disk catalog next entry (MFS)
53465346*/
53475347static imgtoolerr_t mfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
53485348{
r5932r5933
53795379
53805380#if 0
53815381/*
5382   Concatenate path elements in the reverse order
5382    Concatenate path elements in the reverse order
53835383
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
53905390*/
53915391static void concat_fname(char *dest, int *dest_cur_pos, int dest_max_len, const char *src)
53925392{
r5932r5933
54105410#endif
54115411
54125412/*
5413   Enumerate disk catalog next entry (HFS)
5413    Enumerate disk catalog next entry (HFS)
54145414*/
54155415static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
54165416{
r5932r5933
54195419   UINT16 dataRecType;
54205420   imgtoolerr_t err;
54215421   /* currently, the mac->C conversion transcodes one mac char with at most 3
5422   C chars */
5422    C chars */
54235423   int cur_name_head;
54245424
54255425   assert(iter->format == L2I_HFS);
r5932r5933
54715471
54725472   /* insert folder/file name in buffer */
54735473   mac_to_c_strncpy(ent->filename, sizeof(ent->filename) / sizeof(ent->filename[0]), catrec_key->cName);
5474//   concat_fname(ent->filename, &cur_name_head, sizeof(ent->filename) / sizeof(ent->filename[0]) - 1, buf);
5474//  concat_fname(ent->filename, &cur_name_head, sizeof(ent->filename) / sizeof(ent->filename[0]) - 1, buf);
54755475
54765476#if 0
54775477   /* extract parent directory ID */
54785478   parID = get_UINT32BE(catrec_key->parID);
54795479
54805480   /* looping while (parID != 1) will display the volume name; looping while
5481   (parID != 2) won't */
5481    (parID != 2) won't */
54825482   while (parID != /*1*/2)
54835483   {
54845484      /* search catalog for folder thread */
r5932r5933
55085508      }
55095509
55105510      /* got folder thread record: insert the folder name at the start of
5511      file path, then iterate */
5511        file path, then iterate */
55125512      mac_to_c_strncpy(buf, sizeof(buf), catrec_data->thread.nodeName);
55135513      concat_fname(ent->filename, &cur_name_head, sizeof(ent->filename) / sizeof(ent->filename[0]) - 1, ":");
55145514      concat_fname(ent->filename, &cur_name_head, sizeof(ent->filename) / sizeof(ent->filename[0]) - 1, buf);
r5932r5933
55225522}
55235523
55245524/*
5525   Enumerate disk catalog next entry
5525    Enumerate disk catalog next entry
55265526*/
55275527static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
55285528{
r5932r5933
55485548}
55495549
55505550/*
5551   Compute free space on disk image in bytes
5551    Compute free space on disk image in bytes
55525552*/
55535553static imgtoolerr_t mac_image_freespace(imgtool_partition *partition, UINT64 *size)
55545554{
r5932r5933
55755575
55765576      case L2I_HFS:
55775577         /* This is the way to get Finder comments in system <= 7.  Attached
5578         comments use another method, and Finder 8 uses yet another one. */
5578            comments use another method, and Finder 8 uses yet another one. */
55795579         commentID = get_UINT16BE(cat_info->flXFinderInfo.comment);
55805580         if (commentID)
55815581            err = get_comment(image, commentID, comment);
r5932r5933
55875587
55885588
55895589/*
5590   Extract a file from a disk image.
5590    Extract a file from a disk image.
55915591*/
55925592static imgtoolerr_t mac_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf)
55935593{
r5932r5933
56385638}
56395639
56405640/*
5641   Add a file to a disk image.
5641    Add a file to a disk image.
56425642*/
56435643static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions)
56445644{
r5932r5933
56505650   mac_fileref fileref;
56515651   UINT32 fork_len;
56525652   /*UINT16 commentID;
5653   mac_str255 comment;*/
5653    mac_str255 comment;*/
56545654   UINT8 buf[512];
56555655   UINT32 i, run_len;
56565656   imgtoolerr_t err;
r5932r5933
56665666      return err;
56675667
56685668   /*if (header.version_old != 0)
5669      return IMGTOOLERR_UNIMPLEMENTED;*/
5669        return IMGTOOLERR_UNIMPLEMENTED;*/
56705670   /*mac_strcpy(filename, header.filename);*/
56715671   memset(&cat_info, 0, sizeof(cat_info));
56725672   set_UINT32BE(&cat_info.flFinderInfo.type, 0x3F3F3F3F);
r5932r5933
56745674   fork_len = stream_size(sourcef);
56755675   /*comment[0] = get_UINT16BE(header.comment_len);*/   /* comment length */
56765676   /* 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. */
56795679
56805680   /* create file */
56815681   /* clear inited flag and file location in window */
r5932r5933
61786178   finder_flags = (UINT32) attr_values[2].i;
61796179
61806180   /* check the bundle bit; if clear (and the type is not 'APPL'), use the
6181    * desktop file */
6181    * desktop file */
61826182   if (!(finder_flags & 0x2000) && (type_code != /* APPL */ 0x4150504C))
61836183      path = "Desktop\0";
61846184
src/mess/tools/imgtool/modules/vmsx_tap.c
r5932r5933
1818    is an INFO block which lists all files in the archive. The TAPE block
1919    contains the actual data.
2020
21   Original code in Virtual MSX:
21    Original code in Virtual MSX:
2222
23      ftp://ftp.komkon.org/pub/EMUL8/MSX/Emulators/VMSX1SRC.zip
23        ftp://ftp.komkon.org/pub/EMUL8/MSX/Emulators/VMSX1SRC.zip
2424
25   It's in the file TAPE.C.
25    It's in the file TAPE.C.
2626
27   RIFF format specs:
27    RIFF format specs:
2828
29      http://www.saettler.com/RIFFMCI/riffmci.html
29        http://www.saettler.com/RIFFMCI/riffmci.html
3030
3131
3232    This module converts the files to .cas files. Implemented are:
r5932r5933
3636    get - gets one file. If "getall" fails, due to characters in the
3737          filename your FS/OS doesn't support, use:
3838
39   imgtool get vmsx_tap monmsx.tap monmsx-binary.cas monmsx.cas
39    imgtool get vmsx_tap monmsx.tap monmsx-binary.cas monmsx.cas
4040
4141    for example.
4242
43   Sean Young
43    Sean Young
4444*/
4545
4646#include "osdepend.h"
r5932r5933
197197      return IMGTOOLERR_CORRUPTIMAGE;
198198
199199   /* OK we've got the right data chunk. Now we can start looking for
200      the blocks */
200        the blocks */
201201   pos = 0;
202202   while ( (pos + 8) < size)
203203      {
src/mess/tools/imgtool/modules/macutil.h
r5932r5933
11/****************************************************************************
22
3   macutil.h
3    macutil.h
44
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
77
88*****************************************************************************/
99
src/mess/tools/imgtool/modules/vzdos.c
r5932r5933
11/****************************************************************************
22
3   vzdos.c
3    vzdos.c
44
5   Laser/VZ disk images
5    Laser/VZ disk images
66
77****************************************************************************/
88
r5932r5933
6565};
6666
6767/*********************************************************************
68   Internal functions
68    Internal functions
6969*********************************************************************/
7070
7171/* get length of filename without trailing spaces */
r5932r5933
383383}
384384
385385/*********************************************************************
386   Imgtool module code
386    Imgtool module code
387387*********************************************************************/
388388
389389static imgtoolerr_t vzdos_diskimage_beginenum(imgtool_directory *enumeration, const char *path)
r5932r5933
814814}
815815
816816/*********************************************************************
817   Imgtool vz filter code
817    Imgtool vz filter code
818818*********************************************************************/
819819
820820static imgtoolerr_t vzsnapshot_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
r5932r5933
909909}
910910
911911/*********************************************************************
912   Imgtool module declaration
912    Imgtool module declaration
913913*********************************************************************/
914914
915915static OPTION_GUIDE_START(vzdos_writefile_optionguide)
r5932r5933
925925OPTION_GUIDE_END
926926
927927/*
928T   Basic Editor File
929B   Binary File
930D   Sequential Access Program Data File
931F   Quickwrite Document
932A   Russell Harrison's Edit Ass. File
933S   Dave Mitchell/Mark Hardwood Edit Ass. File  Start Addr A280H
934S   Quickwrite/Diskops System File/Label       Except Above
935W   Edit Ass. with Diskops File   Start           Addr A813H
936W   E & F Word Pro with Patch 3.3 File           End Addr D000H
937W   Russell Harrison Word Pro File              Except above two
928T   Basic Editor File
929B   Binary File
930D   Sequential Access Program Data File
931F   Quickwrite Document
932A   Russell Harrison's Edit Ass. File
933S   Dave Mitchell/Mark Hardwood Edit Ass. File  Start Addr A280H
934S   Quickwrite/Diskops System File/Label        Except Above
935W   Edit Ass. with Diskops File Start           Addr A813H
936W   E & F Word Pro with Patch 3.3 File          End Addr D000H
937W   Russell Harrison Word Pro File              Except above two
938938*/
939939
940940void vzdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info)
src/mess/tools/imgtool/modules/prodos.c
r5932r5933
11/****************************************************************************
22
3   prodos.c
3    prodos.c
44
5   Apple II ProDOS disk images
5    Apple II ProDOS disk images
66
77*****************************************************************************
88
r5932r5933
2727  Offset  Length  Description
2828  ------  ------  -----------
2929       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
3737       1      15  File name (NUL padded)
3838      16       1  File type
3939      17       2  Key pointer
r5932r5933
5858
5959  ProDOS dates are 32-bit little endian values
6060
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
6666
6767
6868  ProDOS directory and volume headers have this information:
r5932r5933
7070  Offset  Length  Description
7171  ------  ------  -----------
7272      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
7777
7878  GS/OS Extended Files (storage type $5) point to an extended key block that
7979  contains information about the two forks.  The first half of the extended
r5932r5933
8383  Offset  Length  Description
8484  ------  ------  -----------
8585       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
9595
9696  FInfo format:
9797
9898  Offset  Length  Description
9999  ------  ------  -----------
100100       0       4  File type
101      4       4  File creator
102      8       2  Finder flags
101       4       4  File creator
102       8       2  Finder flags
103103      10       2  X Coordinate
104     12       2  Y Coordinate
105     14       2  Finder folder
104      12       2  Y Coordinate
105      14       2  Finder folder
106106
107107  xFInfo format:
108108
109109  Offset  Length  Description
110110  ------  ------  -----------
111111       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
115115      10       2  Comment ID
116     12       4  Put Away Directory
116      12       4  Put Away Directory
117117
118118
119119  For more info, consult ProDOS technical note #25
120   (http://web.pdx.edu/~heiss/technotes/pdos/tn.pdos.25.html)
120    (http://web.pdx.edu/~heiss/technotes/pdos/tn.pdos.25.html)
121121
122122*****************************************************************************/
123123
r5932r5933
839839   if (is_extendedfile_storagetype(ent->storage_type))
840840   {
841841      /* this is a ProDOS extended file; we need to get the extended info
842      * block */
842        * block */
843843      ent->extkey_pointer   = pick_integer_le(appleenum->block_data, offset + 17, 2);
844844
845845      err = prodos_load_block(image, ent->extkey_pointer, buffer);
r5932r5933
15951595      for (i = 0; i < 256; i++)
15961596      {
15971597         /* retrieve the block pointer; the two bytes are on either half
1598          * of the block */
1598            * of the block */
15991599         sub_block = buffer[i + 256];
16001600         sub_block <<= 8;
16011601         sub_block |= buffer[i + 0];
src/mess/tools/imgtool/modules/fat.c
r5932r5933
11/****************************************************************************
22
3   fat.c
3    fat.c
44
5   PC FAT disk images
5    PC FAT disk images
66
77*****************************************************************************
88
r5932r5933
1515     462      16  Partion #2 info
1616     478      16  Partion #3 info
1717     494      16  Partion #4 info
18    510       2  Magic bytes (0x55 0xAA)
18    510       2  Magic bytes (0x55 0xAA)
1919
2020
2121  Partition info format:
r5932r5933
2323  Offset  Length  Description
2424  ------  ------  -----------
2525       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
4848
4949
5050  Boot sector format:
r5932r5933
5252  Offset  Length  Description
5353  ------  ------  -----------
5454       0       3  Jump instruction (to skip over header on boot)
55      3       8  OEM Name
55       3       8  OEM Name
5656      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
6969      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)
7676
7777  For more information:
78   http://support.microsoft.com/kb/q140418/
78    http://support.microsoft.com/kb/q140418/
7979
8080
8181  Directory Entry Format:
r5932r5933
8383  Offset  Length  Description
8484  ------  ------  -----------
8585       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
9595
9696
9797  Dates and times are stored in separate words; when together, the time is
9898  first and the date is second.
9999
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
104104
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
109109
110110  LFN Entry Format:
111111
112112  Offset  Length  Description
113113  ------  ------  -----------
114114       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)
122122
123123  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)
129129
130130  For more information:
131   http://en.wikipedia.org/wiki/File_Allocation_Table
131    http://en.wikipedia.org/wiki/File_Allocation_Table
132132
133133****************************************************************************/
134134
r5932r5933
12951295   disk_info = fat_get_partition_info(partition);
12961296
12971297   /* 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     */
13071307   do
13081308   {
13091309      entry_index = file->index;
r5932r5933
16501650   }
16511651
16521652   /* since we changed the short file name, we need to recalc the checksums
1653    * in the LFN entries */
1653    * in the LFN entries */
16541654   fat_calc_dirent_lfnchecksum(entry, entry_len);
16551655}
16561656
src/mess/tools/imgtool/modules/t64.c
r5932r5933
139139   t64_image_beginenum,            /* begin enumeration */
140140   t64_image_nextenum,               /* enumerate next */
141141   t64_image_closeenum,            /* close enumeration */
142   NULL, //t64_image_freespace,      /* free space on image */
142   NULL, //t64_image_freespace,        /* free space on image */
143143   t64_image_readfile,               /* read file */
144144   t64_image_writefile,            /* write file */
145145   t64_image_deletefile,            /* delete file */
src/mess/tools/imgtool/modules/pc_flop.c
r5932r5933
11/****************************************************************************
22
3   pc_flop.c
3    pc_flop.c
44
5   PC floppies
5    PC floppies
66
77****************************************************************************/
88
src/mess/tools/imgtool/modules/svi_cas.c
r5932r5933
77#include "utils.h"
88
99/*
10   SVI module
10    SVI module
1111
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.
1414*/
1515
1616typedef struct {
src/mess/tools/imgtool/modules/rsdos.c
r5932r5933
11/****************************************************************************
22
3   rsdos.c
3    rsdos.c
44
5   CoCo RS-DOS disk images
5    CoCo RS-DOS disk images
66
77****************************************************************************/
88
r5932r5933
4242
4343
4444/*********************************************************************
45   Imgtool module code
45    Imgtool module code
4646*********************************************************************/
4747
4848#define MAX_DIRENTS      ((18-2)*(256/32))
r5932r5933
480480   while(sz > 0);
481481
482482   /* 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     */
485485   *gptr = 0xc0 + ((i + 255) / 256);
486486
487487   /* Now we need to find an empty directory entry */
r5932r5933
578578
579579
580580/*********************************************************************
581   Imgtool module declaration
581    Imgtool module declaration
582582*********************************************************************/
583583
584584static OPTION_GUIDE_START( coco_rsdos_writefile_optionguide )
src/mess/tools/imgtool/modules/concept.c
r5932r5933
11/*
2   Handlers for concept floppy images
2    Handlers for concept floppy images
33
4   Disk images are in MESS format.
4    Disk images are in MESS format.
55
6   Raphael Nabet, 2003
6    Raphael Nabet, 2003
77*/
88
99#include <stdio.h>
r5932r5933
2020} UINT16xE;
2121
2222/*
23   get_UINT16xE
23    get_UINT16xE
2424
25   Read a 16-bit word, whether it is little-endian or big-endian
25    Read a 16-bit word, whether it is little-endian or big-endian
2626
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
3030
31   Returns value of word in native format
31    Returns value of word in native format
3232*/
3333INLINE UINT16 get_UINT16xE(int little_endian, UINT16xE word)
3434{
r5932r5933
3636}
3737
3838/*
39   set_UINT16xE
39    set_UINT16xE
4040
41   Write a 16-bit word, whether it is little-endian or big-endian
41    Write a 16-bit word, whether it is little-endian or big-endian
4242
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
4747*/
4848INLINE void set_UINT16xE(int little_endian, UINT16xE *word, UINT16 data)
4949{
r5932r5933
6060}
6161
6262/*
63   Disk structure:
63    Disk structure:
6464
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.
6868*/
6969
7070/*
71   device directory record (Disk sector 2-5)
71    device directory record (Disk sector 2-5)
7272*/
7373
7474typedef struct concept_vol_hdr_entry
r5932r5933
106106} concept_dev_dir;
107107
108108/*
109   concept disk image descriptor
109    concept disk image descriptor
110110*/
111111typedef struct concept_image
112112{
r5932r5933
115115} concept_image;
116116
117117/*
118   concept catalog iterator, used when imgtool reads the catalog
118    concept catalog iterator, used when imgtool reads the catalog
119119*/
120120typedef struct concept_iterator
121121{
r5932r5933
166166}
167167
168168/*
169   read_physical_record
169    read_physical_record
170170
171   Read one 512-byte physical record from a disk image
171    Read one 512-byte physical record from a disk image
172172
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
176176
177   Return non-zero on error
177    Return non-zero on error
178178*/
179179static int read_physical_record(imgtool_stream *file_handle, int secnum, void *dest)
180180{
r5932r5933
194194
195195#ifdef UNUSED_FUNCTION
196196/*
197   write_physical_record
197    write_physical_record
198198
199   Write one 512-byte physical record to a disk image
199    Write one 512-byte physical record to a disk image
200200
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
204204
205   Return non-zero on error
205    Return non-zero on error
206206*/
207207static int write_physical_record(imgtool_stream *file_handle, int secnum, const void *src)
208208{
r5932r5933
222222#endif
223223
224224/*
225   Search for a file name on a concept_image
225    Search for a file name on a concept_image
226226
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
230230
231   Return non-zero on error
231    Return non-zero on error
232232*/
233233static int get_catalog_entry(concept_image *image, const unsigned char *filename, int *entry_index)
234234{
r5932r5933
254254}
255255
256256/*
257   Open a file as a concept_image.
257    Open a file as a concept_image.
258258*/
259259static imgtoolerr_t concept_image_init(imgtool_image *img, imgtool_stream *f)
260260{
r5932r5933
289289}
290290
291291/*
292   close a concept_image
292    close a concept_image
293293*/
294294static void concept_image_exit(imgtool_image *img)
295295{
r5932r5933
297297}
298298
299299/*
300   get basic information on a concept_image
300    get basic information on a concept_image
301301
302   Currently returns the volume name
302    Currently returns the volume name
303303*/
304304static void concept_image_info(imgtool_image *img, char *string, size_t len)
305305{
r5932r5933
313313}
314314
315315/*
316   Open the disk catalog for enumeration
316    Open the disk catalog for enumeration
317317*/
318318static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path)
319319{
r5932r5933
326326}
327327
328328/*
329   Enumerate disk catalog next entry
329    Enumerate disk catalog next entry
330330*/
331331static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
332332{
r5932r5933
387387}
388388
389389/*
390   Free enumerator
390    Free enumerator
391391*/
392392static void concept_image_closeenum(imgtool_directory *enumeration)
393393{
394394}
395395
396396/*
397   Compute free space on disk image
397    Compute free space on disk image
398398*/
399399static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64 *size)
400400{
r5932r5933
420420}
421421
422422/*
423   Extract a file from a concept_image.
423    Extract a file from a concept_image.
424424*/
425425static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
426426{
r5932r5933
457457
458458#if 0
459459/*
460   Add a file to a concept_image.
460    Add a file to a concept_image.
461461*/
462462static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *writeoptions)
463463{
r5932r5933
467467}
468468
469469/*
470   Delete a file from a concept_image.
470    Delete a file from a concept_image.
471471*/
472472static imgtoolerr_t concept_image_deletefile(imgtool_partition *partition, const char *filename)
473473{
r5932r5933
477477}
478478
479479/*
480   Create a blank concept_image.
480    Create a blank concept_image.
481481*/
482482static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool_stream *f, option_resolution *createoptions)
483483{
src/mess/tools/imgtool/modules/xsa.c
r5932r5933
181181
182182
183183/****************************************************************/
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                        */
188188/****************************************************************/
189189
190190#define SHORT unsigned
r5932r5933
204204} huf_node;
205205
206206/****************************************************************/
207/* global vars                                       */
207/* global vars                                                  */
208208/****************************************************************/
209209static unsigned updhufcnt;
210210static unsigned cpdist[tblsize+1];
r5932r5933
217217static huf_node huftbl[2*tblsize-1];
218218
219219/****************************************************************/
220/* maak de huffman codeer informatie                     */
220/* maak de huffman codeer informatie                            */
221221/****************************************************************/
222222static void mkhuftbl( void )
223223{
r5932r5933
285285}
286286
287287/****************************************************************/
288/* global vars                                       */
288/* global vars                                                  */
289289/****************************************************************/
290290static imgtool_stream *in_stream, *out_stream;
291291
r5932r5933
301301#define outbufsize (slwinsize+4096)
302302
303303/****************************************************************/
304/* The function prototypes                              */
304/* The function prototypes                                      */
305305/****************************************************************/
306306static void unlz77( void );       /* perform the real decompression       */
307307static void charout(UINT8);      /* put a character in the output stream */
r5932r5933
312312static UINT8 bitin( void );        /* read a bit                           */
313313
314314/****************************************************************/
315/* de hoofdlus                                       */
315/* de hoofdlus                                                  */
316316/****************************************************************/
317317static int xsa_extract (imgtool_stream *in, imgtool_stream *out)
318318    {
r5932r5933
346346    }
347347
348348/****************************************************************/
349/* the actual decompression algorithm itself               */
349/* the actual decompression algorithm itself                    */
350350/****************************************************************/
351351static void unlz77( void )
352352{
r5932r5933
404404}
405405
406406/****************************************************************/
407/* read string length                                 */
407/* read string length                                           */
408408/****************************************************************/
409409static unsigned rdstrlen( void )
410410{
r5932r5933
429429}
430430
431431/****************************************************************/
432/* read string pos                                    */
432/* read string pos                                              */
433433/****************************************************************/
434434static unsigned rdstrpos( void )
435435{
r5932r5933
471471}
472472
473473/****************************************************************/
474/* read a bit from the input file                        */
474/* read a bit from the input file                               */
475475/****************************************************************/
476476static UINT8 bitin( void )
477477{
src/mess/tools/imgtool/imghd.c
r5932r5933
11/*
2   Code to interface the MESS image code with MAME's harddisk core.
2    Code to interface the MESS image code with MAME's harddisk core.
33
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.
66
7   Raphael Nabet 2003
7    Raphael Nabet 2003
88*/
99
1010/*#include "imgtool.h"*/
r5932r5933
4242
4343
4444/*
45   imghd_create()
45    imghd_create()
4646
47   Create a MAME HD image
47    Create a MAME HD image
4848*/
4949imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 hunksize, UINT32 cylinders, UINT32 heads, UINT32 sectors, UINT32 seclen)
5050{
r5932r5933
133133
134134
135135/*
136   imghd_open()
136    imghd_open()
137137
138   Open stream as a MAME HD image
138    Open stream as a MAME HD image
139139*/
140140imgtoolerr_t imghd_open(imgtool_stream *stream, struct mess_hard_disk_file *hard_disk)
141141{
r5932r5933
169169
170170
171171/*
172   imghd_close()
172    imghd_close()
173173
174   Close MAME HD image
174    Close MAME HD image
175175*/
176176void imghd_close(struct mess_hard_disk_file *disk)
177177{
r5932r5933
192192
193193
194194/*
195   imghd_read()
195    imghd_read()
196196
197   Read sector(s) from MAME HD image
197    Read sector(s) from MAME HD image
198198*/
199199imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, UINT32 lbasector, void *buffer)
200200{
r5932r5933
206206
207207
208208/*
209   imghd_write()
209    imghd_write()
210210
211   Write sector(s) from MAME HD image
211    Write sector(s) from MAME HD image
212212*/
213213imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, UINT32 lbasector, const void *buffer)
214214{
r5932r5933
220220
221221
222222/*
223   imghd_get_header()
223    imghd_get_header()
224224
225   Return pointer to the header of MAME HD image
225    Return pointer to the header of MAME HD image
226226*/
227227const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk)
228228{
src/mess/tools/imgtool/filter.h
r5932r5933
11/***************************************************************************
22
3   filter.h
3    filter.h
44
5   Imgtool filters
5    Imgtool filters
66
77***************************************************************************/
88
src/mess/tools/imgtool/stream.c
r5932r5933
11/***************************************************************************
22
3   stream.c
3    stream.c
44
5   Code for implementing Imgtool streams
5    Code for implementing Imgtool streams
66
77***************************************************************************/
88
r5932r5933
453453         if (!ptr)
454454            return IMGTOOLERR_OUTOFMEMORY;
455455         stream_seek(s, 0, SEEK_SET);
456         if (stream_read(s, ptr, sz) != sz)
456         if (stream_read(s, ptr, sz) != sz)
457457         {
458458            free(ptr);
459459            return IMGTOOLERR_READERROR;
src/mess/tools/imgtool/imgterrs.c
r5932r5933
11/***************************************************************************
22
3   imgterrs.c
3    imgterrs.c
44
5   Imgtool errors
5    Imgtool errors
66
77***************************************************************************/
88
src/mess/tools/imgtool/imghd.h
r5932r5933
11/****************************************************************************
22
3   imghd.h
3    imghd.h
44
5   Bridge between Imgtool and CHD hard disk images
5    Bridge between Imgtool and CHD hard disk images
66
77****************************************************************************/
88
src/mess/audio/lmc1992.c
r5932r5933
143143
144144   lmc1992->intf = device->static_config;
145145
146//   assert(lmc1992->intf != NULL);
146//  assert(lmc1992->intf != NULL);
147147
148148   /* register for state saving */
149149
src/mess/audio/vic6560.c
r5932r5933
234234   channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, vic6560_update);
235235
236236   /* buffer for fastest played sample for 5 second
237    * so we have enough data for min 5 second */
237    * so we have enough data for min 5 second */
238238   noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
239239   noise = auto_alloc_array(device->machine, INT8, noisesize);
240240   {
src/mess/audio/lmc1992.h
r5932r5933
11/*
22
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
55
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
2121
2222*/
2323
src/mess/audio/channelf.c
r5932r5933
9191   rate = device->machine->sample_rate;
9292
9393   /*
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
9998     *
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     */
110110
111111   /* This is the proper value to add per sample */
112112   incr = 65536.0/(rate/1000.0/2.0);
src/mess/audio/sblaster.c
r5932r5933
11/***************************************************************************
22
3   audio/sblaster.c
3    audio/sblaster.c
44
5   Soundblaster code
5    Soundblaster code
66
77****************************************************************************/
88
r5932r5933
5555typedef enum { OFF, INPUT, OUTPUT } MODE;
5656static struct {
5757   SOUNDBLASTER_CONFIG config;
58//   int channel;
58//  int channel;
5959
6060   MODE mode;
6161   int on;
src/mess/audio/t6721.c
r5932r5933
11/***************************************************************************
22
3   toshiba 6721a chip approximation
4   (voice output)
3    toshiba 6721a chip approximation
4    (voice output)
55
6   not really working
6    not really working
77     communication with c364 works, no speech synthesis
8   includes c364 interface hardware
8    includes c364 interface hardware
99
10   PeT mess@utanet.at
10    PeT mess@utanet.at
1111    documentation
12     www.funet.fi
12     www.funet.fi
1313
1414***************************************************************************/
1515
src/mess/audio/svision.c
r5932r5933
8585         size = channel->reg[0] | ((channel->reg[1] & 7) << 8);
8686         if (size)
8787         {
88            //   channel->size=(int)(machine->sample_rate*(size<<5)/4e6);
88            //  channel->size=(int)(machine->sample_rate*(size<<5)/4e6);
8989            channel->size= (int) (machine->sample_rate * (size << 5) / cputag_get_clock(machine, "maincpu"));
9090         }
9191         else
src/mess/audio/lynx.c
r5932r5933
1717
1818
1919/*
20AUDIO_A   EQU $FD20
21AUDIO_B   EQU $FD28
22AUDIO_C   EQU $FD30
23AUDIO_D   EQU $FD38
20AUDIO_A EQU $FD20
21AUDIO_B EQU $FD28
22AUDIO_C EQU $FD30
23AUDIO_D EQU $FD38
2424
25VOLUME_CNTRL   EQU 0
26FEEDBACK_ENABLE EQU 1   ; enables 11/10/5..0
27OUTPUT_VALUE   EQU 2
28SHIFTER_L   EQU 3
29AUD_BAKUP   EQU 4
30AUD_CNTRL1   EQU 5
31AUD_COUNT   EQU 6
32AUD_CNTRL2   EQU 7
25VOLUME_CNTRL    EQU 0
26FEEDBACK_ENABLE EQU 1   ; enables 11/10/5..0
27OUTPUT_VALUE    EQU 2
28SHIFTER_L   EQU 3
29AUD_BAKUP   EQU 4
30AUD_CNTRL1  EQU 5
31AUD_COUNT   EQU 6
32AUD_CNTRL2  EQU 7
3333
3434; AUD_CNTRL1
35FEEDBACK_7   EQU %10000000
36AUD_RESETDONE   EQU %01000000
37AUD_INTEGRATE   EQU %00100000
38AUD_RELOAD   EQU %00010000
39AUD_CNTEN   EQU %00001000
40AUD_LINK   EQU %00000111
35FEEDBACK_7  EQU %10000000
36AUD_RESETDONE   EQU %01000000
37AUD_INTEGRATE   EQU %00100000
38AUD_RELOAD  EQU %00010000
39AUD_CNTEN   EQU %00001000
40AUD_LINK    EQU %00000111
4141; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1
42AUD_64us   EQU %00000110
43AUD_32us   EQU %00000101
44AUD_16us   EQU %00000100
45AUD_8us   EQU %00000011
46AUD_4us   EQU %00000010
47AUD_2us   EQU %00000001
48AUD_1us   EQU %00000000
42AUD_64us    EQU %00000110
43AUD_32us    EQU %00000101
44AUD_16us    EQU %00000100
45AUD_8us EQU %00000011
46AUD_4us EQU %00000010
47AUD_2us EQU %00000001
48AUD_1us EQU %00000000
4949
5050; 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)
5656
57ATTEN_A   EQU $FD40
58ATTEN_B   EQU $FD41
59ATTEN_C   EQU $FD42
60ATTEN_D   EQU $FD43
57ATTEN_A EQU $FD40
58ATTEN_B EQU $FD41
59ATTEN_C EQU $FD42
60ATTEN_D EQU $FD43
6161; B7..B4 attenuation left ear (0 silent ..15/16 volume)
6262; B3..B0       "     right ear
6363
64MPAN   EQU $FD44
64MPAN    EQU $FD44
6565; B7..B4 left ear
6666; B3..B0 right ear
6767; B7/B3 EQU Audio D
6868; a 1 enables attenuation for channel and side
6969
7070
71MSTEREO   EQU $FD50   ; a 1 disables audio connection
72AUD_D_LEFT   EQU %10000000
73AUD_C_LEFT   EQU %01000000
74AUD_B_LEFT   EQU %00100000
75AUD_A_LEFT   EQU %00010000
76AUD_D_RIGHT   EQU %00001000
77AUD_C_RIGHT   EQU %00000100
78AUD_B_RIGHT   EQU %00000010
79AUD_A_RIGHT   EQU %00000001
71MSTEREO EQU $FD50   ; a 1 disables audio connection
72AUD_D_LEFT  EQU %10000000
73AUD_C_LEFT  EQU %01000000
74AUD_B_LEFT  EQU %00100000
75AUD_A_LEFT  EQU %00010000
76AUD_D_RIGHT EQU %00001000
77AUD_C_RIGHT EQU %00000100
78AUD_B_RIGHT EQU %00000010
79AUD_A_RIGHT EQU %00000001
8080
8181 */
8282static sound_stream *mixer_channel;
r5932r5933
209209
210210void lynx_audio_write(int offset, UINT8 data)
211211{
212//   logerror("%.6f audio write %.2x %.2x\n", timer_get_time(machine), offset, data);
212//  logerror("%.6f audio write %.2x %.2x\n", timer_get_time(machine), offset, data);
213213    LYNX_AUDIO *channel=lynx_audio+((offset>>3)&3);
214214    stream_update(mixer_channel);
215215    switch (offset) {
src/mess/audio/ted7360.c
r5932r5933
160160   channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, ted7360_update);
161161
162162   /* buffer for fastest played sample for 5 second
163    * so we have enough data for min 5 second */
163    * so we have enough data for min 5 second */
164164   noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
165165   noise = auto_alloc_array(device->machine, UINT8, noisesize);
166166
src/mess/audio/dai.c
r5932r5933
4545   dai_input[0] = dai_input[1] = dai_input[2] = 0;
4646
4747   mixer_channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, dai_sh_update);
48   
48
4949   logerror ("sample rate: %d\n", device->machine->sample_rate);
5050}
5151
src/mess/audio/spchroms.c
r5932r5933
11/*
2   spchroms.c - This is an emulator for "typical" speech ROMs from TI, as used by TI99/4(a).
2    spchroms.c - This is an emulator for "typical" speech ROMs from TI, as used by TI99/4(a).
33
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.
77
8   One notable thing is that the address is a byte address (*NOT* a bit address).
8    One notable thing is that the address is a byte address (*NOT* a bit address).
99
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.
1212*/
1313
1414#include "driver.h"
r5932r5933
2222static int ROM_bits_count;            /* current bit position in ROM */
2323
2424/*
25   set the speech ROMs
25    set the speech ROMs
2626*/
2727void spchroms_config(running_machine *machine, const spchroms_interface *intf)
2828{
r5932r5933
4040}
4141
4242/*
43   Read 'count' bits serially from speech ROM
43    Read 'count' bits serially from speech ROM
4444*/
4545int spchroms_read(const device_config *device, int count)
4646{
r5932r5933
7878}
7979
8080/*
81   Write an address nibble to speech ROM
81    Write an address nibble to speech ROM
8282*/
8383void spchroms_load_address(const device_config *device, int data)
8484{
8585   /* tms5220 data sheet says that if we load only one 4-bit nibble, it won't work.
86     This code does not care about this. */
86      This code does not care about this. */
8787   speechROMaddr = ( (speechROMaddr & ~(0xf << load_pointer))
8888      | (((unsigned long) (data & 0xf)) << load_pointer) ) & TMS5220_ADDRESS_MASK;
8989   load_pointer += 4;
r5932r5933
9191}
9292
9393/*
94   Perform a read and branch command
94    Perform a read and branch command
9595*/
9696void spchroms_read_and_branch(const device_config *device)
9797{
9898   /* tms5220 data sheet says that if more than one speech ROM (tms6100) is present,
99     there is a bus contention.  This code does not care about this. */
99      there is a bus contention.  This code does not care about this. */
100100   if (speechROMaddr < speechROMlen-1)
101101      speechROMaddr = (speechROMaddr & 0x3c000UL)
102102         | (((((unsigned long) speechrom_data[speechROMaddr]) << 8)
src/mess/audio/mac.c
r5932r5933
11/***************************************************************************
22
3   mac.c
3    mac.c
44
5   Sound handler
5    Sound handler
66
77****************************************************************************/
88
r5932r5933
111111
112112
113113/*
114   Set the sound enable flag (VIA port line)
114    Set the sound enable flag (VIA port line)
115115*/
116116void mac_enable_sound(const device_config *device, int on)
117117{
r5932r5933
122122
123123
124124/*
125   Set the current sound buffer (one VIA port line)
125    Set the current sound buffer (one VIA port line)
126126*/
127127void mac_set_sound_buffer(const device_config *device, int buffer)
128128{
r5932r5933
137137
138138
139139/*
140   Set the current sound volume (3 VIA port line)
140    Set the current sound volume (3 VIA port line)
141141*/
142142void mac_set_volume(const device_config *device, int volume)
143143{
r5932r5933
151151
152152
153153/*
154   Fetch one byte from sound buffer and put it to sound output (called every scanline)
154    Fetch one byte from sound buffer and put it to sound output (called every scanline)
155155*/
156156void mac_sh_updatebuffer(const device_config *device)
157157{
src/mess/audio/mea8000.c
r5932r5933
121121#define SAMPLING ATTOTIME_IN_HZ((SUPERSAMPLING*F0))
122122
123123
124INLINE mea8000_t* get_safe_token( const device_config *device )
124INLINE mea8000_t* get_safe_token( const device_config *device )
125125{
126126   assert( device != NULL );
127127   assert( device->token != NULL );
r5932r5933
202202{
203203   mea8000_t* mea8000 = get_safe_token( device );
204204   /* 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    */
209209   if (mea8000->iface->req_out_func)
210210      mea8000->iface->req_out_func( device, 0, mea8000_accept_byte( mea8000 ) );
211211}
src/mess/audio/dave.c
r5932r5933
22
33    "Dave" Sound Chip
44
5   DAVE SOUND CHIP FOUND IN ENTERPRISE
5    DAVE SOUND CHIP FOUND IN ENTERPRISE
66
7    working:
7    working:
88
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
1313
1414**********************************************************************/
1515
r5932r5933
7272
7373   /* these are used to force channels on/off */
7474   /* 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 */
7777   int level_or[8];
7878   /* if one of the values is 0x00, this means the
79   volume is forced off, else it is dependant on the wave */
79    volume is forced off, else it is dependant on the wave */
8080   int level_and[8];
8181
8282   /* these are the current channel volumes in MAME form */
r5932r5933
165165   }
166166
167167   /* dave has 3 tone channels and 1 noise channel.
168   the volumes are mixed internally and output as left and right volume */
168    the volumes are mixed internally and output as left and right volume */
169169
170170   /* 3 tone channels + 1 noise channel */
171171   dave->sound_stream = stream_create(device, 0, 2, device->machine->sample_rate, NULL, dave_update_sound);
r5932r5933
321321   dave_t *dave = get_token(device);
322322   stream_sample_t *buffer1, *buffer2;
323323   /* 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 */
327327   int output_volumes[8];
328328   int left_volume;
329329   int right_volume;
r5932r5933
403403
404404/*-------------------------------------------------
405405    dave_sound_w - used to update sound output
406   based on data writes
406    based on data writes
407407-------------------------------------------------*/
408408
409409static WRITE8_DEVICE_HANDLER(dave_sound_w)
r5932r5933
485485
486486      case 7:
487487      {
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 */
494494
495495         logerror("selectable int ");
496496         switch ((data>>5) & 0x03)
r5932r5933
719719
720720/*-------------------------------------------------
721721    dave_set_external_int_state - negative edge
722   triggered
722    triggered
723723-------------------------------------------------*/
724724
725725static void dave_set_external_int_state(const device_config *device, int IntID, int State)
src/mess/audio/vp550.c
r5932r5933
11/**********************************************************************
22
3   RCA VP550 - VIP Super Sound System emulation
3    RCA VP550 - VIP Super Sound System emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88*********************************************************************/
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - tempo control
15   - mono/stereo mode
16   - VP551 memory map
14    - tempo control
15    - mono/stereo mode
16    - VP551 memory map
1717
1818*/
1919
r5932r5933
138138{
139139   //float gain = 0.625f * (data & 0x0f);
140140
141//   sound_set_output_gain(device, 0, gain);
141//  sound_set_output_gain(device, 0, gain);
142142
143143   if (LOG) logerror("VP550 '%s' Volume: %u\n", device->tag, data & 0x0f);
144144}
r5932r5933
150150static WRITE8_DEVICE_HANDLER( vp550_sync_w )
151151{
152152   timer_device_enable(device, BIT(data, 0));
153   
153
154154   if (LOG) logerror("VP550 Interrupt Enable: %u\n", BIT(data, 0));
155155}
156156
157157/*-------------------------------------------------
158158    vp550_install_readwrite_handler - install
159   or uninstall write handlers
159    or uninstall write handlers
160160-------------------------------------------------*/
161161
162162void vp550_install_write_handlers(const device_config *device, const address_space *program, int enabled)
r5932r5933
185185
186186/*-------------------------------------------------
187187    vp551_install_readwrite_handler - install
188   or uninstall write handlers
188    or uninstall write handlers
189189-------------------------------------------------*/
190190
191191void vp551_install_write_handlers(const device_config *device, const address_space *program, int enabled)
r5932r5933
199199static TIMER_DEVICE_CALLBACK( sync_tick )
200200{
201201   cpu_set_input_line(timer->machine->firstcpu, CDP1802_INPUT_LINE_INT, ASSERT_LINE);
202   
202
203203   if (LOG) logerror("VP550 Interrupt\n");
204204}
205205
src/mess/audio/socrates.c
r5932r5933
1111#include "streams.h"
1212#include "socrates.h"
1313
14typedef struct
14typedef struct
1515{
16   sound_stream *stream;
16   sound_stream *stream;
1717   UINT8 freq[2]; /* channel 1,2 frequencies */
1818   UINT8 vol[2]; /* channel 1,2 volume */
1919   UINT8 enable[2]; /* channel 1,2 enable */
r5932r5933
8686      outputs[0][i] = ((int)chip->DAC_output<<4);
8787   }
8888}
89   
9089
9190
91
9292/*************************************
9393 *
9494 *  Sound handler start
src/mess/audio/vp550.h
r5932r5933
11/**********************************************************************
22
3   RCA VP550 - VIP Super Sound System emulation
3    RCA VP550 - VIP Super Sound System emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************/
src/mess/audio/gb.c
r5932r5933
1717*
1818* Changes:
1919*
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!
3939*
4040***************************************************************************************/
4141
r5932r5933
382382      break;
383383   case NR52: /* Sound On/Off (R/W) */
384384      /* Only bit 7 is writable, writing to bits 0-3 does NOT enable or
385         disable sound.  They are read-only */
385           disable sound.  They are read-only */
386386      gb->snd_control.on = (data & 0x80) >> 7;
387387      if( !gb->snd_control.on )
388388      {
r5932r5933
391391         gb_sound_w_internal( device, NR12, 0x00 );
392392         gb_sound_w_internal( device, NR13, 0xFE );
393393         gb_sound_w_internal( device, NR14, 0xBF );
394//         gb_sound_w_internal( device, NR20, 0xFF );
394//          gb_sound_w_internal( device, NR20, 0xFF );
395395         gb_sound_w_internal( device, NR21, 0x3F );
396396         gb_sound_w_internal( device, NR22, 0x00 );
397397         gb_sound_w_internal( device, NR23, 0xFF );
r5932r5933
401401         gb_sound_w_internal( device, NR32, 0x9F );
402402         gb_sound_w_internal( device, NR33, 0xFF );
403403         gb_sound_w_internal( device, NR34, 0xBF );
404//         gb_sound_w_internal( device, NR40, 0xFF );
404//          gb_sound_w_internal( device, NR40, 0xFF );
405405         gb_sound_w_internal( device, NR41, 0xFF );
406406         gb_sound_w_internal( device, NR42, 0x00 );
407407         gb_sound_w_internal( device, NR43, 0x00 );
r5932r5933
567567      if( gb->snd_3.on )
568568      {
569569         /* 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.*/
572572         sample = gb->snd_regs[AUD3W0 + (gb->snd_3.offset/2)];
573573         if( !(gb->snd_3.offset % 2) )
574574         {
r5932r5933
624624         if( gb->snd_4.pos == (gb->snd_4.period >> (FIXED_POINT + 1)) )
625625         {
626626            /* 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 */
629629            mode4_mask = (((gb->snd_4.ply_value & 0x2) >> 1) ^ (gb->snd_4.ply_value & 0x1)) << (gb->snd_4.ply_step ? 6 : 14);
630630            gb->snd_4.ply_value >>= 1;
631631            gb->snd_4.ply_value |= mode4_mask;
r5932r5933
721721      for( J = 0; J < 16; J++ )
722722      {
723723         /* I is the dividing ratio of frequencies
724            J is the shift clock frequency */
724               J is the shift clock frequency */
725725         gb->period_mode4_table[I][J] = ((1 << FIXED_POINT) / (524288 / ((I == 0)?0.5:I) / (1 << (J + 1)))) * gb->rate;
726726      }
727727   }
src/mess/audio/cdp1863.c
r5932r5933
11/*
22
3   TODO:
3    TODO:
44
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
77
88*/
99
src/mess/audio/vp595.c
r5932r5933
11/**********************************************************************
22
3   RCA VP595 - VIP Simple Sound System emulation
3    RCA VP595 - VIP Simple Sound System emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88*********************************************************************/
r5932r5933
7070
7171/*-------------------------------------------------
7272    vp595_install_readwrite_handler - install
73   or uninstall write handlers
73    or uninstall write handlers
7474-------------------------------------------------*/
7575
7676void vp595_install_write_handlers(const device_config *device, const address_space *io, int enabled)
src/mess/audio/cdp1863.h
r5932r5933
11/*
22
3           CDP1863 CMOS 8-Bit Programmable Frequency Generator
3              CDP1863 CMOS 8-Bit Programmable Frequency Generator
44
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
1414
1515*/
1616
src/mess/audio/vp595.h
r5932r5933
11/**********************************************************************
22
3   RCA VP595 - VIP Simple Sound System emulation
3    RCA VP595 - VIP Simple Sound System emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************/
src/mess/video/wswan.c
r5932r5933
223223         if ( x_offset >= 0 && x_offset < WSWAN_X_PIXELS ) {
224224            if ( wswan_vdp.colors_16 ) {
225225               if ( col ) {
226//                  if ( wswan_vdp.color_mode ) {
226//                      if ( wswan_vdp.color_mode ) {
227227                     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//                      }
232232               }
233233            } else {
234234               if ( col || !(tile_palette & 4 ) ) {
r5932r5933
507507                  }
508508               } else {
509509                  if ( x_offset < wswan_vdp.window_sprites_left || x_offset > wswan_vdp.window_sprites_right ) {
510//                     continue;
510//                          continue;
511511                  }
512512               }
513513            }
r5932r5933
558558   }
559559
560560   /*
561    * Draw background layer
562    */
561     * Draw background layer
562     */
563563   if ( wswan_vdp.layer_bg_enable ) {
564564      wswan_draw_background();
565565   }
566566
567567   /*
568    * Draw sprites between background and foreground layers
569    */
568     * Draw sprites between background and foreground layers
569     */
570570   if ( wswan_vdp.sprites_enable ) {
571571      wswan_handle_sprites( 0 );
572572   }
573573
574574   /*
575    * Draw foreground layer, taking window settings into account
576    */
575     * Draw foreground layer, taking window settings into account
576     */
577577   if ( wswan_vdp.layer_fg_enable ) {
578578      switch( wswan_vdp.window_fg_mode ) {
579579      case 0:   /* FG inside & outside window area */
r5932r5933
598598   }
599599
600600   /*
601    * Draw sprites in front of foreground layer
602    */
601     * Draw sprites in front of foreground layer
602     */
603603   if ( wswan_vdp.sprites_enable ) {
604604      wswan_handle_sprites( 0x2000 );
605605   }
src/mess/video/zx.c
r5932r5933
11/***************************************************************************
2   zx.c
2    zx.c
33
44    video hardware
5   Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999
5    Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999
66
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.
1111
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.
1616
1717****************************************************************************/
1818
r5932r5933
5757
5858      new_y = video_screen_get_vpos(machine->primary_screen);
5959      new_x = video_screen_get_hpos(machine->primary_screen);
60/*      logerror("zx_ula_bkgnd: %3d,%3d - %3d,%3d\n", old_x, old_y, new_x, new_y);*/
60/*      logerror("zx_ula_bkgnd: %3d,%3d - %3d,%3d\n", old_x, old_y, new_x, new_y);*/
6161      y = old_y;
6262      for (;;)
6363      {
r5932r5933
8888
8989/*
9090 * 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
9595 * 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
9999 */
100100static TIMER_CALLBACK(zx_ula_nmi)
101101{
102102   /*
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     */
106106   const device_config *screen = video_screen_first(machine->config);
107107   int height = video_screen_get_height(screen);
108108   rectangle r = *video_screen_get_visible_area(screen);
r5932r5933
110110
111111   r.min_y = r.max_y = ula_scanline_count;
112112   bitmap_fill(bitmap, &r, 1);
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));
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));
114114   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
115115   if (++ula_scanline_count == height)
116116      ula_scanline_count = 0;
r5932r5933
120120{
121121
122122   /*
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     */
127127   if (ula_irq_active)
128128   {
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));
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));
130130
131131      ula_irq_active = 0;
132132      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
src/mess/video/dgn_beta.c
r5932r5933
11/*
2   video/dgn_beta.c
2    video/dgn_beta.c
33
44The Dragon Beta uses a 68B45 for it's display generation, this is used in the
55conventional wat with a character generator ROM in the two text modes, which are
r5932r5933
99
1010The attributes decode as follows :-
1111
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
1414
15   f=flash
16   u=underline
15    f=flash
16    u=underline
1717
18   FFF = foreground colour
19   BBB = bakcground colour
18    FFF = foreground colour
19    BBB = bakcground colour
2020
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
2929
30   If flash is true, foreground and background colours will be exchanged.
30    If flash is true, foreground and background colours will be exchanged.
3131
3232It is interesting to note that the 6845 uses 16 bit wide access to the ram, in contrast
3333to the 8 bit accesses from the CPUs, this allows each increment of the MA lines to move
r5932r5933
5151However the modes supported are :-
5252
5353Text 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
5757Graphics 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
6363
6464Looking at the parts of the circuit sheet that I have seen it looks like the graphics modes
6565are driven using a combination of the 6845 MA and RA lines to address more than 64K or memory
r5932r5933
203203
204204/* Set video control register from I28 port B, the control register is laid out as */
205205/* 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                */
215215/* the top two address lines for the video ram, are supplied by the BB6 and PB7 on */
216216/* 6821-I28, this allows the 6845 to access the full 64K address range, however    */
217217/* since the ram data is addressed as a 16bit wide unit, this allows the 6845      */
r5932r5933
257257      int HW=m6845_get_register(H_SYNC_WIDTH)&0xF;   // Hsync width (in chars)
258258
259259      beta_scr_y++;
260//      beta_scr_x=0-(((HT-HS)-HW)*8);   // Number of dots after HS to wait before start of next line
260//      beta_scr_x=0-(((HT-HS)-HW)*8);  // Number of dots after HS to wait before start of next line
261261      beta_scr_x=0-((HT-(HS+HW))*Dots);
262262
263263//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)));
r5932r5933
288288      else if (DrawInterlace==INTERLACE_ON)
289289      {
290290         Field=(Field+1) & 0x01;   /* Invert field */
291//         debug_console_printf(machine, "Invert field=%d\n",Field);
291//          debug_console_printf(machine, "Invert field=%d\n",Field);
292292      }
293293      VSyncMin=beta_scr_y;
294294   }
r5932r5933
498498   {
499499      PlotY=(y*2);//+Field;
500500      DoubleY=0;
501//      debug_console_printf(machine, "Field=%d\n",Field);
501//      debug_console_printf(machine, "Field=%d\n",Field);
502502   }
503503
504504   /* Error check, make sure we're drawing on the actual bitmap ! */
r5932r5933
601601            Colour=ColourRAM[((Word&0x8000)>>15)];
602602            plot_gfx_pixel(x,y,Dot,Colour,bitmap);
603603
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);
606606
607607            Hi=Word&0x8000;
608608            Word=((Word<<1)&0xFFFE) | (Hi>>15);
src/mess/video/pdp1.c
r5932r5933
11/*
2   video/pdp1.c
2    video/pdp1.c
33
4   PDP1 video emulation.
4    PDP1 video emulation.
55
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
1010
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.
1313
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
1616*/
1717
1818#include <math.h>
r5932r5933
5151}
5252
5353/*
54   video init
54    video init
5555*/
5656VIDEO_START( pdp1 )
5757{
r5932r5933
7070
7171
7272/*
73   schedule a pixel to be plotted
73    schedule a pixel to be plotted
7474*/
7575void pdp1_plot(int x, int y)
7676{
r5932r5933
8282
8383
8484/*
85   video_update_pdp1: effectively redraw the screen
85    video_update_pdp1: effectively redraw the screen
8686*/
8787VIDEO_UPDATE( pdp1 )
8888{
r5932r5933
100100
101101
102102/*
103   Operator control panel code
103    Operator control panel code
104104*/
105105
106106enum
r5932r5933
247247
248248
249249/*
250   draw the operator control panel (fixed backdrop)
250    draw the operator control panel (fixed backdrop)
251251*/
252252static void pdp1_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap)
253253{
r5932r5933
298298}
299299
300300/*
301   draw the operator control panel (dynamic elements)
301    draw the operator control panel (dynamic elements)
302302*/
303303static void pdp1_draw_panel(running_machine *machine, bitmap_t *bitmap)
304304{
r5932r5933
342342
343343
344344/*
345   Typewriter code
345    Typewriter code
346346*/
347347
348348
r5932r5933
493493
494494
495495/*
496   lightpen code
496    lightpen code
497497*/
498498
499499void pdp1_update_lightpen_state(const lightpen_t *new_state)
r5932r5933
574574   if (previous_lightpen_state.active)
575575   {
576576      /*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);*/
584584      pdp1_draw_circle(bitmap, previous_lightpen_state.x, previous_lightpen_state.y, previous_lightpen_state.radius, pen_black);
585585   }
586586}
r5932r5933
591591   {
592592      int color_ = lightpen_state.down ? pen_lightpen_pressed : pen_lightpen_nonpressed;
593593      /*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);*/
601601      pdp1_draw_circle(bitmap, lightpen_state.x, lightpen_state.y, lightpen_state.radius, color_);
602602   }
603603   previous_lightpen_state = lightpen_state;
src/mess/video/homelab.c
r5932r5933
11/***************************************************************************
22
3      Homelab video driver by Miodrag Milanovic
3        Homelab video driver by Miodrag Milanovic
44
5      31/08/2008 Preliminary driver.
6           
5        31/08/2008 Preliminary driver.
6
77****************************************************************************/
88
99
1010#include "driver.h"
1111#include "includes/homelab.h"
12 
1312
13
1414VIDEO_START( homelab )
1515{
1616}
17
17
1818VIDEO_UPDATE( homelab )
1919{
2020   int x,y,j,b;
r5932r5933
2525   {
2626      for(x = 0; x < 40; x++ )
2727      {
28         int code = memory_read_byte(space, 0xc000 + x + y*40);     
28         int code = memory_read_byte(space, 0xc000 + x + y*40);
2929         for(j = 0; j < 8; j++ )
3030         {
3131            for(b = 0; b < 8; b++ )
r5932r5933
4848   {
4949      for(x = 0; x < 80; x++ )
5050      {
51         int code = memory_read_byte(space, 0xf000 + x + y * 80);     
51         int code = memory_read_byte(space, 0xf000 + x + y * 80);
5252         for(j = 0; j < 8; j++ )
5353         {
5454            for(b = 0; b < 8; b++ )
src/mess/video/cpschngr.c
r5932r5933
11/***************************************************************************
22
3   CPS Changer
3    CPS Changer
44
55***************************************************************************/
66
src/mess/video/pc1401.c
r5932r5933
158158      }
159159    }
160160
161   pocketc_draw_special(bitmap, RIGHT+149, DOWN+24, line,
161   pocketc_draw_special(bitmap, RIGHT+149, DOWN+24, line,
162162         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,
165165         pc1401_lcd.reg[0x3d] & 0x01 ? color[1] : color[0]);
166166
167167   pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, def,
src/mess/video/apple2gs.c
r5932r5933
11/*********************************************************************
22
3   video/apple2gs.c
3    video/apple2gs.c
44
5   Apple IIgs video code
5    Apple IIgs video code
66
77*********************************************************************/
88
src/mess/video/pc8401a.c
r5932r5933
107107/* Machine Drivers */
108108
109109MACHINE_DRIVER_START( pc8401a_video )
110//   MDRV_DEFAULT_LAYOUT(layout_pc8401a)
111   
110//  MDRV_DEFAULT_LAYOUT(layout_pc8401a)
111
112112   MDRV_PALETTE_LENGTH(2)
113113   MDRV_PALETTE_INIT(pc8401a)
114114
r5932r5933
125125
126126MACHINE_DRIVER_START( pc8500_video )
127127   MDRV_DEFAULT_LAYOUT(layout_pc8500)
128   
128
129129   MDRV_PALETTE_LENGTH(2+8)
130130   MDRV_PALETTE_INIT(pc8401a)
131131
src/mess/video/hp48.c
r5932r5933
8686
8787
8888        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
9191
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
9595
96   Pixels are 1-bit, packed in memory.
96    Pixels are 1-bit, packed in memory.
9797
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).
101101
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.
109105
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.
113113 */
114114
115115
116116/*
117117        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.
125125 */
126126
127127
r5932r5933
151151
152152   LOG(( "%f hp48 video_update called: ", attotime_to_double(timer_get_time(screen->machine)) ));
153153
154   if ( !display || refresh )
155   {
154   if ( !display || refresh )
155   {
156156      LOG(( "display off\n" ));
157157      bitmap_fill( bitmap, NULL, 0 );
158      return 0;     
158      return 0;
159159   }
160160
161161   /* correcting factors */
162162   if ( right_margin & 0x800 ) right_margin -= 0x1000;
163163   if ( last_line <= 1 ) last_line = 0x3f;
164164
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 ));
167167
168168   /* draw main bitmap */
169169   addr = bitmap_start;
170   for ( y = 0; y <= last_line; y++ )
170   for ( y = 0; y <= last_line; y++ )
171171   {
172172      xp = -left_margin;
173173      for ( x = 0; x < 34; x++, addr++ )
r5932r5933
179179
180180   /* draw menu bitmap */
181181   addr = menu_start;
182   for ( ; y <= 0x3f; y++ )
182   for ( ; y <= 0x3f; y++ )
183183   {
184184      xp = 0;
185185      for ( x = 0; x < 34; x++, addr++ )
r5932r5933
200200         }
201201         acc = (acc * 255) / (33 * HP48_NB_SCREENS);
202202         *BITMAP_ADDR16( bitmap, y, x ) = acc;
203      }     
203      }
204204   }
205205
206206   hp48_cur_screen = (hp48_cur_screen + 1) % HP48_NB_SCREENS;
src/mess/video/apple3.c
r5932r5933
11/***************************************************************************
22
3   video/apple3.c
3    video/apple3.c
44
5   Apple ///
5    Apple ///
66
77***************************************************************************/
88
src/mess/video/hd44102.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - 4 bit mode
15   - busy flag
16   - reset flag
14    - 4 bit mode
15    - busy flag
16    - reset flag
1717
1818*/
1919
r5932r5933
224224         if ((sy >= cliprect->min_y) && (sy <= cliprect->max_y) && (sx >= cliprect->min_x) && (sx <= cliprect->max_x))
225225         {
226226            int color = (hd44102->status & HD44102_STATUS_DISPLAY_OFF) ? 0 : BIT(data, z % 8);
227           
227
228228            *BITMAP_ADDR16(bitmap, sy, sx) = color;
229229         }
230230
src/mess/video/911_vdt.c
r5932r5933
11/*
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).
44
5   Raphael Nabet 2002
5    Raphael Nabet 2002
66
77TODO:
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???
1010*/
1111
1212
r5932r5933
111111static vdt_t vdt[MAX_VDT];
112112
113113/*
114   Macros for model features
114    Macros for model features
115115*/
116116/* TRUE for japanese and arabic terminals, which use 8-bit charcodes and keyboard shift modes */
117117#define USES_8BIT_CHARCODES(unit) ((vdt[unit].model == vdt911_model_Japanese) /*|| (vdt[unit].model == vdt911_model_Arabic)*/)
118118/* TRUE for keyboards which have this extra key (on the left of TAB/SKIP)
119   (Most localized keyboards have it) */
119    (Most localized keyboards have it) */
120120#define HAS_EXTRA_KEY_67(unit) (! ((vdt[unit].model == vdt911_model_US) || (vdt[unit].model == vdt911_model_UK) || (vdt[unit].model == vdt911_model_French)))
121121/* TRUE for keyboards which have this extra key (on the right of space),
122   AND do not use it as a modifier */
122    AND do not use it as a modifier */
123123#define HAS_EXTRA_KEY_91(unit) ((vdt[unit].model == vdt911_model_German) || (vdt[unit].model == vdt911_model_Swedish) || (vdt[unit].model == vdt911_model_Norwegian))
124124
125125static TIMER_CALLBACK(blink_callback);
126126static TIMER_CALLBACK(beep_callback);
127127
128128/*
129   Initialize vdt911 palette
129    Initialize vdt911 palette
130130*/
131131PALETTE_INIT( vdt911 )
132132{
r5932r5933
145145}
146146
147147/*
148   Copy a character bitmap array to another location in memory
148    Copy a character bitmap array to another location in memory
149149*/
150150static void copy_character_matrix_array(const UINT8 char_array[128][10], UINT8 *dest)
151151{
r5932r5933
157157}
158158
159159/*
160   Patch a character bitmap array according to an array of char_override_t
160    Patch a character bitmap array according to an array of char_override_t
161161*/
162162static void apply_char_overrides(int nb_char_overrides, const char_override_t char_overrides[], UINT8 *dest)
163163{
r5932r5933
171171}
172172
173173/*
174   Initialize the 911 vdt core
174    Initialize the 911 vdt core
175175*/
176176void vdt911_init(running_machine *machine)
177177{
r5932r5933
234234}
235235
236236/*
237   Initialize one 911 vdt controller/terminal
237    Initialize one 911 vdt controller/terminal
238238*/
239239void vdt911_init_term(running_machine *machine,int unit, const vdt911_init_params_t *params)
240240{
r5932r5933
257257}
258258
259259/*
260   Reset the controller board
260    Reset the controller board
261261*/
262262void vdt911_reset(void)
263263{
264264}
265265
266266/*
267   timer callback to toggle blink state
267    timer callback to toggle blink state
268268*/
269269static TIMER_CALLBACK(blink_callback)
270270{
r5932r5933
273273}
274274
275275/*
276   timer callback to stop beep generator
276    timer callback to stop beep generator
277277*/
278278static TIMER_CALLBACK(beep_callback)
279279{
r5932r5933
281281}
282282
283283/*
284   CRU interface read
284    CRU interface read
285285*/
286286static int vdt911_cru_r(int offset, int unit)
287287{
r5932r5933
317317         if (vdt[unit].keyboard_data & 0x80)
318318            reply |= 0x08;
319319         /*if (! vdt[unit].terminal_ready)
320            reply |= 0x10;*/
320                reply |= 0x10;*/
321321         if (vdt[unit].previous_word_select)
322322            reply |= 0x20;
323323         /*if (vdt[unit].keyboard_parity_error)
324            reply |= 0x40;*/
324                reply |= 0x40;*/
325325         if (vdt[unit].keyboard_data_ready)
326326            reply |= 0x80;
327327         break;
r5932r5933
332332}
333333
334334/*
335   CRU interface write
335    CRU interface write
336336*/
337337static void vdt911_cru_w(const address_space *space, int offset, int data, int unit)
338338{
r5932r5933
474474}
475475
476476/*
477   Video refresh
477    Video refresh
478478*/
479479void vdt911_refresh(running_machine *machine, bitmap_t *bitmap, int unit, int x, int y)
480480{
r5932r5933
487487   int color;
488488
489489   /*if (use_8bit_charcodes)
490      color = vdt[unit].dual_intensity_enable ? 1 : 0;*/
490        color = vdt[unit].dual_intensity_enable ? 1 : 0;*/
491491
492492   if (! vdt[unit].display_enable)
493493   {
r5932r5933
548548};
549549
550550/*
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.
553553*/
554554void vdt911_keyboard(running_machine *machine, int unit)
555555{
r5932r5933
595595   }
596596   else
597597   {   /* we are using a western keyboard, or a katakana/arabic keyboard in
598      romaji/latin mode */
598        romaji/latin mode */
599599      foreign_mode = FALSE;
600600
601601      if (key_buf[3] & 0x0040)
src/mess/video/i82720.c
r5932r5933
11/******************************************************************************
22
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.
55
6   Per Ola Ingvarsson
7   Tomas Karlsson
6    Per Ola Ingvarsson
7    Tomas Karlsson
88
99 ******************************************************************************/
1010
src/mess/video/dai.c
r5932r5933
2222
2323const unsigned char dai_palette[16*3] =
2424{
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     */
4141};
4242
4343static unsigned short dai_4_colours_palette[4];
r5932r5933
4646{
4747   int i;
4848
49   for ( i = 0; i < sizeof(dai_palette) / 3; i++ )
49   for ( i = 0; i < sizeof(dai_palette) / 3; i++ )
5050   {
5151      palette_set_color_rgb(machine, i, dai_palette[i * 3], dai_palette[i * 3 + 1], dai_palette[i * 3 + 2]);
5252   }
r5932r5933
7171   UINT16 current_video_memory_address = dai_video_memory_start;
7272
7373   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 */
7777   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 */
8383   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 */
8787   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) */
9292   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 */
9898   UINT8 unit_mode;
9999
100100   UINT8 current_data_1, current_data_2;
src/mess/video/i82720.h
r5932r5933
11/******************************************************************************
22
3   i82720.h
3    i82720.h
44
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
88
99 ******************************************************************************/
1010
src/mess/video/mac.c
r5932r5933
11/***************************************************************************
22
3   video/mac.c
3    video/mac.c
44
5   Macintosh video hardware
5    Macintosh video hardware
66
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)
1010
1111***************************************************************************/
1212
src/mess/video/cbmb.c
r5932r5933
4848
4949VIDEO_START( cbm700 )
5050{
51   int i;   
51   int i;
5252
5353    /* 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++)
5555   {
56//      if( i < 176 || i > 223 )
56//      if( i < 176 || i > 223 )
5757      {
5858         int y;
5959         for( y = 0; y < machine->gfx[0]->height; y++ ) {
src/mess/video/ac1.c
r5932r5933
3030{
3131   int x,y;
3232   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
33   
33
3434   for(y = 0; y < 16; y++ )
3535   {
3636      for(x = 0; x < 64; x++ )
r5932r5933
4646{
4747   int x,y;
4848   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
49   
49
5050   for(y = 0; y < 32; y++ )
5151   {
5252      for(x = 0; x < 64; x++ )
src/mess/video/cirrus.c
r5932r5933
11/***************************************************************************
22
3   video/cirrus.c
3    video/cirrus.c
44
5   Cirrus SVGA card emulation (preliminary)
5    Cirrus SVGA card emulation (preliminary)
66
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:
99
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
2828
2929
3030
3131
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)
6161
6262***************************************************************************/
6363
r5932r5933
146146
147147/*************************************
148148 *
149 *   PCI card interface
149 *  PCI card interface
150150 *
151151 *************************************/
152152
r5932r5933
193193
194194/*************************************
195195 *
196 *   Ports
196 *  Ports
197197 *
198198 *************************************/
199199
src/mess/video/mc80.c
r5932r5933
11/***************************************************************************
22
3        MC-80.xx video by Miodrag Milanovic
3        MC-80.xx video by Miodrag Milanovic
44
55        15/05/2009 Initial implementation
66        12/05/2009 Skeleton driver.
r5932r5933
2222   0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E
2323   0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F
2424   0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G
25   
25
2626   0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H
2727   0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I
2828   0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J
r5932r5933
3131   0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M
3232   0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N
3333   0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O
34   
34
3535   0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P
3636   0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q
3737   0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R
r5932r5933
4040   0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U
4141   0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V
4242   0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W
43   
43
4444   0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X
4545   0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y
4646   0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z
r5932r5933
4949   0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ]
5050   0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^
5151   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, //
5454   0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // !
5555   0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // "
5656   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, //
5858   0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // %
5959   0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // &
6060   0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // '
61   
61
6262   0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // (
6363   0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // )
6464   0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // *
r5932r5933
6767   0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // -
6868   0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // .
6969   0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // /
70   
70
7171   0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0
7272   0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1
7373   0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2
r5932r5933
7676   0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5
7777   0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6
7878   0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7
79   
79
8080   0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8
8181   0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9
8282   0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // :
r5932r5933
103103   int x,y,j,b;
104104     UINT16 addr;
105105     int xpos;
106 
106
107107   for(y = 0; y < 8; y++ )
108108   {
109109      addr = y*32;
110110      xpos = 0;
111111      for(x = 0; x < 32; x++ )
112112      {
113         UINT8 code = mc8020_video_ram[addr + x] & 0x3f;                 
113         UINT8 code = mc8020_video_ram[addr + x] & 0x3f;
114114         for(j = 0; j < 8; j++ )
115         {           
115         {
116116           for(b = 0; b < 6; b++ )
117117           {
118118              *BITMAP_ADDR16(bitmap, y*16+j, xpos+b ) = (prom[code*8 + j] >> (5-b)) & 1;
119           }                     
119           }
120120         }
121121         xpos += 6;
122122      }
r5932r5933
139139{
140140   UINT8 code;
141141   int y, x, b;
142   
143   int addr = 0;   
142
143   int addr = 0;
144144   for (y = 0; y < 256; y++)
145145   {
146146      int horpos = 0;
147147      for (x = 0; x < 64; x++)
148      {         
148      {
149149         code = mc8030_video_mem[addr++];
150150         for (b = 0; b < 8; b++)
151         {           
151         {
152152            *BITMAP_ADDR16(bitmap, 255-y, horpos++) =  (code >> b) & 0x01;
153153         }
154154      }
src/mess/video/mbee.c
r5932r5933
11/***************************************************************************
2   microbee.c
2    microbee.c
33
44    video hardware
5   Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999
5    Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999
66
77****************************************************************************/
88
r5932r5933
125125      crt.lpen_lo = offs & 0xff;
126126      crt.lpen_hi = (offs >> 8) & 0x03;
127127      crt.lpen_strobe = 1;
128//      logerror("mbee keyboard_matrix_r $%03X (port:%d bit:%d) = %d\n", offs, port, bit, data);
128//      logerror("mbee keyboard_matrix_r $%03X (port:%d bit:%d) = %d\n", offs, port, bit, data);
129129   }
130130   return data;
131131}
r5932r5933
158158
159159WRITE8_HANDLER( mbee_1c_w )
160160{
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 */
165165
166166   memory_set_bank(space->machine, 6, (data & 0x20) ? 1 : 0);
167167}
r5932r5933
184184{
185185   /*int data = */keyboard_matrix_r(machine, param);
186186   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);
189189}
190190
191191READ8_HANDLER ( m6545_status_r )
r5932r5933
202202      data |= 0x40;   /* lpen register full */
203203   if( crt.update_strobe )
204204      data |= 0x80;   /* update strobe has occured */
205//   logerror("6545 status_r $%02X\n", data);
205//  logerror("6545 status_r $%02X\n", data);
206206   return data;
207207}
208208
r5932r5933
250250      data = crt.cursor_address_lo;
251251      break;
252252   case 16:
253//      logerror("6545 lpen_hi_r $%02X (lpen:%d upd:%d)\n", crt.lpen_hi, crt.lpen_strobe, crt.update_strobe);
253//      logerror("6545 lpen_hi_r $%02X (lpen:%d upd:%d)\n", crt.lpen_hi, crt.lpen_strobe, crt.update_strobe);
254254      crt.lpen_strobe = 0;
255255      crt.update_strobe = 0;
256256      data = crt.lpen_hi;
257257      break;
258258   case 17:
259//      logerror("6545 lpen_lo_r $%02X (lpen:%d upd:%d)\n", crt.lpen_lo, crt.lpen_strobe, crt.update_strobe);
259//      logerror("6545 lpen_lo_r $%02X (lpen:%d upd:%d)\n", crt.lpen_lo, crt.lpen_strobe, crt.update_strobe);
260260      crt.lpen_strobe = 0;
261261      crt.update_strobe = 0;
262262      data = crt.lpen_lo;
263263      break;
264264   case 18:
265//      logerror("6545 transp_hi_r $%02X\n", crt.transp_hi);
265//      logerror("6545 transp_hi_r $%02X\n", crt.transp_hi);
266266      data = crt.transp_hi;
267267      break;
268268   case 19:
269//      logerror("6545 transp_lo_r $%02X\n", crt.transp_lo);
269//      logerror("6545 transp_lo_r $%02X\n", crt.transp_lo);
270270      data = crt.transp_lo;
271271      break;
272272   case 31:
273273      /* shared memory latch */
274274      addr = (crt.transp_hi << 8) | crt.transp_lo;
275//      logerror("6545 transp_latch $%04X\n", addr);
275//      logerror("6545 transp_latch $%04X\n", addr);
276276      m6545_update_strobe(space->machine, addr);
277277      break;
278278   default:
r5932r5933
383383   case 18:
384384      data &= 63;
385385      crt.transp_hi = data;
386//      logerror("6545 transp_hi_w $%02X\n", data);
386//      logerror("6545 transp_hi_w $%02X\n", data);
387387      break;
388388   case 19:
389389      crt.transp_lo = data;
390//      logerror("6545 transp_lo_w $%02X\n", data);
390//      logerror("6545 transp_lo_w $%02X\n", data);
391391      break;
392392   case 31:
393393      /* shared memory latch */
394394      addr = (crt.transp_hi << 8) | crt.transp_lo;
395//      logerror("6545 transp_latch $%04X\n", addr);
395//      logerror("6545 transp_latch $%04X\n", addr);
396396      m6545_update_strobe(space->machine, addr);
397397      break;
398398   default:
r5932r5933
401401}
402402
403403/* The 6845 can produce a variety of cursor shapes - all are emulated here
404   Need to find out if the 6545 works the same way */
404    Need to find out if the 6545 works the same way */
405405static void mc6845_cursor_configure(void)
406406{
407407   UINT8 i,curs_type=0,r9,r10,r11;
408408
409409   /* 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) */
414414
415415   for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) mc6845_cursor[i] = 0;      // prepare cursor by erasing old one
416416
r5932r5933
432432   if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(mc6845_cursor);i++) mc6845_cursor[i]=0xff; // turn on full cursor
433433
434434   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
436436   if (curs_type == 3) for (i = r11; i < r10;i++) mc6845_cursor[i]=0; // now take a bite out of the middle
437437}
438438
r5932r5933
445445   UINT16 height = crt.vertical_displayed*(crt.scan_lines+1)-1;               // height in pixels
446446   UINT16 bytes = crt.horizontal_displayed*crt.vertical_displayed-1;            // video ram needed
447447
448   if (width > 0x27f) width=0x27f;   
448   if (width > 0x27f) width=0x27f;
449449   if (height > 0x10f) height=0x10f;
450450
451451   /* Resize the screen */
r5932r5933
575575PALETTE_INIT( mbeeic )
576576{
577577   UINT16 i;
578   UINT8 r, b, g, k;
578   UINT8 r, b, g, k;
579579   UINT8 level[] = { 0, 0x80, 0xff, 0xff };   /* off, half, full intensity */
580580
581581   /* set up background palette (00-63) */
src/mess/video/cirrus.h
r5932r5933
11/***************************************************************************
22
3   video/cirrus.h
3    video/cirrus.h
44
5   Cirrus SVGA card emulation (preliminary)
5    Cirrus SVGA card emulation (preliminary)
66
77***************************************************************************/
88
src/mess/video/i8275.c
r5932r5933
495495static DEVICE_START( i8275 )
496496{
497497   i8275_t *i8275 = get_safe_token(device);
498   
498
499499   /* validate arguments */
500500   assert(device != NULL);
501501   assert(device->tag != NULL);
src/mess/video/i8275.h
r5932r5933
3434   const char *screen_tag;      /* screen we are acting on */
3535   int width;               /* char width in pixels */
3636   int char_delay;            /* delay of display char */
37   
37
3838   devcb_write_line out_drq_func;
3939
4040   devcb_write_line out_irq_func;
src/mess/video/coco.c
r5932r5933
11/***************************************************************************
22
3   Video hardware for CoCo/Dragon family
3    Video hardware for CoCo/Dragon family
44
5   driver by Nathan Woods
5    driver by Nathan Woods
66
7   See mess/machine/coco.c for references
7    See mess/machine/coco.c for references
88
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:
1212
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
1616
1717***************************************************************************/
1818
src/mess/video/saa505x.c
r5932r5933
11/************************************************************************
22SAA505X Teletext
33
4Variant      Character set
55050      English
65051      German
75052      Swedish
85053      Italian
95054      Belgian
105055      US ASCII
115056      Hebrew
125057      Cyrillic
4Variant     Character set
55050        English
65051        German
75052        Swedish
85053        Italian
95054        Belgian
105055        US ASCII
115056        Hebrew
125057        Cyrillic
1313
1414Pins
151   Vss            ground
1618   Vdd            positive supply
1717   NC            not connected
151   Vss             ground
1618  Vdd             positive supply
1717  NC              not connected
1818
1919Data In
2020--------
214-10   D1 to D7   in      character data inputs
214-10    D1 to D7    in      character data inputs
2222
2316   ~TLC      out      transmitted large character
2316  ~TLC        out     transmitted large character
2424
2525Colour Our
2626----------
2721   Y      out      monochrome video output
2822   Blue      out      blue video output
2923   Green      out      green video output
3024   Red      out      red video output
3125   BLAN      out      blanking output
2721  Y       out     monochrome video output
2822  Blue        out     blue video output
2923  Green       out     green video output
3024  Red     out     red video output
3125  BLAN        out     blanking output
3232
3333Display Control
3434---------------
3527   PO      in      picture on in[ut
3628   DE      in      display enable input
3527  PO      in      picture on in[ut
3628  DE      in      display enable input
3737
3838Remote Control Data Decoder and Store
3939-------------------------------------
402   ~SI         in/out      superimposer
413   ~DATA      in      remote control data
4211   DLIM      in      remote control data clock
4312   ~GLR      in      general line reset
402   ~SI         in/out      superimposer
413   ~DATA       in      remote control data
4211  DLIM        in      remote control data clock
4312  ~GLR        in      general line reset
4444
4545Timing Generator/Flash Counter
4646------------------------------
4713   DEW      in      data entry window
4819   TR6      in      6MHz input
4920   F1      in      1MHz input
5026   LOSE      in      load output shift register enable
4713  DEW     in      data entry window
4819  TR6     in      6MHz input
4920  F1      in      1MHz input
5026  LOSE        in      load output shift register enable
5151
5252Character Rounding
5353------------------
5414   CRS      in      character rounding select
5515   ~BCS      in      big character select
5414  CRS     in      character rounding select
5515  ~BCS        in      big character select
5656
5757
5858
r5932r5933
18101810  0,0,0,0,0,0,
18111811  0,0,0,0,0,0,
18121812  0,0,0,0,0,0
1813, // 0x5c '½'
1813, // 0x5c '?'
18141814  0,0,0,0,0,0,
18151815  0,1,0,0,0,0,
18161816  0,1,0,0,0,0,
r5932r5933
34633463         tt_flash=0;
34643464         break;
34653465
3466      // 0x0a      End Box    NOT USED
3466      // 0x0a     End Box    NOT USED
34673467      // 0x0b     Start Box  NOT USED
34683468
34693469      case 0x0c:   // Normal Height
r5932r5933
34763476         tt_start_line=tt_double_height_offset;
34773477         break;
34783478
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
34823482
34833483      case 0x11: case 0x12: case 0x13: case 0x14:
34843484      case 0x15: case 0x16: case 0x17:
r5932r5933
34863486         tt_colour=code&0x07;
34873487         break;
34883488
3489      // 0x18      Conceal Display
3489      // 0x18     Conceal Display
34903490
34913491      case 0x19:   //  Contiguois Graphics
34923492         tt_graphics=teletext_graphics;
r5932r5933
34993499            tt_lookup=tt_graphics;
35003500         break;
35013501
3502      // 0x1b      ESC        NOT USED
3502      // 0x1b     ESC        NOT USED
35033503
35043504      case 0x1c:  //  Black Background
35053505         tt_bgcolour=0;
src/mess/video/911_key.h
r5932r5933
11/*
2   key translation table for both US and UK terminals
2    key translation table for both US and UK terminals
33
4   The only difference is that the US # character is a Pound character in UK.
4    The only difference is that the US # character is a Pound character in UK.
55*/
66static const unsigned char US_key_translate[4][91] =
77{
r5932r5933
449449
450450
451451/*
452   key translation table for French terminals
452    key translation table for French terminals
453453*/
454454static const unsigned char French_key_translate[4][91] =
455455{
r5932r5933
897897
898898
899899/*
900   key translation table for German terminals
900    key translation table for German terminals
901901*/
902902static const unsigned char German_key_translate[4][91] =
903903{
r5932r5933
13451345
13461346
13471347/*
1348   key translation table for Swedish/Finnish terminals
1348    key translation table for Swedish/Finnish terminals
13491349*/
13501350static const unsigned char Swedish_key_translate[4][91] =
13511351{
r5932r5933
17931793
17941794
17951795/*
1796   key translation table for Norwegian/Danish terminals
1796    key translation table for Norwegian/Danish terminals
17971797*/
17981798static const unsigned char Norwegian_key_translate[4][91] =
17991799{
r5932r5933
22412241
22422242
22432243/*
2244   key translation table for Japanese katakana terminals
2244    key translation table for Japanese katakana terminals
22452245*/
22462246static const unsigned char Japanese_key_translate[6][91] =
22472247{
r5932r5933
29102910
29112911#if 0
29122912/*
2913   key translation table for Arabic terminals
2913    key translation table for Arabic terminals
29142914*/
29152915static const unsigned char Arabic_key_translate[6][91] =
29162916{
r5932r5933
35793579
35803580
35813581/*
3582   key translation table for French word-processing terminals
3582    key translation table for French word-processing terminals
35833583*/
35843584static const unsigned char FrenchWP_key_translate[4][91] =
35853585{
src/mess/video/cdp1862.c
r5932r5933
1111
1212    TODO:
1313
14   - calculate colors from luminance/chrominance resistors
14    - calculate colors from luminance/chrominance resistors
1515
1616*/
1717
src/mess/video/gb.c
r5932r5933
4949static UINT8 gb_vid_regs[_NR_GB_VID_REGS];
5050static UINT16 cgb_bpal[32];   /* CGB current background palette table */
5151static UINT16 cgb_spal[32];   /* CGB current background palette table */
52static UINT8 gb_bpal[4];   /* Background palette      */
53static UINT8 gb_spal0[4];   /* Sprite 0 palette      */
54static UINT8 gb_spal1[4];   /* Sprite 1 palette      */
52static UINT8 gb_bpal[4];   /* Background palette       */
53static UINT8 gb_spal0[4];   /* Sprite 0 palette     */
54static UINT8 gb_spal1[4];   /* Sprite 1 palette     */
5555static UINT8 *gb_oam;
5656UINT8 *gb_vram;
5757static UINT8 *gb_vram_ptr;
r5932r5933
117117static const unsigned char palette[] =
118118{
119119/* 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 */
124124
125125/* Possibly needs a little more green in it */
126126   0xFF,0xFB,0x87,      /* Background */
r5932r5933
140140};
141141
142142/* Initialise the palettes */
143PALETTE_INIT( gb )
143PALETTE_INIT( gb )
144144{
145145   int ii;
146   for( ii = 0; ii < 4; ii++)
146   for( ii = 0; ii < 4; ii++)
147147   {
148148      palette_set_color_rgb(machine, ii, palette[ii*3+0], palette[ii*3+1], palette[ii*3+2]);
149149   }
150150}
151151
152PALETTE_INIT( gbp )
152PALETTE_INIT( gbp )
153153{
154154   int ii;
155   for( ii = 0; ii < 4; ii++)
155   for( ii = 0; ii < 4; ii++)
156156   {
157157      palette_set_color_rgb(machine, ii, palette[(ii + 4)*3+0], palette[(ii + 4)*3+1], palette[(ii + 4)*3+2]);
158158   }
159159}
160160
161PALETTE_INIT( sgb )
161PALETTE_INIT( sgb )
162162{
163163   int ii, r, g, b;
164164
165   for( ii = 0; ii < 32768; ii++ )
165   for( ii = 0; ii < 32768; ii++ )
166166   {
167167      r = (ii & 0x1F) << 3;
168168      g = ((ii >> 5) & 0x1F) << 3;
r5932r5933
180180      sgb_pal[ii] = 0;
181181}
182182
183PALETTE_INIT( gbc )
183PALETTE_INIT( gbc )
184184{
185185   int ii, r, g, b;
186186
187   for( ii = 0; ii < 32768; ii++ )
187   for( ii = 0; ii < 32768; ii++ )
188188   {
189189      r = (ii & 0x1F) << 3;
190190      g = ((ii >> 5) & 0x1F) << 3;
r5932r5933
200200      cgb_spal[ii] = 0;
201201}
202202
203PALETTE_INIT( megaduck )
203PALETTE_INIT( megaduck )
204204{
205205   int ii;
206   for( ii = 0; ii < 4; ii++)
206   for( ii = 0; ii < 4; ii++)
207207   {
208208      palette_set_color_rgb(machine, ii, palette_megaduck[ii*3+0], palette_megaduck[ii*3+1], palette_megaduck[ii*3+2]);
209209   }
r5932r5933
219219  Select which sprites should be drawn for the current scanline and return the
220220  number of sprites selected.
221221 */
222static void gb_select_sprites( void )
222static void gb_select_sprites( void )
223223{
224224   int   i, /*yindex,*/ line, height;
225225   UINT8   *oam = gb_oam + 39 * 4;
r5932r5933
227227   gb_lcd.sprCount = 0;
228228
229229   /* If video hardware is enabled and sprites are enabled */
230   if ( ( LCDCONT & 0x80 ) && ( LCDCONT & 0x02 ) )
230   if ( ( LCDCONT & 0x80 ) && ( LCDCONT & 0x02 ) )
231231   {
232232      /* Check for stretched sprites */
233      if ( LCDCONT & 0x04 )
233      if ( LCDCONT & 0x04 )
234234      {
235235         height = 16;
236      }
237      else
236      }
237      else
238238      {
239239         height = 8;
240240      }
r5932r5933
242242      //yindex = gb_lcd.current_line;
243243      line = gb_lcd.current_line + 16;
244244
245      for( i = 39; i >= 0; i-- )
245      for( i = 39; i >= 0; i-- )
246246      {
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 )
248248         {
249249            /* 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 )
252252            {
253253               gb_lcd.sprite[gb_lcd.sprCount] = i;
254254               gb_lcd.sprCount++;
r5932r5933
346346   }
347347}
348348
349static void gb_update_scanline( running_machine *machine )
349static void gb_update_scanline( running_machine *machine )
350350{
351351   bitmap_t *bitmap = tmpbitmap;
352352
353353   profiler_mark_start(PROFILER_VIDEO);
354354
355355   /* Make sure we're in mode 3 */
356   if ( ( LCDSTAT & 0x03 ) == 0x03 )
356   if ( ( LCDSTAT & 0x03 ) == 0x03 )
357357   {
358358      /* Calculate number of pixels to render based on time still left on the timer */
359359      UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) );
360360      int l = 0;
361361
362      if ( gb_lcd.start_x < 0 )
362      if ( gb_lcd.start_x < 0 )
363363      {
364364         /* Window is enabled if the hardware says so AND the current scanline is
365          * within the window AND the window X coordinate is <=166 */
365            * within the window AND the window X coordinate is <=166 */
366366         gb_lcd.layer[1].enabled = ( ( LCDCONT & 0x20 ) && ( gb_lcd.current_line >= WNDPOSY ) && ( WNDPOSX <= 166 ) ) ? 1 : 0;
367367
368368         /* BG is enabled if the hardware says so AND (window_off OR (window_on
369          * AND window's X position is >=7 ) ) */
369            * AND window's X position is >=7 ) ) */
370370         gb_lcd.layer[0].enabled = ( ( LCDCONT & 0x01 ) && ( ( ! gb_lcd.layer[1].enabled ) || ( gb_lcd.layer[1].enabled && ( WNDPOSX >= 7 ) ) ) ) ? 1 : 0;
371371
372         if ( gb_lcd.layer[0].enabled )
372         if ( gb_lcd.layer[0].enabled )
373373         {
374374            gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF;
375375            gb_lcd.layer[0].bg_map = gb_bgdtab;
r5932r5933
380380            gb_lcd.layer[0].xend = 160;
381381         }
382382
383         if ( gb_lcd.layer[1].enabled )
383         if ( gb_lcd.layer[1].enabled )
384384         {
385385            int xpos;
386386
r5932r5933
400400         gb_lcd.start_x = 0;
401401      }
402402
403      if ( cycles_to_go < 160 )
403      if ( cycles_to_go < 160 )
404404      {
405405         gb_lcd.end_x = MIN(160 - cycles_to_go,160);
406406         /* Draw empty pixels when the background is disabled */
407         if ( ! ( LCDCONT & 0x01 ) )
407         if ( ! ( LCDCONT & 0x01 ) )
408408         {
409409            rectangle r;
410410            r.min_y = r.max_y = gb_lcd.current_line;
r5932r5933
412412            r.max_x = gb_lcd.end_x - 1;
413413            bitmap_fill( bitmap, &r , gb_bpal[0]);
414414         }
415         while ( l < 2 )
415         while ( l < 2 )
416416         {
417417            UINT8   xindex, *map, *tiles;
418418            UINT16   data;
419419            int   i, tile_index;
420420
421            if ( ! gb_lcd.layer[l].enabled )
421            if ( ! gb_lcd.layer[l].enabled )
422422            {
423423               l++;
424424               continue;
r5932r5933
437437            data = tiles[ tile_index ] | ( tiles[ tile_index+1 ] << 8 );
438438            data <<= gb_lcd.layer[l].xshift;
439439
440            while ( i > 0 )
440            while ( i > 0 )
441441            {
442               while ( ( gb_lcd.layer[l].xshift < 8 ) && i )
442               while ( ( gb_lcd.layer[l].xshift < 8 ) && i )
443443               {
444444                  register int colour = ( ( data & 0x8000 ) ? 2 : 0 ) | ( ( data & 0x0080 ) ? 1 : 0 );
445445                  gb_plot_pixel( bitmap, xindex, gb_lcd.current_line, gb_bpal[ colour ] );
r5932r5933
449449                  gb_lcd.layer[l].xshift++;
450450                  i--;
451451               }
452               if ( gb_lcd.layer[l].xshift == 8 )
452               if ( gb_lcd.layer[l].xshift == 8 )
453453               {
454454                  /* Take possible changes to SCROLLY into account */
455                  if ( l == 0 )
455                  if ( l == 0 )
456456                  {
457457                     gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF;
458458                     map = gb_lcd.layer[l].bg_map + ( ( gb_lcd.layer[l].bgline << 2 ) & 0x3E0 );
r5932r5933
467467            }
468468            l++;
469469         }
470         if ( gb_lcd.end_x == 160 && LCDCONT & 0x02 )
470         if ( gb_lcd.end_x == 160 && LCDCONT & 0x02 )
471471         {
472472            gb_update_sprites();
473473         }
474474         gb_lcd.start_x = gb_lcd.end_x;
475475      }
476   }
477   else
476   }
477   else
478478   {
479      if ( ! ( LCDCONT & 0x80 ) )
479      if ( ! ( LCDCONT & 0x80 ) )
480480      {
481481         /* 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 )
483483         {
484            if ( gb_lcd.current_line < 144 )
484            if ( gb_lcd.current_line < 144 )
485485            {
486486               const device_config *screen = video_screen_first(machine->config);
487487               rectangle r = *video_screen_get_visible_area(screen);
r5932r5933
593593   }
594594}
595595
596static void sgb_refresh_border(void)
596static void sgb_refresh_border(void)
597597{
598598   UINT16 data, data2;
599599   UINT16 yidx, xidx, xindex;
r5932r5933
603603
604604   map = sgb_tile_map - 64;
605605
606   for( yidx = 0; yidx < 224; yidx++ )
606   for( yidx = 0; yidx < 224; yidx++ )
607607   {
608608      xindex = 0;
609609      map += (yidx % 8) ? 0 : 64;
610      for( xidx = 0; xidx < 64; xidx+=2 )
610      for( xidx = 0; xidx < 64; xidx+=2 )
611611      {
612612         if( map[xidx+1] & 0x80 ) /* Vertical flip */
613613            tiles = sgb_tile_data + ( ( 7 - ( yidx % 8 ) ) << 1 );
r5932r5933
620620            pal = 1;
621621         pal <<= 4;
622622
623         if( sgb_hack )
623         if( sgb_hack )
624624         { /* A few games do weird stuff */
625625            UINT8 tileno = map[xidx];
626626            if( tileno >= 128 ) tileno = ((64 + tileno) % 128) + 128;
627627            else tileno = (64 + tileno) % 128;
628628            data = tiles[ tileno * 32 ] | ( tiles[ ( tileno * 32 ) + 1 ] << 8 );
629629            data2 = tiles2[ tileno * 32 ] | ( tiles2[ ( tileno * 32 ) + 1 ] << 8 );
630         }
631         else
630         }
631         else
632632         {
633633            data = tiles[ map[xidx] * 32 ] | ( tiles[ (map[xidx] * 32 ) + 1 ] << 8 );
634634            data2 = tiles2[ map[xidx] * 32 ] | ( tiles2[ (map[xidx] * 32 ) + 1 ] << 8 );
635635         }
636636
637         for( i = 0; i < 8; i++ )
637         for( i = 0; i < 8; i++ )
638638         {
639639            register UINT8 colour;
640640            if( (map[xidx+1] & 0x40) )   /* Horizontal flip */
r5932r5933
643643                   ((data2 & 0x0001) ? 4 : 0) | ((data2 & 0x0100) ? 8 : 0);
644644               data >>= 1;
645645               data2 >>= 1;
646            }
646            }
647647            else   /* No horizontal flip */
648648            {
649649               colour = ((data  & 0x0080) ? 1 : 0) | ((data  & 0x8000) ? 2 : 0) |
r5932r5933
652652               data2 <<= 1;
653653            }
654654            /* 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                 */
658658            if( !((yidx >= SGB_YOFFSET && yidx < SGB_YOFFSET + 144) &&
659               (xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160)) )
659               (xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160)) )
660660               {
661661               gb_plot_pixel(bitmap, xindex, yidx, sgb_pal[pal + colour]);
662662            }
r5932r5933
666666   }
667667}
668668
669static void sgb_update_scanline( running_machine *machine )
669static void sgb_update_scanline( running_machine *machine )
670670{
671671   bitmap_t *bitmap = tmpbitmap;
672672
673673   profiler_mark_start(PROFILER_VIDEO);
674674
675   if ( ( LCDSTAT & 0x03 ) == 0x03 )
675   if ( ( LCDSTAT & 0x03 ) == 0x03 )
676676   {
677677      /* Calcuate number of pixels to render based on time still left on the timer */
678678      UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) );
679679      int l = 0;
680680
681      if ( gb_lcd.start_x < 0 )
681      if ( gb_lcd.start_x < 0 )
682682      {
683683         /* Window is enabled if the hardware says so AND the current scanline is
684          * within the window AND the window X coordinate is <=166 */
684            * within the window AND the window X coordinate is <=166 */
685685         gb_lcd.layer[1].enabled = ((LCDCONT & 0x20) && gb_lcd.current_line >= WNDPOSY && WNDPOSX <= 166) ? 1 : 0;
686686
687687         /* BG is enabled if the hardware says so AND (window_off OR (window_on
688          * AND window's X position is >=7 ) ) */
688            * AND window's X position is >=7 ) ) */
689689         gb_lcd.layer[0].enabled = ((LCDCONT & 0x01) && ((!gb_lcd.layer[1].enabled) || (gb_lcd.layer[1].enabled && WNDPOSX >= 7))) ? 1 : 0;
690690
691         if ( gb_lcd.layer[0].enabled )
691         if ( gb_lcd.layer[0].enabled )
692692         {
693693            gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF;
694694            gb_lcd.layer[0].bg_map = gb_bgdtab;
r5932r5933
699699            gb_lcd.layer[0].xend = 160;
700700         }
701701
702         if ( gb_lcd.layer[1].enabled )
702         if ( gb_lcd.layer[1].enabled )
703703         {
704704            int xpos;
705705
r5932r5933
720720         gb_lcd.start_x = 0;
721721      }
722722
723      if ( cycles_to_go == 0 )
723      if ( cycles_to_go == 0 )
724724      {
725725
726726         /* Does this belong here? or should it be moved to the else block */
727727         /* Handle SGB mask */
728         switch( sgb_window_mask )
728         switch( sgb_window_mask )
729729         {
730730         case 1: /* Freeze screen */
731731            return;
r5932r5933
752752         }
753753
754754         /* Draw the "border" if we're on the first line */
755         if ( gb_lcd.current_line == 0 )
755         if ( gb_lcd.current_line == 0 )
756756         {
757757            sgb_refresh_border();
758758         }
759759      }
760      if ( cycles_to_go < 160 )
760      if ( cycles_to_go < 160 )
761761      {
762762         gb_lcd.end_x = MIN(160 - cycles_to_go,160);
763763
764764         /* if background or screen disabled clear line */
765         if ( ! ( LCDCONT & 0x01 ) )
765         if ( ! ( LCDCONT & 0x01 ) )
766766         {
767767            const device_config *screen = video_screen_first(machine->config);
768768            rectangle r = *video_screen_get_visible_area(screen);
r5932r5933
771771            r.min_y = r.max_y = gb_lcd.current_line + SGB_YOFFSET;
772772            bitmap_fill( bitmap, &r , 0);
773773         }
774         while( l < 2 )
774         while( l < 2 )
775775         {
776776            UINT8   xindex, sgb_palette, *map, *tiles;
777777            UINT16   data;
778778            int   i, tile_index;
779779
780            if ( ! gb_lcd.layer[l].enabled )
780            if ( ! gb_lcd.layer[l].enabled )
781781            {
782782               l++;
783783               continue;
r5932r5933
799799            /* Figure out which palette we're using */
800800            sgb_palette = sgb_pal_map[ ( gb_lcd.end_x - i ) >> 3 ][ gb_lcd.current_line >> 3 ] << 2;
801801
802            while( i > 0 )
802            while( i > 0 )
803803            {
804               while( ( gb_lcd.layer[l].xshift < 8 ) && i )
804               while( ( gb_lcd.layer[l].xshift < 8 ) && i )
805805               {
806806                  register int colour = ( ( data & 0x8000 ) ? 2 : 0 ) | ( ( data & 0x0080 ) ? 1 : 0 );
807807                  gb_plot_pixel( bitmap, xindex + SGB_XOFFSET, gb_lcd.current_line + SGB_YOFFSET, sgb_pal[ sgb_palette + gb_bpal[colour]] );
r5932r5933
811811                  gb_lcd.layer[l].xshift++;
812812                  i--;
813813               }
814               if ( gb_lcd.layer[l].xshift == 8 )
814               if ( gb_lcd.layer[l].xshift == 8 )
815815               {
816816                  /* Take possible changes to SCROLLY into account */
817                  if ( l == 0 )
817                  if ( l == 0 )
818818                  {
819819                     gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF;
820820                     map = gb_lcd.layer[l].bg_map + ( ( gb_lcd.layer[l].bgline << 2 ) & 0x3E0 );
r5932r5933
830830            }
831831            l++;
832832         }
833         if ( ( gb_lcd.end_x == 160 ) && ( LCDCONT & 0x02 ) )
833         if ( ( gb_lcd.end_x == 160 ) && ( LCDCONT & 0x02 ) )
834834         {
835835            sgb_update_sprites();
836836         }
837837         gb_lcd.start_x = gb_lcd.end_x;
838838      }
839   }
840   else
839   }
840   else
841841   {
842      if ( ! ( LCDCONT * 0x80 ) )
842      if ( ! ( LCDCONT * 0x80 ) )
843843      {
844844         /* 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 )
846846         {
847847            /* Also refresh border here??? */
848            if ( gb_lcd.current_line < 144 )
848            if ( gb_lcd.current_line < 144 )
849849            {
850850               const device_config *screen = video_screen_first(machine->config);
851851               rectangle r = *video_screen_get_visible_area(screen);
r5932r5933
864864
865865/* --- Game Boy Color Specific --- */
866866
867INLINE void cgb_update_sprites ( running_machine *machine )
867INLINE void cgb_update_sprites ( running_machine *machine )
868868{
869869   bitmap_t *bitmap = tmpbitmap;
870870   UINT8 height, tilemask, line, *oam;
r5932r5933
976976   }
977977}
978978
979static void cgb_update_scanline ( running_machine *machine )
979static void cgb_update_scanline ( running_machine *machine )
980980{
981981   bitmap_t *bitmap = tmpbitmap;
982982
983983   profiler_mark_start(PROFILER_VIDEO);
984984
985   if ( ( LCDSTAT & 0x03 ) == 0x03 )
985   if ( ( LCDSTAT & 0x03 ) == 0x03 )
986986   {
987987      /* Calcuate number of pixels to render based on time still left on the timer */
988988      UINT32 cycles_to_go = cputag_attotime_to_clocks(machine, "maincpu", timer_timeleft( gb_lcd.lcd_timer ) );
989989      int l = 0;
990990
991      if ( gb_lcd.start_x < 0 )
991      if ( gb_lcd.start_x < 0 )
992992      {
993993         /* Window is enabled if the hardware says so AND the current scanline is
994          * within the window AND the window X coordinate is <=166 */
994            * within the window AND the window X coordinate is <=166 */
995995         gb_lcd.layer[1].enabled = ( ( LCDCONT & 0x20 ) && ( gb_lcd.current_line >= WNDPOSY ) && ( WNDPOSX <= 166 ) ) ? 1 : 0;
996996
997997         /* BG is enabled if the hardware says so AND (window_off OR (window_on
998          * AND window's X position is >=7 ) ) */
998            * AND window's X position is >=7 ) ) */
999999         gb_lcd.layer[0].enabled = ( ( LCDCONT & 0x01 ) && ( ( ! gb_lcd.layer[1].enabled ) || ( gb_lcd.layer[1].enabled && ( WNDPOSX >= 7 ) ) ) ) ? 1 : 0;
10001000
1001         if ( gb_lcd.layer[0].enabled )
1001         if ( gb_lcd.layer[0].enabled )
10021002         {
10031003            gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF;
10041004            gb_lcd.layer[0].bg_map = gb_bgdtab;
r5932r5933
10091009            gb_lcd.layer[0].xend = 160;
10101010         }
10111011
1012         if ( gb_lcd.layer[1].enabled )
1012         if ( gb_lcd.layer[1].enabled )
10131013         {
10141014            int xpos;
10151015
r5932r5933
10301030         gb_lcd.start_x = 0;
10311031      }
10321032
1033      if ( cycles_to_go < 160 )
1033      if ( cycles_to_go < 160 )
10341034      {
10351035         gb_lcd.end_x = MIN(160 - cycles_to_go,160);
10361036         /* Draw empty line when the background is disabled */
1037         if ( ! ( LCDCONT & 0x01 ) )
1037         if ( ! ( LCDCONT & 0x01 ) )
10381038         {
10391039            const device_config *screen = video_screen_first(machine->config);
10401040            rectangle r = *video_screen_get_visible_area(screen);
r5932r5933
10431043            r.max_x = gb_lcd.end_x - 1;
10441044            bitmap_fill( bitmap, &r , ( ! gb_lcd.gbc_mode ) ? 0 : 32767);
10451045         }
1046         while ( l < 2 )
1046         while ( l < 2 )
10471047         {
10481048            UINT8   xindex, *map, *tiles, *gbcmap;
10491049            UINT16   data;
10501050            int   i, tile_index;
10511051
1052            if ( ! gb_lcd.layer[l].enabled )
1052            if ( ! gb_lcd.layer[l].enabled )
10531053            {
10541054               l++;
10551055               continue;
r5932r5933
10591059            tiles = ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x08 ) ? gbc_chrgen : gb_chrgen;
10601060
10611061            /* Check for vertical flip */
1062            if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x40 )
1062            if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x40 )
10631063            {
10641064               tiles += ( ( 7 - ( gb_lcd.layer[l].bgline & 0x07 ) ) << 1 );
1065            }
1066            else
1065            }
1066            else
10671067            {
10681068               tiles += ( ( gb_lcd.layer[l].bgline & 0x07 ) << 1 );
10691069            }
r5932r5933
10781078            tile_index = ( map[ gb_lcd.layer[l].xindex ] ^ gb_tile_no_mod ) * 16;
10791079            data = tiles[ tile_index ] | ( tiles[ tile_index + 1 ] << 8 );
10801080            /* Check for horinzontal flip */
1081            if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x20 )
1081            if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x20 )
10821082            {
10831083               data >>= gb_lcd.layer[l].xshift;
1084            }
1085            else
1084            }
1085            else
10861086            {
10871087               data <<= gb_lcd.layer[l].xshift;
10881088            }
10891089
1090            while ( i > 0 )
1090            while ( i > 0 )
10911091            {
1092               while ( ( gb_lcd.layer[l].xshift < 8 ) && i )
1092               while ( ( gb_lcd.layer[l].xshift < 8 ) && i )
10931093               {
10941094                  int colour;
10951095                  /* Check for horinzontal flip */
1096                  if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x20 )
1096                  if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x20 )
10971097                  {
10981098                     colour = ( ( data & 0x0100 ) ? 2 : 0 ) | ( ( data & 0x0001 ) ? 1 : 0 );
10991099                     data >>= 1;
1100                  }
1101                  else
1100                  }
1101                  else
11021102                  {
11031103                     colour = ( ( data & 0x8000 ) ? 2 : 0 ) | ( ( data & 0x0080 ) ? 1 : 0 );
11041104                     data <<= 1;
r5932r5933
11091109                  gb_lcd.layer[l].xshift++;
11101110                  i--;
11111111               }
1112               if ( gb_lcd.layer[l].xshift == 8 )
1112               if ( gb_lcd.layer[l].xshift == 8 )
11131113               {
11141114                  /* Take possible changes to SCROLLY into account */
1115                  if ( l == 0 )
1115                  if ( l == 0 )
11161116                  {
11171117                     gb_lcd.layer[0].bgline = ( SCROLLY + gb_lcd.current_line ) & 0xFF;
11181118                     map = gb_lcd.layer[l].bg_map + ( ( gb_lcd.layer[l].bgline << 2 ) & 0x3E0 );
r5932r5933
11241124                  tiles = ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x08 ) ? gbc_chrgen : gb_chrgen;
11251125
11261126                  /* Check for vertical flip */
1127                  if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x40 )
1127                  if ( gbcmap[ gb_lcd.layer[l].xindex ] & 0x40 )
11281128                  {
11291129                     tiles += ( ( 7 - ( gb_lcd.layer[l].bgline & 0x07 ) ) << 1 );
1130                  }
1131                  else
1130                  }
1131                  else
11321132                  {
11331133                     tiles += ( ( gb_lcd.layer[l].bgline & 0x07 ) << 1 );
11341134                  }
r5932r5933
11381138            }
11391139            l++;
11401140         }
1141         if ( gb_lcd.end_x == 160 && ( LCDCONT & 0x02 ) )
1141         if ( gb_lcd.end_x == 160 && ( LCDCONT & 0x02 ) )
11421142         {
11431143            cgb_update_sprites( machine );
11441144         }
11451145         gb_lcd.start_x = gb_lcd.end_x;
11461146      }
1147   }
1148   else
1147   }
1148   else
11491149   {
1150      if ( ! ( LCDCONT & 0x80 ) )
1150      if ( ! ( LCDCONT & 0x80 ) )
11511151      {
11521152         /* 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 )
11541154         {
1155            if ( gb_lcd.current_line < 144 )
1155            if ( gb_lcd.current_line < 144 )
11561156            {
11571157               const device_config *screen = video_screen_first(machine->config);
11581158               rectangle r = *video_screen_get_visible_area(screen);
r5932r5933
12371237/*
12381238  For an AGS in CGB mode this data is:
12391239static 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
12561256};
12571257*/
12581258
r5932r5933
12791279   cputag_set_input_line( machine, "maincpu", VBL_INT, ASSERT_LINE );
12801280}
12811281
1282void gb_video_init( running_machine *machine, int mode )
1282void gb_video_init( running_machine *machine, int mode )
12831283{
12841284   int   i;
12851285   int vram_size = 0x2000;
r5932r5933
12981298   gb_wndtab = gb_vram + 0x1C00;
12991299
13001300   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++ )
13021302   {
13031303      gb_vid_regs[i] = 0xFF;
13041304   }
r5932r5933
13111311   WNDPOSX = WNDPOSY = 0x00;
13121312
13131313   /* Initialize palette arrays */
1314   for( i = 0; i < 4; i++ )
1314   for( i = 0; i < 4; i++ )
13151315   {
13161316      gb_bpal[i] = gb_spal0[i] = gb_spal1[i] = i;
13171317   }
13181318
1319   switch( mode )
1319   switch( mode )
13201320   {
13211321   case GB_VIDEO_DMG:
13221322      gb_lcd.lcd_timer = timer_alloc(machine,  gb_lcd_timer_proc , NULL);
r5932r5933
13341334      /* set the scanline update function */
13351335      update_scanline = gb_update_scanline;
13361336      /* 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++ )
13381338      {
13391339         gb_vram[ 0x1903 + i ] = i;
13401340         gb_vram[ 0x1923 + i ] = i + 0x0C;
r5932r5933
13891389   }
13901390}
13911391
1392static void gbc_hdma(running_machine *machine, UINT16 length)
1392static void gbc_hdma(running_machine *machine, UINT16 length)
13931393{
13941394   UINT16 src, dst;
13951395   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5932r5933
13971397   src = ((UINT16)HDMA1 << 8) | (HDMA2 & 0xF0);
13981398   dst = ((UINT16)(HDMA3 & 0x1F) << 8) | (HDMA4 & 0xF0);
13991399   dst |= 0x8000;
1400   while( length > 0 )
1400   while( length > 0 )
14011401   {
14021402      memory_write_byte( space, dst++, memory_read_byte( space, src++ ) );
14031403      length--;
r5932r5933
14071407   HDMA3 = 0x1f & (dst >> 8);
14081408   HDMA4 = dst & 0xF0;
14091409   HDMA5--;
1410   if( (HDMA5 & 0x7f) == 0x7f )
1410   if( (HDMA5 & 0x7f) == 0x7f )
14111411   {
14121412      HDMA5 = 0xff;
14131413      gb_lcd.hdma_enabled = 0;
14141414   }
14151415}
14161416
1417static void gb_increment_scanline( void )
1417static void gb_increment_scanline( void )
14181418{
14191419   gb_lcd.current_line = ( gb_lcd.current_line + 1 ) % 154;
1420   if ( LCDCONT & 0x80 )
1420   if ( LCDCONT & 0x80 )
14211421   {
14221422      CURLINE = gb_lcd.current_line;
14231423   }
1424   if ( gb_lcd.current_line == 0 )
1424   if ( gb_lcd.current_line == 0 )
14251425   {
14261426      gb_lcd.window_lines_drawn = 0;
14271427   }
r5932r5933
14331433
14341434   gb_lcd.state = param;
14351435
1436   if ( LCDCONT & 0x80 )
1436   if ( LCDCONT & 0x80 )
14371437   {
1438      switch( gb_lcd.state )
1438      switch( gb_lcd.state )
14391439      {
14401440      case GB_LCD_STATE_LYXX_PRE_M0:   /* Just before switching to mode 0 */
14411441         gb_lcd.mode = 0;
1442         if ( LCDSTAT & 0x08 )
1442         if ( LCDSTAT & 0x08 )
14431443         {
1444            if ( ! gb_lcd.mode_irq )
1444            if ( ! gb_lcd.mode_irq )
14451445            {
1446               if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq )
1446               if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq )
14471447               {
14481448                  gb_lcd.mode_irq = 1;
14491449                  cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
14501450               }
1451            }
1452            else
1451            }
1452            else
14531453            {
14541454               gb_lcd.mode_irq = 0;
14551455            }
r5932r5933
14601460         /* update current scanline */
14611461         update_scanline( machine );
14621462         /* Increment the number of window lines drawn if enabled */
1463         if ( gb_lcd.layer[1].enabled )
1463         if ( gb_lcd.layer[1].enabled )
14641464         {
14651465            gb_lcd.window_lines_drawn++;
14661466         }
r5932r5933
14711471         gb_lcd.oam_locked = UNLOCKED;
14721472         gb_lcd.vram_locked = UNLOCKED;
14731473         /*
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 )
14801480         {
14811481            gb_lcd.scrollx_adjust += 4;
14821482            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_SCX3);
r5932r5933
14851485      case GB_LCD_STATE_LYXX_M0_SCX3:
14861486         /* Generate lcd interrupt if requested */
14871487         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 ) ) )
14891489             {
14901490            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
14911491         }
14921492         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);
14931493         break;
14941494      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 )
14961496         {
14971497            gb_lcd.mode = 2;
14981498            gb_lcd.triggering_mode_irq = ( LCDSTAT & 0x20 ) ? 1 : 0;
1499            if ( gb_lcd.triggering_mode_irq )
1499            if ( gb_lcd.triggering_mode_irq )
15001500            {
1501               if ( ! gb_lcd.mode_irq )
1501               if ( ! gb_lcd.mode_irq )
15021502               {
1503                  if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq )
1503                  if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq )
15041504                  {
15051505                     gb_lcd.mode_irq = 1;
15061506                     cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
15071507                  }
1508               }
1509               else
1508               }
1509               else
15101510               {
15111511                  gb_lcd.mode_irq = 0;
15121512               }
r5932r5933
15191519         gb_lcd.delayed_line_irq = gb_lcd.line_irq;
15201520         gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
15211521         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 )
15231523         {
15241524            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
15251525            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
r5932r5933
15271527         /* Reset LY==LYC STAT bit */
15281528         LCDSTAT &= 0xFB;
15291529         /* Check if we're going into VBlank next */
1530         if ( CURLINE == 144 )
1530         if ( CURLINE == 144 )
15311531         {
15321532            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
15351535         {
15361536            /* Internally switch to mode 2 */
15371537            gb_lcd.mode = 2;
15381538            /* Generate lcd interrupt if requested */
15391539            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 ) ) )
15411541                {
15421542               gb_lcd.mode_irq = 1;
15431543               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
r5932r5933
15661566         gb_lcd.oam_locked = LOCKED;
15671567         /* Generate lcd interrupt if requested */
15681568         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 ) )
15701570         {
15711571            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
15721572         }
15731573         gb_lcd.line_irq = gb_lcd.triggering_line_irq;
15741574         gb_lcd.triggering_mode_irq = 0;
15751575         /* Check if LY==LYC STAT bit should be set */
1576         if ( CURLINE == CMPLINE )
1576         if ( CURLINE == CMPLINE )
15771577         {
15781578            LCDSTAT |= 0x04;
15791579         }
r5932r5933
15951595         gb_lcd.start_x = -1;
15961596         break;
15971597      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
1598         if ( CURLINE == 144 )
1598         if ( CURLINE == 144 )
15991599         {
16001600            /* Trigger VBlank interrupt */
16011601            cputag_set_input_line( machine, "maincpu", VBL_INT, ASSERT_LINE );
r5932r5933
16031603            gb_lcd.mode = 1;
16041604            LCDSTAT = (LCDSTAT & 0xFC) | 0x01;
16051605            /* Trigger LCD interrupt if requested */
1606            if ( LCDSTAT & 0x10 )
1606            if ( LCDSTAT & 0x10 )
16071607            {
16081608               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
16091609            }
16101610         }
16111611         /* Check if LY==LYC STAT bit should be set */
1612         if ( CURLINE == CMPLINE )
1612         if ( CURLINE == CMPLINE )
16131613         {
16141614            LCDSTAT |= 0x04;
16151615         }
1616         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq )
1616         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq )
16171617         {
16181618            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
16191619         }
r5932r5933
16241624         gb_lcd.delayed_line_irq = gb_lcd.line_irq;
16251625         gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
16261626         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 )
16281628         {
16291629            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
16301630            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
16311631         }
16321632         /* Reset LY==LYC STAT bit */
16331633         LCDSTAT &= 0xFB;
1634         if ( gb_lcd.current_line == 153 )
1634         if ( gb_lcd.current_line == 153 )
16351635         {
16361636            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
16391639         {
16401640            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1);
16411641         }
16421642         break;
16431643      case GB_LCD_STATE_LY00_M1:      /* we stay in VBlank but current line counter should already be incremented */
16441644         /* Check LY=LYC for line #153 */
1645         if ( gb_lcd.delayed_line_irq )
1645         if ( gb_lcd.delayed_line_irq )
16461646         {
1647            if ( gb_lcd.triggering_line_irq )
1647            if ( gb_lcd.triggering_line_irq )
16481648            {
16491649               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
16501650            }
16511651         }
16521652         gb_lcd.delayed_line_irq = gb_lcd.delayed_line_irq | gb_lcd.line_irq;
1653         if ( CURLINE == CMPLINE )
1653         if ( CURLINE == CMPLINE )
16541654         {
16551655            LCDSTAT |= 0x04;
16561656         }
r5932r5933
16611661         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4/*8*/), GB_LCD_STATE_LY00_M1_1);
16621662         break;
16631663      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 )
16651665         {
16661666            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
16671667            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
r5932r5933
16691669         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_2);
16701670         break;
16711671      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 )
16731673         {
16741674            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
16751675            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
16761676         }
1677         if ( CURLINE == CMPLINE )
1677         if ( CURLINE == CMPLINE )
16781678         {
16791679            LCDSTAT |= 0x04;
16801680         }
r5932r5933
16871687         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M2);
16881688         break;
16891689      }
1690   }
1691   else
1690   }
1691   else
16921692   {
16931693      gb_increment_scanline();
1694      if ( gb_lcd.current_line < 144 )
1694      if ( gb_lcd.current_line < 144 )
16951695      {
16961696         update_scanline( machine );
16971697      }
r5932r5933
17051705
17061706   gb_lcd.state = param;
17071707
1708   if ( LCDCONT & 0x80 )
1708   if ( LCDCONT & 0x80 )
17091709   {
1710      switch( gb_lcd.state )
1710      switch( gb_lcd.state )
17111711      {
17121712      case GB_LCD_STATE_LYXX_PRE_M0:   /* Just before switching to mode 0 */
17131713         gb_lcd.mode = 0;
1714         if ( LCDSTAT & 0x08 )
1714         if ( LCDSTAT & 0x08 )
17151715         {
1716            if ( ! gb_lcd.mode_irq )
1716            if ( ! gb_lcd.mode_irq )
17171717            {
1718               if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq )
1718               if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq )
17191719               {
17201720                  gb_lcd.mode_irq = 1;
17211721                  cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
17221722               }
1723            }
1724            else
1723            }
1724            else
17251725            {
17261726               gb_lcd.mode_irq = 0;
17271727            }
r5932r5933
17321732         /* update current scanline */
17331733         update_scanline( machine );
17341734         /* Increment the number of window lines drawn if enabled */
1735         if ( gb_lcd.layer[1].enabled )
1735         if ( gb_lcd.layer[1].enabled )
17361736         {
17371737            gb_lcd.window_lines_drawn++;
17381738         }
r5932r5933
17431743         gb_lcd.oam_locked = UNLOCKED;
17441744         gb_lcd.vram_locked = UNLOCKED;
17451745         /*
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            */
17511751         gb_lcd.triggering_mode_irq = ( LCDSTAT & 0x08 ) ? 1 : 0;
1752         if ( ( SCROLLX & 0x03 ) == 0x03 )
1752         if ( ( SCROLLX & 0x03 ) == 0x03 )
17531753         {
17541754            gb_lcd.scrollx_adjust += 4;
17551755            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LYXX_M0_SCX3);
r5932r5933
17581758      case GB_LCD_STATE_LYXX_M0_SCX3:
17591759         /* Generate lcd interrupt if requested */
17601760         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 ) ) )
17621762             {
17631763            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
17641764            gb_lcd.triggering_mode_irq = 0;
17651765         }
1766         if ( ( SCROLLX & 0x03 ) == 0x03 )
1766         if ( ( SCROLLX & 0x03 ) == 0x03 )
17671767         {
17681768            gb_lcd.pal_locked = UNLOCKED;
17691769         }
r5932r5933
17721772      case GB_LCD_STATE_LYXX_M0_GBC_PAL:
17731773         gb_lcd.pal_locked = UNLOCKED;
17741774            /* Check for HBLANK DMA */
1775         if( gb_lcd.hdma_enabled )
1775         if( gb_lcd.hdma_enabled )
17761776         {
17771777            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
17811781         {
17821782            gb_lcd.hdma_possible = 1;
17831783         }
r5932r5933
17851785         break;
17861786      case GB_LCD_STATE_LYXX_M0_PRE_INC:   /* Just before incrementing the line counter go to mode 2 internally */
17871787         gb_lcd.cmp_line = CMPLINE;
1788         if ( CURLINE < 143 )
1788         if ( CURLINE < 143 )
17891789         {
17901790            gb_lcd.mode = 2;
1791            if ( LCDSTAT & 0x20 )
1791            if ( LCDSTAT & 0x20 )
17921792            {
1793               if ( ! gb_lcd.mode_irq )
1793               if ( ! gb_lcd.mode_irq )
17941794               {
1795                  if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq )
1795                  if ( ! gb_lcd.line_irq && ! gb_lcd.delayed_line_irq )
17961796                  {
17971797                     gb_lcd.mode_irq = 1;
17981798                     cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
17991799                  }
1800               }
1801               else
1800               }
1801               else
18021802               {
18031803                  gb_lcd.mode_irq = 0;
18041804               }
r5932r5933
18111811         gb_lcd.delayed_line_irq = gb_lcd.line_irq;
18121812         gb_lcd.triggering_line_irq = ( ( gb_lcd.cmp_line == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
18131813         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 ) )
18151815         {
18161816            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
18171817            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
18181818         }
18191819         gb_lcd.hdma_possible = 0;
18201820         /* Check if we're going into VBlank next */
1821         if ( CURLINE == 144 )
1821         if ( CURLINE == 144 )
18221822         {
18231823            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
18261826         {
18271827            /* Internally switch to mode 2 */
18281828            gb_lcd.mode = 2;
18291829            /* Generate lcd interrupt if requested */
18301830            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 ) ) )
18321832                {
18331833               gb_lcd.mode_irq = 1;
18341834               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
r5932r5933
18421842         LCDSTAT = ( LCDSTAT & 0xFC ) | 0x02;
18431843         gb_lcd.oam_locked = LOCKED;
18441844         /* 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 )
18461846         {
18471847            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
18481848         }
r5932r5933
18571857         gb_lcd.oam_locked = LOCKED;
18581858         /* Generate lcd interrupt if requested */
18591859         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 ) ) )
18611861             {
18621862            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
18631863         }
18641864         gb_lcd.line_irq = gb_lcd.triggering_line_irq;
18651865         /* Check if LY==LYC STAT bit should be set */
1866         if ( CURLINE == CMPLINE )
1866         if ( CURLINE == CMPLINE )
18671867         {
18681868            LCDSTAT |= 0x04;
1869         }
1870         else
1869         }
1870         else
18711871         {
18721872            LCDSTAT &= ~0x04;
18731873         }
r5932r5933
18901890         gb_lcd.start_x = -1;
18911891         break;
18921892      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
1893         if ( CURLINE == 144 )
1893         if ( CURLINE == 144 )
18941894         {
18951895            /* Trigger VBlank interrupt */
18961896            cputag_set_input_line( machine, "maincpu", VBL_INT, ASSERT_LINE );
r5932r5933
18981898            gb_lcd.mode = 1;
18991899            LCDSTAT = (LCDSTAT & 0xFC) | 0x01;
19001900            /* Trigger LCD interrupt if requested */
1901            if ( LCDSTAT & 0x10 )
1901            if ( LCDSTAT & 0x10 )
19021902            {
19031903               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
1904            }   
1904            }
19051905         }
19061906         /* Check if LY==LYC STAT bit should be set */
1907         if ( CURLINE == CMPLINE )
1907         if ( CURLINE == CMPLINE )
19081908         {
19091909            LCDSTAT |= 0x04;
1910         }
1911         else
1910         }
1911         else
19121912         {
19131913            LCDSTAT &= ~0x04;
19141914         }
1915         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq )
1915         if ( gb_lcd.delayed_line_irq && gb_lcd.triggering_line_irq )
19161916         {
19171917            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
19181918         }
r5932r5933
19231923         gb_lcd.delayed_line_irq = gb_lcd.line_irq;
19241924         gb_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0;
19251925         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 )
19271927         {
19281928            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
19291929            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
19301930         }
1931         if ( gb_lcd.current_line == 153 )
1931         if ( gb_lcd.current_line == 153 )
19321932         {
19331933            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
19361936         {
19371937            timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY9X_M1);
19381938         }
19391939         break;
19401940      case GB_LCD_STATE_LY00_M1:      /* we stay in VBlank but current line counter should already be incremented */
19411941         /* Check LY=LYC for line #153 */
1942         if ( gb_lcd.delayed_line_irq )
1942         if ( gb_lcd.delayed_line_irq )
19431943         {
1944            if ( gb_lcd.triggering_line_irq )
1944            if ( gb_lcd.triggering_line_irq )
19451945            {
19461946               cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
19471947            }
19481948         }
19491949         gb_lcd.delayed_line_irq = gb_lcd.delayed_line_irq | gb_lcd.line_irq;
1950         if ( CURLINE == CMPLINE )
1950         if ( CURLINE == CMPLINE )
19511951         {
19521952            LCDSTAT |= 0x04;
1953         } 
1954         else
1953         }
1954         else
19551955         {
19561956            LCDSTAT &= ~0x04;
19571957         }
r5932r5933
19621962         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_1);
19631963         break;
19641964      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 )
19661966         {
19671967            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
19681968            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
r5932r5933
19701970         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M1_2);
19711971         break;
19721972      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 )
19741974         {
19751975            gb_lcd.line_irq = gb_lcd.triggering_line_irq;
19761976            cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
19771977         }
1978         if ( CURLINE == CMPLINE )
1978         if ( CURLINE == CMPLINE )
19791979         {
19801980            LCDSTAT |= 0x04;
1981         }
1982         else
1981         }
1982         else
19831983         {
19841984            LCDSTAT &= ~0x04;
19851985         }
r5932r5933
19911991         timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 4), GB_LCD_STATE_LY00_M2);
19921992         break;
19931993      }
1994   }
1995   else
1994   }
1995   else
19961996   {
19971997      gb_increment_scanline();
1998      if ( gb_lcd.current_line < 144 )
1998      if ( gb_lcd.current_line < 144 )
19991999      {
20002000         update_scanline( machine );
20012001      }
r5932r5933
20032003   }
20042004}
20052005
2006static void gb_lcd_switch_on( running_machine *machine )
2006static void gb_lcd_switch_on( running_machine *machine )
20072007{
20082008   gb_lcd.current_line = 0;
20092009   gb_lcd.previous_line = 153;
r5932r5933
20132013   gb_lcd.mode = 0;
20142014   gb_lcd.oam_locked = LOCKED;   /* TODO: Investigate whether this OAM locking is correct. */
20152015   /* Check for LY=LYC coincidence */
2016   if ( CURLINE == CMPLINE )
2016   if ( CURLINE == CMPLINE )
20172017   {
20182018      LCDSTAT |= 0x04;
20192019      /* Generate lcd interrupt if requested */
2020      if ( LCDSTAT & 0x40 )
2020      if ( LCDSTAT & 0x40 )
20212021      {
20222022         cputag_set_input_line( machine, "maincpu", LCD_INT, ASSERT_LINE );
20232023      }
r5932r5933
20262026   timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 80), GB_LCD_STATE_LYXX_M3);
20272027}
20282028
2029READ8_HANDLER( gb_video_r )
2029READ8_HANDLER( gb_video_r )
20302030{
20312031   return gb_vid_regs[offset];
20322032}
20332033
2034READ8_HANDLER( gb_vram_r )
2034READ8_HANDLER( gb_vram_r )
20352035{
20362036   return ( gb_lcd.vram_locked == LOCKED ) ? 0xFF : gb_vram_ptr[offset];
20372037}
20382038
2039WRITE8_HANDLER( gb_vram_w )
2039WRITE8_HANDLER( gb_vram_w )
20402040{
2041   if ( gb_lcd.vram_locked == LOCKED )
2041   if ( gb_lcd.vram_locked == LOCKED )
20422042   {
20432043      return;
20442044   }
20452045   gb_vram_ptr[offset] = data;
20462046}
20472047
2048READ8_HANDLER( gb_oam_r )
2048READ8_HANDLER( gb_oam_r )
20492049{
20502050   return ( gb_lcd.oam_locked == LOCKED ) ? 0xFF : gb_oam[offset];
20512051}
20522052
2053WRITE8_HANDLER( gb_oam_w )
2053WRITE8_HANDLER( gb_oam_w )
20542054{
2055   if ( gb_lcd.oam_locked == LOCKED || offset >= 0xa0 )
2055   if ( gb_lcd.oam_locked == LOCKED || offset >= 0xa0 )
20562056   {
20572057      return;
20582058   }
20592059   gb_oam[offset] = data;
20602060}
20612061
2062WRITE8_HANDLER ( gb_video_w )
2062WRITE8_HANDLER ( gb_video_w )
20632063{
2064   switch (offset)
2064   switch (offset)
20652065   {
20662066   case 0x00:                  /* LCDC - LCD Control */
20672067      gb_chrgen = gb_vram + ((data & 0x10) ? 0x0000 : 0x0800);
r5932r5933
20692069      gb_bgdtab = gb_vram + ((data & 0x08) ? 0x1C00 : 0x1800 );
20702070      gb_wndtab = gb_vram + ((data & 0x40) ? 0x1C00 : 0x1800 );
20712071      /* if LCD controller is switched off, set STAT and LY to 00 */
2072      if ( ! ( data & 0x80 ) )
2072      if ( ! ( data & 0x80 ) )
20732073      {
20742074         LCDSTAT &= ~0x03;
20752075         CURLINE = 0;
r5932r5933
20772077         gb_lcd.vram_locked = UNLOCKED;
20782078      }
20792079      /* If LCD is being switched on */
2080      if ( !( LCDCONT & 0x80 ) && ( data & 0x80 ) )
2080      if ( !( LCDCONT & 0x80 ) && ( data & 0x80 ) )
20812081      {
20822082         gb_lcd_switch_on( space->machine );
20832083      }
r5932r5933
20852085   case 0x01:                  /* STAT - LCD Status */
20862086      data = 0x80 | (data & 0x78) | (LCDSTAT & 0x07);
20872087      /*
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 )
20932093      {
20942094         /* 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            */
21082108         if ( ! gb_lcd.mode_irq && ( ( gb_lcd.mode == 1 ) ||
21092109            ( ( LCDSTAT & 0x40 ) && ! ( data & 0x68 ) ) ||
21102110            ( ! ( LCDSTAT & 0x40 ) && ( data & 0x40 ) && ( LCDSTAT & 0x04 ) ) ||
21112111            ( ! ( LCDSTAT & 0x48 ) && ( data & 0x08 ) ) ||
21122112            ( ( LCDSTAT & 0x60 ) == 0x00 && ( data & 0x60 ) == 0x20 ) ||
21132113            ( ( LCDSTAT & 0x60 ) == 0x20 && ( data & 0x40 ) )
2114            ) )
2114            ) )
21152115         {
21162116               cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE );
21172117         }
21182118         /*
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 )
21242124         {
21252125            cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE );
21262126         }
r5932r5933
21292129   case 0x04:                  /* LY - LCD Y-coordinate */
21302130      return;
21312131   case 0x05:                  /* LYC */
2132      if ( CMPLINE != data )
2132      if ( CMPLINE != data )
21332133      {
2134         if ( CURLINE == data )
2134         if ( CURLINE == data )
21352135         {
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 )
21372137            {
21382138               LCDSTAT |= 0x04;
21392139               /* Generate lcd interrupt if requested */
2140               if ( LCDSTAT & 0x40 )
2140               if ( LCDSTAT & 0x40 )
21412141               {
21422142                  cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE );
21432143               }
21442144            }
2145         }
2146         else
2145         }
2146         else
21472147         {
21482148            LCDSTAT &= 0xFB;
21492149            gb_lcd.triggering_line_irq = 0;
r5932r5933
21662166      gb_bpal[3] = (data & 0xC0) >> 6;
21672167      break;
21682168   case 0x08:                  /* OBP0 - Object Palette 0 */
2169//      update_scanline( machine );
2169//      update_scanline( machine );
21702170      gb_spal0[0] = data & 0x3;
21712171      gb_spal0[1] = (data & 0xC) >> 2;
21722172      gb_spal0[2] = (data & 0x30) >> 4;
21732173      gb_spal0[3] = (data & 0xC0) >> 6;
21742174      break;
21752175   case 0x09:                  /* OBP1 - Object Palette 1 */
2176//      update_scanline( machine );
2176//      update_scanline( machine );
21772177      gb_spal1[0] = data & 0x3;
21782178      gb_spal1[1] = (data & 0xC) >> 2;
21792179      gb_spal1[2] = (data & 0x30) >> 4;
r5932r5933
21912191   gb_vid_regs[ offset ] = data;
21922192}
21932193
2194READ8_HANDLER( gbc_video_r )
2194READ8_HANDLER( gbc_video_r )
21952195{
2196   switch( offset )
2196   switch( offset )
21972197   {
21982198   case 0x11:   /* FF51 */
21992199   case 0x12:   /* FF52 */
r5932r5933
22022202      return 0xFF;
22032203   case 0x29:   /* FF69 */
22042204   case 0x2B:   /* FF6B */
2205      if ( gb_lcd.pal_locked == LOCKED )
2205      if ( gb_lcd.pal_locked == LOCKED )
22062206      {
22072207         return 0xFF;
22082208      }
r5932r5933
22112211   return gb_vid_regs[offset];
22122212}
22132213
2214WRITE8_HANDLER ( gbc_video_w )
2214WRITE8_HANDLER ( gbc_video_w )
22152215{
22162216   static UINT16 BP = 0, OP = 0;
22172217
2218   switch( offset )
2218   switch( offset )
22192219   {
22202220   case 0x00:      /* LCDC - LCD Control */
22212221      gb_chrgen = gb_vram + ((data & 0x10) ? 0x0000 : 0x0800);
r5932r5933
22262226      gb_wndtab = gb_vram + ((data & 0x40) ? 0x1C00 : 0x1800);
22272227      gbc_wndtab = gb_vram + ((data & 0x40) ? 0x3C00 : 0x3800);
22282228      /* if LCD controller is switched off, set STAT to 00 */
2229      if ( ! ( data & 0x80 ) )
2229      if ( ! ( data & 0x80 ) )
22302230      {
22312231         LCDSTAT &= ~0x03;
22322232         CURLINE = 0;
r5932r5933
22352235         gb_lcd.pal_locked = UNLOCKED;
22362236      }
22372237      /* If LCD is being switched on */
2238      if ( !( LCDCONT & 0x80 ) && ( data & 0x80 ) )
2238      if ( !( LCDCONT & 0x80 ) && ( data & 0x80 ) )
22392239      {
22402240         gb_lcd_switch_on( space->machine );
22412241      }
22422242      break;
22432243   case 0x01:      /* STAT - LCD Status */
22442244      data = 0x80 | (data & 0x78) | (LCDSTAT & 0x07);
2245      if ( LCDCONT & 0x80 )
2245      if ( LCDCONT & 0x80 )
22462246      {
22472247         /*
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 ) )
22512251         {
22522252            cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE );
22532253         }
22542254         /* Check if line irqs are being disabled */
2255         if ( ! ( data & 0x40 ) )
2255         if ( ! ( data & 0x40 ) )
22562256         {
22572257            gb_lcd.delayed_line_irq = 0;
22582258         }
22592259         /* Check if line irqs are being enabled */
2260         if ( ! ( LCDSTAT & 0x40 ) && ( data & 0x40 ) )
2260         if ( ! ( LCDSTAT & 0x40 ) && ( data & 0x40 ) )
22612261         {
2262            if ( CMPLINE == CURLINE )
2262            if ( CMPLINE == CURLINE )
22632263            {
22642264               gb_lcd.line_irq = 1;
22652265               cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE );
r5932r5933
22682268      }
22692269      break;
22702270   case 0x05:                      /* LYC */
2271      if ( CMPLINE != data )
2271      if ( CMPLINE != data )
22722272      {
22732273         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 ) )
22752275             {
22762276            LCDSTAT |= 0x04;
22772277            /* Generate lcd interrupt if requested */
2278            if ( LCDSTAT & 0x40 )
2278            if ( LCDSTAT & 0x40 )
22792279            {
22802280               cputag_set_input_line( space->machine, "maincpu", LCD_INT, ASSERT_LINE );
22812281            }
2282         }
2283         else
2282         }
2283         else
22842284         {
22852285            LCDSTAT &= 0xFB;
22862286            gb_lcd.triggering_line_irq = 0;
r5932r5933
23372337         {
23382338            /* General DMA */
23392339            gbc_hdma( space->machine, ((data & 0x7F) + 1) * 0x10 );
2340//            cpunum_set_reg( 0, LR35902_DMA_CYCLES, 4 + ( ( ( data & 0x7F ) + 1 ) * 32 ) );
2340//              cpunum_set_reg( 0, LR35902_DMA_CYCLES, 4 + ( ( ( data & 0x7F ) + 1 ) * 32 ) );
23412341            data = 0xff;
23422342         }
23432343      }
r5932r5933
23482348         data &= 0x7f;
23492349         gb_vid_regs[offset] = data;
23502350         /* Check if HDMA should be immediately performed */
2351         if ( gb_lcd.hdma_possible )
2351         if ( gb_lcd.hdma_possible )
23522352         {
23532353            gbc_hdma( space->machine, 0x10 );
2354//            cpunum_set_reg( 0, LR35902_DMA_CYCLES, 36 );
2354//              cpunum_set_reg( 0, LR35902_DMA_CYCLES, 36 );
23552355            gb_lcd.hdma_possible = 0;
23562356         }
23572357      }
r5932r5933
23592359   case 0x28:      /* BCPS - Background palette specification */
23602360      break;
23612361   case 0x29:      /* BCPD - background palette data */
2362      if ( gb_lcd.pal_locked == LOCKED )
2362      if ( gb_lcd.pal_locked == LOCKED )
23632363      {
23642364         return;
23652365      }
r5932r5933
23782378   case 0x2A:      /* OCPS - Object palette specification */
23792379      break;
23802380   case 0x2B:      /* OCPD - Object palette data */
2381      if ( gb_lcd.pal_locked == LOCKED )
2381      if ( gb_lcd.pal_locked == LOCKED )
23822382      {
23832383         return;
23842384      }
src/mess/video/pocketc.c
r5932r5933
3131
3232PALETTE_INIT( pocketc )
3333{
34   UINT8 i=0, r, b, g, color_count = 6;
34   UINT8 i=0, r, b, g, color_count = 6;
3535
3636   machine->colortable = colortable_alloc(machine, color_count);
3737
src/mess/video/z88.c
r5932r5933
201201            }
202202         }
203203
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//          }
211211
212212
213213         /* hi-res? */
src/mess/video/saa505x.h
r5932r5933
11
22/************************************************************************
3   saa505x
3    saa505x
44
5   MESS Driver By:
5    MESS Driver By:
66
7    Gordon Jefferyes
8    mess_bbc@gjeffery.dircon.co.uk
7    Gordon Jefferyes
8    mess_bbc@gjeffery.dircon.co.uk
99
1010 ************************************************************************/
1111
src/mess/video/cdp1862.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
2222
2323
24         http://homepage.mac.com/ruske/cosmacelf/cdp1862.pdf
24           http://homepage.mac.com/ruske/cosmacelf/cdp1862.pdf
2525
2626**********************************************************************/
2727
r5932r5933
6262   double lum_b;            /* blue luminance resistor value */
6363   double lum_g;            /* green luminance resistor value */
6464   double lum_bkg;            /* background luminance resistor value */
65   
65
6666   double chr_r;            /* red chrominance resistor value */
6767   double chr_b;            /* blue chrominance resistor value */
6868   double chr_g;            /* green chrominance resistor value */
src/mess/video/newport.c
r5932r5933
11/*
2   SGI "Newport" graphics board used in the Indy and some Indigo2s
2    SGI "Newport" graphics board used in the Indy and some Indigo2s
33
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
1313
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
2525*/
2626
2727#include "driver.h"
r5932r5933
589589   UINT32 nTemp;
590590   running_machine *machine = space->machine;
591591
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//  }
596596   switch( offset )
597597   {
598598   case 0x0000/4:
r5932r5933
894894      nX = nStartX;
895895      nY = nStartY;
896896      verboselog(machine, 3, "Tux Logo Draw: %04x, %04x = %08x\n", nX, nY, nCMAP0_Palette[ ( nREX3_HostDataPortMSW & 0xff000000 ) >> 24 ] );
897//      nREX3_Kludge_SkipLine = 1;
897//      nREX3_Kludge_SkipLine = 1;
898898      nREX3_BresOctInc1 = 0;
899899      video_base[ nY*(1280+64) + nX ] = nCMAP0_Palette[ ( nREX3_HostDataPortMSW & 0xff000000 ) >> 24 ];
900900      nX++;
r5932r5933
11431143         break;
11441144      }
11451145      nREX3_DrawMode1 = data;
1146//      if( offset >= ( 0x800 / 4 ) )
1147//      {
1148//         DoREX3Command();
1149//      }
1146//      if( offset >= ( 0x800 / 4 ) )
1147//      {
1148//          DoREX3Command();
1149//      }
11501150      break;
11511151   case 0x0004/4:
11521152      verboselog(machine, 2, "REX3 Draw Mode 0 Write: %08x\n", data );
r5932r5933
15631563      }
15641564      verboselog(machine, 2, "    DCB Reg Select Adr: %d\n", ( data & 0x00000070 ) >> 4 );
15651565      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 );
15721572      nREX3_DCBRegSelect = ( data & 0x00000070 ) >> 4;
15731573      nREX3_DCBSlvSelect = ( data & 0x00000780 ) >> 7;
15741574      nREX3_DCBMode = data & 0x1fffffff;
src/mess/video/pc_vga.c
r5932r5933
11/***************************************************************************
22
3   Video Graphics Adapter (VGA) section
3    Video Graphics Adapter (VGA) section
44
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
77
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
1010
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
1515
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
1818
1919
20   ROM declarations:
20    ROM declarations:
2121
22   (oti 037 chip)
22    (oti 037 chip)
2323    ROM_LOAD("oakvga.bin", 0xc0000, 0x8000, 0x318c5f43)
24   (tseng labs famous et4000 isa vga card (oem))
24    (tseng labs famous et4000 isa vga card (oem))
2525    ROM_LOAD("et4000b.bin", 0xc0000, 0x8000, 0xa903540d)
26   (tseng labs famous et4000 isa vga card)
26    (tseng labs famous et4000 isa vga card)
2727    ROM_LOAD("et4000.bin", 0xc0000, 0x8000, 0xf01e4be0)
2828
2929***************************************************************************/
r5932r5933
3737
3838/***************************************************************************
3939
40   Static declarations
40    Static declarations
4141
4242***************************************************************************/
4343
r5932r5933
5656
5757/***************************************************************************
5858
59   MachineDriver stuff
59    MachineDriver stuff
6060
6161***************************************************************************/
6262
src/mess/video/bbctext.h
r5932r5933
17231723  0,0,0,0,0,0,
17241724  0,0,0,0,0,0,
17251725  0,0,0,0,0,0
1726, // 0x5c '½'
1726, // 0x5c '?'
17271727  0,0,0,0,0,0,
17281728  0,1,0,0,0,0,
17291729  0,1,0,0,0,0,
src/mess/video/pcw16.c
r5932r5933
157157***************************************************************************/
158158VIDEO_UPDATE( pcw16 )
159159{
160   unsigned char *pScanLine = (unsigned char *)mess_ram + 0x0fc00;   //0x03c00;   //0x020FC00;
160   unsigned char *pScanLine = (unsigned char *)mess_ram + 0x0fc00;   //0x03c00;  //0x020FC00;
161161
162162   int y;
163163   int x;
r5932r5933
170170   if (pcw16_video_control & (1<<7))
171171   {
172172      /* colour 0 and colour 1 need to be inverted? - what happens in mode 1 and 2 - ignored? or is bit 1 toggled,
173      or is whole lot toggled? */
173        or is whole lot toggled? */
174174
175175      /* force border to be colour 1 */
176176      border_colour = pcw16_colour_palette[1];
src/mess/video/newport.h
r5932r5933
11/*
2   SGI "Newport" graphics board used in the Indy and some Indigo2s
2    SGI "Newport" graphics board used in the Indy and some Indigo2s
33
44*/
55
src/mess/video/pc_vga.h
r5932r5933
11/***************************************************************************
22
3   pc_vga.h
3    pc_vga.h
44
5   PC standard VGA adaptor
5    PC standard VGA adaptor
66
77***************************************************************************/
88
r5932r5933
7373  (mda/hgc lines bit 8 not identical to ega/vga)
7474
7575  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
8080
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
8585
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
9090
91  00001100   320x200
92  00001101   320x200
93  00001110   320x200
94  00001111   320x200
91  00001100  320x200
92  00001101  320x200
93  00001110  320x200
94  00001111  320x200
9595
9696*/
9797
src/mess/video/epnick.c
r5932r5933
222222
223223   Nick_CalcVisibleClocks(ENTERPRISE_SCREEN_WIDTH);
224224
225//   Nick.BORDER = 0;
226//   Nick.FIXBIAS = 0;
225//  Nick.BORDER = 0;
226//  Nick.FIXBIAS = 0;
227227}
228228
229229/* write border colour */
r5932r5933
381381            }
382382         }
383383
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//          }
391391
392392
393393
r5932r5933
536536            }
537537         }
538538
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//          }
546546
547547
548548
r5932r5933
934934   /* scan line count for this LPT */
935935   ScanLineCount = ((~Nick.LPT.SC)+1) & 0x0ff;
936936
937//   printf("ScanLineCount %02x\r\n",ScanLineCount);
937//  printf("ScanLineCount %02x\r\n",ScanLineCount);
938938
939939   /* update count of scanlines done so far */
940940   Nick.ScanLineCount++;
src/mess/video/advision.c
r5932r5933
103103   for( x = (framecount % 2) * 128; x < (framecount % 2) * 128+128; x++ )
104104   {
105105      UINT8 *led = &state->display[x];
106     
106
107107      for( y = 0; y < 8; y++ )
108108      {
109109         for( bit = 0; bit < 8; bit++ )
src/mess/video/radio86.c
r5932r5933
1111#include "video/i8275.h"
1212#include "includes/radio86.h"
1313
14I8275_DISPLAY_PIXELS(radio86_display_pixels)
14I8275_DISPLAY_PIXELS(radio86_display_pixels)
1515{
1616   int i;
1717   bitmap_t *bitmap = tmpbitmap;
r5932r5933
2626   if (rvv) {
2727      pixels ^= 0xff;
2828   }
29   for(i=0;i<6;i++) {     
29   for(i=0;i<6;i++) {
3030      *BITMAP_ADDR16(bitmap, y, x + i) = (pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0;
3131   }
3232}
r5932r5933
104104static const rgb_t radio86_palette[3] = {
105105   MAKE_RGB(0x00, 0x00, 0x00), // black
106106   MAKE_RGB(0xa0, 0xa0, 0xa0), // white
107   MAKE_RGB(0xff, 0xff, 0xff)   // highlight
107   MAKE_RGB(0xff, 0xff, 0xff)   // highlight
108108};
109109
110110PALETTE_INIT( radio86 )
src/mess/video/mz700.c
r5932r5933
11/***************************************************************************
2 *   Sharp MZ700
2 *  Sharp MZ700
33 *
4 *   video hardware
4 *  video hardware
55 *
6 *   Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000
6 *  Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000
77 *
8 *   Reference: http://sharpmz.computingmuseum.com
8 *  Reference: http://sharpmz.computingmuseum.com
99 *
1010 ***************************************************************************/
1111
src/mess/video/abc800.c
r5932r5933
66
77/*
88
9   TODO:
9    TODO:
1010
11   - abc800c
11    - abc800c
1212
1313*/
1414
r5932r5933
7676   abc800_state *state = device->machine->driver_data;
7777
7878   int column;
79   
79
8080   /* prevent wraparound */
8181   if (y >= 240) return;
82   
82
8383   y += 29;
8484
8585   for (column = 0; column < x_count; column++)
r5932r5933
202202static VIDEO_START( abc800m )
203203{
204204   abc800_state *state = machine->driver_data;
205   
205
206206   /* allocate memory */
207207
208208   state->charram = auto_alloc_array(machine, UINT8, ABC800M_CHAR_RAM_SIZE);
r5932r5933
228228static VIDEO_START( abc800c )
229229{
230230   abc800_state *state = machine->driver_data;
231   
231
232232   /* allocate memory */
233233
234234   state->charram = auto_alloc_array(machine, UINT8, ABC800C_CHAR_RAM_SIZE);
r5932r5933
261261
262262   /* draw HR graphics */
263263   abc800m_hr_update(screen->machine, bitmap, cliprect);
264   
264
265265   if (!BIT(state->fgctl, 7))
266266   {
267267      /* draw text */
268268      mc6845_update(state->mc6845, bitmap, cliprect);
269269   }
270   
270
271271   return 0;
272272}
273273
r5932r5933
280280
281281   /* draw HR graphics */
282282   abc800c_hr_update(screen->machine, bitmap, cliprect);
283   
283
284284   if (!BIT(state->fgctl, 7))
285285   {
286286      /* draw text */
287287      abc800c_update(screen->machine, bitmap, cliprect);
288288   }
289   
289
290290   return 0;
291291}
292292
src/mess/video/i82720cm.h
r5932r5933
11/******************************************************************************
22
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.
55
6   Per Ola Ingvarsson
7   Tomas Karlsson
6    Per Ola Ingvarsson
7    Tomas Karlsson
88
99 ******************************************************************************/
1010
r5932r5933
5151
5252   /* Status register flags */
5353
54   GDC_DATA_READY    = 0x01,   /* Data ready         */
54   GDC_DATA_READY    = 0x01,   /* Data ready           */
5555
56   GDC_FIFO_FULL    = 0x02,   /* FIFO full         */
56   GDC_FIFO_FULL    = 0x02,   /* FIFO full            */
5757
58   GDC_FIFO_EMPTY    = 0x04,   /* FIFO empty         */
58   GDC_FIFO_EMPTY    = 0x04,   /* FIFO empty           */
5959
60   GDC_DRAWING    = 0x08,   /* Drawing in progress      */
60   GDC_DRAWING    = 0x08,   /* Drawing in progress      */
6161
62   GDC_DMA_EXEC    = 0x10,   /* DMA execute         */
62   GDC_DMA_EXEC    = 0x10,   /* DMA execute          */
6363
64   GDC_VSYNC    = 0x20,   /* Vertical sync active      */
64   GDC_VSYNC    = 0x20,   /* Vertical sync active     */
6565
66   GDC_HBLANK    = 0x40,   /* Horizontal blanking active   */
66   GDC_HBLANK    = 0x40,   /* Horizontal blanking active   */
6767
68   GDC_LIGHT_PEN    = 0x80      /* Light pen detect      */
68   GDC_LIGHT_PEN    = 0x80      /* Light pen detect     */
6969
7070};
7171
src/mess/video/b2m.c
r5932r5933
11/***************************************************************************
22
3      Bashkiria-2M video driver by Miodrag Milanovic
3        Bashkiria-2M video driver by Miodrag Milanovic
44
5      28/03/2008 Preliminary driver.
6           
5        28/03/2008 Preliminary driver.
6
77****************************************************************************/
88
99
1010#include "driver.h"
1111#include "includes/b2m.h"
12 
12
1313VIDEO_START( b2m )
1414{
1515}
16
16
1717VIDEO_UPDATE( b2m )
1818{
1919    UINT8 code1;
r5932r5933
2121    UINT8 col;
2222   int y, x, b;
2323   b2m_state *state = screen->machine->driver_data;
24     
24
2525   for (x = 0; x < 48; x++)
26   {         
26   {
2727      for (y = 0; y < 256; y++)
2828      {
2929         if (state->b2m_video_page==0) {
r5932r5933
3232         } else {
3333            code1 = mess_ram[0x19000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)];
3434            code2 = mess_ram[0x1d000 + x*256 + ((y + state->b2m_video_scroll) & 0xff)];
35         }         
35         }
3636         for (b = 7; b >= 0; b--)
37         {                       
37         {
3838            col = (((code2 >> b) & 0x01)<<1) + ((code1 >> b) & 0x01);
3939            *BITMAP_ADDR16(bitmap, y, x*8+b) =  col;
4040         }
41      }           
41      }
4242   }
43   
43
4444   return 0;
4545}
4646
4747static const rgb_t b2m_palette[4] = {
4848   MAKE_RGB(0x00, 0x00, 0x00), // 0
4949   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
5252};
5353
5454PALETTE_INIT( b2m )
src/mess/video/vectrex.c
r5932r5933
135135   return via_r(via, offset);
136136}
137137
138WRITE8_HANDLER(vectrex_via_w)
139{
138WRITE8_HANDLER(vectrex_via_w)
139{
140140   const device_config *via = devtag_get_device(space->machine, "via6522_0");
141141   attotime period;
142142
r5932r5933
160160                          period);
161161      break;
162162   }
163   via_w(via, offset, data);
163   via_w(via, offset, data);
164164}
165165
166166
r5932r5933
173173static TIMER_CALLBACK(vectrex_refresh)
174174{
175175   /* Refresh only marks the range of vectors which will be drawn
176    * during the next VIDEO_UPDATE. */
176    * during the next VIDEO_UPDATE. */
177177   display_start = display_end;
178178   display_end = vectrex_point_index;
179179}
r5932r5933
187187
188188   /* start black */
189189   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,
192192                vectrex_points[display_start].col,
193193                0);
194194
r5932r5933
230230void vectrex_add_point_stereo(int x, int y, rgb_t color, int intensity)
231231{
232232   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,
236236                     intensity);
237237   else
238238      vectrex_add_point ((int)(y * M_SQRT1_2),
r5932r5933
266266
267267   if (!ramp)
268268   {
269      length = cputag_get_clock(machine, "maincpu") * INT_PER_CLOCK
269      length = cputag_get_clock(machine, "maincpu") * INT_PER_CLOCK
270270         * attotime_to_double(attotime_sub(timer_get_time(machine), vector_start_time));
271271
272272      x_int += length * (analog[A_X] + analog[A_ZR]);
r5932r5933
306306   vectrex_imager_freq = 1;
307307
308308   vectrex_imager_timer = timer_alloc(machine, vectrex_imager_eye, NULL);
309   timer_adjust_periodic(vectrex_imager_timer,
309   timer_adjust_periodic(vectrex_imager_timer,
310310                    ATTOTIME_IN_HZ(vectrex_imager_freq),
311311                    2,
312312                    ATTOTIME_IN_HZ(vectrex_imager_freq));
r5932r5933
348348         if (lightpen_down)
349349         {
350350            /* 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                 */
368368            double a2, b2, ab, d2;
369369            ab = (pen_x - x_int) * analog[A_X]
370370               +(pen_y - y_int) * analog[A_Y];
r5932r5933
447447      if (vectrex_lightpen_port != 0)
448448      {
449449         lightpen_down = input_port_read(device->machine, "LPENCONF") & 0x10;
450         
450
451451         if (lightpen_down)
452452         {
453453            pen_x = input_port_read(device->machine, "LPENX") * (x_max / 0xff);
454454            pen_y = input_port_read(device->machine, "LPENY") * (y_max / 0xff);
455           
455
456456            dx = abs(pen_x - x_int);
457457            dy = abs(pen_y - y_int);
458458            if (dx < 500000 && dy < 500000 && data > 0)
src/mess/video/arcadia.c
r5932r5933
8383Calculation of sound frequency is done as follows
8484 1/Freq = 2 (pitch +1) * (horizontal line period)
8585
86
86
87874. Sprites
8888
8989Sprite pointers are at 18F0..18F7 (there are four of them). The graphics
r5932r5933
101101by which colours are allocated. There are 8 colours, information is coded
1021023 bits per colour (usually 2 colours per byte)
103103
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
114114
115115Bits 0..2 of $19F9 are the screen colour
116116Bits 3..5 of $19F9 are the colours of characters
r5932r5933
139139        bit 4 is sprite 1 / 3 collision (guess)
140140        bit 5 is sprite 2 / 3 collision (guess)
141141
142   
142
1431437. Graphic Mode
14414419f8 bit 7 graphics mode on (lower 6 bits descripe rectangles)
1451450xc0 in line switches to graphics mode in this line
r5932r5933
156156 8. Memory Map
157157 The offsets in the following memory Map are from the view of the UVI.
158158 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
1780100 - 017F      CE area. In arcadia used for keypad.
1790180 - 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
2170200 - 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
1780100 - 017F     CE area. In arcadia used for keypad.
1790180 - 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
2170200 - 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)
220220*/
221221
222222#include "driver.h"
r5932r5933
376376      data=input_port_read(space->machine, "controller1_joy_x")<<3;
377377   break;
378378    case 0x1ff:
379   if (arcadia_video.ad_select)
379   if (arcadia_video.ad_select)
380380      data=input_port_read(space->machine, "controller2_joy_y")<<3;
381   else
381   else
382382      data=input_port_read(space->machine, "controller2_joy_x")<<3;
383383   break;
384384#else
r5932r5933
456456               int y, int x)
457457{
458458    int k,b,cc,sc, colour;
459    if (arcadia_video.multicolor)
459    if (arcadia_video.multicolor)
460460   {
461461      if (charcode&0x40)
462462         cc=((arcadia_video.reg.d.pal[1]>>3)&7);
r5932r5933
468468      else
469469         sc=(arcadia_video.reg.d.pal[0]&7);
470470
471    }
471    }
472472   else
473473   {
474474      cc=((arcadia_video.reg.d.pal[1]>>3)&1)|((charcode>>5)&6);
r5932r5933
517517
518518    if (bitmap->height-arcadia_video.line<h)
519519      h=bitmap->height-arcadia_video.line;
520   
520
521521   plot_box(bitmap, 0, y, bitmap->width, h, (arcadia_video.reg.d.pal[1]&7));
522522    memset(arcadia_video.bg[y], 0, sizeof(arcadia_video.bg[0])*h);
523   
523
524524   for (x=XPOS+arcadia_video.shift, j=0; j<16;j++,x+=8)
525525   {
526526      ch=chars1[j];
r5932r5933
531531         switch (ch) {
532532         case 0xc0: graphics=TRUE;break;
533533         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");
537537         }
538538      }
539539      if (graphics)
r5932r5933
666666
667667      if (arcadia_video.charline<13)
668668      {
669         if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0)
669         if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0)
670670         {
671671            arcadia_vh_draw_line(device->machine, arcadia_video.bitmap, arcadia_video.charline*h+arcadia_video.ypos,
672672               arcadia_video.reg.d.chars1[arcadia_video.charline]);
673673         }
674674      }
675      else
675      else
676676         if (arcadia_video.lines26 && (arcadia_video.charline<26))
677677         {
678678            if (((arcadia_video.line-arcadia_video.ypos)&(h-1))==0)
src/mess/video/m6847.c
r5932r5933
22
33    m6847.c
44
5   Implementation of Motorola 6847 video hardware chip
5    Implementation of Motorola 6847 video hardware chip
66
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)
1010
1111
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)
2828
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.
3333
34   Timing:
35   (source Motorola M6847 Manual)
34    Timing:
35    (source Motorola M6847 Manual)
3636
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        ...
4545
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)
5050
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
5555
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.
6161
62   TODO: Implement PAL support
62    TODO: Implement PAL support
6363
6464**********************************************************************/
6565
r5932r5933
176176   unsigned int text_offset : 2;         /* needed for CoCo 3 */
177177
178178   /* video state; every scanline the video state for the scanline is copied
179    * here and only rendered in VIDEO_UPDATE */
179    * here and only rendered in VIDEO_UPDATE */
180180   int dirty;
181181   int using_custom;
182182   UINT32 border[384];
r5932r5933
20202020static void apply_artifacts(running_machine *machine, UINT32 *line)
20212021{
20222022   /* 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 */
20292029   static const double artifact_colors[14*3] =
20302030   {
20312031      0.157, 0.000, 0.157, /* [ 1] - dk purple   (reverse  2) */
r5932r5933
21362136static INPUT_CHANGED( artifacting_changed )
21372137{
21382138   /* TODO: not sure how to do this with a device... */
2139//   set_dirty();
2139//  set_dirty();
21402140}
21412141
21422142
src/mess/video/thomson.c
r5932r5933
314314   {
315315      /* between left and right border */
316316      /* 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        */
319319      thom_border_r[ y ] = color;
320320      thom_border_l[ y + 1 ] = color;
321321   }
src/mess/video/cgenie.c
r5932r5933
255255      cursor = 256 * crt.cursor_address_hi + crt.cursor_address_lo;
256256
257257      /*
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         */
261261      for( address = 0; address < size; address++ )
262262      {
263263         i = (offset + address) & 0x3fff;
r5932r5933
280280         {
281281            /* get character code */
282282            code = videoram[i];
283           
283
284284            /* translate defined character sets */
285285            code += cgenie_font_offset[(code >> 6) & 3];
286286            drawgfx_opaque(bitmap, &r, machine->gfx[0], code, colorram[i&0x3ff],
r5932r5933
304304               crt.cursor_phase++;
305305               crt.cursor_visible = (crt.cursor_phase >> 3) & 1;
306306            }
307           
307
308308            if( !crt.cursor_visible )
309309               continue;
310           
310
311311            rc.min_x = r.min_x;
312312            rc.max_x = r.max_x;
313313            rc.min_y = r.min_y + (crt.cursor_top & 15);
r5932r5933
334334      cursor = 256 * crt.cursor_address_hi + crt.cursor_address_lo;
335335
336336      /*
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         */
340340      for( address = 0; address < size; address++ )
341341      {
342342         i = (offset + address) & 0x3fff;
r5932r5933
361361         {
362362            /* get character code */
363363            code = videoram[i];
364           
364
365365            /* translate defined character sets */
366366            code += cgenie_font_offset[(code >> 6) & 3];
367367            drawgfx_opaque(tmpbitmap, &r, machine->gfx[0], code, colorram[i&0x3ff] + 16,
r5932r5933
387387               crt.cursor_phase++;
388388               crt.cursor_visible = (crt.cursor_phase >> 3) & 1;
389389            }
390           
390
391391            if( !crt.cursor_visible )
392392               continue;
393           
393
394394            rc.min_x = r.min_x;
395395            rc.max_x = r.max_x;
396396            rc.min_y = r.min_y + (crt.cursor_top & 15);
397397            rc.max_y = r.min_y + (crt.cursor_bottom & 15);
398           
398
399399            drawgfx_opaque(tmpbitmap, &rc, machine->gfx[0], 0x7f, colorram[i&0x3ff] + 16,
400400               0, 0, rc.min_x, rc.min_y);
401401            drawgfx_opaque(dlybitmap, &rc, machine->gfx[0], 0x7f, colorram[i&0x3ff] + 32,
src/mess/video/m6847.h
r5932r5933
22
33    m6847.h
44
5   Implementation of Motorola 6847 video hardware chip
5    Implementation of Motorola 6847 video hardware chip
66
77**********************************************************************/
88
src/mess/video/abc80.c
r5932r5933
107107         UINT8 data = 0;
108108         int cursor, blank, tecken, graf, versal;
109109         int bit;
110         
110
111111         if (hsync_data & ABC80_K5_LINE_END)
112112            c = 0;
113113
r5932r5933
116116
117117         /*
118118
119            Video RAM Addressing Scheme
119                Video RAM Addressing Scheme
120120
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
123123
124            A6 A5 A4 A3 = 00 C5 C4 C3 + R4 R3 R4 R3
124                A6 A5 A4 A3 = 00 C5 C4 C3 + R4 R3 R4 R3
125125
126         */
127         
126            */
127
128128         videoram_addr = ((r & 0x07) << 7) | ((((c >> 3) & 0x07) + ((r >> 3) | (r >> 1))) & 0x0f) | (c & 0x07);
129129         videoram_data = videoram[videoram_addr];
130130         attr_addr = ((dh & dv) << 7) & (data & 0x7f);
src/mess/video/x68k.c
r5932r5933
11/*
22
3   Sharp X68000 video functions
4   driver by Barry Rodewald
3    Sharp X68000 video functions
4    driver by Barry Rodewald
55
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"
1111
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).
2525
2626*/
2727
r5932r5933
128128
129129static void x68k_crtc_refresh_mode(running_machine *machine)
130130{
131//   rectangle rect;
132//   double scantime;
131//  rectangle rect;
132//  double scantime;
133133   rectangle scr,visiblescr;
134134   int length;
135135
r5932r5933
181181   if(visiblescr.max_y >= scr.max_y - 1)
182182      visiblescr.max_y = scr.max_y - 2;
183183
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]);
186186   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);
187187   video_screen_configure(machine->primary_screen,scr.max_x,scr.max_y,&visiblescr,HZ_TO_ATTOSECONDS(55.45));
188188}
r5932r5933
233233      {
234234         if(oddscanline == 1)
235235         {
236            int scan = video_screen_get_vpos(machine->primary_screen);
236            int scan = video_screen_get_vpos(machine->primary_screen);
237237            if(scan > x68k_sys.crtc.vend)
238238               scan = x68k_sys.crtc.vbegin;
239239            else
r5932r5933
271271      {
272272         hsync_time = video_screen_get_time_until_pos(machine->primary_screen,video_screen_get_vpos(machine->primary_screen)+1,x68k_sys.crtc.hbegin);
273273         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;
276276      }
277277   }
278278}
r5932r5933
480480            memset(x68k_gvram+0x30000,0,0x20000);
481481         }
482482         timer_set(space->machine, ATTOTIME_IN_MSEC(10), NULL, 0x02,x68k_crtc_operation_end);  // time taken to do operation is a complete guess.
483//         popmessage("CRTC: High-speed gfx screen clear [0x%02x]",x68k_sys.crtc.reg[21] & 0x0f);
483//          popmessage("CRTC: High-speed gfx screen clear [0x%02x]",x68k_sys.crtc.reg[21] & 0x0f);
484484      }
485485      break;
486486   }
487//   logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")),data,offset);
487//  logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")),data,offset);
488488}
489489
490490READ16_HANDLER( x68k_crtc_r )
491491{
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    }*/
498498   if(offset < 24)
499499   {
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);
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);
501501      switch(offset)
502502      {
503503      case 9:
r5932r5933
520520   }
521521   if(offset == 576) // operation port, operation bits are set to 0 when operation is complete
522522      return x68k_sys.crtc.operation;
523//   logerror("CRTC: [%08x] Read from unknown CRTC register %i\n",activecpu_get_pc(),offset);
523//  logerror("CRTC: [%08x] Read from unknown CRTC register %i\n",activecpu_get_pc(),offset);
524524   return 0xffff;
525525}
526526
r5932r5933
528528{
529529   int xloc,yloc,pageoffset;
530530   /*
531      G-VRAM usage is determined by colour depth and "real" screen size.
531       G-VRAM usage is determined by colour depth and "real" screen size.
532532
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.
536536
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
545545   // handle different G-VRAM page setups
546546   if(x68k_sys.crtc.reg[20] & 0x08)  // G-VRAM set to buffer
547547   {
r5932r5933
588588            logerror("G-VRAM written while layer setup is undefined.\n");
589589      }
590590   }
591   
591
592592   pageoffset = offset & 0xfffff;
593593   xloc = pageoffset % 1024;
594594   yloc = pageoffset / 1024;
r5932r5933
662662
663663   if(x68k_sys.crtc.reg[20] & 0x08)  // G-VRAM set to buffer
664664      return x68k_gvram[offset];
665   
665
666666   switch(x68k_sys.crtc.reg[20] & 0x0300)  // colour setup determines G-VRAM use
667667   {
668668      case 0x0300: // 65,536 colour (RGB) - 16-bits per word
r5932r5933
693693         logerror("G-VRAM read while layer setup is undefined.\n");
694694         ret = 0xffff;
695695   }
696   
696
697697   return ret;
698698}
699699
r5932r5933
750750   COMBINE_DATA(x68k_spriteram+offset);
751751   x68k_sys.video.tile8_dirty[offset / 16] = 1;
752752   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    }
770770}
771771
772772READ16_HANDLER( x68k_spriteram_r )
r5932r5933
780780   UINT32 loc;  // location in TVRAM
781781   UINT32 colour;
782782   int bit;
783   
783
784784   for(line=rect.min_y;line<=rect.max_y;line++)  // per scanline
785785   {
786786      // adjust for scroll registers
r5932r5933
823823
824824   if(x68k_sys.crtc.reg[20] & 0x0800)  // if graphic layers are set to buffer, then they aren't visible
825825      return;
826     
826
827827   for(priority=3;priority>=0;priority--)
828828   {
829829      if(x68k_sys.crtc.reg[20] & 0x0400)  // 1024x1024 "real" screen size - use 1024x1024 16-colour gfx layer
r5932r5933
872872                  yscr = x68k_sys.crtc.vbegin-(x68k_sys.crtc.reg[13 + (gpage*2)] & 0x1ff);
873873                  copyscrollbitmap_trans(bitmap, x68k_get_gfx_page(gpage,GFX256), 1, &xscr, 1, &yscr, &cliprect,0);
874874               }
875             }           
875             }
876876            break;
877877         case 0x00:
878878            // 16 colour gfx screen
r5932r5933
897897static void x68k_draw_sprites(running_machine *machine, bitmap_t* bitmap, int priority, rectangle cliprect)
898898{
899899   /*
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
909909
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    */
928928   int ptr,pri;
929929
930930   for(ptr=508;ptr>=0;ptr-=4)  // stepping through sprites
r5932r5933
10681068   tilemap_set_transparent_pen(x68k_bg0_16,0);
10691069   tilemap_set_transparent_pen(x68k_bg1_16,0);
10701070
1071//   timer_adjust_periodic(x68k_scanline_timer, attotime_zero, 0, ATTOTIME_IN_HZ(55.45)/568);
1071//  timer_adjust_periodic(x68k_scanline_timer, attotime_zero, 0, ATTOTIME_IN_HZ(55.45)/568);
10721072}
10731073
10741074VIDEO_UPDATE( x68000 )
r5932r5933
10911091      x68k_bg0 = x68k_bg0_16;
10921092      x68k_bg1 = x68k_bg1_16;
10931093   }
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;
10961096   bitmap_fill(bitmap,cliprect,0);
10971097
10981098   if(x68k_sys.sysport.contrast == 0)  // if monitor contrast is 0, then don't bother displaying anything
r5932r5933
11001100
11011101   rect.min_x=x68k_sys.crtc.hbegin;
11021102   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;
11051105   rect.max_x=x68k_sys.crtc.hend;
11061106   rect.max_y=x68k_sys.crtc.vend;
11071107
r5932r5933
11851185   {
11861186      x68k_sys.mfp.isra = 0;
11871187      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);
11901190   }
11911191   if(input_code_pressed(screen->machine,KEYCODE_9))
11921192   {
r5932r5933
12021202#endif
12031203
12041204#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]);
12251225#endif
12261226   return 0;
12271227}
src/mess/video/kramermc.c
r5932r5933
3131{
3232   int x,y;
3333   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
34   
34
3535   for(y = 0; y < 16; y++ )
3636   {
3737      for(x = 0; x < 64; x++ )
src/mess/video/spectrum.c
r5932r5933
3131{
3232   spectrum_frame_number = 0;
3333   spectrum_flash_invert = 0;
34   
34
3535   EventList_Initialise(machine, 30000);
3636
3737   retrace_cycles = SPEC_RETRACE_CYCLES;
38   
38
3939   spectrum_screen_location = spectrum_video_ram;
4040}
4141
r5932r5933
4545   spectrum_flash_invert = 0;
4646
4747   EventList_Initialise(machine, 30000);
48   
48
4949   retrace_cycles = SPEC128_RETRACE_CYCLES;
5050}
5151
r5932r5933
170170static const rgb_t spectrum_palette[16] = {
171171   MAKE_RGB(0x00, 0x00, 0x00),
172172   MAKE_RGB(0x00, 0x00, 0xbf),
173   MAKE_RGB(0xbf, 0x00, 0x00),
173   MAKE_RGB(0xbf, 0x00, 0x00),
174174   MAKE_RGB(0xbf, 0x00, 0xbf),
175   MAKE_RGB(0x00, 0xbf, 0x00),
175   MAKE_RGB(0x00, 0xbf, 0x00),
176176   MAKE_RGB(0x00, 0xbf, 0xbf),
177   MAKE_RGB(0xbf, 0xbf, 0x00),
177   MAKE_RGB(0xbf, 0xbf, 0x00),
178178   MAKE_RGB(0xbf, 0xbf, 0xbf),
179179   MAKE_RGB(0x00, 0x00, 0x00),
180180   MAKE_RGB(0x00, 0x00, 0xff),
src/mess/video/kaypro.c
r5932r5933
1414
1515/***********************************************************
1616
17   Video
17    Video
1818
1919************************************************************/
2020
2121PALETTE_INIT( kaypro )
2222{
2323   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 */
2626}
2727
2828VIDEO_UPDATE( kayproii )
2929{
3030/* 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. */
3737
3838   static UINT8 framecnt=0;
3939   UINT8 y,ra,chr,gfx;
r5932r5933
133133}
134134
135135/* 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.
138138
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
144144
145   Not sure how the attributes interact, for example does an underline blink? */
145    Not sure how the attributes interact, for example does an underline blink? */
146146
147147
148148MC6845_UPDATE_ROW( kaypro2x_update_row )
r5932r5933
152152   for (x = 0; x < x_count; x++)            // for each character
153153   {
154154      UINT8 inv=0;
155      //      if (x == cursor_x) inv=0xff;   /* uncomment when mame fixed */
155      //      if (x == cursor_x) inv=0xff;    /* uncomment when mame fixed */
156156      mem = (ma + x) & 0x7ff;
157157      chr = videoram[mem];
158158      attr = videoram[mem | 0x800];
r5932r5933
217217   UINT8 i,curs_type=0,r9,r10,r11;
218218
219219   /* 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) */
224224
225225   for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) mc6845_cursor[i] = 0;      // prepare cursor by erasing old one
226226
r5932r5933
247247}
248248
249249/* Resize the screen within the limits of the hardware. Expand the image to fill the screen area.
250   Standard screen is 640 x 400 = 0x7d0 bytes. */
250    Standard screen is 640 x 400 = 0x7d0 bytes. */
251251
252252static void mc6845_screen_configure(running_machine *machine)
253253{
src/mess/video/super80.c
r5932r5933
11/* Super80.c written by Robbbert, 2005-2009. See the MESS wiki for documentation. */
22
33/* 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. */
77
88
99#include "driver.h"
r5932r5933
2525
2626static const UINT8 super80_rgb_palette[16*3] =
2727{
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     */
4444};
4545
4646static const UINT8 super80_comp_palette[16*3] =
4747{
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     */
6464};
6565
6666static void palette_set_colors_rgb(running_machine *machine, const UINT8 *colors)
r5932r5933
289289
290290/*---------------------------------------------------------------
291291
292   Super-80R and Super-80V
292    Super-80R and Super-80V
293293
294294---------------------------------------------------------------*/
295295
r5932r5933
348348   UINT8 i,curs_type=0,r9,r10,r11;
349349
350350   /* 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) */
355355
356356   for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) mc6845_cursor[i] = 0;      // prepare cursor by erasing old one
357357
r5932r5933
419419   for (x = 0; x < x_count; x++)            // for each character
420420   {
421421      UINT8 inv=0;
422      //      if (x == cursor_x) inv=0xff;   /* uncomment when mame fixed */
422      //      if (x == cursor_x) inv=0xff;    /* uncomment when mame fixed */
423423      mem = (ma + x) & 0xfff;
424424      chr = videoram[mem];
425425
src/mess/video/crtc_ega.c
r5932r5933
11/**********************************************************************
22
3   IBM EGA CRT Controller emulation
3    IBM EGA CRT Controller emulation
44
5   This controller is very loosely based on the mc6845.
5    This controller is very loosely based on the mc6845.
66
77**********************************************************************/
88
r5932r5933
220220      default:   break;
221221   }
222222
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);
226226
227227   recompute_parameters(crtc_ega, FALSE);
228228}
src/mess/video/atarist.c
r5932r5933
11/*
22
3   TODO:
3    TODO:
44
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
99
1010*/
1111
src/mess/video/tx0.c
r5932r5933
11/*
2   TX-0
2    TX-0
33
4   Raphael Nabet, 2004
4    Raphael Nabet, 2004
55*/
66
77#include "driver.h"
r5932r5933
3737
3838
3939/*
40   video init
40    video init
4141*/
4242VIDEO_START( tx0 )
4343{
r5932r5933
5656
5757
5858/*
59   schedule a pixel to be plotted
59    schedule a pixel to be plotted
6060*/
6161void tx0_plot(int x, int y)
6262{
r5932r5933
6868
6969
7070/*
71   VIDEO_UPDATE( tx0 ): effectively redraw the screen
71    VIDEO_UPDATE( tx0 ): effectively redraw the screen
7272*/
7373VIDEO_UPDATE( tx0 )
7474{
r5932r5933
8484
8585
8686/*
87   Operator control panel code
87    Operator control panel code
8888*/
8989
9090enum
r5932r5933
237237#endif
238238
239239/*
240   draw the operator control panel (fixed backdrop)
240    draw the operator control panel (fixed backdrop)
241241*/
242242static void tx0_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap)
243243{
r5932r5933
284284
285285
286286/*
287   draw the operator control panel (dynamic elements)
287    draw the operator control panel (dynamic elements)
288288*/
289289static void tx0_draw_panel(running_machine *machine, bitmap_t *bitmap)
290290{
r5932r5933
326326
327327
328328/*
329   Typewriter code
329    Typewriter code
330330*/
331331
332332
r5932r5933
420420   case 020:
421421      /* color shift */
422422      /*color = color_typewriter_black;
423      color = color_typewriter_red;*/
423        color = color_typewriter_red;*/
424424      break;
425425
426426   case 043:
src/mess/video/border.c
r5932r5933
6464
6565   for (Count = 0; Count < NumItems; Count++)
6666   {
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);
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);
6868   }
6969
7070   /* Find the first and second events with the correct ID */
r5932r5933
8585   else if (NextItem >= NumItems)
8686   {
8787         /* 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! */
9292         r.min_x = 0;
9393         r.max_x = TotalScreenWidth-1;
9494         r.min_y = 0;
r5932r5933
111111         r.max_y = TotalScreenHeight-1;
112112         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
113113
114//         logerror ("Setting border colour to %d (Last = %d, Full Refresh = %d)\n", CurrBorderColor, LastDisplayedBorderColor, full_refresh);
114//          logerror ("Setting border colour to %d (Last = %d, Full Refresh = %d)\n", CurrBorderColor, LastDisplayedBorderColor, full_refresh);
115115         LastDisplayedBorderColor = CurrBorderColor;
116116   }
117117   else
r5932r5933
336336         /* Set value to ensure redraw on next frame */
337337         LastDisplayedBorderColor = -1;
338338
339//         logerror ("Multi coloured border drawn (last colour = %d)\n", CurrBorderColor);
339//          logerror ("Multi coloured border drawn (last colour = %d)\n", CurrBorderColor);
340340   }
341341
342342   /* Assume all other routines have processed their data from the list */
src/mess/video/crtc6845.c
r5932r5933
11/***************************************************************************
22
3   Motorola 6845 CRT controller and emulation
3    Motorola 6845 CRT controller and emulation
44
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
77
8   Peter Trauner
9   Nathan Woods
8    Peter Trauner
9    Nathan Woods
1010
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)
3030
3131***************************************************************************/
3232
r5932r5933
3737
3838/***************************************************************************
3939
40   Type definitions
40    Type definitions
4141
4242***************************************************************************/
4343
r5932r5933
6060
6161/***************************************************************************
6262
63   Local variables
63    Local variables
6464
6565***************************************************************************/
6666
6767/*-------------------------------------------------
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
7171-------------------------------------------------*/
7272
7373static const struct reg_mask mscrtc6845_reg_mask[2][18] =
r5932r5933
9999
100100/***************************************************************************
101101
102   Functions
102    Functions
103103
104104***************************************************************************/
105105
r5932r5933
282282         }
283283
284284         /* 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             */
287287         if ((crtc->config.personality == M6845_PERSONALITY_PC1512) && (idx == 9))
288288         {
289289            UINT8 char_height;
src/mess/video/timex.c
r5932r5933
22
33  timex.c
44
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.
66
77  Changes:
88
src/mess/video/pc_video.c
r5932r5933
11/*********************************************************************
22
3   pc_video.c
3    pc_video.c
44
5   PC Video code
5    PC Video code
66
77*********************************************************************/
88
r5932r5933
1515
1616/***************************************************************************
1717
18   Local variables
18    Local variables
1919
2020***************************************************************************/
2121
r5932r5933
143143
144144/*************************************
145145 *
146 *   Graphics renderers
146 *  Graphics renderers
147147 *
148148 *************************************/
149149
src/mess/video/osi.c
r5932r5933
174174   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
175175   MDRV_SCREEN_SIZE(64*8, 16*16)
176176   MDRV_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1)
177   
177
178178   MDRV_PALETTE_LENGTH(2)
179179   MDRV_PALETTE_INIT(black_and_white)
180180
src/mess/video/oric.c
r5932r5933
11/***************************************************************************
22
3   video/oric.c
3    video/oric.c
44
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.
77
8   TODO:
9   - speed up this code a bit?
8    TODO:
9    - speed up this code a bit?
1010
1111***************************************************************************/
1212
r5932r5933
2424{
2525   /* foreground and background colour used for rendering */
2626   /* if flash attribute is set, these two will both be equal
27   to background colour */
27    to background colour */
2828   int active_foreground_colour;
2929   int active_background_colour;
3030   /* current foreground and background colour */
r5932r5933
159159
160160         /* a different charset base is used depending on the video mode */
161161         /* hires takes all the data from 0x0a000 through to about 0x0bf68,
162         so the charset is moved to 0x09800 */
162            so the charset is moved to 0x09800 */
163163         /* text mode starts at 0x0bb80 and so the charset is in a different location */
164164         if (vh_state.mode & (1<<2))
165165         {
r5932r5933
171171               vh_state.char_base = memory_get_read_ptr(space, 0x09800);
172172
173173            /* changing the mode also changes the position of the standard charset
174            and alternative charset */
174                and alternative charset */
175175            oric_refresh_charset();
176176         }
177177         else
r5932r5933
184184               vh_state.char_base = memory_get_read_ptr(space, 0x0b400);
185185
186186            /* changing the mode also changes the position of the standard charset
187            and alternative charset */
187                and alternative charset */
188188            oric_refresh_charset();
189189         }
190190      }
r5932r5933
277277         if (y<200)
278278         {
279279            /* calculate fetch address based on current line and
280            current mode */
280                current mode */
281281            if (hires_active)
282282            {
283283               read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(y*40);
r5932r5933
347347               if (vh_state.text_attributes & (1<<1))
348348               {
349349                  /* if char line is even, top half of character is displayed,
350                  if char line is odd, bottom half of character is displayed */
350                        if char line is odd, bottom half of character is displayed */
351351                  int double_height_flag = ((y>>3) & 0x01);
352352
353353                  /* calculate line to fetch */
src/mess/video/pc_video.h
r5932r5933
11/*********************************************************************
22
3   pc_video.h
3    pc_video.h
44
5   Refactoring of code common to PC video implementations
5    Refactoring of code common to PC video implementations
66
77*********************************************************************/
88
src/mess/video/orao.c
r5932r5933
11/***************************************************************************
22
3      Orao video driver by Miodrag Milanovic
3        Orao video driver by Miodrag Milanovic
44
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
88****************************************************************************/
99
1010#include "driver.h"
1111#include "includes/orao.h"
1212
1313UINT8 *orao_video_ram;
14 
14
1515VIDEO_START( orao )
1616{
1717}
18
18
1919VIDEO_UPDATE( orao )
2020{
2121   UINT8 code;
2222   int y, x, b;
23   
24   int addr = 0;   
23
24   int addr = 0;
2525   for (y = 0; y < 256; y++)
2626   {
2727      int horpos = 0;
2828      for (x = 0; x < 32; x++)
29      {         
29      {
3030         code = orao_video_ram[addr++];
3131         for (b = 0; b < 8; b++)
32         {           
32         {
3333            *BITMAP_ADDR16(bitmap, y, horpos++) =  (code >> b) & 0x01;
3434         }
3535      }
src/mess/video/mekd2.c
r5932r5933
11/******************************************************************************
2   Motorola Evaluation Kit 6800 D2
2    Motorola Evaluation Kit 6800 D2
33    MEK6800D2
44
55    video driver
66
7   Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
7    Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
88
99******************************************************************************/
1010
r5932r5933
1919
2020   for (i = 0; i < 16; i++)
2121      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(24 + (i + 1) * (i + 1) - 1, (i + 1) * (i + 1) / 4, 0));
22   
22
2323   colortable_palette_set_color(machine->colortable, 16, MAKE_RGB(0, 0, 0));
2424   colortable_palette_set_color(machine->colortable, 17, MAKE_RGB(30, 30, 30));
2525   colortable_palette_set_color(machine->colortable, 18, MAKE_RGB(90, 90, 90));
src/mess/video/upd7220.c
r5932r5933
4949   devcb_resolved_write_line   out_vsync_func;
5050   devcb_resolved_write_line   out_blank_func;
5151
52   int clock;                 
52   int clock;
5353
5454   UINT8 ra[16];               /* parameter RAM */
5555
r5932r5933
7676   UINT32 ead;                  /* execute word address */
7777   UINT16 dad;                  /* dot address within the word */
7878   UINT32 lad;                  /* light pen address */
79   
79
8080   int disp;                  /* display zoom factor */
8181   int gchr;                  /* zoom factor for graphics character writing and area filling */
8282   UINT16 mask;               /* mask register */
r5932r5933
122122***************************************************************************/
123123
124124/*-------------------------------------------------
125    recompute_parameters -
125    recompute_parameters -
126126-------------------------------------------------*/
127127#ifdef UNUSED_FUNCTION
128128static void recompute_parameters(upd7220_t *upd7220)
r5932r5933
143143}
144144#endif
145145/*-------------------------------------------------
146    update_vsync_timer -
146    update_vsync_timer -
147147-------------------------------------------------*/
148148
149149static void update_vsync_timer(upd7220_t *upd7220, int state)
r5932r5933
170170}
171171
172172/*-------------------------------------------------
173    update_hsync_timer -
173    update_hsync_timer -
174174-------------------------------------------------*/
175175
176176static void update_hsync_timer(upd7220_t *upd7220, int state)
r5932r5933
200200}
201201
202202/*-------------------------------------------------
203    update_blank_timer -
203    update_blank_timer -
204204-------------------------------------------------*/
205205
206206static void update_blank_timer(upd7220_t *upd7220, int state)
src/mess/video/vic4567.c
r5932r5933
849849         if (c64_pal)
850850         {
851851            if (vic2.on) vic2_drawlines (device->machine, vic2.lastline, vic2.lines, VIC2_STARTVISIBLECOLUMNS + 32, VIC2_STARTVISIBLECOLUMNS + 32 + columns + 16 - 1);
852         }         
852         }
853853         else
854854         {
855855            if (vic2.on) vic2_drawlines (device->machine, vic2.lastline, vic2.lines, VIC2_STARTVISIBLECOLUMNS + 34, VIC2_STARTVISIBLECOLUMNS + 34 + columns + 16 - 1);
r5932r5933
875875         if (c64_pal)
876876         {
877877            if (vic2.on) vic2_drawlines (device->machine, vic2.rasterline-1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS + 32, VIC2_STARTVISIBLECOLUMNS + 32 + columns + 16 - 1);
878         }         
878         }
879879         else
880880         {
881881            if (vic2.on) vic2_drawlines (device->machine, vic2.rasterline-1, vic2.rasterline, VIC2_STARTVISIBLECOLUMNS + 34, VIC2_STARTVISIBLECOLUMNS + 34 + columns + 16 - 1);
src/mess/video/vector06.c
r5932r5933
2020    UINT8 col;
2121   int y, x, b,draw_y;
2222
23   int width = (vector_video_mode==0x00) ? 256 : 512;     
23   int width = (vector_video_mode==0x00) ? 256 : 512;
2424   rectangle screen_area = {0,width+64-1,0,256+64-1};
2525   // fill border color
2626   bitmap_fill(bitmap, &screen_area, vector_color_index);
src/mess/video/galeb.c
r5932r5933
11/***************************************************************************
22
3      Galeb video driver by Miodrag Milanovic
3        Galeb video driver by Miodrag Milanovic
44
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
88****************************************************************************/
99
1010
1111#include "driver.h"
1212#include "includes/galeb.h"
13 
13
1414UINT8 *galeb_video_ram;
15   
15
1616const gfx_layout galeb_charlayout =
1717{
1818   8, 8,            /* 8x8 characters */
r5932r5933
2727VIDEO_START( galeb )
2828{
2929}
30
30
3131VIDEO_UPDATE( galeb )
3232{
3333   int x,y;
src/mess/video/pc1403.c
r5932r5933
11/*****************************************************************************
22 *
3 *    pc1403.c
4 *    portable sharp pc1403 video emulator interface
3 *   pc1403.c
4 *   portable sharp pc1403 video emulator interface
55 *   (sharp pocket computers)
66 *
7 *    Copyright (c) 2001 Peter Trauner, all rights reserved.
7 *  Copyright (c) 2001 Peter Trauner, all rights reserved.
88 *
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.
2020 *
2121 * History of changes:
2222 * 21.07.2001 Several changes listed below were made by Mario Konegger
2323 *            (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.
2929 *****************************************************************************/
3030
3131#include "driver.h"
r5932r5933
165165   color[2] = pocketc_colortable[CONTRAST][1];
166166   color[1] = (pc1403_portc & 1) ? color[2] : color[0];
167167
168   if (pc1403_portc & 1)
168   if (pc1403_portc & 1)
169169   {
170170      for (x=RIGHT, y=DOWN, i=0; i<6*5; x+=2) {
171171         for (j=0; j<5; j++, i++, x+=2)
172172         drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0,
173173            x,y);
174174      }
175      for (i=9*5; i<12*5; x+=2)
175      for (i=9*5; i<12*5; x+=2)
176176      {
177177         for (j=0; j<5; j++, i++, x+=2)
178178         drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0,
179179            x,y);
180180      }
181      for (i=6*5; i<9*5; x+=2)
181      for (i=6*5; i<9*5; x+=2)
182182      {
183183         for (j=0; j<5; j++, i++, x+=2)
184184         drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0,
185185            x,y);
186186      }
187      for (i=0x7b-3*5; i>0x7b-6*5; x+=2)
187      for (i=0x7b-3*5; i>0x7b-6*5; x+=2)
188188      {
189189         for (j=0; j<5; j++, i--, x+=2)
190190            drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0,
191191            x,y);
192192      }
193      for (i=0x7b; i>0x7b-3*5; x+=2)
193      for (i=0x7b; i>0x7b-3*5; x+=2)
194194      {
195195         for (j=0; j<5; j++, i--, x+=2)
196196         drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0,
197197            x,y);
198198      }
199      for (i=0x7b-6*5; i>0x7b-12*5; x+=2)
199      for (i=0x7b-6*5; i>0x7b-12*5; x+=2)
200200      {
201201         for (j=0; j<5; j++, i--, x+=2)
202202         drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1403_lcd.reg[i],CONTRAST,0,0,
r5932r5933
207207    /* But if computer is off, busy is hidden. */
208208    if(!(pc1403_portc&8))
209209    {
210      if (pc1403_portc&1)
210      if (pc1403_portc&1)
211211         pocketc_draw_special(bitmap, RIGHT, DOWN-13, busy,
212212            pc1403_lcd.reg[0x3d] & 1 ? color[2] : color[0]);
213213
src/mess/video/v1050.c
r5932r5933
44
55/*
66
7   TODO:
7    TODO:
88
9   - bright in reverse video
9    - bright in reverse video
1010
1111*/
1212
r5932r5933
102102   v1050_set_int(device->machine, INT_VSYNC, state);
103103}
104104
105static const mc6845_interface v1050_mc6845_intf =
105static const mc6845_interface v1050_mc6845_intf =
106106{
107107   SCREEN_TAG,
108108   8,
r5932r5933
130130static VIDEO_START( v1050 )
131131{
132132   v1050_state *state = machine->driver_data;
133   
133
134134   /* find devices */
135135   state->mc6845 = devtag_get_device(machine, H46505_TAG);
136136
r5932r5933
149149   v1050_state *state = screen->machine->driver_data;
150150
151151   mc6845_update(state->mc6845, bitmap, cliprect);
152   
152
153153   return 0;
154154}
155155
src/mess/video/electron.c
r5932r5933
11/******************************************************************************
2   Acorn Electron driver
2    Acorn Electron driver
33
4   MESS Driver By:
4    MESS Driver By:
55
6   Wilbert Pol
6    Wilbert Pol
77
88******************************************************************************/
99
r5932r5933
252252      }
253253      break;
254254   }
255   
255
256256   return 0;
257257}
258258
src/mess/video/911_chr.h
r5932r5933
11/*
2   911_chr.h: character definitions for 911_vdt.c
2    911_chr.h: character definitions for 911_vdt.c
33
4   We define the character matrix for each character.
4    We define the character matrix for each character.
55
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.
88
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.
1414
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.
1919
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.
2727
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.
3030*/
3131/*
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.
3535*/
3636
3737
3838/*
39   Offsets in the char_defs array
39    Offsets in the char_defs array
4040*/
4141enum
4242{
r5932r5933
147147};
148148
149149/*
150   char_defs array: character matrices for each character
150    char_defs array: character matrices for each character
151151*/
152152static const UINT8 char_defs[char_defs_count][10] =
153153{
src/mess/video/zx8301.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - use resnet for colors
15   - proper video timing
14    - use resnet for colors
15    - proper video timing
1616
1717*/
1818
r5932r5933
170170
171171/*-------------------------------------------------
172172    zx8301_draw_line_mode4 - high resolution
173   line drawing routine
173    line drawing routine
174174-------------------------------------------------*/
175175
176176static void zx8301_draw_line_mode4(const device_config *device, bitmap_t *bitmap, int y, UINT16 da)
r5932r5933
200200
201201/*-------------------------------------------------
202202    zx8301_draw_line_mode4 - low resolution
203   line drawing routine
203    line drawing routine
204204-------------------------------------------------*/
205205
206206static void zx8301_draw_line_mode8(const device_config *device, bitmap_t *bitmap, int y, UINT16 da)
r5932r5933
331331
332332static DEVICE_RESET( zx8301 )
333333{
334//   zx8301_t *zx8301 = get_safe_token(device);
334//  zx8301_t *zx8301 = get_safe_token(device);
335335}
336336
337337/*-------------------------------------------------
src/mess/video/channelf.c
r5932r5933
99{
1010   MAKE_RGB(0x10, 0x10, 0x10),   /* black */
1111   MAKE_RGB(0xfd, 0xfd, 0xfd),   /* white */
12   MAKE_RGB(0xff, 0x31, 0x53),   /* red    */
12   MAKE_RGB(0xff, 0x31, 0x53),   /* red  */
1313   MAKE_RGB(0x02, 0xcc, 0x5d),   /* green */
1414   MAKE_RGB(0x4b, 0x3f, 0xf3),   /* blue  */
1515   MAKE_RGB(0xe0, 0xe0, 0xe0),   /* ltgray  */
src/mess/video/irisha.c
r5932r5933
2121    UINT8 col;
2222   int y, x, b;
2323   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
24   
24
2525   // draw image
2626   for (y = 0; y < 200; y++)
2727   {
src/mess/video/vtvideo.c
r5932r5933
2020#define   VERBOSE         0
2121
2222#define   LOG(x)      do { if (VERBOSE) logerror x; } while (0)
23   
23
2424/***************************************************************************
2525    TYPE DEFINITIONS
2626***************************************************************************/
r5932r5933
3333
3434   const device_config *screen;   /* screen */
3535   UINT8 *gfx;      /* content of char rom */
36       
36
3737    int lba7;
38   
38
3939    // dc012 attributes
4040    UINT8 scroll_latch;
4141    UINT8 blink_flip_flop;
r5932r5933
4444    // dc011 attributes
4545    UINT8 columns;
4646    UINT8 height;
47    UINT8 skip_lines;   
47    UINT8 skip_lines;
4848    UINT8 frequency;
4949    UINT8 interlaced;
5050};
r5932r5933
6464INLINE const vt_video_interface *get_interface(const device_config *device)
6565{
6666   assert(device != NULL);
67//   assert((device->type == dc012));
67//  assert((device->type == dc012));
6868   return (const vt_video_interface *) device->static_config;
6969}
7070
r5932r5933
8181WRITE8_DEVICE_HANDLER( dc012_w )
8282{
8383   vt_video_t *vt = get_safe_token(device);
84       
84
8585    if ((data & 0x08)==0) {
8686      if ((data & 0x04)==0) {
8787         // set lower part scroll
r5932r5933
103103         case 0x0A:
104104            // set reverse field on
105105            vt->reverse_field = 1;
106            break;           
106            break;
107107         case 0x0B:
108108            // set reverse field off
109109            vt->reverse_field = 0;
r5932r5933
146146         vt->frequency = 50;
147147         vt->skip_lines = 5;
148148      }
149      vt->interlaced = 0;     
149      vt->interlaced = 0;
150150   }
151151}
152152
r5932r5933
155155   //palette_set_color_rgb(device->machine, 1, data, data, data);
156156}
157157
158static 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{               
158static 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{
161161   UINT8 line=0;
162162      int i,b,bit=0,j;
163163    int double_width = (display_type==2) ? 1 : 0;
r5932r5933
165165
166166   for (i = 0; i < 10; i++)
167167   {
168     
168
169169      switch(display_type) {
170170         case 0 : // bottom half, double height
171171                j = (i >> 1)+5; break;
172172         case 1 : // top half, double height
173173                 j = (i >> 1); break;
174         case 2 : // double width           
174         case 2 : // double width
175175         case 3 : // normal
176176                j = i;   break;
177177         default : j = 0; break;
178178      }
179179      // modify line since that is how it is stored in rom
180180      if (j==0) j=15; else j=j-1;
181     
181
182182      line = vt->gfx[(code & 0x7f)*16 + j];
183183      if (vt->basic_attribute==1) {
184184         if ((code & 0x80)==0x80) {
185185            line = line ^ 0xff;
186         }   
187      }
188     
186         }
187      }
188
189189      for (b = 0; b < 8; b++)
190190      {
191191         bit = ((line << b) & 0x80) ? 1 : 0;
r5932r5933
222222    UINT8 scroll_region = 1; // binary 1
223223    UINT8 display_type = 3;  // binary 11
224224    UINT16 temp =0;
225   
225
226226   if (devcb_call_read8(&vt->in_ram_func, 0) !=0x7f) return;
227     
227
228228    while(line < (vt->height + vt->skip_lines)) {
229229       code =  devcb_call_read8(&vt->in_ram_func, addr + xpos);
230230       if (code == 0x7f) {
r5932r5933
234234            {
235235               vt_video_display_char(device,bitmap,code,x,ypos,scroll_region,display_type);
236236            }
237          }   
238          // move to new data   
237          }
238          // move to new data
239239          temp = devcb_call_read8(&vt->in_ram_func, addr+xpos+1)*256 + devcb_call_read8(&vt->in_ram_func, addr+xpos+2);
240240          addr = (temp) & 0x1fff;
241241          // if A12 is 1 then it is 0x2000 block, if 0 then 0x4000 (AVO)
r5932r5933
246246             ypos++;
247247          }
248248          xpos=0;
249          line++;             
249          line++;
250250       } else {
251251          // display regular char
252252          if (line >= vt->skip_lines) {
253253            vt_video_display_char(device,bitmap,code,xpos,ypos,scroll_region,display_type);
254         }               
254         }
255255         xpos++;
256256         if (xpos > vt->columns) {
257            line++;           
257            line++;
258258            xpos=0;
259259         }
260260       }
261261   }
262   
262
263263}
264264
265265/*-------------------------------------------------
r5932r5933
273273
274274   /* resolve callbacks */
275275   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);
277277
278278   /* get the screen device */
279279   vt->screen = devtag_get_device(device->machine, intf->screen_tag);
280280   assert(vt->screen != NULL);
281   
281
282282     vt->gfx = memory_region(device->machine, intf->char_rom_region_tag);
283283   assert(vt->gfx != NULL);
284   
284
285285}
286286
287287static TIMER_CALLBACK(lba7_change)
r5932r5933
315315    vt->interlaced = 1;
316316   vt->skip_lines = 2; // for 60Hz
317317    // 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);
319319}
320320
321321/*-------------------------------------------------
src/mess/video/zx8301.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3030
3131**********************************************************************/
3232
src/mess/video/apple1.c
r5932r5933
103103   int cursor_x, cursor_y;
104104
105105   /* While CLEAR SCREEN is being held down, the hardware is forced
106      to clear the video memory, so video writes have no effect. */
106       to clear the video memory, so video writes have no effect. */
107107   if (apple1_vh_clrscrn_pressed)
108108      return;
109109
r5932r5933
114114
115115   if (data == '\r') {
116116      /* Carriage-return moves the cursor to the start of the next
117         line. */
117           line. */
118118      cursor_x = 0;
119119      cursor_y++;
120120   }
121121   else if (data < ' ') {
122122      /* Except for carriage-return, the video hardware completely
123         ignores all control characters. */
123           ignores all control characters. */
124124      return;
125125   }
126126   else {
127127      /* 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. */
135135
136136      int romindx = (data & 0x1f) | (((data ^ 0x40) & 0x40) >> 1);
137137
r5932r5933
184184   double cursor_hfrac;
185185
186186   /* 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. */
193193
194194   terminal_getcursor(apple1_terminal, &cursor_x, &cursor_y);
195195   cursor_scanline = cursor_y * apple1_charlayout.height;
196196
197197   /* 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. */
200200   cursor_hfrac = (175 + cursor_x * apple1_charlayout.width) / 455;
201201
202202   if (video_screen_get_vpos(machine->primary_screen) == cursor_scanline) {
203203      /* 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. */
208208      double current_hfrac = video_screen_get_hpos(machine->primary_screen) /
209209                        video_screen_get_width(video_screen_first(machine->config));
210210      if (current_hfrac < cursor_hfrac)
r5932r5933
223223   int new_blink_on;
224224
225225   /* 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. */
230230
231231   if (((int) (attotime_to_double(timer_get_time(machine)) / CURSOR_OFF_LENGTH)) % 3 < 2)
232232      new_blink_on = 1;
src/mess/video/pc_mda.c
r5932r5933
317317
318318
319319/*
320 *   rW   MDA mode control register (see #P138)
320 *  rW  MDA mode control register (see #P138)
321321 */
322322static void mda_mode_control_w(running_machine *machine, int data)
323323{
r5932r5933
339339}
340340
341341
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
352352 */
353353static int pc_mda_status_r(void)
354354{
r5932r5933
359359
360360/*************************************************************************
361361 *
362 *      MDA
363 *      monochrome display adapter
362 *      MDA
363 *      monochrome display adapter
364364 *
365365 *************************************************************************/
366366WRITE8_HANDLER ( pc_MDA_w )
src/mess/video/vtvideo.h
r5932r5933
44    [ DC012 and DC011 emulation ]
55
66    01/05/2009 Initial implementation [Miodrag Milanovic]
7   
7
88    Copyright MESS Team.
99    Visit http://mamedev.org for licensing and usage restrictions.
1010
src/mess/video/orion.c
r5932r5933
11/***************************************************************************
22
3      Orion video driver by Miodrag Milanovic
3        Orion video driver by Miodrag Milanovic
44
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
88****************************************************************************/
99
1010
1111#include "driver.h"
1212#include "includes/orion.h"
13 
1413
14
1515VIDEO_START( orion128 )
1616{
1717}
18
18
1919VIDEO_UPDATE( orion128 )
2020{
2121   UINT8 code1,code2,code3,code4,color,val;
r5932r5933
2323   int orionproshift = (orion128_video_mode & 0x10) ? 1 : 0;
2424   int part1addr = (3-((orion128_video_page & 3) | orionproshift)) * 0x4000;
2525
26   int part2addr = part1addr + 0x10000;         
26   int part2addr = part1addr + 0x10000;
2727   int video_mode = orion128_video_mode & orion_video_mode_mask;
2828   for (x = 0; x < orion128_video_width; x++)
29   {         
29   {
3030      for (y = 0; y < 256; y++)
3131      {
32         code1 = mess_ram[part1addr + y + x*256];         
32         code1 = mess_ram[part1addr + y + x*256];
3333         code2 = mess_ram[part2addr + y + x*256];
3434         code3 = mess_ram[part1addr + y + x*256 + 0x4000];
3535         code4 = mess_ram[part2addr + y + x*256 + 0x4000];
r5932r5933
3737            code2 = orionpro_pseudo_color;
3838         }
3939         color = 0;
40         for (b = 7; b >= 0; b--)         
41         {                       
40         for (b = 7; b >= 0; b--)
41         {
4242            switch(orion128_video_mode & orion_video_mode_mask) {
4343               case 0 : color = ((code1 >> b) & 0x01) ? 10 : 0; break;
4444               case 1 : color = ((code1 >> b) & 0x01) ? 17 : 16; break;
r5932r5933
4949                         case 2 : color = 2; break; // green
5050                         case 3 : color = 1; break; // blue
5151                      }
52                      break;
52                      break;
5353               case 5 : val = (((code1 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01);
5454                      switch(val) {
5555                         case 0 : color = 7; break; // white
r5932r5933
5757                         case 2 : color = 2; break; // green
5858                         case 3 : color = 1; break; // blue
5959                      }
60                      break;
61               case 6 :                                 
60                      break;
61               case 6 :
6262               case 7 :
6363               case 14 :
6464               case 15 :
65                      color = ((code1 >> b) & 0x01) ? (code2 & 0x0f) : (code2 >> 4); break;     
66                     
65                      color = ((code1 >> b) & 0x01) ? (code2 & 0x0f) : (code2 >> 4); break;
66
6767               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 :
7070                            color = (((code1 >> b) & 0x01) << 2) + (((code3 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01);
71                            break;                     
71                            break;
7272                     case 20 :
7373                            color = (((code1 >> b) & 0x01) << 2) + (((code3 >> b) & 0x01) << 1) + ((code2 >> b) & 0x01);
7474                            if ((((code4 >> b) & 0x01)==1) && (color!=0)) {
7575                              color += 8;
7676                            }
7777                            break;
78                   }                       
78                   }
7979            }
8080            *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = color;
8181         }
82      }           
82      }
8383   }
84   
84
8585   return 0;
8686}
8787
8888static const rgb_t orion128_palette[18] = {
8989   MAKE_RGB(0x00, 0x00, 0x00), // 0
9090   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
107107};
108108
109109PALETTE_INIT( orion128 )
src/mess/video/pc_t1t.c
r5932r5933
11/***************************************************************************
22
3   IBM PC junior
4   Tandy 1000 Graphics Adapter (T1T) section
3    IBM PC junior
4    Tandy 1000 Graphics Adapter (T1T) section
55
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
88
99***************************************************************************/
1010
r5932r5933
1616
1717/***************************************************************************
1818
19   Static declarations
19    Static declarations
2020
2121***************************************************************************/
2222
r5932r5933
8888
8989/***************************************************************************
9090
91   Methods
91    Methods
9292
9393***************************************************************************/
9494
r5932r5933
124124      UINT8 index;
125125      UINT8 data[0x20];
126126      /* 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        */
134134   } reg;
135135
136136   UINT8 bank;
r5932r5933
318318      UINT8 data0 = vid[ offset ];
319319      UINT8 data1 = vid[ offset + 1 ];
320320
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++;
322322      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x40 ) >> 6 ) | ( ( data1 & 0x40 ) >> 5 ) ) ]; p++;
323323      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x20 ) >> 5 ) | ( ( data1 & 0x20 ) >> 4 ) ) ]; p++;
324324      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x10 ) >> 4 ) | ( ( data1 & 0x10 ) >> 3 ) ) ]; p++;
r5932r5933
332332
333333static MC6845_UPDATE_ROW( t1000_gfx_2bpp_tga_update_row )
334334{
335   UINT16   *p = BITMAP_ADDR16(bitmap, y, 0);
335   UINT16   *p = BITMAP_ADDR16(bitmap, y, 0);
336336   UINT8   *vid = pcjr.displayram + ( ra << 13 );
337   int i;
337   int i;
338338
339339   if ( y == 0 ) logerror("t1000_gfx_2bpp_tga_update_row\n");
340340   for ( i = 0; i < x_count; i++ )
341341   {
342342      UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff;
343      UINT8 data = vid[ offset ];
343      UINT8 data = vid[ offset ];
344344      UINT16 data2 = ( vid[ offset + 1 ] ) << 1;
345       
345
346346      *p = pcjr.reg.data[ 0x10 + ( ( ( data2 & 0x100 ) | ( data & 0x80 ) ) >> 7 ) ]; p++;
347347      *p = pcjr.reg.data[ 0x10 + ( ( ( data2 & 0x80 ) | ( data & 0x40 ) ) >> 6 ) ]; p++;
348348      *p = pcjr.reg.data[ 0x10 + ( ( ( data2 & 0x40 ) | ( data & 0x20 ) ) >> 5 ) ]; p++;
r5932r5933
540540
541541
542542/*
543 * 3d8 rW   T1T mode control register (see #P138)
543 * 3d8 rW   T1T mode control register (see #P138)
544544 */
545545static void pc_t1t_mode_control_w(int data)
546546{
r5932r5933
556556}
557557
558558/*
559 * 3d9 ?W   color select register on color adapter
559 * 3d9 ?W   color select register on color adapter
560560 */
561561static void pc_t1t_color_select_w(int data)
562562{
r5932r5933
597597}
598598
599599/*
600 * 3db -W   light pen strobe reset (on any value)
600 * 3db -W   light pen strobe reset (on any value)
601601 */
602602static void pc_t1t_lightpen_strobe_w(int data)
603603{
604//   pc_port[0x3db] = data;
604//  pc_port[0x3db] = data;
605605}
606606
607607
608608/*
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)
611611 */
612612static void pc_t1t_vga_index_w(int data)
613613{
r5932r5933
704704}
705705
706706/*
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)
716716 */
717717static void pc_t1t_bank_w(running_machine *machine, int data)
718718{
r5932r5933
775775
776776/*************************************************************************
777777 *
778 *      T1T
779 *      Tandy 1000 / PCjr
778 *      T1T
779 *      Tandy 1000 / PCjr
780780 *
781781 *************************************************************************/
782782
r5932r5933
826826
827827   switch( offset )
828828   {
829      case 0: case 4:
829      case 0: case 4:
830830         devconf = devtag_get_device(space->machine, T1000_MC6845_NAME);
831831         mc6845_address_w( devconf, offset, data );
832832         break;
src/mess/video/a7800.c
r5932r5933
55  Routines to control the Atari 7800 video hardware
66
77  TODO:
8   precise DMA cycle stealing
8    precise DMA cycle stealing
99
10   2003-06-23 ericball Kangaroo mode & 320 mode & other stuff
10    2003-06-23 ericball Kangaroo mode & 320 mode & other stuff
1111
12   2002-05-14 kubecj vblank dma stop fix
12    2002-05-14 kubecj vblank dma stop fix
1313
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
1818
19   2002-05-12 kubecj added cases for 0x01-160A, 0x05-160B as stated by docs
19    2002-05-12 kubecj added cases for 0x01-160A, 0x05-160B as stated by docs
2020
2121***************************************************************************/
2222
r5932r5933
341341   int frame_scanline;
342342   UINT8 *ROM = memory_region(device->machine, "maincpu");
343343   const address_space* space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
344   
344
345345   maria_scanline++;
346346
347347   /* why + 1? */
r5932r5933
372372         maria_offset = READ_MEM(maria_dll) & 0x0f;
373373         maria_holey = (READ_MEM(maria_dll) & 0x60) >> 5;
374374         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]); */
377377      }
378378
379379      /*logerror( "vblank end on line %d\n", frame_scanline );*/
380380   }
381381
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 */
386386   if( frame_scanline == ( a7800_lines - 4 ) )
387387   {
388388      /* vblank starts 4 scanlines before end of screen */
r5932r5933
390390      maria_vblank = 0x80;
391391
392392      /* 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
397397
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        */
406406
407407      maria_dodma = 0;
408408      /*logerror( "vblank on line %d\n\n", frame_scanline );*/
r5932r5933
578578         maria_rm = data & 0x03;
579579
580580         /*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 );*/
587587
588588         break;
589589      case 0x1D:
src/mess/video/dm9368.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
1818
1919**********************************************************************/
2020
r5932r5933
4343struct _dm9368_config
4444{
4545   const char *rbo_tag;      /* device to connect RBO pin to */
46   
46
4747   int digit;               /* output digit */
4848};
4949
src/mess/video/coco3.c
r5932r5933
11/***************************************************************************
22
3   CoCo 3 Video Hardware
3    CoCo 3 Video Hardware
44
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
1010
1111
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.
2424
2525***************************************************************************/
2626
r5932r5933
4141
4242/*************************************
4343 *
44 *   Global variables
44 *  Global variables
4545 *
4646 *************************************/
4747
r5932r5933
8282   UINT8 video_type;
8383
8484   /* video state; every scanline the video state for the scanline is copied
85    * here and only rendered in VIDEO_UPDATE */
85    * here and only rendered in VIDEO_UPDATE */
8686   coco3_scanline_record scanlines[384];
8787};
8888
r5932r5933
9292
9393/*************************************
9494 *
95 *   Parameters
95 *  Parameters
9696 *
9797 *************************************/
9898
r5932r5933
103103
104104/*************************************
105105 *
106 *   Video rendering
106 *  Video rendering
107107 *
108108 *************************************/
109109
r5932r5933
134134      if (is_black_white)
135135      {
136136         /* 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             */
140140         UINT32 red   = ((c & 0xFF0000) >> 16);
141141         UINT32 green = ((c & 0x00FF00) >>  8);
142142         UINT32 blue  = ((c & 0x0000FF) >>  0);
r5932r5933
181181      if (attr & 0x40)
182182      {
183183         /* 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            */
193193         switch(scanline_record->ff98 & 0x07)
194194         {
195195            case 0x03:   /* 8 scanlines per row */
r5932r5933
457457
458458/*************************************
459459 *
460 *   Miscellaneous
460 *  Miscellaneous
461461 *
462462 *************************************/
463463
r5932r5933
573573      video_data_size = sizeof(scanline_record->data);
574574
575575      /* FF9F offsets wrap around every 256 bytes, even if bit 7 is not set.
576      * Therefore, we must split things up into two separate segments */
576        * Therefore, we must split things up into two separate segments */
577577      segment_length = MIN(video_data_size, 256 - video_offset);
578578      memcpy_dirty(&dirty, scanline_record->data, video_data + video_offset, segment_length);
579579      memcpy_dirty(&dirty, scanline_record->data + segment_length, video_data, video_data_size - segment_length);
r5932r5933
644644UINT32 coco3_get_video_base(UINT8 ff9d_mask, UINT8 ff9e_mask)
645645{
646646   /* 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     */
652652   return   ((offs_t) (coco3_gimereg[14] & ff9e_mask)   * 0x00008)
653653      |   ((offs_t) (coco3_gimereg[13] & ff9d_mask)   * 0x00800)
654654      |   ((offs_t) (coco3_gimereg[11] & 0x03)      * 0x80000);
r5932r5933
665665
666666/*************************************
667667 *
668 *   Initialization
668 *  Initialization
669669 *
670670 *************************************/
671671
672672static UINT32 get_composite_color(int color)
673673{
674674   /* 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     */
723723
724724   double saturation, brightness, contrast;
725725   int offset;
src/mess/video/pc_aga.c
r5932r5933
417417   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
418418   int i;
419419
420//   if ( y == 0 ) logerror("cga_gfx_2bpp_update_row\n");
420//  if ( y == 0 ) logerror("cga_gfx_2bpp_update_row\n");
421421   for ( i = 0; i < x_count; i++ ) {
422422      UINT16 offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 );
423423      UINT8 data = videoram[ offset ];
r5932r5933
470470
471471/*************************************
472472 *
473 *   AGA MDA/CGA read/write handlers
473 *  AGA MDA/CGA read/write handlers
474474 *
475475 *************************************/
476476
r5932r5933
817817   switch(offset) {
818818   case 4:
819819      pc200.portd |= 0x20;
820//      pc_cga8_w(space, offset,data);
820//      pc_cga8_w(space, offset,data);
821821      break;
822822   case 8:
823823      pc200.port8 = data;
824824      pc200.portd |= 0x80;
825//      pc_cga8_w(space, offset,data);
825//      pc_cga8_w(space, offset,data);
826826      break;
827827   case 0xe:
828828      pc200.portd = 0x1f;
r5932r5933
847847      break;
848848
849849   default:
850//      pc_cga8_w(space, offset,data);
850//      pc_cga8_w(space, offset,data);
851851      break;
852852   }
853853}
r5932r5933
874874      break;
875875
876876   default:
877//      result = pc_cga8_r(space, offset);
877//      result = pc_cga8_r(space, offset);
878878      break;
879879   }
880880   return result;
src/mess/video/microtan.c
r5932r5933
11/***************************************************************************
2 *   Microtan 65
2 *  Microtan 65
33 *
4 *   video hardware
4 *  video hardware
55 *
6 *   Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000
6 *  Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000
77 *
8 *   Thanks go to Geoff Macdonald <mail@geoff.org.uk>
8 *  Thanks go to Geoff Macdonald <mail@geoff.org.uk>
99 *  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
1212 *
1313 ***************************************************************************/
1414
src/mess/video/pc_cga.c
r5932r5933
66  Notes on Port 3D8
77  (http://www.clipx.net/ng/interrupts_and_ports/ng2d045.php)
88
9   Port 3D8  -  Color/VGA Mode control register
9    Port 3D8  -  Color/VGA Mode control register
1010
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
1717
1818
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
2727
2828
29   PC1512 display notes
29    PC1512 display notes
3030
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.
3535
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:
3838
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.
4545
46   (source John Elliott http://www.seasip.info/AmstradXT/pc1512disp.html)
46    (source John Elliott http://www.seasip.info/AmstradXT/pc1512disp.html)
4747
4848
4949  Cursor signal handling:
r5932r5933
9797
9898/***************************************************************************
9999
100   Static declarations
100    Static declarations
101101
102102***************************************************************************/
103103
r5932r5933
230230
231231/***************************************************************************
232232
233   Local variables and declarations
233    Local variables and declarations
234234
235235***************************************************************************/
236236
r5932r5933
416416
417417/***************************************************************************
418418
419   Methods
419    Methods
420420
421421***************************************************************************/
422422
r5932r5933
471471   const address_space *spaceio = cpu_get_address_space(machine->firstcpu, ADDRESS_SPACE_IO);
472472
473473   /* 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 */
477477   buswidth = cpu_get_databus_width(machine->firstcpu, ADDRESS_SPACE_PROGRAM);
478478   switch(buswidth)
479479   {
r5932r5933
897897      int b = ( ntsc_decoded[samp_index+2] + ntsc_decoded[samp_index+5] ) / 2;
898898      *p = 0x8000 + ( ( ( r & 0xF8 ) << 7 ) | ( ( g & 0xF8 ) << 2 ) | ( ( b & 0xF8 ) >> 3 ) );
899899      p++;
900      samp_index +=6;
900      samp_index +=6;
901901   }
902902}
903903}
r5932r5933
10401040}
10411041
10421042/*
1043 *   rW   CGA mode control register (see #P138)
1043 *  rW  CGA mode control register (see #P138)
10441044 *
10451045 *  x x x 0 1 0 0 0 - 320x200, 40x25 text. Colour on RGB and composite monitors.
10461046 *  x x x 0 1 0 0 1 - 640x200, 80x25 text. Colour on RGB and composite monitors.
r5932r5933
11621162
11631163
11641164/*
1165 *   ?W   reserved for color select register on color adapter
1165 *  ?W  reserved for color select register on color adapter
11661166 */
11671167static void pc_cga_color_select_w(running_machine *machine, int data)
11681168{
r5932r5933
11921192
11931193/*************************************************************************
11941194 *
1195 *      CGA
1196 *      color graphics adapter
1195 *      CGA
1196 *      color graphics adapter
11971197 *
11981198 *************************************************************************/
11991199
r5932r5933
12651265//
12661266
12671267//INLINE void pgfx_plot_unit_4bpp(bitmap_t *bitmap,
1268//                      int x, int y, int offs)
1268//                          int x, int y, int offs)
12691269//{
1270//   int color, values[2];
1271//   int i;
1270//  int color, values[2];
1271//  int i;
12721272//
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//  }
12921292//}
12931293//
12941294//
r5932r5933
13011301//
13021302//static void cga_pgfx_4bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc)
13031303//{
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;
13091309//
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//  }
13311331//}
13321332//
13331333//
13341334//
13351335//INLINE void pgfx_plot_unit_2bpp(bitmap_t *bitmap,
1336//                int x, int y, const UINT16 *palette, int offs)
1336//                  int x, int y, const UINT16 *palette, int offs)
13371337//{
1338//   int i;
1339//   UINT8 bmap[2], values[2];
1340//   UINT16 *dest;
1338//  int i;
1339//  UINT8 bmap[2], values[2];
1340//  UINT16 *dest;
13411341//
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//  }
13621362//
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];
13721372//}
13731373//
13741374//
r5932r5933
13811381//
13821382//static void cga_pgfx_2bpp(bitmap_t *bitmap, struct mscrtc6845 *crtc)
13831383//{
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;
13911391//
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;
14021402//
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//  }
14101410//
14111411//
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;
14181418//
1419//   for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) {
1419//  for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) {
14201420//
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//  }
14381438//}
14391439
14401440
src/mess/video/smsvdp.c
r5932r5933
11/*
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
55
66A scanline contains the following sections:
77  - horizontal sync     1  ED      => HSYNC high/increment line counter/generate interrupts/etc
r5932r5933
101101   UINT8      *collision_buffer;
102102
103103   /* 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     */
107107   int         *line_buffer;
108108   int         current_palette[32];
109109   void (*int_callback)(running_machine*,int);
r5932r5933
150150         smsvdp.vdp_mode = 0;
151151      }
152152      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
158158      if ( ! M1 && M2 && ! M3 )
159159      {
160160         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;
166166      }
167167      else
168168      {
r5932r5933
218218   smsvdp.int_callback = config->int_callback;
219219
220220   /* 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    */
224224   smsvdp.VRAM = memory_region_alloc( machine, "gfx1", VRAM_SIZE, ROM_REQUIRED );
225225   smsvdp.CRAM = memory_region_alloc( machine, "gfx2", MAX_CRAM_SIZE, ROM_REQUIRED );
226226   smsvdp.line_buffer = auto_alloc_array(machine, int, 256 * 5);
r5932r5933
659659         pixelPlotX = (0 - (xScroll & 0x07) + (tileColumn << 3) + pixelPlotX);
660660         if (pixelPlotX >= 0 && pixelPlotX < 256)
661661         {
662//            logerror("%x %x\n", pixelPlotX + pixelOffsetX, pixelPlotY);
662//              logerror("%x %x\n", pixelPlotX + pixelOffsetX, pixelPlotY);
663663            lineBuffer[pixelPlotX] = smsvdp.current_palette[penSelected];
664664            prioritySelected[pixelPlotX] = prioritySelect | ( penSelected & 0x0F );
665665         }
r5932r5933
12351235      }
12361236
12371237      /* 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        */
12491249      {
12501250         int   ggLine;
12511251         int   myLine = pixelPlotY + line - ( TBORDER_START + NTSC_224_TBORDER_Y_PIXELS );
src/mess/video/sapi1.c
r5932r5933
1919   0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E
2020   0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F
2121   0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G
22   
22
2323   0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H
2424   0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I
2525   0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J
r5932r5933
2828   0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M
2929   0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N
3030   0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O
31   
31
3232   0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P
3333   0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q
3434   0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R
r5932r5933
3737   0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U
3838   0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V
3939   0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W
40   
40
4141   0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X
4242   0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y
4343   0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z
r5932r5933
4646   0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ]
4747   0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^
4848   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, //
5151   0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // !
5252   0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // "
5353   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, //
5555   0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // %
5656   0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // &
5757   0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // '
58   
58
5959   0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // (
6060   0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // )
6161   0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // *
r5932r5933
6464   0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // -
6565   0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // .
6666   0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // /
67   
67
6868   0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0
6969   0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1
7070   0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2
r5932r5933
7373   0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5
7474   0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6
7575   0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7
76   
76
7777   0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8
7878   0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9
7979   0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // :
r5932r5933
9797    int x,y,j,b;
9898  UINT16 addr;
9999  int xpos;
100 
100
101101   for(y = 0; y < 24; y++ )
102102   {
103103      addr = y*64;
r5932r5933
106106      {
107107         UINT8 code = sapi_video_ram[addr + x];
108108         UINT8 attr = (code >> 6) & 3;
109         code &= 0x3f;                 
109         code &= 0x3f;
110110         for(j = 0; j < 9; j++ )
111         {           
111         {
112112            for(b = 0; b < 6; b++ )
113113           {
114114              UINT8 val;
r5932r5933
117117                    val = (refresh_counter & 0x20) ? 1 : 0;
118118                 } else {
119119                    val = 0;
120                 }                 
121              } else {                 
120                 }
121              } else {
122122                 val = (MHB2501[code*8 + j] >> (5-b)) & 1;
123123                 if (attr==1) {
124124                    val = (refresh_counter & 0x20) ? val : 0;
r5932r5933
130130              } else {
131131                 *BITMAP_ADDR16(bitmap, y*9+j, xpos+b ) = val;
132132              }
133           }                     
133           }
134134         }
135135         xpos+= (attr==3) ? 12 : 6;
136136         if (xpos>=6*40) break;
src/mess/video/p2000m.c
r5932r5933
11/**********************************************************************
22
3   p2000m.c
3    p2000m.c
44
5   Functions to emulate video hardware of the p2000m
5    Functions to emulate video hardware of the p2000m
66
77**********************************************************************/
88
r5932r5933
2727   {
2828      sy = (offs / 80) * 10;
2929      sx = (offs % 80) * 6;
30     
30
3131      if ((frame_count > 25) && (videoram[offs + 2048] & 0x40))
3232         code = 32;
3333      else
src/mess/video/msm6255.c
r5932r5933
380380   msm6255_t *msm6255 = get_safe_token(device);
381381
382382   /* 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);
385385
386386   /* get the screen */
387387   msm6255->screen = devtag_get_device(device->machine, msm6255->intf->screen_tag);
src/mess/video/pc_ega.c
r5932r5933
66
77"Regular" register on an EGA graphics card:
88
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
3838
3939
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
5656
5757
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
7777
7878
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
8989
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
118118
119119
120120
r5932r5933
132132write to I/O port 0x3C0 sets the index register. The next write to I/O port
1331330x3C0 actually sets the data to the indexed register.
134134
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
145145
146146
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
157157
158158
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
171171
172172
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
183183
184184
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
195195
196196
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
207207
208208
209209Sequencer Registers SR00 - SR04
r5932r5933
211211The Sequencer Registers are accessed through an index register located at I/O
212212port 0x3C4, and a data register located at I/O port 0x3C5.
213213
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
224224
225225
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
236236
237237
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
248248
249249
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
260260
261261
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
272272
273273
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
296296
297297
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
308308
309309
310310Graphics Controller Registers GR00 - GR08
r5932r5933
312312The Graphics Controller Registers are accessed through an index register
313313located at I/O port 0x3CE, and a data register located at I/O port 0x3CF.
314314
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
325325
326326
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
337337
338338
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
349349
350350
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
365365
366366
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
377377
378378
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
400400
401401
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
416416
417417
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
428428
429429
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
440440
441441
442442***************************************************************************/
r5932r5933
469469   UINT8   misc_output;
470470   UINT8   feature_control;
471471
472   /* Attribute registers AR00 - AR14
473   */
472   /* Attribute registers AR00 - AR14
473    */
474474   struct {
475475      UINT8   index;
476476      UINT8   data[32];
r5932r5933
478478   } attribute;
479479
480480   /* Sequencer registers SR00 - SR04
481   */
481    */
482482   struct {
483483      UINT8   index;
484484      UINT8   data[8];
485485   } sequencer;
486486
487487   /* Graphics controller registers GR00 - GR08
488   */
488    */
489489   struct {
490490      UINT8   index;
491491      UINT8   data[16];
r5932r5933
499499
500500
501501/*
502   Prototypes
502    Prototypes
503503*/
504504static VIDEO_START( pc_ega );
505505static VIDEO_UPDATE( pc_ega );
r5932r5933
738738   UINT16   *p = BITMAP_ADDR16(bitmap, y, 0);
739739   int   i;
740740
741//   logerror( "pc_ega_graphics: y = %d, x_count = %d, ma = %d, ra = %d\n", y, x_count, ma, ra );
741//  logerror( "pc_ega_graphics: y = %d, x_count = %d, ma = %d, ra = %d\n", y, x_count, ma, ra );
742742
743743   for ( i = 0; i < x_count; i++ )
744744   {
r5932r5933
752752   UINT16   *p = BITMAP_ADDR16(bitmap, y, 0);
753753   int   i;
754754
755//   logerror( "pc_ega_text: y = %d, x_count = %d, ma = %d, ra = %d\n", y, x_count, ma, ra );
755//  logerror( "pc_ega_text: y = %d, x_count = %d, ma = %d, ra = %d\n", y, x_count, ma, ra );
756756
757757   for ( i = 0; i < x_count; i++ )
758758   {
r5932r5933
9639631000 - 40x25
9649641001 - no diplsay (text at a0000)
9659651010 - 40x25
9661011 -
9661011 -
9679671100 - 40x25
9689681101 -
9699691110 - 40x25
src/mess/video/pc_aga.h
r5932r5933
88  commodore pc10 320x200 in 16 colors
99
1010
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
1515    ROM_LOAD("aga.chr",     0x00000, 0x02000, CRC(aca81498))
16   // hercules font of above
16    // hercules font of above
1717    ROM_LOAD("hercules.chr", 0x00000, 0x1000, CRC(7e8c9d76))
1818
1919*/
src/mess/video/intv.c
r5932r5933
1717
1818/*
1919    for (i = 0; i < 8; i++) {
20      struct intv_sprite_type* s = &intv_sprite[i];
20        struct intv_sprite_type* s = &intv_sprite[i];
2121        s->visible = 0;
2222        s->xpos = 0;
2323        s->ypos = 0;
r5932r5933
4141        }
4242        intv_collision_registers[i] = 0;
4343    }
44   for(i = 0; i < 4; i++) {
44    for(i = 0; i < 4; i++) {
4545        intv_color_stack[i] = 0;
4646    }
4747    intv_color_stack_mode = 0;
r5932r5933
5454    intv_top_edge_inhibit = 0;
5555
5656    intv_gramdirty = 1;
57   for(i=0;i<64;i++) {
57    for(i=0;i<64;i++) {
5858        intv_gram[i] = 0;
59      intv_gramdirtybytes[i] = 1;
59        intv_gramdirtybytes[i] = 1;
6060    }
6161*/
6262}
r5932r5933
592592/*
593593static void draw_sprites(running_machine *machine, bitmap_t *bitmap, int behind_foreground)
594594{
595   int i;
596   int code;
595    int i;
596    int code;
597597
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    }
685685}
686686*/
687687
r5932r5933
783783{
784784   int x,y,offs;
785785   int current_row;
786//   char c;
786//  char c;
787787
788788   /* Draw the underlying INTV screen first */
789789   VIDEO_UPDATE_CALL(generic_bitmapped);
src/mess/video/special.c
r5932r5933
11/***************************************************************************
22
3      Specialist video driver by Miodrag Milanovic
3        Specialist video driver by Miodrag Milanovic
44
5      15/03/2008 Preliminary driver.
6           
5        15/03/2008 Preliminary driver.
6
77****************************************************************************/
88
99
1010#include "driver.h"
1111#include "includes/special.h"
12 
12
1313UINT8 *specialist_video_ram;
1414//UINT8 erik_page_active;
1515UINT8 *erik_video_ram_page_1;
r5932r5933
1919VIDEO_START( special )
2020{
2121}
22
22
2323VIDEO_UPDATE( special )
2424{
2525  UINT8 code;
2626   int y, x, b;
27   
27
2828   for (x = 0; x < 48; x++)
29   {         
29   {
3030      for (y = 0; y < 256; y++)
3131      {
3232         code = specialist_video_ram[y + x*256];
3333         for (b = 7; b >= 0; b--)
34         {                       
34         {
3535            *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) =  (code >> b) & 0x01;
3636         }
37      }           
37      }
3838   }
3939   return 0;
4040}
4141VIDEO_START( specialp )
4242{
4343}
44
44
4545VIDEO_UPDATE( specialp )
4646{
4747  UINT8 code;
4848   int y, x, b;
49   
49
5050   for (x = 0; x < 64; x++)
51   {         
51   {
5252      for (y = 0; y < 256; y++)
5353      {
5454         code = specialist_video_ram[y + x*256];
5555         for (b = 7; b >= 0; b--)
56         {                       
56         {
5757            *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) =  (code >> b) & 0x01;
5858         }
59      }           
59      }
6060   }
6161   return 0;
6262}
r5932r5933
6565const rgb_t specimx_palette[16] = {
6666   MAKE_RGB(0x00, 0x00, 0x00), // 0
6767   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
8282};
8383
8484PALETTE_INIT( specimx )
r5932r5933
8888
8989
9090VIDEO_START( specimx )
91{   
91{
9292   specimx_colorram = auto_alloc_array(machine, UINT8, 0x3000);
9393   memset(specimx_colorram,0x70,0x3000);
94}
94}
9595
9696VIDEO_UPDATE( specimx )
9797{
9898     UINT8 code,color;
9999   int y, x, b;
100     
100
101101   for (x = 0; x < 48; x++)
102   {         
102   {
103103      for (y = 0; y < 256; y++)
104104      {
105105         code = mess_ram[0x9000 + y + x*256];
106106         color = specimx_colorram[y + x*256];
107107         for (b = 7; b >= 0; b--)
108         {                       
109           
108         {
109
110110            *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) =  ((code >> b) & 0x01)==0 ? color & 0x0f : (color >> 4)& 0x0f ;
111111         }
112      }           
112      }
113113   }
114114   return 0;
115115}
r5932r5933
117117static const rgb_t erik_palette[8] = {
118118   MAKE_RGB(0x00, 0x00, 0x00), // 0
119119   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
126126};
127127
128128PALETTE_INIT( erik )
r5932r5933
135135UINT8 erik_background;
136136
137137VIDEO_START( erik )
138{   
139}
138{
139}
140140
141141VIDEO_UPDATE( erik )
142142{
r5932r5933
146146   int y, x, b;
147147   UINT8 *erik_video_ram_p1;
148148   UINT8 *erik_video_ram_p2;
149   
149
150150   erik_video_ram_p1 =  mess_ram + 0x9000;
151151   erik_video_ram_p2 =  mess_ram + 0xd000;
152     
152
153153   for (x = 0; x < 48; x++)
154   {         
154   {
155155      for (y = 0; y < 256; y++)
156156      {
157157         code1  = erik_video_ram_p1[y + x*256];
158158         code2  = erik_video_ram_p2[y + x*256];
159         
159
160160         for (b = 7; b >= 0; b--)
161         {                       
161         {
162162            color1 = ((code1 >> b) & 0x01)==0 ? erik_background : erik_color_1;
163163            color2 = ((code2 >> b) & 0x01)==0 ? erik_background : erik_color_2;
164164            *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) =  color1 | color2;
165165         }
166      }           
167   }     
166      }
167   }
168168   return 0;
169169}
170170
src/mess/video/pc_cga.h
r5932r5933
22#include "video/pc_video.h"
33
44#define CGA_PALETTE_SETS 83   /* one for colour, one for mono,
5            * 81 for colour composite */
5                * 81 for colour composite */
66
77#define CGA_SCREEN_NAME   "cga_screen"
88#define CGA_MC6845_NAME   "mc6845_cga"
src/mess/video/msm6255.h
r5932r5933
3939struct _msm6255_interface
4040{
4141   const char *screen_tag;      /* screen we are acting on */
42   
42
4343   int character_clock;      /* the character clock of the chip */
4444
4545   /* ROM/RAM data read function */
src/mess/video/mikro80.c
r5932r5933
11/***************************************************************************
22
3      Mikro-80 video driver by Miodrag Milanovic
3        Mikro-80 video driver by Miodrag Milanovic
44
5      10/03/2008 Preliminary driver.
6           
5        10/03/2008 Preliminary driver.
6
77****************************************************************************/
88
99
1010#include "driver.h"
1111#include "includes/mikro80.h"
12 
12
1313UINT8 *mikro80_video_ram;
1414UINT8 *mikro80_cursor_ram;
15   
15
1616VIDEO_START( mikro80 )
1717{
1818}
19
19
2020VIDEO_UPDATE( mikro80 )
2121{
2222   UINT8 *gfx = memory_region(screen->machine, "gfx1");
r5932r5933
3030         UINT8 code = gfx[mikro80_video_ram [addr]*8+ (y % 8)];
3131         UINT8 attr = mikro80_cursor_ram[addr+1] & 0x80 ? 1 : 0;
3232         for (b = 7; b >= 0; b--)
33         {                       
33         {
3434            UINT8 col = (code >> b) & 0x01;
3535            *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) =  attr ? col ^ 1 : col;
3636         }
src/mess/video/ssystem3.c
r5932r5933
66#include "includes/ssystem3.h"
77
88static struct {
9  UINT8 data[5]; 
9  UINT8 data[5];
1010  int clock;
1111  int count;
1212} ssystem3_lcd;
1313
14void ssystem3_lcd_reset(void)
14void ssystem3_lcd_reset(void)
1515{
1616  ssystem3_lcd.count=0; ssystem3_lcd.clock=1;
1717}
r5932r5933
214214       0, // empty
215215       1, // bauer
216216       3, // springer
217       0x11, // läufer
217       0x11, // l??ufer
218218       7, // turm
219219       0x1f, // dame
220       0x17, // könig
220       0x17, // k??nig
221221       0
222222     };
223223     int y, x;
r5932r5933
226226         int figure, black;
227227         int xp=263+x*22;
228228         int yp=55+(y^7)*28;
229         ssystem3_playfield_getfigure(x, y, &figure, &black);       
229         ssystem3_playfield_getfigure(x, y, &figure, &black);
230230         ssystem3_draw_led(bitmap, lcd_signs_on[figure]&1?1:0, xp, yp, '6');
231231         ssystem3_draw_led(bitmap, lcd_signs_on[figure]&2?1:0, xp, yp, '8');
232232         ssystem3_draw_led(bitmap, lcd_signs_on[figure]&4?1:0, xp, yp, '9');
233233         ssystem3_draw_led(bitmap, lcd_signs_on[figure]&8?1:0, xp, yp, 'b');
234234         ssystem3_draw_led(bitmap, lcd_signs_on[figure]&0x10?1:0, xp, yp, 'c');
235235         ssystem3_draw_led(bitmap, figure!=0 && black?1:0, xp, yp, '7');
236         
236
237237       }
238238     }
239239   }
src/mess/video/kyocera.c
r5932r5933
177177   MDRV_HD44102_ADD( "m9", SCREEN_TAG, 150, 32)
178178   MDRV_HD44102_ADD("m10", SCREEN_TAG, 200, 32)
179179
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)
182182MACHINE_DRIVER_END
183183
184184MACHINE_DRIVER_START( tandy200_video )
src/mess/video/mz80.c
r5932r5933
4242{
4343   int x,y;
4444   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;
4646   mz80k_cursor_cnt++;
4747   if (mz80k_cursor_cnt==64) mz80k_cursor_cnt = 0;
48     
48
4949   for(y = 0; y < 25; y++ )
5050   {
5151      for(x = 0; x < 40; x++ )
5252      {
53         int code = memory_read_byte(space,0xD000 + x + y*40);     
53         int code = memory_read_byte(space,0xD000 + x + y*40);
5454         drawgfx_opaque(bitmap, NULL, screen->machine->gfx[0],  code , 0, 0,0, x*8,y*8);
5555      }
5656   }
src/mess/video/poly88.c
r5932r5933
1111
1212UINT8* poly_video_ram;
1313
14static UINT8 mcm6571a[] =
14static UINT8 mcm6571a[] =
1515{
1616   0x00,0x00,0x00,0x00,0x31,0x4A,0x44,0x4A,0x31,// 0
1717   0x3C,0x22,0x3C,0x22,0x22,0x3C,0x20,0x20,0x40,// 1
r5932r5933
154154   1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0
155155};
156156
157static UINT8 get_mcm6571a_line(UINT8 code, UINT8 line)
157static UINT8 get_mcm6571a_line(UINT8 code, UINT8 line)
158158{
159159   if (mcm6571a_shift[code]==0) {
160160      if (line < 9) {
161161         return mcm6571a[code*9 + line];
162162      } else {
163163         return 0;
164      }     
164      }
165165   } else {
166166      if (line < 3) {
167167         return 0;
168      } else
168      } else
169169      if (line <12) {
170170         return mcm6571a[code*9 + line - 3];
171171      } else {
172172         return 0;
173      }     
173      }
174174   }
175175   return 0;
176   
176
177177}
178178VIDEO_START( poly88 )
179179{
r5932r5933
183183{
184184   int x,y,j,b;
185185     UINT16 addr;
186     int xpos;     
186     int xpos;
187187     UINT8 l,r;
188 
188
189189   for(y = 0; y < 16; y++ )
190190   {
191191      addr = y*64;
r5932r5933
195195         UINT8 code = poly_video_ram[addr + x];
196196         if ((code & 0x80)==0) {
197197            for(j = 0; j < 15; j++ )
198            {   
199              l = j/5;         
198            {
199              l = j/5;
200200              for(b = 0; b < 10; b++ )
201201              {
202202               r = b/5;
r5932r5933
218218               if (l==2 && r==1) {
219219                  *BITMAP_ADDR16(bitmap, y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1;
220220               }
221               
222                 
223              }                     
221
222
223              }
224224            }
225225         } else {
226226            for(j = 0; j < 15; j++ )
r5932r5933
229229              for(b = 0; b < 7; b++ )
230230              {
231231                 *BITMAP_ADDR16(bitmap, y*15+j, xpos+b ) =  (l >> (6-b)) & 1;
232              }                     
232              }
233233              *BITMAP_ADDR16(bitmap, y*15+j, xpos+7 ) =  0;
234234              *BITMAP_ADDR16(bitmap, y*15+j, xpos+8 ) =  0;
235235              *BITMAP_ADDR16(bitmap, y*15+j, xpos+9 ) =  0;
236             
236
237237            }
238238         }
239239         xpos += 10;
src/mess/video/ut88.c
r5932r5933
11/***************************************************************************
22
3      UT88 video driver by Miodrag Milanovic
3        UT88 video driver by Miodrag Milanovic
44
5      06/03/2008 Preliminary driver.
6           
5        06/03/2008 Preliminary driver.
6
77****************************************************************************/
88
99
1010#include "driver.h"
1111#include "includes/ut88.h"
12 
12
1313UINT8 *ut88_video_ram;
14   
14
1515const gfx_layout ut88_charlayout =
1616{
1717   8, 8,            /* 8x8 characters */
1818   256,            /* 256 characters */
1919   1,              /* 1 bits per pixel */
20   {0},            /* no bitplanes; 1 bit per pixel */   
20   {0},            /* no bitplanes; 1 bit per pixel */
2121   {0, 1, 2, 3, 4, 5, 6, 7},
2222   {0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8},
2323   8*8               /* size of one char */
r5932r5933
2626VIDEO_START( ut88 )
2727{
2828}
29
29
3030VIDEO_UPDATE( ut88 )
3131{
3232   int x,y;
r5932r5933
3535   {
3636      for(x = 0; x < 64; x++ )
3737      {
38         int code = ut88_video_ram[ x + y*64 ] & 0x7f;     
38         int code = ut88_video_ram[ x + y*64 ] & 0x7f;
3939         int attr = ut88_video_ram[ x+1 + y*64 ] & 0x80;
4040         drawgfx_opaque(bitmap, NULL, screen->machine->gfx[0],  code | attr, 0, 0,0, x*8,y*8);
4141      }
42   }   
42   }
4343   return 0;
4444}
4545
src/mess/video/vic6567.c
r5932r5933
11/***************************************************************************
22
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
55
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
88
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.
1414
1515***************************************************************************/
1616/* mos videochips
r5932r5933
328328   vic2.dma_read_color = dma_read_color;
329329   vic2.interrupt = irq;
330330   vic2.vic2e = chip_vic2e;
331   
331
332332   vic2.on = TRUE;
333333}
334334
r5932r5933
881881   vic2.rasterline = 0; // VIC2_LINES - 1;
882882
883883   // from 1 to 63 (PAL) or from 1 to 65 (NTSC)
884   vic2.rasterX = 63;
884   vic2.rasterX = 63;
885885
886886   // immediately call the timer to handle the first line
887887   if (vic2.pal)
r5932r5933
15541554
15551555   default:
15561556      vic2.rasterX++;
1557     
1557
15581558      break;
15591559   }
15601560
r5932r5933
23522352      ResumeCPU
23532353
23542354      vic2.cycle++;
2355      break;     
2355      break;
23562356
23572357   // Refresh, fetch if bad line
23582358   case 12:
r5932r5933
24872487
24882488   // Graphics
24892489
2490   case 19:   
2490   case 19:
24912491   case 20:
24922492   case 21:
24932493   case 22:
r5932r5933
24972497   case 26:
24982498   case 27:
24992499   case 28:
2500   case 29:   
2500   case 29:
25012501   case 30:
25022502   case 31:
25032503   case 32:
r5932r5933
29102910      ResumeCPU
29112911
29122912      vic2.cycle++;
2913      break;     
2913      break;
29142914
29152915   // Refresh, fetch if bad line
29162916   case 12:
r5932r5933
30453045
30463046   // Graphics
30473047
3048   case 19:   
3048   case 19:
30493049   case 20:
30503050   case 21:
30513051   case 22:
r5932r5933
30553055   case 26:
30563056   case 27:
30573057   case 28:
3058   case 29:   
3058   case 29:
30593059   case 30:
30603060   case 31:
30613061   case 32:
src/mess/video/llc.c
r5932r5933
2121    UINT8 code,disp;
2222   int y, x, b,c,inv;
2323   UINT8 *gfx = memory_region(screen->machine, "gfx1");
24   
24
2525   for (x = 0; x < 64; x++)
2626   {
2727      for (y = 0; y < 16; y++)
2828      {
2929         code = llc_video_ram[x + y*64];
3030         inv = code & 0x80; // highest bit is invert flag
31         code &= 0x7f;         
31         code &= 0x7f;
3232         for (b = 0; b < 8; b++)
33         {           
33         {
3434            for (c = 0; c < 8; c++)
3535            {
3636               disp = gfx[code + b*0x80];
r5932r5933
5252    UINT8 code,disp;
5353   int y, x, b,c;
5454   UINT8 *gfx = memory_region(screen->machine, "gfx1");
55   
55
5656   for (x = 0; x < 64; x++)
5757   {
5858      for (y = 0; y < 32; y++)
5959      {
6060         code = llc_video_ram[x + y*64];
6161         for (b = 0; b < 8; b++)
62         {           
62         {
6363            disp = gfx[code * 8 + b];
6464            for (c = 0; c < 8; c++)
65            {               
65            {
6666               *BITMAP_ADDR16(bitmap, y*8+b, x*8+c) =  ((disp<< c) & 0x80) ? 1 : 0;
6767            }
6868         }
src/mess/video/comx35.c
r5932r5933
130130   else
131131   {
132132      const device_config *mc6845 = devtag_get_device(screen->machine, MC6845_TAG);
133     
133
134134      mc6845_update(mc6845, bitmap, cliprect);
135135   }
136136
src/mess/video/vic6567.h
r5932r5933
1111 *
1212 ****************************************************************************/
1313
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
1515
1616#ifndef VIC6567_H_
1717#define VIC6567_H_
src/mess/video/z1013.c
r5932r5933
2121    UINT8 code, line;
2222   int y, x, b,i;
2323   UINT8 *gfx = memory_region(screen->machine, "gfx1");
24   
24
2525   for(y = 0; y < 32; y++ )
2626   {
2727      for(x = 0; x < 32; x++ )
src/mess/video/abc802.c
r5932r5933
3131{
3232   /*
3333
34      PAL16R4 equation:
34        PAL16R4 equation:
3535
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
4949
5050
51      + = AND
52      / = OR
53      * = Inverted
51        + = AND
52        / = OR
53        * = Inverted
5454
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
6868
69   */
69    */
7070
7171   abc802_state *state = device->machine->driver_data;
7272
7373   int column;
7474   int rf = 0, rc = 0, rg = 0;
75   
75
7676   /* prevent wraparound */
7777   if (y >= 240) return;
78   
78
7979   y += 29;
8080
8181   for (column = 0; column < x_count; column++)
r5932r5933
210210static VIDEO_START( abc802 )
211211{
212212   abc802_state *state = machine->driver_data;
213   
213
214214   /* allocate memory */
215215
216216   state->charram = auto_alloc_array(machine, UINT8, ABC802_CHAR_RAM_SIZE);
r5932r5933
237237static VIDEO_UPDATE( abc802 )
238238{
239239   abc802_state *state = screen->machine->driver_data;
240   
240
241241   /* expand visible area to workaround MC6845 */
242242   video_screen_set_visarea(screen, 0, 767, 0, 311);
243243
244244   /* draw text */
245245   mc6845_update(state->mc6845, bitmap, cliprect);
246   
246
247247   return 0;
248248}
249249
src/mess/video/pp01.c
r5932r5933
3333                *BITMAP_ADDR16(bitmap, y,  x*8+(7-b)) =  col;
3434            }
3535        }
36    }   
36    }
3737   return 0;
3838}
3939
src/mess/video/trs80.c
r5932r5933
99#include "includes/trs80.h"
1010
1111/* 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) */
2020
2121static UINT16 start_address=0;
2222static UINT8 crtc_reg;
r5932r5933
2525WRITE8_HANDLER( trs80m4_88_w )
2626{
2727/* 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. */
3434
3535   if (!offset) crtc_reg = data & 0x1f;
3636
r5932r5933
8484               *p++ = ( chr & gfxbit ) ? 1 : 0;
8585               *p++ = ( chr & gfxbit ) ? 1 : 0;
8686               *p++ = ( chr & gfxbit ) ? 1 : 0;
87               gfxbit <<= 1;
87               gfxbit <<= 1;
8888               *p++ = ( chr & gfxbit ) ? 1 : 0;
8989               *p++ = ( chr & gfxbit ) ? 1 : 0;
9090               *p++ = ( chr & gfxbit ) ? 1 : 0;
r5932r5933
209209   return 0;
210210}
211211
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 */
213213VIDEO_UPDATE( ht1080z )
214214{
215215   UINT8 y,ra,chr,gfx,gfxbit;
r5932r5933
241241               *p++ = ( chr & gfxbit ) ? 1 : 0;
242242               *p++ = ( chr & gfxbit ) ? 1 : 0;
243243               *p++ = ( chr & gfxbit ) ? 1 : 0;
244               gfxbit <<= 1;
244               gfxbit <<= 1;
245245               *p++ = ( chr & gfxbit ) ? 1 : 0;
246246               *p++ = ( chr & gfxbit ) ? 1 : 0;
247247               *p++ = ( chr & gfxbit ) ? 1 : 0;
r5932r5933
276276   UINT16 sy=0,ma=0,x,y,ra;
277277   UINT8 *FNT = memory_region(screen->machine, "gfx1");
278278   UINT8 cols = (trs80_mode & 0x10) ? 80 : 64;
279   
279
280280   /* Although the OS can select 32-character mode, it is not supported by hardware */
281281   if (trs80_mode != trs80_size_store)
282282   {
r5932r5933
310310                     *p++ = ( chr & gfxbit ) ? fg : bg;
311311                     *p++ = ( chr & gfxbit ) ? fg : bg;
312312                     *p++ = ( chr & gfxbit ) ? fg : bg;
313                     gfxbit <<= 1;
313                     gfxbit <<= 1;
314314                     *p++ = ( chr & gfxbit ) ? fg : bg;
315315                     *p++ = ( chr & gfxbit ) ? fg : bg;
316316                     *p++ = ( chr & gfxbit ) ? fg : bg;
r5932r5933
346346
347347               for (x = 0; x < 0x40; x++)
348348               {
349                  gfx = gfxram[ y | x | ra];     
349                  gfx = gfxram[ y | x | ra];
350350                  /* Display 6 pixels in normal region */
351351                  *p++ = ( gfx & 0x01 ) ? fg : bg;
352352                  *p++ = ( gfx & 0x02 ) ? fg : bg;
r5932r5933
358358
359359               for (x = 0; x < 0x10; x++)
360360               {
361                  gfx = gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)];     
361                  gfx = gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)];
362362                  /* Display 6 pixels in extended region */
363363                  *p++ = ( gfx & 0x01 ) ? fg : bg;
364364                  *p++ = ( gfx & 0x02 ) ? fg : bg;
r5932r5933
373373
374374      case 0x20:               // MODE 2
375375         /* it seems the text video ram can have an effect in this mode,
376            not explained clearly, so not emulated */
376                not explained clearly, so not emulated */
377377         for (y = 0; y < 0x400; y+=0x40)
378378         {
379379            for (ra = 0; ra < 0x3000; ra+=0x400)
r5932r5933
382382
383383               for (x = 0; x < 0x40; x++)
384384               {
385                  gfx = gfxram[ y | x | ra];     
385                  gfx = gfxram[ y | x | ra];
386386                  /* Display 6 pixels in normal region */
387387                  fg = (gfx & 0x38) >> 3;
388388                  *p++ = fg;
r5932r5933
399399
400400      case 0x30:               // MODE 3
401401         /* 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. */
404404         for (y = 0; y < 0x400; y+=0x40)
405405         {
406406            for (ra = 0; ra < 0x3000; ra+=0x400)
r5932r5933
410410               for (x = 0; x < 0x40; x++)
411411               {
412412                  gfx = gfxram[ y | x | ra];
413                  fg = (videoram[ 0x3c00 | x | y ] & 0x38) >> 3;     
413                  fg = (videoram[ 0x3c00 | x | y ] & 0x38) >> 3;
414414                  /* Display 6 pixels in normal region */
415415                  *p++ = ( gfx & 0x01 ) ? fg : bg;
416416                  *p++ = ( gfx & 0x02 ) ? fg : bg;
417417                  *p++ = ( gfx & 0x04 ) ? fg : bg;
418                  fg = videoram[ 0x3c00 | x | y ] & 0x07;     
418                  fg = videoram[ 0x3c00 | x | y ] & 0x07;
419419                  *p++ = ( gfx & 0x08 ) ? fg : bg;
420420                  *p++ = ( gfx & 0x10 ) ? fg : bg;
421421                  *p++ = ( gfx & 0x20 ) ? fg : bg;
r5932r5933
423423
424424               for (x = 0; x < 0x10; x++)
425425               {
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;
428428                  /* Display 6 pixels in extended region */
429429                  *p++ = ( gfx & 0x01 ) ? fg : bg;
430430                  *p++ = ( gfx & 0x02 ) ? fg : bg;
431431                  *p++ = ( gfx & 0x04 ) ? fg : bg;
432                  fg = gfxram[ 0x3c00 | x | y ] & 0x07;     
432                  fg = gfxram[ 0x3c00 | x | y ] & 0x07;
433433                  *p++ = ( gfx & 0x08 ) ? fg : bg;
434434                  *p++ = ( gfx & 0x10 ) ? fg : bg;
435435                  *p++ = ( gfx & 0x20 ) ? fg : bg;
src/mess/video/odyssey2.c
r5932r5933
174174{
175175   int i;
176176
177   for ( i = 0; i < 24; i++ )
177   for ( i = 0; i < 24; i++ )
178178   {
179179      palette_set_color_rgb( machine, i, odyssey2_colors[i*3], odyssey2_colors[i*3+1], odyssey2_colors[i*3+2] );
180180   }
r5932r5933
191191         iff = 0;
192192         cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
193193         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 )
195195         {
196196            data |= 1;
197197         }
r5932r5933
216216
217217        case 0xa5:
218218
219            if ((o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY))
219            if ((o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY))
220220         {
221221                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 )
223223            {
224224               x_beam_pos = x_beam_pos - I824X_START_ACTIVE_SCAN + I824X_LINE_CLOCKS;
225            }
226            else
225            }
226            else
227227            {
228228               x_beam_pos = x_beam_pos - I824X_START_ACTIVE_SCAN;
229229            }
r5932r5933
253253        {
254254            /* Toggling strobe bit, tuck away values */
255255            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 )
257257         {
258258            x_beam_pos = x_beam_pos - I824X_START_ACTIVE_SCAN + 228;
259         }
260         else
259         }
260         else
261261         {
262262            x_beam_pos = x_beam_pos - I824X_START_ACTIVE_SCAN;
263263         }
r5932r5933
277277    o2_vdc.reg[offset] = data;
278278}
279279
280WRITE8_HANDLER ( odyssey2_lum_w )
280WRITE8_HANDLER ( odyssey2_lum_w )
281281{
282282   lum = data;
283283}
284284
285285READ8_HANDLER( odyssey2_t1_r )
286286{
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 )
288288   {
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 )
290290      {
291291         return 1;
292292      }
r5932r5933
294294   return 0;
295295}
296296
297static TIMER_CALLBACK( i824x_scanline_callback )
297static TIMER_CALLBACK( i824x_scanline_callback )
298298{
299299   UINT8   collision_map[160];
300300   int      vpos = video_screen_get_vpos( machine->primary_screen );
r5932r5933
302302   if ( vpos < start_vpos )
303303      return;
304304
305   if ( vpos == start_vpos )
305   if ( vpos == start_vpos )
306306   {
307307      control_status &= ~0x08;
308308   }
309309
310   if ( vpos < start_vblank )
310   if ( vpos < start_vblank )
311311   {
312312      rectangle rect;
313313      int   sprite_width[4] = { 8, 8, 8, 8 };
r5932r5933
325325      memset( collision_map, 0, sizeof( collision_map ) );
326326
327327      /* Display grid if enabled */
328      if ( o2_vdc.s.control & 0x08 )
328      if ( o2_vdc.s.control & 0x08 )
329329      {
330330         UINT16   color = ( o2_vdc.s.color & 7 ) | ( ( o2_vdc.s.color >> 3 ) & 0x08 ) | ( ( lum << 3 ) ^ 0x08 );
331331         int      x_grid_offset = 8;
r5932r5933
336336         int      j, k, y;
337337
338338         /* 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 )
340340         {
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 )
342342            {
343               for ( i = 0; i < 9; i++ )
343               for ( i = 0; i < 9; i++ )
344344               {
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 ) ) )
346346                  {
347                     for ( k = 0; k < width + 2; k++ )
347                     for ( k = 0; k < width + 2; k++ )
348348                     {
349349                        int px = x_grid_offset + i * width + k;
350350                        collision_map[ px ] |= COLLISION_HORIZ_GRID_DOTS;
r5932r5933
356356         }
357357
358358         /* 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 )
360360         {
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 )
362362            {
363               for ( i = 0; i < 10; i++ )
363               for ( i = 0; i < 10; i++ )
364364               {
365                  if ( o2_vdc.s.vgrid[i] & j )
365                  if ( o2_vdc.s.vgrid[i] & j )
366366                  {
367                     for ( k = 0; k < w; k++ )
367                     for ( k = 0; k < w; k++ )
368368                     {
369369                        int px = x_grid_offset + i * width + k;
370370
371371                        /* 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 )
373373                        {
374374                           collision_status |= COLLISION_VERTICAL_GRID;
375375                        }
376376                        /* 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 ] )
378378                        {
379379                           collision_status |= collision_map[ px ];
380380                        }
r5932r5933
388388      }
389389
390390      /* Display objects if enabled */
391      if ( o2_vdc.s.control & 0x20 )
391      if ( o2_vdc.s.control & 0x20 )
392392      {
393393         /* 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++ )
395395         {
396396            int   y = o2_vdc.s.foreground[i].y;
397397            int   height = 8 - ( ( ( y >> 1 ) + o2_vdc.s.foreground[i].ptr ) & 7 );
398398
399            if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 )
399            if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 )
400400            {
401401               UINT16   color = 16 + ( ( o2_vdc.s.foreground[i].color & 0x0E ) >> 1 );
402402               int      offset = ( o2_vdc.s.foreground[i].ptr | ( ( o2_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( vpos - start_vpos - y ) >> 1 );
r5932r5933
404404               int      x = o2_vdc.s.foreground[i].x;
405405               UINT8   m;
406406
407               for ( m = 0x80; m > 0; m >>= 1, x++ )
407               for ( m = 0x80; m > 0; m >>= 1, x++ )
408408               {
409                  if ( chr & m )
409                  if ( chr & m )
410410                  {
411                     if ( x >= 0 && x < 160 )
411                     if ( x >= 0 && x < 160 )
412412                     {
413413                        /* 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 )
415415                        {
416416                           collision_status |= COLLISION_CHARACTERS;
417417                        }
418418                        /* 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 ] )
420420                        {
421421                           collision_status |= collision_map[ x ];
422422                        }
r5932r5933
429429         }
430430
431431         /* 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++ )
433433         {
434434            int y = o2_vdc.s.quad[i].single[0].y;
435435            int height = 8;
436436
437            if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 )
437            if ( y <= ( vpos - start_vpos ) && ( vpos - start_vpos ) < y + height * 2 )
438438            {
439439               int   x = o2_vdc.s.quad[i].single[0].x;
440440               int j;
441441
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 )
443443               {
444444                  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 )
446446                  {
447447                     UINT16 color = 16 + ( ( o2_vdc.s.quad[i].single[j].color & 0x0E ) >> 1 );
448448                     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 );
449449                     UINT8   chr = ((char*)o2_shape)[ offset & 0x1FF ];
450450                     UINT8   m;
451                     for ( m = 0x80; m > 0; m >>= 1, x++ )
451                     for ( m = 0x80; m > 0; m >>= 1, x++ )
452452                     {
453                        if ( chr & m )
453                        if ( chr & m )
454454                        {
455                           if ( x >= 0 && x < 160 )
455                           if ( x >= 0 && x < 160 )
456456                           {
457457                              /* 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 )
459459                              {
460460                                 collision_status |= COLLISION_CHARACTERS;
461461                              }
462462                              /* 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 ] )
464464                              {
465465                                 collision_status |= collision_map[ x ];
466466                              }
r5932r5933
469469                           }
470470                        }
471471                     }
472                  }
473                  else
472                  }
473                  else
474474                  {
475475                     x += 8;
476476                  }
r5932r5933
479479         }
480480
481481         /* 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++ )
483483         {
484484            int y = o2_vdc.s.sprites[i].y;
485485            int height = 8;
486            if ( o2_vdc.s.sprites[i].color & 4 )
486            if ( o2_vdc.s.sprites[i].color & 4 )
487487            {
488488               /* Zoomed sprite */
489489               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 )
491491               {
492492                  UINT16 color = 16 + ( ( o2_vdc.s.sprites[i].color >> 3 ) & 0x07 );
493493                  UINT8   chr = o2_vdc.s.shape[i][ ( ( vpos - start_vpos - y ) >> 2 ) ];
r5932r5933
496496
497497                  for ( m = 0x01; m > 0; m <<= 1, x += 2 )
498498                  {
499                     if ( chr & m )
499                     if ( chr & m )
500500                     {
501                        if ( x >= 0 && x < 160 )
501                        if ( x >= 0 && x < 160 )
502502                        {
503503                           /* 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 )
505505                           {
506506                              collision_status |= ( 1 << i );
507507                           }
508508                           /* 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 ] )
510510                           {
511511                              collision_status |= collision_map[ x ];
512512                           }
513513                           collision_map[ x ] |= ( 1 << i );
514514                           *BITMAP_ADDR16( tmp_bitmap, vpos, I824X_START_ACTIVE_SCAN + x ) = color;
515515                        }
516                        if ( x >= -1 && x < 159 )
516                        if ( x >= -1 && x < 159 )
517517                        {
518518                           /* 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 )
520520                           {
521521                              collision_status |= ( 1 << i );
522522                           }
523523                           /* 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 ] )
525525                           {
526526                              collision_status |= collision_map[ x ];
527527                           }
r5932r5933
531531                     }
532532                  }
533533               }
534            }
535            else
534            }
535            else
536536            {
537537               /* 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 )
539539               {
540540                  UINT16 color = 16 + ( ( o2_vdc.s.sprites[i].color >> 3 ) & 0x07 );
541541                  UINT8   chr = o2_vdc.s.shape[i][ ( ( vpos - start_vpos - y ) >> 1 ) ];
542542                  int      x = o2_vdc.s.sprites[i].x;
543543                  UINT8   m;
544544
545                  for ( m = 0x01; m > 0; m <<= 1, x++ )
545                  for ( m = 0x01; m > 0; m <<= 1, x++ )
546546                  {
547547                     if ( chr & m )
548548                      {
549                        if ( x >= 0 && x < 160 )
549                        if ( x >= 0 && x < 160 )
550550                        {
551551                           /* 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 )
553553                           {
554554                              collision_status |= ( 1 << i );
555555                           }
556556                           /* 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 ] )
558558                           {
559559                              collision_status |= collision_map[ x ];
560560                           }
r5932r5933
570570   }
571571
572572   /* Check for start of VBlank */
573   if ( vpos == start_vblank )
573   if ( vpos == start_vblank )
574574   {
575575      control_status |= 0x08;
576      if ( ! iff )
576      if ( ! iff )
577577      {
578578         cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
579579         iff = 1;
r5932r5933
581581   }
582582}
583583
584static TIMER_CALLBACK( i824x_hblank_callback )
584static TIMER_CALLBACK( i824x_hblank_callback )
585585{
586586   int vpos = video_screen_get_vpos( machine->primary_screen );
587587
588588   if ( vpos < start_vpos - 1 )
589589      return;
590590
591   if ( vpos < start_vblank - 1 )
591   if ( vpos < start_vblank - 1 )
592592   {
593593      control_status |= 0x01;
594594   }
r5932r5933
684684            }
685685            /* Noise poly is : L=16 W=2 10000000000100001 */
686686            lfsr = ( lfsr >> 1 ) | ( ( ( lfsr & 0x01 ) ^ ( ( lfsr & 0x800 ) >> 11 ) ) << 15 );
687            if ( ! lfsr )
687            if ( ! lfsr )
688688            {
689689               lfsr = 0xFFFF;
690690            }
691691            /* Check if noise should be applied */
692            if ( o2_vdc.s.sound & 0x10 )
692            if ( o2_vdc.s.sound & 0x10 )
693693            {
694694               *buffer |= ( lfsr & 0x01 );
695695            }
r5932r5933
719719}
720720
721721/*
722   Thomson EF9340/EF9341 extra chips in the g7400
722    Thomson EF9340/EF9341 extra chips in the g7400
723723 */
724724
725725static struct {
r5932r5933
734734   UINT8   ram[1024];
735735} ef9341;
736736
737INLINE UINT16 ef9341_get_c_addr( void )
737INLINE UINT16 ef9341_get_c_addr( void )
738738{
739   if ( ( ef9341.Y & 0x0C ) == 0x0C )
739   if ( ( ef9341.Y & 0x0C ) == 0x0C )
740740   {
741741      return 0x318 | ( ( ef9341.X & 0x38 ) << 2 ) | ( ef9341.X & 0x07 );
742742   }
743   if ( ef9341.X & 0x20 )
743   if ( ef9341.X & 0x20 )
744744   {
745745      return 0x300 | ( ( ef9341.Y & 0x07 ) << 5 ) | ( ef9341.Y & 0x18 ) | ( ef9341.X & 0x07 );
746746   }
747747   return ( ef9341.Y << 5 ) | ef9341.X;
748748}
749749
750INLINE void ef9341_inc_c( void )
750INLINE void ef9341_inc_c( void )
751751{
752752   ef9341.X++;
753   if ( ef9341.X >= 40 )
753   if ( ef9341.X >= 40 )
754754   {
755755      ef9341.Y = ( ef9341.Y + 1 ) % 24;
756756   }
757757}
758758
759void ef9341_w( int command, int b, UINT8 data )
759void ef9341_w( int command, int b, UINT8 data )
760760{
761761   logerror("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data );
762762
763   if ( command )
763   if ( command )
764764   {
765      if ( b )
765      if ( b )
766766      {
767767         ef9341.TB = data;
768768         ef9341.busy = 0x80;
769         switch( ef9341.TB & 0xE0 )
769         switch( ef9341.TB & 0xE0 )
770770         {
771771         case 0x00:   /* Begin row */
772772            ef9341.X = 0;
r5932r5933
792792            break;
793793         }
794794         ef9341.busy = 0;
795      }
796      else
795      }
796      else
797797      {
798798         ef9341.TA = data;
799799      }
800   }
801   else
800   }
801   else
802802   {
803      if ( b )
803      if ( b )
804804      {
805805         ef9341.TB = data;
806806         ef9341.busy = 0x80;
807         switch ( ef9341.M & 0xE0 )
807         switch ( ef9341.M & 0xE0 )
808808         {
809809         case 0x00:   /* Write */
810810            ef9341.ram[ ef9341_get_c_addr() ] = ef9341.TB;
r5932r5933
822822            break;
823823         }
824824         ef9341.busy = 0;
825      }
826      else
825      }
826      else
827827      {
828828         ef9341.TA = data;
829829      }
830830   }
831831}
832832
833UINT8 ef9341_r( int command, int b )
833UINT8 ef9341_r( int command, int b )
834834{
835835   UINT8   data = 0xFF;
836836
837837   logerror("ef9341 %s read, t%s\n", command ? "command" : "data", b ? "B" : "A" );
838   if ( command )
838   if ( command )
839839   {
840      if ( b )
840      if ( b )
841841      {
842842         data = 0xFF;
843      }
844      else
843      }
844      else
845845      {
846846         data = ef9341.busy;
847847      }
848   }
849   else
848   }
849   else
850850   {
851      if ( b )
851      if ( b )
852852      {
853853         data = ef9341.TB;
854854         ef9341.busy = 0x80;
855      }
856      else
855      }
856      else
857857      {
858858         data = ef9341.TA;
859859      }
src/mess/video/m6845.c
r5932r5933
11/************************************************************************
2   crct6845
2    crct6845
33
4   MESS Driver By:
4    MESS Driver By:
55
6    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
6    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
88
99 ************************************************************************/
1010
r5932r5933
4747/* *** Part not implemented ***
4848R8 interlace settings
4949Interlace mode (bits 0,1)
50Bit 1   Bit 0   Description
510      0      Normal (non-interlaced) sync mode
521      0      Normal (non-interlaced) sync mode
530      1      Interlace sync mode
541      1      Interlace sync and video
50Bit 1   Bit 0   Description
510       0       Normal (non-interlaced) sync mode
521       0       Normal (non-interlaced) sync mode
530       1       Interlace sync mode
541       1       Interlace sync and video
5555*/
5656#define R8_interlace_display_enabled crtc.registers[8]
5757/* scan lines per character -1 */
5858#define R9_scan_lines_per_character crtc.registers[9]
5959/* *** Part not implemented yet ***
6060R10 The cursor start register
61Bit 6    Bit 5
620      0      Solid cursor
630      1      No cursor (This no cursor setting is working)
641      0      slow flashing cursor
651      1      fast flashing cursor
61Bit 6   Bit 5
620       0       Solid cursor
630       1       No cursor (This no cursor setting is working)
641       0       slow flashing cursor
651       1       fast flashing cursor
6666*/
6767#define R10_cursor_start crtc.registers[10]
6868/* cursor end row */
r5932r5933
135135   int Display_Disable_Delay;
136136
137137   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;
140140} m6845_state;
141141
142142
r5932r5933
461461         crtc.Memory_Address=(crtc.Memory_Address_of_this_Character_Row=crtc.Memory_Address_of_next_Character_Row);
462462
463463         /* Character row clock pulse (R9 CO out) */
464/*         crtc.Character_Row_Counter=(crtc.Character_Row_Counter+1)%128;*/
464/*          crtc.Character_Row_Counter=(crtc.Character_Row_Counter+1)%128;*/
465465         crtc.Character_Row_Counter=(crtc.Character_Row_Counter+1)&0x07f;
466466         if (crtc.Character_Row_Counter_Reset)
467467         {
468468            crtc.Character_Row_Counter_Reset=False;
469469
470470            /* if vertical adjust is set, the first time it will do the vertical, adjust, the
471            next time, it will not do it and complete the frame */
471                next time, it will not do it and complete the frame */
472472
473473            /* vertical adjust set? */
474474            if (R5_vertical_total_adjust!=0)
r5932r5933
535535            /* not active, clear counter and restart frame */
536536            crtc.Vertical_Total_Adjust_Active = False;
537537            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;
542542
543543            // KT this caused problems when R7 == 0 and R5 was set!
544544            m6845_restart_frame();
r5932r5933
823823   int crtc_cycles_to_vsync_start;
824824
825825   /* get cycles to vsync start, or if vsync cannot be reached
826   cycles will be -1 */
826    cycles will be -1 */
827827   crtc_cycles_to_vsync_start = cycles;
828828
829829   m6845_remove_vsync_set_timer();
r5932r5933
884884
885885   /* if we got to here the vsync has just been set, and has just started */
886886   /* the next timer will be in vsync length cycles unless it is reprogrammed as the VSYNC
887   is active, in this case, the new vsync end will be re-calculated */
887    is active, in this case, the new vsync end will be re-calculated */
888888
889889   /* setup time for vsync clear timer */
890890    m6845_set_new_vsync_clear_time(m6845_vsync_length_in_cycles());
r5932r5933
897897   int cycles_to_vsync_end = m6845_cycles_to_vsync_end();
898898
899899   /* if we're in vsync, the end is important, otherwise we are waiting for the next vsync
900   to start. The start is not affected by the length of the vsync */
900    to start. The start is not affected by the length of the vsync */
901901   if (crtc.VSYNC)
902902   {
903903      m6845_set_new_vsync_clear_time(cycles_to_vsync_end);
r5932r5933
909909   int cycles_to_vsync_start = m6845_cycles_to_vsync();
910910
911911   /* if we're not in vsync, the end is important, otherwise we are waiting for the end
912   of the vsync */
912    of the vsync */
913913   if (!crtc.VSYNC)
914914   {
915915      m6845_set_new_vsync_set_time(cycles_to_vsync_start);
src/mess/video/abc806.c
r5932r5933
88
99    TODO:
1010
11   - HRU II PROM reading
11    - HRU II PROM reading
1212
1313*/
1414
r5932r5933
3838{
3939   /*
4040
41      bit      signal   description
41        bit     signal  description
4242
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
5151
52   */
52    */
5353
5454   abc806_state *state = space->machine->driver_data;
55   
55
5656   state->hrs = data;
5757}
5858
r5932r5933
110110
111111   /*
112112
113      bit      description
113        bit     description
114114
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
123123
124   */
124    */
125125
126126   UINT16 hru2_addr = (state->hru2_a8 << 8) | (offset >> 8);
127127   UINT8 data = state->hru2_prom[hru2_addr] & 0x0f;
r5932r5933
137137{
138138   /*
139139
140      bit      description
140        bit     description
141141
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
150150
151   */
151    */
152152
153153   return 0x7f;
154154}
r5932r5933
225225   if (y >= 240) return;
226226
227227   y += state->sync + 27;
228   
228
229229   for (column = 0; column < x_count; column++)
230230   {
231231      UINT8 data = state->charram[(ma + column) & 0x7ff];
r5932r5933
312312
313313         chargen_data <<= 1;
314314      }
315     
315
316316      if (e5 || e6)
317317      {
318318         column++;
r5932r5933
425425static VIDEO_START(abc806)
426426{
427427   abc806_state *state = machine->driver_data;
428   
428
429429   int i;
430430
431431   /* initialize variables */
r5932r5933
487487
488488   /* clear screen */
489489   bitmap_fill(bitmap, cliprect, 0);
490   
490
491491   if (!state->txoff)
492492   {
493493      /* draw text */
r5932r5933
496496
497497   /* draw HR graphics */
498498   abc806_hr_update(screen->machine, bitmap, cliprect);
499   
499
500500   return 0;
501501}
502502
src/mess/video/apple2.c
r5932r5933
3939#define PROFILER_VIDEOTOUCH      PROFILER_USER3
4040
4141/***************************************************************************
42   HELPERS
42    HELPERS
4343***************************************************************************/
4444
4545/*-------------------------------------------------
4646    effective_a2 - calculates the effective a2
47   register
47    register
4848-------------------------------------------------*/
4949
5050INLINE UINT32 effective_a2(void)
r5932r5933
5555
5656/*-------------------------------------------------
5757    compute_video_address - performs funky Apple II
58   video address lookup
58    video address lookup
5959-------------------------------------------------*/
6060
6161static UINT32 compute_video_address(int col, int row)
r5932r5933
8787
8888
8989/***************************************************************************
90   TEXT
90    TEXT
9191***************************************************************************/
9292
9393/*-------------------------------------------------
9494    apple2_plot_text_character - plots a single
95   textual character
95    textual character
9696-------------------------------------------------*/
9797
9898INLINE void apple2_plot_text_character(bitmap_t *bitmap, int xpos, int ypos, int xscale, UINT32 code,
r5932r5933
139139
140140/*-------------------------------------------------
141141    apple2_text_draw - renders text (either 40
142   column or 80 column)
142    column or 80 column)
143143-------------------------------------------------*/
144144
145145static void apple2_text_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
r5932r5933
260260
261261
262262/***************************************************************************
263   HIGH RESOLUTION GRAPHICS
263    HIGH RESOLUTION GRAPHICS
264264***************************************************************************/
265265
266266static void apple2_hires_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int page, int beginrow, int endrow)
r5932r5933
351351
352352
353353/***************************************************************************
354   VIDEO CORE
354    VIDEO CORE
355355***************************************************************************/
356356
357357void apple2_video_start(running_machine *machine, const UINT8 *vram, size_t vram_size, UINT32 ignored_softswitches, int hires_modulo)
r5932r5933
416416      int len = memory_region_length(machine, "gfx1");
417417      for (i = 0; i < len; i++)
418418      {
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);
420420      }
421421   }
422   
422
423423   /* do we need to flip the gfx? */
424424   if (!strcmp(machine->gamedrv->name, "apple2")
425425      || !strcmp(machine->gamedrv->name, "apple2p")
r5932r5933
427427      || !strcmp(machine->gamedrv->name, "prav8m")
428428      || !strcmp(machine->gamedrv->name, "ace100")
429429      || !strcmp(machine->gamedrv->name, "apple2jp"))
430   {     
430   {
431431      int len = memory_region_length(machine, "gfx1");
432432      for (i = 0; i < len; i++)
433433      {
src/mess/video/tms3556.c
r5932r5933
11/*
2   tms3556 emulation
2    tms3556 emulation
33
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.
1010
11   Raphael Nabet, 2004
11    Raphael Nabet, 2004
1212*/
1313
1414#include "driver.h"
r5932r5933
3838   /* c/g flag (mixed mode only) */
3939   int cg_flag;
4040   /* character line counter (decrements from 10, 0 when we have reached last
41   line of character row) */
41    line of character row) */
4242   int char_line_counter;
4343   /* double height phase flags (one per horizontal character position) */
4444   int dbl_h_phase[40];
r5932r5933
6868#pragma mark BUS INTERFACE
6969#endif
7070/*
71   bus interface
71    bus interface
7272*/
7373
7474/*
75   tms3556_vram_r
75    tms3556_vram_r
7676
77   read a byte from tms3556 VRAM port
77    read a byte from tms3556 VRAM port
7878*/
7979READ8_HANDLER(tms3556_vram_r)
8080{
r5932r5933
9393}
9494
9595/*
96   tms3556_vram_w
96    tms3556_vram_w
9797
98   write a byte to tms3556 VRAM port
98    write a byte to tms3556 VRAM port
9999*/
100100WRITE8_HANDLER(tms3556_vram_w)
101101{
r5932r5933
110110}
111111
112112/*
113   tms3556_reg_r
113    tms3556_reg_r
114114
115   read a byte from tms3556 register port
115    read a byte from tms3556 register port
116116*/
117117READ8_HANDLER(tms3556_reg_r)
118118{
r5932r5933
124124      vdp.reg_access_phase = 0;
125125   }
126126   /*else
127   {   // ???
128   }*/
127    {   // ???
128    }*/
129129
130130   return reply;
131131}
132132
133133/*
134   tms3556_reg_w
134    tms3556_reg_w
135135
136   write a byte to tms3556 register port
136    write a byte to tms3556 register port
137137*/
138138WRITE8_HANDLER(tms3556_reg_w)
139139{
r5932r5933
155155      }
156156      else if (vdp.reg_ptr == 9)
157157      {   /* I don't understand what is going on, but it is the only way to
158         get this to work */
158            get this to work */
159159         vdp.addressRegs[vdp.reg_ptr-8] = ((vdp.controlRegs[2] << 8) | vdp.controlRegs[1]) + 1;
160160         vdp.reg_access_phase = 0;
161161         vdp.magical_mystery_flag = 0;
r5932r5933
187187#pragma mark INITIALIZATION CODE
188188#endif
189189/*
190   initialization code
190    initialization code
191191*/
192192
193193/*
194   mdrv_tms3556
194    mdrv_tms3556
195195
196   machine struct initialization helper
196    machine struct initialization helper
197197*/
198198MACHINE_DRIVER_START( tms3556 )
199199   /* video hardware */
r5932r5933
216216
217217
218218/*
219   PALETTE_INIT( tms3556 )
219    PALETTE_INIT( tms3556 )
220220
221   Create our 8-color RGB palette
221    Create our 8-color RGB palette
222222*/
223223static PALETTE_INIT( tms3556 )
224224{
r5932r5933
235235}
236236
237237/*
238   tms3556_init
238    tms3556_init
239239
240   tms3556 core init (called at video init time)
240    tms3556 core init (called at video init time)
241241*/
242242void tms3556_init(running_machine *machine, int vram_size)
243243{
r5932r5933
256256}
257257
258258/*
259   tms3556_reset
259    tms3556_reset
260260
261   tms3556 reset (should be called at machine init time)
261    tms3556 reset (should be called at machine init time)
262262*/
263263void tms3556_reset(void)
264264{
r5932r5933
283283#pragma mark REDRAW CODE
284284#endif
285285/*
286   redraw code
286    redraw code
287287*/
288288
289289/*
290   tms3556_draw_line_empty
290    tms3556_draw_line_empty
291291
292   draw an empty line (used for top and bottom borders, and screen off mode)
292    draw an empty line (used for top and bottom borders, and screen off mode)
293293*/
294294static void tms3556_draw_line_empty(UINT16 *ln)
295295{
r5932r5933
303303}
304304
305305/*
306   tms3556_draw_line_text_common
306    tms3556_draw_line_text_common
307307
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)
310310*/
311311static void tms3556_draw_line_text_common(UINT16 *ln)
312312{
r5932r5933
417417}
418418
419419/*
420   tms3556_draw_line_bitmap_common
420    tms3556_draw_line_bitmap_common
421421
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)
424424*/
425425static void tms3556_draw_line_bitmap_common(UINT16 *ln)
426426{
r5932r5933
464464}
465465
466466/*
467   tms3556_draw_line_text
467    tms3556_draw_line_text
468468
469   draw a line in text mode
469    draw a line in text mode
470470*/
471471static void tms3556_draw_line_text(UINT16 *ln)
472472{
r5932r5933
477477}
478478
479479/*
480   tms3556_draw_line_bitmap
480    tms3556_draw_line_bitmap
481481
482   draw a line in bitmap mode
482    draw a line in bitmap mode
483483*/
484484static void tms3556_draw_line_bitmap(UINT16 *ln)
485485{
r5932r5933
493493}
494494
495495/*
496   tms3556_draw_line_mixed
496    tms3556_draw_line_mixed
497497
498   draw a line in mixed mode
498    draw a line in mixed mode
499499*/
500500static void tms3556_draw_line_mixed(UINT16 *ln)
501501{
r5932r5933
527527}
528528
529529/*
530   tms3556_draw_line
530    tms3556_draw_line
531531
532   draw a line.  If non-interlaced mode, duplicate the line.
532    draw a line.  If non-interlaced mode, duplicate the line.
533533*/
534534static void tms3556_draw_line(bitmap_t *bmp, int line)
535535{
r5932r5933
539539   double_lines = 0;
540540
541541   /*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*/
546546   {   /* non-interlaced mode */
547547      ln = BITMAP_ADDR16(bmp, line, 0);
548548      ln2 = BITMAP_ADDR16(bmp, line, 1);
r5932r5933
578578
579579
580580/*
581   tms3556_interrupt_start_vblank
581    tms3556_interrupt_start_vblank
582582
583   Do vblank-time tasks
583    Do vblank-time tasks
584584*/
585585static void tms3556_interrupt_start_vblank(void)
586586{
r5932r5933
612612}
613613
614614/*
615   tms3556_interrupt
615    tms3556_interrupt
616616
617   scanline handler
617    scanline handler
618618*/
619619void tms3556_interrupt()
620620{
src/mess/video/m6845.h
r5932r5933
11/************************************************************************
2   crct6845
2    crct6845
33
4   MESS Driver By:
4    MESS Driver By:
55
6    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
6    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
88
99 ************************************************************************/
1010
src/mess/video/crt.c
r5932r5933
11/*
2   video/crt.c
2    video/crt.c
33
4   CRT video emulation for TX-0 and PDP-1.
4    CRT video emulation for TX-0 and PDP-1.
55
66
77Theory of operation:
88
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.
1414
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).
2222
2323
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
2626*/
2727
2828#include <math.h>
r5932r5933
5757
5858
5959/*
60   video_start_crt
60    video_start_crt
6161
62   video init
62    video init
6363*/
6464int video_start_crt(running_machine *machine, int num_levels, int offset_x, int offset_y, int width, int height)
6565{
r5932r5933
9292
9393
9494/*
95   crt_plot
95    crt_plot
9696
97   schedule a pixel to be plotted
97    schedule a pixel to be plotted
9898*/
9999void crt_plot(int x, int y)
100100{
r5932r5933
124124
125125
126126/*
127   VIDEO_EOF( crt )
127    VIDEO_EOF( crt )
128128
129   keep track of time
129    keep track of time
130130*/
131131VIDEO_EOF( crt )
132132{
r5932r5933
135135
136136
137137/*
138   VIDEO_UPDATE( crt )
138    VIDEO_UPDATE( crt )
139139
140   update the bitmap
140    update the bitmap
141141*/
142142VIDEO_UPDATE( crt )
143143{
src/mess/video/tms3556.h
r5932r5933
11/*
2   tms3556.h: header file for tms3556.c
2    tms3556.h: header file for tms3556.c
33*/
44
55READ8_HANDLER(tms3556_vram_r);
src/mess/video/ted7360.c
r5932r5933
11/***************************************************************************
22
3   TExt Display 7360
4   PeT mess@utanet.at
3    TExt Display 7360
4    PeT mess@utanet.at
55
66***************************************************************************/
77/*
r5932r5933
547547static void ted7360_set_interrupt (running_machine *machine, int mask)
548548{
549549   /* kernel itself polls for timer 2 shot (interrupt disabled!)
550    * when cassette loading */
550    * when cassette loading */
551551   ted7360[9] |= mask;
552552   if ((ted7360[0xa] & ted7360[9] & 0x5e))
553553   {
src/mess/video/hd61830.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - text mode
14    - text mode
1515
1616*/
1717
r5932r5933
121121
122122/*-------------------------------------------------
123123    set_busy_flag - set busy flag and arm timer
124               to clear it later
124                    to clear it later
125125-------------------------------------------------*/
126126
127127static void set_busy_flag(hd61830_t *hd61830, int period)
r5932r5933
199199         logerror("HD61380 '%s' Display %s\n", device->tag, (data & HD61830_MODE_DISPLAY_ON) ? "On" : "Off");
200200      }
201201      break;
202   
202
203203   case HD61830_INSTRUCTION_CHARACTER_PITCH:
204204      hd61830->hp = (data & 0x07) + 1;
205205      hd61830->vp = (data >> 4) + 1;
src/mess/video/hd66421.c
r5932r5933
11/*
22
3   Hitachi HD66421 LCD Controller/Driver
3    Hitachi HD66421 LCD Controller/Driver
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
77*/
88
src/mess/video/busicom.c
r5932r5933
11/***************************************************************************
2   
2
33        Busicom 141-PF
44
55        04/08/2009 Initial driver by Miodrag Milanovic
r5932r5933
1313UINT8 busicom_printer_line[11][17];
1414UINT8 busicom_printer_line_color[11];
1515
16static UINT8 printer_font[]= {   
16static UINT8 printer_font[]= {
17170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
18180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
19190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
r5932r5933
58580,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
59590,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
60600,0,0,0,0,0,0,0,0,0,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
62620,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
63630,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,
64640,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,
r5932r5933
18201820
18211821VIDEO_UPDATE( busicom )
18221822{
1823   int y, x, b, j;   
1823   int y, x, b, j;
18241824   //34x44
18251825   for (y = 0; y < 11; y++)
18261826   {
18271827      UINT8 col = 8 * busicom_printer_line_color[y];
18281828      for (x = 0; x < 17; x++)
18291829      {
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++) {
18321832            for (b = 0; b < 34; b++)
1833            {                       
1833            {
18341834               *BITMAP_ADDR16(bitmap, (y*44)+j, x*40+b) =  printer_font[44*34 * chr + j*34 + b] + col ;
18351835            }
18361836            for (b = 34; b < 40; b++)
1837            {                       
1837            {
18381838               *BITMAP_ADDR16(bitmap, (y*44)+j, x*40+b) =  0;
18391839            }
18401840
r5932r5933
18501850PALETTE_INIT( busicom )
18511851{
18521852   int i;
1853   for(i=0;i<8;i++) {     
1853   for(i=0;i<8;i++) {
18541854      palette_set_color( machine, i, MAKE_RGB(color[i],color[i],color[i]) );
18551855   }
18561856   palette_set_color( machine, 8, MAKE_RGB(0xff,0xff,0xff) );
1857   for(i=0;i<7;i++) {     
1857   for(i=0;i<7;i++) {
18581858      palette_set_color( machine, i+9, MAKE_RGB(color_red[i],0x00,0x00) );
18591859   }
18601860}
src/mess/video/hd66421.h
r5932r5933
11/*
22
3   Hitachi HD66421 LCD Controller/Driver
3    Hitachi HD66421 LCD Controller/Driver
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
77*/
88
src/mess/video/pecom.c
r5932r5933
8282static CDP1869_INTERFACE( pecom_cdp1869_intf )
8383{
8484   "maincpu",
85   SCREEN_TAG,   
85   SCREEN_TAG,
8686   CDP1869_COLOR_CLK_PAL,
8787   CDP1869_PAL,
8888   pecom_page_ram_r,
r5932r5933
111111   /* register for state saving */
112112   state_save_register_global(machine, state->cdp1802_mode);
113113   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);
115115}
116116
117117static VIDEO_UPDATE( pecom )
src/mess/video/pc1251.c
r5932r5933
128128   color[0] = pocketc_colortable[PC1251_CONTRAST][0];
129129   color[1] = pocketc_colortable[PC1251_CONTRAST][1];
130130
131   for (x=RIGHT,y=DOWN, i=0; i<60; x+=3)
131   for (x=RIGHT,y=DOWN, i=0; i<60; x+=3)
132132   {
133133      for (j=0; j<5; j++, i++, x+=3)
134134         drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1251_lcd.reg[i],
135135               PC1251_CONTRAST,0,0,
136136               x,y);
137137   }
138   for (i=0x7b; i>=0x40; x+=3)
138   for (i=0x7b; i>=0x40; x+=3)
139139   {
140140      for (j=0; j<5; j++, i--, x+=3)
141141         drawgfx_opaque(bitmap, 0, screen->machine->gfx[0], pc1251_lcd.reg[i],
r5932r5933
161161                  pc1251_lcd.reg[0x3e] & 0x04 ? color[1] : color[0]);
162162
163163   /* 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?*/
166166   return 0;
167167}
168168
src/mess/video/vc4000.c
r5932r5933
161161      vc4000_video.sprite_collision = 0;
162162      vc4000_video.reg.d.sprite_collision &= 0xbf;
163163      break;
164
164
165165#ifndef ANALOG_HACK
166166   case 0xcc:
167167      if (!activecpu_get_reg(S2650_FO)) data=input_port_read(machine, "JOY1_X");
r5932r5933
207207               joy1_y+=5;
208208               if (joy1_y > STICKHIGH) joy1_y=STICKHIGH;
209209               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);
212212            }
213213            data=joy1_y;
214214         }
r5932r5933
284284               joy2_y+=5;
285285               if (joy2_y > STICKHIGH) joy2_y=STICKHIGH;
286286               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);
289289            }
290290            data=joy2_y;
291291         }
r5932r5933
337337
338338WRITE8_HANDLER(vc4000_video_w)
339339{
340//   vc4000_video.reg.data[offset]=data;
340//  vc4000_video.reg.data[offset]=data;
341341   if (offset > 0xcf) offset &= 0xcf;   // c0-cf is mirrored at d0-df, e0-ef, f0-ff
342342
343343   switch (offset) {
r5932r5933
353353      vc4000_video.sprites[0].scolor=((~data>>3)&7);
354354      vc4000_video.sprites[1].scolor=(~data&7);
355355      break;
356     
356
357357   case 0xc2:                  // Sprite 2+3 color
358358      vc4000_video.sprites[2].scolor=((~data>>3)&7);
359359      vc4000_video.sprites[3].scolor=(~data&7);
r5932r5933
630630      vc4000_video.background_collision=0;
631631      vc4000_video.sprite_collision=0;
632632      vc4000_video.reg.d.sprite_collision=0;
633//      logerror("begin of frame\n");
633//      logerror("begin of frame\n");
634634   }
635635
636636   if (irq_pause>10)
src/mess/video/733_asr.c
r5932r5933
11/*
2   733 ASR emulation
2    733 ASR emulation
33
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.
66
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.
99
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.
1515
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?
1919
20   Raphael Nabet 2003
20    Raphael Nabet 2003
2121*/
2222
2323#include "driver.h"
r5932r5933
4747static struct
4848{
4949   /*UINT8 OutQueue[ASROutQueueSize];
50   int OutQueueHead;
51   int OutQueueLen;*/
50    int OutQueueHead;
51    int OutQueueLen;*/
5252
5353   UINT8 recv_buf;
5454   UINT8 xmit_buf;
r5932r5933
8484
8585static const gfx_layout fontlayout =
8686{
87   6, 8,         /* 6*8 characters */
87    6, 8,           /* 6*8 characters */
8888   /*96*/128,            /* 96 characters */
8989   1,            /* 1 bit per pixel */
9090   { 0 },
r5932r5933
104104}
105105
106106/*
107   Initialize the asr core
107    Initialize the asr core
108108*/
109109void asr733_init(running_machine *machine)
110110{
r5932r5933
314314#endif
315315
316316/*
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
327327*/
328328static int asr733_cru_r(int offset, int unit)
329329{
r5932r5933
346346}
347347
348348/*
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
358358*/
359359static void asr733_cru_w(running_machine *machine, int offset, int data, int unit)
360360{
r5932r5933
417417
418418
419419/*
420   Video refresh
420    Video refresh
421421*/
422422void asr733_refresh(running_machine *machine, bitmap_t *bitmap, int unit, int x, int y)
423423{
r5932r5933
602602
603603
604604/*
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.
607607*/
608608void asr733_keyboard(running_machine *machine, int unit)
609609{
src/mess/video/sed1330.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
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
2424
2525*/
2626
r5932r5933
195195   switch (sed1330->ir)
196196   {
197197/*
198   case SED1330_INSTRUCTION_SLEEP_IN:
199      break;
198    case SED1330_INSTRUCTION_SLEEP_IN:
199        break;
200200*/
201201   case SED1330_INSTRUCTION_CSRDIR_RIGHT:
202202   case SED1330_INSTRUCTION_CSRDIR_LEFT:
r5932r5933
225225READ8_DEVICE_HANDLER( sed1330_data_r )
226226{
227227   sed1330_t *sed1330 = get_safe_token(device);
228   
228
229229   UINT8 data = devcb_call_read8(&sed1330->in_vd_func, sed1330->csr);
230230
231231   if (LOG) logerror("SED1330 '%s' Memory Read %02x from %04x\n", device->tag, data, sed1330->csr);
r5932r5933
326326         case SED1330_FC_FLASH_32:   logerror("SED1330 '%s' Cursor: fFR/32\n", device->tag);      break;
327327         case SED1330_FC_FLASH_64:   logerror("SED1330 '%s' Cursor: fFR/64\n", device->tag);      break;
328328         }
329         
329
330330         switch (sed1330->fp & 0x03)
331331         {
332332         case SED1330_FC_OFF:      logerror("SED1330 '%s' Display Page 1: disabled\n", device->tag);      break;
r5932r5933
334334         case SED1330_FC_FLASH_32:   logerror("SED1330 '%s' Display Page 1: flash fFR/32\n", device->tag);   break;
335335         case SED1330_FC_FLASH_64:   logerror("SED1330 '%s' Display Page 1: flash fFR/64\n", device->tag);   break;
336336         }
337         
337
338338         switch ((sed1330->fp >> 2) & 0x03)
339339         {
340340         case SED1330_FC_OFF:      logerror("SED1330 '%s' Display Page 2/4: disabled\n", device->tag);      break;
r5932r5933
418418      case 1:
419419         sed1330->cry = (data & 0x0f) + 1;
420420         sed1330->cm = BIT(data, 7);
421         if (LOG)
421         if (LOG)
422422         {
423423            logerror("SED1330 '%s' Vertical Cursor Location: %u\n", device->tag, sed1330->cry);
424424            logerror("SED1330 '%s' Cursor Shape: %s\n", device->tag, BIT(data, 7) ? "Block" : "Underscore");
r5932r5933
480480         sed1330->csr = (sed1330->csr & 0xff00) | data;
481481         break;
482482
483      case 1:     
483      case 1:
484484         sed1330->csr = (data << 8) | (sed1330->csr & 0xff);
485485         if (LOG) logerror("SED1330 '%s' Cursor Address %04x\n", device->tag, sed1330->csr);
486486         break;
r5932r5933
490490      }
491491      break;
492492/*
493   case SED1330_INSTRUCTION_CSRR:
494      break;
493    case SED1330_INSTRUCTION_CSRR:
494        break;
495495*/
496496   case SED1330_INSTRUCTION_MWRITE:
497497      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);
r5932r5933
501501      increment_csr(sed1330);
502502      break;
503503/*
504   case SED1330_INSTRUCTION_MREAD:
505      break;
504    case SED1330_INSTRUCTION_MREAD:
505        break;
506506*/
507507   default:
508508      logerror("SED1330 '%s' Unsupported instruction %02x\n", device->tag, sed1330->ir);
r5932r5933
513513
514514/*-------------------------------------------------
515515    draw_text_scanline - draw one scanline
516   (currently this only draws the text cursor)
516    (currently this only draws the text cursor)
517517-------------------------------------------------*/
518518
519519static void draw_text_scanline(sed1330_t *sed1330, bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va)
r5932r5933
587587static void update_text(sed1330_t *sed1330, bitmap_t *bitmap, const rectangle *cliprect)
588588{
589589   int y;
590   
590
591591   if (sed1330->ws)
592592   {
593593      for (y = 0; y < sed1330->sl1; y++)
r5932r5933
695695
696696static DEVICE_RESET( sed1330 )
697697{
698//   sed1330_t *sed1330 = get_safe_token(device);
698//  sed1330_t *sed1330 = get_safe_token(device);
699699
700700}
701701
src/mess/video/pk8020.c
r5932r5933
1717{
1818    int y, x, b, j;
1919   UINT8 *gfx = memory_region(screen->machine, "gfx1");
20   
20
2121   for (y = 0; y < 16; y++)
2222   {
2323      for (x = 0; x < 64; x++)
2424      {
2525         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++) {
2828            UINT32 addr = 0x10000 + x + ((y*16+j)*64) + (pk8020_video_page * 0xC000);
2929            UINT8 code1 = mess_ram[addr];
3030            UINT8 code2 = mess_ram[addr + 0x4000];
3131            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)];
3333            if(attr) code4 ^= 0xff;
3434            for (b = 0; b < 8; b++)
35            {                       
35            {
3636               UINT8 col = (((code4 >> b) & 0x01) ? 0x08 : 0x00);
3737               col |= (((code3 >> b) & 0x01) ? 0x04 : 0x00);
3838               col |= (((code2 >> b) & 0x01) ? 0x02 : 0x00);
r5932r5933
4848PALETTE_INIT( pk8020 )
4949{
5050   int i;
51   for(i=0;i<16;i++) {     
51   for(i=0;i<16;i++) {
5252      palette_set_color( machine, i, MAKE_RGB(i*0x10,i*0x10,i*0x10) );
5353   }
5454}
src/mess/video/galaxy.c
r5932r5933
1919emu_timer *gal_video_timer = NULL;
2020
2121TIMER_CALLBACK( gal_video )
22{   
22{
2323   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
2424   int y, x;
25   if (galaxy_interrupts_enabled == TRUE)
25   if (galaxy_interrupts_enabled == TRUE)
2626   {
2727      UINT8 *gfx = memory_region(machine, "gfx1");
2828      UINT8 dat = (gal_latch_value & 0x3c) >> 2;
r5932r5933
3333           if (mode == 0)
3434         {
3535              // 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)
3737            {
3838                 // Due to a fact that on real processor latch value is set at
3939                 // the end of last cycle we need to skip dusplay of double
4040                 // first char in each row
4141                 code = 0x00;
4242                 first = 1;
43            }
44            else
43            }
44            else
4545            {
4646               code = memory_read_byte(space,addr) & 0xbf;
4747               code += (code & 0x80) >> 1;
r5932r5933
5050            }
5151            y = gal_cnt / 48 - 2;
5252            x = (gal_cnt % 48) * 8;
53           
53
5454            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 0) & 1; x++;
5555            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 1) & 1; x++;
5656            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 2) & 1; x++;
r5932r5933
6060            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 6) & 1; x++;
6161            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 7) & 1;
6262         }
63         else
63         else
6464         { // 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)
6666            {
6767                 // Due to a fact that on real processor latch value is set at
6868                 // the end of last cycle we need to skip dusplay of 4 times
6969                 // first char in each row
7070                 code = 0x00;
7171                 first++;
72            }
73            else
72            }
73            else
7474            {
7575               code = memory_read_byte(space,addr) ^ 0xff;
7676               first = 0;
7777            }
7878            y = gal_cnt / 48 - 2;
7979            x = (gal_cnt % 48) * 8;
80           
80
8181            /* hack - until calc of R is fixed in Z80 */
82            if (x == 11 * 8 && y == 0)
82            if (x == 11 * 8 && y == 0)
8383            {
8484               start_addr = addr;
8585            }
86            if ((x / 8 >= 11) && (x / 8 < 44))
86            if ((x / 8 >= 11) && (x / 8 < 44))
8787            {
8888               code = memory_read_byte(space, start_addr + y * 32 + (gal_cnt % 48) - 11) ^ 0xff;
89            }
90            else
89            }
90            else
9191            {
9292               code = 0x00;
9393            }
9494            /* end of hack */
95           
95
9696            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 0) & 1; x++;
9797            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 1) & 1; x++;
9898            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 2) & 1; x++;
r5932r5933
101101            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 5) & 1; x++;
102102            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 6) & 1; x++;
103103            *BITMAP_ADDR16(tmpbitmap, y, x ) = (code >> 7) & 1;
104         }               
104         }
105105      }
106106      gal_cnt++;
107   }   
107   }
108108}
109109
110110VIDEO_UPDATE( galaxy )
111111{
112112   timer_adjust_periodic(gal_video_timer, attotime_zero, 0, attotime_never);
113   if (galaxy_interrupts_enabled == FALSE)
113   if (galaxy_interrupts_enabled == FALSE)
114114   {
115115      rectangle black_area = {0, 384 - 1, 0, 208 - 1};
116116      bitmap_fill(tmpbitmap, &black_area, 0);
src/mess/video/bbc.c
r5932r5933
33
44    MESS Driver By:
55
6   Gordon Jefferyes
7   mess_bbc@gjeffery.dircon.co.uk
6    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
88
99******************************************************************************/
1010
r5932r5933
107107
108108
109109            /* 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) */
112112
113113            /* get bit m12 from the 6845 */
114114            ma12=(ma>>12)&1;
r5932r5933
131131            s=(a+b+1)&0xf;
132132
133133            /* 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 */
137137            if ((ma>>13)&1)
138138            {
139139               m=((ma&0x3ff)|0x3c00)|((s&0x8)<<11);
r5932r5933
286286   else
287287     video_screen_update_partial(space->machine->primary_screen, vpos -1 );
288288
289//   logerror("setting videoULA %s at %.4x size:%.4x\n",image_filename(image), addr, size);
289//  logerror("setting videoULA %s at %.4x size:%.4x\n",image_filename(image), addr, size);
290290   logerror("setting videoULA %.4x to:%.4x   at :%d \n",data,offset,video_screen_get_vpos(space->machine->primary_screen) );
291291
292292
src/mess/video/k1ge.c
r5932r5933
326326      }
327327
328328      for( i = 0; i < k1ge->wba_h; i++ )
329      {       
329      {
330330         p[i] = oowcol;
331331      }
332332
333333      for( i = k1ge->wba_h + k1ge->wsi_h; i < 160; i++ )
334      {       
334      {
335335         p[i] = oowcol;
336336      }
337337   }
src/mess/video/fm7.c
r5932r5933
11/*
2 *
2 *
33 *  Fujitsu Micro 7 Video functions
4 *
4 *
55 */
66
77#include "driver.h"
r5932r5933
3838
3939/*
4040 * Main CPU: Sub-CPU interface (port 0xfd05)
41 *
41 *
4242 * Read:
4343 *   bit 7: Sub-CPU busy (or halted)
4444 *   bit 0: EXTDET (?)
r5932r5933
5050READ8_HANDLER( fm7_subintf_r )
5151{
5252   UINT8 ret = 0x00;
53   
53
5454   if(fm7_video.sub_busy != 0 || fm7_video.sub_halt != 0)
5555      ret |= 0x80;
56     
56
5757   ret |= 0x7e;
5858   //ret |= 0x01; // EXTDET (not implemented yet)
59   
59
6060   return ret;
6161}
6262
r5932r5933
9595}
9696
9797/*
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
9999 */
100100READ8_HANDLER( fm7_attn_irq_r )
101101{
r5932r5933
106106
107107/*
108108 *  Sub CPU: I/O port 0xd409
109 *
109 *
110110 *  On read, enables VRAM access
111111 *  On write, disables VRAM access
112112 */
r5932r5933
130130{
131131   UINT8 temp;
132132   int page = 0;
133   
133
134134   if(offset >= 0xc000)
135135      page = 1;
136136
r5932r5933
139139      fm7_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = dat;
140140      return;
141141   }
142   
142
143143   temp = fm7_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)];
144144   if(fm7_alu.command & 0x20)
145145   {  // "not equal" write mode
r5932r5933
151151      temp &= ~fm7_alu.compare_data;
152152      dat &= fm7_alu.compare_data;
153153   }
154   
154
155155   fm7_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = temp | dat;
156156}
157157
r5932r5933
159159{
160160   // COMPARE - compares which colors match those in the compare registers
161161   // can be used on its own, or when bit 6 of the command register is high.
162   
162
163163   UINT8 red,green,blue;
164164   UINT8 dat = 0;
165165   UINT8 colour;
r5932r5933
168168   int match;
169169   int page = 0;
170170   UINT8 bit = 0x80;
171   
171
172172   if(offset >= 0xc000)
173173   {
174174      page = 1;
r5932r5933
176176   }
177177   else
178178      offset += fm7_video.vram_offset;
179   
179
180180   blue = fm7_video_ram[(offset & 0x3fff) + (page * 0xc000)];
181181   red = fm7_video_ram[(offset & 0x3fff) + 0x4000 + (page * 0xc000)];
182182   green = fm7_video_ram[(offset & 0x3fff) + 0x8000 + (page * 0xc000)];
183183
184184   banks = (~fm7_alu.bank_disable) & 0x07;
185   
185
186186   for(x=0;x<8;x++) // loop through each pixel
187187   {
188188      colour = 0;
r5932r5933
192192         colour |= 2;
193193      if(green & bit)
194194         colour |= 4;
195         
195
196196      match = 0;
197197      for(y=0;y<8;y++)  // loop through each compare register
198198      {
r5932r5933
204204      }
205205      if(match != 0)
206206         dat |= bit;
207     
207
208208      bit >>= 1;
209209   }
210210   fm7_alu.compare_data = dat;
r5932r5933
217217   UINT8 dat;
218218   int page = 0;
219219   UINT8 mask;
220   
220
221221   if(fm7_alu.command & 0x40)
222222      fm7_alu_function_compare(offset);
223   
223
224224   if(offset >= 0xc000)
225225   {
226226      page = 1;
r5932r5933
228228   }
229229   else
230230      offset += fm7_video.vram_offset;
231   
231
232232   for(x=0;x<3;x++) // cycle through banks
233233   {
234234      if(!(fm7_alu.bank_disable & (1 << x)))
r5932r5933
237237            dat = 0xff;
238238         else
239239            dat = 0;
240   
240
241241         mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & fm7_alu.mask;
242242         dat &= ~fm7_alu.mask;
243243         dat |= mask;
244         
244
245245         fm7_alu_mask_write(offset,x,dat);
246246      }
247247   }
r5932r5933
253253   UINT8 dat;
254254   int page = 0;
255255   UINT8 mask;
256   
256
257257   if(fm7_alu.command & 0x40)
258258      fm7_alu_function_compare(offset);
259   
259
260260   if(offset >= 0xc000)
261261   {
262262      page = 1;
r5932r5933
264264   }
265265   else
266266      offset += fm7_video.vram_offset;
267   
267
268268   for(x=0;x<3;x++) // cycle through banks
269269   {
270270      if(!(fm7_alu.bank_disable & (1 << x)))
r5932r5933
273273            dat = 0xff;
274274         else
275275            dat = 0;
276   
276
277277         mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
278278         dat |= mask;
279         
279
280280         mask &= fm7_alu.mask;
281281         dat &= ~fm7_alu.mask;
282282         dat |= mask;
283           
283
284284         fm7_alu_mask_write(offset,x,dat);
285285      }
286286   }
r5932r5933
292292   UINT8 dat;
293293   int page = 0;
294294   UINT8 mask;
295   
295
296296   if(fm7_alu.command & 0x40)
297297      fm7_alu_function_compare(offset);
298   
298
299299   if(offset >= 0xc000)
300300   {
301301      page = 1;
r5932r5933
303303   }
304304   else
305305      offset += fm7_video.vram_offset;
306   
306
307307   for(x=0;x<3;x++) // cycle through banks
308308   {
309309      if(!(fm7_alu.bank_disable & (1 << x)))
r5932r5933
312312            dat = 0xff;
313313         else
314314            dat = 0;
315   
315
316316         mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
317317         dat &= mask;
318         
318
319319         mask &= fm7_alu.mask;
320320         dat &= ~fm7_alu.mask;
321321         dat |= mask;
322           
322
323323         fm7_alu_mask_write(offset,x,dat);
324324      }
325325   }
r5932r5933
331331   UINT8 dat;
332332   int page = 0;
333333   UINT8 mask;
334   
334
335335   if(fm7_alu.command & 0x40)
336336      fm7_alu_function_compare(offset);
337   
337
338338   if(offset >= 0xc000)
339339   {
340340      page = 1;
r5932r5933
342342   }
343343   else
344344      offset += fm7_video.vram_offset;
345   
345
346346   for(x=0;x<3;x++) // cycle through banks
347347   {
348348      if(!(fm7_alu.bank_disable & (1 << x)))
r5932r5933
351351            dat = 0xff;
352352         else
353353            dat = 0;
354   
354
355355         mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
356356         dat ^= mask;
357         
357
358358         mask &= fm7_alu.mask;
359359         dat &= ~fm7_alu.mask;
360360         dat |= mask;
361           
361
362362         fm7_alu_mask_write(offset,x,dat);
363363      }
364364   }
r5932r5933
370370   UINT8 dat;
371371   int page = 0;
372372   UINT8 mask;
373   
373
374374   if(fm7_alu.command & 0x40)
375375      fm7_alu_function_compare(offset);
376   
376
377377   if(offset >= 0xc000)
378378   {
379379      page = 1;
r5932r5933
381381   }
382382   else
383383      offset += fm7_video.vram_offset;
384   
384
385385   for(x=0;x<3;x++) // cycle through banks
386386   {
387387      if(!(fm7_alu.bank_disable & (1 << x)))
r5932r5933
390390            dat = 0xff;
391391         else
392392            dat = 0;
393   
393
394394         mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
395395         dat = ~mask;
396         
396
397397         mask &= fm7_alu.mask;
398398         dat &= ~fm7_alu.mask;
399399         dat |= mask;
400           
400
401401         fm7_alu_mask_write(offset,x,dat);
402402      }
403403   }
r5932r5933
410410   UINT8 dat;
411411   int page = 0;
412412   UINT8 mask;
413   
413
414414   if(fm7_alu.command & 0x40)
415415      fm7_alu_function_compare(offset);
416   
416
417417   if(offset >= 0xc000)
418418   {
419419      page = 1;
r5932r5933
421421   }
422422   else
423423      offset += fm7_video.vram_offset;
424   
424
425425   for(x=0;x<3;x++) // cycle through banks
426426   {
427427      if(!(fm7_alu.bank_disable & (1 << x)))
428428      {
429429         mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]);
430         
430
431431         dat = mask & fm7_alu.mask;
432           
432
433433         fm7_alu_mask_write(offset,x,dat);
434434      }
435435   }
r5932r5933
442442   UINT8 dat = 0;
443443   int page = 0;
444444   UINT8 mask;
445   
445
446446   if(fm7_alu.command & 0x40)
447447      fm7_alu_function_compare(offset);
448   
448
449449   if(offset >= 0xc000)
450450   {
451451      page = 1;
r5932r5933
453453   }
454454   else
455455      offset += fm7_video.vram_offset;
456   
456
457457   for(x=0;x<3;x++) // cycle through banks
458458   {
459459      if(!(fm7_alu.bank_disable & (1 << x)))
r5932r5933
473473         dat &= ~fm7_alu.mask;
474474         mask = (fm7_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & fm7_alu.mask;
475475         dat |= mask;
476   
476
477477         fm7_alu_mask_write(offset,x,dat);
478478      }
479   }   
479   }
480480}
481481
482482static void fm7_alu_function(UINT32 offset)
r5932r5933
514514{
515515   UINT32 addr;
516516   UINT8 pixel_mask[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe };
517   
518   
517
518
519519   if(fm7_video.modestatus & 0x40) // 320 pixels wide
520520   {
521521      addr = (x >> 3) + (y * 40);
r5932r5933
528528   addr &= 0x3fff;
529529   if(fm7_video.active_video_page != 0)
530530      addr += 0xc000;
531   
531
532532   if(fm7_alu.command & 0x80)  // ALU must be active
533533   {
534534      fm7_alu.mask = pixel_mask[x & 0x07];
535535      fm7_alu_function(addr);
536536   }
537   
537
538538   return addr;
539539}
540540
r5932r5933
550550   int byte_count = 0;
551551   UINT16 old_addr = 0xffff;
552552   UINT16 addr;
553   
553
554554   fm7_alu.busy = 1;
555   
555
556556   horiz = x2 - x1;
557557   vert = y2 - y1;
558   
558
559559   if(horiz < 0)
560560   {
561561      dirx = -1;
r5932r5933
570570   }
571571   else
572572      diry = 1;
573     
573
574574   if(horiz == 0 && vert == 0)
575575   {
576576      fm7_line_set_pixel(x1,y1);
r5932r5933
624624         if(rep < 0)
625625         {
626626            rep += horiz;
627            y1 += diry;
627            y1 += diry;
628628         }
629629      }
630630   }
r5932r5933
646646         if(rep < 0)
647647         {
648648            rep += vert;
649            x1 += dirx;
649            x1 += dirx;
650650         }
651651      }
652652   }
653   
653
654654   // set timer to disable busy flag
655655   // 1/16 us for each byte changed
656656   timer_set(machine,ATTOTIME_IN_USEC(byte_count/16),NULL,0,fm77av_alu_task_end);
r5932r5933
670670      return 0xff;
671671   if((offset < 0xc000 && offset >=0x8000) && (fm7_video.multi_page & 0x04))
672672      return 0xff;
673   
673
674674   if(fm7_alu.command & 0x80) // ALU active, writes to VRAM even when reading it (go figure)
675675   {
676676      fm7_alu_function(offset+page);
677677   }
678   
678
679679   if(fm7_video.modestatus & 0x40)
680680   {
681681      if(fm7_video.active_video_page != 0)
r5932r5933
697697{
698698   int offs;
699699   UINT16 page = 0x0000;
700   
700
701701   if(fm7_video.active_video_page != 0)
702702      page = 0xc000;
703703
r5932r5933
713713      fm7_alu_function(offset+page);
714714      return;
715715   }
716     
716
717717   if(fm7_video.modestatus & 0x40)
718718   {
719719      if(fm7_video.active_video_page != 0)
r5932r5933
728728      else
729729         offs = (offset & 0xc000) | ((offset + fm7_video.vram_offset) & 0x3fff);
730730   }
731//   if(fm7_video.vram_access != 0)
731//  if(fm7_video.vram_access != 0)
732732      fm7_video_ram[offs+page] = data;
733733}
734734
r5932r5933
750750      return;
751751   if((offset < 0xc000 && offset >=0x8000) && (fm7_video.multi_page & 0x04))
752752      return;
753     
753
754754   if(fm7_alu.command & 0x80) // ALU active
755755   {
756756      fm7_alu_function(offset+page);
757757      return;
758758   }
759   
759
760760   if(fm7_video.modestatus & 0x40)
761761   {
762762      if(fm7_video.active_video_page != 0)
r5932r5933
920920
921921/*
922922 *  Sub CPU: I/O port 0xd408
923 *
923 *
924924 *  On read, enables the CRT display
925925 *  On write, disables the CRT display
926926 */
r5932r5933
937937
938938/*
939939 *  Sub CPU: I/O ports 0xd40e - 0xd40f
940 *
940 *
941941 *  0xd40e: bits 0-6 - offset in bytes (high byte) (bit 6 is used for 400 line video only)
942942 *  0xd40f: bits 0-7 - offset in bytes (low byte)
943943 */
944944WRITE8_HANDLER( fm7_vram_offset_w )
945945{
946946   UINT16 new_offset = 0;
947     
947
948948   switch(offset)
949949   {
950950      case 0:
951951         if(fm7_video.active_video_page != 0)
952952            new_offset = ((data & 0x3f) << 8) | (fm7_video.vram_offset2 & 0x00ff);
953953         else
954            new_offset = ((data & 0x3f) << 8) | (fm7_video.vram_offset & 0x00ff);
954            new_offset = ((data & 0x3f) << 8) | (fm7_video.vram_offset & 0x00ff);
955955         break;
956956      case 1:  // low 5 bits are used on FM-77AV and later only
957957         if(fm7_type == SYS_FM7)
r5932r5933
974974            }
975975         }
976976         break;
977   }   
977   }
978978   if(fm7_video.active_video_page != 0)
979979      fm7_video.vram_offset2 = new_offset;
980980   else
r5932r5933
984984/*
985985 *  Main CPU: port 0xfd37
986986 *  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)
990990 *  bits 2-0: VRAM CPU access (G,R,B) (1=disable)
991991 */
992992WRITE8_HANDLER( fm7_multipage_w )
r5932r5933
10101010WRITE8_HANDLER( fm7_palette_w )
10111011{
10121012   UINT8 r = 0,g = 0,b = 0;
1013   
1013
10141014   if(data & 0x04)
10151015      g = 0xff;
10161016   if(data & 0x02)
10171017      r = 0xff;
10181018   if(data & 0x01)
10191019      b = 0xff;
1020     
1020
10211021   palette_set_color(space->machine,offset,MAKE_RGB(r,g,b));
10221022   fm7_video.fm7_pal[offset] = data & 0x07;
10231023}
r5932r5933
10261026 *  Main CPU: 0xfd30 - 0xfd34
10271027 *  Analog colour palette (FM-77AV and later only)
10281028 *  All ports are write-only.
1029 *
1029 *
10301030 *  fd30: colour select(?) high 4 bits (LC11-LC8)
10311031 *  fd31: colour select(?) low 8 bits (LC7-LC0)
10321032 *  fd32: blue level (4 bits)
10331033 *  fd33: red level (4 bits)
1034 *  fd34: green level (4 bits)
1034 *  fd34: green level (4 bits)
10351035 */
10361036WRITE8_HANDLER( fm77av_analog_palette_w )
10371037{
10381038   int val;
1039   
1039
10401040   switch(offset)
10411041   {
10421042      case 0:
r5932r5933
10741074
10751075/*
10761076 *   Sub CPU: 0xd430 - BUSY/NMI/Bank register (FM77AV series only)
1077 *
1077 *
10781078 *   On read:  bit 7 - 0 if in VBlank
10791079 *             bit 4 - ALU busy(0)/ready(1)
10801080 *             bit 2 - VSync status (1 if active?)
10811081 *             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)
10851085 *             bit 5 - active VRAM page
10861086 *             bit 6 - display VRAM page
10871087 *             bit 7 - NMI mask register (1=mask)
r5932r5933
10891089READ8_HANDLER( fm77av_video_flags_r )
10901090{
10911091   UINT8 ret = 0xff;
1092   
1092
10931093   if(video_screen_get_vblank(space->machine->primary_screen))
10941094      ret &= ~0x80;
1095   
1095
10961096   if(fm7_alu.busy != 0)
10971097      ret &= ~0x10;
1098   
1098
10991099   if(fm7_video.vsync_flag == 0)
11001100      ret &= ~0x04;
11011101
11021102   if(!fm7_video.sub_reset)
11031103      ret &= ~0x01;
1104     
1104
11051105   return ret;
11061106}
11071107
r5932r5933
11181118}
11191119
11201120/*
1121 *  Main CPU: port 0xfd12
1121 *  Main CPU: port 0xfd12
11221122 *  Sub mode status register  (FM-77AV or later)
11231123 *  bit 6 (R/W) - Video mode width(?) 0=640 (default) 1=320.
11241124 *  bit 1 (R/O) - DISPTMG status (0=blank)
r5932r5933
11271127READ8_HANDLER( fm77av_sub_modestatus_r )
11281128{
11291129   UINT8 ret = 0x00;
1130   
1130
11311131   ret |= 0xbc;
11321132   ret |= (fm7_video.modestatus & 0x40);
1133   
1133
11341134   if(!video_screen_get_vblank(space->machine->primary_screen))
11351135      ret |= 0x02;
1136     
1136
11371137   if(fm7_video.vsync_flag != 0)
11381138      ret |= 0x01;
1139   
1139
11401140   return ret;
11411141}
11421142
r5932r5933
11631163/*
11641164 *  Main CPU: port 0xfd13
11651165 *  Sub Bank select register
1166 *
1166 *
11671167 *  bits 1 and 0 select which subsys ROM to be banked into sub CPU space
11681168 *  on the FM-77AV40 and later, bit 2 can also selected to bank in sub monitor RAM.
11691169 */
11701170WRITE8_HANDLER( fm77av_sub_bank_w )
11711171{
1172//   UINT8* RAM = memory_region(space->machine,"sub");
1172//  UINT8* RAM = memory_region(space->machine,"sub");
11731173   UINT8* ROM;
11741174   static int prev;
1175   
1175
11761176   if((data & 0x03) == (prev & 0x03))
11771177      return;
1178   
1178
11791179   fm7_video.subrom = data & 0x03;
11801180   switch (data & 0x03)
11811181   {
11821182      case 0x00:  // Type C, 640x200 (as used on the FM-7)
11831183         ROM = memory_region(space->machine,"subsys_c");
1184      //   memory_set_bankptr(space->machine,20,ROM);
1184      //  memory_set_bankptr(space->machine,20,ROM);
11851185         memory_set_bankptr(space->machine,21,ROM+0x800);
11861186         logerror("VID: Sub ROM Type C selected\n");
11871187         break;
11881188      case 0x01:  // Type A, 640x200
11891189         ROM = memory_region(space->machine,"subsys_a");
1190      //   memory_set_bankptr(space->machine,20,RAM+0xd800);
1190      //  memory_set_bankptr(space->machine,20,RAM+0xd800);
11911191         memory_set_bankptr(space->machine,21,ROM);
11921192         logerror("VID: Sub ROM Type A selected\n");
11931193         break;
11941194      case 0x02:  // Type B, 320x200
11951195         ROM = memory_region(space->machine,"subsys_b");
1196      //   memory_set_bankptr(space->machine,20,RAM+0xd800);
1196      //  memory_set_bankptr(space->machine,20,RAM+0xd800);
11971197         memory_set_bankptr(space->machine,21,ROM);
11981198         logerror("VID: Sub ROM Type B selected\n");
11991199         break;
12001200      case 0x03:  // CG Font?
12011201         ROM = memory_region(space->machine,"subsyscg");
1202      //   memory_set_bankptr(space->machine,20,RAM+0xd800);
1202      //  memory_set_bankptr(space->machine,20,RAM+0xd800);
12031203         memory_set_bankptr(space->machine,21,ROM);
12041204         logerror("VID: Sub ROM CG selected\n");
12051205         break;
r5932r5933
12151215/*
12161216 *  Sub CPU: ports 0xd410-0xd42b (FM-77AV and later only)
12171217 *  Video operations
1218 *
1218 *
12191219 *  0xd410 (R/W): Command register
12201220 *                bit 7: 0=DIS 1=Start
12211221 *                bits 6-5: MBIT1, MBIT2
r5932r5933
12381238 *  0xd424-25(W): Line X0 (High-Low, X9-X0)
12391239 *  0xd426-27(W): Line Y0 (High-Low, Y8-Y0)
12401240 *  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)
12421242 */
12431243READ8_HANDLER( fm77av_alu_r )
12441244{
r5932r5933
12691269WRITE8_HANDLER( fm77av_alu_w )
12701270{
12711271   UINT16 dat;
1272   
1272
12731273   switch(offset)
12741274   {
12751275      case 0x00:
r5932r5933
12971297         break;
12981298      case 0x0b:
12991299         fm7_alu.bank_disable = data & 0x03;
1300//         logerror("ALU: write to bank disable register - %02x\n",data);
1300//          logerror("ALU: write to bank disable register - %02x\n",data);
13011301         break;
13021302      case 0x0c:
13031303         fm7_alu.tilepaint_b = data;
1304//         logerror("ALU: write to tilepaint (blue) register - %02x\n",data);
1304//          logerror("ALU: write to tilepaint (blue) register - %02x\n",data);
13051305         break;
13061306      case 0x0d:
13071307         fm7_alu.tilepaint_r = data;
1308//         logerror("ALU: write to tilepaint (red) register - %02x\n",data);
1308//          logerror("ALU: write to tilepaint (red) register - %02x\n",data);
13091309         break;
13101310      case 0x0e:
13111311         fm7_alu.tilepaint_g = data;
1312//         logerror("ALU: write to tilepaint (green) register - %02x\n",data);
1312//          logerror("ALU: write to tilepaint (green) register - %02x\n",data);
13131313         break;
13141314      case 0x10:
13151315         dat = ((data & 0x1f) << 8) | (fm7_alu.addr_offset & 0x00ff);
13161316         fm7_alu.addr_offset = dat;
1317//         logerror("ALU: write to address offset (high) register - %02x (%04x)\n",data,fm7_alu.addr_offset);
1317//          logerror("ALU: write to address offset (high) register - %02x (%04x)\n",data,fm7_alu.addr_offset);
13181318         break;
13191319      case 0x11:
13201320         dat = (fm7_alu.addr_offset & 0xff00) | data;
13211321         fm7_alu.addr_offset = dat;
1322//         logerror("ALU: write to address offset (low) register - %02x (%04x)\n",data,fm7_alu.addr_offset);
1322//          logerror("ALU: write to address offset (low) register - %02x (%04x)\n",data,fm7_alu.addr_offset);
13231323         break;
13241324      case 0x12:
13251325         dat = (data << 8) | (fm7_alu.line_style & 0x00ff);
13261326         fm7_alu.line_style = dat;
1327//         logerror("ALU: write to line style (high) register - %02x (%04x)\n",data,fm7_alu.line_style);
1327//          logerror("ALU: write to line style (high) register - %02x (%04x)\n",data,fm7_alu.line_style);
13281328         break;
13291329      case 0x13:
13301330         dat = (fm7_alu.line_style & 0xff00) | data;
13311331         fm7_alu.line_style = dat;
1332//         logerror("ALU: write to line style (low) register - %02x (%04x)\n",data,fm7_alu.line_style);
1332//          logerror("ALU: write to line style (low) register - %02x (%04x)\n",data,fm7_alu.line_style);
13331333         break;
13341334      case 0x14:
13351335         dat = ((data & 0x03) << 8) | (fm7_alu.x0 & 0x00ff);
13361336         fm7_alu.x0 = dat;
1337//         logerror("ALU: write to X0 (high) register - %02x (%04x)\n",data,fm7_alu.x0);
1337//          logerror("ALU: write to X0 (high) register - %02x (%04x)\n",data,fm7_alu.x0);
13381338         break;
13391339      case 0x15:
13401340         dat = (fm7_alu.x0 & 0xff00) | data;
13411341         fm7_alu.x0 = dat;
1342//         logerror("ALU: write to X0 (low) register - %02x (%04x)\n",data,fm7_alu.x0);
1342//          logerror("ALU: write to X0 (low) register - %02x (%04x)\n",data,fm7_alu.x0);
13431343         break;
13441344      case 0x16:
13451345         dat = ((data & 0x01) << 8) | (fm7_alu.y0 & 0x00ff);
13461346         fm7_alu.y0 = dat;
1347//         logerror("ALU: write to Y0 (high) register - %02x (%04x)\n",data,fm7_alu.y0);
1347//          logerror("ALU: write to Y0 (high) register - %02x (%04x)\n",data,fm7_alu.y0);
13481348         break;
13491349      case 0x17:
13501350         dat = (fm7_alu.y0 & 0xff00) | data;
13511351         fm7_alu.y0 = dat;
1352//         logerror("ALU: write to Y0 (low) register - %02x (%04x)\n",data,fm7_alu.y0);
1352//          logerror("ALU: write to Y0 (low) register - %02x (%04x)\n",data,fm7_alu.y0);
13531353         break;
13541354      case 0x18:
13551355         dat = ((data & 0x03) << 8) | (fm7_alu.x1 & 0x00ff);
13561356         fm7_alu.x1 = dat;
1357//         logerror("ALU: write to X1 (high) register - %02x (%04x)\n",data,fm7_alu.x1);
1357//          logerror("ALU: write to X1 (high) register - %02x (%04x)\n",data,fm7_alu.x1);
13581358         break;
13591359      case 0x19:
13601360         dat = (fm7_alu.x1 & 0xff00) | data;
13611361         fm7_alu.x1 = dat;
1362//         logerror("ALU: write to X1 (low) register - %02x (%04x)\n",data,fm7_alu.x1);
1362//          logerror("ALU: write to X1 (low) register - %02x (%04x)\n",data,fm7_alu.x1);
13631363         break;
13641364      case 0x1a:
13651365         dat = ((data & 0x01) << 8) | (fm7_alu.y1 & 0x00ff);
13661366         fm7_alu.y1 = dat;
1367//         logerror("ALU: write to Y1 (high) register - %02x (%04x)\n",data,fm7_alu.y1);
1367//          logerror("ALU: write to Y1 (high) register - %02x (%04x)\n",data,fm7_alu.y1);
13681368         break;
13691369      case 0x1b:
13701370         dat = (fm7_alu.y1 & 0xff00) | data;
13711371         fm7_alu.y1 = dat;
13721372         // draw line
13731373         fm77av_line_draw(space->machine);
1374//         logerror("ALU: write to Y1 (low) register - %02x (%04x)\n",data,fm7_alu.y1);
1374//          logerror("ALU: write to Y1 (low) register - %02x (%04x)\n",data,fm7_alu.y1);
13751375         break;
13761376      default:
13771377         logerror("ALU: write 0x%02x to invalid register 0x%02x\n",data,offset);
r5932r5933
13971397{
13981398   UINT8* RAM = memory_region(space->machine,"maincpu");
13991399   UINT8* ROM;
1400   
1400
14011401   if(!fm7_video.sub_halt)
14021402      return 0xff;
1403     
1403
14041404   if(offset < 0x380)  // work RAM
14051405      return RAM[0x1d000+offset];
14061406   if(offset >= 0x380 && offset < 0x400) // shared RAM
r5932r5933
14121412      ROM = memory_region(space->machine,"subsyscg");
14131413      return ROM[(fm7_video.cgrom*0x800)+(offset-0x800)];
14141414   }
1415   
1415
14161416   if(offset >= 0x410 && offset <= 0x42b)
14171417      return fm77av_alu_r(space,offset-0x410);
1418   
1418
14191419   switch(offset)
14201420   {
14211421      case 0x400:
r5932r5933
14401440         return fm77av_key_encoder_r(space,offset-0x431);
14411441      default:
14421442         logerror("Unmapped read from sub CPU port 0xd%03x via MMR banking\n",offset);
1443         return 0xff;
1443         return 0xff;
14441444   }
14451445   return 0xff;
14461446}
r5932r5933
14671467      RAM[0x1d000+offset] = data;
14681468      return;
14691469   }
1470     
1470
14711471   if(offset >= 0x410 && offset <= 0x42b)
14721472   {
14731473      fm77av_alu_w(space,offset-0x410,data);
14741474      return;
14751475   }
1476     
1476
14771477   switch(offset)
14781478   {
14791479      case 0x408:
r5932r5933
15041504READ8_HANDLER( fm7_console_ram_banked_r )
15051505{
15061506   UINT8* RAM = memory_region(space->machine,"maincpu");
1507   
1507
15081508   if(!fm7_video.sub_halt)
15091509      return 0xff;
1510     
1510
15111511   return RAM[0x1c000+offset];
15121512}
15131513
15141514WRITE8_HANDLER( fm7_console_ram_banked_w )
15151515{
15161516   UINT8* RAM = memory_region(space->machine,"maincpu");
1517   
1517
15181518   if(!fm7_video.sub_halt)
15191519      return;
1520     
1520
15211521   RAM[0x1c000+offset] = data;
15221522}
15231523
r5932r5933
15471547    UINT16 col;
15481548    int y, x, b;
15491549    UINT16 page = 0x0000;
1550   
1550
15511551    if(fm7_video.display_video_page != 0)
15521552       page = 0xc000;
15531553
r5932r5933
15831583             }
15841584               for (b = 0; b < 8; b++)
15851585               {
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);
15871587                  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);
15881588                  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);
15891589               col += 8;  // use analog palette
r5932r5933
16291629PALETTE_INIT( fm7 )
16301630{
16311631   int x;
1632   
1632
16331633   palette_set_colors(machine, 0, fm7_initial_palette, ARRAY_LENGTH(fm7_initial_palette));
16341634   for(x=0;x<8;x++)
16351635      fm7_video.fm7_pal[x] = x;
src/mess/video/cdp1861.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
2222
2323
24         http://homepage.mac.com/ruske/cosmacelf/cdp1861.pdf
24           http://homepage.mac.com/ruske/cosmacelf/cdp1861.pdf
2525
2626**********************************************************************/
2727
src/mess/video/vtech2.c
r5932r5933
11/***************************************************************************
2   vtech2.c
2    vtech2.c
33
44    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
77
88****************************************************************************/
99
r5932r5933
137137      case  0:
138138      case  1:
139139         /*
140          * GR 5
141          * 640x192 1bpp
142          */
140             * GR 5
141             * 640x192 1bpp
142             */
143143         for( y = 0; y < 192; y++ )
144144         {
145145            offs = offs_2[y];
r5932r5933
156156
157157      case 2:
158158         /*
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             */
162162         for( y = 0; y < 192; y++ )
163163         {
164164            offs = offs_2[y];
r5932r5933
176176
177177      case  3:
178178         /*
179          * GR 3
180          * 160x192 4bpp
181          */
179             * GR 3
180             * 160x192 4bpp
181             */
182182         for( y = 0; y < 192; y++ )
183183         {
184184            offs = offs_2[y];
r5932r5933
196196      case  4:
197197      case  5:
198198         /*
199          * GR 0
200          * 160x96 4bpp
201          */
199             * GR 0
200             * 160x96 4bpp
201             */
202202         for( y = 0; y < 96; y++ )
203203         {
204204            offs = offs_0[y];
r5932r5933
215215
216216      case  6:
217217         /*
218          * GR 2
218            * GR 2
219219             * 320x192 1bpp
220220             */
221221         for( y = 0; y < 192; y++ )
r5932r5933
234234
235235      case  7:
236236         /*
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             */
240240         for( y = 0; y < 192; y++ )
241241         {
242242            offs = offs_1[y];
src/mess/video/kc.c
r5932r5933
1919};
2020
2121/*
22   foreground:
22    foreground:
2323
24      "full" of each component
24        "full" of each component
2525
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
3434
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
4343
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)
5454
5555 */
5656
r5932r5933
194194
195195/*
196196
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
201201*/
202202
203203/* Operation:
204204
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.
209209
210210
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
213213
214   - the event list is based on cpu time
214    - the event list is based on cpu time
215215
216216*/
217217
r5932r5933
305305         /* border */
306306         case 0:
307307         {
308         //   video_update->render_x+=(cycles_to_do)*8;
308         //  video_update->render_x+=(cycles_to_do)*8;
309309         }
310310         break;
311311
r5932r5933
345345         /* border */
346346         case 2:
347347         {
348         //   video_update->render_x+=(cycles_to_do)*8;
348         //  video_update->render_x+=(cycles_to_do)*8;
349349         }
350350         break;
351351
r5932r5933
441441         /* border */
442442         case 0:
443443         {
444   //         cycles_done = cycles_to_do;
444   //          cycles_done = cycles_to_do;
445445         }
446446         break;
447447
r5932r5933
461461         /* border */
462462         case 2:
463463         {
464   //         cycles_done = cycles_to_do;
464   //          cycles_done = cycles_to_do;
465465         }
466466         break;
467467
468468         /* not visible */
469469         case 3:
470470         {
471   //         cycles_done = cycles_to_do;
471   //          cycles_done = cycles_to_do;
472472         }
473473         break;
474474      }
src/mess/includes/fm7.h
r5932r5933
11/*
2 *
2 *
33 *  FM-7 header file
4 *
4 *
55 */
66
77#ifndef FM7_H_
src/mess/includes/cbm.h
r5932r5933
2525
2626/***********************************************
2727
28   CBM Quickloads
28    CBM Quickloads
2929
3030***********************************************/
3131
r5932r5933
4343
4444/***********************************************
4545
46   CBM Cartridges
46    CBM Cartridges
4747
4848***********************************************/
4949
r5932r5933
7676
7777/***********************************************
7878
79   CBM Datasette Tapes
79    CBM Datasette Tapes
8080
8181***********************************************/
8282
src/mess/includes/apple2gs.h
r5932r5933
11/*****************************************************************************
22 *
33 * includes/apple2gs.h
4 *
4 *
55 * Apple IIgs
66 *
77 ****************************************************************************/
src/mess/includes/apple3.h
r5932r5933
11/*****************************************************************************
22 *
33 * includes/apple3.h
4 *
4 *
55 * Apple ///
66 *
77 ****************************************************************************/
src/mess/includes/mac.h
r5932r5933
11/*****************************************************************************
22 *
33 * includes/mac.h
4 *
4 *
55 * Macintosh driver declarations
66 *
77 ****************************************************************************/
src/mess/includes/coco.h
r5932r5933
11/*****************************************************************************
22
3   includes/coco.h
3    includes/coco.h
44
5   CoCo/Dragon
5    CoCo/Dragon
66
77****************************************************************************/
88
src/mess/includes/b2m.h
r5932r5933
3030   UINT8 b2m_color[4];
3131   UINT8 b2m_localmachine;
3232   UINT8 vblank_state;
33   
33
3434   /* devices */
3535   const device_config *fdc;
3636   const device_config *pic;
src/mess/includes/vectrex.h
r5932r5933
4747WRITE8_HANDLER  ( raaspec_led_w );
4848
4949READ8_HANDLER ( vectrex_via_r );
50WRITE8_HANDLER ( vectrex_via_w );
50WRITE8_HANDLER ( vectrex_via_w );
5151
5252void vectrex_add_point_stereo (int x, int y, rgb_t color, int intensity);
5353void vectrex_add_point (int x, int y, rgb_t color, int intensity);
src/mess/includes/vc1541.h
r5932r5933
1212/*----------- defined in machine/vc1541.c -----------*/
1313
1414/* we currently have preliminary support for 1541 & 1551 only */
15enum {
15enum {
1616   type_1541 = 0,
1717   type_1541ii,
1818   type_1551,
r5932r5933
2929   type_8250,
3030};
3131
32enum {
32enum {
3333   format_d64 = 0,         /* 1541 image, 35 tracks */
3434   format_d64_err,         /* 1541 image, 35 tracks + error table */
3535   format_d64_40t,         /* 1541 image, 40 tracks */
r5932r5933
163163
164164
165165
166Note: according to additional docs at zimmers.net, ROMs in these drive
167were interchangeable: you could burn later revisions on EEPROM and put
166Note: according to additional docs at zimmers.net, ROMs in these drive
167were interchangeable: you could burn later revisions on EEPROM and put
168168them in older drives and they would work perfectly.
169169
170170****************************************************************************/
r5932r5933
177177   ROM_LOAD( "325303-01.ub3", 0xe000, 0x2000, CRC(10b39158) SHA1(56dfe79b26f50af4e83fd9604857756d196516b9) )
178178
179179/*
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
181181        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
183183        America (Japan only?).
184184    rev. 03 - It is said to be the first version that is usable in Europe (in the service manual?).
185185    rev. 05 - From an old-style 1541 with short board.
r5932r5933
264264****************************************************************************/
265265
266266// 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.
268268// this will be used later, when proper drives will be added to each system
269269#define C1570_ROM( cpu ) \
270270   ROM_REGION( 0x10000, cpu, 0) \
r5932r5933
292292    rev. 01 - First revision of 1581 firmware
293293    rev. 02 - Second revision of 1581 firmware
294294    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).
296296        Despite the label, is a 1581 firmaware
297297*/
298298#define C1581_ROM( cpu ) \
r5932r5933
369369
370370Notes: The DOS 2.7 ROM in SFD-1001 is the same as in 8250 drives. Differences:
371371
372CBM 8050 - dual 5" 1/4 floppy drive, disks are written on one side
373      with double density
374CBM   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
376SFD-1001 - single 5" 1/4 floppy drive, same as CBM 8250LP, but only
377      one drive and 1541-case
372CBM 8050 - dual 5" 1/4 floppy drive, disks are written on one side
373        with double density
374CBM 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
376SFD-1001 - single 5" 1/4 floppy drive, same as CBM 8250LP, but only
377        one drive and 1541-case
378378
379379****************************************************************************/
380380
r5932r5933
422422****************************************************************************/
423423
424424#define C4040_ROM( cpu )   \
425   ROM_REGION( 0x10000, cpu, 0 )   
425   ROM_REGION( 0x10000, cpu, 0 )
426426
427427// still to be sorted out
428428
r5932r5933
463463drive                   Tandon TM603S (9090)
464464
465465
466Note: The Commodore D9060 and D9090 can use the same firmware. The
467difference between these units is that the jumper J14 on the DOS board
468is open in the D9060, and closed in the D9090 to select a 4-head vs.
466Note: The Commodore D9060 and D9090 can use the same firmware. The
467difference between these units is that the jumper J14 on the DOS board
468is open in the D9060, and closed in the D9090 to select a 4-head vs.
4694696-head drive. The jumper J13 seems to be unused.
470470
471471****************************************************************************/
r5932r5933
488488
489489/****************************************************************************
490490
491   Dual 8" floppy drive. Related to any other drive? What about 8060?
491    Dual 8" floppy drive. Related to any other drive? What about 8060?
492492
493493****************************************************************************/
494494
src/mess/includes/lisa.h
r5932r5933
11/*****************************************************************************
22 *
33 * includes/lisa.h
4 *
4 *
55 * Lisa driver declarations
66 *
77 ****************************************************************************/
src/mess/includes/cgenie.h
r5932r5933
6363
6464// CRTC 6845
6565typedef struct
66{         
66{
6767   UINT8    cursor_address_lo;
6868   UINT8    cursor_address_hi;
6969   UINT8    screen_address_lo;
src/mess/includes/c128.h
r5932r5933
11/*****************************************************************************
22 *
33 * includes/c128.h
4 *
4 *
55 * Commodore C128 Home Computer
6 *
6 *
77 * peter.trauner@jk.uni-linz.ac.at
88 *
99 * Documentation: iDOC (http://www.softwolves.pp.se/idoc)
1010 *   Christian Janoff <mepk@c64.org>
11 *
11 *
1212 ****************************************************************************/
1313
1414#ifndef C128_H_
src/mess/includes/electron.h
r5932r5933
3838   int screen_mode;
3939   int cassette_motor_mode;
4040   int capslock_mode;
41//   int scanline;
41//  int scanline;
4242   /* tape reading related */
4343   UINT32 tape_value;
4444   int tape_steps;
src/mess/includes/abc80x.h
r5932r5933
4444
4545   /* keyboard state */
4646   int abc77_txd;            /* ABC-77 transmit data */
47   
47
4848   /* video state */
4949   UINT8 *charram;            /* character RAM */
5050   UINT8 *videoram;         /* HR video RAM */
src/mess/includes/orion.h
r5932r5933
1313
1414extern UINT8 orion128_video_mode;
1515extern UINT8 orion128_video_page;
16extern UINT8 orion128_video_width; 
16extern UINT8 orion128_video_width;
1717extern UINT8 orion_video_mode_mask ;
1818extern UINT8 orionpro_pseudo_color;
1919
r5932r5933
3131extern READ8_HANDLER ( orion128_system_r );
3232extern WRITE8_HANDLER ( orion128_system_w );
3333extern READ8_HANDLER ( orion128_romdisk_r );
34extern WRITE8_HANDLER ( orion128_romdisk_w );   
35extern WRITE8_HANDLER ( orion128_video_mode_w );   
36extern WRITE8_HANDLER ( orion128_memory_page_w );   
34extern WRITE8_HANDLER ( orion128_romdisk_w );
35extern WRITE8_HANDLER ( orion128_video_mode_w );
36extern WRITE8_HANDLER ( orion128_memory_page_w );
3737extern WRITE8_HANDLER ( orion128_video_page_w );
3838extern WRITE8_HANDLER ( orionz80_memory_page_w );
3939extern WRITE8_HANDLER ( orionz80_dispatcher_w );
r5932r5933
4848extern MACHINE_RESET( orionpro );
4949extern READ8_HANDLER ( orionpro_io_r );
5050extern WRITE8_HANDLER ( orionpro_io_w );
51   
51
5252/*----------- defined in video/orion.c -----------*/
5353
5454extern VIDEO_START( orion128 );
src/mess/includes/bebox.h
r5932r5933
11/*****************************************************************************
22 *
33 * includes/bebox.h
4 *
4 *
55 * BeBox
66 *
77 ****************************************************************************/
src/mess/includes/kyocera.h
r5932r5933
1010#define CASSETTE_TAG   "cassette"
1111#define CENTRONICS_TAG   "centronics"
1212
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"
1616#define RP5C01A_TAG      "m301"
1717#define TCM5089_TAG      "m11"
1818#define HD61830_TAG      "m18"
src/mess/includes/mz80.h
r5932r5933
1414extern READ8_HANDLER( mz80k_strobe_r );
1515extern WRITE8_HANDLER( mz80k_strobe_w );
1616
17extern const i8255a_interface mz80k_8255_int;   
17extern const i8255a_interface mz80k_8255_int;
1818extern const struct pit8253_config mz80k_pit8253_config;
1919
2020extern UINT8 mz80k_vertical;
src/mess/includes/cybiko.h
r5932r5933
11/*****************************************************************************
22 *
33 * includes/cybiko.h
4 *
4 *
55 * Cybiko Wireless Inter-tainment System
6 *
6 *
77 * (c) 2001-2007 Tim Schuerewegen
8 *
8 *
99 * Cybiko Classic (V1)
1010 * Cybiko Classic (V2)
1111 * Cybiko Xtreme
src/mess/includes/c64.h
r5932r5933
11/*****************************************************************************
22 *
33 * includes/c64.h
4 *
4 *
55 * Commodore C64 Home Computer
6 *
6 *
77 * peter.trauner@jk.uni-linz.ac.at
8 *
8 *
99 * Documentation: www.funet.fi
1010 *
1111 ****************************************************************************/
src/mess/includes/genesis.h
r5932r5933
11/*****************************************************************************
22 *
3 *   includes/genesis.h
3 *  includes/genesis.h
44 *
55 ****************************************************************************/
66
src/mess/includes/pecom.h
r5932r5933
1313{
1414   UINT8 *page_ram;      /* page memory */
1515   UINT8 *charram;         /* character generator ROM */
16   int cdp1802_mode;      /* CPU mode */   
16   int cdp1802_mode;      /* CPU mode */
1717   int dma;            /* memory refresh DMA */
1818   const device_config *cdp1869;
1919
2020   /* timers */
2121   emu_timer *reset_timer;   /* power on reset timer */
22   
22
2323};
2424
2525/*----------- defined in machine/pecom.c -----------*/
src/mess/machine/strata.c
r5932r5933
11/*
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)
44
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.
77
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)
1010
11   Raphael Nabet 2004, based on MAME's intelfsh.c core
11    Raphael Nabet 2004, based on MAME's intelfsh.c core
1212*/
1313
1414#include "driver.h"
r5932r5933
6464#define CLEAR_BLOCKLOCK(id, block) (strata[(id)].blocklock[(block) >> 3] &= ~(1 << ((block) & 7)))
6565
6666/*
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)
6969*/
7070int strataflash_init(running_machine *machine, int id)
7171{
r5932r5933
9797}
9898
9999/*
100   load the FEEPROM contents from file
100    load the FEEPROM contents from file
101101*/
102102int strataflash_load(int id, mame_file *file)
103103{
r5932r5933
147147}
148148
149149/*
150   save the FEEPROM contents to file
150    save the FEEPROM contents to file
151151*/
152152int strataflash_save(int id, mame_file *file)
153153{
r5932r5933
166166      return 1;
167167
168168   /* chip state: lower boot block lockout, higher boot block lockout,
169   software data protect */
169    software data protect */
170170   buf = strata[id].master_lock;
171171   if (mame_fwrite(file, & buf, 1) != 1)
172172      return 1;
r5932r5933
214214} bus_width_t;
215215
216216/*
217   read a 8/16-bit word from FEEPROM
217    read a 8/16-bit word from FEEPROM
218218*/
219219static int strataflash_r(int id, offs_t offset, bus_width_t bus_width)
220220{
r5932r5933
294294         }
295295         return 0;   // default case
296296      /*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        */
302302
303303      /* CFI query identification string */
304304      case 0x10:
r5932r5933
410410}
411411
412412/*
413   write a 8/16-bit word to FEEPROM
413    write a 8/16-bit word to FEEPROM
414414*/
415415static void strataflash_w(int id, offs_t offset, int data, bus_width_t bus_width)
416416{
r5932r5933
656656}
657657
658658/*
659   read a 8-bit word from FEEPROM
659    read a 8-bit word from FEEPROM
660660*/
661661UINT8 strataflash_8_r(int id, offs_t offset)
662662{
r5932r5933
664664}
665665
666666/*
667   write a 8-bit word to FEEPROM
667    write a 8-bit word to FEEPROM
668668*/
669669void strataflash_8_w(int id, offs_t offset, UINT8 data)
670670{
r5932r5933
672672}
673673
674674/*
675   read a 16-bit word from FEEPROM
675    read a 16-bit word from FEEPROM
676676*/
677677UINT16 strataflash_16_r(int id, offs_t offset)
678678{
r5932r5933
680680}
681681
682682/*
683   write a 16-bit word to FEEPROM
683    write a 16-bit word to FEEPROM
684684*/
685685void strataflash_16_w(int id, offs_t offset, UINT16 data)
686686{
src/mess/machine/upd7201.c
r5932r5933
11/**********************************************************************
22
3    NEC µPD7201 Multiprotocol Serial Communications Controller emulation
3    NEC ?PD7201 Multiprotocol Serial Communications Controller emulation
44
55    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
r5932r5933
110110
111111static DEVICE_START( upd7201 )
112112{
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);
115115
116116   /* resolve callbacks */
117117
r5932r5933
120120   /* create the timers */
121121
122122   /* register for state saving */
123//   state_save_register_device_item(device, 0, upd7201->);
123//  state_save_register_device_item(device, 0, upd7201->);
124124}
125125
126126/*-------------------------------------------------
r5932r5933
142142      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
143143
144144      /* --- 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;
147147      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
148148      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
149149      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
src/mess/machine/strata.h
r5932r5933
11/*
2   strata.h: header file for strata.c
2    strata.h: header file for strata.c
33*/
44
55int strataflash_init(running_machine *machine, int id);
src/mess/machine/dgn_beta.c
r5932r5933
22
33  machine\dgn_beta.c (machine.c)
44
5   Moved out of dragon.c, 2005-05-05, P.Harvey-Smith.
5    Moved out of dragon.c, 2005-05-05, P.Harvey-Smith.
66
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).
1010
1111  Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
1212  I/O ports)
1313
1414  References:
15   Disassembly of Dragon Beta ROM, examination of only (known) surviving board.
15    Disassembly of Dragon Beta ROM, examination of only (known) surviving board.
1616
1717  TODO:
18   Pretty much everything !
18    Pretty much everything !
1919
20   Display working with 6845 taking data from rom.
20    Display working with 6845 taking data from rom.
2121
2222  2005-05-10
23   Memory banking seems to be working, as documented in code comments below.
23    Memory banking seems to be working, as documented in code comments below.
2424
2525  2005-05-31
26   CPU#2 now executes code correctly to do transfers from WD2797.
26    CPU#2 now executes code correctly to do transfers from WD2797.
2727
2828  2005-06-03
2929
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.
3333
3434  2005-11-29
3535
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.
3939
4040  2005-12-07
4141
42   First booted to OS9 prompt, did not execute startup scripts.
42    First booted to OS9 prompt, did not execute startup scripts.
4343
4444  2005-12-08
4545
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.
5151
5252  2006-09-27
5353
54   Clean up of IRQ/FIRQ handling code allows correct booting again.
54    Clean up of IRQ/FIRQ handling code allows correct booting again.
5555
5656***************************************************************************/
5757
r5932r5933
131131static int d_pia1_pa_last;
132132static int d_pia1_pb_last;
133133static int DMA_NMI_LAST;
134//static int DMA_NMI;            /* DMA cpu has received an NMI */
134//static int DMA_NMI;               /* DMA cpu has received an NMI */
135135
136136#define INVALID_KEYROW   -1         /* no ketrow selected */
137137#define NO_KEY_PRESSED   0x7F         /* retrurned by hardware if no key pressed */
r5932r5933
151151      DEVCB_NULL,
152152      DEVCB_NULL,
153153      DEVCB_NULL,
154      /*outputs: A/B,CA/B2      */
154      /*outputs: A/B,CA/B2       */
155155      DEVCB_HANDLER(d_pia0_pa_w),
156156      DEVCB_HANDLER(d_pia0_pb_w),
157157      DEVCB_NULL,
158158      DEVCB_HANDLER(d_pia0_cb2_w),
159      /*irqs    : A/B         */
159      /*irqs   : A/B         */
160160      DEVCB_LINE(d_pia0_irq_a),
161161      DEVCB_LINE(d_pia0_irq_b)
162162   },
r5932r5933
170170      DEVCB_NULL,
171171      DEVCB_NULL,
172172      DEVCB_NULL,
173      /*outputs: A/B,CA/B2      */
173      /*outputs: A/B,CA/B2       */
174174      DEVCB_HANDLER(d_pia1_pa_w),
175175      DEVCB_HANDLER(d_pia1_pb_w),
176176      DEVCB_NULL,
177177      DEVCB_NULL,
178      /*irqs    : A/B         */
178      /*irqs   : A/B         */
179179      DEVCB_LINE(d_pia1_irq_a),
180180      DEVCB_LINE(d_pia1_irq_b)
181181   },
r5932r5933
191191      DEVCB_NULL,
192192      DEVCB_NULL,
193193      DEVCB_NULL,
194      /*outputs: A/B,CA/B2      */
194      /*outputs: A/B,CA/B2       */
195195      DEVCB_HANDLER(d_pia2_pa_w),
196196      DEVCB_HANDLER(d_pia2_pb_w),
197197      DEVCB_NULL,
198198      DEVCB_NULL,
199      /*irqs    : A/B            */
199      /*irqs   : A/B         */
200200      DEVCB_LINE(d_pia2_irq_a),
201201      DEVCB_LINE(d_pia2_irq_b)
202202   }
r5932r5933
491491of the output shift register that is zero, most of the time there should
492492only be one row active e.g.
493493
494Shifter      Row being scanned
4951111111110   0
4961111111101   1
4971111111011   2
494Shifter     Row being scanned
4951111111110  0
4961111111101  1
4971111111011  2
498498
499499etc.
500500
r5932r5933
548548
549549/*********************************** PIA Handlers ************************/
550550/* 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
564564*/
565565static READ8_DEVICE_HANDLER(d_pia0_pa_r)
566566{
r5932r5933
576576   int RetVal;
577577   int Idx;
578578   int Selected;
579   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4",
579   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4",
580580                              "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
581   
581
582582   LOG_KEYBOARD(("PB Read\n"));
583583
584584   KAny_next = 0;
r5932r5933
617617static WRITE8_DEVICE_HANDLER(d_pia0_pb_w)
618618{
619619   int   InClkState;
620   //int   OutClkState;
620   //int   OutClkState;
621621
622622   LOG_KEYBOARD(("PB Write\n"));
623623
624624   InClkState   = data & KInClk;
625   //OutClkState   = data & KOutClk;
625   //OutClkState   = data & KOutClk;
626626
627627   LOG_KEYBOARD(("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(d_pia0_pb_last & KInClk),Keyrow));
628628
r5932r5933
675675}
676676
677677/* 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 ????
685685*/
686686
687687static READ8_DEVICE_HANDLER(d_pia1_pa_r)
r5932r5933
693693{
694694   int   HALT_DMA;
695695   const device_config *fdc = devtag_get_device(device->machine, "wd179x");
696   
696
697697   /* Only play with halt line if halt bit changed since last write */
698698   if((data & 0x80) != d_pia1_pa_last)
699699   {
r5932r5933
768768}
769769
770770/* PIA #2 at FCC0-FCC3 I28
771   This handles :-
772      DAT task select   PA0..PA3
771    This handles :-
772        DAT task select PA0..PA3
773773
774      DMA CPU NMI   PA7
774        DMA CPU NMI PA7
775775
776      Graphics control PB0..PB7 ???
777      VSYNC intutrupt CB2
776        Graphics control PB0..PB7 ???
777        VSYNC intutrupt CB2
778778*/
779779static READ8_DEVICE_HANDLER(d_pia2_pa_r)
780780{
r5932r5933
10121012#if 0
10131013   int   Idx;
10141014   int   Row;
1015   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4",
1015   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4",
10161016                              "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
1017   
1017
10181018   LOG_KEYBOARD(("Scanning Host keyboard\n"));
10191019
10201020   for(Idx=0; Idx<NoKeyrows; Idx++)
r5932r5933
10561056
10571057void dgn_beta_line_interrupt (int data)
10581058{
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//  }
10681068}
10691069
10701070
r5932r5933
11071107   KAny_next = 0x00;         /* Next value for KAny */
11081108
11091109   DMA_NMI_LAST = 0x80;      /* start with DMA NMI inactive, as pulled up */
1110//   DMA_NMI = CLEAR_LINE;      /* start with DMA NMI inactive */
1110//  DMA_NMI = CLEAR_LINE;       /* start with DMA NMI inactive */
11111111
11121112   wd17xx_set_density(fdc, DEN_MFM_LO);
11131113   wd17xx_set_drive(fdc, 0);
src/mess/machine/pdp1.c
r5932r5933
11/*
2   pdp1 machine code
2    pdp1 machine code
33
4   includes emulation for I/O devices (with the IOT opcode) and control panel functions
4    includes emulation for I/O devices (with the IOT opcode) and control panel functions
55
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?
1010*/
1111
1212#include <stdio.h>
r5932r5933
4747
4848
4949/*
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)
6060
61   This list should probably include additional optional devices (card reader comes to mind).
61    This list should probably include additional optional devices (card reader comes to mind).
6262*/
6363
6464/* IO status word */
r5932r5933
181181static void pdp1_machine_stop(running_machine *machine)
182182{
183183   /* the core will take care of freeing the timers, BUT we must set the variables
184   to NULL if we don't want to risk confusing the tape image init function */
184    to NULL if we don't want to risk confusing the tape image init function */
185185   tape_reader.timer = tape_puncher.timer = typewriter.tyo_timer = dpy_timer = NULL;
186186}
187187
188188
189189/*
190   driver init function
190    driver init function
191191
192   Set up the pdp1_memory pointer, and generate font data.
192    Set up the pdp1_memory pointer, and generate font data.
193193*/
194194MACHINE_START( pdp1 )
195195{
r5932r5933
348348
349349
350350/*
351   perforated tape handling
351    perforated tape handling
352352*/
353353
354354void pdp1_get_open_mode(int id, unsigned int *readable, unsigned int *writeable, unsigned int *creatable)
r5932r5933
377377
378378
379379/*
380   Open a perforated tape image
380    Open a perforated tape image
381381
382   unit 0 is reader (read-only), unit 1 is puncher (write-only)
382    unit 0 is reader (read-only), unit 1 is puncher (write-only)
383383*/
384384DEVICE_IMAGE_LOAD( pdp1_tape )
385385{
r5932r5933
396396
397397      /* restart reader IO when necessary */
398398      /* 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! */
401401      if (tape_reader.timer)
402402      {
403403         if (tape_reader.motor_on && tape_reader.rcl)
r5932r5933
446446}
447447
448448/*
449   Read a byte from perforated tape
449    Read a byte from perforated tape
450450*/
451451static int tape_read(UINT8 *reply)
452452{
r5932r5933
457457}
458458
459459/*
460   Write a byte to perforated tape
460    Write a byte to perforated tape
461461*/
462462static void tape_write(UINT8 data)
463463{
r5932r5933
466466}
467467
468468/*
469   common code for tape read commands (RPA, RPB, and read-in mode)
469    common code for tape read commands (RPA, RPB, and read-in mode)
470470*/
471471static void begin_tape_read(int binary, int nac)
472472{
r5932r5933
494494}
495495
496496/*
497   timer callback to simulate reader IO
497    timer callback to simulate reader IO
498498*/
499499static TIMER_CALLBACK(reader_callback)
500500{
r5932r5933
544544}
545545
546546/*
547   timer callback to generate punch completion pulse
547    timer callback to generate punch completion pulse
548548*/
549549static TIMER_CALLBACK(puncher_callback)
550550{
r5932r5933
557557}
558558
559559/*
560   Initiate read of a 18-bit word in binary format from tape (used in read-in mode)
560    Initiate read of a 18-bit word in binary format from tape (used in read-in mode)
561561*/
562562void pdp1_tape_read_binary(const device_config *device)
563563{
r5932r5933
565565}
566566
567567/*
568   perforated tape reader iot callbacks
568    perforated tape reader iot callbacks
569569*/
570570
571571/*
572   rpa iot callback
572    rpa iot callback
573573
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
579579*/
580580/*
581581 * Read Perforated Tape, Alphanumeric
r5932r5933
600600}
601601
602602/*
603   rpb iot callback
603    rpb iot callback
604604*/
605605/*
606606 * Read Perforated Tape, Binary rpb
r5932r5933
637637}
638638
639639/*
640   rrb iot callback
640    rrb iot callback
641641*/
642642void iot_rrb(const device_config *device, int op2, int nac, int mb, int *io, int ac)
643643{
r5932r5933
649649}
650650
651651/*
652   perforated tape punch iot callbacks
652    perforated tape punch iot callbacks
653653*/
654654
655655/*
656   ppa iot callback
656    ppa iot callback
657657*/
658658/*
659659 * Punch Perforated Tape, Alphanumeric
r5932r5933
680680}
681681
682682/*
683   ppb iot callback
683    ppb iot callback
684684*/
685685/*
686686 * Punch Perforated Tape, Binary
r5932r5933
708708
709709
710710/*
711   Typewriter handling
711    Typewriter handling
712712
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.
715715*/
716716
717717/*
718   Open a file for typewriter output
718    Open a file for typewriter output
719719*/
720720DEVICE_IMAGE_LOAD(pdp1_typewriter)
721721{
r5932r5933
733733}
734734
735735/*
736   Write a character to typewriter
736    Write a character to typewriter
737737*/
738738static void typewriter_out(running_machine *machine, UINT8 data)
739739{
r5932r5933
841841}
842842
843843/*
844   timer callback to generate typewriter completion pulse
844    timer callback to generate typewriter completion pulse
845845*/
846846static TIMER_CALLBACK(tyo_callback)
847847{
r5932r5933
854854}
855855
856856/*
857   tyo iot callback
857    tyo iot callback
858858*/
859859void iot_tyo(const device_config *device, int op2, int nac, int mb, int *io, int ac)
860860{
r5932r5933
896896}
897897
898898/*
899   tyi iot callback
899    tyi iot callback
900900*/
901901/* When a typewriter key is struck, the code for the struck key is placed in the
902902 * typewriter buffer, Program Flag 1 is set, and the type-in status bit is set to
r5932r5933
961961
962962
963963/*
964   timer callback to generate crt completion pulse
964    timer callback to generate crt completion pulse
965965*/
966966static TIMER_CALLBACK(dpy_callback)
967967{
r5932r5933
970970
971971
972972/*
973   dpy iot callback
973    dpy iot callback
974974
975   Light on one pixel on CRT
975    Light on one pixel on CRT
976976*/
977977void iot_dpy(const device_config *device, int op2, int nac, int mb, int *io, int ac)
978978{
r5932r5933
10001000      if (LOG_IOT_OVERLAP)
10011001      {
10021002         /* note that overlap detection is incomplete: it will only work if both DPY
1003         instructions require a completion pulse */
1003            instructions require a completion pulse */
10041004         if (timer_enable(dpy_timer, 0))
10051005            logerror("Error: overlapped DPY instruction: mb=0%06o, (%s)\n", (unsigned) mb, cpuexec_describe_context(device->machine));
10061006      }
r5932r5933
10111011
10121012
10131013/*
1014   MIT parallel drum (variant of type 23)
1014    MIT parallel drum (variant of type 23)
10151015*/
10161016
10171017static void parallel_drum_set_il(int il)
r5932r5933
10471047#endif
10481048
10491049/*
1050   Open a file for drum
1050    Open a file for drum
10511051*/
10521052DEVICE_IMAGE_LOAD(pdp1_drum)
10531053{
r5932r5933
10791079}
10801080
10811081/*
1082   Read a word from drum
1082    Read a word from drum
10831083*/
10841084static UINT32 drum_read(int field, int position)
10851085{
r5932r5933
10931093}
10941094
10951095/*
1096   Write a word to drum
1096    Write a word to drum
10971097*/
10981098static void drum_write(int field, int position, UINT32 data)
10991099{
r5932r5933
11621162
11631163
11641164/*
1165   iot 11 callback
1165    iot 11 callback
11661166
1167   Read state of Spacewar! controllers
1167    Read state of Spacewar! controllers
11681168
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.
11741174*/
11751175void iot_011(const device_config *device, int op2, int nac, int mb, int *io, int ac)
11761176{
r5932r5933
12071207
12081208
12091209/*
1210   cks iot callback
1210    cks iot callback
12111211
1212   check IO status
1212    check IO status
12131213*/
12141214void iot_cks(const device_config *device, int op2, int nac, int mb, int *io, int ac)
12151215{
r5932r5933
12211221
12221222
12231223/*
1224   callback which is called when Start Clear is pulsed
1224    callback which is called when Start Clear is pulsed
12251225
1226   IO devices should reset
1226    IO devices should reset
12271227*/
12281228void pdp1_io_sc_callback(const device_config *device)
12291229{
r5932r5933
12451245
12461246
12471247/*
1248   typewriter keyboard handler
1248    typewriter keyboard handler
12491249*/
12501250static void pdp1_keyboard(running_machine *machine)
12511251{
r5932r5933
13401340}
13411341
13421342/*
1343   Not a real interrupt - just handle keyboard input
1343    Not a real interrupt - just handle keyboard input
13441344*/
13451345INTERRUPT_GEN( pdp1_interrupt )
13461346{
r5932r5933
13941394      {
13951395         cpu_set_reg(device, PDP1_RUN, 0);
13961396         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) */
13991399      }
14001400      if (control_transitions & pdp1_continue)
14011401      {
src/mess/machine/upd7201.h
r5932r5933
11/**********************************************************************
22
3    NEC µPD7201 Multiprotocol Serial Communications Controller emulation
3    NEC ?PD7201 Multiprotocol Serial Communications Controller emulation
44
55    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3030
3131**********************************************************************/
3232
src/mess/machine/homelab.c
r5932r5933
11/***************************************************************************
22
3      Homelab machine driver by Miodrag Milanovic
3        Homelab machine driver by Miodrag Milanovic
44
5      31/08/2008 Preliminary driver.
6           
5        31/08/2008 Preliminary driver.
6
77****************************************************************************/
88
99
1010#include "driver.h"
1111#include "includes/homelab.h"
12   
12
1313/* Driver initialization */
1414DRIVER_INIT(homelab)
1515{
src/mess/machine/gdrom.c
r5932r5933
2929
3030static UINT8 GDROM_Cmd11_Reply[32] =
3131{
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,
3333   0x20, 0x20, 0x52, 0x65, 0x76, 0x20, 0x36, 0x2E, 0x34, 0x32, 0x39, 0x39, 0x30, 0x33, 0x31, 0x36
3434};
3535
r5932r5933
6060
6161   switch ( command[0] )
6262   {
63     
6463
64
6565      case 0x03: // REQUEST SENSE
6666         SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN );
6767         return SCSILengthFromUINT8( &command[ 4 ] );
r5932r5933
7272            command[0], command[1],
7373            command[2], command[3],
7474            command[4], command[5]);
75//         if (SCSILengthFromUINT8( &command[ 4 ] ) < 32) return -1;
75//          if (SCSILengthFromUINT8( &command[ 4 ] ) < 32) return -1;
7676         return 32; //SCSILengthFromUINT8( &command[ 4 ] );
7777
7878      case 0x12: // INQUIRY
r5932r5933
137137         {
138138            fatalerror("GDROM: MSF mode used for CD_READ, unsupported\n");
139139            return 0;
140         }
140         }
141141         else
142142         {
143143            our_this->lba = (command[2]<<16 | command[3]<<8 | command[4]) - 150;
src/mess/machine/ataricrt.c
r5932r5933
11/***************************************************************************
22
3   MESS specific Atari init and Cartridge code for Atari 8 bit systems
3    MESS specific Atari init and Cartridge code for Atari 8 bit systems
44
55***************************************************************************/
66
r5932r5933
9494{
9595   offs_t ram_top;
9696   offs_t ram_size;
97   
97
9898   /* set atari type (needed for banks above) */
9999   atari = type;
100100
src/mess/machine/applefdc.c
r5932r5933
11/*********************************************************************
22
3   applefdc.c
3    applefdc.c
44
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
88
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.
1111
12   Nate Woods
13   Raphael Nabet
12    Nate Woods
13    Raphael Nabet
1414
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.
1717
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?
3535
3636*********************************************************************/
3737
r5932r5933
7070/***************************************************************************
7171    IWM MODE
7272
73   The IWM mode has the following values:
73    The IWM mode has the following values:
7474
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)
9393
9494 ***************************************************************************/
9595
r5932r5933
157157   static const applefdc_interface dummy_interface = {0, };
158158
159159   assert_is_applefdc(device);
160   return (device->static_config != NULL)
160   return (device->static_config != NULL)
161161      ? (const applefdc_interface *) device->static_config
162162      : &dummy_interface;
163163}
r5932r5933
253253   const applefdc_interface *intf = get_interface(device);
254254
255255   /* 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     */
262262
263263   status = iwm_enable2(device) ? 1 : (intf->read_status ? intf->read_status(device) : 0);
264264
r5932r5933
308308         else
309309         {
310310            /*
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                 */
315315            if (LOG_APPLEFDC)
316316            {
317317               if ((fdc->mode & IWM_MODE_LATCHMODE) == 0x00)
r5932r5933
329329
330330      case IWM_Q7:
331331         /* Classic Apple II: Read status register
332          * IWM: Read handshake register
333          */
332             * IWM: Read handshake register
333             */
334334         if (fdc->type == APPLEFDC_APPLE2)
335335            result = applefdc_statusreg_r(device);
336336         else
r5932r5933
361361         else if (!iwm_enable2(device))
362362         {
363363            /*
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                 */
368368            if (LOG_APPLEFDC)
369369            {
370370               if ((fdc->mode & IWM_MODE_LATCHMODE) == 0)
r5932r5933
382382
383383/*-------------------------------------------------
384384    TIMER_CALLBACK(iwm_turnmotor_onoff) - timer
385   callback for turning motor on or off
385    callback for turning motor on or off
386386-------------------------------------------------*/
387387
388388static TIMER_CALLBACK(iwm_turnmotor_onoff)
src/mess/machine/conkort.c
r5932r5933
8855 21046-03
99
1010|-----------------------------------|
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|                                   |
3838|--|-----------------------------|--|
3939   |------------CON1-------------|
4040
r5932r5933
4343
4444    ROM     - Toshiba TMM27128D-20 16Kx8 EPROM "CNTR 1.07 6490318-07"
4545    TC5565  - Toshiba TC5565PL-15 8Kx8 bit Static RAM
46    Z80       - Zilog Z8400APS Z80A CPU Central Processing Unit
46    Z80     - Zilog Z8400APS Z80A CPU Central Processing Unit
4747    Z80DMA  - Zilog Z8410APS Z80A DMA Direct Memory Access Controller
4848    SAB1793 - Siemens SAB1793-02P Floppy Disc Controller
4949    FDC9229 - SMC FDC9229BT Floppy Disc Interface Circuit
5050    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
6565
6666*/
6767
6868/*
6969
70   TODO:
70    TODO:
7171
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
7979
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
8585
8686*/
8787
r5932r5933
252252{
253253   /*
254254
255      bit      description
255        bit     description
256256
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
265265
266   */
266    */
267267
268268   slow_t *conkort = get_safe_token_machine_slow(space->machine);
269269
270270   /* drive selection */
271271   if (!BIT(data, 0)) wd17xx_set_drive(conkort->wd1791, 0);
272272   if (!BIT(data, 1)) wd17xx_set_drive(conkort->wd1791, 1);
273//   if (!BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2);
273//  if (!BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2);
274274
275275   /* motor enable */
276276   floppy_drive_set_motor_state(get_floppy_image(space->machine, 0), !BIT(data, 3));
r5932r5933
292292{
293293   /*
294294
295      bit      description
295        bit     description
296296
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
305305
306   */
306    */
307307
308308   slow_t *conkort = get_safe_token_machine_slow(space->machine);
309309
r5932r5933
434434   AM_RANGE(0x0f, 0x0f) AM_READ(fast_data_r)
435435   AM_RANGE(0x1f, 0x1f) AM_WRITE(fast_data_w)
436436   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()
439439   AM_RANGE(0x5d, 0x5d) AM_READ(fast_ctrl_r)
440440   AM_RANGE(0x68, 0x6b) AM_DEVREAD(SAB1793_TAG, wd17xx_r)
441441   AM_RANGE(0x78, 0x7b) AM_DEVWRITE(SAB1793_TAG, wd17xx_w)
r5932r5933
520520{
521521   /*
522522
523      bit      description
523        bit     description
524524
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
533533
534   */
534    */
535535
536536   slow_t *conkort = get_safe_token_machine_slow(device->machine);
537537
r5932r5933
542542{
543543   /*
544544
545      bit      description
545        bit     description
546546
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
555555
556   */
556    */
557557
558558}
559559
r5932r5933
585585
586586/*
587587
588   DMA Transfer Programs
589   ---------------------
588    DMA Transfer Programs
589    ---------------------
590590
591   C3 14 28 95 6B 02 8A CF 01 AF CF 87
591    C3 14 28 95 6B 02 8A CF 01 AF CF 87
592592
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
605605
606   C3 14 28 95 7B 02 8A CF 05 AF CF 87
606    C3 14 28 95 7B 02 8A CF 05 AF CF 87
607607
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
620620
621   C3 91 40 8A AB
621    C3 91 40 8A AB
622622
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
628628
629629*/
630630
r5932r5933
716716
717717static const wd17xx_interface slow_wd17xx_interface =
718718{
719   slow_wd1791_callback,
719   slow_wd1791_callback,
720720   NULL,
721721   {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3}
722722};
r5932r5933
742742   }
743743}
744744
745static const wd17xx_interface fast_wd17xx_interface =
746{
745static const wd17xx_interface fast_wd17xx_interface =
746{
747747   fast_wd1793_callback,
748748   NULL,
749749   {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3}
src/mess/machine/ap2_slot.c
r5932r5933
11/*********************************************************************
22
3   ap2_slot.c
3    ap2_slot.c
44
5   Implementation of Apple II device slots
5    Implementation of Apple II device slots
66
77*********************************************************************/
88
r5932r5933
6363
6464   assert((slotnum >= 0) && (slotnum <= 7));
6565   snprintf(buffer, ARRAY_LENGTH(buffer), "slot_%d", slotnum);
66   
66
6767   return devtag_get_device(machine, buffer);
6868}
6969
r5932r5933
7171
7272/*-------------------------------------------------
7373    DEVICE_START(apple2_slot) - device start
74   function
74    function
7575-------------------------------------------------*/
7676
7777static DEVICE_START(apple2_slot)
r5932r5933
135135
136136/*-------------------------------------------------
137137    DEVICE_GET_INFO(apple2_slot) - device get info
138   function
138    function
139139-------------------------------------------------*/
140140
141141DEVICE_GET_INFO(apple2_slot)
src/mess/machine/hp48.c
r5932r5933
88
99#include "driver.h"
1010#include "timer.h"
11#include "state.h"
11#include "state.h"
1212#include "device.h"
1313#include "sound/dac.h"
1414#include "cpu/saturn/saturn.h"
r5932r5933
102102/* from highest to lowest priority: HDW, NCE2, CE1, CE2, NCE3, NCE1 */
103103static hp48_module hp48_modules[6];
104104
105static const char *const hp48_module_names[6] =
105static const char *const hp48_module_names[6] =
106106  { "HDW (I/O)", "NCE2 (RAM)", "CE1", "CE2", "NCE3", "NCE1 (ROM)" };
107107
108108/* values returned by C=ID */
109109static const UINT8 hp48_module_mask_id[6] = { 0x00, 0x03, 0x05, 0x07, 0x01, 0x00 };
110110static const UINT8 hp48_module_addr_id[6] = { 0x19, 0xf4, 0xf6, 0xf8, 0xf2, 0x00 };
111111
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
114114   port2: SX:32/128KB, GX:128/512/4096 KB
115115 */
116static UINT32 hp48_port_size[2];
116static UINT32 hp48_port_size[2];
117117static UINT8  hp48_port_write[2];
118118static UINT8* hp48_port_data[2];
119119static UINT32 hp48_bank_switch;
r5932r5933
146146static void hp48_pulse_irq( running_machine *machine, int irq_line)
147147{
148148   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 );
150150}
151151
152152
r5932r5933
156156
157157/* end of receive event */
158158static 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",
161161           attotime_to_double(timer_get_time(machine)), param ));
162162
163163   hp48_io[0x14] = param & 0xf; /* receive zone */
r5932r5933
175175/* outside world initiates a receive event */
176176void hp48_rs232_start_recv_byte( running_machine *machine, UINT8 data )
177177{
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",
179179           attotime_to_double(timer_get_time(machine)), data ));
180180
181181   hp48_io[0x11] |= 2;  /* set byte receiving */
182   
182
183183   /* interrupt */
184184   if ( hp48_io[0x10] & 1 )
185185   {
r5932r5933
193193
194194/* end of send event */
195195static TIMER_CALLBACK( hp48_rs232_byte_sent_cb )
196{   
196{
197197   const device_config *xmodem = devtag_get_device(machine, "rs232_x");
198198   const device_config *kermit = devtag_get_device(machine, "rs232_k");
199199
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",
201201           attotime_to_double(timer_get_time(machine)), param ));
202202
203203   hp48_io[0x12] &= ~3; /* clear byte sending and buffer full */
r5932r5933
221221{
222222   UINT8 data = HP48_IO_8(0x16); /* byte to send */
223223
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",
225225           cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), attotime_to_double(timer_get_time(machine)), data ));
226226
227227   /* set byte sending and send buffer full */
r5932r5933
238238{
239239   UINT8 data = chardev_in( hp48_chardev );
240240
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",
242242           attotime_to_double(timer_get_time(machine)), data ));
243243
244244   hp48_io[0x14] = data & 0xf; /* receive zone */
r5932r5933
257257{
258258   if ( status != CHARDEV_OK ) return;
259259
260   LOG_SERIAL(( "%f hp48_chardev_start_recv_byte: start receiving\n",
260   LOG_SERIAL(( "%f hp48_chardev_start_recv_byte: start receiving\n",
261261           attotime_to_double(timer_get_time(machine)) ));
262262
263263   hp48_io[0x11] |= 2;  /* set byte receiving */
264   
264
265265   /* interrupt */
266266   if ( hp48_io[0x10] & 1 )
267267   {
r5932r5933
274274
275275static void hp48_chardev_ready_to_send( running_machine *machine )
276276{
277   hp48_io[0x12] &= ~3;     
277   hp48_io[0x12] &= ~3;
278278
279279   /* interrupt */
280280   if ( hp48_io[0x10] & 4 )
r5932r5933
283283   }
284284}
285285
286static const chardev_interface hp48_chardev_iface =
286static const chardev_interface hp48_chardev_iface =
287287{ hp48_chardev_start_recv_byte, hp48_chardev_ready_to_send };
288288
289289#endif
r5932r5933
300300
301301   /* bits 0-8: keyboard lines */
302302   hp48_out = out & 0x1ff;
303   
303
304304   /* bits 9-10: unused */
305   
305
306306   /* bit 11: beeper */
307307   dac_data_w( devtag_get_device(device->machine, "dac"), (out & 0x800) ? 0x80 : 00 );
308308}
r5932r5933
321321   if ( (hp48_out >> 6) & 1 ) in |= input_port_read( machine, "LINE6" );
322322   if ( (hp48_out >> 7) & 1 ) in |= input_port_read( machine, "LINE7" );
323323   if ( (hp48_out >> 8) & 1 ) in |= input_port_read( machine, "LINE8" );
324   
324
325325   /* on key */
326326   in |= input_port_read( machine, "ON" );
327327
r5932r5933
339339
340340/* key detect */
341341static void hp48_update_kdn( running_machine *machine )
342{   
342{
343343   int in = hp48_get_in( machine );
344344
345345   /* interrupt on raising edge */
346   if ( in && !hp48_kdn )
346   if ( in && !hp48_kdn )
347347   {
348348      LOG(( "%f hp48_update_kdn: interrupt\n", attotime_to_double(timer_get_time(machine)) ));
349349      hp48_io[0x19] |= 8;                                              /* service request */
r5932r5933
360360   /* NMI for ON key */
361361   if ( input_port_read( machine, "ON" ) )
362362   {
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)) ));
365365      hp48_io[0x19] |= 8;                                          /* set service request */
366366      hp48_pulse_irq( machine, SATURN_WAKEUP_LINE );
367367      hp48_pulse_irq( machine, SATURN_NMI_LINE );
r5932r5933
377377{
378378   LOG(( "%05x %f hp48_rsi\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)) ));
379379
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    */
383383   hp48_kdn = 0;
384384}
385385
r5932r5933
389389static void hp48_update_annunciators( running_machine *machine, void* param )
390390{
391391   /* 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    */
399399   int markers = HP48_IO_8(0xb);
400400   output_set_value( "lshift0",   (markers & 0x81) == 0x81 );
401401   output_set_value( "rshift0",   (markers & 0x82) == 0x82 );
r5932r5933
416416
417417static WRITE8_HANDLER ( hp48_io_w )
418418{
419   LOG(( "%05x %f hp48_io_w: off=%02x data=%x\n",
419   LOG(( "%05x %f hp48_io_w: off=%02x data=%x\n",
420420         cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset, data ));
421421
422422   switch( offset )
r5932r5933
440440   {
441441      int old_cntrl = hp48_io[offset] & 8;
442442      hp48_io[offset] = data;
443      if ( old_cntrl != (data & 8) )
443      if ( old_cntrl != (data & 8) )
444444      {
445445         hp48_apply_modules( space->machine, NULL );
446446      }
r5932r5933
465465      /* bit 0: software interrupt */
466466      if ( data & 1 )
467467      {
468         LOG(( "%f hp48_io_w: software interrupt requested\n",
468         LOG(( "%f hp48_io_w: software interrupt requested\n",
469469               attotime_to_double(timer_get_time(space->machine)) ));
470470         hp48_pulse_irq( space->machine, SATURN_IRQ_LINE );
471471         data &= ~1;
472472      }
473473
474      /* XXX not implemented
475          bit 1: card test?
476       */
474      /* XXX not implemented
475            bit 1: card test?
476         */
477477
478478      hp48_io[0x0e] = data;
479479      break;
r5932r5933
499499
500500   /* XXX not implemented:
501501
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
508508              bit 3: ?
509509
510510           - 0x1a: I/R input
511511              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
515515
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)
521521
522      - 0x1d: I/R output buffer
523   */
522       - 0x1d: I/R output buffer
523    */
524524
525525   default: hp48_io[offset] = data;
526526   }
r5932r5933
534534
535535   switch( offset )
536536   {
537     
537
538538   /* CRC register */
539539   case 0x04: data = hp48_crc & 0xf; break;
540540   case 0x05: data = (hp48_crc >> 4) & 0xf; break;
r5932r5933
547547      if ( hp48_io[0x9] & 8 ) /* test enable */
548548      {
549549         /* 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             */
553553         switch ( input_port_read( space->machine, "BATTERY" ) )
554554         {
555555         case 1: data = 2; break; /* low */
r5932r5933
563563   case 0x29:
564564   {
565565      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 );
567567      if ( last_line <= 1 ) last_line = 0x3f;
568568      data = ( cur_line >= 0 && cur_line <= last_line ) ? last_line - cur_line : 0;
569569      if ( offset == 0x29 )
r5932r5933
590590   case 0x3f: data = (hp48_timer2 >> 28) & 0xf; break;
591591
592592   /* serial */
593   case 0x15:
593   case 0x15:
594594   {
595595                /* second nibble of received data */
596596
597597      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");
599599
600600      hp48_io[0x11] &= ~1;  /* clear byte received */
601601      data = hp48_io[offset];
602     
602
603603      /* protocol action */
604604      if ( xmodem && image_exists( xmodem ) ) xmodem_byte_transmitted( xmodem );
605605      else if ( kermit && image_exists( kermit ) ) kermit_byte_transmitted( kermit );
r5932r5933
634634   default: data = hp48_io[offset];
635635   }
636636
637   LOG(( "%05x %f hp48_io_r: off=%02x data=%x\n",
637   LOG(( "%05x %f hp48_io_r: off=%02x data=%x\n",
638638         cpu_get_previouspc(space->cpu), attotime_to_double(timer_get_time(space->machine)), offset, data ));
639639   return data;
640640}
r5932r5933
711711
712712/* --------- memory controller ----------- */
713713
714/*
714/*
715715   Clark (S series) and York (G series) CPUs have 6 daisy-chained modules
716716
717717
r5932r5933
776776      {
777777         /* NCE2 */
778778         hp48_modules[5].off_mask = 0x7ffff;
779         nce2_enable = hp48_bank_switch >> 6;
779         nce2_enable = hp48_bank_switch >> 6;
780780      }
781781   }
782782
r5932r5933
816816
817817      LOG(( "hp48_apply_modules: module %s configured at %05x-%05x, mirror %05x\n",
818818            hp48_module_names[i], base, end, mirror ));
819     
819
820820      if ( hp48_modules[i].data )
821821      {
822822         memory_set_bankptr( space->machine, i, hp48_modules[i].data );
r5932r5933
862862
863863/* CONFIG opcode */
864864void hp48_mem_config( const device_config *device, int v )
865{   
865{
866866   int i;
867867
868868   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 ));
r5932r5933
879879      }
880880
881881      /* ... 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 )
883883      {
884884         hp48_modules[i].base = v & hp48_modules[i].mask;
885885         hp48_modules[i].state = HP48_MODULE_CONFIGURED;
r5932r5933
894894
895895/* UNCFG opcode */
896896void hp48_mem_unconfig( const device_config *device, int v )
897{   
897{
898898   int i;
899899   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 ));
900900
r5932r5933
902902   for ( i = 0; i < 5; i++ )
903903   {
904904      /* ... and unconfigure it */
905      if ( hp48_modules[i].state == HP48_MODULE_CONFIGURED &&
905      if ( hp48_modules[i].state == HP48_MODULE_CONFIGURED &&
906906           (hp48_modules[i].base == (v & hp48_modules[i].mask)) )
907907      {
908908         hp48_modules[i].state = i> 0 ? HP48_MODULE_UNCONFIGURED : HP48_MODULE_MASK_KNOWN;
r5932r5933
931931      }
932932
933933      /* ... 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 )
935935      {
936936         data = hp48_module_addr_id[i] | (hp48_modules[i].base & ~0x3f);
937937         break;
938938      }
939939   }
940940
941   LOG(( "%05x %f hp48_mem_id = %02x\n",
941   LOG(( "%05x %f hp48_mem_id = %02x\n",
942942         cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data ));
943943
944944   return data; /* everything is configured */
r5932r5933
966966static void hp48_decode_nibble( UINT8* dst, UINT8* src, int size )
967967{
968968   int i;
969   for ( i=size-1; i >= 0; i-- )
969   for ( i=size-1; i >= 0; i-- )
970970   {
971971      dst[2*i+1] = src[i] >> 4;
972972      dst[2*i] = src[i] & 0xf;
r5932r5933
977977static void hp48_encode_nibble( UINT8* dst, UINT8* src, int size )
978978{
979979   int i;
980   for ( i=0; i < size; i++ )
980   for ( i=0; i < size; i++ )
981981   {
982982      dst[i] = (src[2*i] & 0xf) | (src[2*i+1] << 4);
983983   }
r5932r5933
10431043static DEVICE_IMAGE_CREATE( hp48_port )
10441044{
10451045   struct hp48_port_config* conf = (struct hp48_port_config*) image->static_config;
1046   int size = conf->max_size;
1046   int size = conf->max_size;
10471047        /* XXX defaults to max_size; get user-specified size instead */
10481048
10491049   /* check size */
r5932r5933
10521052   {
10531053      logerror( "hp48: image size for %s should be a power of two between %i and %i\n", conf->name, 32*1024, conf->max_size );
10541054      return INIT_FAIL;
1055   }   
1055   }
10561056
1057   hp48_port_size[conf->port] = size;   
1057   hp48_port_size[conf->port] = size;
10581058   hp48_port_write[conf->port] = 1;
10591059   hp48_fill_port( image );
10601060   return INIT_PASS;
r5932r5933
10631063static DEVICE_IMAGE_UNLOAD( hp48_port )
10641064{
10651065   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",
10671067         conf->name, hp48_port_size[conf->port] ,hp48_port_write[conf->port] ));
10681068   if ( hp48_port_write[conf->port] )
10691069   {
r5932r5933
10841084DEVICE_GET_INFO( hp48_port )
10851085{
10861086   struct hp48_port_config* conf = device ? (struct hp48_port_config*) device->static_config : NULL;
1087   switch ( state )
1087   switch ( state )
10881088   {
10891089   case DEVINFO_INT_TOKEN_BYTES:                 info->i = 1;                                               break;
10901090   case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                                               break;
r5932r5933
11781178   hp48_modules[1].write    = SMH_BANK(1);
11791179   hp48_modules[1].data     = ram;
11801180
1181   if ( HP48_G_SERIES )
1181   if ( HP48_G_SERIES )
11821182   {
11831183                /* bank switcher */
11841184      hp48_modules[2].off_mask = 0x00fff;  /* 2 KB */
r5932r5933
12071207   state_save_register_global(machine,  hp48_timer1 );
12081208   state_save_register_global(machine,  hp48_timer2 );
12091209   state_save_register_global(machine,  hp48_bank_switch );
1210   for ( i = 0; i < 6; i++ )
1210   for ( i = 0; i < 6; i++ )
12111211   {
12121212      state_save_register_item(machine, "globals", NULL, i, hp48_modules[i].state );
12131213      state_save_register_item(machine, "globals", NULL, i, hp48_modules[i].base );
src/mess/machine/applefdc.h
r5932r5933
11/*********************************************************************
22
3   applefdc.h
3    applefdc.h
44
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
88
9   Nate Woods
10   Raphael Nabet
9    Nate Woods
10    Raphael Nabet
1111
1212*********************************************************************/
1313
r5932r5933
5555***************************************************************************/
5656
5757/* classic Apple II disk controller (pre-IWM) */
58DEVICE_GET_INFO(applefdc);   
58DEVICE_GET_INFO(applefdc);
5959
6060/* Integrated Woz Machine */
6161DEVICE_GET_INFO(iwm);
6262
6363/* Steve Woz Integrated Machine (NYI) */
64DEVICE_GET_INFO(swim);   
64DEVICE_GET_INFO(swim);
6565
6666/* read/write handlers */
6767READ8_DEVICE_HANDLER(applefdc_r);
r5932r5933
8181#define MDRV_APPLEFDC_MODIFY(_tag, _intrf) \
8282  MDRV_DEVICE_MODIFY(_tag)         \
8383  MDRV_DEVICE_CONFIG(_intrf)
84 
84
8585#define MDRV_IWM_ADD(_tag, _intrf) \
8686   MDRV_DEVICE_ADD(_tag, IWM, 0) \
8787   MDRV_DEVICE_CONFIG(_intrf)
r5932r5933
8989#define MDRV_IWM_MODIFY(_tag, _intrf) \
9090  MDRV_DEVICE_MODIFY(_tag)         \
9191  MDRV_DEVICE_CONFIG(_intrf)
92 
92
9393#define MDRV_SWIM_ADD(_tag, _intrf) \
9494   MDRV_DEVICE_ADD(_tag, SWIM, 0) \
9595   MDRV_DEVICE_CONFIG(_intrf)
r5932r5933
9797#define MDRV_SWIM_MODIFY(_tag, _intrf) \
9898  MDRV_DEVICE_MODIFY(_tag)         \
9999  MDRV_DEVICE_CONFIG(_intrf)
100 
101100
101
102102#endif /* __APPLEFDC_H__ */
src/mess/machine/mockngbd.c
r5932r5933
11/*********************************************************************
22
3   mockngbd.c
3    mockngbd.c
44
5   Implementation of the Apple II Mockingboard
5    Implementation of the Apple II Mockingboard
66
7   The Mockingboard comes in different flavours:
7    The Mockingboard comes in different flavours:
88
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
1313
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
2322
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
2723
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
2828*********************************************************************/
2929
3030#include "mockngbd.h"
r5932r5933
7171
7272/*-------------------------------------------------
7373    DEVICE_START(mockingboard) - device start
74   function
74    function
7575-------------------------------------------------*/
7676
7777static DEVICE_START(mockingboard)
r5932r5933
8282
8383/*-------------------------------------------------
8484    DEVICE_RESET(mockingboard) - device reset
85   function
85    function
8686-------------------------------------------------*/
8787
8888static DEVICE_RESET(mockingboard)
r5932r5933
9797   /* What follows is pure filth. It abuses the core like an angry pimp on a bad hair day. */
9898
9999   /* 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);
105105}
106106
107107
r5932r5933
210210
211211/*-------------------------------------------------
212212    DEVICE_GET_INFO(mockingboard) - device get info
213   function
213    function
214214-------------------------------------------------*/
215215
216216DEVICE_GET_INFO(mockingboard)
src/mess/machine/apple3.c
r5932r5933
11/***************************************************************************
22
3   machine/apple3.c
3    machine/apple3.c
44
5   Apple ///
5    Apple ///
66
77
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
1010
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
1313
1414***************************************************************************/
1515
r5932r5933
603603   {
604604#if 0
605605      /* 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         */
611611      result = apple3_bankaddr(~0, offset - 0x8000);
612612#endif
613613   }
src/mess/machine/3do.c
r5932r5933
1313} CLIO;
1414
1515
16//static UINT32   unk_318_data_0 = 0;
16//static UINT32 unk_318_data_0 = 0;
1717static MADAM   madam;
1818static CLIO      clio;
1919
r5932r5933
3030
3131
3232/*
33   I have no idea what piece of hardware this is. Possibly some kind of communication hardware.
33    I have no idea what piece of hardware this is. Possibly some kind of communication hardware.
3434
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
7272*/
7373READ32_HANDLER( unk_318_r ) {
7474   logerror( "%08X: UNK_318 read offset = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset );
src/mess/machine/ap2_slot.h
r5932r5933
11/*********************************************************************
22
3   ap2_slot.h
3    ap2_slot.h
44
5   Implementation of Apple II device slots
5    Implementation of Apple II device slots
66
77*********************************************************************/
88
r5932r5933
5151***************************************************************************/
5252
5353/* device get info function */
54DEVICE_GET_INFO(apple2_slot);   
54DEVICE_GET_INFO(apple2_slot);
5555
5656/* slot read function */
5757READ8_DEVICE_HANDLER(apple2_slot_r);
src/mess/machine/mockngbd.h
r5932r5933
11/*********************************************************************
22
3   mockngbd.h
3    mockngbd.h
44
5   Implementation of the Apple II Mockingboard
5    Implementation of the Apple II Mockingboard
66
77*********************************************************************/
88
r5932r5933
2727***************************************************************************/
2828
2929/* device get info function */
30DEVICE_GET_INFO(mockingboard);   
30DEVICE_GET_INFO(mockingboard);
3131
3232/* slot read function */
3333READ8_DEVICE_HANDLER(mockingboard_r);
src/mess/machine/dai.c
r5932r5933
154154
155155/***************************************************************************
156156
157   Discrete Devices IO
157    Discrete Devices IO
158158
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
167167
168   FD01   PDLST:   IN   Single pulse used to trigger paddle timer circuit
168    FD01    PDLST:  IN  Single pulse used to trigger paddle timer circuit
169169
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
172172
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
175175
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
182182***************************************************************************/
183183
184184READ8_HANDLER( dai_io_discrete_devices_r )
r5932r5933
244244
245245/***************************************************************************
246246
247   AMD 9911 mathematical coprocesor
247    AMD 9911 mathematical coprocesor
248248
249249***************************************************************************/
250250
src/mess/machine/ncr5380.c
r5932r5933
5959static UINT8 n5380_Data[512];
6060
6161#if NCR5380_DEVICE_CONVERSION
62typedef struct _ncr5380_t ncr5380_t;   
62typedef struct _ncr5380_t ncr5380_t;
6363struct _ncr5380_t
6464{
6565   SCSIInstance *devices[8];
r5932r5933
438438
439439/* device interface */
440440#if NCR5380_DEVICE_CONVERSION
441static DEVICE_START( ncr5380 )
441static DEVICE_START( ncr5380 )
442442{
443443}
444444
445445
446static DEVICE_RESET( ncr5380 )
446static DEVICE_RESET( ncr5380 )
447447{
448448}
449449
src/mess/machine/adam.c
r5932r5933
595595               break;
596596            case 4: /* Read Data */
597597               /*
598               AdamNet Error codes on low nibble for tape1,disk1,disk2 and on high nibble for tape2 (share DCB with tape1):
598                    AdamNet Error codes on low nibble for tape1,disk1,disk2 and on high nibble for tape2 (share DCB with tape1):
599599
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                    */
608608               if (deviceNum==1)
609609               {
610610                  kbcode=getKeyFromBuffer();
r5932r5933
686686WRITE8_HANDLER( adamnet_w )
687687{
688688   /*
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    */
692692   UINT8 *BankBase;
693693   BankBase = &memory_region(space->machine, "maincpu")[0x00000];
694694
r5932r5933
796796         inport6 = input_port_read(space->machine, "controllers");
797797
798798         /* 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 */
801801
802802         data = 0x0F;   /* No key pressed by default */
803803         if (!(inport6&0x01)) /* If Driving Controller enabled -> no keypad 1 */
r5932r5933
845845         inport4 = input_port_read(space->machine, "controller2_keypad2");
846846
847847         /* 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 */
850850
851851         data = 0x0F;   /* No key pressed by default */
852852         if (!(inport3 & 0x01)) data &= 0x0A; /* 0 */
src/mess/machine/at45dbxx.c
r5932r5933
11/*
22
3   Atmel Serial DataFlash
3    Atmel Serial DataFlash
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
7   AT45DB041 -  528 KByte
8   AT45DB081 - 1056 KByte
9   AT45DB161 - 2112 KByte
7    AT45DB041 -  528 KByte
8    AT45DB081 - 1056 KByte
9    AT45DB161 - 2112 KByte
1010
1111*/
1212
r5932r5933
9090static void common_start(const device_config *device, int device_type)
9191{
9292   at45dbxx_t *flash = get_token(device);
93   
93
9494   _logerror( 0, ("at45dbxx_init (%d)\n", device_type));
9595   memset( flash, 0, sizeof( flash));
9696   switch (device_type)
r5932r5933
103103   flash->data = auto_alloc_array(device->machine, UINT8, flash->size);
104104   flash->buffer1 = auto_alloc_array(device->machine, UINT8, flash->page_size);
105105   flash->buffer2 = auto_alloc_array(device->machine, UINT8, flash->page_size);
106   
106
107107   // data
108108   state_save_register_item_pointer(device->machine, "at45dbxx", device->tag, 0, flash->data, flash->size);
109109   // pins
r5932r5933
392392/*
393393NVRAM_HANDLER( at45dbxx )
394394{
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    }
411411}
412412*/
413413
src/mess/machine/ataridev.h
r5932r5933
11/*
2   ataridev.h
2    ataridev.h
33
44*/
55
src/mess/machine/mc80.c
r5932r5933
1616/*****************************************************************************/
1717
1818static IRQ_CALLBACK(mc8020_irq_callback)
19{   
19{
2020   return 0x00;
21}
21}
2222
2323MACHINE_RESET(mc8020)
2424{
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);
2626}
2727
2828static void mc8020_ctc_interrupt(const device_config *device, int state)
r5932r5933
4040
4141static WRITE8_DEVICE_HANDLER( ctc_z2_w )
4242{
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
4646}
4747
4848const z80ctc_interface mc8020_ctc_intf =
49{   
49{
5050   0,
51   mc8020_ctc_interrupt,   
51   mc8020_ctc_interrupt,
5252   ctc_z0_w,
5353   ctc_z1_w,
5454   ctc_z2_w
r5932r5933
5656
5757
5858static READ8_DEVICE_HANDLER (mc80_port_b_r)
59{   
59{
6060   return 0;
6161}
6262
6363static READ8_DEVICE_HANDLER (mc80_port_a_r)
6464{
65   return 0;   
65   return 0;
6666}
6767
6868static WRITE8_DEVICE_HANDLER (mc80_port_a_w)
r5932r5933
9797   // reg C
9898   // 7 6 5 4 -- module
9999   //         3 - 0 left half, 1 right half
100   //           2 1 0
100   //           2 1 0
101101   //           =====
102102   //           0 0 0 - dark
103103   //           0 0 1 - light
104104   //           0 1 0 - in reg pixel
105   //          0 1 1 - negate in reg pixel
105   //          0 1 1 - negate in reg pixel
106106   //           1 0 x - operation code in B reg
107107   // reg B
108108   //
109   UINT16 addr = ((offset & 0xff00) >> 2) | ((offset & 0x08) << 2) | (data >> 3); 
109   UINT16 addr = ((offset & 0xff00) >> 2) | ((offset & 0x08) << 2) | (data >> 3);
110110   UINT8 val[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
111111   int c = offset & 1;
112112   mc8030_video_mem[addr] = mc8030_video_mem[addr] | (val[data & 7]*c);
113   
113
114114}
115115
116116WRITE8_HANDLER( eprom_prog_w )
117{   
117{
118118}
119119
120120static IRQ_CALLBACK(mc8030_irq_callback)
121{   
121{
122122   return 0x20;
123}
123}
124124
125125MACHINE_RESET(mc8030)
126126{
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);
128128}
129129
130130static READ8_DEVICE_HANDLER (zve_port_a_r)
131{   
131{
132132   return 0xff;
133133}
134134
r5932r5933
157157};
158158
159159static READ8_DEVICE_HANDLER (asp_port_a_r)
160{   
160{
161161   return 0xff;
162162}
163163
src/mess/machine/at45dbxx.h
r5932r5933
11/*
22
3   Atmel Serial DataFlash
3    Atmel Serial DataFlash
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
7   AT45DB041 -  528 KByte
8   AT45DB081 - 1056 KByte
9   AT45DB161 - 2112 KByte
7    AT45DB041 -  528 KByte
8    AT45DB081 - 1056 KByte
9    AT45DB161 - 2112 KByte
1010
1111*/
1212
src/mess/machine/mbee.c
r5932r5933
11/***************************************************************************
22
3   microbee.c
3    microbee.c
44
55    machine driver
6   Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
6    Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
77
88
99****************************************************************************/
r5932r5933
2121
2222/***********************************************************
2323
24   PIO
24    PIO
2525
2626************************************************************/
2727
r5932r5933
4646
4747static WRITE8_DEVICE_HANDLER( pio_port_b_w )
4848{
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 */
5858
5959   cassette_output(mbee_cassette, (data & 0x02) ? -1.0 : +1.0);
6060
r5932r5933
117117
118118/*************************************************************************************
119119
120   Floppy DIsk
120    Floppy DIsk
121121
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.
124124
125125*************************************************************************************/
126126
r5932r5933
136136
137137READ8_HANDLER ( mbee_fdc_status_r )
138138{
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 */
141141
142142   return fdc_status;
143143}
144144
145145WRITE8_HANDLER ( mbee_fdc_motor_w )
146146{
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) */
151151
152152   wd17xx_set_drive(mbee_fdc, data & 3);
153153   wd17xx_set_side(mbee_fdc, (data & 4) ? 1 : 0);
r5932r5933
156156
157157/***********************************************************
158158
159   Machine
159    Machine
160160
161161************************************************************/
162162
r5932r5933
191191   mbee_vsync = 1;
192192
193193   /* 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. */
196196
197197   z80pio_astb_w( mbee_z80pio, centronics_busy_r(mbee_printer));   /* signal int when not busy (L->H) */
198198
r5932r5933
201201
202202/***********************************************************
203203
204   Quickload
204    Quickload
205205
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.
208208
209209************************************************************/
210210
src/mess/machine/msx_slot.c
r5932r5933
3030static void msx_cpu_setbank (running_machine *machine, int page, UINT8 *mem)
3131{
3232   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
33   switch (page)
33   switch (page)
3434   {
3535   case 1:
3636   case 2:
r5932r5933
136136
137137   nsize = 0x10000; /* 64 kb */
138138   mask = 3;
139   for (i=0; i<6; i++)
139   for (i=0; i<6; i++)
140140   {
141      if (size == nsize)
141      if (size == nsize)
142142      {
143143         break;
144144      }
145145      mask = (mask << 1) | 1;
146146      nsize <<= 1;
147147   }
148   if (i == 6)
148   if (i == 6)
149149   {
150150      logerror ("ram mapper: error: must be 64kb, 128kb, 256kb, 512kb, "
151151              "1mb, 2mb or 4mb\n");
r5932r5933
156156
157157#ifdef MONMSX
158158   f = fopen ("/home/sean/msx/hack/monmsx.bin", "r");
159   if (f)
159   if (f)
160160   {
161161      fseek (f, 6L, SEEK_SET);
162162      fread (state->mem, 1, 6151 - 6, f);
r5932r5933
176176{
177177   int i;
178178
179   for (i=0; i<4; i++)
179   for (i=0; i<4; i++)
180180   {
181181      msx1.ram_mapper[i] = 3 - i;
182182   }
r5932r5933
213213
214214MSX_SLOT_MAP(msxdos2)
215215{
216   if (page != 1)
216   if (page != 1)
217217   {
218218      msx_cpu_setbank (machine, page * 2 + 1, msx1.empty);
219219      msx_cpu_setbank (machine, page * 2 + 2, msx1.empty);
220   }
221   else
220   }
221   else
222222   {
223223      msx_cpu_setbank (machine, 3, state->mem + state->banks[0] * 0x4000);
224224      msx_cpu_setbank (machine, 4, state->mem + state->banks[0] * 0x4000 + 0x2000);
r5932r5933
227227
228228MSX_SLOT_WRITE(msxdos2)
229229{
230   if (addr == 0x6000)
230   if (addr == 0x6000)
231231   {
232232      state->banks[0] = val & 3;
233233      slot_msxdos2_map (machine, state, 1);
r5932r5933
238238{
239239   int banks;
240240
241   if (size > 0x200000)
241   if (size > 0x200000)
242242   {
243243      logerror ("konami: warning: truncating to 2mb\n");
244244      size = 0x200000;
245245      return 1;
246246   }
247247   banks = size / 0x2000;
248   if (size != banks * 0x2000 || (~(banks - 1) % banks))
248   if (size != banks * 0x2000 || (~(banks - 1) % banks))
249249   {
250250      logerror ("konami: error: must be a 2 power of 8kb\n");
251251      return 1;
r5932r5933
267267
268268MSX_SLOT_MAP(konami)
269269{
270   switch (page)
270   switch (page)
271271   {
272272   case 0:
273273      msx_cpu_setbank (machine, 1, state->mem);
r5932r5933
289289
290290MSX_SLOT_WRITE(konami)
291291{
292   switch (addr)
292   switch (addr)
293293   {
294294   case 0x6000:
295295      state->banks[1] = val & state->bank_mask;
296296      slot_konami_map (machine, state, 1);
297      if (msx1.state[0] == state)
297      if (msx1.state[0] == state)
298298      {
299299         slot_konami_map (machine, state, 0);
300300      }
r5932r5933
310310   case 0xa000:
311311      state->banks[3] = val & state->bank_mask;
312312      slot_konami_map (machine, state, 2);
313      if (msx1.state[3] == state)
313      if (msx1.state[3] == state)
314314      {
315315         slot_konami_map (machine, state, 3);
316316      }
r5932r5933
321321{
322322   int banks;
323323
324   if (size > 0x200000)
324   if (size > 0x200000)
325325   {
326326      logerror ("konami_scc: warning: truncating to 2mb\n");
327327      size = 0x200000;
328328      return 1;
329329   }
330330   banks = size / 0x2000;
331   if (size != banks * 0x2000 || (~(banks - 1) % banks))
331   if (size != banks * 0x2000 || (~(banks - 1) % banks))
332332   {
333333      logerror ("konami_scc: error: must be a 2 power of 8kb\n");
334334      return 1;
r5932r5933
352352
353353static READ8_HANDLER (konami_scc_bank5)
354354{
355   if (offset & 0x80)
355   if (offset & 0x80)
356356   {
357357#if 0
358358      if ((offset & 0xff) >= 0xe0)
r5932r5933
362362#endif
363363      return 0xff;
364364   }
365   else
365   else
366366   {
367367      return k051649_waveform_r (devtag_get_device(space->machine, "k051649"), offset & 0x7f);
368368   }
r5932r5933
370370
371371MSX_SLOT_MAP(konami_scc)
372372{
373   switch (page)
373   switch (page)
374374   {
375375   case 0:
376376      msx_cpu_setbank (machine, 1, state->mem + state->banks[2] * 0x2000);
r5932r5933
395395MSX_SLOT_WRITE(konami_scc)
396396{
397397   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)
399399   {
400400      state->banks[0] = val & state->bank_mask;
401401      slot_konami_scc_map (machine, state, 1);
402      if (msx1.state[3] == state)
402      if (msx1.state[3] == state)
403403      {
404404         slot_konami_scc_map (machine, state, 3);
405405      }
406406   }
407   else if (addr >= 0x7000 && addr < 0x7800)
407   else if (addr >= 0x7000 && addr < 0x7800)
408408   {
409409      state->banks[1] = val & state->bank_mask;
410410      slot_konami_scc_map (machine, state, 1);
411      if (msx1.state[3] == state)
411      if (msx1.state[3] == state)
412412      {
413413         slot_konami_scc_map (machine, state, 3);
414414      }
415415   }
416   else if (addr >= 0x9000 && addr < 0x9800)
416   else if (addr >= 0x9000 && addr < 0x9800)
417417   {
418418      state->banks[2] = val & state->bank_mask;
419419      state->cart.scc.active = ((val & 0x3f) == 0x3f);
420420      slot_konami_scc_map (machine, state, 2);
421      if (msx1.state[0] == state)
421      if (msx1.state[0] == state)
422422      {
423423         slot_konami_scc_map (machine, state, 0);
424424      }
425425   }
426   else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000)
426   else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000)
427427   {
428428      const device_config *k051649 = devtag_get_device(space->machine, "k051649");
429429      int offset = addr & 0xff;
430430
431      if (offset < 0x80)
431      if (offset < 0x80)
432432      {
433433         k051649_waveform_w (k051649, offset, val);
434434      }
435      else if (offset < 0xa0)
435      else if (offset < 0xa0)
436436      {
437437         offset &= 0xf;
438         if (offset < 0xa)
438         if (offset < 0xa)
439439         {
440440            k051649_frequency_w (k051649, offset, val);
441441         }
442         else if (offset < 0xf)
442         else if (offset < 0xf)
443443         {
444444            k051649_volume_w (k051649, offset - 0xa, val);
445445         }
446         else
446         else
447447         {
448448            k051649_keyonoff_w (k051649, 0, val);
449449         }
450450      }
451451#if 0
452      else if (offset >= 0xe0)
452      else if (offset >= 0xe0)
453453      {
454454         /* deformation register */
455455      }
456456#endif
457457   }
458   else if (addr >= 0xb000 && addr < 0xb800)
458   else if (addr >= 0xb000 && addr < 0xb800)
459459   {
460460      state->banks[3] = val & state->bank_mask;
461461      slot_konami_scc_map (machine, state, 2);
462      if (msx1.state[0] == state)
462      if (msx1.state[0] == state)
463463      {
464464         slot_konami_scc_map (machine, state, 0);
465465      }
r5932r5933
470470{
471471   int banks;
472472
473   if (size > 0x200000)
473   if (size > 0x200000)
474474   {
475475      logerror ("ascii8: warning: truncating to 2mb\n");
476476      size = 0x200000;
477477      return 1;
478478   }
479479   banks = size / 0x2000;
480   if (size != banks * 0x2000 || (~(banks - 1) % banks))
480   if (size != banks * 0x2000 || (~(banks - 1) % banks))
481481   {
482482      logerror ("ascii8: error: must be a 2 power of 8kb\n");
483483      return 1;
r5932r5933
499499
500500MSX_SLOT_MAP(ascii8)
501501{
502   switch (page)
502   switch (page)
503503   {
504504   case 0:
505505      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
523523{
524524   int bank;
525525
526   if (addr >= 0x6000 && addr < 0x8000)
526   if (addr >= 0x6000 && addr < 0x8000)
527527   {
528528      bank = (addr / 0x800) & 3;
529529
530530      state->banks[bank] = val & state->bank_mask;
531      if (bank <= 1)
531      if (bank <= 1)
532532      {
533533         slot_ascii8_map (machine, state, 1);
534534      }
535      else if (msx1.state[2] == state)
535      else if (msx1.state[2] == state)
536536      {
537537         slot_ascii8_map (machine, state, 2);
538538      }
r5932r5933
543543{
544544   int banks;
545545
546   if (size > 0x400000)
546   if (size > 0x400000)
547547   {
548548      logerror ("ascii16: warning: truncating to 4mb\n");
549549      size = 0x400000;
550550   }
551551   banks = size / 0x4000;
552   if (size != banks * 0x4000 || (~(banks - 1) % banks))
552   if (size != banks * 0x4000 || (~(banks - 1) % banks))
553553   {
554554      logerror ("ascii16: error: must be a 2 power of 16kb\n");
555555      return 1;
r5932r5933
574574{
575575   UINT8 *mem;
576576
577   switch (page)
577   switch (page)
578578   {
579579   case 0:
580580      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
598598
599599MSX_SLOT_WRITE(ascii16)
600600{
601   if (addr >= 0x6000 && addr < 0x6800)
601   if (addr >= 0x6000 && addr < 0x6800)
602602   {
603603      state->banks[0] = val & state->bank_mask;
604604      slot_ascii16_map (machine, state, 1);
605605   }
606   else if (addr >= 0x7000 && addr < 0x7800)
606   else if (addr >= 0x7000 && addr < 0x7800)
607607   {
608608      state->banks[1] = val & state->bank_mask;
609      if (msx1.state[2] == state)
609      if (msx1.state[2] == state)
610610      {
611611         slot_ascii16_map (machine, state, 2);
612612      }
r5932r5933
619619   int banks;
620620
621621   state->cart.sram.mem = auto_alloc_array(machine, UINT8, 0x2000);
622   if (size > 0x100000)
622   if (size > 0x100000)
623623   {
624624      logerror ("ascii8_sram: warning: truncating to 1mb\n");
625625      size = 0x100000;
626626      return 1;
627627   }
628628   banks = size / 0x2000;
629   if (size != banks * 0x2000 || (~(banks - 1) % banks))
629   if (size != banks * 0x2000 || (~(banks - 1) % banks))
630630   {
631631      logerror ("ascii8_sram: error: must be a 2 power of 8kb\n");
632632      return 1;
r5932r5933
638638   state->bank_mask = banks - 1;
639639   state->cart.sram.sram_mask = banks;
640640   state->cart.sram.empty_mask = ~(banks | (banks - 1));
641   if (!state->sramfile)
641   if (!state->sramfile)
642642   {
643643      state->sramfile = sramfile;
644644   }
r5932r5933
657657{
658658   int bank = state->banks[bankno];
659659
660   if (bank & state->cart.sram.empty_mask)
660   if (bank & state->cart.sram.empty_mask)
661661   {
662662      return msx1.empty;
663663   }
664   else if (bank & state->cart.sram.sram_mask)
664   else if (bank & state->cart.sram.sram_mask)
665665   {
666666      return state->cart.sram.mem;
667667   }
668   else
668   else
669669   {
670670      return state->mem + (bank & state->bank_mask) * 0x2000;
671671   }
r5932r5933
673673
674674MSX_SLOT_MAP(ascii8_sram)
675675{
676   switch (page)
676   switch (page)
677677   {
678678   case 0:
679679      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
697697{
698698   int bank;
699699
700   if (addr >= 0x6000 && addr < 0x8000)
700   if (addr >= 0x6000 && addr < 0x8000)
701701   {
702702      bank = (addr / 0x800) & 3;
703703
704704      state->banks[bank] = val;
705      if (bank <= 1)
705      if (bank <= 1)
706706      {
707707         slot_ascii8_sram_map (machine, state, 1);
708708      }
709      else if (msx1.state[2] == state)
709      else if (msx1.state[2] == state)
710710      {
711711         slot_ascii8_sram_map (machine, state, 2);
712712      }
713713   }
714   if (addr >= 0x8000 && addr < 0xc000)
714   if (addr >= 0x8000 && addr < 0xc000)
715715   {
716716      bank = addr < 0xa000 ? 2 : 3;
717717      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))
719719      {
720720         state->cart.sram.mem[addr & 0x1fff] = val;
721721      }
r5932r5933
727727   file_error filerr;
728728   mame_file *f;
729729
730   if (!state->sramfile)
730   if (!state->sramfile)
731731   {
732732      logerror ("ascii8_sram: error: no sram filename provided\n");
733733      return 1;
r5932r5933
736736   filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_READ, &f);
737737   if (filerr == FILERR_NONE)
738738   {
739      if (mame_fread (f, state->cart.sram.mem, 0x2000) == 0x2000)
739      if (mame_fread (f, state->cart.sram.mem, 0x2000) == 0x2000)
740740      {
741741         mame_fclose (f);
742742         logerror ("ascii8_sram: info: sram loaded\n");
r5932r5933
758758   file_error filerr;
759759   mame_file *f;
760760
761   if (!state->sramfile)
761   if (!state->sramfile)
762762   {
763763      return 0;
764764   }
r5932r5933
785785
786786   state->cart.sram.mem = auto_alloc_array(machine, UINT8, 0x4000);
787787
788   if (size > 0x200000)
788   if (size > 0x200000)
789789   {
790790      logerror ("ascii16_sram: warning: truncating to 2mb\n");
791791      size = 0x200000;
792792   }
793793   banks = size / 0x4000;
794   if (size != banks * 0x4000 || (~(banks - 1) % banks))
794   if (size != banks * 0x4000 || (~(banks - 1) % banks))
795795   {
796796      logerror ("ascii16_sram: error: must be a 2 power of 16kb\n");
797797      return 1;
r5932r5933
804804   state->bank_mask = banks - 1;
805805   state->cart.sram.sram_mask = banks;
806806   state->cart.sram.empty_mask = ~(banks | (banks - 1));
807   if (!state->sramfile)
807   if (!state->sramfile)
808808   {
809809      state->sramfile = sramfile;
810810   }
r5932r5933
823823{
824824   int bank = state->banks[bankno];
825825
826   if (bank & state->cart.sram.empty_mask)
826   if (bank & state->cart.sram.empty_mask)
827827   {
828828      return msx1.empty;
829829   }
830   else if (bank & state->cart.sram.sram_mask)
830   else if (bank & state->cart.sram.sram_mask)
831831   {
832832      return state->cart.sram.mem;
833833   }
834   else
834   else
835835   {
836836      return state->mem + (bank & state->bank_mask) * 0x4000;
837837   }
r5932r5933
841841{
842842   UINT8 *mem;
843843
844   switch (page)
844   switch (page)
845845   {
846846   case 0:
847847      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
865865
866866MSX_SLOT_WRITE(ascii16_sram)
867867{
868   if (addr >= 0x6000 && addr < 0x6800)
868   if (addr >= 0x6000 && addr < 0x6800)
869869   {
870870      state->banks[0] = val;
871871      slot_ascii16_sram_map (machine, state, 1);
872872   }
873   else if (addr >= 0x7000 && addr < 0x7800)
873   else if (addr >= 0x7000 && addr < 0x7800)
874874   {
875875      state->banks[1] = val;
876      if (msx1.state[2] == state)
876      if (msx1.state[2] == state)
877877      {
878878         slot_ascii16_sram_map (machine, state, 2);
879879      }
880880   }
881   else if (addr >= 0x8000 && addr < 0xc000)
881   else if (addr >= 0x8000 && addr < 0xc000)
882882   {
883883      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))
885885      {
886886         int offset, i;
887887
888888         offset = addr & 0x07ff;
889         for (i=0; i<8; i++)
889         for (i=0; i<8; i++)
890890         {
891891            state->cart.sram.mem[offset] = val;
892892            offset += 0x0800;
r5932r5933
901901   mame_file *f;
902902   UINT8 *p;
903903
904   if (!state->sramfile)
904   if (!state->sramfile)
905905   {
906906      logerror ("ascii16_sram: error: no sram filename provided\n");
907907      return 1;
r5932r5933
912912   {
913913      p = state->cart.sram.mem;
914914
915      if (mame_fread (f, state->cart.sram.mem, 0x200) == 0x200)
915      if (mame_fread (f, state->cart.sram.mem, 0x200) == 0x200)
916916      {
917917         int /*offset,*/ i;
918918
919919         mame_fclose (f);
920920
921921         //offset = 0;
922         for (i=0; i<7; i++)
922         for (i=0; i<7; i++)
923923         {
924924            memcpy (p + 0x800, p, 0x800);
925925            p += 0x800;
r5932r5933
944944   file_error filerr;
945945   mame_file *f;
946946
947   if (!state->sramfile)
947   if (!state->sramfile)
948948   {
949949      return 0;
950950   }
r5932r5933
966966
967967MSX_SLOT_INIT(rtype)
968968{
969   if (!(size == 0x60000 || size == 0x80000))
969   if (!(size == 0x60000 || size == 0x80000))
970970   {
971971      logerror ("rtype: error: rom file should be exactly 384kb\n");
972972      return 1;
r5932r5933
988988{
989989   UINT8 *mem;
990990
991   switch (page)
991   switch (page)
992992   {
993993   case 0:
994994      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
10121012
10131013MSX_SLOT_WRITE(rtype)
10141014{
1015   if (addr >= 0x7000 && addr < 0x8000)
1015   if (addr >= 0x7000 && addr < 0x8000)
10161016   {
10171017      int data ;
10181018
1019      if (val & 0x10)
1019      if (val & 0x10)
10201020      {
10211021         data = 0x10 | (val & 7);
10221022      }
1023      else
1023      else
10241024      {
10251025         data = val & 0x0f;
10261026      }
10271027      state->banks[0] = data;
1028      if (msx1.state[2] == state)
1028      if (msx1.state[2] == state)
10291029      {
10301030         slot_rtype_map (machine, state, 2);
10311031      }
r5932r5933
10371037   UINT8 *p;
10381038   static const char sramfile[] = "GameMaster2";
10391039
1040   if (size != 0x20000)
1040   if (size != 0x20000)
10411041   {
10421042      logerror ("gmaster2: error: rom file should be 128kb\n");
10431043      return 1;
r5932r5933
10491049   p = auto_alloc_array(machine, UINT8, 0x4000);
10501050   memset (p, 0, 0x4000);
10511051   state->cart.sram.mem = p;
1052   if (!state->sramfile)
1052   if (!state->sramfile)
10531053   {
10541054      state->sramfile = sramfile;
10551055   }
r5932r5933
10611061{
10621062   int i;
10631063
1064   for (i=0; i<4; i++)
1064   for (i=0; i<4; i++)
10651065   {
10661066      state->banks[i] = i;
10671067   }
r5932r5933
10691069
10701070MSX_SLOT_MAP(gmaster2)
10711071{
1072   switch (page)
1072   switch (page)
10731073   {
10741074   case 0:
10751075   case 1:
10761076      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)
10781078      {
10791079         msx_cpu_setbank (machine, 2 + page * 2, state->cart.sram.mem +
10801080               (state->banks[1] - 16) * 0x2000);
10811081      }
1082      else
1082      else
10831083      {
10841084         msx_cpu_setbank (machine, 2 + page * 2, state->mem + state->banks[1] * 0x2000);
10851085      }
10861086      break;
10871087   case 2:
10881088   case 3:
1089      if (state->banks[2] > 15)
1089      if (state->banks[2] > 15)
10901090      {
10911091         msx_cpu_setbank (machine, 5 + page * 2, state->cart.sram.mem +
10921092               (state->banks[2] - 16) * 0x2000);
10931093      }
1094      else
1094      else
10951095      {
10961096         msx_cpu_setbank (machine, 5 + page * 2, state->mem + state->banks[2] * 0x2000);
10971097      }
1098      if (state->banks[3] > 15)
1098      if (state->banks[3] > 15)
10991099      {
11001100         msx_cpu_setbank (machine, 6 + page * 2, state->cart.sram.mem +
11011101               (state->banks[3] - 16) * 0x2000);
11021102      }
1103      else
1103      else
11041104      {
11051105         msx_cpu_setbank (machine, 6 + page * 2, state->mem + state->banks[3] * 0x2000);
11061106      }
r5932r5933
11101110
11111111MSX_SLOT_WRITE(gmaster2)
11121112{
1113   if (addr >= 0x6000 && addr < 0x7000)
1113   if (addr >= 0x6000 && addr < 0x7000)
11141114   {
1115      if (val & 0x10)
1115      if (val & 0x10)
11161116      {
11171117         val = val & 0x20 ? 17 : 16;
11181118      }
1119      else
1119      else
11201120      {
11211121         val = val & 15;
11221122      }
11231123      state->banks[1] = val;
11241124      slot_gmaster2_map (machine, state, 1);
1125      if (msx1.state[0] == state)
1125      if (msx1.state[0] == state)
11261126      {
11271127         slot_gmaster2_map (machine, state, 0);
11281128      }
11291129   }
1130   else if (addr >= 0x8000 && addr < 0x9000)
1130   else if (addr >= 0x8000 && addr < 0x9000)
11311131   {
1132      if (val & 0x10)
1132      if (val & 0x10)
11331133      {
11341134         val = val & 0x20 ? 17 : 16;
11351135      }
1136      else
1136      else
11371137      {
11381138         val = val & 15;
11391139      }
11401140      state->banks[2] = val;
11411141      slot_gmaster2_map (machine, state, 2);
1142      if (msx1.state[3] == state)
1142      if (msx1.state[3] == state)
11431143      {
11441144         slot_gmaster2_map (machine, state, 3);
11451145      }
11461146   }
1147   else if (addr >= 0xa000 && addr < 0xb000)
1147   else if (addr >= 0xa000 && addr < 0xb000)
11481148   {
1149      if (val & 0x10)
1149      if (val & 0x10)
11501150      {
11511151         val = val & 0x20 ? 17 : 16;
11521152      }
1153      else
1153      else
11541154      {
11551155         val = val & 15;
11561156      }
11571157      state->banks[3] = val;
11581158      slot_gmaster2_map (machine, state, 2);
1159      if (msx1.state[3] == state)
1159      if (msx1.state[3] == state)
11601160      {
11611161         slot_gmaster2_map (machine, state, 3);
11621162      }
11631163   }
1164   else if (addr >= 0xb000 && addr < 0xc000)
1164   else if (addr >= 0xb000 && addr < 0xc000)
11651165   {
11661166      addr &= 0x0fff;
1167      switch (state->banks[3])
1167      switch (state->banks[3])
11681168      {
11691169      case 16:
11701170         state->cart.sram.mem[addr] = val;
r5932r5933
11881188   filerr = mame_fopen(SEARCHPATH_MEMCARD, state->sramfile, OPEN_FLAG_READ, &f);
11891189   if (filerr == FILERR_NONE)
11901190   {
1191      if (mame_fread (f, p + 0x1000, 0x2000) == 0x2000)
1191      if (mame_fread (f, p + 0x1000, 0x2000) == 0x2000)
11921192      {
11931193         memcpy (p, p + 0x1000, 0x1000);
11941194         memcpy (p + 0x3000, p + 0x2000, 0x1000);
r5932r5933
12291229
12301230MSX_SLOT_INIT(diskrom)
12311231{
1232   if (size != 0x4000)
1232   if (size != 0x4000)
12331233   {
12341234      logerror ("diskrom: error: the diskrom should be 16kb\n");
12351235      return 1;
r5932r5933
12451245MSX_SLOT_RESET(diskrom)
12461246{
12471247   const device_config *fdc = devtag_get_device(machine, "wd179x");
1248   wd17xx_reset(fdc);   
1248   wd17xx_reset(fdc);
12491249}
12501250
12511251static READ8_HANDLER (msx_diskrom_page1_r)
12521252{
12531253   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
1254   switch (offset)
1254   switch (offset)
12551255   {
12561256   case 0: return wd17xx_status_r (fdc, 0);
12571257   case 1: return wd17xx_track_r (fdc, 0);
r5932r5933
12661266static READ8_HANDLER (msx_diskrom_page2_r)
12671267{
12681268   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
1269   if (offset >= 0x7f8)
1269   if (offset >= 0x7f8)
12701270   {
1271      switch (offset)
1271      switch (offset)
12721272      {
12731273      case 0x7f8:
12741274         return wd17xx_status_r (fdc, 0);
r5932r5933
12841284         return msx1.state[2]->mem[offset + 0x3800];
12851285      }
12861286   }
1287   else
1287   else
12881288   {
12891289      return 0xff;
12901290   }
r5932r5933
12931293MSX_SLOT_MAP(diskrom)
12941294{
12951295   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
1296   switch (page)
1296   switch (page)
12971297   {
12981298   case 0:
12991299      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
13191319MSX_SLOT_WRITE(diskrom)
13201320{
13211321   const device_config *fdc = devtag_get_device(machine, "wd179x");
1322   if (addr >= 0xa000 && addr < 0xc000)
1322   if (addr >= 0xa000 && addr < 0xc000)
13231323   {
13241324      addr -= 0x4000;
13251325   }
1326   switch (addr)
1326   switch (addr)
13271327   {
13281328   case 0x7ff8:
13291329      wd17xx_command_w (fdc, 0, val);
r5932r5933
13431343      break;
13441344   case 0x7ffd:
13451345      wd17xx_set_drive (fdc,val & 1);
1346      if ((state->mem[0x3ffd] ^ val) & 0x40)
1346      if ((state->mem[0x3ffd] ^ val) & 0x40)
13471347      {
13481348         set_led_status (0, !(val & 0x40));
13491349      }
r5932r5933
13541354
13551355MSX_SLOT_INIT(diskrom2)
13561356{
1357   if (size != 0x4000)
1357   if (size != 0x4000)
13581358   {
13591359      logerror ("diskrom2: error: the diskrom2 should be 16kb\n");
13601360      return 1;
r5932r5933
13911391static  READ8_HANDLER (msx_diskrom2_page2_r)
13921392{
13931393   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
1394   if (offset >= 0x7b8)
1394   if (offset >= 0x7b8)
13951395   {
1396      switch (offset)
1396      switch (offset)
13971397      {
13981398      case 0x7b8:
13991399         return wd17xx_status_r (fdc, 0);
r5932r5933
14091409         return msx1.state[2]->mem[offset + 0x3800];
14101410      }
14111411   }
1412   else
1412   else
14131413   {
14141414      return 0xff;
14151415   }
r5932r5933
14181418MSX_SLOT_MAP(diskrom2)
14191419{
14201420   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
1421   switch (page)
1421   switch (page)
14221422   {
14231423   case 0:
14241424      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
14431443MSX_SLOT_WRITE(diskrom2)
14441444{
14451445   const device_config *fdc = devtag_get_device(machine, "wd179x");
1446   if (addr >= 0xa000 && addr < 0xc000)
1446   if (addr >= 0xa000 && addr < 0xc000)
14471447   {
14481448      addr -= 0x4000;
14491449   }
1450   switch (addr)
1450   switch (addr)
14511451   {
14521452   case 0x7fb8:
14531453      wd17xx_command_w (fdc, 0, val);
r5932r5933
14651465      wd17xx_set_side (fdc,val & 1);
14661466      state->mem[0x3fbc] = val | 0xfe;
14671467      wd17xx_set_drive (fdc,val & 1);
1468      if ((state->mem[0x3fbc] ^ val) & 0x40)
1468      if ((state->mem[0x3fbc] ^ val) & 0x40)
14691469      {
14701470         set_led_status (0, !(val & 0x40));
14711471      }
r5932r5933
14761476
14771477MSX_SLOT_INIT(synthesizer)
14781478{
1479   if (size != 0x8000)
1479   if (size != 0x8000)
14801480   {
14811481      logerror ("synthesizer: error: rom file must be 32kb\n");
14821482      return 1;
r5932r5933
14951495
14961496MSX_SLOT_MAP(synthesizer)
14971497{
1498   switch (page)
1498   switch (page)
14991499   {
15001500   case 0:
15011501      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
15171517
15181518MSX_SLOT_WRITE(synthesizer)
15191519{
1520   if (addr >= 0x4000 && addr < 0x8000 && !(addr & 0x0010))
1520   if (addr >= 0x4000 && addr < 0x8000 && !(addr & 0x0010))
15211521   {
15221522      dac_data_w (devtag_get_device(machine, "dac"), val);
15231523   }
r5932r5933
15251525
15261526MSX_SLOT_INIT(majutsushi)
15271527{
1528   if (size != 0x20000)
1528   if (size != 0x20000)
15291529   {
15301530      logerror ("majutsushi: error: rom file must be 128kb\n");
15311531      return 1;
r5932r5933
15421542{
15431543   int i;
15441544
1545   for (i=0; i<4; i++)
1545   for (i=0; i<4; i++)
15461546   {
15471547      state->banks[i] = i;
15481548   }
r5932r5933
15501550
15511551MSX_SLOT_MAP(majutsushi)
15521552{
1553   switch (page)
1553   switch (page)
15541554   {
15551555   case 0:
15561556      msx_cpu_setbank (machine, 1, state->mem + state->banks[0] * 0x2000);
r5932r5933
15731573
15741574MSX_SLOT_WRITE(majutsushi)
15751575{
1576   if (addr >= 0x5000 && addr < 0x6000)
1576   if (addr >= 0x5000 && addr < 0x6000)
15771577   {
15781578      dac_data_w (devtag_get_device(machine, "dac"), val);
15791579   }
1580   else if (addr >= 0x6000 && addr < 0x8000)
1580   else if (addr >= 0x6000 && addr < 0x8000)
15811581   {
15821582      state->banks[1] = val & 0x0f;
15831583      slot_majutsushi_map (machine, state, 1);
1584      if (msx1.state[0] == state)
1584      if (msx1.state[0] == state)
15851585      {
15861586         slot_konami_map (machine, state, 0);
15871587      }
15881588   }
1589   else if (addr >= 0x8000 && addr < 0xc000)
1589   else if (addr >= 0x8000 && addr < 0xc000)
15901590   {
15911591      state->banks[addr < 0xa000 ? 2 : 3] = val & 0x0f;
15921592      slot_majutsushi_map (machine, state, 2);
1593      if (msx1.state[3] == state)
1593      if (msx1.state[3] == state)
15941594      {
15951595         slot_konami_map (machine, state, 3);
15961596      }
r5932r5933
16031603   UINT8 *p;
16041604   int banks;
16051605
1606   if (size > 0x400000)
1606   if (size > 0x400000)
16071607   {
16081608      logerror ("fmpac: warning: truncating rom to 4mb\n");
16091609      size = 0x400000;
16101610   }
16111611   banks = size / 0x4000;
1612   if (size != banks * 0x4000 || (~(banks - 1) % banks))
1612   if (size != banks * 0x4000 || (~(banks - 1) % banks))
16131613   {
16141614      logerror ("fmpac: error: must be a 2 power of 16kb\n");
16151615      return 1;
16161616   }
16171617
1618   if (!strncmp ((char*)mem + 0x18, "PAC2", 4))
1618   if (!strncmp ((char*)mem + 0x18, "PAC2", 4))
16191619   {
16201620      state->cart.fmpac.sram_support = 1;
16211621      p = auto_alloc_array(machine, UINT8, 0x4000);
r5932r5933
16231623      memset (p + 0x2000, 0xff, 0x2000);
16241624      state->cart.fmpac.mem = p;
16251625   }
1626   else
1626   else
16271627   {
16281628      state->cart.fmpac.sram_support = 0;
16291629      state->cart.fmpac.mem = NULL;
r5932r5933
16331633   state->size = size;
16341634   state->mem = mem;
16351635   state->bank_mask = banks - 1;
1636   if (!state->sramfile)
1636   if (!state->sramfile)
16371637   {
16381638      state->sramfile = sramfile;
16391639   }
r5932r5933
16491649   state->cart.fmpac.sram_active = 0;
16501650   state->cart.fmpac.opll_active = 0;
16511651   msx1.opll_active = 0;
1652   for (i=0; i<=state->bank_mask; i++)
1652   for (i=0; i<=state->bank_mask; i++)
16531653   {
16541654      state->mem[0x3ff6 + i * 0x4000] = 0;
16551655   }
r5932r5933
16661666
16671667MSX_SLOT_MAP(fmpac)
16681668{
1669   if (page == 1)
1669   if (page == 1)
16701670   {
1671      if (state->cart.fmpac.sram_active)
1671      if (state->cart.fmpac.sram_active)
16721672      {
16731673         msx_cpu_setbank (machine, 3, state->cart.fmpac.mem);
16741674         msx_cpu_setbank (machine, 4, state->cart.fmpac.mem + 0x2000);
16751675      }
1676      else
1676      else
16771677      {
16781678         msx_cpu_setbank (machine, 3, state->mem + state->banks[0] * 0x4000);
16791679         msx_cpu_setbank (machine, 4, state->mem + state->banks[0] * 0x4000 + 0x2000);
16801680      }
16811681   }
1682   else
1682   else
16831683   {
16841684      msx_cpu_setbank (machine, page * 2 + 1, msx1.empty);
16851685      msx_cpu_setbank (machine, page * 2 + 2, msx1.empty);
r5932r5933
16911691   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
16921692   int i, data;
16931693
1694   if (addr >= 0x4000 && addr < 0x6000 && state->cart.fmpac.sram_support)
1694   if (addr >= 0x4000 && addr < 0x6000 && state->cart.fmpac.sram_support)
16951695   {
1696      if (state->cart.fmpac.sram_active || addr >= 0x5ffe)
1696      if (state->cart.fmpac.sram_active || addr >= 0x5ffe)
16971697      {
16981698         state->cart.fmpac.mem[addr & 0x1fff] = val;
16991699      }
r5932r5933
17031703             state->cart.fmpac.mem[0x1fff] == 0x69);
17041704   }
17051705
1706   switch (addr)
1706   switch (addr)
17071707   {
17081708   case 0x7ff4:
1709      if (state->cart.fmpac.opll_active)
1709      if (state->cart.fmpac.opll_active)
17101710      {
17111711         ym2413_w (devtag_get_device(space->machine, "ay8910"), 0, val);
17121712      }
17131713      break;
17141714   case 0x7ff5:
1715      if (state->cart.fmpac.opll_active)
1715      if (state->cart.fmpac.opll_active)
17161716      {
17171717         ym2413_w (devtag_get_device(space->machine, "ay8910"), 1, val);
17181718      }
17191719      break;
17201720   case 0x7ff6:
17211721      data = val & 0x11;
1722      for (i=0; i<=state->bank_mask; i++)
1722      for (i=0; i<=state->bank_mask; i++)
17231723      {
17241724         state->mem[0x3ff6 + i * 0x4000] = data;
17251725      }
17261726      state->cart.fmpac.mem[0x3ff6] = data;
17271727      state->cart.fmpac.opll_active = val & 1;
1728      if ((msx1.opll_active ^ val) & 1)
1728      if ((msx1.opll_active ^ val) & 1)
17291729      {
17301730         logerror ("FM-PAC: OPLL %sactivated\n", val & 1 ? "" : "de");
17311731      }
r5932r5933
17481748   mame_file *f;
17491749   char buf[PAC_HEADER_LEN];
17501750
1751   if (!state->cart.fmpac.sram_support)
1751   if (!state->cart.fmpac.sram_support)
17521752   {
17531753      logerror ("Your fmpac.rom does not support sram\n");
17541754      return 1;
r5932r5933
17651765   {
17661766      if ((mame_fread (f, buf, PAC_HEADER_LEN) == PAC_HEADER_LEN) &&
17671767         !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))
17691769         {
17701770         logerror ("fmpac: info: sram loaded\n");
17711771         mame_fclose (f);
17721772         return 0;
17731773      }
1774      else
1774      else
17751775      {
17761776         logerror ("fmpac: warning: failed to load sram\n");
17771777         mame_fclose (f);
r5932r5933
17881788   file_error filerr;
17891789   mame_file *f;
17901790
1791   if (!state->cart.fmpac.sram_support || !state->sramfile)
1791   if (!state->cart.fmpac.sram_support || !state->sramfile)
17921792   {
17931793      return 0;
17941794   }
r5932r5933
17971797   if (filerr == FILERR_NONE)
17981798   {
17991799      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))
18011801         {
18021802         logerror ("fmpac: info: sram saved\n");
18031803         mame_fclose (f);
18041804         return 0;
18051805      }
1806      else
1806      else
18071807      {
18081808         logerror ("fmpac: warning: sram save to file failed\n");
18091809         mame_fclose (f);
r5932r5933
18181818
18191819MSX_SLOT_INIT(superloadrunner)
18201820{
1821   if (size != 0x20000)
1821   if (size != 0x20000)
18221822   {
18231823      logerror ("superloadrunner: error: rom file should be exactly "
18241824              "128kb\n");
r5932r5933
18401840
18411841MSX_SLOT_MAP(superloadrunner)
18421842{
1843   if (page == 2)
1843   if (page == 2)
18441844   {
18451845      UINT8 *mem = state->mem +
18461846            (msx1.superloadrunner_bank & state->bank_mask) * 0x4000;
r5932r5933
18481848      msx_cpu_setbank (machine, 5, mem);
18491849      msx_cpu_setbank (machine, 6, mem + 0x2000);
18501850   }
1851   else
1851   else
18521852   {
18531853      msx_cpu_setbank (machine, page * 2 + 1, msx1.empty);
18541854      msx_cpu_setbank (machine, page * 2 + 2, msx1.empty);
r5932r5933
18571857
18581858MSX_SLOT_INIT(crossblaim)
18591859{
1860   if (size != 0x10000)
1860   if (size != 0x10000)
18611861   {
18621862      logerror ("crossblaim: error: rom file should be exactly 64kb\n");
18631863      return 1;
r5932r5933
18801880
18811881   /* This might look odd, but it's what happens on the real cartridge */
18821882
1883   switch (page)
1883   switch (page)
18841884   {
18851885   case 0:
18861886      if (state->banks[0] < 2){
18871887         mem = state->mem + state->banks[0] * 0x4000;
18881888         msx_cpu_setbank (machine, 1, mem);
18891889         msx_cpu_setbank (machine, 2, mem + 0x2000);
1890      }
1891      else
1890      }
1891      else
18921892      {
18931893         msx_cpu_setbank (machine, 1, msx1.empty);
18941894         msx_cpu_setbank (machine, 2, msx1.empty);
r5932r5933
19081908         mem = state->mem + state->banks[0] * 0x4000;
19091909         msx_cpu_setbank (machine, 7, mem);
19101910         msx_cpu_setbank (machine, 8, mem + 0x2000);
1911      }
1912      else
1911      }
1912      else
19131913      {
19141914         msx_cpu_setbank (machine, 7, msx1.empty);
19151915         msx_cpu_setbank (machine, 8, msx1.empty);
r5932r5933
19241924   if (!block) block = 1;
19251925   state->banks[0] = block;
19261926
1927   if (msx1.state[0] == state)
1927   if (msx1.state[0] == state)
19281928   {
19291929      slot_crossblaim_map (machine, state, 0);
19301930   }
1931   if (msx1.state[2] == state)
1931   if (msx1.state[2] == state)
19321932   {
19331933      slot_crossblaim_map (machine, state, 2);
19341934   }
1935   if (msx1.state[3] == state)
1935   if (msx1.state[3] == state)
19361936   {
19371937      slot_crossblaim_map (machine, state, 3);
19381938   }
r5932r5933
19421942{
19431943   int banks;
19441944
1945   if (size > 0x200000)
1945   if (size > 0x200000)
19461946   {
19471947      logerror ("korean-80in1: warning: truncating to 2mb\n");
19481948      size = 0x200000;
19491949   }
19501950   banks = size / 0x2000;
1951   if (size != banks * 0x2000 || (~(banks - 1) % banks))
1951   if (size != banks * 0x2000 || (~(banks - 1) % banks))
19521952   {
19531953      logerror ("korean-80in1: error: must be a 2 power of 8kb\n");
19541954      return 1;
r5932r5933
19651965{
19661966   int i;
19671967
1968   for (i=0; i<4; i++)
1968   for (i=0; i<4; i++)
19691969   {
19701970      state->banks[i] = i;
19711971   }
r5932r5933
19731973
19741974MSX_SLOT_MAP(korean80in1)
19751975{
1976   switch (page)
1976   switch (page)
19771977   {
19781978   case 0:
19791979      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
19971997{
19981998   int bank;
19991999
2000   if (addr >= 0x4000 && addr < 0x4004)
2000   if (addr >= 0x4000 && addr < 0x4004)
20012001   {
20022002      bank = addr & 3;
20032003
20042004      state->banks[bank] = val & state->bank_mask;
2005      if (bank <= 1)
2005      if (bank <= 1)
20062006      {
20072007         slot_korean80in1_map (machine, state, 1);
20082008      }
2009      else if (msx1.state[2] == state)
2009      else if (msx1.state[2] == state)
20102010      {
20112011         slot_korean80in1_map (machine, state, 2);
20122012      }
r5932r5933
20172017{
20182018   int banks;
20192019
2020   if (size > 0x100000)
2020   if (size > 0x100000)
20212021   {
20222022      logerror ("korean-90in1: warning: truncating to 1mb\n");
20232023      size = 0x100000;
20242024   }
20252025   banks = size / 0x4000;
2026   if (size != banks * 0x4000 || (~(banks - 1) % banks))
2026   if (size != banks * 0x4000 || (~(banks - 1) % banks))
20272027   {
20282028      logerror ("korean-90in1: error: must be a 2 power of 16kb\n");
20292029      return 1;
r5932r5933
20482048   mem = state->mem +
20492049      ((msx1.korean90in1_bank & mask) & state->bank_mask) * 0x4000;
20502050
2051   switch (page)
2051   switch (page)
20522052   {
20532053   case 0:
20542054      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
20592059      msx_cpu_setbank (machine, 4, mem + 0x2000);
20602060      break;
20612061   case 2:
2062      switch (msx1.korean90in1_bank & 0xc0)
2062      switch (msx1.korean90in1_bank & 0xc0)
20632063      {
20642064      case 0x80: /* 32 kb mode */
20652065         mem += 0x4000;
r5932r5933
20832083{
20842084   int banks;
20852085
2086   if (size > 0x400000)
2086   if (size > 0x400000)
20872087   {
20882088      logerror ("korean-126in1: warning: truncating to 4mb\n");
20892089      size = 0x400000;
20902090   }
20912091   banks = size / 0x4000;
2092   if (size != banks * 0x4000 || (~(banks - 1) % banks))
2092   if (size != banks * 0x4000 || (~(banks - 1) % banks))
20932093   {
20942094      logerror ("korean-126in1: error: must be a 2 power of 16kb\n");
20952095      return 1;
r5932r5933
21142114{
21152115   UINT8 *mem;
21162116
2117   switch (page)
2117   switch (page)
21182118   {
21192119   case 0:
21202120      msx_cpu_setbank (machine, 1, msx1.empty);
r5932r5933
21382138
21392139MSX_SLOT_WRITE(korean126in1)
21402140{
2141   if (addr >= 0x4000 && addr < 0x4002)
2141   if (addr >= 0x4000 && addr < 0x4002)
21422142   {
21432143      int bank = addr & 1;
21442144      state->banks[bank] = val & state->bank_mask;
2145      if (bank == 0)
2145      if (bank == 0)
21462146      {
21472147         slot_korean126in1_map (machine, state, 1);
21482148      }
2149      else if (msx1.state[2] == state)
2149      else if (msx1.state[2] == state)
21502150      {
21512151         slot_korean126in1_map (machine, state, 2);
21522152      }
r5932r5933
21722172{
21732173   int i;
21742174
2175   for (i=0; i<4; i++)
2175   for (i=0; i<4; i++)
21762176   {
21772177      state->banks[i] = i;
21782178      state->cart.sccp.ram_mode[i] = 0;
r5932r5933
21882188   int reg;
21892189
21902190
2191   if (offset >= 0x7e0)
2191   if (offset >= 0x7e0)
21922192   {
21932193      return msx1.state[2]->mem[
21942194            msx1.state[2]->banks[2] * 0x2000 + 0x1800 + offset];
r5932r5933
21962196
21972197   reg = offset & 0xff;
21982198
2199   if (reg < 0x80)
2199   if (reg < 0x80)
22002200   {
22012201      return k051649_waveform_r (devtag_get_device(space->machine, "k051649"), reg);
22022202   }
2203   else if (reg < 0xa0)
2203   else if (reg < 0xa0)
22042204   {
22052205      /* nothing */
22062206   }
2207   else if (reg < 0xc0)
2207   else if (reg < 0xc0)
22082208   {
22092209      /* read wave 5 */
22102210      return k051649_waveform_r (devtag_get_device(space->machine, "k051649"), 0x80 + (reg & 0x1f));
22112211   }
22122212#if 0
2213   else if (reg < 0xe0)
2213   else if (reg < 0xe0)
22142214   {
22152215      /* write 0xff to deformation register */
22162216   }
r5932r5933
22232223{
22242224   int reg;
22252225
2226   if (offset >= 0x7e0)
2226   if (offset >= 0x7e0)
22272227   {
22282228      return msx1.state[2]->mem[
22292229            msx1.state[2]->banks[3] * 0x2000 + 0x1800 + offset];
r5932r5933
22312231
22322232   reg = offset & 0xff;
22332233
2234   if (reg < 0xa0)
2234   if (reg < 0xa0)
22352235   {
22362236      return k051649_waveform_r (devtag_get_device(space->machine, "k051649"), reg);
22372237   }
22382238#if 0
2239   else if (reg >= 0xc0 && reg < 0xe0)
2239   else if (reg >= 0xc0 && reg < 0xe0)
22402240   {
22412241      /* write 0xff to deformation register */
22422242   }
r5932r5933
22482248MSX_SLOT_MAP(soundcartridge)
22492249{
22502250   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
2251   switch (page)
2251   switch (page)
22522252   {
22532253   case 0:
22542254      msx_cpu_setbank (machine, 1, state->mem + state->banks[2] * 0x2000);
r5932r5933
22782278   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
22792279   int i;
22802280
2281   if (addr < 0x4000)
2281   if (addr < 0x4000)
22822282   {
22832283      return;
22842284   }
2285   else if (addr < 0x6000)
2285   else if (addr < 0x6000)
22862286   {
2287      if (state->cart.sccp.ram_mode[0])
2287      if (state->cart.sccp.ram_mode[0])
22882288      {
22892289         state->mem[state->banks[0] * 0x2000 + (addr & 0x1fff)] = val;
22902290      }
2291      else if (addr >= 0x5000 && addr < 0x5800)
2291      else if (addr >= 0x5000 && addr < 0x5800)
22922292      {
22932293         state->banks[0] = val & state->bank_mask;
22942294         state->cart.sccp.banks_saved[0] = val;
22952295         slot_soundcartridge_map (machine, state, 1);
2296         if (msx1.state[3] == state)
2296         if (msx1.state[3] == state)
22972297         {
22982298            slot_soundcartridge_map (machine, state, 3);
22992299         }
23002300      }
23012301   }
2302   else if (addr < 0x8000)
2302   else if (addr < 0x8000)
23032303   {
2304      if (state->cart.sccp.ram_mode[1])
2304      if (state->cart.sccp.ram_mode[1])
23052305      {
23062306         state->mem[state->banks[1] * 0x2000 + (addr & 0x1fff)] = val;
23072307      }
2308      else if (addr >= 0x7000 && addr < 0x7800)
2308      else if (addr >= 0x7000 && addr < 0x7800)
23092309      {
23102310         state->banks[1] = val & state->bank_mask;
23112311         state->cart.sccp.banks_saved[1] = val;
2312         if (msx1.state[3] == state)
2312         if (msx1.state[3] == state)
23132313         {
23142314            slot_soundcartridge_map (machine, state, 3);
23152315         }
23162316         slot_soundcartridge_map (machine, state, 1);
23172317      }
23182318   }
2319   else if (addr < 0xa000)
2319   else if (addr < 0xa000)
23202320   {
2321      if (state->cart.sccp.ram_mode[2])
2321      if (state->cart.sccp.ram_mode[2])
23222322      {
23232323         state->mem[state->banks[2] * 0x2000 + (addr & 0x1fff)] = val;
23242324      }
2325      else if (addr >= 0x9000 && addr < 0x9800)
2325      else if (addr >= 0x9000 && addr < 0x9800)
23262326      {
23272327         state->banks[2] = val & state->bank_mask;
23282328         state->cart.sccp.banks_saved[2] = val;
r5932r5933
23302330               (((val & 0x3f) == 0x3f) && !(state->cart.sccp.mode & 0x20));
23312331
23322332         slot_soundcartridge_map (machine, state, 2);
2333         if (msx1.state[0] == state)
2333         if (msx1.state[0] == state)
23342334         {
23352335            slot_soundcartridge_map (machine, state, 0);
23362336         }
23372337      }
2338      else if (addr >= 0x9800 && state->cart.sccp.scc_active)
2338      else if (addr >= 0x9800 && state->cart.sccp.scc_active)
23392339      {
23402340         const device_config *k051649 = devtag_get_device(space->machine, "k051649");
23412341         int offset = addr & 0xff;
23422342
2343         if (offset < 0x80)
2343         if (offset < 0x80)
23442344         {
23452345            k051649_waveform_w (k051649, offset, val);
23462346         }
2347         else if (offset < 0xa0)
2347         else if (offset < 0xa0)
23482348         {
23492349            offset &= 0xf;
23502350
2351            if (offset < 0xa)
2351            if (offset < 0xa)
23522352            {
23532353               k051649_frequency_w (k051649, offset, val);
23542354            }
2355            else if (offset < 0x0f)
2355            else if (offset < 0x0f)
23562356            {
23572357               k051649_volume_w (k051649, offset - 0xa, val);
23582358            }
2359            else if (offset == 0x0f)
2359            else if (offset == 0x0f)
23602360            {
23612361               k051649_keyonoff_w (k051649, 0, val);
23622362            }
23632363         }
23642364#if 0
2365         else if (offset < 0xe0)
2365         else if (offset < 0xe0)
23662366         {
23672367            /* write to deformation register */
23682368         }
23692369#endif
23702370      }
23712371   }
2372   else if (addr < 0xbffe)
2372   else if (addr < 0xbffe)
23732373   {
2374      if (state->cart.sccp.ram_mode[3])
2374      if (state->cart.sccp.ram_mode[3])
23752375      {
23762376         state->mem[state->banks[3] * 0x2000 + (addr & 0x1fff)] = val;
23772377      }
2378      else if (addr >= 0xb000 && addr < 0xb800)
2378      else if (addr >= 0xb000 && addr < 0xb800)
23792379      {
23802380         state->cart.sccp.banks_saved[3] = val;
23812381         state->banks[3] = val & state->bank_mask;
23822382         state->cart.sccp.sccp_active =
23832383               (val & 0x80) && (state->cart.sccp.mode & 0x20);
23842384         slot_soundcartridge_map (machine, state, 2);
2385         if (msx1.state[0] == state)
2385         if (msx1.state[0] == state)
23862386         {
23872387            slot_soundcartridge_map (machine, state, 0);
23882388         }
23892389      }
2390      else if (addr >= 0xb800 && state->cart.sccp.sccp_active)
2390      else if (addr >= 0xb800 && state->cart.sccp.sccp_active)
23912391      {
23922392         const device_config *k051649 = devtag_get_device(space->machine, "k051649");
23932393         int offset = addr & 0xff;
23942394
2395         if (offset < 0xa0)
2395         if (offset < 0xa0)
23962396         {
23972397            k052539_waveform_w (k051649, offset, val);
23982398         }
2399         else if (offset < 0xc0)
2399         else if (offset < 0xc0)
24002400         {
24012401            offset &= 0x0f;
24022402
2403            if (offset < 0x0a)
2403            if (offset < 0x0a)
24042404            {
24052405               k051649_frequency_w (k051649, offset, val);
24062406            }
2407            else if (offset < 0x0f)
2407            else if (offset < 0x0f)
24082408            {
24092409               k051649_volume_w (k051649, offset - 0x0a, val);
24102410            }
2411            else if (offset == 0x0f)
2411            else if (offset == 0x0f)
24122412            {
24132413               k051649_keyonoff_w (k051649, 0, val);
24142414            }
24152415         }
24162416#if 0
2417         else if (offset < 0xe0)
2417         else if (offset < 0xe0)
24182418         {
24192419            /* write to deformation register */
24202420         }
24212421#endif
24222422      }
24232423   }
2424   else if (addr < 0xc000)
2424   else if (addr < 0xc000)
24252425   {
24262426      /* write to mode register */
2427      if ((state->cart.sccp.mode ^ val) & 0x20)
2427      if ((state->cart.sccp.mode ^ val) & 0x20)
24282428      {
24292429         logerror ("soundcartrige: changed to %s mode\n",
24302430                     val & 0x20 ? "scc+" : "scc");
24312431      }
24322432      state->cart.sccp.mode = val;
2433      if (val & 0x10)
2433      if (val & 0x10)
24342434      {
24352435         /* all ram mode */
2436         for (i=0; i<4; i++)
2436         for (i=0; i<4; i++)
24372437         {
24382438            state->cart.sccp.ram_mode[i] = 1;
24392439         }
24402440      }
2441      else
2441      else
24422442      {
24432443         state->cart.sccp.ram_mode[0] = val & 1;
24442444         state->cart.sccp.ram_mode[1] = val & 2;
src/mess/machine/pc1350.c
r5932r5933
5656   if (outa & 0x04)
5757   {
5858      data |= input_port_read(machine, "KEY8");
59   
59
6060      /* At Power Up we fake a 'CLS' pressure */
6161      if (power)
6262         data |= 0x08;
r5932r5933
6868   if (outa & 0x10)
6969      data |= input_port_read(machine, "KEY10");
7070
71   if (outa & 0xc0)
71   if (outa & 0xc0)
7272      data |= input_port_read(machine, "KEY11");
7373
7474   // missing lshift
r5932r5933
119119MACHINE_START( pc1350 )
120120{
121121   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
122   
122
123123   timer_set(machine, ATTOTIME_IN_SEC(1), NULL, 0, pc1350_power_up);
124124
125125   memory_install_read8_handler(space, 0x6000, 0x6fff, 0, 0, SMH_BANK(1));
src/mess/machine/pokemini.c
r5932r5933
11/**********************************************************************
22
3   Pokemini machine emulation.
3    Pokemini machine emulation.
44
55
66**********************************************************************/
r5932r5933
215215      static const int levels[4] = { 0, 1, 1, 2 };
216216      int level = levels[ pm_reg[0x71] & 0x03 ];
217217
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//      {
221221         level = 0;
222//      }
222//      }
223223
224224      speaker_level_w( speaker, level );
225225   }
r5932r5933
428428   switch( offset )
429429   {
430430   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            */
434434   case 0x01:   /* CPU related?
435            Bit 0-7 R/W Unknown
436         */
435               Bit 0-7 R/W Unknown
436            */
437437   case 0x02:   /* CPU related?
438            Bit 0-7 R/W Unknown
439         */
438               Bit 0-7 R/W Unknown
439            */
440440      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data );
441441      break;
442442   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            */
447447      if ( data & 0x02 )
448448      {
449449         pm_reg[0x09] = 0x00;
r5932r5933
453453      }
454454      break;
455455   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            */
458458      return;
459459   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            */
462462      return;
463463   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            */
466466      return;
467467   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            */
472472      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data );
473473      break;
474474   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            */
488488      /* Check for prescaler change for the low counter */
489489      if ( ( data & 0x07 ) != ( pm_reg[0x18] & 0x07 ) )
490490      {
r5932r5933
528528      }
529529      break;
530530   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            */
538538      /* Check for prescaler change for the high counter */
539539      if ( ( data & 0x01 ) != ( pm_reg[0x19] & 0x01 ) )
540540      {
r5932r5933
601601      }
602602      break;
603603   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            */
617617      /* Check for prescaler change for the low counter */
618618      if ( ( data & 0x07 ) != ( pm_reg[0x1A] & 0x07 ) )
619619      {
r5932r5933
657657      }
658658      break;
659659   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            */
663663      /* Check for prescaler change for the high counter */
664664      if ( ( data & 0x01 ) != ( pm_reg[0x1B] & 0x01 ) )
665665      {
r5932r5933
701701      }
702702      break;
703703   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            */
717717      /* Check for prescaler change for the low counter */
718718      if ( ( data & 0x07 ) != ( pm_reg[0x1C] & 0x07 ) )
719719      {
r5932r5933
757757      }
758758      break;
759759   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            */
763763      /* Check for prescaler change for the high counter */
764764      if ( ( data & 0x01 ) != ( pm_reg[0x1D] & 0x01 ) )
765765      {
r5932r5933
801801      }
802802      break;
803803   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            */
809809      pm_reg[0x20] = data;
810810      pokemini_check_irqs( space->machine );
811811      break;
812812   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            */
817817      pm_reg[0x21] = data;
818818      pokemini_check_irqs( space->machine );
819819      break;
820820   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            */
824824      pm_reg[0x22] = data;
825825      pokemini_check_irqs( space->machine );
826826      break;
827827   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            */
837837      pm_reg[0x23] = data;
838838      pokemini_check_irqs( space->machine );
839839      break;
840840   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            */
844844      pm_reg[0x24] = data;
845845      pokemini_check_irqs( space->machine );
846846      break;
847847   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            */
857857      pm_reg[0x25] = data;
858858      pokemini_check_irqs( space->machine );
859859      break;
860860   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            */
867867      pm_reg[0x26] = data;
868868      pokemini_check_irqs( space->machine );
869869      break;
870870   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            */
880880      pm_reg[0x27] &= ~data;
881881      pokemini_check_irqs( space->machine );
882882      return;
883883   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            */
891891      pm_reg[0x28] &= ~data;
892892      pokemini_check_irqs( space->machine );
893893      return;
894894   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            */
904904      pm_reg[0x29] &= ~data;
905905      pokemini_check_irqs( space->machine );
906906      return;
907907   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            */
912912      pm_reg[0x2A] &= ~data;
913913      pokemini_check_irqs( space->machine );
914914      return;
915915   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            */
923923      if ( data & 0x02 )
924924      {
925925         pm_reg[0x36] = pm_reg[0x32];
r5932r5933
949949      }
950950      break;
951951   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            */
958958      if ( data & 0x02 )
959959      {
960960         pm_reg[0x37] = pm_reg[0x33];
r5932r5933
973973      }
974974      break;
975975   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            */
978978      break;
979979   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            */
982982      break;
983983   case 0x34:   /* Timer 1 sound-pivot (low, unused)
984         */
984            */
985985   case 0x35:   /* Timer 1 sound-pivot (high, unused)
986         */
986            */
987987      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data );
988988      break;
989989   case 0x36:   /* Timer 1 counter (low), read only
990         */
990            */
991991      return;
992992   case 0x37:   /* Timer 1 counter (high), read only
993         */
993            */
994994      return;
995995   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            */
10031003      if ( data & 0x02 )
10041004      {
10051005         pm_reg[0x3E] = pm_reg[0x3A];
r5932r5933
10281028      }
10291029      break;
10301030   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            */
10371037      if ( data & 0x02 )
10381038      {
10391039         pm_reg[0x3F] = pm_reg[0x3A];
r5932r5933
10521052      }
10531053      break;
10541054   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            */
10571057      break;
10581058   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            */
10611061      break;
10621062   case 0x3C:   /* Timer 2 sound-pivot (low, unused)
1063         */
1063            */
10641064   case 0x3D:   /* Timer 2 sound-pivot (high, unused)
1065         */
1065            */
10661066      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data );
10671067      break;
10681068   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            */
10711071      return;
10721072   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            */
10751075      return;
10761076   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            */
10811081      if ( data & 0x02 )
10821082      {
10831083         pm_reg[0x41] = 0;
r5932r5933
10851085      }
10861086      break;
10871087   case 0x41:   /* 256Hz timer counter
1088            Bit 0-7 R   256Hz timer counter
1089         */
1088               Bit 0-7 R   256Hz timer counter
1089            */
10901090      return;
10911091   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            */
10991099      if ( data & 0x02 )
11001100      {
11011101         pm_reg[0x4E] = pm_reg[0x4A];
r5932r5933
11261126      pokemini_update_sound( space->machine );
11271127      break;
11281128   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            */
11351135      if ( data & 0x02 )
11361136      {
11371137         pm_reg[0x4F] = pm_reg[0x4B];
r5932r5933
11521152      pokemini_update_sound( space->machine );
11531153      break;
11541154   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            */
11571157      pm_reg[0x4A] = data;
11581158      pokemini_update_sound( space->machine );
11591159      break;
11601160   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            */
11631163      pm_reg[0x4B] = data;
11641164      pokemini_update_sound( space->machine );
11651165      break;
11661166   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            */
11691169      pm_reg[0x4C] = data;
11701170      pokemini_update_sound( space->machine );
11711171      break;
11721172   case 0x4D:   /* Timer 3 sound-pivot (high)
1173            Bit 0-7 R/W Timer 3 sound-pivot value bit 8-15
1173               Bit 0-7 R/W Timer 3 sound-pivot value bit 8-15
11741174
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            */
11801180      pm_reg[0x4D] = data;
11811181      pokemini_update_sound( space->machine );
11821182      break;
11831183   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            */
11861186      return;
11871187   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            */
11901190      return;
11911191   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            */
12011201      return;
12021202   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            */
12121212      break;
12131213   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            */
12231223      if ( pm_reg[0x60] & 0x04 )
12241224         i2cmem_write( space->machine, 0, I2CMEM_SDA, ( data & 0x04 ) ? 1 : 0 );
12251225
r5932r5933
12311231      pokemini_update_sound( space->machine );
12321232      break;
12331233   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            */
12421242      pm_reg[0x71] = data;
12431243      pokemini_update_sound( space->machine );
12441244      break;
12451245   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            */
12571257      prc.colors_inverted = ( data & 0x01 ) ? 1 : 0;
12581258      prc.background_enabled = ( data & 0x02 ) ? 1 : 0;
12591259      prc.sprites_enabled = ( data & 0x04 ) ? 1 : 0;
r5932r5933
12711271      }
12721272      break;
12731273   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            */
12861286      switch ( data & 0x0E )
12871287      {
12881288      case 0x00:   prc.max_frame_count = 3; break;
r5932r5933
12961296      }
12971297      break;
12981298   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            */
13021302      data &= 0xF8;
13031303      prc.bg_tiles = ( prc.bg_tiles & 0xFFFF00 ) | data;
13041304      break;
13051305   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            */
13081308      prc.bg_tiles = ( prc.bg_tiles & 0xFF00FF ) | ( data << 8 );
13091309      break;
13101310   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            */
13141314      data &= 0x1F;
13151315      prc.bg_tiles = ( prc.bg_tiles & 0x00FFFF ) | ( data << 16 );
13161316      break;
13171317   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            */
13241324   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            */
13311331      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data );
13321332      break;
13331333   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            */
13371337      data &= 0xC0;
13381338      prc.spr_tiles = ( prc.spr_tiles & 0xFFFF00 ) | data;
13391339      break;
13401340   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            */
13431343      prc.spr_tiles = ( prc.spr_tiles & 0xFF00FF ) | ( data << 8 );
13441344      break;
13451345   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            */
13491349      data &= 0x1F;
13501350      prc.spr_tiles = ( prc.spr_tiles & 0x00FFFF ) | ( data << 16 );
13511351      break;
13521352   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            */
13611361   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 );
13651365      break;
13661366   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 );
13701370      break;
13711371   default:
13721372      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( space->cpu ), offset, data );
src/mess/machine/rp5c15.c
r5932r5933
11/*
22
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
66
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.
99
10   Date and time are stored in BCD, one digit to each register
10    Date and time are stored in BCD, one digit to each register
1111
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
2929
3030
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)
4040
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.
4545
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.
4949
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.
5353
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
5858
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.
6161
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
6767
6868*/
6969
src/mess/machine/coco.c
r5932r5933
66  I/O ports)
77
88  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)
2020
2121  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
2626
2727  In the CoCo, all timings should be exactly relative to each other.  This
2828  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)
3333
3434  It is also noting that the CoCo 3 had two sets of VSync interrupts.  To quote
3535  John Kowalski:
3636
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.
4545
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.
5050
5151Dragon Alpha code added 21-Oct-2004,
52         Phill Harvey-Smith (afra@aurigae.demon.co.uk)
52            Phill Harvey-Smith (afra@aurigae.demon.co.uk)
5353
54         Added AY-8912 and FDC code 30-Oct-2004.
54            Added AY-8912 and FDC code 30-Oct-2004.
5555
5656Fixed Dragon Alpha NMI enable/disable, following circuit traces on a real machine.
57   P.Harvey-Smith, 11-Aug-2005.
57    P.Harvey-Smith, 11-Aug-2005.
5858
5959Re-implemented Alpha NMI enable/disable, using direct PIA reads, rather than
6060keeping track of it in a variable in the driver.
61   P.Harvey-Smith, 25-Sep-2006.
61    P.Harvey-Smith, 25-Sep-2006.
6262
6363Radically re-wrote memory emulation code for CoCo 1/2 & Dragon machines, the
6464new code emulates the memory mapping of the SAM, dependent on what size of
r5932r5933
7575the CoCo 1/2 should stay in coco.c, and that the coco3 and dragon specifc code
7676should go into coco3.c and dragon.c which should (hopefully) make the code
7777easier to manage.
78   P.Harvey-Smith, Dec 2006-Feb 2007
78    P.Harvey-Smith, Dec 2006-Feb 2007
7979***************************************************************************/
8080
8181#include <math.h>
r5932r5933
238238 * Notes of interest:  Below are some observations of key programs and what
239239 * they rely on:
240240 *
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
243243 */
244244
245245const struct coco3_video_vars coco3_vidvars =
r5932r5933
271271   DEVCB_NULL,
272272   DEVCB_NULL,
273273   DEVCB_NULL,
274   /*outputs: A/B,CA/B2      */
274   /*outputs: A/B,CA/B2       */
275275   DEVCB_HANDLER(d_pia0_pa_w),
276276   DEVCB_HANDLER(d_pia0_pb_w),
277277   DEVCB_HANDLER(d_pia0_ca2_w),
278278   DEVCB_HANDLER(d_pia0_cb2_w),
279   /*irqs    : A/B            */
279   /*irqs   : A/B             */
280280   DEVCB_LINE(d_pia0_irq_a),
281281   DEVCB_LINE(d_pia0_irq_b)
282282};
r5932r5933
291291   DEVCB_NULL,
292292   DEVCB_NULL,
293293   DEVCB_NULL,
294   /*outputs: A/B,CA/B2      */
294   /*outputs: A/B,CA/B2       */
295295   DEVCB_HANDLER(d_pia1_pa_w),
296296   DEVCB_HANDLER(d_pia1_pb_w),
297297   DEVCB_HANDLER(d_pia1_ca2_w),
298298   DEVCB_HANDLER(d_pia1_cb2_w),
299   /*irqs    : A/B            */
299   /*irqs   : A/B             */
300300   DEVCB_LINE(d_pia1_firq_a),
301301   DEVCB_LINE(d_pia1_firq_b)
302302};
r5932r5933
311311   DEVCB_NULL,
312312   DEVCB_NULL,
313313   DEVCB_NULL,
314   /*outputs: A/B,CA/B2      */
314   /*outputs: A/B,CA/B2       */
315315   DEVCB_HANDLER(d_pia0_pa_w),
316316   DEVCB_HANDLER(d_pia0_pb_w),
317317   DEVCB_HANDLER(d_pia0_ca2_w),
318318   DEVCB_HANDLER(d_pia0_cb2_w),
319   /*irqs    : A/B            */
319   /*irqs   : A/B             */
320320   DEVCB_LINE(d_pia0_irq_a),
321321   DEVCB_LINE(d_pia0_irq_b)
322322};
r5932r5933
331331   DEVCB_NULL,
332332   DEVCB_NULL,
333333   DEVCB_NULL,
334   /*outputs: A/B,CA/B2      */
334   /*outputs: A/B,CA/B2       */
335335   DEVCB_HANDLER(d_pia1_pa_w),
336336   DEVCB_HANDLER(d_pia1_pb_w_coco2),
337337   DEVCB_HANDLER(d_pia1_ca2_w),
338338   DEVCB_HANDLER(d_pia1_cb2_w),
339   /*irqs    : A/B            */
339   /*irqs   : A/B             */
340340   DEVCB_LINE(d_pia1_firq_a),
341341   DEVCB_LINE(d_pia1_firq_b)
342342};
r5932r5933
351351   DEVCB_NULL,
352352   DEVCB_NULL,
353353   DEVCB_NULL,
354   /*outputs: A/B,CA/B2      */
354   /*outputs: A/B,CA/B2       */
355355   DEVCB_HANDLER(d_pia0_pa_w),
356356   DEVCB_HANDLER(d_pia0_pb_w),
357357   DEVCB_HANDLER(d_pia0_ca2_w),
358358   DEVCB_HANDLER(d_pia0_cb2_w),
359   /*irqs    : A/B            */
359   /*irqs   : A/B             */
360360   DEVCB_LINE(coco3_pia0_irq_a),
361361   DEVCB_LINE(coco3_pia0_irq_b)
362362};
r5932r5933
371371   DEVCB_NULL,
372372   DEVCB_NULL,
373373   DEVCB_NULL,
374   /*outputs: A/B,CA/B2      */
374   /*outputs: A/B,CA/B2       */
375375   DEVCB_HANDLER(d_pia1_pa_w),
376376   DEVCB_HANDLER(d_pia1_pb_w),
377377   DEVCB_HANDLER(d_pia1_ca2_w),
378378   DEVCB_HANDLER(d_pia1_cb2_w),
379   /*irqs    : A/B            */
379   /*irqs   : A/B             */
380380   DEVCB_LINE(coco3_pia1_firq_a),
381381   DEVCB_LINE(coco3_pia1_firq_b)
382382};
r5932r5933
391391   DEVCB_NULL,
392392   DEVCB_NULL,
393393   DEVCB_NULL,
394   /*outputs: A/B,CA/B2      */
394   /*outputs: A/B,CA/B2       */
395395   DEVCB_HANDLER(d_pia0_pa_w),
396396   DEVCB_HANDLER(d_pia0_pb_w),
397397   DEVCB_HANDLER(d_pia0_ca2_w),
398398   DEVCB_HANDLER(d_pia0_cb2_w),
399   /*irqs    : A/B            */
399   /*irqs   : A/B             */
400400   DEVCB_LINE(d_pia0_irq_a),
401401   DEVCB_LINE(d_pia0_irq_b)
402402};
r5932r5933
411411   DEVCB_NULL,
412412   DEVCB_NULL,
413413   DEVCB_NULL,
414   /*outputs: A/B,CA/B2      */
414   /*outputs: A/B,CA/B2       */
415415   DEVCB_HANDLER(d_pia1_pa_w),
416416   DEVCB_HANDLER(d_pia1_pb_w),
417417   DEVCB_HANDLER(d_pia1_ca2_w),
418418   DEVCB_HANDLER(d_pia1_cb2_w),
419   /*irqs    : A/B            */
419   /*irqs   : A/B             */
420420   DEVCB_LINE(d_pia1_firq_a),
421421   DEVCB_LINE(d_pia1_firq_b)
422422};
r5932r5933
431431   DEVCB_NULL,
432432   DEVCB_NULL,
433433   DEVCB_NULL,
434   /*outputs: A/B,CA/B2      */
434   /*outputs: A/B,CA/B2       */
435435   DEVCB_HANDLER(d_pia0_pa_w),
436436   DEVCB_HANDLER(d_pia0_pb_w),
437437   DEVCB_HANDLER(d_pia0_ca2_w),
438438   DEVCB_HANDLER(d_pia0_cb2_w),
439   /*irqs    : A/B            */
439   /*irqs   : A/B             */
440440   DEVCB_LINE(d_pia0_irq_a),
441441   DEVCB_LINE(d_pia0_irq_b)
442442};
r5932r5933
451451   DEVCB_NULL,
452452   DEVCB_NULL,
453453   DEVCB_NULL,
454   /*outputs: A/B,CA/B2      */
454   /*outputs: A/B,CA/B2       */
455455   DEVCB_HANDLER(d_pia1_pa_w),
456456   DEVCB_HANDLER(dragon64_pia1_pb_w),
457457   DEVCB_HANDLER(d_pia1_ca2_w),
458458   DEVCB_HANDLER(d_pia1_cb2_w),
459   /*irqs    : A/B            */
459   /*irqs   : A/B             */
460460   DEVCB_LINE(d_pia1_firq_a),
461461   DEVCB_LINE(d_pia1_firq_b)
462462};
r5932r5933
472472   DEVCB_NULL,
473473   DEVCB_NULL,
474474   DEVCB_NULL,
475   /*outputs: A/B,CA/B2      */
475   /*outputs: A/B,CA/B2       */
476476   DEVCB_HANDLER(d_pia0_pa_w),
477477   DEVCB_HANDLER(d_pia0_pb_w),
478478   DEVCB_HANDLER(d_pia0_ca2_w),
479479   DEVCB_HANDLER(d_pia0_cb2_w),
480   /*irqs    : A/B            */
480   /*irqs   : A/B             */
481481   DEVCB_LINE(d_pia0_irq_a),
482482   DEVCB_LINE(d_pia0_irq_b)
483483};
r5932r5933
492492   DEVCB_NULL,
493493   DEVCB_NULL,
494494   DEVCB_NULL,
495   /*outputs: A/B,CA/B2      */
495   /*outputs: A/B,CA/B2       */
496496   DEVCB_HANDLER(d_pia1_pa_w),
497497   DEVCB_HANDLER(d_pia1_pb_w),
498498   DEVCB_HANDLER(d_pia1_ca2_w),
499499   DEVCB_HANDLER(d_pia1_cb2_w),
500   /*irqs    : A/B            */
500   /*irqs   : A/B             */
501501   DEVCB_LINE(d_pia1_firq_a),
502502   DEVCB_LINE(d_pia1_firq_b)
503503};
r5932r5933
512512   DEVCB_NULL,
513513   DEVCB_NULL,
514514   DEVCB_NULL,
515   /*outputs: A/B,CA/B2      */
515   /*outputs: A/B,CA/B2       */
516516   DEVCB_HANDLER(dgnalpha_pia2_pa_w),
517517   DEVCB_NULL,
518518   DEVCB_NULL,
519519   DEVCB_NULL,
520   /*irqs    : A/B               */
520   /*irqs   : A/B             */
521521   DEVCB_LINE(d_pia2_firq_a),
522522   DEVCB_LINE(d_pia2_firq_b)
523523};
r5932r5933
612612   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_CC, trailer->reg_cc);
613613
614614   /* 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     */
619619
620620   pia6821_w(state->pia_0, 1, 0x00);
621621   pia6821_w(state->pia_0, 3, 0x00);
r5932r5933
637637   pia6821_w(state->pia_1, 2, trailer->pia[6]);
638638
639639   /* 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     */
644644   sam_set_state(state->sam, trailer->sam, 0x7fff);
645645}
646646
r5932r5933
712712      paklength = 0xff00;
713713
714714   /* 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     */
722722
723723   memcpy(rambase + 0x8000, rombase, 0x4000);
724724   memcpy(rambase + 0xC000, pakbase, 0x3F00);
r5932r5933
814814   romsize = image_length(image);
815815
816816   /* 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. */
822822
823823   if (image_crc(image) == 0x25C3AA70)     /* Test for Arkanoid  */
824824   {
r5932r5933
10971097   double val;
10981098   UINT8 ctrl = input_port_read_safe(machine, "ctrl_sel", 0x00);
10991099   /* this function gets only called for hi-res joystick. hence, ctrl can only take values
1100      0x04, 0x40 (hi-res) or 0x05, 0x50 (hi-res coco3max) */
1100       0x04, 0x40 (hi-res) or 0x05, 0x50 (hi-res coco3max) */
11011101   UINT8 coco3max = ((ctrl & 0x0f) == 0x05 || (ctrl & 0xf0) == 0x50) ? 1 : 0;
11021102
11031103   static const char *const port_tags[2][4] =
r5932r5933
11601160
11611161  The sound MUX has 4 possible settings, depend on SELA and SELB inputs:
11621162
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)
11671167
11681168  Note on the Dragon Alpha state 11, selects the AY-3-8912, this is currently
11691169  un-implemented - phs.
r5932r5933
12161216static void soundmux_update(running_machine *machine)
12171217{
12181218   /* 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     */
12231223   cassette_state new_state;
12241224   int soundmux_status = get_soundmux_status(machine);
12251225
r5932r5933
12471247   coco_state *state = machine->driver_data;
12481248
12491249   /* 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     */
12521252   UINT8 dac = pia6821_get_output_a(state->pia_1) & 0xFC;
12531253   UINT8 pia1_pb1 = (pia6821_get_output_b(state->pia_1) & 0x02) ? 0x80 : 0x00;
12541254   int soundmux_status = get_soundmux_status(machine);
r5932r5933
12751275}
12761276
12771277/*
1278   Dragon Alpha AY-3-8912
1278    Dragon Alpha AY-3-8912
12791279*/
12801280
12811281READ8_HANDLER ( dgnalpha_psg_porta_read )
r5932r5933
13091309/***************************************************************************
13101310  PIA0 ($FF00-$FF1F) (Chip U8)
13111311
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)
13181318***************************************************************************/
13191319
13201320static WRITE8_DEVICE_HANDLER ( d_pia0_ca2_w )
r5932r5933
14981498/***************************************************************************
14991499  PIA1 ($FF20-$FF3F) (Chip U4)
15001500
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)
15161516***************************************************************************/
15171517
15181518static WRITE8_DEVICE_HANDLER ( d_pia1_cb2_w )
r5932r5933
15441544static WRITE8_DEVICE_HANDLER ( d_pia1_pa_w )
15451545{
15461546   /*
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     */
15531553   UINT8 dac = pia6821_get_output_a(device) & 0xFC;
15541554   static int dclg_previous_bit;
15551555
r5932r5933
16361636   mc6847_ag_w(state->mc6847, BIT(data, 7));
16371637
16381638   /* 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     */
16441644   coco_sound_update(device->machine);
16451645}
16461646
r5932r5933
16551655   mc6847_ag_w(state->mc6847, BIT(data, 7));
16561656
16571657   /* 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     */
16631663   coco_sound_update(device->machine);
16641664}
16651665
r5932r5933
16841684/***************************************************************************
16851685  PIA2 ($FF24-$FF28) on Daragon Alpha/Professional
16861686
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.
16931693***************************************************************************/
16941694
16951695static WRITE8_DEVICE_HANDLER( dgnalpha_pia2_pa_w )
r5932r5933
18611861   coco_state *state = device->machine->driver_data;
18621862
18631863   /* This handles the reading of the memory sense switch (pb2) for the CoCo 1,
1864    * and serial-in (pb0). Serial-in not yet implemented. */
1864    * and serial-in (pb0). Serial-in not yet implemented. */
18651865   int result;
18661866
18671867   /* 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 */
18731873
18741874   if (mess_ram_size > 0x8000)      /* 1 bank of 64K rams */
18751875      result = (pia6821_get_output_b(state->pia_0) & 0x80) >> 5;
r5932r5933
18841884static READ8_DEVICE_HANDLER ( d_pia1_pb_r_dragon32 )
18851885{
18861886   /* This handles the reading of the memory sense switch (pb2) for the Dragon 32,
1887    * and pb0, is the printer /busy line. */
1887    * and pb0, is the printer /busy line. */
18881888
18891889   int result;
18901890
18911891   /* 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 */
18941894
18951895   if (mess_ram_size > 0x8000)
18961896      result = 0x00;      /* 1 bank of 64K, rams */
r5932r5933
19051905   coco_state *state = device->machine->driver_data;
19061906
19071907   /* 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     */
19101910   int result;
19111911
19121912   if (mess_ram_size <= 0x1000)
r5932r5933
19201920
19211921
19221922/*
1923   Compusense Dragon Plus Control register
1923    Compusense Dragon Plus Control register
19241924*/
19251925
19261926/* The read handler will eventually return the 6845 status */
r5932r5933
19301930}
19311931
19321932/*
1933   When writing the bits have the following meanings :
1933    When writing the bits have the following meanings :
19341934
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,
19381938
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.
19441944*/
19451945WRITE8_HANDLER ( plus_reg_w )
19461946{
r5932r5933
19711971static SAM6883_SET_MPU_RATE( d_sam_set_mpurate )
19721972{
19731973   /* 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     */
19951995    cpu_set_clockscale(cputag_get_cpu(device->machine, "maincpu"), val ? 2 : 1);
19961996}
19971997
r5932r5933
20032003static void setup_memory_map(running_machine *machine)
20042004{
20052005   /*
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 :-
20092009
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.
20142014
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.
20172017
2018   The following table holds the data required to implement this.
2018    The following table holds the data required to implement this.
20192019
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    */
20232023
20242024   struct coco_meminfo
20252025   {
r5932r5933
20562056   coco_state *state = machine->driver_data;
20572057   UINT8 memsize   = get_sam_memorysize(state->sam);
20582058   UINT8 maptype   = get_sam_maptype(state->sam);
2059//   UINT8 pagemode   = get_sam_pagemode(machine);
2059//  UINT8 pagemode  = get_sam_pagemode(machine);
20602060   int       last_ram_block;      /* Last block that will be RAM, dependent on maptype */
20612061   int       block_index;      /* Index of block being processed */
20622062   int       wbank;         /* bank no to go in this block */
r5932r5933
21282128static SAM6883_SET_PAGE_ONE_MODE( d_sam_set_pageonemode )
21292129{
21302130   /* 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     */
21362136
21372137   if (!get_sam_maptype(device))      // Ignored in maptype 1
21382138   {
r5932r5933
21482148static SAM6883_SET_MEMORY_SIZE( d_sam_set_memorysize )
21492149{
21502150   /* 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     */
21732173
21742174   setup_memory_map(device->machine);
21752175}
r5932r5933
22792279
22802280/*************************************
22812281 *
2282 *   CoCo 3
2282 *  CoCo 3
22832283 *
22842284 *************************************/
22852285
r5932r5933
22892289 * translates it into a physical RAM address.  The following logical memory
22902290 * addresses have the following bank indexes:
22912291 *
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
23012301 *
23022302 * The result represents a physical RAM address.  Since ROM/Cartidge space is
23032303 * outside of the standard RAM memory map, ROM addresses get a "physical RAM"
r5932r5933
23182318      if (coco3_gimereg[0] & 8)
23192319      {
23202320         /* this GIME register fixes logical addresses $FExx to physical
2321          * addresses $7FExx ($1FExx if 128k */
2321            * addresses $7FExx ($1FExx if 128k */
23222322         assert(offset < 0x200);
23232323         return ((mess_ram_size - 0x200) & 0x7ffff) + offset;
23242324      }
r5932r5933
23452345   }
23462346
23472347   /* 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     */
23592359   if (((block & 0x3f) >= 0x3c) && !coco3_enable_64k && !forceram)
23602360   {
23612361      static const UINT8 rommap[4][4] =
r5932r5933
24392439READ8_HANDLER(coco3_mmu_r)
24402440{
24412441   /* 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     */
24442444   return coco3_mmu[offset];
24452445}
24462446
r5932r5933
24882488   case 4:   /* Timer MSB/LSB; these arn't readable */
24892489   case 5:
24902490      /* 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         */
24932493      result = 0x7e;
24942494      break;
24952495
r5932r5933
25152515   switch(offset)
25162516   {
25172517      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            */
25282528         coco3_mmu_update(space->machine, 0, 8);
25292529         {
25302530            if (coco3_gimereg[0] & 0x04)
r5932r5933
25422542         break;
25432543
25442544      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            */
25552555         coco3_mmu_update(space->machine, 0, 8);
25562556         coco3_timer_reset(space->machine);
25572557         break;
25582558
25592559      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            */
25702570         if (LOG_INT_MASKING)
25712571         {
25722572            logerror("CoCo3 IRQ: Interrupts { %s%s%s%s%s%s} enabled\n",
r5932r5933
25812581         break;
25822582
25832583      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            */
25942594         if (LOG_INT_MASKING)
25952595         {
25962596            logerror("CoCo3 FIRQ: Interrupts { %s%s%s%s%s%s} enabled\n",
r5932r5933
26052605         break;
26062606
26072607      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            */
26122612         coco3_timer_reset(space->machine);
26132613         break;
26142614
26152615      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            */
26192619         if (timer_was_off && (coco3_gimereg[5] != 0x00))
26202620                     {
26212621                             /* 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                */
26322632            coco3_timer_reset(space->machine);
26332633                     }
26342634         break;
26352635
26362636      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            */
26452645         break;
26462646
26472647      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            */
26542654         break;
26552655
26562656      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            */
26612661         break;
26622662
26632663      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            */
26682668         break;
26692669
26702670      case 11:
26712671      case 13:
26722672      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            */
26812681         break;
26822682
26832683      case 15:
26842684         /*
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            */
26912691         break;
26922692   }
26932693}
r5932r5933
27152715/***************************************************************************
27162716    CARTRIDGE EXPANSION SLOT
27172717
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.
27232723
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
27292729***************************************************************************/
27302730
27312731/*-------------------------------------------------
r5932r5933
27412741
27422742/*-------------------------------------------------
27432743    coco3_cart_w - calls coco_cart_w and
2744   in addition will raise the GIME interrupt
2744    in addition will raise the GIME interrupt
27452745-------------------------------------------------*/
27462746
27472747void coco3_cart_w(const device_config *device, int data)
r5932r5933
27762776
27772777/*-------------------------------------------------
27782778    coco_pia_1_w - wrapper for pia_1_w() that will
2779   also call twiddle Q lines, if necessary
2779    also call twiddle Q lines, if necessary
27802780-------------------------------------------------*/
27812781
27822782WRITE8_DEVICE_HANDLER(coco_pia_1_w)
src/mess/machine/tc8521.c
r5932r5933
11/*********************************************************************
22
3   tc8521.h
3    tc8521.h
44
5   Toshiba TC8251 Real Time Clock code
5    Toshiba TC8251 Real Time Clock code
66
7   (or RICOH RF5C01A)
7    (or RICOH RF5C01A)
88
9   Registers:
9    Registers:
1010
11      Page 0/Mode 0 (timer):
11        Page 0/Mode 0 (timer):
1212
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
2626
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
4141
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
5757
5858
59      registers common to all modes:
59        registers common to all modes:
6060
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
7575
7676*********************************************************************/
7777
r5932r5933
179179
180180/*-------------------------------------------------
181181    tc8521_load_stream - read tc8521 data from
182   supplied file
182    supplied file
183183-------------------------------------------------*/
184184
185185void tc8521_load_stream(const device_config *device, mame_file *file)
r5932r5933
198198
199199/*-------------------------------------------------
200200    tc8521_save_stream - write tc8521 data to
201   supplied file
201    supplied file
202202-------------------------------------------------*/
203203
204204void tc8521_save_stream(const device_config *device, mame_file *file)
src/mess/machine/mc6854.c
r5932r5933
216216
217217
218218
219INLINE mc6854_t* get_safe_token( const device_config *device )
219INLINE mc6854_t* get_safe_token( const device_config *device )
220220{
221221   assert( device != NULL );
222222   assert( device->token != NULL );
src/mess/machine/gb.c
r5932r5933
66
77  Changes:
88
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.
3131
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.
3434
3535***************************************************************************/
3636#define __MACHINE_GB_C
r5932r5933
9696static UINT8 sgb_atf_data[4050];      /* (SGB) Attribute files                       */
9797UINT8 *sgb_tile_data;
9898UINT16 sgb_pal[128];   /* SGB palette remapping */
99UINT16 sgb_pal_data[4096];   /* 512 palettes of 4 colours         */
100UINT8 sgb_pal_map[20][18];   /* Palette tile map                  */
101UINT8 sgb_tile_map[2048];   /* 32x32 tile map data (0-tile,1-attribute)   */
102UINT8 sgb_window_mask;      /* Current GB screen mask            */
103UINT8 sgb_hack;            /* Flag set if we're using a hack      */
99UINT16 sgb_pal_data[4096];   /* 512 palettes of 4 colours            */
100UINT8 sgb_pal_map[20][18];   /* Palette tile map                     */
101UINT8 sgb_tile_map[2048];   /* 32x32 tile map data (0-tile,1-attribute) */
102UINT8 sgb_window_mask;      /* Current GB screen mask               */
103UINT8 sgb_hack;            /* Flag set if we're using a hack       */
104104
105105static UINT8 *gb_cart = NULL;
106106static UINT8 *gb_cart_ram = NULL;
r5932r5933
160160/* #define V_BANK*/         /* Display bank switching debug information */
161161#endif
162162
163static void gb_init_regs(running_machine *machine)
163static void gb_init_regs(running_machine *machine)
164164{
165165   /* Initialize the registers */
166166   SIODATA = 0x00;
r5932r5933
170170   gb_io_w( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM ), 0x06, 0x00 );      /* TIMEMOD */
171171}
172172
173static void gb_rom16_0000( running_machine *machine, UINT8 *addr )
173static void gb_rom16_0000( running_machine *machine, UINT8 *addr )
174174{
175175   memory_set_bankptr( machine, 5, addr );
176176   memory_set_bankptr( machine, 10, addr + 0x0100 );
r5932r5933
178178   memory_set_bankptr( machine, 11, addr + 0x0900 );
179179}
180180
181static void gb_rom16_4000( running_machine *machine, UINT8 *addr )
181static void gb_rom16_4000( running_machine *machine, UINT8 *addr )
182182{
183183   memory_set_bankptr( machine, 1, addr );
184184   memory_set_bankptr( machine, 4, addr + 0x2000 );
185185}
186186
187static void gb_rom8_4000( running_machine *machine, UINT8 *addr )
187static void gb_rom8_4000( running_machine *machine, UINT8 *addr )
188188{
189189   memory_set_bankptr( machine, 1, addr );
190190}
191191
192static void gb_rom8_6000( running_machine *machine, UINT8 *addr )
192static void gb_rom8_6000( running_machine *machine, UINT8 *addr )
193193{
194194   memory_set_bankptr( machine, 4, addr );
195195}
196196
197static void gb_init(running_machine *machine)
197static void gb_init(running_machine *machine)
198198{
199199   const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM );
200200
r5932r5933
328328   memset( sgb_tile_data, 0, 0x2000 );
329329
330330   /* Initialize the Sound Registers */ // should be unnecessary with the bootrom
331   //gb_sound_w(devtag_get_device(machine, "custom"), 0x16,0xF0);   /* F0 for SGB */
331   //gb_sound_w(devtag_get_device(machine, "custom"), 0x16,0xF0);  /* F0 for SGB */
332332   //gb_sound_w(devtag_get_device(machine, "custom"), 0x15,0xF3);
333333   //gb_sound_w(devtag_get_device(machine, "custom"), 0x14,0x77);
334334
r5932r5933
337337   memset( sgb_atf_data, 0, sizeof(sgb_atf_data) );
338338
339339   /* 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 */
342342   sgb_hack = 0;
343343
344344   if (gb_cart)   // make sure cart is in
r5932r5933
387387   memory_set_bankptr(machine, 6, memory_region(machine, "maincpu") + 0x100 );
388388
389389   /* Allocate memory for internal ram */
390   for( ii = 0; ii < 8; ii++ )
390   for( ii = 0; ii < 8; ii++ )
391391   {
392392      GBC_RAMMap[ii] = mess_ram + CGB_START_RAM_BANKS + ii * 0x1000;
393393      memset (GBC_RAMMap[ii], 0, 0x1000);
r5932r5933
401401      return;
402402
403403   /* 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. */
406406   image_battery_save(devtag_get_device(machine, "cart"), gb_cart_ram, RAMBanks * 0x2000 );
407407}
408408
409static void gb_set_mbc1_banks( running_machine *machine )
409static void gb_set_mbc1_banks( running_machine *machine )
410410{
411411   gb_rom16_4000( machine, ROMMap[ ROMBank ] );
412412   memory_set_bankptr( machine, 2, RAMMap[ MBC1Mode ? ( ROMBank >> 5 ) : 0 ] );
r5932r5933
454454static WRITE8_HANDLER( gb_rom_bank_select_mbc5 )
455455{
456456   /* 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    */
460460   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 )
462462   {
463463      ROMBank = (ROMBank & 0xFF ) | ( ( data & 0x01 ) << 8 );
464   }
465   else
464   }
465   else
466466   {
467467      ROMBank = (ROMBank & 0x100 ) | data;
468468   }
r5932r5933
470470   gb_rom16_4000( space->machine, ROMMap[ROMBank] );
471471}
472472
473static WRITE8_HANDLER( gb_ram_bank_select_mbc6 )
473static WRITE8_HANDLER( gb_ram_bank_select_mbc6 )
474474{
475475   logerror( "0x%04X: write to mbc6 ram enable area: %04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data );
476476}
477477
478static WRITE8_HANDLER( gb_rom_bank_select_mbc6_1 )
478static WRITE8_HANDLER( gb_rom_bank_select_mbc6_1 )
479479{
480480   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 )
482482   {
483      if ( data == 0x00 )
483      if ( data == 0x00 )
484484      {
485485         gb_rom8_4000( space->machine, ROMMap[ROMBank>>1] + ( ( ROMBank & 0x01 ) ? 0x2000 : 0x0000 ) );
486486      }
487   }
488   else
487   }
488   else
489489   {
490490      ROMBank = data;
491491   }
492492}
493493
494static WRITE8_HANDLER( gb_rom_bank_select_mbc6_2 )
494static WRITE8_HANDLER( gb_rom_bank_select_mbc6_2 )
495495{
496496   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 )
498498   {
499      if ( data == 0x00 )
499      if ( data == 0x00 )
500500      {
501501         gb_rom8_6000( space->machine, ROMMap[ROMBank00>>1] + ( ( ROMBank00 & 0x01 ) ? 0x2000 : 0x0000 ) );
502502      }
503   }
504   else
503   }
504   else
505505   {
506506      ROMBank00 = data;
507507   }
508508}
509509
510static WRITE8_HANDLER( gb_rom_bank_select_mbc7 )
510static WRITE8_HANDLER( gb_rom_bank_select_mbc7 )
511511{
512512   logerror( "0x%04X: write to mbc7 rom select register: 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), 0x2000 + offset, data );
513513   /* Bit 12 must be set for writing to the mbc register */
514   if ( offset & 0x0100 )
514   if ( offset & 0x0100 )
515515   {
516516      ROMBank = data;
517517      gb_rom16_4000( space->machine, ROMMap[ROMBank] );
518518   }
519519}
520520
521static WRITE8_HANDLER( gb_rom_bank_unknown_mbc7 )
521static WRITE8_HANDLER( gb_rom_bank_unknown_mbc7 )
522522{
523523        logerror( "0x%04X: write to mbc7 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), 0x3000 + offset, data );
524524   /* Bit 12 must be set for writing to the mbc register */
525   if ( offset & 0x0100 )
525   if ( offset & 0x0100 )
526526   {
527      switch( offset & 0x7000 )
527      switch( offset & 0x7000 )
528528      {
529529      case 0x0000:   /* 0x3000-0x3fff */
530530      case 0x1000:   /* 0x4000-0x4fff */
r5932r5933
536536   }
537537}
538538
539static WRITE8_HANDLER( gb_rom_bank_select_wisdom )
539static WRITE8_HANDLER( gb_rom_bank_select_wisdom )
540540{
541541   logerror( "0x%04X: wisdom tree mapper write to address 0x%04X\n", cpu_get_pc( space->cpu ), offset );
542542   /* The address determines the bank to select */
r5932r5933
560560static WRITE8_HANDLER( gb_ram_bank_select_mbc3 )
561561{
562562   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 )
564564   {   /* RTC banks */
565      if ( CartType & TIMER )
565      if ( CartType & TIMER )
566566      {
567567         MBC3RTCBank = data & 0x07;
568         if ( data < 5 )
568         if ( data < 5 )
569569         {
570570            memset( MBC3RTCData, MBC3RTCMap[MBC3RTCBank], 0x2000 );
571571            memory_set_bankptr( space->machine, 2, MBC3RTCData );
572572         }
573573      }
574   }
575   else
574   }
575   else
576576   {   /* RAM banks */
577577      RAMBank = data & 0x3;
578578      MBC3RTCBank = 0xFF;
r5932r5933
585585{
586586   logerror( "0x%04X: MBC5 RAM Bank select write 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data );
587587   data &= 0x0F;
588   if( CartType & RUMBLE )
588   if( CartType & RUMBLE )
589589   {
590590      data &= 0x7;
591591   }
r5932r5933
597597WRITE8_HANDLER ( gb_ram_enable )
598598{
599599   /* FIXME: Currently we don't handle this, but a value of 0xA will enable
600    * writing to the cart's RAM banks */
600    * writing to the cart's RAM banks */
601601   logerror( "0x%04X: Write to ram enable register 0x%04X <- 0x%02X\n", cpu_get_pc( space->cpu ), offset, data );
602602}
603603
r5932r5933
610610static WRITE8_HANDLER( gb_mem_mode_select_mbc3 )
611611{
612612        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 )
614614   {
615615      /* FIXME: RTC Latch goes here */
616616      MBC3RTCMap[0] = 50;    /* Seconds */
r5932r5933
621621   }
622622}
623623
624static WRITE8_HANDLER( gb_ram_tama5 )
624static WRITE8_HANDLER( gb_ram_tama5 )
625625{
626626   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 )
628628   {
629629   case 0x0000:    /* Write to data register */
630      switch( gbLastTama5Command )
630      switch( gbLastTama5Command )
631631      {
632632      case 0x00:      /* Bits 0-3 for rom bank selection */
633633         ROMBank = ( ROMBank & 0xF0 ) | ( data & 0x0F );
r5932r5933
648648         break;
649649      case 0x07:      /* Address selection lo */
650650            /* This address always seems to written last, so we'll just
651               execute the command here */
651                   execute the command here */
652652         gbTama5Address = ( gbTama5Address & 0xF0 ) | ( data & 0x0F );
653         switch ( gbTama5Address & 0xE0 )
653         switch ( gbTama5Address & 0xE0 )
654654         {
655655         case 0x00:      /* Write memory */
656656            logerror( "Write tama5 memory 0x%02X <- 0x%02X\n", gbTama5Address & 0x1F, gbTama5Byte );
r5932r5933
661661            gbTama5Byte = gbTama5Memory[ gbTama5Address & 0x1F ];
662662            break;
663663         case 0x40:      /* Unknown, some kind of read */
664            if ( ( gbTama5Address & 0x1F ) == 0x12 )
664            if ( ( gbTama5Address & 0x1F ) == 0x12 )
665665            {
666666               gbTama5Byte = 0xFF;
667667            }
r5932r5933
674674      }
675675      break;
676676   case 0x0001:    /* Write to control register */
677      switch( data )
677      switch( data )
678678      {
679679      case 0x00:      /* Bits 0-3 for rom bank selection */
680680      case 0x01:      /* Bits 4-7 for rom bank selection */
r5932r5933
709709static UINT8 mmm01_bank;
710710static UINT8 mmm01_bank_mask;
711711
712static WRITE8_HANDLER( gb_rom_bank_mmm01_0000_w )
712static WRITE8_HANDLER( gb_rom_bank_mmm01_0000_w )
713713{
714714   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 )
716716   {
717717      mmm01_bank_offset = mmm01_reg1;
718718      memory_set_bankptr( space->machine, 5, ROMMap[ mmm01_bank_offset ] );
r5932r5933
721721   }
722722}
723723
724static WRITE8_HANDLER( gb_rom_bank_mmm01_2000_w )
724static WRITE8_HANDLER( gb_rom_bank_mmm01_2000_w )
725725{
726726   logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( space->cpu ), data, offset+0x2000 );
727727
728728   mmm01_reg1 = data & ROMMask;
729729   mmm01_bank = mmm01_reg1 & mmm01_bank_mask;
730   if ( mmm01_bank == 0 )
730   if ( mmm01_bank == 0 )
731731   {
732732      mmm01_bank = 1;
733733   }
734734   gb_rom16_4000( space->machine, ROMMap[ mmm01_bank_offset + mmm01_bank ] );
735735}
736736
737static WRITE8_HANDLER( gb_rom_bank_mmm01_4000_w )
737static WRITE8_HANDLER( gb_rom_bank_mmm01_4000_w )
738738{
739739   logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( space->cpu ), data, offset+0x4000 );
740740}
741741
742static WRITE8_HANDLER( gb_rom_bank_mmm01_6000_w )
742static WRITE8_HANDLER( gb_rom_bank_mmm01_6000_w )
743743{
744744   logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( space->cpu ), data, offset+0x6000 );
745745   /* Not sure if this is correct, Taito Variety Pack sets these values */
746746   /* Momotarou Collection 2 writes 01 and 21 here */
747   switch( data )
747   switch( data )
748748   {
749749   case 0x30:   mmm01_bank_mask = 0x07;   break;
750750   case 0x38:   mmm01_bank_mask = 0x03;   break;
r5932r5933
754754
755755/* Korean MBC1 variant mapping */
756756
757static void gb_set_mbc1_kor_banks( running_machine *machine )
757static void gb_set_mbc1_kor_banks( running_machine *machine )
758758{
759   if ( ROMBank & 0x30 )
759   if ( ROMBank & 0x30 )
760760   {
761761      gb_rom16_0000( machine, ROMMap[ ROMBank & 0x30 ] );
762762   }
r5932r5933
809809   case 0x01:                  /* SB - Serial transfer data */
810810      break;
811811   case 0x02:                  /* SC - SIO control */
812      switch( data & 0x81 )
812      switch( data & 0x81 )
813813      {
814814      case 0x00:
815815      case 0x01:
r5932r5933
832832      return;
833833   case 0x05:                  /* TIMA - Timer counter */
834834      /* 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 )
836836      {
837837         data = TIMECNT;
838838      }
839839      break;
840840   case 0x06:                  /* TMA - Timer module */
841841      /* 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 )
843843      {
844844         TIMECNT = data;
845845      }
r5932r5933
847847   case 0x07:                  /* TAC - Timer control */
848848      data |= 0xF8;
849849      /* 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 ) ) )
851851      {
852852         /* 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 ) )
854854         {
855855            gb_timer_increment(space->machine);
856856         }
r5932r5933
869869
870870WRITE8_HANDLER ( gb_io2_w )
871871{
872   if ( offset == 0x10 )
872   if ( offset == 0x10 )
873873   {
874874      /* disable BIOS ROM */
875875      gb_rom16_0000( space->machine, ROMMap[ROMBank00] );
876   }
877   else
876   }
877   else
878878   {
879879      gb_video_w( space, offset, data );
880880   }
r5932r5933
937937            if (sgb_rest)
938938            {
939939               /* We should test for this case , but the code below won't
940                  work with the current setup */
940                       work with the current setup */
941941               /* 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                    }*/
946946               sgb_data[sgb_bytecount] >>= 1;
947947               sgb_data[sgb_bytecount] |= 0x80;
948948               sgb_bitcount++;
r5932r5933
12051205                        break;
12061206                     case 0x09:   /* SOU_TRN */
12071207                        /* This command sends data to the SNES sound processor.
1208                           We'll need to emulate that for this to be used */
1208                                   We'll need to emulate that for this to be used */
12091209                        /* Not Implemented */
12101210                        break;
12111211                     case 0x0A:   /* PAL_SET */
r5932r5933
13511351                        break;
13521352                     case 0x19:   /* ? */
13531353                        /* Called by: dkl,dkl2,dkl3,zeldadx
1354                           But I don't know what it is for. */
1354                                   But I don't know what it is for. */
13551355                        /* Not Implemented */
13561356                        break;
13571357                     case 0x1E:   /* Used by bootrom to transfer the gb cart header */
r5932r5933
14531453   gb_dummy_ram_bank = auto_alloc_array( device->machine, UINT8, 0x2000 );
14541454   memset( gb_dummy_ram_bank, 0xFF, 0x2000 );
14551455
1456   for(I = 0; I < MAX_ROMBANK; I++)
1456   for(I = 0; I < MAX_ROMBANK; I++)
14571457   {
14581458      ROMMap[I] = gb_dummy_rom_bank;
14591459   }
1460   for(I = 0; I < MAX_RAMBANK; I++)
1460   for(I = 0; I < MAX_RAMBANK; I++)
14611461   {
14621462      RAMMap[I] = gb_dummy_ram_bank;
14631463   }
r5932r5933
16071607
16081608   /* Check for presence of a header, and skip that header */
16091609   J = filesize % 0x4000;
1610   if ( J == 512 )
1610   if ( J == 512 )
16111611   {
16121612      logerror( "Rom-header found, skipping\n" );
16131613      image_fseek( image, J, SEEK_SET );
r5932r5933
16151615   }
16161616
16171617   /* Verify that the file contains 16kb blocks */
1618   if ( ( filesize == 0 ) || ( ( filesize % 0x4000 ) != 0 ) )
1618   if ( ( filesize == 0 ) || ( ( filesize % 0x4000 ) != 0 ) )
16191619   {
16201620      image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Invalid rom file size" );
16211621      return INIT_FAIL;
r5932r5933
16251625   gb_cart = auto_alloc_array( image->machine, UINT8, filesize );
16261626
16271627   /* Read cartridge */
1628   if ( image_fread( image, gb_cart, filesize ) != filesize )
1628   if ( image_fread( image, gb_cart, filesize ) != filesize )
16291629   {
16301630      image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file" );
16311631      return INIT_FAIL;
r5932r5933
16351635   ROMBank00 = 0;
16361636
16371637   /* Check for presence of MMM01 mapper */
1638   if ( filesize >= 0x8000 )
1638   if ( filesize >= 0x8000 )
16391639   {
16401640      static const UINT8 nintendo_logo[0x18] = {
16411641         0xCE, 0xED, 0x66, 0x66, 0xCC, 0x0D, 0x00, 0x0B,
r5932r5933
16441644      };
16451645      int   bytes_matched = 0;
16461646      gb_header = gb_cart + filesize - 0x8000;
1647      for ( I = 0; I < 0x18; I++ )
1647      for ( I = 0; I < 0x18; I++ )
16481648      {
1649         if ( gb_header[0x0104 + I] == nintendo_logo[I] )
1649         if ( gb_header[0x0104 + I] == nintendo_logo[I] )
16501650         {
16511651            bytes_matched++;
16521652         }
16531653      }
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 )
16551655      {
16561656         ROMBank00 = ( filesize / 0x4000 ) - 2;
16571657         mmm01_bank_offset = ROMBank00;
1658      }
1659      else
1658      }
1659      else
16601660      {
16611661         gb_header = gb_cart;
16621662      }
16631663   }
16641664
16651665   /* Fill in our cart details */
1666   switch( gb_header[0x0147] )
1666   switch( gb_header[0x0147] )
16671667   {
16681668   case 0x00:   MBCType = MBC_NONE;   CartType = 0;            break;
16691669   case 0x01:   MBCType = MBC_MBC1;   CartType = 0;            break;
r5932r5933
17001700   }
17011701
17021702   /* Check whether we're dealing with a (possible) Wisdom Tree game here */
1703   if ( gb_header[0x0147] == 0x00 )
1703   if ( gb_header[0x0147] == 0x00 )
17041704   {
17051705      int count = 0;
1706      for( I = 0x0134; I <= 0x014C; I++ )
1706      for( I = 0x0134; I <= 0x014C; I++ )
17071707      {
17081708         count += gb_header[I];
17091709      }
1710      if ( count == 0 )
1710      if ( count == 0 )
17111711      {
17121712         MBCType = MBC_WISDOM;
17131713      }
17141714   }
17151715
17161716   /* Check if we're dealing with a Korean variant of the MBC1 mapper */
1717   if ( MBCType == MBC_MBC1 )
1717   if ( MBCType == MBC_MBC1 )
17181718   {
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 )
17201720      {
17211721         MBCType = MBC_MBC1_KOR;
17221722      }
17231723   }
1724   if ( MBCType == MBC_UNKNOWN )
1724   if ( MBCType == MBC_UNKNOWN )
17251725   {
17261726      image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Unknown mapper type" );
17271727      return INIT_FAIL;
17281728   }
1729   if ( MBCType == MBC_MMM01 )
1729   if ( MBCType == MBC_MMM01 )
17301730   {
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;
17331733   }
1734   if ( MBCType == MBC_MBC4 )
1734   if ( MBCType == MBC_MBC4 )
17351735   {
17361736      image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Mapper MBC4 is not supported yet" );
17371737      return INIT_FAIL;
17381738   }
17391739   /* MBC7 support is still work-in-progress, so only enable it for debug builds */
17401740#ifndef MAME_DEBUG
1741   if ( MBCType == MBC_MBC7 )
1741   if ( MBCType == MBC_MBC7 )
17421742   {
17431743      image_seterror( image, IMAGE_ERROR_UNSUPPORTED, "Mapper MBC7 is not supported yet" );
17441744      return INIT_FAIL;
r5932r5933
17461746#endif
17471747
17481748   ROMBanks = filesize / 0x4000;
1749   switch( gb_header[0x0148] )
1749   switch( gb_header[0x0148] )
17501750   {
17511751   case 0x52:
17521752      reported_rom_banks = 72;
r5932r5933
17661766      reported_rom_banks = 256;
17671767      break;
17681768   }
1769   if ( ROMBanks != reported_rom_banks && MBCType != MBC_WISDOM )
1769   if ( ROMBanks != reported_rom_banks && MBCType != MBC_WISDOM )
17701770   {
17711771      logerror( "Warning loading cartridge: Filesize and reported ROM banks don't match.\n" );
17721772   }
r5932r5933
17921792        }
17931793
17941794   /*
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    */
18011801   ROMMask = I - 1;
1802   if ( ( ROMBanks & ROMMask ) != 0 )
1802   if ( ( ROMBanks & ROMMask ) != 0 )
18031803   {
1804      for( ; I & ROMBanks; I++ )
1804      for( ; I & ROMBanks; I++ )
18051805      {
18061806         ROMMap[ I ] = ROMMap[ I & ROMMask ];
18071807      }
r5932r5933
18091809   }
18101810
18111811   /* Fill out the remaining rom bank pointers, if any. */
1812   for ( ; I < MAX_ROMBANK; I++ )
1812   for ( ; I < MAX_ROMBANK; I++ )
18131813   {
18141814      ROMMap[ I ] = ROMMap[ I & ROMMask ];
18151815   }
r5932r5933
18491849   if( MBCType == MBC_MBC2 )
18501850      RAMBanks = 1;
18511851   /* MBC7 has 512 bytes(?) of internal RAM */
1852   if ( MBCType == MBC_MBC7 )
1852   if ( MBCType == MBC_MBC7 )
18531853   {
18541854      RAMBanks = 1;
18551855   }
r5932r5933
18671867
18681868      /* Set up rest of the (mirrored) RAM pages */
18691869      RAMMask = I - 1;
1870      for ( ; I < MAX_RAMBANK; I++ )
1870      for ( ; I < MAX_RAMBANK; I++ )
18711871      {
18721872         RAMMap[ I ] = RAMMap [ I & RAMMask ];
18731873      }
1874   }
1875   else
1874   }
1875   else
18761876   {
18771877      RAMMask = 0;
18781878   }
18791879
18801880   /* If there's an RTC claim memory to store the RTC contents */
1881   if ( CartType & TIMER )
1881   if ( CartType & TIMER )
18821882   {
18831883      MBC3RTCData = auto_alloc_array(image->machine, UINT8, 0x2000 );
18841884   }
18851885
1886   if ( MBCType == MBC_TAMA5 )
1886   if ( MBCType == MBC_TAMA5 )
18871887   {
18881888      MBC3RTCData = auto_alloc_array(image->machine, UINT8, 0x2000 );
18891889      memset( gbTama5Memory, 0xFF, sizeof(gbTama5Memory) );
r5932r5933
19091909   /* Decrement number of handled bits */
19101910   SIOCount--;
19111911   /* If all bits done, stop timer and trigger interrupt */
1912   if ( ! SIOCount )
1912   if ( ! SIOCount )
19131913   {
19141914      SIOCONT &= 0x7F;
19151915      timer_enable( gb_serial_timer, 0 );
r5932r5933
19171917   }
19181918}
19191919
1920INLINE void gb_timer_check_irq( running_machine *machine )
1920INLINE void gb_timer_check_irq( running_machine *machine )
19211921{
19221922   gb_timer.reloading = 0;
1923   if ( gb_timer.triggering_irq )
1923   if ( gb_timer.triggering_irq )
19241924   {
19251925      gb_timer.triggering_irq = 0;
1926      if ( TIMECNT == 0 )
1926      if ( TIMECNT == 0 )
19271927      {
19281928         TIMECNT = TIMEMOD;
19291929         cputag_set_input_line(machine, "maincpu", TIM_INT, ASSERT_LINE );
r5932r5933
19321932   }
19331933}
19341934
1935static void gb_timer_increment( running_machine *machine )
1935static void gb_timer_increment( running_machine *machine )
19361936{
19371937   gb_timer_check_irq(machine);
19381938
19391939   TIMECNT += 1;
1940   if ( TIMECNT == 0 )
1940   if ( TIMECNT == 0 )
19411941   {
19421942      gb_timer.triggering_irq = 1;
19431943   }
19441944}
19451945
1946void gb_timer_callback(const device_config *device, int cycles)
1946void gb_timer_callback(const device_config *device, int cycles)
19471947{
19481948   UINT16 old_gb_divcount = gb_timer.divcount;
19491949   gb_timer.divcount += cycles;
19501950
19511951   gb_timer_check_irq(device->machine);
19521952
1953   if ( TIMEFRQ & 0x04 )
1953   if ( TIMEFRQ & 0x04 )
19541954   {
19551955      UINT16 old_count = old_gb_divcount >> gb_timer.shift;
19561956      UINT16 new_count = gb_timer.divcount >> gb_timer.shift;
1957      if ( cycles > gb_timer.shift_cycles )
1957      if ( cycles > gb_timer.shift_cycles )
19581958      {
19591959         gb_timer_increment(device->machine);
19601960         old_count++;
19611961      }
1962      if ( new_count != old_count )
1962      if ( new_count != old_count )
19631963      {
19641964         gb_timer_increment(device->machine);
19651965      }
1966      if ( new_count << gb_timer.shift < gb_timer.divcount )
1966      if ( new_count << gb_timer.shift < gb_timer.divcount )
19671967      {
19681968         gb_timer_check_irq(device->machine);
19691969      }
r5932r5933
19721972
19731973WRITE8_HANDLER ( gbc_io2_w )
19741974{
1975   switch( offset )
1975   switch( offset )
19761976   {
19771977      case 0x0D:   /* KEY1 - Prepare speed switch */
19781978         cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), LR35902_SPEED, data );
r5932r5933
19921992   gbc_video_w( space, offset, data );
19931993}
19941994
1995READ8_HANDLER( gbc_io2_r )
1995READ8_HANDLER( gbc_io2_r )
19961996{
1997   switch( offset )
1997   switch( offset )
19981998   {
19991999   case 0x0D:   /* KEY1 */
20002000      return cpu_get_reg( cputag_get_cpu(space->machine, "maincpu"), LR35902_SPEED );
r5932r5933
20602060{
20612061   UINT8 data;
20622062
2063   if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) )
2063   if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) )
20642064   {
20652065      offset ^= 0x0C;
20662066   }
r5932r5933
20722072
20732073WRITE8_HANDLER ( megaduck_video_w )
20742074{
2075   if ( !offset )
2075   if ( !offset )
20762076   {
20772077      data = BITSWAP8(data,7,3,5,4,2,1,0,6);
20782078   }
2079   if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) )
2079   if ( (offset & 0x0C) && ((offset & 0x0C) ^ 0x0C) )
20802080   {
20812081      offset ^= 0x0C;
20822082   }
r5932r5933
20992099
21002100WRITE8_HANDLER( megaduck_sound_w2 )
21012101{
2102   switch(offset)
2102   switch(offset)
21032103   {
21042104      case 0x00:   gb_sound_w(devtag_get_device(space->machine, "custom"), 0x10, data );   break;
21052105      case 0x01:   gb_sound_w(devtag_get_device(space->machine, "custom"), 0x12, data );   break;
r5932r5933
21612161   filesize = image_length(image);
21622162   ROMBanks = filesize / 0x4000;
21632163
2164   if ( ( filesize == 0 ) || ( ( filesize % 0x4000 ) != 0 ) )
2164   if ( ( filesize == 0 ) || ( ( filesize % 0x4000 ) != 0 ) )
21652165   {
21662166      image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Invalid rom file size" );
21672167      return INIT_FAIL;
r5932r5933
21712171   gb_cart = auto_alloc_array(image->machine, UINT8, filesize);
21722172
21732173   /* Read cartridge */
2174   if (image_fread (image, gb_cart, filesize) != filesize)
2174   if (image_fread (image, gb_cart, filesize) != filesize)
21752175   {
21762176      image_seterror( image, IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file" );
21772177      return INIT_FAIL;
src/mess/machine/tc8521.h
r5932r5933
11/*********************************************************************
22
3   tc8521.h
3    tc8521.h
44
5   Toshiba TC8251 Real Time Clock code
5    Toshiba TC8251 Real Time Clock code
66
77*********************************************************************/
88
src/mess/machine/990_hd.c
r5932r5933
11/*
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).
55
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.
1111
1212
13   Long description: see 2234398-9701 and 2306140-9701.
13    Long description: see 2234398-9701 and 2306140-9701.
1414
1515
16   Raphael Nabet 2002-2003
16    Raphael Nabet 2002-2003
1717*/
1818
1919#include "driver.h"
r5932r5933
5252
5353/*INLINE void set_UINT32BE(UINT32BE *word, UINT32 data)
5454{
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;
5959}*/
6060
6161/* disk image header */
r5932r5933
104104   w0_unsafe         = 0x1000,
105105   w0_end_of_cylinder   = 0x0800,
106106   w0_seek_incomplete   = 0x0400,
107   /*w0_offset_active   = 0x0200,*/
107   /*w0_offset_active  = 0x0200,*/
108108   w0_pack_change      = 0x0100,
109109
110110   w0_attn_lines      = 0x00f0,
111111   w0_attn_mask      = 0x000f,
112112
113113   w1_extended_command   = 0xc000,
114   /*w1_strobe_early      = 0x2000,
115   w1_strobe_late      = 0x1000,*/
114   /*w1_strobe_early       = 0x2000,
115    w1_strobe_late      = 0x1000,*/
116116   w1_transfer_inhibit   = 0x0800,
117117   w1_command         = 0x0700,
118118   w1_offset         = 0x0080,
r5932r5933
128128   w7_complete         = 0x4000,
129129   w7_error         = 0x2000,
130130   w7_int_enable      = 0x1000,
131   /*w7_lock_out         = 0x0800,*/
131   /*w7_lock_out           = 0x0800,*/
132132   w7_retry         = 0x0400,
133133   w7_ecc            = 0x0200,
134134   w7_abnormal_completion   = 0x0100,
r5932r5933
146146static const UINT16 w_mask[8] =
147147{
148148   0x000f,      /* Controllers should prevent overwriting of w0 status bits, and I know
149            that some controllers do so. */
149                that some controllers do so. */
150150   0xffff,
151151   0xffff,
152152   0xffff,
r5932r5933
187187
188188/*DEVICE_STOP( ti990_hd )
189189{
190   d->img = NULL;
190    d->img = NULL;
191191}*/
192192
193193/*
194   Initialize hard disk unit and open a hard disk image
194    Initialize hard disk unit and open a hard disk image
195195*/
196196static DEVICE_IMAGE_LOAD( ti990_hd )
197197{
r5932r5933
231231
232232      /* use custom image header. */
233233      /* to convert old header-less images to this format, insert a 16-byte
234      header as follow: 00 00 03 8f  00 00 00 05  00 00 00 21  00 00 01 00 */
234        header as follow: 00 00 03 8f  00 00 00 05  00 00 00 21  00 00 01 00 */
235235      image_fseek(d->img, 0, SEEK_SET);
236236      bytes_read = image_fread(d->img, &custom_header, sizeof(custom_header));
237237      if (bytes_read != sizeof(custom_header))
r5932r5933
268268}
269269
270270/*
271   close a hard disk image
271    close a hard disk image
272272*/
273273static DEVICE_IMAGE_UNLOAD( ti990_hd )
274274{
r5932r5933
287287}
288288
289289/*
290   Return true if a HD image has been loaded
290    Return true if a HD image has been loaded
291291*/
292292INLINE int is_unit_loaded(int unit)
293293{
r5932r5933
308308}
309309
310310/*
311   Init the hdc core
311    Init the hdc core
312312*/
313313MACHINE_START(ti990_hdc)
314314{
r5932r5933
344344
345345
346346/*
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)
349349*/
350350static int cur_disk_unit(void)
351351{
r5932r5933
370370}
371371
372372/*
373   Update interrupt state
373    Update interrupt state
374374*/
375375static void update_interrupt(running_machine *machine)
376376{
r5932r5933
381381}
382382
383383/*
384   Check that a sector address is valid.
384    Check that a sector address is valid.
385385
386   Terminate current command and return non-zero if the address is invalid.
386    Terminate current command and return non-zero if the address is invalid.
387387*/
388388static int check_sector_address(running_machine *machine, int unit, unsigned int cylinder, unsigned int head, unsigned int sector)
389389{
r5932r5933
409409}
410410
411411/*
412   Seek to sector whose address is given
412    Seek to sector whose address is given
413413*/
414414static int sector_to_lba(running_machine *machine, int unit, unsigned int cylinder, unsigned int head, unsigned int sector, unsigned int *lba)
415415{
r5932r5933
422422}
423423
424424/*
425   Read one given sector
425    Read one given sector
426426*/
427427static int read_sector(int unit, unsigned int lba, void *buffer, unsigned int bytes_to_read)
428428{
r5932r5933
452452}
453453
454454/*
455   Write one given sector
455    Write one given sector
456456*/
457457static int write_sector(int unit, unsigned int lba, const void *buffer, unsigned int bytes_to_write)
458458{
r5932r5933
482482}
483483
484484/*
485   Handle the store registers command: read the drive geometry.
485    Handle the store registers command: read the drive geometry.
486486*/
487487static void store_registers(running_machine *machine)
488488{
r5932r5933
539539}
540540
541541/*
542   Handle the write format command: format a complete track on disk.
542    Handle the write format command: format a complete track on disk.
543543
544   The emulation just clears the track data in the disk image.
544    The emulation just clears the track data in the disk image.
545545*/
546546static void write_format(running_machine *machine)
547547{
r5932r5933
611611}
612612
613613/*
614   Handle the read data command: read a variable number of sectors from disk.
614    Handle the read data command: read a variable number of sectors from disk.
615615*/
616616static void read_data(running_machine *machine)
617617{
r5932r5933
711711}
712712
713713/*
714   Handle the write data command: write a variable number of sectors from disk.
714    Handle the write data command: write a variable number of sectors from disk.
715715*/
716716static void write_data(running_machine *machine)
717717{
r5932r5933
823823}
824824
825825/*
826   Handle the unformatted read command: read drive geometry information.
826    Handle the unformatted read command: read drive geometry information.
827827*/
828828static void unformatted_read(running_machine *machine)
829829{
r5932r5933
897897}
898898
899899/*
900   Handle the restore command: return to track 0.
900    Handle the restore command: return to track 0.
901901*/
902902static void restore(running_machine *machine)
903903{
r5932r5933
922922   hdc.d[dsk_sel].unsafe = 0;      /* I think */
923923
924924   /*if (seek_to_sector(dsk_sel, 0, 0, 0))
925      return;*/
925        return;*/
926926
927927   hdc.w[7] |= w7_idle | w7_complete;
928928   update_interrupt(machine);
929929}
930930
931931/*
932   Parse command code and execute the command.
932    Parse command code and execute the command.
933933*/
934934static void execute_command(running_machine *machine)
935935{
r5932r5933
989989}
990990
991991/*
992   Read one register in TPCS space
992    Read one register in TPCS space
993993*/
994994READ16_HANDLER(ti990_hdc_r)
995995{
r5932r5933
10001000}
10011001
10021002/*
1003   Write one register in TPCS space.  Execute command if w7_idle is cleared.
1003    Write one register in TPCS space.  Execute command if w7_idle is cleared.
10041004*/
10051005WRITE16_HANDLER(ti990_hdc_w)
10061006{
src/mess/machine/990_hd.h
r5932r5933
11/*
2   990_hd.h: include file for 990_hd.c
2    990_hd.h: include file for 990_hd.c
33*/
44#ifndef __990_HD_H_
55#define __990_HD_H_
src/mess/machine/99_dsk.c
r5932r5933
11/*
2   TI-99/4 and /4a disk controller emulation.
2    TI-99/4 and /4a disk controller emulation.
33
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.
1515
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.
2222
23   Raphael Nabet, 1999-2004.
23    Raphael Nabet, 1999-2004.
2424*/
2525
2626#include "driver.h"
r5932r5933
6666static void *motor_on_timer;
6767
6868/*
69   call this when the state of DSKhold or DRQ/IRQ or DVENA change
69    call this when the state of DSKhold or DRQ/IRQ or DVENA change
7070
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
7373*/
7474static void fdc_handle_hold(running_machine *machine)
7575{
r5932r5933
8080}
8181
8282/*
83   callback called at the end of DVENA pulse
83    callback called at the end of DVENA pulse
8484*/
8585static TIMER_CALLBACK(motor_on_timer_callback)
8686{
r5932r5933
110110};
111111
112112/*
113   Convert physical sector address to sector offset in disk image
113    Convert physical sector address to sector offset in disk image
114114*/
115115static UINT64 ti99_translate_offset(floppy_image *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector)
116116{
r5932r5933
132132}
133133
134134/*
135   support for 48TPI disks in 96TPI drives
135    support for 48TPI disks in 96TPI drives
136136*/
137137static int ti99_tracktranslate(const device_config *image, floppy_image *floppy, int physical_track)
138138{
r5932r5933
146146}
147147
148148/*
149   Sniff the geometry of a v9t9 format disk image
149    Sniff the geometry of a v9t9 format disk image
150150*/
151151static void ti99_guess_geometry(floppy_image *floppy, ti99_geometry *geometry, int *vote, int *success)
152152{
r5932r5933
178178      geometry->secspertrack = vib.secspertrack;
179179      if (geometry->secspertrack == 0)
180180         /* Some images might be like this, because the original SSSD TI
181         controller always assumes 9. */
181            controller always assumes 9. */
182182         geometry->secspertrack = 9;
183183      geometry->tracksperside = vib.tracksperside;
184184      if (geometry->tracksperside == 0)
185185         /* Some images are like this, because the original SSSD TI
186         controller always assumes 40. */
186            controller always assumes 40. */
187187         geometry->tracksperside = 40;
188188      geometry->sides = vib.sides;
189189      if (geometry->sides == 0)
190190         /* Some images are like this, because the original SSSD TI
191         controller always assumes that tracks beyond 40 are on side 2. */
191            controller always assumes that tracks beyond 40 are on side 2. */
192192         geometry->sides = totsecs / (geometry->secspertrack * geometry->tracksperside);
193193      geometry->density = vib.density;
194194      if (geometry->density == 0)
r5932r5933
208208   }
209209
210210   /* If we have been unable to parse the format, let us guess according to
211   file lenght */
211    file lenght */
212212   switch (floppy_image_size(floppy))
213213   {
214214   case 1*40*9*256:   /* 90kbytes: SSSD */
r5932r5933
225225      return;
226226
227227   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. */
231231      geometry->sides = 2;
232232      geometry->tracksperside = 40;
233233      geometry->secspertrack = 9;
r5932r5933
239239      return;
240240
241241   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???) */
244244      geometry->sides = 1;
245245      geometry->tracksperside = 40;
246246      geometry->secspertrack = 16;
r5932r5933
252252      return;
253253
254254   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???) */
257257      geometry->sides = 2;
258258      geometry->tracksperside = 40;
259259      geometry->secspertrack = 16;
r5932r5933
265265      return;
266266
267267   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) */
271271      geometry->sides = 2;
272272      geometry->tracksperside = 40;
273273      geometry->secspertrack = 18;
r5932r5933
279279      return;
280280
281281   case 2*80*18*256:   /* 720kbytes: 18-sector-per-track 80-track DSDD
282                  (Myarc only) */
282                        (Myarc only) */
283283      geometry->sides = 2;
284284      geometry->tracksperside = 80;
285285      geometry->secspertrack = 18;
r5932r5933
365365}
366366
367367/*
368   callback called whenever DRQ/IRQ state change
368    callback called whenever DRQ/IRQ state change
369369*/
370370static WD17XX_CALLBACK( fdc_callback )
371371{
r5932r5933
394394
395395
396396/*
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.
400400*/
401401void ti99_floppy_controllers_init_all(running_machine *machine)
402402{
r5932r5933
410410
411411/*===========================================================================*/
412412/*
413   TI99/4(a) Floppy disk controller card emulation
413    TI99/4(a) Floppy disk controller card emulation
414414*/
415415
416416/* prototypes */
r5932r5933
432432};
433433
434434/*
435   Reset fdc card, set up handlers
435    Reset fdc card, set up handlers
436436*/
437437void ti99_fdc_reset(running_machine *machine)
438438{
r5932r5933
453453}
454454
455455/*
456   Read disk CRU interface
456    Read disk CRU interface
457457
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
464464*/
465465static int fdc_cru_r(running_machine *machine, int offset)
466466{
r5932r5933
487487}
488488
489489/*
490   Write disk CRU interface
490    Write disk CRU interface
491491*/
492492static void fdc_cru_w(running_machine *machine, int offset, int data)
493493{
494494   const device_config *fdc = devtag_get_device(machine, "wd179x");
495   
495
496496   switch (offset)
497497   {
498498   case 0:
r5932r5933
513513
514514   case 2:
515515      /* 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...) */
520520      DSKhold = data;
521521      fdc_handle_hold(machine);
522522      break;
r5932r5933
567567
568568
569569/*
570   read a byte in disk DSR space
570    read a byte in disk DSR space
571571*/
572572static  READ8_HANDLER(fdc_mem_r)
573573{
574574   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
575   
575
576576   switch (offset)
577577   {
578578   case 0x1FF0:               /* Status register */
r5932r5933
589589}
590590
591591/*
592   write a byte in disk DSR space
592    write a byte in disk DSR space
593593*/
594594static WRITE8_HANDLER(fdc_mem_w)
595595{
596596   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
597   
597
598598   data ^= 0xFF;   /* inverted data bus */
599599
600600   switch (offset)
r5932r5933
618618#if HAS_99CCFDC
619619/*===========================================================================*/
620620/*
621   Alternate fdc: CorcComp FDC
621    Alternate fdc: CorcComp FDC
622622
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.
626626
627   References:
628   * ???
627    References:
628    * ???
629629*/
630630
631631/* prototypes */
r5932r5933
646646void ti99_ccfdc_reset(running_machine *machine)
647647{
648648   const device_config *fdc = devtag_get_device(machine, "wd179x");
649   
649
650650   ti99_disk_DSR = memory_region(machine, region_dsr) + offset_ccfdc_dsr;
651651   DSEL = 0;
652652   DSKnum = -1;
r5932r5933
666666
667667
668668/*
669   Read disk CRU interface
669    Read disk CRU interface
670670
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
674674*/
675675static int ccfdc_cru_r(int offset)
676676{
r5932r5933
695695
696696
697697/*
698   Write disk CRU interface
698    Write disk CRU interface
699699*/
700700static void ccfdc_cru_w(running_machine *machine, int offset, int data)
701701{
702702   const device_config *fdc = devtag_get_device(machine, "wd179x");
703   
703
704704   switch (offset)
705705   {
706706   case 0:
r5932r5933
721721
722722   case 2:
723723      /* 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...) */
728728      DSKhold = data;
729729      fdc_handle_hold(machine);
730730      break;
r5932r5933
799799
800800
801801/*
802   read a byte in disk DSR space
802    read a byte in disk DSR space
803803*/
804804static READ8_HANDLER(ccfdc_mem_r)
805805{
r5932r5933
811811}
812812
813813/*
814   write a byte in disk DSR space
814    write a byte in disk DSR space
815815*/
816816static WRITE8_HANDLER(ccfdc_mem_w)
817817{
r5932r5933
821821
822822/*===========================================================================*/
823823/*
824   Alternate fdc: BwG card from SNUG
824    Alternate fdc: BwG card from SNUG
825825
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.
832832
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>
836836*/
837837
838838/* prototypes */
r5932r5933
856856
857857
858858/*
859   Reset fdc card, set up handlers
859    Reset fdc card, set up handlers
860860*/
861861void ti99_bwg_reset(running_machine *machine)
862862{
863863   const device_config *fdc = devtag_get_device(machine, "wd179x");
864   
864
865865   ti99_disk_DSR = memory_region(machine, region_dsr) + offset_bwg_dsr;
866866        bwg_ram = memory_region(machine, region_dsr) + offset_bwg_ram;
867867   bwg_ram_offset = 0;
r5932r5933
874874
875875   DVENA = 0;
876876   motor_on = 0;
877       
877
878878        use_80_track_drives = FALSE;
879       
879
880880   ti99_peb_set_card_handlers(0x1100, & bwg_handlers);
881881
882882   wd17xx_reset(fdc);      /* initialize the floppy disk controller */
r5932r5933
884884}
885885
886886/*
887   Read disk CRU interface
887    Read disk CRU interface
888888
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
892892*/
893893static int bwg_cru_r(running_machine *machine, int offset)
894894{
r5932r5933
913913
914914
915915/*
916   Write disk CRU interface
916    Write disk CRU interface
917917*/
918918static void bwg_cru_w(running_machine *machine, int offset, int data)
919919{
920920   const device_config *fdc = devtag_get_device(machine, "wd179x");
921   
921
922922   switch (offset)
923923   {
924924   case 0:
r5932r5933
939939
940940   case 2:
941941      /* 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...) */
946946      DSKhold = data;
947947      fdc_handle_hold(machine);
948948      break;
r5932r5933
10301030
10311031
10321032/*
1033   read a byte in disk DSR space
1033    read a byte in disk DSR space
10341034*/
10351035static  READ8_HANDLER(bwg_mem_r)
10361036{
10371037   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
1038   
1038
10391039   int reply = 0;
10401040
10411041   if (offset < 0x1c00)
r5932r5933
10751075}
10761076
10771077/*
1078   write a byte in disk DSR space
1078    write a byte in disk DSR space
10791079*/
10801080static WRITE8_HANDLER(bwg_mem_w)
10811081{
10821082   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
1083   
1083
10841084   if (offset < 0x1c00)
10851085      ;
10861086   else if (offset < 0x1fe0)
r5932r5933
11201120
11211121/*===========================================================================*/
11221122/*
1123   Alternate fdc: HFDC card built by Myarc
1123    Alternate fdc: HFDC card built by Myarc
11241124
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)
11291129
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.
11321132
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>
11361136*/
11371137
11381138/* prototypes */
r5932r5933
11571157static int hfdc_irq_state;
11581158
11591159/*
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.
11621162*/
11631163static int hfdc_select_callback(int which, select_mode_t select_mode, int select_line, int gpos)
11641164{
r5932r5933
11781178   case sm_floppy_fast:
11791179      /* floppy disk */
11801180      /* We use the 4 general purpose output as select lines in order to
1181      support 4 drives. */
1181        support 4 drives. */
11821182      switch (gpos & 0xf)
11831183      {
11841184      case 1:
r5932r5933
12081208}
12091209
12101210/*
1211   Read a byte from buffer in DMA mode
1211    Read a byte from buffer in DMA mode
12121212*/
12131213static UINT8 hfdc_dma_read_callback(int which, offs_t offset)
12141214{
r5932r5933
12171217}
12181218
12191219/*
1220   Write a byte to buffer in DMA mode
1220    Write a byte to buffer in DMA mode
12211221*/
12221222static void hfdc_dma_write_callback(int which, offs_t offset, UINT8 data)
12231223{
r5932r5933
12261226}
12271227
12281228/*
1229   Called whenever the state of the sms9234 interrupt pin changes.
1229    Called whenever the state of the sms9234 interrupt pin changes.
12301230*/
12311231static void hfdc_int_callback(int which, int state)
12321232{
r5932r5933
12361236}
12371237
12381238/*
1239   Reset fdc card, set up handlers
1239    Reset fdc card, set up handlers
12401240*/
12411241void ti99_hfdc_reset(running_machine *machine)
12421242{
r5932r5933
12621262
12631263
12641264/*
1265   Read disk CRU interface
1265    Read disk CRU interface
12661266*/
12671267static int hfdc_cru_r(running_machine *machine, int offset)
12681268{
r5932r5933
12731273      /* CRU bits */
12741274      if (cru_sel)
12751275         /* 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 */
12821282         reply = use_80_track_drives ? 0x00 : 0x55;
12831283      else
12841284      {
r5932r5933
12881288         if (motor_on)
12891289            reply |= 2;
12901290         /*if (hfdc_dma_in_progress)
1291            reply |= 4;*/
1291                reply |= 4;*/
12921292      }
12931293      break;
12941294
r5932r5933
13021302
13031303
13041304/*
1305   Write disk CRU interface
1305    Write disk CRU interface
13061306*/
13071307static void hfdc_cru_w(running_machine *machine, int offset, int data)
13081308{
r5932r5933
13771377
13781378
13791379/*
1380   read a byte in disk DSR space
1380    read a byte in disk DSR space
13811381*/
13821382static  READ8_HANDLER(hfdc_mem_r)
13831383{
r5932r5933
14301430}
14311431
14321432/*
1433   write a byte in disk DSR space
1433    write a byte in disk DSR space
14341434*/
14351435static WRITE8_HANDLER(hfdc_mem_w)
14361436{
src/mess/machine/gamecom.c
r5932r5933
8080   gamecom_clock_timer = timer_alloc(machine,  gamecom_clock_timer_callback , NULL);
8181
8282   /* intialize the empty dummy bank */
83   if ( dummy_bank == NULL )
83   if ( dummy_bank == NULL )
8484   {
8585      dummy_bank = auto_alloc_array(machine, UINT8, 8 * 1024 );
8686   }
r5932r5933
9595   gamecom_internal_w( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), SM8521_WDTC, 0x38 );
9696}
9797
98static void gamecom_set_mmu( running_machine *machine, int mmu, UINT8 data )
98static void gamecom_set_mmu( running_machine *machine, int mmu, UINT8 data )
9999{
100   if ( data < 32 )
100   if ( data < 32 )
101101   {
102102      /* select internal ROM bank */
103103      memory_set_bankptr( machine, mmu, memory_region(machine, "user1") + (data << 13) );
104   }
105   else
104   }
105   else
106106   {
107107      /* select cartridge bank */
108      if ( cartridge == NULL )
108      if ( cartridge == NULL )
109109      {
110110         memory_set_bankptr( machine, mmu, dummy_bank );
111      }
112      else
111      }
112      else
113113      {
114114         memory_set_bankptr( machine, mmu, cartridge + ( data << 13 ) );
115115      }
116116   }
117117}
118118
119static void handle_stylus_press( running_machine *machine, UINT8 column )
119static void handle_stylus_press( running_machine *machine, UINT8 column )
120120{
121121   static const UINT16 row_data[10] = { 0x3FE, 0x3FD, 0x3FB, 0x3F7, 0x3EF, 0x3DF, 0x3BF, 0x37F, 0x2FF, 0x1FF };
122122   static UINT32 stylus_x;
123123   static UINT32 stylus_y;
124124
125   if ( column == 0 )
125   if ( column == 0 )
126126   {
127      if ( ! ( input_port_read(machine, "IN2") & 0x04 ) )
127      if ( ! ( input_port_read(machine, "IN2") & 0x04 ) )
128128      {
129129         stylus_x = input_port_read(machine, "STYX") >> 4;
130130         stylus_y = input_port_read(machine, "STYY") >> 4;
131      }
132      else
131      }
132      else
133133      {
134134         stylus_x = 16;
135135         stylus_y = 16;
136136      }
137137   }
138138
139   if ( stylus_x == column )
139   if ( stylus_x == column )
140140   {
141141      cpu_set_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P0, row_data[stylus_y] & 0xFF );
142142      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
145145   {
146146      cpu_set_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P0, 0xFF );
147147      cpu_set_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P1, ( cpu_get_reg( cputag_get_cpu(machine, "maincpu"), SM8500_P1 ) & 0xFC ) | 0x03 );
r5932r5933
150150
151151WRITE8_HANDLER( gamecom_internal_w )
152152{
153   if ( offset >= 0x80 )
153   if ( offset >= 0x80 )
154154   {
155155      internal_ram[offset] = data;
156156      return;
157157   }
158158
159   switch( offset )
159   switch( offset )
160160   {
161161   case SM8521_IE0:   cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_IE0, data ); return;
162162   case SM8521_IE1:   cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_IE1, data ); return;
r5932r5933
165165   case SM8521_P0:      cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P0, data ); return;
166166   case SM8521_P1:      cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P1, data ); return;
167167   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 )
169169            {
170170            case 0xFBFF:   /* column #0 */
171171                  /* P0 bit 0 cleared => 01 */
r5932r5933
250250            /* P3 bit7 clear, bit6 set -> enable cartridge port #0? */
251251            /* P3 bit6 clear, bit7 set -> enable cartridge port #1? */
252252            cpu_set_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P3, data );
253            switch( data & 0xc0 )
253            switch( data & 0xc0 )
254254            {
255255            case 0x40: cartridge = cartridge1; break;
256256            case 0x80: cartridge = cartridge2; break;
r5932r5933
290290
291291   /* Video hardware and DMA */
292292   case SM8521_LCDC:
293//      logerror( "%X: Setting LCDC to %X\n", activecpu_get_pc(), data );
293//      logerror( "%X: Setting LCDC to %X\n", activecpu_get_pc(), data );
294294      break;
295295   case SM8521_LCH:
296296      break;
r5932r5933
302302      gamecom_dma.decrement_x = data & 0x08;
303303      gamecom_dma.decrement_y = data & 0x10;
304304      gamecom_dma.enabled = data & 0x80;
305      if ( gamecom_dma.enabled )
305      if ( gamecom_dma.enabled )
306306      {
307307         gamecom_dma_init(space->machine);
308308      }
r5932r5933
344344      gamecom_timer[1].counter = 0;
345345      break;
346346   case SM8521_CLKT:   /* bit 6-7 */
347      if ( data & 0x80 )
347      if ( data & 0x80 )
348348      {
349349         /* timer run */
350         if ( data & 0x40 )
350         if ( data & 0x40 )
351351         {
352352            /* timer resolution 1 minute */
353353            timer_adjust_periodic(gamecom_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(60));
354         }
355         else
354         }
355         else
356356         {
357357            /* TImer resolution 1 second */
358358            timer_adjust_periodic(gamecom_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
359359         }
360      }
361      else
360      }
361      else
362362      {
363363         /* disable timer reset */
364364         timer_enable( gamecom_clock_timer, 0 );
r5932r5933
384384READ8_HANDLER( gamecom_internal_r )
385385{
386386   /* 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 )
388388   {
389389      return internal_ram[offset];
390390   }
391391
392   switch( offset )
392   switch( offset )
393393   {
394394   case SM8521_R0:  case SM8521_R1:  case SM8521_R2:  case SM8521_R3:
395395   case SM8521_R4:  case SM8521_R5:  case SM8521_R6:  case SM8521_R7:
r5932r5933
417417   case SM8521_P3C:   return cpu_get_reg( cputag_get_cpu(space->machine, "maincpu"), SM8500_P3C );
418418   case SM8521_TM0D:   return gamecom_timer[0].counter;
419419   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 );
422422
423423   /* Reserved addresses */
424424   case SM8521_18: case SM8521_1B:
r5932r5933
429429   case SM8521_55: case SM8521_56: case SM8521_57: case SM8521_58:
430430   case SM8521_59: case SM8521_5A: case SM8521_5B: case SM8521_5C:
431431   case SM8521_5D:
432//      logerror( "%X: Read from reserved address (0x%02X)\n", cpu_get_pc(space->cpu), offset );
432//      logerror( "%X: Read from reserved address (0x%02X)\n", cpu_get_pc(space->cpu), offset );
433433      break;
434434
435435   }
r5932r5933
438438
439439/* The manual is not conclusive as to which bit of the DMVP register (offset 0x3D) determines
440440   which page for source or destination is used */
441static void gamecom_dma_init(running_machine *machine)
441static void gamecom_dma_init(running_machine *machine)
442442{
443   if ( gamecom_dma.decrement_x || gamecom_dma.decrement_y )
443   if ( gamecom_dma.decrement_x || gamecom_dma.decrement_y )
444444   {
445445      logerror( "TODO: Decrement-x and decrement-y are not supported yet\n" );
446446   }
r5932r5933
462462   gamecom_dma.palette[3] = ( gamecom_internal_registers[SM8521_DMPL] & 0xC0 ) >> 6;
463463   gamecom_dma.source_mask = 0x1FFF;
464464   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 )
468468   {
469469   case 0x00:
470470      /* VRAM->VRAM */
r5932r5933
473473      break;
474474   case 0x02:
475475      /* ROM->VRAM */
476//      logerror( "DMA DMBR = %X\n", gamecom_internal_registers[SM8521_DMBR] );
476//      logerror( "DMA DMBR = %X\n", gamecom_internal_registers[SM8521_DMBR] );
477477      gamecom_dma.source_width = 64;
478      if ( gamecom_internal_registers[SM8521_DMBR] < 16 )
478      if ( gamecom_internal_registers[SM8521_DMBR] < 16 )
479479      {
480480         gamecom_dma.source_bank = memory_region(machine, "user1") + (gamecom_internal_registers[SM8521_DMBR] << 14);
481481         gamecom_dma.source_mask = 0x3FFF;
482      }
483      else
482      }
483      else
484484      {
485485         logerror( "TODO: Reading from external ROMs not supported yet\n" );
486486         gamecom_dma.source_bank = memory_region(machine, "user1");
r5932r5933
513513   Their usage is also not explained properly in the manuals. Guess we'll have to wait
514514   for them to show up in some rom images...
515515 */
516void gamecom_handle_dma( const device_config *device, int cycles )
516void gamecom_handle_dma( const device_config *device, int cycles )
517517{
518518   unsigned y_count, x_count;
519519   /* If not enabled, ignore */
520   if ( ! gamecom_dma.enabled )
520   if ( ! gamecom_dma.enabled )
521521   {
522522      return;
523523   }
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++ )
525525   {
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++ )
527527      {
528528         int source_pixel = 0;
529529         int dest_pixel = 0;
r5932r5933
531531         int dest_addr = gamecom_dma.dest_current & gamecom_dma.dest_mask;
532532         /* handle DMA for 1 pixel */
533533         /* Read pixel data */
534         switch ( gamecom_dma.source_x_current & 0x03 )
534         switch ( gamecom_dma.source_x_current & 0x03 )
535535         {
536536         case 0x00: source_pixel = ( gamecom_dma.source_bank[src_addr] & 0xC0 ) >> 6; break;
537537         case 0x01: source_pixel = ( gamecom_dma.source_bank[src_addr] & 0x30 ) >> 4; break;
r5932r5933
539539         case 0x03: source_pixel = ( gamecom_dma.source_bank[src_addr] & 0x03 );      break;
540540         }
541541
542         if ( !gamecom_dma.overwrite_mode && source_pixel == 0 )
542         if ( !gamecom_dma.overwrite_mode && source_pixel == 0 )
543543         {
544            switch ( gamecom_dma.dest_x_current & 0x03 )
544            switch ( gamecom_dma.dest_x_current & 0x03 )
545545            {
546546            case 0x00: dest_pixel = ( gamecom_dma.dest_bank[dest_addr] & 0xC0 ) >> 6; break;
547547            case 0x01: dest_pixel = ( gamecom_dma.dest_bank[dest_addr] & 0x30 ) >> 4; break;
r5932r5933
555555         /* Not sure if this should be done before the compound stuff - WP */
556556         source_pixel = gamecom_dma.palette[ source_pixel ];
557557         /* Write pixel data */
558         switch( gamecom_dma.dest_x_current & 0x03 )
558         switch( gamecom_dma.dest_x_current & 0x03 )
559559         {
560560         case 0x00:
561561            gamecom_dma.dest_bank[dest_addr] = ( gamecom_dma.dest_bank[dest_addr] & 0x3F ) | ( source_pixel << 6 );
r5932r5933
572572         }
573573
574574         /* Advance a pixel */
575         if ( gamecom_dma.decrement_x )
575         if ( gamecom_dma.decrement_x )
576576         {
577577            gamecom_dma.source_x_current--;
578            if ( ( gamecom_dma.source_x_current & 0x03 ) == 0x03 )
578            if ( ( gamecom_dma.source_x_current & 0x03 ) == 0x03 )
579579            {
580580               gamecom_dma.source_current--;
581581            }
582         }
583         else
582         }
583         else
584584         {
585585            gamecom_dma.source_x_current++;
586            if ( ( gamecom_dma.source_x_current & 0x03 ) == 0x00 )
586            if ( ( gamecom_dma.source_x_current & 0x03 ) == 0x00 )
587587            {
588588               gamecom_dma.source_current++;
589589            }
590590         }
591591         gamecom_dma.dest_x_current++;
592         if ( ( gamecom_dma.dest_x_current & 0x03 ) == 0x00 )
592         if ( ( gamecom_dma.dest_x_current & 0x03 ) == 0x00 )
593593         {
594594            gamecom_dma.dest_current++;
595595         }
r5932r5933
607607   cputag_set_input_line(device->machine, "maincpu", DMA_INT, HOLD_LINE );
608608}
609609
610void gamecom_update_timers( const device_config *device, int cycles )
610void gamecom_update_timers( const device_config *device, int cycles )
611611{
612   if ( gamecom_timer[0].enabled )
612   if ( gamecom_timer[0].enabled )
613613   {
614614      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 )
616616      {
617617         gamecom_timer[0].state_count -= gamecom_timer[0].state_limit;
618618         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 )
620620         {
621621            gamecom_timer[0].counter = 0;
622622            cputag_set_input_line(device->machine, "maincpu", TIM0_INT, HOLD_LINE );
623623         }
624624      }
625625   }
626   if ( gamecom_timer[1].enabled )
626   if ( gamecom_timer[1].enabled )
627627   {
628628      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 )
630630      {
631631         gamecom_timer[1].state_count -= gamecom_timer[1].state_limit;
632632         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 )
634634         {
635635            gamecom_timer[1].counter = 0;
636636            cputag_set_input_line(device->machine, "maincpu", TIM1_INT, HOLD_LINE );
r5932r5933
639639   }
640640}
641641
642WRITE8_HANDLER( gamecom_vram_w )
642WRITE8_HANDLER( gamecom_vram_w )
643643{
644644   gamecom_vram[offset] = data;
645645}
646646
647READ8_HANDLER( gamecom_vram_r )
647READ8_HANDLER( gamecom_vram_r )
648648{
649649   return gamecom_vram[offset];
650650}
r5932r5933
660660   int load_offset = 0;
661661
662662   /* allocate memory on first load of a cartridge */
663   if ( cartridge1 == NULL )
663   if ( cartridge1 == NULL )
664664   {
665665      cartridge1 = auto_alloc_array(image->machine, UINT8, 2048 * 1024 );
666666   }
667667   filesize = image_length( image );
668   switch( filesize )
668   switch( filesize )
669669   {
670670   case 0x008000: load_offset = 0;        break;  /* 32 KB */
671671   case 0x040000: load_offset = 0;        break;  /* 256KB */
r5932r5933
677677      logerror( "Error loading cartridge: Invalid file size.\n" );
678678      return INIT_FAIL;
679679   }
680   if ( image_fread( image, cartridge1 + load_offset, filesize ) != filesize )
680   if ( image_fread( image, cartridge1 + load_offset, filesize ) != filesize )
681681   {
682682      logerror( "Error loading cartridge: Unable to read from file: %s.\n", image_filename(image) );
683683      return INIT_FAIL;
src/mess/machine/smartmed.c
r5932r5933
11/*
2   smartmed.c: SmartMedia Flash ROM emulation
2    smartmed.c: SmartMedia Flash ROM emulation
33
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.
66
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)
1111
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?
1515
16   Raphael Nabet 2004
16    Raphael Nabet 2004
1717*/
1818
1919#include "driver.h"
r5932r5933
3838
3939/*INLINE void set_UINT32BE(UINT32BE *word, UINT32 data)
4040{
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;
4545}*/
4646
4747/* SmartMedia image header */
r5932r5933
111111
112112
113113/*
114   Init a SmartMedia image
114    Init a SmartMedia image
115115*/
116116DEVICE_START( smartmedia )
117117{
r5932r5933
134134}
135135
136136/*
137   Load a SmartMedia image
137    Load a SmartMedia image
138138*/
139139DEVICE_IMAGE_LOAD( smartmedia )
140140{
r5932r5933
178178}
179179
180180/*
181   Unload a SmartMedia image
181    Unload a SmartMedia image
182182*/
183183DEVICE_IMAGE_UNLOAD( smartmedia )
184184{
r5932r5933
215215}
216216
217217/*
218   write a byte to SmartMedia command port
218    write a byte to SmartMedia command port
219219*/
220220void smartmedia_command_w(const device_config *device, UINT8 data)
221221{
222222   smartmedia_t *sm = get_safe_token(device);
223   
223
224224   if (!smartmedia_present(device))
225225      return;
226226
r5932r5933
286286      }
287287      break;
288288   /*case 0x11:
289      break;*/
289        break;*/
290290   case 0x60:
291291      sm->mode = SM_M_ERASE;
292292      sm->page_addr = 0;
r5932r5933
312312      sm->mode = SM_M_READSTATUS;
313313      break;
314314   /*case 0x71:
315      break;*/
315        break;*/
316316   case 0x90:
317317      sm->mode = SM_M_READID;
318318      break;
319319   /*case 0x91:
320      break;*/
320        break;*/
321321   default:
322322      logerror("smartmedia: unsupported command 0x%02x\n", data);
323323      sm->mode = SM_M_INIT;
r5932r5933
326326}
327327
328328/*
329   write a byte to SmartMedia address port
329    write a byte to SmartMedia address port
330330*/
331331void smartmedia_address_w(const device_config *device, UINT8 data)
332332{
333333   smartmedia_t *sm = get_safe_token(device);
334   
334
335335   if (!smartmedia_present(device))
336336      return;
337337
r5932r5933
380380}
381381
382382/*
383   read a byte from SmartMedia data port
383    read a byte from SmartMedia data port
384384*/
385385UINT8 smartmedia_data_r(const device_config *device)
386386{
r5932r5933
425425}
426426
427427/*
428   write a byte to SmartMedia data port
428    write a byte to SmartMedia data port
429429*/
430430void smartmedia_data_w(const device_config *device, UINT8 data)
431431{
432432   smartmedia_t *sm = get_safe_token(device);
433   
433
434434   if (!smartmedia_present(device))
435435      return;
436436
r5932r5933
456456
457457
458458/*
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)
461461*/
462462static DEVICE_RESET(smartmedia)
463463{
464464   smartmedia_t *sm = get_safe_token(device);
465   
465
466466   sm->mode = SM_M_INIT;
467467   sm->pointer_mode = SM_PM_A;
468468   sm->status = (sm->status & 0x80) | 0x40;
r5932r5933
471471
472472DEVICE_GET_INFO( smartmedia )
473473{
474   switch ( state )
474   switch ( state )
475475   {
476476      case DEVINFO_INT_CLASS:                       info->i = DEVICE_CLASS_PERIPHERAL;                         break;
477477      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;
479479      case DEVINFO_INT_IMAGE_TYPE:               info->i = IO_MEMCARD;                                      break;
480480      case DEVINFO_INT_IMAGE_READABLE:            info->i = 1;                                               break;
481481      case DEVINFO_INT_IMAGE_WRITEABLE:         info->i = 1;                                               break;
src/mess/machine/advision.c
r5932r5933
1414
1515/*
1616    8048 Ports:
17   
17
1818    P1  Bit 0..1  - RAM bank select
1919        Bit 3..7  - Keypad input
2020
r5932r5933
147147   if ((state->video_enable == 0x00) && (data & 0x10))
148148   {
149149      advision_vh_update(space->machine, state->video_hpos);
150     
150
151151      state->video_hpos++;
152     
152
153153      if (state->video_hpos > 255)
154154      {
155155         state->video_hpos = 0;
156156         logerror("HPOS OVERFLOW\n");
157157      }
158158   }
159   
159
160160   state->video_enable = data & 0x10;
161161   state->video_bank = (data & 0xe0) >> 5;
162162}
src/mess/machine/radio86.c
r5932r5933
2020
2121static UINT8* radio_ram_disk;
2222
23void radio86_init_keyboard()
23void radio86_init_keyboard()
2424{
2525   radio86_keyboard_mask = 0;
2626   radio86_tape_value = 0x10;
r5932r5933
5959
6060static READ8_DEVICE_HANDLER (radio86_8255_portc_r2 )
6161{
62   double level = cassette_input(devtag_get_device(device->machine, "cassette"));                                               
62   double level = cassette_input(devtag_get_device(device->machine, "cassette"));
6363   UINT8 dat = input_port_read(device->machine, "LINE8");
64   if (level <  0) {
64   if (level <  0) {
6565      dat ^= radio86_tape_value;
66    }   
67   return dat;   
66    }
67   return dat;
6868}
6969
7070static WRITE8_DEVICE_HANDLER (radio86_8255_porta_w2 )
r5932r5933
7474
7575static WRITE8_DEVICE_HANDLER (radio86_8255_portc_w2 )
7676{
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);
7878}
7979
8080
r5932r5933
102102
103103static READ8_DEVICE_HANDLER (rk7007_8255_portc_r )
104104{
105   double level = cassette_input(devtag_get_device(device->machine, "cassette"));                                               
105   double level = cassette_input(devtag_get_device(device->machine, "cassette"));
106106   UINT8 key = 0xff;
107107   if ((radio86_keyboard_mask & 0x01)!=0) { key &= input_port_read(device->machine,"CLINE0"); }
108108   if ((radio86_keyboard_mask & 0x02)!=0) { key &= input_port_read(device->machine,"CLINE1"); }
r5932r5933
113113   if ((radio86_keyboard_mask & 0x40)!=0) { key &= input_port_read(device->machine,"CLINE6"); }
114114   if ((radio86_keyboard_mask & 0x80)!=0) { key &= input_port_read(device->machine,"CLINE7"); }
115115   key &= 0xe0;
116   if (level <  0) {
116   if (level <  0) {
117117      key ^= radio86_tape_value;
118    }   
119   return key;   
118    }
119   return key;
120120}
121121
122122I8255A_INTERFACE( rk7007_ppi8255_interface )
r5932r5933
158158   { 0, 0, 0, 0 }
159159};
160160
161static TIMER_CALLBACK( radio86_reset )   
161static TIMER_CALLBACK( radio86_reset )
162162{
163163   memory_set_bank(machine, 1, 0);
164164}
r5932r5933
167167
168168READ8_HANDLER (radio_cpu_state_r )
169169{
170   return cpu_get_reg(space->cpu, I8085_STATUS);   
170   return cpu_get_reg(space->cpu, I8085_STATUS);
171171}
172172
173173READ8_HANDLER (radio_io_r )
r5932r5933
190190}
191191
192192
193WRITE8_HANDLER ( radio86_pagesel )
193WRITE8_HANDLER ( radio86_pagesel )
194194{
195195   disk_sel = data;
196196}
197197
198198static READ8_DEVICE_HANDLER (radio86_romdisk_porta_r )
199199{
200   UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x10000;   
200   UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x10000;
201201   if ((disk_sel & 0x0f) ==0) {
202      return romdisk[romdisk_msb*256+romdisk_lsb];   
202      return romdisk[romdisk_msb*256+romdisk_lsb];
203203   } else {
204204      if (disk_sel==0xdf) {
205205         return radio_ram_disk[romdisk_msb*256+romdisk_lsb + 0x10000];
r5932r5933
210210}
211211
212212static WRITE8_DEVICE_HANDLER (radio86_romdisk_portb_w )
213{   
213{
214214   romdisk_lsb = data;
215215}
216216
217217static WRITE8_DEVICE_HANDLER (radio86_romdisk_portc_w )
218{     
219   romdisk_msb = data;   
218{
219   romdisk_msb = data;
220220}
221221
222222I8255A_INTERFACE( radio86_ppi8255_interface_2 )
r5932r5933
239239   DEVCB_NULL,
240240   DEVCB_NULL,
241241   DEVCB_NULL,
242   DEVCB_NULL,   
242   DEVCB_NULL,
243243   DEVCB_HANDLER(mikrosha_8255_font_page_w),
244244   DEVCB_NULL
245245};
src/mess/machine/ti990.c
r5932r5933
11/*
2   machine/ti990.c
2    machine/ti990.c
33
4   Emulation for a few generic aspects of TI990
4    Emulation for a few generic aspects of TI990
55*/
66
77#include "driver.h"
88#include "ti990.h"
99
1010/*
11   Interrupt priority encoder.  Actually part of the CPU board.
11    Interrupt priority encoder.  Actually part of the CPU board.
1212*/
1313static UINT16 intlines;
1414
r5932r5933
7373}
7474
7575/*
76   hold and debounce load line (emulation is inaccurate)
76    hold and debounce load line (emulation is inaccurate)
7777*/
7878
7979static TIMER_CALLBACK(clear_load)
r5932r5933
8888}
8989
9090/*
91   line interrupt
91    line interrupt
9292*/
9393
9494/* ckon_state: 1 if line clock active (RTCLR flip-flop on TI990/10 schematics -
r5932r5933
111111
112112
113113/*
114   Control panel emulation
114    Control panel emulation
115115
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)
121121
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
126126
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
130130
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.)
134134
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)
145145
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)
156156*/
157157
158158 READ8_HANDLER ( ti990_panel_read )
r5932r5933
169169
170170
171171/*
172   CPU board soft reset (RSET instruction)
172    CPU board soft reset (RSET instruction)
173173*/
174174void ti990_cpuboard_reset(void)
175175{
src/mess/machine/serial.c
r5932r5933
99
1010/*
1111
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.
1515
16   msm8251 expects this in asynchronous mode:
17   packet format:
16    msm8251 expects this in asynchronous mode:
17    packet format:
1818
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
2424
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.
3030*/
3131
3232#include "driver.h"
r5932r5933
5555   int i;
5656
5757   /* if sum of all bits in the byte is even, then the data
58   has even parity, otherwise it has odd parity */
58    has even parity, otherwise it has odd parity */
5959   for (i=0; i<256; i++)
6060   {
6161      int data;
r5932r5933
738738
739739
740740   /*
741   packet:
741    packet:
742742
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    */
750750
751751   /* soh */
752752   xmodem_transfer.packet[count] = XMODEM_SOH;
r5932r5933
878878
879879/* this converts state at this end to a state the other end can accept */
880880/* 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
885885
886      The same thing is done inside the serial null-terminal lead */
886        The same thing is done inside the serial null-terminal lead */
887887
888888static unsigned long serial_connection_spin_bits(unsigned long input_status)
889889{
r5932r5933
941941{
942942   /* both connections should have their in connection setup! */
943943   /* the in connection is the callback they use to update their state based
944   on the output from the other side */
944    on the output from the other side */
945945   connection_a->out_callback = connection_b->in_callback;
946946   connection_b->out_callback = connection_a->in_callback;
947947
src/mess/machine/b2m.c
r5932r5933
11/***************************************************************************
22
3      Bashkiria-2M machine driver by Miodrag Milanovic
3        Bashkiria-2M machine driver by Miodrag Milanovic
44
5      28/03/2008 Preliminary driver.
6           
5        28/03/2008 Preliminary driver.
6
77****************************************************************************/
88
99
r5932r5933
1818#include "includes/b2m.h"
1919
2020static READ8_HANDLER (b2m_keyboard_r )
21{     
21{
2222   UINT8 key = 0x00;
2323   if (offset < 0x100) {
2424      if ((offset & 0x01)!=0) { key |= input_port_read(space->machine,"LINE0"); }
r5932r5933
2828      if ((offset & 0x10)!=0) { key |= input_port_read(space->machine,"LINE4"); }
2929      if ((offset & 0x20)!=0) { key |= input_port_read(space->machine,"LINE5"); }
3030      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"); }
3232   } else {
3333      if ((offset & 0x01)!=0) { key |= input_port_read(space->machine,"LINE8"); }
3434      if ((offset & 0x02)!=0) { key |= input_port_read(space->machine,"LINE9"); }
r5932r5933
3838}
3939
4040
41static void b2m_set_bank(running_machine *machine,int bank)
41static void b2m_set_bank(running_machine *machine,int bank)
4242{
4343   UINT8 *rom;
4444   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
45   
45
4646   memory_install_write8_handler(space, 0x0000, 0x27ff, 0, 0, SMH_BANK(1));
4747   memory_install_write8_handler(space, 0x2800, 0x2fff, 0, 0, SMH_BANK(2));
4848   memory_install_write8_handler(space, 0x3000, 0x6fff, 0, 0, SMH_BANK(3));
r5932r5933
5454      case 0 :
5555      case 1 :
5656                  memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP);
57                 
57
5858                  memory_set_bankptr(machine, 1, mess_ram);
5959                  memory_set_bankptr(machine, 2, mess_ram + 0x2800);
6060                  memory_set_bankptr(machine, 3, mess_ram + 0x3000);
6161                  memory_set_bankptr(machine, 4, mess_ram + 0x7000);
62                  memory_set_bankptr(machine, 5, rom + 0x10000);                 
62                  memory_set_bankptr(machine, 5, rom + 0x10000);
6363                  break;
6464#if 0
6565      case 1 :
r5932r5933
7070                  memory_set_bankptr(machine, 2, mess_ram + 0x2800);
7171                  memory_set_bankptr(machine, 3, rom + 0x12000);
7272                  memory_set_bankptr(machine, 4, rom + 0x16000);
73                  memory_set_bankptr(machine, 5, rom + 0x10000);                 
73                  memory_set_bankptr(machine, 5, rom + 0x10000);
7474                  break;
7575#endif
7676      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);
7878                  memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP);
7979
8080                  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);
8282                  memory_set_bankptr(machine, 3, mess_ram + 0x10000);
8383                  memory_set_bankptr(machine, 4, mess_ram + 0x7000);
84                  memory_set_bankptr(machine, 5, rom + 0x10000);                 
84                  memory_set_bankptr(machine, 5, rom + 0x10000);
8585                  break;
8686      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);
8888                  memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP);
8989
9090                  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);
9292                  memory_set_bankptr(machine, 3, mess_ram + 0x14000);
9393                  memory_set_bankptr(machine, 4, mess_ram + 0x7000);
94                  memory_set_bankptr(machine, 5, rom + 0x10000);                 
94                  memory_set_bankptr(machine, 5, rom + 0x10000);
9595                  break;
9696      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);
9898                  memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP);
9999
100100                  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);
102102                  memory_set_bankptr(machine, 3, mess_ram + 0x18000);
103103                  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
106106                  break;
107107      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);
109109                  memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_UNMAP);
110110
111111                  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);
113113                  memory_set_bankptr(machine, 3, mess_ram + 0x1c000);
114114                  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
117117                  break;
118118      case 6 :
119119                  memory_set_bankptr(machine, 1, mess_ram);
120120                  memory_set_bankptr(machine, 2, mess_ram + 0x2800);
121121                  memory_set_bankptr(machine, 3, mess_ram + 0x3000);
122122                  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);
124124                  break;
125125      case 7 :
126126                  memory_install_write8_handler(space, 0x0000, 0x27ff, 0, 0, SMH_UNMAP);
r5932r5933
128128                  memory_install_write8_handler(space, 0x3000, 0x6fff, 0, 0, SMH_UNMAP);
129129                  memory_install_write8_handler(space, 0x7000, 0xdfff, 0, 0, SMH_UNMAP);
130130                  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);
137137                  break;
138138   }
139139}
r5932r5933
141141static PIT8253_OUTPUT_CHANGED(bm2_pit_out0)
142142{
143143   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);
145145}
146146
147147
148148static PIT8253_OUTPUT_CHANGED(bm2_pit_out1)
149{   
150   b2m_state *st = device->machine->driver_data;   
149{
150   b2m_state *st = device->machine->driver_data;
151151   speaker_level_w(st->speaker, state);
152152
153153}
r5932r5933
177177};
178178
179179static WRITE8_DEVICE_HANDLER (b2m_8255_porta_w )
180{   
180{
181181   b2m_state *state = device->machine->driver_data;
182182   state->b2m_8255_porta = data;
183183}
184184static WRITE8_DEVICE_HANDLER (b2m_8255_portb_w )
185{   
185{
186186   b2m_state *state = device->machine->driver_data;
187187   state->b2m_video_scroll = data;
188188}
189189
190190static WRITE8_DEVICE_HANDLER (b2m_8255_portc_w )
191{   
191{
192192   b2m_state *state = device->machine->driver_data;
193193
194194   state->b2m_8255_portc = data;
r5932r5933
215215
216216
217217static WRITE8_DEVICE_HANDLER (b2m_ext_8255_portc_w )
218{     
218{
219219   UINT8 drive = ((data >> 1) & 1) ^ 1;
220   UINT8 side  = (data  & 1) ^ 1;   
220   UINT8 side  = (data  & 1) ^ 1;
221221   b2m_state *state = device->machine->driver_data;
222222
223223   if (state->b2m_drive!=drive) {
r5932r5933
244244{
245245   b2m_state *state = device->machine->driver_data;
246246
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];
249249}
250250
251251static WRITE8_DEVICE_HANDLER (b2m_romdisk_portb_w )
252{   
252{
253253   b2m_state *state = device->machine->driver_data;
254254   state->b2m_romdisk_lsb = data;
255255}
r5932r5933
257257static WRITE8_DEVICE_HANDLER (b2m_romdisk_portc_w )
258258{
259259   b2m_state *state = device->machine->driver_data;
260   state->b2m_romdisk_msb = data & 0x7f;   
260   state->b2m_romdisk_msb = data & 0x7f;
261261}
262262
263263I8255A_INTERFACE( b2m_ppi8255_interface_3 )
r5932r5933
271271};
272272
273273static 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}
277277
278278/* Driver initialization */
279279DRIVER_INIT(b2m)
280280{
281281   b2m_state *state = machine->driver_data;
282282
283   memset(mess_ram,0,128*1024);   
283   memset(mess_ram,0,128*1024);
284284   state->vblank_state = 0;
285285}
286286
287WRITE8_HANDLER ( b2m_palette_w )
287WRITE8_HANDLER ( b2m_palette_w )
288288{
289289   b2m_state *state = space->machine->driver_data;
290290
291291   UINT8 b = (3 - ((data >> 6) & 3)) * 0x55;
292292   UINT8 g = (3 - ((data >> 4) & 3)) * 0x55;
293293   UINT8 r = (3 - ((data >> 2) & 3)) * 0x55;
294   
294
295295   UINT8 bw = (3 - (data & 3)) * 0x55;
296   
297   state->b2m_color[offset & 3] = data;     
298   
296
297   state->b2m_color[offset & 3] = data;
298
299299   if (input_port_read(space->machine,"MONITOR")==1) {
300300      palette_set_color_rgb(space->machine,offset, r, g, b);
301301   } else {
r5932r5933
309309   return state->b2m_color[offset];
310310}
311311
312WRITE8_HANDLER ( b2m_localmachine_w )
312WRITE8_HANDLER ( b2m_localmachine_w )
313313{
314314   b2m_state *state = space->machine->driver_data;
315315   state->b2m_localmachine = data;
316316}
317317
318READ8_HANDLER ( b2m_localmachine_r )
318READ8_HANDLER ( b2m_localmachine_r )
319319{
320320   b2m_state *state = space->machine->driver_data;
321321   return state->b2m_localmachine;
r5932r5933
335335   state->speaker = devtag_get_device(machine, "speaker");
336336
337337   wd17xx_set_pause_time(state->fdc,10);
338   
338
339339   /* register for state saving */
340340   state_save_register_global(machine, state->b2m_8255_porta);
341341   state_save_register_global(machine, state->b2m_video_scroll);
r5932r5933
348348   state_save_register_global_pointer(machine, state->b2m_color, 4);
349349   state_save_register_global(machine, state->b2m_localmachine);
350350   state_save_register_global(machine, state->vblank_state);
351   
351
352352   state_save_register_postload(machine, b2m_postload, NULL);
353353}
354354
355355static IRQ_CALLBACK(b2m_irq_callback)
356{   
356{
357357   b2m_state *state = device->machine->driver_data;
358358   return pic8259_acknowledge(state->pic);
359}
359}
360360
361361const struct pic8259_interface b2m_pic8259_config = {
362362   b2m_pic_set_int_line
363363};
364364
365365INTERRUPT_GEN (b2m_vblank_interrupt)
366{   
366{
367367   b2m_state *state = device->machine->driver_data;
368368   state->vblank_state++;
369369   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);
371371}
372372
373373MACHINE_RESET(b2m)
374{   
374{
375375   b2m_state *state = machine->driver_data;
376376   state->b2m_side = 0;
377377   state->b2m_drive = 0;
src/mess/machine/ins8154.h
r5932r5933
11/*****************************************************************************
22 *
33 * machine/ins8154.h
4 *
4 *
55 * INS8154 N-Channel 128-by-8 Bit RAM Input/Output (RAM I/O)
66 *
77 ****************************************************************************/
r5932r5933
3232   read8_device_func in_b_func;
3333   write8_device_func out_a_func;
3434   write8_device_func out_b_func;
35   ins8154_irq_func irq_func;   
35   ins8154_irq_func irq_func;
3636};
3737
3838DEVICE_GET_INFO( ins8154 );
src/mess/machine/smartmed.h
r5932r5933
11/*
2   smartmed.h: header file for smartmed.c
2    smartmed.h: header file for smartmed.c
33*/
44
55#ifndef __SMARTMEDIA_H__
src/mess/machine/ti990.h
r5932r5933
11/*
2   ti990.h: header file for ti990.c
2    ti990.h: header file for ti990.c
33*/
44
55void ti990_reset_int(void);
src/mess/machine/mc6846.c
r5932r5933
8181
8282
8383
84INLINE mc6846_t* get_safe_token( const device_config *device )
84INLINE mc6846_t* get_safe_token( const device_config *device )
8585{
8686   assert( device != NULL );
8787   assert( device->token != NULL );
src/mess/machine/cdp1871.c
r5932r5933
142142
143143/*-------------------------------------------------
144144    change_output_lines - change output line
145   state
145    state
146146-------------------------------------------------*/
147147
148148static void change_output_lines(const device_config *device)
r5932r5933
166166
167167/*-------------------------------------------------
168168    clock_scan_counters - clock the keyboard
169   scan counters
169    scan counters
170170-------------------------------------------------*/
171171
172172static void clock_scan_counters(const device_config *device)
r5932r5933
199199   cdp1871_t *cdp1871 = get_safe_token(device);
200200
201201   UINT8 data = 0;
202   
202
203203   switch (cdp1871->drive)
204204   {
205205   case 0:      data = devcb_call_read8(&cdp1871->in_d1_func, 0);   break;
src/mess/machine/8530scc.c
r5932r5933
11/*********************************************************************
22
3   8530scc.c
3    8530scc.c
44
5   Zilog 8530 SCC (Serial Control Chip) code
5    Zilog 8530 SCC (Serial Control Chip) code
66
77*********************************************************************/
88
r5932r5933
291291               scc->mode = 1;
292292               scc->reg = data & 0x0f;
293293               logerror("SCC: Port B Reg select - %i\n",scc->reg);
294//               scc_putbreg(device, data & 0xf0);
294//                  scc_putbreg(device, data & 0xf0);
295295            }
296296         }
297297         else
r5932r5933
310310               scc->mode = 1;
311311               scc->reg = data & 0x0f;
312312               logerror("SCC: Port A Reg select - %i\n", scc->reg);
313//               scc_putareg(device, data & 0xf0);
313//                  scc_putareg(device, data & 0xf0);
314314            }
315315         }
316316         else
src/mess/machine/cdp1871.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3030
3131**********************************************************************/
3232
src/mess/machine/pmd85.c
r5932r5933
3636static void pmd851_update_memory(running_machine *machine)
3737{
3838   const address_space* space = cputag_get_address_space(machine, "maincpu",ADDRESS_SPACE_PROGRAM);
39   
39
4040   if (pmd85_startup_mem_map)
4141   {
4242      UINT8 *mem = memory_region(machine, "maincpu");
r5932r5933
228228
229229/*******************************************************************************
230230
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
234234
235235*******************************************************************************/
236236
r5932r5933
271271
272272/*******************************************************************************
273273
274   Motherboard 8255 (Mato)
275   -----------------------
276      keyboard, speaker, LEDs, tape
274    Motherboard 8255 (Mato)
275    -----------------------
276        keyboard, speaker, LEDs, tape
277277
278278*******************************************************************************/
279279
r5932r5933
305305
306306/*******************************************************************************
307307
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)
311311
312312*******************************************************************************/
313313
r5932r5933
343343
344344/*******************************************************************************
345345
346   I/O board 8255
347   --------------
348      IMS-2 (K5 connector)
346    I/O board 8255
347    --------------
348        IMS-2 (K5 connector)
349349
350   - 8251 - cassette recorder and V.24/IFSS (selectable by switch)
350    - 8251 - cassette recorder and V.24/IFSS (selectable by switch)
351351
352   - external interfaces connector (K2)
352    - external interfaces connector (K2)
353353
354354*******************************************************************************/
355355
r5932r5933
385385
386386/*******************************************************************************
387387
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)
391391
392392*******************************************************************************/
393393
394394/*******************************************************************************
395395
396   I/O board 8253
397   --------------
396    I/O board 8253
397    --------------
398398
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
411411
412412*******************************************************************************/
413413
r5932r5933
422422
423423/*******************************************************************************
424424
425   I/O board external interfaces connector (K2)
426   --------------------------------------------
425    I/O board external interfaces connector (K2)
426    --------------------------------------------
427427
428428*******************************************************************************/
429429
r5932r5933
431431
432432/*******************************************************************************
433433
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
438438
439439*******************************************************************************/
440440
r5932r5933
470470
471471/*******************************************************************************
472472
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    -------------------------------------------------------
475475
476   I/O board
477   1xxx11aa   external interfaces connector (K2)
476    I/O board
477    1xxx11aa    external interfaces connector (K2)
478478
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)
484484
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
488488
489   ROM Module
490   1xxx10aa   8255 (ROM reading)
489    ROM Module
490    1xxx10aa    8255 (ROM reading)
491491
492492*******************************************************************************/
493493
r5932r5933
635635
636636/*******************************************************************************
637637
638   I/O ports (Mato)
639   ----------------
638    I/O ports (Mato)
639    ----------------
640640
641   Motherboard
642   1xxx01aa   8255 (keyboard, speaker, LEDs, tape)
641    Motherboard
642    1xxx01aa    8255 (keyboard, speaker, LEDs, tape)
643643
644644*******************************************************************************/
645645
r5932r5933
844844
845845static DIRECT_UPDATE_HANDLER(pmd85_opbaseoverride)
846846{
847   if (input_port_read(space->machine, "RESET") & 0x01)
847   if (input_port_read(space->machine, "RESET") & 0x01)
848848      timer_set(space->machine, ATTOTIME_IN_USEC(10), NULL, 0, pmd_reset);
849849   return address;
850850}
r5932r5933
899899   pmd85_common_driver_init(machine);
900900}
901901
902static TIMER_CALLBACK( setup_machine_state )
902static TIMER_CALLBACK( setup_machine_state )
903903{
904904   const device_config *pit8253 = devtag_get_device(machine, "pit8253");
905905
906906   pit8253_gate_w(pit8253, 0, 1);
907907   pit8253_gate_w(pit8253, 1, 1);
908908   pit8253_gate_w(pit8253, 2, 1);
909   if (pmd85_model!=MATO)
909   if (pmd85_model!=MATO)
910910   {
911911      msm8251_connect(devtag_get_device(machine, "uart"), &pmd85_cassette_serial_connection);
912912   }
r5932r5933
936936
937937   timer_set(machine,  attotime_zero, NULL, 0, setup_machine_state );
938938
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);
940940}
src/mess/machine/8530scc.h
r5932r5933
11/*********************************************************************
22
3   8530scc.h
3    8530scc.h
44
5   Zilog 8530 SCC (Serial Control Chip) code
5    Zilog 8530 SCC (Serial Control Chip) code
66
77*********************************************************************/
88
src/mess/machine/spectrum.c
r5932r5933
168168 *      26      2       R,I
169169 *      28      4       SP,PC
170170 *      32      2       0 (reserved for future use)
171 *      34      1   Border color
171 *      34      1   Border color
172172 *      35      1       0 (reserved for future use)
173173 *      36      2       Status word
174174 *      38      -       RAM dump
175175 *
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
188188 *
189189 *******************************************************************/
190190void spectrum_setup_sp(running_machine *machine, unsigned char *pSnapshot, unsigned long SnapshotSize)
r5932r5933
408408   }
409409
410410   if (SnapshotSize == 49179)
411   {     
411   {
412412      /* get pc from stack */
413413      addr = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP) & 0xFFFF;
414414
415415      lo = memory_read_byte(space,addr + 0);
416      hi = memory_read_byte(space,addr + 1);     
416      hi = memory_read_byte(space,addr + 1);
417417      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, (hi << 8) | lo);
418418      memory_write_byte(space, addr + 0, 0);
419419      memory_write_byte(space, addr + 1, 0);
420     
420
421421      memory_write_byte(space, 0x5CB0, 0xff); // Set NMIADD system variable to make game run
422422                                    //  when directly started with cart mounted
423423      addr += 2;
r5932r5933
465465   unsigned char ch;
466466   int i;
467467   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
468   
468
469469   do
470470   {
471471      /* get byte */
472472      ch = pSource[0];
473473
474474      /* either start 0f 0x0ed, 0x0ed, xx yy or
475      * single 0x0ed */
475        * single 0x0ed */
476476      if (ch == (unsigned char) 0x0ed)
477477      {
478478         if (pSource[1] == (unsigned char) 0x0ed)
src/mess/machine/kay_kbd.c
r5932r5933
11/******************************************************************************
22 *
3 *   kay_kbd.c
3 *  kay_kbd.c
44 *
5 *   Kaypro II Serial Keyboard
5 *  Kaypro II Serial Keyboard
66 *
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.
99 *
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)
1212 *
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.
1515 *
1616 ******************************************************************************/
1717
r5932r5933
101101   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)         PORT_CHAR('[') PORT_CHAR('{')
102102   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)      PORT_CHAR(']') PORT_CHAR('}')
103103   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))
105105   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL)         PORT_CHAR(UCHAR_SHIFT_2)
106106   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK)         PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
107107
r5932r5933
384384#if 0
385385
386386/******************************************************
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
390390 ******************************************************/
391391static WRITE8_HANDLER ( kaypro2_const_w )
392392{
r5932r5933
397397#endif
398398
399399/******************************************************
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
403403 ******************************************************/
404404static void kay_kbd_in( running_machine *machine, UINT8 data )
405405{
r5932r5933
421421
422422UINT8 kay_kbd_c_r( void )
423423{
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 */
427427
428428   UINT8 data = control_status;
429429
r5932r5933
457457void kay_kbd_d_w( running_machine *machine, UINT8 data )
458458{
459459/* 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 */
465465
466466   UINT16 length = 0;
467467
src/mess/machine/6883sam.c
r5932r5933
11/**********************************************************************
22
3   Motorola 6883 SAM interface and emulation
3    Motorola 6883 SAM interface and emulation
44
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.
77
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.
1414
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:
1818
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
5151
5252**********************************************************************/
5353
src/mess/machine/sst39vfx.c
r5932r5933
11/*
22
3   SST Multi-Purpose Flash (MPF)
3    SST Multi-Purpose Flash (MPF)
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
7   SST39VF020  - 256 KByte
8   SST39VF400A - 512 Kbyte
7    SST39VF020  - 256 KByte
8    SST39VF400A - 512 Kbyte
99
1010*/
1111
r5932r5933
5757{
5858   sst39vfx_t *flash = get_token(device);
5959   const sst39vfx_config *config = get_config(device);
60   
60
6161   _logerror( 0, ("sst39vfx_init (%d)\n", device_type));
6262   memset( flash, 0, sizeof( flash));
6363   switch (device_type)
r5932r5933
106106/*
107107READ8_HANDLER( sst39vfx_r )
108108{
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];
112112}
113113*/
114114
115115/*
116116WRITE8_HANDLER( sst39vfx_w )
117117{
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;
121121}
122122*/
123123
r5932r5933
126126   int i, j;
127127   UINT8 *base, temp[8];
128128   sst39vfx_t *flash = get_token(device);
129   
129
130130   base = flash->data;
131131   for (i=0;i<flash->size;i+=flash->swap)
132132   {
r5932r5933
138138void sst39vfx_load(const device_config *device, mame_file *file)
139139{
140140   sst39vfx_t *flash = get_token(device);
141   
141
142142   _logerror( 0, ("sst39vfx_load (%p)\n", file));
143143   mame_fread( file, flash->data, flash->size);
144144   if (flash->swap) sst39vfx_swap(device);
r5932r5933
147147void sst39vfx_save(const device_config *device, mame_file *file)
148148{
149149   sst39vfx_t *flash = get_token(device);
150   
150
151151   _logerror( 0, ("sst39vfx_save (%p)\n", file));
152152   if (flash->swap) sst39vfx_swap(device);
153153   mame_fwrite( file, flash->data, flash->size);
r5932r5933
157157/*
158158NVRAM_HANDLER( sst39vfx )
159159{
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    }
176176}
177177*/
178178
src/mess/machine/tx0.c
r5932r5933
11/*
2   TX-0
2    TX-0
33*
4   Raphael Nabet, 2004
4    Raphael Nabet, 2004
55*/
66
77#include "driver.h"
r5932r5933
149149static void tx0_machine_stop(running_machine *machine)
150150{
151151   /* the core will take care of freeing the timers, BUT we must set the variables
152   to NULL if we don't want to risk confusing the tape image init function */
152    to NULL if we don't want to risk confusing the tape image init function */
153153   tape_reader.timer = tape_puncher.timer = typewriter.prt_timer = dis_timer = NULL;
154154}
155155
r5932r5933
166166
167167
168168/*
169   perforated tape handling
169    perforated tape handling
170170*/
171171
172172void tx0_tape_get_open_mode(int id,   unsigned int *readable, unsigned int *writeable, unsigned int *creatable)
r5932r5933
193193
194194
195195/*
196   Open a perforated tape image
196    Open a perforated tape image
197197
198   unit 0 is reader (read-only), unit 1 is puncher (write-only)
198    unit 0 is reader (read-only), unit 1 is puncher (write-only)
199199*/
200200DEVICE_IMAGE_LOAD( tx0_tape )
201201{
r5932r5933
212212
213213      /* restart reader IO when necessary */
214214      /* 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! */
217217      if (tape_reader.timer)
218218      {
219219         if (tape_reader.motor_on && tape_reader.rcl)
r5932r5933
262262}
263263
264264/*
265   Read a byte from perforated tape
265    Read a byte from perforated tape
266266*/
267267static int tape_read(UINT8 *reply)
268268{
r5932r5933
273273}
274274
275275/*
276   Write a byte to perforated tape
276    Write a byte to perforated tape
277277*/
278278static void tape_write(UINT8 data)
279279{
r5932r5933
282282}
283283
284284/*
285   common code for tape read commands (R1C, R3C, and read-in mode)
285    common code for tape read commands (R1C, R3C, and read-in mode)
286286*/
287287static void begin_tape_read(int binary)
288288{
r5932r5933
303303
304304
305305/*
306   timer callback to simulate reader IO
306    timer callback to simulate reader IO
307307*/
308308static TIMER_CALLBACK(reader_callback)
309309{
r5932r5933
350350}
351351
352352/*
353   timer callback to generate punch completion pulse
353    timer callback to generate punch completion pulse
354354*/
355355static TIMER_CALLBACK(puncher_callback)
356356{
r5932r5933
358358}
359359
360360/*
361   Initiate read of a 6-bit word from tape
361    Initiate read of a 6-bit word from tape
362362*/
363363void tx0_io_r1l(const device_config *device)
364364{
r5932r5933
366366}
367367
368368/*
369   Initiate read of a 18-bit word from tape (used in read-in mode)
369    Initiate read of a 18-bit word from tape (used in read-in mode)
370370*/
371371void tx0_io_r3l(const device_config *device)
372372{
r5932r5933
374374}
375375
376376/*
377   Write a 7-bit word to tape (7th bit clear)
377    Write a 7-bit word to tape (7th bit clear)
378378*/
379379void tx0_io_p6h(const device_config *device)
380380{
r5932r5933
389389}
390390
391391/*
392   Write a 7-bit word to tape (7th bit set)
392    Write a 7-bit word to tape (7th bit set)
393393*/
394394void tx0_io_p7h(const device_config *device)
395395{
r5932r5933
405405
406406
407407/*
408   Typewriter handling
408    Typewriter handling
409409
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.
412412*/
413413
414414/*
415   Open a file for typewriter output
415    Open a file for typewriter output
416416*/
417417DEVICE_IMAGE_LOAD(tx0_typewriter)
418418{
r5932r5933
428428}
429429
430430/*
431   Write a character to typewriter
431    Write a character to typewriter
432432*/
433433static void typewriter_out(running_machine *machine, UINT8 data)
434434{
r5932r5933
438438}
439439
440440/*
441   timer callback to generate typewriter completion pulse
441    timer callback to generate typewriter completion pulse
442442*/
443443static TIMER_CALLBACK(prt_callback)
444444{
r5932r5933
446446}
447447
448448/*
449   prt io callback
449    prt io callback
450450*/
451451void tx0_io_prt(const device_config *device)
452452{
r5932r5933
464464
465465
466466/*
467   timer callback to generate crt completion pulse
467    timer callback to generate crt completion pulse
468468*/
469469static TIMER_CALLBACK(dis_callback)
470470{
r5932r5933
472472}
473473
474474/*
475   Plot one point on crt
475    Plot one point on crt
476476*/
477477void tx0_io_dis(const device_config *device)
478478{
r5932r5933
490490
491491
492492/*
493   Magtape support
493    Magtape support
494494
495   Magtape format:
495    Magtape format:
496496
497   7-track tape, 6-bit data, 1-bit parity
497    7-track tape, 6-bit data, 1-bit parity
498498
499499
500500*/
r5932r5933
549549}
550550
551551/*
552   Open a magnetic tape image
552    Open a magnetic tape image
553553*/
554554DEVICE_IMAGE_LOAD( tx0_magtape )
555555{
r5932r5933
559559
560560   /* restart IO when necessary */
561561   /* 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! */
564564   if (magtape.timer)
565565   {
566566      if (magtape.state == MTS_SELECTING)
r5932r5933
607607
608608         if ((mar & 03) != 1)
609609         {   /* unimplemented device: remain in unselected state and set rwc
610            flag? */
610                flag? */
611611            cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_RWC);
612612         }
613613         else
r5932r5933
689689            {
690690            case MTBSS_STATE0:
691691               /* 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 */
694694               if (buf != 0)
695695                  magtape.u.backspace_state = MTBSS_STATE1;
696696               break;
697697            case MTBSS_STATE1:
698698               /* STATE1 -> first byte of gap between longitudinal parity and
699               data, second byte of data */
699                    data, second byte of data */
700700               if (buf == 0)
701701                  magtape.u.backspace_state = MTBSS_STATE2;
702702               else
r5932r5933
704704               break;
705705            case MTBSS_STATE2:
706706               /* STATE2 -> second byte of gap between longitudinal parity and
707               data */
707                    data */
708708               if (buf == 0)
709709                  magtape.u.backspace_state = MTBSS_STATE3;
710710               else
r5932r5933
716716               break;
717717            case MTBSS_STATE3:
718718               /* STATE3 -> third byte of gap between longitudinal parity and
719               data */
719                    data */
720720               if (buf == 0)
721721                  magtape.u.backspace_state = MTBSS_STATE4;
722722               else
r5932r5933
728728               break;
729729            case MTBSS_STATE4:
730730               /* STATE4 -> first byte of data word, first byte of
731               interrecord gap after data */
731                    interrecord gap after data */
732732               if (buf == 0)
733733               {
734734                  if (magtape.long_parity)
r5932r5933
774774         if (image_fread(magtape.img, &buf, 1) != 1)
775775         {   /* I/O error or EOF? */
776776            /* 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!!! */
780780            UINT64 offs;
781781            offs = image_ftell(magtape.img);
782782            if (image_fseek(magtape.img, 0, SEEK_END) || (offs != image_ftell(magtape.img)))
r5932r5933
787787            else
788788            {   /* end of tape -> ??? */
789789               /* maybe we run past end of tape, so that tape is ejected from
790               upper reel and unit becomes unavailable??? */
790                    upper reel and unit becomes unavailable??? */
791791               /*image_unload(magtape.img);*/
792792               /* Or do we stop at EOT mark??? */
793793               magtape.state = MTS_UNSELECTING;
r5932r5933
865865               break;
866866            case MTRDS_STATE3:
867867               /* STATE3 -> first byte of new word of data, or first byte
868               of gap between data and longitudinal parity */
868                    of gap between data and longitudinal parity */
869869               if (buf != 0)
870870               {
871871                  magtape.u.read.state = MTRDS_STATE1;
r5932r5933
883883               break;
884884            case MTRDS_STATE4:
885885               /* STATE4 -> second byte of gap between data and
886               longitudinal parity */
886                    longitudinal parity */
887887               if (buf != 0)
888888               {
889889                  logerror("tape seems to be corrupt\n");
r5932r5933
896896
897897            case MTRDS_STATE5:
898898               /* STATE5 -> third byte of gap between data and
899               longitudinal parity */
899                    longitudinal parity */
900900               if (buf != 0)
901901               {
902902                  logerror("tape seems to be corrupt\n");
r5932r5933
914914               {
915915                  logerror("invalid longitudinal parity\n");
916916                  /* no idea if the original tx-0 magtape controller
917                  checks parity, but can't harm if we do */
917                        checks parity, but can't harm if we do */
918918                  cpu_set_reg(device, TX0_PF, cpu_get_reg(device, TX0_PF) | PF_PC);
919919               }
920920               /* set EOR and unselect... */
r5932r5933
10701070
10711071
10721072/*
1073   callback which is called when reset line is pulsed
1073    callback which is called when reset line is pulsed
10741074
1075   IO devices should reset
1075    IO devices should reset
10761076*/
10771077void tx0_io_reset_callback(const device_config *device)
10781078{
r5932r5933
10921092
10931093
10941094/*
1095   typewriter keyboard handler
1095    typewriter keyboard handler
10961096*/
10971097static void tx0_keyboard(running_machine *machine)
10981098{
r5932r5933
11101110   {
11111111      typewriter_keys[i] = input_port_read(machine, twrnames[i]);
11121112   }
1113   
1113
11141114   for (i=0; i<4; i++)
11151115   {
11161116      typewriter_transitions = typewriter_keys[i] & (~ old_typewriter_keys[i]);
r5932r5933
11211121         charcode = (i << 4) + j;
11221122         /* shuffle and insert data into LR */
11231123         /* BTW, I am not sure how the char code is combined with the
1124         previous LR */
1124            previous LR */
11251125         lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1);
11261126         /* write modified LR */
11271127         cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_LR, lr);
r5932r5933
11351135}
11361136
11371137/*
1138   Not a real interrupt - just handle keyboard input
1138    Not a real interrupt - just handle keyboard input
11391139*/
11401140INTERRUPT_GEN( tx0_interrupt )
11411141{
src/mess/machine/6883sam.h
r5932r5933
11/**********************************************************************
22
3   Motorola 6883 SAM interface and emulation
3    Motorola 6883 SAM interface and emulation
44
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.
77
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.
1414
1515**********************************************************************/
1616
src/mess/machine/sst39vfx.h
r5932r5933
11/*
22
3   SST Multi-Purpose Flash (MPF)
3    SST Multi-Purpose Flash (MPF)
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
7   SST39VF020  - 256 KByte
8   SST39VF400A - 512 Kbyte
7    SST39VF020  - 256 KByte
8    SST39VF400A - 512 Kbyte
99
1010*/
1111
r5932r5933
3737   MDRV_DEVICE_CONFIG_DATA32(sst39vfx_config, cpu_endianess, _cpu_endianess)
3838
3939#define MDRV_SST39VF020_REMOVE(_tag) \
40   MDRV_DEVICE_REMOVE(_tag)   
41   
40   MDRV_DEVICE_REMOVE(_tag)
41
4242#define SST39VF400A      DEVICE_GET_INFO_NAME(sst39vf400a)
4343
4444#define MDRV_SST39VF400A_ADD(_tag,_cpu_datawidth,_cpu_endianess) \
src/mess/machine/ay3600.c
r5932r5933
55  Machine file to handle emulation of the AY-3600 keyboard controller.
66
77  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?
1515
1616***************************************************************************/
1717
r5932r5933
4343
4444static const unsigned char ay3600_key_remap_2[9*8][4] =
4545{
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            */
103103};
104104
105105static const unsigned char ay3600_key_remap_2e[2][9*8][4] =
106106{
107107/* caps lock off  norm ctrl shft both */
108108   {
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        */
118118      { 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)   */
181181   },
182182/* caps lock on   norm ctrl shft both */
183183   {
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        */
193193      { 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)   */
256256   }
257257};
258258
r5932r5933
325325   ay3600_keys = auto_alloc_array_clear(machine, unsigned int, AY3600_KEYS_LENGTH);
326326
327327   /* We poll the keyboard periodically to scan the keys.  This is
328   actually consistent with how the AY-3600 keyboard controller works. */
328    actually consistent with how the AY-3600 keyboard controller works. */
329329   timer_pulse(machine, ATTOTIME_IN_HZ(60), NULL, 0, AY3600_poll);
330330
331331   /* Set Caps Lock light to ON, since that's how we default it. */
r5932r5933
366366
367367   static unsigned int time_until_repeat = MAGIC_KEY_REPEAT_NUMBER;
368368
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",
370370                              "keypad_1", "keypad_2" };
371371
372372   /* check for these special cases because they affect the emulated key codes */
r5932r5933
435435
436436   /* reset key check */
437437   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))
439439      {
440         if (!reset_flag)
440         if (!reset_flag)
441441         {
442442            reset_flag = 1;
443443            /* using PULSE_LINE does not allow us to press and hold key */
r5932r5933
463463
464464      for (bit = 0; bit < 8; bit++)
465465      {
466         if (a2_has_capslock(machine))
466         if (a2_has_capslock(machine))
467467         {
468468            curkey = ay3600_key_remap_2e[caps_lock][port*8+bit][switchkey];
469469            curkey_unmodified = ay3600_key_remap_2e[caps_lock][port*8+bit][0];
470         }
471         else
470         }
471         else
472472         {
473473            curkey = ay3600_key_remap_2[port*8+bit][switchkey];
474474            curkey_unmodified = ay3600_key_remap_2[port*8+bit][0];
src/mess/machine/ap2_lang.c
r5932r5933
11/*********************************************************************
22
3   ap2_lang.c
3    ap2_lang.c
44
5   Implementation of the Apple II Language Card
5    Implementation of the Apple II Language Card
66
77*********************************************************************/
88
r5932r5933
8383
8484/*-------------------------------------------------
8585    DEVICE_START(apple2_langcard) - device start
86   function
86    function
8787-------------------------------------------------*/
8888
8989static DEVICE_START(apple2_langcard)
r5932r5933
9595
9696/*-------------------------------------------------
9797    DEVICE_GET_INFO(apple2_langcard) - device get info
98   function
98    function
9999-------------------------------------------------*/
100100
101101DEVICE_GET_INFO(apple2_langcard)
src/mess/machine/p2000t.c
r5932r5933
4242
4343READ8_HANDLER (   p2000t_port_000f_r )
4444{
45   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4",
45   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4",
4646                              "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
4747
4848   if (p2000t_ports.port_101f & P2000M_101F_KEYINT)
src/mess/machine/tms9901.c
r5932r5933
11/*
2   TMS9901 Programmable System Interface
2    TMS9901 Programmable System Interface
33
4   Raphael Nabet, 2000-2004
4    Raphael Nabet, 2000-2004
55*/
66
77#include <math.h>
r5932r5933
1010#include "tms9901.h"
1111
1212/*
13   TMS9901 emulation.
13    TMS9901 emulation.
1414
1515Overview:
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).
1919
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.
2222
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.
2727
2828Pins:
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.)
4040
4141Interrupt 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.
4646
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.
5353
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.)
5858
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).
6363
6464TODO:
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.
8080*/
8181
8282
8383/*
84   tms9901 state structure
84    tms9901 state structure
8585*/
8686
8787
r5932r5933
9494{
9595   /* interrupt registers */
9696   int supported_int_mask;   /* mask:  bit #n is set if pin #n is supported as an interrupt pin,
97                       i.e. the driver sends a notification whenever the pin state changes */
97                              i.e. the driver sends a notification whenever the pin state changes */
9898                     /* 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 */
101101   int int_state;         /* state of the int1-int15 lines */
102102   int timer_int_pending;   /* timer int pending (overrides int3 pin if timer enabled) */
103103   int enabled_ints;      /* interrupt enable mask */
r5932r5933
114114   void *timer;         /* MESS timer, used to emulate the decrementer register */
115115
116116   int clockinvl;         /* clock interval, loaded in decrementer when it reaches 0.
117                       0 means decrementer off */
117                              0 means decrementer off */
118118   int latchedtimer;      /* when we go into timer mode, the decrementer is copied there to allow to read it reliably */
119119
120120   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) */
124124
125125   /* tms9901 clock rate (PHI* pin, normally connected to TMS9900 Phi3*) */
126126   /* decrementer rate equates PHI* rate/64 (e.g. 46875Hz for a 3MHz clock)
127   (warning: 3MHz on a tms9900 is equivalent to 12MHz on a tms9995 or tms99000) */
127    (warning: 3MHz on a tms9900 is equivalent to 12MHz on a tms9995 or tms99000) */
128128   double clock_rate;
129129
130130   /* Pointer to interface */
r5932r5933
145145
146146
147147/*
148   utilities
148    utilities
149149*/
150150
151151
152152/*
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
155155*/
156156static int find_first_bit(int value)
157157{
r5932r5933
190190}
191191
192192/*
193   should be called after any change to int_state or enabled_ints.
193    should be called after any change to int_state or enabled_ints.
194194*/
195195static void tms9901_field_interrupts(const device_config *device)
196196{
r5932r5933
214214   if (current_ints)
215215   {
216216      /* find which interrupt tripped us:
217        we simply look for the first bit set to 1 in current_ints... */
217          we simply look for the first bit set to 1 in current_ints... */
218218      int level = find_first_bit(current_ints);
219219
220220      tms->int_pending = TRUE;
r5932r5933
233233
234234
235235/*
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)
238238
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)
241241
242   0<=pin_number<=15
242    0<=pin_number<=15
243243*/
244244void tms9901_set_single_int(const device_config *device, int pin_number, int state)
245245{
r5932r5933
256256
257257
258258/*
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.
261261*/
262262static TIMER_CALLBACK(decrementer_callback)
263263{
r5932r5933
270270}
271271
272272/*
273   load the content of clockinvl into the decrementer
273    load the content of clockinvl into the decrementer
274274*/
275275static void tms9901_timer_reload(const device_config *device)
276276{
r5932r5933
288288
289289
290290/*----------------------------------------------------------------
291   TMS9901 CRU interface.
291    TMS9901 CRU interface.
292292----------------------------------------------------------------*/
293293
294294/*
295   Read a 8 bit chunk from tms9901.
295    Read a 8 bit chunk from tms9901.
296296
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.
304304
305   bit 16-31: current status of the P0-P15 pins (quits timer mode, too...)
305    bit 16-31: current status of the P0-P15 pins (quits timer mode, too...)
306306*/
307307READ8_DEVICE_HANDLER ( tms9901_cru_r )
308308{
r5932r5933
373373}
374374
375375/*
376   Write 1 bit to tms9901.
376    Write 1 bit to tms9901.
377377
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)
385385
386   bit 16-31: set output state of P0-P15 (and set them as output pin) (quit timer mode, too...)
386    bit 16-31: set output state of P0-P15 (and set them as output pin) (quit timer mode, too...)
387387*/
388388WRITE8_DEVICE_HANDLER ( tms9901_cru_w )
389389{
r5932r5933
402402         if (tms->mode9901)
403403         {
404404            /* we are switching to clock mode: latch the current value of
405            the decrementer register */
405                the decrementer register */
406406            if (tms->clockinvl)
407407               tms->latchedtimer = ceil(attotime_to_double(timer_timeleft(tms->timer)) * (tms->clock_rate / 64.));
408408            else
r5932r5933
429429   case 0x0D:
430430   case 0x0E:
431431      /*
432         write one bit to 9901 (bits 1-14)
432            write one bit to 9901 (bits 1-14)
433433
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        */
437437      /* offset is the index of the modified bit of register (-> interrupt number -1) */
438438      if (tms->mode9901)
439439      {   /* modify clock interval */
src/mess/machine/ay3600.h
r5932r5933
11/***************************************************************************
22
3   ay3600.h
3    ay3600.h
44
5   Include file for AY3600 keyboard; used by Apple IIs
5    Include file for AY3600 keyboard; used by Apple IIs
66
77***************************************************************************/
88
src/mess/machine/ap2_lang.h
r5932r5933
11/*********************************************************************
22
3   ap2_lang.h
3    ap2_lang.h
44
5   Implementation of the Apple II Language Card
5    Implementation of the Apple II Language Card
66
77*********************************************************************/
88
r5932r5933
2828***************************************************************************/
2929
3030/* device get info function */
31DEVICE_GET_INFO(apple2_langcard);   
31DEVICE_GET_INFO(apple2_langcard);
3232
3333/* slot read function */
3434READ8_DEVICE_HANDLER(apple2_langcard_r);
src/mess/machine/tms9901.h
r5932r5933
11/*
2   tms9901.h: header file for tms9901.c
2    tms9901.h: header file for tms9901.c
33
4   Raphael Nabet
4    Raphael Nabet
55*/
66#ifndef __TMS9901_H__
77#define __TMS9901_H__
src/mess/machine/oric.c
r5932r5933
11/*********************************************************************
22
3   machine/oric.c
3    machine/oric.c
44
5   Paul Cook
6   Kev Thacker
5    Paul Cook
6    Kev Thacker
77
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/
1010
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
1616
1717*********************************************************************/
1818
r5932r5933
107107static void oric_keyboard_sense_refresh(running_machine *machine)
108108{
109109   /* The following assumes that if a 0 is written, it can be used to detect if any key
110   has been pressed.. */
110    has been pressed.. */
111111   /* for each bit that is 0, it combines it's pressed state with the pressed state so far */
112112
113113   int i;
r5932r5933
289289      data |= 1;
290290
291291   /* "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 */
295295
296296   input_port_9 = input_port_read(machine, "FLOPPY");
297297   /* cable is enabled? */
r5932r5933
514514{
515515   /* data is ignored, address is used to decode operation */
516516
517/*   logerror("apple 2 interface v2 rom page: %01x\n",(offset & 0x02)>>1); */
517/*  logerror("apple 2 interface v2 rom page: %01x\n",(offset & 0x02)>>1); */
518518
519519   /* bit 0 is 0 for page 0, 1 for page 1 */
520520   memory_set_bankptr(space->machine, 4, memory_region(space->machine, "maincpu") + 0x014000 + 0x0100 + (((offset & 0x02)>>1)<<8));
r5932r5933
583583static void oric_jasmin_set_mem_0x0c000(running_machine *machine)
584584{
585585   /* 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    */
590590
591591   /* the ram is disabled in the jasmin rom which indicates that jasmin takes
592   priority over the ram */
592    priority over the ram */
593593
594594   /* basic rom disabled? */
595595   if ((port_3fb_w & 0x01)==0)
r5932r5933
946946         break;
947947      case 0x04:
948948         data = port_314_r | 0x07f;
949/*         logerror("port_314_r: %02x\n",data); */
949/*          logerror("port_314_r: %02x\n",data); */
950950         break;
951951      case 0x08:
952952         data = port_318_r | 0x07f;
953/*         logerror("port_318_r: %02x\n",data); */
953/*          logerror("port_318_r: %02x\n",data); */
954954         break;
955955
956956      default:
src/mess/machine/europc.c
r5932r5933
2323   fec08 // test of special europc registers 800a rtc time or date error, rtc corrected
2424    fef66 0xf
2525    fdb3e 0x8..0xc
26   fd7f8
26    fd7f8
2727     fdb5f
2828  fe172
2929   fecc5 // 801a video setup error
r5932r5933
3434   (801a)
3535   0x8000 output
3636        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
4545
4646  fe1e2 fdc0c cpu speed is 4.77 MHz
4747  fe1e5 ff9c0 keyboard processor error
r5932r5933
9090  63 bit 6,7 clock select
9191  254 bit 6,7 clock select
9292  250 bit 0: mouse on
93     bit 1: joystick on
93      bit 1: joystick on
9494  254..257 r/w memory ? JIM asic? ram behaviour
9595
9696*/
9797WRITE8_HANDLER ( europc_jim_w )
9898{
99   switch (offset)
99   switch (offset)
100100   {
101101   case 2:
102      if (!(data & 0x80))
102      if (!(data & 0x80))
103103      {
104         switch (data)
104         switch (data)
105105         {
106106         case 0x1f:
107107         case 0x0b: europc_jim.mode = AGA_MONO; break;
r5932r5933
112112         default: europc_jim.mode = AGA_OFF; break;
113113         }
114114      }
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;
117117      pc_aga_set_mode(space->machine, europc_jim.mode);
118118      if (data & 0x80) europc_jim.state = 0;
119119      break;
120120   case 4:
121      switch(data & 0xc0)
121      switch(data & 0xc0)
122122      {
123123      case 0x00: cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 1.0 / 2); break;
124124      case 0x40: cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 3.0 / 4); break;
r5932r5933
136136READ8_HANDLER ( europc_jim_r )
137137{
138138   int data = 0;
139   switch(offset)
139   switch(offset)
140140   {
141141   case 4: case 5: case 6: case 7: data = europc_jim.data[offset]; break;
142142   case 0: case 1: case 2: case 3: data = 0; break;
r5932r5933
147147
148148READ8_HANDLER ( europc_jim2_r )
149149{
150   switch (europc_jim.state)
150   switch (europc_jim.state)
151151   {
152152   case 0: europc_jim.state++; return 0;
153153   case 1: europc_jim.state++; return 0x80;
154154   case 2:
155155      europc_jim.state = 0;
156      switch (europc_jim.mode)
156      switch (europc_jim.mode)
157157      {
158158      case AGA_COLOR: return 0x87; // for color;
159159      case AGA_MONO: return 0x90; //for mono
160160      case AGA_OFF: return 0x80; // for vram
161//      return 0x97; //for error
161//      return 0x97; //for error
162162      }
163163   }
164164   return 0;
r5932r5933
172172
173173WRITE8_HANDLER( europc_pio_w )
174174{
175   switch (offset)
175   switch (offset)
176176   {
177177   case 1:
178178      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;
181181      pit8253_gate_w(devtag_get_device(space->machine, "pit8253"), 2, BIT(data, 0));
182182      pc_speaker_set_spkrdata(space->machine, BIT(data, 1));
183183      pc_keyb_set_clock(BIT(data, 6));
r5932r5933
191191 READ8_HANDLER( europc_pio_r )
192192{
193193   int data = 0;
194   switch (offset)
194   switch (offset)
195195   {
196196   case 0:
197197      if (!(europc_pio.port61&0x80))
r5932r5933
201201      data = europc_pio.port61;
202202      break;
203203   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))
205205         data |= 0x20;
206206      break;
207207   }
r5932r5933
211211// realtime clock and nvram
212212static struct {
213213   /*
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    */
236236   UINT8 data[0x10];
237237   int reg;
238238   int state;
r5932r5933
259259{
260260   int month, year;
261261   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)
263263   {
264264      europc_rtc.data[0]=0;
265265      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)
267267      {
268268         europc_rtc.data[1]=0;
269269         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)
271271         {
272272            europc_rtc.data[2]=0;
273273            europc_rtc.data[3]=bcd_adjust(europc_rtc.data[3]+1);
274274            month=bcd_2_dec(europc_rtc.data[4]);
275275            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))
277277            {
278278               europc_rtc.data[3]=1;
279279               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)
281281               {
282282                  europc_rtc.data[4]=1;
283283                  europc_rtc.data[5]=bcd_adjust(europc_rtc.data[5]+1)&0xff;
r5932r5933
300300 READ8_HANDLER( europc_rtc_r )
301301{
302302   int data=0;
303   switch (europc_rtc.state)
303   switch (europc_rtc.state)
304304   {
305305   case 1:
306306      data=(europc_rtc.data[europc_rtc.reg]&0xf0)>>4;
r5932r5933
309309   case 2:
310310      data=europc_rtc.data[europc_rtc.reg]&0xf;
311311      europc_rtc.state=0;
312//      logerror("rtc read %x %.2x\n",europc_rtc.reg, europc_rtc.data[europc_rtc.reg]);
312//      logerror("rtc read %x %.2x\n",europc_rtc.reg, europc_rtc.data[europc_rtc.reg]);
313313      break;
314314   }
315315   return data;
r5932r5933
317317
318318WRITE8_HANDLER( europc_rtc_w )
319319{
320   switch (europc_rtc.state)
320   switch (europc_rtc.state)
321321   {
322322   case 0:
323323      europc_rtc.reg=data;
r5932r5933
330330   case 2:
331331      europc_rtc.data[europc_rtc.reg]=(europc_rtc.data[europc_rtc.reg]&~0xf)|(data&0xf);
332332      europc_rtc.state=0;
333//      logerror("rtc written %x %.2x\n",europc_rtc.reg, europc_rtc.data[europc_rtc.reg]);
333//      logerror("rtc written %x %.2x\n",europc_rtc.reg, europc_rtc.data[europc_rtc.reg]);
334334      break;
335335   }
336336}
src/mess/machine/990_dk.c
r5932r5933
11/*
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).
55
6   This floppy disk controller supports IBM-format 8" SSSD and DSSD floppies.
6    This floppy disk controller supports IBM-format 8" SSSD and DSSD floppies.
77
8   Raphael Nabet 2003
8    Raphael Nabet 2003
99*/
1010
1111#include "driver.h"
r5932r5933
125125}
126126
127127/*
128   Read the first id field that can be found on the floppy disk.
128    Read the first id field that can be found on the floppy disk.
129129
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
134134
135   Return TRUE if an ID was found
135    Return TRUE if an ID was found
136136*/
137137static int fd800_read_id(int unit, int head, int *cylinder_id, int *sector_id)
138138{
r5932r5933
141141
142142   /*revolution_count = 0;
143143
144   while (revolution_count < 2)
145   {*/
144    while (revolution_count < 2)
145    {*/
146146      if (floppy_drive_get_next_id(fd800.drv[unit].img, head, &id))
147147      {
148148         if (cylinder_id)
r5932r5933
157157}
158158
159159/*
160   Find a sector by id.
160    Find a sector by id.
161161
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
166166
167   Return TRUE if the given sector ID was found
167    Return TRUE if the given sector ID was found
168168*/
169169static int fd800_find_sector(int unit, int head, int sector, int *data_id)
170170{
r5932r5933
192192}
193193
194194/*
195   Perform seek command
195    Perform seek command
196196
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
200200
201   Return FALSE if the seek was successful
201    Return FALSE if the seek was successful
202202*/
203203static int fd800_do_seek(int unit, int cylinder, int head)
204204{
r5932r5933
256256}
257257
258258/*
259   Perform restore command
259    Perform restore command
260260
261   unit: floppy drive index
261    unit: floppy drive index
262262
263   Return FALSE if the restore was successful
263    Return FALSE if the restore was successful
264264*/
265265static int fd800_do_restore(int unit)
266266{
r5932r5933
295295}
296296
297297/*
298   Perform a read operation for one sector
298    Perform a read operation for one sector
299299*/
300300static void fd800_do_read(void)
301301{
r5932r5933
323323}
324324
325325/*
326   Perform a write operation for one sector
326    Perform a write operation for one sector
327327*/
328328static void fd800_do_write(void)
329329{
r5932r5933
348348}
349349
350350/*
351   Execute a fdc command
351    Execute a fdc command
352352*/
353353static void fd800_do_cmd(void)
354354{
r5932r5933
380380   switch (fd800.cmd_reg >> 12)
381381   {
382382   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) */
385385      unit = (fd800.cmd_reg >> 10) & 3;
386386
387387      /* reset status */
r5932r5933
399399      break;
400400
401401   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) */
406406      unit = (fd800.cmd_reg >> 10) & 3;
407407      head = (fd800.cmd_reg >> 9) & 1;
408408      cylinder = fd800.cmd_reg & 0x7f;
r5932r5933
418418      break;
419419
420420   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) */
423423      unit = (fd800.cmd_reg >> 10) & 3;
424424
425425      /* reset status */
r5932r5933
433433      break;
434434
435435   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) */
439439      unit = (fd800.cmd_reg >> 10) & 3;
440440      seclen = fd800.cmd_reg & 0x7f;
441441
r5932r5933
457457      break;
458458
459459   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) */
465465      unit = (fd800.cmd_reg >> 10) & 3;
466466      head = (fd800.cmd_reg >> 9) & 1;
467467      /*non_seq_mode = (fd800.cmd_reg >> 8) & 1;*/
r5932r5933
482482      break;
483483
484484   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) */
488488      unit = (fd800.cmd_reg >> 10) & 3;
489489      head = (fd800.cmd_reg >> 9) & 1;
490490
r5932r5933
506506      break;
507507
508508   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) */
513513      /* ... */
514514      break;
515515
516516   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) */
521521      unit = (fd800.cmd_reg >> 10) & 3;
522522      head = (fd800.cmd_reg >> 9) & 1;
523523      sector = fd800.cmd_reg & 0x1f;
r5932r5933
547547      break;
548548
549549   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) */
554554      unit = (fd800.cmd_reg >> 10) & 3;
555555      head = (fd800.cmd_reg >> 9) & 1;
556556      sector = fd800.cmd_reg & 0x1f;
r5932r5933
580580      break;
581581
582582   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) */
587587      /* ... */
588588      break;
589589
590590   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 */
593593      fd800.interrupt_f_f = fd800.cmd_reg & 1;
594594      fd800_field_interrupt();
595595      break;
596596
597597   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) */
600600      unit = (fd800.cmd_reg >> 10) & 3;
601601
602602      /* reset status */
r5932r5933
609609      break;
610610
611611   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) */
615615      unit = (fd800.cmd_reg >> 10) & 3;
616616      cylinder = fd800.cmd_reg & 0x7f;
617617
r5932r5933
630630      break;
631631
632632   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) */
635635      switch ((fd800.cmd_reg >> 8) & 15)
636636      {
637637      case 0:   /* reset
638               bits 16-23: 0s */
638                    bits 16-23: 0s */
639639         /* ... */
640640         break;
641641      case 1:   /* retry inhibit
642               bits 16-23: 0s */
642                    bits 16-23: 0s */
643643         /* ... */
644644         break;
645645      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 */
652652         /* ... */
653653         break;
654654      case 3:   /* program error (a.k.a. invalid command)
655               bits 16-23: 0s */
655                    bits 16-23: 0s */
656656         /* ... */
657657         break;
658658      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 */
661661         /* ... */
662662         break;
663663      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) */
666666         /* ... */
667667         break;
668668      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) */
671671         /* ... */
672672         break;
673673      case 7:   /* power up simulation
674               bits 16-23: 0s */
674                    bits 16-23: 0s */
675675         /* ... */
676676         break;
677677      }
r5932r5933
679679      break;
680680
681681   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) */
687687      unit = (fd800.cmd_reg >> 10) & 3;
688688      head = (fd800.cmd_reg >> 9) & 1;
689689      /*non_seq_mode = (fd800.cmd_reg >> 8) & 1;*/
r5932r5933
704704      break;
705705
706706   case 15:   /* Clear Status port
707               bits 16-27: 0s */
707                    bits 16-27: 0s */
708708      fd800.stat_reg = 0;
709709      fd800_field_interrupt();
710710      break;
r5932r5933
712712}
713713
714714/*
715   read one CRU bit
715    read one CRU bit
716716
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)
735735*/
736736 READ8_HANDLER(fd800_cru_r)
737737{
r5932r5933
756756}
757757
758758/*
759   write one CRU bit
759    write one CRU bit
760760
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
769769*/
770770WRITE8_HANDLER(fd800_cru_w)
771771{
src/mess/machine/orao.c
r5932r5933
11/***************************************************************************
22
3      Orao machine driver by Miodrag Milanovic
3        Orao machine driver by Miodrag Milanovic
44
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
88****************************************************************************/
99
1010#include "driver.h"
r5932r5933
2424{
2525   memset(orao_memory,0xff,0x6000);
2626}
27
27
2828MACHINE_RESET( orao )
29{   
29{
3030}
3131
3232READ8_HANDLER( orao_io_r )
3333{
3434   double level;
35   
35
3636    switch(offset) {
3737       /* Keyboard*/
3838       case 0x07FC : return input_port_read(space->machine, "LINE0");
r5932r5933
5555       case 0x05FF : return input_port_read(space->machine, "LINE17");
5656       case 0x03FE : return input_port_read(space->machine, "LINE18");
5757       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;
6363               }
64               return 0xff;                                               
64               return 0xff;
6565    }
66   
67   
68    return 0xff;   
66
67
68    return 0xff;
6969}
7070
7171
7272WRITE8_HANDLER( orao_io_w )
73{   
73{
7474   if (offset == 0x0800)
7575   {
7676      const device_config *dac_device = devtag_get_device(space->machine, "dac");
src/mess/machine/z80sti.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
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
1717
1818*/
1919
r5932r5933
118118/* interrupt vectors */
119119static const UINT8 INT_VECTOR[] =
120120{
121   0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
121   0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
122122   0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e
123123};
124124
r5932r5933
208208
209209/*-------------------------------------------------
210210    check_interrupts - set the interrupt request
211   line state
211    line state
212212-------------------------------------------------*/
213213
214214static void check_interrupts(z80sti_t *z80sti)
r5932r5933
423423      int i;
424424      LOG(("Z80STI '%s' Interrupt Pending Register B: %x\n", device->tag, data));
425425      z80sti->ipr &= (z80sti->ipr & 0xff00) | data;
426     
426
427427      for (i = 0; i < 16; i++)
428428      {
429429         if (!BIT(z80sti->ipr, i) && (z80sti->int_state[i] == Z80_DAISY_INT)) z80sti->int_state[i] = 0;
r5932r5933
438438      int i;
439439      LOG(("Z80STI '%s' Interrupt Pending Register A: %x\n", device->tag, data));
440440      z80sti->ipr &= (data << 8) | (z80sti->ipr & 0xff);
441     
441
442442      for (i = 0; i < 16; i++)
443443      {
444444         if (!BIT(z80sti->ipr, i) && (z80sti->int_state[i] == Z80_DAISY_INT)) z80sti->int_state[i] = 0;
r5932r5933
510510      z80sti->tdr[TIMER_A] = data;
511511      break;
512512/*
513   case Z80STI_REGISTER_UCR:
514      z80sti->ucr = data;
515      break;
513    case Z80STI_REGISTER_UCR:
514        z80sti->ucr = data;
515        break;
516516
517   case Z80STI_REGISTER_RSR:
518      z80sti->rsr = data;
519      break;
517    case Z80STI_REGISTER_RSR:
518        z80sti->rsr = data;
519        break;
520520
521   case Z80STI_REGISTER_TSR:
522      z80sti->tsr = data;
523      break;
521    case Z80STI_REGISTER_TSR:
522        z80sti->tsr = data;
523        break;
524524
525   case Z80STI_REGISTER_UDR:
526      z80sti->udr = data;
527      break;
525    case Z80STI_REGISTER_UDR:
526        z80sti->udr = data;
527        break;
528528*/
529529   default:
530530      LOG(("Z80STI '%s' Unsupported Register %x\n", device->tag, offset & 0x0f));
r5932r5933
674674   }
675675
676676   LOG(("Z80STI '%s' Interrupt State: %u\n", device->tag, state));
677   
677
678678   return state;
679679}
680680
r5932r5933
703703
704704         /* set interrupt in-service register bit */
705705         z80sti->isr |= (1 << i);
706         
706
707707         check_interrupts(z80sti);
708708
709709         LOG(("Z80STI '%s' Interrupt Acknowledge Vector: %02x\n", device->tag, vector));
r5932r5933
713713   }
714714
715715   logerror("z80sti_irq_ack: failed to find an interrupt to ack!\n");
716   
716
717717   return 0;
718718}
719719
src/mess/machine/mekd2.c
r5932r5933
11/******************************************************************************
2   Motorola Evaluation Kit 6800 D2
3   MEK6800D2
2    Motorola Evaluation Kit 6800 D2
3    MEK6800D2
44
5   machine Driver
5    machine Driver
66
7   Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
7    Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
88
99******************************************************************************/
1010#include "driver.h"
src/mess/machine/990_dk.h
r5932r5933
11/*
2   990_dk.h: include file for 990_dk.c
2    990_dk.h: include file for 990_dk.c
33*/
44
55FLOPPY_OPTIONS_EXTERN(fd800);
src/mess/machine/at.c
r5932r5933
11/***************************************************************************
22
3   IBM AT Compatibles
3    IBM AT Compatibles
44
55***************************************************************************/
66
r5932r5933
225225
226226   if (LOG_PORT80 && (offset == 0))
227227   {
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,
229229                     (unsigned) cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPC));
230230   }
231231
r5932r5933
406406{
407407   pic8259_set_irq_line(at_devices.pic8259_master, 6, state);
408408//if ( mess_ram[0x0490] == 0x74 )
409//   mess_ram[0x0490] = 0x54;
409//  mess_ram[0x0490] = 0x54;
410410}
411411
412412
r5932r5933
497497   logerror("%04x: writing $%02x to P2\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), data );
498498
499499   at_set_gate_a20( space->machine, ( data & 0x02 ) ? 1 : 0 );
500   
500
501501   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
502502
503503   /* OPT BUF FULL is connected to IR1 on the master 8259 */
src/mess/machine/z80sti.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3030
3131**********************************************************************/
3232
r5932r5933
6666
6767   /* this gets called for each read of the SI pin (pin 38) */
6868   devcb_read_line         in_si_func;
69   
69
7070   /* this gets called for each change of the SO pin (pin 37) */
7171   devcb_write_line      out_so_func;
7272
7373   /* this gets called for each change of the TAO pin (pin 1) */
7474   devcb_write_line      out_tao_func;
75   
75
7676   /* this gets called for each change of the TBO pin (pin 2) */
7777   devcb_write_line      out_tbo_func;
78   
78
7979   /* this gets called for each change of the TCO pin (pin 3) */
8080   devcb_write_line      out_tco_func;
81   
81
8282   /* this gets called for each change of the TDO pin (pin 4) */
8383   devcb_write_line      out_tdo_func;
8484
src/mess/machine/vector06.c
r5932r5933
3939}
4040
4141static READ8_DEVICE_HANDLER (vector06_8255_portc_r )
42{   
42{
4343   double level = cassette_input(devtag_get_device(device->machine, "cassette"));
4444   UINT8 retVal = input_port_read(device->machine, "LINE8");
45   if (level >  0) {
46      retVal |= 0x10;
45   if (level >  0) {
46      retVal |= 0x10;
4747    }
4848   return retVal;
4949}
r5932r5933
5555
5656static void vector_set_video_mode(running_machine *machine, int width) {
5757   rectangle visarea;
58   
58
5959   visarea.min_x = 0;
6060   visarea.min_y = 0;
6161   visarea.max_x = width+64-1;
6262   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);
6464}
6565
6666static WRITE8_DEVICE_HANDLER (vector06_8255_portb_w )
6767{
6868   vector_color_index = data & 0x0f;
69   if ((data & 0x10) != vector_video_mode)
69   if ((data & 0x10) != vector_video_mode)
7070   {
7171      vector_video_mode = data & 0x10;
7272      vector_set_video_mode(device->machine,(vector_video_mode==0x10) ? 512 : 256);
73   }   
73   }
7474}
7575
7676WRITE8_HANDLER(vector06_color_set)
r5932r5933
8686
8787static READ8_DEVICE_HANDLER (vector06_romdisk_portb_r )
8888{
89   UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x18000;     
89   UINT8 *romdisk = memory_region(device->machine, "maincpu") + 0x18000;
9090   UINT16 addr = (romdisk_msb*256+romdisk_lsb) & 0x7fff;
91   return romdisk[addr];   
91   return romdisk[addr];
9292}
9393
9494static WRITE8_DEVICE_HANDLER (vector06_romdisk_porta_w )
95{   
95{
9696   romdisk_lsb = data;
9797}
9898
9999static WRITE8_DEVICE_HANDLER (vector06_romdisk_portc_w )
100{     
101   romdisk_msb = data;   
100{
101   romdisk_msb = data;
102102}
103103
104104I8255A_INTERFACE( vector06_ppi8255_2_interface )
r5932r5933
145145{
146146   vblank_state++;
147147   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
150150}
151151
152152static IRQ_CALLBACK (  vector06_irq_callback )
r5932r5933
172172{
173173   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
174174   wd17xx_set_side (fdc,((data & 4) >> 2) ^ 1);
175    wd17xx_set_drive(fdc,data & 1);               
175    wd17xx_set_drive(fdc,data & 1);
176176}
177177
178178MACHINE_START( vector06 )
r5932r5933
184184MACHINE_RESET( vector06 )
185185{
186186   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
187   
187
188188   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), vector06_irq_callback);
189189   memory_install_read8_handler (space, 0x0000, 0x7fff, 0, 0, SMH_BANK(1));
190190   memory_install_write8_handler(space, 0x0000, 0x7fff, 0, 0, SMH_BANK(2));
src/mess/machine/99_usbsm.c
r5932r5933
11/*
2   Thierry Nouspikel's USB-SmartMedia card emulation
2    Thierry Nouspikel's USB-SmartMedia card emulation
33
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.
99
10   The specs have been published in <http://www.nouspikel.com/ti99/usb.html>.
10    The specs have been published in <http://www.nouspikel.com/ti99/usb.html>.
1111
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.
1818
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
2323
24   Raphael Nabet, 2004.
24    Raphael Nabet, 2004.
2525*/
2626
2727#include "driver.h"
r5932r5933
7070static int tms9995_mode;
7171
7272/*
73   Initilaizes USB-SmartMedia card, set up handlers
73    Initilaizes USB-SmartMedia card, set up handlers
7474*/
7575void ti99_usbsm_init(running_machine *machine)
7676{
r5932r5933
7878}
7979
8080/*
81   Reset USB-SmartMedia card, set up handlers
81    Reset USB-SmartMedia card, set up handlers
8282*/
8383int ti99_usbsm_reset(running_machine *machine, int in_tms9995_mode)
8484{
r5932r5933
9797}
9898
9999/*
100   Read USB-SmartMedia CRU interface
100    Read USB-SmartMedia CRU interface
101101*/
102102static int usbsm_cru_r(running_machine *machine, int offset)
103103{
r5932r5933
109109   {
110110   case 0:
111111      /*
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         */
126126      reply = 0x33;
127127      if (! smartmedia_present(smartmedia))
128128         reply |= 0xc0;
r5932r5933
135135}
136136
137137/*
138   Write USB-SmartMedia CRU interface
138    Write USB-SmartMedia CRU interface
139139*/
140140static void usbsm_cru_w(running_machine *machine, int offset, int data)
141141{
r5932r5933
190190}
191191
192192/*
193   read a byte in USB-SmartMedia DSR space
193    read a byte in USB-SmartMedia DSR space
194194*/
195195static READ8_HANDLER(usbsm_mem_r)
196196{
r5932r5933
204204}
205205
206206/*
207   write a byte in USB-SmartMedia DSR space
207    write a byte in USB-SmartMedia DSR space
208208*/
209209static WRITE8_HANDLER(usbsm_mem_w)
210210{
r5932r5933
221221}
222222
223223/*
224   demultiplexed read in USB-SmartMedia DSR space
224    demultiplexed read in USB-SmartMedia DSR space
225225*/
226226static UINT16 usbsm_mem_16_r(const address_space* space,offs_t offset)
227227{
r5932r5933
255255}
256256
257257/*
258   demultiplexed write in USB-SmartMedia DSR space
258    demultiplexed write in USB-SmartMedia DSR space
259259*/
260260static void usbsm_mem_16_w(const address_space* space,offs_t offset, UINT16 data)
261261{
src/mess/machine/galeb.c
r5932r5933
11/***************************************************************************
22
3      Galeb machine driver by Miodrag Milanovic
3        Galeb machine driver by Miodrag Milanovic
44
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
88****************************************************************************/
99
1010
1111#include "driver.h"
1212#include "sound/dac.h"
1313#include "includes/galeb.h"
14
14
1515/* Driver initialization */
1616DRIVER_INIT(galeb)
1717{
src/mess/machine/electron.c
r5932r5933
11/******************************************************************************
2   Acorn Electron driver
2    Acorn Electron driver
33
4   MESS Driver By:
4    MESS Driver By:
55
6   Wilbert Pol
6    Wilbert Pol
77
88******************************************************************************/
99
r5932r5933
1515ULA electron_ula;
1616static emu_timer *electron_tape_timer;
1717
18static const device_config *cassette_device_image( running_machine *machine )
18static const device_config *cassette_device_image( running_machine *machine )
1919{
2020   return devtag_get_device(machine, "cassette");
2121}
2222
23static void electron_tape_start( void )
23static void electron_tape_start( void )
2424{
25   if ( electron_ula.tape_running )
25   if ( electron_ula.tape_running )
2626   {
2727      return;
2828   }
r5932r5933
3434   timer_adjust_periodic(electron_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(4800));
3535}
3636
37static void electron_tape_stop( void )
37static void electron_tape_stop( void )
3838{
3939   electron_ula.tape_running = 0;
4040   timer_reset( electron_tape_timer, attotime_never );
r5932r5933
4545
4646static TIMER_CALLBACK(electron_tape_timer_handler)
4747{
48   if ( electron_ula.cassette_motor_mode )
48   if ( electron_ula.cassette_motor_mode )
4949   {
5050      double tap_val;
5151      tap_val = cassette_input( cassette_device_image( machine ) );
52      if ( tap_val < -0.5 )
52      if ( tap_val < -0.5 )
5353      {
5454         electron_ula.tape_value = ( electron_ula.tape_value << 8 ) | TAPE_LOW;
5555         electron_ula.tape_steps++;
56      }
57      else if ( tap_val > 0.5 )
56      }
57      else if ( tap_val > 0.5 )
5858      {
5959         electron_ula.tape_value = ( electron_ula.tape_value << 8 ) | TAPE_HIGH;
6060         electron_ula.tape_steps++;
61      }
62      else
61      }
62      else
6363      {
6464         electron_ula.tape_steps = 0;
6565         electron_ula.bit_count = 0;
6666         electron_ula.high_tone_set = 0;
6767         electron_ula.tape_value = 0x80808080;
6868      }
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 ) )
7070      {
7171         electron_ula.tape_steps = 0;
72         switch( electron_ula.bit_count )
72         switch( electron_ula.bit_count )
7373         {
7474         case 0:   /* start bit */
7575            electron_ula.start_bit = ( ( electron_ula.tape_value == 0x0000FFFF ) ? 0 : 1 );
7676            //logerror( "++ Read start bit: %d\n", electron_ula.start_bit );
77            if ( electron_ula.start_bit )
77            if ( electron_ula.start_bit )
7878            {
79               if ( electron_ula.high_tone_set )
79               if ( electron_ula.high_tone_set )
8080               {
8181                  electron_ula.bit_count--;
8282               }
83            }
84            else
83            }
84            else
8585            {
8686               electron_ula.high_tone_set = 0;
8787            }
r5932r5933
9494         case 9: /* stop bit */
9595            electron_ula.stop_bit = ( ( electron_ula.tape_value == 0x0000FFFF ) ? 0 : 1 );
9696            //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 )
9898            {
9999               electron_interrupt_handler( machine, INT_SET, INT_HIGH_TONE );
100100               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 )
103103            {
104104               //logerror( "-- Byte read from tape: %02x\n", electron_ula.tape_byte );
105105               electron_interrupt_handler( machine, INT_SET, INT_RECEIVE_FULL );
106            }
107            else
106            }
107            else
108108            {
109109               logerror( "Invalid start/stop bit combination detected: %d,%d\n", electron_ula.start_bit, electron_ula.stop_bit );
110110            }
r5932r5933
115115   }
116116}
117117
118static READ8_HANDLER( electron_read_keyboard )
118static READ8_HANDLER( electron_read_keyboard )
119119{
120120   UINT8 data = 0;
121121   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",
123123                              "LINE7", "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13" };
124   
124
125125   //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++ )
127127   {
128      if( !(offset & 1) )
128      if( !(offset & 1) )
129129         data |= input_port_read(space->machine, keynames[i]) & 0x0f;
130130
131131      offset = offset >> 1;
r5932r5933
134134   return data;
135135}
136136
137READ8_HANDLER( electron_jim_r )
137READ8_HANDLER( electron_jim_r )
138138{
139139   return 0xff;
140140}
141141
142WRITE8_HANDLER( electron_jim_w )
142WRITE8_HANDLER( electron_jim_w )
143143{
144144}
145145
146READ8_HANDLER( electron_1mhz_r )
146READ8_HANDLER( electron_1mhz_r )
147147{
148148   return 0xff;
149149}
150150
151WRITE8_HANDLER( electron_1mhz_w )
151WRITE8_HANDLER( electron_1mhz_w )
152152{
153153}
154154
155READ8_HANDLER( electron_ula_r )
155READ8_HANDLER( electron_ula_r )
156156{
157157   UINT8 data = ((UINT8 *)memory_region(space->machine, "user1"))[0x43E00 + offset];
158   switch ( offset & 0x0f )
158   switch ( offset & 0x0f )
159159   {
160160   case 0x00:   /* Interrupt status */
161161      data = electron_ula.interrupt_status;
r5932r5933
180180   const device_config *speaker = devtag_get_device(space->machine, "beep");
181181   int i = electron_palette_offset[(( offset >> 1 ) & 0x03)];
182182   logerror( "ULA: write offset %02x <- %02x\n", offset & 0x0f, data );
183   switch( offset & 0x0f )
183   switch( offset & 0x0f )
184184   {
185185   case 0x00:   /* Interrupt control */
186186      electron_ula.interrupt_control = data;
r5932r5933
199199      break;
200200   case 0x05:   /* Interrupt clear and paging */
201201      /* 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 ) )
208208      {
209209         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 )
211211         {
212212            electron_ula.rompage = 8;
213213            memory_install_read8_handler( space, 0x8000, 0xbfff, 0, 0, electron_read_keyboard );
214         }
215         else
214         }
215         else
216216         {
217217            memory_install_read8_handler( space, 0x8000, 0xbfff, 0, 0, SMH_BANK(2) );
218218         }
219219         memory_set_bank(space->machine, 2, electron_ula.rompage);
220220      }
221      if ( data & 0x10 )
221      if ( data & 0x10 )
222222      {
223223         electron_interrupt_handler( space->machine, INT_CLEAR, INT_DISPLAY_END );
224224      }
225      if ( data & 0x20 )
225      if ( data & 0x20 )
226226      {
227227         electron_interrupt_handler( space->machine, INT_CLEAR, INT_RTC );
228228      }
229      if ( data & 0x40 )
229      if ( data & 0x40 )
230230      {
231231         electron_interrupt_handler( space->machine, INT_CLEAR, INT_HIGH_TONE );
232232      }
233      if ( data & 0x80 )
233      if ( data & 0x80 )
234234      {
235235      }
236236      break;
237237   case 0x06:   /* Counter divider */
238      if ( electron_ula.communication_mode == 0x01)
238      if ( electron_ula.communication_mode == 0x01)
239239      {
240240         beep_set_frequency( speaker, 1000000 / ( 16 * ( data + 1 ) ) );
241241      }
242242      break;
243243   case 0x07:   /* Misc. */
244244      electron_ula.communication_mode = ( data >> 1 ) & 0x03;
245      switch( electron_ula.communication_mode )
245      switch( electron_ula.communication_mode )
246246      {
247247      case 0x00:   /* cassette input */
248248         beep_set_state( speaker, 0 );
r5932r5933
287287   }
288288}
289289
290void electron_interrupt_handler(running_machine *machine, int mode, int interrupt)
290void electron_interrupt_handler(running_machine *machine, int mode, int interrupt)
291291{
292   if ( mode == INT_SET )
292   if ( mode == INT_SET )
293293   {
294294      electron_ula.interrupt_status |= interrupt;
295   }
296   else
295   }
296   else
297297   {
298298      electron_ula.interrupt_status &= ~interrupt;
299299   }
300   if ( electron_ula.interrupt_status & electron_ula.interrupt_control & ~0x83 )
300   if ( electron_ula.interrupt_status & electron_ula.interrupt_control & ~0x83 )
301301   {
302302      electron_ula.interrupt_status |= 0x01;
303303      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE );
304   }
305   else
304   }
305   else
306306   {
307307      electron_ula.interrupt_status &= ~0x01;
308308      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE );
src/mess/machine/pc_hdc.c
r5932r5933
22
33    machine/pc_hdc.c
44
5   Functions to emulate a WD1004A-WXI hard disk controller
5    Functions to emulate a WD1004A-WXI hard disk controller
66
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
1111
1212    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.
1616
1717
1818
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.
2521
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
2625
27   tandon Fixed Disk Adapter found in an IBM 5150:
28   600963-001__TYPE_5.U12.2764.bin
2926
27    tandon Fixed Disk Adapter found in an IBM 5150:
28    600963-001__TYPE_5.U12.2764.bin
29
3030***************************************************************************/
3131
3232#include "driver.h"
r5932r5933
230230
231231   if ( img == NULL )
232232      return NULL;
233
233
234234   if (!image_exists(img))
235235      return NULL;
236236
r5932r5933
596596
597597
598598/*  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
607607 *
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
617617 */
618618static void pc_hdc_data_w(running_machine *machine, int n, int data)
619619{
r5932r5933
755755
756756
757757/*
758   Dipswitch configuration
758    Dipswitch configuration
759759
760760
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
769769
770770 */
771771
r5932r5933
779779
780780/*************************************************************************
781781 *
782 *      HDC
783 *      hard disk controller
782 *      HDC
783 *      hard disk controller
784784 *
785785 *************************************************************************/
786786
r5932r5933
821821
822822/*************************************
823823 *
824 *      Port handlers
824 *      Port handlers
825825 *
826826 *************************************/
827827
src/mess/machine/orion.c
r5932r5933
11/***************************************************************************
22
3      Orion machine driver by Miodrag Milanovic
3        Orion machine driver by Miodrag Milanovic
44
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
88****************************************************************************/
99
1010
r5932r5933
3636
3737static READ8_DEVICE_HANDLER (orion_romdisk_porta_r )
3838{
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];
4141}
4242
4343static WRITE8_DEVICE_HANDLER (orion_romdisk_portb_w )
44{   
44{
4545   romdisk_lsb = data;
4646}
4747
4848static WRITE8_DEVICE_HANDLER (orion_romdisk_portc_w )
49{     
50   romdisk_msb = data;   
49{
50   romdisk_msb = data;
5151}
5252
5353I8255A_INTERFACE( orion128_ppi8255_interface_1)
r5932r5933
7171{
7272   const device_config *fdc = devtag_get_device(machine, "wd1793");
7373
74   wd17xx_set_density (fdc,DEN_FM_HI);   
74   wd17xx_set_density (fdc,DEN_FM_HI);
7575   orion_video_mode_mask = 7;
7676}
7777
78READ8_HANDLER ( orion128_system_r )
78READ8_HANDLER ( orion128_system_r )
7979{
8080   return i8255a_r(devtag_get_device(space->machine, "ppi8255_2"), offset & 3);
8181}
8282
83WRITE8_HANDLER ( orion128_system_w )
83WRITE8_HANDLER ( orion128_system_w )
8484{
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);
8686}
8787
88READ8_HANDLER ( orion128_romdisk_r )
88READ8_HANDLER ( orion128_romdisk_r )
8989{
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);
9191}
9292
93WRITE8_HANDLER ( orion128_romdisk_w )
94{   
95   i8255a_w(devtag_get_device(space->machine, "ppi8255_1"), offset & 3, data);   
93WRITE8_HANDLER ( orion128_romdisk_w )
94{
95   i8255a_w(devtag_get_device(space->machine, "ppi8255_1"), offset & 3, data);
9696}
9797
98static void orion_set_video_mode(running_machine *machine, int width)
98static void orion_set_video_mode(running_machine *machine, int width)
9999{
100100      rectangle visarea;
101     
101
102102      visarea.min_x = 0;
103103      visarea.min_y = 0;
104104      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);
107107}
108108
109109WRITE8_HANDLER ( orion128_video_mode_w )
110{           
111   if ((data & 0x80)!=(orion128_video_mode & 0x80))
110{
111   if ((data & 0x80)!=(orion128_video_mode & 0x80))
112112   {
113      if ((data & 0x80)==0x80)
113      if ((data & 0x80)==0x80)
114114      {
115         if (orion_video_mode_mask == 31)
115         if (orion_video_mode_mask == 31)
116116         {
117117            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
121121         {
122122            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
127127      {
128128         orion128_video_width = SCREEN_WIDTH_384;
129129         orion_set_video_mode(space->machine,384);
130130      }
131   }           
132   
131   }
132
133133   orion128_video_mode = data;
134134}
135135
136136WRITE8_HANDLER ( orion128_video_page_w )
137{   
138   if (orion128_video_page != data)
137{
138   if (orion128_video_page != data)
139139   {
140      if ((data & 0x80)!=(orion128_video_page & 0x80))
140      if ((data & 0x80)!=(orion128_video_page & 0x80))
141141      {
142         if ((data & 0x80)==0x80)
142         if ((data & 0x80)==0x80)
143143         {
144            if (orion_video_mode_mask == 31)
144            if (orion_video_mode_mask == 31)
145145            {
146146               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
150150            {
151151               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
156156         {
157157            orion128_video_width = SCREEN_WIDTH_384;
158158            orion_set_video_mode(space->machine,384);
159159         }
160      }           
160      }
161161   }
162162   orion128_video_page = data;
163163}
164164
165165
166166WRITE8_HANDLER ( orion128_memory_page_w )
167{           
168   if (data!=orion128_memory_page )
167{
168   if (data!=orion128_memory_page )
169169   {
170170      memory_set_bankptr(space->machine, 1, mess_ram + (data & 3) * 0x10000);
171171      orion128_memory_page = (data & 3);
172172   }
173173}
174174
175MACHINE_RESET ( orion128 )
176{     
175MACHINE_RESET ( orion128 )
176{
177177   orion128_video_page = 0;
178178   orion128_video_mode = 0;
179179   orion128_memory_page = -1;
r5932r5933
189189   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
190190
191191   wd17xx_set_side(fdc,((data & 0x10) >> 4) ^ 1);
192    wd17xx_set_drive(fdc,data & 3);           
192    wd17xx_set_drive(fdc,data & 3);
193193}
194194
195195READ8_HANDLER ( orion128_floppy_r )
196{   
196{
197197   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
198198
199   switch(offset)
199   switch(offset)
200200   {
201201      case 0x0   :
202202      case 0x10 : return wd17xx_status_r(fdc,0);
r5932r5933
206206      case 0x12 : return wd17xx_sector_r(fdc,0);
207207      case 0x3  :
208208      case 0x13 : return wd17xx_data_r(fdc,0);
209   }   
209   }
210210   return 0xff;
211211}
212212
213213WRITE8_HANDLER ( orion128_floppy_w )
214{     
214{
215215   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
216   
217   switch(offset)
216
217   switch(offset)
218218   {
219219      case 0x0   :
220220      case 0x10 : wd17xx_command_w(fdc,0,data); break;
r5932r5933
224224      case 0x12 : wd17xx_sector_w(fdc,0,data);break;
225225      case 0x3  :
226226      case 0x13 : wd17xx_data_w(fdc,0,data);break;
227      case 0x4  :
228      case 0x14 :
227      case 0x4  :
228      case 0x14 :
229229      case 0x20 : orion_disk_control_w(space, offset, data);break;
230230   }
231231}
232232static READ8_HANDLER ( orionz80_floppy_rtc_r )
233{   
234   if ((offset >= 0x60) && (offset <= 0x6f))
233{
234   if ((offset >= 0x60) && (offset <= 0x6f))
235235   {
236236      return mc146818_port_r(space,offset-0x60);
237   }
238   else
239   {
237   }
238   else
239   {
240240      return orion128_floppy_r(space,offset);
241   }   
241   }
242242}
243243
244244static WRITE8_HANDLER ( orionz80_floppy_rtc_w )
245{     
246   if ((offset >= 0x60) && (offset <= 0x6f))
245{
246   if ((offset >= 0x60) && (offset <= 0x6f))
247247   {
248248      mc146818_port_w(space,offset-0x60,data);
249   }
250   else
249   }
250   else
251251   {
252252      orion128_floppy_w(space,offset,data);
253   }   
253   }
254254}
255255
256256
257257DRIVER_INIT( orionz80 )
258258{
259   memset(mess_ram,0,512*1024);   
259   memset(mess_ram,0,512*1024);
260260}
261261
262262
r5932r5933
271271
272272static UINT8 orion_speaker;
273273WRITE8_HANDLER ( orionz80_sound_w )
274{   
274{
275275   const device_config *speaker = devtag_get_device(space->machine, "speaker");
276   if (orion_speaker == 0)
276   if (orion_speaker == 0)
277277   {
278      orion_speaker = data;     
279   }
280   else
278      orion_speaker = data;
279   }
280   else
281281   {
282      orion_speaker = 0 ;   
282      orion_speaker = 0 ;
283283   }
284284   speaker_level_w(speaker,orion_speaker);
285     
285
286286}
287287
288288static WRITE8_HANDLER ( orionz80_sound_fe_w )
289{   
289{
290290   const device_config *speaker = devtag_get_device(space->machine, "speaker");
291291   speaker_level_w(speaker,(data>>4) & 0x01);
292292}
r5932r5933
297297   UINT8 bank_select;
298298   UINT8 segment_select;
299299   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
300   
300
301301   bank_select = (orionz80_dispatcher & 0x0c) >> 2;
302302   segment_select = orionz80_dispatcher & 0x03;
303   
303
304304   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
305   if ((orionz80_dispatcher & 0x80)==0)
305   if ((orionz80_dispatcher & 0x80)==0)
306306   { // 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
310310   { // 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);
312312   }
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)
317317   {
318318      memory_install_write8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_w);
319319      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);
321321      memory_install_read8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_r);
322322      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
325325      memory_install_write8_handler(space, 0xf800, 0xf8ff, 0, 0, orion128_video_mode_w);
326326      memory_install_write8_handler(space, 0xf900, 0xf9ff, 0, 0, orionz80_memory_page_w);
327327      memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, orion128_video_page_w);
328328      memory_install_write8_handler(space, 0xfb00, 0xfbff, 0, 0, orionz80_dispatcher_w);
329329      memory_install_write8_handler(space, 0xfc00, 0xfeff, 0, 0, SMH_UNMAP);
330330      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
337337   {
338338      /* 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   }
343343}
344344
345345WRITE8_HANDLER ( orionz80_memory_page_w )
346{   
346{
347347   orionz80_memory_page = data & 7;
348348   orionz80_switch_bank(space->machine);
349349}
350350
351351WRITE8_HANDLER ( orionz80_dispatcher_w )
352{   
352{
353353   orionz80_dispatcher = data;
354354   orionz80_switch_bank(space->machine);
355355}
356356
357MACHINE_RESET ( orionz80 )
358{   
357MACHINE_RESET ( orionz80 )
358{
359359   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
360   
360
361361   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
362362   memory_install_write8_handler(space, 0x4000, 0xefff, 0, 0, SMH_BANK(2));
363363   memory_install_write8_handler(space, 0xf000, 0xf3ff, 0, 0, SMH_BANK(3));
364364
365365   memory_install_write8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_w);
366366   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);
368368   memory_install_read8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_r);
369369   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
372372   memory_install_write8_handler(space, 0xf800, 0xf8ff, 0, 0, orion128_video_mode_w);
373373   memory_install_write8_handler(space, 0xf900, 0xf9ff, 0, 0, orionz80_memory_page_w);
374374   memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, orion128_video_page_w);
375375   memory_install_write8_handler(space, 0xfb00, 0xfbff, 0, 0, orionz80_dispatcher_w);
376376   memory_install_write8_handler(space, 0xfc00, 0xfeff, 0, 0, SMH_UNMAP);
377377   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   
385378
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
386386   orion128_video_page = 0;
387387   orion128_video_mode = 0;
388388   orionz80_memory_page = 0;
r5932r5933
393393   radio86_init_keyboard();
394394}
395395
396INTERRUPT_GEN( orionz80_interrupt )
396INTERRUPT_GEN( orionz80_interrupt )
397397{
398   if ((orionz80_dispatcher & 0x40)==0x40)
398   if ((orionz80_dispatcher & 0x40)==0x40)
399399   {
400      cpu_set_input_line(device, 0, HOLD_LINE);         
401   }   
400      cpu_set_input_line(device, 0, HOLD_LINE);
401   }
402402}
403403
404READ8_HANDLER ( orionz80_io_r )
404READ8_HANDLER ( orionz80_io_r )
405405{
406   if (offset == 0xFFFD)
406   if (offset == 0xFFFD)
407407   {
408408      return ay8910_r (devtag_get_device(space->machine, "ay8912"), 0);
409409   }
410410   return 0xff;
411411}
412412
413WRITE8_HANDLER ( orionz80_io_w )
413WRITE8_HANDLER ( orionz80_io_w )
414414{
415   switch (offset & 0xff)
415   switch (offset & 0xff)
416416   {
417417      case 0xf8 : orion128_video_mode_w(space,0,data);break;
418418      case 0xf9 : orionz80_memory_page_w(space,0,data);break;
r5932r5933
421421      case 0xfe : orionz80_sound_fe_w(space,0,data);break;
422422      case 0xff : orionz80_sound_w(space,0,data);break;
423423   }
424   switch(offset)
424   switch(offset)
425425   {
426426      case 0xfffd : ay8910_address_w(devtag_get_device(space->machine, "ay8912"), 0, data);
427427                 break;
428428      case 0xbffd :
429429      case 0xbefd : ay8910_data_w(devtag_get_device(space->machine, "ay8912"), 0, data);
430                  break;     
430                  break;
431431   }
432432}
433433
r5932r5933
444444
445445DRIVER_INIT( orionpro )
446446{
447   memset(mess_ram,0,512*1024);   
447   memset(mess_ram,0,512*1024);
448448}
449449
450450
r5932r5933
459459static void orionpro_bank_switch(running_machine *machine)
460460{
461461   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
463463   int is128 = (orionpro_dispatcher & 0x80) ? 1 : 0;
464   if (is128==1)
464   if (is128==1)
465465   {
466466      page = orionpro_128_page & 7;
467467   }
r5932r5933
473473   memory_install_write8_handler(space, 0xf000, 0xf3ff, 0, 0, SMH_BANK(6));
474474   memory_install_write8_handler(space, 0xf400, 0xf7ff, 0, 0, SMH_BANK(7));
475475   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)
479479   {   // RAM0 segment disabled
480480      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
484484   {
485485      memory_set_bankptr(machine, 1, mess_ram + (orionpro_ram0_segment & 31) * 0x4000);
486486      memory_set_bankptr(machine, 2, mess_ram + (orionpro_ram0_segment & 31) * 0x4000 + 0x2000);
487487   }
488   if ((orionpro_dispatcher & 0x10)==0x10)
489   {   // ROM1 enabled     
488   if ((orionpro_dispatcher & 0x10)==0x10)
489   {   // ROM1 enabled
490490      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);
492492   }
493   if ((orionpro_dispatcher & 0x08)==0x08)
493   if ((orionpro_dispatcher & 0x08)==0x08)
494494   {   // ROM2 enabled
495495      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);
497497   }
498498
499   if ((orionpro_dispatcher & 0x02)==0x00)
499   if ((orionpro_dispatcher & 0x02)==0x00)
500500   {   // 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
504504   {
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);
506506   }
507   
508   if ((orionpro_dispatcher & 0x04)==0x00)
507
508   if ((orionpro_dispatcher & 0x04)==0x00)
509509   {   // RAM2 segment disabled
510510      memory_set_bankptr(machine, 4, mess_ram + 0x10000 * page + 0x8000);
511   }
511   }
512512   else
513   {
513   {
514514      memory_set_bankptr(machine, 4, mess_ram + (orionpro_ram2_segment & 31) * 0x4000);
515515   }
516   
516
517517   memory_set_bankptr(machine, 5, mess_ram + 0x10000 * page + 0xc000);
518   
519   if (is128)
518
519   if (is128)
520520   {
521      memory_set_bankptr(machine, 6, mess_ram + 0x10000 * 0 + 0xf000);   
521      memory_set_bankptr(machine, 6, mess_ram + 0x10000 * 0 + 0xf000);
522522
523523      memory_install_write8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_w);
524524      memory_install_write8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_w);
525525      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);
527527      memory_install_read8_handler(space, 0xf400, 0xf4ff, 0, 0, orion128_system_r);
528528      memory_install_read8_handler(space, 0xf500, 0xf5ff, 0, 0, orion128_romdisk_r);
529529      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
532532      memory_install_write8_handler(space, 0xf800, 0xf8ff, 0, 0, orion128_video_mode_w);
533533      memory_install_write8_handler(space, 0xf900, 0xf9ff, 0, 0, orionpro_memory_page_w);
534534      memory_install_write8_handler(space, 0xfa00, 0xfaff, 0, 0, orion128_video_page_w);
535535      memory_install_write8_handler(space, 0xfb00, 0xfeff, 0, 0, SMH_UNMAP);
536536      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
542542   {
543      if ((orionpro_dispatcher & 0x40)==0x40)
543      if ((orionpro_dispatcher & 0x40)==0x40)
544544      {   // 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
550550      {
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);
554554      }
555   }   
555   }
556556}
557557
558558static WRITE8_HANDLER ( orionpro_memory_page_w )
559{   
559{
560560   orionpro_128_page = data;
561561   orionpro_bank_switch(space->machine);
562562}
563563
564MACHINE_RESET ( orionpro )
565{   
566   radio86_init_keyboard();   
564MACHINE_RESET ( orionpro )
565{
566   radio86_init_keyboard();
567567
568568   orion128_video_page = 0;
569569   orion128_video_mode = 0;
r5932r5933
577577
578578   orionpro_dispatcher = 0x50;
579579   orionpro_bank_switch(machine);
580   
580
581581   orion_speaker = 0;
582582   orion128_video_width = SCREEN_WIDTH_384;
583583   orion_set_video_mode(machine,384);
r5932r5933
586586   orionpro_pseudo_color = 0;
587587}
588588
589READ8_HANDLER ( orionpro_io_r )
589READ8_HANDLER ( orionpro_io_r )
590590{
591591   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
592     
593   switch (offset & 0xff)
594   {     
592
593   switch (offset & 0xff)
594   {
595595      case 0x00 : return 0x56;
596596      case 0x04 : return orionpro_ram0_segment;
597597      case 0x05 : return orionpro_ram1_segment;
r5932r5933
599599      case 0x08 : return orionpro_page;
600600      case 0x09 : return orionpro_rom2_segment;
601601      case 0x0a : return orionpro_dispatcher;
602      case 0x10 : return wd17xx_status_r(fdc,0);
602      case 0x10 : return wd17xx_status_r(fdc,0);
603603      case 0x11 : return wd17xx_track_r(fdc,0);
604604      case 0x12 : return wd17xx_sector_r(fdc,0);
605605      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 :
610610               return orion128_system_r(space,(offset & 0xff)-0x18);
611611      case 0x28 : return orion128_romdisk_r(space,0);
612612      case 0x29 : return orion128_romdisk_r(space,1);
613613      case 0x2a : return orion128_romdisk_r(space,2);
614614      case 0x2b : return orion128_romdisk_r(space,3);
615615   }
616   if (offset == 0xFFFD)
616   if (offset == 0xFFFD)
617617   {
618618      return ay8910_r (devtag_get_device(space->machine, "ay8912"), 0);
619619   }
620620   return 0xff;
621621}
622622
623WRITE8_HANDLER ( orionpro_io_w )
623WRITE8_HANDLER ( orionpro_io_w )
624624{
625625   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;
630630      case 0x05 : orionpro_ram1_segment = data; orionpro_bank_switch(space->machine); break;
631631      case 0x06 : orionpro_ram2_segment = data; orionpro_bank_switch(space->machine); break;
632632      case 0x08 : orionpro_page = data;         orionpro_bank_switch(space->machine); break;
r5932r5933
637637      case 0x12 : wd17xx_sector_w(fdc,0,data);break;
638638      case 0x13 : wd17xx_data_w(fdc,0,data);break;
639639      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 :
644644               orion128_system_w(space,(offset & 0xff)-0x18,data); break;
645645      case 0x28 : orion128_romdisk_w(space,0,data); break;
646646      case 0x29 : orion128_romdisk_w(space,1,data); break;
r5932r5933
648648      case 0x2b : orion128_romdisk_w(space,3,data); break;
649649      case 0xf8 : orion128_video_mode_w(space,0,data);break;
650650      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;
652652      case 0xfc : orionpro_pseudo_color = data;break;
653653      case 0xfe : orionz80_sound_fe_w(space,0,data);break;
654654      case 0xff : orionz80_sound_w(space,0,data);break;
655655   }
656   switch(offset)
656   switch(offset)
657657   {
658658      case 0xfffd : ay8910_address_w(devtag_get_device(space->machine, "ay8912"), 0, data);
659659                 break;
660660      case 0xbffd :
661661      case 0xbefd : ay8910_data_w(devtag_get_device(space->machine, "ay8912"), 0, data);
662                  break;     
662                  break;
663663   }
664664}
src/mess/machine/68901mfp.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
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
1818
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.
2121
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.
2525
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.
3131
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."
3434
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
4141
4242*/
4343
r5932r5933
340340
341341/*-------------------------------------------------
342342    check_interrupts - set the interrupt request
343   line state
343    line state
344344-------------------------------------------------*/
345345
346346static void check_interrupts(const device_config *device)
r5932r5933
406406
407407/*-------------------------------------------------
408408    rx_buffer_full - signal receive buffer full
409   interrupt
409    interrupt
410410-------------------------------------------------*/
411411
412412static void rx_buffer_full(const device_config *device)
r5932r5933
438438}
439439
440440/*-------------------------------------------------
441    tx_buffer_empty - signal transmit buffer
442   empty interrupt
441    tx_buffer_empty - signal transmit buffer
442    empty interrupt
443443-------------------------------------------------*/
444444
445445static void tx_buffer_empty(const device_config *device)
r5932r5933
648648static void tx_break(const device_config *device)
649649{
650650   mc68901_t *mc68901 = get_safe_token(device);
651   
651
652652   if (mc68901->tsr & MC68901_TSR_XMIT_ENABLE)
653653   {
654654      if (mc68901->tsr & MC68901_TSR_BREAK)
r5932r5933
717717         {
718718            /* transmit start bit */
719719            TXD(0);
720           
720
721721            /* load transmit buffer */
722722            mc68901->tx_buffer = mc68901->udr;
723723            mc68901->tx_bits = 0;
r5932r5933
12581258      case MC68901_UCR_START_STOP_1_15:
12591259         mc68901->rxtx_start = 1;
12601260         mc68901->rxtx_stop = 1;
1261         if (LOG) logerror("MC68901 Start Bits : 1, Stop Bits : 1½, Format : asynchronous\n");
1261         if (LOG) logerror("MC68901 Start Bits : 1, Stop Bits : 1??, Format : asynchronous\n");
12621262         break;
12631263      case MC68901_UCR_START_STOP_1_2:
12641264         mc68901->rxtx_start = 1;
src/mess/machine/amigafdc.c
r5932r5933
11/***************************************************************************
22
3   Amiga floppy disk controller emulation
3    Amiga floppy disk controller emulation
44
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
1010
1111***************************************************************************/
1212
r5932r5933
622622}
623623
624624static void start_rev_timer( int drive ) {
625//   double time;
625//  double time;
626626
627627   if ( fdc_status[drive].rev_timer_started ) {
628628      logerror("Revolution timer started twice?!\n" );
src/mess/machine/bk.c
r5932r5933
2222static TIMER_CALLBACK(keyboard_callback)
2323{
2424   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",
2626                              "LINE7", "LINE8", "LINE9", "LINE10", "LINE11" };
2727
28   for(i = 1; i < 12; i++)
28   for(i = 1; i < 12; i++)
2929   {
3030      code =    input_port_read(machine, keynames[i-1]);
31      if (code != 0)
31      if (code != 0)
3232      {
33         for(j = 0; j < 8; j++)
33         for(j = 0; j < 8; j++)
3434         {
35            if (code == (1 << j))
35            if (code == (1 << j))
3636            {
3737               key_code = j + i*8;
3838               break;
3939            }
4040         }
41         if ((input_port_read(machine, "LINE0") & 4) == 4)
41         if ((input_port_read(machine, "LINE0") & 4) == 4)
4242         {
43            if (i==6 || i==7)
43            if (i==6 || i==7)
4444            {
4545               key_code -= 16;
4646            }
4747
4848         }
49         if ((input_port_read(machine, "LINE0") & 4) == 4)
49         if ((input_port_read(machine, "LINE0") & 4) == 4)
5050         {
51            if (i>=8 && i<=11)
51            if (i>=8 && i<=11)
5252            {
5353               key_code += 32;
5454            }
5555         }
5656         key_pressed = 0x40;
57         if ((input_port_read(machine, "LINE0") & 2) == 0)
57         if ((input_port_read(machine, "LINE0") & 2) == 0)
5858         {
5959            key_irq_vector = 0x30;
60         }
61         else
60         }
61         else
6262         {
6363            key_irq_vector = 0xBC;
6464         }
r5932r5933
8989   bk_scrool = 01330;
9090}
9191
92READ16_HANDLER (bk_key_state_r)
93{     
92READ16_HANDLER (bk_key_state_r)
93{
9494   return kbd_state;
9595}
96READ16_HANDLER (bk_key_code_r)
96READ16_HANDLER (bk_key_code_r)
9797{
9898   kbd_state &= ~0x80; // mark reading done
9999   key_pressed = 0;
100100   return key_code;
101101}
102READ16_HANDLER (bk_vid_scrool_r)
102READ16_HANDLER (bk_vid_scrool_r)
103103{
104104   return bk_scrool;
105105}
106106
107READ16_HANDLER (bk_key_press_r)
107READ16_HANDLER (bk_key_press_r)
108108{
109   double level = cassette_input(devtag_get_device(space->machine, "cassette"));                                               
109   double level = cassette_input(devtag_get_device(space->machine, "cassette"));
110110   UINT16 cas;
111   if (level < 0)
112   {
113       cas = 0x00;
114    }
115   else
111   if (level < 0)
116112   {
113       cas = 0x00;
114    }
115   else
116   {
117117      cas = 0x20;
118118   }
119119
120120   return 0x8080 | key_pressed | cas;
121121}
122122
123WRITE16_HANDLER(bk_key_state_w)
123WRITE16_HANDLER(bk_key_state_w)
124124{
125125   kbd_state = (kbd_state & ~0x40) | (data & 0x40);
126126}
127127
128WRITE16_HANDLER(bk_vid_scrool_w)
128WRITE16_HANDLER(bk_vid_scrool_w)
129129{
130130   bk_scrool = data;
131131}
132132
133WRITE16_HANDLER(bk_key_press_w)
133WRITE16_HANDLER(bk_key_press_w)
134134{
135135}
136136
r5932r5933
141141
142142WRITE16_HANDLER(bk_floppy_cmd_w)
143143{
144   if ((data & 1) == 1)
144   if ((data & 1) == 1)
145145   {
146146      bk_drive = 0;
147147   }
148   if ((data & 2) == 2)
148   if ((data & 2) == 2)
149149   {
150150      bk_drive = 1;
151151   }
152   if ((data & 4) == 4)
152   if ((data & 4) == 4)
153153   {
154154      bk_drive = 2;
155155   }
156   if ((data & 8) == 8)
156   if ((data & 8) == 8)
157157   {
158158      bk_drive = 3;
159159   }
160   if (data == 0)
160   if (data == 0)
161161   {
162162      bk_drive = -1;
163163   }
src/mess/machine/z80dart.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
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
1818
1919*/
2020
r5932r5933
166166struct _z80dart_t
167167{
168168   devcb_resolved_write_line   out_int_func;
169   
169
170170   dart_channel channel[2];      /* channels */
171171
172172   int int_state[8];            /* interrupt state */
r5932r5933
401401
402402/*-------------------------------------------------
403403    character_completed - check if complete
404   data word has been transferred
404    data word has been transferred
405405-------------------------------------------------*/
406406
407407static int character_completed(dart_channel *ch)
r5932r5933
417417{
418418   z80dart_t *z80dart = get_safe_token(device);
419419   dart_channel *ch = &z80dart->channel[channel];
420   
420
421421   int parity = (ch->wr[1] & Z80DART_WR4_PARITY_EVEN) ? 1 : 0;
422422
423423   if (RXD != (ch->rx_parity ^ parity))
r5932r5933
433433            take_interrupt(device, channel, INT_SPECIAL);
434434         }
435435         break;
436     
436
437437      case Z80DART_WR1_RX_INT_ALL_PARITY:
438438         take_interrupt(device, channel, INT_SPECIAL);
439439         break;
440     
440
441441      case Z80DART_WR1_RX_INT_ALL:
442442         take_interrupt(device, channel, INT_RECEIVE);
443443         break;
r5932r5933
453453{
454454   z80dart_t *z80dart = get_safe_token(device);
455455   dart_channel *ch = &z80dart->channel[channel];
456   
456
457457   if (!RXD)
458458   {
459459      /* framing error detected */
r5932r5933
467467            take_interrupt(device, channel, INT_SPECIAL);
468468         }
469469         break;
470     
470
471471      case Z80DART_WR1_RX_INT_ALL_PARITY:
472472      case Z80DART_WR1_RX_INT_ALL:
473473         take_interrupt(device, channel, INT_SPECIAL);
r5932r5933
484484{
485485   z80dart_t *z80dart = get_safe_token(device);
486486   dart_channel *ch = &z80dart->channel[channel];
487   
487
488488   float stop_bits = get_stop_bits(ch);
489489
490490   switch (ch->rx_state)
r5932r5933
507507   case STATE_DATA:
508508      /* shift bit into shift register */
509509      shift_data_in(ch);
510     
510
511511      if (character_completed(ch))
512512      {
513513         /* all data bits received */
r5932r5933
576576{
577577   z80dart_t *z80dart = get_safe_token(device);
578578   dart_channel *ch = &z80dart->channel[channel];
579   
579
580580   int word_length = get_tx_word_length(ch);
581581   float stop_bits = get_stop_bits(ch);
582582
r5932r5933
778778      LOG(("Z80DART \"%s\" Channel %c : Transmit Interrupt Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR1_TX_INT_ENABLE) ? 1 : 0));
779779      LOG(("Z80DART \"%s\" Channel %c : Status Affects Vector %u\n", device->tag, 'A' + channel, (data & Z80DART_WR1_STATUS_VECTOR) ? 1 : 0));
780780      LOG(("Z80DART \"%s\" Channel %c : Wait/Ready Enable %u\n", device->tag, 'A' + channel, (data & Z80DART_WR1_WRDY_ENABLE) ? 1 : 0));
781     
781
782782      switch (data & Z80DART_WR1_RX_INT_ENABLE_MASK)
783783      {
784784      case Z80DART_WR1_RX_INT_DISABLE:
r5932r5933
892892   dart_channel *ch = &z80dart->channel[channel];
893893
894894   ch->tx_data = data;
895   
895
896896   ch->rr[0] &= ~Z80DART_RR0_TX_BUFFER_EMPTY;
897897   ch->rr[1] &= ~Z80DART_RR1_ALL_SENT;
898898
r5932r5933
923923            take_interrupt(device, channel, INT_SPECIAL);
924924         }
925925         break;
926     
926
927927      case Z80DART_WR1_RX_INT_ALL_PARITY:
928928      case Z80DART_WR1_RX_INT_ALL:
929929         take_interrupt(device, channel, INT_SPECIAL);
r5932r5933
10601060}
10611061
10621062/*-------------------------------------------------
1063    z80dart_dcda_w - data carrier detected
1064   (channel A)
1063    z80dart_dcda_w - data carrier detected
1064    (channel A)
10651065-------------------------------------------------*/
10661066
10671067void z80dart_dcda_w(const device_config *device, int state)
r5932r5933
10701070}
10711071
10721072/*-------------------------------------------------
1073    z80dart_dcdb_w - data carrier detected
1074   (channel B)
1073    z80dart_dcdb_w - data carrier detected
1074    (channel B)
10751075-------------------------------------------------*/
10761076
10771077void z80dart_dcdb_w(const device_config *device, int state)
r5932r5933
11461146   if (!state) return;
11471147
11481148   LOG(("Z80DART \"%s\" Channel A : Receiver Clock Pulse\n", device->tag));
1149   
1149
11501150   ch->rx_clock++;
11511151
11521152   if (ch->rx_clock == clocks)
r5932r5933
11721172   if (!state) return;
11731173
11741174   LOG(("Z80DART \"%s\" Channel A : Transmitter Clock Pulse\n", device->tag));
1175   
1175
11761176   ch->tx_clock++;
11771177
11781178   if (ch->tx_clock == clocks)
r5932r5933
11851185}
11861186
11871187/*-------------------------------------------------
1188    z80dart_rxtxcb_w - receive/transmit clock
1189   (channel B)
1188    z80dart_rxtxcb_w - receive/transmit clock
1189    (channel B)
11901190-------------------------------------------------*/
11911191
11921192void z80dart_rxtxcb_w(const device_config *device, int state)
r5932r5933
11991199   if (!state) return;
12001200
12011201   LOG(("Z80DART \"%s\" Channel A : Receiver/Transmitter Clock Pulse\n", device->tag));
1202   
1202
12031203   ch->rx_clock++;
12041204   ch->tx_clock++;
12051205
r5932r5933
12511251   int state = 0;
12521252   int i;
12531253
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,
12551255            z80dart->int_state[0], z80dart->int_state[1], z80dart->int_state[2], z80dart->int_state[3],
12561256            z80dart->int_state[4], z80dart->int_state[5], z80dart->int_state[6], z80dart->int_state[7]));
12571257
r5932r5933
13011301   }
13021302
13031303   logerror("z80dart_irq_ack: failed to find an interrupt to ack!\n");
1304   
1304
13051305   return z80dart->channel[Z80DART_CH_B].rr[2];
13061306}
13071307
src/mess/machine/amigakbd.c
r5932r5933
11/***************************************************************************
22
3   Amiga keyboard controller emulation
3    Amiga keyboard controller emulation
44
55***************************************************************************/
66
src/mess/machine/abcbus.c
r5932r5933
3333      (*tailptr)->card_select = (abcbus_card_select)device_get_info_fct((*tailptr)->device, DEVINFO_FCT_ABCBUS_CARD_SELECT);
3434      tailptr = &(*tailptr)->next;
3535   }
36   
36
3737   astring_free(tempstring);
3838
3939   daisy_state = head;
src/mess/machine/a7800.c
r5932r5933
11/***************************************************************************
22
3   a7800.c
3    a7800.c
44
5   Machine file to handle emulation of the Atari 7800.
5    Machine file to handle emulation of the Atari 7800.
66
7    5-Nov-2003 npwoods      Cleanups
7     5-Nov-2003 npwoods     Cleanups
88
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?
1212
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
2020
2121***************************************************************************/
2222
r5932r5933
142142#define MBANK_TYPE_ACTIVISION 0x0100
143143#define MBANK_TYPE_ABSOLUTE 0x0200
144144
145/*   Header format
1460     Header version    - 1 byte
1471..16  "ATARI7800     "  - 16 bytes
14817..48 Cart title       - 32 bytes
14949..52 data length      - 4 bytes
15053..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
1460     Header version     - 1 byte
1471..16  "ATARI7800     "  - 16 bytes
14817..48 Cart title        - 32 bytes
14949..52 data length      - 4 bytes
15053..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
155155
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
160160
16155    controller 1 type  - 1 byte
16256    controller 2 type  - 1 byte
163   0 = None
164   1 = Joystick
165   2 = Light Gun
16155   controller 1 type  - 1 byte
16256   controller 2 type  - 1 byte
163    0 = None
164    1 = Joystick
165    2 = Light Gun
16616657  0 = NTSC/1 = PAL
167167
168168100..127 "ACTUAL CART DATA STARTS HERE" - 28 bytes
169169
170170Versions:
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
174174
175175*/
176176
r5932r5933
274274      memcpy( memory + 0xC000, memory + 0x10000 + len - 0x4000, 0x4000);
275275
276276      /* 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        */
280280
281      /* bank n-2   */
281      /* bank n-2 */
282282      if( ! ( a7800_cart_type & 0x0D ) )
283283      {
284284         memcpy( memory + 0x4000, memory + 0x10000 + len - 0x8000, 0x4000);
r5932r5933
372372      }
373373      memory_set_bankptr(space->machine, 2,memory + 0x10000 + (data << 14));
374374      memory_set_bankptr(space->machine, 3,memory + 0x12000 + (data << 14));
375   /*   logerror("BANK SEL: %d\n",data); */
375   /*  logerror("BANK SEL: %d\n",data); */
376376   }
377377   else if(( a7800_cart_type == MBANK_TYPE_ABSOLUTE ) &&( offset == 0x4000 ) )
378378   {
src/mess/machine/68901mfp.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3434
3535**********************************************************************/
3636
r5932r5933
7676
7777   /* this gets called for each read of the SI pin (pin 9) */
7878   devcb_read_line         in_si_func;
79   
79
8080   /* this gets called for each change of the SO pin (pin 8) */
8181   devcb_write_line      out_so_func;
8282
8383   /* this gets called for each change of the TAO pin (pin 13) */
8484   devcb_write_line      out_tao_func;
85   
85
8686   /* this gets called for each change of the TBO pin (pin 14) */
8787   devcb_write_line      out_tbo_func;
88   
88
8989   /* this gets called for each change of the TCO pin (pin 15) */
9090   devcb_write_line      out_tco_func;
91   
91
9292   /* this gets called for each change of the TDO pin (pin 16) */
9393   devcb_write_line      out_tdo_func;
9494
src/mess/machine/matsucd.c
r5932r5933
11/***************************************************************************
22
3   Matsushita/Panasonic CDR521/522 type CDROM drive emulation
3    Matsushita/Panasonic CDR521/522 type CDROM drive emulation
44
55Notes:
66This version implements the drive found in Amiga CDTV. There are
r5932r5933
3030typedef struct
3131{
3232   UINT8   enabled;      /* /ENABLE - Unit enabled */
33   UINT8   cmd_signal;      /* /CMD - Command mode    */
33   UINT8   cmd_signal;      /* /CMD - Command mode  */
3434   UINT8   stch_signal;   /* /STCH - Status Changed */
3535   UINT8   sten_signal;   /* /STEN - Status Enabled */
3636   UINT8   scor_signal;   /* /STEN - Subcode Ready */
src/mess/machine/z80dart.h
r5932r5933
4141
4242#define Z80DART   DEVICE_GET_INFO_NAME(z80dart)
4343/*
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)
4747*/
4848
4949#define MDRV_Z80DART_ADD(_tag, _clock, _config) \
src/mess/machine/nascom1.c
r5932r5933
114114
115115   if (nascom1_portstat.stat_count < 9)
116116      return (input_port_read(space->machine, keynames[nascom1_portstat.stat_count]) | ~0x7f);
117   
117
118118   return (0xff);
119119}
120120
r5932r5933
125125   cassette_change_state( devtag_get_device(space->machine, "cassette"),
126126      ( data & 0x10 ) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR );
127127
128   if (!(data & NASCOM1_KEY_RESET))
128   if (!(data & NASCOM1_KEY_RESET))
129129   {
130130      if (nascom1_portstat.stat_flags & NASCOM1_KEY_RESET)
131131         nascom1_portstat.stat_count = 0;
132   }
133   else
132   }
133   else
134134      nascom1_portstat.stat_flags = NASCOM1_KEY_RESET;
135135
136   if (!(data & NASCOM1_KEY_INCR))
136   if (!(data & NASCOM1_KEY_INCR))
137137   {
138138      if (nascom1_portstat.stat_flags & NASCOM1_KEY_INCR)
139139         nascom1_portstat.stat_count++;
140   }
141   else
140   }
141   else
142142      nascom1_portstat.stat_flags = NASCOM1_KEY_INCR;
143143}
144144
r5932r5933
270270MACHINE_RESET( nascom2 )
271271{
272272   const device_config *fdc = devtag_get_device(machine, "wd1793");
273   
273
274274   wd17xx_set_density(fdc,DEN_FM_HI);
275275
276276   MACHINE_RESET_CALL(nascom1);
src/mess/machine/abcbus.h
r5932r5933
11/*
22
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
3636
3737*/
3838
3939/*
4040
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
4747
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
5151
5252
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
5757
5858*/
5959
6060/*
6161
62   Type               Size      Tracks   Sides   Sectors/track   Sectors      Speed         Drives
62    Type                    Size        Tracks  Sides   Sectors/track   Sectors     Speed           Drives
6363
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)
7777
7878*/
7979
src/mess/machine/matsucd.h
r5932r5933
11/***************************************************************************
22
3   Matsushita/Panasonic CDR521/522 type CDROM drive emulation
3    Matsushita/Panasonic CDR521/522 type CDROM drive emulation
44
55***************************************************************************/
66
src/mess/machine/microtan.c
r5932r5933
630630
631631   while ( !chg && row > 0)
632632   {
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;
635635   }
636    if (!chg)
636    if (!chg)
637637      --row;
638638
639639    if (row >= 0)
r5932r5933
645645        /* CapsLock LED */
646646      if( row == 3 && chg == 0x80 )
647647         set_led_status(1, (keyrows[3] & 0x80) ? 0 : 1);
648     
648
649649        if (new & chg)  /* key(s) pressed ? */
650650        {
651651            mod = 0;
r5932r5933
717717   const device_config *via_0 = devtag_get_device(machine, "via6522_0");
718718   const device_config *via_1 = devtag_get_device(machine, "via6522_1");
719719   const device_config *ay8910 = devtag_get_device(machine, "ay8910.1");
720   
720
721721    /* check for .DMP file format */
722722    if (snapshot_size == 8263)
723723    {
r5932r5933
931931{
932932    int i;
933933   static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8" };
934   
934
935935   for (i = 1; i < 10;  i++)
936936   {
937937        keyrows[i] = input_port_read(machine, keynames[i-1]);
src/mess/machine/tms9902.c
r5932r5933
11/*
2   TMS9902 Asynchronous Communication Controller
2    TMS9902 Asynchronous Communication Controller
33
4   Raphael Nabet, 2003
4    Raphael Nabet, 2003
55*/
66
77#include <math.h>
r5932r5933
1010#include "tms9902.h"
1111
1212/*
13   TMS9902 emulation.
13    TMS9902 emulation.
1414
1515Overview:
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.
2020
2121Pins:
22   (...)
22    (...)
2323
2424*/
2525
r5932r5933
3434   /* driver-specific configuration */
3535   /* tms9902 clock rate (PHI* pin, normally connected to TMS9900 Phi3*) */
3636   /* 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) */
3939   double clock_rate;
4040
4141   /* CRU interface */
r5932r5933
122122
123123
124124/*
125   should be called after any change to int_state or enabled_ints.
125    should be called after any change to int_state or enabled_ints.
126126*/
127127static void field_interrupts(const device_config *device)
128128{
r5932r5933
143143
144144
145145/*
146   function device should be called by the driver when the state of CTS changes
146    function device should be called by the driver when the state of CTS changes
147147
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)
150150*/
151151void tms9902_set_cts(const device_config *device, int state)
152152{
r5932r5933
171171
172172
173173/*
174   function device should be called by the driver when the state of DSR changes
174    function device should be called by the driver when the state of DSR changes
175175
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)
178178*/
179179void tms9902_set_dsr(const device_config *device, int state)
180180{
r5932r5933
206206
207207
208208/*
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.
211211*/
212212static TIMER_CALLBACK(decrementer_callback)
213213{
r5932r5933
221221}
222222
223223/*
224   load the content of clockinvl into the decrementer
224    load the content of clockinvl into the decrementer
225225*/
226226static void reload_interval_timer(const device_config *device)
227227{
r5932r5933
301301
302302
303303/*----------------------------------------------------------------
304   TMS9902 CRU interface.
304    TMS9902 CRU interface.
305305----------------------------------------------------------------*/
306306
307307/*
308   Read a 8 bit chunk from tms9902.
308    Read a 8 bit chunk from tms9902.
309309
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)
319319*/
320320READ8_DEVICE_HANDLER( tms9902_cru_r )
321321{
r5932r5933
361361}
362362
363363/*
364   Write 1 bit to tms9902.
364    Write 1 bit to tms9902.
365365
366   signification:
367   ...
366    signification:
367    ...
368368*/
369369WRITE8_DEVICE_HANDLER( tms9902_cru_w )
370370{
src/mess/machine/99_peb.c
r5932r5933
11/*
2   Peripheral expansion bus support.
2    Peripheral expansion bus support.
33
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.
1010
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.)
2323
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.
2727
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)
5555
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
5959
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
6363
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
7373
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.)
8282
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.
9696
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.
101101*/
102102
103103#include "driver.h"
r5932r5933
167167
168168
169169/*
170   Initializes the expansion card handlers
170    Initializes the expansion card handlers
171171
172172*/
173173void ti99_peb_init()
r5932r5933
178178
179179
180180/*
181   Resets the expansion card handlers
181    Resets the expansion card handlers
182182
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)
189189*/
190190void 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))
191191{
r5932r5933
202202}
203203
204204/*
205   Sets the handlers for one expansion port (normal 8-bit card)
205    Sets the handlers for one expansion port (normal 8-bit card)
206206
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
211211*/
212212void ti99_peb_set_card_handlers(int cru_base, const ti99_peb_card_handlers_t *handler)
213213{
r5932r5933
241241}
242242
243243/*
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)
246246
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
251251*/
252252void ti99_peb_set_16bit_card_handlers(int cru_base, const ti99_peb_16bit_card_handlers_t *handler)
253253{
r5932r5933
272272}
273273
274274/*
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.
277277
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
282282*/
283283void ti99_peb_set_ila_bit(running_machine *machine, int bit, int state)
284284{
r5932r5933
297297}
298298
299299/*
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.
302302
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
307307*/
308308void ti99_peb_set_ilb_bit(running_machine *machine, int bit, int state)
309309{
r5932r5933
323323
324324
325325/*
326   Read CRU in range >1000->1ffe (>800->fff) (ti-99/4(a))
326    Read CRU in range >1000->1ffe (>800->fff) (ti-99/4(a))
327327*/
328328READ8_HANDLER ( ti99_4x_peb_cru_r )
329329{
r5932r5933
340340}
341341
342342/*
343   Write CRU in range >1000->1ffe (>800->fff) (ti-99/4(a))
343    Write CRU in range >1000->1ffe (>800->fff) (ti-99/4(a))
344344*/
345345WRITE8_HANDLER ( ti99_4x_peb_cru_w )
346346{
r5932r5933
372372}
373373
374374/*
375   Read mem in range >4000->5ffe (ti-99/4(a))
375    Read mem in range >4000->5ffe (ti-99/4(a))
376376*/
377377READ16_HANDLER ( ti99_4x_peb_r )
378378{
r5932r5933
395395}
396396
397397/*
398   Write mem in range >4000->5ffe (ti-99/4(a))
398    Write mem in range >4000->5ffe (ti-99/4(a))
399399*/
400400WRITE16_HANDLER ( ti99_4x_peb_w )
401401{
r5932r5933
419419
420420
421421/*
422   Read CRU in range >1000->1ffe (>800->fff) (Geneve)
422    Read CRU in range >1000->1ffe (>800->fff) (Geneve)
423423*/
424424 READ8_HANDLER ( geneve_peb_cru_r )
425425{
r5932r5933
436436}
437437
438438/*
439   Write CRU in range >1000->1ffe (>800->fff) (Geneve)
439    Write CRU in range >1000->1ffe (>800->fff) (Geneve)
440440*/
441441WRITE8_HANDLER ( geneve_peb_cru_w )
442442{
r5932r5933
468468}
469469
470470/*
471   Read mem in range >4000->5fff (Geneve)
471    Read mem in range >4000->5fff (Geneve)
472472*/
473473 READ8_HANDLER ( geneve_peb_r )
474474{
r5932r5933
488488}
489489
490490/*
491   Write mem in range >4000->5fff (Geneve)
491    Write mem in range >4000->5fff (Geneve)
492492*/
493493WRITE8_HANDLER ( geneve_peb_w )
494494{
r5932r5933
505505}
506506
507507/*
508   Read CRU in range >1000->2ffe (>0800->17ff) (ti-99/8)
508    Read CRU in range >1000->2ffe (>0800->17ff) (ti-99/8)
509509*/
510510 READ8_HANDLER ( ti99_8_peb_cru_r )
511511{
r5932r5933
522522}
523523
524524/*
525   Write CRU in range >1000->2ffe (>0800->17ff) (ti-99/8)
525    Write CRU in range >1000->2ffe (>0800->17ff) (ti-99/8)
526526*/
527527WRITE8_HANDLER ( ti99_8_peb_cru_w )
528528{
r5932r5933
554554}
555555
556556/*
557   Read mem in range >4000->5fff (ti-99/8)
557    Read mem in range >4000->5fff (ti-99/8)
558558*/
559559 READ8_HANDLER ( ti99_8_peb_r )
560560{
r5932r5933
574574}
575575
576576/*
577   Write mem in range >4000->5fff (ti-99/8)
577    Write mem in range >4000->5fff (ti-99/8)
578578*/
579579WRITE8_HANDLER ( ti99_8_peb_w )
580580{
r5932r5933
591591}
592592
593593/*
594   Read CRU in range >0400->1ffe (>200->fff) (snug sgcpu 99/4p)
594    Read CRU in range >0400->1ffe (>200->fff) (snug sgcpu 99/4p)
595595*/
596596 READ8_HANDLER ( ti99_4p_peb_cru_r )
597597{
r5932r5933
608608}
609609
610610/*
611   Write CRU in range >0400->1ffe (>200->fff) (snug sgcpu 99/4p)
611    Write CRU in range >0400->1ffe (>200->fff) (snug sgcpu 99/4p)
612612*/
613613WRITE8_HANDLER ( ti99_4p_peb_cru_w )
614614{
r5932r5933
658658}
659659
660660/*
661   Read mem in range >4000->5ffe (snug sgcpu 99/4p)
661    Read mem in range >4000->5ffe (snug sgcpu 99/4p)
662662*/
663663READ16_HANDLER ( ti99_4p_peb_r )
664664{
r5932r5933
709709}
710710
711711/*
712   Write mem in range >4000->5ffe (snug sgcpu 99/4p)
712    Write mem in range >4000->5ffe (snug sgcpu 99/4p)
713713*/
714714WRITE16_HANDLER ( ti99_4p_peb_w )
715715{
r5932r5933
746746}
747747
748748/*
749   Set the state of the SENILA line (snug sgcpu 99/4p)
749    Set the state of the SENILA line (snug sgcpu 99/4p)
750750*/
751751void ti99_4p_peb_set_senila(int state)
752752{
r5932r5933
754754}
755755
756756/*
757   Set the state of the SENILB line (snug sgcpu 99/4p)
757    Set the state of the SENILB line (snug sgcpu 99/4p)
758758*/
759759void ti99_4p_peb_set_senilb(int state)
760760{
src/mess/machine/amigacrt.c
r5932r5933
11/***************************************************************************
22
3   Amiga cartridge emulation
3    Amiga cartridge emulation
44
55TODO:
66- Investigate why the AR2/3 sometimes garble the video on exit from the cart
r5932r5933
113113   if ( ((pc >> 16) & 0xff ) != 0xf0 )
114114   {
115115      /* if we're not, see if either the Spurious IRQ vector
116         or the NMI vector are being overwritten */
116           or the NMI vector are being overwritten */
117117      if ( offset == (0x60/2) || offset == (0x7c/2) )
118118      {
119119         /* trigger an NMI or spurious irq */
r5932r5933
367367   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK(3));
368368
369369   /* 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);
372372
373373   /* Install status/mode handlers */
374374   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r);
r5932r5933
387387
388388/***************************************************************************
389389
390   MAME/MESS hooks
390    MAME/MESS hooks
391391
392392***************************************************************************/
393393
src/mess/machine/osborne1.c
r5932r5933
336336
337337//static const struct aica6850_interface osborne1_6850_config =
338338//{
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 */
347347//};
348348
349349
r5932r5933
474474   {
475475      floppy_install_load_proc(floppy_get_device(machine, drive), osborne1_load_proc);
476476   }
477   
477
478478   memory_set_direct_update_handler( space, osborne1_opbase );
479479}
480480
r5932r5933
487487   memset( osborne1.empty_4K, 0xFF, 0x1000 );
488488
489489   /* Configure the 6850 ACIA */
490//   acia6850_config( 0, &osborne1_6850_config );
490//  acia6850_config( 0, &osborne1_6850_config );
491491}
492492
493493
494494/****************************************************************
495   Osborne1 specific daisy chain code
495    Osborne1 specific daisy chain code
496496****************************************************************/
497497
498498
r5932r5933
507507    /* Enable ROM and I/O when IRQ is acknowledged */
508508    UINT8   old_bankswitch = osborne1.bankswitch;
509509    const address_space* space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
510   
510
511511    osborne1_bankswitch_w( space, 0, 0 );
512512    osborne1.bankswitch = old_bankswitch;
513513    osborne1.in_irq_handler = 1;
src/mess/machine/amstrad.c
r5932r5933
516516/*
517517DMA commands
518518
5190RDDh    LOAD R,D    Load 8 bit data D to PSG register R (0<=R<=15)
5201NNNh    PAUSE N    Pause for N prescaled ticks (0<N<=4095)
5212NNNh    REPEAT N    Set loop counter to N for this stream (0<N<=4095), and mark next instruction as loop start.
5223xxxh    (reserved)    Do not use
5234000h    NOP    No operation (64us idle)
5244001h    LOOP    If loop counter non zero, loop back to the first instruction after REPEAT instruction and decrement loop counter.
5254010h    INT    Interrupt the CPU
5264020h    STOP    Stop processing the sound list.
5190RDDh   LOAD R,D    Load 8 bit data D to PSG register R (0<=R<=15)
5201NNNh   PAUSE N     Pause for N prescaled ticks (0<N<=4095)
5212NNNh   REPEAT N    Set loop counter to N for this stream (0<N<=4095), and mark next instruction as loop start.
5223xxxh   (reserved)  Do not use
5234000h   NOP     No operation (64us idle)
5244001h   LOOP    If loop counter non zero, loop back to the first instruction after REPEAT instruction and decrement loop counter.
5254010h   INT     Interrupt the CPU
5264020h   STOP    Stop processing the sound list.
527527*/
528528
529529static void amstrad_plus_dma_parse(running_machine *machine, int channel)
r5932r5933
544544      return;
545545   }
546546   command = (mess_ram[asic.dma_addr[channel]+1] << 8) + mess_ram[asic.dma_addr[channel]];
547//   logerror("DMA #%i: address %04x: command %04x\n",channel,asic.dma_addr[channel],command);
547//  logerror("DMA #%i: address %04x: command %04x\n",channel,asic.dma_addr[channel],command);
548548   switch (command & 0xf000)
549549   {
550550   case 0x0000:  // Load PSG register
r5932r5933
10251025   UINT16   *p = BITMAP_ADDR16( bitmap, y, 0 );
10261026   int      i;
10271027
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 );
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 );
10291029
10301030   for ( i = 15 * 8; i >= 0; i -= 8 )
10311031   {
r5932r5933
10741074   UINT16   *p = BITMAP_ADDR16( bitmap, y, 0 );
10751075   int i;
10761076
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 );
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 );
10781078
10791079   for ( i = 0; i < x_count; i++ )
10801080   {
r5932r5933
11201120   UINT16   *p = BITMAP_ADDR16( bitmap, y, 0 );
11211121   int i;
11221122
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 );
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 );
11241124
11251125   for ( i = 0; i < x_count; i++ )
11261126   {
r5932r5933
11541154
11551155static MC6845_UPDATE_ROW( amstrad_update_row )
11561156{
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 );
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 );
11581158
11591159   if ( draw_function )
11601160      draw_function( device, bitmap, cliprect, ma, ra, y, x_count, cursor_x, param );
r5932r5933
16851685      {  // ASIC secondary lower ROM selection (bit 5: 1 = enabled)
16861686         if ( asic.enabled )
16871687         {
1688//            logerror("L-ROM: Lower ROM enabled, cart bank %i\n", asic.rmr2 & 0x07 );
1688//              logerror("L-ROM: Lower ROM enabled, cart bank %i\n", asic.rmr2 & 0x07 );
16891689            bank_base = &memory_region(machine, "maincpu")[0x4000 * ( asic.rmr2 & 0x07 )];
16901690            switch( asic.rmr2 & 0x18 )
16911691            {
16921692            case 0x00:
1693//               logerror("L-ROM: located at &0000\n");
1693//                  logerror("L-ROM: located at &0000\n");
16941694               memory_set_bankptr(machine,1, bank_base);
16951695               memory_set_bankptr(machine,2, bank_base+0x02000);
16961696               break;
16971697            case 0x08:
1698//               logerror("L-ROM: located at &4000\n");
1698//                  logerror("L-ROM: located at &4000\n");
16991699               memory_set_bankptr(machine,3, bank_base);
17001700               memory_set_bankptr(machine,4, bank_base+0x02000);
17011701               break;
17021702            case 0x10:
1703//               logerror("L-ROM: located at &8000\n");
1703//                  logerror("L-ROM: located at &8000\n");
17041704               memory_set_bankptr(machine,5, bank_base);
17051705               memory_set_bankptr(machine,6, bank_base+0x02000);
17061706               break;
17071707            case 0x18:
1708//               logerror("L-ROM: located at &0000, ASIC registers enabled\n");
1708//                  logerror("L-ROM: located at &0000, ASIC registers enabled\n");
17091709               memory_set_bankptr(machine,1, bank_base);
17101710               memory_set_bankptr(machine,2, bank_base+0x02000);
17111711               break;
r5932r5933
17851785         Aleste_RamBanks[i] = BankAddr;
17861786         AmstradCPC_RamBanks[i] = BankAddr;
17871787      }
1788   }
1789   else
1788   }
1789   else
17901790   {/* Need to add the ram expansion configuration here ! */
17911791   }
17921792   amstrad_rethinkMemory(machine);
r5932r5933
18621862WRITE8_HANDLER( amstrad_plus_asic_4000_w )
18631863{
18641864   video_screen_update_partial( space->machine->primary_screen, video_screen_get_vpos( space->machine->primary_screen ) );
1865//   logerror("ASIC: Write to register at &%04x\n",offset+0x4000);
1865//  logerror("ASIC: Write to register at &%04x\n",offset+0x4000);
18661866   amstrad_plus_asic_ram[offset] = data & 0x0f;
18671867}
18681868
r5932r5933
18771877   }
18781878   if(offset == 0x0800)  // Programmable raster interrupt
18791879   {
1880//      logerror("ASIC: Wrote %02x to PRI\n",data);
1880//      logerror("ASIC: Wrote %02x to PRI\n",data);
18811881      asic.pri = data;
18821882   }
18831883   if(offset >= 0x0801 && offset <= 0x0803)  // Split screen registers
r5932r5933
20492049static void amstrad_GateArray_write(running_machine *machine, UINT8 dataToGateArray)
20502050{
20512051/* Get Bit 7 and 6 of the dataToGateArray = Gate Array function selected */
2052   switch ((dataToGateArray & 0xc0)>>6)
2052   switch ((dataToGateArray & 0xc0)>>6)
20532053   {
20542054/* Pen selection
20552055   -------------
r5932r5933
21322132      }
21332133
21342134      /* If bit 4 of the "Select screen mode and rom configuration" register of the Gate-Array is set to "1"
2135      then the interrupt request is cleared and the 6-bit counter is reset to "0".  */
2135        then the interrupt request is cleared and the 6-bit counter is reset to "0".  */
21362136      if ( gate_array.mrer & 0x10 )
21372137      {
21382138         amstrad_CRTC_HS_Counter = 0;
r5932r5933
22982298
22992299   unsigned char data = 0xFF;
23002300   unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8);
2301//   m6845_personality_t crtc_type;
2301//  m6845_personality_t crtc_type;
23022302   int page;
23032303
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);
23062306
23072307   if(aleste_mode & 0x04)
23082308   {
r5932r5933
23172317   /* if b14 = 0 : CRTC Read selected */
23182318   if ((offset & (1<<14)) == 0)
23192319   {
2320      switch(r1r0)
2320      switch(r1r0)
23212321      {
23222322      case 0x02:
23232323         data = mc6845_status_r( mc6845, 0 );
2324//         /* CRTC Type 1 : Read Status Register
2324//          /* CRTC Type 1 : Read Status Register
23252325//               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//          }
23372337         break;
23382338      case 0x03:
23392339         /* All CRTC type : Read from selected internal 6845 register Read only */
r5932r5933
25082508   }
25092509
25102510   /* 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    */
25172517   if ((offset & (1<<11)) == 0)
25182518   {
25192519      unsigned int Index = ((offset & 0x0300) >> 8);
r5932r5933
25512551            {
25522552            case 0x00:
25532553               /* 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.*/
25562556               floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), (data & 0x01));
25572557               floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), (data & 0x01));
25582558               floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1);
r5932r5933
25702570      }
25712571   }
25722572
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 */
25802580   if(offset == 0xfabf)
25812581   {
25822582      aleste_mode = data;
r5932r5933
26472647   RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8);
26482648
26492649   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, RegData);
2650//   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_SP, RegData);
2650//  cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_SP, RegData);
26512651
26522652   RegData = (pSnapshot[0x025] & 0x0ff);
26532653   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, RegData);
r5932r5933
28112811   }
28122812
28132813   /* multiface hardware enabled? */
2814   if (multiface_hardware_enabled(machine))
2814   if (multiface_hardware_enabled(machine))
28152815   {
28162816      multiface_rethink_memory(machine);
28172817   }
r5932r5933
28642864{
28652865   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
28662866   const device_config *ay8910 = devtag_get_device(machine, "ay");
2867   
2867
28682868   if(aleste_mode & 0x20)  // RTC selected
28692869   {
28702870      switch(aleste_rtc_function)
r5932r5933
29542954/* Set b7 with cassette tape input */
29552955   if(amstrad_system_type != SYSTEM_GX4000)
29562956   {
2957      if (cassette_input(devtag_get_device(device->machine, "cassette" )) > 0.03)
2957      if (cassette_input(devtag_get_device(device->machine, "cassette" )) > 0.03)
29582958      {
29592959         data |= (1<<7);
29602960      }
r5932r5933
30203020   /* b5 Cassette Write data */
30213021   if(amstrad_system_type != SYSTEM_GX4000)
30223022   {
3023      if ((changed_data & 0x20) != 0)
3023      if ((changed_data & 0x20) != 0)
30243024      {
30253025         cassette_output(devtag_get_device(device->machine, "cassette" ),
30263026            ((data & 0x20) ? -1.0 : +1.0));
r5932r5933
32993299   Amstrad_ROM_Table[7] = &rom[0x018000];
33003300   amstrad_common_init(machine);
33013301   amstrad_reset_machine(machine);
3302//   amstrad_init_palette(machine);
3302//  amstrad_init_palette(machine);
33033303
33043304   multiface_init(machine);
33053305
r5932r5933
35813581
35823582/*static DEVICE_IMAGE_LOAD( aleste )
35833583{
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;
35903590}*/
src/mess/machine/99_peb.h
r5932r5933
11/*
2   header file for machine/99_peb.c
2    header file for machine/99_peb.c
33*/
44
55/*
6   prototype for CRU handlers in expansion system
6    prototype for CRU handlers in expansion system
77*/
88typedef int (*cru_read_handler)(running_machine *machine, int offset);
99typedef void (*cru_write_handler)(running_machine *machine, int offset, int data);
1010
1111/*
12   Descriptor for TI peripheral expansion cards (8-bit bus)
12    Descriptor for TI peripheral expansion cards (8-bit bus)
1313*/
1414typedef struct ti99_peb_card_handlers_t
1515{
r5932r5933
2121} ti99_peb_card_handlers_t;
2222
2323/*
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.)
2727*/
2828typedef struct ti99_peb_16bit_card_handlers_t
2929{
r5932r5933
4444   inta_rs232_4_bit = 7-5,
4545
4646   /* extra "virtual" bits for devices that assert the INTA line without
47   setting a bit of the ILA register */
47    setting a bit of the ILA register */
4848   inta_ide_bit     = 8,
4949   inta_ide_clk_bit = 9,
5050
src/mess/machine/wd17xx.c
r5932r5933
4343        - Bugfix: busy flag was cleared too early
4444
4545    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.
5757
5858    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.
6262
6363    2009-July-08 Roberto Lavarone:
64   - Fixed a bug in head load flag handling: einstein and samcoupe now working again
64    - Fixed a bug in head load flag handling: einstein and samcoupe now working again
6565
6666    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.
6969
7070    TODO:
7171        - Multiple record write
r5932r5933
933933
934934   usecs = 12;
935935
936   /* set new timer */   
936   /* set new timer */
937937   timer_adjust_oneshot(w->timer, ATTOTIME_IN_USEC(usecs), MISCCALLBACK_COMMAND);
938938}
939939
src/mess/machine/sms.c
r5932r5933
851851      if (!strncmp((char*)&magic[0x7FF0], "TMR SEGA", 8))
852852      {
853853         /* 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            */
865865         retval = IMAGE_VERIFY_PASS;
866866      }
867867   }
868868
869869      /* Check at $81f0 also */
870870      //if (!retval) {
871    //    if (!strncmp(&magic[0x81f0], "TMR SEGA", 8)) {
871    // if (!strncmp(&magic[0x81f0], "TMR SEGA", 8)) {
872872            /* 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      //  }
884884      //}
885885
886886   return retval;
r5932r5933
991991   if (strcmp(image->tag,"cart4")==0)
992992   {
993993      index = 3;
994   }   
994   }
995995   if (strcmp(image->tag,"cart5")==0)
996996   {
997997      index = 4;
998   }   
998   }
999999   /* Check for 512-byte header */
10001000   if ((size / 512) & 1)
10011001   {
src/mess/machine/poly88.c
r5932r5933
2121static TIMER_CALLBACK(poly88_usart_timer_callback)
2222{
2323   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);
2525}
2626
2727WRITE8_HANDLER(poly_baud_rate_w)
r5932r5933
2929   logerror("poly_baud_rate_w %02x\n",data);
3030   poly88_usart_timer = timer_alloc(space->machine, poly88_usart_timer_callback, NULL);
3131   timer_adjust_periodic(poly88_usart_timer, attotime_zero, 0, ATTOTIME_IN_HZ(300));
32   
32
3333}
3434
3535static UINT8 row_number(UINT8 code) {
r5932r5933
4040   if BIT(code,4) return 4;
4141   if BIT(code,5) return 5;
4242   if BIT(code,6) return 6;
43   if BIT(code,7) return 7;   
43   if BIT(code,7) return 7;
4444   return 0;
4545}
4646
4747static TIMER_CALLBACK(keyboard_callback)
4848{
4949   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6" };
50   
50
5151   int i;
5252   UINT8 code;
5353   UINT8 key_code = 0;
5454   UINT8 shift = input_port_read(machine, "LINEC") & 0x02 ? 1 : 0;
5555   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++)
5858   {
59     
59
6060      code =    input_port_read(machine, keynames[i]);
61      if (code != 0)
61      if (code != 0)
6262      {
6363         if (i==0 && shift==0) {
6464            key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs
r5932r5933
107107            key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl
108108         }
109109         if (i==6) {
110            switch(row_number(code))
110            switch(row_number(code))
111111            {
112112               case 0: key_code = 0x11; break;
113113               case 1: key_code = 0x12; break;
r5932r5933
121121         }
122122      }
123123   }
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);
127127   } else {
128128      last_code = key_code;
129129   }
130130}
131131
132132static IRQ_CALLBACK (poly88_irq_callback)
133{   
133{
134134   return int_vector;
135135}
136136
r5932r5933
151151   static int clk_level_tape = 1;
152152
153153
154//   if (!(input_port_read(machine, "DSW0") & 0x02))   /* V.24 / Tape Switch */
154//  if (!(input_port_read(machine, "DSW0") & 0x02)) /* V.24 / Tape Switch */
155155   //{
156156      /* tape reading */
157157      if (cassette_get_state(devtag_get_device(machine, "cassette"))&CASSETTE_PLAY)
r5932r5933
177177                  }
178178               }
179179      }
180     
180
181181      /* tape writing */
182182      if (cassette_get_state(devtag_get_device(machine, "cassette"))&CASSETTE_RECORD)
183183      {
r5932r5933
198198      if (!clk_level)
199199         msm8251_transmit_clock(devtag_get_device(machine, "uart"));
200200      clk_level = clk_level ? 0 : 1;
201//   }
201//  }
202202}
203203
204204
205static TIMER_CALLBACK( setup_machine_state )
205static TIMER_CALLBACK( setup_machine_state )
206206{
207207   msm8251_connect(devtag_get_device(machine, "uart"), &poly88_cassette_serial_connection);
208208}
r5932r5933
217217}
218218
219219MACHINE_RESET(poly88)
220{   
220{
221221   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), poly88_irq_callback);
222222   timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback);
223223   intr = 0;
224224   last_code = 0;
225     
225
226226   timer_set(machine,  attotime_zero, NULL, 0, setup_machine_state );
227227}
228228
229229INTERRUPT_GEN( poly88_interrupt )
230230{
231231   int_vector = 0xf7;
232   cpu_set_input_line(device, 0, HOLD_LINE);   
232   cpu_set_input_line(device, 0, HOLD_LINE);
233233}
234234static void poly88_usart_rxready (const device_config *device, int state)
235235{
236236   //int_vector = 0xe7;
237   //cpu_set_input_line(device, 0, HOLD_LINE);   
237   //cpu_set_input_line(device, 0, HOLD_LINE);
238238}
239239const msm8251_interface poly88_usart_interface=
240240{
r5932r5933
264264   UINT16 recordLen;
265265   UINT16 address;
266266   UINT8  recordType;
267   
267
268268   int pos = 0x300;
269269   char name[9];
270270   int i = 0;
271271   int theend = 0;
272272
273273   image_fread(image, data, snapshot_size);
274     
274
275275   while (pos<snapshot_size) {
276276      for(i=0;i<9;i++) {
277277         name[i] = (char) data[pos + i];
278      }
278      }
279279      pos+=8;
280280      name[8] = 0;
281     
282     
281
282
283283      recordNum = data[pos]+ data[pos+1]*256; pos+=2;
284      recordLen = data[pos]; pos++;
284      recordLen = data[pos]; pos++;
285285      if (recordLen==0) recordLen=0x100;
286286      address = data[pos] + data[pos+1]*256; pos+=2;
287287      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);
290290      switch(recordType) {
291291         case 0 :
292292               /* 00 Absolute */
293293               memcpy(memory_get_read_ptr(space,address ), data + pos ,recordLen);
294294               break;
295         case 1 :
295         case 1 :
296296               /* 01 Comment */
297297               break;
298298         case 2 :
299299               /* 02 End */
300300               theend = 1;
301301               break;
302         case 3 :     
302         case 3 :
303303                /* 03 Auto Start @ Address */
304304                cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), I8085_PC, address);
305305                theend = 1;
306306                break;
307          case 4 :
307          case 4 :
308308                /* 04 Data ( used by Assembler ) */
309309                logerror("ASM load unsupported\n");
310310                theend = 1;
311311                break;
312          case 5 :
312          case 5 :
313313                /* 05 BASIC program file */
314314                logerror("BASIC load unsupported\n");
315315                theend = 1;
r5932r5933
319319                theend = 1;
320320               break;
321321         default: break;
322       }     
323             
322       }
323
324324      if (theend) {
325325         break;
326326      }
327327      pos+=recordLen;
328   }   
328   }
329329   device_reset(devtag_get_device(image->machine, "uart"));
330330   return INIT_PASS;
331331}
src/mess/machine/llc.c
r5932r5933
1616static UINT8 llc1_key_state = 0;
1717
1818static READ8_DEVICE_HANDLER (llc1_port_b_r)
19{   
19{
2020   UINT8 retVal = 0;
2121   if (code!=0) {
2222      if (llc1_key_state==0) {
r5932r5933
2727            llc1_key_state = 2;
2828            retVal = 0;
2929         } else {
30            llc1_key_state = 0;           
30            llc1_key_state = 0;
3131            retVal = code;
3232            code =0;
3333         }
r5932r5933
4141
4242static READ8_DEVICE_HANDLER (llc1_port_a_r)
4343{
44   return 0;   
44   return 0;
4545}
4646
4747
r5932r5933
7272{
7373   int i,j;
7474   UINT8 c;
75   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4",
75   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4",
7676      "LINE5", "LINE6", "LINE7", "LINE8", "LINE9", "LINE10", "LINE11" };
7777
78   for(i = 0; i < 12; i++)
78   for(i = 0; i < 12; i++)
7979   {
8080      c = input_port_read(machine, keynames[i]);
81      if (c != 0)
81      if (c != 0)
8282      {
83         for(j = 0; j < 8; j++)
83         for(j = 0; j < 8; j++)
8484         {
85            if (c == (1 << j))
85            if (c == (1 << j))
8686            {
8787               code = j + i*8;
8888               break;
8989            }
90         }         
90         }
9191      }
9292   }
9393}
9494
9595/* Driver initialization */
9696DRIVER_INIT(llc1)
97{   
97{
9898}
9999
100100MACHINE_RESET( llc1 )
r5932r5933
114114MACHINE_RESET( llc2 )
115115{
116116   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
117   
117
118118   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
119119   memory_set_bankptr(machine, 1, memory_region(machine, "maincpu"));
120   
120
121121   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);
123123
124124   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);
126126
127127   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);
129129
130130}
131131
132132WRITE8_HANDLER( llc2_rom_disable_w )
133{   
133{
134134   const address_space *mem_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
135   
135
136136   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);
138138
139139   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);
141141
142142   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);
144144
145145   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);
147147
148148}
149149
r5932r5933
153153   const address_space *mem_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
154154   if (data & 0x02) {
155155      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);
157157   } else {
158158      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);
160160   }
161   
161
162162}
163163static READ8_DEVICE_HANDLER (llc2_port_b_r)
164{   
164{
165165   return 0;
166166}
167167
r5932r5933
174174   if (BIT(val,5)) return 6;
175175   if (BIT(val,6)) return 7;
176176   if (BIT(val,7)) return 8;
177   return 0;         
177   return 0;
178178}
179179static READ8_DEVICE_HANDLER (llc2_port_a_r)
180{   
180{
181181   UINT8 *k7659 = memory_region(device->machine, "k7659");
182182   UINT8 retVal = 0;
183183   UINT8 a1 = input_port_read(device->machine, "A1");
r5932r5933
213213      code = 0x90 + key_pos(a10);
214214   } else if (a11!=0) {
215215      code = 0xA0 + key_pos(a11);
216   }   
217   if (code!=0) {           
216   }
217   if (code!=0) {
218218      if (BIT(a8,6) || BIT(a8,7)) {
219219         code |= 0x100;
220220      } else if (BIT(a12,6)) {
221221         code |= 0x200;
222222      }
223223      retVal = k7659[code] | 0x80;
224   }
225   return retVal;   
224   }
225   return retVal;
226226}
227227
228228
src/mess/machine/rp5c01a.c
r5932r5933
11/**********************************************************************
22
3   Ricoh RP5C01A Real Time Clock With Internal RAM emulation
3    Ricoh RP5C01A Real Time Clock With Internal RAM emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88*********************************************************************/
99
1010/*
1111
12   TODO:
12    TODO:
1313
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
2020
2121*/
2222
r5932r5933
7979   UINT8 reg[4][13];         /* clock registers */
8080
8181   UINT8 mode;               /* mode register */
82   
82
8383   /* timers */
8484   emu_timer *clock_timer;
8585   emu_timer *alarm_timer;
r5932r5933
114114
115115WRITE_LINE_DEVICE_HANDLER( rp5c01a_adj_w )
116116{
117//   rp5c01a_t *rp5c01a = get_safe_token(device);
117//  rp5c01a_t *rp5c01a = get_safe_token(device);
118118
119119}
120120
src/mess/machine/z1013.c
r5932r5933
2121
2222WRITE8_DEVICE_HANDLER(z1013_z80pio_w)
2323{
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
2727      z80pio_c_w(device, offset >> 1, data);
2828}
2929
r5932r5933
4444}
4545
4646static READ8_DEVICE_HANDLER (z1013_port_b_r)
47{   
47{
4848   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3",
4949      "LINE4", "LINE5", "LINE6", "LINE7" };
5050   UINT8 data = input_port_read(device->machine, keynames[z1013_keyboard_line & 7]);
r5932r5933
7171};
7272
7373static READ8_DEVICE_HANDLER (z1013k7659_port_b_r)
74{   
74{
7575   return 0xff;
7676}
7777
r5932r5933
7979{
8080   DEVCB_NULL,   /* callback when change interrupt status */
8181   DEVCB_NULL,
82   DEVCB_HANDLER(z1013k7659_port_b_r),   
82   DEVCB_HANDLER(z1013k7659_port_b_r),
8383   DEVCB_NULL,
8484   DEVCB_NULL,
8585   DEVCB_NULL,
r5932r5933
9898   runaddr   = data[4] + data[5]*256;
9999   if (data[12]!='C') return INIT_FAIL;
100100   if (data[13]!=0xD3 || data[14]!=0xD3 || data[14]!=0xD3) return INIT_FAIL;
101     
101
102102   memcpy (memory_get_read_ptr(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM),  startaddr ),
103103       data+0x20, endaddr - startaddr + 1);
104104
src/mess/machine/comx35.c
r5932r5933
88
99F-001-EB-REV0
1010
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   -       |
2727|-------------------------------------------|
2828
2929Notes:
3030    All IC's shown.
3131
3232    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
3939
4040*/
4141
r5932r5933
4949
5050F-001-FD-REV0
5151
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                                            |
6464|-----------------------------------------------|
6565
6666Notes:
6767    All IC's shown.
6868
6969    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
7575
7676*/
7777
r5932r5933
8585
8686F-003-CLM-REV 1
8787
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                       |
100100|-----------------------------------------------|
101101
102102Notes:
103103    All IC's shown.
104104
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
107107    ROM1    - Mitsubishi 2Kx8 EPROM "C"
108108    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
114114
115115*/
116116
r5932r5933
239239   const device_config *fdc = devtag_get_device(space->machine, WD1770_TAG);
240240   /*
241241
242      bit      description
242        bit     description
243243
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
250250
251   */
251    */
252252
253253   comx35_state *state = space->machine->driver_data;
254254
r5932r5933
261261      if (BIT(data, 2))
262262      {
263263         wd17xx_set_drive(fdc,0);
264      }     
264      }
265265      else if (BIT(data, 3))
266266      {
267267         wd17xx_set_drive(fdc,1);
r5932r5933
288288
289289static UINT8 printer_r(running_machine *machine)
290290{
291//   comx35_state *state = machine->driver_data;
291//  comx35_state *state = machine->driver_data;
292292
293293   int printer = input_port_read(machine, "PRINTER") & 0x07;
294294   UINT8 data = 0;
r5932r5933
298298   case PRINTER_PARALLEL:
299299   case PRINTER_PLOTTER:
300300      /*
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        */
307307
308308      data = 0x06;
309309      break;
310310
311311   case PRINTER_SERIAL:
312312      /*
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        */
315315      break;
316316
317317   case PRINTER_THERMAL:
318318      /*
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        */
324324      break;
325325   }
326326
r5932r5933
329329
330330static void printer_w(running_machine *machine, UINT8 data)
331331{
332//   comx35_state *state = machine->driver_data;
332//  comx35_state *state = machine->driver_data;
333333   int printer = input_port_read(machine, "PRINTER") & 0x07;
334334
335335   switch (printer)
r5932r5933
337337   case PRINTER_PARALLEL:
338338   case PRINTER_PLOTTER:
339339      /*
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        */
342342
343343      printer_output(printer_device(machine), data);
344344      break;
345345
346346   case PRINTER_SERIAL:
347347      /*
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        */
350350      break;
351351
352352   case PRINTER_THERMAL:
353353      /*
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        */
360360      break;
361361   }
362362}
r5932r5933
647647   }
648648
649649   /* allocate reset timer */
650   
650
651651   state->reset_timer = timer_alloc(machine, reset_tick, NULL);
652652
653653   /* screen format */
r5932r5933
740740   case COMX_TYPE_BINARY:
741741      /*
742742
743         Type 1: pure machine code (i.e. no basic)
743            Type 1: pure machine code (i.e. no basic)
744744
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
749749
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.
752752
753      */
753        */
754754      {
755755         UINT16 start_address, end_address, run_address;
756         
756
757757         image_fread(image, header, 6);
758758
759759         start_address = header[0] << 8 | header[1];
r5932r5933
769769   case COMX_TYPE_BASIC:
770770      /*
771771
772         Type 2: Regular basic code or machine code followed by basic
772            Type 2: Regular basic code or machine code followed by basic
773773
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
780780
781         Byte 15 to Eof to be stored on 0x4400 and onwards
781            Byte 15 to Eof to be stored on 0x4400 and onwards
782782
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.
785785
786      */
786        */
787787
788788      image_fread_memory(image, 0x4281, 4);
789789      image_fread_memory(image, 0x4292, 4);
r5932r5933
794794   case COMX_TYPE_BASIC_FM:
795795      /*
796796
797         Type 3: F&M basic load
797            Type 3: F&M basic load
798798
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.
805805
806      */
806        */
807807
808808      image_fread_memory(image, 0x4281, 4);
809809      image_fread_memory(image, 0x4292, 4);
r5932r5933
814814   case COMX_TYPE_RESERVED:
815815      /*
816816
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.
819819
820      */
820        */
821821      break;
822822
823823   case COMX_TYPE_DATA:
824824      /*
825825
826         Type 5: Data load
826            Type 5: Data load
827827
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'
831831
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.
838838
839      */
839        */
840840      {
841841         UINT16 start_array, end_array, start_string, array_length;
842842
r5932r5933
848848
849849         memory_write_byte(program, 0x4299, end_array >> 8);
850850         memory_write_byte(program, 0x429a, end_array & 0xff);
851         
851
852852         start_string = start_array + array_length;
853853
854854         memory_write_byte(program, 0x4292, start_string >> 8);
src/mess/machine/trs80.c
r5932r5933
7070static TIMER_CALLBACK( cassette_data_callback )
7171{
7272/* This does all baud rates. 250 baud (trs80), and 500 baud (all others) set bit 7 of "cassette_data".
73   1500 baud (trs80m3, trs80m4) is interrupt-driven and uses bit 0 of "cassette_data" */
73    1500 baud (trs80m3, trs80m4) is interrupt-driven and uses bit 0 of "cassette_data" */
7474
7575   static double old_cassette_val;
7676   double new_val = cassette_input(trs80_cass);
r5932r5933
169169
170170/*************************************
171171 *
172 *            Port handlers.
172 *              Port handlers.
173173 *
174174 *************************************/
175175
r5932r5933
177177READ8_HANDLER( trs80m4_e0_r )
178178{
179179/* 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.
184184
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 */
192192
193193   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
194194   return ~(trs80_mask & trs80_int);
r5932r5933
197197READ8_HANDLER( trs80m4_e4_r )
198198{
199199/* 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.
204204
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) */
208208
209209   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
210210
r5932r5933
214214READ8_HANDLER( trs80m4_e8_r )
215215{
216216/* 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) */
223223
224224   return 0;
225225}
226226
227227READ8_HANDLER( trs80m4_ea_r )
228228{
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 */
236236
237237   UINT8 data=7;
238238   ay31015_set_input_pin( trs80_ay31015, AY31015_SWE, 0 );
r5932r5933
265265READ8_HANDLER( sys80_f9_r )
266266{
267267/* 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 */
276276
277277   UINT8 data=70;
278278   ay31015_set_input_pin( trs80_ay31015, AY31015_SWE, 0 );
r5932r5933
294294READ8_HANDLER( trs80_ff_r )
295295{
296296/* ModeSel and cassette data
297   d7 cassette data from tape
298   d2 modesel setting */
297    d7 cassette data from tape
298    d2 modesel setting */
299299
300300   UINT8 data = (~trs80_mode & 1) << 5;
301301   return data | cassette_data;
r5932r5933
304304READ8_HANDLER( trs80m4_ff_r )
305305{
306306/* 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 */
310310
311311   trs80_int &= 0xfc;   /* clear cassette interrupts */
312312
r5932r5933
317317WRITE8_HANDLER( trs80m4_84_w )
318318{
319319/* 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 */
328328
329329   /* get address space instead of io space */
330330   const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5932r5933
458458WRITE8_HANDLER( trs80m4p_9c_w )      /* model 4P only - swaps the ROM with read-only RAM */
459459{
460460   /* 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) */
466466
467467   /* get address space instead of io space */
468468   const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5932r5933
481481            memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu"));
482482            break;
483483      }
484   }
484   }
485485}
486486
487487WRITE8_HANDLER( trs80m4_e0_w )
488488{
489489/* 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 */
497497
498498   trs80_mask = data;
499499}
r5932r5933
501501WRITE8_HANDLER( trs80m4_e4_w )
502502{
503503/* 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 */
506506
507507   trs80_nmi_mask = data;
508508}
r5932r5933
517517WRITE8_HANDLER( trs80m4_e9_w )
518518{
519519/* 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 */
536536
537537   int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 };
538538   ay31015_set_receiver_clock( trs80_ay31015, baud_clock[data & 0x0f]);
r5932r5933
544544   if (trs80_reg_load)
545545
546546/* 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 */
557557
558558   {
559559      ay31015_set_input_pin( trs80_ay31015, AY31015_CS, 0 );
r5932r5933
568568   {
569569
570570/* 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 */
578578
579579   }
580580}
r5932r5933
587587WRITE8_HANDLER( trs80m4_ec_w )
588588{
589589/* 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) */
596596
597597   cputag_set_clock(space->machine, "maincpu", data & 0x40 ? MODEL4_MASTER_CLOCK/5 : MODEL4_MASTER_CLOCK/10);
598598
r5932r5933
608608/* Selection of drive and parameters - d6..d5 not emulated.
609609 A write also causes the selected drive motor to turn on for about 3 seconds.
610610 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 */
619619
620620   UINT8 drive = 255;
621621
r5932r5933
645645WRITE8_HANDLER( sys80_f8_w )
646646{
647647/* 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 */
651651}
652652
653653WRITE8_HANDLER( sys80_fe_w )
654654{
655655/* not emulated
656   d4 select internal or external cassette player */
656    d4 select internal or external cassette player */
657657
658658   trs80_tape_unit = (data & 0x10) ? 2 : 1;
659659}
r5932r5933
662662WRITE8_HANDLER( lnw80_fe_w )
663663{
664664/* 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) */
669669
670670   /* get address space instead of io space */
671671   const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5932r5933
696696WRITE8_HANDLER( trs80_ff_w )
697697{
698698/* 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 */
702702
703703   static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 };
704704
r5932r5933
716716WRITE8_HANDLER( trs80m4_ff_w )
717717{
718718/* Cassette port
719   d1, d0 Cassette output */
719    d1, d0 Cassette output */
720720
721721   static const double levels[4] = { 0.0, -1.0, 0.0, 1.0 };
722722   cassette_output( trs80_cass, levels[data & 3]);
r5932r5933
726726
727727/*************************************
728728 *
729 *      Interrupt handlers.
729 *      Interrupt handlers.
730730 *
731731 *************************************/
732732
733733INTERRUPT_GEN( trs80_rtc_interrupt )
734734{
735735/* 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. */
738738
739739   if (trs80_model4)   // Model 4
740740   {
r5932r5933
797797
798798
799799/*************************************
800 *                 *
801 *      Memory handlers      *
802 *                 *
800 *                   *
801 *      Memory handlers      *
802 *                   *
803803 *************************************/
804804
805805READ8_DEVICE_HANDLER (trs80_wd179x_r)
r5932r5933
813813READ8_HANDLER ( trs80_printer_r )
814814{
815815   /* 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 */
820820
821821   UINT8 data = 0;
822822   data |= centronics_busy_r(trs80_printer) << 7;
r5932r5933
837837WRITE8_HANDLER( trs80_cassunit_w )
838838{
839839/* not emulated
840   01 for unit 1 (default
841   02 for unit 2 */
840    01 for unit 1 (default
841    02 for unit 2 */
842842
843843   trs80_tape_unit = data;
844844}
r5932r5933
846846READ8_HANDLER( trs80_irq_status_r )
847847{
848848/* (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. */
854854
855855   int result = trs80_int;
856856   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
r5932r5933
884884      head = 0;
885885      break;
886886   /* These 3 combinations aren't official. Some manufacturers of double-sided disks
887      used drive select 4 to indicate the other side. */
887        used drive select 4 to indicate the other side. */
888888   case 9:
889889      drive = 0;
890890      head = 1;
r5932r5933
908908}
909909
910910/*************************************
911 *      Keyboard        *
911 *      Keyboard         *
912912 *************************************/
913913READ8_HANDLER( trs80_keyboard_r )
914914{
r5932r5933
936936
937937
938938/*************************************
939 *   Machine              *
939 *  Machine              *
940940 *************************************/
941941
942942MACHINE_RESET( trs80 )
src/mess/machine/rp5c01a.h
r5932r5933
11/**********************************************************************
22
3   Ricoh RP5C01A Real Time Clock With Internal RAM emulation
3    Ricoh RP5C01A Real Time Clock With Internal RAM emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
1919
2020**********************************************************************/
2121
src/mess/machine/odyssey2.c
r5932r5933
105105   else if (!(p1 & P1_EXT_RAM_ENABLE)) {
106106      return ram[offset];
107107   } else {
108//      return ef9341_r( offset & 0x02, offset & 0x01 );
108//      return ef9341_r( offset & 0x02, offset & 0x01 );
109109   }
110110
111111   return 0;
r5932r5933
119119   else if (!(p1 & P1_VDC_ENABLE)) {
120120      odyssey2_video_w(space, offset, data);
121121   } else {
122//      ef9341_w( offset & 0x02, offset & 0x01, data );
122//      ef9341_w( offset & 0x02, offset & 0x01, data );
123123   }
124124}
125125
src/mess/machine/tandy1t.c
r5932r5933
5555{
5656   if (!eeprom.clock && (data&4) )
5757   {
58//            logerror("!!!tandy1000 eeprom %.2x %.2x\n",eeprom.state, data);
58//              logerror("!!!tandy1000 eeprom %.2x %.2x\n",eeprom.state, data);
5959      switch (eeprom.state)
6060      {
6161      case 0:
r5932r5933
165165
166166WRITE8_HANDLER ( pc_t1t_p37x_w )
167167{
168//   DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", cpu_get_pc( space->cpu),offset, data));
168//  DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", cpu_get_pc( space->cpu),offset, data));
169169   if (offset!=4)
170170      logerror("T1T_p37x_w %.5x #%d $%02x\n", cpu_get_pc( space->cpu),offset, data);
171171   tandy.data[offset]=data;
r5932r5933
180180 READ8_HANDLER ( pc_t1t_p37x_r )
181181{
182182   int data = tandy.data[offset];
183//   DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", cpu_get_pc( space->cpu), offset, data));
183//  DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", cpu_get_pc( space->cpu), offset, data));
184184    return data;
185185}
186186
r5932r5933
213213      break;
214214   case 2:
215215      tandy_ppi.portc = data;
216      if (data & 8)
216      if (data & 8)
217217         cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 1);
218218      else
219219         cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 4.77/8);
r5932r5933
233233      data=tandy_ppi.portb;
234234      break;
235235   case 2:
236//      if (tandy1000hx) {
237//      data=tandy_ppi.portc; // causes problems (setuphx)
236//      if (tandy1000hx) {
237//      data=tandy_ppi.portc; // causes problems (setuphx)
238238      if (!tandy1000_read_eeprom()) data&=~0x10;
239//   }
239//  }
240240      break;
241241   }
242242   return data;
r5932r5933
369369   PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) /* F9                          43  C3 */
370370   PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) /* F10                         44  C4 */
371371   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) /*                           46  C6 */
372   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Hold") PORT_CODE(KEYCODE_SCRLOCK) /*                           46  C6 */
373373   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 7 \\") PORT_CODE(KEYCODE_7_PAD) /* Keypad 7                    47  C7 */
374374   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 8 ~") PORT_CODE(KEYCODE_8_PAD) /* Keypad 8                    48  C8 */
375375   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 9 (PgUp)") PORT_CODE(KEYCODE_9_PAD) /* Keypad 9  (PgUp)            49  C9 */
src/mess/machine/primo.c
r5932r5933
11/*******************************************************************************
22
3   primo.c
3    primo.c
44
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)
77
8   Krzysztof Strzecha
8    Krzysztof Strzecha
99
1010*******************************************************************************/
1111
r5932r5933
3131
3232/*******************************************************************************
3333
34   Interrupt callback
34    Interrupt callback
3535
3636*******************************************************************************/
3737
r5932r5933
4343
4444/*******************************************************************************
4545
46   Memory banking
46    Memory banking
4747
4848*******************************************************************************/
4949
r5932r5933
7474
7575/*******************************************************************************
7676
77   IO read/write handlers
77    IO read/write handlers
7878
7979*******************************************************************************/
8080
r5932r5933
120120      data &= ~0x10;
121121
122122   // bit 3 - SRQ
123//   data &= (!cbm_serial_request_read(serbus, 0)) ? ~0x08 : ~0x00;
123//  data &= (!cbm_serial_request_read(serbus, 0)) ? ~0x08 : ~0x00;
124124
125125   // bit 2 - joystic 2 (not implemeted yet)
126126
r5932r5933
198198
199199   if (data & 0x04)
200200      logerror ("SRQ WRITE\n");
201//   logerror ("IOW KI-2 data:%02x\n", data);
201//  logerror ("IOW KI-2 data:%02x\n", data);
202202}
203203
204204WRITE8_HANDLER( primo_FD_w )
r5932r5933
212212
213213/*******************************************************************************
214214
215   Driver initialization
215    Driver initialization
216216
217217*******************************************************************************/
218218
r5932r5933
241241
242242/*******************************************************************************
243243
244   Machine initialization
244    Machine initialization
245245
246246*******************************************************************************/
247247
r5932r5933
268268
269269/*******************************************************************************
270270
271   Snapshot files (.pss)
271    Snapshot files (.pss)
272272
273273*******************************************************************************/
274274
r5932r5933
337337
338338/*******************************************************************************
339339
340   Quicload files (.pp)
340    Quicload files (.pp)
341341
342342*******************************************************************************/
343343
src/mess/machine/ti85.c
r5932r5933
193193         memory_set_bankptr(machine, 3, ti8x_ram + 0x004000*(ti8x_memory_page_2&0x01));
194194         memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, SMH_BANK(3));
195195      }
196     
196
197197   }
198198   else
199199   {
r5932r5933
399399
400400      if (ti_calculator_model == TI_83p)
401401         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
405405      ti_calculator_model = TI_83p;
406406
407407      timer_pulse(machine, ATTOTIME_IN_HZ(200), NULL, 0, ti85_timer_callback);
r5932r5933
549549{
550550    UINT8* ti82_video;
551551   UINT8 ti82_port11;
552   
552
553553   if(ti82_video_dir == 4)
554554      ++ti82_video_y;
555555   if(ti82_video_dir == 5)
r5932r5933
563563      ti82_port11 = ti82_video_buffer[(12*ti82_video_y)+ti82_video_x];
564564   else
565565   {
566      ti82_video_col = ti82_video_x * 6;                                                                                               
566      ti82_video_col = ti82_video_x * 6;
567567      ti82_video_bit = ti82_video_col & 7;
568568      ti82_video = &ti82_video_buffer[(ti82_video_y*12)+(ti82_video_col>>3)];
569569      ti82_port11 = ((((*ti82_video)<<8)+ti82_video[1])>>(10-ti82_video_bit));
r5932r5933
601601
602602 READ8_HANDLER ( ti83_port_0002_r )
603603{
604   return ti8x_port2;
604   return ti8x_port2;
605605}
606606
607607 READ8_HANDLER ( ti83_port_0003_r )
r5932r5933
621621
622622 READ8_HANDLER ( ti83p_port_0002_r )
623623{
624   return ti8x_port2|3;
624   return ti8x_port2|3;
625625}
626626
627627WRITE8_HANDLER ( ti81_port_0007_w )
r5932r5933
648648{
649649   if (ti85_LCD_status && !(data&0x08))   ti85_timer_interrupt_mask = 0;
650650   ti85_ON_interrupt_mask = data&0x01;
651//   ti85_timer_interrupt_mask = data&0x04;
651//  ti85_timer_interrupt_mask = data&0x04;
652652   ti85_LCD_mask = data&0x02;
653653   ti85_LCD_status = data&0x08;
654654}
r5932r5933
706706}
707707
708708WRITE8_HANDLER ( ti82_port_0010_w)
709 {   
709 {
710710   if (data == 0x00 || data == 0x01)
711711      ti82_video_mode = data;
712712   if (data >= 0x04 && data <= 0x07)
r5932r5933
724724WRITE8_HANDLER ( ti82_port_0011_w )
725725{
726726   UINT8* ti82_video;
727   
727
728728   if(ti82_video_mode)
729729      ti82_video_buffer[(12*ti82_video_y)+ti82_video_x] = data;
730730   else
731731   {
732732      data = data<<0x02;
733      ti82_video_col = ti82_video_x * 6;                                                                                               
733      ti82_video_col = ti82_video_x * 6;
734734      ti82_video_bit = ti82_video_col & 0x07;
735735      ti82_video = &ti82_video_buffer[(ti82_video_y*12)+(ti82_video_col>>3)];
736736      *ti82_video = (*ti82_video & ~(0xFC>>ti82_video_bit)) | (data>>ti82_video_bit);
r5932r5933
746746      --ti82_video_x;
747747   if(ti82_video_dir == 0x07)
748748      ++ti82_video_x;
749   
749
750750   ti82_video_x &= 15;
751751   ti82_video_y &= 63;
752752}
r5932r5933
754754WRITE8_HANDLER ( ti83_port_0000_w )
755755{
756756   ti8x_memory_page_1 = (ti8x_memory_page_1 & 7) | ((data & 16) >> 1);
757   update_ti85_memory(space->machine);   
757   update_ti85_memory(space->machine);
758758}
759759
760760WRITE8_HANDLER ( ti83_port_0002_w )
r5932r5933
765765}
766766
767767WRITE8_HANDLER ( ti83_port_0003_w )
768{   
768{
769769      if (ti85_LCD_status && !(data&0x08))   ti85_timer_interrupt_mask = 0;
770770      ti85_ON_interrupt_mask = data&0x01;
771771      //ti85_timer_interrupt_mask = data&0x04;
r5932r5933
813813}
814814
815815WRITE8_HANDLER ( ti83p_port_0010_w)
816 {   
816 {
817817   if (data == 0x00 || data == 0x01)
818818      ti82_video_mode = data;
819819   if (data == 0x02 || data == 0x03)
r5932r5933
828828      ti82_video_y = data - 0x80;
829829   if (data >= 0xc8)
830830      ti85_LCD_contrast = data - 0xc8;
831     
831
832832}
833833
834834/* NVRAM functions */
src/mess/machine/svi318.c
r5932r5933
633633
634634   svi.bank_switch = 0xff;
635635   svi318_set_banks(machine);
636   
636
637637   for(drive=0;drive<2;drive++)
638638   {
639639      floppy_install_load_proc(floppy_get_device(machine, drive), svi318_load_proc);
src/mess/machine/msm58321.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - count
15   - stop
16   - reset
17   - reference registers
14    - count
15    - stop
16    - reset
17    - reference registers
1818
1919*/
2020
r5932r5933
257257}
258258
259259/*-------------------------------------------------
260    msm58321_address_write_w - adddress write
261   handshake
260    msm58321_address_write_w - adddress write
261    handshake
262262-------------------------------------------------*/
263263
264264WRITE_LINE_DEVICE_HANDLER( msm58321_address_write_w )
r5932r5933
276276
277277WRITE_LINE_DEVICE_HANDLER( msm58321_stop_w )
278278{
279//   msm58321_t *msm58321 = get_safe_token(device);
279//  msm58321_t *msm58321 = get_safe_token(device);
280280
281281   if (LOG) logerror("MSM58321 '%s' STOP: %u\n", device->tag, state);
282282}
r5932r5933
287287
288288WRITE_LINE_DEVICE_HANDLER( msm58321_test_w )
289289{
290//   msm58321_t *msm58321 = get_safe_token(device);
290//  msm58321_t *msm58321 = get_safe_token(device);
291291
292292   if (LOG) logerror("MSM58321 '%s' TEST: %u\n", device->tag, state);
293293}
src/mess/machine/msm58321.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
1818
1919**********************************************************************/
2020
src/mess/machine/amstr_pc.c
r5932r5933
4949   fc818
5050   fc87d display amstrad ..
5151    fca17 keyboard check
52    fca69
53    fd680
52     fca69
53     fd680
5454      fd7f9
55    fca7b !keyboard interrupt routine for this check
55    fca7b !keyboard interrupt routine for this check
5656 */
5757
5858
r5932r5933
8484   fc5fa
8585    the following when language selection not 0 (test for presence of 0x80000..0x9ffff ram)
8686    fc60e
87   fc667
87    fc667
8888   fc678
8989   fc6e5
9090   fc72e
src/mess/machine/i8155.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - strobed mode
14    - strobed mode
1515
1616*/
1717
r5932r5933
330330WRITE8_DEVICE_HANDLER( i8155_w )
331331{
332332   i8155_t *i8155 = get_safe_token(device);
333   
333
334334   switch (offset & 0x07)
335335   {
336336   case I8155_REGISTER_COMMAND:
src/mess/machine/i8155.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3030
3131**********************************************************************/
3232
src/mess/machine/mm74c922.c
r5932r5933
99
1010/*
1111
12   TODO:
13   
14   - update frequency from interface capacitor value
15   - debounce from interface capacitor value
12    TODO:
1613
14    - update frequency from interface capacitor value
15    - debounce from interface capacitor value
16
1717*/
1818
1919#include "driver.h"
r5932r5933
7373
7474/*-------------------------------------------------
7575    change_output_lines - change output line
76   state
76    state
7777-------------------------------------------------*/
7878
7979static void change_output_lines(const device_config *device)
r5932r5933
9292
9393/*-------------------------------------------------
9494    clock_scan_counters - clock the keyboard
95   scan counters
95    scan counters
9696-------------------------------------------------*/
9797
9898static void clock_scan_counters(const device_config *device)
src/mess/machine/galaxy.c
r5932r5933
2020{
2121   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" };
2222
23   if (offset == 0)
23   if (offset == 0)
2424   {
2525      double level = cassette_input(devtag_get_device(space->machine, "cassette"));
2626      return (level >  0) ? 0xfe : 0xff;
27   }
28   else
27   }
28   else
2929   {
3030      return input_port_read(space->machine, keynames[(offset>>3) & 0x07]) & (0x01<<(offset & 0x07)) ? 0xfe : 0xff;
3131   }
r5932r5933
3434UINT8 gal_latch_value = 0;
3535
3636WRITE8_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;
3939   gal_latch_value = data;
4040   cassette_output(devtag_get_device(space->machine, "cassette"), val);
4141}
r5932r5933
176176MACHINE_RESET( galaxy )
177177{
178178   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
179   
179
180180   /* ROM 2 enable/disable */
181181   memory_install_read8_handler(space, 0x1000, 0x1fff, 0, 0, input_port_read(machine, "ROM2") ? SMH_BANK(10) : SMH_NOP);
182182   memory_install_write8_handler(space, 0x1000, 0x1fff, 0, 0, SMH_NOP);
r5932r5933
198198{
199199   UINT8 *ROM = memory_region(machine, "maincpu");
200200   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
201   
201
202202   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), galaxy_irq_callback);
203203
204204   ROM[0x0037] = 0x29;
src/mess/machine/gamepock.c
r5932r5933
1515static UINT8 gamepock_port_b;
1616static HD44102CH hd44102ch[3];
1717
18static void hd44102ch_w( int which, int c_d, UINT8 data )
18static void hd44102ch_w( int which, int c_d, UINT8 data )
1919{
20   if ( c_d )
20   if ( c_d )
2121   {
2222      UINT8   y;
2323      /* Data */
r5932r5933
2525
2626      /* Increment/decrement Y counter */
2727      y = ( hd44102ch[which].address & 0x3F ) + hd44102ch[which].y_inc;
28      if ( y == 0xFF )
28      if ( y == 0xFF )
2929      {
3030         y = 49;
3131      }
32      if ( y == 50 )
32      if ( y == 50 )
3333      {
3434         y = 0;
3535      }
3636      hd44102ch[which].address = ( hd44102ch[which].address & 0xC0 ) | y;
37   }
38   else
37   }
38   else
3939   {
4040      /* Command */
41      switch ( data )
41      switch ( data )
4242      {
4343      case 0x38:      /* Display off */
4444         hd44102ch[which].enabled = 0;
r5932r5933
5959         hd44102ch[which].start_page = data & 0xC0;
6060         break;
6161      default:
62         if ( ( data & 0x3F ) < 50 )
62         if ( ( data & 0x3F ) < 50 )
6363         {
6464            hd44102ch[which].address = data;
6565         }
r5932r5933
6868   }
6969}
7070
71static void hd44102ch_init( int which )
71static void hd44102ch_init( int which )
7272{
7373   memset( &hd44102ch[which], 0, sizeof( HD44102CH ) );
7474   hd44102ch[which].y_inc = 0x01;
7575}
7676
77static void gamepock_lcd_update(void)
77static void gamepock_lcd_update(void)
7878{
7979   /* Check whether HD44102CH #1 is enabled */
80   if ( gamepock_port_a & 0x08 )
80   if ( gamepock_port_a & 0x08 )
8181   {
8282      hd44102ch_w( 0, gamepock_port_a & 0x04, gamepock_port_b );
8383   }
8484
8585   /* Check whether HD44102CH #2 is enabled */
86   if ( gamepock_port_a & 0x10 )
86   if ( gamepock_port_a & 0x10 )
8787   {
8888      hd44102ch_w( 1, gamepock_port_a & 0x04, gamepock_port_b );
8989   }
9090
9191   /* Check whether HD44102CH #3 is enabled */
92   if ( gamepock_port_a & 0x20 )
92   if ( gamepock_port_a & 0x20 )
9393   {
9494      hd44102ch_w( 2, gamepock_port_a & 0x04, gamepock_port_b );
9595   }
9696}
9797
98WRITE8_HANDLER( gamepock_port_a_w )
98WRITE8_HANDLER( gamepock_port_a_w )
9999{
100100   UINT8   old_port_a = gamepock_port_a;
101101
102102   gamepock_port_a = data;
103103
104   if ( ! ( old_port_a & 0x02 ) && ( gamepock_port_a & 0x02 ) )
104   if ( ! ( old_port_a & 0x02 ) && ( gamepock_port_a & 0x02 ) )
105105   {
106106      gamepock_lcd_update();
107107   }
108108}
109109
110WRITE8_HANDLER( gamepock_port_b_w )
110WRITE8_HANDLER( gamepock_port_b_w )
111111{
112112   gamepock_port_b = data;
113113}
114114
115READ8_HANDLER( gamepock_port_b_r )
115READ8_HANDLER( gamepock_port_b_r )
116116{
117117   logerror("gamepock_port_b_r: not implemented\n");
118118   return 0xFF;
119119}
120120
121READ8_HANDLER( gamepock_port_c_r )
121READ8_HANDLER( gamepock_port_c_r )
122122{
123123   UINT8   data = 0xFF;
124124
125   if ( gamepock_port_a & 0x80 )
125   if ( gamepock_port_a & 0x80 )
126126   {
127127      data &= input_port_read(space->machine, "IN0");
128128   }
129129
130   if ( gamepock_port_a & 0x40 )
130   if ( gamepock_port_a & 0x40 )
131131   {
132132      data &= input_port_read(space->machine, "IN1");
133133   }
r5932r5933
135135   return data;
136136}
137137
138MACHINE_RESET( gamepock )
138MACHINE_RESET( gamepock )
139139{
140140   hd44102ch_init( 0 );
141141   hd44102ch_init( 1 );
142142   hd44102ch_init( 2 );
143143}
144144
145VIDEO_UPDATE( gamepock )
145VIDEO_UPDATE( gamepock )
146146{
147147   UINT8   ad;
148148   int      i,j;
149149
150150   /* Handle HD44102CH #0 */
151151   ad = hd44102ch[0].start_page;
152   for ( i = 0; i < 4; i++ )
152   for ( i = 0; i < 4; i++ )
153153   {
154      for ( j = 0; j < 50; j++ )
154      for ( j = 0; j < 50; j++ )
155155      {
156156         *BITMAP_ADDR16(bitmap, i * 8 + 0, 49 - j ) = ( hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1;
157157         *BITMAP_ADDR16(bitmap, i * 8 + 1, 49 - j ) = ( hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1;
r5932r5933
167167
168168   /* Handle HD44102CH #1 */
169169   ad = hd44102ch[1].start_page;
170   for ( i = 4; i < 8; i++ )
170   for ( i = 4; i < 8; i++ )
171171   {
172      for ( j = 0; j < 50; j++ )
172      for ( j = 0; j < 50; j++ )
173173      {
174174         *BITMAP_ADDR16(bitmap, i * 8 + 0, j ) = ( hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1;
175175         *BITMAP_ADDR16(bitmap, i * 8 + 1, j ) = ( hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1;
r5932r5933
185185
186186   /* Handle HD44102CH #2 */
187187   ad = hd44102ch[2].start_page;
188   for ( i = 0; i < 4; i++ )
188   for ( i = 0; i < 4; i++ )
189189   {
190      for ( j = 0; j < 25; j++ )
190      for ( j = 0; j < 25; j++ )
191191      {
192192         *BITMAP_ADDR16(bitmap, i * 8 + 0, 50 + j ) = ( hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1;
193193         *BITMAP_ADDR16(bitmap, i * 8 + 1, 50 + j ) = ( hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1;
r5932r5933
198198         *BITMAP_ADDR16(bitmap, i * 8 + 6, 50 + j ) = ( hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1;
199199         *BITMAP_ADDR16(bitmap, i * 8 + 7, 50 + j ) = ( hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1;
200200      }
201      for ( j = 25; j < 50; j++ )
201      for ( j = 25; j < 50; j++ )
202202      {
203203         *BITMAP_ADDR16(bitmap, 32 + i * 8 + 0, 25 + j ) = ( hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1;
204204         *BITMAP_ADDR16(bitmap, 32 + i * 8 + 1, 25 + j ) = ( hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1;
r5932r5933
216216}
217217
218218/* This is called whenever the T0 pin switches state */
219int gamepock_io_callback( const device_config *device, int ioline, int state )
219int gamepock_io_callback( const device_config *device, int ioline, int state )
220220{
221221   const device_config *speaker = devtag_get_device(device->machine, "speaker");
222   if ( ioline == UPD7810_TO )
222   if ( ioline == UPD7810_TO )
223223   {
224224      speaker_level_w(speaker, state & 1 );
225225   }
src/mess/machine/994x_ser.c
r5932r5933
11/*
2   TI99/4(a) RS232 card emulation
2    TI99/4(a) RS232 card emulation
33
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.
99
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.
1313
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>
1919
20   Raphael Nabet, 2003.
20    Raphael Nabet, 2003.
2121*/
2222
2323#include "driver.h"
r5932r5933
5353   int pio_in_buffer;
5454   int pio_readable;
5555   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
5757};
5858
5959typedef struct _card_t card_t;
r5932r5933
7070
7171   return (pio_t *)device->token;
7272}
73     
73
7474static const ti99_peb_card_handlers_t rs232_handlers =
7575{
7676   rs232_cru_r,
r5932r5933
8080};
8181
8282/*
83   Initialize pio unit and open image
83    Initialize pio unit and open image
8484*/
8585static DEVICE_IMAGE_LOAD( ti99_4_pio )
8686{
r5932r5933
8989   pio->pio_readable = ! image_has_been_created(image);
9090   /* tell whether the image is writable */
9191   pio->pio_writable = image_is_writable(image);
92   
92
9393   if (pio->pio_write && pio->pio_writable)
9494      pio->pio_handshakein = 0;   /* receiver ready */
9595   else
r5932r5933
9999}
100100
101101/*
102   close a pio image
102    close a pio image
103103*/
104104static DEVICE_IMAGE_UNLOAD( ti99_4_pio )
105105{
r5932r5933
126126   pio->pio_write = 1;
127127}
128128/*
129   Initialize rs232 unit and open image
129    Initialize rs232 unit and open image
130130*/
131131static DEVICE_IMAGE_LOAD( ti99_4_rs232 )
132132{
133133   const device_config *tms9902 = NULL;
134     
134
135135   if (strcmp(image->tag, "rs232:port0")) {
136136      tms9902 = devtag_get_device(image->machine, "rs232:tms9902_0");
137137   }
138138   if (strcmp(image->tag, "rs232:port1")) {
139139      tms9902 = devtag_get_device(image->machine, "rs232:tms9902_1");
140140   }
141     
141
142142   if (image)
143143   {
144144      tms9902_set_cts(tms9902, 1);
r5932r5933
154154}
155155
156156/*
157   close a rs232 image
157    close a rs232 image
158158*/
159159static DEVICE_IMAGE_UNLOAD( ti99_4_rs232 )
160{   
160{
161161}
162162
163163/*
164   Initializes rs232 card, set up handlers
164    Initializes rs232 card, set up handlers
165165*/
166166static DEVICE_START( ti99_4_rs232 )
167167{
r5932r5933
169169}
170170
171171/*
172   Reset rs232 card, set up handlers
172    Reset rs232 card, set up handlers
173173*/
174174static DEVICE_RESET( ti99_4_rs232 )
175175{
r5932r5933
178178   ti99_peb_set_card_handlers(0x1300, & rs232_handlers);
179179}
180180
181static READ8_DEVICE_HANDLER(ti99_4_pio_r)
181static READ8_DEVICE_HANDLER(ti99_4_pio_r)
182182{
183183   pio_t *pio = get_safe_token_pio(device);
184184   UINT8 reply = 0x00;
r5932r5933
199199   return reply;
200200}
201201
202static READ8_DEVICE_HANDLER(ti99_4_pio_buf_r)
202static READ8_DEVICE_HANDLER(ti99_4_pio_buf_r)
203203{
204204   pio_t *pio = get_safe_token_pio(device);
205205   return pio->pio_direction ? pio->pio_in_buffer : pio->pio_out_buffer;
r5932r5933
285285         pio->led = data;
286286         break;
287287   }
288}         
288}
289289/*
290   Read rs232 card CRU interface
290    Read rs232 card CRU interface
291291
292   bit 0: always 0
293   ...
292    bit 0: always 0
293    ...
294294*/
295295static int rs232_cru_r(running_machine *machine, int offset)
296296{
r5932r5933
332332}
333333
334334/*
335   Write rs232 card CRU interface
335    Write rs232 card CRU interface
336336*/
337337static void rs232_cru_w(running_machine *machine, int offset, int data)
338338{
r5932r5933
361361
362362
363363/*
364   read a byte in rs232 DSR space
364    read a byte in rs232 DSR space
365365*/
366366static  READ8_HANDLER(rs232_mem_r)
367367{
r5932r5933
382382}
383383
384384/*
385   write a byte in rs232 DSR space
385    write a byte in rs232 DSR space
386386*/
387387static WRITE8_HANDLER(rs232_mem_w)
388388{
389389   if (offset >= 0x1000)
390390   {
391      /* PIO */     
391      /* PIO */
392392      ti99_4_pio_buf_w(devtag_get_device(space->machine, "rs232:pio"), offset, data);
393393   }
394394   else
r5932r5933
398398}
399399
400400/*
401   rs232 interrupt handler
401    rs232 interrupt handler
402402*/
403403static TMS9902_INT_CALLBACK( int_callback_0 )
404404{
r5932r5933
430430{
431431   3000000.,            /* clock rate (3MHz) */
432432   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 */
435435   xmit_callback_0         /* called when a character is transmitted */
436436};
437437
r5932r5933
439439{
440440   3000000.,            /* clock rate (3MHz) */
441441   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 */
444444   xmit_callback_1         /* called when a character is transmitted */
445445};
446446
447447DEVICE_GET_INFO( ti99_4_rs232 )
448448{
449   switch ( state )
449   switch ( state )
450450   {
451451      case DEVINFO_INT_CLASS:                       info->i = DEVICE_CLASS_PERIPHERAL;                         break;
452452      case DEVINFO_INT_TOKEN_BYTES:            info->i = sizeof(card_t);                     break;
r5932r5933
455455      case DEVINFO_INT_IMAGE_READABLE:            info->i = 1;                                               break;
456456      case DEVINFO_INT_IMAGE_WRITEABLE:         info->i = 1;                                               break;
457457      case DEVINFO_INT_IMAGE_CREATABLE:           info->i = 1;                                               break;
458           
458
459459      case DEVINFO_FCT_START:                      info->start = DEVICE_START_NAME( ti99_4_rs232 );              break;
460460      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME( ti99_4_rs232 );         break;
461461      case DEVINFO_FCT_IMAGE_LOAD:              info->f = (genf *) DEVICE_IMAGE_LOAD_NAME( ti99_4_rs232 );    break;
r5932r5933
476476#define MDRV_TI99_4_RS232_ADD(_tag) \
477477   MDRV_DEVICE_ADD(_tag, TI99_4_RS232, 0)
478478
479   
479
480480DEVICE_GET_INFO( ti99_4_pio )
481481{
482   switch ( state )
482   switch ( state )
483483   {
484484      case DEVINFO_INT_CLASS:                       info->i = DEVICE_CLASS_PERIPHERAL;                         break;
485485      case DEVINFO_INT_TOKEN_BYTES:            info->i = sizeof(pio_t);                     break;
r5932r5933
488488      case DEVINFO_INT_IMAGE_READABLE:            info->i = 1;                                               break;
489489      case DEVINFO_INT_IMAGE_WRITEABLE:         info->i = 1;                                               break;
490490      case DEVINFO_INT_IMAGE_CREATABLE:           info->i = 1;                                               break;
491           
491
492492      case DEVINFO_FCT_START:                      info->start = DEVICE_START_NAME( ti99_4_pio );              break;
493493      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME( ti99_4_pio );         break;
494494      case DEVINFO_FCT_IMAGE_LOAD:              info->f = (genf *) DEVICE_IMAGE_LOAD_NAME( ti99_4_pio );    break;
r5932r5933
520520
521521DEVICE_GET_INFO( ti99_4_rs232_card )
522522{
523   switch ( state )
523   switch ( state )
524524   {
525525      case DEVINFO_INT_CLASS:                       info->i = DEVICE_CLASS_PERIPHERAL;                         break;
526526      case DEVINFO_INT_TOKEN_BYTES:            info->i = sizeof(card_t);                     break;
527527      case DEVINFO_INT_INLINE_CONFIG_BYTES:      info->i = 0;                        break;
528528      case DEVINFO_FCT_START:                      info->start = DEVICE_START_NAME( ti99_4_rs232_card );              break;
529529      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;
532532      case DEVINFO_STR_NAME:                      strcpy( info->s, "TI99 RS232 card");                            break;
533533      case DEVINFO_STR_FAMILY:                    strcpy(info->s, "TI99 RS232 card");                            break;
534534      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
src/mess/machine/mm74c922.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
1919
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
3131
3232**********************************************************************/
3333
src/mess/machine/compis.c
r5932r5933
11/******************************************************************************
22
3   compis.c
4   machine driver
3    compis.c
4    machine driver
55
6   Per Ola Ingvarsson
7   Tomas Karlsson
6    Per Ola Ingvarsson
7    Tomas Karlsson
88
99 ******************************************************************************/
1010
r5932r5933
113113typedef struct
114114{
115115   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) */
127127   UINT8 key_code;
128128   UINT8 key_status;
129129} TYP_COMPIS_KEYBOARD;
r5932r5933
259259      compis.keyboard.key_status = key_status;
260260      compis.usart.status |= COMPIS_USART_STATUS_RX_READY;
261261      compis.usart.bytes_sent = 0;
262//      compis_osp_pic_irq(COMPIS_IRQ_8251_RXRDY);
262//      compis_osp_pic_irq(COMPIS_IRQ_8251_RXRDY);
263263   }
264264}
265265
r5932r5933
374374
375375/*-------------------------------------------------------------------------*/
376376/* Bit 0: J5-4                                                             */
377/* Bit 1: J5-5                                                   */
377/* Bit 1: J5-5                                                     */
378378/* Bit 2: J6-3 Cassette read                                               */
379379/* Bit 3: J2-6 DSR / S8-4 Test                                             */
380380/* 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                                                     */
384384/*-------------------------------------------------------------------------*/
385385static READ8_DEVICE_HANDLER( compis_ppi_port_b_r )
386386{
r5932r5933
397397}
398398
399399/*-------------------------------------------------------------------------*/
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                                   */
408408/*-------------------------------------------------------------------------*/
409409static WRITE8_DEVICE_HANDLER( compis_ppi_port_c_w )
410410{
r5932r5933
479479static void compis_usart_rxready(const device_config *device, int state)
480480{
481481/*
482   if (state)
483      compis_pic_irq(COMPIS_IRQ_8251_RXRDY);
482    if (state)
483        compis_pic_irq(COMPIS_IRQ_8251_RXRDY);
484484*/
485485}
486486
r5932r5933
516516
517517/*************************************
518518 *
519 *   80186 interrupt controller
519 *  80186 interrupt controller
520520 *
521521 *************************************/
522522static IRQ_CALLBACK(int_callback)
r5932r5933
703703
704704/*************************************
705705 *
706 *   80186 internal timers
706 *  80186 internal timers
707707 *
708708 *************************************/
709709
r5932r5933
892892
893893/*************************************
894894 *
895 *   80186 internal DMA
895 *  80186 internal DMA
896896 *
897897 *************************************/
898898
r5932r5933
955955      /* otherwise, set a timer */
956956      else
957957      {
958//         int count = d->count;
958//          int count = d->count;
959959
960960         /* adjust for redline racer */
961961            // int dacnum = (d->dest & 0x3f) / 2;
r5932r5933
963963         if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
964964
965965         d->finished = 0;
966/*         timer_adjust_oneshot(d->finish_timer,
966/*          timer_adjust_oneshot(d->finish_timer,
967967         ATTOTIME_IN_HZ(dac[dacnum].frequency) * (double)count, which);*/
968968      }
969969   }
r5932r5933
976976
977977/*************************************
978978 *
979 *   80186 internal I/O reads
979 *  80186 internal I/O reads
980980 *
981981 *************************************/
982982
r5932r5933
11121112      case 0x68:
11131113         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(space->cpu), (offset - 0x60) / 8);
11141114         which = (offset - 0x60) / 8;
1115//         stream_update(dma_stream, 0);
1115//          stream_update(dma_stream, 0);
11161116         return i186.dma[which].source;
11171117
11181118      case 0x61:
11191119      case 0x69:
11201120         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(space->cpu), (offset - 0x61) / 8);
11211121         which = (offset - 0x61) / 8;
1122//         stream_update(dma_stream, 0);
1122//          stream_update(dma_stream, 0);
11231123         return i186.dma[which].source >> 16;
11241124
11251125      case 0x62:
11261126      case 0x6a:
11271127         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(space->cpu), (offset - 0x62) / 8);
11281128         which = (offset - 0x62) / 8;
1129//         stream_update(dma_stream, 0);
1129//          stream_update(dma_stream, 0);
11301130         return i186.dma[which].dest;
11311131
11321132      case 0x63:
11331133      case 0x6b:
11341134         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(space->cpu), (offset - 0x63) / 8);
11351135         which = (offset - 0x63) / 8;
1136//         stream_update(dma_stream, 0);
1136//          stream_update(dma_stream, 0);
11371137         return i186.dma[which].dest >> 16;
11381138
11391139      case 0x64:
11401140      case 0x6c:
11411141         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(space->cpu), (offset - 0x64) / 8);
11421142         which = (offset - 0x64) / 8;
1143//         stream_update(dma_stream, 0);
1143//          stream_update(dma_stream, 0);
11441144         return i186.dma[which].count;
11451145
11461146      case 0x65:
11471147      case 0x6d:
11481148         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(space->cpu), (offset - 0x65) / 8);
11491149         which = (offset - 0x65) / 8;
1150//         stream_update(dma_stream, 0);
1150//          stream_update(dma_stream, 0);
11511151         return i186.dma[which].control;
11521152
11531153      default:
r5932r5933
11591159
11601160/*************************************
11611161 *
1162 *   80186 internal I/O writes
1162 *  80186 internal I/O writes
11631163 *
11641164 *************************************/
11651165
r5932r5933
13121312         temp = (i186.mem.peripheral & 0xffc0) << 4;
13131313         if (i186.mem.middle_size & 0x0040)
13141314         {
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);
13171317         }
13181318         else
13191319         {
13201320            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);
13231323         }
13241324
13251325         /* we need to do this at a time when the I86 context is swapped in */
r5932r5933
13321332      case 0x68:
13331333         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x60) / 8, data16);
13341334         which = (offset - 0x60) / 8;
1335//         stream_update(dma_stream, 0);
1335//          stream_update(dma_stream, 0);
13361336         i186.dma[which].source = (i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff);
13371337         break;
13381338
r5932r5933
13401340      case 0x69:
13411341         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x61) / 8, data16);
13421342         which = (offset - 0x61) / 8;
1343//         stream_update(dma_stream, 0);
1343//          stream_update(dma_stream, 0);
13441344         i186.dma[which].source = (i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000);
13451345         break;
13461346
r5932r5933
13481348      case 0x6a:
13491349         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x62) / 8, data16);
13501350         which = (offset - 0x62) / 8;
1351//         stream_update(dma_stream, 0);
1351//          stream_update(dma_stream, 0);
13521352         i186.dma[which].dest = (i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff);
13531353         break;
13541354
r5932r5933
13561356      case 0x6b:
13571357         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x63) / 8, data16);
13581358         which = (offset - 0x63) / 8;
1359//         stream_update(dma_stream, 0);
1359//          stream_update(dma_stream, 0);
13601360         i186.dma[which].dest = (i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000);
13611361         break;
13621362
r5932r5933
13641364      case 0x6c:
13651365         if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", cpu_get_pc(space->cpu), (offset - 0x64) / 8, data16);
13661366         which = (offset - 0x64) / 8;
1367//         stream_update(dma_stream, 0);
1367//          stream_update(dma_stream, 0);
13681368         i186.dma[which].count = data16;
13691369         break;
13701370
r5932r5933
13721372      case 0x6d:
13731373         if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", cpu_get_pc(space->cpu), (offset - 0x65) / 8, data16);
13741374         which = (offset - 0x65) / 8;
1375//         stream_update(dma_stream, 0);
1375//          stream_update(dma_stream, 0);
13761376         update_dma_control(space->machine, which, data16);
13771377         break;
13781378
r5932r5933
13941394            memory_install_read16_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_IO), temp, temp + 0xff, 0, 0, i186_internal_port_r);
13951395            memory_install_write16_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_IO), temp, temp + 0xff, 0, 0, i186_internal_port_w);
13961396         }
1397/*         popmessage("Sound CPU reset");*/
1397/*          popmessage("Sound CPU reset");*/
13981398         break;
13991399
14001400      default:
r5932r5933
14311431 *
14321432 *************************************************************/
14331433
1434static PIC8259_SET_INT_LINE( compis_pic8259_master_set_int_line )
1434static PIC8259_SET_INT_LINE( compis_pic8259_master_set_int_line )
14351435{
14361436   cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE);
14371437}
14381438
14391439
1440static PIC8259_SET_INT_LINE( compis_pic8259_slave_set_int_line )
1440static PIC8259_SET_INT_LINE( compis_pic8259_slave_set_int_line )
14411441{
1442   if ( compis_devices.pic8259_master )
1442   if ( compis_devices.pic8259_master )
14431443   {
14441444      pic8259_set_irq_line(compis_devices.pic8259_master, 2, interrupt);
14451445   }
r5932r5933
15031503/*-------------------------------------------------------------------------*/
15041504INTERRUPT_GEN( compis_vblank_int )
15051505{
1506//   compis_gdc_vblank_int();
1506//  compis_gdc_vblank_int();
15071507   compis_keyb_update(device->machine);
15081508}
src/mess/machine/vtech2.c
r5932r5933
11/***************************************************************************
2   vtech2.c
2    vtech2.c
33
44    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
77
88    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.
1313
1414****************************************************************************/
1515
r5932r5933
204204/*************************************************
205205 * memory mapped I/O read
206206 * 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
215215 ************************************************/
216216static int mra_bank(running_machine *machine, int bank, int offs)
217217{
src/mess/machine/corvushd.c
r5932r5933
11//
2//   corvus_hd
2//  corvus_hd
33//
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.
66//
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
99//  Z80 processor, 4K of EPROM and 5KB of RAM.  Ultimately, a true emulation would include
1010//  the on-boad controller; however, that is outside the current scope of this code.  Maybe
1111//  if I could get a Rev. B/H drive, it could be reverse-engineered to do this.
1212//
13//   The Flat Cable controller has two registers:
13//  The Flat Cable controller has two registers:
1414//
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
1818//
19//   Layout of a Corvus Hard Disk is as follows:
19//  Layout of a Corvus Hard Disk is as follows:
2020//
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
3636//
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
4141//
42//   An on-disk structure is written with the SYSGEN utility on the same disk.  Password is "HAI"
42//  An on-disk structure is written with the SYSGEN utility on the same disk.  Password is "HAI"
4343//
4444//
45//   Corvus Hard Disk performance characteristics (from a 6MB Rev B-E drive)
45//  Corvus Hard Disk performance characteristics (from a 6MB Rev B-E drive)
4646//
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
5353//
54//   Brett Wyer
54//  Brett Wyer
5555//
5656//
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)
6464//
6565
6666#include "driver.h"
r5932r5933
387387// Dump a buffer to the error log in a nice format.
388388//
389389// 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
392392//
393393// Returns:
394//      nada
394//      nada
395395//
396396static void dump_buffer(UINT8 *buffer, UINT16 length) {
397397
r5932r5933
429429// a side-effect of this command, as is awaiting_modifier.
430430//
431431// Pass:
432//      data:   Initial byte received from the host in Host to Controller mode
432//      data:   Initial byte received from the host in Host to Controller mode
433433//
434434// Returns:
435//      Whether the command was invalid or not (TRUE = invalid command)
435//      Whether the command was invalid or not (TRUE = invalid command)
436436//
437437static UINT8 parse_hdc_command(UINT8 data) {
438438
r5932r5933
460460         case BOOT:
461461         case READ_BOOT_BLOCK:
462462         case GET_DRIVE_PARAMETERS:
463      //   case PARK_HEADS_REVH:
463      //  case PARK_HEADS_REVH:
464464         case PARK_HEADS_OMNI:
465465         case ECHO:
466466         case PREP_MODE_SELECT:
r5932r5933
473473         // Double-byte commands
474474         //
475475         case SEMAPHORE_LOCK_CODE:
476      //   case SEMAPHORE_UNLOCK_CODE:
476      //  case SEMAPHORE_UNLOCK_CODE:
477477         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:
483483         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:
486486         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:
491491            c->awaiting_modifier = TRUE;
492492            LOG(("parse_hdc_command: Double byte command recoginized: 0x%2.2x\n", data));
493493            break;
r5932r5933
535535// Write a variably-sized chunk of data to the CHD file
536536//
537537// 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)
542542//
543543// Returns:
544//      status:   Command status
544//      status: Command status
545545//
546546static UINT8 corvus_write_sector(running_machine *machine, UINT8 drv, UINT32 sector, UINT8 *buffer, int len) {
547547
r5932r5933
597597// Write a variably-sized chunk of data to the user area of the virtual Corvus drive
598598//
599599// 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
603603//
604604// Returns:
605//      status:   Corvus status
605//      status: Corvus status
606606//
607607static UINT8 corvus_write_logical_sector(running_machine *machine, dadr_t *dadr, UINT8 *buffer, int len) {
608608
r5932r5933
646646// Read a variably-sized chunk of data from the CHD file
647647//
648648// 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
653653//
654654// Returns:
655//      status:   Corvus status
655//      status: Corvus status
656656//
657657static UINT8 corvus_read_sector(running_machine *machine, UINT8 drv, UINT32 sector, UINT8 *buffer, int len) {
658658
r5932r5933
697697// Read a variably-sized chunk of data from the user area of the virtual Corvus drive
698698//
699699// 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
703703//
704704// Returns:
705//      status:   Corvus status
705//      status: Corvus status
706706//
707707static UINT8 corvus_read_logical_sector(running_machine *machine, dadr_t *dadr, UINT8 *buffer, int len) {
708708
r5932r5933
747747// Lock a semaphore in the semaphore table
748748//
749749// Pass:
750//      name:   Name of the semaphore to lock
750//      name:   Name of the semaphore to lock
751751//
752752// Returns:
753//      status:   Disk status
753//      status: Disk status
754754//
755755// Side-effects:
756//      Fills in the semaphore result code
756//      Fills in the semaphore result code
757757//
758758static UINT8 corvus_lock_semaphore(running_machine *machine, UINT8 *name) {
759759
r5932r5933
825825// Unock a semaphore in the semaphore table
826826//
827827// Pass:
828//      name:   Name of the semaphore to unlock
828//      name:   Name of the semaphore to unlock
829829//
830830// Returns:
831//      status:   Disk status
831//      status: Disk status
832832//
833833// Side-effects:
834//      Fills in the semaphore result code
834//      Fills in the semaphore result code
835835//
836836static UINT8 corvus_unlock_semaphore(running_machine *machine, UINT8 *name) {
837837
r5932r5933
895895// Zap all of the semaphores from the table (set them to blanks)
896896//
897897// Pass:
898//      Nothing
898//      Nothing
899899//
900900// Returns:
901//      Disk status
901//      Disk status
902902//
903903//
904904static UINT8 corvus_init_semaphore_table( running_machine *machine ) {
r5932r5933
926926// Fills in the Drive Parameter packet based on the opened CHD file
927927//
928928// Pass:
929//      drv:   Drive number to get parameters from
929//      drv:    Drive number to get parameters from
930930//
931931// Returns:
932//      Status of command
932//      Status of command
933933//
934934static UINT8 corvus_get_drive_parameters(running_machine *machine, UINT8 drv) {
935935
r5932r5933
10351035// Old-style Boot (0x14) command boot block reader
10361036//
10371037// Pass:
1038//      block:   Boot block number to read (0-7)
1038//      block:  Boot block number to read (0-7)
10391039//
10401040// Returns:
1041//      status:   Status of read operation
1041//      status: Status of read operation
10421042//
10431043static UINT8 corvus_read_boot_block(running_machine *machine, UINT8 block) {
10441044
r5932r5933
10581058// Reads firmware information from the first cylinder of the drive
10591059//
10601060// Pass:
1061//      head:   Head number
1062//      sector:   Sector number
1061//      head:   Head number
1062//      sector: Sector number
10631063//
10641064// Returns:
1065//      Status of command
1065//      Status of command
10661066//
10671067static UINT8 corvus_read_firmware_block(running_machine *machine, UINT8 head, UINT8 sector) {
10681068
r5932r5933
10881088// Writes firmware information to the first cylinder of the drive
10891089//
10901090// 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
10941094//
10951095// Returns:
1096//      Status of command
1096//      Status of command
10971097//
10981098static UINT8 corvus_write_firmware_block(running_machine *machine, UINT8 head, UINT8 sector, UINT8 *buffer) {
10991099
r5932r5933
11191119// Write the pattern provided across the entire disk
11201120//
11211121// Pass:
1122//      pattern: 512-byte buffer containing the pattern to write to the whole drive
1122//      pattern: 512-byte buffer containing the pattern to write to the whole drive
11231123//
11241124// Returns:
1125//      Status of command
1125//      Status of command
11261126//
11271127static UINT8 corvus_format_drive(running_machine *machine, UINT8 *pattern, UINT16 len) {
11281128
r5932r5933
11671167// Returns a hard_disk_file object for a given virtual hard drive device in the concept
11681168//
11691169// Pass:
1170//      id:      Drive number (1 - 15)
1170//      id:     Drive number (1 - 15)
11711171//
11721172// Returns:
1173//      hard_disk_file object
1173//      hard_disk_file object
11741174//
11751175static hard_disk_file *corvus_hdc_file(running_machine *machine, int id) {
11761176   static const char *const tags[] = {
r5932r5933
12001200// Having received a complete packet from the host, process it
12011201//
12021202// Pass:
1203//      Invalid_Command_Flag:   Invalid command flag responses are handled in this routine
1203//      Invalid_Command_Flag:   Invalid command flag responses are handled in this routine
12041204//
12051205// Returns:
1206//      Nothing
1206//      Nothing
12071207//
12081208static void corvus_process_command_packet(running_machine *machine, UINT8 invalid_command_flag) {
12091209
r5932r5933
12511251            // Semaphore commands
12521252            //
12531253            case SEMAPHORE_LOCK_CODE:
1254         //   case SEMAPHORE_UNLOCK_CODE:
1254         //  case SEMAPHORE_UNLOCK_CODE:
12551255            case SEMAPHORE_INIT_CODE:
1256         //   case SEMAPHORE_STATUS_CODE:
1256         //  case SEMAPHORE_STATUS_CODE:
12571257               switch(c->buffer.command.modifier) {
12581258                  case SEMAPHORE_LOCK_MOD:
12591259                     c->buffer.semaphore_locking_response.status = corvus_lock_semaphore(machine, c->buffer.lock_semaphore_command.name);
r5932r5933
13691369// Callback routine for completion of controller functions
13701370//
13711371// Pass:
1372//      Callback Function
1372//      Callback Function
13731373//
13741374// Returns:
1375//      Nothing
1375//      Nothing
13761376//
13771377static TIMER_CALLBACK(corvus_hdc_callback)
13781378{
r5932r5933
14061406            c->recv_bytes = 0;
14071407            c->xmit_bytes = 1;
14081408            logerror("corvus_hdc_callback: Exceeded four-second timeout for data from host, resetting communications\n");
1409         } else { // if(c->recv_bytes == 0)                This was a variable-size command
1409         } else { // if(c->recv_bytes == 0)                 This was a variable-size command
14101410            LOG(("corvus_hdc_callback: Executing variable-length command via four-second timeout\n"));
14111411            corvus_process_command_packet(machine, 0);         // Process the command
14121412         }
r5932r5933
14281428// Global routine to initialize the Hard Disk Controller structures and arrays
14291429//
14301430// Pass:
1431//      Nothing
1431//      Nothing
14321432//
14331433// Returns:
1434//      NULL if there's no file to attach to
1434//      NULL if there's no file to attach to
14351435//
14361436UINT8 corvus_hdc_init(running_machine *machine) {
14371437
r5932r5933
15711571// Global routine to read the Status Register from the Controller (Controller to Host)
15721572//
15731573// Pass:
1574//      Nothing
1574//      Nothing
15751575//
15761576// Returns:
1577//      Value in the controller status register
1577//      Value in the controller status register
15781578//
15791579READ8_HANDLER ( corvus_hdc_status_r ) {
15801580
r5932r5933
15931593// when complete.
15941594//
15951595// Pass:
1596//      Nothing
1596//      Nothing
15971597//
15981598// Returns:
1599//      Value in the controller data register
1599//      Value in the controller data register
16001600//
16011601READ8_HANDLER ( corvus_hdc_data_r ) {
16021602
r5932r5933
16241624
16251625      timer_set(space->machine, (ATTOTIME_IN_USEC(INTERBYTE_DELAY)), NULL, CALLBACK_HTC_MODE, corvus_hdc_callback);
16261626
1627//      c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY);   // Put us in Idle, Host-to-Controller mode
1627//      c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY); // Put us in Idle, Host-to-Controller mode
16281628   } else {
16291629      //
16301630      // Not finished with this packet.  Insert an interbyte delay and then let the host continue
r5932r5933
16431643// Write to the Data Register on the Controller (Host to Controller)
16441644//
16451645// Pass:
1646//      Value to write to controller data register
1646//      Value to write to controller data register
16471647//
16481648// Returns:
1649//      Nothing
1649//      Nothing
16501650//
16511651WRITE8_HANDLER ( corvus_hdc_data_w ) {
16521652
src/mess/machine/wswan.c
r5932r5933
9393};
9494
9595/*
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....
9999
100   The setting of SP to 2000h is what's needed to get Wonderswan Colloseum to boot.
100    The setting of SP to 2000h is what's needed to get Wonderswan Colloseum to boot.
101101
102   f000:ffc0
103   FC             cld
102    f000:ffc0
103    FC             cld
104104        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
116116
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
122122
123123*/
124124static const UINT8 ws_fake_bios_code[] = {
r5932r5933
128128   0xea, 0xc0, 0xff, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
129129};
130130
131static void wswan_handle_irqs( running_machine *machine )
131static void wswan_handle_irqs( running_machine *machine )
132132{
133133   if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_HBLTMR ) {
134134      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_HBLTMR );
r5932r5933
151151   }
152152}
153153
154static void wswan_set_irq_line( running_machine *machine, int irq)
154static void wswan_set_irq_line( running_machine *machine, int irq)
155155{
156   if ( ws_portram[0xb2] & irq )
156   if ( ws_portram[0xb2] & irq )
157157   {
158158      ws_portram[0xb6] |= irq;
159159      wswan_handle_irqs( machine );
160160   }
161161}
162162
163static void wswan_clear_irq_line( running_machine *machine, int irq)
163static void wswan_clear_irq_line( running_machine *machine, int irq)
164164{
165165   ws_portram[0xb6] &= ~irq;
166166   wswan_handle_irqs( machine );
r5932r5933
170170{
171171   /* A second passed */
172172   rtc.second = rtc.second + 1;
173   if ( ( rtc.second & 0x0F ) > 9 )
173   if ( ( rtc.second & 0x0F ) > 9 )
174174   {
175175      rtc.second = ( rtc.second & 0xF0 ) + 0x10;
176176   }
177177
178178   /* Check for minute passed */
179   if ( rtc.second >= 0x60 )
179   if ( rtc.second >= 0x60 )
180180   {
181181      rtc.second = 0;
182182      rtc.minute = rtc.minute + 1;
183      if ( ( rtc.minute & 0x0F ) > 9 )
183      if ( ( rtc.minute & 0x0F ) > 9 )
184184      {
185185         rtc.minute = ( rtc.minute & 0xF0 ) + 0x10;
186186      }
187187   }
188188
189189   /* Check for hour passed */
190   if ( rtc.minute >= 0x60 )
190   if ( rtc.minute >= 0x60 )
191191   {
192192      rtc.minute = 0;
193193      rtc.hour = rtc.hour + 1;
194      if ( ( rtc.hour & 0x0F ) > 9 )
194      if ( ( rtc.hour & 0x0F ) > 9 )
195195      {
196196         rtc.hour = ( rtc.hour & 0xF0 ) + 0x10;
197197      }
198      if ( rtc.hour == 0x12 )
198      if ( rtc.hour == 0x12 )
199199      {
200200         rtc.hour |= 0x80;
201201      }
202202   }
203203
204204   /* Check for day passed */
205   if ( rtc.hour >= 0x24 )
205   if ( rtc.hour >= 0x24 )
206206   {
207207      rtc.hour = 0;
208208      rtc.day = rtc.day + 1;
209209   }
210210}
211211
212static void wswan_machine_stop( running_machine *machine )
212static void wswan_machine_stop( running_machine *machine )
213213{
214   if ( eeprom.size )
214   if ( eeprom.size )
215215   {
216216      image_battery_save( devtag_get_device(machine, "cart"), eeprom.data, eeprom.size );
217217   }
218218}
219219
220static void wswan_setup_bios( running_machine *machine )
220static void wswan_setup_bios( running_machine *machine )
221221{
222   if ( ws_bios_bank == NULL )
222   if ( ws_bios_bank == NULL )
223223   {
224224      ws_bios_bank = auto_alloc_array(machine, UINT8, 0x10000 );
225225      memcpy( ws_bios_bank + 0xffc0, ws_fake_bios_code, 0x40 );
226226   }
227227}
228228
229MACHINE_START( wswan )
229MACHINE_START( wswan )
230230{
231231   ws_bios_bank = NULL;
232232   system_type = WSWAN;
233233   add_exit_callback( machine, wswan_machine_stop );
234234}
235235
236MACHINE_START( wscolor )
236MACHINE_START( wscolor )
237237{
238238   ws_bios_bank = NULL;
239239   system_type = WSC;
r5932r5933
282282   memory_set_bankptr( machine, 14, ROMMap[(ROMBanks - 2) & (ROMBanks - 1)] );
283283   wswan_bios_disabled = 0;
284284   memory_set_bankptr( machine, 15, ws_bios_bank );
285//   memory_set_bankptr( machine, 15, ROMMap[(ROMBanks - 1) & (ROMBanks - 1)] );
285//  memory_set_bankptr( machine, 15, ROMMap[(ROMBanks - 1) & (ROMBanks - 1)] );
286286
287287   /* Set up RTC timer */
288   if ( rtc.present )
288   if ( rtc.present )
289289   {
290290      timer_pulse(machine,  ATTOTIME_IN_SEC(1), NULL, 0, wswan_rtc_callback );
291291   }
292292
293293}
294294
295NVRAM_HANDLER( wswan )
295NVRAM_HANDLER( wswan )
296296{
297   if ( read_or_write )
297   if ( read_or_write )
298298   {
299299      /* Save the EEPROM data */
300300      mame_fwrite( file, internal_eeprom, INTERNAL_EEPROM_SIZE );
301   }
302   else
301   }
302   else
303303   {
304304      /* Load the EEPROM data */
305      if ( file )
305      if ( file )
306306      {
307307         mame_fread( file, internal_eeprom, INTERNAL_EEPROM_SIZE );
308      }
309      else
308      }
309      else
310310      {
311311         /* Initialize the EEPROM data */
312312         memset( internal_eeprom, 0xFF, sizeof( internal_eeprom ) );
r5932r5933
316316
317317READ8_HANDLER( wswan_sram_r )
318318{
319   if ( eeprom.data == NULL )
319   if ( eeprom.data == NULL )
320320   {
321321      return 0xFF;
322322   }
r5932r5933
325325
326326WRITE8_HANDLER( wswan_sram_w )
327327{
328   if ( eeprom.data == NULL )
328   if ( eeprom.data == NULL )
329329   {
330330      return;
331331   }
r5932r5933
366366               /* Bit 1 - Determine mono/color */
367367               /* Bit 2 - Determine color/crystal */
368368         value = value & ~ 0x02;
369         if ( system_type == WSC )
369         if ( system_type == WSC )
370370         {
371371            value |= 2;
372372         }
r5932r5933
384384         value = wswan_vdp.timer_vblank_count >> 8;
385385         break;
386386      case 0xCB:      /* RTC data */
387         if ( ws_portram[0xca] == 0x95 && ( rtc.index < 7 ) )
387         if ( ws_portram[0xca] == 0x95 && ( rtc.index < 7 ) )
388388         {
389            switch( rtc.index )
389            switch( rtc.index )
390390            {
391391            case 0: value = rtc.year; break;
392392            case 1: value = rtc.month; break;
r5932r5933
409409   switch( offset )
410410   {
411411      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                */
423423         wswan_vdp.layer_bg_enable = data & 0x1;
424424         wswan_vdp.layer_fg_enable = (data & 0x2) >> 1;
425425         wswan_vdp.sprites_enable = (data & 0x4) >> 2;
r5932r5933
427427         wswan_vdp.window_fg_mode = (data & 0x30) >> 4;
428428         break;
429429      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                */
437437         break;
438438      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                */
441441         logerror( "Write to current scanline! Current value: %d  Data to write: %d\n", wswan_vdp.current_line, data );
442442         /* Returning so we don't overwrite the value here, not that it
443          * really matters */
443            * really matters */
444444         return;
445445      case 0x03:   /* Line compare
446               Bit 0-7 - Line compare
447            */
446                   Bit 0-7 - Line compare
447                */
448448         wswan_vdp.line_compare = data;
449449         break;
450450      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                */
454454         wswan_vdp.sprite_table_address = ( data & 0x3F ) << 9;
455455         break;
456456      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                */
459459         wswan_vdp.sprite_first = data;
460460         break;
461461      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                */
464464         wswan_vdp.sprite_count = data;
465465         break;
466466      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                */
472472         wswan_vdp.layer_bg_address = (data & 0x7) << 11;
473473         wswan_vdp.layer_fg_address = (data & 0x70) << 7;
474474         break;
475475      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                */
478478         wswan_vdp.window_fg_left = data;
479479         break;
480480      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                */
483483         wswan_vdp.window_fg_top = data;
484484         break;
485485      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                */
488488         wswan_vdp.window_fg_right = data;
489489         break;
490490      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                */
493493         wswan_vdp.window_fg_bottom = data;
494494         break;
495495      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                */
498498         wswan_vdp.window_sprites_left = data;
499499         break;
500500      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                */
503503         wswan_vdp.window_sprites_top = data;
504504         break;
505505      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                */
508508         wswan_vdp.window_sprites_right = data;
509509         break;
510510      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                */
513513         wswan_vdp.window_sprites_bottom = data;
514514         break;
515515      case 0x10:   /* Background layer X scroll
516               Bit 0-7 - Background layer X scroll
517            */
516                   Bit 0-7 - Background layer X scroll
517                */
518518         wswan_vdp.layer_bg_scroll_x = data;
519519         break;
520520      case 0x11:   /* Background layer Y scroll
521               Bit 0-7 - Background layer Y scroll
522            */
521                   Bit 0-7 - Background layer Y scroll
522                */
523523         wswan_vdp.layer_bg_scroll_y = data;
524524         break;
525525      case 0x12:   /* Foreground layer X scroll
526               Bit 0-7 - Foreground layer X scroll
527            */
526                   Bit 0-7 - Foreground layer X scroll
527                */
528528         wswan_vdp.layer_fg_scroll_x = data;
529529         break;
530530      case 0x13:   /* Foreground layer Y scroll
531               Bit 0-7 - Foreground layer Y scroll
532            */
531                   Bit 0-7 - Foreground layer Y scroll
532                */
533533         wswan_vdp.layer_fg_scroll_y = data;
534534         break;
535535      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                */
539539         wswan_vdp.lcd_enable = data & 0x1;
540540         break;
541541      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                */
550550         wswan_vdp.icons = data;   /* ummmmm */
551551         break;
552552      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 )
557557         {
558558            int i = 15 - ( data & 0x0F );
559559            int j = 15 - ( ( data & 0xF0 ) >> 4 );
560560            wswan_vdp.main_palette[0] = ( i << 8 ) | ( i << 4 ) | i;
561561            wswan_vdp.main_palette[1] = ( j << 8 ) | ( j << 4 ) | j;
562         }
563         else
562         }
563         else
564564         {
565565            wswan_vdp.main_palette[0] = data & 0x0F;
566566            wswan_vdp.main_palette[1] = ( data & 0xF0 ) >> 4;
567567         }
568568         break;
569569      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 )
574574         {
575575            int i = 15 - ( data & 0x0F );
576576            int j = 15 - ( ( data & 0xF0 ) >> 4 );
577577            wswan_vdp.main_palette[2] = ( i << 8 ) | ( i << 4 ) | i;
578578            wswan_vdp.main_palette[3] = ( j << 8 ) | ( j << 4 ) | j;
579         }
580         else
579         }
580         else
581581         {
582582            wswan_vdp.main_palette[2] = data & 0x0F;
583583            wswan_vdp.main_palette[3] = ( data & 0xF0 ) >> 4;
584584         }
585585         break;
586586      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 )
591591         {
592592            int i = 15 - ( data & 0x0F );
593593            int j = 15 - ( ( data & 0xF0 ) >> 4 );
594594            wswan_vdp.main_palette[4] = ( i << 8 ) | ( i << 4 ) | i;
595595            wswan_vdp.main_palette[5] = ( j << 8 ) | ( j << 4 ) | j;
596         }
597         else
596         }
597         else
598598         {
599599            wswan_vdp.main_palette[4] = data & 0x0F;
600600            wswan_vdp.main_palette[5] = ( data & 0xF0 ) >> 4;
601601         }
602602         break;
603603      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 )
608608         {
609609            int i = 15 - ( data & 0x0F );
610610            int j = 15 - ( ( data & 0xF0 ) >> 4 );
611611            wswan_vdp.main_palette[6] = ( i << 8 ) | ( i << 4 ) | i;
612612            wswan_vdp.main_palette[7] = ( j << 8 ) | ( j << 4 ) | j;
613         }
614         else
613         }
614         else
615615         {
616616            wswan_vdp.main_palette[6] = data & 0x0F;
617617            wswan_vdp.main_palette[7] = ( data & 0xF0 ) >> 4;
618618         }
619619         break;
620620      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 */
623623      case 0x21:   /* Bit 0-3 - Palette 0 index 2
624               Bit 4-7 - Palette 0 index 3 */
624                   Bit 4-7 - Palette 0 index 3 */
625625      case 0x22:   /* Bit 0-3 - Palette 1 index 0
626               Bit 4-7 - Palette 1 index 1 */
626                   Bit 4-7 - Palette 1 index 1 */
627627      case 0x23:   /* Bit 0-3 - Palette 1 index 2
628               Bit 4-7 - Palette 1 index 3 */
628                   Bit 4-7 - Palette 1 index 3 */
629629      case 0x24:   /* Bit 0-3 - Palette 2 index 0
630               Bit 4-7 - Palette 2 index 1 */
630                   Bit 4-7 - Palette 2 index 1 */
631631      case 0x25:   /* Bit 0-3 - Palette 2 index 2
632               Bit 4-7 - Palette 2 index 3 */
632                   Bit 4-7 - Palette 2 index 3 */
633633      case 0x26:   /* Bit 0-3 - Palette 3 index 0
634               Bit 4-7 - Palette 3 index 1 */
634                   Bit 4-7 - Palette 3 index 1 */
635635      case 0x27:   /* Bit 0-3 - Palette 3 index 2
636               Bit 4-7 - Palette 3 index 3 */
636                   Bit 4-7 - Palette 3 index 3 */
637637      case 0x28:   /* Bit 0-3 - Palette 4 index 0
638               Bit 4-7 - Palette 4 index 1 */
638                   Bit 4-7 - Palette 4 index 1 */
639639      case 0x29:   /* Bit 0-3 - Palette 4 index 2
640               Bit 4-7 - Palette 4 index 3 */
640                   Bit 4-7 - Palette 4 index 3 */
641641      case 0x2A:   /* Bit 0-3 - Palette 5 index 0
642               Bit 4-7 - Palette 5 index 1 */
642                   Bit 4-7 - Palette 5 index 1 */
643643      case 0x2B:   /* Bit 0-3 - Palette 5 index 2
644               Bit 4-7 - Palette 5 index 3 */
644                   Bit 4-7 - Palette 5 index 3 */
645645      case 0x2C:   /* Bit 0-3 - Palette 6 index 0
646               Bit 4-7 - Palette 6 index 1 */
646                   Bit 4-7 - Palette 6 index 1 */
647647      case 0x2D:   /* Bit 0-3 - Palette 6 index 2
648               Bit 4-7 - Palette 6 index 3 */
648                   Bit 4-7 - Palette 6 index 3 */
649649      case 0x2E:   /* Bit 0-3 - Palette 7 index 0
650               Bit 4-7 - Palette 7 index 1 */
650                   Bit 4-7 - Palette 7 index 1 */
651651      case 0x2F:   /* Bit 0-3 - Palette 7 index 2
652               Bit 4-7 - Palette 7 index 3 */
652                   Bit 4-7 - Palette 7 index 3 */
653653      case 0x30:   /* Bit 0-3 - Palette 8 / Sprite Palette 0 index 0
654               Bit 4-7 - Palette 8 / Sprite Palette 0 index 1 */
654                   Bit 4-7 - Palette 8 / Sprite Palette 0 index 1 */
655655      case 0x31:   /* Bit 0-3 - Palette 8 / Sprite Palette 0 index 2
656               Bit 4-7 - Palette 8 / Sprite Palette 0 index 3 */
656                   Bit 4-7 - Palette 8 / Sprite Palette 0 index 3 */
657657      case 0x32:   /* Bit 0-3 - Palette 9 / Sprite Palette 1 index 0
658               Bit 4-7 - Palette 9 / Sprite Palette 1 index 1 */
658                   Bit 4-7 - Palette 9 / Sprite Palette 1 index 1 */
659659      case 0x33:   /* Bit 0-3 - Palette 9 / Sprite Palette 1 index 2
660               Bit 4-7 - Palette 9 / Sprite Palette 1 index 3 */
660                   Bit 4-7 - Palette 9 / Sprite Palette 1 index 3 */
661661      case 0x34:   /* Bit 0-3 - Palette 10 / Sprite Palette 2 index 0
662               Bit 4-7 - Palette 10 / Sprite Palette 2 index 1 */
662                   Bit 4-7 - Palette 10 / Sprite Palette 2 index 1 */
663663      case 0x35:   /* Bit 0-3 - Palette 10 / Sprite Palette 2 index 2
664               Bit 4-7 - Palette 10 / Sprite Palette 2 index 3 */
664                   Bit 4-7 - Palette 10 / Sprite Palette 2 index 3 */
665665      case 0x36:   /* Bit 0-3 - Palette 11 / Sprite Palette 3 index 0
666               Bit 4-7 - Palette 11 / Sprite Palette 3 index 1 */
666                   Bit 4-7 - Palette 11 / Sprite Palette 3 index 1 */
667667      case 0x37:   /* Bit 0-3 - Palette 11 / Sprite Palette 3 index 2
668               Bit 4-7 - Palette 11 / Sprite Palette 3 index 3 */
668                   Bit 4-7 - Palette 11 / Sprite Palette 3 index 3 */
669669      case 0x38:   /* Bit 0-3 - Palette 12 / Sprite Palette 4 index 0
670               Bit 4-7 - Palette 12 / Sprite Palette 4 index 1 */
670                   Bit 4-7 - Palette 12 / Sprite Palette 4 index 1 */
671671      case 0x39:   /* Bit 0-3 - Palette 12 / Sprite Palette 4 index 2
672               Bit 4-7 - Palette 12 / Sprite Palette 4 index 3 */
672                   Bit 4-7 - Palette 12 / Sprite Palette 4 index 3 */
673673      case 0x3A:   /* Bit 0-3 - Palette 13 / Sprite Palette 5 index 0
674               Bit 4-7 - Palette 13 / Sprite Palette 5 index 1 */
674                   Bit 4-7 - Palette 13 / Sprite Palette 5 index 1 */
675675      case 0x3B:   /* Bit 0-3 - Palette 13 / Sprite Palette 5 index 2
676               Bit 4-7 - Palette 13 / Sprite Palette 5 index 3 */
676                   Bit 4-7 - Palette 13 / Sprite Palette 5 index 3 */
677677      case 0x3C:   /* Bit 0-3 - Palette 14 / Sprite Palette 6 index 0
678               Bit 4-7 - Palette 14 / Sprite Palette 6 index 1 */
678                   Bit 4-7 - Palette 14 / Sprite Palette 6 index 1 */
679679      case 0x3D:   /* Bit 0-3 - Palette 14 / Sprite Palette 6 index 2
680               Bit 4-7 - Palette 14 / Sprite Palette 6 index 3 */
680                   Bit 4-7 - Palette 14 / Sprite Palette 6 index 3 */
681681      case 0x3E:   /* Bit 0-3 - Palette 15 / Sprite Palette 7 index 0
682               Bit 4-7 - Palette 15 / Sprite Palette 7 index 1 */
682                   Bit 4-7 - Palette 15 / Sprite Palette 7 index 1 */
683683      case 0x3F:   /* Bit 0-3 - Palette 15 / Sprite Palette 7 index 2
684               Bit 4-7 - Palette 15 / Sprite Palette 7 index 3 */
684                   Bit 4-7 - Palette 15 / Sprite Palette 7 index 3 */
685685         break;
686686      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                */
689689      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                */
692692      case 0x42:   /* DMA source bank
693               Bit 0-7 - DMA source bank number
694            */
693                   Bit 0-7 - DMA source bank number
694                */
695695      case 0x43:   /* DMA destination bank
696               Bit 0-7 - DMA destination bank number
697            */
696                   Bit 0-7 - DMA destination bank number
697                */
698698      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                */
701701      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                */
704704      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                */
707707      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                */
710710         break;
711711      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                */
715715         if( data & 0x80 )
716716         {
717717            UINT32 src, dst;
r5932r5933
720720            src = ws_portram[0x40] + (ws_portram[0x41] << 8) + (ws_portram[0x42] << 16);
721721            dst = ws_portram[0x44] + (ws_portram[0x45] << 8) + (ws_portram[0x43] << 16);
722722            length = ws_portram[0x46] + (ws_portram[0x47] << 8);
723            for( ; length > 0; length-- )
723            for( ; length > 0; length-- )
724724            {
725725               memory_write_byte(space,  dst, memory_read_byte(space,  src ) );
726726               src++;
r5932r5933
739739         }
740740         break;
741741      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                */
744744         sound_dma.source = ( sound_dma.source & 0x0FFF00 ) | data;
745745         break;
746746      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                */
749749         sound_dma.source = ( sound_dma.source & 0x0F00FF ) | ( data << 8 );
750750         break;
751751      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                */
755755         sound_dma.source = ( sound_dma.source & 0xFFFF ) | ( ( data & 0x0F ) << 16 );
756756         break;
757757      case 0x4D:   /* Unknown */
758758         break;
759759      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                */
762762         sound_dma.size = ( sound_dma.size & 0xFF00 ) | data;
763763         break;
764764      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                */
767767         sound_dma.size = ( sound_dma.size & 0xFF ) | ( data << 8 );
768768         break;
769769      case 0x50:   /* Unknown */
770770      case 0x51:   /* Unknown */
771771         break;
772772      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                */
776776         sound_dma.enable = data;
777777         break;
778778      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                */
784784         /*
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 )
795795         {
796796            wswan_vdp.color_mode = data & 0x80;
797797            wswan_vdp.colors_16 = data & 0x40;
r5932r5933
799799         }
800800         break;
801801      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                */
804804      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                */
807807      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                */
810810      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                */
813813      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                */
816816      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                */
819819      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                */
822822      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                */
825825      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                */
829829      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                */
833833      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                */
837837      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                */
841841      case 0x8C:   /* Sweep step
842               Bit 0-7 - Sweep step
843            */
842                   Bit 0-7 - Sweep step
843                */
844844      case 0x8D:   /* Sweep time
845               Bit 0-7 - Sweep time
846            */
845                   Bit 0-7 - Sweep time
846                */
847847      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                */
853853      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                */
856856      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                */
866866      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                */
873873      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                */
876876      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                */
880880      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                */
884884         wswan_sound_port_w( space, offset, data );
885885         break;
886886      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 )
892892         {
893893            wswan_bios_disabled = 1;
894894            memory_set_bankptr( space->machine, 15, ROMMap[ ( ( ( ws_portram[0xc0] & 0x0F ) << 4 ) | 15 ) & ( ROMBanks - 1 ) ] );
895895         }
896896         break;
897897      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                */
904904         wswan_vdp.timer_hblank_enable = data & 0x1;
905905         wswan_vdp.timer_hblank_mode = (data & 0x2) >> 1;
906906         wswan_vdp.timer_vblank_enable = (data & 0x4) >> 2;
907907         wswan_vdp.timer_vblank_mode = (data & 0x8) >> 3;
908908         break;
909909      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                */
912912         wswan_vdp.timer_hblank_reload &= 0xff00;
913913         wswan_vdp.timer_hblank_reload += data;
914914         wswan_vdp.timer_hblank_count = wswan_vdp.timer_hblank_reload;
915915         break;
916916      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                */
919919         wswan_vdp.timer_hblank_reload &= 0xff;
920920         wswan_vdp.timer_hblank_reload += data << 8;
921921         wswan_vdp.timer_hblank_count = wswan_vdp.timer_hblank_reload;
922922         break;
923923      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                */
926926         wswan_vdp.timer_vblank_reload &= 0xff00;
927927         wswan_vdp.timer_vblank_reload += data;
928928         wswan_vdp.timer_vblank_count = wswan_vdp.timer_vblank_reload;
929929         break;
930930      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                */
933933         wswan_vdp.timer_vblank_reload &= 0xff;
934934         wswan_vdp.timer_vblank_reload += data << 8;
935935         wswan_vdp.timer_vblank_count = wswan_vdp.timer_vblank_reload;
936936         break;
937937      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                */
940940      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                */
943943      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                */
946946      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                */
949949         break;
950950
951951      case 0xb0:   /* Interrupt base vector
952               Bit 0-7 - Interrupt base vector
953            */
952                   Bit 0-7 - Interrupt base vector
953                */
954954         break;
955955      case 0xb1:   /* Communication byte
956               Bit 0-7 - Communication byte
957            */
956                   Bit 0-7 - Communication byte
957                */
958958         break;
959959      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                */
969969         break;
970970      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;
980980         ws_portram[0xb1] = 0xFF;
981         if ( data & 0x80 )
981         if ( data & 0x80 )
982982         {
983//            ws_portram[0xb1] = 0x00;
983//              ws_portram[0xb1] = 0x00;
984984            data |= 0x04;
985985         }
986         if (data & 0x20 )
986         if (data & 0x20 )
987987         {
988//            data |= 0x01;
988//              data |= 0x01;
989989         }
990990         break;
991991      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                */
999999         data = data & 0xF0;
1000         switch( data )
1000         switch( data )
10011001         {
10021002         case 0x10:   /* Read Y cursors: Y1 - Y2 - Y3 - Y4 */
10031003            data = data | input_port_read(space->machine, "CURSY");
r5932r5933
10111011         }
10121012         break;
10131013      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                */
10231023         wswan_clear_irq_line( space->machine, data );
10241024         data = ws_portram[0xB6];
10251025         break;
10261026      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                */
10291029      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                */
10321032         break;
10331033      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                */
10361036      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                */
10411041         break;
10421042      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 )
10521052         {
10531053            UINT16 addr = ( ( ( ws_portram[0xbd] << 8 ) | ws_portram[0xbc] ) << 1 ) & 0x1FF;
10541054            internal_eeprom[ addr ] = ws_portram[0xba];
10551055            internal_eeprom[ addr + 1 ] = ws_portram[0xbb];
10561056            data |= 0x02;
1057         }
1058         else if ( data & 0x10 )
1057         }
1058         else if ( data & 0x10 )
10591059         {
10601060            UINT16 addr = ( ( ( ws_portram[0xbd] << 8 ) | ws_portram[0xbc] ) << 1 ) & 0x1FF;
10611061            ws_portram[0xba] = internal_eeprom[ addr ];
10621062            ws_portram[0xbb] = internal_eeprom[ addr + 1];
10631063            data |= 0x01;
1064         }
1065         else
1064         }
1065         else
10661066         {
10671067            logerror( "Unsupported internal EEPROM command: %X\n", data );
10681068         }
10691069         break;
10701070      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                */
10741074         memory_set_bankptr( space->machine, 4, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 4 ) & ( ROMBanks - 1 ) ] );
10751075         memory_set_bankptr( space->machine, 5, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 5 ) & ( ROMBanks - 1 ) ] );
10761076         memory_set_bankptr( space->machine, 6, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 6 ) & ( ROMBanks - 1 ) ] );
r5932r5933
10821082         memory_set_bankptr( space->machine, 12, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 12 ) & ( ROMBanks - 1 ) ] );
10831083         memory_set_bankptr( space->machine, 13, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 13 ) & ( ROMBanks - 1 ) ] );
10841084         memory_set_bankptr( space->machine, 14, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 14 ) & ( ROMBanks - 1 ) ] );
1085         if ( wswan_bios_disabled )
1085         if ( wswan_bios_disabled )
10861086         {
10871087            memory_set_bankptr( space->machine, 15, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 15 ) & ( ROMBanks - 1 ) ] );
10881088         }
10891089         break;
10901090      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 )
10941094         {
10951095            eeprom.page = &eeprom.data[ ( data * 64 * 1024 ) & ( eeprom.size - 1 ) ];
10961096         }
10971097         break;
10981098      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                */
11011101         memory_set_bankptr( space->machine, 2, ROMMap[ data & ( ROMBanks - 1 ) ]);
11021102         break;
11031103      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                */
11061106         memory_set_bankptr( space->machine, 3, ROMMap[ data & ( ROMBanks - 1 ) ]);
11071107         break;
11081108      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 )
11241124         {
11251125         case EEPROM_1K:
11261126            eeprom.address = data & 0x3F;
11271127            eeprom.command = data >> 4;
1128            if ( ( eeprom.command & 0x0C ) != 0x00 )
1128            if ( ( eeprom.command & 0x0C ) != 0x00 )
11291129            {
11301130               eeprom.command = eeprom.command & 0x0C;
11311131            }
r5932r5933
11391139         }
11401140         break;
11411141      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                */
11591159         switch( eeprom.mode )
11601160         {
11611161         case EEPROM_1K:
r5932r5933
11641164         case EEPROM_16K:
11651165            eeprom.address = ( ( data & 0x03 ) << 8 ) | ( eeprom.address & 0xFF );
11661166            eeprom.command = data & 0x0F;
1167            if ( ( eeprom.command & 0x0C ) != 0x00 )
1167            if ( ( eeprom.command & 0x0C ) != 0x00 )
11681168            {
11691169               eeprom.command = eeprom.command & 0x0C;
11701170            }
r5932r5933
11761176         }
11771177         break;
11781178      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 )
11881188         {
1189            if ( data & 0x80 )
1189            if ( data & 0x80 )
11901190            {   /* Initialize */
11911191               logerror( "Unsupported EEPROM command 'Initialize'\n" );
11921192            }
1193            if ( data & 0x40 )
1193            if ( data & 0x40 )
11941194            {   /* Protect */
1195               switch( eeprom.command )
1195               switch( eeprom.command )
11961196               {
11971197               case 0x00:
11981198                  eeprom.write_enabled = 0;
r5932r5933
12061206                  logerror( "Unsupported 'Protect' command %X\n", eeprom.command );
12071207               }
12081208            }
1209            if ( data & 0x20 )
1209            if ( data & 0x20 )
12101210            {   /* Write */
1211               if ( eeprom.write_enabled )
1211               if ( eeprom.write_enabled )
12121212               {
1213                  switch( eeprom.command )
1213                  switch( eeprom.command )
12141214                  {
12151215                  case 0x04:
12161216                     eeprom.data[ ( eeprom.address << 1 ) + 1 ] = ws_portram[0xc4];
r5932r5933
12221222                  }
12231223               }
12241224            }
1225            if ( data & 0x10 )
1225            if ( data & 0x10 )
12261226            {   /* Read */
12271227               ws_portram[0xc4] = eeprom.data[ ( eeprom.address << 1 ) + 1 ];
12281228               ws_portram[0xc5] = eeprom.data[ eeprom.address << 1 ];
12291229               data |= 0x01;
12301230            }
1231         }
1232         else
1231         }
1232         else
12331233         {
12341234            logerror( "EEPROM command for unknown EEPROM type\n" );
12351235         }
12361236         break;
12371237      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 )
12481248         {
12491249         case 0x10:   /* Reset */
12501250            rtc.index = 8;
r5932r5933
12831283         }
12841284         break;
12851285      case 0xcb:   /* RTC Data */
1286         if ( ws_portram[0xca] == 0x94 && rtc.index < 7 )
1286         if ( ws_portram[0xca] == 0x94 && rtc.index < 7 )
12871287         {
1288            switch( rtc.index )
1288            switch( rtc.index )
12891289            {
12901290            case 0:   rtc.year = data; break;
12911291            case 1: rtc.month = data; break;
r5932r5933
13071307   ws_portram[offset] = data;
13081308}
13091309
1310static const char* wswan_determine_sram( UINT8 data )
1310static const char* wswan_determine_sram( UINT8 data )
13111311{
13121312   eeprom.write_enabled = 0;
13131313   eeprom.mode = SRAM_UNKNOWN;
1314   switch( data )
1314   switch( data )
13151315   {
13161316   case 0x00: eeprom.mode = SRAM_NONE; break;
13171317   case 0x01: eeprom.mode = SRAM_64K; break;
r5932r5933
13351335
13361336static const char* wswan_determine_romsize( UINT8 data )
13371337{
1338   switch( data )
1338   switch( data )
13391339   {
13401340   case 0x02:   return wswan_romsize_str[ ROM_4M ];
13411341   case 0x03:   return wswan_romsize_str[ ROM_8M ];
r5932r5933
14101410      mame_printf_debug( "\tSRAM size: %s\n", sram_str );
14111411      mame_printf_debug( "\tFeatures: %X\n", ROMMap[ROMBanks-1][0xfffc] );
14121412      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++ )
14141414      {
14151415         int count;
1416         for( count = 0; count < 0x10000; count++ )
1416         for( count = 0; count < 0x10000; count++ )
14171417         {
14181418            sum += ROMMap[ii][count];
14191419         }
r5932r5933
14251425   }
14261426#endif
14271427
1428   if ( eeprom.size != 0 )
1428   if ( eeprom.size != 0 )
14291429   {
14301430      eeprom.data = auto_alloc_array(image->machine, UINT8, eeprom.size );
14311431      image_battery_load( image, eeprom.data, eeprom.size );
r5932r5933
14421442
14431443static TIMER_CALLBACK(wswan_scanline_interrupt)
14441444{
1445   if( wswan_vdp.current_line < 144 )
1445   if( wswan_vdp.current_line < 144 )
14461446   {
14471447      wswan_refresh_scanline();
14481448   }
14491449
14501450   /* 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 )
14521452   {
14531453      wswan_vdp.timer_hblank_count--;
14541454      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 )
14561456      {
1457         if ( wswan_vdp.timer_hblank_mode )
1457         if ( wswan_vdp.timer_hblank_mode )
14581458         {
14591459            wswan_vdp.timer_hblank_count = wswan_vdp.timer_hblank_reload;
1460         }
1461         else
1460         }
1461         else
14621462         {
14631463            wswan_vdp.timer_hblank_reload = 0;
14641464         }
r5932r5933
14681468   }
14691469
14701470   /* Handle Sound DMA */
1471   if ( ( sound_dma.enable & 0x88 ) == 0x80 )
1471   if ( ( sound_dma.enable & 0x88 ) == 0x80 )
14721472   {
14731473      const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM );
14741474      /* TODO: Output sound DMA byte */
14751475      wswan_port_w( space, 0x89, memory_read_byte(space,  sound_dma.source ) );
14761476      sound_dma.size--;
14771477      sound_dma.source = ( sound_dma.source + 1 ) & 0x0FFFFF;
1478      if ( sound_dma.size == 0 )
1478      if ( sound_dma.size == 0 )
14791479      {
14801480         sound_dma.enable &= 0x7F;
14811481      }
14821482   }
14831483
1484//   wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159;
1484//  wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159;
14851485
1486   if( wswan_vdp.current_line == 144 )
1486   if( wswan_vdp.current_line == 144 )
14871487   {
14881488      wswan_set_irq_line( machine, WSWAN_IFLAG_VBL );
14891489      /* 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 )
14911491      {
14921492         wswan_vdp.timer_vblank_count--;
14931493         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 )
14951495         {
1496            if ( wswan_vdp.timer_vblank_mode )
1496            if ( wswan_vdp.timer_vblank_mode )
14971497            {
14981498               wswan_vdp.timer_vblank_count = wswan_vdp.timer_vblank_reload;
1499            }
1500            else
1499            }
1500            else
15011501            {
15021502               wswan_vdp.timer_vblank_reload = 0;
15031503            }
r5932r5933
15071507      }
15081508   }
15091509
1510//   wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159;
1510//  wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159;
15111511
1512   if ( wswan_vdp.current_line == wswan_vdp.line_compare )
1512   if ( wswan_vdp.current_line == wswan_vdp.line_compare )
15131513   {
15141514      wswan_set_irq_line( machine, WSWAN_IFLAG_LCMP );
15151515   }
15161516
15171517   wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159;
15181518
1519   if ( wswan_vdp.current_line == 0 )
1519   if ( wswan_vdp.current_line == 0 )
15201520   {
1521      if ( wswan_vdp.display_vertical != wswan_vdp.new_display_vertical )
1521      if ( wswan_vdp.display_vertical != wswan_vdp.new_display_vertical )
15221522      {
15231523         wswan_vdp.display_vertical = wswan_vdp.new_display_vertical;
1524         if ( wswan_vdp.display_vertical )
1524         if ( wswan_vdp.display_vertical )
15251525         {
15261526            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
15291529         {
15301530            video_screen_set_visarea( machine->primary_screen, 0, WSWAN_X_PIXELS - 1, 5*8, 5*8 + WSWAN_Y_PIXELS - 1 );
15311531         }
src/mess/machine/zx.c
r5932r5933
11/***************************************************************************
2   zx.c
2    zx.c
33
44    machine driver
5   Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999
5    Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999
66
77****************************************************************************/
88
r5932r5933
2525
2626static WRITE8_HANDLER( zx_ram_w )
2727{
28   UINT8 *RAM = memory_region(space->machine, "maincpu");   
28   UINT8 *RAM = memory_region(space->machine, "maincpu");
2929   RAM[offset + 0x4000] = data;
3030
3131   if (data & 0x40)
r5932r5933
4343/* I know this looks really pointless... but it has to be here */
4444READ8_HANDLER( zx_ram_r )
4545{
46   UINT8 *RAM = memory_region(space->machine, "maincpu");   
46   UINT8 *RAM = memory_region(space->machine, "maincpu");
4747   return RAM[offset | 0xc000];
4848}
4949
r5932r5933
102102READ8_HANDLER ( zx80_io_r )
103103{
104104/* port FE = read keyboard, NTSC/PAL diode, and cass bit; turn off HSYNC-generator/cass-out
105   The upper 8 bits are used to select a keyboard scan line
105    The upper 8 bits are used to select a keyboard scan line
106106
107   The diode doesn't make any visual difference, but it's in the schematic, and used by the code. */
107    The diode doesn't make any visual difference, but it's in the schematic, and used by the code. */
108108
109109   UINT8 data = 0xff;
110110   UINT8 offs = offset & 0xff;
r5932r5933
138138         zx_ula_bkgnd(space->machine, 0);
139139         ula_irq_active = 0;
140140
141//         LOG_ZX81_IOR("ULA IRQs off");
141//          LOG_ZX81_IOR("ULA IRQs off");
142142      }
143//      else
144//      {
143//      else
144//      {
145145         if ((cassette_input(devtag_get_device(space->machine, "cassette")) < -0.75) && zx_tape_bit)
146146         {
147147            zx_tape_bit = 0x00;
r5932r5933
150150
151151         data &= ~zx_tape_bit;
152152
153//         LOG_ZX81_IOR("Tape");
154//      }
153//          LOG_ZX81_IOR("Tape");
154//      }
155155      if (ula_frame_vsync == 3)
156156      {
157157         ula_frame_vsync = 2;
158//         LOG_ZX81_VSYNC;
158//          LOG_ZX81_VSYNC;
159159      }
160160   }
161161   else
r5932r5933
167167READ8_HANDLER ( zx81_io_r )
168168{
169169/* 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 */
172172
173173   UINT8 data = 0xff;
174174   UINT8 offs = offset & 0xff;
r5932r5933
202202         zx_ula_bkgnd(space->machine, 0);
203203         ula_irq_active = 0;
204204
205//         LOG_ZX81_IOR("ULA IRQs off");
205//          LOG_ZX81_IOR("ULA IRQs off");
206206      }
207207      else
208208      {
r5932r5933
214214
215215         data &= ~zx_tape_bit;
216216
217//         LOG_ZX81_IOR("Tape");
217//          LOG_ZX81_IOR("Tape");
218218      }
219219      if (ula_frame_vsync == 3)
220220      {
221221         ula_frame_vsync = 2;
222//         LOG_ZX81_VSYNC;
222//          LOG_ZX81_VSYNC;
223223      }
224224   }
225225   else
r5932r5933
231231READ8_HANDLER ( pc8300_io_r )
232232{
233233/* 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 */
239239
240240   UINT8 data = 0xff;
241241   UINT8 offs = offset & 0xff;
r5932r5933
274274         zx_ula_bkgnd(space->machine, 0);
275275         ula_irq_active = 0;
276276
277//         LOG_ZX81_IOR("ULA IRQs off");
277//          LOG_ZX81_IOR("ULA IRQs off");
278278      }
279279      else
280280      {
r5932r5933
286286
287287         data &= ~zx_tape_bit;
288288
289//         LOG_ZX81_IOR("Tape");
289//          LOG_ZX81_IOR("Tape");
290290      }
291291      if (ula_frame_vsync == 3)
292292      {
293293         ula_frame_vsync = 2;
294//         LOG_ZX81_VSYNC;
294//          LOG_ZX81_VSYNC;
295295      }
296296   }
297297   else
r5932r5933
303303READ8_HANDLER ( pow3000_io_r )
304304{
305305/* 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 */
311311
312312   UINT8 data = 0xff;
313313   UINT8 offs = offset & 0xff;
r5932r5933
362362
363363         data &= ~zx_tape_bit;
364364
365//         LOG_ZX81_IOR("Tape");
365//          LOG_ZX81_IOR("Tape");
366366      }
367367      if (ula_frame_vsync == 3)
368368      {
369369         ula_frame_vsync = 2;
370//         LOG_ZX81_VSYNC;
370//          LOG_ZX81_VSYNC;
371371      }
372372   }
373373   else
r5932r5933
379379WRITE8_HANDLER( zx80_io_w )
380380{
381381/* port FF = write HSYNC and cass data */
382   
382
383383   UINT8 offs = offset & 0xff;
384384
385385   if (offs == 0xff)
r5932r5933
391391WRITE8_HANDLER ( zx81_io_w )
392392{
393393/* 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 */
399399
400400   const device_config *screen = video_screen_first(space->machine->config);
401401   int height = video_screen_get_height(screen);
src/mess/machine/ps2.c
r5932r5933
11/*****************************************************************************
22 *
33 * machine/ps2.c
4 *
4 *
55 * IBM Personal System 2
66 *
77 ****************************************************************************/
src/mess/machine/nec765.c
r5932r5933
11/***************************************************************************
22
3   machine/nec765.c
3    machine/nec765.c
44
5   Functions to emulate a NEC765/Intel 8272 compatible floppy disk controller
5    Functions to emulate a NEC765/Intel 8272 compatible floppy disk controller
66
7   Code by Kevin Thacker.
7    Code by Kevin Thacker.
88
9   TODO:
9    TODO:
1010
1111    - 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
1616        - end of cylinder condition - almost working, needs fixing  with
1717                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)
2020
2121***************************************************************************/
2222
r5932r5933
118118
119119   unsigned int   ncn;
120120
121//   unsigned int    nec765_id_index;
121//  unsigned int    nec765_id_index;
122122   char *execution_phase_data;
123123   unsigned int   nec765_flags;
124124
125//   unsigned char specify[2];
126//   unsigned char perpendicular_mode[1];
125//  unsigned char specify[2];
126//  unsigned char perpendicular_mode[1];
127127
128128   int command;
129129
r5932r5933
168168   if (!fdc->intf->get_image)
169169   {
170170      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]);
172172      }
173173   }
174174   else
r5932r5933
233233
234234   /* if a seek is done without drive connected: */
235235   /*  abnormal termination of command,
236      seek complete,
237      not ready
238   */
236        seek complete,
237        not ready
238    */
239239
240240   /* if a seek is done with drive connected, but disc missing: */
241241   /* abnormal termination of command,
242      seek complete,
243      not ready */
242        seek complete,
243        not ready */
244244
245245   /* if a seek is done with drive connected and disc in drive */
246246   /* seek complete */
247247
248248
249249   /* On the PC however, it appears that recalibrates and seeks can be performed without
250   a disc in the drive. */
250    a disc in the drive. */
251251
252252   /* Therefore, the above output is dependant on the state of the drive */
253253
254254   /* 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 */
257257
258258   /* On the PC the drive can be selected with the DIGITAL OUTPUT REGISTER, and the motor of each
259   of the 4 possible drives is also settable using the same register */
259    of the 4 possible drives is also settable using the same register */
260260
261261   /* Assumption for PC: (NOT TESTED - NEEDS VERIFICATION) */
262262
263263   /* If a seek is done without drive connected: */
264264   /* abnormal termination of command,
265      seek complete,
266      fault
267      */
265        seek complete,
266        fault
267        */
268268
269269   /* if a seek is done with drive connected, but disc missing: */
270270   /* seek complete */
r5932r5933
273273   /* seek complete */
274274
275275   /* 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!
280280
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    */
284284
285285   const device_config *img = current_image(device);
286286   nec765_t *fdc = get_safe_token(device);
r5932r5933
328328
329329   /* set drive and side */
330330   fdc->nec765_status[0] |= fdc->drive | (fdc->side<<2);
331   
331
332332   nec765_set_int(device,0);
333333   nec765_set_int(device,1);
334334
335335   fdc->nec765_flags &= ~NEC765_SEEK_ACTIVE;
336   
336
337337   nec765_idle(device);
338338}
339339
r5932r5933
406406   else if (fdc->timer_type == 4)
407407   {
408408      /* if in dma mode, a int is not generated per byte. If not in  DMA mode
409      a int is generated per byte */
409        a int is generated per byte */
410410      if (fdc->nec765_flags & NEC765_DMA_MODE)
411411      {
412412         nec765_set_dma_drq(device,1);
r5932r5933
510510         )
511511      {
512512         /* seek completed */
513//         nec765_seek_complete(device);
513//          nec765_seek_complete(device);
514514         // delay for the time of 1 step, the PCW does not like immediate recalibrates
515515         nec765_setup_timed_int(device,1);
516516      }
r5932r5933
711711with error */
712712static void nec765_set_ready_change_callback(const device_config *controller, const device_config *img, int state)
713713{
714   nec765_t *fdc = get_safe_token(controller);   
714   nec765_t *fdc = get_safe_token(controller);
715715   int drive = floppy_get_drive(img);
716716
717717   logerror("nec765: ready state change\n");
r5932r5933
826826
827827  - get next sector id from disc
828828  - if sector id matches id specified in command, it will
829   search for next data block and read data from it.
829    search for next data block and read data from it.
830830
831831  - if the index is seen twice while it is searching for a sector, then the sector cannot be found
832832*/
r5932r5933
864864      nec765_get_next_id(device, &id);
865865
866866      /* tested on Amstrad CPC - All bytes must match, otherwise
867      a NO DATA error is reported */
867        a NO DATA error is reported */
868868      if (id.R == fdc->nec765_command_bytes[4])
869869      {
870870         if (id.C == fdc->nec765_command_bytes[2])
r5932r5933
874874               if (id.N == fdc->nec765_command_bytes[5])
875875               {
876876                  /* 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 */
881881                  if (fdc->nec765_command_bytes[4]==fdc->nec765_command_bytes[6])
882882                  {
883883                     /* set end of cylinder */
r5932r5933
891891         else
892892         {
893893            /* the specified sector ID was found, however, the C value specified
894            in the read/write command did not match the C value read from the disc */
894                in the read/write command did not match the C value read from the disc */
895895
896896            /* no data - checked on Amstrad CPC */
897897            fdc->nec765_status[1] |= NEC765_ST1_NO_DATA;
r5932r5933
901901            if (id.C == 0x0ff)
902902            {
903903               /* the C value is 0x0ff which indicates a bad track in the IBM soft-sectored
904               format */
904                    format */
905905               fdc->nec765_status[2] |= NEC765_ST2_BAD_CYLINDER;
906906            }
907907
r5932r5933
938938   /* completed read command */
939939
940940   /* 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        */
945945
946946   /* if end of cylinder is set, and we did receive a terminal count, then clear it */
947947   if ((fdc->nec765_flags & NEC765_TC)!=0)
r5932r5933
11311131   /* completed read command */
11321132
11331133   /* 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     */
11381138
11391139   /* if end of cylinder is set, and we did receive a terminal count, then clear it */
11401140   if ((fdc->nec765_flags & NEC765_TC)!=0)
r5932r5933
12211221   if (fdc->nec765_command_bytes[0] & 0x080)
12221222   {
12231223      /* 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????
12281228
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.
12311231
1232      To be checked!!!!
1233      */
1232        To be checked!!!!
1233        */
12341234
12351235      /* if just read last sector and on side 1 - finish */
12361236      if ((nec765_just_read_last_sector_on_track(device)) &&
r5932r5933
12671267
12681268   /* Multi-Track operation:
12691269
1270   Verified on Amstrad CPC.
1270    Verified on Amstrad CPC.
12711271
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
12761276
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
12831283
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
12941294
12951295
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"
13041304
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
13101310
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
13171317
13181318  */
13191319
r5932r5933
13241324      if (fdc->nec765_command_bytes[0] & 0x080)
13251325      {
13261326         /* if we have reached EOT (fdc->nec765_command_bytes[6])
1327         on side 1, then read is complete */
1327            on side 1, then read is complete */
13281328         if (fdc->side==1)
13291329            return 1;
13301330
r5932r5933
16741674      if (fdc->nec765_flags & NEC765_SEEK_ACTIVE)
16751675      {
16761676         /* any command results in a invalid - I think that seek, recalibrate and
1677         sense interrupt status may work*/
1677            sense interrupt status may work*/
16781678         fdc->nec765_data_reg = 0;
16791679      }
16801680
r5932r5933
18661866      case 0x04:  /* sense drive status */
18671867         nec765_setup_drive_and_side(device);
18681868         img = current_image(device);
1869         
1869
18701870         fdc->nec765_status[3] = fdc->drive | (fdc->side<<2);
18711871
18721872         if (img)
r5932r5933
19051905      case 0x0a:      /* read id */
19061906         nec765_setup_drive_and_side(device);
19071907         img = current_image(device);
1908         
1908
19091909         fdc->nec765_status[0] = fdc->drive | (fdc->side<<2);
19101910         fdc->nec765_status[1] = 0;
19111911         fdc->nec765_status[2] = 0;
r5932r5933
21972197      fdc->nec765_status[0] = 0x080 | 0x040;
21982198
21992199      /* 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?? */
22022202
22032203      a_drive_is_ready = 0;
22042204      for (i = 0; i < 4; i++)
22052205      {
2206         if (fdc->intf->floppy_drive_tags[i]!=NULL) {           
2206         if (fdc->intf->floppy_drive_tags[i]!=NULL) {
22072207            if (image_exists(devtag_get_device(device->machine,fdc->intf->floppy_drive_tags[i]))) {
22082208               a_drive_is_ready = 1;
22092209               break;
src/mess/machine/pc1401.c
r5932r5933
4343{
4444   int data = outa;
4545
46   if (outb & 0x01)
46   if (outb & 0x01)
4747      data |= input_port_read(device->machine, "KEY0");
4848
49   if (outb & 0x02)
49   if (outb & 0x02)
5050      data |= input_port_read(device->machine, "KEY1");
5151
52   if (outb & 0x04)
52   if (outb & 0x04)
5353      data |= input_port_read(device->machine, "KEY2");
5454
55   if (outb & 0x08)
55   if (outb & 0x08)
5656      data |= input_port_read(device->machine, "KEY3");
5757
58   if (outb & 0x10)
58   if (outb & 0x10)
5959      data |= input_port_read(device->machine, "KEY4");
6060
61   if (outb & 0x20)
61   if (outb & 0x20)
6262   {
6363      data |= input_port_read(device->machine, "KEY5");
64   
64
6565      /* At Power Up we fake a 'C-CE' pressure */
6666      if (power)
6767         data |= 0x01;
6868   }
6969
70   if (outa & 0x01)
70   if (outa & 0x01)
7171      data |= input_port_read(device->machine, "KEY6");
7272
73   if (outa & 0x02)
73   if (outa & 0x02)
7474      data |= input_port_read(device->machine, "KEY7");
7575
76   if (outa & 0x04)
76   if (outa & 0x04)
7777      data |= input_port_read(device->machine, "KEY8");
7878
7979   if (outa & 0x08)
r5932r5933
9595{
9696   int data=outb;
9797
98   if (input_port_read(device->machine, "EXTRA") & 0x04)
98   if (input_port_read(device->machine, "EXTRA") & 0x04)
9999      data |= 0x01;
100100
101101   return data;
r5932r5933
148148#if 0
149149   char sucker[]={
150150      /* 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        */
156156#if 1
157157      18,4,/*lip xl */
158158      2,0,/*lia 0 startaddress low */
r5932r5933
183183/*400f x: */
184184      /* dump external memory */
185185      4, /*ix */
186      87,/*            ldd */
186      87,/*                ldd */
187187#endif
188188      218,/*exab */
189189
r5932r5933
192192      0,4,/*lii 4 */
193193
194194      /*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 */
200200      2,2, /*lia 2 */
201      196,/*              adcm */
202      95,/*              outf */
201      196,/*                adcm */
202      95,/*                 outf */
203203      /*b:  */
204204      204,/*inb */
205205      102,128,/*tsia 0x80 */
206206#if 0
207      41,4,/*            jnzm b */
207      41,4,/*            jnzm b */
208208#else
209209      /* input not working reliable! */
210210      /* so handshake removed, PC side must run with disabled */
r5932r5933
212212      78,20, /*wait 20 */
213213#endif
214214
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 */
219219      96,252,/*anma 252 */
220      2,0,/*              lia 0 */
220      2,0,/*                lia 0 */
221221      196,/*adcm */
222      95,/*              outf */
222      95,/*                 outf */
223223      /*c:  */
224224      204,/*inb */
225225      102,128,/*tsia 0x80 */
226226#if 0
227      57,4,/*            jzm c */
227      57,4,/*            jzm c */
228228#else
229229      78,20, /*wait 20 */
230230#endif
r5932r5933
234234
235235      41,41,/*jnzm x: */
236236
237      55,/*            rtn */
237      55,/*               rtn */
238238   };
239239
240240   for (i=0; i<sizeof(sucker);i++) pc1401_mem[0x4000+i]=sucker[i];
241241   logerror("%d %d\n",i, 0x4000+i);
242242#endif
243243
244   for (i=0; i<128; i++)
244   for (i=0; i<128; i++)
245245      gfx[i]=i;
246246
247247   timer_set(machine, ATTOTIME_IN_SEC(1), NULL, 0, pc1401_power_up);
src/mess/machine/upd1990a.c
r5932r5933
11/**********************************************************************
22
3   NEC uPD1990AC Serial I/O Calendar & Clock emulation
3    NEC uPD1990AC Serial I/O Calendar & Clock emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88*********************************************************************/
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - test mode
14    - test mode
1515
1616*/
1717
r5932r5933
5757   int c;                  /* command */
5858   int clk;               /* shift clock */
5959   int tp;                  /* time pulse */
60   
60
6161   /* timers */
6262   emu_timer *clock_timer;
6363   emu_timer *data_out_timer;
r5932r5933
155155
156156      case UPD1990A_MODE_SHIFT:
157157         if (LOG) logerror("UPD1990A Shift Mode\n");
158         
158
159159         /* enable time counter */
160160         timer_enable(upd1990a->clock_timer, 1);
161161
r5932r5933
201201      case UPD1990A_MODE_TIME_READ:
202202         {
203203         int i;
204         
204
205205         if (LOG) logerror("UPD1990A Time Read Mode\n");
206206
207207         /* enable time counter */
r5932r5933
226226
227227      case UPD1990A_MODE_TP_64HZ_SET:
228228         if (LOG) logerror("UPD1990A TP = 64 Hz Set Mode\n");
229         
229
230230         /* 64 Hz time pulse */
231231         timer_adjust_periodic(upd1990a->tp_timer, attotime_zero, 0, ATTOTIME_IN_HZ(64*2));
232232         break;
233233
234234      case UPD1990A_MODE_TP_256HZ_SET:
235235         if (LOG) logerror("UPD1990A TP = 256 Hz Set Mode\n");
236         
236
237237         /* 256 Hz time pulse */
238238         timer_adjust_periodic(upd1990a->tp_timer, attotime_zero, 0, ATTOTIME_IN_HZ(256*2));
239239         break;
src/mess/machine/nec765.h
r5932r5933
11/***************************************************************************
22
3   machine/nec765.h
3    machine/nec765.h
44
5   Functions to emulate a NEC765/Intel 8272 compatible floppy disk controller
5    Functions to emulate a NEC765/Intel 8272 compatible floppy disk controller
66
77***************************************************************************/
88
r5932r5933
5252
5353   /* image lookup */
5454   nec765_get_image_func get_image;
55   
55
5656   NEC765_RDY_PIN rdy_pin;
57   
57
5858   const char *floppy_drive_tags[4];
5959} nec765_interface;
6060
src/mess/machine/apple2gs.c
r5932r5933
11/*********************************************************************
22
3   apple2gs.c
3    apple2gs.c
44
5   Apple IIgs code
5    Apple IIgs code
66
77
8   Apple IIgs specific softswitches:
8    Apple IIgs specific softswitches:
99
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)
1212
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
1616
17   C023 - VGCINT
18      bit 7 - set for interrupt generated by VGC
17    C023 - VGCINT
18        bit 7 - set for interrupt generated by VGC
1919
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
2222
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
2626
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
2929
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
3939
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
4949
50   C02D - SLTROMSEL
50    C02D - SLTROMSEL
5151
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
5555
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
6565
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
7575
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
8282
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
9292
93   C047 - CLRVBLINT
93    C047 - CLRVBLINT
9494
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
104104
105105*********************************************************************/
106106
r5932r5933
17221722{
17231723   apple2gs_clock_timer = timer_alloc(machine, apple2gs_clock_tick, NULL);
17241724   timer_adjust_periodic(apple2gs_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
1725   
1725
17261726   apple2gs_qsecond_timer = timer_alloc(machine, apple2gs_qsecond_tick, NULL);
17271727   timer_adjust_periodic(apple2gs_qsecond_timer, ATTOTIME_IN_USEC(266700), 0, ATTOTIME_IN_USEC(266700));
1728   
1728
17291729   apple2gs_scanline_timer = timer_alloc(machine, apple2gs_scanline_tick, NULL);
17301730   timer_adjust_oneshot(apple2gs_scanline_timer, attotime_never, 0);
17311731
src/mess/machine/x68k_hdc.c
r5932r5933
11/*
22
3   X68000 custom SASI Hard Disk controller
3    X68000 custom SASI Hard Disk controller
44
55 0xe96001 (R/W) - SASI data I/O
66 0xe96003 (W)   - SEL signal high (0)
r5932r5933
258258            case SASI_CMD_FORMAT_UNIT:
259259            case SASI_CMD_FORMAT_UNIT_06:
260260               /*
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                    */
269269                  sasi->phase = SASI_PHASE_STATUS;
270270                  sasi->io = 1;  // Output
271271                  sasi->status_port |= 0x04;  // C/D remains the same
r5932r5933
323323      break;
324324   }
325325
326//   logerror("SASI: write to HDC, offset %04x, data %04x\n",offset,data);
326//  logerror("SASI: write to HDC, offset %04x, data %04x\n",offset,data);
327327}
328328
329329READ16_DEVICE_HANDLER( x68k_hdc_r )
r5932r5933
427427      }
428428      return 0x00;
429429   case 0x01:
430//      logerror("SASI: [%08x] read from status port, read 0x%02x\n",activecpu_get_pc(),sasi->status_port);
430//      logerror("SASI: [%08x] read from status port, read 0x%02x\n",activecpu_get_pc(),sasi->status_port);
431431      return sasi->status_port;
432432   case 0x02:
433433      return 0xff;  // write-only
src/mess/machine/upd1990a.h
r5932r5933
11/**********************************************************************
22
3   NEC uPD1990AC Serial I/O Calendar & Clock emulation
3    NEC uPD1990AC Serial I/O Calendar & Clock emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
1717
1818**********************************************************************/
1919
src/mess/machine/x68k_hdc.h
r5932r5933
11/*
22
3   X68000 Custom SASI HD controller
3    X68000 Custom SASI HD controller
44
55*/
66
src/mess/machine/mac.c
r5932r5933
11/****************************************************************************
22
3   machine/mac.c
3    machine/mac.c
44
5   Mac hardware - Mac 128k, 512k, 512ke, Plus, SE, Classic, II (SCSI, SCC, ADB, etc)
5    Mac hardware - Mac 128k, 512k, 512ke, Plus, SE, Classic, II (SCSI, SCC, ADB, etc)
66
7   Nate Woods
8   Ernesto Corvi
9   Raphael Nabet
10   R. Belmont
7    Nate Woods
8    Ernesto Corvi
9    Raphael Nabet
10    R. Belmont
1111
12   Mac Model Feature Summary:
12    Mac Model Feature Summary:
1313
1414                                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
3232
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.
5454
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 ?
6363
6464
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
6969
7070
7171****************************************************************************/
r5932r5933
270270
271271
272272/*
273   Interrupt handling
273    Interrupt handling
274274*/
275275
276276static int scc_interrupt, via_interrupt, scsi_interrupt, last_taken_interrupt;
r5932r5933
393393
394394
395395/*
396   R Nabet 000531 : added keyboard code
396    R Nabet 000531 : added keyboard code
397397*/
398398
399399/* *************************************************************************
r5932r5933
428428static int kbd_shift_count;
429429
430430/*
431   scan_keyboard()
431    scan_keyboard()
432432
433   scan the keyboard, and returns key transition code (or NULL ($7B) if none)
433    scan the keyboard, and returns key transition code (or NULL ($7B) if none)
434434*/
435435
436436/* keyboard matrix to detect transition */
r5932r5933
544544}
545545
546546/*
547   power-up init
547    power-up init
548548*/
549549static void keyboard_init(void)
550550{
r5932r5933
624624}
625625
626626/*
627   called when inquiry times out (1/4s)
627    called when inquiry times out (1/4s)
628628*/
629629static TIMER_CALLBACK(inquiry_timeout_func)
630630{
r5932r5933
634634}
635635
636636/*
637   called when a command is received from the mac
637    called when a command is received from the mac
638638*/
639639static void keyboard_receive(running_machine *machine, int val)
640640{
r5932r5933
681681      }
682682
683683      /* format : 1 if another device (-> keypad ?) connected | next device (-> keypad ?) number 1-8
684                     | keyboard model number 1-8 | 1  */
684                            | keyboard model number 1-8 | 1  */
685685      /* 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        */
689689      /* keypads :
690         ??? : standard keypad (always available on Mac Plus) ???
691      */
690            ??? : standard keypad (always available on Mac Plus) ???
691        */
692692      kbd_shift_out(machine, 0x17);   /* probably wrong */
693693      break;
694694
r5932r5933
840840  scsiRd+sIDR         $580060    Input Data Register
841841  scsiRd+sRESET       $580070    Reset Parity/Interrupt
842842
843          */
843            */
844844
845845READ16_HANDLER ( macplus_scsi_r )
846846{
r5932r5933
10561056            ++rtc_seconds[3];
10571057
10581058   /*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];*/
10621062}
10631063
10641064/* Executes a command.
r5932r5933
12781278READ16_HANDLER ( mac_iwm_r )
12791279{
12801280   /* 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     */
12871287
12881288   UINT16 result = 0;
12891289   const device_config *fdc = devtag_get_device(space->machine, "fdc");
r5932r5933
13311331{
13321332   int NewX, NewY;
13331333
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");
13361336
13371337   if ((NewX != adb_lastmousex) || (NewY != adb_lastmousey))
13381338   {
r5932r5933
13451345   int MouseCountX = 0, MouseCountY = 0;
13461346   int NewX, NewY;
13471347
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");
13501350
13511351   /* see if it moved in the x coord */
13521352   if (NewX != adb_lastmousex)
r5932r5933
13911391   addr = (adb_command>>4);
13921392   reg = (adb_command & 3);
13931393
1394//   printf("Mac sent %x\n", adb_command);
1394//  printf("Mac sent %x\n", adb_command);
13951395
13961396   if (adb_waiting_cmd)
13971397   {
r5932r5933
14171417            break;
14181418
14191419         case 2:   // listen
1420//            printf("ADB LISTEN: reg %x address %x\n", reg, addr);
1420//              printf("ADB LISTEN: reg %x address %x\n", reg, addr);
14211421            adb_direction = 1;   // input from Mac
14221422            adb_listenreg = reg;
14231423            adb_listenaddr = addr;
14241424            break;
14251425
14261426         case 3: // talk
1427//            printf("ADB TALK: reg %x address %x\n", reg, addr);
1427//              printf("ADB TALK: reg %x address %x\n", reg, addr);
14281428
14291429            adb_direction = 0;       // output to Mac
14301430            if (addr == adb_mouseaddr)
14311431            {
14321432               UINT8 mouseX, mouseY;
14331433
1434//               printf("Talking to mouse, register %x\n", reg);
1434//                  printf("Talking to mouse, register %x\n", reg);
14351435
14361436               switch (reg)
14371437               {
14381438                  // read mouse
1439                  case 0:   
1439                  case 0:
14401440                     mac_adb_accummouse(machine, &mouseX, &mouseY);
14411441                     adb_buffer[0] = (input_port_read(machine, "MOUSE0") & 0x01) ? 0x00 : 0x80;
14421442                     adb_buffer[0] |= mouseX & 0x7f;
r5932r5933
14591459            }
14601460            else if (addr == adb_keybaddr)
14611461            {
1462//               printf("Talking to keyboard, register %x\n", reg);
1462//                  printf("Talking to keyboard, register %x\n", reg);
14631463
14641464               switch (reg)
14651465               {
14661466                  // read keyboard
1467                  case 0:   
1467                  case 0:
14681468                     adb_buffer[0] = adb_buffer[1] = 0x80;     // nothing pressed
14691469                     adb_datasize = 2;
14701470                     break;
r5932r5933
15391539   ret = (adb_send & 0x80)>>7;
15401540   adb_send <<= 1;
15411541
1542//   printf("IN CB2 = %x\n", ret);
1542//  printf("IN CB2 = %x\n", ret);
15431543
15441544   return ret;
15451545}
15461546
15471547static WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2)
15481548{
1549//   printf("OUT CB2 = %x\n", data);
1549//  printf("OUT CB2 = %x\n", data);
15501550   adb_command <<= 1;
15511551   adb_command |= data & 1;
15521552}
r5932r5933
16501650 *
16511651 * PORT A
16521652 *
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
16591659 *
16601660 *
16611661 * PORT B
16621662 *
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
16741674 *
16751675 */
16761676
r5932r5933
17361736   mac_set_volume(sound, data & 0x07);
17371737
17381738   /* 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. */
17411741   if (mac_model < MODEL_MAC_SE)
17421742      set_memory_overlay(device->machine, (data & 0x10) >> 4);
17431743}
r5932r5933
19961996    { SCSI_ID_6, "harddisk2", SCSI_DEVICE_HARDDISK }   /* SCSI ID 6, using CHD 0, and it's a harddisk */
19971997   }
19981998};
1999                   // 41a868       41a5ac = data copy
1999                   // 41a868        41a5ac = data copy
20002000static const struct NCR5380interface macplus_5380intf =
20012001{
20022002   &dev_table,   // SCSI device table
r5932r5933
20112011MACHINE_START( macscsi )
20122012{
20132013   ncr5380_init(machine, &macplus_5380intf);
2014   
2014
20152015   add_exit_callback(machine, macscsi_exit);
20162016}
20172017
r5932r5933
30403040
30413041   case 0xa9a0:   /* _GetResource */
30423042      /* 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         */
30453045      sprintf(s, " type='%c%c%c%c' id=%i", (char) mem[a7+3], (char) mem[a7+2],
30463046         (char) mem[a7+5], (char) mem[a7+4], *((INT16*) (mem + a7)));
30473047      break;
src/mess/machine/pcf8593.c
r5932r5933
11/*********************************************************************
22
3   Philips PCF8593 CMOS clock/calendar circuit
3    Philips PCF8593 CMOS clock/calendar circuit
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
77*********************************************************************/
88
r5932r5933
423423/*
424424NVRAM_HANDLER( pcf8593 )
425425{
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    }
442442}
443443*/
444444
src/mess/machine/ac1.c
r5932r5933
1111#include "includes/ac1.h"
1212
1313static READ8_DEVICE_HANDLER (ac1_port_b_r)
14{   
14{
1515   return 0xff;
1616}
1717
r5932r5933
2626   UINT8 line4 = input_port_read(device->machine, "LINE4");
2727   UINT8 line5 = input_port_read(device->machine, "LINE5");
2828   UINT8 line6 = input_port_read(device->machine, "LINE6");
29   
29
3030   UINT8 SH    = BNOT(BIT(line6,0));
3131   UINT8 CTRL  = BNOT(BIT(line6,1));
3232   UINT8 SPACE = BIT(line6,2);
3333   UINT8 ENTER = BIT(line6,3);
3434   UINT8 BACK  = BIT(line6,4);
35   
35
3636   UINT8 all = line0 | line1 | line2 | line3 | line4 | line5;
3737   UINT8 s1 = BNOT(BIT(all,0));UINT8 z1 = (line0 !=0) ? 0 : 1;
3838   UINT8 s2 = BNOT(BIT(all,1));UINT8 z2 = (line1 !=0) ? 0 : 1;
r5932r5933
4343   UINT8 s7 = BNOT(BIT(all,6));
4444   UINT8 s8 = BNOT(BIT(all,7));
4545   UINT8 tast,td0,td1,td2,td3,td4,td5,td6,dg5;
46   
46
4747   /* Additional double keys */
4848   if (SPACE) {
4949      z1 = 0; s1 = 0; SH = 0;
r5932r5933
5454   if (BACK) {
5555      z4 = 0; s1 = 0; CTRL = 0;
5656   }
57   
57
5858   tast = BNOT(s1 & s2 & s3 & s4 & s5 &s6 & s7 & s8);
5959   td0  = BNOT(s2 & s4 & s6 & s8);
6060   td1  = BNOT(s3 & s4 & s7 & s8);
r5932r5933
6464   dg5  = BNOT(z3 & z4 & z5 & z6);
6565   td5  = BNOT(BNOT(dg5 & BNOT(SH)) & z1 & z2);
6666   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);
6868}
6969
7070static WRITE8_DEVICE_HANDLER (ac1_port_a_w)
src/mess/machine/i8212.c
r5932r5933
138138   devcb_resolve_write_line(&i8212->out_int_func, &intf->out_int_func, device);
139139   devcb_resolve_read8(&i8212->in_di_func, &intf->in_di_func, device);
140140   devcb_resolve_write8(&i8212->out_do_func, &intf->out_do_func, device);
141   
141
142142   /* register for state saving */
143143   state_save_register_device_item(device, 0, i8212->md);
144144   state_save_register_device_item(device, 0, i8212->stb);
src/mess/machine/mpc105.c
r5932r5933
11/***************************************************************************
22
3   machine/mpc105.h
3    machine/mpc105.h
44
5   Motorola MPC105 PCI bridge
5    Motorola MPC105 PCI bridge
66
77***************************************************************************/
88
src/mess/machine/pcf8593.h
r5932r5933
11/*********************************************************************
22
3   Philips PCF8593 CMOS clock/calendar circuit
3    Philips PCF8593 CMOS clock/calendar circuit
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
77*********************************************************************/
88
src/mess/machine/i8212.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
2222
2323**********************************************************************/
2424
src/mess/machine/i8271.c
r5932r5933
194194      return devtag_get_device(device->machine,i8271->intf->floppy_drive_tags[i8271->drive]);
195195   } else {
196196      return NULL;
197   }   
197   }
198198}
199199
200200
r5932r5933
10781078         status |= (1<<2) | (1<<6);
10791079
10801080         /* these two do not appear to be set at all! ?? */
1081         
1081
10821082         if (i8271->intf->floppy_drive_tags[0]!=NULL) {
10831083            if (floppy_drive_get_flag_state(devtag_get_device(device->machine,i8271->intf->floppy_drive_tags[0]), FLOPPY_DRIVE_READY))
10841084            {
src/mess/machine/mpc105.h
r5932r5933
11/***************************************************************************
22
3   machine/mpc105.h
3    machine/mpc105.h
44
5   Motorola MPC105 PCI bridge
5    Motorola MPC105 PCI bridge
66
77***************************************************************************/
88
src/mess/machine/990_tap.c
r5932r5933
11/*
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).
55
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.
1111
1212
13   Long description: see 2234398-9701 and 2306140-9701.
13    Long description: see 2234398-9701 and 2306140-9701.
1414
1515
16   Raphael Nabet 2002
16    Raphael Nabet 2002
1717*/
1818/*
19   Image encoding:
19    Image encoding:
2020
2121
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?)
2727
28   4 0s: EOF mark
28    4 0s: EOF mark
2929*/
3030
3131#include "driver.h"
r5932r5933
8686   w7_tiline_parity_err   = 0x0010,
8787   w7_tiline_timing_err   = 0x0008,
8888   w7_tiline_timeout_err   = 0x0004,
89   /*w7_format_error      = 0x0002,*/
89   /*w7_format_error       = 0x0002,*/
9090   w7_tape_error      = 0x0001
9191};
9292
9393static const UINT16 w_mask[8] =
9494{
9595   0x000f,      /* Controllers should prevent overwriting of w0 status bits, and I know
96            that some controllers do so. */
96                that some controllers do so. */
9797   0xffff,
9898   0xffff,
9999   0xffff,
r5932r5933
124124
125125/*DEVICE_STOP( ti990_tape )
126126{
127   d->img = NULL;
127    d->img = NULL;
128128}*/
129129
130130/*
131   Open a tape image
131    Open a tape image
132132*/
133133DEVICE_IMAGE_LOAD( ti990_tape )
134134{
r5932r5933
151151}
152152
153153/*
154   Close a tape image
154    Close a tape image
155155*/
156156DEVICE_IMAGE_UNLOAD( ti990_tape )
157157{
r5932r5933
168168}
169169
170170/*
171   Init the tape controller core
171    Init the tape controller core
172172*/
173173void ti990_tpc_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state))
174174{
r5932r5933
183183}
184184
185185/*
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)
188188*/
189189static int cur_tape_unit(void)
190190{
r5932r5933
209209}
210210
211211/*
212   Update interrupt state
212    Update interrupt state
213213*/
214214static void update_interrupt(running_machine *machine)
215215{
r5932r5933
220220}
221221
222222/*
223   Handle the read binary forward command: read the next record on tape.
223    Handle the read binary forward command: read the next record on tape.
224224*/
225225static void cmd_read_binary_forward(running_machine *machine)
226226{
r5932r5933
446446}
447447
448448/*
449   Handle the record skip forward command: skip a specified number of records.
449    Handle the record skip forward command: skip a specified number of records.
450450*/
451451static void cmd_record_skip_forward(running_machine *machine)
452452{
r5932r5933
582582}
583583
584584/*
585   Handle the record skip reverse command: skip a specified number of records backwards.
585    Handle the record skip reverse command: skip a specified number of records backwards.
586586*/
587587static void cmd_record_skip_reverse(running_machine *machine)
588588{
r5932r5933
740740}
741741
742742/*
743   Handle the rewind command: rewind to BOT.
743    Handle the rewind command: rewind to BOT.
744744*/
745745static void cmd_rewind(running_machine *machine)
746746{
r5932r5933
787787}
788788
789789/*
790   Handle the rewind and offline command: disable the tape unit.
790    Handle the rewind and offline command: disable the tape unit.
791791*/
792792static void cmd_rewind_and_offline(running_machine *machine)
793793{
r5932r5933
825825}
826826
827827/*
828   Handle the read transport status command: return the current tape status.
828    Handle the read transport status command: return the current tape status.
829829*/
830830static void read_transport_status(running_machine *machine)
831831{
r5932r5933
865865}
866866
867867/*
868   Parse command code and execute the command.
868    Parse command code and execute the command.
869869*/
870870static void execute_command(running_machine *machine)
871871{
r5932r5933
952952
953953
954954/*
955   Read one register in TPCS space
955    Read one register in TPCS space
956956*/
957957READ16_HANDLER(ti990_tpc_r)
958958{
r5932r5933
963963}
964964
965965/*
966   Write one register in TPCS space.  Execute command if w7_idle is cleared.
966    Write one register in TPCS space.  Execute command if w7_idle is cleared.
967967*/
968968WRITE16_HANDLER(ti990_tpc_w)
969969{
src/mess/machine/amigacd.c
r5932r5933
11/***************************************************************************
22
3   Amiga CD-ROM controller emulation
3    Amiga CD-ROM controller emulation
44
55Notes:
66Many thanks to Toni Wilen for all the help and information about the
r5932r5933
2828
2929/***************************************************************************
3030
31   DMAC
31    DMAC
3232
3333***************************************************************************/
3434
r5932r5933
382382
383383/***************************************************************************
384384
385   Autoconfig
385    Autoconfig
386386
387387***************************************************************************/
388388
r5932r5933
420420
421421/***************************************************************************
422422
423   TPI6525
423    TPI6525
424424
425425***************************************************************************/
426426
src/mess/machine/990_tap.h
r5932r5933
11/*
2   990_tap.h: include file for 990_tap.c
2    990_tap.h: include file for 990_tap.c
33*/
44
55DEVICE_START( ti990_tape );
src/mess/machine/concept.c
r5932r5933
11/*
2   Corvus Concept driver
2    Corvus Concept driver
33
4   Raphael Nabet, Brett Wyer, 2003-2005
4    Raphael Nabet, Brett Wyer, 2003-2005
55*/
66
77#include "driver.h"
r5932r5933
205205}
206206
207207/*
208   VIA port A
208    VIA port A
209209
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)
218218*/
219219static  READ8_DEVICE_HANDLER(via_in_a)
220220{
r5932r5933
229229}
230230
231231/*
232   VIA port B
232    VIA port B
233233
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)
242242*/
243243static READ8_DEVICE_HANDLER(via_in_b)
244244{
r5932r5933
255255}
256256
257257/*
258   VIA CB2: used as sound output
258    VIA CB2: used as sound output
259259*/
260260static WRITE8_DEVICE_HANDLER(via_out_cb2)
261261{
r5932r5933
263263}
264264
265265/*
266   VIA irq -> 68k level 5
266    VIA irq -> 68k level 5
267267*/
268268static void via_irq_func(const device_config *device, int state)
269269{
r5932r5933
527527}
528528
529529/*
530   Concept fdc controller
530    Concept fdc controller
531531*/
532532
533533static UINT8 fdc_local_status;
r5932r5933
677677}
678678
679679/*
680 *   Concept Hard Disk Controller (hdc)
680 *  Concept Hard Disk Controller (hdc)
681681 */
682682
683683static  READ8_HANDLER(concept_hdc_reg_r);
r5932r5933
685685static  READ8_HANDLER(concept_hdc_rom_r);
686686
687687/*
688 *   Hook up the Register and ROM R/W routines into the Slot I/O Space
688 *  Hook up the Register and ROM R/W routines into the Slot I/O Space
689689 */
690690
691691static void concept_hdc_init(running_machine *machine, int slot)
r5932r5933
695695}
696696
697697/*
698 *   Handle reads against the Hard Disk Controller's onboard registers
698 *  Handle reads against the Hard Disk Controller's onboard registers
699699 */
700700static READ8_HANDLER(concept_hdc_reg_r)
701701{
r5932r5933
714714}
715715
716716/*
717 *   Handle writes against the Hard Disk Controller's onboard registers
717 *  Handle writes against the Hard Disk Controller's onboard registers
718718 */
719719static WRITE8_HANDLER(concept_hdc_reg_w)
720720{
r5932r5933
728728}
729729
730730/*
731 *   Handle reads agsint the Hard Disk Controller's onboard ROM
731 *  Handle reads agsint the Hard Disk Controller's onboard ROM
732732 */
733733static  READ8_HANDLER(concept_hdc_rom_r)
734734{
src/mess/machine/upd7002.c
r5932r5933
33
44    MESS Driver By:
55
6   Gordon Jefferyes
7   mess_bbc@gjeffery.dircon.co.uk
6    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
88
99******************************************************************************/
1010
r5932r5933
1919   const uPD7002_interface *intf;
2020
2121   /* 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    */
3030   int status;
3131
3232   /* High data byte
33      This byte contains the 8 most significant bits of the analogue to digital conversion. */
33        This byte contains the 8 most significant bits of the analogue to digital conversion. */
3434   int data1;
3535
3636   /* 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. */
4040   int data0;
4141
4242
r5932r5933
4444   int digitalvalue;
4545
4646   /* 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 */
5050   int conversion_counter;
5151};
5252
r5932r5933
122122   {
123123      case 0:
124124      /*
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.
130130
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
133133
134         writing to this register will initiate a conversion.
135      */
134            writing to this register will initiate a conversion.
135        */
136136
137137      /* set D6=0 busy ,D7=1 conversion not complete */
138138      uPD7002->status=(data & 0x0f) | 0x80;
r5932r5933
142142      if (uPD7002->intf->EOC_func) uPD7002->intf->EOC_func(device, 1);
143143
144144      /* the uPD7002 works by sampling the analogue value at the start of the conversion
145         so it is read hear and stored until the end of the A to D conversion */
145           so it is read hear and stored until the end of the A to D conversion */
146146
147147      // this function should return a 16 bit value.
148148      uPD7002->digitalvalue = uPD7002->intf->get_analogue_func(device, uPD7002->status & 0x03);
r5932r5933
166166
167167      case 3:
168168      /* 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        */
172172      break;
173173   }
174174}
src/mess/machine/at29040.c
r5932r5933
11/*
2   Atmel at29c040a flash EEPROM
2    Atmel at29c040a flash EEPROM
33
4   512k*8 FEEPROM, organized in pages of 256 bytes.
4    512k*8 FEEPROM, organized in pages of 256 bytes.
55
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)
88
9   Raphael Nabet 2003
9    Raphael Nabet 2003
1010*/
1111
1212#include "driver.h"
r5932r5933
2424#define BYTE_ADDRESS_MASK   0x000ff
2525
2626/*
27   at29c40a state
27    at29c40a state
2828
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
3333
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
4040*/
4141static struct
4242{
r5932r5933
7575
7676
7777/*
78   programming timer callback
78    programming timer callback
7979*/
8080static TIMER_CALLBACK(at29c040a_programming_timer_callback)
8181{
r5932r5933
118118}
119119
120120/*
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)
123123*/
124124void at29c040a_init_data_ptr(int id, UINT8 *data_ptr)
125125{
r5932r5933
127127}
128128
129129/*
130   Initialize one FEEPROM chip: must be called at machine init time
130    Initialize one FEEPROM chip: must be called at machine init time
131131*/
132132void at29c040a_init(running_machine *machine,int id)
133133{
r5932r5933
135135}
136136
137137/*
138   load the contents of one FEEPROM file
138    load the contents of one FEEPROM file
139139*/
140140int at29c040a_file_load(int id, mame_file *file)
141141{
r5932r5933
148148      return 1;
149149
150150   /* chip state: lower boot block lockout, higher boot block lockout,
151   software data protect */
151    software data protect */
152152   if (mame_fread(file, & buf, 1) != 1)
153153      return 1;
154154   at29c040a[id].s_lower_bbl = (buf >> 2) & 1;
r5932r5933
165165}
166166
167167/*
168   save the FEEPROM contents to file
168    save the FEEPROM contents to file
169169*/
170170int at29c040a_file_save(int id, mame_file *file)
171171{
r5932r5933
177177      return 1;
178178
179179   /* chip state: lower boot block lockout, higher boot block lockout,
180   software data protect */
180    software data protect */
181181   buf = (at29c040a[id].s_lower_bbl << 2) | (at29c040a[id].s_higher_bbl << 1) | at29c040a[id].s_sdp;
182182   if (mame_fwrite(file, & buf, 1) != 1)
183183      return 1;
r5932r5933
195195}
196196
197197/*
198   read a byte from FEEPROM
198    read a byte from FEEPROM
199199*/
200200UINT8 at29c040a_r(int id, offs_t offset)
201201{
r5932r5933
212212   if (at29c040a[id].s_pgm == s_pgm_1)
213213   {
214214      /* attempty to access a locked out boot block: cancel programming
215      command if necessary */
215        command if necessary */
216216      at29c040a[id].s_pgm = s_pgm_0;
217217      at29c040a[id].s_enabling_sdb = FALSE;
218218      at29c040a[id].s_disabling_sdb = FALSE;
r5932r5933
266266}
267267
268268/*
269   write a byte to FEEPROM
269    write a byte to FEEPROM
270270*/
271271void at29c040a_w(int id, offs_t offset, UINT8 data)
272272{
r5932r5933
404404         || ((offset >= FEEPROM_SIZE-BOOT_BLOCK_SIZE) && at29c040a[id].s_higher_bbl))
405405      {
406406         /* attempty to access a locked out boot block: cancel programming
407         command if necessary */
407            command if necessary */
408408         at29c040a[id].s_pgm = s_pgm_0;
409409         at29c040a[id].s_enabling_sdb = FALSE;
410410         at29c040a[id].s_disabling_sdb = FALSE;
src/mess/machine/msx.c
r5932r5933
214214      else /*if (size <= 0xc000) */ {
215215         if (page) {
216216            /* shift up 16kB; custom memcpy so overlapping memory
217               isn't corrupted. ROM starts in page 1 (0x4000) */
217                   isn't corrupted. ROM starts in page 1 (0x4000) */
218218            UINT8 *m;
219219
220220            page = 1;
r5932r5933
474474
475475   memset (&msx1, 0, sizeof (MSX));
476476   /* 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++)
478478   {
479479      msx1.cart_state[i] = cart_state[i];
480480   }
r5932r5933
690690
691691adress
692692
6937FF8H read   status register
694     write command register
6957FF9H  r/w   track register (r/o on NMS 8245 and Sony)
6967FFAH  r/w   sector register (r/o on NMS 8245 and Sony)
6977FFBH  r/w   data register
6937FF8H read  status register
694      write command register
6957FF9H  r/w  track register (r/o on NMS 8245 and Sony)
6967FFAH  r/w  sector register (r/o on NMS 8245 and Sony)
6977FFBH  r/w  data register
698698
699699
700700hardware registers
r5932r5933
703703
7047047FFCH r/w  bit 0 side select
7057057FFDH r/w  b7>M-on , b6>in-use , b1>ds1 , b0>ds0  (all neg. logic)
7067FFEH        not used
7067FFEH         not used
7077077FFFH read b7>drq , b6>intrq
708708
709709set on 7FFDH bit 2 always to 0 (some use it as disk change reset)
src/mess/machine/adc080x.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
2424
2525**********************************************************************/
2626
src/mess/machine/mz700.c
r5932r5933
11/******************************************************************************
2 *   Sharp MZ700
2 *  Sharp MZ700
33 *
4 *   machine driver
4 *  machine driver
55 *
6 *   Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000
6 *  Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000
77 *
88 *  Reference: http://sharpmz.computingmuseum.com
99 *
r5932r5933
5959const struct pit8253_config mz700_pit8253_config =
6060{
6161   {
62      /* clockin              callback */
62      /* clockin             callback */
6363      { XTAL_17_73447MHz/20, pit_out0_changed },
6464      {             15611.0, pit_out1_changed },
6565      {                  0, pit_irq_2        },
r5932r5933
6969const struct pit8253_config mz800_pit8253_config =
7070{
7171   {
72      /* clockin              callback */
72      /* clockin             callback */
7373      { XTAL_17_73447MHz/16, pit_out0_changed },
7474      {             15611.0, pit_out1_changed },
7575      {                  0, pit_irq_2        },
r5932r5933
416416   const device_config *speaker = devtag_get_device(device->machine, "speaker");
417417   if((prev_state==0) && (state==1)) {
418418      speaker_level ^= 1;
419   }   
419   }
420420   prev_state = state;
421421   speaker_level_w( speaker, speaker_level);
422422}
r5932r5933
516516     * bit 0 out    unused
517517     */
518518
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 */
521521
522522   /* 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.
530530
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);
535535
536   */
536    */
537537
538538   LOG(2,"mz700_pio_port_c_w",("%02X\n", data),device->machine);
539539
r5932r5933
542542
543543
544544/******************************************************************************
545 *   Sharp MZ800
545 *  Sharp MZ800
546546 *
547547 *
548548 ******************************************************************************/
r5932r5933
636636}
637637
638638/* 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    ???
643643 */
644644WRITE8_HANDLER( mz800_display_mode_w )
645645{
r5932r5933
650650   mz->screen = data & 0x03;
651651
652652   /* 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//  }
659659}
660660
661661/* port CF */
src/mess/machine/vectrex.c
r5932r5933
9191   }
9292
9393   /* If VIA T2 starts, reset refresh timer.
94      This is the best strategy for most games. */
94       This is the best strategy for most games. */
9595   vectrex_reset_refresh = 1;
9696
9797   vectrex_imager_angles = narrow_escape_angles;
r5932r5933
114114   {
115115      vectrex_imager_angles = minestorm_3d_angles;
116116
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. */
119119      vectrex_reset_refresh = 0;
120120   }
121121
r5932r5933
229229   int pot;
230230   static const char *const ctrlnames[] = { "CONTR1X", "CONTR1Y", "CONTR2X", "CONTR2Y" };
231231
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
234234   if (pot > (signed char)vectrex_via_out[PORTA])
235235      vectrex_via_out[PORTB] |= 0x20;
236236   else
r5932r5933
326326      if (wavel < 1)
327327      {
328328         /* 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. */
333333
334334         ang_acc = (50.0 - 1.55 * vectrex_imager_freq) / MMI;
335335         vectrex_imager_freq += ang_acc * pwl + DAMPC * vectrex_imager_freq / MMI * wavel;
r5932r5933
354354DRIVER_INIT(vectrex)
355355{
356356   /*
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     */
360360
361361   memset(vectorram, 0xff, vectorram_size);
362362}
src/mess/machine/pc_joy.c
r5932r5933
11/*************************************************************************
22 *
3 *      pc_joy.h
3 *      pc_joy.h
44 *
5 *      joystick port
5 *      joystick port
66 *
77 *************************************************************************/
88
src/mess/machine/dc.c
r5932r5933
77    c230048 - 5 is written, want 6
88    c0d9d9e - where bad happens, from routine @ c0da260
99
10    c0d9d8e - R0 on return is the value to put in
10    c0d9d8e - R0 on return is the value to put in
1111
1212    cfffee0 - stack location when bad happens
13   
13
1414*/
1515
1616#include "driver.h"
r5932r5933
2222#include "naomi.h"
2323#include "machine/gdrom.h"
2424#include "devices/chd_cd.h"
25             
25
2626#define ATAPI_CYCLES_PER_SECTOR (5000)   // TBD for Dreamcast
2727
2828#define ATAPI_STAT_BSY      0x80
r5932r5933
9999      ddtdata.destination = atapi_xferbase;    // destination address
100100      ddtdata.length = 2048/4;
101101      ddtdata.size = 4;
102      ddtdata.buffer = sector_buffer;     
102      ddtdata.buffer = sector_buffer;
103103      ddtdata.direction=1;   // 0 source to buffer, 1 buffer to destination
104104      ddtdata.channel= -1;   // not used
105105      ddtdata.mode= -1;      // copy from/to buffer
r5932r5933
175175            atapi_xfermod = 0;
176176         }
177177
178//         printf( "atapi_r: atapi_xferlen=%d\n", atapi_xferlen );
178//          printf( "atapi_r: atapi_xferlen=%d\n", atapi_xferlen );
179179         if( atapi_xferlen != 0 )
180180         {
181181            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;
183183            atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
184184         }
185185         else
r5932r5933
264264      mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, cpu_get_pc(space->cpu));
265265   }
266266
267//   printf( "atapi_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
267//  printf( "atapi_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
268268   return data;
269269}
270270
r5932r5933
273273   running_machine *machine = space->machine;
274274   int reg;
275275
276//   printf( "atapi_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
276//  printf( "atapi_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
277277
278278   if (mem_mask == 0x0000ffff)   // word-wide command write
279279   {
280//      printf("atapi_w: data=%04x\n", data );
280//      printf("atapi_w: data=%04x\n", data );
281281
282//      printf("ATAPI: packet write %04x\n", data);
282//      printf("ATAPI: packet write %04x\n", data);
283283      atapi_data[atapi_data_ptr++] = data & 0xff;
284284      atapi_data[atapi_data_ptr++] = data >> 8;
285285
286286      if (atapi_cdata_wait)
287287      {
288//                printf("ATAPI: waiting, ptr %d wait %d\n", atapi_data_ptr, atapi_cdata_wait);
288//                  printf("ATAPI: waiting, ptr %d wait %d\n", atapi_data_ptr, atapi_cdata_wait);
289289         if (atapi_data_ptr == atapi_cdata_wait)
290290         {
291291            // send it to the device
r5932r5933
303303      {
304304         int phase;
305305
306//         printf("atapi_w: command %02x\n", atapi_data[0]&0xff );
306//          printf("atapi_w: command %02x\n", atapi_data[0]&0xff );
307307
308308         // reset data pointer for reading SCSI results
309309         atapi_data_ptr = 0;
r5932r5933
621621      off=offset << 1;
622622   }
623623
624//   printf("gdrom_r: @ %x (off %x), mask %llx (PC %x)\n", offset, off, mem_mask, cpu_get_pc(space->cpu));
624//  printf("gdrom_r: @ %x (off %x), mask %llx (PC %x)\n", offset, off, mem_mask, cpu_get_pc(space->cpu));
625625
626626   if (offset == 3)
627627   {
r5932r5933
650650      off=offset << 1;
651651   }
652652
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));
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));
654654
655655   if (off >= 0x20)
656656   {
src/mess/machine/lisa.c
r5932r5933
11/*
2   experimental LISA driver
2    experimental LISA driver
33
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).
88
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 !
2323
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)
2828
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
3535
36   Raphael Nabet, 2000-2003
36    Raphael Nabet, 2000-2003
3737*/
3838
3939#include "driver.h"
r5932r5933
4646
4747
4848/*
49   pointers with RAM & ROM location
49    pointers with RAM & ROM location
5050*/
5151
5252/* up to 2MB of 68k RAM (normally 1MB or 512kb), generally 16kb of ROM */
r5932r5933
6868
6969
7070/*
71   MMU regs
71    MMU regs
7272*/
7373
7474static int setup;   /* MMU setup mode : allows to edit the MMU regs */
r5932r5933
9595
9696
9797/*
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)
103103*/
104104
105105static int diag2;         /* -> writes wrong parity data into RAM */
r5932r5933
112112
113113
114114/*
115   video
115    video
116116*/
117117static int VTMSK;            /* VBI enable */
118118static int VTIR;            /* VBI pending */
r5932r5933
121121
122122
123123/*
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
126126*/
127127
128128static READ8_DEVICE_HANDLER(COPS_via_in_b);
r5932r5933
159159};
160160
161161/*
162   floppy disk interface
162    floppy disk interface
163163*/
164164
165165static int FDIR;
r5932r5933
170170static int PWM_floppy_motor_speed;
171171
172172/*
173   lisa model identification
173    lisa model identification
174174*/
175175static enum
176176{
r5932r5933
184184{
185185   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) */
186186                              /* 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. */
198198   enum
199199   {
200200      twiggy,         /* twiggy drives (Lisa 1) */
r5932r5933
206206} lisa_features;
207207
208208/*
209   protos
209    protos
210210*/
211211
212212static READ16_HANDLER ( lisa_IO_r );
r5932r5933
214214
215215
216216/*
217   Interrupt handling
217    Interrupt handling
218218*/
219219
220220static void lisa_field_interrupts(running_machine *machine)
r5932r5933
223223      return;   /* don't touch anything... */
224224
225225   /*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)
238238      /* COPS VIA interrupt */
239239      cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_2, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
240240   else if (FDIR || VTIR)
r5932r5933
286286
287287
288288/*
289   keyboard interface
289    keyboard interface
290290*/
291291
292292static int COPS_Ready;      /* COPS is about to read a command from VIA port A */
r5932r5933
385385}
386386
387387/*
388   scan_keyboard()
388    scan_keyboard()
389389
390   scan the keyboard, and add key transition codes to buffer as needed
390    scan the keyboard, and add key transition codes to buffer as needed
391391*/
392392/* shamelessly stolen from machine/mac.c :-) */
393393
r5932r5933
447447   int new_mx, new_my;
448448
449449   /*if (COPS_force_unplug)
450      return;*/   /* ???? */
450        return;*/   /* ???? */
451451
452452   new_mx = input_port_read(machine, "MOUSE_X");
453453   new_my = input_port_read(machine, "MOUSE_Y");
r5932r5933
729729static void plug_keyboard(running_machine *machine)
730730{
731731   /*
732      possible keyboard IDs according to Lisa Hardware Manual and boot ROM source code
732        possible keyboard IDs according to Lisa Hardware Manual and boot ROM source code
733733
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    */
746746
747747   static const UINT8 cmd[2] =
748748   {
r5932r5933
770770/* VIA1 accessors (COPS, sound, and 2 hard disk lines) */
771771
772772/*
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
776776*/
777777static WRITE8_DEVICE_HANDLER(COPS_via_out_a)
778778{
r5932r5933
790790}
791791
792792/*
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.)
802802
803   CB1 : not used
804   CB2 (O) : sound output
803    CB1 : not used
804    CB2 (O) : sound output
805805*/
806806static READ8_DEVICE_HANDLER(COPS_via_in_b)
807807{
r5932r5933
860860/* VIA2 accessors (hard disk, and a few floppy disk lines) */
861861
862862/*
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
866866*/
867867
868868/*
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
879879*/
880880static READ8_DEVICE_HANDLER(parallel_via_in_b)
881881{
r5932r5933
899899
900900
901901/*
902   LISA video emulation
902    LISA video emulation
903903*/
904904
905905VIDEO_START( lisa )
r5932r5933
907907}
908908
909909/*
910   Video update
910    Video update
911911*/
912912VIDEO_UPDATE( lisa )
913913{
r5932r5933
924924   for (y = 0; y < resy; y++)
925925   {
926926      for (x = 0; x < resx; x++)
927//         line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> ((x+y*resx) & 0xf))) ? 0 : 1;
927//          line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> ((x+y*resx) & 0xf))) ? 0 : 1;
928928         line_buffer[x] = (v[(x+y*resx)>>4] & (0x8000 >> (x & 0xf))) ? 0 : 1;
929929      draw_scanline8(bitmap, 0, y, resx, line_buffer, screen->machine->pens);
930930   }
r5932r5933
947947   {
948948      if (address & 0x004000)
949949      {
950//         the_seg = 0;   /* correct ??? */
950//          the_seg = 0;    /* correct ??? */
951951      }
952952      else
953953      {
r5932r5933
10841084
10851085/*void init_lisa1(void)
10861086{
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;
10921092}*/
10931093
10941094DRIVER_INIT( lisa2 )
r5932r5933
11001100   lisa_features.floppy_hardware = sony_lisa2;
11011101   lisa_features.has_double_sided_floppy = 0;
11021102   lisa_features.has_mac_xl_video = 0;
1103   
1103
11041104   bad_parity_table = auto_alloc_array(machine, UINT8, 0x40000);  /* 1 bit per byte of CPU RAM */
11051105}
11061106
r5932r5933
11131113   lisa_features.floppy_hardware = sony_lisa210;
11141114   lisa_features.has_double_sided_floppy = 0;
11151115   lisa_features.has_mac_xl_video = 0;
1116   
1116
11171117   bad_parity_table = auto_alloc_array(machine, UINT8, 0x40000);  /* 1 bit per byte of CPU RAM */
11181118}
11191119
r5932r5933
11261126   lisa_features.floppy_hardware = sony_lisa210;
11271127   lisa_features.has_double_sided_floppy = 0;
11281128   lisa_features.has_mac_xl_video = 1;
1129   
1129
11301130   bad_parity_table = auto_alloc_array(machine, UINT8, 0x40000);  /* 1 bit per byte of CPU RAM */
11311131}
11321132
r5932r5933
12761276      set_VTIR(device->machine, 1);
12771277   else
12781278      set_VTIR(device->machine, 0);
1279   
1279
12801280   /* do keyboard scan */
12811281   scan_keyboard(device->machine);
12821282}
12831283
12841284/*
1285   Lots of fun with the Lisa fdc hardware
1285    Lots of fun with the Lisa fdc hardware
12861286
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)...
12891289*/
12901290
12911291INLINE void lisa_fdc_ttl_glue_access(running_machine *machine, offs_t offset)
r5932r5933
13171317         }
13181318      }
13191319      /*else
1320         MT1 = offset & 1;*/
1320            MT1 = offset & 1;*/
13211321      break;
13221322   case 4:
13231323      /*DIS = offset & 1;*/   /* forbids access from the 68000 to our RAM */
r5932r5933
13251325   case 5:
13261326      /*HDS = offset & 1;*/      /* head select (-> disk side) on twiggy */
13271327      /*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)
13301330         sony_set_sel_line(devtag_get_device(machine, "fdc"), offset & 1);
13311331      break;
13321332   case 6:
r5932r5933
13841384   case 2:   /* writes the PWM register */
13851385      /* the written value is used to generate the motor speed control signal */
13861386      /*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)
13891389         sony_set_speed(((256-data) * 1.3) + 237);
13901390      break;
13911391
r5932r5933
14701470   {   /* special setup mode */
14711471      if (offset & 0x002000)
14721472      {
1473//         the_seg = 0;   /* correct ??? */
1473//          the_seg = 0;    /* correct ??? */
14741474      }
14751475      else
14761476      {
r5932r5933
15111511      offs_t address = (mmu_regs[the_seg][segment].sorg + seg_offset) & 0x1fffff;
15121512
15131513      /*logerror("read, logical address%lX\n", offset);
1514      logerror("physical address%lX\n", address);*/
1514        logerror("physical address%lX\n", address);*/
15151515
15161516      switch (mmu_regs[the_seg][segment].type)
15171517      {
r5932r5933
15731573            /* this emulation is not guaranteed accurate */
15741574
15751575            /* problem : due to collisions with video, timings of the LISA CPU
1576            are slightly different from timings of a bare 68k */
1576                are slightly different from timings of a bare 68k */
15771577            /* so we use a kludge... */
15781578            int time_in_frame = video_screen_get_vpos(space->machine->primary_screen);
15791579            static int videoROM_address = 0;
15801580
15811581            /* the BOOT ROM only reads 56 bits, so there must be some wrap-around for
1582            videoROM_address <= 56 */
1582                videoROM_address <= 56 */
15831583            /* 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 */
15861586            /* The values are different on the Mac XL, and I don't know the correct values
1587            for sure. */
1587                for sure. */
15881588
15891589            /* 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). */
15941594            if (lisa_features.has_mac_xl_video)
15951595            {
15961596               if ((time_in_frame >= 374) && (time_in_frame <= 392))   /* these values have not been tested */
r5932r5933
16431643   {
16441644      if (offset & 0x002000)
16451645      {
1646//         the_seg = 0;   /* correct ??? */
1646//          the_seg = 0;    /* correct ??? */
16471647      }
16481648      else
16491649      {
r5932r5933
19451945         switch ((offset & 0x0600) >> 9)
19461946         {
19471947         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*/
19511951            break;
19521952
19531953         case 2:   /* parallel port */
r5932r5933
21022102         COMBINE_DATA(& video_address_latch);
21032103         videoram_ptr = ((UINT16 *)lisa_ram_ptr) + ((video_address_latch << 6) & 0xfc000);
21042104         /*logerror("video address latch %X -> base address %X\n", video_address_latch,
2105                     (video_address_latch << 7) & 0x1f8000);*/
2105                            (video_address_latch << 7) & 0x1f8000);*/
21062106         break;
21072107      }
21082108      break;
src/mess/machine/pc_joy.h
r5932r5933
11/*************************************************************************
22 *
3 *      pc_joy.h
3 *      pc_joy.h
44 *
5 *      joystick port
5 *      joystick port
66 *
77 *************************************************************************/
88
src/mess/machine/sym1.c
r5932r5933
283283MACHINE_RESET( sym1 )
284284{
285285   /* make 0xf800 to 0xffff point to the last half of the monitor ROM
286      so that the CPU can find its reset vectors */
286       so that the CPU can find its reset vectors */
287287   memory_install_readwrite8_handler(cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ),
288288         0xf800, 0xffff, 0, 0, SMH_BANK(1), SMH_NOP);
289289   memory_set_bankptr(machine, 1, sym1_monitor + 0x800);
src/mess/machine/cgenie.c
r5932r5933
145145   head = 0;
146146
147147   /*
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);
153153
154154   /* Initialize some patterns to be displayed in graphics mode */
155155   for( i = 0; i < 256; i++ )
r5932r5933
164164
165165/*************************************
166166 *
167 *            Port handlers.
167 *              Port handlers.
168168 *
169169 *************************************/
170170
r5932r5933
266266}
267267
268268/*************************************
269 *                            *
270 *      Memory handlers           *
271 *                            *
269 *                                   *
270 *      Memory handlers              *
271 *                                   *
272272 *************************************/
273273
274274static UINT8 psg_a_out = 0x00;
r5932r5933
482482}
483483
484484/*************************************
485 *      Keyboard                *
485 *      Keyboard                    *
486486 *************************************/
487487 READ8_HANDLER( cgenie_keyboard_r )
488488{
r5932r5933
516516}
517517
518518/*************************************
519 *      Video RAM                *
519 *      Video RAM                    *
520520 *************************************/
521521
522522int cgenie_videoram_r( int offset )
r5932r5933
580580
581581/*************************************
582582 *
583 *      Interrupt handlers.
583 *      Interrupt handlers.
584584 *
585585 *************************************/
586586
src/mess/machine/lynx.c
r5932r5933
8787
8888/****************************************
8989
90   Graphics Drawing
90    Graphics Drawing
9191
9292****************************************/
9393
r5932r5933
164164   {
165165      case NORMAL_SPRITE:
166166      /* A sprite may be set to 'normal'. This means that pen number '0' will be transparent and
167      non-collideable. All other pens will be opaque and collideable */
167        non-collideable. All other pens will be opaque and collideable */
168168         if (color == 0)
169169            break;
170170         if (!(x & 0x01))      /* Upper nibble */
r5932r5933
198198
199199      case BOUNDARY:
200200      /* A sprite may be set to 'boundary'. This is a 'normal' sprite with the exception that pen
201      number 'F' is transparent (and still collideable). */
201        number 'F' is transparent (and still collideable). */
202202         if (color == 0)
203203            break;
204204         if (!(x & 0x01))      /* Upper nibble */
r5932r5933
237237
238238      case SHADOW:
239239      /* A sprite may be set to 'shadow'. This is a 'normal' sprite with the exception that pen
240      number 'E' is non-collideable (but still opaque) */
240        number 'E' is non-collideable (but still opaque) */
241241         if (color == 0)
242242            break;
243243         if (!(x & 0x01))      /* Upper nibble */
r5932r5933
271271
272272      case BOUNDARY_SHADOW:
273273      /* 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). */
276276         if (color == 0)
277277            break;
278278         if (!(x & 0x01))      /* Upper nibble */
r5932r5933
311311
312312      case BACKGROUND:
313313      /* 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 */
318318         if (!(x & 0x01))      /* Upper nibble */
319319         {
320320            *screen = (*screen & 0x0f) | (color << 4);
r5932r5933
349349
350350      case NO_COLL:
351351      /* A sprite may be set to 'non-collideable'. This means that it will have no affect on the contents of
352      the collision buffer and all other collision activities are overridden (pen 'F' is not collideable). */
352        the collision buffer and all other collision activities are overridden (pen 'F' is not collideable). */
353353         if (color == 0)
354354            break;
355355         if (!(x & 0x01))      /* Upper nibble */
r5932r5933
361361
362362      case XOR_SPRITE:
363363      /* 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 */
367367         if (color == 0)
368368            break;
369369         if (!(x & 0x01))      /* Upper nibble */
r5932r5933
892892
893893/****************************************
894894
895   Suzy Emulation
895    Suzy Emulation
896896
897897****************************************/
898898
r5932r5933
913913   UINT16 right;
914914   UINT32 res, mod;
915915   /*
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    */
923923
924924   left = suzy.data[MATH_H] | (suzy.data[MATH_G] << 8) | (suzy.data[MATH_F] << 16) | (suzy.data[MATH_E] << 24);
925925   right = suzy.data[MATH_P] | (suzy.data[MATH_N] << 8);
r5932r5933
936936      res = left / right;
937937      mod = left % right;
938938   }
939//   logerror("coprocessor %8x / %8x = %4x\n", left, right, res);
939//  logerror("coprocessor %8x / %8x = %4x\n", left, right, res);
940940   suzy.data[MATH_D] = res & 0xff;
941941   suzy.data[MATH_C] = res >> 8;
942942   suzy.data[MATH_B] = res >> 16;
r5932r5933
953953   UINT16 left, right;
954954   UINT32 res, accu;
955955   /*
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    */
963963   suzy.accumulate_overflow = FALSE;
964964
965965   left = suzy.data[MATH_B] | (suzy.data[MATH_A] << 8);
r5932r5933
10601060      default:
10611061         value = suzy.data[offset];
10621062   }
1063//   logerror("suzy read %.2x %.2x\n",offset,data);
1063//  logerror("suzy read %.2x %.2x\n",offset,data);
10641064   return value;
10651065}
10661066
r5932r5933
10711071   /* Additional effects of a write */
10721072   /* Even addresses are the LSB. Any CPU write to an LSB in 0x00-0x7f will set the MSB to 0. */
10731073   /* 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 */
10761076   switch(offset)
10771077   {
10781078   case 0x00: case 0x02: case 0x04: case 0x06: case 0x08: case 0x0a: case 0x0c: case 0x0e:
r5932r5933
10941094      break;
10951095   case 0x53:
10961096   /* If we are going to perform a signed multiplication, we store the sign and convert the number
1097   to an unsigned one */
1097    to an unsigned one */
10981098      if (suzy.data[SPRSYS] & 0x80)      /* signed math */
10991099      {
11001100         UINT16 factor, temp;
r5932r5933
11121112      break;
11131113   /* Writing to A will start a 16 bit multiply */
11141114   /* If we are going to perform a signed multiplication, we also store the sign and convert the
1115   number to an unsigned one */
1115    number to an unsigned one */
11161116   case 0x55:
11171117      if (suzy.data[SPRSYS] & 0x80)      /* signed math */
11181118      {
r5932r5933
11411141         lynx_blitter(space->machine);
11421142      }
11431143      break;
1144//   case 0xb2: case 0xb3: /* Cart Bank 0 & 1 */
1144//  case 0xb2: case 0xb3: /* Cart Bank 0 & 1 */
11451145   }
11461146}
11471147
11481148
11491149/****************************************
11501150
1151   Mikey emulation
1151    Mikey emulation
11521152
11531153****************************************/
11541154
r5932r5933
13011301
13021302/****************************************
13031303
1304   Timers
1304    Timers
13051305
13061306****************************************/
13071307
r5932r5933
13611361
13621362static void lynx_timer_signal_irq(running_machine *machine, int which)
13631363{
1364   if ( ( lynx_timer[which].cntrl1 & 0x80 ) && ( which != 4 ) )
1364   if ( ( lynx_timer[which].cntrl1 & 0x80 ) && ( which != 4 ) )
13651365   { // irq flag handling later
13661366      mikey.data[0x81] |= ( 1 << which );
13671367      cputag_set_input_line(machine, "maincpu", M65SC02_IRQ_LINE, ASSERT_LINE);
13681368   }
1369   switch ( which )
1369   switch ( which )
13701370   {
13711371   case 0:
13721372      lynx_timer_count_down( machine, 2 );
r5932r5933
13941394
13951395void lynx_timer_count_down(running_machine *machine, int which)
13961396{
1397   if ( ( lynx_timer[which].cntrl1 & 0x0f ) == 0x0f )
1397   if ( ( lynx_timer[which].cntrl1 & 0x0f ) == 0x0f )
13981398   {
1399      if ( lynx_timer[which].counter > 0 )
1399      if ( lynx_timer[which].counter > 0 )
14001400      {
14011401         lynx_timer[which].counter--;
14021402         return;
14031403      }
1404      if ( lynx_timer[which].counter == 0 )
1404      if ( lynx_timer[which].counter == 0 )
14051405      {
14061406         lynx_timer[which].cntrl2 |= 8;
14071407         lynx_timer_signal_irq(machine, which);
1408         if ( lynx_timer[which].cntrl1 & 0x10 )
1408         if ( lynx_timer[which].cntrl1 & 0x10 )
14091409         {
14101410            lynx_timer[which].counter = lynx_timer[which].bakup;
1411         }
1412         else
1411         }
1412         else
14131413         {
14141414            lynx_timer[which].counter--;
14151415         }
r5932r5933
14881488            lynx_timer[which].cntrl2 &= ~0x08;
14891489         break;
14901490      case 2:
1491//         lynx_timer[which].counter = data;   // why commented out?
1491//          lynx_timer[which].counter = data;   // why commented out?
14921492         break;
14931493      case 3:
14941494         lynx_timer[which].cntrl2 = (lynx_timer[which].cntrl2 & 0x08) | (data & ~0x08);
r5932r5933
15181518
15191519/****************************************
15201520
1521   UART Emulation
1521    UART Emulation
15221522
15231523****************************************/
15241524
r5932r5933
16061606
16071607/****************************************
16081608
1609   Mikey memory handlers
1609    Mikey memory handlers
16101610
16111611****************************************/
16121612
r5932r5933
17611761         logerror("Trying to enable bank 1 write. %d\n", mikey.data[offset] & 0x10);
17621762      break;
17631763
1764//   case 0x90: // SDONEACK - Suzy Done Acknowledge
1764//  case 0x90: // SDONEACK - Suzy Done Acknowledge
17651765   case 0x91: // CPUSLEEP - CPU Bus Request Disable
17661766      mikey.data[offset] = data;
17671767      if (!data)
r5932r5933
17801780
17811781/****************************************
17821782
1783   Init / Config
1783    Init / Config
17841784
17851785****************************************/
17861786
r5932r5933
17921792WRITE8_HANDLER( lynx_memory_config_w )
17931793{
17941794   /* bit 7: hispeed, uses page mode accesses (4 instead of 5 cycles )
1795    * when these are safe in the cpu */
1795    * when these are safe in the cpu */
17961796   lynx_memory_config = data;
17971797
17981798   memory_install_read8_handler(space, 0xfc00, 0xfcff, 0, 0, (data & 1) ? SMH_BANK(1) : suzy_read);
r5932r5933
18691869
18701870/****************************************
18711871
1872   Image handling
1872    Image handling
18731873
18741874****************************************/
18751875
r5932r5933
19591959         return INIT_FAIL;
19601960
19611961      /* 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 */
19641964      lynx_granularity = header[4] | (header[5] << 8);
19651965
19661966      logerror ("%s %dkb cartridge with %dbyte granularity from %s\n",
r5932r5933
19711971   else if (!mame_stricmp (filetype, "lyx"))
19721972   {
19731973      /* 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 */
19761976      if (size == 0x20000)
19771977         lynx_granularity = 0x0200;
19781978      else if (size == 0x80000)
src/mess/machine/ondra.c
r5932r5933
3030static READ8_HANDLER( ondra_keyboard_r )
3131{
3232   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" };
3535   double valcas = cassette_input(cassette_device_image(space->machine));
3636   if ( valcas < 0.00) {
3737      retVal = 0x80;
38   }   
38   }
3939   if (ondra_keyboard_line > 9) {
4040      retVal |= 0x1f;
4141   } else {
42      retVal |= input_port_read(space->machine, keynames[ondra_keyboard_line]);   
42      retVal |= input_port_read(space->machine, keynames[ondra_keyboard_line]);
4343   }
4444   return retVal;
4545 }
r5932r5933
8484
8585static TIMER_CALLBACK(nmi_check_callback)
8686{
87   if ((input_port_read(machine, "NMI") & 1) == 1)
87   if ((input_port_read(machine, "NMI") & 1) == 1)
8888   {
8989      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
9090   }
r5932r5933
9595   ondra_bank1_status = 0;
9696   ondra_bank2_status = 0;
9797   ondra_update_banks(machine);
98   
98
9999   timer_pulse(machine, ATTOTIME_IN_HZ(10), NULL, 0, nmi_check_callback);
100100}
101101
src/mess/machine/kaypro.c
r5932r5933
1919
2020/***********************************************************
2121
22   PIO
22    PIO
2323
24   Port B is unused on both PIOs
24    Port B is unused on both PIOs
2525
2626************************************************************/
2727
r5932r5933
3232
3333static READ8_DEVICE_HANDLER( pio_system_r )
3434{
35/*   d3 Centronics ready flag */
35/*  d3 Centronics ready flag */
3636
3737   UINT8 data = ~centronics_busy_r(kaypro_printer) << 3;
3838   return (kaypro_system_port & 0xf7) | (data & 8) ;
r5932r5933
4040
4141static WRITE8_DEVICE_HANDLER( pio_system_w )
4242{
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 */
5050
5151   /* get address space */
5252   const address_space *mem = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5932r5933
133133
134134/***********************************************************
135135
136   KAYPRO2X SYSTEM PORT
136    KAYPRO2X SYSTEM PORT
137137
138   The PIOs were replaced by a few standard 74xx chips
138    The PIOs were replaced by a few standard 74xx chips
139139
140140************************************************************/
141141
r5932r5933
147147
148148WRITE8_HANDLER( kaypro2x_system_port_w )
149149{
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 */
158158
159159   /* get address space */
160160   const address_space *mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5932r5933
192192
193193/***********************************************************************
194194
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.
197197
198   On Kaypro2x, Channel B on both SIOs is hardwired to 300 baud.
198    On Kaypro2x, Channel B on both SIOs is hardwired to 300 baud.
199199
200   Both devices on sio2 (printer and modem) are not emulated.
200    Both devices on sio2 (printer and modem) are not emulated.
201201
202202************************************************************************/
203203
204204/* 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 */
221221
222222static const int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 };
223223
r5932r5933
225225{
226226   data &= 0x0f;
227227
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);
230230}
231231
232232WRITE8_HANDLER( kayproii_baud_b_w )   /* Channel B - Keyboard - only usable speed is 300 baud */
233233{
234234   data &= 0x0f;
235235
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);
238238}
239239
240240WRITE8_HANDLER( kaypro2x_baud_a_w )   /* Channel A on 2nd SIO - Serial Printer */
241241{
242242   data &= 0x0f;
243243
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);
246246}
247247
248248const z80sio_interface kaypro_sio_intf =
r5932r5933
261261      return z80sio_d_r(device, 0);
262262   else
263263   if (offset == 1)
264//      return z80sio_d_r(device, 1);
264//      return z80sio_d_r(device, 1);
265265      return kay_kbd_d_r();
266266   else
267267   if (offset == 2)
268268      return z80sio_c_r(device, 0);
269269   else
270//      return z80sio_c_r(device, 1);
270//      return z80sio_c_r(device, 1);
271271      return kay_kbd_c_r();
272272}
273273
r5932r5933
277277      z80sio_d_w(device, 0, data);
278278   else
279279   if (offset == 1)
280//      z80sio_d_w(device, 1, data);
280//      z80sio_d_w(device, 1, data);
281281      kay_kbd_d_w(device->machine, data);
282282   else
283283   if (offset == 2)
r5932r5933
317317
318318/*************************************************************************************
319319
320   Floppy DIsk
320    Floppy DIsk
321321
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.
326326
327327*************************************************************************************/
328328
r5932r5933
349349
350350/***********************************************************
351351
352   Machine
352    Machine
353353
354354************************************************************/
355355
r5932r5933
378378
379379/***********************************************************
380380
381   Quickload
381    Quickload
382382
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.
387387
388388************************************************************/
389389
r5932r5933
402402      RAM[i+0x100] = data;
403403   }
404404
405//   if (input_port_read(image->machine, "CONFIG") & 1)
405//  if (input_port_read(image->machine, "CONFIG") & 1)
406406   {
407407      pio_system_w(kayproii_z80pio_s, 0, kaypro_system_port & 0x7f);   // switch TPA in
408408      RAM[0x80]=0;                     // clear out command tail
r5932r5933
428428      RAM[i+0x100] = data;
429429   }
430430
431//   if (input_port_read(image->machine, "CONFIG") & 1)
431//  if (input_port_read(image->machine, "CONFIG") & 1)
432432   {
433433      kaypro2x_system_port_w(space, 0, kaypro_system_port & 0x7f);
434434      RAM[0x80]=0;
src/mess/machine/super80.c
r5932r5933
99#include "super80.h"
1010
1111/* 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) */
1616
1717UINT8 super80_shared=0xff;
1818
r5932r5933
8383
8484static UINT8 cass_data[]={ 0, 0, 0, 0 };
8585
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
8989
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.
9696
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.
9999
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 */
103103
104104static TIMER_CALLBACK( super80_timer )
105105{
r5932r5933
158158/*************************************** PRINTER ********************************************************/
159159
160160/* 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.
165165
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). */
168168
169169/**************************** I/O PORTS *****************************************************************/
170170
r5932r5933
173173   UINT8 data=0x7f;
174174
175175   /* bit 7 = printer busy
176   0 = printer is not busy */
176    0 = printer is not busy */
177177
178178   data |= centronics_busy_r(super80_printer) << 7;
179179
src/mess/machine/geneve.c
r5932r5933
11/*
2   Machine code for Myarc Geneve.
3   Raphael Nabet, 2003.
2    Machine code for Myarc Geneve.
3    Raphael Nabet, 2003.
44*/
55
66#include <math.h>
r5932r5933
3030static void poll_mouse(running_machine *machine);
3131
3232/*
33   pointers to memory areas
33    pointers to memory areas
3434*/
3535/* pointer to boot ROM */
3636static UINT8 *ROM_ptr;
r5932r5933
4242static UINT8 *DRAM_ptr;
4343
4444/*
45   Configuration
45    Configuration
4646*/
4747/* TRUE if speech synthesizer present */
4848static char has_speech;
r5932r5933
8787static void machine_stop_geneve(running_machine *machine);
8888
8989/*
90   GROM support.
90    GROM support.
9191
92   The Geneve does not include any GROM, but it features a simple GROM emulator.
92    The Geneve does not include any GROM, but it features a simple GROM emulator.
9393
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).
9797
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).
101101*/
102102static struct
103103{
r5932r5933
106106} GPL_port;
107107
108108/*
109   Cartridge support
109    Cartridge support
110110
111   The Geneve does not have a cartridge port, but it has cartridge emulation.
111    The Geneve does not have a cartridge port, but it has cartridge emulation.
112112*/
113113static int cartridge_page;
114114
r5932r5933
138138
139139/*===========================================================================*/
140140/*
141   General purpose code:
142   initialization, cart loading, etc.
141    General purpose code:
142    initialization, cart loading, etc.
143143*/
144144
145145DRIVER_INIT( geneve )
r5932r5933
155155MACHINE_START( geneve )
156156{
157157   /* 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. */
160160   ti99_peb_init();
161161   ti99_floppy_controllers_init_all(machine);
162162   ti99_ide_init(machine);
r5932r5933
257257
258258
259259/*
260   video initialization.
260    video initialization.
261261*/
262262VIDEO_START(geneve)
263263{
r5932r5933
266266}
267267
268268/*
269   scanline interrupt
269    scanline interrupt
270270*/
271271INTERRUPT_GEN( geneve_hblank_interrupt )
272272{
r5932r5933
281281}
282282
283283/*
284   inta is connected to both tms9901 IRQ1 line and to tms9995 INT4/EC line.
284    inta is connected to both tms9901 IRQ1 line and to tms9995 INT4/EC line.
285285*/
286286static void inta_callback(running_machine *machine, int state)
287287{
r5932r5933
290290}
291291
292292/*
293   intb is connected to tms9901 IRQ12 line.
293    intb is connected to tms9901 IRQ12 line.
294294*/
295295static void intb_callback(running_machine *machine, int state)
296296{
r5932r5933
304304#pragma mark MEMORY HANDLERS
305305#endif
306306/*
307   Memory handlers.
307    Memory handlers.
308308*/
309309
310310/*
311   TMS5200 speech chip read
311    TMS5200 speech chip read
312312*/
313313static  READ8_HANDLER ( geneve_speech_r )
314314{
r5932r5933
324324   if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
325325   {
326326      /* Weirdly enough, we are always seeing some problems even though
327      everything is working fine. */
327        everything is working fine. */
328328      /*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));*/
331331   }
332332}
333333
334334#endif
335335
336336/*
337   TMS5200 speech chip write
337    TMS5200 speech chip write
338338*/
339339static WRITE8_HANDLER ( geneve_speech_w )
340340{
r5932r5933
342342
343343#if 1
344344   /* 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. */
348348   if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
349349   {
350350      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
r5932r5933
553553
554554   offset &= 0x1fff;
555555
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    */
564564   if (page > 0xf1) page &= 0xf1;
565   
565
566566   switch (page)
567567   {
568568   case 0xf0:
r5932r5933
653653            page_lookup[offset-0xf110] = data;
654654            return;
655655
656         /*case 0xf118:   // read-only register???
657            key_buf = data;
658            return*/
656         /*case 0xf118:  // read-only register???
657                key_buf = data;
658                return*/
659659
660660         case 0xf120:
661661            sn76496_w(devtag_get_device(space->machine, "sn76496"), 0, data);
r5932r5933
706706            page_lookup[offset-0x8000] = data;
707707            return;
708708
709         /*case 0x8008:   // read-only register???
710            key_buf = data;
711            return*/
709         /*case 0x8008:  // read-only register???
710                key_buf = data;
711                return*/
712712
713713         case 0x8010:
714714         case 0x8011:
r5932r5933
852852   offset &= 0x1fff;
853853
854854   /* ROM is incompletely decoded. Pages f0, f2, f4 ... fe all map to the
855      first 8K Boot ROM; f1, ..., ff to the second 8K. See above. */
855       first 8K Boot ROM; f1, ..., ff to the second 8K. See above. */
856856   if (page > 0xf1) page &= 0xf1;
857     
857
858858   switch (page)
859859   {
860860   case 0xf0:
r5932r5933
961961static void read_key_if_possible(running_machine *machine)
962962{
963963   /* if keyboard reset is not asserted, and key clock is enabled, and key
964   buffer clear is disabled, and key queue is not empty. */
964    buffer clear is disabled, and key queue is not empty. */
965965   if ((! KeyReset) && (mode_flags & mf_keyclock) && (mode_flags & mf_keyclear) && KeyQueueLen)
966966   {
967967      tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 8, 1);
r5932r5933
991991      0x1d,   /* right control */
992992      0x38,   /* alt gr */
993993      /* 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. */
996996
997997      /* extended key that is equivalent to a non-extended key
998      with shift off */
998        with shift off */
999999      0x35,   /* pad slash */
10001000
10011001      /* extended keys that are equivalent to non-extended keys
1002      with numlock off */
1002        with numlock off */
10031003      0x47,   /* home */
10041004      0x48,   /* up */
10051005      0x49,   /* page up */
r5932r5933
10451045
10461046               /* Release Fake Shift/Unshift if another key is pressed */
10471047               /* We do so if a key is released, though it is actually
1048               required only if it is a modifier key */
1048                    required only if it is a modifier key */
10491049               /*if (pressed)*/
10501050               {
10511051                  if (KeyFakeShiftState)
r5932r5933
11481148               else if (keycode == 0x6f)
11491149               {   /* emulate pause (F15) key */
11501150                  /* 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. */
11531153                  if (pressed)
11541154                  {
11551155                     if (KeyCtrlState)
r5932r5933
12531253#pragma mark TMS9901 INTERFACE
12541254#endif
12551255/*
1256   Geneve-specific tms9901 I/O handlers
1256    Geneve-specific tms9901 I/O handlers
12571257
1258   See mess/machine/tms9901.c for generic tms9901 CRU handlers.
1258    See mess/machine/tms9901.c for generic tms9901 CRU handlers.
12591259*/
12601260/*
1261   TMS9901 interrupt handling on a Geneve.
1261    TMS9901 interrupt handling on a Geneve.
12621262
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
12721272*/
12731273
12741274/*
1275   set the state of int2 (called by tms9928 core)
1275    set the state of int2 (called by tms9928 core)
12761276*/
12771277/*void tms9901_set_int2(int state)
12781278{
1279   tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 2, state);
1279    tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 2, state);
12801280}*/
12811281
12821282/*
1283   Called by the 9901 core whenever the state of INTREQ and IC0-3 changes
1283    Called by the 9901 core whenever the state of INTREQ and IC0-3 changes
12841284*/
12851285static TMS9901_INT_CALLBACK( tms9901_interrupt_callback )
12861286{
r5932r5933
12891289}
12901290
12911291/*
1292   Read pins INT3*-INT7* of Geneve 9901.
1292    Read pins INT3*-INT7* of Geneve 9901.
12931293
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
12981298*/
12991299static READ8_DEVICE_HANDLER( R9901_0 )
13001300{
r5932r5933
13061306}
13071307
13081308/*
1309   Read pins INT8*-INT15* of Geneve 9901.
1309    Read pins INT8*-INT15* of Geneve 9901.
13101310
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
13191319*/
13201320static READ8_DEVICE_HANDLER( R9901_1 )
13211321{
r5932r5933
13271327}
13281328
13291329/*
1330   Read pins P0-P7 of Geneve 9901.
1330    Read pins P0-P7 of Geneve 9901.
13311331*/
13321332static READ8_DEVICE_HANDLER( R9901_2 )
13331333{
r5932r5933
13351335}
13361336
13371337/*
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
13401340*/
13411341static READ8_DEVICE_HANDLER( R9901_3 )
13421342{
r5932r5933
13501350
13511351
13521352/*
1353   Write PE bus reset line
1353    Write PE bus reset line
13541354*/
13551355static WRITE8_DEVICE_HANDLER( W9901_PE_bus_reset )
13561356{
13571357}
13581358
13591359/*
1360   Write VDP reset line
1360    Write VDP reset line
13611361*/
13621362static WRITE8_DEVICE_HANDLER( W9901_VDP_reset )
13631363{
13641364}
13651365
13661366/*
1367   Write joystick select line
1367    Write joystick select line
13681368*/
13691369static WRITE8_DEVICE_HANDLER( W9901_JoySel )
13701370{
r5932r5933
13881388      KeyAutoRepeatKey = 0;
13891389   }
13901390   /*else
1391      poll_keyboard(space->machine);*/
1391        poll_keyboard(space->machine);*/
13921392}
13931393
13941394/*
1395   Write external mem cycles (0=long, 1=short)
1395    Write external mem cycles (0=long, 1=short)
13961396*/
13971397static WRITE8_DEVICE_HANDLER( W9901_ext_mem_wait_states )
13981398{
13991399}
14001400
14011401/*
1402   Write vdp wait cycles (1=add 15 cycles, 0=add none)
1402    Write vdp wait cycles (1=add 15 cycles, 0=add none)
14031403*/
14041404static WRITE8_DEVICE_HANDLER( W9901_VDP_wait_states )
14051405{
src/mess/machine/beta.c
r5932r5933
11/*********************************************************************
22
3   beta.h
3    beta.h
44
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
86
7    04/05/2008 Created by Miodrag Milanovic
8
99*********************************************************************/
1010#include "driver.h"
1111#include "devices/flopdrv.h"
r5932r5933
4949void betadisk_enable(const device_config *device)
5050{
5151   beta_disk_state *beta = get_safe_token(device);
52   
52
5353   beta->betadisk_active = 1;
5454}
5555
5656void betadisk_disable(const device_config *device)
5757{
5858   beta_disk_state *beta = get_safe_token(device);
59   
59
6060   beta->betadisk_active = 0;
6161}
6262
6363void betadisk_clear_status(const device_config *device)
6464{
6565   beta_disk_state *beta = get_safe_token(device);
66   
66
6767   beta->betadisk_status = 0;
6868}
6969
r5932r5933
7171{
7272   const device_config *wd_device = devtag_get_device(device->machine, BETA_DISK_TAG);
7373   beta_disk_state *beta = get_safe_token(wd_device);
74   if (wd_device->started) {   
74   if (wd_device->started) {
7575      switch (state)
7676      {
7777         case WD17XX_DRQ_SET:
r5932r5933
7979            beta->betadisk_status |= (1<<6);
8080         }
8181         break;
82   
82
8383         case WD17XX_DRQ_CLR:
8484         {
8585            beta->betadisk_status &=~(1<<6);
8686         }
8787         break;
88   
88
8989         case WD17XX_IRQ_SET:
9090         {
9191            beta->betadisk_status |= (1<<7);
9292         }
9393         break;
94   
94
9595         case WD17XX_IRQ_CLR:
9696         {
9797            beta->betadisk_status &=~(1<<7);
r5932r5933
106106READ8_DEVICE_HANDLER(betadisk_status_r)
107107{
108108   beta_disk_state *beta = get_safe_token(device);
109   
109
110110   if (beta->betadisk_active==1) {
111      return wd17xx_status_r(beta->wd179x, offset);
111      return wd17xx_status_r(beta->wd179x, offset);
112112   } else {
113113      return 0xff;
114114   }
r5932r5933
117117READ8_DEVICE_HANDLER(betadisk_track_r)
118118{
119119   beta_disk_state *beta = get_safe_token(device);
120   
120
121121   if (beta->betadisk_active==1) {
122      return wd17xx_track_r(beta->wd179x, offset);
122      return wd17xx_track_r(beta->wd179x, offset);
123123   } else {
124124      return 0xff;
125125   }
r5932r5933
128128READ8_DEVICE_HANDLER(betadisk_sector_r)
129129{
130130   beta_disk_state *beta = get_safe_token(device);
131   
131
132132   if (beta->betadisk_active==1) {
133      return wd17xx_sector_r(beta->wd179x, offset);
133      return wd17xx_sector_r(beta->wd179x, offset);
134134   } else {
135135      return 0xff;
136136   }
r5932r5933
138138
139139READ8_DEVICE_HANDLER(betadisk_data_r)
140140{
141   
141
142142   beta_disk_state *beta = get_safe_token(device);
143   
143
144144   if (beta->betadisk_active==1) {
145      return wd17xx_data_r(beta->wd179x, offset);
145      return wd17xx_data_r(beta->wd179x, offset);
146146   } else {
147147      return 0xff;
148148   }
r5932r5933
151151READ8_DEVICE_HANDLER(betadisk_state_r)
152152{
153153   beta_disk_state *beta = get_safe_token(device);
154   
154
155155   if (beta->betadisk_active==1) {
156156      return beta->betadisk_status;
157157   } else {
r5932r5933
160160}
161161
162162WRITE8_DEVICE_HANDLER(betadisk_param_w)
163{
163{
164164   beta_disk_state *beta = get_safe_token(device);
165   
165
166166   if (beta->betadisk_active==1) {
167        wd17xx_set_drive(beta->wd179x, data & 3); 
167        wd17xx_set_drive(beta->wd179x, data & 3);
168168        wd17xx_set_side (beta->wd179x,(data & 0x10) ? 0 : 1 );
169169        wd17xx_set_density(beta->wd179x, data & 0x20 ? DEN_MFM_HI : DEN_FM_LO );
170170        if ((data & 0x04) == 0) // reset
171171        {
172           wd17xx_reset(beta->wd179x);   
173        }         
172           wd17xx_reset(beta->wd179x);
173        }
174174        beta->betadisk_status = (data & 0x3f) | beta->betadisk_status;
175175     }
176}   
176}
177177
178178WRITE8_DEVICE_HANDLER(betadisk_command_w)
179179{
180180   beta_disk_state *beta = get_safe_token(device);
181   
181
182182   if (beta->betadisk_active==1) {
183183      wd17xx_command_w(beta->wd179x, offset, data);
184   }   
184   }
185185}
186186
187187WRITE8_DEVICE_HANDLER(betadisk_track_w)
188188{
189189   beta_disk_state *beta = get_safe_token(device);
190   
190
191191   if (beta->betadisk_active==1) {
192192      wd17xx_track_w(beta->wd179x, offset, data);
193   }   
193   }
194194}
195195
196196WRITE8_DEVICE_HANDLER(betadisk_sector_w)
197197{
198198   beta_disk_state *beta = get_safe_token(device);
199   
199
200200   if (beta->betadisk_active==1) {
201201      wd17xx_sector_w(beta->wd179x, offset, data);
202   }   
202   }
203203}
204204
205205WRITE8_DEVICE_HANDLER(betadisk_data_w)
206{   
206{
207207   beta_disk_state *beta = get_safe_token(device);
208   
208
209209   if (beta->betadisk_active==1) {
210210      wd17xx_data_w(beta->wd179x, offset, data);
211   }   
211   }
212212}
213213
214214static const floppy_config beta_floppy_config =
r5932r5933
240240    ROM_LOAD( "trd503kay.rom",  0x00000, 0x4000, CRC(77baccbb) SHA1(9c5fb89b57643f723246453809dad3f669bf59a3))
241241    ROM_LOAD( "trd503xbios.rom",0x00000, 0x4000, CRC(8be427cc) SHA1(78f423fd200e720aa6b857f00969fa1f8c7da20e))
242242   ROM_LOAD( "trd503[a4].rom", 0x00000, 0x4000, CRC(c2387608) SHA1(93e0b92a3f38b59cc006d22f9c9299f5377b15e5))
243   
244243
244
245245   ROM_LOAD( "trd504.rom",    0x00000, 0x4000, CRC(ba310874) SHA1(05e55e37df8eee6c68601ba9cf6c92195852ce3f))
246246   ROM_LOAD( "trd504s.rom",    0x00000, 0x4000, CRC(c5ca0423) SHA1(cb2da2c4575bc54454e4f97073c5bb37505487fe))
247247   ROM_LOAD( "trd504s2.rom",   0x00000, 0x4000, CRC(1e9b59aa) SHA1(d6eb0eeb429c70d1f8f9a23ca4e2feb5f73d3120))
248248     ROM_LOAD( "trd504s3.rom",   0x00000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db))
249     
250   
249
250
251251   ROM_LOAD( "trd504tm.rom",    0x00000, 0x4000, CRC(2334b8c6) SHA1(2fd8944e067140324e998b59aab766f16eb5c7fb))
252252   ROM_LOAD( "trd504t.rom",    0x00000, 0x4000, CRC(e212d1e0) SHA1(745e9caf576e64a5386ad845256d28593d34cc40))
253253   ROM_LOAD( "trd504tb2.rom",  0x00000, 0x4000, CRC(8d943e6b) SHA1(bf6ab329791258f02c5f695b0c7448998b709435))
r5932r5933
264264   ROM_LOAD( "trd505h.rom",    0x00000, 0x4000, CRC(9ba15549) SHA1(5908784cdfb782066bde08f186f0bbb6f6b80545))
265265   ROM_LOAD( "trd505d.rom",    0x00000, 0x4000, CRC(31e4be08) SHA1(dd08bdea8b5caa35569f49770e380d16bb37502b))
266266    ROM_LOAD( "trd505[a2].rom", 0x00000, 0x4000, CRC(a102e726) SHA1(a3f0ef7b7d8b3022f306be8d9e8a51ae699097df))
267         
267
268268   ROM_LOAD( "trd56661.rom",    0x00000, 0x4000, CRC(8528c789) SHA1(1332a01137bd537fee696ba7adddc0a15b3237c4))
269269   ROM_LOAD( "trd5666hte.rom", 0x00000, 0x4000, CRC(03841161) SHA1(4e523768231130947a81247e116fc049bd6da963))
270270   ROM_LOAD( "trd5613.rom",    0x00000, 0x4000, CRC(d66cda49) SHA1(dac3c8396fc4f85b5673076cc647afbe439ad17a))
271 
271
272272   ROM_LOAD( "trd512.rom",    0x00000, 0x4000, CRC(b615d6c4) SHA1(4abb90243f66df19caa84f82d0b880a6ce344eca))
273273   ROM_LOAD( "trd512f.rom",    0x00000, 0x4000, CRC(edb74f8c) SHA1(c5b2cd18926dde4a68bcd8c360ba33d6c11b8801))
274274
r5932r5933
288288   ROM_LOAD( "trd606h.rom",    0x00000, 0x4000, CRC(6b44fdd7) SHA1(4ca7ea2bc0e62c98c9ba86a304aee3cbf88d6b09))
289289
290290   ROM_LOAD( "trd607m.rom",    0x00000, 0x4000, CRC(5a062f03) SHA1(bbd68481c76e8a3f2f26847faa72c42df013b617))
291   
291
292292   ROM_LOAD( "trd608.rom",    0x00000, 0x4000, CRC(5c998d53) SHA1(c65a972e75e627336c44ea184cb9ae81dfa2069b))
293293     ROM_LOAD( "trd608-2.rom",    0x00000, 0x4000, CRC(3541b280) SHA1(2b93c1887f485639ec15860b5503dc7efb6d31d6))
294294     ROM_LOAD( "trd608-3.rom",    0x00000, 0x4000, CRC(d3e91d69) SHA1(5e367d3601d07bd2af1d6255561a5983c0e9fb5d))
295     
295
296296   ROM_LOAD( "trd609.rom",     0x00000, 0x4000, CRC(91028924) SHA1(fa5433f73aab93c58c891ceee2cdfed0a979dfbb))
297297    ROM_LOAD( "trd609e.rom",    0x00000, 0x4000, CRC(46312c8c) SHA1(0ce69fe76e17a875c287e3725f6209f1c59d8bd9))
298   
298
299299   ROM_LOAD( "trd610e.rom",     0x00000, 0x4000, CRC(95395ca4) SHA1(8cda2efbf2360cd675ea8b04b43cf1746fb41f35))
300   
300
301301   ROM_LOAD( "trd701.rom",      0x00000, 0x4000, CRC(47f39c0d) SHA1(53d8b8959c321618caaef5aeb270e530e8f8ada3))
302   
302
303303   //Default for now
304   ROM_LOAD( "trd503.rom",    0x00000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c))   
305ROM_END   
304   ROM_LOAD( "trd503.rom",    0x00000, 0x4000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c))
305ROM_END
306306
307307
308308/*-------------------------------------------------
r5932r5933
318318   assert(device->tag != NULL);
319319
320320   /* find our WD179x */
321   astring_printf(tempstring, "%s:%s", device->tag, "wd179x");   
321   astring_printf(tempstring, "%s:%s", device->tag, "wd179x");
322322   beta->wd179x = devtag_get_device(device->machine, astring_c(tempstring));
323323
324   astring_free(tempstring);   
324   astring_free(tempstring);
325325}
326326
327327/*-------------------------------------------------
r5932r5933
342342   {
343343      /* --- the following bits of info are returned as 64-bit signed integers --- */
344344      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;
346346      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;                     break;
347347
348348      /* --- the following bits of info are returned as pointers --- */
r5932r5933
353353      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(beta_disk);               break;
354354      case DEVINFO_FCT_STOP:                     /* Nothing */                                    break;
355355      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(beta_disk);               break;
356     
356
357357      /* --- the following bits of info are returned as NULL-terminated strings --- */
358358      case DEVINFO_STR_NAME:                     strcpy(info->s, "Beta Disk Interface");                  break;
359359      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Beta Disk Interface");                  break;
src/mess/machine/pc_turbo.c
r5932r5933
22
33    pc_turbo.c
44
5   The PC "turbo" button
5    The PC "turbo" button
66
77**********************************************************************/
88
src/mess/machine/i82439tx.c
r5932r5933
11/***************************************************************************
22
3   machine/i82439tx.c
3    machine/i82439tx.c
44
5   Intel 82439TX PCI Bridge
5    Intel 82439TX PCI Bridge
66
77***************************************************************************/
88
src/mess/machine/ds1315.c
r5932r5933
11/*********************************************************************
22
3   ds1315.c
3    ds1315.c
44
5   Dallas Semiconductor's Phantom Time Chip DS1315.
5    Dallas Semiconductor's Phantom Time Chip DS1315.
66
7   by tim lindner, November 2001.
7    by tim lindner, November 2001.
88
99*********************************************************************/
1010
r5932r5933
193193static void ds1315_fill_raw_data(const device_config *device)
194194{
195195   /* 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    */
198198
199199   mame_system_time systime;
200200   ds1315_t *ds1315 = get_token(device);
r5932r5933
231231static void ds1315_input_raw_data(const device_config *device)
232232{
233233   /* 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.
236236
237      We always return the host's time when asked.
238   */
237       We always return the host's time when asked.
238    */
239239}
240240
241241
src/mess/machine/beta.h
r5932r5933
11/*********************************************************************
22
3   beta.h
3    beta.h
44
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
86
7    04/05/2008 Created by Miodrag Milanovic
8
99*********************************************************************/
1010#ifndef BETA_H
1111#define BETA_H
r5932r5933
2828
2929#define MDRV_BETA_DISK_REMOVE(_tag)      \
3030    MDRV_DEVICE_REMOVE(_tag)
31   
31
3232READ8_DEVICE_HANDLER(betadisk_status_r);
3333READ8_DEVICE_HANDLER(betadisk_track_r);
3434READ8_DEVICE_HANDLER(betadisk_sector_r);
r5932r5933
4343
4444/* device interface */
4545DEVICE_GET_INFO( beta_disk );
46   
46
4747#endif /* BETA_H */
src/mess/machine/exidy.c
r5932r5933
3434    Transmit and receive clocks are connected to the same clock */
3535
3636   /* if rs232 is disabled, receive clock is linked to cassette hardware */
37//   if (exidy_fe & 0x80)
38//   {
37//  if (exidy_fe & 0x80)
38//  {
3939      connect to rs232
40//   }
40//  }
4141//}
4242#endif
4343
r5932r5933
7777      case 0x00:            /* Cassette 300 baud */
7878
7979         /* loading a tape - this is basically the same as the super80.
80            We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */
80                We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */
8181
8282         cass_data.input.length++;
8383
r5932r5933
9292         }
9393
9494         /* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies.
95            Synchronisation of the frequency pulses to the uart is extremely important. */
95                Synchronisation of the frequency pulses to the uart is extremely important. */
9696
9797         cass_data.output.length++;
9898         if (!(cass_data.output.length & 0x1f))
r5932r5933
243243      if (data & 0x80)
244244      {
245245      /* connect to serial device (not yet emulated) */
246//         timer_adjust_periodic(serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate));
246//          timer_adjust_periodic(serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(baud_rate));
247247      }
248248      else
249249      {
250250      /* connect to tape */
251//         hd6402_connect(&cassette_serial_connection);
251//          hd6402_connect(&cassette_serial_connection);
252252      }
253253   }
254254}
r5932r5933
326326READ8_HANDLER(exidy_ff_r)
327327{
328328   /* 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. */
332332
333333   const device_config *printer = devtag_get_device(space->machine, "centronics");
334334   UINT8 data=0x7f;
335335
336336   /* bit 7 = printer busy
337   0 = printer is not busy */
337    0 = printer is not busy */
338338
339339   data |= centronics_busy_r(printer) << 7;
340340
r5932r5933
353353      return;               /* can't run a program if the cartridge isn't in */
354354
355355   /* 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 */
362362
363363   if ((start_address == 0x1d5) || (execute_address == 0xc858))
364364   {
365365      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
370370
371371      for (i = 0; i < ARRAY_LENGTH(data); i++)
372372         memory_write_byte(space, 0xf01f + i, data[i]);
r5932r5933
392392
393393MACHINE_START( exidy )
394394{
395//   serial_timer = timer_alloc(machine, exidy_serial_timer_callback, NULL);
395//  serial_timer = timer_alloc(machine, exidy_serial_timer_callback, NULL);
396396   cassette_timer = timer_alloc(machine, exidy_cassette_tc, NULL);
397397}
398398
src/mess/machine/pc_turbo.h
r5932r5933
22
33    pc_turbo.h
44
5   The PC "turbo" button
5    The PC "turbo" button
66
77**********************************************************************/
88
src/mess/machine/i82439tx.h
r5932r5933
11/***************************************************************************
22
3   machine/i82439tx.h
3    machine/i82439tx.h
44
5   Intel 82439TX PCI Bridge
5    Intel 82439TX PCI Bridge
66
77***************************************************************************/
88
src/mess/machine/pc8801.c
r5932r5933
11/***************************************************************************
22
3   machine/pc8801.c
3    machine/pc8801.c
44
5   Implementation of the PC8801
5    Implementation of the PC8801
66
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:
1010
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)
1515
1616***************************************************************************/
1717
r5932r5933
227227
228228READ8_HANDLER(pc88sr_inport_30)
229229     /* 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)
239239      */
240240{
241241  int r;
r5932r5933
255255
256256READ8_HANDLER(pc88sr_inport_31)
257257     /* 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)
266266      */
267267{
268268  int r;
r5932r5933
744744   }
745745
746746   /* 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     */
763763   if ((chip == 1) && (result == 0xF8))
764764      result = 0xF0;
765765
src/mess/machine/ds1315.h
r5932r5933
11/*********************************************************************
22
3   ds1315.h
3    ds1315.h
44
5   Dallas Semiconductor's Phantom Time Chip DS1315.
5    Dallas Semiconductor's Phantom Time Chip DS1315.
66
7   by tim lindner, November 2001.
7    by tim lindner, November 2001.
88
99*********************************************************************/
1010
src/mess/machine/atom.c
r5932r5933
11/***********************************************************************
22
3   atom.c
3    atom.c
44
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)
77
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.
1414
1515***********************************************************************/
1616
r5932r5933
9595{
9696   /* I'm assuming that the nmi is edge triggered */
9797   /* 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 */
100100   /* I'll emulate it like this to be sure */
101101
102102   if (state!=previous_i8271_int_state)
r5932r5933
104104      if (state)
105105      {
106106         /* I'll pulse it because if I used hold-line I'm not sure
107         it would clear - to be checked */
107            it would clear - to be checked */
108108         cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
109109      }
110110   }
r5932r5933
154154   timer_state^=1;
155155
156156   /* the 2.4 kHz signal is notted (A), and nand'ed with the 2.4kz enable, resulting
157   in B. The final cassette output is the result of tape output nand'ed with B */
157    in B. The final cassette output is the result of tape output nand'ed with B */
158158
159159
160160   {
r5932r5933
185185
186186   /* this is temporary */
187187   /* 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 */
191191   memory_region(machine, "maincpu")[0x08] = mame_rand(machine) & 0x0ff;
192192   memory_region(machine, "maincpu")[0x09] = mame_rand(machine) & 0x0ff;
193193   memory_region(machine, "maincpu")[0x0a] = mame_rand(machine) & 0x0ff;
r5932r5933
282282
283283   row = atom_8255_porta & 0x0f;
284284   /* logerror("8255: Read port b: %02X %02X\n", input_port_read(machine, port),
285                           input_port_read(machine, "KEY10") & 0xc0); */
285                                    input_port_read(machine, "KEY10") & 0xc0); */
286286   return ((input_port_read(device->machine, keynames[row]) & 0x3f) | (input_port_read(device->machine, "KEY10") & 0xc0));
287287}
288288
r5932r5933
312312
313313/* Atom 6847 modes:
314314
3150000xxxx   Text
3160001xxxx   64x64   4
3170011xxxx   128x64   2
3180101xxxx   128x64   4
3190111xxxx   128x96   2
3201001xxxx   128x96   4
3211011xxxx   128x192   2
3221101xxxx   128x192   4
3231111xxxx   256x192   2
3150000xxxx    Text
3160001xxxx    64x64   4
3170011xxxx    128x64  2
3180101xxxx    128x64  4
3190111xxxx    128x96  2
3201001xxxx    128x96  4
3211011xxxx    128x192 2
3221101xxxx    128x192 4
3231111xxxx    256x192 2
324324
325325*/
326326
src/mess/machine/6551.c
r5932r5933
11/*********************************************************************
22
3   6551.h
3    6551.h
44
5   MOS Technology 6551 Asynchronous Communications Interface Adapter
5    MOS Technology 6551 Asynchronous Communications Interface Adapter
66
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
1212
1313*********************************************************************/
1414
r5932r5933
7575
7676/*-------------------------------------------------
7777    acia_6551_in_callback - called when other side
78   has updated state
78    has updated state
7979-------------------------------------------------*/
8080
8181static void acia_6551_in_callback(running_machine *machine, int id, unsigned long state)
r5932r5933
128128   /* if transmit is not empty... transmit data */
129129   if ((acia->transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0)
130130   {
131   //   logerror("UART6551\n");
131   //  logerror("UART6551\n");
132132      transmit_register_send_bit(machine, &acia->transmit_reg, &acia->connection);
133133   }
134134}
r5932r5933
248248      break;
249249
250250   /*
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
260260    */
261261      case 1:
262262        {
r5932r5933
340340
341341
342342      /*
343      Command Register:
343        Command Register:
344344
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        */
369369
370370      case 2:
371371      {
r5932r5933
403403      break;
404404
405405      /*
406      Control register:
406        Control register:
407407
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        */
439439      case 3:
440440      {
441441         unsigned char previous_control_register;
src/mess/machine/ay31015.c
r5932r5933
11/****************************************************************************
22
3   ay31015.c by Robbbert, May 2008
3    ay31015.c by Robbbert, May 2008
44
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.
77
8   This is cycle-accurate according to the specifications.
8    This is cycle-accurate according to the specifications.
99
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.
1212
13   Note to any MESSDEVs who might happen to stray here:
13    Note to any MESSDEVs who might happen to stray here:
1414
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.
1818
1919*****************************************************************************
2020
r5932r5933
2929******************************************************************************
3030
3131It is not clear in the documentation as to which settings will reset the device.
32   To be safe, we will always reset whenever the control register changes.
32    To be safe, we will always reset whenever the control register changes.
3333
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.
4040
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.
4343
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.
4747
4848********************************************************************************
4949
r5932r5933
326326            {
327327               ay31015->status_reg |= STATUS_FE;      // framing error - the stop bit not high
328328               ay31015->rx_state = PREP_TIME;      // lost sync - start over
329         //      return;
329         //      return;
330330            }
331331            else
332332               ay31015->status_reg &= ~STATUS_FE;
r5932r5933
357357            if (ay31015->second_stop_bit)
358358            {
359359               /* We should wait for the full first stop bit and
360                  the beginning of the second stop bit */
360                       the beginning of the second stop bit */
361361               ay31015->rx_state = SECOND_STOP_BIT;
362362               ay31015->rx_pulses += ay31015->second_stop_bit - 7;
363363            }
r5932r5933
368368            }
369369         }
370370         return;
371         
371
372372      case SECOND_STOP_BIT:
373373         ay31015->rx_pulses--;
374374         if (!ay31015->rx_pulses)
r5932r5933
442442
443443            ay31015->tx_data >>= 1;            // adjust the shift register
444444         }
445           
445
446446         ay31015->tx_pulses--;
447447         if (!ay31015->tx_pulses)               // all data bits sent
448448         {
r5932r5933
737737
738738/*-------------------------------------------------
739739    DEVICE_GET_INFO(ay31015) - device getinfo
740   function
740    function
741741-------------------------------------------------*/
742742
743743DEVICE_GET_INFO( ay31015 )
src/mess/machine/ti99pcod.c
r5932r5933
11/*
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
304
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.
7272*/
7373#include "driver.h"
7474#include "99_peb.h"
7575#include "devices/ti99cart.h"
76#include "ti99_4x.h"
76#include "ti99_4x.h"
7777
7878static const int GROM_base = 0x1bfc;
7979static 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.
8383*/
8484UINT8 *ti99_pcode_rom0;
8585UINT8 *ti99_pcode_rom1;
r5932r5933
115115static UINT8 GROM_dataread(void)
116116{
117117   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. */
121121   reply = pcode_GROMs.buf;
122   
122
123123   /* Get next value, put it in buffer. Note that the
124   GROM wraps at 8K boundaries. */
124    GROM wraps at 8K boundaries. */
125125   pcode_GROMs.buf = pcode_GROMs.data_ptr[pcode_GROMs.addr];
126126
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. */
129129   pcode_GROMs.addr = ((pcode_GROMs.addr + 1) & 0x1FFF) | (pcode_GROMs.addr & 0xE000);
130   
130
131131   /* Reset the read and write address flipflops. */
132132   pcode_GROMs.raddr_LSB = pcode_GROMs.waddr_LSB = FALSE;
133133
r5932r5933
135135}
136136
137137/*
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
140140*/
141141static READ8_HANDLER ( ti99_pcode_grom_r )
142142{
143143   UINT8 reply;
144144
145145   cpu_adjust_icount(space->machine->firstcpu,-4);
146   
146
147147   if (offset & 2)
148   {   
148   {
149149      pcode_GROMs.waddr_LSB = FALSE;
150150
151151      if (pcode_GROMs.raddr_LSB)
r5932r5933
160160      }
161161   }
162162   else
163      reply = GROM_dataread();     
163      reply = GROM_dataread();
164164
165165   return reply;
166166}
167167
168168/*
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
171171*/
172172static WRITE8_HANDLER ( ti99_pcode_grom_w )
173173{
r5932r5933
179179      if (pcode_GROMs.waddr_LSB)
180180      {
181181         pcode_GROMs.addr = (pcode_GROMs.addr & 0xFF00) | (data & 0xFF);
182         
182
183183         GROM_dataread();
184184         pcode_GROMs.waddr_LSB = FALSE;
185185      }
r5932r5933
208208   bank_select = 0;
209209   pcode_GROMs.addr = 0;
210210   pcode_GROMs.data_ptr = ti99_pcode_grom;
211   
211
212212   ti99_peb_set_card_handlers(0x1f00, &pcode_handlers);
213213}
214214
215215/*
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)
223223*/
224224static void pcode_cru_w(running_machine *machine, int offset, int data)
225225{
r5932r5933
227227           by 2. */
228228   if (offset == 0)
229229   {
230//      printf("pcode card state = %d\n", data);
230//      printf("pcode card state = %d\n", data);
231231   }
232232   if (offset == 0x40)  // Bit 4 is on A8
233233   {
234      if (data==0)
234      if (data==0)
235235         bank_select = 0;
236236      else
237237         bank_select = 1;
238//      printf("pcode bank select = %d\n", data);
238//      printf("pcode bank select = %d\n", data);
239239   }
240240}
241241
242242/*
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.
245245*/
246246static int pcode_cru_r(running_machine *machine, int offset)
247247{
r5932r5933
249249}
250250
251251/*
252   Read a byte in pcode DSR space
252    Read a byte in pcode DSR space
253253*/
254254static  READ8_HANDLER( pcode_mem_r )
255255{
r5932r5933
265265      switch (offset)
266266      {
267267      /* GROMs only answer at even addresses. The odd addresses are
268      undefined, so we can as well just ignore these cases. */
268        undefined, so we can as well just ignore these cases. */
269269      case 0x1bfc:
270270      case 0x1bfe:
271271         reply = ti99_pcode_grom_r(space, offset);
r5932r5933
277277         break;
278278      default:
279279         /* 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            */
283283         reply = (bank_select==0)? ti99_pcode_rom1[offset-0x1000] : ti99_pcode_rom2[offset-0x1000];
284284      }
285285   }
r5932r5933
287287}
288288
289289/*
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.
292292*/
293293static WRITE8_HANDLER( pcode_mem_w )
294294{
src/mess/machine/6551.h
r5932r5933
11/*********************************************************************
22
3   6551.h
3    6551.h
44
5   MOS Technology 6551 Asynchronous Communications Interface Adapter
5    MOS Technology 6551 Asynchronous Communications Interface Adapter
66
77*********************************************************************/
88
src/mess/machine/ay31015.h
r5932r5933
11/* ay31015.h
22
3   Written for MESS by Robbbert on May 29th, 2008.
3    Written for MESS by Robbbert on May 29th, 2008.
44
55*/
66
src/mess/machine/ti99pcod.h
r5932r5933
11/*
2   TI-99 P-Code Card emulation.
3   Michael Zapf, July 2009
2    TI-99 P-Code Card emulation.
3    Michael Zapf, July 2009
44*/
55
66void ti99_pcode_reset(running_machine *machine);
src/mess/machine/pc1403.c
r5932r5933
8484    if (outa & 0x01)
8585   {
8686      data |= input_port_read(device->machine, "KEY7");
87     
87
8888      /* At Power Up we fake a 'C-CE' pressure */
8989      if (power)
9090         data |= 0x02;
r5932r5933
116116{
117117   int data = outb;
118118
119   if (input_port_read(machine, "KEY13"))
119   if (input_port_read(machine, "KEY13"))
120120      data |= 1;
121121
122122   return data;
src/mess/machine/partner.c
r5932r5933
3636         break;
3737      case WD17XX_IRQ_SET:
3838         break;
39      case WD17XX_DRQ_CLR:           
39      case WD17XX_DRQ_CLR:
4040         break;
4141      case WD17XX_DRQ_SET:
4242         dma8257_drq_w(dma8257, 0, 1);
r5932r5933
4949MACHINE_START(partner)
5050{
5151   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);
5353   wd17xx_set_pause_time(fdc,10);
5454}
5555
56static void partner_window_1(running_machine *machine, UINT8 bank, UINT16 offset,UINT8 *rom)
56static void partner_window_1(running_machine *machine, UINT8 bank, UINT16 offset,UINT8 *rom)
5757{
5858   switch(partner_win_mem_page) {
5959       case 2 : // FDD BIOS
r5932r5933
6868   }
6969}
7070
71static void partner_window_2(running_machine *machine, UINT8 bank, UINT16 offset,UINT8 *rom)
71static void partner_window_2(running_machine *machine, UINT8 bank, UINT16 offset,UINT8 *rom)
7272{
7373   switch(partner_win_mem_page) {
7474       case 4 : // MCPG FONT
r5932r5933
8282
8383static READ8_HANDLER ( partner_floppy_r ) {
8484   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
85   
85
8686   if (offset<0x100) {
8787      switch(offset & 3) {
88         case 0x00 : return wd17xx_status_r(fdc,0);
88         case 0x00 : return wd17xx_status_r(fdc,0);
8989         case 0x01 : return wd17xx_track_r(fdc,0);
9090         case 0x02 : return wd17xx_sector_r(fdc,0);
9191         default   :
r5932r5933
9393      }
9494   } else {
9595      return 0;
96   }   
96   }
9797}
9898
9999static WRITE8_HANDLER ( partner_floppy_w ) {
100100   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
101   
101
102102   if (offset<0x100) {
103103      switch(offset & 3) {
104104         case 0x00 : wd17xx_command_w(fdc,0,data); break;
r5932r5933
112112      }
113113      if (((data >> 3) & 1)==1) {
114114         wd17xx_set_drive(fdc,1);
115      }     
116      wd17xx_set_side(fdc,data >> 7);       
115      }
116      wd17xx_set_side(fdc,data >> 7);
117117   }
118118}
119119
r5932r5933
126126            memory_install_write8_handler(space, 0xdc00, 0xddff, 0, 0, partner_floppy_w);
127127            memory_install_read8_handler (space, 0xdc00, 0xddff, 0, 0, partner_floppy_r);
128128            break;
129      case 4 :
129      case 4 :
130130            // Timer
131131            break;
132132      default : // BIOS
r5932r5933
138138{
139139   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
140140   UINT8 *rom = memory_region(machine, "maincpu");
141   
141
142142   memory_install_write8_handler(space, 0x0000, 0x07ff, 0, 0, SMH_BANK(1));
143143   memory_install_write8_handler(space, 0x0800, 0x3fff, 0, 0, SMH_BANK(2));
144144   memory_install_write8_handler(space, 0x4000, 0x5fff, 0, 0, SMH_BANK(3));
r5932r5933
196196    // BANK 5 (0x8000 - 0x9fff)
197197   switch (partner_mem_page) {
198198      case 5:
199      case 10:
199      case 10:
200200            //window 2
201201            memory_install_write8_handler(space, 0x8000, 0x9fff, 0, 0, SMH_UNMAP);
202202            partner_window_2(machine, 5, 0, rom);
203203            break;
204204      case 8:
205      case 9:
205      case 9:
206206            //window 1
207207            memory_install_write8_handler(space, 0x8000, 0x9fff, 0, 0, SMH_UNMAP);
208208            partner_window_1(machine, 5, 0, rom);
209209            break;
210      case 7:
210      case 7:
211211            memory_set_bankptr(machine, 5, mess_ram + 0x0000);
212212            break;
213      default:             
213      default:
214214            memory_set_bankptr(machine, 5, mess_ram + 0x8000);
215215            break;
216216   }
217   
217
218218    // BANK 6 (0xa000 - 0xb7ff)
219219   switch (partner_mem_page) {
220220      case 5:
221      case 10:
221      case 10:
222222            //window 2
223223            memory_install_write8_handler(space, 0xa000, 0xb7ff, 0, 0, SMH_UNMAP);
224224            partner_window_2(machine, 6, 0, rom);
225225            break;
226226      case 6:
227      case 8:
227      case 8:
228228            //BASIC
229229            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
231231            break;
232      case 7:
232      case 7:
233233            memory_set_bankptr(machine, 6, mess_ram + 0x2000);
234234            break;
235      default:             
235      default:
236236            memory_set_bankptr(machine, 6, mess_ram + 0xa000);
237237            break;
238   }   
238   }
239239
240240    // BANK 7 (0xb800 - 0xbfff)
241241   switch (partner_mem_page) {
242242      case 4:
243243      case 5:
244      case 10:
244      case 10:
245245            //window 2
246246            memory_install_write8_handler(space, 0xb800, 0xbfff, 0, 0, SMH_UNMAP);
247247            partner_window_2(machine, 7, 0x1800, rom);
248248            break;
249249      case 6:
250      case 8:
250      case 8:
251251            //BASIC
252252            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
254254            break;
255      case 7:
255      case 7:
256256            memory_set_bankptr(machine, 7, mess_ram + 0x3800);
257257            break;
258      default:             
258      default:
259259            memory_set_bankptr(machine, 7, mess_ram + 0xb800);
260260            break;
261   }   
262   
261   }
262
263263    // BANK 8 (0xc000 - 0xc7ff)
264264   switch (partner_mem_page) {
265265      case 7:
r5932r5933
272272            break;
273273      default:
274274            memory_set_bankptr(machine, 8, mess_ram + 0xc000);
275            break;         
275            break;
276276   }
277277
278278    // BANK 9 (0xc800 - 0xcfff)
r5932r5933
292292            break;
293293      default:
294294            memory_set_bankptr(machine, 9, mess_ram + 0xc800);
295            break;         
295            break;
296296   }
297297
298298    // BANK 10 (0xd000 - 0xd7ff)
r5932r5933
308308            break;
309309      default:
310310            memory_set_bankptr(machine, 10, mess_ram + 0xd000);
311            break;         
311            break;
312312   }
313313
314314   // BANK 11 (0xdc00 - 0xddff)
315315   partner_iomap_bank(machine,rom);
316   
316
317317    // BANK 12 (0xe000 - 0xe7ff)
318318   if (partner_mem_page==1) {
319319      memory_set_bankptr(machine, 12, rom + 0x10000);
r5932r5933
321321      //window 1
322322      partner_window_1(machine, 12, 0, rom);
323323   }
324   
324
325325    // BANK 13 (0xe800 - 0xffff)
326326   switch (partner_mem_page) {
327327      case 3:
r5932r5933
330330            // window 1
331331            partner_window_1(machine, 13, 0x800, rom);
332332            break;
333      default:     
334            // BIOS     
333      default:
334            // BIOS
335335            memory_set_bankptr(machine, 13, rom + 0x10800);
336336            break;
337   }   
337   }
338338}
339339
340340WRITE8_HANDLER ( partner_win_memory_page_w )
src/mess/machine/pc_fdc.c
r5932r5933
11/**********************************************************************
22
3   PC-style floppy disk controller emulation
3    PC-style floppy disk controller emulation
44
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
1111
1212**********************************************************************/
1313
r5932r5933
237237
238238
239239
240/*   FDC Digitial Output Register (DOR)
240/*  FDC Digitial Output Register (DOR)
241241
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
250250 */
251251
252252static void pc_fdc_dor_w(running_machine *machine, UINT8 data)
r5932r5933
280280   }
281281
282282   /* 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 */
285285   pc_fdc_set_tc_state(machine, fdc->tc_state);
286286
287287   /* 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 */
290290   pc_fdc_hw_dma_drq(pc_get_device(machine), fdc->dma_state, fdc->dma_read);
291291
292292   /* 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 */
295295   pc_fdc_hw_interrupt(pc_get_device(machine), fdc->int_state);
296296
297297   /* reset? */
r5932r5933
300300      /* yes */
301301
302302         /* 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.
307307
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.
311311
312         This in return causes a int?? ---
312            This in return causes a int?? ---
313313
314314
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        */
318318         nec765_ready_w(pc_get_device(machine),1);
319319
320320      /* set FDC at reset */
r5932r5933
330330}
331331
332332
333/*   PCJr FDC Digitial Output Register (DOR)
333/*  PCJr FDC Digitial Output Register (DOR)
334334
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 )
345345 */
346346
347347static TIMER_CALLBACK( watchdog_timeout )
r5932r5933
396396      /* yes */
397397
398398         /* 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.
403403
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.
407407
408         This in return causes a int?? ---
408            This in return causes a int?? ---
409409
410410
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        */
414414         nec765_ready_w(pc_get_device(machine),1);
415415
416416      /* set FDC at reset */
r5932r5933
491491         break;
492492      case 7:
493493         /* 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             */
502502         break;
503503   }
504504}
src/mess/machine/apple1.c
r5932r5933
6262static TIMER_CALLBACK(apple1_dsp_ready_end);
6363
6464/*****************************************************************************
65**   Structures
65**  Structures
6666*****************************************************************************/
6767
6868/* Handlers for the PIA.  The inputs for Port B, CA1, and CB1 are
r5932r5933
139139
140140
141141/*****************************************************************************
142**   DRIVER_INIT:  driver-specific setup, executed once at MESS startup.
142**  DRIVER_INIT:  driver-specific setup, executed once at MESS startup.
143143*****************************************************************************/
144144
145145DRIVER_INIT( apple1 )
r5932r5933
153153   memory_set_bankptr(machine,1, mess_ram);
154154
155155   /* 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.
162162
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. */
165165   timer_pulse(machine, ATTOTIME_IN_HZ(120), NULL, 0, apple1_kbd_poll);
166166}
167167
168168
169169/*****************************************************************************
170**   MACHINE_RESET:  actions to perform on each cold boot.
170**  MACHINE_RESET:  actions to perform on each cold boot.
171171*****************************************************************************/
172172
173173MACHINE_RESET( apple1 )
r5932r5933
178178
179179
180180/*****************************************************************************
181**   apple1_verify_header
181**  apple1_verify_header
182182*****************************************************************************/
183183static int apple1_verify_header (UINT8 *data)
184184{
r5932r5933
205205#define SNAP_HEADER_LEN         12
206206
207207/*****************************************************************************
208**   snapshot_load_apple1
208**  snapshot_load_apple1
209209**
210**   Format of the binary snapshot image is:
210**  Format of the binary snapshot image is:
211211**
212**   [ LOAD:xxyyDATA:zzzzzz...]
212**  [ LOAD:xxyyDATA:zzzzzz...]
213213**
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.
216216**
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.
219219*****************************************************************************/
220220SNAPSHOT_LOAD(apple1)
221221{
r5932r5933
266266
267267
268268/*****************************************************************************
269**   apple1_kbd_poll
269**  apple1_kbd_poll
270270**
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.
273273**
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.
279279**
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.
282282*****************************************************************************/
283283static TIMER_CALLBACK(apple1_kbd_poll)
284284{
r5932r5933
289289   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" };
290290
291291   /* This holds the values of all the input ports for ordinary keys
292      seen during the last scan. */
292       seen during the last scan. */
293293   static UINT32 kbd_last_scan[] = { 0, 0, 0, 0 };
294294
295295   static int reset_flag = 0;
r5932r5933
329329   }
330330
331331   /* 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. */
334334
335335   apple1_kbd_data = 0;
336336   key_pressed = 0;
r5932r5933
344344   for (port = 0; port < 4; port++)
345345   {
346346      UINT32 portval, newkeys;
347     
347
348348      portval = input_port_read(machine, keynames[port]);
349349      newkeys = portval & ~(kbd_last_scan[port]);
350350
r5932r5933
369369   if (key_pressed)
370370   {
371371      /* The keyboard will pulse its strobe line when a key is
372         pressed.  A 10-usec pulse is typical. */
372           pressed.  A 10-usec pulse is typical. */
373373      pia6821_ca1_w(pia, 0, 1);
374374      timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, apple1_kbd_strobe_end);
375375   }
r5932r5933
385385
386386
387387/*****************************************************************************
388**   READ/WRITE HANDLERS
388**  READ/WRITE HANDLERS
389389*****************************************************************************/
390390static READ8_DEVICE_HANDLER( apple1_pia0_kbdin )
391391{
392392   /* Bit 7 of the keyboard input is permanently wired high.  This is
393      what the ROM Monitor software expects. */
393       what the ROM Monitor software expects. */
394394   return apple1_kbd_data | 0x80;
395395}
396396
r5932r5933
403403static WRITE8_DEVICE_HANDLER( apple1_pia0_dsp_write_signal )
404404{
405405   /* PIA output CB2 is inverted to become the DA signal, used to
406      signal a display write to the video hardware. */
406       signal a display write to the video hardware. */
407407
408408   /* 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. */
411411   pia6821_portb_w(device, 0, (!data) << 7);
412412
413413   /* 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. */
418418   if (!data)
419419      timer_set(device->machine, apple1_vh_dsp_time_to_ready(device->machine), NULL, 0, apple1_dsp_ready_start);
420420}
r5932r5933
424424   const device_config *pia = devtag_get_device( machine, "pia" );
425425
426426   /* 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. */
430430   pia6821_cb1_w(pia, 0, 0);
431431   timer_set(machine, ATTOTIME_IN_NSEC(3500), NULL, 0, apple1_dsp_ready_end);
432432}
r5932r5933
436436   const device_config *pia = devtag_get_device( machine, "pia" );
437437
438438   /* The one-shot pulse has ended; return CB1 to high, so we can do
439      another display write. */
439       another display write. */
440440   pia6821_cb1_w(pia, 0, 1);
441441}
442442
443443
444444/*****************************************************************************
445**   Cassette interface I/O
445**  Cassette interface I/O
446446**
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.
454454**
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.
463463**
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:
467467**
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.
477477**
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.
482482**
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.
494494*****************************************************************************/
495495
496496static const device_config *cassette_device_image(running_machine *machine)
r5932r5933
518518   if (offset <= 0x7f)
519519   {
520520      /* 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. */
524524
525525      return memory_read_byte(space, 0xc100 + offset);
526526   }
527527    else
528528   {
529529      /* 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. */
538538
539539      /* (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.) */
542542      if (cassette_input(cassette_device_image(space->machine)) > 0.0)
543543         return memory_read_byte(space, 0xc100 + (offset & ~1));
544544      else
r5932r5933
549549WRITE8_HANDLER( apple1_cassette_w )
550550{
551551   /* 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. */
557557
558558   cassette_toggle_output(space->machine);
559559}
src/mess/machine/99_ide.c
r5932r5933
11/*
2   Thierry Nouspikel's IDE card emulation
2    Thierry Nouspikel's IDE card emulation
33
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.
77
8   The specs have been published in <http://www.nouspikel.com/ti99/ide.html>.
8    The specs have been published in <http://www.nouspikel.com/ti99/ide.html>.
99
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.
1616
17   Raphael Nabet, 2002-2004.
17    Raphael Nabet, 2002-2004.
1818*/
1919
2020#include "driver.h"
r5932r5933
7171static int tms9995_mode;
7272
7373/*
74   ti99_ide_interrupt()
74    ti99_ide_interrupt()
7575
76   IDE interrupt callback
76    IDE interrupt callback
7777*/
7878void ti99_ide_interrupt(const device_config *device, int state)
7979{
r5932r5933
8383}
8484
8585/*
86   clk_interrupt_callback()
86    clk_interrupt_callback()
8787
88   clock interrupt callback
88    clock interrupt callback
8989*/
9090static void clk_interrupt_callback(running_machine *machine, int state)
9191{
r5932r5933
9494}
9595
9696/*
97   Initializes the ide card, set up handlers
97    Initializes the ide card, set up handlers
9898*/
9999void ti99_ide_init(running_machine *machine)
100100{
r5932r5933
103103}
104104
105105/*
106   Reset ide card, set up handlers
106    Reset ide card, set up handlers
107107*/
108108void ti99_ide_reset(running_machine *machine, int in_tms9995_mode)
109109{
r5932r5933
157157}
158158
159159/*
160   Read ide CRU interface
160    Read ide CRU interface
161161*/
162162static int ide_cru_r(running_machine *machine, int offset)
163163{
r5932r5933
181181}
182182
183183/*
184   Write ide CRU interface
184    Write ide CRU interface
185185*/
186186static void ide_cru_w(running_machine *machine, int offset, int data)
187187{
r5932r5933
219219}
220220
221221/*
222   read a byte in ide DSR space
222    read a byte in ide DSR space
223223*/
224224static READ8_HANDLER(ide_mem_r)
225225{
r5932r5933
284284}
285285
286286/*
287   write a byte in ide DSR space
287    write a byte in ide DSR space
288288*/
289289static WRITE8_HANDLER(ide_mem_w)
290290{
r5932r5933
316316      case 2:      /* IDE registers set 1 (CS1Fx) */
317317         /* latch write */
318318         /*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);*/
322322         /* latch write - bytes are swapped in 2004 IDE card */
323323         if (offset & 1)
324324            output_latch = (output_latch & 0x00ff) | (data << 8);
r5932r5933
334334      case 3:      /* IDE registers set 2 (CS3Fx) */
335335         /* latch write */
336336         /*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);*/
340340         /* latch write - bytes are swapped in 2004 IDE card */
341341         if (offset & 1)
342342            output_latch = (output_latch & 0x00ff) | (data << 8);
src/mess/machine/pc_ide.c
r5932r5933
11/***************************************************************************
22
3   machine/pc_ide.c
3    machine/pc_ide.c
44
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 :(
77
88***************************************************************************/
99
r5932r5933
6464 * 7   which drive failed (0 = master, 1 = slave)
6565 * 6-3 reserved
6666 * 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
7272 * ---operation mode---
7373 * 7   bad block detected
7474 * 6   uncorrectable ECC error
r5932r5933
224224
225225/*
226226 * 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
235235 */
236236static int pc_ide_status_r(DEVICE *This)
237237{
r5932r5933
242242
243243/*************************************************************************
244244 *
245 *      ATHD
246 *      AT hard disk
245 *      ATHD
246 *      AT hard disk
247247 *
248248 *************************************************************************/
249249WRITE8_HANDLER(at_mfm_0_w)
src/mess/machine/pc_fdc.h
r5932r5933
11/**********************************************************************
22
3   PC-style floppy disk controller emulation
3    PC-style floppy disk controller emulation
44
55**********************************************************************/
66
r5932r5933
2525
2626/* main interface */
2727struct pc_fdc_interface
28{   
28{
2929   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);
3131   const device_config *(*get_image)(running_machine*, int floppy_index);
3232   const device_config *(*get_device)(running_machine*);
3333};
src/mess/machine/mc6843.c
r5932r5933
107107
108108
109109
110INLINE mc6843_t* get_safe_token( const device_config *device )
110INLINE mc6843_t* get_safe_token( const device_config *device )
111111{
112112   assert( device != NULL );
113113   assert( device->token != NULL );
r5932r5933
700700      mc6843->data_size = 0;
701701
702702      /* commands are initiated by updating some flags and scheduling
703         a bottom-half (mc6843_cont) after some delay */
703           a bottom-half (mc6843_cont) after some delay */
704704
705705      switch (cmd)
706706      {
src/mess/machine/mm58274c.c
r5932r5933
11/***************************************************************************
22
3   mm58274c.c
3    mm58274c.c
44
5   mm58274c emulation
5    mm58274c emulation
66
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>
1010
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
1616
17   Raphael Nabet, 2002
17    Raphael Nabet, 2002
1818
1919***************************************************************************/
2020
r5932r5933
301301
302302
303303/*
304   Set RTC interrupt flag
304    Set RTC interrupt flag
305305*/
306306static TIMER_CALLBACK(rtc_interrupt_callback)
307307{
r5932r5933
312312
313313
314314/*
315   Increment RTC clock (timed interrupt every 1/10s)
315    Increment RTC clock (timed interrupt every 1/10s)
316316*/
317317
318318static TIMER_CALLBACK(increment_rtc)
src/mess/machine/ibmpc.c
r5932r5933
141141
142142/*************************************************************************
143143 *
144 *      EXP
145 *      expansion port
144 *      EXP
145 *      expansion port
146146 *
147147 *************************************************************************/
148148
149149// I even don't know what it is!
150150static struct {
151151   /*
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    */
157157   /* selftest in ibmpc, ibmxt */
158158   UINT8 reg[8];
159159} pc_expansion={ { 0,0,0,0,0,0,1 } };
src/mess/machine/mm58274c.h
r5932r5933
1515DEVICE_GET_INFO( mm58274c );
1616
1717/* 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.
2323*/
2424typedef struct _mm58274c_interface mm58274c_interface;
2525struct _mm58274c_interface
src/mess/machine/com8116.c
r5932r5933
11/**********************************************************************
22
3   COM8116 - Dual Baud Rate Generator (Programmable Divider) emulation
3    COM8116 - Dual Baud Rate Generator (Programmable Divider) emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88*********************************************************************/
src/mess/machine/bebox.c
r5932r5933
11/***************************************************************************
22
3   machine/bebox.c
3    machine/bebox.c
44
5   BeBox
5    BeBox
66
7   Memory map:
7    Memory map:
88
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
1515
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:
1919
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
4141
4242
4343  Interrupt bit masks:
4444
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
7777
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)
8080
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
8585
86   More hardware information at http://www.netbsd.org/Ports/bebox/hardware.html
86    More hardware information at http://www.netbsd.org/Ports/bebox/hardware.html
8787
8888***************************************************************************/
8989
r5932r5933
128128
129129/*************************************
130130 *
131 *   Interrupts and Motherboard Registers
131 *  Interrupts and Motherboard Registers
132132 *
133133 *************************************/
134134
r5932r5933
236236         if (LOG_INTERRUPTS)
237237         {
238238/*
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                    */
243243         }
244244
245245         cputag_set_input_line(space->machine, cputags[crossproc_map[i].cpunum], crossproc_map[i].inputline, line);
r5932r5933
344344
345345/*************************************
346346 *
347 *   COM ports
347 *  COM ports
348348 *
349349 *************************************/
350350
r5932r5933
401401
402402/*************************************
403403 *
404 *   Floppy Disk Controller
404 *  Floppy Disk Controller
405405 *
406406 *************************************/
407407
r5932r5933
427427static const device_config *bebox_fdc_get_image(running_machine *machine, int floppy_index)
428428{
429429   /* the BeBox boot ROM seems to query for floppy #1 when it should be
430    * querying for floppy #0 */
430    * querying for floppy #0 */
431431   return floppy_get_device(machine, 0);
432432}
433433
r5932r5933
448448
449449/*************************************
450450 *
451 *   8259 PIC
451 *  8259 PIC
452452 *
453453 *************************************/
454454
r5932r5933
468468 * pic8259 configuration
469469 *
470470 *************************************************************/
471
471
472472static PIC8259_SET_INT_LINE( bebox_pic8259_master_set_int_line ) {
473473   bebox_set_irq_bit(device->machine, 5, interrupt);
474474}
r5932r5933
493493
494494/*************************************
495495 *
496 *   Floppy/IDE/ATA
496 *  Floppy/IDE/ATA
497497 *
498498 *************************************/
499499
r5932r5933
551551
552552/*************************************
553553 *
554 *   Video card (Cirrus Logic CL-GD5430)
554 *  Video card (Cirrus Logic CL-GD5430)
555555 *
556556 *************************************/
557557
r5932r5933
618618
619619/*************************************
620620 *
621 *   8237 DMA
621 *  8237 DMA
622622 *
623623 *************************************/
624624
r5932r5933
794794
795795/*************************************
796796 *
797 *   8254 PIT
797 *  8254 PIT
798798 *
799799 *************************************/
800800
r5932r5933
827827
828828/*************************************
829829 *
830 *   Flash ROM
830 *  Flash ROM
831831 *
832832 *************************************/
833833
r5932r5933
859859
860860/*************************************
861861 *
862 *   Keyboard
862 *  Keyboard
863863 *
864864 *************************************/
865865
r5932r5933
886886
887887/*************************************
888888 *
889 *   SCSI
889 *  SCSI
890890 *
891891 *************************************/
892892
r5932r5933
10161016      {
10171017         case 0x04:
10181018            /* 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                 */
10271027            if (data & 0x02)
10281028            {
10291029               /* brutal ugly hack; at some point the PCI code should be handling this stuff */
r5932r5933
10701070
10711071/*************************************
10721072 *
1073 *   Driver main
1073 *  Driver main
10741074 *
10751075 *************************************/
10761076
r5932r5933
11381138   memory_install_write64_handler(space_1, vram_begin, vram_end, 0, 0, bebox_video_w);
11391139
11401140   /* 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     */
11481148   {
11491149      static UINT64 ops[2] =
11501150      {
src/mess/machine/com8116.h
r5932r5933
11/**********************************************************************
22
3   COM8116 - Dual Baud Rate Generator (Programmable Divider) emulation
3    COM8116 - Dual Baud Rate Generator (Programmable Divider) emulation
44
5   Copyright MESS Team.
5    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
1919
2020**********************************************************************/
2121
src/mess/machine/i8214.c
r5932r5933
5858   i8214_t *i8214 = get_safe_token(device);
5959
6060   if (LOG) logerror("I8214 '%s' Interrupt Level %u\n", device->tag, level);
61   
61
6262   i8214->a = level;
6363
6464   /* disable interrupts */
src/mess/machine/i8214.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
2222
2323**********************************************************************/
2424
src/mess/machine/6525tpi.c
r5932r5933
11/***************************************************************************
22    mos tri port interface 6525
3   mos triple interface adapter 6523
3    mos triple interface adapter 6523
44
55    peter.trauner@jk.uni-linz.ac.at
66
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
99***************************************************************************/
1010
1111/*
r5932r5933
114114   UINT8 port_a, ddr_a, in_a;
115115   UINT8 port_b, ddr_b, in_b;
116116   UINT8 port_c, ddr_c, in_c;
117   
117
118118   UINT8 ca_level, cb_level, interrupt_level;
119   
119
120120   UINT8 cr;
121121   UINT8 air;
122122
r5932r5933
343343
344344   data = (data & ~tpi6525->ddr_a) | (tpi6525->ddr_a & tpi6525->port_a);
345345
346   return data;   
346   return data;
347347}
348348
349349
r5932r5933
418418
419419   case 1:
420420      data = tpi6525->in_b;
421     
421
422422      if (tpi6525->intf->in_b_func)
423423         data &= tpi6525->intf->in_b_func(device, 0);
424424
r5932r5933
443443      else
444444      {
445445         data = tpi6525->in_c;
446         
446
447447         if (tpi6525->intf->in_c_func)
448448            data &= tpi6525->intf->in_c_func(device, 0);
449         
449
450450         data = (data & ~tpi6525->ddr_c) | (tpi6525->ddr_c & tpi6525->port_c);
451451      }
452452
r5932r5933
503503         data = tpi6525->air;
504504         tpi6525->air = 0;
505505      }
506     
506
507507      tpi6525_clear_interrupt(device);
508508      break;
509509
r5932r5933
530530         tpi6525->intf->out_a_func(device, 0, tpi6525->port_a & tpi6525->ddr_a);
531531
532532      break;
533     
533
534534   case 1:
535535      tpi6525->port_b = data;
536536
r5932r5933
573573
574574   case 6:
575575      tpi6525->cr = data;
576     
576
577577      if (INTERRUPT_MODE)
578578      {
579579         if (CA_MANUAL_OUT)
r5932r5933
591591            if (tpi6525->cb_level != CB_MANUAL_LEVEL)
592592            {
593593               tpi6525->cb_level = CB_MANUAL_LEVEL;
594               
594
595595               if (tpi6525->intf->out_cb_func)
596596                  tpi6525->intf->out_cb_func(device, 0, tpi6525->cb_level);
597597            }
src/mess/machine/intv.c
r5932r5933
336336
337337   UINT8 *memory = memory_region(image->machine, "maincpu");
338338   const char *filetype = image_filetype(image);
339   
339
340340   /* if it is in .rom format, we enter here */
341341   if (!mame_stricmp (filetype, "rom"))
342342   {
r5932r5933
384384      return INIT_PASS;
385385   }
386386   /* otherwise, we load it as a .bin file, using extrainfo from intv.hsi in place of .cfg */
387   else
387   else
388388   {
389389      /* This code is a blatant hack, due to impossibility to load a separate .cfg file in MESS. */
390390      /* It shall be eventually replaced by the .xml loading */
r5932r5933
392392      /* extrainfo format */
393393      // 1. mapper number (to deal with bankswitch). no bankswitch is mapper 0 (most games).
394394      // 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
397397      // 6. some images have a ram chunk. as above we store location and size in 8 bits
398398      // 7. extra = 1 ECS, 2 Intellivoice
399399      int start, size;
r5932r5933
415415         sscanf(image_extrainfo(image),"%d %d %d %d %d %d %d", &mapper, &rom[0], &rom[1], &rom[2],
416416                                                &rom[3], &ram, &extra);
417417
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);
420420
421         if (mapper)
421         if (mapper)
422422         {
423423            logerror("Bankswitch not yet implemented! \n");
424424         }
425425
426         if (ram)
426         if (ram)
427427         {
428428            logerror("RAM banks not yet implemented! \n");
429429         }
430430
431         if (extra & INTELLIVOICE_MASK)
431         if (extra & INTELLIVOICE_MASK)
432432         {
433433            logerror("Intellivoice support not yet implemented! \n");
434434         }
435435
436         if (extra & ECS_MASK)
436         if (extra & ECS_MASK)
437437         {
438438            logerror("ECS support is only partial\n");
439439            logerror("(even with the intvkbd driver)! \n");
r5932r5933
443443         {
444444            start = (( rom[j] & 0xf0 ) >> 4) * 0x1000;
445445            size = ( rom[j] & 0x0f ) * 0x800;
446           
446
447447            /* some cart has to be loaded to 0x4800, but none goes to 0x4000. Hence, we use */
448448            /* 0x04 << 4 in extrainfo (to reduce the stored values) and fix the value here. */
449449            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
453453            for (i = 0; i < size; i++ )
454454            {
455455               image_fread(image, &low_byte, 1);
r5932r5933
467467DEVICE_START( intv_cart )
468468{
469469   /* First, initialize these as empty so that the intellivision
470    * will think that the playcable and keyboard are not attached */
470    * will think that the playcable and keyboard are not attached */
471471   UINT8 *memory = memory_region(device->machine, "maincpu");
472472
473473   /* assume playcable is absent */
r5932r5933
482482DEVICE_IMAGE_LOAD( intv_cart )
483483{
484484   /* First, initialize these as empty so that the intellivision
485    * will think that the playcable and keyboard are not attached */
485    * will think that the playcable and keyboard are not attached */
486486   UINT8 *memory = memory_region(image->machine, "maincpu");
487487
488488   /* assume playcable is absent */
r5932r5933
579579   if (strcmp(image->tag,"cart1") == 0) /* Legacy cartridge slot */
580580   {
581581      /* First, initialize these as empty so that the intellivision
582      * will think that the playcable is not attached */
582        * will think that the playcable is not attached */
583583      UINT8 *memory = memory_region(image->machine, "maincpu");
584584
585585      /* assume playcable is absent */
src/mess/machine/special.c
r5932r5933
11/***************************************************************************
22
3      Specialist machine driver by Miodrag Milanovic
3        Specialist machine driver by Miodrag Milanovic
44
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
88****************************************************************************/
99
1010
r5932r5933
2828DRIVER_INIT(special)
2929{
3030   /* set initialy ROM to be visible on first bank */
31   UINT8 *RAM = memory_region(machine, "maincpu");   
31   UINT8 *RAM = memory_region(machine, "maincpu");
3232   memset(RAM,0x0000,0x3000); // make frist page empty by default
3333   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);
3535}
3636
3737static READ8_DEVICE_HANDLER (specialist_8255_porta_r )
r5932r5933
4343   if (input_port_read(device->machine, "LINE4")!=0xff) return 0xef;
4444   if (input_port_read(device->machine, "LINE5")!=0xff) return 0xdf;
4545   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;
4747   return 0xff;
4848}
4949
5050static READ8_DEVICE_HANDLER (specialist_8255_portb_r )
5151{
52   
52
5353   int dat = 0;
54   double level;   
54   double level;
5555
5656   if ((specialist_8255_porta & 0x01)==0) dat ^= (input_port_read(device->machine, "LINE0") ^ 0xff);
5757   if ((specialist_8255_porta & 0x02)==0) dat ^= (input_port_read(device->machine, "LINE1") ^ 0xff);
r5932r5933
6565   if ((specialist_8255_portc & 0x02)==0) dat ^= (input_port_read(device->machine, "LINE9") ^ 0xff);
6666   if ((specialist_8255_portc & 0x04)==0) dat ^= (input_port_read(device->machine, "LINE10") ^ 0xff);
6767   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;
7070   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   {
7575         dat ^= 0x01;
76    }     
76    }
7777   return dat & 0xff;
7878}
7979
r5932r5933
8787}
8888
8989static WRITE8_DEVICE_HANDLER (specialist_8255_porta_w )
90{   
90{
9191   specialist_8255_porta = data;
9292}
9393
9494static WRITE8_DEVICE_HANDLER (specialist_8255_portb_w )
95{   
95{
9696   specialist_8255_portb = data;
9797}
9898static WRITE8_DEVICE_HANDLER (specialist_8255_portc_w )
99{     
99{
100100   const device_config *dac_device = devtag_get_device(device->machine, "dac");
101101
102102   specialist_8255_portc = data;
103   
104   cassette_output(devtag_get_device(device->machine, "cassette"),data & 0x80 ? 1 : -1);   
105103
104   cassette_output(devtag_get_device(device->machine, "cassette"),data & 0x80 ? 1 : -1);
105
106106   dac_data_w(dac_device, data & 0x20); //beeper
107   
107
108108}
109109
110110I8255A_INTERFACE( specialist_ppi8255_interface )
r5932r5933
126126MACHINE_RESET( special )
127127{
128128   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);
130130}
131131
132132READ8_HANDLER( specialist_keyboard_r )
133{   
133{
134134   return i8255a_r(devtag_get_device(space->machine, "ppi8255"), (offset & 3));
135135}
136136
137137WRITE8_HANDLER( specialist_keyboard_w )
138{   
138{
139139   i8255a_w(devtag_get_device(space->machine, "ppi8255"), (offset & 3) , data );
140140}
141141
142142
143143/*
144    Specialist MX
144    Specialist MX
145145*/
146146
147147static WRITE8_HANDLER( video_memory_w )
r5932r5933
151151}
152152
153153WRITE8_HANDLER (specimx_video_color_w )
154{     
154{
155155   specimx_color = data;
156156}
157157
r5932r5933
166166   memory_install_write8_handler(space, 0xc000, 0xffbf, 0, 0, SMH_BANK(3));
167167   memory_install_write8_handler(space, 0xffc0, 0xffdf, 0, 0, SMH_BANK(4));
168168   memory_set_bankptr(machine, 4, mess_ram + 0xffc0);
169   switch(i)
169   switch(i)
170170   {
171      case 0 :           
171      case 0 :
172172            memory_install_write8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK(1));
173173            memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, video_memory_w);
174         
174
175175            memory_set_bankptr(machine, 1, mess_ram);
176176            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);
178178            break;
179179      case 1 :
180180            memory_install_write8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK(1));
181181            memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, SMH_BANK(2));
182         
182
183183            memory_set_bankptr(machine, 1, mess_ram + 0x10000);
184184            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);
186186            break;
187187      case 2 :
188188            memory_install_write8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_UNMAP);
189189            memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, SMH_UNMAP);
190         
190
191191            memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x10000);
192192            memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x19000);
193            if (data & 0x80)
193            if (data & 0x80)
194194            {
195               memory_set_bankptr(machine, 3, mess_ram + 0x1c000);               
196            }
197            else
195               memory_set_bankptr(machine, 3, mess_ram + 0x1c000);
196            }
197            else
198198            {
199               memory_set_bankptr(machine, 3, mess_ram + 0xc000);               
199               memory_set_bankptr(machine, 3, mess_ram + 0xc000);
200200            }
201201            break;
202202   }
203203}
204204WRITE8_HANDLER( specimx_select_bank )
205{   
206   specimx_set_bank(space->machine, offset, data);   
205{
206   specimx_set_bank(space->machine, offset, data);
207207}
208208
209209DRIVER_INIT(specimx)
r5932r5933
256256   wd17xx_set_density (fdc,DEN_FM_HI);
257257}
258258
259static TIMER_CALLBACK( setup_pit8253_gates )
259static TIMER_CALLBACK( setup_pit8253_gates )
260260{
261261   const device_config *pit8253 = devtag_get_device(machine, "pit8253");
262262
r5932r5933
268268MACHINE_RESET( specimx )
269269{
270270   specimx_set_bank(machine, 2,0x00); // Initiali load ROM disk
271   specimx_color = 0x70;   
271   specimx_color = 0x70;
272272   timer_set(machine,  attotime_zero, NULL, 0, setup_pit8253_gates );
273273}
274274
r5932r5933
278278}
279279
280280WRITE8_HANDLER( specimx_disk_ctrl_w )
281{   
281{
282282   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
283283
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);
291291             break;
292         
293  } 
292
293  }
294294}
295295
296296/*
297   Erik
297    Erik
298298*/
299299static UINT8 RR_register;
300300static UINT8 RC_register;
301301
302static void erik_set_bank(running_machine *machine)
303{     
302static void erik_set_bank(running_machine *machine)
303{
304304   UINT8 bank1 = (RR_register & 3);
305305   UINT8 bank2 = ((RR_register >> 2) & 3);
306306   UINT8 bank3 = ((RR_register >> 4) & 3);
307307   UINT8 bank4 = ((RR_register >> 6) & 3);
308308   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
311311   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
312312   memory_install_write8_handler(space, 0x4000, 0x8fff, 0, 0, SMH_BANK(2));
313313   memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, SMH_BANK(3));
314314   memory_install_write8_handler(space, 0xc000, 0xefff, 0, 0, SMH_BANK(4));
315315   memory_install_write8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_BANK(5));
316316   memory_install_write8_handler(space, 0xf800, 0xffff, 0, 0, SMH_BANK(6));
317   
318   switch(bank1)
317
318   switch(bank1)
319319   {
320      case    1:                   
320      case    1:
321321      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:
326326                  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);
328328                  break;
329329   }
330   switch(bank2)
330   switch(bank2)
331331   {
332      case    1:                   
332      case    1:
333333      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:
338338                  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);
340340                  break;
341341   }
342   switch(bank3)
342   switch(bank3)
343343   {
344      case    1:                                     
344      case    1:
345345      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:
350350                  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);
352352                  break;
353353   }
354   switch(bank4)
354   switch(bank4)
355355   {
356      case    1:                   
356      case    1:
357357      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:
364364                  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);
366366                  memory_install_write8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_UNMAP);
367367                  memory_install_read8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_NOP);
368368                  memory_install_write8_handler(space, 0xf800, 0xffff, 0, 0, specialist_keyboard_w);
r5932r5933
372372}
373373
374374DRIVER_INIT(erik)
375{   
376   memset(mess_ram,0,192*1024);   
375{
376   memset(mess_ram,0,192*1024);
377377   erik_color_1 = 0;
378378   erik_color_2 = 0;
379379   erik_background = 0;
r5932r5933
381381
382382MACHINE_RESET( erik )
383383{
384   RR_register = 0x00;   
384   RR_register = 0x00;
385385   RC_register = 0x00;
386   erik_set_bank(machine);           
386   erik_set_bank(machine);
387387}
388388
389389READ8_HANDLER ( erik_rr_reg_r )
390390{
391391   return RR_register;
392392}
393WRITE8_HANDLER( erik_rr_reg_w )
393WRITE8_HANDLER( erik_rr_reg_w )
394394{
395395   RR_register = data;
396396   erik_set_bank(space->machine);
397397}
398398
399READ8_HANDLER ( erik_rc_reg_r )
399READ8_HANDLER ( erik_rc_reg_r )
400400{
401401   return RC_register;
402402}
403403
404404
405WRITE8_HANDLER( erik_rc_reg_w )
405WRITE8_HANDLER( erik_rc_reg_w )
406406{
407407   RC_register = data;
408408   erik_color_1 =  RC_register & 7;
r5932r5933
410410   erik_background = ((RC_register  >> 6 ) & 1) + ((RC_register  >> 7 ) & 1) * 4;
411411}
412412
413READ8_HANDLER ( erik_disk_reg_r )
413READ8_HANDLER ( erik_disk_reg_r )
414414{
415   return 0xff;   
415   return 0xff;
416416}
417417
418WRITE8_HANDLER( erik_disk_reg_w )
418WRITE8_HANDLER( erik_disk_reg_w )
419419{
420420   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);
423423   wd17xx_set_drive(fdc,(data >> 1) & 1);
424   if((data >>2) & 1)
424   if((data >>2) & 1)
425425   {
426426      wd17xx_set_density (fdc,DEN_FM_LO);
427   }
428   else
427   }
428   else
429429   {
430430      wd17xx_set_density (fdc,DEN_FM_HI);
431  }   
431  }
432432}
src/mess/machine/jupiter.c
r5932r5933
110110/* Load in .ace files. These are memory images of 0x2000 to 0x7fff
111111   and compressed as follows:
112112
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>
117117*/
118118
119119DEVICE_IMAGE_LOAD( jupiter_ace )
src/mess/machine/mz80.c
r5932r5933
1212#include "devices/cassette.h"
1313#include "sound/speaker.h"
1414#include "includes/mz80.h"
15
15
1616UINT8 mz80k_tempo_strobe = 0;
1717static UINT8 mz80k_8255_portc = 0;
1818UINT8 mz80k_vertical = 0;
r5932r5933
5858   return val;
5959}
6060
61static WRITE8_DEVICE_HANDLER(mz80k_8255_porta_w)
62{   
63   mz80k_keyboard_line = data & 0x0f;   
61static WRITE8_DEVICE_HANDLER(mz80k_8255_porta_w)
62{
63   mz80k_keyboard_line = data & 0x0f;
6464}
6565
66static WRITE8_DEVICE_HANDLER(mz80k_8255_portc_w)
67{   
68//   logerror("mz80k_8255_portc_w %02x\n",data);
66static WRITE8_DEVICE_HANDLER(mz80k_8255_portc_w)
67{
68//  logerror("mz80k_8255_portc_w %02x\n",data);
6969}
7070
7171static UINT8 speaker_level = 0;
r5932r5933
7575   const device_config *speaker = devtag_get_device(device->machine, "speaker");
7676   if((prev_state==0) && (state==1)) {
7777      speaker_level ^= 1;
78   }   
78   }
7979   prev_state = state;
8080   speaker_level_w( speaker, speaker_level);
8181}
r5932r5933
105105const struct pit8253_config mz80k_pit8253_config =
106106{
107107   {
108      /* clockin     irq callback     */     
109      { XTAL_8MHz/  4,  pit_out0_changed },     
108      /* clockin    irq callback    */
109      { XTAL_8MHz/  4,  pit_out0_changed },
110110      { XTAL_8MHz/256,  pit_out1_changed },
111111      {            0,  pit_out2_changed },
112112   }
src/mess/machine/ins8250.c
r5932r5933
11/**********************************************************************
22
3   National Semiconductor 8250 UART interface and emulation
3    National Semiconductor 8250 UART interface and emulation
44
55   More information on the different models can be found in
66   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/
88
99Model overview (from page above):
1010
r5932r5933
6464
6565
6666History:
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
7373
7474**********************************************************************/
7575
r5932r5933
333333            break;
334334      case 5:
335335         /*
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            */
340340         COM_LOG(1,"COM_lsr_w",("COM \"%s\" $%02x\n", device->tag, data ));
341341
342342         ins8250->lsr = data;
r5932r5933
350350         break;
351351      case 6:
352352         /*
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             */
357357         COM_LOG(1,"COM_msr_w",("COM \"%s\" $%02x\n", device->tag, data ));
358358
359359         ins8250->msr = data;
r5932r5933
416416         data = ins8250->iir;
417417         COM_LOG(2,"COM_iir_r",("COM \"%s\" $%02x\n", device->tag, data));
418418         /* The documentation says that reading this register will
419         clear the int if this is the source of the int */
419            clear the int if this is the source of the int */
420420         if ( ins8250->ier & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY )
421421         {
422422            ins8250_clear_int(device, COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY);
r5932r5933
502502   ins8250_trigger_int(device, COM_INT_PENDING_RECEIVED_DATA_AVAILABLE);
503503
504504
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);
510510//
511//   }
511//  }
512512}
513513
514514/**************************************************************************
515 *   change the modem status register
515 *  change the modem status register
516516 **************************************************************************/
517517void ins8250_handshake_in(const device_config *device, int new_msr)
518518{
r5932r5933
527527
528528   ins8250_trigger_int(device, COM_INT_PENDING_MODEM_STATUS_REGISTER);
529529
530//   /* set up interrupt information register */
530//  /* set up interrupt information register */
531531  //  COM_iir[n] &= ~(0x06 | 0x01);
532532
533533//    /* 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//  }
539539}
540540
541541
src/mess/machine/ut88.c
r5932r5933
11/***************************************************************************
22
3      UT88 machine driver by Miodrag Milanovic
3        UT88 machine driver by Miodrag Milanovic
44
5      06/03/2008 Preliminary driver.
6           
5        06/03/2008 Preliminary driver.
6
77****************************************************************************/
88
99
r5932r5933
2020DRIVER_INIT(ut88)
2121{
2222   /* set initialy ROM to be visible on first bank */
23   UINT8 *RAM = memory_region(machine, "maincpu");   
23   UINT8 *RAM = memory_region(machine, "maincpu");
2424   memset(RAM,0x0000,0x0800); // make frist page empty by default
2525     memory_configure_bank(machine, 1, 1, 2, RAM, 0x0000);
2626   memory_configure_bank(machine, 1, 0, 2, RAM, 0xf800);
r5932r5933
4242
4343static READ8_DEVICE_HANDLER (ut88_8255_portc_r )
4444{
45   return input_port_read(device->machine, "LINE8");   
45   return input_port_read(device->machine, "LINE8");
4646}
4747
4848static WRITE8_DEVICE_HANDLER (ut88_8255_porta_w )
4949{
50   ut88_keyboard_mask = data ^ 0xff;   
50   ut88_keyboard_mask = data ^ 0xff;
5151}
5252
5353I8255A_INTERFACE( ut88_ppi8255_interface )
r5932r5933
6868MACHINE_RESET( ut88 )
6969{
7070   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);
7272   ut88_keyboard_mask = 0;
7373}
7474
7575
7676READ8_DEVICE_HANDLER( ut88_keyboard_r )
7777{
78   return i8255a_r(device, offset^0x03);   
78   return i8255a_r(device, offset^0x03);
7979}
8080
8181
r5932r5933
8888{
8989   const device_config *dac_device = devtag_get_device(space->machine, "dac");
9090   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);
9292}
9393
9494
9595READ8_HANDLER( ut88_tape_r )
9696{
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;
100100    }
101   return 0xff;   
101   return 0xff;
102102}
103103
104104READ8_HANDLER( ut88mini_keyboard_r )
r5932r5933
106106   // This is real keyboard implementation
107107   UINT8 *keyrom1 = memory_region(space->machine, "maincpu")+ 0x10000;
108108   UINT8 *keyrom2 = memory_region(space->machine, "maincpu")+ 0x10100;
109   
109
110110   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
112112   // 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   }
116116   // 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
119119   // discrete logic
120120   key = (input_port_read(space->machine, "LINE0") & 0x01)==0x01 ? key : 0x10;
121121   return key;
r5932r5933
126126WRITE8_HANDLER( ut88mini_write_led )
127127{
128128      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;
131131                        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;
134134                        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;
137137                        break;
138138      }
139139}
140140
141static const UINT8 hex_to_7seg[16] =
142   {0x3F, 0x06, 0x5B, 0x4F,
143    0x66, 0x6D, 0x7D, 0x07,
144    0x7F, 0x6F, 0x77, 0x7c,
141static const UINT8 hex_to_7seg[16] =
142   {0x3F, 0x06, 0x5B, 0x4F,
143    0x66, 0x6D, 0x7D, 0x07,
144    0x7F, 0x6F, 0x77, 0x7c,
145145    0x39, 0x5e, 0x79, 0x71 };
146146
147147static TIMER_CALLBACK( update_display )
148{   
148{
149149   int i;
150150   for (i=0;i<6;i++) {
151151      output_set_digit_value(i, hex_to_7seg[lcd_digit[i]]);
152   }         
152   }
153153}
154154
155155
156156DRIVER_INIT(ut88mini)
157157{
158   
158
159159}
160160MACHINE_START( ut88mini )
161161{
src/mess/machine/pc_mouse.c
r5932r5933
11/***************************************************************************
22
3   machine/pc_mouse.c
3    machine/pc_mouse.c
44
5   Code for emulating PC-style serial mouses
5    Code for emulating PC-style serial mouses
66
77***************************************************************************/
88
r5932r5933
5151}
5252
5353/**************************************************************************
54 *   Check for mouse moves and buttons. Build delta x/y packets
54 *  Check for mouse moves and buttons. Build delta x/y packets
5555 **************************************************************************/
5656static TIMER_CALLBACK(pc_mouse_scan)
5757{
r5932r5933
124124            break;
125125
126126            /* mouse systems mouse
127            from "PC Mouse information" by Tomi Engdahl */
127                from "PC Mouse information" by Tomi Engdahl */
128128
129129            /*
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
132132
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'
138138
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
150150
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. */
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. */
152152
153153            case TYPE_MOUSE_SYSTEMS:
154154            {
r5932r5933
192192
193193
194194/**************************************************************************
195 *   Check for mouse control line changes and (de-)install timer
195 *  Check for mouse control line changes and (de-)install timer
196196 **************************************************************************/
197197
198198INS8250_HANDSHAKE_OUT( pc_mouse_handshake_in )
r5932r5933
247247
248248
249249/**************************************************************************
250 *   Mouse INPUT_PORT declarations
250 *  Mouse INPUT_PORT declarations
251251 **************************************************************************/
252252
253253INPUT_PORTS_START( pc_mouse_mousesystems )
src/mess/machine/ins8250.h
r5932r5933
11/**********************************************************************
22
3   8250 UART interface and emulation
3    8250 UART interface and emulation
44
55**********************************************************************/
66
src/mess/machine/zx8302.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
1414    - microdrive
1515    - RTC register write
r5932r5933
159159
160160/*-------------------------------------------------
161161    zx8302_irq_status_r - interrupt status
162   register
162    register
163163-------------------------------------------------*/
164164
165165READ8_DEVICE_HANDLER( zx8302_irq_status_r )
r5932r5933
171171
172172/*-------------------------------------------------
173173    zx8302_irq_acknowledge_w - interrupt
174   acknowledge
174    acknowledge
175175-------------------------------------------------*/
176176
177177WRITE8_DEVICE_HANDLER( zx8302_irq_acknowledge_w )
r5932r5933
208208{
209209   /*
210210
211      IPC <-> ZX8302 serial link protocol
212      ***********************************
211        IPC <-> ZX8302 serial link protocol
212        ***********************************
213213
214      Send bit to IPC
215      ---------------
214        Send bit to IPC
215        ---------------
216216
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)
222222
223      Receive bit from IPC
224      --------------------
223        Receive bit from IPC
224        --------------------
225225
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)
231231
232   */
232    */
233233
234234   zx8302_t *zx8302 = get_safe_token(device);
235235
r5932r5933
472472
473473WRITE8_DEVICE_HANDLER( zx8302_rtc_w )
474474{
475//   zx8302_t *zx8302 = get_safe_token(device);
475//  zx8302_t *zx8302 = get_safe_token(device);
476476
477477   if (LOG) logerror("ZX8302 Real Time Clock Register: %02x\n", data);
478478}
r5932r5933
493493
494494/*-------------------------------------------------
495495    zx8302_get_selected_microdrive - gets the
496   index of the selected microdrive
496    index of the selected microdrive
497497-------------------------------------------------*/
498498
499499static int zx8302_get_selected_microdrive(const device_config *device)
r5932r5933
512512
513513/*-------------------------------------------------
514514    zx8302_get_microdrive_status - gets the
515   status of the selected microdrive
515    status of the selected microdrive
516516-------------------------------------------------*/
517517
518518static UINT8 zx8302_get_microdrive_status(const device_config *device)
r5932r5933
578578
579579/*-------------------------------------------------
580580    zx8302_mdv_control_w - microdrive control
581   register
581    register
582582-------------------------------------------------*/
583583
584584WRITE8_DEVICE_HANDLER( zx8302_mdv_control_w )
r5932r5933
749749
750750static DEVICE_RESET( zx8302 )
751751{
752//   zx8302_t *zx8302 = get_safe_token(device);
752//  zx8302_t *zx8302 = get_safe_token(device);
753753
754754}
755755
src/mess/machine/pp01.c
r5932r5933
3030static void pp01_video_w(UINT8 block,UINT16 offset,UINT8 data,UINT8 part)
3131{
3232   UINT16 addroffset = part ? 0x1000  : 0x0000;
33   
33
3434   if (BIT(pp01_video_write_mode,3)) {
3535      // Copy mode
3636      if(BIT(pp01_video_write_mode,0)) {
r5932r5933
5858      if (block==2) {
5959         mess_ram[0xe000+offset+addroffset] = data;
6060      }
61   }   
61   }
6262}
6363
6464static WRITE8_HANDLER (pp01_video_r_1_w)
r5932r5933
8989
9090
9191static 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");
9494   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
9595   UINT16 startaddr = block*0x1000;
9696   UINT16 endaddr   = ((block+1)*0x1000)-1;
r5932r5933
9999      // This is RAM
100100      memory_install_read8_handler (space, startaddr, endaddr, 0, 0, SMH_BANK(blocknum));
101101      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);
104104               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);
107107               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);
110110               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);
113113               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);
116116               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);
119119               break;
120         
120
121121         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));
123123               break;
124124      }
125     
125
126126      memory_set_bankptr(machine, blocknum, mess_ram + (data & 0x0F)* 0x1000);
127127   } else if (data>=0xF8) {
128128      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);
130130      memory_set_bankptr(machine, blocknum, mem + ((data & 0x0F)-8)* 0x1000+0x10000);
131131   } else {
132132      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);
135135   }
136136}
137   
137
138138MACHINE_RESET( pp01 )
139139{
140140   int i;
r5932r5933
145145   }
146146}
147147
148WRITE8_HANDLER (pp01_mem_block_w)
148WRITE8_HANDLER (pp01_mem_block_w)
149149{
150150   memory_block[offset] = data;
151151   pp01_set_memory(space->machine, offset, data);
r5932r5933
198198   return pp01_video_scroll;
199199}
200200static WRITE8_DEVICE_HANDLER (pp01_8255_porta_w )
201{   
201{
202202   pp01_video_scroll = data;
203203}
204204
r5932r5933
207207{
208208   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7",
209209                                 "LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF" };
210   
210
211211   return (input_port_read(device->machine,keynames[pp01_key_line]) & 0x3F) | (input_port_read(device->machine,"LINEALL") & 0xC0);
212212}
213213static WRITE8_DEVICE_HANDLER (pp01_8255_portb_w )
214{   
214{
215215   //logerror("pp01_8255_portb_w %02x\n",data);
216   
216
217217}
218218
219219static WRITE8_DEVICE_HANDLER (pp01_8255_portc_w )
220{   
220{
221221   pp01_key_line = data & 0x0f;
222222}
223223
224224static READ8_DEVICE_HANDLER (pp01_8255_portc_r )
225{   
225{
226226   return 0xff;
227227}
228228
src/mess/machine/cybiko.c
r5932r5933
11/*
22
3   Cybiko Wireless Inter-tainment System
3    Cybiko Wireless Inter-tainment System
44
5   (c) 2001-2007 Tim Schuerewegen
5    (c) 2001-2007 Tim Schuerewegen
66
7   Cybiko Classic (V1)
8   Cybiko Classic (V2)
9   Cybiko Xtreme
7    Cybiko Classic (V1)
8    Cybiko Classic (V2)
9    Cybiko Xtreme
1010
1111*/
1212
r5932r5933
111111/*
112112NVRAM_HANDLER( cybikov1 )
113113{
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);
117117}
118118*/
119119
120120/*
121121NVRAM_HANDLER( cybikov2 )
122122{
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);
127127}
128128*/
129129
130130/*
131131NVRAM_HANDLER( cybikoxt )
132132{
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);
136136}
137137*/
138138
r5932r5933
235235MACHINE_START( cybikov2 )
236236{
237237   const device_config *flash2 = devtag_get_device(machine, "flash2");
238   
238
239239   _logerror( 0, ("machine_start_cybikov2\n"));
240240   // real-time clock
241241   nvram_system_load( machine, "rtc", cybiko_pcf8593_load, 0);
r5932r5933
349349{
350350   _logerror( 0, ("cybiko_rs232_init\n"));
351351   memset( &rs232, 0, sizeof( rs232));
352//   timer_pulse(machine,  TIME_IN_HZ( 10), NULL, 0, rs232_timer_callback);
352//  timer_pulse(machine,  TIME_IN_HZ( 10), NULL, 0, rs232_timer_callback);
353353}
354354
355355static void cybiko_rs232_exit( void)
r5932r5933
437437   UINT8 data = 0xFF;
438438   int i;
439439   static const char *const keynames[] = { "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9" };
440   
440
441441   _logerror( 2, ("cybiko_key_r_byte (%08X)\n", offset));
442442   // A11
443   if (!(offset & (1 << 11)))
443   if (!(offset & (1 << 11)))
444444      data &= 0xFE;
445445   // A1 .. A9
446   for (i=1; i<10; i++)
446   for (i=1; i<10; i++)
447447   {
448      if (!(offset & (1 << i)))
448      if (!(offset & (1 << i)))
449449         data &= input_port_read(space->machine, keynames[i-1]);
450450   }
451451   // A0
452   if (!(offset & (1 <<  0)))
452   if (!(offset & (1 <<  0)))
453453      data |= 0xFF;
454454   //
455455   return data;
r5932r5933
481481      // serial dataflash
482482      case H8S_IO_PORT3 :  {
483483            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;
485485         }
486486         break;
487         
487
488488      // rs232
489489      case H8S_IO_PORT5 : if (cybiko_rs232_pin_rxd()) data = data | H8S_P5_RXD2; break;
490490      // real-time clock
r5932r5933
609609      case 0x000 : return 0xBA0B; // magic (part 1)
610610      case 0x002 : return 0xAB15; // magic (part 2)
611611      case 0x004 : return (0x07 << 8) | (0x07 ^0xFF); // brightness (or contrast) & value xor FF
612//      case 0x006 : return 0x2B57; // do not show "Free Games and Applications at www.cybiko.com" screen
612//      case 0x006 : return 0x2B57; // do not show "Free Games and Applications at www.cybiko.com" screen
613613      case 0x008 : return 0xDEBA; // enable debug output
614614      case 0x016 : return 0x5000 | 0x03FF; // ?
615615      case 0x7FC : return 0x22A1; // crc32 (part 1)
src/mess/machine/snescart.c
r5932r5933
131131   if (snes_cart.mode == SNES_MODE_20)
132132   {
133133      /* There could be some larger image needing banks 0x70 to 0x7f at address 0x8000 for ROM
134      * mirroring. These should be treated separately or data would be overwritten by SRAM */
134        * mirroring. These should be treated separately or data would be overwritten by SRAM */
135135      for (ii = 0; ii < 16; ii++)
136136      {
137137         /* loading */
r5932r5933
236236   UINT8 mapper        = infoblock[offset + 0x15] & ~0x10;                     //mask off irrelevent FastROM-capable bit
237237
238238   /* $00:[000-7fff] contains uninitialized RAM and MMIO.
239   reset vector must point to ROM at $00:[8000-ffff] to be considered valid. */
239    reset vector must point to ROM at $00:[8000-ffff] to be considered valid. */
240240   if (reset_vector < 0x8000)
241241      return 0;
242242
243243   /* 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. */
247247
248248   /* most likely opcodes */
249249   if (reset_opcode == 0x78      //sei
r5932r5933
290290      score -= 8;
291291
292292   /* Sometimes, both the header and reset vector's first opcode will match ...
293   fallback and rely on info validity in these cases to determine more likely header. */
293    fallback and rely on info validity in these cases to determine more likely header. */
294294
295295   /* a valid checksum is the biggest indicator of a valid header. */
296296   if ((checksum + ichecksum) == 0xffff && (checksum != 0) && (ichecksum != 0))
r5932r5933
382382   }
383383
384384   /* We need to take a sample to test what mode we need to be in (the
385   sample has to be quite large to cope with large carts in ExHiRom) */
385    sample has to be quite large to cope with large carts in ExHiRom) */
386386   image_fread(image, temp_buffer, 0x40ffff);
387387   image_fseek(image, offset, SEEK_SET);   /* Rewind */
388388
r5932r5933
427427   read_blocks = 0;
428428
429429   /* 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     */
440440   switch (snes_cart.mode)
441441   {
442442      case SNES_MODE_21:
443443      /* 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         */
447447         while (read_blocks < 64 && read_blocks < total_blocks)
448448         {
449449            /* Loading data */
r5932r5933
472472
473473      case SNES_MODE_25:
474474      /* 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         */
481481         /* Reading the first 64 blocks */
482482         while (read_blocks < 64 && read_blocks < total_blocks)
483483         {
r5932r5933
522522
523523      case SNES_MODE_22:
524524      /* "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         */
530530         while (read_blocks < 64 && read_blocks < total_blocks)
531531         {
532532            /* Loading and mirroring data */
r5932r5933
555555      default:
556556      case SNES_MODE_20:
557557      /* 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         */
560560         /* SuperFX games needs this different loading routine */
561561         if(((temp_buffer[0x007fd6] >= 0x13 && temp_buffer[0x007fd6] <= 0x15) || temp_buffer[0x007fd6] == 0x1a) && (temp_buffer[0x007fd5] == 0x20))
562562         {
r5932r5933
700700
701701         case 0xf6:
702702            /* These Seta ST-01X chips have both 0x30 at 0x00ffd5,
703            they only differ for the 'size' at 0x00ffd7 */
703                they only differ for the 'size' at 0x00ffd7 */
704704            if (snes_r_bank1(space, 0x00ffd7) < 0x0a)
705705            {
706706               snes_has_addon_chip = HAS_ST011;
src/mess/machine/apple2.c
r5932r5933
77  TODO:  Make a standard set of peripherals work.
88  TODO:  Allow swappable peripherals in each slot.
99  TODO:  Verify correctness of C08X switches.
10         - need to do double-read before write-enable RAM
10            - need to do double-read before write-enable RAM
1111
1212***************************************************************************/
1313
r5932r5933
569569
570570void apple2_setvar(running_machine *machine, UINT32 val, UINT32 mask)
571571{
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,
573573               (unsigned int) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC)));
574574
575575   assert((val & mask) == val);
r5932r5933
796796
797797
798798/***************************************************************************
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
803803***************************************************************************/
804804
805805static WRITE8_HANDLER ( apple2_mainram0400_w )
r5932r5933
849849/***************************************************************************
850850  apple2_c00x_w
851851
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
868868***************************************************************************/
869869
870870WRITE8_HANDLER ( apple2_c00x_w )
r5932r5933
10561056         break;
10571057      default:
10581058         /* 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             */
10611061         return apple2_getfloatingbusvalue(space->machine);
10621062   }
10631063   return result ? 0x80 : 0x00;
r5932r5933
12811281   memset(mess_ram, 0, mess_ram_size);
12821282
12831283   /* --------------------------------------------- *
1284    * set up the softswitch mask/set                *
1285    * --------------------------------------------- */
1284     * set up the softswitch mask/set                *
1285     * --------------------------------------------- */
12861286   a2_mask = ~0;
12871287   a2_set = 0;
12881288
r5932r5933
13021302   void *apple2cp_ce00_ram = NULL;
13031303
13041304   /* 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 */
13071307   if (!strcmp(machine->gamedrv->name, "apple2cp"))
13081308      apple2cp_ce00_ram = auto_alloc_array(machine, UINT8, 0x200);
13091309
src/mess/machine/zx8302.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3030
3131**********************************************************************/
3232
src/mess/machine/snescart.h
r5932r5933
11/*
2   snescart.h
2    snescart.h
33
44*/
55
src/mess/machine/hd63450.c
r5932r5933
11/*
22    Hitachi HD63450 DMA Controller
33
4   Largely based on documentation of the Sharp X68000
4    Largely based on documentation of the Sharp X68000
55*/
66
77#include "machine/hd63450.h"
r5932r5933
130130   case 0x00:  // CSR / CER
131131      if(ACCESSING_BITS_8_15)
132132      {
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);
135135      }
136136      // CER is read-only, so no action needed there.
137137      break;
r5932r5933
353353                  break;
354354               }
355355            }
356//            logerror("DMA#%i: byte transfer %08lx -> %08lx  (byte = %02x)\n",x,dmac.reg[x].dar,dmac.reg[x].mar,data);
356//              logerror("DMA#%i: byte transfer %08lx -> %08lx  (byte = %02x)\n",x,dmac.reg[x].dar,dmac.reg[x].mar,data);
357357         }
358358         else  // memory -> device
359359         {
r5932r5933
391391                  break;
392392               }
393393            }
394//            logerror("DMA#%i: byte transfer %08lx -> %08lx\n",x,dmac->reg[x].mar,dmac->reg[x].dar);
394//              logerror("DMA#%i: byte transfer %08lx -> %08lx\n",x,dmac->reg[x].mar,dmac->reg[x].dar);
395395         }
396396
397397
src/mess/machine/genesis.c
r5932r5933
55  Machine file to handle emulation of the Sega Mega Drive & Genesis.
66
77
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.
1717
1818***************************************************************************/
1919
r5932r5933
9191   static int lastoffset = -1,lastdata = -1;
9292   UINT8 *ROM = memory_region(space->machine, "maincpu");
9393
94   if ((lastoffset != offset) || (lastdata != data))
94   if ((lastoffset != offset) || (lastdata != data))
9595   {
9696      lastoffset = offset; lastdata = data;
9797      switch (offset << 1)
9898      {
9999         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)
101101            {
102102               memcpy(ROM + 0x000000, ROM + 0x400000 + (((data & 0xf) - 2) * 0x080000), 0x080000);
103103            }
r5932r5933
129129
130130/*static WRITE16_HANDLER( g_l3alt_pdat_w )
131131{
132   g_l3alt_pdat = data;
132    g_l3alt_pdat = data;
133133}
134134
135135static WRITE16_HANDLER( g_l3alt_pcmd_w )
136136{
137   g_l3alt_pcmd = data;
137    g_l3alt_pcmd = data;
138138}
139139*/
140140
r5932r5933
180180         break;
181181   }
182182
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); */
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); */
184184
185185   return retdata;
186186}
r5932r5933
308308   UINT32 retdat;
309309
310310   /* not 100% correct, there may be some relationship between the reads here
311   and the writes made at the start of the game.. */
311    and the writes made at the start of the game.. */
312312
313313   /*
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    */
317317
318318   if (cpu_get_pc(space->cpu) == 0x01782) // makes 'VS' screen appear
319319   {
r5932r5933
623623{
624624
625625   /* 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    */
628628   genesis_sram_active = (data & 1) ? 1 : 0;
629629   genesis_sram_readonly = (data & 2) ? 1 : 0;
630630
r5932r5933
830830
831831      memcpy(&ROM[0x400000], &ROM[relocate], 0x80000);
832832
833      for (mirroraddr = 0; mirroraddr < 0x400000; mirroraddr += 0x2000)
833      for (mirroraddr = 0; mirroraddr < 0x400000; mirroraddr += 0x2000)
834834      {
835835         memcpy(ROM + mirroraddr, ROM + relocate + 0x7e000, 0x002000); /* copy last 8kb across the whole rom region */
836836      }
r5932r5933
853853   }
854854
855855   /* Disable SRAM handlers if it's a game using EEPROM to save
856   progresses. Currently EEPROM is not emulated. */
856    progresses. Currently EEPROM is not emulated. */
857857   if (!has_serial_eeprom)
858858   {
859859      /* Info from DGen: If SRAM does not overlap main ROM, set it active by
860      default since a few games can't manage to properly switch it on/off. */
860        default since a few games can't manage to properly switch it on/off. */
861861      if (genesis_last_loaded_image_length <= genesis_sram_start)
862862         genesis_sram_active = 1;
863863
864864      memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa130f0, 0xa130f1, 0, 0, genesis_sram_toggle);
865865
866866      /* 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. */
869869      if (genesis_sram_active)
870870         install_sram_rw_handlers (machine);
871871   }
r5932r5933
10951095
10961096   /* Detect carts which need additional handlers */
10971097   {
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 },
10991099         mjlover_sig[]   = { 0x13, 0xf9, 0x00, 0x40, 0x00, 0x00 }, // move.b  ($400000).l,($FFFF0C).l (partial)
11001100         squir_sig[]      = { 0x26, 0x79, 0x00, 0xff, 0x00, 0xfa },
11011101         bugsl_sig[]      = { 0x20, 0x12, 0x13, 0xc0, 0x00, 0xff },
r5932r5933
12261226   /* check if cart has battery save */
12271227
12281228   /* 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
12321232   if (ROM[0x1b1] == 'R' && ROM[0x1b0] == 'A')
12331233   {
12341234      /* SRAM info found in header */
r5932r5933
12391239         genesis_sram_end = genesis_sram_start + 0x0FFFF;
12401240
12411241      /* for some games using serial EEPROM, difference between SRAM
1242      end to start is 0 or 1. Currently EEPROM is not emulated. */
1242        end to start is 0 or 1. Currently EEPROM is not emulated. */
12431243      if ((genesis_sram_end - genesis_sram_start) < 2)
12441244         has_serial_eeprom = 1;
12451245      else
r5932r5933
12621262   megadriv_backupram = (UINT16*) (ROM + (genesis_sram_start & 0x3fffff));
12631263
12641264   /* 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) */
12681268   if (has_serial_eeprom && megadriv_backupram[0] == 0xffff)
12691269      megadriv_backupram[0] = 0xff00;
12701270
src/mess/machine/99_hsgpl.c
r5932r5933
11/*
2   SNUG HSGPL card emulation.
2    SNUG HSGPL card emulation.
33
4   Raphael Nabet, 2003.
4    Raphael Nabet, 2003.
55*/
66
77#include "driver.h"
r5932r5933
1111#include "at29040.h"
1212
1313/*
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).
2020
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
3939
4040
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):
4343
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
6262
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
6767
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
7777
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.
8181*/
8282
8383static struct
r5932r5933
251251}
252252
253253/*
254   Initialize hsgpl card, set up handlers
254    Initialize hsgpl card, set up handlers
255255*/
256256void ti99_hsgpl_init(running_machine *machine)
257257{
r5932r5933
270270}
271271
272272/*
273   Reset hsgpl card
273    Reset hsgpl card
274274*/
275275void ti99_hsgpl_reset(running_machine *machine)
276276{
r5932r5933
287287
288288
289289/*
290   Write hsgpl CRU interface
290    Write hsgpl CRU interface
291291*/
292292static void hsgpl_cru_w(running_machine *machine, int offset, int data)
293293{
r5932r5933
303303}
304304
305305/*
306   read a byte in hsgpl DSR space
306    read a byte in hsgpl DSR space
307307*/
308308static  READ8_HANDLER(hsgpl_dsr_r)
309309{
r5932r5933
313313}
314314
315315/*
316   GPL read
316    GPL read
317317*/
318318READ16_HANDLER ( ti99_hsgpl_gpl_r )
319319{
r5932r5933
341341   }
342342   else
343343   {   /* read GPL data */
344      //reply = (data_ptr ? ((int) data_ptr[hsgpl.addr]) : 0) << 8;   /* read data */
344      //reply = (data_ptr ? ((int) data_ptr[hsgpl.addr]) : 0) << 8;   /* read data */
345345
346346      switch (port)
347347      {
r5932r5933
425425}
426426
427427/*
428   GPL write
428    GPL write
429429*/
430430WRITE16_HANDLER ( ti99_hsgpl_gpl_w )
431431{
r5932r5933
535535}
536536
537537/*
538   Cartridge space read
538    Cartridge space read
539539*/
540540READ16_HANDLER ( ti99_hsgpl_rom6_r )
541541{
r5932r5933
586586}
587587
588588/*
589   Cartridge space write
589    Cartridge space write
590590*/
591591WRITE16_HANDLER ( ti99_hsgpl_rom6_w )
592592{
r5932r5933
605605   }
606606
607607   /* 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 */
610610   if ((hsgpl.cru_reg & cr_wriena) || ((hsgpl.cru_reg & cr_mbxena) && (offset >= 0x0600) && (offset <= 0x07fe)))
611611   {
612612      switch (port)
r5932r5933
636636      case 14:
637637      case 15:
638638         /* feeprom is normally written to using GPL ports, and I don't know
639         writing through >6000 page is enabled */
639            writing through >6000 page is enabled */
640640         /*at29c040a_w(feeprom_rom6, 1 + 2*offset + 0x2000*hsgpl.cur_bank + 0x8000*port, data);
641         at29c040a_w(feeprom_rom6, 2*offset + 0x2000*hsgpl.cur_bank + 0x8000*port, data >> 8);*/
641            at29c040a_w(feeprom_rom6, 2*offset + 0x2000*hsgpl.cur_bank + 0x8000*port, data >> 8);*/
642642         break;
643643
644644      case 32:
src/mess/machine/pc.c
r5932r5933
11/***************************************************************************
22
3   machine/pc.c
3    machine/pc.c
44
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)
77
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
1111
1212***************************************************************************/
1313
r5932r5933
629629   if (pc_ppi.keyboard_clear)
630630   {
631631      /*   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         */
640640      data = input_port_read(device->machine, "DSW0") & 0xF3;
641641      switch ( mess_ram_size )
642642      {
r5932r5933
856856   if (pc_ppi.keyboard_clear)
857857   {
858858      /*   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         */
867867      data = input_port_read(device->machine, "DSW0");
868868   }
869869   else
r5932r5933
884884   data&=~0x80; // no parity error
885885   data&=~0x40; // no error on expansion board
886886   /* KB port C: equipment flags */
887//   if (pc_port[0x61] & 0x08)
887//  if (pc_port[0x61] & 0x08)
888888   if (pc_ppi.portc_switch_high)
889889   {
890890      /* read hi nibble of S2 */
r5932r5933
951951   if (pc_ppi.keyboard_clear)
952952   {
953953      /*   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         */
962962      data = input_port_read(device->machine, "DSW0");
963963   }
964964   else
r5932r5933
12061206      gfx[i] = i;
12071207
12081208   /*
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    */
12121212   if (rom[0xff93e]==0xb6){ // mov dh,
12131213      UINT8 a;
12141214      rom[0xff93e]=0xb5; // mov ch,
r5932r5933
12191219   mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
12201220
12211221   europc_rtc_init(machine);
1222//   europc_rtc_set_time(machine);
1222//  europc_rtc_set_time(machine);
12231223}
12241224
12251225DRIVER_INIT( t1000hx )
src/mess/machine/hd63450.h
r5932r5933
11/*
2   Hitachi HD63450 DMA Controller
2    Hitachi HD63450 DMA Controller
33*/
44
55#include "driver.h"
src/mess/machine/pecom.c
r5932r5933
1111#include "sound/cdp1869.h"
1212#include "devices/cassette.h"
1313#include "includes/pecom.h"
14
14
1515static UINT8 pecom_caps_state = 4;
1616static UINT8 pecom_prev_caps_state = 4;
1717
r5932r5933
3838{
3939   UINT8 *rom = memory_region(machine, "maincpu");
4040   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
41   
41
4242   pecom_state *state = machine->driver_data;
43   
43
4444   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
4545   memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK(2));
4646   memory_install_write8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_UNMAP);
4747   memory_install_write8_handler(space, 0xf800, 0xffff, 0, 0, SMH_UNMAP);
4848   memory_install_read8_handler (space, 0xf000, 0xf7ff, 0, 0, SMH_BANK(3));
4949   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);
5151   memory_set_bankptr(machine, 2, mess_ram + 0x4000);
5252   memory_set_bankptr(machine, 3, rom + 0xf000);
5353   memory_set_bankptr(machine, 4, rom + 0xf800);
54   
54
5555   pecom_caps_state = 4;
5656   pecom_prev_caps_state = 4;
5757
r5932r5933
6767   UINT8 *rom = memory_region(space->machine, "maincpu");
6868   memory_install_write8_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
6969   memory_set_bankptr(space->machine, 1, mess_ram + 0x0000);
70     
71   if (data==2)
70
71   if (data==2)
7272   {
7373      memory_install_read8_device_handler (space2, cdp1869, 0xf000, 0xf7ff, 0, 0, cdp1869_charram_r);
7474      memory_install_write8_device_handler(space2, cdp1869, 0xf000, 0xf7ff, 0, 0, cdp1869_charram_w);
7575      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
7979   {
8080      memory_install_write8_handler(space2, 0xf000, 0xf7ff, 0, 0, SMH_UNMAP);
8181      memory_install_write8_handler(space2, 0xf800, 0xffff, 0, 0, SMH_UNMAP);
r5932r5933
9191   static const char *const keynames[] = {    "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7",
9292                              "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15", "LINE16",
9393                              "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    */
100100   UINT16 addr = cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), CDP1802_R0 + cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), CDP1802_X));
101101   /* 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;
103103   return input_port_read(space->machine, keynames[addr - 0x7cca]) & 0x03;
104104}
105105
r5932r5933
108108{
109109   pecom_state *state = device->machine->driver_data;
110110
111   return state->cdp1802_mode;   
111   return state->cdp1802_mode;
112112}
113113
114114static const device_config *cassette_device_image(running_machine *machine)
r5932r5933
121121   int flags = 0x0f;
122122   double valcas = cassette_input(cassette_device_image(device->machine));
123123   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)
126126   {
127127      pecom_caps_state = (pecom_caps_state==4) ? 0 : 4; // Change CAPS state
128128   }
129129   pecom_prev_caps_state = val & 0x04;
130   if (valcas!=0.0)
130   if (valcas!=0.0)
131131   { // If there is any cassette signal
132132      val = (val & 0x0D); // remove EF2 from SHIFT
133133      flags -= EF2;
134134      if ( valcas > 0.00) flags += EF2;
135   }   
135   }
136136   flags -= (val & 0x0b) + pecom_caps_state;
137137   return flags;
138138}
139139
140140static WRITE_LINE_DEVICE_HANDLER( pecom64_q_w )
141{   
141{
142142   cassette_output(cassette_device_image(device->machine), state ? -1.0 : +1.0);
143143}
144144
r5932r5933
152152
153153   case CDP1802_STATE_CODE_S1_EXECUTE:
154154      break;
155     
155
156156   case CDP1802_STATE_CODE_S2_DMA:
157157      // DMA acknowledge clears the DMAOUT request
158158      cputag_set_input_line(device->machine, "maincpu", CDP1802_INPUT_LINE_DMAOUT, CLEAR_LINE);
src/mess/machine/kb3600.c
r5932r5933
88**********************************************************************/
99
1010/*
11   
12   TODO:
1311
14   - more accurate emulation of real chip
12 TODO:
1513
14    - more accurate emulation of real chip
15
1616*/
1717
1818#include "driver.h"
r5932r5933
105105         }
106106      }
107107   }
108   
108
109109   if (!ako)
110110   {
111111      ay3600->b = -1;
src/mess/machine/pce.c
r5932r5933
9797static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback );
9898
9999
100static WRITE8_HANDLER( pce_sf2_banking_w )
100static WRITE8_HANDLER( pce_sf2_banking_w )
101101{
102102   memory_set_bankptr( space->machine, 2, memory_region(space->machine, "user1") + offset * 0x080000 + 0x080000 );
103103   memory_set_bankptr( space->machine, 3, memory_region(space->machine, "user1") + offset * 0x080000 + 0x088000 );
104104   memory_set_bankptr( space->machine, 4, memory_region(space->machine, "user1") + offset * 0x080000 + 0x0D0000 );
105105}
106106
107static WRITE8_HANDLER( pce_cartridge_ram_w )
107static WRITE8_HANDLER( pce_cartridge_ram_w )
108108{
109109   cartridge_ram[ offset ] = data;
110110}
r5932r5933
196196   memory_set_bankptr( image->machine, 4, ROM + 0x0D0000 );
197197
198198   /* Check for Street fighter 2 */
199   if ( size == PCE_ROM_MAXSIZE )
199   if ( size == PCE_ROM_MAXSIZE )
200200   {
201201      memory_install_write8_handler(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x01ff0, 0x01ff3, 0, 0, pce_sf2_banking_w );
202202   }
203203
204204   /* Check for Populous */
205   if ( ! memcmp( ROM + 0x1F26, "POPULOUS", 8 ) )
205   if ( ! memcmp( ROM + 0x1F26, "POPULOUS", 8 ) )
206206   {
207207      cartridge_ram = auto_alloc_array(image->machine, UINT8, 0x8000 );
208208      memory_set_bankptr( image->machine, 2, cartridge_ram );
r5932r5933
211211
212212   /* Check for CD system card */
213213   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 ) )
215215   {
216216      /* 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 ) )
218218      {
219219         pce_sys3_card = 1;
220220         cartridge_ram = auto_alloc_array(image->machine, UINT8, 0x30000 );
r5932r5933
225225   return 0;
226226}
227227
228DRIVER_INIT( pce )
228DRIVER_INIT( pce )
229229{
230230   pce.io_port_options = PCE_JOY_SIG | CONST_SIG;
231231}
232232
233DRIVER_INIT( tg16 )
233DRIVER_INIT( tg16 )
234234{
235235   pce.io_port_options = TG_16_JOY_SIG | CONST_SIG;
236236}
237237
238DRIVER_INIT( sgx )
238DRIVER_INIT( sgx )
239239{
240240   pce.io_port_options = PCE_JOY_SIG | CONST_SIG;
241241}
242242
243MACHINE_RESET( pce )
243MACHINE_RESET( pce )
244244{
245245   pce_cd_init( machine );
246246}
r5932r5933
291291   }
292292}
293293
294static void pce_set_cd_bram( running_machine *machine )
294static void pce_set_cd_bram( running_machine *machine )
295295{
296296   memory_set_bankptr( machine, 10, pce_cd.bram + ( pce_cd.bram_locked ? PCE_BRAM_SIZE : 0 ) );
297297}
r5932r5933
304304static void pce_cd_msm5205_int(const device_config *device)
305305{
306306   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 )
308308   {
309309      /* Supply new ADPCM data */
310   }
311   else
310   }
311   else
312312   {
313313      /* Make sure the sample does not change */
314314   }
r5932r5933
317317#define   SCSI_STATUS_OK         0x00
318318#define SCSI_CHECK_CONDITION   0x02
319319
320static void pce_cd_reply_status_byte( UINT8 status )
320static void pce_cd_reply_status_byte( UINT8 status )
321321{
322322logerror("Setting CD in reply_status_byte\n");
323323   pce_cd.scsi_CD = pce_cd.scsi_IO = pce_cd.scsi_REQ = 1;
r5932r5933
325325   pce_cd.message_after_status = 1;
326326   pce_cd.status_sent = pce_cd.message_sent = 0;
327327
328   if ( status == SCSI_STATUS_OK )
328   if ( status == SCSI_STATUS_OK )
329329   {
330330      pce_cd.regs[0x01] = 0x00;
331   }
332   else
331   }
332   else
333333   {
334334      pce_cd.regs[0x01] = 0x01;
335335   }
336336}
337337
338338/* 0x00 - TEST UNIT READY */
339static void pce_cd_test_unit_ready( running_machine *machine )
339static void pce_cd_test_unit_ready( running_machine *machine )
340340{
341341   logerror("test unit ready\n");
342   if ( pce_cd.cd )
342   if ( pce_cd.cd )
343343   {
344344      logerror( "Sending STATUS_OK status\n" );
345345      pce_cd_reply_status_byte( SCSI_STATUS_OK );
346   }
347   else
346   }
347   else
348348   {
349349      logerror( "Sending CHECK_CONDITION status\n" );
350350      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
r5932r5933
352352}
353353
354354/* 0x08 - READ (6) */
355static void pce_cd_read_6( running_machine *machine )
355static void pce_cd_read_6( running_machine *machine )
356356{
357357   UINT32 frame = ( ( pce_cd.command_buffer[1] & 0x1F ) << 16 ) | ( pce_cd.command_buffer[2] << 8 ) | pce_cd.command_buffer[3];
358358   UINT32 frame_count = pce_cd.command_buffer[4];
359359
360360   /* Check for presence of a CD */
361   if ( ! pce_cd.cd )
361   if ( ! pce_cd.cd )
362362   {
363363      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
364364      return;
365365   }
366366
367   if ( pce_cd.cdda_status != PCE_CD_CDDA_OFF )
367   if ( pce_cd.cdda_status != PCE_CD_CDDA_OFF )
368368   {
369369      pce_cd.cdda_status = PCE_CD_CDDA_OFF;
370370      cdda_stop_audio( devtag_get_device( machine, "cdda" ) );
r5932r5933
373373   pce_cd.current_frame = frame;
374374   pce_cd.end_frame = frame + frame_count;
375375
376   if ( frame_count == 0 )
376   if ( frame_count == 0 )
377377   {
378378      pce_cd_reply_status_byte( SCSI_STATUS_OK );
379   }
380   else
379   }
380   else
381381   {
382382      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 ));
383383   }
384384}
385385
386386/* 0xD8 - SET AUDIO PLAYBACK START POSITION (NEC) */
387static void pce_cd_nec_set_audio_start_position( running_machine *machine )
387static void pce_cd_nec_set_audio_start_position( running_machine *machine )
388388{
389389   UINT32   frame = 0;
390390
391   if ( ! pce_cd.cd )
391   if ( ! pce_cd.cd )
392392   {
393393      /* Throw some error here */
394394      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
395395      return;
396396   }
397397
398   switch( pce_cd.command_buffer[9] & 0xC0 )
398   switch( pce_cd.command_buffer[9] & 0xC0 )
399399   {
400400   case 0x00:
401401      frame = ( pce_cd.command_buffer[3] << 16 ) | ( pce_cd.command_buffer[4] << 8 ) | pce_cd.command_buffer[5];
r5932r5933
413413
414414   pce_cd.current_frame = frame;
415415   pce_cd.cdda_play_mode = pce_cd.command_buffer[1];
416   if ( pce_cd.cdda_play_mode )
416   if ( pce_cd.cdda_play_mode )
417417   {
418418      pce_cd.cdda_status = PCE_CD_CDDA_PLAYING;
419419      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
422422   {
423423      pce_cd.cdda_status = PCE_CD_CDDA_OFF;
424424      cdda_stop_audio( devtag_get_device( machine, "cdda" ) );
r5932r5933
430430}
431431
432432/* 0xD9 - SET AUDIO PLAYBACK END POSITION (NEC) */
433static void pce_cd_nec_set_audio_stop_position( running_machine *machine )
433static void pce_cd_nec_set_audio_stop_position( running_machine *machine )
434434{
435435   UINT32  frame = 0;
436436
437   if ( ! pce_cd.cd )
437   if ( ! pce_cd.cd )
438438   {
439439      /* Throw some error here */
440440      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
441441      return;
442442   }
443443
444   switch( pce_cd.command_buffer[9] & 0xC0 )
444   switch( pce_cd.command_buffer[9] & 0xC0 )
445445   {
446446   case 0x00:
447447      frame = ( pce_cd.command_buffer[3] << 16 ) | ( pce_cd.command_buffer[4] << 8 ) | pce_cd.command_buffer[5];
r5932r5933
459459
460460   pce_cd.end_frame = frame;
461461   pce_cd.cdda_play_mode = pce_cd.command_buffer[1];
462   if ( pce_cd.cdda_play_mode )
462   if ( pce_cd.cdda_play_mode )
463463   {
464      if ( pce_cd.cdda_status == PCE_CD_CDDA_PAUSED )
464      if ( pce_cd.cdda_status == PCE_CD_CDDA_PAUSED )
465465      {
466466         cdda_pause_audio( devtag_get_device( machine, "cdda" ), 0 );
467      }
468      else
467      }
468      else
469469      {
470470         cdda_start_audio( devtag_get_device( machine, "cdda" ), pce_cd.current_frame, pce_cd.end_frame - pce_cd.current_frame );
471471      }
472472      pce_cd.cdda_status = PCE_CD_CDDA_PLAYING;
473   }
474   else
473   }
474   else
475475   {
476476      pce_cd.cdda_status = PCE_CD_CDDA_OFF;
477477      cdda_stop_audio( devtag_get_device( machine, "cdda" ) );
r5932r5933
484484}
485485
486486/* 0xDA - PAUSE (NEC) */
487static void pce_cd_nec_pause( running_machine *machine )
487static void pce_cd_nec_pause( running_machine *machine )
488488{
489489
490490   /* If no cd mounted throw an error */
491   if ( ! pce_cd.cd )
491   if ( ! pce_cd.cd )
492492   {
493493      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
494494      return;
495495   }
496496
497497   /* 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 )
499499   {
500500      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
501501      return;
r5932r5933
508508}
509509
510510/* 0xDD - READ SUBCHANNEL Q (NEC) */
511static void pce_cd_nec_get_subq( running_machine *machine )
511static void pce_cd_nec_get_subq( running_machine *machine )
512512{
513513   /* WP - I do not have access to chds with subchannel information yet, so I'm faking something here */
514514   UINT32 msf_abs, msf_rel, track, frame;
515515
516   if ( ! pce_cd.cd )
516   if ( ! pce_cd.cd )
517517   {
518518      /* Throw some error here */
519519      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
r5932r5933
522522
523523   frame = pce_cd.current_frame;
524524
525   switch( pce_cd.cdda_status )
525   switch( pce_cd.cdda_status )
526526   {
527527   case PCE_CD_CDDA_PAUSED:
528528      pce_cd.data_buffer[0] = 2;
r5932r5933
559559}
560560
561561/* 0xDE - GET DIR INFO (NEC) */
562static void pce_cd_nec_get_dir_info( running_machine *machine )
562static void pce_cd_nec_get_dir_info( running_machine *machine )
563563{
564564   UINT32 frame, msf, track = 0;
565565   const cdrom_toc   *toc;
566566   logerror("nec get dir info\n");
567567
568   if ( ! pce_cd.cd )
568   if ( ! pce_cd.cd )
569569   {
570570      /* Throw some error here */
571571      pce_cd_reply_status_byte( SCSI_CHECK_CONDITION );
r5932r5933
573573
574574   toc = cdrom_get_toc( pce_cd.cd );
575575
576   switch( pce_cd.command_buffer[1] )
576   switch( pce_cd.command_buffer[1] )
577577   {
578578   case 0x00:      /* Get first and last track numbers */
579579      pce_cd.data_buffer[0] = dec_2_bcd(1);
r5932r5933
591591      pce_cd.data_buffer_size = 3;
592592      break;
593593   case 0x02:      /* Get track information */
594      if ( pce_cd.command_buffer[2] == 0xAA )
594      if ( pce_cd.command_buffer[2] == 0xAA )
595595      {
596596         frame = toc->tracks[toc->numtrks-1].physframeofs;
597597         frame += toc->tracks[toc->numtrks-1].frames;
598598         pce_cd.data_buffer[3] = 0x04;   /* correct? */
599      } else
599      } else
600600      {
601601         track = MAX( bcd_2_dec( pce_cd.command_buffer[2] ), 1 );
602602         frame = toc->tracks[track-1].physframeofs;
r5932r5933
620620   pce_cd.scsi_CD = 0;
621621}
622622
623static void pce_cd_handle_data_output( running_machine *machine )
623static void pce_cd_handle_data_output( running_machine *machine )
624624{
625625   static const struct {
626626      UINT8   command_byte;
r5932r5933
637637      { 0xFF, 0, NULL }                           /* end of list marker */
638638   };
639639
640   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
640   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
641641   {
642642      /* Command byte received */
643643      logerror( "Command byte $%02X received\n", pce_cd.regs[0x01] );
r5932r5933
650650      pce_cd.scsi_REQ = 0;
651651   }
652652
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 )
654654   {
655655      int i = 0;
656656
r5932r5933
659659      for( i = 0; pce_cd.command_buffer[0] > pce_cd_commands[i].command_byte; i++ );
660660
661661      /* 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 )
663663      {
664664         logerror("Unrecognized command: %02X\n", pce_cd.command_buffer[0] );
665665      }
666666      assert( pce_cd.command_buffer[0] == pce_cd_commands[i].command_byte );
667667
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 )
669669      {
670670         (pce_cd_commands[i].command_handler)( machine );
671671         pce_cd.command_buffer_index = 0;
672      }
673      else
672      }
673      else
674674      {
675675         pce_cd.scsi_REQ = 1;
676676      }
677677   }
678678}
679679
680static void pce_cd_handle_data_input( running_machine *machine )
680static void pce_cd_handle_data_input( running_machine *machine )
681681{
682   if ( pce_cd.scsi_CD )
682   if ( pce_cd.scsi_CD )
683683   {
684684      /* Command / Status byte */
685      if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
685      if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
686686      {
687687         logerror( "status sent\n" );
688688         pce_cd.scsi_REQ = 0;
689689         pce_cd.status_sent = 1;
690690      }
691691
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 )
693693      {
694694         pce_cd.status_sent = 0;
695         if ( pce_cd.message_after_status )
695         if ( pce_cd.message_after_status )
696696         {
697697            logerror( "message after status\n" );
698698            pce_cd.message_after_status = 0;
r5932r5933
700700            pce_cd.regs[0x01] = 0;
701701         }
702702      }
703   }
704   else
703   }
704   else
705705   {
706706      /* Data */
707      if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
707      if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
708708      {
709709         pce_cd.scsi_REQ = 0;
710710      }
711711
712      if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK )
712      if ( ! pce_cd.scsi_REQ && ! pce_cd.scsi_ACK )
713713      {
714         if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size )
714         if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size )
715715         {
716716            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 )
718718            {
719719               pce_cd.data_transferred = 0;
720720               pce_cd_reply_status_byte( SCSI_STATUS_OK );
721721               pce_cd_set_irq_line( machine, PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE );
722722            }
723         }
724         else
723         }
724         else
725725         {
726726            logerror("Transfer byte from offset %d\n", pce_cd.data_buffer_index);
727727            pce_cd.regs[0x01] = pce_cd.data_buffer[pce_cd.data_buffer_index];
r5932r5933
732732   }
733733}
734734
735static void pce_cd_handle_message_output( void )
735static void pce_cd_handle_message_output( void )
736736{
737   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
737   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
738738   {
739739      pce_cd.scsi_REQ = 0;
740740   }
741741}
742742
743static void pce_cd_handle_message_input( void )
743static void pce_cd_handle_message_input( void )
744744{
745   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
745   if ( pce_cd.scsi_REQ && pce_cd.scsi_ACK )
746746   {
747747      pce_cd.scsi_REQ = 0;
748748      pce_cd.message_sent = 1;
749749   }
750750
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 )
752752   {
753753      pce_cd.message_sent = 0;
754754      pce_cd.scsi_BSY = 0;
r5932r5933
756756}
757757
758758/* Update internal CD statuses */
759static void pce_cd_update( running_machine *machine )
759static void pce_cd_update( running_machine *machine )
760760{
761761   /* 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 )
763763   {
764      if ( pce_cd.scsi_RST )
764      if ( pce_cd.scsi_RST )
765765      {
766766         logerror("Performing CD reset\n");
767767         /* Reset internal data */
r5932r5933
774774   }
775775
776776   /* 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 )
778778   {
779779      logerror( "freeing bus\n" );
780780      pce_cd.selected = 0;
r5932r5933
783783   }
784784
785785   /* Select the CD device */
786   if ( pce_cd.scsi_SEL )
786   if ( pce_cd.scsi_SEL )
787787   {
788      if ( ! pce_cd.selected )
788      if ( ! pce_cd.selected )
789789      {
790790         pce_cd.selected = 1;
791791logerror("Setting CD in device selection\n");
r5932r5933
794794      }
795795   }
796796
797   if ( pce_cd.scsi_ATN )
797   if ( pce_cd.scsi_ATN )
798798   {
799   }
800   else
799   }
800   else
801801   {
802802      /* Check for data and pessage phases */
803      if ( pce_cd.scsi_BSY )
803      if ( pce_cd.scsi_BSY )
804804      {
805         if ( pce_cd.scsi_MSG )
805         if ( pce_cd.scsi_MSG )
806806         {
807807            /* message phase */
808            if ( pce_cd.scsi_IO )
808            if ( pce_cd.scsi_IO )
809809            {
810810               pce_cd_handle_message_input();
811            }
812            else
811            }
812            else
813813            {
814814               pce_cd_handle_message_output();
815815            }
816         }
817         else
816         }
817         else
818818         {
819819            /* data phase */
820            if ( pce_cd.scsi_IO )
820            if ( pce_cd.scsi_IO )
821821            {
822822               /* Reading data from target */
823823               pce_cd_handle_data_input( machine );
824            }
825            else
824            }
825            else
826826            {
827827               /* Sending data to target */
828828               pce_cd_handle_data_output( machine );
r5932r5933
832832   }
833833}
834834
835static void pce_cd_set_irq_line( running_machine *machine, int num, int state )
835static void pce_cd_set_irq_line( running_machine *machine, int num, int state )
836836{
837   switch( num )
837   switch( num )
838838   {
839839   case PCE_CD_IRQ_TRANSFER_DONE:
840      if ( state == ASSERT_LINE )
840      if ( state == ASSERT_LINE )
841841      {
842842         pce_cd.regs[0x03] |= PCE_CD_IRQ_TRANSFER_DONE;
843      }
844      else
843      }
844      else
845845      {
846846         pce_cd.regs[0x03] &= ~ PCE_CD_IRQ_TRANSFER_DONE;
847847      }
848848      break;
849849   case PCE_CD_IRQ_TRANSFER_READY:
850      if ( state == ASSERT_LINE )
850      if ( state == ASSERT_LINE )
851851      {
852852         pce_cd.regs[0x03] |= PCE_CD_IRQ_TRANSFER_READY;
853      }
854      else
853      }
854      else
855855      {
856856         pce_cd.regs[0x03] &= ~ PCE_CD_IRQ_TRANSFER_READY;
857857      }
r5932r5933
860860      break;
861861   }
862862
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 ) )
864864   {
865865      cputag_set_input_line(machine, "maincpu", 1, ASSERT_LINE );
866   }
867   else
866   }
867   else
868868   {
869869      cputag_set_input_line(machine, "maincpu", 1, CLEAR_LINE );
870870   }
871871}
872872
873static TIMER_CALLBACK( pce_cd_data_timer_callback )
873static TIMER_CALLBACK( pce_cd_data_timer_callback )
874874{
875   if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size )
875   if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size )
876876   {
877877      /* Read next data sector */
878878      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 ) )
880880      {
881881         logerror("Mode1 CD read failed for frame #%d\n", pce_cd.current_frame );
882      }
883      else
882      }
883      else
884884      {
885885         logerror("Succesfully read mode1 frame #%d\n", pce_cd.current_frame );
886886      }
r5932r5933
892892      pce_cd.scsi_IO = 1;
893893      pce_cd.scsi_CD = 0;
894894
895      if ( pce_cd.current_frame == pce_cd.end_frame )
895      if ( pce_cd.current_frame == pce_cd.end_frame )
896896      {
897897         /* We are done, disable the timer */
898898         logerror("Last frame read from CD\n");
899899         pce_cd.data_transferred = 1;
900900         timer_adjust_oneshot(pce_cd.data_timer, attotime_never, 0);
901      }
902      else
901      }
902      else
903903      {
904904         pce_cd.data_transferred = 0;
905905      }
906906   }
907907}
908908
909static void pce_cd_init( running_machine *machine )
909static void pce_cd_init( running_machine *machine )
910910{
911911   const device_config *device;
912912
r5932r5933
957957   timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0);
958958}
959959
960WRITE8_HANDLER( pce_cd_bram_w )
960WRITE8_HANDLER( pce_cd_bram_w )
961961{
962   if ( ! pce_cd.bram_locked )
962   if ( ! pce_cd.bram_locked )
963963   {
964964      pce_cd.bram[ offset ] = data;
965965   }
966966}
967967
968WRITE8_HANDLER( pce_cd_intf_w )
968WRITE8_HANDLER( pce_cd_intf_w )
969969{
970970   logerror("%04X: write to CD interface offset %02X, data %02X\n", cpu_get_pc(space->cpu), offset, data );
971971   pce_cd_update(space->machine);
972972
973   switch( offset )
973   switch( offset )
974974   {
975975   case 0x00:   /* CDC status */
976976      /* select device (which bits??) */
r5932r5933
999999   case 0x06:   /* PCM data */
10001000      break;
10011001   case 0x07:   /* BRAM unlock / CD status */
1002      if ( data & 0x80 )
1002      if ( data & 0x80 )
10031003      {
10041004         pce_cd.bram_locked = 0;
10051005         pce_set_cd_bram(space->machine);
r5932r5933
10111011   case 0x0A:   /* ADPCM RAM data port */
10121012      break;
10131013   case 0x0B:   /* ADPCM DMA control */
1014      if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) )
1014      if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) )
10151015      {
10161016         /* Start CD to ADPCM transfer */
10171017         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 ) );
10181018      }
1019      if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) )
1019      if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) )
10201020      {
10211021         /* Stop CD to ADPCM transfer (?) */
10221022         timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0);
r5932r5933
10251025   case 0x0C:   /* ADPCM status */
10261026      break;
10271027   case 0x0D:   /* ADPCM address control */
1028      if ( ( pce_cd.regs[0x0D] & 0x80 ) && ! ( data & 0x80 ) )
1028      if ( ( pce_cd.regs[0x0D] & 0x80 ) && ! ( data & 0x80 ) )
10291029      {
10301030         /* Reset ADPCM hardware */
10311031         pce_cd.adpcm_read_ptr = 0;
10321032         pce_cd.adpcm_write_ptr = 0;
10331033         msm5205_reset_w( devtag_get_device( space->machine, "msm5205"), 0 );
10341034      }
1035      if ( data & 0x10 )
1035      if ( data & 0x10 )
10361036      {
10371037         pce_cd.adpcm_length = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08];
10381038      }
1039      if ( data & 0x08 )
1039      if ( data & 0x08 )
10401040      {
10411041         pce_cd.adpcm_read_ptr = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08];
10421042      }
1043      if ( ( data & 0x03 ) == 0x03 )
1043      if ( ( data & 0x03 ) == 0x03 )
10441044      {
10451045         pce_cd.adpcm_write_ptr = ( pce_cd.regs[0x09] << 8 ) | pce_cd.regs[0x08];
10461046      }
r5932r5933
10581058   pce_cd_update(space->machine);
10591059}
10601060
1061static TIMER_CALLBACK( pce_cd_clear_ack )
1061static TIMER_CALLBACK( pce_cd_clear_ack )
10621062{
10631063   pce_cd_update(machine);
10641064   pce_cd.scsi_ACK = 0;
10651065   pce_cd_update(machine);
1066   if ( pce_cd.scsi_CD )
1066   if ( pce_cd.scsi_CD )
10671067   {
10681068      pce_cd.regs[0x0B] &= 0xFE;
10691069   }
10701070}
10711071
1072static UINT8 pce_cd_get_cd_data_byte(running_machine *machine)
1072static UINT8 pce_cd_get_cd_data_byte(running_machine *machine)
10731073{
10741074   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 )
10761076   {
1077      if ( pce_cd.scsi_IO )
1077      if ( pce_cd.scsi_IO )
10781078      {
10791079         pce_cd.scsi_ACK = 1;
10801080         timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 15), NULL, 0, pce_cd_clear_ack );
r5932r5933
10841084}
10851085
10861086
1087static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback )
1087static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback )
10881088{
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   {
10911091      pce_cd.adpcm_ram[pce_cd.adpcm_write_ptr] = pce_cd_get_cd_data_byte(machine);
10921092      pce_cd.adpcm_write_ptr = ( pce_cd.adpcm_write_ptr + 1 ) & 0xFFFF;
10931093   }
10941094}
10951095
1096READ8_HANDLER( pce_cd_intf_r )
1096READ8_HANDLER( pce_cd_intf_r )
10971097{
10981098   UINT8 data = pce_cd.regs[offset & 0x0F];
10991099
11001100   pce_cd_update(space->machine);
11011101
11021102   logerror("%04X: read from CD interface offset %02X\n", cpu_get_pc(space->cpu), offset );
1103   switch( offset )
1103   switch( offset )
11041104   {
11051105   case 0x00:   /* CDC status */
11061106      data &= 0x07;
src/mess/machine/smc92x4.c
r5932r5933
11/*
2   SMC9224 and SMC9234 Hard and Floppy Disk Controller (HFDC)
2    SMC9224 and SMC9234 Hard and Floppy Disk Controller (HFDC)
33
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.
99
10   References:
11   * SMC HDC9234 preliminary data book (1988)
10    References:
11    * SMC HDC9234 preliminary data book (1988)
1212
13   Raphael Nabet, 2003
13    Raphael Nabet, 2003
1414*/
1515
1616#include "driver.h"
r5932r5933
2222#define MAX_SECTOR_LEN 2048   /* ??? */
2323
2424/*
25   hfdc state structure
25    hfdc state structure
2626*/
2727typedef struct hfdc_t
2828{
2929   UINT8 status;      /* command status register */
3030   UINT8 disk_sel;      /* disk selection state */
3131   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??? */
3535   int reg_ptr;
3636   int (*select_callback)(int which, select_mode_t select_mode, int select_line, int gpos);
3737   UINT8 (*dma_read_callback)(int which, offs_t offset);
r5932r5933
6565};
6666
6767/*
68   Definition of bits in the status register
68    Definition of bits in the status register
6969*/
7070#define ST_INTPEND   (1<<7)      /* interrupt pending */
7171#define ST_DMAREQ   (1<<6)      /* DMA request */
r5932r5933
7676#define ST_BADSECT   (1<<0)      /* bad sector */
7777
7878/*
79   Definition of the termination codes
79    Definition of the termination codes
8080*/
8181#define ST_TC_SUCCESS   (0<<3)   /* Successful completion */
8282#define ST_TC_RDIDERR   (1<<3)   /* Error in READ-ID sequence */
r5932r5933
8585
8686
8787/*
88   Definition of bits in the Termination-Conditions register
88    Definition of bits in the Termination-Conditions register
8989*/
9090#define TC_CRCPRE   (1<<7)      /* CRC register preset, must be 1 */
9191#define TC_UNUSED   (1<<6)      /* bit 6 is not used and must be 0 */
r5932r5933
9797#define TC_TWRFLT   (1<<0)      /* interrupt on write-fault (HDD only) */
9898
9999/*
100   Definition of bits in the Chip-Status register
100    Definition of bits in the Chip-Status register
101101*/
102102#define CS_RETREQ   (1<<7)      /* retry required */
103103#define CS_ECCATT   (1<<6)      /* ECC correction attempted */
r5932r5933
108108#define CS_PRESDRV   (3<<0)      /* present drive selected */
109109
110110/*
111   Definition of bits in the Disk-Status register
111    Definition of bits in the Disk-Status register
112112*/
113113#define DS_SELACK   (1<<7)      /* select acknowledge (harddisk only!) */
114114#define DS_INDEX   (1<<6)      /* index point */
r5932r5933
122122static hfdc_t hfdc[MAX_HFDC];
123123
124124/*
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)
127127
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
131131*/
132132static int floppy_read_id(running_machine *machine,int which, int disk_unit, int head)
133133{
r5932r5933
156156}
157157
158158/*
159   Perform the verify sequence for a floppy disk
159    Perform the verify sequence for a floppy disk
160160
161   which: udc controller index
162   disk_unit: floppy drive index
161    which: udc controller index
162    disk_unit: floppy drive index
163163*/
164164static 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)
165165{
r5932r5933
355355   hfdc[which].regs[hfdc_reg_cur_head] = ((hd[disk_unit].current_cylinder >> 4) & 0x70) | head;
356356   hfdc[which].regs[hfdc_reg_read_6] = 0xfe;   /* ident byte */
357357   /*if ()
358      hfdc[which].regs[hfdc_reg_chip_stat] |= CS_DELDATA;*/
358        hfdc[which].regs[hfdc_reg_chip_stat] |= CS_DELDATA;*/
359359
360360   return TRUE;
361361}
r5932r5933
463463   {
464464      reply |= DS_SELACK;
465465      /*if ()
466         reply |= DS_INDEX;*/
466            reply |= DS_INDEX;*/
467467      reply |= DS_SKCOM;
468468      if (hd[disk_unit].current_cylinder == 0)
469469         reply |= DS_TRK00;
r5932r5933
472472      if (hd[disk_unit].hd_handle)
473473         reply |= DS_READY;
474474      /*if ()
475         reply |= DS_WRFAULT;*/
475            reply |= DS_WRFAULT;*/
476476   }
477477
478478   return reply;
r5932r5933
481481
482482
483483/*
484   Initialize the controller
484    Initialize the controller
485485*/
486486void smc92x4_init(int which, const smc92x4_intf *intf)
487487{
r5932r5933
495495}
496496
497497/*
498   Reset the controller
498    Reset the controller
499499*/
500500void smc92x4_reset(int which)
501501{
r5932r5933
510510}
511511
512512/*
513   Change the state of IRQ
513    Change the state of IRQ
514514*/
515515static void smc92x4_set_interrupt(int which, int state)
516516{
r5932r5933
527527}
528528
529529/*
530   Select currently selected drive
530    Select currently selected drive
531531*/
532532static int get_selected_drive(int which, select_mode_t *select_mode, int *disk_unit)
533533{
r5932r5933
560560}
561561
562562/*
563   Assert Command Done status bit, triggering interrupts as needed
563    Assert Command Done status bit, triggering interrupts as needed
564564*/
565565INLINE void set_command_done(int which)
566566{
r5932r5933
594594}
595595
596596/*
597   Perform the read_id phase on a drive
597    Perform the read_id phase on a drive
598598*/
599599INLINE int read_id(running_machine *machine,int which, select_mode_t select_mode, int disk_unit, int head,
600600               int do_implied_seek, int desired_cylinder)
r5932r5933
675675}
676676
677677/*
678   Get the status of a drive
678    Get the status of a drive
679679*/
680680INLINE UINT8 get_disk_status(running_machine *machine,int which, select_mode_t select_mode, int disk_unit)
681681{
r5932r5933
707707}
708708
709709/*
710   Handle the step command
710    Handle the step command
711711*/
712712static void do_step(running_machine *machine,int which, int mode)
713713{
r5932r5933
738738}
739739
740740/*
741   Handle the restore command
741    Handle the restore command
742742*/
743743static void do_restore(running_machine *machine,int which, int mode)
744744{
r5932r5933
755755   {
756756      /* no unit has been selected */
757757      /* the drive status will be 0, therefore the SEEK_COMPLETE bit will be
758      cleared, which is what we want */
758        cleared, which is what we want */
759759      goto cleanup;
760760   }
761761
r5932r5933
790790}
791791
792792/*
793   Handle the read command
793    Handle the read command
794794
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)
798798*/
799799static void do_read(running_machine *machine,int which, int physical_flag, int mode)
800800{
r5932r5933
835835
836836#if 0
837837   /* if we enable write-protect test in read operations, the ti99 HFDC DSR is
838   unable to read write-protected floppies! */
838    unable to read write-protected floppies! */
839839   if ((hfdc[which].regs[hfdc_reg_term] & TC_TWPROT)
840840         && (get_disk_status(machine,which, select_mode, disk_unit) & DS_WRPROT))
841841   {
r5932r5933
902902}
903903
904904/*
905   Handle the write command
905    Handle the write command
906906
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)
910910*/
911911static void do_write(running_machine *machine,int which, int physical_flag, int mode)
912912{
r5932r5933
10111011}
10121012
10131013/*
1014   Process a command
1014    Process a command
10151015*/
10161016static void smc92x4_process_command(running_machine *machine,int which, int opcode)
10171017{
r5932r5933
10411041            case 0x03:
10421042               /* RESTORE DRIVE */
10431043               /* bit 0: 0 -> command ends after last seek pulse, 1 -> command
1044                  ends when the drive asserts the seek complete pin */
1044                        ends when the drive asserts the seek complete pin */
10451045               logerror("smc92x4 restore command %X\n", opcode & 0x01);
10461046               do_restore(machine,which, opcode & 0x01);
10471047               break;
r5932r5933
10521052            /* STEP IN/OUT ONE CYLINDER */
10531053            /* bit 1: direction (0 -> inward, 1 -> outward i.e. toward cyl #0) */
10541054            /* bit 0: 0 -> command ends after last seek pulse, 1 -> command
1055               ends when the drive asserts the seek complete pin */
1055                    ends when the drive asserts the seek complete pin */
10561056            logerror("smc92x4 step command %X\n", opcode & 0x3);
10571057            do_step(machine,which, opcode & 0x03);
10581058         }
r5932r5933
10721072         /* DRSELECT */
10731073         /* bit 4: if 1, apply head load delay */
10741074         /* 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 */
10771077         /* bit 1 & 0: unit number (0-3)*/
10781078         logerror("smc92x4 drselect command %X\n", opcode & 0xf);
10791079         hfdc[which].disk_sel = opcode & 0xf;
r5932r5933
10991099         {
11001100            /* READ */
11011101            /* 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 */
11041104            /* bit 0: 0 -> do not transfer data (transfer ID fields for
1105               read track command), 1 -> transfer data */
1105                    read track command), 1 -> transfer data */
11061106            switch ((opcode >> 1) & 0x3)
11071107            {
11081108            case 0:
r5932r5933
11241124      case 0x7:
11251125         /* FORMAT TRACK */
11261126         /* bit 4: 0 -> write deleted data mark instead of normal address
1127            mark */
1127                mark */
11281128         /* bit 3: 1 -> write with reduced current */
11291129         /* bit 2-0: write precompensation value */
11301130         logerror("smc92x4 formattrack command %X\n", opcode & 0xf);
r5932r5933
11631163}
11641164
11651165/*
1166   Memory accessors
1166    Memory accessors
11671167*/
11681168
11691169/*
1170   Read a byte of data from a smc99x4 controller
1170    Read a byte of data from a smc99x4 controller
11711171*/
11721172int smc92x4_r(running_machine *machine,int which, int offset)
11731173{
r5932r5933
12061206}
12071207
12081208/*
1209   Write a byte to a smc99x4 controller
1209    Write a byte to a smc99x4 controller
12101210*/
12111211void smc92x4_w(running_machine *machine,int which, int offset, int data)
12121212{
src/mess/machine/ti99_4x.c
r5932r5933
11/*
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.
55
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.
3030
3131Emulated:
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
4141
42   Compatibility looks quite good.
42    Compatibility looks quite good.
4343
4444Issues:
45   * floppy disk timings are not emulated (general issue)
45    * floppy disk timings are not emulated (general issue)
4646
4747TODO:
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)
5151*/
5252
5353#include <math.h>
r5932r5933
9090static void ti99_evpc_reset(running_machine *machine);
9191
9292/*
93   pointer to extended RAM area
93    pointer to extended RAM area
9494*/
9595static UINT16 *xRAM_ptr;
9696
9797/*
98   Configuration
98    Configuration
9999*/
100100/* model of ti99 in emulation */
101101static enum
r5932r5933
150150static int AlphaLockLine;
151151
152152/*
153   GROM support.
153    GROM support.
154154
155155In short:
156156
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.
162162
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.
167167
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.
175175
176176The simple way:
177177
178   Each GROM is logically 8kb long.
178    Each GROM is logically 8kb long.
179179
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).
184184
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...)
187187
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).
190190
191191Some details:
192192
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...)
198198
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.
201201
202202GPL ports:
203203
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.
211211
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.
223223
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.
227227
228   The handling of cartridge GROMs has moved to ti99cart.c.   
228    The handling of cartridge GROMs has moved to ti99cart.c.
229229*/
230230
231231/* descriptor for console GROMs */
r5932r5933
265265
266266/*===========================================================================*/
267267/*
268   General purpose code:
269   initialization, cart loading, etc.
268    General purpose code:
269    initialization, cart loading, etc.
270270*/
271271
272272static void create_grom_high2k(int first, int last)
r5932r5933
331331   UINT8 *mem = memory_region(machine, "maincpu");
332332   ti99_model = model_99_8;
333333   has_evpc = FALSE;
334   
334
335335   /* set up memory pointers */
336336   xRAM_ptr_8 = mem + offset_xram_8;
337337   ROM0_ptr_8 = mem + offset_rom0_8;
r5932r5933
342342
343343   /* Pull this one up here. */
344344   ti99_8_enable_rom_and_ports = 1;
345   
345
346346   console_GROMs.data_ptr = memory_region(machine, region_grom);
347347   create_grom_high2k(0x0000, 0x5fff);
348348
r5932r5933
419419    ti99_common_init(machine, 0);
420420}
421421
422void ti99_common_init(running_machine *machine, const TMS9928a_interface *gfxparm)
422void ti99_common_init(running_machine *machine, const TMS9928a_interface *gfxparm)
423423{
424424   if (gfxparm != 0)
425425      TMS9928A_configure(gfxparm);
r5932r5933
432432   ti99_ide_init(machine);
433433   ti99_hsgpl_init(machine);
434434   ti99_usbsm_init(machine);
435   
435
436436   /* Find the cartslot device and cache it. This is a string search,
437      and we don't want to repeat it on each memory access. */
437       and we don't want to repeat it on each memory access. */
438438   cartslots = devtag_get_device(machine, "ti99_multicart");
439439   assert(cartslots != NULL);
440440}
441441
442442
443443/*
444   ti99_init_machine(); called before ti99_load_rom...
444    ti99_init_machine(); called before ti99_load_rom...
445445*/
446446MACHINE_RESET( ti99 )
447447{
r5932r5933
470470      memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + offset_sram);
471471   }
472472
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    } */
480480
481481   if (!has_evpc) TMS9928A_reset();
482482        else v9938_reset(0);
r5932r5933
510510   has_hsgpl = ((ti99_model == model_99_4p) || (input_port_read(machine, "CFG") >> config_hsgpl_bit) & config_hsgpl_mask);
511511   has_usb_sm = (input_port_read(machine, "CFG") >> config_usbsm_bit) & config_usbsm_mask;
512512   has_pcode = (input_port_read(machine, "CFG") >> config_pcode_bit) & config_pcode_mask;
513   
513
514514   /* set up optional expansion hardware */
515515   ti99_peb_reset(ti99_model == model_99_4p, tms9901_set_int1, NULL);
516516
r5932r5933
520520   if (ti99_model == model_99_4p)
521521      ti99_4p_internal_dsr_reset(machine);
522522
523        if (has_speech)
523        if (has_speech)
524524   {
525525      static const spchroms_interface speech_intf = { region_speech_rom };
526526
r5932r5933
635635
636636
637637/*
638   video initialization.
638    video initialization.
639639*/
640640VIDEO_START( ti99_4ev )
641641{
r5932r5933
644644}
645645
646646/*
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 ?)
649649*/
650650INTERRUPT_GEN( ti99_vblank_interrupt )
651651{
r5932r5933
671671}
672672
673673/*
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
676676*/
677677void set_hsgpl_crdena(int data)
678678{
r5932r5933
685685#pragma mark MEMORY HANDLERS
686686#endif
687687/*
688   Memory handlers.
688    Memory handlers.
689689
690   TODO:
691   * actually implement GRAM support and GPL port support
690    TODO:
691    * actually implement GRAM support and GPL port support
692692*/
693693
694694/*
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.
697697*/
698698READ16_HANDLER ( ti99_nop_8_r )
699699{
700700   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
701//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
701//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
702702
703703   return (0);
704704}
r5932r5933
706706WRITE16_HANDLER ( ti99_nop_8_w )
707707{
708708   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
709//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
709//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
710710}
711711
712712/*
713   99/4p cartridge space: mapped either to internal ROM6 or to HSGPL.
713    99/4p cartridge space: mapped either to internal ROM6 or to HSGPL.
714714*/
715715READ16_HANDLER ( ti99_4p_cart_r )
716716{
r5932r5933
718718      return ti99_4p_internal_ROM6[offset];
719719
720720   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
721//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
721//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
722722
723723   if (hsgpl_crdena)
724724      /* hsgpl is enabled */
r5932r5933
736736   }
737737
738738   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
739//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
739//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
740740
741741   if (hsgpl_crdena)
742742      /* hsgpl is enabled */
r5932r5933
745745
746746/*---------------------------------------------------------------------------*/
747747/*
748   memory-mapped register handlers.
748    memory-mapped register handlers.
749749
750750Theory:
751751
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.)
759759
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)
772772
773773(1) on some hardware, (addr & 0x3FC) provides a GPL page number.
774774*/
775775
776776/*
777   TMS9919 sound chip write
777    TMS9919 sound chip write
778778*/
779779WRITE16_HANDLER ( ti99_wsnd_w )
780780{
781781   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
782//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
782//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
783783
784784   sn76496_w(devtag_get_device(space->machine, "sn76496"), offset, (data >> 8) & 0xff);
785785}
786786
787787/*
788   TMS9918(A)/9928(A)/9929(A) VDP read
788    TMS9918(A)/9928(A)/9929(A) VDP read
789789*/
790790READ16_HANDLER ( ti99_rvdp_r )
791791{
792792   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
793//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
793//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
794794
795795   if (offset & 1)
796796   {   /* read VDP status */
r5932r5933
803803}
804804
805805/*
806   TMS9918(A)/9928(A)/9929(A) vdp write
806    TMS9918(A)/9928(A)/9929(A) vdp write
807807*/
808808WRITE16_HANDLER ( ti99_wvdp_w )
809809{
810810   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
811//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
811//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
812812
813813   if (offset & 1)
814814   {   /* write VDP address */
r5932r5933
821821}
822822
823823/*
824   V38 VDP read
824    V38 VDP read
825825*/
826826READ16_HANDLER ( ti99_rv38_r )
827827{
828828   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
829//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
829//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
830830
831831   if (offset & 1)
832832   {   /* read VDP status */
r5932r5933
839839}
840840
841841/*
842   V38 vdp write
842    V38 vdp write
843843*/
844844WRITE16_HANDLER ( ti99_wv38_w )
845845{
846846   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
847//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
847//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
848848
849849   switch (offset & 3)
850850   {
r5932r5933
868868}
869869
870870/*
871   TMS0285 speech chip read
871    TMS0285 speech chip read
872872*/
873873static READ16_HANDLER ( ti99_rspeech_r )
874874{
r5932r5933
884884   if (! tms5220_readyq_r())
885885   {
886886      /* Weirdly enough, we are always seeing some problems even though
887      everything is working fine. */
887        everything is working fine. */
888888      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready());
889889      logerror("ti99/4a speech says aaargh!\n");
890890      logerror("(time to ready: %f -> %d)\n", time_to_ready, (int) ceil(3000000*time_to_ready));
r5932r5933
894894#endif
895895
896896/*
897   TMS0285 speech chip write
897    TMS0285 speech chip write
898898*/
899899static WRITE16_HANDLER ( ti99_wspeech_w )
900900{
r5932r5933
902902
903903#if 1
904904   /* 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. */
908908   if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
909909   {
910910      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
r5932r5933
925925   UINT8 reply;
926926   if (console_GROMs.addr >= 0x6000)
927927   {
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. */
930930      reply = cartridge_grom_read(cartslots, console_GROMs.addr-0x6000);
931931   }
932   else
932   else
933933   {
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. */
937937      reply = console_GROMs.buf;
938     
938
939939      /* Get next value, put it in buffer. Note that the
940      GROM wraps at 8K boundaries. */
940        GROM wraps at 8K boundaries. */
941941      console_GROMs.buf = console_GROMs.data_ptr[console_GROMs.addr];
942942   }
943943
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. */
947947   console_GROMs.addr = ((console_GROMs.addr + 1) & 0x1FFF) | (console_GROMs.addr & 0xE000);
948   
948
949949   /* Reset the read and write address flipflops. */
950950   console_GROMs.raddr_LSB = console_GROMs.waddr_LSB = FALSE;
951951
r5932r5933
953953}
954954
955955/*
956   GPL read
956    GPL read
957957*/
958958READ16_HANDLER ( ti99_grom_r )
959959{
960960   UINT16 reply;
961961
962962   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4 /*20+3*/);      /* from 4 to 23? */
963//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
963//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
964964
965965   /* 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
985985   /* Activates a slot in the multi-cartridge extender. */
986986   cartridge_slot_set(cartslots, (offset & 0x01fe)/2);
987   
987
988988   if (offset & 1)
989989   {   /* 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. */
998998      console_GROMs.waddr_LSB = FALSE;
999999
10001000      /* Address reading is done in two steps; first, the high byte
1001         is transferred, then the low byte. */
1001           is transferred, then the low byte. */
10021002      if (console_GROMs.raddr_LSB)
10031003      {
10041004         /* second pass */
r5932r5933
10131013      }
10141014   }
10151015   else
1016   {   
1016   {
10171017      /* Read GROM data */
1018      reply = ((UINT16)GROM_dataread()) << 8;     
1018      reply = ((UINT16)GROM_dataread()) << 8;
10191019   }
10201020
10211021   if (hsgpl_crdena)
r5932r5933
10261026}
10271027
10281028/*
1029   GPL write
1029    GPL write
10301030*/
10311031WRITE16_HANDLER ( ti99_grom_w )
10321032{
10331033   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4/*20+3*/);      /* from 4 to 23? */
1034//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
1034//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
10351035
10361036   /* Activates a slot in the multi-cartridge extender. */
10371037   cartridge_slot_set(cartslots, (offset & 0x01fe)/2);
10381038
10391039   // 1001 1wbb bbbb bbr0
1040   
1040
10411041   if (offset & 1)
10421042   {   /* write GROM address */
10431043      /* see comments above */
10441044      console_GROMs.raddr_LSB = FALSE;
1045     
1045
10461046      /* 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        */
10511051      if (console_GROMs.waddr_LSB)
10521052      {
10531053         /* Accept low byte (2nd write) */
10541054         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. */
10581058         GROM_dataread();
10591059         console_GROMs.waddr_LSB = FALSE;
10601060      }
r5932r5933
10711071      /* write GROM data */
10721072      /* the console GROMs are always affected */
10731073      /* 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        */
10781078      GROM_dataread();
10791079      console_GROMs.raddr_LSB = console_GROMs.waddr_LSB = FALSE;
10801080   }
r5932r5933
10841084}
10851085
10861086/*
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
10891089*/
10901090static READ8_HANDLER ( ti99_grom_r8 )
10911091{
10921092   UINT8 reply;
10931093
10941094   cpu_adjust_icount(space->machine->firstcpu,-4);
1095   
1095
10961096   /* Activates a slot in the multi-cartridge extender. */
10971097   // 1001 1wbb bbbb bbr0
10981098   cartridge_slot_set(cartslots, (offset & 0x03fc)/4);
1099   
1099
11001100   if (offset & 2)
1101   {   
1101   {
11021102      console_GROMs.waddr_LSB = FALSE;
11031103
11041104      if (console_GROMs.raddr_LSB)
r5932r5933
11131113      }
11141114   }
11151115   else
1116      reply = GROM_dataread();     
1116      reply = GROM_dataread();
11171117
11181118   return reply;
11191119}
11201120
11211121/*
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
11241124*/
11251125static WRITE8_HANDLER ( ti99_grom_w8 )
11261126{
r5932r5933
11281128
11291129   /* Activates a slot in the multi-cartridge extender. */
11301130   cartridge_slot_set(cartslots, (offset & 0x03fc)/4);
1131   
1131
11321132   if (offset & 2)
11331133   {
11341134      console_GROMs.raddr_LSB = FALSE;
11351135      if (console_GROMs.waddr_LSB)
11361136      {
11371137         console_GROMs.addr = (console_GROMs.addr & 0xFF00) | (data & 0xFF);
1138         
1138
11391139         GROM_dataread();
11401140         console_GROMs.waddr_LSB = FALSE;
11411141      }
r5932r5933
11551155
11561156
11571157/*
1158   GROM read for TI-99/4p
1158    GROM read for TI-99/4p
11591159*/
11601160READ16_HANDLER ( ti99_4p_grom_r )
11611161{
11621162   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);      /* HSGPL is located on 8-bit bus? */
1163//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
1163//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
11641164
11651165   return /*hsgpl_crdena ?*/ ti99_hsgpl_gpl_r(space, offset, mem_mask) /*: 0*/;
11661166}
11671167
11681168/*
1169   GROM write
1169    GROM write
11701170*/
11711171WRITE16_HANDLER ( ti99_4p_grom_w )
11721172{
11731173   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);      /* HSGPL is located on 8-bit bus? */
1174//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
1174//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
11751175
11761176   /*if (hsgpl_crdena)*/
11771177      ti99_hsgpl_gpl_w(space, offset, data, mem_mask);
r5932r5933
11921192
11931193   if (ti99_8_enable_rom_and_ports)
11941194   {
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. */
11971197      if ((offset >= 0x0000) && (offset < 0x2000))
11981198      {
11991199         /* ROM */
r5932r5933
12121212            break;
12131213
12141214         case 1:
1215            /* >8400 - >840f: sound (cannot read)
1216               >8410 - >87ff: SRAM */
1215            /* >8400 - >840f: sound (cannot read)
1216                   >8410 - >87ff: SRAM */
12171217            if (offset >= 0x8410)
12181218               reply = sRAM_ptr_8[offset & 0x1fff];
12191219            break;
r5932r5933
12681268
12691269   /* test read protect */
12701270   /*if (mapper_reg & 0x20000000)
1271      ;*/
1271        ;*/
12721272
12731273   /* test execute protect */
12741274   /*if (mapper_reg & 0x40000000)
1275      ;*/
1275        ;*/
12761276
12771277   if (offset < 0x010000)
12781278      /* Read RAM */
r5932r5933
13041304         /* ff6000 - ff7fff: cartridge ROM space */
13051305         offset &= 0x1fff;
13061306
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);
13101310         break;
13111311
13121312      case 5:
r5932r5933
14061406               cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-48*4);      /* this is just an approx. minimum, it can be much more */
14071407
14081408               /* 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. */
14121412               if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
14131413               {
14141414                  attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
r5932r5933
14411441   }
14421442
14431443   mapper_reg = ti99_8_mapper_regs[page];
1444   
1445   /* 4 KiB page size */
1444
1445   /* 4 KiB page size */
14461446   offset = (mapper_reg + (offset & 0x0fff)) & 0x00ffffff;
14471447
14481448   /* test write protect */
14491449   /*if (mapper_reg & 0x80000000)
1450      ;*/
1450        ;*/
14511451
14521452   if (offset < 0x010000)
14531453   {   /* Write RAM */
r5932r5933
14771477      case 3:
14781478         /* cartridge space */
14791479         /* 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);
14811481         break;
14821482
14831483      case 5:
r5932r5933
15011501#pragma mark TI-99/4 HANDSETS
15021502#endif
15031503/*
1504   Handset support (TI99/4 only)
1504    Handset support (TI99/4 only)
15051505
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.
15131513
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.
15191519*/
15201520
15211521/*
1522   ti99_handset_poll_bus()
1522    ti99_handset_poll_bus()
15231523
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.
15261526*/
15271527static int ti99_handset_poll_bus(void)
15281528{
r5932r5933
15301530}
15311531
15321532/*
1533   ti99_handset_ack_callback()
1533    ti99_handset_ack_callback()
15341534
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.
15391539*/
15401540static TIMER_CALLBACK(ti99_handset_ack_callback)
15411541{
r5932r5933
15471547   if (handset_buflen == 1)
15481548   {
15491549      /* 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. */
15541554      timer_set(machine, ATTOTIME_IN_USEC(1000), NULL, 0, ti99_handset_ack_callback);
15551555   }
15561556
r5932r5933
15601560}
15611561
15621562/*
1563   ti99_handset_set_ack()
1563    ti99_handset_set_ack()
15641564
1565   Handler for tms9901 P0 pin (handset data acknowledge)
1565    Handler for tms9901 P0 pin (handset data acknowledge)
15661566*/
15671567static WRITE8_DEVICE_HANDLER( ti99_handset_set_ack )
15681568{
r5932r5933
15761576}
15771577
15781578/*
1579   ti99_handset_post_message()
1579    ti99_handset_post_message()
15801580
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.
15841584
1585   message: 12-bit message to post (only the 12 LSBits are meaningful)
1585    message: 12-bit message to post (only the 12 LSBits are meaningful)
15861586*/
15871587static void ti99_handset_post_message(running_machine *machine, int message)
15881588{
r5932r5933
15941594}
15951595
15961596/*
1597   ti99_handset_poll_keyboard()
1597    ti99_handset_poll_keyboard()
15981598
1599   Poll the current state of one given handset keypad.
1599    Poll the current state of one given handset keypad.
16001600
1601   num: number of the keypad to poll (0-3)
1601    num: number of the keypad to poll (0-3)
16021602
1603   Returns TRUE if the handset state has changed and a message was posted.
1603    Returns TRUE if the handset state has changed and a message was posted.
16041604*/
16051605static int ti99_handset_poll_keyboard(running_machine *machine, int num)
16061606{
r5932r5933
16151615   key_buf = ( input_port_read(machine, keynames[num]) | (input_port_read(machine, keynames[num + 1]) << 16) ) >> (4*num);
16161616
16171617   /* If a key was previously pressed, this key was not shift, and this key is
1618   still down, then don't change the current key press. */
1618    still down, then don't change the current key press. */
16191619   if (previous_key[num] && (previous_key[num] != 0x24)
16201620         && (key_buf & (1 << (previous_key[num] & 0x1f))))
16211621   {
r5932r5933
16261626      else
16271627      {
16281628         /* the shift modifier state has changed: we need to update the
1629         keyboard state */
1629            keyboard state */
16301630         if (key_buf & 0x0008)
16311631         {   /* shift has been pressed down */
16321632            previous_key[num] = current_key = previous_key[num] | 0x20;
r5932r5933
16541654
16551655         if (current_key != 0x24)
16561656            /* 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. */
16591659            break;
16601660      }
16611661   }
r5932r5933
16741674}
16751675
16761676/*
1677   ti99_handset_poll_joystick()
1677    ti99_handset_poll_joystick()
16781678
1679   Poll the current state of one given handset joystick.
1679    Poll the current state of one given handset joystick.
16801680
1681   num: number of the joystick to poll (0-3)
1681    num: number of the joystick to poll (0-3)
16821682
1683   Returns TRUE if the handset state has changed and a message was posted.
1683    Returns TRUE if the handset state has changed and a message was posted.
16841684*/
16851685static int ti99_handset_poll_joystick(running_machine *machine, int num)
16861686{
r5932r5933
17121712
17131713      /* set sign */
17141714      /* note that we set the sign if the joystick position is 0 to work
1715      around a bug in the ti99/4 ROMs */
1715        around a bug in the ti99/4 ROMs */
17161716      if (current_joy_x <= 0)
17171717      {
17181718         message |= 0x040;
r5932r5933
17511751}
17521752
17531753/*
1754   ti99_handset_task()
1754    ti99_handset_task()
17551755
1756   Manage handsets, posting an event if the state of any handset has changed.
1756    Manage handsets, posting an event if the state of any handset has changed.
17571757*/
17581758static void ti99_handset_task(running_machine *machine)
17591759{
r5932r5933
17911791static void mecmouse_select(int selnow, int stick1, int stick2)
17921792{
17931793   /* 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).
18081808
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)
18151812
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)
18271815
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
18331833   if (selnow==stick2) {
18341834      if (mecmouse_sel==stick1) {
18351835         if (! mecmouse_read_y)
r5932r5933
18441844            mecmouse_x -= mecmouse_x_buf;
18451845            mecmouse_x_buf = (mecmouse_x_buf-1) & 7;
18461846         }
1847         else
1847         else
18481848         {
18491849            /* Sample y motion. */
18501850            if (mecmouse_y < -4)
r5932r5933
18591859      }
18601860      mecmouse_sel = selnow;
18611861   }
1862   else if (selnow==stick1)
1862   else if (selnow==stick1)
18631863   {
18641864      if (mecmouse_sel==stick2)
18651865      {
r5932r5933
18681868      }
18691869      mecmouse_sel = selnow;
18701870   }
1871   else
1871   else
18721872   {
18731873      /* Reset the axis toggle when the mouse is deselected */
18741874      mecmouse_read_y = 0;
r5932r5933
18861886
18871887   /* compute x delta */
18881888   delta_x = new_mx - last_mx;
1889   
1889
18901890   /* check for wrap */
18911891   if (delta_x > 0x80)
18921892      delta_x = -0x100+delta_x;
r5932r5933
19221922#pragma mark TMS9901 INTERFACE
19231923#endif
19241924/*
1925   TI99/4x-specific tms9901 I/O handlers
1925    TI99/4x-specific tms9901 I/O handlers
19261926
1927   See mess/machine/tms9901.c for generic tms9901 CRU handlers.
1927    See mess/machine/tms9901.c for generic tms9901 CRU handlers.
19281928
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)
19311931
19321932KNOWN 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).
19371937*/
19381938/*
1939   TMS9901 interrupt handling on a TI99/4(a).
1939    TMS9901 interrupt handling on a TI99/4(a).
19401940
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)
19461946
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).
19521952
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.
19561956
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 ?).
19601960
19611961nota:
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?).
19691969*/
19701970
19711971/*
1972   set the state of int1 (called by the peb core)
1972    set the state of int1 (called by the peb core)
19731973*/
19741974static void tms9901_set_int1(running_machine *machine, int state)
19751975{
r5932r5933
19771977}
19781978
19791979/*
1980   set the state of int2 (called by the tms9928 core)
1980    set the state of int2 (called by the tms9928 core)
19811981*/
19821982void tms9901_set_int2(running_machine *machine, int state)
19831983{
r5932r5933
19851985}
19861986
19871987/*
1988   Called by the 9901 core whenever the state of INTREQ and IC0-3 changes
1988    Called by the 9901 core whenever the state of INTREQ and IC0-3 changes
19891989*/
19901990static TMS9901_INT_CALLBACK( tms9901_interrupt_callback )
19911991{
19921992   if (intreq)
19931993   {
19941994      /* On TI99, TMS9900 IC0-3 lines are not connected to TMS9901,
1995      * but hard-wired to force level 1 interrupts */
1995        * but hard-wired to force level 1 interrupts */
19961996      cputag_set_input_line_and_vector(device->machine, "maincpu", 0, ASSERT_LINE, 1);   /* interrupt it, baby */
19971997   }
19981998   else
r5932r5933
20022002}
20032003
20042004/*
2005   Read pins INT3*-INT7* of TI99's 9901.
2005    Read pins INT3*-INT7* of TI99's 9901.
20062006
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
20112011*/
20122012static READ8_DEVICE_HANDLER( ti99_R9901_0 )
20132013{
r5932r5933
20332033   {
20342034      answer = ((input_port_read(device->machine, keynames[KeyCol >> 1]) >> ((KeyCol & 1) * 8)) << 3) & 0xF8;
20352035   }
2036   
2036
20372037   if ((ti99_model == model_99_4a) || (ti99_model == model_99_4p))
20382038   {
20392039      if (! AlphaLockLine)
r5932r5933
20442044}
20452045
20462046/*
2047   Read pins INT8*-INT15* of TI99's 9901.
2047    Read pins INT8*-INT15* of TI99's 9901.
20482048
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
20542054*/
20552055static READ8_DEVICE_HANDLER( ti99_R9901_1 )
20562056{
r5932r5933
20632063   {
20642064      answer = ((input_port_read(device->machine, keynames[KeyCol >> 1]) >> ((KeyCol & 1) * 8)) >> 5) & 0x07;
20652065   }
2066   
2066
20672067   /* we don't take CS2 into account, as CS2 is a write-only unit */
20682068   /*if (cassette_input(devtag_get_device(device->machine, "cassette1")) > 0)
2069      answer |= 8;*/
2069        answer |= 8;*/
20702070
20712071   return answer;
20722072}
20732073
20742074/*
2075   Read pins P0-P7 of TI99's 9901.
2075    Read pins P0-P7 of TI99's 9901.
20762076
2077    bit 1: handset data clock pin
2077    bit 1: handset data clock pin
20782078*/
20792079static READ8_DEVICE_HANDLER( ti99_R9901_2 )
20802080{
r5932r5933
20822082}
20832083
20842084/*
2085   Read pins P8-P15 of TI99's 9901.
2085    Read pins P8-P15 of TI99's 9901.
20862086
2087    bit 26: IR handset interrupt
2088    bit 27: tape input
2087     bit 26: IR handset interrupt
2088     bit 27: tape input
20892089*/
20902090static READ8_DEVICE_HANDLER( ti99_R9901_3 )
20912091{
r5932r5933
21132113
21142114
21152115/*
2116   WRITE key column select (P2-P4)
2116    WRITE key column select (P2-P4)
21172117*/
21182118static WRITE8_DEVICE_HANDLER( ti99_KeyC )
21192119{
r5932r5933
21212121      KeyCol |= 1 << (offset-2);
21222122   else
21232123      KeyCol &= ~ (1 << (offset-2));
2124   
2124
21252125        if (has_mecmouse)
21262126                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);
21282128}
21292129
21302130/*
2131   WRITE alpha lock line - TI99/4a only (P5)
2131    WRITE alpha lock line - TI99/4a only (P5)
21322132*/
21332133static WRITE8_DEVICE_HANDLER( ti99_AlphaW )
21342134{
r5932r5933
21372137}
21382138
21392139/*
2140   Read pins INT3*-INT7* of TI99's 9901.
2140    Read pins INT3*-INT7* of TI99's 9901.
21412141
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
21482148*/
21492149static READ8_DEVICE_HANDLER( ti99_8_R9901_0 )
21502150{
r5932r5933
21662166   {
21672167      answer = (input_port_read(device->machine, keynames[KeyCol]) << 6) & 0xC0;
21682168   }
2169   
2169
21702170   return answer;
21712171}
21722172
21732173/*
2174   Read pins INT8*-INT15* of TI99's 9901.
2174    Read pins INT8*-INT15* of TI99's 9901.
21752175
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
21812181*/
21822182static READ8_DEVICE_HANDLER( ti99_8_R9901_1 )
21832183{
r5932r5933
21992199   {
22002200      answer = (input_port_read(device->machine, keynames[KeyCol]) >> 2) & 0x07;
22012201   }
2202   
2202
22032203   /* we don't take CS2 into account, as CS2 is a write-only unit */
22042204   /*if (cassette_input(devtag_get_device(machine, "cassette")) > 0)
2205      answer |= 8;*/
2205        answer |= 8;*/
22062206
22072207   return answer;
22082208}
22092209
22102210/*
2211   WRITE key column select (P0-P3)
2211    WRITE key column select (P0-P3)
22122212*/
22132213static WRITE8_DEVICE_HANDLER( ti99_8_KeyC )
22142214{
r5932r5933
22322232}
22332233
22342234/*
2235   command CS1/CS2 tape unit motor (P6-P7)
2235    command CS1/CS2 tape unit motor (P6-P7)
22362236*/
22372237static WRITE8_DEVICE_HANDLER( ti99_CS_motor )
22382238{
r5932r5933
22502250}
22512251
22522252/*
2253   audio gate (P8)
2253    audio gate (P8)
22542254
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.
22572257
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.
22602260*/
22612261static WRITE8_DEVICE_HANDLER( ti99_audio_gate )
22622262{
22632263}
22642264
22652265/*
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.
22682268*/
22692269static WRITE8_DEVICE_HANDLER( ti99_CS_output )
22702270{
r5932r5933
22872287#pragma mark 99/8 INTERNAL DSR
22882288#endif
22892289/*
2290   TI 99/8 internal DSR support.
2290    TI 99/8 internal DSR support.
22912291
2292   Includes a few specific signals, and an extra ROM.
2292    Includes a few specific signals, and an extra ROM.
22932293*/
22942294
22952295/* prototypes */
r5932r5933
23182318}
23192319
23202320/* 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 */
23232323static void ti99_8_internal_dsr_cru_w(running_machine *machine, int offset, int data)
23242324{
23252325   switch (offset)
r5932r5933
23442344#pragma mark SGCPU INTERNAL DSR
23452345#endif
23462346/*
2347   SNUG SGCPU (a.k.a. 99/4p) internal DSR support.
2347    SNUG SGCPU (a.k.a. 99/4p) internal DSR support.
23482348
2349   Includes a few specific signals, and an extra ROM.
2349    Includes a few specific signals, and an extra ROM.
23502350*/
23512351
23522352/* prototypes */
r5932r5933
23822382}
23832383
23842384/* 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*/
23892389static void ti99_4p_internal_dsr_cru_w(running_machine *machine, int offset, int data)
23902390{
23912391   switch (offset)
r5932r5933
24242424#endif
24252425/*===========================================================================*/
24262426/*
2427   TI memory extension support.
2427    TI memory extension support.
24282428
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.
24312431*/
24322432
24332433static READ16_HANDLER ( ti99_TIxramlow_r );
r5932r5933
24382438static void ti99_TIxram_init(running_machine *machine)
24392439{
24402440   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
2441   
2441
24422442   memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_TIxramlow_r);
24432443   memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_TIxramlow_w);
24442444   memory_install_read16_handler(space, 0xa000, 0xffff, 0, 0, ti99_TIxramhigh_r);
r5932r5933
24492449static READ16_HANDLER ( ti99_TIxramlow_r )
24502450{
24512451   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
2452//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2452//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
24532453
24542454   return xRAM_ptr[offset];
24552455}
r5932r5933
24572457static WRITE16_HANDLER ( ti99_TIxramlow_w )
24582458{
24592459   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
2460//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2460//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
24612461
24622462   COMBINE_DATA(xRAM_ptr + offset);
24632463}
r5932r5933
24662466static READ16_HANDLER ( ti99_TIxramhigh_r )
24672467{
24682468   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
2469//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2469//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
24702470
24712471   return xRAM_ptr[offset+0x1000];
24722472}
r5932r5933
24742474static WRITE16_HANDLER ( ti99_TIxramhigh_w )
24752475{
24762476   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
2477//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2477//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
24782478
24792479   COMBINE_DATA(xRAM_ptr + offset+0x1000);
24802480}
r5932r5933
24822482
24832483/*===========================================================================*/
24842484/*
2485   Super AMS memory extension support.
2485    Super AMS memory extension support.
24862486
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.
24892489*/
24902490
24912491/* prototypes */
r5932r5933
25182518   int i;
25192519
25202520   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
2521   
2521
25222522   memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_sAMSxramlow_r);
25232523   memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_sAMSxramlow_w);
25242524   memory_install_read16_handler(space, 0xa000, 0xffff, 0, 0, ti99_sAMSxramhigh_r);
r5932r5933
25332533}
25342534
25352535/* 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 */
25382538static void sAMS_cru_w(running_machine *machine, int offset, int data)
25392539{
25402540   if (offset == 1)
r5932r5933
25572557static READ16_HANDLER ( ti99_sAMSxramlow_r )
25582558{
25592559   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
2560//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2560//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
25612561
25622562   if (sAMS_mapper_on)
25632563      return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]];
r5932r5933
25682568static WRITE16_HANDLER ( ti99_sAMSxramlow_w )
25692569{
25702570   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
2571//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2571//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
25722572
25732573   if (sAMS_mapper_on)
25742574      COMBINE_DATA(xRAM_ptr + (offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]);
r5932r5933
25802580static READ16_HANDLER ( ti99_sAMSxramhigh_r )
25812581{
25822582   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
2583//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2583//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
25842584
25852585   if (sAMS_mapper_on)
25862586      return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x5000+offset)>>11]];
r5932r5933
25912591static WRITE16_HANDLER ( ti99_sAMSxramhigh_w )
25922592{
25932593   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
2594//   cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2594//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
25952595
25962596   if (sAMS_mapper_on)
25972597      COMBINE_DATA(xRAM_ptr + (offset&0x7ff)+sAMSlookup[(0x5000+offset)>>11]);
r5932r5933
26022602
26032603/*===========================================================================*/
26042604/*
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.
26072607
2608   Up to 1Mb of SRAM.  Straightforward mapper, works with 4kb chunks.
2608    Up to 1Mb of SRAM.  Straightforward mapper, works with 4kb chunks.
26092609*/
26102610
26112611/* prototypes */
r5932r5933
26342634
26352635   /* Not required at run-time */
26362636   /*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));*/
26522652
26532653   ti99_peb_set_16bit_card_handlers(0x1e00, & ti99_4p_mapper_handlers);
26542654
r5932r5933
26792679}
26802680
26812681/* 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 */
26842684static void ti99_4p_mapper_cru_w(running_machine *machine, int offset, int data)
26852685{
26862686   int i;
r5932r5933
27542754
27552755/*===========================================================================*/
27562756/*
2757   myarc-ish memory extension support (foundation, and myarc clones).
2757    myarc-ish memory extension support (foundation, and myarc clones).
27582758
2759   Up to 512kb of RAM.  Straightforward mapper, works with 32kb chunks.
2759    Up to 512kb of RAM.  Straightforward mapper, works with 32kb chunks.
27602760*/
27612761
27622762static int myarc_cru_r(running_machine *machine, int offset);
r5932r5933
27852785static void ti99_myarcxram_init(running_machine *machine)
27862786{
27872787   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
2788   
2788
27892789   memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_myarcxramlow_r);
27902790   memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_myarcxramlow_w);
27912791   memory_install_read16_handler(space, 0xa000, 0xffff, 0, 0, ti99_myarcxramhigh_r);
r5932r5933
28242824}
28252825
28262826/* read CRU bit:
2827   bit 1-2 (128kb) or 1-4 (512kb): read current map offset */
2827    bit 1-2 (128kb) or 1-4 (512kb): read current map offset */
28282828static int myarc_cru_r(running_machine *machine, int offset)
28292829{
28302830   /*if (offset == 0)*/   /* right??? */
r5932r5933
28342834}
28352835
28362836/* write CRU bit:
2837   bit 1-2 (128kb) or 1-4 (512kb): write map offset */
2837    bit 1-2 (128kb) or 1-4 (512kb): write map offset */
28382838static void myarc_cru_w(running_machine *machine, int offset, int data)
28392839{
28402840   offset &= 0x7;   /* right??? */
r5932r5933
28882888#pragma mark EVPC VIDEO CARD
28892889#endif
28902890/*
2891   SNUG's EVPC emulation
2891    SNUG's EVPC emulation
28922892*/
28932893
28942894/* prototypes */
r5932r5933
29172917
29182918
29192919/*
2920   Reset evpc card, set up handlers
2920    Reset evpc card, set up handlers
29212921*/
29222922static void ti99_evpc_reset(running_machine *machine)
29232923{
r5932r5933
29302930}
29312931
29322932/*
2933   Read evpc CRU interface
2933    Read evpc CRU interface
29342934*/
29352935static int evpc_cru_r(running_machine *machine, int offset)
29362936{
r5932r5933
29382938}
29392939
29402940/*
2941   Write evpc CRU interface
2941    Write evpc CRU interface
29422942*/
29432943static void evpc_cru_w(running_machine *machine, int offset, int data)
29442944{
r5932r5933
29942994} evpc_palette;
29952995
29962996/*
2997   read a byte in evpc DSR space
2997    read a byte in evpc DSR space
29982998*/
29992999static  READ8_HANDLER(evpc_mem_r)
30003000{
r5932r5933
30733073}
30743074
30753075/*
3076   write a byte in evpc DSR space
3076    write a byte in evpc DSR space
30773077*/
30783078static WRITE8_HANDLER(evpc_mem_w)
30793079{
src/mess/machine/kb3600.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3030
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
5252
5353**********************************************************************/
5454
src/mess/machine/pc1251.c
r5932r5933
7373{
7474   int data = outb;
7575
76   if (outb & 0x08)
76   if (outb & 0x08)
7777      data |= (input_port_read(device->machine, "MODE") & 0x07);
7878
7979   return data;
src/mess/machine/msm8251.c
r5932r5933
11/*********************************************************************
22
3   msm8251.c
3    msm8251.c
44
5   MSM/Intel 8251 Universal Synchronous/Asynchronous Receiver Transmitter code
5    MSM/Intel 8251 Universal Synchronous/Asynchronous Receiver Transmitter code
66
77*********************************************************************/
88
r5932r5933
228228      /* if transmit is not empty... transmit data */
229229      if ((uart->transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0)
230230      {
231   //      logerror("MSM8251\n");
231   //      logerror("MSM8251\n");
232232         transmit_register_send_bit(device->machine,&uart->transmit_reg, &uart->connection);
233233      }
234234   }
r5932r5933
276276   int tx_ready;
277277
278278   /* 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    */
283283
284284   tx_ready = 0;
285285
r5932r5933
392392            /* finished transfering sync bytes, now expecting command */
393393            uart->flags &= ~(MSM8251_EXPECTING_MODE | MSM8251_EXPECTING_SYNC_BYTE);
394394            uart->sync_byte_offset = 0;
395         //   uart->status = MSM8251_STATUS_TX_EMPTY | MSM8251_STATUS_TX_READY;
395         //  uart->status = MSM8251_STATUS_TX_EMPTY | MSM8251_STATUS_TX_READY;
396396         }
397397      }
398398      else
r5932r5933
404404         /* Synchronous or Asynchronous? */
405405         if ((data & 0x03)!=0)
406406         {
407            /*   Asynchronous
407            /*  Asynchronous
408408
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                */
431431
432432            LOG(("MSM8251: Asynchronous operation\n"));
433433
r5932r5933
522522#endif
523523            /* not expecting mode byte now */
524524            uart->flags &= ~MSM8251_EXPECTING_MODE;
525//            uart->status = MSM8251_STATUS_TX_EMPTY | MSM8251_STATUS_TX_READY;
525//              uart->status = MSM8251_STATUS_TX_EMPTY | MSM8251_STATUS_TX_READY;
526526         }
527527         else
528528         {
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                */
548548            LOG(("MSM8251: Synchronous operation\n"));
549549
550550            /* setup for sync byte(s) */
r5932r5933
613613      }
614614
615615
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        */
641641
642642      uart->connection.State &=~SERIAL_STATE_RTS;
643643      if (data & (1<<5))
r5932r5933
718718
719719/*-------------------------------------------------
720720    msm8251_receive_character - called when last
721   bit of data has been received
721    bit of data has been received
722722-------------------------------------------------*/
723723
724724static void msm8251_receive_character(const device_config *device, UINT8 ch)
r5932r5933
761761
762762/*-------------------------------------------------
763763    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
767767-------------------------------------------------*/
768768
769769void msm8251_connect_to_serial_device(const device_config *device, const device_config *image)
src/mess/machine/i8355.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - attempt to direct-map
14    - attempt to direct-map
1515
1616*/
1717
src/mess/machine/atarifdc.c
r5932r5933
3434   UINT8 serin_chksum;
3535   int  serin_delay;
3636}   ATARI_FDC;
37
37
3838static ATARI_FDC atari_fdc;
3939
4040typedef struct _atari_drive atari_drive;
r5932r5933
469469      switch (atari_fdc.serout_buff[1]) /* command ? */
470470      {
471471         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);
473473
474474            if (VERBOSE_SERIAL)
475475               logerror("atari status\n");
src/mess/machine/smc92x4.h
r5932r5933
11/*
2   smc92x4.h: header file for smc92x4.c
2    smc92x4.h: header file for smc92x4.c
33
4   Raphael Nabet
4    Raphael Nabet
55*/
66
77/* this enum matches the possible values for bits 3-2 of the select register */
r5932r5933
1717typedef struct smc92x4_intf
1818{
1919   /* 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. */
3232   int (*select_callback)(int which, select_mode_t select_mode, int select_line, int gpos);
3333   /* dma_read_callback will be called by the smc99x4 core to read the sector
34   buffer */
34    buffer */
3535   UINT8 (*dma_read_callback)(int which, offs_t offset);
3636   /* dma_read_callback will be called by the smc99x4 core to write the sector
37   buffer */
37    buffer */
3838   void (*dma_write_callback)(int which, offs_t offset, UINT8 data);
3939   /* int_callback will be called by the smc99x4 core whenever the state of
40   the interrupt lien changes */
40    the interrupt lien changes */
4141   void (*int_callback)(int which, int state);
4242} smc92x4_intf;
4343
src/mess/machine/ti99_4x.h
r5932r5933
11/*
2   header file for machine/ti99_4x.c
2    header file for machine/ti99_4x.c
33*/
44#include "video/tms9928a.h"
55#include "machine/tms9901.h"
r5932r5933
9999   fdc_kind_TI,            /* TI fdc */
100100   fdc_kind_BwG,            /* SNUG's BwG fdc */
101101   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) */
104104#if HAS_99CCFDC
105105   ,
106106   fdc_kind_CC = 0x100         /* CorComp fdc */
r5932r5933
134134   config_cartslot_bit   = 14,
135135   config_cartslot_mask   = 0xf, /* need four bits: covers all current and possibly future cartslots, and one auto mode */
136136   config_pcode_bit   = 18,
137   config_pcode_mask   = 0x1
137   config_pcode_mask   = 0x1
138138};
139139
140140enum {
src/mess/machine/tms5501.c
r5932r5933
11/*********************************************************************
22
3   tms5501.c
3    tms5501.c
44
5   TMS5501 input/output controller
5    TMS5501 input/output controller
66
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
99
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.
1616
17   TODO:
18   - SIO
17    TODO:
18    - SIO
1919
2020*********************************************************************/
2121
r5932r5933
427427         break;
428428      case 0x04:
429429         /* 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 */
437437
438438         tms->command = data & TMS5501_COMMAND_LATCHED_BITS;
439439         LOG_TMS5501(device, "Command register write", data);
r5932r5933
443443         break;
444444      case 0x05:
445445         /* 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 */
454454
455455         tms->sio_rate = data;
456456         LOG_TMS5501(device, "Serial rate write", data);
r5932r5933
467467         break;
468468      case 0x08:
469469         /* 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) */
478478
479479         tms->interrupt_mask = data;
480480         LOG_TMS5501(device, "Interrupt mask write", data);
src/mess/machine/msm8251.h
r5932r5933
11/*********************************************************************
22
3   msm8251.h
3    msm8251.h
44
5   MSM/Intel 8251 Universal Synchronous/Asynchronous Receiver Transmitter code
5    MSM/Intel 8251 Universal Synchronous/Asynchronous Receiver Transmitter code
66
77*********************************************************************/
88
src/mess/machine/i8355.h
r5932r5933
66    Visit http://mamedev.org for licensing and usage restrictions.
77
88**********************************************************************
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
3030
3131**********************************************************************/
3232
src/mess/machine/sgi.c
r5932r5933
11/*********************************************************************
22
3   sgi.c
3    sgi.c
44
5   Silicon Graphics MC (Memory Controller) code
5    Silicon Graphics MC (Memory Controller) code
66
77*********************************************************************/
88
r5932r5933
241241   case 0x203c:
242242      verboselog( space->machine, 0, "DMA Zoom Count Read: %08x (%08x)\n", nMC_DMAZoomByteCnt, mem_mask );
243243      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 );
247247      // Start DMA
248//      nMC_DMARunning = 1;
249//      break;
248//      nMC_DMARunning = 1;
249//      break;
250250   case 0x2048:
251251   case 0x204c:
252252      verboselog( space->machine, 0, "VDMA Running Read: %08x (%08x)\n", nMC_DMARunning, mem_mask );
src/mess/machine/tms5501.h
r5932r5933
11/*********************************************************************
22
3   tms5501.h
3    tms5501.h
44
5   TMS 5501 code
5    TMS 5501 code
66
77*********************************************************************/
88
src/mess/machine/pk8020.c
r5932r5933
3232
3333static READ8_HANDLER(keyboard_r)
3434{
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",
3636                                 "LINE8", "LINE9", "LINE10", "LINE11", "LINE12", "LINE13", "LINE14", "LINE15" };
37   UINT8 retVal=0x00;   
37   UINT8 retVal=0x00;
3838   UINT8 line = 0;
3939   if (offset & 0x100)  line=8;
40     
40
4141   if (offset & 0x0001) retVal|=input_port_read(space->machine,keynames[line]);
4242   line++;
4343   if (offset & 0x0002) retVal|=input_port_read(space->machine,keynames[line]);
r5932r5933
6868      pk8020_set_bank(space->machine,data >> 2);
6969   } else if (BIT(offset,6)==0) {
7070      // Color
71      pk8020_color = data;     
71      pk8020_color = data;
7272   } else if (BIT(offset,2)==0) {
7373      // Palette set
7474      UINT8 number = data & 0x0f;
r5932r5933
7676      UINT8 i = (color & 0x08) ?  0x3F : 0;
7777      UINT8 r = ((color & 0x04) ? 0xC0 : 0) + i;
7878      UINT8 g = ((color & 0x02) ? 0xC0 : 0) + i;
79      UINT8 b = ((color & 0x01) ? 0xC0 : 0) + i;               
79      UINT8 b = ((color & 0x01) ? 0xC0 : 0) + i;
8080      palette_set_color( space->machine, number, MAKE_RGB(r,g,b) );
8181   }
8282}
r5932r5933
8484static READ8_HANDLER(text_r)
8585{
8686    if (attr == 3) text_attr=mess_ram[0x40400+offset];
87   return mess_ram[0x40000+offset];   
87   return mess_ram[0x40000+offset];
8888}
8989
9090static WRITE8_HANDLER(text_w)
9191{
9292   mess_ram[0x40000+offset] = data;
9393   switch (attr) {
94        case 0: break;
94        case 0: break;
9595        case 1: mess_ram[0x40400+offset]=0x01;break;
9696        case 2: mess_ram[0x40400+offset]=0x00;break;
9797        case 3: mess_ram[0x40400+offset]=text_attr;break;
98    }   
98    }
9999}
100100
101101static READ8_HANDLER(gzu_r)
102{   
102{
103103   UINT8 *addr = mess_ram + 0x10000 + (pk8020_video_page_access * 0xC000);
104104   UINT8 p0 = addr[offset];
105105   UINT8 p1 = addr[offset + 0x4000];
r5932r5933
138138   UINT8 *plane_0 = addr;
139139   UINT8 *plane_1 = addr + 0x4000;
140140   UINT8 *plane_2 = addr + 0x8000;
141   
142   if(pk8020_color & 0x80)
141
142   if(pk8020_color & 0x80)
143143   {
144144      // Color mode
145145      plane_0[offset] = (plane_0[offset] & ~data) | ((pk8020_color & 2) ? data : 0);
r5932r5933
169169   const device_config *pic = devtag_get_device(space->machine, "pic8259");
170170   const device_config *rs232 = devtag_get_device(space->machine, "rs232");
171171   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
174174   switch(offset & 0x38)
175175   {
176176      case 0x00: return pit8253_r(pit,offset & 3);
r5932r5933
179179                  case 0 : return msm8251_data_r(rs232,0);
180180                     case 1 : return msm8251_status_r(rs232,0);
181181               }
182               break;     
182               break;
183183      case 0x18: switch(offset & 3) {
184184                  case 0 : return wd17xx_status_r(fdc,0);
185185                  case 1 : return wd17xx_track_r(fdc,0);
186186                  case 2 : return wd17xx_sector_r(fdc,0);
187187                  case 3 : return wd17xx_data_r(fdc,0);
188               }
188               }
189189               break;
190190      case 0x20: switch(offset & 1) {
191191                  case 0 : return msm8251_data_r(lan,0);
192192                     case 1 : return msm8251_status_r(lan,0);
193193               }
194               break;     
194               break;
195195      case 0x28: return pic8259_r(pic,offset & 1);
196196      case 0x30: return i8255a_r(ppi2,offset & 3);
197197      case 0x38: return i8255a_r(ppi1,offset & 3);
r5932r5933
209209   const device_config *rs232 = devtag_get_device(space->machine, "rs232");
210210   const device_config *lan = devtag_get_device(space->machine, "lan");
211211   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
212   
212
213213   switch(offset & 0x38)
214214   {
215215      case 0x00: pit8253_w(pit,offset & 3,data); break;
r5932r5933
218218                  case 0 : msm8251_data_w(rs232,0,data); break;
219219                     case 1 : msm8251_control_w(rs232,0,data); break;
220220               }
221               break;         
221               break;
222222      case 0x18: switch(offset & 3) {
223223                  case 0 : wd17xx_command_w(fdc,0,data);break;
224224                  case 1 : wd17xx_track_w(fdc,0,data);break;
225225                  case 2 : wd17xx_sector_w(fdc,0,data);break;
226226                  case 3 : wd17xx_data_w(fdc,0,data);break;
227               }
228               break;                 
227               }
228               break;
229229      case 0x20: switch(offset & 1) {
230230                  case 0 : msm8251_data_w(lan,0,data); break;
231231                     case 1 : msm8251_control_w(lan,0,data); break;
232232               }
233               break;         
233               break;
234234      case 0x28: pic8259_w(pic,offset & 1,data);break;
235235      case 0x30: i8255a_w(ppi2,offset & 3,data); break;
236236      case 0x38: i8255a_w(ppi1,offset & 3,data); break;
237237   }
238238}
239239
240static void pk8020_set_bank(running_machine *machine,UINT8 data)
241{
242   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);   
240static void pk8020_set_bank(running_machine *machine,UINT8 data)
241{
242   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
243243   switch(data & 0x1F) {
244      case 0x00 :
244      case 0x00 :
245245               {
246246                  // ROM
247247                  memory_install_read8_handler (space, 0x0000, 0x37ff, 0, 0, SMH_BANK(1));
r5932r5933
279279                  memory_install_write8_handler(space, 0x2000, 0xffff, 0, 0, SMH_BANK(4));
280280                  memory_set_bankptr(machine, 3, mess_ram + 0x2000);
281281                  memory_set_bankptr(machine, 4, mess_ram + 0x2000);
282               }               
282               }
283283               break;
284284      case 0x02 : {
285285                  // ROM
r5932r5933
292292                  memory_install_write8_handler(space, 0x4000, 0xffff, 0, 0, SMH_BANK(4));
293293                  memory_set_bankptr(machine, 3, mess_ram + 0x4000);
294294                  memory_set_bankptr(machine, 4, mess_ram + 0x4000);
295               }               
295               }
296296               break;
297297      case 0x03 : {
298298                  // RAM
r5932r5933
300300                  memory_install_write8_handler(space, 0x0000, 0xffff, 0, 0, SMH_BANK(2));
301301                  memory_set_bankptr(machine, 1, mess_ram);
302302                  memory_set_bankptr(machine, 2, mess_ram);
303               }               
303               }
304304               break;
305      case 0x04 :
306      case 0x05 :
305      case 0x04 :
306      case 0x05 :
307307               {
308308                  // ROM
309309                  memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1));
r5932r5933
330330                  memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w);
331331               }
332332               break;
333      case 0x06 :
333      case 0x06 :
334334               {
335335                  // ROM
336336                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
356356                  memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r);
357357                  memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w);
358358               }
359               break;   
360      case 0x07 :
359               break;
360      case 0x07 :
361361               {
362362                  // RAM
363363                  memory_install_read8_handler (space, 0x0000, 0xf7ff, 0, 0, SMH_BANK(1));
r5932r5933
378378                  memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r);
379379                  memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w);
380380               }
381               break;   
382      case 0x08 :
381               break;
382      case 0x08 :
383383               {
384384                  // ROM
385385                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
407407                  // Video RAM
408408                  memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r);
409409                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
410                 
410
411411               }
412412               break;
413      case 0x09 :
413      case 0x09 :
414414               {
415415                  // ROM
416416                  memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1));
r5932r5933
424424                  memory_set_bankptr(machine, 4, mess_ram + 0x2000);
425425                  // Video RAM
426426                  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);
428428               }
429429               break;
430      case 0x0A :
430      case 0x0A :
431431               {
432432                  // ROM
433433                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
444444                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
445445               }
446446               break;
447      case 0x0B :
447      case 0x0B :
448448               {
449449                  // RAM
450450                  memory_install_read8_handler (space, 0x0000, 0xbfff, 0, 0, SMH_BANK(1));
r5932r5933
456456                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
457457               }
458458               break;
459      case 0x0C :
460      case 0x0D :
459      case 0x0C :
460      case 0x0D :
461461               {
462462                  // ROM
463463                  memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1));
r5932r5933
482482                  memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w);
483483                  // System reg
484484                  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);
486486               }
487487               break;
488      case 0x0E :
488      case 0x0E :
489489               {
490490                  // ROM
491491                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
505505                  memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w);
506506                  // System reg
507507                  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);
509509               }
510510               break;
511      case 0x0F :
511      case 0x0F :
512512               {
513513                  // RAM
514514                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
528528                  memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w);
529529                  // System reg
530530                  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);
532532               }
533               break;               
534      case 0x10 :
533               break;
534      case 0x10 :
535535               {
536536                  // ROM
537537                  memory_install_read8_handler (space, 0x0000, 0x5fff, 0, 0, SMH_BANK(1));
r5932r5933
542542                  memory_install_read8_handler (space, 0x6000, 0xf7ff, 0, 0, SMH_BANK(3));
543543                  memory_install_write8_handler(space, 0x6000, 0xf7ff, 0, 0, SMH_BANK(4));
544544                  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);
546546                  // Keyboard
547547                  memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r);
548548                  memory_install_write8_handler(space, 0xf800, 0xf9ff, 0, 0, SMH_BANK(5));
r5932r5933
557557                  memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r);
558558                  memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w);
559559               }
560               break;               
561      case 0x11 :
560               break;
561      case 0x11 :
562562               {
563563                  // ROM
564564                  memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1));
r5932r5933
569569                  memory_install_read8_handler (space, 0x2000, 0xf7ff, 0, 0, SMH_BANK(3));
570570                  memory_install_write8_handler(space, 0x2000, 0xf7ff, 0, 0, SMH_BANK(4));
571571                  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);
573573                  // Keyboard
574574                  memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r);
575575                  memory_install_write8_handler(space, 0xf800, 0xf9ff, 0, 0, SMH_BANK(5));
r5932r5933
584584                  memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r);
585585                  memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w);
586586               }
587               break;                 
588      case 0x12 :
587               break;
588      case 0x12 :
589589               {
590590                  // ROM
591591                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
596596                  memory_install_read8_handler (space, 0x4000, 0xf7ff, 0, 0, SMH_BANK(3));
597597                  memory_install_write8_handler(space, 0x4000, 0xf7ff, 0, 0, SMH_BANK(4));
598598                  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);
600600                  // Keyboard
601601                  memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r);
602602                  memory_install_write8_handler(space, 0xf800, 0xf9ff, 0, 0, SMH_BANK(5));
r5932r5933
611611                  memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r);
612612                  memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w);
613613               }
614               break;                 
615      case 0x13 :
614               break;
615      case 0x13 :
616616               {
617617                  // RAM
618618                  memory_install_read8_handler (space, 0x0000, 0xf7ff, 0, 0, SMH_BANK(1));
619619                  memory_install_write8_handler(space, 0x0000, 0xf7ff, 0, 0, SMH_BANK(2));
620620                  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);
622622                  // Keyboard
623623                  memory_install_read8_handler (space, 0xf800, 0xf9ff, 0, 0, keyboard_r);
624624                  memory_install_write8_handler(space, 0xf800, 0xf9ff, 0, 0, SMH_BANK(3));
r5932r5933
633633                  memory_install_read8_handler (space, 0xfc00, 0xffff, 0, 0, text_r);
634634                  memory_install_write8_handler(space, 0xfc00, 0xffff, 0, 0, text_w);
635635               }
636               break;                                 
637      case 0x14 :
636               break;
637      case 0x14 :
638638               {
639639                  // ROM
640640                  memory_install_read8_handler (space, 0x0000, 0x5fff, 0, 0, SMH_BANK(1));
r5932r5933
651651                  memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w);
652652                  // System reg
653653                  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);
655655               }
656656               break;
657      case 0x15 :
657      case 0x15 :
658658               {
659659                  // ROM
660660                  memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1));
r5932r5933
671671                  memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w);
672672                  // System reg
673673                  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);
675675               }
676676               break;
677      case 0x16 :
677      case 0x16 :
678678               {
679679                  // ROM
680680                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
691691                  memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w);
692692                  // System reg
693693                  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);
695695               }
696696               break;
697      case 0x17 :
697      case 0x17 :
698698               {
699699                  // RAM
700700                  memory_install_read8_handler (space, 0x0000, 0xfdff, 0, 0, SMH_BANK(1));
r5932r5933
706706                  memory_install_write8_handler(space, 0xfe00, 0xfeff, 0, 0, devices_w);
707707                  // System reg
708708                  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);
710710               }
711711               break;
712      case 0x18 :
712      case 0x18 :
713713               {
714714                  // ROM
715715                  memory_install_read8_handler (space, 0x0000, 0x5fff, 0, 0, SMH_BANK(1));
r5932r5933
723723                  memory_set_bankptr(machine, 4, mess_ram + 0x6000);
724724                  // System reg
725725                  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);
727727                  // Video RAM
728728                  memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r);
729729                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
730730               }
731731               break;
732      case 0x19 :
732      case 0x19 :
733733               {
734734                  // ROM
735735                  memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1));
r5932r5933
743743                  memory_set_bankptr(machine, 4, mess_ram + 0x2000);
744744                  // System reg
745745                  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);
747747                  // Video RAM
748748                  memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r);
749749                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
750750               }
751751               break;
752      case 0x1A :
752      case 0x1A :
753753               {
754754                  // ROM
755755                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
763763                  memory_set_bankptr(machine, 4, mess_ram + 0x4000);
764764                  // System reg
765765                  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);
767767                  // Video RAM
768768                  memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r);
769769                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
770770               }
771771               break;
772      case 0x1B :
772      case 0x1B :
773773               {
774774                  // RAM
775775                  memory_install_read8_handler (space, 0x0000, 0xbeff, 0, 0, SMH_BANK(1));
r5932r5933
778778                  memory_set_bankptr(machine, 2, mess_ram);
779779                  // System reg
780780                  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);
782782                  // Video RAM
783783                  memory_install_read8_handler (space, 0xc000, 0xffff, 0, 0, gzu_r);
784784                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
785785               }
786786               break;
787      case 0x1C :
787      case 0x1C :
788788               {
789789                  // ROM
790790                  memory_install_read8_handler (space, 0x0000, 0x5fff, 0, 0, SMH_BANK(1));
r5932r5933
801801                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
802802               }
803803               break;
804      case 0x1D :
804      case 0x1D :
805805               {
806806                  // ROM
807807                  memory_install_read8_handler (space, 0x0000, 0x1fff, 0, 0, SMH_BANK(1));
r5932r5933
818818                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
819819               }
820820               break;
821      case 0x1E :
821      case 0x1E :
822822               {
823823                  // ROM
824824                  memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
r5932r5933
835835                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
836836               }
837837               break;
838      case 0x1F :
838      case 0x1F :
839839               {
840840                  // RAM
841841                  memory_install_read8_handler (space, 0x0000, 0xbfff, 0, 0, SMH_BANK(1));
r5932r5933
847847                  memory_install_write8_handler(space, 0xc000, 0xffff, 0, 0, gzu_w);
848848               }
849849               break;
850               
850
851851   }
852852}
853853
854854static READ8_DEVICE_HANDLER(pk8020_porta_r)
855{   
855{
856856   return 0xf0 | (takt <<1) | (text_attr)<<3;
857857}
858858
r5932r5933
861861   pk8020_video_page_access =(data>>6) & 3;
862862   attr = (data >> 4) & 3;
863863   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
868868   portc_data = data;
869869}
870870
r5932r5933
884884}
885885
886886static READ8_DEVICE_HANDLER(pk8020_portc_r)
887{   
887{
888888   return portc_data;
889889}
890890
r5932r5933
900900};
901901
902902static WRITE8_DEVICE_HANDLER(pk8020_2_portc_w)
903{     
903{
904904   const device_config *speaker = devtag_get_device(device->machine, "speaker");
905   
905
906906   sound_gate = BIT(data,3);
907   
907
908908   speaker_level_w(speaker, sound_gate ? sound_level : 0);
909909}
910910
r5932r5933
929929};
930930
931931static PIT8253_OUTPUT_CHANGED(pk8020_pit_out0)
932{   
932{
933933   const device_config *speaker = devtag_get_device(device->machine, "speaker");
934   
934
935935   sound_level = state;
936   
936
937937   speaker_level_w(speaker, sound_gate ? sound_level : 0);
938938}
939939
r5932r5933
943943}
944944
945945static PIT8253_OUTPUT_CHANGED(pk8020_pit_out2)
946{   
946{
947947   pic8259_set_irq_line(devtag_get_device(device->machine, "pic8259"),5,state);
948948}
949949
r5932r5933
967967};
968968
969969static 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}
973973
974974const struct pic8259_interface pk8020_pic8259_config = {
975975   pk8020_pic_set_int_line
976976};
977977
978978static IRQ_CALLBACK(pk8020_irq_callback)
979{   
979{
980980   return pic8259_acknowledge(devtag_get_device(device->machine, "pic8259"));
981}
981}
982982
983983MACHINE_RESET( pk8020 )
984984{
985985   const device_config *fdc = devtag_get_device(machine, "wd1793");
986986   pk8020_set_bank(machine,0);
987987   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
991991   sound_gate = 0;
992   sound_level = 0;   
992   sound_level = 0;
993993}
994994
995995INTERRUPT_GEN( pk8020_interrupt )
src/mess/machine/bbc.c
r5932r5933
33
44    MESS Driver By:
55
6   Gordon Jefferyes
7   mess_bbc@gjeffery.dircon.co.uk
6    Gordon Jefferyes
7    mess_bbc@gjeffery.dircon.co.uk
88
99******************************************************************************/
1010
r5932r5933
8585   if (bbc_rombank!=1)
8686   {
8787      memory_set_bankptr(space->machine, 4, memory_region(space->machine, "user1") + (bbc_rombank << 14));
88   }
89   else
88   }
89   else
9090   {
9191      memory_set_bankptr(space->machine, 4, memory_region(space->machine, "user2") + ((bbc_DFSType) << 14));
9292   }
r5932r5933
9595
9696WRITE8_HANDLER ( bbc_memoryb3_w )
9797{
98   if (bbc_RAMSize)
98   if (bbc_RAMSize)
9999   {
100100      memory_region(space->machine, "maincpu")[offset + 0x4000] = data;
101101      // this array is set so that the video emulator know which addresses to redraw
102102      bbc_vidmem[offset + 0x4000] = 1;
103   }
104   else
103   }
104   else
105105   {
106106      memory_region(space->machine, "maincpu")[offset] = data;
107107      bbc_vidmem[offset] = 1;
r5932r5933
127127      if (bbc_DFSType == 3) memory_region(space->machine, "user2")[((bbc_DFSType) << 14) + offset] = data;
128128   } else
129129   {
130      switch (bbc_SWRAMtype)
130      switch (bbc_SWRAMtype)
131131      {
132132         case 1:   if (bbc_SWRAMtype1[bbc_userport]) memory_region(space->machine, "user1")[(bbc_userport << 14) + offset] = data;
133133         case 2:   if (bbc_SWRAMtype2[bbc_rombank])  memory_region(space->machine, "user1")[(bbc_rombank << 14) + offset] = data;
r5932r5933
144144static int vdusel = 0;
145145
146146/*  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
151151*/
152152static int vdudriverset(running_machine *machine)
153153{
r5932r5933
170170      {
171171         /* if paged ram then set 8000 to afff to read from the ram 8000 to afff */
172172         memory_set_bankptr(space->machine, 4, memory_region(space->machine, "maincpu") + 0x8000);
173      }
174      else
173      }
174      else
175175      {
176176         /* if paged rom then set the rom to be read from 8000 to afff */
177177         memory_set_bankptr(space->machine, 4, memory_region(space->machine, "user1") + (bbc_rombank << 14));
r5932r5933
224224   {
225225      // not in shadow ram mode so just read normal ram
226226      memory_set_bankptr(space->machine, 2, ram + 0x3000);
227   }
228   else
227   }
228   else
229229   {
230230      if (vdudriverset(space->machine))
231231      {
232232         // if VDUDriver set then read from shadow ram
233233         memory_set_bankptr(space->machine, 2, ram + 0xb000);
234      }
235      else
234      }
235      else
236236      {
237237         // else read from normal ram
238238         memory_set_bankptr(space->machine, 2, ram + 0x3000);
r5932r5933
250250      // not in shadow ram mode so just write to normal ram
251251      ram[offset + 0x3000] = data;
252252      bbc_vidmem[offset + 0x3000] = 1;
253   }
254   else
253   }
254   else
255255   {
256256      if (vdudriverset(space->machine))
257257      {
258258         // if VDUDriver set then write to shadow ram
259259         ram[offset + 0xb000] = data;
260260         bbc_vidmem[offset + 0xb000] = 1;
261      }
262      else
261      }
262      else
263263      {
264264         // else write to normal ram
265265         ram[offset + 0x3000] = data;
r5932r5933
323323/*
324324ROMSEL - &FE30 write Only
325325B7 RAM 1=Page in ANDY &8000-&8FFF
326      0=Page in ROM  &8000-&8FFF
326       0=Page in ROM  &8000-&8FFF
327327B6 Not Used
328328B5 Not Used
329329B4 Not Used
r5932r5933
331331
332332ACCCON
333333
334b7 IRR   1=Causes an IRQ to the processor
334b7 IRR  1=Causes an IRQ to the processor
335335b6 TST  1=Selects &FC00-&FEFF read from OS-ROM
336336b5 IFJ  1=Internal 1 MHz bus
337      0=External 1MHz bus
337        0=External 1MHz bus
338338b4 ITU  1=Internal Tube
339      0=External Tube
340b3 Y   1=Read/Write HAZEL &C000-&DFFF RAM
341      0=Read/Write ROM &C000-&DFFF OS-ROM
342b2 X   1=Read/Write LYNNE
343      0=Read/WRITE main memory &3000-&8000
339        0=External Tube
340b3 Y    1=Read/Write HAZEL &C000-&DFFF RAM
341        0=Read/Write ROM &C000-&DFFF OS-ROM
342b2 X    1=Read/Write LYNNE
343        0=Read/WRITE main memory &3000-&8000
344344b1 E    1=Causes shadow if VDU code
345      0=Main all the time
346b0 D   1=Display LYNNE as screen
347      0=Display main RAM screen
345        0=Main all the time
346b0 D    1=Display LYNNE as screen
347        0=Display main RAM screen
348348
349349ACCCON is a read/write register
350350
r5932r5933
409409   if (ACCCON_Y)
410410   {
411411      memory_set_bankptr(space->machine, 7, memory_region(space->machine, "maincpu") + 0x9000);
412   }
413   else
412   }
413   else
414414   {
415415      memory_set_bankptr(space->machine, 7, memory_region(space->machine, "user1") + 0x40000);
416416   }
r5932r5933
421421   if (ACCCON_X)
422422   {
423423      memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0xb000 );
424   }
425   else
424   }
425   else
426426   {
427427      memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0x3000 );
428428   }
r5932r5933
460460   {
461461      memory_set_bankptr(space->machine, 4, memory_region(space->machine, "maincpu") + 0x8000);
462462      memory_set_bank(space->machine, 5, bbc_rombank);
463   }
464   else
463   }
464   else
465465   {
466466      memory_set_bankptr(space->machine, 4, memory_region(space->machine, "user1") + ((bbc_rombank) << 14));
467467      memory_set_bank(space->machine, 5, bbc_rombank);
r5932r5933
482482   if (ACCCON_X)
483483   {
484484      memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0xb000 );
485   }
486   else
485   }
486   else
487487   {
488488      if (ACCCON_E && bbcm_vdudriverset(space->machine))
489489      {
490490         memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0xb000 );
491      }
492      else
491      }
492      else
493493      {
494494         memory_set_bankptr( space->machine, 2, memory_region( space->machine, "maincpu" ) + 0x3000 );
495495      }
r5932r5933
507507   {
508508      ram[offset + 0xb000] = data;
509509      bbc_vidmem[offset + 0xb000] = 1;
510   }
511   else
510   }
511   else
512512   {
513513      if (ACCCON_E && bbcm_vdudriverset(space->machine))
514514      {
515515         ram[offset + 0xb000] = data;
516516         bbc_vidmem[offset + 0xb000] = 1;
517      }
518      else
517      }
518      else
519519      {
520520         ram[offset + 0x3000] = data;
521521         bbc_vidmem[offset + 0x3000] = 1;
r5932r5933
567567/******************************************************************************
568568&FC00-&FCFF FRED
569569&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
587587******************************************************************************/
588588
589589READ8_HANDLER ( bbcm_r )
r5932r5933
591591long myo;
592592
593593   /* 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//  };
598598
599599   if ((offset>=0x000) && (offset<=0x0ff)) /* FRED */
600600   {
r5932r5933
669669      if ((myo>=0x28) && (myo<=0x2f)) bbcm_wd1770_write(space, myo-0x28,data);     /* disc control latch */
670670      if ((myo>=0x30) && (myo<=0x33)) page_selectbm_w(space, myo-0x30,data);      /* page select */
671671      if ((myo>=0x34) && (myo<=0x37)) bbcm_ACCCON_write(space, myo-0x34,data);   /* ACCCON */
672      //if ((myo>=0x38) && (myo<=0x3f))                            /* NC ?? */
672      //if ((myo>=0x38) && (myo<=0x3f))                                   /* NC ?? */
673673      if ((myo>=0x40) && (myo<=0x5f)) via_w(via_0, myo-0x40, data);
674674      if ((myo>=0x60) && (myo<=0x7f)) via_w(via_1, myo-0x60, data);
675675      //if ((myo>=0x80) && (myo<=0x9f))
r5932r5933
687687
688688PA0-PA7
689689Port A forms a slow data bus to the keyboard sound and speech processors
690PortA   Keyboard
691D0   Pin 8
692D1   Pin 9
693D2   Pin 10
694D3   Pin 11
695D4   Pin 5
696D5   Pin 6
697D6   Pin 7
698D7   Pin 12
690PortA   Keyboard
691D0  Pin 8
692D1  Pin 9
693D2  Pin 10
694D3  Pin 11
695D4  Pin 5
696D5  Pin 6
697D6  Pin 7
698D7  Pin 12
699699
700700PB0-PB2 outputs
701701---------------
r5932r5933
772772B3 - Keyboard write enable
773773B4,B5 - these two outputs define the number to be added to the
774774start of screen address in hardware to control hardware scrolling:-
775Mode   Size   Start of screen    Number to add   B5      B4
7760,1,2   20K   &3000       12K      1       1
7773      16K   &4000       16K      0   0
7784,5      10K   &5800 (or &1800) 22K      1   0
7796      8K   &6000 (or &2000) 24K      0   1
775Mode    Size    Start of screen  Number to add  B5      B4
7760,1,2   20K &3000        12K        1       1
7773       16K &4000        16K        0   0
7784,5     10K &5800 (or &1800) 22K        1   0
7796       8K  &6000 (or &2000) 24K        0   1
780780B6 - Operates the CAPS lock LED  (Pin 17 keyboard connector)
781781B7 - Operates the SHIFT lock LED (Pin 16 keyboard connector)
782782
r5932r5933
823823      {
824824           /* KBD IC4 8 input NAND gate */
825825           /* set the value of via_system ca2, by checking for any keys
826              being pressed on the selected column */
826                being pressed on the selected column */
827827         if ((input_port_read(device->machine, colnames[column]) | 0x01) != 0xff)
828828         {
829829            via_ca2_w(via_0, 0, 1);
r5932r5933
861861         {
862862         /* KBD IC4 8 input NAND gate */
863863         /* set the value of via_system ca2, by checking for any keys
864            being pressed on the selected column */
864                being pressed on the selected column */
865865         if ((input_port_read(device->machine, colnames[column]) | 0x01) != 0xff)
866866         {
867867            via_ca2_w(via_0, 0, 1);
868         }
869         else
868         }
869         else
870870         {
871871            via_ca2_w(via_0, 0, 0);
872872         }
873873
874      }
875      else
874      }
875      else
876876      {
877877         via_ca2_w(via_0, 0, 0);
878878      }
r5932r5933
952952         {
953953            via_system_porta=mc146818_port_r(space, 1);
954954            //logerror("read 146818 data %d \n",via_system_porta);
955         }
956         else
955         }
956         else
957957         {
958958            mc146818_port_w(space, 1, via_system_porta);
959959            //logerror("write 146818 data %d \n",via_system_porta);
r5932r5933
10001000
10011001    //logerror("SYSTEM write portb %d %d %d\n",data,bit,value);
10021002
1003   if (value)
1003   if (value)
10041004   {
1005      switch (bit)
1005      switch (bit)
10061006      {
10071007      case 0:
1008         if (b0_sound == 0)
1008         if (b0_sound == 0)
10091009         {
10101010            b0_sound = 1;
10111011         }
r5932r5933
10191019               MC146818_WR = 1;
10201020               MC146818_set(space);
10211021            }
1022         }
1023         else
1022         }
1023         else
10241024         {
10251025            if (b1_speech_read == 0)
10261026            {
r5932r5933
10381038               MC146818_DS = 1;
10391039               MC146818_set(space);
10401040            }
1041         }
1042         else
1041         }
1042         else
10431043         {
1044            if (b2_speech_write == 0)
1044            if (b2_speech_write == 0)
10451045            {
10461046               /* VSP TMS 5220 */
10471047               b2_speech_write = 1;
r5932r5933
10491049         }
10501050         break;
10511051      case 3:
1052         if (b3_keyboard == 0)
1052         if (b3_keyboard == 0)
10531053         {
10541054            b3_keyboard = 1;
10551055         }
10561056         break;
10571057      case 4:
1058         if (b4_video0 == 0)
1058         if (b4_video0 == 0)
10591059         {
10601060            b4_video0 = 1;
10611061            bbc_setscreenstart(b4_video0, b5_video1);
10621062         }
10631063         break;
10641064      case 5:
1065         if (b5_video1 == 0)
1065         if (b5_video1 == 0)
10661066         {
10671067            b5_video1 = 1;
10681068            bbc_setscreenstart(b4_video0, b5_video1);
10691069         }
10701070         break;
10711071      case 6:
1072         if (b6_caps_lock_led == 0)
1072         if (b6_caps_lock_led == 0)
10731073         {
10741074            b6_caps_lock_led = 1;
10751075            /* call caps lock led update */
10761076         }
10771077         break;
10781078      case 7:
1079         if (b7_shift_lock_led == 0)
1079         if (b7_shift_lock_led == 0)
10801080         {
10811081            b7_shift_lock_led = 1;
10821082            /* call shift lock led update */
10831083         }
10841084         break;
10851085      }
1086   }
1087   else
1086   }
1087   else
10881088   {
1089      switch (bit)
1089      switch (bit)
10901090      {
10911091      case 0:
1092         if (b0_sound == 1)
1092         if (b0_sound == 1)
10931093         {
10941094            b0_sound = 0;
10951095            sn76496_w(devtag_get_device(space->machine, "sn76489"), 0, via_system_porta);
r5932r5933
11041104               MC146818_WR = 0;
11051105               MC146818_set(space);
11061106            }
1107         }
1108         else
1107         }
1108         else
11091109         {
1110            if (b1_speech_read == 1)
1110            if (b1_speech_read == 1)
11111111            {
11121112               /* VSP TMS 5220 */
11131113               b1_speech_read = 0;
r5932r5933
11231123               MC146818_DS = 0;
11241124               MC146818_set(space);
11251125            }
1126         }
1127         else
1126         }
1127         else
11281128         {
1129            if (b2_speech_write == 1)
1129            if (b2_speech_write == 1)
11301130            {
11311131               /* VSP TMS 5220 */
11321132               b2_speech_write = 0;
r5932r5933
11341134         }
11351135         break;
11361136      case 3:
1137         if (b3_keyboard == 1)
1137         if (b3_keyboard == 1)
11381138         {
11391139            b3_keyboard = 0;
11401140            /* *** call keyboard enabled *** */
r5932r5933
11421142         }
11431143         break;
11441144      case 4:
1145         if (b4_video0 == 1)
1145         if (b4_video0 == 1)
11461146         {
11471147            b4_video0 = 0;
11481148            bbc_setscreenstart(b4_video0, b5_video1);
11491149         }
11501150         break;
11511151      case 5:
1152         if (b5_video1 == 1)
1152         if (b5_video1 == 1)
11531153         {
11541154            b5_video1 = 0;
11551155            bbc_setscreenstart(b4_video0, b5_video1);
11561156         }
11571157         break;
11581158      case 6:
1159         if (b6_caps_lock_led == 1)
1159         if (b6_caps_lock_led == 1)
11601160         {
11611161            b6_caps_lock_led = 0;
11621162            /* call caps lock led update */
11631163         }
11641164         break;
11651165      case 7:
1166         if (b7_shift_lock_led == 1)
1166         if (b7_shift_lock_led == 1)
11671167         {
11681168            b7_shift_lock_led = 0;
11691169            /* call shift lock led update */
r5932r5933
12101210
12111211//void bbc_TMSint(int status)
12121212//{
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)));
12161216//}
12171217
12181218
12191219
12201220static READ8_DEVICE_HANDLER( bbcb_via_system_read_portb )
12211221{
1222//   TMSint=(!tms5220_int_r())&1;
1223//   TMSrdy=(!tms5220_readyq_r())&1;
1222//  TMSint=(!tms5220_int_r())&1;
1223//  TMSrdy=(!tms5220_readyq_r())&1;
12241224
12251225   //logerror("SYSTEM read portb %d\n",0xf | input_port(machine, "IN0")|(TMSint<<6)|(TMSrdy<<7));
12261226
r5932r5933
14381438   {
14391439      cassette_change_state(devtag_get_device(machine, "cassette"), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
14401440      timer_adjust_periodic(bbc_tape_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100));
1441   }
1442   else
1441   }
1442   else
14431443   {
14441444      cassette_change_state(devtag_get_device(machine, "cassette"), CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
14451445      timer_reset(bbc_tape_timer, attotime_never);
r5932r5933
14681468{
14691469   /* I'm assuming that the nmi is edge triggered */
14701470   /* 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 */
14731473   /* I'll emulate it like this to be sure */
14741474
14751475   if (state!=previous_i8271_int_state)
r5932r5933
14771477      if (state)
14781478      {
14791479         /* I'll pulse it because if I used hold-line I'm not sure
1480         it would clear - to be checked */
1480            it would clear - to be checked */
14811481         cpu_set_input_line(cputag_get_cpu(device->machine, "maincpu"), INPUT_LINE_NMI,PULSE_LINE);
14821482      }
14831483   }
r5932r5933
15841584{
15851585   int bbc_state;
15861586   /* 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.
15921592
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    */
15971597
15981598   logerror("callback $%02X\n", state);
15991599
r5932r5933
16391639   }
16401640
16411641   /* nmi is edge triggered, and triggers when the state goes from clear->set.
1642   Here we are checking this transition before triggering the nmi */
1642    Here we are checking this transition before triggering the nmi */
16431643   if (bbc_state!=previous_wd177x_int_state)
16441644   {
16451645      if (bbc_state)
16461646      {
16471647         /* I'll pulse it because if I used hold-line I'm not sure
1648         it would clear - to be checked */
1648            it would clear - to be checked */
16491649         cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI,PULSE_LINE);
16501650      }
16511651   }
r5932r5933
17451745
17461746/*********************************************
17471747OPUS CHALLENGER MEMORY MAP
1748      Read                  Write
1748        Read                        Write
17491749
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
17551755
17561756
17571757drive control register bits
17580   select side 0= side 0   1= side 1
17580   select side 0= side 0   1= side 1
175917591   select drive 0
176017602   select drive 1
176117613   ?unused?
r5932r5933
17671767The RAM is accessible through JIM (page &FD). One page is visible in JIM at a time.
17681768The selected page is controlled by the two paging registers:
17691769
1770&FCFE      Paging register MSB
1770&FCFE       Paging register MSB
17711771&FCFF       Paging register LSB
17721772
17731773256K model has 1024 pages &000 to &3ff
17741774512K model has 2048 pages &000 to &7ff
17751775
1776AM_RANGE(0xfc00, 0xfdff) AM_READWRITE(bbc_opus_read     , bbc_opus_write   )
1776AM_RANGE(0xfc00, 0xfdff) AM_READWRITE(bbc_opus_read     , bbc_opus_write    )
17771777
17781778
17791779**********************************************/
r5932r5933
18291829               return wd17xx_data_r(fdc, 0);
18301830         }
18311831
1832      }
1833      else
1832      }
1833      else
18341834      {
18351835         return memory_region(space->machine, "disks")[offset + (opusbank << 8)];
18361836      }
r5932r5933
18711871               opusbank=(opusbank & 0xff00) | data;
18721872               break;
18731873         }
1874      }
1875      else
1874      }
1875      else
18761876      {
18771877         memory_region(space->machine, "disks")[offset + (opusbank << 8)] = data;
18781878      }
r5932r5933
19631963      wd17xx_set_density(fdc,DEN_MFM_LO);
19641964   }
19651965
1966//   bbc_1770_IntEnabled=(((data>>4) & 0x01)==0);
1966//  bbc_1770_IntEnabled=(((data>>4) & 0x01)==0);
19671967   bbc_1770_IntEnabled=1;
19681968
19691969}
r5932r5933
20352035
20362036   size = image_length (image);
20372037
2038   if (strcmp(image->tag,"cart1") == 0)
2038   if (strcmp(image->tag,"cart1") == 0)
20392039   {
20402040      index = 0;
20412041   }
2042   if (strcmp(image->tag,"cart2") == 0)
2042   if (strcmp(image->tag,"cart2") == 0)
20432043   {
20442044      index = 1;
20452045   }
2046   if (strcmp(image->tag,"cart3") == 0)
2046   if (strcmp(image->tag,"cart3") == 0)
20472047   {
20482048      index = 2;
20492049   }
2050   if (strcmp(image->tag,"cart4") == 0)
2050   if (strcmp(image->tag,"cart4") == 0)
20512051   {
20522052      index = 3;
20532053   }
r5932r5933
20572057   logerror("loading rom %s at %.4x size:%.4x\n", image_filename(image), addr, size);
20582058
20592059
2060   switch (size)
2060   switch (size)
20612061   {
20622062   case 0x2000:
20632063      read_ = image_fread(image, mem + addr, size);
r5932r5933
21242124
21252125   /*set up the required disc controller*/
21262126   //switch (bbc_DFSType) {
2127   //case 0:   case 1: case 2: case 3:
2127   //case 0:   case 1: case 2: case 3:
21282128      previous_i8271_int_state=0;
2129   //   break;
2129   //  break;
21302130   //case 4: case 5: case 6:
21312131      previous_wd177x_int_state=1;
2132   //   break;
2132   //  break;
21332133   //}
21342134}
21352135
r5932r5933
21462146      /* 32K Model B */
21472147      memory_set_bankptr(machine, 3, ram + 0x4000);
21482148      bbc_set_video_memory_lookups(32);
2149   }
2150   else
2149   }
2150   else
21512151   {
21522152      /* 16K just repeat the lower 16K*/
21532153      memory_set_bankptr(machine, 3, ram);
r5932r5933
21632163   opusbank = 0;
21642164   /*set up the required disc controller*/
21652165   //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;
21682168   //case 4: case 5: case 6:
2169   //   break;
2169   //  break;
21702170   //}
21712171}
21722172
r5932r5933
22132213
22142214MACHINE_RESET( bbcm )
22152215{
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 */
22182218   memory_set_bankptr(machine, 4, memory_region(machine, "user1"));         /* bank 4 is paged ROM or RAM   from 8000 to 8fff */
22192219   memory_set_bank(machine, 5, 0);
2220   memory_set_bankptr(machine, 7, memory_region(machine, "user1") + 0x40000); /* bank 6 OS rom of RAM         from c000 to dfff */
2220   memory_set_bankptr(machine, 7, memory_region(machine, "user1") + 0x40000); /* bank 6 OS rom of RAM          from c000 to dfff */
22212221
22222222   bbcb_IC32_initialise();
22232223
src/mess/machine/sgi.h
r5932r5933
11/*********************************************************************
22
3   sgi.h
3    sgi.h
44
5   Silicon Graphics MC (Memory Controller) code
5    Silicon Graphics MC (Memory Controller) code
66
77*********************************************************************/
88
src/mess/machine/kc.c
r5932r5933
157157
158158
159159   /* bits 1,0 of i/o address define 256 byte block to access.
160   bits 15-8 define the byte offset in the 256 byte block selected */
160    bits 15-8 define the byte offset in the 256 byte block selected */
161161   addr = ((offset & 0x03)<<8) | ((offset>>8) & 0x0ff);
162162
163163   logerror("interface ram w: %04x %02x\n",addr,data);
r5932r5933
243243*/
244244
245245/*
246   Module ID      Module Name         Module Description
246    Module ID       Module Name         Module Description
247247
248248
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
252252
253253
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
266266*/
267267
268268
r5932r5933
282282/*
283283static const struct kc85_module kc85_v24_module=
284284{
285   0x0ee,
286   "M003",
287   "V24"
285    0x0ee,
286    "M003",
287    "V24"
288288};
289289*/
290290static const struct kc85_module kc85_disk_interface_device=
r5932r5933
297297static const struct kc85_module *modules[256>>2];
298298/*
299299
300   port xx80
300    port xx80
301301
302   - xx is module id.
302    - xx is module id.
303303
304304
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.
307307
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.
310310  */
311311
312312/* bus drivers 4 */
r5932r5933
362362/**********************/
363363/* used by KC85/4 and KC85/3 */
364364/*
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.
371371
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.
374374*/
375375
376376
r5932r5933
388388   int bit;
389389
390390   /* the cassette data is linked to /astb input of
391   the pio. */
391    the pio. */
392392
393393   bit = 0;
394394
r5932r5933
434434/*
435435  pin 2 = gnd
436436  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??
439439  pin 5 = motor on
440440
441441
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?
446446
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.
449449
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.
453453
454454
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.
458458
459459
460460
r5932r5933
479479
480480  E-mail from Torsten Paul about the keyboard:
481481
482   Torsten.Paul@gmx.de
482    Torsten.Paul@gmx.de
483483
484484"> I hope that you will be able to help me so I can add keyboard
485485> emulation to it.
r5932r5933
558558
559559/*
560560
561   The CTC timer 3 count is initialised at 0x08f and counts down.
561    The CTC timer 3 count is initialised at 0x08f and counts down.
562562
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!
566566
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.
569569
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.
572572
573   Summary From code below:
573    Summary From code below:
574574
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"
580580
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.
583583
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.
587587
588588
589   Keyboard reading procedure extracted from KC85/4 system rom:
589    Keyboard reading procedure extracted from KC85/4 system rom:
590590
5915910345  f5        push    af
5920346  db8f      in      a,(#8f)         ; get CTC timer 3 count
5920346  db8f      in      a,(#8f)         ; get CTC timer 3 count
5935930348  f5        push    af
5940349  3ea7      ld      a,#a7         ; channel 3, enable int, select counter mode, control word
595                              ; write, software reset, time constant follows
5940349  3ea7      ld      a,#a7           ; channel 3, enable int, select counter mode, control word
595                                        ; write, software reset, time constant follows
596596034b  d38f      out     (#8f),a
597034d  3e8f      ld      a,#8f         ; time constant
597034d  3e8f      ld      a,#8f           ; time constant
598598034f  d38f      out     (#8f),a
5995990351  f1        pop     af
600600
6016010352  fb        ei
6020353  b7        or      a            ; count is over
6020353  b7        or      a               ; count is over
6036030354  284d      jr      z,#03a3         ;
604604
605   ;; check count is in range
605    ;; check count is in range
6066060356  fe14      cp      #14
6076070358  3849      jr      c,#03a3         ;
608608035a  fe78      cp      #78
609609035c  3045      jr      nc,#03a3        ;
610610
611   ;; at this point, time must be between #14 and #77 to be valid
611    ;; at this point, time must be between #14 and #77 to be valid
612612
613   ;; if >=#65, then carry=0, and a 0 bit has been detected
613    ;; if >=#65, then carry=0, and a 0 bit has been detected
614614
615615035e  fe65      cp      #65
6166160360  303d      jr      nc,#039f        ; (61)
617617
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
620620
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.
623623
6246240362  c6be      add     a,#be
6256250364  3839      jr      c,#039f         ; (57)
626626
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???
6296290366  e5        push    hl
6306300367  d5        push    de
631   ;; convert hardware scan-code into os code
631    ;; convert hardware scan-code into os code
6326320368  dd7e0c    ld      a,(ix+#0c)
633633036b  1f        rra
634634036c  ee01      xor     #01
r5932r5933
6416410379  d1        pop     de
642642037a  e1        pop     hl
643643
644   ;; shift lock pressed?
644    ;; shift lock pressed?
645645037b  ddcb087e  bit     7,(ix+#08)
646646037f  200a      jr      nz,#038b
647   ;; no.
647    ;; no.
648648
649   ;; alpha char?
649    ;; alpha char?
6506500381  fe40      cp      #40
6516510383  3806      jr      c,#038b
6526520385  fe80      cp      #80
6536530387  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
6566560389  ee20      xor     #20
657657
658038b  ddbe0d    cp      (ix+#0d)      ;; same as stored?
658038b  ddbe0d    cp      (ix+#0d)        ;; same as stored?
659659038e  201d      jr      nz,#03ad
660660
661    ;; yes - must be held for a certain time before it can repeat?
661    ;; yes - must be held for a certain time before it can repeat?
6626620390  f5        push    af
6636630391  3ae0b7    ld      a,(#b7e0)
6646640394  ddbe0a    cp      (ix+#0a)
6656650397  3811      jr      c,#03aa
6666660399  f1        pop     af
667667
668039a  dd340a    inc     (ix+#0a)      ;; incremenent repeat count?
668039a  dd340a    inc     (ix+#0a)        ;; incremenent repeat count?
669669039d  1804      jr      #03a3
670670
671   ;; update scan-code received so far
671    ;; update scan-code received so far
672672
673039f  ddcb0c1e  rr      (ix+#0c)      ; shift in 0 or 1 bit depending on what has been selected
673039f  ddcb0c1e  rr      (ix+#0c)        ; shift in 0 or 1 bit depending on what has been selected
674674
67503a3  db89      in      a,(#89)         ; used to clear brdy
67503a3  db89      in      a,(#89)         ; used to clear brdy
67667603a5  d389      out     (#89),a
67767703a7  f1        pop     af
67867803a8  ed4d      reti
r5932r5933
73873801b3  3054      jr      nc,#0209
739739
740740
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
744744
74574501b5  fe44      cp      #44
74674601b7  3053      jr      nc,#020c
r5932r5933
823823static unsigned char kc_brdy;
824824
825825/*
826   The kc keyboard is seperate from the kc base unit.
826    The kc keyboard is seperate from the kc base unit.
827827
828   The keyboard emulation uses 2 timers:
828    The keyboard emulation uses 2 timers:
829829
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.
832832*/
833833
834834static kc_keyboard keyboard_data;
r5932r5933
12221222   {
12231223      LOG(("no memory at ram0!\n"));
12241224
1225//      memory_set_bankptr(machine, 1,memory_region(machine, "maincpu") + 0x013000);
1225//      memory_set_bankptr(machine, 1,memory_region(machine, "maincpu") + 0x013000);
12261226      /* ram is disabled */
12271227      memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_NOP);
12281228      memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_NOP);
r5932r5933
13971397         speaker_level = (data>>1) & 0x0f;
13981398
13991399         /* this might not be correct, the range might
1400         be logarithmic and not linear! */
1400            be logarithmic and not linear! */
14011401         speaker_level_w(speaker, (speaker_level<<4));
14021402      }
14031403      break;
r5932r5933
16431643         speaker_level = (data>>1) & 0x0f;
16441644
16451645         /* this might not be correct, the range might
1646         be logarithmic and not linear! */
1646            be logarithmic and not linear! */
16471647         speaker_level_w(speaker, (speaker_level<<4));
16481648      }
16491649      break;
r5932r5933
18731873
18741874#if 0
18751875   /* 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 */
18801880   memory_set_direct_update_handler(0, kc85_4_opbaseoverride);
18811881#endif
18821882}
r5932r5933
19071907
19081908#if 0
19091909   /* 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 */
19141914   memory_set_direct_update_handler(0, kc85_3_opbaseoverride);
19151915#endif
19161916}
src/mess/drivers/vip.c
r5932r5933
66----------
77
88|-------------------------------------------------------------------------------|
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|                                                                               |
3232|-------------------------------------------------------------------------------|
3333
3434Notes:
3535    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
5236
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
5353*/
5454
5555/*
5656
5757    TODO:
5858
59   - second VP580 keypad
59    - second VP580 keypad
6060
61   - VP-585 Expansion Keyboard Interface (2 keypad connectors for VP-580)
61    - VP-585 Expansion Keyboard Interface (2 keypad connectors for VP-580)
6262    - VP-551 Super Sound Board (4 channel sound)
6363    - VP-601/611 ASCII Keyboard (VP-601 58 keys, VP611 58 keys + 16 keys numerical keypad)
6464    - VP-700 Expanded Tiny Basic Board (4 KB ROM expansion)
r5932r5933
6767
6868/*
6969
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.
7777
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.
8181
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.
8888
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.
9292
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.
9595
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.
101101
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.
107107
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.
112112
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.
119119
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.
126126
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.
130130
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.
135135
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.
139139
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.
144144
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.
149149
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.
153153
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.
157157
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".
161161
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.
165165
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.
169169
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.
173173
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.
177177
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.
181181
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.
185185
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.
189189
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.
193193
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.
197197
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.
202202
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.
206206
207   VP-720 Game Manual II More exciting games. Available mid-1980. $15
207    VP-720 Game Manual II More exciting games. Available mid-1980. $15
208208
209   VP-311 VP-711 Instruction Manual (Included with VP-711) $5
209    VP-311 VP-711 Instruction Manual (Included with VP-711) $5
210210
211   VP-320 VP-711 User Guide Manual (Included with VP-711) $5
211    VP-320 VP-711 User Guide Manual (Included with VP-711) $5
212212
213   MPM-201B CDP1802 User Manual (Included with VP-711) $5
213    MPM-201B CDP1802 User Manual (Included with VP-711) $5
214214
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.
217217
218218*/
219219
r5932r5933
310310static ADDRESS_MAP_START( vip_io_map, ADDRESS_SPACE_IO, 8 )
311311   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1861_TAG, vip_cdp1861_dispon_r, vip_cdp1861_dispoff_w)
312312   AM_RANGE(0x02, 0x02) AM_WRITE(keylatch_w)
313//   AM_RANGE(0x03, 0x03) AM_DEVWRITE(CDP1863_TAG, cdp1863_str_w)
313//  AM_RANGE(0x03, 0x03) AM_DEVWRITE(CDP1863_TAG, cdp1863_str_w)
314314   AM_RANGE(0x04, 0x04) AM_WRITE(bankswitch_w)
315//   AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1862_TAG, cdp1862_bkg_w)
315//  AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1862_TAG, cdp1862_bkg_w)
316316ADDRESS_MAP_END
317317
318318/* Input Ports */
r5932r5933
364364   PORT_CONFSETTING( 0x02, "2x VP-580 Expansion Keyboard" )
365365   PORT_CONFSETTING( 0x03, "VP-601 ASCII Keyboard" )
366366   PORT_CONFSETTING( 0x04, "VP-611 ASCII/Numeric Keyboard" )
367   
367
368368   PORT_START("VIDEO")
369369   PORT_CONFNAME( 0x01, 0x00, "Video")
370370   PORT_CONFSETTING( 0x00, "Standard" )
r5932r5933
440440
441441   state->a12 = (offset & 0x1000) ? 1 : 0;
442442
443   if (!state->a12)
443   if (!state->a12)
444444   {
445445      /* mask out A4 and A3 */
446446      mask = 0xe7;
r5932r5933
535535
536536static CDP1802_SC_WRITE( vip_sc_w )
537537{
538//   vip_state *driver_state = device->machine->driver_data;
538//  vip_state *driver_state = device->machine->driver_data;
539539
540540   switch (input_port_read(device->machine, "SOUND"))
541541   {
r5932r5933
595595      {
596596         UINT8 mask = 0xff;
597597
598         if (!state->a12)
598         if (!state->a12)
599599         {
600600            /* mask out A4 and A3 */
601601            mask = 0xe7;
602602         }
603603
604604         state->color = state->colorram[offset & mask];
605         
605
606606         cdp1862_dma_w(state->cdp1862, offset, data);
607607      }
608608      break;
r5932r5933
674674static MACHINE_RESET( vip )
675675{
676676   vip_state *state = machine->driver_data;
677   
677
678678   const address_space *program = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM);
679679   const address_space *io = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_IO);
680680
r5932r5933
853853
854854/* System Drivers */
855855
856/*     YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT   INIT    CONFIG  COMPANY FULLNAME            FLAGS */
856/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT   INIT    CONFIG  COMPANY FULLNAME                FLAGS */
857857COMP( 1977, vip,   0,      0,      vip,      vip,   0,      vp711,   "RCA",   "Cosmac VIP (VP-711)",   GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS )
858858COMP( 1977, vp111,   vip,   0,      vip,      vip,   0,      vp111,   "RCA",   "Cosmac VIP (VP-111)",   GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS )
src/mess/drivers/dgn_beta.c
r5932r5933
316316   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
317317
318318   MDRV_VIDEO_UPDATE( dgnbeta )
319   
319
320320   MDRV_PIA6821_ADD( "pia_0", dgnbeta_pia_intf[0] )
321321   MDRV_PIA6821_ADD( "pia_1", dgnbeta_pia_intf[1] )
322322   MDRV_PIA6821_ADD( "pia_2", dgnbeta_pia_intf[2] )
323323
324   MDRV_WD179X_ADD("wd179x", dgnbeta_wd17xx_interface )   
325   
324   MDRV_WD179X_ADD("wd179x", dgnbeta_wd17xx_interface )
325
326326   MDRV_FLOPPY_4_DRIVES_ADD(dgnbeta_floppy_config)
327327MACHINE_DRIVER_END
328328
src/mess/drivers/elf.c
r5932r5933
66
77/*
88
9   TODO:
9    TODO:
1010
11   - proper layout
11    - proper layout
1212
1313*/
1414
r5932r5933
160160{
161161   /*
162162        EF1     CDP1861
163        EF2     
164        EF3     
163        EF2
164        EF3
165165        EF4     input switch
166166    */
167167
r5932r5933
365365
366366/* System Drivers */
367367
368/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY         FULLNAME   FLAGS */
368/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY         FULLNAME    FLAGS */
369369COMP( 1978, elf2,   0,      0,      elf2,   elf2,   0,      elf2,   "Netronics",   "Elf II",   GAME_SUPPORTS_SAVE )
src/mess/drivers/homelab.c
r5932r5933
3232
3333/* Address maps */
3434static 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
3737    AM_RANGE( 0x1000, 0x17ff ) AM_ROM  // ROM 3
3838    AM_RANGE( 0x1800, 0x1fff ) AM_ROM  // ROM 4
3939    AM_RANGE( 0x2000, 0x27ff ) AM_ROM  // ROM 5
r5932r5933
4141   AM_RANGE( 0x3000, 0x37ff ) AM_ROM  // Empty
4242   AM_RANGE( 0x3800, 0x3fff ) AM_READWRITE(homelab_keyboard_r,homelab_keyboard_w)
4343    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
4545ADDRESS_MAP_END
4646
4747static ADDRESS_MAP_START(homelab3_mem, ADDRESS_SPACE_PROGRAM, 8)
48    AM_RANGE( 0x0000, 0x3fff ) AM_ROM
48    AM_RANGE( 0x0000, 0x3fff ) AM_ROM
4949    AM_RANGE( 0x4000, 0x7fff ) AM_RAM
5050    //AM_RANGE( 0xe000, 0xefff ) AM_RAM // Keyboard
5151    AM_RANGE( 0xf000, 0xf7ff ) AM_RAM AM_MIRROR(0x0800)// Video RAM
5252ADDRESS_MAP_END
53                                             
53
5454/* Input ports */
5555static INPUT_PORTS_START( homelab )
5656   PORT_START("LINE0")
r5932r5933
6363   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
6464   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
6565   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)
6767   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t')
6868   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Run/Brk") PORT_CODE(KEYCODE_RCONTROL)
6969
r5932r5933
150150static MACHINE_DRIVER_START( homelab3 )
151151/* basic machine hardware */
152152   MDRV_IMPORT_FROM(homelab)
153     MDRV_CPU_MODIFY("maincpu")     
153     MDRV_CPU_MODIFY("maincpu")
154154   MDRV_CPU_PROGRAM_MAP(homelab3_mem)
155   
155
156156   MDRV_SCREEN_MODIFY("screen")
157157   MDRV_SCREEN_SIZE(80*8, 25*8)
158158   MDRV_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*8-1)
159159   MDRV_VIDEO_UPDATE( homelab3 )
160   
160
161161MACHINE_DRIVER_END
162162
163163/* ROM definition */
src/mess/drivers/dectalk.c
r5932r5933
1111*  Special thanks to leeeeee for helping figure out what the led selftest codes actually mean
1212*
1313*  TODO:
14*  * DUART:
14*  * DUART:
1515*    * 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:
1717*    * pins IP0, IP2, and IP3 are connected to the primary serial port:
1818*      * IP0 is CTS
1919*      * IP2 is DSR
r5932r5933
595595/*
596596Address maps (x = ignored; * = selects address within this range)
59759768k address map:
598a23   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)
5990   x   x   x   0   x   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *      R   ROM
6000   x   x   x   1   x   x   0   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *      RW   RAM (first 4 chip pairs)
6010   x   x   x   1   x   x   1   0   0   *   *   *   *   *   *   *   *   *   *   *   *   *   *      RW   RAM (last chip pair)
6020   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>
6030   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)
6040   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)
6050   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)
6060   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]
6070   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)
6080   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]
6090   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           |              |              |              |              |
598a23 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)
5990   x   x   x   0   x   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *       R   ROM
6000   x   x   x   1   x   x   0   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *       RW  RAM (first 4 chip pairs)
6010   x   x   x   1   x   x   1   0   0   *   *   *   *   *   *   *   *   *   *   *   *   *   *       RW  RAM (last chip pair)
6020   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>
6030   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)
6040   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)
6050   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)
6060   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]
6070   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)
6080   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]
6090   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              |               |               |               |               |
611611*/
612612
613613static ADDRESS_MAP_START(m68k_mem, ADDRESS_SPACE_PROGRAM, 16)
r5932r5933
786786 Drivers
787787******************************************************************************/
788788
789/*    YEAR   NAME      PARENT   COMPAT   MACHINE      INPUT      INIT      CONFIG      COMPANY      FULLNAME         FLAGS */
789/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT        CONFIG      COMPANY     FULLNAME            FLAGS */
790790COMP( 1984, dectalk,   0,      0,      dectalk,   dectalk,   dectalk,   0,   "DEC",      "DECTalk DTC-01",   GAME_NOT_WORKING )
src/mess/drivers/jaguar.c
r5932r5933
314314   int i;
315315   static const char *const keynames[2][8] =
316316         {
317            { "JOY0", "JOY1", "JOY2", "JOY3",
317            { "JOY0", "JOY1", "JOY2", "JOY3",
318318                  "JOY4", "JOY5", "JOY6", "JOY7" },
319            { "BUTTONS0", "BUTTONS1", "BUTTONS2", "BUTTONS3",
319            { "BUTTONS0", "BUTTONS1", "BUTTONS2", "BUTTONS3",
320320                  "BUTTONS4", "BUTTONS5", "BUTTONS6", "BUTTONS7" }
321321         };
322322
r5932r5933
469469   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
470470   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
471471   PORT_BIT( 0xf0ff, IP_ACTIVE_LOW, IPT_UNUSED )
472   
472
473473   PORT_START("JOY1")
474474   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1) PORT_PLAYER(1)
475475   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4) PORT_PLAYER(1)
r5932r5933
554554   PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNUSED )
555555
556556   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")
560560   PORT_CONFNAME( 0x04, 0x04, "TV System")
561561   PORT_CONFSETTING(    0x00, "PAL")
562562   PORT_CONFSETTING(    0x04, "NTSC")
src/mess/drivers/comxpl80.c
r5932r5933
2323{
2424   /*
2525
26      bit      description
26        bit     description
2727
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
3636
37   */
37    */
3838
3939   comxpl80_state *state = space->machine->driver_data;
4040
r5932r5933
5454
5555      state->plotter_data = memory_region(space->machine, "gfx2")[font_rom | state->font_addr];
5656   }
57   
57
5858   if (!BIT(data, 6))
5959   {
6060      // read data from Centronics bus
r5932r5933
7272{
7373   /*
7474
75      bit      description
75        bit     description
7676
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
8585
86   */
86    */
8787
8888   comxpl80_state *state = space->machine->driver_data;
8989
r5932r5933
9696{
9797   /*
9898
99      bit      description
99        bit     description
100100
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
109109
110   */
110    */
111111
112112   comxpl80_state *state = space->machine->driver_data;
113113
r5932r5933
123123{
124124   /*
125125
126      bit      description
126        bit     description
127127
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
136136
137   */
137    */
138138
139139   comxpl80_state *state = space->machine->driver_data;
140140
r5932r5933
145145
146146static ADDRESS_MAP_START( pl80_map, ADDRESS_SPACE_PROGRAM, 8 )
147147   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)*/
158158   AM_RANGE(0x00a, 0x01f) AM_NOP // Not Used
159159   AM_RANGE(0x020, 0x07f) AM_RAM // Internal RAM
160160   AM_RANGE(0x080, 0xf7f) AM_ROM // Internal ROM
r5932r5933
215215
216216/* System Drivers */
217217
218//    YEAR  NAME      PARENT  COMPAT   MACHINE      INPUT     INIT   CONFIG   COMPANY                     FULLNAME      FLAGS
218//    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT     INIT  CONFIG  COMPANY                         FULLNAME        FLAGS
219219COMP( 1987, comxpl80,   0,      0,      comxpl80,   comxpl80, 0,    0,      "Comx World Operations Ltd",   "COMX PL-80",   GAME_NOT_WORKING | GAME_NO_SOUND )
src/mess/drivers/bob85.c
r5932r5933
3636         case 0x20 : retVal = 0x85; break;
3737         case 0x40 : retVal = 0x86; break;
3838         case 0x80 : retVal = 0x87; break;
39         default : retVal = 0; break;           
39         default : retVal = 0; break;
4040      }
4141   }
4242   if (line1!=0) {
r5932r5933
6060         case 0x08 : retVal |= 0xC0; break;
6161         case 0x10 : retVal |= 0xD0; break;
6262         case 0x20 : retVal |= 0xF0; break;
63         default :  break;   
63         default :  break;
6464      }
6565   }
6666   if (retVal != prev_key) {
r5932r5933
7171      if (count_key <1) {
7272         count_key++;
7373         return retVal;
74      } else {         
74      } else {
7575         return 0;
7676      }
7777   }
78   
78
7979   if (retVal == 0) {
8080      prev_key = 0;
8181      count_key = 0;
82   }   
83   
82   }
83
8484   return retVal;
8585}
8686
r5932r5933
9191
9292static ADDRESS_MAP_START( bob85_io , ADDRESS_SPACE_IO, 8)
9393   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)
9696ADDRESS_MAP_END
9797
9898/* Input ports */
src/mess/drivers/vt520.c
r5932r5933
11/***************************************************************************
2   
2
33        DEC VT520
44
55        02/07/2009 Skeleton driver.
r5932r5933
1414ADDRESS_MAP_END
1515
1616/*
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
2020*/
2121
2222static READ8_HANDLER(vt520_some_r)
r5932r5933
3636INPUT_PORTS_END
3737
3838
39static MACHINE_RESET(vt520)
40{   
39static MACHINE_RESET(vt520)
40{
4141   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
4242   UINT8 *rom = memory_region(machine, "maincpu");
4343   memory_install_write8_handler(space, 0x0000, 0xffff, 0, 0, SMH_UNMAP);
r5932r5933
5757    /* basic machine hardware */
5858    MDRV_CPU_ADD("maincpu",I8032, XTAL_20MHz)
5959    MDRV_CPU_PROGRAM_MAP(vt520_mem)
60    MDRV_CPU_IO_MAP(vt520_io)   
60    MDRV_CPU_IO_MAP(vt520_io)
6161
6262    MDRV_MACHINE_RESET(vt520)
63   
63
6464    /* video hardware */
6565    MDRV_SCREEN_ADD("screen", RASTER)
6666    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
9090/* Driver */
9191
9292/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY   FULLNAME       FLAGS */
93//COMP( 1993, vt510,  0,       0,    vt520,    vt520,     0,       vt520,      "DEC",   "VT510",      GAME_NOT_WORKING)
93//COMP( 1993, vt510,  0,       0,   vt520, vt520, 0,       vt520,    "DEC",   "VT510",      GAME_NOT_WORKING)
9494COMP( 1994, vt520,  0,       0,    vt520,    vt520,     0,       vt520,      "DEC",   "VT520",      GAME_NOT_WORKING)
95//COMP( 1994, vt525,  0,       0,    vt520,    vt520,     0,       vt520,      "DEC",   "VT525",      GAME_NOT_WORKING)
95//COMP( 1994, vt525,  0,       0,   vt520, vt520, 0,       vt520,    "DEC",   "VT525",      GAME_NOT_WORKING)
src/mess/drivers/pc8401a.c
r5932r5933
1010
1111/*
1212
13   NEC PC-8401A-LS "Starlet"
14   NEC PC-8500 "Studley"
13    NEC PC-8401A-LS "Starlet"
14    NEC PC-8500 "Studley"
1515
16   TODO:
16    TODO:
1717
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
2929
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
3636
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.
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.
3838
3939*/
4040
r5932r5933
175175{
176176   /*
177177
178      bit      description
178        bit     description
179179
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
188188
189   */
189    */
190190
191191   pc8401a_state *state = space->machine->driver_data;
192192
r5932r5933
209209{
210210   /*
211211
212      bit      description
212        bit     description
213213
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
222222
223   */
223    */
224224
225225   pc8401a_state *state = space->machine->driver_data;
226226
r5932r5933
231231{
232232   /*
233233
234      bit      description
234        bit     description
235235
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
244244
245   */
245    */
246246
247247   pc8401a_state *state = space->machine->driver_data;
248248
r5932r5933
256256{
257257   /*
258258
259      bit      description
259        bit     description
260260
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
269269
270   */
270    */
271271
272272   pc8401a_state *state = space->machine->driver_data;
273273
r5932r5933
315315{
316316   /*
317317
318      bit      description
318        bit     description
319319
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
328328
329   */
329    */
330330
331331   pc8401a_state *state = space->machine->driver_data;
332332
r5932r5933
383383   AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(MSM8251_TAG, msm8251_data_r, msm8251_data_w)
384384   AM_RANGE(0x21, 0x21) AM_DEVREADWRITE(MSM8251_TAG, msm8251_status_r, msm8251_control_w)
385385   AM_RANGE(0x30, 0x30) AM_READWRITE(mmr_r, mmr_w)
386//   AM_RANGE(0x31, 0x31)
386//  AM_RANGE(0x31, 0x31)
387387   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)
390390   AM_RANGE(0x60, 0x60) AM_DEVREADWRITE(SED1330_TAG, sed1330_status_r, sed1330_data_w)
391391   AM_RANGE(0x61, 0x61) AM_DEVREADWRITE(SED1330_TAG, sed1330_data_r, sed1330_command_w)
392392   AM_RANGE(0x70, 0x70) AM_READWRITE(port70_r, port70_w)
393393   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)
398398   AM_RANGE(0x98, 0x98) AM_DEVWRITE(MC6845_TAG, mc6845_address_w)
399399   AM_RANGE(0x99, 0x99) AM_DEVREADWRITE(MC6845_TAG, mc6845_register_r, mc6845_register_w)
400400   AM_RANGE(0xb0, 0xb3) AM_WRITE(io_rom_addr_w)
401401   AM_RANGE(0xb3, 0xb3) AM_READ(io_rom_data_r)
402//   AM_RANGE(0xc8, 0xc8)
402//  AM_RANGE(0xc8, 0xc8)
403403   AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE(I8255A_TAG, i8255a_r, i8255a_w)
404404ADDRESS_MAP_END
405405
r5932r5933
435435   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
436436   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
437437   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
438   
438
439439   PORT_START("KEY3")
440440   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
441441   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
r5932r5933
471471   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('*')
472472   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('*')
473473   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 ) // ?
475475   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('*')
476476   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('*')
477477   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
r5932r5933
555555{
556556   /*
557557
558      bit      signal         description
558        bit     signal          description
559559
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
568568
569   */
569    */
570570
571571   return 0;
572572}
r5932r5933
575575{
576576   /*
577577
578      bit      signal         description
578        bit     signal          description
579579
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
588588
589   */
589    */
590590}
591591
592592static I8255A_INTERFACE( pc8401a_8255_interface )
r5932r5933
638638   MDRV_CPU_ADD(Z80_TAG, Z80, 4000000) // NEC uPD70008C
639639   MDRV_CPU_PROGRAM_MAP(pc8401a_mem)
640640   MDRV_CPU_IO_MAP(pc8401a_io)
641   
641
642642   MDRV_MACHINE_START(pc8401a)
643643
644644   /* fake keyboard */
r5932r5933
673673   /* basic machine hardware */
674674   MDRV_CPU_MODIFY(Z80_TAG)
675675   MDRV_CPU_IO_MAP(pc8500_io)
676   
676
677677   /* video hardware */
678678   MDRV_IMPORT_FROM(pc8500_video)
679679MACHINE_DRIVER_END
r5932r5933
717717
718718/* System Drivers */
719719
720/*    YEAR  NAME      PARENT   COMPAT   MACHINE      INPUT      INIT   CONFIG      COMPANY   FULLNAME */
720/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY FULLNAME */
721721COMP( 1984,   pc8401a,   0,      0,      pc8401a,   pc8401a,   0,      pc8401a,   "NEC",   "PC-8401A-LS", GAME_NOT_WORKING )
722722/*
723COMP( 1984,   pc8401bd,   pc8401a,0,      pc8401a,   pc8401a,   0,      pc8401a,   "NEC",   "PC-8401BD", GAME_NOT_WORKING )
723COMP( 1984, pc8401bd,   pc8401a,0,      pc8401a,    pc8401a,    0,      pc8401a,    "NEC",  "PC-8401BD", GAME_NOT_WORKING )
724724*/
725725COMP( 1985, pc8500,      0,      0,      pc8500,      pc8401a,   0,      pc8500,      "NEC",   "PC-8500", GAME_NOT_WORKING )
src/mess/drivers/apple3.c
r5932r5933
4343/*
4444static void apple3_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
4545{
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;
4949
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;
5252
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;
5959
60      default:                              apple525_device_getinfo(devclass, state, info); break;
61   }
60        default:                                        apple525_device_getinfo(devclass, state, info); break;
61    }
6262}
6363
6464*/
src/mess/drivers/nakajies.c
r5932r5933
4646   |         |       |        |        |    |    |    |         |
4747   |         |       |        |        |    |    |    |         |
4848
49 
5049
50
5151NTS information from http://web.archive.org/web/19980205154137/nts.dreamwriter.com/dreamwt4.html:
5252
5353File Management & Memory:
5454
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
6262  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.
6565
6666Hardware:
6767
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
7878
7979
8080I/O Map:
r5932r5933
253253   else
254254   {
255255      cpu_set_input_line( state->cpu, 0, CLEAR_LINE );
256   }
256   }
257257}
258258
259259
src/mess/drivers/tec1.c
r5932r5933
11/***************************************************************************
22
3   TEC-1 driver, written by Robbbert in April, 2009 for MESS.
3    TEC-1 driver, written by Robbbert in April, 2009 for MESS.
44
55The TEC-1 was a single-board "computer" described in Talking Electronics
66magazine, issues number 10 and 11. Talking Electronics do not have dates on
r5932r5933
5757
5858/***************************************************************************
5959
60   Display
60    Display
6161
6262***************************************************************************/
6363
r5932r5933
7171
7272static WRITE8_HANDLER( tec1_segment_w )
7373{
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 */
8282
8383   tec1_segment = BITSWAP8(data, 4, 2, 1, 6, 7, 5, 3, 0);
8484   if (tec1_digit) tec1_display();
r5932r5933
8686
8787static WRITE8_HANDLER( tec1_digit_w )
8888{
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 */
9797
9898   speaker_level_w(tec1_speaker, (data & 0x80) ? 1 : 0);
9999
r5932r5933
104104
105105/***************************************************************************
106106
107   Keyboard
107    Keyboard
108108
109109***************************************************************************/
110110
r5932r5933
113113   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
114114   return tec1_kbd;
115115}
116   
116
117117static UINT8 tec1_convert_col_to_bin( UINT8 col, UINT8 row )
118118{
119119   UINT8 data = row;
r5932r5933
146146   /* if previous key is still held, bail out */
147147   if (input_port_read(machine, keynames[row]))
148148      if (tec1_convert_col_to_bin(input_port_read(machine, keynames[row]), row) == tec1_kbd)
149         return;
150     
149         return;
150
151151   row++;
152152   row &= 3;
153153
r5932r5933
162162
163163/***************************************************************************
164164
165   Machine
165    Machine
166166
167167***************************************************************************/
168168
r5932r5933
176176
177177/***************************************************************************
178178
179   Address Map
179    Address Map
180180
181181***************************************************************************/
182182
r5932r5933
196196
197197/**************************************************************************
198198
199   Keyboard Layout
199    Keyboard Layout
200200
201201***************************************************************************/
202202
r5932r5933
233233
234234/***************************************************************************
235235
236   Machine driver
236    Machine driver
237237
238238***************************************************************************/
239239
r5932r5933
257257
258258/***************************************************************************
259259
260   Game driver
260    Game driver
261261
262262***************************************************************************/
263263
264264ROM_START(tec1)
265265   ROM_REGION(0x10000, "maincpu", 0)
266266   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))
271271ROM_END
272272
273/*    YEAR  NAME      PARENT  COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
273/*    YEAR  NAME      PARENT  COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
274274COMP( 1984, tec1,     0,      0,      tec1,       tec1,    0,        0,      "Talking Electronics magazine",  "TEC-1" , 0 )
src/mess/drivers/mmd1.c
r5932r5933
11/***************************************************************************
2   
2
33        MMD-1 & MMD-2 driver by Miodrag Milanovic
4     
4
55        12/05/2009 Initial version
66
77****************************************************************************/
r5932r5933
6767   if (BIT(line2,5)==0) return 13;
6868   if (BIT(line2,6)==0) return 14;
6969   if (BIT(line2,7)==0) return 15;
70     
70
7171   return 0xff;
7272}
7373
r5932r5933
7676   AM_RANGE( 0x0000, 0x00ff ) AM_ROM // Main ROM
7777   AM_RANGE( 0x0100, 0x01ff ) AM_ROM // Expansion slot
7878   AM_RANGE( 0x0200, 0x02ff ) AM_RAM
79   AM_RANGE( 0x0300, 0x03ff ) AM_RAM   
79   AM_RANGE( 0x0300, 0x03ff ) AM_RAM
8080ADDRESS_MAP_END
8181
8282static ADDRESS_MAP_START( mmd1_io , ADDRESS_SPACE_IO, 8)
r5932r5933
9393   AM_RANGE( 0x0400, 0x07ff ) AM_RAM // WE1
9494   AM_RANGE( 0x0800, 0x0bff ) AM_RAM // WE2
9595   AM_RANGE( 0x0c00, 0x0fff ) AM_RAM // WE3
96   
96
9797   AM_RANGE( 0xd800, 0xdfff ) AM_ROM // ROM label 330
9898   AM_RANGE( 0xe000, 0xe7ff ) AM_ROM // ROM label 340
9999   AM_RANGE( 0xe800, 0xefff ) AM_RAM // ROM label 350
r5932r5933
116116         PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
117117         PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
118118         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)
120120   PORT_START("LINE2")
121121         PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
122122         PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
r5932r5933
125125         PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
126126         PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
127127         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)
129129   PORT_START("LINE3")
130130         PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
131131INPUT_PORTS_END
r5932r5933
133133
134134static INPUT_PORTS_START( mmd2 )
135135/*
136DIP switches:
137WE 0      - Write enable for addresses $0000..$03FF
138WE 1      - Write enable for addresses $0400..$07FF
139WE 2      - Write enable for addresses $0800..$0BFF
140WE 3      - Write enable for addresses $0C00..$0FFF
141SPARE     - ???
142HEX OCT   - choose display and entry to be in Hexadecimal or Octal
143PUP RESET - ???
136DIP switches:
137WE 0      - Write enable for addresses $0000..$03FF
138WE 1      - Write enable for addresses $0400..$07FF
139WE 2      - Write enable for addresses $0800..$0BFF
140WE 3      - Write enable for addresses $0C00..$0FFF
141SPARE     - ???
142HEX OCT   - choose display and entry to be in Hexadecimal or Octal
143PUP RESET - ???
144144EXEC 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)
146146
147147Keyboard
1480  1  2  3      PREV  STORE  NEXT  STEP 
1494  5  6  7      HIGH  LOW  GO  OPTION 
1508  9  A  B      LOAD  DUMP  PROM  COPY 
151C  D  E  F      MEM  REGS  AUX  CANCEL 
1480  1  2  3      PREV  STORE  NEXT  STEP
1494  5  6  7      HIGH  LOW  GO  OPTION
1508  9  A  B      LOAD  DUMP  PROM  COPY
151C  D  E  F      MEM  REGS  AUX  CANCEL
152152
153153*/
154154INPUT_PORTS_END
155155
156static MACHINE_RESET(mmd1)
157{   
156static MACHINE_RESET(mmd1)
157{
158158}
159159
160static MACHINE_RESET(mmd2)
161{   
160static MACHINE_RESET(mmd2)
161{
162162}
163163
164164static MACHINE_DRIVER_START( mmd1 )
165165    /* basic machine hardware */
166166    MDRV_CPU_ADD("maincpu",8080, 6750000 / 9)
167167    MDRV_CPU_PROGRAM_MAP(mmd1_mem)
168    MDRV_CPU_IO_MAP(mmd1_io)   
168    MDRV_CPU_IO_MAP(mmd1_io)
169169
170170    MDRV_MACHINE_RESET(mmd1)
171   
171
172172   /* video hardware */
173173   MDRV_DEFAULT_LAYOUT(layout_mmd1)
174174MACHINE_DRIVER_END
r5932r5933
177177    /* basic machine hardware */
178178    MDRV_CPU_ADD("maincpu",8080, 6750000 / 9)
179179    MDRV_CPU_PROGRAM_MAP(mmd2_mem)
180    MDRV_CPU_IO_MAP(mmd2_io)   
180    MDRV_CPU_IO_MAP(mmd2_io)
181181
182182    MDRV_MACHINE_RESET(mmd2)
183   
183
184184   /* video hardware */
185185   MDRV_DEFAULT_LAYOUT(layout_mmd2)
186186MACHINE_DRIVER_END
src/mess/drivers/mc1000.c
r5932r5933
44
55    12/05/2009 Skeleton driver.
66
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
99
1010****************************************************************************/
1111
1212/*
1313
14   TODO:
14    TODO:
1515
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
2020
2121*/
2222
r5932r5933
108108{
109109   /*
110110
111      bit      description
111        bit     description
112112
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
121121
122   */
122    */
123123
124124   mc1000_state *state = space->machine->driver_data;
125125
r5932r5933
151151   ADDRESS_MAP_GLOBAL_MASK(0xff)
152152   AM_RANGE(0x04, 0x04) AM_READWRITE(printer_r, printer_w)
153153   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)
156156   AM_RANGE(0x12, 0x12) AM_WRITE(mc6845_ctrl_w)
157157   AM_RANGE(0x20, 0x20) AM_DEVWRITE(AY8910_TAG, ay8910_address_w)
158158   AM_RANGE(0x40, 0x40) AM_DEVREAD(AY8910_TAG, ay8910_r)
r5932r5933
489489
490490/* System Drivers */
491491
492/*    YEAR   NAME      PARENT      COMPAT   MACHINE      INPUT      INIT      CONFIG      COMPANY            FULLNAME      FLAGS */
492/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT        CONFIG      COMPANY             FULLNAME        FLAGS */
493493COMP( 1985,   mc1000,      0,         0,      mc1000,      mc1000,      mc1000,      mc1000,      "CCE",            "MC-1000",      GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
src/mess/drivers/adam.c
r5932r5933
656656   MDRV_SPEAKER_STANDARD_MONO("mono")
657657   MDRV_SOUND_ADD("sn76489a", SN76489A, 3579545)   /* 3.579545 MHz */
658658   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
659   
659
660660   /* cartridge */
661661   MDRV_CARTSLOT_ADD("cart")
662662   MDRV_CARTSLOT_EXTENSION_LIST("rom,col,bin")
663663   MDRV_CARTSLOT_NOT_MANDATORY
664   
665   MDRV_FLOPPY_4_DRIVES_ADD(adam_floppy_config)   
664
665   MDRV_FLOPPY_4_DRIVES_ADD(adam_floppy_config)
666666MACHINE_DRIVER_END
667667
668668
src/mess/drivers/mc80.c
r5932r5933
1515   ADDRESS_MAP_UNMAP_HIGH
1616   AM_RANGE(0x0000, 0x0bff) AM_ROM
1717   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
1919   AM_RANGE(0x6000, 0xffff) AM_RAM
2020ADDRESS_MAP_END
2121
2222static ADDRESS_MAP_START( mc8020_io , ADDRESS_SPACE_IO, 8)
2323   ADDRESS_MAP_UNMAP_HIGH
2424   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)
2626   AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w)
2727ADDRESS_MAP_END
2828
2929static ADDRESS_MAP_START(mc8030_mem, ADDRESS_SPACE_PROGRAM, 8)
3030   ADDRESS_MAP_UNMAP_HIGH
31   //  ZRE 4 * 2KB
31   //  ZRE 4 * 2KB
3232   AM_RANGE(0x0000, 0x1fff) AM_ROM // ZRE ROM's 4 * 2716
3333   AM_RANGE(0x2000, 0x27ff) AM_ROM // SPE ROM's 2 * 2708
3434   AM_RANGE(0x2800, 0x3fff) AM_ROM // For extension
r5932r5933
5959    MDRV_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz)
6060    MDRV_CPU_PROGRAM_MAP(mc8020_mem)
6161    MDRV_CPU_IO_MAP(mc8020_io)
62   
62
6363    MDRV_MACHINE_RESET(mc8020)
64   
64
6565    /* video hardware */
6666    MDRV_SCREEN_ADD("screen", RASTER)
6767    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
7474
7575    MDRV_VIDEO_START(mc8020)
7676    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 )
8080MACHINE_DRIVER_END
8181
8282static MACHINE_DRIVER_START( mc8030 )
r5932r5933
8686    MDRV_CPU_IO_MAP(mc8030_io)
8787
8888    MDRV_MACHINE_RESET(mc8030)
89   
89
9090    /* video hardware */
9191    MDRV_SCREEN_ADD("screen", RASTER)
9292    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
9999
100100    MDRV_VIDEO_START(mc8030)
101101    MDRV_VIDEO_UPDATE(mc8030)
102   
103    MDRV_Z80PIO_ADD( "zve_pio", zve_z80pio_intf )   
102
103    MDRV_Z80PIO_ADD( "zve_pio", zve_z80pio_intf )
104104    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 )
107107   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 )
109109MACHINE_DRIVER_END
110110
111111/* ROM definition */
112112ROM_START( mc8020 )
113113   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
114   ROM_SYSTEM_BIOS(0, "ver1", "Version 1")   
114   ROM_SYSTEM_BIOS(0, "ver1", "Version 1")
115115   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))
118118   ROMX_LOAD( "mo01_v2.rom", 0x2000, 0x0400, CRC(7e47201c) SHA1(db49afdc5c1fe4065a979c56cbdbd3c58f5d942f), ROM_BIOS(1))
119119
120   ROM_SYSTEM_BIOS(1, "ver2", "Version 2")   
120   ROM_SYSTEM_BIOS(1, "ver2", "Version 2")
121121   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))
124124   ROMX_LOAD( "mo01.rom",   0x2000, 0x0400, CRC(c65a470f) SHA1(71325fed1a342149b5efc2234ecfc8adfff0a42d), ROM_BIOS(2))
125125
126   ROM_SYSTEM_BIOS(2, "ver3", "Version 3")   
126   ROM_SYSTEM_BIOS(2, "ver3", "Version 3")
127127   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
132132   // m02 doesn't exist on board
133133   ROM_LOAD( "mo03.rom", 0x2800, 0x0400, CRC(29685056) SHA1(39e77658fb7af5a28112341f0893e007d73c1b7a))
134134   ROM_LOAD( "mo04.rom", 0x2c00, 0x0400, CRC(fd315b73) SHA1(cfb943ec8c884a9b92562d05f92faf06fe42ad68))
src/mess/drivers/act.c
r5932r5933
11/***************************************************************************
22
3      ACT Apricot series
3        ACT Apricot series
44
5      07/2009 Skeleton driver.
5        07/2009 Skeleton driver.
66
77****************************************************************************/
88
r5932r5933
8989
9090/* Driver */
9191
92/*     YEAR  NAME    PARENT  COMPAT MACHINE INPUT   INIT  CONFIG COMPANY  FULLNAME                 FLAGS */
92/*    YEAR  NAME    PARENT  COMPAT MACHINE INPUT   INIT  CONFIG COMPANY  FULLNAME                 FLAGS */
9393COMP( 1984, aprixi,    0,    0,     act,    act,    0,    0,     "ACT",   "Apricot Xi",            GAME_NOT_WORKING)
9494COMP( 1984, aprif1,    0,    0,     act,    act,    0,    0,     "ACT",   "Apricot F1",            GAME_NOT_WORKING)
9595COMP( 1985, aprif10,   0,    0,     act,    act,    0,    0,     "ACT",   "Apricot F10",           GAME_NOT_WORKING)
src/mess/drivers/mbee.c
r5932r5933
3232        F800-FFFF PCG RAM (graphics), Colour RAM (banked)
3333
3434    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.
3939
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.
4444
45   MENU - Do a rombank switch to bank 5 and jump to C000 to start the Shell
45    MENU - Do a rombank switch to bank 5 and jump to C000 to start the Shell
4646
47   PAK n - Do a rombank switch (write to port 0A) to bank "n" and jump to C000.
47    PAK n - Do a rombank switch (write to port 0A) to bank "n" and jump to C000.
4848
4949    These early colour computers have a PROM to create the foreground palette.
5050
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
5656
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.
6161
6262
6363***************************************************************************/
r5932r5933
7373size_t mbee_size;
7474
7575/********** 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 !!
7878********************************************************************************/
7979
8080
r5932r5933
320320   PORT_CONFSETTING(    0x00, DEF_STR(No))
321321   PORT_CONFSETTING(    0x01, DEF_STR(Yes))
322322   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))
326326INPUT_PORTS_END
327327
328328static const z80_daisy_chain mbee_daisy_chain[] =
r5932r5933
355355      TRACKS([84])
356356      SECTORS([10])
357357      SECTOR_LENGTH([512])
358      FIRST_SECTOR_ID([1]))     
358      FIRST_SECTOR_ID([1]))
359359FLOPPY_OPTIONS_END
360360
361361static const floppy_config mbee_floppy_config =
r5932r5933
584584   ROM_LOAD_OPTIONAL("edasmb.ic33",  0xd000,  0x1000, CRC(a23bf3c8) SHA1(73a57c2800a1c744b527d0440b170b8b03351753) )
585585   ROM_LOAD_OPTIONAL("telcom10.rom", 0xe000,  0x1000, CRC(cc9ac94d) SHA1(6804b5ff54d16f8e06180751d8681c44f351e0bb) )
586586
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) ) */
589589
590590   ROM_LOAD("charrom.ic13",          0x11000, 0x0800, CRC(b149737b) SHA1(a3cd4f5d0d3c71137cd1f0f650db83333a2e3597) )
591591   ROM_RELOAD( 0x17000, 0x0800 )
r5932r5933
602602   ROM_LOAD("charrom.bin",           0x11000, 0x1000, CRC(1f9fcee4) SHA1(e57ac94e03638075dde68a0a8c834a4f84ba47b0) )
603603   ROM_RELOAD( 0x17000, 0x1000 )
604604
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) ) */
607607   ROM_LOAD_OPTIONAL("telcom12.rom", 0xe000,  0x1000, CRC(0231bda3) SHA1(be7b32499034f985cc8f7865f2bc2b78c485585c) )
608608
609609   /* PAK option roms */
r5932r5933
707707
708708***************************************************************************/
709709
710/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT      CONFIG    COMPANY         FULLNAME */
710/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT      CONFIG    COMPANY         FULLNAME */
711711COMP( 1982, mbee,     0,   0,   mbee,     mbee,     mbee,     0,   "Applied Technology",  "Microbee 16 Standard" , 0)
712712COMP( 1982, mbeeic,   mbee,   0,   mbeeic,   mbee,     mbeeic,   0,   "Applied Technology",  "Microbee 32 IC" , 0)
713713COMP( 1982, mbeepc,   mbee,   0,   mbeepc,   mbee,     mbeepc,   0,   "Applied Technology",  "Microbee 32 Personal Communicator" , 0)
src/mess/drivers/coco.c
r5932r5933
88    Nate Woods (current maintainer)
99    Tim Lindner (VHD and other work)
1010
11   Version information:
11    Version information:
1212
13   Basic   Extended Basic   Disk Extended
14coco   1.0   -      -
15cocoe   1.1   1.0      1.0
16coco2   1.2   1.1      1.1
17coco2b   1.3   1.1      1.1
18coco3   1.2   2.0      1.1
19coco3p   1.2   2.0      1.1
20coco3h   1.2   2.0      1.1
13    Basic   Extended Basic  Disk Extended
14coco    1.0 -       -
15cocoe   1.1 1.0     1.0
16coco2   1.2 1.1     1.1
17coco2b  1.3 1.1     1.1
18coco3   1.2 2.0     1.1
19coco3p  1.2 2.0     1.1
20coco3h  1.2 2.0     1.1
2121
2222
2323
r5932r5933
542542   PORT_CONFSETTING(    0x01, "Cloud-9" )
543543
544544   /* Port Condition is used because you can plug Hi-Res joystick,
545   Rat Mouse and Lightgun in either ports, but not both */
545    Rat Mouse and Lightgun in either ports, but not both */
546546   /* Fix me: should Rat Mouse and Diecom Light Gun be available also for coco & coco2? */
547547   PORT_START("ctrl_sel")  /* Select Controller Type */
548548   PORT_CATEGORY_CLASS( 0x0f, 0x01, "Right Controller Port (P1)") PORT_CHANGED( coco_joystick_mode_changed, 0 )
r5932r5933
661661   PORT_CONFSETTING(    0x01, "Cloud-9" )
662662
663663   /* Port Condition is used because you can plug Hi-Res joystick,
664   Rat Mouse and Lightgun in either ports, but not both */
664    Rat Mouse and Lightgun in either ports, but not both */
665665   /* Fix me: should Rat Mouse and Diecom Light Gun be available also for coco & coco2? */
666666   PORT_START("ctrl_sel")  /* Select Controller Type */
667667   PORT_CATEGORY_CLASS( 0x0f, 0x01, "Right Controller Port (P1)") PORT_CHANGED( coco_joystick_mode_changed, 0 )
src/mess/drivers/ti99_8.c
r5932r5933
148148
149149Known Issues (MZ, 2009-04-26)
150150- 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
152152  cartridge is presented. The slots are scanned, though. Need to check whether
153153  this is a bug of the operating system or of the emulation.
154154- Emulation speed must be checked. I have inserted adjust_icounts, but I need to
155155  check whether the console experienced those delays actually. Unfortunately,
156156  there is almost no real hardware available.
157157- 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
159159  neither reset nor restarted.
160160*/
161161
r5932r5933
199199*/
200200
201201static ADDRESS_MAP_START(ti99_8_cru_map, ADDRESS_SPACE_IO, 8)
202//   AM_RANGE(0x0000, 0x00ff) AM_DEVREAD("tms9901", tms9901_cru_r)
202//  AM_RANGE(0x0000, 0x00ff) AM_DEVREAD("tms9901", tms9901_cru_r)
203203        AM_RANGE(0x0000, 0x007f) AM_DEVREAD("tms9901", tms9901_cru_r)
204204        AM_RANGE(0x0080, 0x00ff) AM_DEVREAD("ti99_multicart", ti99_multicart_cru_r)     /* SuperSpace cartridge */
205205        AM_RANGE(0x0100, 0x02ff) AM_READ(ti99_8_peb_cru_r)
r5932r5933
422422
423423static const mm58274c_interface floppy_mm58274c_interface =
424424{
425   1,   /*    mode 24*/
425   1,   /* mode 24*/
426426   0   /*  first day of week */
427427};
428428
r5932r5933
471471   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
472472
473473   /* rtc */
474   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)     
475   
474   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
475
476476   /* tms9901 */
477   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_8)   
477   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_8)
478478
479479   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
483483   MDRV_TI99_CARTRIDGE_ADD("ti99_multicart")
484484   MDRV_SMARTMEDIA_ADD("smartmedia")
485485   MDRV_TI99_4_RS232_CARD_ADD("rs232")
r5932r5933
524524   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
525525
526526   /* rtc */
527   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)     
528   
527   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
528
529529   /* tms9901 */
530   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_8)   
530   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_8)
531531
532532   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)
534534
535535   MDRV_TI99_CARTRIDGE_ADD("ti99_multicart")
536536   MDRV_SMARTMEDIA_ADD("smartmedia")
src/mess/drivers/x1.c
r5932r5933
11/************************************************************************************************
22
3   Sharp X1 (c) 1983 Sharp Corporation
3    Sharp X1 (c) 1983 Sharp Corporation
44
5   driver by Angelo Salese & Barry Rodewald
5    driver by Angelo Salese & Barry Rodewald
66
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?)
2626
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);
3434
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.
4040
4141=================================================================================================
4242
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)
5151
52   X1C (CZ-801C) - October, 1983
53    * same but only 48KB GRAM
52    X1C (CZ-801C) - October, 1983
53     * same but only 48KB GRAM
5454
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!!)
5757
58   X1Cs (CZ-803C) - June, 1984
59    * two expansion I/O ports
58    X1Cs (CZ-803C) - June, 1984
59     * two expansion I/O ports
6060
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
6464
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)
6868
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
7373
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)
7777
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
8282
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
8888
89   =============  X1 Turbo series  =============
89    =============  X1 Turbo series  =============
9090
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
100100
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
103103
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)
107107
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)
110110
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
113113
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
116116
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
128128
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
131131
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
134134
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
137137
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)
140140
141141************************************************************************************************/
142142
r5932r5933
454454   draw_fgtilemap(screen->machine,bitmap,cliprect,w);
455455   draw_gfxbitmap(screen->machine,bitmap,cliprect,w,scrn_reg.disp_bank,scrn_reg.ply^0xff);
456456   /* Y's uses the following as a normal buffer/work ram without anything reasonable to draw */
457//   draw_gfxbitmap(screen->machine,bitmap,cliprect,w,1);
457//  draw_gfxbitmap(screen->machine,bitmap,cliprect,w,1);
458458
459459   return 0;
460460}
r5932r5933
601601   }
602602
603603   /*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    }*/
608608
609609   sub_cmd_length--;
610610   sub_obf = (sub_cmd_length) ? 0x00 : 0x20;
r5932r5933
830830{
831831   //UINT8 *ROM = memory_region(space->machine, "rom");
832832
833//   popmessage("%06x",rom_index[0]<<16|rom_index[1]<<8|rom_index[2]<<0);
833//  popmessage("%06x",rom_index[0]<<16|rom_index[1]<<8|rom_index[2]<<0);
834834
835835   return 0; //ROM[rom_index[0]<<16|rom_index[1]<<8|rom_index[2]<<0];
836836}
r5932r5933
11001100}
11011101
11021102/*
1103   SCRN flags
1103    SCRN flags
11041104
1105   d0(01) = 0:low res            1:high res
1105    d0(01) = 0:low res            1:high res
11061106    d1(02) = 0:1 raster           1:2 raster  <- 0=400-line mode, legal when 'd0=1'
11071107    d2(04) = 0:25(20) lines       1:12(10) lines
11081108    d3(08) = 0:bank 0             0:bank 1    <- display
r5932r5933
11271127static WRITE8_HANDLER( x1_ply_w )
11281128{
11291129   scrn_reg.ply = data;
1130//   printf("PLY = %02x\n",data);
1130//  printf("PLY = %02x\n",data);
11311131}
11321132
11331133static WRITE8_HANDLER( x1_6845_w )
r5932r5933
12071207static UINT32 kanji_addr;
12081208
12091209/*
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;
12131213 */
12141214static READ8_HANDLER( x1_kanji_r )
12151215{
r5932r5933
12581258{
12591259   io_bank_mode = 0; //any read disables the extended mode.
12601260
1261   //if(offset >= 0x0704 && offset <= 0x0707)      { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
1261   //if(offset >= 0x0704 && offset <= 0x0707)      { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
12621262   if(offset == 0x0e03)                          { return x1_rom_r(space, 0); }
12631263   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
12641264   else if(offset >= 0x1400 && offset <= 0x17ff)   { return x1_pcg_r(space, offset-0x1400); }
r5932r5933
12701270   else if(offset >= 0x1f92 && offset <= 0x1f93)   { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); }
12711271   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); }
12721272   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa8); }
1273//   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
1273//  else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
12741274   else if(offset == 0x1fe0)                  { return x1_blackclip_r(space,0); }
12751275   else if(offset >= 0x2000 && offset <= 0x2fff)   { return colorram[offset-0x2000]; }
12761276   else if(offset >= 0x3000 && offset <= 0x3fff)   { return videoram[offset-0x3000]; }
r5932r5933
12851285static WRITE8_HANDLER( x1_io_w )
12861286{
12871287   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); }
12901290   else if(offset >= 0x0e00 && offset <= 0x0e02)     { x1_rom_w(space, offset-0xe00,data); }
1291//   else if(offset >= 0x0e80 && offset <= 0x0e82)   { x1_kanji_w(space->machine, offset-0xe80,data); }
1291//  else if(offset >= 0x0e80 && offset <= 0x0e82)   { x1_kanji_w(space->machine, offset-0xe80,data); }
12921292   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { x1_fdc_w(space, offset-0xff8,data); }
12931293   else if(offset >= 0x1000 && offset <= 0x10ff)   { x1_pal_b_w(space, 0,data); }
12941294   else if(offset >= 0x1100 && offset <= 0x11ff)   { x1_pal_r_w(space, 0,data); }
r5932r5933
13071307   else if(offset >= 0x1f92 && offset <= 0x1f93)   { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); }
13081308   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); }
13091309   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); }
13141314   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { x1_scrn_w(space,0,data); }
13151315   else if(offset == 0x1fe0)                  { x1_blackclip_w(space,0,data); }
13161316   else if(offset >= 0x2000 && offset <= 0x2fff)   { colorram[offset-0x2000] = data; }
r5932r5933
13441344   else if(offset >= 0x1fb8 && offset <= 0x1fbf)   { return x1turbo_txpal_r(space,offset-0x1fb8); }
13451345   else if(offset == 0x1fc0)                  { return x1turbo_txdisp_r(space,0); }
13461346   else if(offset == 0x1fc5)                  { return x1turbo_gfxpal_r(space,0); }
1347//   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
1347//  else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { return x1_scrn_r(space,offset-0x1fd0); }
13481348   else if(offset == 0x1fe0)                  { return x1_blackclip_r(space,0); }
13491349   else if(offset >= 0x2000 && offset <= 0x2fff)   { return colorram[offset-0x2000]; }
13501350   else if(offset >= 0x3000 && offset <= 0x3fff)   { return videoram[offset-0x3000]; }
r5932r5933
13631363   if(io_bank_mode == 1)                           { x1_ex_gfxram_w(space, offset, data); }
13641364   else if(offset == 0x0700 || offset == 0x0701)   { ym2151_w(devtag_get_device(space->machine, "ym"), offset-0x0700,data); }
13651365   else if(offset >= 0x0704 && offset <= 0x0707)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x0704,data); }
1366//   else if(offset >= 0x0c00 && offset <= 0x0cff)   { x1_rs232c_w(space->machine, 0, data); }
1366//  else if(offset >= 0x0c00 && offset <= 0x0cff)   { x1_rs232c_w(space->machine, 0, data); }
13671367   else if(offset >= 0x0e00 && offset <= 0x0e02)     { x1_rom_w(space, offset-0xe00,data); }
13681368   else if(offset >= 0x0e80 && offset <= 0x0e83)   { x1_kanji_w(space, offset-0xe80,data); }
13691369   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { x1_fdc_w(space, offset-0xff8,data); }
r5932r5933
14331433{
14341434   //printf("PPI Port B read\n");
14351435   /*
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    */
14451445   UINT8 dat = 0;
14461446   vdisp = (video_screen_get_vpos(device->machine->primary_screen) < 200) ? 0x80 : 0x00;
14471447   dat = (input_port_read(device->machine, "SYSTEM") & 0x10) | sub_obf | vsync | vdisp;
r5932r5933
14491449   if(cassette_input(devtag_get_device(device->machine,"cass")) > 0.03)
14501450      dat |= 0x02;
14511451
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
14541454
14551455   // CMT test bit is set low when the CMT Stop command is issued, and becomes
14561456   // high again when this bit is read.
r5932r5933
14691469{
14701470   //printf("PPI Port C read\n");
14711471   /*
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    */
14761476   return (io_sys & 0x9f) | hres_320 | ~io_switch;
14771477}
14781478
r5932r5933
18771877   GFXDECODE_ENTRY( "cgrom",   0x00000, x1_chars_8x8,    0x200, 0x20 )
18781878   GFXDECODE_ENTRY( "pcg",     0x00000, x1_pcg_8x8,      0x000, 1 )
18791879   GFXDECODE_ENTRY( "cgrom",   0x01800, x1_chars_8x16,   0x200, 0x20 )
1880//   GFXDECODE_ENTRY( "kanji",   0x27000, x1_chars_16x16,  0, 0x20 ) //needs to be checked when the ROM will be redumped
1880//  GFXDECODE_ENTRY( "kanji",   0x27000, x1_chars_16x16,  0, 0x20 ) //needs to be checked when the ROM will be redumped
18811881   GFXDECODE_ENTRY( "cgrom",   0x02800, x1_chars_16x16,  0, 0x20 ) //needs to be checked when the ROM will be redumped
18821882GFXDECODE_END
18831883
r5932r5933
19161916{
19171917   { "x1kb" },
19181918   { "ctc" },
1919//   { "dma" },
1920//   { "sio" },
1919//  { "dma" },
1920//  { "sio" },
19211921   { NULL }
19221922};
19231923
r5932r5933
19661966
19671967/*static IRQ_CALLBACK(x1_irq_callback)
19681968{
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;
19841984}
19851985*/
19861986static TIMER_CALLBACK(keyboard_callback)
r5932r5933
20382038   //cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), x1_irq_callback);
20392039   timer_pulse(machine, ATTOTIME_IN_HZ(240), NULL, 0, keyboard_callback);
20402040   timer_pulse(machine, ATTOTIME_IN_HZ(16), NULL, 0, cmt_wind_timer);
2041   
2041
20422042   cmt_current_cmd = 0;
20432043   cmt_test = 0;
20442044   cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
r5932r5933
21522152   MDRV_CPU_IO_MAP(x1turbo_io)
21532153
21542154   MDRV_SOUND_ADD("ym", YM2151, XTAL_4MHz) //unknown clock / divider
2155//   MDRV_SOUND_CONFIG(ay8910_config)
2155//  MDRV_SOUND_CONFIG(ay8910_config)
21562156   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
21572157MACHINE_DRIVER_END
21582158
src/mess/drivers/gb.c
r5932r5933
711711   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
712712ROM_END
713713
714/*    YEAR  NAME      PARENT   COMPAT   MACHINE   INPUT    INIT  CONFIG      COMPANY     FULLNAME */
714/*    YEAR  NAME      PARENT   COMPAT   MACHINE   INPUT    INIT  CONFIG     COMPANY     FULLNAME */
715715CONS( 1990, gameboy,  0,       0,      gameboy,  gameboy, 0,    0,         "Nintendo", "Game Boy", 0)
716716CONS( 1994, supergb,  gameboy, 0,      supergb,  gameboy, 0,    0,         "Nintendo", "Super Game Boy", 0)
717717CONS( 1996, gbpocket, gameboy, 0,      gbpocket, gameboy, 0,    0,         "Nintendo", "Game Boy Pocket", 0)
src/mess/drivers/pocketc.c
r5932r5933
297297
298298static INPUT_PORTS_START( pc1402 )
299299   PORT_INCLUDE( pc1401 )
300   
300
301301   PORT_MODIFY("DSW0")
302302    PORT_DIPNAME( 0xc0, 0x80, "RAM")
303303   PORT_DIPSETTING(   0x00, "2KB" )
r5932r5933
447447
448448static INPUT_PORTS_START( pc1403h )
449449   PORT_INCLUDE( pc1403 )
450   
450
451451   PORT_MODIFY("DSW0")
452452    PORT_DIPNAME( 0x80, 0x80, "RAM")
453453   PORT_DIPSETTING(   0x00, "PC1403 (8KB)" )
r5932r5933
494494   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R     $") PORT_CODE(KEYCODE_R)
495495   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
496496   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
497   
497
498498   PORT_START("KEY4")
499499   PORT_BIT(0x03, IP_ACTIVE_HIGH, IPT_UNUSED)
500500   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_QUOTE)
r5932r5933
511511   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y     &") PORT_CODE(KEYCODE_Y)
512512   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
513513   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
514   
514
515515   PORT_START("KEY6")
516516   PORT_BIT(0x0f, IP_ACTIVE_HIGH, IPT_UNUSED)
517517   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)   /* down? */
r5932r5933
784784   MDRV_SCREEN_SIZE(608, 300)
785785   MDRV_SCREEN_VISIBLE_AREA(0, 608-1, 0, 300-1)
786786   MDRV_GFXDECODE( pc1251 )
787   
787
788788   MDRV_VIDEO_UPDATE( pc1251 )
789789MACHINE_DRIVER_END
790790
r5932r5933
827827   MDRV_IMPORT_FROM( pc1250)
828828   MDRV_CPU_MODIFY( "maincpu" )
829829   MDRV_CPU_PROGRAM_MAP( pc1260_mem)
830   
830
831831   MDRV_NVRAM_HANDLER( pc1260 )
832832MACHINE_DRIVER_END
833833
r5932r5933
934934ROM_START(pc1260)
935935   ROM_REGION(0x10000,"maincpu",0)
936936   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))
938938     ROM_REGION(0x80,"gfx1",ROMREGION_ERASEFF)
939939ROM_END
940940
src/mess/drivers/xor100.c
r5932r5933
44
55        12/05/2009 Skeleton driver.
66
7   Execution of this monitor rom starts at F800.
7    Execution of this monitor rom starts at F800.
88
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
1818
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
2323
2424*****************************************************************************************************/
2525
2626/*
2727
28   TODO:
28    TODO:
2929
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
3838
3939*/
4040
r5932r5933
5656{
5757   /*
5858
59      bit      description
60     
61      0      A16
62      1      A17
59        bit     description
6360
64   */
61        0       A16
62        1       A17
63
64    */
6565}
6666
6767static WRITE8_HANDLER( prom_toggle_w )
r5932r5933
181181   DEVCB_LINE(com5016_fr_w),   /* fR output */
182182   DEVCB_LINE(com5016_ft_w),   /* fT output */
183183   { 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
185185};
186186
187187/* Printer 8251A Interface */
r5932r5933
262262   }
263263}
264264
265static const wd17xx_interface wd1795_intf =
266{
265static const wd17xx_interface wd1795_intf =
266{
267267   wd1795_callback,
268268   NULL,
269269   {FLOPPY_0,FLOPPY_1,NULL,NULL}
r5932r5933
364364   MDRV_Z80CTC_ADD(Z80CTC_TAG, XTAL_8MHz/2, ctc_intf)
365365   MDRV_COM8116_ADD(COM5016_TAG, 5000000, com5016_intf) // COM5016
366366   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)
368368
369369   MDRV_CASSETTE_ADD(CASSETTE_TAG, xor100_cassette_config)
370370MACHINE_DRIVER_END
r5932r5933
379379/* System Configuration */
380380
381381static SYSTEM_CONFIG_START( xor100 )
382   CONFIG_RAM_DEFAULT( 64 * 1024 )   
382   CONFIG_RAM_DEFAULT( 64 * 1024 )
383383SYSTEM_CONFIG_END
384384
385385/* System Drivers */
386386
387/*    YEAR   NAME      PARENT   COMPAT   MACHINE      INPUT      INIT   CONFIG      COMPANY               FULLNAME      FLAGS */
387/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY                 FULLNAME        FLAGS */
388388COMP( 1982, xor100,      0,      0,      xor100,      xor100,      0,      xor100,      "Xor Data Science",      "XOR S-100-12",   GAME_NOT_WORKING )
src/mess/drivers/palm.c
r5932r5933
11/****************************************************************************
22
3   drivers/palm.c
4   Palm (MC68328) emulation
3    drivers/palm.c
4    Palm (MC68328) emulation
55
6   Driver by MooglyGuy
6    Driver by MooglyGuy
77
8   Additional bug fixing by R. Belmont
8    Additional bug fixing by R. Belmont
99
1010****************************************************************************/
1111
src/mess/drivers/kim1.c
r5932r5933
282282   for ( i = 0; i < 6; i++ )
283283   {
284284      if ( kim1_led_time[i] )
285         kim1_led_time[i]--;
285         kim1_led_time[i]--;
286286      else
287287         output_set_digit_value( i, 0 );
288288   }
src/mess/drivers/beehive.c
r5932r5933
11/***************************************************************************
22
3   BEEHIVE DM3270
3    BEEHIVE DM3270
44
5   25/05/2009 Skeleton driver [Robbbert]
5    25/05/2009 Skeleton driver [Robbbert]
66
7   This is a conventional computer terminal using a serial link.
7    This is a conventional computer terminal using a serial link.
88
99****************************************************************************/
1010
src/mess/drivers/tmc600.c
r5932r5933
345345
346346   /* cassette */
347347   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)
350350MACHINE_DRIVER_END
351351
352352/* ROMs */
src/mess/drivers/advision.c
r5932r5933
88
99/*
1010
11   TODO:
11    TODO:
1212
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
1616
1717*/
1818
r5932r5933
2424#include "sound/dac.h"
2525
2626/* Memory Maps */
27
27
2828static ADDRESS_MAP_START( program_map, ADDRESS_SPACE_PROGRAM, 8 )
2929   AM_RANGE(0x0000, 0x03ff) AM_ROMBANK(1)
3030   AM_RANGE(0x0400, 0x0fff) AM_ROM
r5932r5933
122122ROM_END
123123
124124/* 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 */
127127CONS( 1982, advision,   0,      0,      advision, advision,   0,         0,   "Entex Electronics",   "Adventure Vision", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
src/mess/drivers/radio86.c
r5932r5933
256256   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
257257   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
258258   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)
260260
261261   PORT_START("LINE8")
262262   PORT_BIT(0xFF, IP_ACTIVE_LOW, IPT_UNUSED)
r5932r5933
337337
338338   MDRV_VIDEO_START(generic_bitmapped)
339339   MDRV_VIDEO_UPDATE(radio86)
340   
340
341341   MDRV_SPEAKER_STANDARD_MONO("mono")
342342   MDRV_SOUND_WAVE_ADD("wave", "cassette")
343343   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
r5932r5933
360360     MDRV_IMPORT_FROM(radio86)
361361     MDRV_CPU_MODIFY("maincpu")
362362     MDRV_CPU_PROGRAM_MAP(radio86rom_mem)
363   
363
364364   MDRV_I8255A_ADD( "ppi8255_2", radio86_ppi8255_interface_2 )
365365MACHINE_DRIVER_END
366366
r5932r5933
381381
382382   MDRV_I8255A_ADD( "ms7007", rk7007_ppi8255_interface )
383383MACHINE_DRIVER_END
384 
384
385385static MACHINE_DRIVER_START( rk700716 )
386386     /* basic machine hardware */
387387     MDRV_IMPORT_FROM(radio16)
388388     MDRV_CPU_MODIFY("maincpu")
389389     MDRV_CPU_IO_MAP(rk7007_io)
390   
391   MDRV_I8255A_ADD( "ms7007", rk7007_ppi8255_interface )   
390
391   MDRV_I8255A_ADD( "ms7007", rk7007_ppi8255_interface )
392392MACHINE_DRIVER_END
393393
394394static MACHINE_DRIVER_START( mikron2 )
r5932r5933
415415ROM_END
416416
417417ROM_START( spektr01 )
418   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )   
418   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
419419   ROM_LOAD( "spektr001.rom", 0xf800, 0x0800, CRC(5a38e6d5) SHA1(799c3bbe2a9f08f3aba55379cc093329048350ff))
420420   ROM_COPY( "maincpu", 0xf800, 0xf000, 0x0800 )
421421   ROM_REGION(0x0800, "gfx1",0)
src/mess/drivers/b2m.c
r5932r5933
11/***************************************************************************
22
3      Bashkiria-2M driver by Miodrag Milanovic
3        Bashkiria-2M driver by Miodrag Milanovic
44
5      28/03/2008 Preliminary driver.
6           
5        28/03/2008 Preliminary driver.
6
77****************************************************************************/
88
99
r5932r5933
1919#include "formats/basicdsk.h"
2020#include "includes/b2m.h"
2121
22   
22
2323/* Address maps */
2424static ADDRESS_MAP_START(b2m_mem, ADDRESS_SPACE_PROGRAM, 8)
2525   AM_RANGE (0x0000, 0x27ff) AM_RAMBANK(1)
r5932r5933
3434   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253", pit8253_r,pit8253_w)
3535   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_2", i8255a_r, i8255a_w)
3636     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)
3939   AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_r, pic8259_w )
4040   AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", msm8251_data_r,msm8251_data_w)
4141   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)
4646ADDRESS_MAP_END
4747
4848static ADDRESS_MAP_START( b2m_rom_io, ADDRESS_SPACE_IO, 8 )
r5932r5933
5050   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("pit8253", pit8253_r,pit8253_w)
5151   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi8255_3", i8255a_r, i8255a_w)
5252     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)
5555   AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_r, pic8259_w )
5656   AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", msm8251_data_r, msm8251_data_w)
5757   AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", msm8251_status_r, msm8251_control_w)
r5932r5933
7676   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v')
7777   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k')
7878   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')
8080   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b')
8181   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('{')
8282
r5932r5933
8686   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e')
8787   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n')
8888   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')
9090   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z')
9191   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g')
9292
r5932r5933
9696   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o')
9797   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
9898   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')
100100   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s')
101101   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m')
102102
r5932r5933
114114   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR('<') PORT_CHAR(',')
115115   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR('\'') PORT_CHAR(';')
116116   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)
118118   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('!') PORT_CHAR('1')
119119   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('|') PORT_CHAR('\\')
120120   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR(')') PORT_CHAR('0')
r5932r5933
142142   PORT_START("LINE8")
143143   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
144144   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)
146146   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
147147   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))
149149   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("end") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
150150   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ins") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))
151151
r5932r5933
157157   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
158158   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
159159   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))
161161
162162   PORT_START("LINE10")
163   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
163   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
164164   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
165165   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
166166   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
r5932r5933
171171
172172   PORT_START("MONITOR")
173173   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")
176176INPUT_PORTS_END
177
177
178178static FLOPPY_OPTIONS_START(b2m)
179179   FLOPPY_OPTION(b2m, "cpm", "Bashkiria-2M disk image", basicdsk_identify_default, basicdsk_construct_default,
180180      HEADS([2])
r5932r5933
199199    MDRV_CPU_PROGRAM_MAP(b2m_mem)
200200    MDRV_CPU_IO_MAP(b2m_io)
201201    MDRV_CPU_VBLANK_INT("screen", b2m_vblank_interrupt)
202                               
202
203203    MDRV_MACHINE_START( b2m )
204204    MDRV_MACHINE_RESET( b2m )
205       
206    /* video hardware */       
207   MDRV_SCREEN_ADD("screen", RASTER)         
205
206    /* video hardware */
207   MDRV_SCREEN_ADD("screen", RASTER)
208208   MDRV_SCREEN_REFRESH_RATE(50)
209209   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
210210   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
211211   MDRV_SCREEN_SIZE(384, 256)
212212   MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1)
213213   MDRV_PALETTE_LENGTH(4)
214   MDRV_PALETTE_INIT(b2m)   
215   
214   MDRV_PALETTE_INIT(b2m)
215
216216   MDRV_PIT8253_ADD( "pit8253", b2m_pit8253_intf )
217217
218218   MDRV_I8255A_ADD( "ppi8255_1", b2m_ppi8255_interface_1 )
219219
220220   MDRV_I8255A_ADD( "ppi8255_2", b2m_ppi8255_interface_2 )
221         
221
222222   MDRV_I8255A_ADD( "ppi8255_3", b2m_ppi8255_interface_3 )
223223
224224   MDRV_PIC8259_ADD( "pic8259", b2m_pic8259_config )
225     
225
226226   MDRV_VIDEO_START(b2m)
227    MDRV_VIDEO_UPDATE(b2m)       
228   
227    MDRV_VIDEO_UPDATE(b2m)
228
229229   /* sound */
230230    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)
233233
234234   /* uart */
235235   MDRV_MSM8251_ADD("uart", default_msm8251_interface)
236   
236
237237   MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives )
238   
238
239239   MDRV_FLOPPY_2_DRIVES_ADD(b2m_floppy_config)
240240MACHINE_DRIVER_END
241241
242242static MACHINE_DRIVER_START( b2mrom )
243243    MDRV_IMPORT_FROM(b2m)
244    MDRV_CPU_MODIFY("maincpu")       
244    MDRV_CPU_MODIFY("maincpu")
245245     MDRV_CPU_IO_MAP(b2m_rom_io)
246246MACHINE_DRIVER_END
247
247
248248/* ROM definition */
249249
250250ROM_START( b2m )
r5932r5933
258258    ROM_LOAD( "ramdos.sys", 0x12000, 0x60c0, CRC(91ed6df0) SHA1(4fd040f2647a6b7930c330c75560a035027d0606) )
259259ROM_END
260260
261static SYSTEM_CONFIG_START(b2m)   
262    CONFIG_RAM_DEFAULT(128 * 1024)   
261static SYSTEM_CONFIG_START(b2m)
262    CONFIG_RAM_DEFAULT(128 * 1024)
263263SYSTEM_CONFIG_END
264264
265265/* 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 */
268268COMP( 1989, b2m,    0,        0,      b2m,       b2m,       b2m,     b2m,     "BNPO",                "Bashkiria-2M",    GAME_SUPPORTS_SAVE)
269269COMP( 1989, b2mrom,   b2m,    0,      b2mrom,      b2m,       b2m,     b2m,     "BNPO",                "Bashkiria-2M ROM-disk",    GAME_SUPPORTS_SAVE)
src/mess/drivers/aim65.c
r5932r5933
283283    GAME DRIVERS
284284***************************************************************************/
285285
286/*    YEAR  NAME         PARENT  COMPAT  MACHINE  INPUT   INIT    CONFIG  COMPANY     FULLNAME  FLAGS */
286/*   YEAR  NAME         PARENT  COMPAT  MACHINE  INPUT   INIT    CONFIG  COMPANY     FULLNAME  FLAGS */
287287COMP(1977, aim65,      0,      0,      aim65,   aim65,  0,      aim65,  "Rockwell", "AIM 65", 0)
288288COMP(1981, aim65_40,   aim65,  0,      aim65,    aim65,  0,      aim65,  "Rockwell", "AIM 65/40", GAME_NOT_WORKING)
src/mess/drivers/arcadia.c
r5932r5933
77 TODO: implement the RESET key on the front panel
88         find a dump of the charactyer ROM
99         convert the drawing code to tilemap
10 
11 
10
11
1212 1. General
1313   SYSTEM
1414- Signetics 2650 CPU at 3.58/4 MHz(for NTSC) or at 4,433/5 (for PAL)
r5932r5933
2727
28282. Memory map
2929The memory map of the 2001 is below.
300000 - 0FFF   4k ROM Block 1 (first 4k of a cartridge)
311000 - 13FF      mirror of $1800-$1BFF
321400 - 17FF      mirror of $1800-$1BFF
331800 - 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
451C00 - 1FFF      mirror of 1800-1BFF
462000 - 2FFF   4k ROM Block 2 (for 8k carts such as Jungler)
473000 - 3FFF   mirror of 1000-1FFF
484000 - 4FFF   mirror of 0000-0FFF
495000 - 5FFF   mirror of 1000-1FFF
506000 - 6FFF   mirror of 0000-0FFF
517000 - 7FFF   mirror of 1000-1FFF
300000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge)
311000 - 13FF     mirror of $1800-$1BFF
321400 - 17FF     mirror of $1800-$1BFF
331800 - 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
451C00 - 1FFF     mirror of 1800-1BFF
462000 - 2FFF 4k ROM Block 2 (for 8k carts such as Jungler)
473000 - 3FFF mirror of 1000-1FFF
484000 - 4FFF mirror of 0000-0FFF
495000 - 5FFF mirror of 1000-1FFF
506000 - 6FFF mirror of 0000-0FFF
517000 - 7FFF mirror of 1000-1FFF
5252
5353The Palladium VCG memory map is as follows.
540000 - 0FFF   4k ROM Block 1 (first 4k of a cartridge)
551000 - 17FF      could be ROM or RAM but no Cartridge uses this
561800 - 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
681C00 - 1FFF      could be ROM or RAM but no Cartridge uses this
692000 - 2FFF   4k ROM Block  (for 8k carts such as Jungler)
703000 - 3FFF   could be ROM or RAM but no Cartridge uses this
714000 - 4FFF   4k ROM Block  (first 2K used by Golf)
725000 - 5FFF   4k ROM Block
736000 - 6FFF   4k ROM Block
747000 - 7FFF   4k ROM Block
540000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge)
551000 - 17FF     could be ROM or RAM but no Cartridge uses this
561800 - 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
681C00 - 1FFF     could be ROM or RAM but no Cartridge uses this
692000 - 2FFF 4k ROM Block  (for 8k carts such as Jungler)
703000 - 3FFF could be ROM or RAM but no Cartridge uses this
714000 - 4FFF 4k ROM Block  (first 2K used by Golf)
725000 - 5FFF 4k ROM Block
736000 - 6FFF 4k ROM Block
747000 - 7FFF 4k ROM Block
7575
7676
77773. ROM Images
7878ROM Images are loaded into 0000-0FFF. If the ROM is an 8k ROM the
7979second half of the Rom is located at 2000-2FFF. Except for the Golf cart
80which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on
80which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on
8181Palladium VCG.
8282
8383
r5932r5933
1061061905 bit 3.
107107
108108Palladium has 4 additional key per keypad which are mapped at
1091903 palladium player 1
1101907 palladium player 2
1091903 palladium player 1
1101907 palladium player 2
111111
112112
1131135. Other information
r5932r5933
417417static const unsigned short arcadia_palette[128+8] =  /* bgnd, fgnd */
418418{
419419   0,1,2,3,4,5,6,7,
420   
420
421421   0,0, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7,
422422   1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7,
423423   2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7,
src/mess/drivers/tm990189.c
r5932r5933
116116   joy2y_timer = timer_alloc(machine, NULL, NULL);
117117
118118   hold_load(machine);
119   
119
120120   TMS9928A_reset();
121121}
122122
r5932r5933
779779   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
780780
781781   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
782   
782
783783   /* tms9901 */
784784   MDRV_TMS9901_ADD("tms9901_0", usr9901reset_param)
785785   MDRV_TMS9901_ADD("tms9901_1", sys9901reset_param)
src/mess/drivers/bcs3.c
r5932r5933
44
55        12/05/2009 Skeleton driver.
66
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.
99
10   Therefore, it is likely to be full of mistakes and omissions.
10    Therefore, it is likely to be full of mistakes and omissions.
1111
12   Note: The $ key makes a square symbol.
12    Note: The $ key makes a square symbol.
1313
1414****************************************************************************/
1515
r5932r5933
9595static ADDRESS_MAP_START( bcs3_io, ADDRESS_SPACE_IO, 8)
9696   ADDRESS_MAP_UNMAP_HIGH
9797   ADDRESS_MAP_GLOBAL_MASK(0xff)
98//   AM_RANGE( 0xf8, 0xfb ) AM_DEVREADWRITE(Z80CTC,"z80ctc",z80ctc_r,z80ctc_w)
98//  AM_RANGE( 0xf8, 0xfb ) AM_DEVREADWRITE(Z80CTC,"z80ctc",z80ctc_r,z80ctc_w)
9999ADDRESS_MAP_END
100100
101101/* Input ports */
r5932r5933
252252}
253253
254254/* This has 100 lines of screen data. I'm assuming that it only shows a portion of this,
255   with the cursor always in sight. */
255    with the cursor always in sight. */
256256static VIDEO_UPDATE( bcs3a )
257257{
258258   UINT8 y,ra,chr,gfx,rat;
src/mess/drivers/scorpion.c
r5932r5933
11/***************************************************************************
22
3   NOTE: ****** Specbusy: press N, R, or E to boot *************
3    NOTE: ****** Specbusy: press N, R, or E to boot *************
44
55
66        Spectrum/Inves/TK90X etc. memory map:
r5932r5933
203203   if ((scorpion_256_port_1ffd_data & 0x01)==0x01)
204204   {
205205      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");
208208   }
209209   else
210210   {
211211      if ((scorpion_256_port_1ffd_data & 0x02)==0x02)
212212      {
213         ROMSelection = 2;         
214      }
215      else
213         ROMSelection = 2;
214      }
215      else
216216      {
217217         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0;
218      }         
218      }
219219      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));
221221   }
222   
223   
222
223
224224}
225225
226226static DIRECT_UPDATE_HANDLER( scorpion_direct )
227{   
227{
228228   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))
230230   {
231      if (pc >= 0x4000)
231      if (pc >= 0x4000)
232232      {
233233         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0;
234234         betadisk_disable(beta);
235235         memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
236236         memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14));
237      }   
237      }
238238   } else if (((pc & 0xff00) == 0x3d00) && (ROMSelection==1))
239239   {
240240      ROMSelection = 3;
241241      betadisk_enable(beta);
242     
243   }
244   if((address>=0x0000) && (address<=0x3fff))
242
243   }
244   if((address>=0x0000) && (address<=0x3fff))
245245   {
246      memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);     
246      memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
247247      direct->raw = direct->decrypted =  memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14);
248248      memory_set_bankptr(space->machine, 1, direct->raw);
249249      return ~0;
r5932r5933
253253
254254static TIMER_CALLBACK(nmi_check_callback)
255255{
256   if ((input_port_read(machine, "NMI") & 1)==1)
256   if ((input_port_read(machine, "NMI") & 1)==1)
257257   {
258258      scorpion_256_port_1ffd_data |= 0x02;
259259      scorpion_update_memory(machine);
r5932r5933
283283      scorpion_update_memory(space->machine);
284284   }
285285}
286 
287static ADDRESS_MAP_START (scorpion_io, ADDRESS_SPACE_IO, 8)   
286
287static ADDRESS_MAP_START (scorpion_io, ADDRESS_SPACE_IO, 8)
288288   ADDRESS_MAP_UNMAP_HIGH
289289   AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_status_r,betadisk_command_w) AM_MIRROR(0xff00)
290290   AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_track_r,betadisk_track_w) AM_MIRROR(0xff00)
291291   AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_sector_r,betadisk_sector_w) AM_MIRROR(0xff00)
292292   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)
294294   AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_state_r, betadisk_param_w) AM_MIRROR(0xff00)
295295   AM_RANGE(0x4000, 0x4000) AM_WRITE(scorpion_port_7ffd_w)  AM_MIRROR(0x3ffd)
296296   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd)
r5932r5933
300300
301301
302302static MACHINE_RESET( scorpion )
303{   
303{
304304   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
307307   memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
308   
308
309309   betadisk_disable(beta);
310310   betadisk_clear_status(beta);
311311
312   memory_set_direct_update_handler(space, scorpion_direct );
313   
312   memory_set_direct_update_handler(space, scorpion_direct );
313
314314   memset(mess_ram,0,256*1024);
315   
315
316316   /* Bank 5 is always in 0x4000 - 0x7fff */
317317   memory_set_bankptr(machine, 2, mess_ram + (5<<14));
318318
r5932r5933
322322   spectrum_128_port_7ffd_data = 0;
323323   scorpion_256_port_1ffd_data = 0;
324324
325   scorpion_update_memory(machine);   
326         
325   scorpion_update_memory(machine);
326
327327   timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, nmi_check_callback);
328328}
329329
r5932r5933
332332   MDRV_CPU_MODIFY("maincpu")
333333   MDRV_CPU_IO_MAP(scorpion_io)
334334   MDRV_MACHINE_RESET( scorpion )
335   
335
336336   MDRV_BETA_DISK_ADD(BETA_DISK_TAG)
337337MACHINE_DRIVER_END
338338
r5932r5933
360360    ROM_SYSTEM_BIOS(4, "v5", "ProfROM V.3.9f")
361361    ROMX_LOAD( "prof_39f.rom", 0x010000, 0x20000, CRC(c55e64da) SHA1(cec7770fe26350f57f6c325a29db78787dc4521e), ROM_BIOS(5))
362362    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))
364364   ROM_SYSTEM_BIOS(6, "v7", "NeOS 256")
365365    ROMX_LOAD("neos_256.rom", 0x010000, 0x4000, CRC(364ae09a) SHA1(bb6db1947415503a6bc48f33c603fb3a0dbb3690), ROM_BIOS(7))
366366   ROMX_LOAD("scorp1.rom",   0x014000, 0x4000, CRC(9d513013) SHA1(367b5a102fb663beee8e7930b8c4acc219c1f7b3), ROM_BIOS(7))
367367   ROMX_LOAD("scorp2.rom",   0x018000, 0x4000, CRC(fd0d3ce1) SHA1(07783ee295274d8ff15d935bfd787c8ac1d54900), ROM_BIOS(7))
368368   ROMX_LOAD("scorp3.rom",   0x01c000, 0x4000, CRC(1fe1d003) SHA1(33703e97cc93b7edfcc0334b64233cf81b7930db), ROM_BIOS(7))
369369    ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
370   
370
371371   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))
373373
374374   ROM_REGION(0x010000, "gsound", 0)
375375    ROM_LOAD( "gs104.rom", 0x0000, 0x8000, CRC(7a365ba6) SHA1(c865121306eb3a7d811d82fbcc653b4dc1d6fa3d))
r5932r5933
385385   ROM_SYSTEM_BIOS(2, "v3", "ver 3")
386386   ROMX_LOAD( "profi-p1.rom", 0x010000, 0x10000, CRC(537ddb81) SHA1(00a23e8dc722b248d4f98cb14a600ce7487f2b9c), ROM_BIOS(3))
387387   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")
390390     ROMX_LOAD( "profi-p.rom", 0x010000, 0x10000, CRC(314f6b57) SHA1(1507f53ec64dcf5154b5cfce6922f69f70296a53), ROM_BIOS(5))
391391     ROM_SYSTEM_BIOS(5, "v6", "JV Kramis V0.2")
392392   ROMX_LOAD( "profi32.rom", 0x010000, 0x10000, CRC(77327f52) SHA1(019bd00cc7939741d99b99beac6ae1298652e652), ROM_BIOS(6))
393393   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))
395395   ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
396396ROM_END
397397
398398ROM_START(quorum)
399399   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))
401401   ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
402402ROM_END
403403
404404ROM_START( kay1024 )
405405   ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF)
406406   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))
408408    ROMX_LOAD( "trd503.rom",   0x01c000, 0x04000, CRC(10751aba) SHA1(21695e3f2a8f796386ce66eea8a246b0ac44810c), ROM_BIOS(1))
409409     ROM_SYSTEM_BIOS(1, "v2", "Kramis V0.2")
410410    ROMX_LOAD( "kay1024b.rom", 0x010000, 0x10000, CRC(ab99c31e) SHA1(cfa9e6553aea72956fce4f0130c007981d684734), ROM_BIOS(2))
src/mess/drivers/abc80.c
r5932r5933
4545    74S263  - Texas Instruments SN74S263N Row Output Character Generator
4646    MC1488  - Texas Instruments MC1488 Quadruple Line Driver
4747    MC1489  - Texas Instruments MC1489 Quadruple Line Receiver
48   8205   - ?
48    8205    - ?
4949    CN1     - RS-232 connector
5050    CN2     - ABC bus connector (DIN 41612)
5151    CN3     - video connector
r5932r5933
6262
6363    TODO:
6464
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
7171    - floppy
7272    - printer
7373    - IEC
r5932r5933
9797{
9898   /*
9999
100      Bit Name     Description
100        Bit Name     Description
101101
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.
110110
111   */
111    */
112112   const device_config *sn76477 = devtag_get_device(space->machine, "sn76477");
113113
114114   sn76477_enable_w(sn76477, ~data & 0x01);
r5932r5933
374374{
375375   /*
376376
377      PIO Port A
377        PIO Port A
378378
379      bit      description
379        bit     description
380380
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
389389
390   */
390    */
391391
392392   abc80_state *state = device->machine->driver_data;
393393
r5932r5933
398398{
399399   /*
400400
401      PIO Channel B
401        PIO Channel B
402402
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
411411
412   */
412    */
413413
414414   abc80_state *state = device->machine->driver_data;
415415
r5932r5933
423423{
424424   /*
425425
426      PIO Channel B
426        PIO Channel B
427427
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
436436
437   */
437    */
438438
439439   abc80_state *state = device->machine->driver_data;
440440
r5932r5933
549549
550550   /* cassette */
551551   MDRV_CASSETTE_ADD("cassette", default_cassette_config)
552   
552
553553   MDRV_FLOPPY_2_DRIVES_ADD(abc80_floppy_config)
554554MACHINE_DRIVER_END
555555
r5932r5933
640640
641641/* Drivers */
642642
643/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY                        FULLNAME               FLAGS */
643/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY                             FULLNAME                    FLAGS */
644644COMP( 1978, abc80,  0,      0,      abc80,  abc80,  0,      abc80,  "Luxor Datorer AB",               "ABC 80 (Sweden, Finland)",   GAME_SUPPORTS_SAVE )
645645COMP( 1978, abc80h, abc80,  0,      abc80,  abc80,  0,      abc80,  "Budapesti Radiotechnikai Gyar",   "ABC 80 (Hungary)",         GAME_SUPPORTS_SAVE )
src/mess/drivers/pmd85.c
r5932r5933
257257
258258static INPUT_PORTS_START( pmd85 )
259259   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))
261261      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1)         PORT_CHAR('1') PORT_CHAR('!')
262262      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q)          PORT_CHAR('q') PORT_CHAR('Q')
263263      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A)          PORT_CHAR('a') PORT_CHAR('A')
264264      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 )
268268
269269   PORT_START("KEY1") /* port 0x01 */
270270      PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("K1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F2))
r5932r5933
272272      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W)          PORT_CHAR('w') PORT_CHAR('W')
273273      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S)          PORT_CHAR('s') PORT_CHAR('S')
274274      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 )
278278
279279   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))
281281      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3)          PORT_CHAR('3') PORT_CHAR('#')
282282      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E)          PORT_CHAR('e') PORT_CHAR('E')
283283      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D)          PORT_CHAR('d') PORT_CHAR('D')
284284      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 )
288288
289289   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))
291291      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4)          PORT_CHAR('4') PORT_CHAR('$')
292292      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R)          PORT_CHAR('r') PORT_CHAR('R')
293293      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F)          PORT_CHAR('f') PORT_CHAR('F')
294294      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 )
298298
299299   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))
301301      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5)          PORT_CHAR('5') PORT_CHAR('%')
302302      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T)          PORT_CHAR('t') PORT_CHAR('T')
303303      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G)          PORT_CHAR('g') PORT_CHAR('G')
304304      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 )
308308
309309   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))
311311      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6)          PORT_CHAR('6') PORT_CHAR('&')
312312      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y)          PORT_CHAR('y') PORT_CHAR('Y')
313313      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H)          PORT_CHAR('h') PORT_CHAR('H')
314314      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 )
318318
319319   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))
321321      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7)          PORT_CHAR('7') PORT_CHAR('\'')
322322      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U)          PORT_CHAR('u') PORT_CHAR('U')
323323      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J)          PORT_CHAR('j') PORT_CHAR('J')
324324      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 )
328328
329329   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))
331331      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8)          PORT_CHAR('8') PORT_CHAR('(')
332332      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I)          PORT_CHAR('i') PORT_CHAR('I')
333333      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K)          PORT_CHAR('k') PORT_CHAR('K')
334334      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 )
338338
339339   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))
341341      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9)          PORT_CHAR('9') PORT_CHAR(')')
342342      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O)          PORT_CHAR('o') PORT_CHAR('O')
343343      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L)          PORT_CHAR('l') PORT_CHAR('L')
344344      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 )
348348
349349   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))
351351      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0)          PORT_CHAR('0') PORT_CHAR('-')
352352      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P)          PORT_CHAR('p') PORT_CHAR('P')
353353      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON)      PORT_CHAR(';') PORT_CHAR('+')
354354      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 )
358358
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))
361361      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS)       PORT_CHAR('_') PORT_CHAR('=')
362362      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE)   PORT_CHAR('@') PORT_CHAR('`')
363363      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE)       PORT_CHAR(':') PORT_CHAR('*')
364364      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 )
368368
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))
371371      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)    PORT_CHAR('{') PORT_CHAR('}')
372372      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)   PORT_CHAR('\\') PORT_CHAR('^')
373373      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 )
378378
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 )
388388
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))
391391      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(DEL))
392392      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("^\\") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(HOME))
393393      PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("END") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(END))
394394      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 )
398398
399   PORT_START("KEY14") /* port 0x0e */   
399   PORT_START("KEY14") /* port 0x0e */
400400      PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CLR") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP))
401401      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RCL") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(PGDN))
402402      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("->") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
403403      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 )
408408
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))
416416      PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
417417      PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
418418
419   PORT_START("RESET") /* port 0x10 */   
419   PORT_START("RESET") /* port 0x10 */
420420      PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RST") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE))
421421
422   PORT_START("DSW0") /* port 0x11 */         
422   PORT_START("DSW0") /* port 0x11 */
423423      PORT_CONFNAME( 0x01, 0x00, "Basic ROM Module" )
424424          PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
425425         PORT_CONFSETTING( 0x01, DEF_STR( On ) )
r5932r5933
438438
439439
440440static INPUT_PORTS_START (mato)
441   PORT_START("KEY0") /* port 0x00 */   
441   PORT_START("KEY0") /* port 0x00 */
442442      PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1)          PORT_CHAR('1') PORT_CHAR('!')
443443      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2)          PORT_CHAR('2') PORT_CHAR('\"')
444444      PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3)          PORT_CHAR('3') PORT_CHAR('#')
src/mess/drivers/m20.c
r5932r5933
11/* Olivetti M20 skeleton driver, by incog (19/05/2009) */
2
2
33#include "driver.h"
44#include "cpu/z8000/z8000.h"
5
5
66#define MAIN_CLOCK 4000000 /* 4 MHz */
7 
8 
7
8
99static ADDRESS_MAP_START(m20_mem, ADDRESS_SPACE_PROGRAM, 16)
1010   ADDRESS_MAP_UNMAP_HIGH
1111   AM_RANGE( 0x0000, 0x1fff ) AM_ROM
1212   AM_RANGE( 0x2000, 0xffff ) AM_RAM
1313ADDRESS_MAP_END
14
14
1515static ADDRESS_MAP_START( m20_io , ADDRESS_SPACE_IO, 16)
1616   ADDRESS_MAP_UNMAP_HIGH
1717ADDRESS_MAP_END
18
18
1919static INPUT_PORTS_START( m20 )
2020INPUT_PORTS_END
21
21
2222static DRIVER_INIT( m20 )
2323{
2424}
25
25
2626static MACHINE_RESET( m20 )
2727{
2828}
29
29
3030static VIDEO_START( m20 )
3131{
3232}
33
33
3434static VIDEO_UPDATE( m20 )
3535{
3636    return 0;
3737}
38
38
3939static MACHINE_DRIVER_START( m20 )
4040    /* basic machine hardware */
4141    MDRV_CPU_ADD("maincpu", Z8000, MAIN_CLOCK)
4242    MDRV_CPU_PROGRAM_MAP(m20_mem)
4343    MDRV_CPU_IO_MAP(m20_io)
44     
44
4545     MDRV_MACHINE_RESET(m20)
46
46
4747    /* video hardware */
4848    MDRV_SCREEN_ADD("screen", RASTER)
4949    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 */
5151    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
5252    MDRV_SCREEN_SIZE(512, 256)
5353    MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
5454    MDRV_PALETTE_LENGTH(2)
5555    MDRV_PALETTE_INIT(black_and_white)
56
56
5757    MDRV_VIDEO_START(m20)
5858    MDRV_VIDEO_UPDATE(m20)
5959MACHINE_DRIVER_END
60
60
6161ROM_START(m20)
6262   ROM_REGION(0x12000,"maincpu",0)
6363   ROM_SYSTEM_BIOS( 0, "m20", "M20 1.0" )
r5932r5933
8181     ROM_SYSTEM_BIOS( 3, "m40-60", "M40 6.0" )
8282     ROMX_LOAD( "m40rom-6.0", 0x0000, 0x4000, CRC(8114ebec) SHA1(4e2c65b95718c77a87dbee0288f323bd1c8837a3), ROM_BIOS(4))
8383ROM_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 */
8686COMP( 1981, m20,   0,      0,      m20,    m20,    m20,    0,     "Olivetti", "Olivetti L1 M20", GAME_NOT_WORKING)
8787COMP( 1981, m40,   m20,    0,      m20,    m20,    m20,    0,     "Olivetti", "Olivetti L1 M40", GAME_NOT_WORKING)
src/mess/drivers/spectrum.c
r5932r5933
666666   ROMX_LOAD( "boot80k_v1.bin", 0x0000, 0x0800, CRC(f42d2342) SHA1(8aa1b3b056e311674a051ffc6a49af60cae409f3), ROM_BIOS(1))
667667   ROM_SYSTEM_BIOS(1, "v2", "V2")
668668   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")
670670   ROMX_LOAD( "boot80k_v3.bin", 0x0000, 0x0800, CRC(8580494c) SHA1(91af3f3fa50f2071f8ff081536bdf7e21e9823d9), ROM_BIOS(3))
671671   ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
672672ROM_END
src/mess/drivers/astrocde.c
r5932r5933
4646 *  right gives lower numbers, and twisting to the left gives larger numbers.
4747 *  Paddle games like Clowns have more intuitive behavior -- twisting to the
4848 *  right moves the character right.
49 *
49 *
5050 *  There is a 24-key keypad on the system itself (6 rows, 4 columns).  It is
5151 *  labeled for the built-in calculator, but overlays were released for other
5252 *  programs, the most popular being the BASIC cartridges, which allowed a
r5932r5933
167167   MDRV_SPEAKER_STANDARD_MONO("mono")
168168   MDRV_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4)
169169   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
170   
170
171171   MDRV_CARTSLOT_ADD("cart")
172172MACHINE_DRIVER_END
173173
src/mess/drivers/atarist.c
r5932r5933
2020
2121    TODO:
2222
23   - move static variables to driver state
23    - move static variables to driver state
2424    - fix floppy interface
2525    - fix mouse
2626    - MSA disk image support
r5932r5933
18461846   MDRV_ACIA6850_ADD("acia_1", acia_midi_intf)
18471847
18481848   MDRV_WD1772_ADD(WD1772_TAG, atarist_wd17xx_interface )
1849   
1849
18501850   MDRV_FLOPPY_2_DRIVES_ADD(atarist_floppy_config)
18511851
18521852   MDRV_IMPORT_FROM(atarist_cartslot)
r5932r5933
19101910   MDRV_ACIA6850_ADD("acia_1", acia_midi_intf)
19111911
19121912   MDRV_WD1772_ADD(WD1772_TAG, atarist_wd17xx_interface )
1913   
1913
19141914   MDRV_FLOPPY_2_DRIVES_ADD(atarist_floppy_config)
19151915
19161916   MDRV_IMPORT_FROM(atarist_cartslot)
r5932r5933
19681968   MDRV_ACIA6850_ADD("acia_1", acia_midi_intf)
19691969
19701970   MDRV_WD1772_ADD(WD1772_TAG, atarist_wd17xx_interface )
1971   
1971
19721972   MDRV_FLOPPY_2_DRIVES_ADD(atarist_floppy_config)
19731973
19741974   MDRV_IMPORT_FROM(atarist_cartslot)
src/mess/drivers/cat.c
r5932r5933
11/***************************************************************************
2   
2
33    Canon Cat driver by Miodrag Milanovic
44
55    12/06/2009 Skeleton driver.
r5932r5933
2323}
2424
2525static WRITE16_HANDLER( cat_test_mode_w )
26{   
26{
2727}
2828
2929static READ16_HANDLER( cat_modem_r )
r5932r5933
5656{
5757   UINT16 retVal = 0;
5858   // Read country code
59   if (pr_cont == 0x0900)
59   if (pr_cont == 0x0900)
6060   {
61      retVal = input_port_read(space->machine, "DIPSW1");     
61      retVal = input_port_read(space->machine, "DIPSW1");
6262   }
6363   // Regular keyboard read
64   if (pr_cont == 0x0800 || pr_cont == 0x0a00)
64   if (pr_cont == 0x0800 || pr_cont == 0x0a00)
6565   {
6666      retVal=0xff00;
67      switch(keyboard_line)
67      switch(keyboard_line)
6868      {
6969         case 0x01: retVal = input_port_read(space->machine, "LINE0") << 8; break;
7070         case 0x02: retVal = input_port_read(space->machine, "LINE1") << 8; break;
r5932r5933
7979   return retVal;
8080}
8181static WRITE16_HANDLER( cat_keyboard_w )
82{   
82{
8383   keyboard_line = data >> 8;
8484}
8585
8686static WRITE16_HANDLER( cat_video_w )
8787{
88/*   
88/*
8989 006500AE ,          ( HSS HSync Strart    89 )
9090 006480C2 ,          ( HST End HSync   96 )
9191 006400CE ,          ( HSE End H Line    104 )
r5932r5933
115115   AM_RANGE(0x0080000e, 0x0080000f) AM_READWRITE(cat_battery_r,cat_printer_w)
116116   AM_RANGE(0x00810000, 0x0081001f) AM_DEVREADWRITE8( "duart68681", duart68681_r, duart68681_w, 0xff )
117117   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
120120ADDRESS_MAP_END
121121
122122static UINT16 *swyft_video_ram;
r5932r5933
124124static ADDRESS_MAP_START(swyft_mem, ADDRESS_SPACE_PROGRAM, 16)
125125   ADDRESS_MAP_UNMAP_HIGH
126126   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)
128128ADDRESS_MAP_END
129129
130130/* Input ports */
r5932r5933
153153   PORT_DIPSETTING(   0x7200, "South Africa" )
154154   PORT_DIPSETTING(   0x7100, "Switzerland" )
155155   PORT_DIPSETTING(   0x7000, "ASCII" )
156           
156
157157   PORT_START("LINE0")
158158   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
159159   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
r5932r5933
250250   return M68K_INT_ACK_AUTOVECTOR;
251251}
252252
253static MACHINE_RESET(cat)
254{   
253static MACHINE_RESET(cat)
254{
255255   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), cat_int_ack);
256256   timer_pulse(machine, ATTOTIME_IN_HZ(120), NULL, 0, keyboard_callback);
257257}
r5932r5933
264264{
265265   UINT16 code;
266266   int y, x, b;
267   
268   int addr = 0;   
269   if (video_enable == 1)
267
268   int addr = 0;
269   if (video_enable == 1)
270270   {
271271      for (y = 0; y < 344; y++)
272272      {
273273         int horpos = 0;
274274         for (x = 0; x < 42; x++)
275         {         
275         {
276276            code = cat_video_ram[addr++];
277277            for (b = 15; b >= 0; b--)
278            {                       
278            {
279279               *BITMAP_ADDR16(bitmap, y, horpos++) = (code >> b) & 0x01;
280280            }
281281         }
r5932r5933
292292   memset(memory_get_read_ptr(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe2341), 0xff, 1);
293293}
294294
295static MACHINE_RESET(swyft)
295static MACHINE_RESET(swyft)
296296{
297297   timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, swyft_reset);
298298
r5932r5933
306306{
307307   UINT16 code;
308308   int y, x, b;
309   
310   int addr = 0;   
309
310   int addr = 0;
311311   for (y = 0; y < 242; y++)
312312   {
313313      int horpos = 0;
314314      for (x = 0; x < 20; x++)
315      {         
315      {
316316         code = swyft_video_ram[addr++];
317317         for (b = 15; b >= 0; b--)
318         {           
318         {
319319            *BITMAP_ADDR16(bitmap, y, horpos++) =  (code >> b) & 0x01;
320320         }
321321      }
r5932r5933
336336
337337static UINT8 duart_input(const device_config *device)
338338{
339   if (duart_inp != 0)
339   if (duart_inp != 0)
340340   {
341341      duart_inp = 0;
342342      return 0x0e;
343   }
344   else
343   }
344   else
345345   {
346346      duart_inp = 0x0e;
347347      return 0x00;
r5932r5933
425425ROM_END
426426
427427ROM_START( cat )
428   ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF )
428   ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF )
429429   // SYS ROM
430430   ROM_LOAD16_BYTE( "r240l0.bin", 0x00001, 0x10000, CRC(1b89bdc4) SHA1(39c639587dc30f9d6636b46d0465f06272838432) )
431431   ROM_LOAD16_BYTE( "r240h0.bin", 0x00000, 0x10000, CRC(94f89b8c) SHA1(6c336bc30636a02c625d31f3057ec86bf4d155fc) )
432432   ROM_LOAD16_BYTE( "r240l1.bin", 0x20001, 0x10000, CRC(1a73be4f) SHA1(e2de2cb485f78963368fb8ceba8fb66ca56dba34) )
433433   ROM_LOAD16_BYTE( "r240h1.bin", 0x20000, 0x10000, CRC(898dd9f6) SHA1(93e791dd4ed7e4afa47a04df6fdde359e41c2075) )
434434
435   ROM_REGION( 0x80000, "svrom", ROMREGION_ERASEFF )
435   ROM_REGION( 0x80000, "svrom", ROMREGION_ERASEFF )
436436ROM_END
437437
438438/* Driver */
src/mess/drivers/sg1000.c
r5932r5933
88171-5078 (C) SEGA 1983
99171-5046 REV. A (C) SEGA 1983
1010
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       |
3030|---------------------------------------------------------------------------------------|
3131
3232Notes:
3333    All IC's shown.
3434
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
4949
5050*/
5151
r5932r5933
5353
5454    TODO:
5555
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
6060    - SP-400 serial printer
61   - SH-400 racing controller
61    - SH-400 racing controller
6262    - SF-7000 serial comms
6363
6464*/
r5932r5933
169169
170170/* This is how the I/O ports are really mapped, but MAME does not support overlapping ranges
171171static 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)
178178ADDRESS_MAP_END
179179*/
180180
r5932r5933
398398   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
399399   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
400400/*
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')
411411
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')
420420
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))
423423*/
424424   PORT_START("NMI")
425425   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("PAUSE") PORT_CODE(KEYCODE_P) PORT_CHANGED(trigger_nmi, 0)
r5932r5933
809809
810810static DEVICE_IMAGE_LOAD( sc3000_cart )
811811{
812//   const address_space *program = cputag_get_address_space(image->machine, Z80_TAG, ADDRESS_SPACE_PROGRAM);
812//  const address_space *program = cputag_get_address_space(image->machine, Z80_TAG, ADDRESS_SPACE_PROGRAM);
813813   int size = image_length(image);
814814   UINT8 *ptr = memory_region(image->machine, Z80_TAG);
815815
r5932r5933
961961   MDRV_MSM8251_ADD("uart", default_msm8251_interface)
962962
963963   MDRV_NEC765A_ADD(NEC765_TAG, sf7000_nec765_interface)
964   
964
965965   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, sf7000_floppy_config)
966966MACHINE_DRIVER_END
967967
r5932r5933
10271027SYSTEM_CONFIG_END
10281028
10291029static SYSTEM_CONFIG_START( sf7000 )
1030   CONFIG_RAM_DEFAULT   (64 * 1024)   
1030   CONFIG_RAM_DEFAULT   (64 * 1024)
10311031   CONFIG_DEVICE(sf7000_serial_getinfo)
10321032SYSTEM_CONFIG_END
10331033
src/mess/drivers/ip22.c
r5932r5933
13551355{
13561356        1,                                      /* 1 SCSI device */
13571357        { { SCSI_ID_4, "cdrom", SCSI_DEVICE_CDROM } }  /* SCSI ID 4, using CD 0, and it's a CD-ROM */
1358//     { SCSI_ID_2, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */
1358//    { SCSI_ID_2, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */
13591359};
13601360
13611361static const struct WD33C93interface scsi_intf =
src/mess/drivers/mikromik.c
r5932r5933
1515
1616/*
1717
18   TODO:
18    TODO:
1919
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
2727
2828*/
2929
3030/*
3131
32   Nokia Elektroniikka pj
33   Controller ILC 9534
32    Nokia Elektroniikka pj
33    Controller ILC 9534
3434
35   Parts:
35    Parts:
3636
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
5050
51   DMA channels:
52   
53   0   CRT
54   1   MPSC transmit
55   2   MPSC receive
56   3   FDC
51    DMA channels:
5752
58   Interrupts:
53    0   CRT
54    1   MPSC transmit
55    2   MPSC receive
56    3   FDC
5957
60   INTR   MPSC INT
61   RST5.5   FDC IRQ
62   RST6.5   8212 INT
63   RST7.5   DMA EOP
58    Interrupts:
6459
60    INTR    MPSC INT
61    RST5.5  FDC IRQ
62    RST6.5  8212 INT
63    RST7.5  DMA EOP
64
6565*/
6666
6767INLINE const device_config *get_floppy_image(running_machine *machine, int drive)
r5932r5933
138138   AM_RANGE(0xff50, 0xff50) AM_MIRROR(0x8e) AM_DEVREAD(UPD765_TAG, nec765_status_r)
139139   AM_RANGE(0xff51, 0xff51) AM_MIRROR(0x8e) AM_DEVREADWRITE(UPD765_TAG, nec765_data_r, nec765_data_w)
140140   AM_RANGE(0xff60, 0xff67) AM_MIRROR(0x88) AM_WRITE(ls259_w)
141//   AM_RANGE(0xff70, 0xff7f) AM_MIRROR(0x80) AM_DEVREADWRITE(UPD7220_TAG, i82720_r, i82720_w)
141//  AM_RANGE(0xff70, 0xff7f) AM_MIRROR(0x80) AM_DEVREADWRITE(UPD7220_TAG, i82720_r, i82720_w)
142142ADDRESS_MAP_END
143143
144144/* Input Ports */
r5932r5933
196196
197197   PORT_START("ROW5")
198198   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('´') PORT_CHAR('`')
199   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('?') PORT_CHAR('`')
200200   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
201201   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
202202   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
r5932r5933
270270
271271   UINT8 data = state->char_rom[(charcode << 4) | linecount];
272272   int i;
273   
273
274274   for (i = 0; i < 8; i++)
275275   {
276276      *BITMAP_ADDR16(tmpbitmap, y, x + i) = BIT(data, i);
277277   }
278278}
279279
280static const i8275_interface mm1_i8275_intf =
280static const i8275_interface mm1_i8275_intf =
281281{
282282   SCREEN_TAG,
283283   8,
r5932r5933
332332   1,
333333   { 0 },
334334   { 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,
336336      8*8,  9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
337337   8*16
338338};
r5932r5933
370370static DMA8237_MEM_READ( memory_dma_r )
371371{
372372   const address_space *program = cputag_get_address_space(device->machine, I8085A_TAG, ADDRESS_SPACE_PROGRAM);
373//   logerror("DMA read %04x\n", offset);
373//  logerror("DMA read %04x\n", offset);
374374   return memory_read_byte(program, offset);
375375}
376376
377377static DMA8237_MEM_WRITE( memory_dma_w )
378378{
379379   const address_space *program = cputag_get_address_space(device->machine, I8085A_TAG, ADDRESS_SPACE_PROGRAM);
380//   logerror("DMA write %04x:%02x\n", offset, data);
380//  logerror("DMA write %04x:%02x\n", offset, data);
381381   memory_write_byte(program, offset, data);
382382}
383383
r5932r5933
394394
395395   /* clear data request */
396396   dma8237_drq_write(state->i8237, DMA_MPSC_RX, CLEAR_LINE);
397   
397
398398   return upd7201_hai_r(state->upd7201, 0);
399399}
400400
r5932r5933
445445   tc_w
446446};
447447
448/* µPD765 Interface */
448/* ?PD765 Interface */
449449
450450static NEC765_DMA_REQUEST( drq_w )
451451{
r5932r5933
509509   }
510510};
511511
512/* µPD7201 Interface */
512/* ?PD7201 Interface */
513513
514514static WRITE_LINE_DEVICE_HANDLER( drq2_w )
515515{
r5932r5933
670670      /* get key data from PROM */
671671      keydata = state->key_rom[(ctrl << 8) | (shift << 7) | (state->drive << 3) | (state->sense)];
672672   }
673   
673
674674   if (state->keydata != keydata)
675675   {
676676      /* latch key data */
r5932r5933
744744   MDRV_PIT8253_ADD(I8253_TAG, mm1_pit8253_intf)
745745   MDRV_NEC765A_ADD(UPD765_TAG, /* XTAL_16MHz/2/2, */ mm1_nec765_intf)
746746   MDRV_UPD7201_ADD(UPD7201_TAG, XTAL_6_144MHz/2, mm1_upd7201_intf)
747   
747
748748   MDRV_FLOPPY_2_DRIVES_ADD(mm1_floppy_config)
749749MACHINE_DRIVER_END
750750
r5932r5933
762762
763763   /*
764764
765      Address Decoder PROM outputs
765        Address Decoder PROM outputs
766766
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
775775
776   */
776    */
777777   ROM_REGION( 0x200, "address", 0 ) /* address decoder */
778778   ROM_LOAD( "720793a.ic24", 0x0000, 0x0200, CRC(deea87a6) SHA1(8f19e43252c9a0b1befd02fc9d34fe1437477f3a) )
779779
r5932r5933
798798
799799/* System Drivers */
800800
801//    YEAR  NAME      PARENT  COMPAT   MACHINE      INPUT      INIT   CONFIG    COMPANY         FULLNAME            FLAGS
801//    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    CONFIG    COMPANY           FULLNAME                FLAGS
802802COMP( 1981, mm1m6,      0,      0,      mm1m6,      mm1,      0,       mm1m6,     "Nokia Data",      "MikroMikko 1 M6",      GAME_NOT_WORKING )
803803COMP( 1981, mm1m7,      mm1m6,   0,      mm1m6,      mm1,      0,       mm1m7,     "Nokia Data",      "MikroMikko 1 M7",      GAME_NOT_WORKING )
src/mess/drivers/pc98.c
r5932r5933
33    NEC PC-98 computer series
44
55    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
77    1990s, they run MS Windows as OS)
88
9   Models:
9    Models:
1010
1111                      |  CPU                          |   RAM    |            Drives                                     | CBus| Release |
1212    PC-9801           |  8086 @ 5                     |  128 KB  | -                                                     |  6  | 1982/10 |
1313    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 |
1616    PC-9801F3         |  8086-2 @ 5/8                 |  256 KB  | 5"2DDx1, 10M SASI HDD                                 |  2  | 1984/10 |
1717    PC-9801M2         |  8086-2 @ 5/8                 |  256 KB  | 5"2HDx2                                               |  4  | 1984/11 |
1818    PC-9801M3         |  8086-2 @ 5/8                 |  256 KB  | 5"2HDx1, 20M SASI HDD                                 |  3  | 1985/02 |
1919    PC-9801U2         |  V30 @ 8                      |  128 KB  | 3.5"2HDx2                                             |  2  | 1985/05 |
2020    PC-98XA1          |  80286 @ 8                    |  512 KB  | -                                                     |  6  | 1985/05 |
2121    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 |
2323    PC-9801VF2        |  V30 @ 8                      |  384 KB  | 5"2DDx2                                               |  4  | 1985/07 |
2424    PC-9801VM0        |  V30 @ 8/10                   |  384 KB  | -                                                     |  4  | 1985/07 |
2525    PC-9801VM2        |  V30 @ 8/10                   |  384 KB  | 5"2DD/2HDx2                                           |  4  | 1985/07 |
2626    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 |
2828    PC-98XA21         |  80286 @ 8                    |  512 KB  | 5"2DD/2HDx2                                           |  6  | 1986/05 |
2929    PC-98XA31         |  80286 @ 8                    |  512 KB  | 5"2DD/2HDx1, 20M SASI HDD                             |  6  | 1986/05 |
3030    PC-9801UV2        |  V30 @ 8/10                   |  384 KB  | 3.5"2DD/2HDx2                                         |  2  | 1986/05 |
src/mess/drivers/spec128.c
r5932r5933
11/***************************************************************************
22
3   NOTE: ****** Specbusy: press N, R, or E to boot *************
3    NOTE: ****** Specbusy: press N, R, or E to boot *************
44
55
66        Spectrum/Inves/TK90X etc. memory map:
r5932r5933
226226}
227227
228228static 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)
230230   AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00)
231231   AM_RANGE(0x007f, 0x007f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00)
232232   AM_RANGE(0x00df, 0x00df) AM_READ(spectrum_port_df_r) AM_MIRROR(0xff00)
233233   AM_RANGE(0x4000, 0x4000) AM_WRITE(spectrum_128_port_7ffd_w) AM_MIRROR(0x3ffd)
234234   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd)
235235   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)
237237ADDRESS_MAP_END
238238
239239static ADDRESS_MAP_START (spectrum_128_mem, ADDRESS_SPACE_PROGRAM, 8)
r5932r5933
280280   /* sound hardware */
281281   MDRV_SOUND_ADD("ay8912", AY8912, 1773400)
282282   MDRV_SOUND_CONFIG(spectrum_ay_interface)
283   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)   
283   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
284284MACHINE_DRIVER_END
285285
286286
r5932r5933
297297   ROM_REGION(0x18000,"maincpu",0)
298298   ROM_SYSTEM_BIOS( 0, "en", "English" )
299299   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))
301301   ROM_SYSTEM_BIOS( 1, "sp", "Spanish" )
302302   ROMX_LOAD("zx128s0.rom",0x10000,0x4000, CRC(453d86b2) SHA1(968937b1c750f0ef6205f01c6db4148da4cca4e3), ROM_BIOS(2))
303303   ROMX_LOAD("zx128s1.rom",0x14000,0x4000, CRC(6010e796) SHA1(bea3f397cc705eafee995ea629f4a82550562f90), ROM_BIOS(2))
r5932r5933
317317   ROMX_LOAD("plus2sp1.rom",0x14000,0x4000, CRC(41981d4b) SHA1(ec0d5a158842d20601b4fbeaefc6668db979d0e1), ROM_BIOS(3))
318318   ROM_SYSTEM_BIOS( 3, "ao", "ZX Spectrum +2c (Andrew Owen)" )
319319   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))
321321   ROM_SYSTEM_BIOS( 4, "namco", "ZX Spectrum +2c (Namco)" )
322322   ROMX_LOAD("pl2namco.rom",0x10000,0x8000, CRC(72a54e75) SHA1(311400157df689450dadc3620f4c4afa960b05ad), ROM_BIOS(5))
323323   ROM_CART_LOAD("cart", 0x10000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
r5932r5933
326326ROM_START(hc128)
327327   ROM_REGION(0x18000,"maincpu",0)
328328   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))
330330   ROM_CART_LOAD("cart", 0x10000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
331331ROM_END
332332
r5932r5933
334334   ROM_REGION(0x18000,"maincpu",0)
335335   ROM_SYSTEM_BIOS( 0, "v1", "Version 1" )
336336   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))
338338   ROM_SYSTEM_BIOS( 1, "v2", "Version 2" )
339339   ROMX_LOAD("zx128_0.rom",0x10000,0x4000, CRC(e76799d2) SHA1(4f4b11ec22326280bdb96e3baf9db4b4cb1d02c5), ROM_BIOS(2))
340340   ROMX_LOAD("hc2000.v2",  0x14000,0x4000, CRC(65d90464) SHA1(5e2096e6460ff2120c8ada97579fdf82c1199c09), ROM_BIOS(2))
src/mess/drivers/p2000t.c
r5932r5933
9595
9696/* 2008-05 FP:
9797TO DO: verify position of the following keys: '1/4 3/4', '-> <-', '@ up', 'Clrln'
98Also, notice that pictures of p2000 units shows slightly different key mappings, suggesting
98Also, notice that pictures of p2000 units shows slightly different key mappings, suggesting
9999many different .chr roms could exist
100100
101101Small note about natural keyboard support: currently,
src/mess/drivers/a2600.c
r5932r5933
533533   }
534534   /* Check the reset vector does not point into the super chip RAM area */
535535   i = ( cart[0x0FFD] << 8 ) | cart[0x0FFC];
536   if ( ( i & 0x0FFF ) < 0x0100 )
536   if ( ( i & 0x0FFF ) < 0x0100 )
537537   {
538538      return 0;
539539   }
r5932r5933
579579
580580   image_fread(image, cart, cart_size);
581581
582   if (!(cart_size == 0x4000 && detect_modef6(image->machine)))
582   if (!(cart_size == 0x4000 && detect_modef6(image->machine)))
583583   {
584      while (cart_size > 0x00800)
584      while (cart_size > 0x00800)
585585      {
586586         if (!memcmp(cart, &cart[cart_size/2],cart_size/2)) cart_size /= 2;
587587         else break;
r5932r5933
590590
591591   extrainfo = image_extrainfo( image );
592592
593   if ( extrainfo && extrainfo[0] )
593   if ( extrainfo && extrainfo[0] )
594594   {
595      for ( eibd = extrainfo_banking_defs; eibd->extrainfo[0]; eibd++ )
595      for ( eibd = extrainfo_banking_defs; eibd->extrainfo[0]; eibd++ )
596596      {
597         if ( ! mame_stricmp( eibd->extrainfo, extrainfo ) )
597         if ( ! mame_stricmp( eibd->extrainfo, extrainfo ) )
598598         {
599599            banking_mode = eibd->bank_mode;
600600         }
r5932r5933
675675static void modeFV_switch(running_machine *machine, UINT16 offset, UINT8 data)
676676{
677677   //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 )
679679   {
680680      FVlocked = 1;
681681      current_bank = current_bank ^ 0x01;
r5932r5933
685685}
686686static void modeJVP_switch(running_machine *machine, UINT16 offset, UINT8 data)
687687{
688   switch( offset )
688   switch( offset )
689689   {
690690   case 0x00:
691691   case 0x20:
r5932r5933
726726static WRITE8_HANDLER(modeDC_switch_w) { modeDC_switch(space->machine, offset, data); }
727727static WRITE8_HANDLER(mode3E_switch_w) { mode3E_switch(space->machine, offset, data); }
728728static WRITE8_HANDLER(mode3E_RAM_switch_w) { mode3E_RAM_switch(space->machine, offset, data); }
729static WRITE8_HANDLER(mode3E_RAM_w)
729static WRITE8_HANDLER(mode3E_RAM_w)
730730{
731   if ( mode3E_ram_enabled )
731   if ( mode3E_ram_enabled )
732732   {
733733      ram_base[offset] = data;
734734   }
r5932r5933
739739
740740static DIRECT_UPDATE_HANDLER( modeF6_opbase )
741741{
742   if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 )
742   if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 )
743743   {
744744      modeF6_switch_w( space, ( address & 0x1FFF ) - 0x1FF6, 0 );
745745   }
r5932r5933
748748
749749static DIRECT_UPDATE_HANDLER( modeSS_opbase )
750750{
751   if ( address & 0x1000 )
751   if ( address & 0x1000 )
752752   {
753753      direct->bytemask = 0x7ff;
754754      direct->bytestart = ( address & 0xf800 );
755755      direct->byteend = ( address & 0xf800 ) | 0x7ff;
756      if ( address & 0x800 )
756      if ( address & 0x800 )
757757      {
758758         direct->decrypted = bank_base[2];
759759         direct->raw = bank_base[2];
760      }
761      else
760      }
761      else
762762      {
763763         direct->decrypted = bank_base[1];
764764         direct->raw = bank_base[1];
r5932r5933
774774
775775   //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset);
776776   /* Check for control register "write" */
777   if ( offset == 0xFF8 )
777   if ( offset == 0xFF8 )
778778   {
779779      //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), modeSS_byte);
780780      modeSS_write_enabled = modeSS_byte & 0x02;
781781      modeSS_write_delay = modeSS_byte >> 5;
782      switch ( modeSS_byte & 0x1C )
782      switch ( modeSS_byte & 0x1C )
783783      {
784784      case 0x00:
785785         bank_base[1] = extra_RAM + 2 * 0x800;
r5932r5933
826826      memory_set_bankptr(space->machine, 2, bank_base[2] );
827827
828828      /* 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 )
830830      {
831831         const device_config *img = devtag_get_device(space->machine, "cassette");
832         if ( img )
832         if ( img )
833833         {
834834            cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
835835         }
836836      }
837   }
838   else if ( offset == 0xFF9 )
837   }
838   else if ( offset == 0xFF9 )
839839   {
840840      /* Cassette port read */
841841      double tap_val = cassette_input( devtag_get_device(space->machine, "cassette") );
842842      //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 )
844844      {
845845         data = 0x00;
846      }
847      else
846      }
847      else
848848      {
849849         data = 0x01;
850850      }
851   }
852   else
851   }
852   else
853853   {
854854      /* Possible RAM write */
855      if ( modeSS_write_enabled )
855      if ( modeSS_write_enabled )
856856      {
857857         int diff = cputag_get_total_cycles(space->machine, "maincpu") - modeSS_byte_started;
858858         //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 )
860860         {
861861            //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 )
863863            {
864               if ( modeSS_high_ram_enabled )
864               if ( modeSS_high_ram_enabled )
865865               {
866866                  bank_base[2][offset & 0x7FF] = modeSS_byte;
867867                  data = modeSS_byte;
868868               }
869            }
870            else
869            }
870            else
871871            {
872872               bank_base[1][offset] = modeSS_byte;
873873               data = modeSS_byte;
874874            }
875         }
876         else if ( offset < 0x0100 )
875         }
876         else if ( offset < 0x0100 )
877877         {
878878            modeSS_byte = offset;
879879            modeSS_byte_started = cputag_get_total_cycles(space->machine, "maincpu");
880880         }
881881         /* Check for dummy read from same address */
882         if ( diff == 2 )
882         if ( diff == 2 )
883883         {
884884            modeSS_diff_adjust = 1;
885         }
886         else
885         }
886         else
887887         {
888888            modeSS_diff_adjust = 0;
889889         }
890      }
891      else if ( offset < 0x0100 )
890      }
891      else if ( offset < 0x0100 )
892892      {
893893         modeSS_byte = offset;
894894         modeSS_byte_started = cputag_get_total_cycles(space->machine, "maincpu");
r5932r5933
896896   }
897897   /* Because the mame core caches opcode data and doesn't perform reads like normal */
898898   /* 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 )
900900   {
901901      modeSS_r( space, 0xFF8 );
902902   }
903903   return data;
904904}
905905
906INLINE void modeDPC_check_flag(UINT8 data_fetcher)
906INLINE void modeDPC_check_flag(UINT8 data_fetcher)
907907{
908908   /* 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 )
910910   {
911911      dpc.df[data_fetcher].flag = 1;
912912   }
913913   /* 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 )
915915   {
916916      dpc.df[data_fetcher].flag = 0;
917917   }
918918}
919919
920INLINE void modeDPC_decrement_counter(UINT8 data_fetcher)
920INLINE void modeDPC_decrement_counter(UINT8 data_fetcher)
921921{
922922   dpc.df[data_fetcher].low -= 1;
923   if ( dpc.df[data_fetcher].low == 0xFF )
923   if ( dpc.df[data_fetcher].low == 0xFF )
924924   {
925925      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 )
927927      {
928928         dpc.df[data_fetcher].low = dpc.df[data_fetcher].top;
929929      }
r5932r5933
935935static TIMER_CALLBACK(modeDPC_timer_callback)
936936{
937937   int data_fetcher;
938   for( data_fetcher = 5; data_fetcher < 8; data_fetcher++ )
938   for( data_fetcher = 5; data_fetcher < 8; data_fetcher++ )
939939   {
940      if ( dpc.df[data_fetcher].osc_clk )
940      if ( dpc.df[data_fetcher].osc_clk )
941941      {
942942         modeDPC_decrement_counter( data_fetcher );
943943      }
r5932r5933
961961   UINT8   data = 0xFF;
962962
963963   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 )
965965   {
966      switch( offset & 0x06 )
966      switch( offset & 0x06 )
967967      {
968968      case 0x00:      /* Random number generator */
969969      case 0x02:
r5932r5933
974974         dpc.latch_64 = dpc.latch_62 + dpc.df[4].top;
975975         dpc.dlc = ( dpc.latch_62 + dpc.df[4].top > 0xFF ) ? 1 : 0;
976976         data = 0;
977         if ( dpc.df[5].music_mode && dpc.df[5].flag )
977         if ( dpc.df[5].music_mode && dpc.df[5].flag )
978978         {
979979            data |= 0x01;
980980         }
981         if ( dpc.df[6].music_mode && dpc.df[6].flag )
981         if ( dpc.df[6].music_mode && dpc.df[6].flag )
982982         {
983983            data |= 0x02;
984984         }
985         if ( dpc.df[7].music_mode && dpc.df[7].flag )
985         if ( dpc.df[7].music_mode && dpc.df[7].flag )
986986         {
987987            data |= 0x04;
988988         }
989989         return ( dpc.dlc ? dpc.movamt & 0xF0 : 0 ) | dpc_amplitude[data];
990990      }
991   }
992   else
991   }
992   else
993993   {
994994      UINT8   display_data = memory_region(space->machine, "user1")[0x2000 + ( ~ ( ( dpc.df[data_fetcher].low | ( dpc.df[data_fetcher].high << 8 ) ) ) & 0x7FF ) ];
995995
996      switch( offset & 0x38 )
996      switch( offset & 0x38 )
997997      {
998998      case 0x08:         /* display data */
999999         data = display_data;
r5932r5933
10181018         break;
10191019      }
10201020
1021      if ( data_fetcher < 5 || ! dpc.df[data_fetcher].osc_clk )
1021      if ( data_fetcher < 5 || ! dpc.df[data_fetcher].osc_clk )
10221022      {
10231023         modeDPC_decrement_counter( data_fetcher );
10241024      }
r5932r5933
10301030{
10311031   UINT8   data_fetcher = offset & 0x07;
10321032
1033   switch( offset & 0x38 )
1033   switch( offset & 0x38 )
10341034   {
10351035   case 0x00:         /* Top count */
10361036      dpc.df[data_fetcher].top = data;
r5932r5933
10431043      break;
10441044   case 0x10:         /* Counter low */
10451045      dpc.df[data_fetcher].low = data;
1046      if ( data_fetcher == 4 )
1046      if ( data_fetcher == 4 )
10471047      {
10481048         dpc.latch_64 = data;
10491049      }
1050      if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode )
1050      if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode )
10511051      {
10521052         dpc.df[data_fetcher].low = dpc.df[data_fetcher].top;
10531053      }
r5932r5933
10571057      dpc.df[data_fetcher].high = data;
10581058      dpc.df[data_fetcher].music_mode = data & 0x10;
10591059      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 )
10611061      {
10621062         dpc.df[data_fetcher].low = dpc.df[data_fetcher].top;
10631063         modeDPC_check_flag( data_fetcher );
r5932r5933
11531153   running_machine *machine = device->machine;
11541154
11551155   /* Left controller port */
1156   if ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT == 0x03 )
1156   if ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT == 0x03 )
11571157   {
11581158      keypad_left_column = data / 16;
11591159   }
11601160
11611161   /* Right controller port */
1162   switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT )
1162   switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT )
11631163   {
11641164   case 0x03:   /* Keypad */
11651165      keypad_right_column = data & 0x0F;
r5932r5933
11771177   UINT8 val = 0;
11781178
11791179   /* 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 )
11811181   {
11821182   case 0x00:  /* Joystick */
11831183   case 0x05:   /* Joystick w/Boostergrip */
r5932r5933
11991199   }
12001200
12011201   /* 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 )
12031203   {
12041204   case 0x00:   /* Joystick */
12051205   case 0x05:   /* Joystick w/Boostergrip */
r5932r5933
12701270   }
12711271}
12721272
1273static READ16_HANDLER(a2600_read_input_port)
1273static READ16_HANDLER(a2600_read_input_port)
12741274{
12751275   int i;
12761276
1277   switch( offset )
1277   switch( offset )
12781278   {
12791279   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 )
12811281      {
12821282      case 0x00:   /* Joystick */
12831283         return TIA_INPUT_PORT_ALWAYS_OFF;
12841284      case 0x01:   /* Paddle */
12851285         return input_port_read(space->machine, "PADDLE1");
12861286      case 0x03:   /* Keypad */
1287         for ( i = 0; i < 4; i++ )
1287         for ( i = 0; i < 4; i++ )
12881288         {
1289            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
1289            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
12901290            {
1291               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x01 )
1291               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x01 )
12921292               {
12931293                  return TIA_INPUT_PORT_ALWAYS_ON;
1294               }
1295               else
1294               }
1295               else
12961296               {
12971297                  return TIA_INPUT_PORT_ALWAYS_OFF;
12981298               }
r5932r5933
13061306      }
13071307      break;
13081308   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 )
13101310      {
13111311      case 0x00:   /* Joystick */
13121312         return TIA_INPUT_PORT_ALWAYS_OFF;
13131313      case 0x01:   /* Paddle */
13141314         return input_port_read(space->machine, "PADDLE3");
13151315      case 0x03:   /* Keypad */
1316         for ( i = 0; i < 4; i++ )
1316         for ( i = 0; i < 4; i++ )
13171317         {
1318            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
1318            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
13191319            {
1320               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x02 )
1320               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x02 )
13211321               {
13221322                  return TIA_INPUT_PORT_ALWAYS_ON;
1323               }
1324               else
1323               }
1324               else
13251325               {
13261326                  return TIA_INPUT_PORT_ALWAYS_OFF;
13271327               }
r5932r5933
13351335      }
13361336      break;
13371337   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 )
13391339      {
13401340      case 0x00:   /* Joystick */
13411341         return TIA_INPUT_PORT_ALWAYS_OFF;
13421342      case 0x01:   /* Paddle */
13431343         return input_port_read(space->machine, "PADDLE2");
13441344      case 0x03:   /* Keypad */
1345         for ( i = 0; i < 4; i++ )
1345         for ( i = 0; i < 4; i++ )
13461346         {
1347            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
1347            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
13481348            {
1349               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x01 )
1349               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x01 )
13501350               {
13511351                  return TIA_INPUT_PORT_ALWAYS_ON;
1352               }
1353               else
1352               }
1353               else
13541354               {
13551355                  return TIA_INPUT_PORT_ALWAYS_OFF;
13561356               }
r5932r5933
13641364      }
13651365      break;
13661366   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 )
13681368      {
13691369      case 0x00:   /* Joystick */
13701370         return TIA_INPUT_PORT_ALWAYS_OFF;
13711371      case 0x01:   /* Paddle */
13721372         return input_port_read(space->machine, "PADDLE4");
13731373      case 0x03:   /* Keypad */
1374         for ( i = 0; i < 4; i++ )
1374         for ( i = 0; i < 4; i++ )
13751375         {
1376            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
1376            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
13771377            {
1378               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x02 )
1378               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x02 )
13791379               {
13801380                  return TIA_INPUT_PORT_ALWAYS_ON;
1381               }
1382               else
1381               }
1382               else
13831383               {
13841384                  return TIA_INPUT_PORT_ALWAYS_OFF;
13851385               }
r5932r5933
13931393      }
13941394      break;
13951395   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 )
13971397      {
13981398      case 0x00:   /* Joystick */
13991399      case 0x05:   /* Joystick w/Boostergrip */
r5932r5933
14031403      case 0x02:   /* Driving */
14041404         return input_port_read(space->machine, "BUTTONS_L") << 3;
14051405      case 0x03:   /* Keypad */
1406         for ( i = 0; i < 4; i++ )
1406         for ( i = 0; i < 4; i++ )
14071407         {
1408            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
1408            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
14091409            {
1410               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x04 )
1410               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x04 )
14111411               {
14121412                  return 0xff;
1413               }
1414               else
1413               }
1414               else
14151415               {
14161416                  return 0x00;
14171417               }
r5932r5933
14251425      }
14261426      break;
14271427   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 )
14291429      {
14301430      case 0x00:   /* Joystick */
14311431      case 0x05:   /* Joystick w/Boostergrip */
r5932r5933
14351435      case 0x02:   /* Driving */
14361436         return input_port_read(space->machine, "BUTTONS_R") << 3;
14371437      case 0x03:   /* Keypad */
1438         for ( i = 0; i < 4; i++ )
1438         for ( i = 0; i < 4; i++ )
14391439         {
1440            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
1440            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
14411441            {
1442               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x04 )
1442               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x04 )
14431443               {
14441444                  return 0xff;
1445               }
1446               else
1445               }
1446               else
14471447               {
14481448                  return 0x00;
14491449               }
r5932r5933
14681468   Q-Bert's Qubes (NTSC,F6) at 0x1594
14691469   Berzerk at 0xF093.
14701470*/
1471static READ8_HANDLER(a2600_get_databus_contents)
1471static READ8_HANDLER(a2600_get_databus_contents)
14721472{
14731473   UINT16   last_address, prev_address;
14741474   UINT8   last_byte, prev_byte;
14751475
14761476   last_address = cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) - 1;
1477   if ( ! ( last_address & 0x1080 ) )
1477   if ( ! ( last_address & 0x1080 ) )
14781478   {
14791479      return offset;
14801480   }
14811481   last_byte = memory_read_byte(space,  last_address );
1482   if ( last_byte < 0x80 || last_byte == 0xFF )
1482   if ( last_byte < 0x80 || last_byte == 0xFF )
14831483   {
14841484      return last_byte;
14851485   }
14861486   prev_address = last_address - 1;
1487   if ( ! ( prev_address & 0x1080 ) )
1487   if ( ! ( prev_address & 0x1080 ) )
14881488   {
14891489      return last_byte;
14901490   }
14911491   prev_byte = memory_read_byte(space,  prev_address );
1492   if ( prev_byte == 0xB1 )
1492   if ( prev_byte == 0xB1 )
14931493   {   /* LDA (XX),Y */
14941494      return memory_read_byte(space,  last_byte + 1 );
14951495   }
r5932r5933
15031503   { 26, 26 + 160 + 16, 48, 48 + 240 + 31 }   /* 342 */
15041504};
15051505
1506static WRITE16_HANDLER( a2600_tia_vsync_callback )
1506static WRITE16_HANDLER( a2600_tia_vsync_callback )
15071507{
15081508   int i;
15091509
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++ )
15111511   {
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 )
15131513      {
1514         if ( supported_screen_heights[i] != current_screen_height )
1514         if ( supported_screen_heights[i] != current_screen_height )
15151515         {
15161516            current_screen_height = supported_screen_heights[i];
15171517//              video_screen_configure( machine->primary_screen, 228, current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * current_screen_height );
r5932r5933
15201520   }
15211521}
15221522
1523static WRITE16_HANDLER( a2600_tia_vsync_callback_pal )
1523static WRITE16_HANDLER( a2600_tia_vsync_callback_pal )
15241524{
15251525   int i;
15261526
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++ )
15281528   {
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 )
15301530      {
1531         if ( supported_screen_heights[i] != current_screen_height )
1531         if ( supported_screen_heights[i] != current_screen_height )
15321532         {
15331533            current_screen_height = supported_screen_heights[i];
15341534//              video_screen_configure( machine->primary_screen, 228, current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * current_screen_height );
r5932r5933
15711571   current_reset_bank_counter = 0xFF;
15721572}
15731573
1574static void set_category_value( running_machine *machine, const char* cat, const char *cat_selection )
1574static void set_category_value( running_machine *machine, const char* cat, const char *cat_selection )
15751575{
15761576   /* NPW 22-May-2008 - FIXME */
15771577#if 0
15781578   input_port_entry   *cat_in = NULL;
15791579   input_port_entry   *in;
15801580
1581   for( in = machine->input_ports; in->type != IPT_END; in++ )
1581   for( in = machine->input_ports; in->type != IPT_END; in++ )
15821582   {
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) ) )
15841584      {
15851585         cat_in = in;
15861586      }
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) ) )
15881588      {
15891589         cat_in->default_value = in->default_value;
15901590         return;
r5932r5933
15931593#endif
15941594}
15951595
1596static void set_controller( running_machine *machine, const char *controller, unsigned int selection )
1596static void set_controller( running_machine *machine, const char *controller, unsigned int selection )
15971597{
15981598   /* Defaulting to only joystick when joysstick and paddle are set for now... */
15991599   if ( selection == JOYS + PADD )
16001600      selection = JOYS;
16011601
1602   switch( selection )
1602   switch( selection )
16031603   {
16041604   case JOYS:   set_category_value( machine, controller, "Joystick" ); break;
16051605   case PADD:   set_category_value( machine, controller, STR_PADDLES ); break;
r5932r5933
16451645   if (banking_mode == 0xff) if (detect_32K_mode3F(machine)) banking_mode = mode3F;
16461646   if (banking_mode == 0xff) if (detect_modeE7(machine)) banking_mode = modeE7;
16471647
1648   if (banking_mode == 0xff)
1648   if (banking_mode == 0xff)
16491649   {
16501650      switch (cart_size)
16511651      {
r5932r5933
17081708      break;
17091709
17101710   case modeF8:
1711      if (!memcmp(&CART[0x1ffc],snowwhite,sizeof(snowwhite)))
1711      if (!memcmp(&CART[0x1ffc],snowwhite,sizeof(snowwhite)))
17121712      {
17131713         install_banks(machine, 1, 0x0000);
1714      }
1715      else
1714      }
1715      else
17161716      {
17171717         install_banks(machine, 1, 0x1000);
17181718      }
r5932r5933
18901890      memory_set_direct_update_handler(space, modeDPC_opbase_handler );
18911891      {
18921892         int   data_fetcher;
1893         for( data_fetcher = 0; data_fetcher < 8; data_fetcher++ )
1893         for( data_fetcher = 0; data_fetcher < 8; data_fetcher++ )
18941894         {
18951895            dpc.df[data_fetcher].osc_clk = 0;
18961896            dpc.df[data_fetcher].flag = 0;
src/mess/drivers/studio2.c
r5932r5933
7878      TMM331  - Toshiba TMM331AP 2k x8 MASKROM (DIP24)
7979                Pinout (preliminary):
8080                           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? ? ?                   |----------|
9595
9696*/
9797
r5932r5933
140140
141141/*
142142
143   RCA Studio II games list
143    RCA Studio II games list
144144
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
163163
164164
165   MPT-02 games list
165    MPT-02 games list
166166
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
182182
183183*/
184184
r5932r5933
186186
187187    TODO:
188188
189   - studio2 cpu clock from schematics
190   - visicom alternate videoram @ 0x1300 ?
189    - studio2 cpu clock from schematics
190    - visicom alternate videoram @ 0x1300 ?
191191    - mpt02/mustang cdp1864 colors
192192    - discrete sound
193   - Academy Apollo 80 (Germany)
193    - Academy Apollo 80 (Germany)
194194
195195*/
196196
r5932r5933
242242   AM_RANGE(0x0000, 0x07ff) AM_ROM
243243   AM_RANGE(0x1000, 0x10ff) AM_MIRROR(0x200) AM_RAM
244244   AM_RANGE(0x1100, 0x11ff) AM_RAM
245//   AM_RANGE(0x1200, 0x12ff) AM_RAM
245//  AM_RANGE(0x1200, 0x12ff) AM_RAM
246246   AM_RANGE(0x1300, 0x13ff) AM_RAM
247247ADDRESS_MAP_END
248248
r5932r5933
465465
466466   /* find devices */
467467   state->cdp1864 = devtag_get_device(machine, CDP1864_TAG);
468   
468
469469   /* register for state saving */
470470   state_save_register_global(machine, state->cdp1802_mode);
471471   state_save_register_global(machine, state->keylatch);
r5932r5933
559559   MDRV_SPEAKER_STANDARD_MONO("mono")
560560   MDRV_SOUND_ADD("beep", BEEP, 0)
561561   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
562   
562
563563   MDRV_IMPORT_FROM( studio2_cartslot )
564564MACHINE_DRIVER_END
565565
r5932r5933
590590   MDRV_SPEAKER_STANDARD_MONO("mono")
591591   MDRV_SOUND_ADD("beep", BEEP, 0)
592592   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
593   
593
594594   MDRV_IMPORT_FROM( studio2_cartslot )
595595MACHINE_DRIVER_END
596596
r5932r5933
618618   MDRV_SPEAKER_STANDARD_MONO("mono")
619619   MDRV_CDP1864_ADD(CDP1864_TAG, CDP1864_CLOCK, mpt02_cdp1864_intf)
620620   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
621   
621
622622   MDRV_IMPORT_FROM( studio2_cartslot )
623623MACHINE_DRIVER_END
624624
src/mess/drivers/pcw.c
r5932r5933
156156   else
157157      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
158158
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
160160   if(fdc_interrupt_code == 1 && (pcw_system_status & 0x20))
161161   {
162162      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
163163      return;
164164   }
165   
165
166166   if(pcw_timer_irq_flag != 0)
167167   {
168168      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
r5932r5933
244244      memory_install_read8_handler(space,
245245         block * 0x04000 + 0x3ff0, block * 0x04000 + 0x3fff, 0, 0,
246246         pcw_keyboard_r);
247//      LOG(("MEM: read block %i -> bank %i\n",block,bank));
247//      LOG(("MEM: read block %i -> bank %i\n",block,bank));
248248   }
249249   else
250250   {
r5932r5933
252252      memory_install_read8_handler(space,
253253         block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff, 0, 0,
254254         (read8_space_func) (STATIC_BANK1 + (FPTR)block));
255//      LOG(("MEM: read block %i -> bank %i\n",block,bank));
255//      LOG(("MEM: read block %i -> bank %i\n",block,bank));
256256   }
257257   memory_set_bankptr(machine, block + 1, mess_ram + ((bank * 0x4000) % mess_ram_size));
258258}
r5932r5933
262262static void pcw_update_write_memory_block(running_machine *machine, int block, int bank)
263263{
264264   memory_set_bankptr(machine, block + 5, mess_ram + ((bank * 0x4000) % mess_ram_size));
265//   LOG(("MEM: write block %i -> bank %i\n",block,bank));
265//  LOG(("MEM: write block %i -> bank %i\n",block,bank));
266266}
267267
268268
r5932r5933
376376   pcw_banks[offset] = data;
377377
378378   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]);
380380}
381381
382382static WRITE8_HANDLER(pcw_bank_force_selection_w)
r5932r5933
568568{
569569   /* from Jacob Nevins docs */
570570   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));
573573   return ret;
574574}
575575
r5932r5933
693693
694694static ADDRESS_MAP_START(pcw_io, ADDRESS_SPACE_IO, 8)
695695   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)
697697   AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r,         pcw_expansion_w)
698698   AM_RANGE(0x0f0, 0x0f3) AM_WRITE(                        pcw_bank_select_w)
699699   AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r,   pcw_bank_force_selection_w)
r5932r5933
739739{
740740   /* ram paging is actually undefined at power-on */
741741   pcw_bank_force = 0x00;
742   
742
743743   pcw_banks[0] = 0x80;
744744   pcw_banks[1] = 0x81;
745745   pcw_banks[2] = 0x82;
r5932r5933
759759
760760   cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0x0ff);
761761
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 */
764764
765   memset(mess_ram,0x00,mess_ram_size);   
765   memset(mess_ram,0x00,mess_ram_size);
766766   for(x=0;x<256;x++)
767767      mess_ram[x+2] = code[x];
768768
r5932r5933
792792b0:   f4     exit   del>   =      0      8      6      4      1             f6
793793      &3FF0  &3FF1  &3FF2  &3FF3  &3FF4  &3FF5  &3FF6  &3FF7  &3FF8  &3FF9  &3FFA
794794
7952008-05 FP:
7952008-05 FP:
796796Small note about atural keyboard: currently,
797797- "Paste" is mapped to 'F9'
798798- "Exit" is mapped to 'F10'
r5932r5933
921921   PORT_START("LINE12")   /* 0x03ffc */
922922   PORT_BIT(0xff, 0x00,    IPT_UNUSED)
923923
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. */
926926   PORT_START("LINE13")   /* 0x03ffd */
927927   PORT_BIT(0x3f, 0x000, IPT_UNUSED)
928928   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SHIFT LOCK") //PORT_CODE(KEYCODE_CAPSLOCK)
r5932r5933
10081008   MDRV_SPEAKER_STANDARD_MONO("mono")
10091009   MDRV_SOUND_ADD("beep", BEEP, 0)
10101010   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
1011   
1011
10121012   MDRV_NEC765A_ADD("nec765", pcw_nec765_interface)
1013   
1013
10141014   MDRV_FLOPPY_2_DRIVES_ADD(pcw_floppy_config)
10151015MACHINE_DRIVER_END
10161016
r5932r5933
10321032/* I am loading the boot-program outside of the Z80 memory area, because it
10331033is banked. */
10341034/* 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
10361036   http://www.chiark.greenend.org.uk/~jacobn/cpm/pcwboot.html  */
10371037
10381038// for now all models use the same rom
r5932r5933
10401040   ROM_START(model)                                    \
10411041      ROM_REGION(0x010000, "maincpu",0)                     \
10421042      ROM_FILL(0x0000,0x10000,0x00)                                 \
1043/*      ROM_LOAD("pcwboot.bin", 0x010000, 608, BAD_DUMP CRC(679b0287) SHA1(5dde974304e3376ace00850d6b4c8ec3b674199e))*/   \
1043/*      ROM_LOAD("pcwboot.bin", 0x010000, 608, BAD_DUMP CRC(679b0287) SHA1(5dde974304e3376ace00850d6b4c8ec3b674199e))*/   \
10441044      ROM_REGION(256,"bootcode",0)                        \
10451045      ROM_LOAD("8256boot.bin", 0, 256, NO_DUMP CRC(d55925bd) SHA1(bca6a47d657557be99cb8580d4bf90968d8dde4a))   \
10461046   ROM_END                                             \
src/mess/drivers/osi.c
r5932r5933
88OHIO SCIENTIFIC MODEL 600 REV D
99
1010|-------------------------------------------------------------------------------------------|
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     |
4141|-------------------------------------------------------------------------------------------|
4242
4343Notes:
4444    All IC's shown.
4545
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     -
5656
5757*/
5858
r5932r5933
6464----------
6565
6666|-------------------------------------------------------------------------------------------|
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                                            |
9797|-------------------------------------------------------------------------------------------|
9898
9999Notes:
100100    All IC's shown.
101101
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
112112
113113*/
114114
r5932r5933
122122OSI 470 REV B
123123
124124|-------------------------------------------------------------------|
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|                                                                   |
148148|-------------------------------------------------------------------|
149149
150150Notes:
151151    All IC's shown.
152152
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?
158158
159159*/
160160
161161/*
162162
163   TODO:
163    TODO:
164164
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?
176176
177177*/
178178
r5932r5933
268268{
269269   /*
270270
271      bit      signal         description
271        bit     signal          description
272272
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
281281
282   */
282    */
283283
284284   const device_config *discrete = devtag_get_device(space->machine, "discrete");
285285   osi_state *state = space->machine->driver_data;
r5932r5933
295295   const device_config *speaker = devtag_get_device(space->machine, "beep");
296296   /*
297297
298      bit      description
298        bit     description
299299
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
308308
309   */
309    */
310310
311311   beep_set_state(speaker, BIT(data, 1));
312312}
r5932r5933
320320/* Disk Drive */
321321
322322/*
323   C000 FLOPIN         FLOPPY DISK STATUS PORT
323    C000 FLOPIN         FLOPPY DISK STATUS PORT
324324
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)
334334
335   C002 FLOPOT         FLOPPY DISK CONTROL PORT
335    C002 FLOPOT         FLOPPY DISK CONTROL PORT
336336
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)
351351
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
354354*/
355355
356356static void osi470_index_callback(const device_config *controller, const device_config *img, int state)
r5932r5933
365365
366366   /*
367367
368      bit      description
368        bit     description
369369
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
378378
379   */
379    */
380380
381381   osi_state *state = device->machine->driver_data;
382382
r5932r5933
387387{
388388   /*
389389
390      bit      description
390        bit     description
391391
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
400400
401   */
401    */
402402}
403403
404404static WRITE8_DEVICE_HANDLER( osi470_pia_b_w )
405405{
406406   /*
407407
408      bit      description
408        bit     description
409409
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
418418
419   */
419    */
420420}
421421
422422static WRITE8_DEVICE_HANDLER( osi470_pia_cb2_w )
r5932r5933
838838
839839   /* floppy ACIA */
840840   MDRV_ACIA6850_ADD("acia_1", osi470_acia_intf)
841   
841
842842   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, osi_floppy_config)
843843MACHINE_DRIVER_END
844844
r5932r5933
908908
909909/* System Drivers */
910910
911//    YEAR  NAME      PARENT      COMPAT   MACHINE      INPUT      INIT   CONFIG      COMPANY            FULLNAME
911//    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY            FULLNAME
912912COMP( 1978, sb2m600b,   0,         0,      osi600,      osi600,      0,       osi600,      "Ohio Scientific", "Superboard II Model 600 (Rev. B)", 0)
913//COMP( 1980, sb2m600c,   0,         0,      osi600c,   osi600,      0,       osi600,      "Ohio Scientific", "Superboard II Model 600 (Rev. C)", 0)
913//COMP( 1980, sb2m600c, 0,          0,      osi600c,    osi600,     0,      osi600,     "Ohio Scientific", "Superboard II Model 600 (Rev. C)", 0)
914914COMP( 1980, c1p,      sb2m600b,   0,      c1p,      osi600,      c1p,   c1p,      "Ohio Scientific", "Challenger 1P Series 2", GAME_NOT_WORKING)
915915COMP( 1980, c1pmf,      sb2m600b,   0,      c1pmf,      osi600,      c1p,   c1pmf,      "Ohio Scientific", "Challenger 1P MF Series 2", GAME_NOT_WORKING)
916916COMP( 1979,   uk101,      sb2m600b,   0,      uk101,      uk101,      0,       uk101,      "Compukit",        "UK101", GAME_NOT_WORKING)
src/mess/drivers/oric.c
r5932r5933
414414   MDRV_VIA6522_ADD( "via6522_0", 1000000, oric_6522_interface )
415415
416416   MDRV_WD179X_ADD("wd179x", oric_wd17xx_interface )
417   
417
418418   MDRV_FLOPPY_4_DRIVES_ADD(oric1_floppy_config)
419419MACHINE_DRIVER_END
420420
src/mess/drivers/pippin.c
r5932r5933
11/***************************************************************************
2   
2
33        Bandai Pippin
44
55        17/07/2009 Skeleton driver.
r5932r5933
1212#include "sound/cdda.h"
1313
1414static ADDRESS_MAP_START( pippin_mem, ADDRESS_SPACE_PROGRAM, 64 )
15   ADDRESS_MAP_UNMAP_HIGH   
15   ADDRESS_MAP_UNMAP_HIGH
1616   AM_RANGE(0x00000000, 0x005fffff) AM_RAM
1717   AM_RANGE(0xf3016000, 0xf3016007) AM_NOP // ADB PORTB
1818   AM_RANGE(0xf3016400, 0xf3016407) AM_NOP // ADB DDRB
r5932r5933
3434INPUT_PORTS_END
3535
3636
37static MACHINE_RESET(pippin)
38{   
37static MACHINE_RESET(pippin)
38{
3939}
4040
4141static VIDEO_START( pippin )
r5932r5933
5353    MDRV_CPU_PROGRAM_MAP(pippin_mem)
5454
5555    MDRV_MACHINE_RESET(pippin)
56   
56
5757    /* video hardware */
5858    MDRV_SCREEN_ADD("screen", RASTER)
5959    MDRV_SCREEN_REFRESH_RATE(60)
r5932r5933
8080/* ROM definition */
8181/*
8282
83   BIOS versions
83    BIOS versions
8484
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
9090
9191*/
9292
r5932r5933
9595   ROM_LOAD64_WORD_SWAP( "341s0251.u1", 0x000006, 0x100000, CRC(aaea2449) SHA1(2f63e215260a42fb7c5f2364682d5e8c0604646f) )
9696   ROM_LOAD64_WORD_SWAP( "341s0252.u2", 0x000004, 0x100000, CRC(3d584419) SHA1(e29c764816755662693b25f1fb3c24faef4e9470) )
9797   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) )
9999
100100   ROM_REGION( 0x10000, "cdrom", 0 ) /* MATSUSHITA CR504-L OEM */
101101   ROM_LOAD( "504par4.0i.ic7", 0x0000, 0x10000, CRC(25f7dd46) SHA1(ec3b3031742807924c6259af865e701827208fec) )
src/mess/drivers/mekd2.c
r5932r5933
124124   PORT_BIT(0x04, 0x04, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
125125   PORT_BIT(0x02, 0x02, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
126126   PORT_BIT(0x01, 0x01, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
127   
127
128128   PORT_START("KEY1")
129129   PORT_BIT(0x80, 0x80, IPT_UNUSED)
130130   PORT_BIT(0x40, 0x40, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
r5932r5933
221221
222222   MDRV_SOUND_ADD("dac", DAC, 0)
223223   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
224   
224
225225   MDRV_CARTSLOT_ADD("cart")
226226   MDRV_CARTSLOT_EXTENSION_LIST("d2")
227227   MDRV_CARTSLOT_NOT_MANDATORY
src/mess/drivers/at.c
r5932r5933
8383
8484static ADDRESS_MAP_START( at16_map, ADDRESS_SPACE_PROGRAM, 16 )
8585   AM_RANGE(0x000000, 0x09ffff) AM_MIRROR(0xff000000) AM_RAMBANK(10)
86//   AM_RANGE(0x0a0000, 0x0bffff) AM_READWRITE(SMH_RAM, pc_video_videoram16le_w) AM_BASE((UINT16 **)&videoram) AM_SIZE(&videoram_size)
86//  AM_RANGE(0x0a0000, 0x0bffff) AM_READWRITE(SMH_RAM, pc_video_videoram16le_w) AM_BASE((UINT16 **)&videoram) AM_SIZE(&videoram_size)
8787   AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM
8888   AM_RANGE(0x0c8000, 0x0cffff) AM_ROM
8989   AM_RANGE(0x0d0000, 0x0effff) AM_RAM
r5932r5933
9696   ADDRESS_MAP_GLOBAL_MASK(0x00ffffff)
9797   AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK(10)
9898   AM_RANGE(0x000a0000, 0x000bffff) AM_NOP
99//   AM_RANGE(0x000b8000, 0x000bffff) AM_READWRITE(SMH_RAM, pc_video_videoram32_w) AM_BASE((UINT32 **) &videoram) AM_SIZE(&videoram_size)
99//  AM_RANGE(0x000b8000, 0x000bffff) AM_READWRITE(SMH_RAM, pc_video_videoram32_w) AM_BASE((UINT32 **) &videoram) AM_SIZE(&videoram_size)
100100   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM
101101   AM_RANGE(0x000c8000, 0x000cffff) AM_ROM
102102   AM_RANGE(0x000d0000, 0x000effff) AM_ROM
r5932r5933
107107static ADDRESS_MAP_START( at586_map, ADDRESS_SPACE_PROGRAM, 32 )
108108   AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK(10)
109109   AM_RANGE(0x000a0000, 0x000bffff) AM_NOP
110//   AM_RANGE(0x000b8000, 0x000bffff) AM_READWRITE(SMH_RAM, pc_video_videoram32_w) AM_BASE((UINT32 **) &videoram) AM_SIZE(&videoram_size)
110//  AM_RANGE(0x000b8000, 0x000bffff) AM_READWRITE(SMH_RAM, pc_video_videoram32_w) AM_BASE((UINT32 **) &videoram) AM_SIZE(&videoram_size)
111111   AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("user1", 0x20000)
112112ADDRESS_MAP_END
113113
r5932r5933
163163   AM_RANGE(0x0278, 0x027f) AM_DEVREADWRITE8("lpt_2", pc_lpt_r, pc_lpt_w, 0x00ff)
164164   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ns16450_3", ins8250_r, ins8250_w, 0xffff)
165165   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)
168168   AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_1", pc_lpt_r, pc_lpt_w, 0x00ff)
169169#ifdef ADLIB
170170   AM_RANGE(0x0388, 0x0389) AM_DEVREADWRITE("ym3812", at16_388_r, at16_388_w )
r5932r5933
494494   MDRV_IMPORT_FROM( pc_hdc )
495495
496496   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
497   
497
498498   MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config)
499499MACHINE_DRIVER_END
500500
r5932r5933
559559   MDRV_IMPORT_FROM( pc_hdc )
560560
561561   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
562   
562
563563   MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config)
564564MACHINE_DRIVER_END
565565
r5932r5933
626626   MDRV_IMPORT_FROM( pc_hdc )
627627
628628   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
629   
629
630630   MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config)
631631MACHINE_DRIVER_END
632632
r5932r5933
695695   MDRV_IMPORT_FROM( pc_hdc )
696696
697697   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
698   
698
699699   MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config)
700700MACHINE_DRIVER_END
701701
r5932r5933
761761   MDRV_IMPORT_FROM( pc_hdc )
762762
763763   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
764   
764
765765   MDRV_FLOPPY_2_DRIVES_ADD(ibmat_floppy_config)
766766MACHINE_DRIVER_END
767767
r5932r5933
825825   ROMX_LOAD("6480090.u27", 0xf0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(2))
826826   ROMX_LOAD("6480091.u47", 0xf0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(2))
827827
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))
831831
832832   ROM_REGION(0x08100, "gfx1", 0)
833833   ROM_LOAD("cga.chr",     0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd))
r5932r5933
902902ROM_END
903903
904904
905ROM_START( ibm5162 ) //MB p/n 62x1168
905ROM_START( ibm5162 ) //MB p/n 62x1168
906906   ROM_REGION16_LE(0x1000000,"maincpu", 0)
907907   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a))
908908
r5932r5933
10781078ROM_END
10791079
10801080static SYSTEM_CONFIG_START(ibmat)
1081   CONFIG_RAM_DEFAULT( (640+1024) * 1024 )   
1081   CONFIG_RAM_DEFAULT( (640+1024) * 1024 )
10821082SYSTEM_CONFIG_END
10831083
10841084/***************************************************************************
src/mess/drivers/vector06.c
r5932r5933
3131   AM_RANGE( 0x00, 0x03) AM_READWRITE(vector_8255_1_r, vector_8255_1_w )
3232   AM_RANGE( 0x04, 0x07) AM_READWRITE(vector_8255_2_r, vector_8255_2_w )
3333   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)
3838     AM_RANGE( 0x1C, 0x1C) AM_WRITE(vector_disc_w)
3939ADDRESS_MAP_END
4040
r5932r5933
122122      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT)
123123      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL)
124124      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
129129INPUT_PORTS_END
130130
131131static const cassette_config vector_cassette_config =
r5932r5933
155155static MACHINE_DRIVER_START( vector06 )
156156  /* basic machine hardware */
157157     MDRV_CPU_ADD("maincpu", 8080, 3000000)
158//   MDRV_CPU_ADD("maincpu", Z80, 3000000)
158//  MDRV_CPU_ADD("maincpu", Z80, 3000000)
159159     MDRV_CPU_PROGRAM_MAP(vector06_mem)
160160     MDRV_CPU_IO_MAP(vector06_io)
161161     MDRV_CPU_VBLANK_INT("screen", vector06_interrupt)
r5932r5933
185185   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
186186
187187   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)   
191188
189   MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives )
190   MDRV_FLOPPY_2_DRIVES_ADD(vector_floppy_config)
191
192192   /* cartridge */
193193   MDRV_CARTSLOT_ADD("cart")
194194   MDRV_CARTSLOT_EXTENSION_LIST("emr")
r5932r5933
219219     ROM_LOAD( "vec1200.bin", 0x10000, 0x2000, CRC(37349224) SHA1(060fbb2c1a89040c929521cfd58cb6f1431a8b75))
220220     ROM_CART_LOAD("cart", 0x18000, 0x8000, ROM_FILL_FF | ROM_OPTIONAL)
221221    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))
223223ROM_END
224224ROM_START( pk6128c )
225225    ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF )
r5932r5933
233233
234234/* Driver */
235235
236/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT     CONFIG COMPANY                  FULLNAME   FLAGS */
236/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT     CONFIG COMPANY                  FULLNAME   FLAGS */
237237COMP( 1987, vector06,     0,         0,   vector06,    vector06,    vector06, vector06,  "",                 "Vector 06c",    GAME_NOT_WORKING)
238238COMP( 1987, vec1200,     vector06,    0,   vector06,    vector06,    vector06, vector06,  "",                 "Vector 1200",    GAME_NOT_WORKING)
239239COMP( 1987, pk6128c,     vector06,  0,   vector06,    vector06,    vector06, vector06,  "",                 "PK-6128c",    GAME_NOT_WORKING)
src/mess/drivers/electron.c
r5932r5933
1818    - Support for ROM images
1919    - Support for floppy disks
2020    - Other peripherals
21   - Keyboard is missing the 'Break' key
21    - Keyboard is missing the 'Break' key
2222
2323******************************************************************************/
2424
r5932r5933
5757ADDRESS_MAP_END
5858
5959static INPUT_PORTS_START( electron )
60   
60
6161   PORT_START("LINE0")      /* Keyboard line 0 */
6262   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
6363   PORT_BIT(0x02,  IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_END)    PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR('[') PORT_CHAR(']')
src/mess/drivers/v1050.c
r5932r5933
88REV B-1
99
1010|---------------------------------------------------------------------------------------------------|
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                                         |
6464|---------------------------------------------------------------------------------------------------|
6565
6666Notes:
6767    All IC's shown.
6868
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
9191
9292*/
9393
9494/*
9595
96   TODO:
96    TODO:
9797
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
102102
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)
107107
108108*/
109109
r5932r5933
185185{
186186   {   /* unshifted */
187187      { 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 },
189189      { 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 },
192192      { 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d },
193193      { 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 },
195195      { 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 },
198198      { 0xb1, 0xb2, 0xb3, 0x83, 0xb0, 0xae, 0x00, 0x00 },
199199   },
200200
201201   {   /* shifted */
202202      { 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 },
204204      { 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 },
207207      { 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d, 0x0d },
208208      { 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 },
210210      { 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 },
213213      { 0xb2, 0xb3, 0x83, 0xb0, 0xa0, 0x00, 0x00, 0x00 },
214214   },
215215
r5932r5933
378378static READ8_HANDLER( keyboard_r )
379379{
380380   v1050_state *state = space->machine->driver_data;
381   
381
382382   static const char *const KEY_ROW[] = { "X0", "X1", "X2", "X3", "X4", "X5", "X6", "X7", "X8", "X9", "XA", "XB" };
383   
383
384384   return input_port_read(space->machine, KEY_ROW[state->keylatch]);
385385}
386386
r5932r5933
395395{
396396   /*
397397
398      bit      description
398        bit     description
399399
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
408408
409   */
409    */
410410
411411   v1050_state *state = space->machine->driver_data;
412412
413413   output_set_led_value(0, BIT(data, 5));
414//   discrete_sound_w(discrete, NODE_01, BIT(data, 6));
414//  discrete_sound_w(discrete, NODE_01, BIT(data, 6));
415415   state->kb_so = BIT(data, 7);
416416}
417417
r5932r5933
430430   ADDRESS_MAP_UNMAP_HIGH
431431   ADDRESS_MAP_GLOBAL_MASK(0xff)
432432   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)
435435   AM_RANGE(0x88, 0x88) AM_READ(v1050_get_key) AM_DEVWRITE(I8251A_KB_TAG, msm8251_data_w)
436436   AM_RANGE(0x89, 0x89) AM_READ(v1050_get_key_status) AM_DEVWRITE(I8251A_KB_TAG, msm8251_control_w)
437437   AM_RANGE(0x8c, 0x8c) AM_DEVREADWRITE(I8251A_SIO_TAG, msm8251_data_r, msm8251_data_w)
r5932r5933
441441   AM_RANGE(0x9c, 0x9f) AM_DEVREADWRITE(I8255A_RTC_TAG, i8255a_r, i8255a_w)
442442   AM_RANGE(0xa0, 0xa0) AM_READWRITE(vint_clr_r, vint_clr_w)
443443   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)
445445   AM_RANGE(0xd0, 0xd0) AM_WRITE(bank_w)
446//   AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE(S1410_TAG, s1410_r, s1410_w)
446//  AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE(S1410_TAG, s1410_r, s1410_w)
447447ADDRESS_MAP_END
448448
449449static ADDRESS_MAP_START( v1050_crt_mem, ADDRESS_SPACE_PROGRAM, 8 )
r5932r5933
479479   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad Enter DelCh") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
480480   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))
481481   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 )
483483   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad - DelLn") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
484484   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 End") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
485485   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad , DelWd")
r5932r5933
506506   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))
507507
508508   PORT_START("X4")
509   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
509   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
510510   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))
511511   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 )
513513   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
514514   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 Last") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
515515   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 PgUp") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
r5932r5933
583583   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
584584   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
585585   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 )
587587INPUT_PORTS_END
588588
589589static INPUT_PORTS_START( v1050 )
r5932r5933
676676   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
677677   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
678678   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
679   
679
680680   PORT_START("ROW9")
681681   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
682682   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
r5932r5933
696696   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD)
697697   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD)
698698   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
699   
699
700700   PORT_START("ROW11")
701701   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD)
702702   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD)
r5932r5933
706706   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
707707   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
708708   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
709   
709
710710   PORT_START("ROW12")
711711   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
712712   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LEFT SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
r5932r5933
782782{
783783   /*
784784
785        bit      signal      description
785        bit     signal      description
786786
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
797795
796    */
797
798798   v1050_state *state = device->machine->driver_data;
799799
800800   int f_motor_on = !BIT(data, 6);
r5932r5933
829829{
830830   /*
831831
832        bit      signal      description
832        bit     signal      description
833833
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
836836        PC2     baud_sel_a
837837        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
844842
843    */
844
845845   v1050_state *state = device->machine->driver_data;
846846
847847   UINT8 data = 0;
r5932r5933
856856{
857857   /*
858858
859        bit      signal      description
859        bit     signal      description
860860
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
863863        PC2     baud_sel_a
864864        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
871869
870    */
871
872872   v1050_state *state = device->machine->driver_data;
873873
874874   int baud_sel = (data >> 2) & 0x03;
r5932r5933
914914{
915915   /*
916916
917        bit      signal      description
917        bit     signal      description
918918
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
929927
928    */
929
930930   v1050_state *state = device->machine->driver_data;
931931
932932   state->int_mask = data;
r5932r5933
936936{
937937   /*
938938
939        bit      signal      description
939        bit     signal      description
940940
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
951949
950    */
951
952952   v1050_state *state = device->machine->driver_data;
953953
954954   return msm58321_busy_r(state->msm58321) << 3;
r5932r5933
958958{
959959   /*
960960
961        bit      signal      description
961        bit     signal      description
962962
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
973971
972    */
973
974974   v1050_state *state = device->machine->driver_data;
975975
976976   msm58321_address_write_w(state->msm58321, BIT(data, 4));
r5932r5933
10801080   }
10811081}
10821082
1083static const wd17xx_interface v1050_wd17xx_intf =
1084{
1083static const wd17xx_interface v1050_wd17xx_intf =
1084{
10851085   v1050_mb8877_callback,
10861086   NULL,
10871087   {FLOPPY_0,FLOPPY_1,NULL,NULL}
r5932r5933
11211121   /* initialize I8214 */
11221122   i8214_etlg_w(state->i8214, 1);
11231123   i8214_inte_w(state->i8214, 1);
1124   
1124
11251125   /* initialize RTC */
11261126   msm58321_cs1_w(state->msm58321, 1);
11271127
r5932r5933
12021202    MDRV_CPU_PROGRAM_MAP(v1050_crt_mem)
12031203   MDRV_QUANTUM_PERFECT_CPU(M6502_TAG)
12041204
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)
12071207
12081208   MDRV_MACHINE_START(v1050)
12091209   MDRV_MACHINE_RESET(v1050)
r5932r5933
12151215   MDRV_IMPORT_FROM(v1050_video)
12161216
12171217   /* 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)*/
12221222
12231223   /* devices */
12241224   MDRV_I8214_ADD(UPB8214_TAG, XTAL_16MHz/4, v1050_8214_intf)
r5932r5933
12301230   MDRV_MSM8251_ADD(I8251A_KB_TAG, /*XTAL_16MHz/8,*/ kb_8251_intf)
12311231   MDRV_MSM8251_ADD(I8251A_SIO_TAG, /*XTAL_16MHz/8,*/ sio_8251_intf)
12321232   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)
12341234   MDRV_TIMER_ADD_PERIODIC(TIMER_KB_TAG, kb_8251_tick, HZ((double)XTAL_16MHz/4/13/8))
12351235   MDRV_TIMER_ADD_PERIODIC(TIMER_SIO_TAG, sio_8251_tick, HZ((double)XTAL_16MHz/4/13/16))
12361236
r5932r5933
12591259
12601260/* System Drivers */
12611261
1262/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY                        FULLNAME      FLAGS */
1262/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY                             FULLNAME        FLAGS */
12631263COMP( 1983, v1050,   0,      0,      v1050,   v1050,   0,      v1050,   "Visual Technology Incorporated",   "Visual 1050",   GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
src/mess/drivers/ql.c
r5932r5933
1010
1111    TODO:
1212
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)
3030    - CST Thor XVI CF    (Workstation, 68000 @ 8 MHz, M6802, 68682 DUART)
3131    - CST Thor XVI IF    (Single Floppy)
3232    - CST Thor XVI FF    (Dual Floppy)
r5932r5933
641641      TRACKS([80])
642642      SECTORS([40])
643643      SECTOR_LENGTH([512])
644      FIRST_SECTOR_ID([1]))     
644      FIRST_SECTOR_ID([1]))
645645FLOPPY_OPTIONS_END
646646
647647static const floppy_config ql_floppy_config =
r5932r5933
696696   MDRV_CARTSLOT_EXTENSION_LIST("bin")
697697   MDRV_CARTSLOT_NOT_MANDATORY
698698   MDRV_CARTSLOT_LOAD(ql_cart)
699   
699
700700   MDRV_FLOPPY_2_DRIVES_ADD(ql_floppy_config)
701701MACHINE_DRIVER_END
702702
r5932r5933
709709
710710   MDRV_CPU_ADD(I8051_TAG, I8051, X4)
711711   MDRV_CPU_IO_MAP(ipc_io_map)
712   
712
713713   MDRV_DEVICE_REMOVE("cart")
714   
714
715715   MDRV_FLOPPY_2_DRIVES_REMOVE()
716716MACHINE_DRIVER_END
717717
r5932r5933
721721   MDRV_SCREEN_MODIFY(SCREEN_TAG)
722722   MDRV_SCREEN_REFRESH_RATE(60)
723723   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)
725725MACHINE_DRIVER_END
726726
727727/* ROMs */
r5932r5933
765765
766766   ROM_IPC
767767   /*
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    */
771771ROM_END
772772
773773ROM_START( ql_us )
r5932r5933
920920   CONFIG_RAM         (384 * 1024) // 256K expansion
921921   CONFIG_RAM         (640 * 1024) // 512K expansion
922922   CONFIG_RAM         (896 * 1024) // Trump Card
923   CONFIG_DEVICE(ql_serial_getinfo)   
923   CONFIG_DEVICE(ql_serial_getinfo)
924924SYSTEM_CONFIG_END
925925
926926static SYSTEM_CONFIG_START( opd )
src/mess/drivers/vt220.c
r5932r5933
11/***************************************************************************
2   
2
33        DEC VT220
44
55        30/06/2009 Skeleton driver.
r5932r5933
2020INPUT_PORTS_START( vt220 )
2121INPUT_PORTS_END
2222
23static MACHINE_RESET(vt220)
24{   
23static MACHINE_RESET(vt220)
24{
2525   memset(mess_ram,0,16*1024);
2626}
2727
r5932r5933
3939    /* basic machine hardware */
4040    MDRV_CPU_ADD("maincpu", I8051, XTAL_16MHz)
4141    MDRV_CPU_PROGRAM_MAP(vt220_mem)
42    MDRV_CPU_IO_MAP(vt220_io)   
42    MDRV_CPU_IO_MAP(vt220_io)
4343
4444    MDRV_MACHINE_RESET(vt220)
45   
45
4646    /* video hardware */
4747    MDRV_SCREEN_ADD("screen", RASTER)
4848    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
7171
7272/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY   FULLNAME       FLAGS */
7373COMP( 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)
7676
src/mess/drivers/amiga.c
r5932r5933
426426   MDRV_CPU_ADD("rcmcu", M6502, XTAL_1MHz) /* 1 MHz? */
427427   MDRV_CPU_PROGRAM_MAP(cdtv_rcmcu_mem)
428428
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)
431431
432432   MDRV_MACHINE_START( cdtv )
433433   MDRV_MACHINE_RESET( cdtv )
src/mess/drivers/abc80x.c
r5932r5933
5454
5555    TODO:
5656
57   - ABC 77 keyboard
58   - bit accurate Z80 SIO/2 (cassette)
57    - ABC 77 keyboard
58    - bit accurate Z80 SIO/2 (cassette)
5959    - floppy controller board
6060    - hard disks (ABC-850 10MB, ABC-852 20MB, ABC-856 60MB)
6161
r5932r5933
387387{
388388   /*
389389
390      bit      description
390        bit     description
391391
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
400400
401   */
401    */
402402
403403   abc806_state *state = space->machine->driver_data;
404404
r5932r5933
668668INPUT_PORTS_END
669669
670670static INPUT_PORTS_START( abc800 )
671//   PORT_INCLUDE(abc77)
671//  PORT_INCLUDE(abc77)
672672   PORT_INCLUDE(fake_keyboard)
673673
674674   PORT_START("SB")
r5932r5933
10171017
10181018static ABCBUS_CONFIG( abc802_abcbus_config )
10191019{
1020//   { LUXOR_55_21046, CONKORT_TAG }, won't boot with this enabled
1020//  { LUXOR_55_21046, CONKORT_TAG }, won't boot with this enabled
10211021   { NULL }
10221022};
10231023
r5932r5933
12031203   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
12041204   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
12051205   MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf)
1206//   MDRV_ABC77_ADD(abc800_abc77_intf)
1206//  MDRV_ABC77_ADD(abc800_abc77_intf)
12071207   MDRV_LUXOR_55_21046_ADD
12081208   MDRV_PRINTER_ADD("printer")
12091209   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
12101210
12111211   /* fake keyboard */
12121212   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
1213   
1213
12141214   MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config)
12151215MACHINE_DRIVER_END
12161216
r5932r5933
12401240   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
12411241   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
12421242   MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc800_dart_intf)
1243//   MDRV_ABC77_ADD(abc800_abc77_intf)
1243//  MDRV_ABC77_ADD(abc800_abc77_intf)
12441244   MDRV_LUXOR_55_21046_ADD
12451245   MDRV_PRINTER_ADD("printer")
12461246   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
12471247
12481248   /* fake keyboard */
12491249   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
1250   
1250
12511251   MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config)
12521252MACHINE_DRIVER_END
12531253
r5932r5933
12771277   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
12781278   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
12791279   MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc802_dart_intf)
1280//   MDRV_ABC77_ADD(abc802_abc77_intf)
1280//  MDRV_ABC77_ADD(abc802_abc77_intf)
12811281   MDRV_LUXOR_55_21046_ADD
12821282   MDRV_PRINTER_ADD("printer")
12831283   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
12841284
12851285   /* fake keyboard */
12861286   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
1287   
1287
12881288   MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config)
12891289MACHINE_DRIVER_END
12901290
r5932r5933
13121312   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
13131313   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
13141314   MDRV_Z80DART_ADD(Z80DART_TAG, ABC800_X01/2/2, abc806_dart_intf)
1315//   MDRV_ABC77_ADD(abc806_abc77_intf)
1315//  MDRV_ABC77_ADD(abc806_abc77_intf)
13161316   MDRV_LUXOR_55_21046_ADD
13171317   MDRV_PRINTER_ADD("printer")
13181318   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
13191319
13201320   /* fake keyboard */
13211321   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
1322   
1322
13231323   MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config)
13241324MACHINE_DRIVER_END
13251325
r5932r5933
13351335    800 8"      DD88
13361336    ABC 6-2X    ABC832
13371337    ABC 6-3X    ABC838
1338   ABC 6-52   ABC834
1338    ABC 6-52    ABC834
13391339    UFD 6.XX    Winchester
13401340
13411341
1342   Floppy Controllers
1342    Floppy Controllers
13431343
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
13521352
13531353*/
13541354
r5932r5933
14361436
14371437   ROM_REGION( 0x200, "hru2", 0 )
14381438   ROM_LOAD( "fgctl.bin",  0x0000, 0x0200, BAD_DUMP CRC(7a19de8d) SHA1(e7cc49e749b37f7d7dd14f3feda53eae843a8fe0) )
1439//   ROM_LOAD( "64 90127-01.12g", 0x0000, 0x0200, NO_DUMP ) // "HRU II" 7621 (82S131), ABC800C HR compatibility mode palette
1439//  ROM_LOAD( "64 90127-01.12g", 0x0000, 0x0200, NO_DUMP ) // "HRU II" 7621 (82S131), ABC800C HR compatibility mode palette
14401440
14411441   ROM_REGION( 0x400, "v50", 0 )
14421442   ROM_LOAD( "64 90242-01.7e",  0x0000, 0x0200, NO_DUMP ) // "V50" 7621 (82S131), HR vertical timing 50Hz
r5932r5933
15961596
15971597/* System Drivers */
15981598
1599/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT   INIT    CONFIG  COMPANY             FULLNAME      FLAGS */
1599/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT   INIT    CONFIG  COMPANY             FULLNAME        FLAGS */
16001600COMP( 1981, abc800m,    0,         0,      abc800m,    abc800, abc800, abc800, "Luxor Datorer AB", "ABC 800 M/HR", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
16011601COMP( 1981, abc800c,    abc800m,    0,      abc800c,    abc800, abc800, abc800, "Luxor Datorer AB", "ABC 800 C/HR", GAME_NOT_WORKING )
16021602COMP( 1983, abc802,     0,          0,      abc802,     abc802, abc802, abc802, "Luxor Datorer AB", "ABC 802",      GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
src/mess/drivers/orion.c
r5932r5933
140140   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
141141
142142   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
146146   MDRV_FLOPPY_4_DRIVES_ADD(orion_floppy_config)
147   
147
148148   MDRV_CARTSLOT_ADD("cart")
149149MACHINE_DRIVER_END
150150
151151static MACHINE_DRIVER_START( orion128ms )
152152   MDRV_IMPORT_FROM(orion128)
153153   MDRV_DEVICE_REMOVE("ppi8255_2")
154   MDRV_I8255A_ADD( "ppi8255_2", rk7007_ppi8255_interface )   
155MACHINE_DRIVER_END   
154   MDRV_I8255A_ADD( "ppi8255_2", rk7007_ppi8255_interface )
155MACHINE_DRIVER_END
156156
157157static const ay8910_interface orionz80_ay_interface =
158158{
r5932r5933
200200   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
201201
202202   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
206206   MDRV_FLOPPY_4_DRIVES_ADD(orion_floppy_config)
207   
207
208208   MDRV_CARTSLOT_ADD("cart")
209209MACHINE_DRIVER_END
210210
r5932r5933
212212   MDRV_IMPORT_FROM(orionz80)
213213
214214   MDRV_DEVICE_REMOVE("ppi8255_2")
215   MDRV_I8255A_ADD( "ppi8255_2", rk7007_ppi8255_interface )   
216MACHINE_DRIVER_END   
215   MDRV_I8255A_ADD( "ppi8255_2", rk7007_ppi8255_interface )
216MACHINE_DRIVER_END
217217
218218static MACHINE_DRIVER_START( orionpro )
219219    MDRV_CPU_ADD("maincpu", Z80, 5000000)
r5932r5933
251251   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
252252
253253   MDRV_CASSETTE_ADD( "cassette", orion_cassette_config )
254   
254
255255   MDRV_WD1793_ADD("wd1793", default_wd17xx_interface )
256   
256
257257   MDRV_FLOPPY_4_DRIVES_ADD(orion_floppy_config)
258   
258
259259   MDRV_CARTSLOT_ADD("cart")
260260MACHINE_DRIVER_END
261261
src/mess/drivers/qx10.c
r5932r5933
6666   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
6767   ROM_LOAD( "qx10boot.bin", 0x0000, 0x0800, CRC(f8dfcba5) SHA1(a7608f8aa7da355dcaf257ee28b66ded8974ce3a))
6868   /* The first part of this rom looks like code for an embedded controller?
69      From 8300 on, looks like a characters generator */
69        From 8300 on, looks like a characters generator */
7070   ROM_LOAD( "mfboard.bin", 0x8000, 0x0800, CRC(fa27f333) SHA1(73d27084ca7b002d5f370220d8da6623a6e82132))
7171   /* This rom looks like a character generator */
7272   ROM_LOAD( "qge.bin", 0x8800, 0x0800, CRC(ed93cb81) SHA1(579e68bde3f4184ded7d89b72c6936824f48d10b))
src/mess/drivers/tmc1800.c
r5932r5933
66----------
77
88|-----------------------------------------------------------|
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    |
4141|-----------------------------------------------------------|
4242
4343Notes:
4444    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
5345
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
5454*/
5555
5656/*
r5932r5933
6363OK 30379
6464
6565|-------------------------------------------------|
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          |
8787|-------------------------------------------------|
8888
8989Notes:
9090    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
10091
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
101101*/
102102
103103/*
104104
105   TODO:
105    TODO:
106106
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
111111
112112*/
113113
r5932r5933
149149{
150150   /*
151151
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
162153
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
164162
163    */
164
165165   tmc2000_state *state = space->machine->driver_data;
166166
167167   state->keylatch = data & 0x3f;
r5932r5933
171171{
172172   /*
173173
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
184175
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
186184
185    */
186
187187   oscnano_state *state = space->machine->driver_data;
188188
189189   state->keylatch = data & 0x0f;
src/mess/drivers/crvision.c
r5932r5933
11/*
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.
44
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.
77
8   NOTE:
8    NOTE:
99
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.
1212
1313    TODO:
1414
15   - BASIC v1,v2 numbers are invisible
15    - BASIC v1,v2 numbers are invisible
1616    - 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
3030
3131*/
3232
r5932r5933
6060/* Memory Map */
6161
6262static 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
6464   AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_r, pia6821_w)
6565   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_READ(TMS9928A_vram_r)
6666   AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_READ(TMS9928A_register_r)
r5932r5933
7272ADDRESS_MAP_END
7373
7474static 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
7676   AM_RANGE(0x1000, 0x1003) AM_MIRROR(0x0ffc) AM_DEVREADWRITE(PIA6821_TAG, pia6821_r, pia6821_w)
7777   AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x0ffe) AM_READ(TMS9928A_vram_r)
7878   AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x0ffe) AM_READ(TMS9928A_register_r)
r5932r5933
8080   AM_RANGE(0x3001, 0x3001) AM_MIRROR(0x0ffe) AM_WRITE(TMS9928A_register_w)
8181   AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(BANK_ROM2)
8282   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(BANK_ROM1)
83//   AM_RANGE(0xc000, 0xe7ff) AM_RAMBANK(3)
83//  AM_RANGE(0xc000, 0xe7ff) AM_RAMBANK(3)
8484   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE(CENTRONICS_TAG, centronics_data_w)
8585   AM_RANGE(0xe801, 0xe801) AM_DEVREADWRITE(CENTRONICS_TAG, centronics_status_r, centronics_ctrl_w)
86//   AM_RANGE(0xf000, 0xf7ff) AM_RAMBANK(4)
86//  AM_RANGE(0xf000, 0xf7ff) AM_RAMBANK(4)
8787   AM_RANGE(0xf800, 0xffff) AM_ROM
8888ADDRESS_MAP_END
8989
r5932r5933
635635
636636/* System Drivers */
637637
638/*    YEAR  NAME      PARENT    COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY                  FULLNAME */
638/*    YEAR  NAME      PARENT    COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY                     FULLNAME */
639639CONS( 1982, crvision, 0,      0,      pal,      crvision,   0,      0,         "Video Technology",         "CreatiVision", 0 )
640640CONS( 1982, fnvision, crvision, 0,      pal,      crvision,   0,      0,         "Video Technology",         "FunVision", 0 )
641641CONS( 1982, crvisioj, crvision,   0,      ntsc,      crvision,   0,      0,         "Cheryco",               "CreatiVision (Japan)", 0 )
r5932r5933
644644CONS( 1983, vz2000,   crvision, 0,      pal,      crvision,   0,      0,         "Dick Smith Electronics",   "VZ 2000 (Oceania)", 0 )
645645CONS( 1983, crvisio2, crvision, 0,      pal,      crvision,   0,      0,         "Sanyo Video",            "CreatiVision MK-II (Germany)", 0 )
646646/*
647COMP( 1983, lasr2001, 0,      0,      lasr2001,   lasr2001,   0,      lasr2001,   "Video Technology",         "Laser 2001", GAME_NOT_WORKING )
648COMP( 1983, vz2001,     lasr2001,   0,      lasr2001,   lasr2001,   0,      lasr2001,   "Dick Smith Electronics",   "VZ 2001 (Oceania)", GAME_NOT_WORKING )
649COMP( 1983, manager,  lasr2001,   0,      lasr2001,   lasr2001,   0,      lasr2001,   "Salora",               "Manager (Finland)", GAME_NOT_WORKING )
647COMP( 1983, lasr2001, 0,        0,      lasr2001,   lasr2001,   0,      lasr2001,   "Video Technology",         "Laser 2001", GAME_NOT_WORKING )
648COMP( 1983, vz2001,   lasr2001, 0,      lasr2001,   lasr2001,   0,      lasr2001,   "Dick Smith Electronics",   "VZ 2001 (Oceania)", GAME_NOT_WORKING )
649COMP( 1983, manager,  lasr2001, 0,      lasr2001,   lasr2001,   0,      lasr2001,   "Salora",                   "Manager (Finland)", GAME_NOT_WORKING )
650650*/
src/mess/drivers/tvc.c
r5932r5933
11/***************************************************************************
2   
2
33        Videotone TVC 32/64 driver
44
55        12/05/2009 Skeleton driver.
r5932r5933
1414
1515static void tvc_set_mem_page(running_machine *machine, UINT8 data)
1616{
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);
1818   switch(data & 0x18) {
1919      case 0x00 : // system ROM selected
2020            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"));
2222            break;
2323      case 0x08 : // Cart ROM selected
2424            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"));
2626            break;
2727      case 0x10 : // RAM selected
2828            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;
3131   }
3232   // 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);
3434   if ((data & 0x20)==0) {
3535      // Video RAM
36      memory_set_bankptr(space->machine, 3, mess_ram + 0x10000);   
36      memory_set_bankptr(space->machine, 3, mess_ram + 0x10000);
3737   } else {
3838      // System RAM page 3
39      memory_set_bankptr(space->machine, 3, mess_ram + 0x8000);   
39      memory_set_bankptr(space->machine, 3, mess_ram + 0x8000);
4040   }
4141   switch(data & 0xc0) {
4242      case 0x00 : // Cart ROM selected
4343            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"));
4545            break;
4646      case 0x40 : // System ROM selected
4747            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"));
4949            break;
5050      case 0x80 : // RAM selected
5151            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);
5353            break;
5454      case 0xc0 : // External ROM selected
5555            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"));
5757            break;
58           
59   }     
58
59   }
6060}
6161
6262static WRITE8_HANDLER( tvc_bank_w )
r5932r5933
7676   //  0 I 0 G | 0 R 0 B
7777   //  0 0 0 0 | I R G B
7878   int i = ((data&0x40)>>3) | ((data&0x10)>>3) | (data&0x04) | (data&0x01);
79     
79
8080   col[offset] = i;
8181}
8282
r5932r5933
102102INPUT_PORTS_END
103103
104104
105static MACHINE_RESET(tvc)
106{   
105static MACHINE_RESET(tvc)
106{
107107   memset(mess_ram,0,(64+14)*1024);
108108   tvc_set_mem_page(machine, 0);
109109   tvc_video_mode = 0;
r5932r5933
124124{
125125   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
126126   int i;
127   
127
128128   switch(tvc_video_mode) {
129      case 0 :
129      case 0 :
130130            for ( i = 0; i < x_count; i++ )
131            {     
131            {
132132               UINT16 offset = i  + (y * 64);
133133               UINT8 data = mess_ram[ offset + 0x10000];
134134               *p = col[(data >> 7)]; p++;
r5932r5933
143143            break;
144144      case 1 :
145145            for ( i = 0; i < x_count; i++ )
146            {     
146            {
147147               UINT16 offset = i  + (y * 64);
148148               UINT8 data = mess_ram[ offset + 0x10000];
149149               *p = col[BIT(data,7)*2 + BIT(data,3)]; p++;
r5932r5933
158158            break;
159159      default:
160160            for ( i = 0; i < x_count; i++ )
161            {     
161            {
162162               UINT16 offset = i  + (y * 64);
163163               UINT8 data = mess_ram[ offset + 0x10000];
164164               *p = col[(data >> 4) & 0xf]; p++;
r5932r5933
171171               *p = col[(data >> 0) & 0xf]; p++;
172172            }
173173            break;
174     
175   }   
174
175   }
176176}
177177
178178static PALETTE_INIT( tvc )
r5932r5933
194194      { 0xff,0x00,0x00 },
195195      { 0xff,0x00,0xff },
196196      { 0xff,0xff,0x00 },
197      { 0xff,0xff,0xff }
197      { 0xff,0xff,0xff }
198198   };
199199   int i;
200200
r5932r5933
220220    /* basic machine hardware */
221221    MDRV_CPU_ADD("maincpu",Z80, 3125000)
222222    MDRV_CPU_PROGRAM_MAP(tvc_mem)
223    MDRV_CPU_IO_MAP(tvc_io)   
223    MDRV_CPU_IO_MAP(tvc_io)
224224
225225    MDRV_MACHINE_RESET(tvc)
226   
226
227227 /* video hardware */
228228   MDRV_SCREEN_ADD("screen", RASTER)
229229   MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
233233   MDRV_SCREEN_VISIBLE_AREA(0, 512 - 1, 0, 240 - 1)
234234   MDRV_PALETTE_LENGTH( 16 )
235235   MDRV_PALETTE_INIT(tvc)
236   
236
237237   MDRV_MC6845_ADD("crtc", MC6845, 3125000, tvc_crtc6845_interface) // clk taken from schematics
238238
239239    MDRV_VIDEO_START(tvc)
r5932r5933
261261   ROM_REGION( 0x4000, "cart", ROMREGION_ERASEFF )
262262   ROM_REGION( 0x4000, "ext", ROMREGION_ERASEFF )
263263   ROM_LOAD( "tvc22_d7.64k", 0x2000, 0x2000, CRC(05e1c3a8) SHA1(abf119cf947ea32defd08b29a8a25d75f6bd4987))
264/*   
264/*
265265
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*/
270270ROM_END
271271
272272ROM_START( tvc64pru )
src/mess/drivers/fmtowns.c
r5932r5933
11/*
22
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
214
5    Japanese computer system released in 1989.
226
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)
2415
25   Issues: BIOS requires 386 protected mode.
2616
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
2727*/
2828
2929/* I/O port map (incomplete, could well be incorrect too)
3030 *
3131 * 0x0000   : Master 8259 PIC
32 * 0x0002   : Master 8259 PIC
32 * 0x0002   : Master 8259 PIC
3333 * 0x0010   : Slave 8259 PIC
34 * 0x0012   : Slave 8259 PIC
34 * 0x0012   : Slave 8259 PIC
3535 * 0x0020 RW: bit 0 = soft reset (read/write), bit 6 = power off (write), bit 7 = NMI vector protect
3636 * 0x0022  W: bit 7 = power off (write)
3737 * 0x0025 R : returns 0x00? (read)
r5932r5933
320320static WRITE8_HANDLER( towns_cmos8_w )
321321{
322322   UINT8* cmos = (UINT8*)towns_cmos;
323   
323
324324   cmos[offset] = data;
325325}
326326
r5932r5933
350350static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32)
351351  // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns)
352352  // may not be (and probably is not) correct
353  AM_RANGE(0x00000000, 0x000bffff) AM_RAM
353  AM_RANGE(0x00000000, 0x000bffff) AM_RAM
354354  AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_BASE(&towns_gfxvram)  // GVRAM
355355  AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_BASE(&towns_txtvram) // TVRAM
356356//  AM_RANGE(0x000ca000, 0x000cafff) AM_RAM AM_BASE(&towns_txtvram) // TVRAM
r5932r5933
445445{
446446   int x,y;
447447   int pixel = 0;
448   
448
449449   for(y=0;y<480;y++)
450450   {
451451      for(x=0;x<640;x++)
r5932r5933
455455            pixel = 0;
456456      }
457457   }
458   
458
459459    return 0;
460460}
461461
r5932r5933
465465      {
466466         307200,
467467         NULL
468      },
468      },
469469      {
470470         307200,
471471         NULL
472      },
472      },
473473      {
474474         307200,
475475         NULL
r5932r5933
477477   }
478478};
479479
480static const struct pic8259_interface towns_pic8259_master_config =
480static const struct pic8259_interface towns_pic8259_master_config =
481481{
482482   NULL
483483};
484484
485485
486static const struct pic8259_interface towns_pic8259_slave_config =
486static const struct pic8259_interface towns_pic8259_slave_config =
487487{
488488   NULL
489489};
r5932r5933
503503    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
504504    MDRV_SCREEN_SIZE(640, 480)
505505    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
506   
506
507507    /* sound hardware */
508508    MDRV_SPEAKER_STANDARD_MONO("mono")
509509   MDRV_SOUND_ADD("fm", YM3438, 53693100 / 7) // actual clock speed unknown
510//   MDRV_SOUND_CONFIG(ym3438_interface)
510//  MDRV_SOUND_CONFIG(ym3438_interface)
511511   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
512512   MDRV_SOUND_ADD("pcm", RF5C68, 2150000)  // actual clock speed unknown
513//   MDRV_SOUND_CONFIG(rf5c68_interface)
513//  MDRV_SOUND_CONFIG(rf5c68_interface)
514514   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
515   
515
516516    MDRV_PIT8253_ADD("pit",towns_pit8253_config)
517   
517
518518   MDRV_PIC8259_ADD( "pic8259_master", towns_pic8259_master_config )
519519
520520   MDRV_PIC8259_ADD( "pic8259_slave", towns_pic8259_slave_config )
src/mess/drivers/uknc.c
r5932r5933
11/***************************************************************************
2   
2
33        UKNC
44
55        12/05/2009 Skeleton driver.
r5932r5933
1212static ADDRESS_MAP_START(uknc_mem, ADDRESS_SPACE_PROGRAM, 16)
1313   ADDRESS_MAP_UNMAP_HIGH
1414   AM_RANGE( 0x0000, 0x7fff ) AM_RAM  // RAM
15    AM_RANGE( 0x8000, 0xffff ) AM_ROM  // ROM   
15    AM_RANGE( 0x8000, 0xffff ) AM_ROM  // ROM
1616ADDRESS_MAP_END
1717
1818static ADDRESS_MAP_START(uknc_sub_mem, ADDRESS_SPACE_PROGRAM, 16)
1919   ADDRESS_MAP_UNMAP_HIGH
2020   AM_RANGE( 0x0000, 0x7fff ) AM_RAM  // RAM
21    AM_RANGE( 0x8000, 0xffff ) AM_ROM  // ROM   
21    AM_RANGE( 0x8000, 0xffff ) AM_ROM  // ROM
2222ADDRESS_MAP_END
2323
2424/* Input ports */
r5932r5933
2626INPUT_PORTS_END
2727
2828
29static MACHINE_RESET(uknc)
30{   
29static MACHINE_RESET(uknc)
30{
3131}
3232
3333static VIDEO_START( uknc )
r5932r5933
4848static MACHINE_DRIVER_START( uknc )
4949    /* basic machine hardware */
5050    MDRV_CPU_ADD("maincpu", T11, 8000000)
51   MDRV_CPU_CONFIG(t11_data)   
51   MDRV_CPU_CONFIG(t11_data)
5252    MDRV_CPU_PROGRAM_MAP(uknc_mem)
53   
53
5454    MDRV_CPU_ADD("subcpu",  T11, 6000000)
55   MDRV_CPU_CONFIG(t11_data)   
55   MDRV_CPU_CONFIG(t11_data)
5656    MDRV_CPU_PROGRAM_MAP(uknc_sub_mem)
5757
5858    MDRV_MACHINE_RESET(uknc)
59   
59
6060    /* video hardware */
6161    MDRV_SCREEN_ADD("screen", RASTER)
6262    MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/nascom1.c
r5932r5933
341341   MDRV_SCREEN_VISIBLE_AREA(0, 48 * 8 - 1, 0, 16 * 14 - 1)
342342   MDRV_GFXDECODE(nascom2)
343343   MDRV_VIDEO_UPDATE(nascom2)
344   
344
345345   MDRV_WD1793_ADD("wd1793", nascom2_wd17xx_interface )
346   
346
347347   MDRV_FLOPPY_4_DRIVES_ADD(nascom2_floppy_config)
348348MACHINE_DRIVER_END
349349
r5932r5933
391391
392392//static void nascom1_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
393393//{
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;
403403//
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;
407407//
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//  }
411411//}
412412
413413
r5932r5933
416416   CONFIG_RAM(16 * 1024)
417417   CONFIG_RAM(32 * 1024)
418418   CONFIG_RAM_DEFAULT(40 * 1024)
419//   CONFIG_DEVICE(nascom1_cassette_getinfo)
419//  CONFIG_DEVICE(nascom1_cassette_getinfo)
420420SYSTEM_CONFIG_END
421421
422422
423423static SYSTEM_CONFIG_START( nascom2 )
424   CONFIG_IMPORT_FROM(nascom1)   
424   CONFIG_IMPORT_FROM(nascom1)
425425SYSTEM_CONFIG_END
426426
427427
src/mess/drivers/newbrain.c
r5932r5933
1616
1717/*
1818
19   NewBrain
20   Grundy Business Systems Ltd.
19    NewBrain
20    Grundy Business Systems Ltd.
2121
22   32K RAM
23   28K ROM
22    32K RAM
23    28K ROM
2424
25   Z80 @ 2MHz
26   COP420 @ 2MHz
25    Z80 @ 2MHz
26    COP420 @ 2MHz
2727
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)
3434
35   Models according to the Software Technical Manual:
35    Models according to the Software Technical Manual:
3636
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
4040
4141*/
4242
4343/*
4444
45   TODO:
45    TODO:
4646
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
5555
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
6060
6161*/
6262
r5932r5933
210210{
211211   /*
212212
213      bit      signal      description
213        bit     signal      description
214214
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
223223
224   */
224    */
225225
226226   newbrain_state *state = space->machine->driver_data;
227227
r5932r5933
232232{
233233   /*
234234
235      bit      signal      description
235        bit     signal      description
236236
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
245245
246   */
246    */
247247
248248   newbrain_state *state = space->machine->driver_data;
249249
r5932r5933
255255{
256256   /*
257257
258      bit      signal      description
258        bit     signal      description
259259
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
268268
269   */
269    */
270270
271271   newbrain_state *state = space->machine->driver_data;
272272
r5932r5933
339339{
340340   /*
341341
342      bit      signal      description
342        bit     signal      description
343343
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
352352
353   */
353    */
354354
355355   newbrain_state *state = space->machine->driver_data;
356356
r5932r5933
361361{
362362   /*
363363
364      bit      signal      description
364        bit     signal      description
365365
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
374374
375   */
375    */
376376
377377   newbrain_state *state = space->machine->driver_data;
378378
r5932r5933
448448{
449449   /*
450450
451      bit      description
451        bit     description
452452
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
457457
458   */
458    */
459459
460460   newbrain_state *state = space->machine->driver_data;
461461
r5932r5933
472472{
473473   /*
474474
475      bit      description
475        bit     description
476476
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
481481
482   */
482    */
483483
484484   newbrain_state *state = space->machine->driver_data;
485485
r5932r5933
490490{
491491   /*
492492
493      bit      description
493        bit     description
494494
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
499499
500   */
500    */
501501
502502   newbrain_state *state = space->machine->driver_data;
503   
503
504504   static const char *const keynames[] = { "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
505505                              "D8", "D9", "D10", "D11", "D12", "D13", "D14", "D15" };
506506
r5932r5933
539539{
540540   /*
541541
542      bit      description
542        bit     description
543543
544      IN0      K8
545      IN1      _RD
546      IN2      _COP
547      IN3      _WR
544        IN0     K8
545        IN1     _RD
546        IN2     _COP
547        IN3     _WR
548548
549   */
549    */
550550
551551   newbrain_state *state = space->machine->driver_data;
552552
r5932r5933
617617{
618618   /*
619619
620      bit      signal      description
620        bit     signal      description
621621
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
630630
631   */
631    */
632632
633633   newbrain_state *state = space->machine->driver_data;
634634
r5932r5933
641641{
642642   /*
643643
644      bit      description
644        bit     description
645645
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
654654
655   */
655    */
656656
657657   newbrain_state *state = space->machine->driver_data;
658658
r5932r5933
668668{
669669   /*
670670
671      bit      description
671        bit     description
672672
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
681681
682   */
682    */
683683
684684   newbrain_state *state = space->machine->driver_data;
685685
r5932r5933
691691{
692692   /*
693693
694      bit      description
694        bit     description
695695
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)
704704
705   */
705    */
706706
707707   return 0;
708708}
r5932r5933
710710
711711#define NEWBRAIN_COPCMD_NULLCOM      0xd0
712712#define NEWBRAIN_COPCMD_DISPCOM      0xa0
713//#define NEWBRAIN_COPCMD_TIMCOM      0x
713//#define NEWBRAIN_COPCMD_TIMCOM        0x
714714#define NEWBRAIN_COPCMD_PDNCOM      0xb8
715715#define NEWBRAIN_COPCMD_TAPECOM      0x80
716716
r5932r5933
725725#define NEWBRAIN_COP_BREAK_PRESSED   0x02
726726
727727#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*/
732732
733733enum
734734{
r5932r5933
776776
777777         break;
778778
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;
784784*/
785785      case NEWBRAIN_COPCMD_PDNCOM:
786786         /* power down */
r5932r5933
808808      copdata = NEWBRAIN_COP_NO_DATA;
809809      state->copint = 0;
810810      check_interrupt(space->machine);
811   
811
812812      break;
813813   }
814814}
r5932r5933
831831{
832832   /*
833833
834      bit      signal      description
834        bit     signal      description
835835
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
844844
845   */
845    */
846846
847847   newbrain_state *state = space->machine->driver_data;
848848
r5932r5933
853853{
854854   /*
855855
856      bit      signal      description
856        bit     signal      description
857857
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
866866
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
869869
870   */
870    */
871871
872872   newbrain_state *state = space->machine->driver_data;
873873
r5932r5933
906906
907907static READ8_HANDLER( ei_anin_r )
908908{
909//   int channel = offset & 0x03;
909//  int channel = offset & 0x03;
910910
911911   return 0;
912912}
913913
914914static WRITE8_HANDLER( ei_anio_w )
915915{
916//   int channel = offset & 0x03;
916//  int channel = offset & 0x03;
917917}
918918
919919static READ8_HANDLER( ei_st0_r )
920920{
921921   /*
922922
923      bit      signal      description
923        bit     signal      description
924924
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
933933
934   */
934    */
935935
936936   newbrain_state *state = space->machine->driver_data;
937937
r5932r5933
942942{
943943   /*
944944
945      bit      signal      description
945        bit     signal      description
946946
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
955955
956   */
956    */
957957
958958   newbrain_state *state = space->machine->driver_data;
959959
r5932r5933
964964{
965965   /*
966966
967      bit      signal      description
967        bit     signal      description
968968
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
977977
978   */
978    */
979979
980980   return 0;
981981}
r5932r5933
999999
10001000      /*
10011001
1002         bit      signal      description
1002            bit     signal      description
10031003
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
10121012
1013      */
1013        */
10141014
10151015      state->paging = BIT(data, 0);
10161016      state->a16 = BIT(data, 2);
r5932r5933
10221022
10231023      /*
10241024
1025         bit      signal      description
1025            bit     signal      description
10261026
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
10351035
1036      */
1036        */
10371037
10381038      cputag_set_input_line(space->machine, FDC_Z80_TAG, INPUT_LINE_RESET, BIT(data, 5) ? HOLD_LINE : CLEAR_LINE);
10391039
r5932r5933
13741374static MACHINE_START( newbrain )
13751375{
13761376   newbrain_state *state = machine->driver_data;
1377   
1377
13781378   /* find devices */
13791379   state->cassette1 = devtag_get_device(machine, CASSETTE1_TAG);
13801380   state->cassette2 = devtag_get_device(machine, CASSETTE2_TAG);
r5932r5933
15231523
15241524static MACHINE_DRIVER_START( newbrain_eim )
15251525   MDRV_IMPORT_FROM(newbrain_a)
1526   
1526
15271527   /* basic system hardware */
15281528   MDRV_CPU_MODIFY(Z80_TAG)
15291529   MDRV_CPU_IO_MAP(newbrain_ei_io_map)
r5932r5933
15431543
15441544   /* MC6850 */
15451545   MDRV_ACIA6850_ADD(MC6850_TAG, newbrain_acia_intf)
1546   
1546
15471547   /* NEC765 */
15481548   MDRV_NEC765A_ADD(NEC765_TAG, newbrain_nec765_interface)
1549   
1549
15501550   MDRV_FLOPPY_2_DRIVES_ADD(newbrain_floppy_config)
15511551MACHINE_DRIVER_END
15521552
r5932r5933
16921692SYSTEM_CONFIG_END
16931693
16941694static SYSTEM_CONFIG_START( newbrain_eim )
1695   CONFIG_RAM_DEFAULT   (96 * 1024)   
1695   CONFIG_RAM_DEFAULT   (96 * 1024)
16961696   CONFIG_DEVICE(newbrain_serial_getinfo)
16971697SYSTEM_CONFIG_END
16981698
16991699/* System Drivers */
17001700
1701//    YEAR  NAME      PARENT      COMPAT   MACHINE         INPUT      INIT   CONFIG         COMPANY                     FULLNAME      FLAGS
1701//    YEAR  NAME        PARENT      COMPAT  MACHINE         INPUT       INIT    CONFIG          COMPANY                         FULLNAME        FLAGS
17021702COMP( 1981, newbrain,   0,         0,      newbrain_a,      newbrain,   0,       newbrain_a,      "Grundy Business Systems Ltd.",   "NewBrain AD",   GAME_NOT_WORKING | GAME_NO_SOUND )
17031703COMP( 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 )
17041704COMP( 1981, newbraia,   newbrain,   0,      newbrain_a,      newbrain,   0,       newbrain_a,      "Grundy Business Systems Ltd.",   "NewBrain A",   GAME_NOT_WORKING | GAME_NO_SOUND )
src/mess/drivers/microtan.c
r5932r5933
9696
9797    PORT_START("ROW2")
9898    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')
100100    PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
101101    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r')
102102    PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t')
src/mess/drivers/sapi1.c
r5932r5933
1818   AM_RANGE(0x0000, 0x0fff) AM_ROM
1919   AM_RANGE(0x1000, 0x1fff) AM_ROM // Extension ROM
2020   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
2222   //AM_RANGE(0x2800, 0x2bff) AM_NOP // PORT 1
2323   //AM_RANGE(0x2c00, 0x2fff) AM_NOP // PORT 2
24   //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214     
24   //AM_RANGE(0x3000, 0x33ff) AM_NOP // 3214
2525   AM_RANGE(0x3800, 0x3fff) AM_RAM AM_BASE(&sapi_video_ram) // AND-1 (video RAM)
2626   AM_RANGE(0x4000, 0x4000) AM_RAM // REM-1
2727ADDRESS_MAP_END
src/mess/drivers/einstein.c
r5932r5933
176176
177177
178178/****************************************************************
179   EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT
179    EINSTEIN NON-Z80 DEVICES DAISY CHAIN SUPPORT
180180****************************************************************/
181181
182182static DEVICE_START( einstein_daisy ) { }
r5932r5933
898898   MDRV_MACHINE_RESET(einstein)
899899
900900   /* this is actually clocked at the system clock 4 MHz, but this would be too fast for our
901   driver. So we update at 50Hz and hope this is good enough. */
901    driver. So we update at 50Hz and hope this is good enough. */
902902   MDRV_TIMER_ADD_PERIODIC("keyboard", einstein_keyboard_timer_callback, HZ(50))
903903
904904   MDRV_Z80PIO_ADD(IC_I063, einstein_pio_intf)
src/mess/drivers/vboy.c
r5932r5933
11/***************************************************************************
2   
3   Nintendo Virtual Boy
42
3    Nintendo Virtual Boy
4
55    12/05/2009 Skeleton driver.
66
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?
88
99****************************************************************************/
1010
r5932r5933
5353   UINT16 VER;
5454   UINT16 SPT[4];
5555   UINT16 GPLT[4];
56   UINT16 JPLT[4];
57   UINT16 BKCOL;
56   UINT16 JPLT[4];
57   UINT16 BKCOL;
5858};
5959
6060static struct VIP_REGS_STRUCT vip_regs;
r5932r5933
9292      default:
9393         logerror("Unemulated read: offset %08x\n", 0x02000000 + (offset << 2));
9494         break;
95   }   
95   }
9696   return value;
9797}
9898
r5932r5933
130130      case 0x18:   // TLB (Timer Low Byte)
131131      case 0x1c:   // THB (Timer High Byte)
132132      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);
134134         break;
135135   }
136136}
r5932r5933
153153      case 0x22:    //DPCTRL
154154               return vip_regs.DPCTRL;
155155               break;
156      case 0x24:    //BRTA         
156      case 0x24:    //BRTA
157157               return vip_regs.BRTA;
158               break;     
158               break;
159159      case 0x26:    //BRTB
160160               return vip_regs.BRTB;
161161               break;
r5932r5933
221221               break;
222222      default:
223223               logerror("Unemulated read: addr %08x\n", offset * 2 + 0x0005f800);
224               break;         
224               break;
225225   }
226226   return 0xffff;
227227}
r5932r5933
247247      case 0x24:    //BRTA
248248               vip_regs.BRTA = data;
249249               palette_set_color_rgb(space->machine, 1,(vip_regs.BRTA) & 0xff,0,0);
250               break;     
250               break;
251251      case 0x26:    //BRTB
252252               vip_regs.BRTB = data;
253253               palette_set_color_rgb(space->machine, 2,(vip_regs.BRTA + vip_regs.BRTB) & 0xff,0,0);
254254               break;
255      case 0x28:    //BRTC                           
255      case 0x28:    //BRTC
256256               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);
258258               break;
259259      case 0x2A:    //REST
260260               vip_regs.REST = data;
r5932r5933
315315               break;
316316      default:
317317               logerror("Unemulated write: addr %08x, data %04x\n", offset * 2 + 0x0005f800, data);
318               break;         
318               break;
319319   }
320320}
321321
322322static WRITE16_HANDLER( vboy_font0_w )
323323{
324   vboy_font[offset] = data | (vboy_font[offset] & (mem_mask ^ 0xffff));   
324   vboy_font[offset] = data | (vboy_font[offset] & (mem_mask ^ 0xffff));
325325}
326326
327327static WRITE16_HANDLER( vboy_font1_w )
328328{
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));
330330}
331331
332332static WRITE16_HANDLER( vboy_font2_w )
333333{
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));
335335}
336336
337337static WRITE16_HANDLER( vboy_font3_w )
338338{
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));
340340}
341341
342342static READ16_HANDLER( vboy_font0_r )
r5932r5933
363363{
364364   UINT16 code = ch;
365365   int i, b;
366   
367   for(i = 0; i < 8; i++)
366
367   for(i = 0; i < 8; i++)
368368   {
369369      UINT16  data;
370370      if(flipy==0) {
371          data =vboy_font[code * 8 + i];
371          data =vboy_font[code * 8 + i];
372372      } else {
373          data =vboy_font[code * 8 + (7-i)];
373          data =vboy_font[code * 8 + (7-i)];
374374      }
375375      for (b = 0; b < 8; b++)
376      {               
376      {
377377         UINT8 dat,col;
378378         if(flipx==0) {
379379            dat = ((data >> (b << 1)) & 0x03);
r5932r5933
383383         col = (pal >> (dat*2)) & 3;
384384         // This is how emulator works, but need to check
385385         if (dat==0) col=0;
386         
387         if (!trans || ( trans && col!=0)) {         
386
387         if (!trans || ( trans && col!=0)) {
388388            *BITMAP_ADDR16(bitmap, (y + i) & 0x1ff, (x + b) & 0x1ff) =  col;
389389         }
390      }     
391   }   
390      }
391   }
392392}
393393
394394static WRITE16_HANDLER( vboy_bgmap_w )
395{   
395{
396396   vboy_bgmap[offset] = data | (vboy_bgmap[offset] & (mem_mask ^ 0xffff));
397397}
398398
r5932r5933
411411   AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535
412412   AM_RANGE( 0x00018000, 0x0001dfff ) AM_RAM AM_BASE((UINT32**)&vboy_r_frame_1) // R frame buffer 1
413413   AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047
414   
414
415415   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
418418   AM_RANGE( 0x0005f800, 0x0005f87f )   AM_READWRITE16(vip_r, vip_w, 0xffffffff)
419   
419
420420   AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 mirror
421421   AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 mirror
422422   AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 mirror
423423   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
426426   AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(port_02_read, port_02_write) // Hardware control registers mask 0xff
427427   //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area
428428   AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM // Main RAM - 64K mask 0xffff
r5932r5933
440440   AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535
441441   AM_RANGE( 0x00018000, 0x0001dfff ) AM_RAM AM_BASE((UINT32**)&vboy_r_frame_1) // R frame buffer 1
442442   AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047
443   
443
444444   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
447447   AM_RANGE( 0x0005f800, 0x0005f87f )   AM_READWRITE16(vip_r, vip_w, 0xffffffff)
448   
448
449449   AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 mirror
450450   AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 mirror
451451   AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 mirror
452452   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
455455   AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(port_02_read, port_02_write) // Hardware control registers mask 0xff
456456   //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area
457457   AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM // Main RAM - 64K mask 0xffff
r5932r5933
463463static INPUT_PORTS_START( vboy )
464464   PORT_START("INPUT")
465465   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)
467467   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1)
468468   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1)
469469   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(1)
470470   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1)
471471   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(1)
472472   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)
474474   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1)
475475   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("L") PORT_PLAYER(1) // Left button on back
476476   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("R") PORT_PLAYER(1) // Right button on back
r5932r5933
481481INPUT_PORTS_END
482482
483483
484static MACHINE_RESET(vboy)
484static MACHINE_RESET(vboy)
485485{
486486   /* Initial values taken from Reality Boy, to be verified when emulation improves */
487487   vboy_regs.lpc = 0x6d;
488488   vboy_regs.lpc2 = 0xff;
489   vboy_regs.lpt = 0x00;
489   vboy_regs.lpt = 0x00;
490490   vboy_regs.lpr = 0x00;
491491   vboy_regs.klb = 0x00;
492492   vboy_regs.khb = 0x00;
r5932r5933
502502{
503503   int i;
504504   // Allocate memory for temporary screens
505   for(i = 0; i < 16; i++)
505   for(i = 0; i < 16; i++)
506506   {
507507      bg_map[i] = auto_bitmap_alloc(machine, 512, 512, BITMAP_FORMAT_INDEXED16);
508508   }
509509   screen_output = auto_bitmap_alloc(machine, 384, 224, BITMAP_FORMAT_INDEXED16);
510   
510
511511   vboy_font  = auto_alloc_array(machine, UINT16, 2048 * 8);
512512   vboy_bgmap = auto_alloc_array(machine, UINT16, 0x20000 >> 1);;
513   vboy_objects = vboy_bgmap + (0x1E000 >> 1);   
513   vboy_objects = vboy_bgmap + (0x1E000 >> 1);
514514   vboy_columntab1 = vboy_bgmap + (0x1dc00 >> 1);
515515   vboy_columntab2 = vboy_bgmap + (0x1de00 >> 1);
516516   vboy_world = vboy_bgmap + (0x1d800 >> 1);
r5932r5933
518518
519519static void fill_bg_map(int num, bitmap_t *bitmap)
520520{
521   int i, j;   
521   int i, j;
522522   // Fill background map
523   for (i = 0; i < 64; i++)
523   for (i = 0; i < 64; i++)
524524   {
525      for (j = 0; j < 64; j++)
525      for (j = 0; j < 64; j++)
526526      {
527527         UINT16 val = vboy_bgmap[j + 64 * i + (num * 0x1000)];
528528         put_char(j * 8, i * 8, val & 0x7ff, bitmap,BIT(val,13),BIT(val,12),0, vip_regs.GPLT[(val >> 14) & 3]);
r5932r5933
542542   UINT16 w  = vboy_world[num*16+7];
543543   UINT16 h = vboy_world[num*16+8];
544544   UINT16 param_base  = vboy_world[num*16+9] & 0xfff0;
545//   UINT16 overplane = vboy_world[num*16+10];
545//  UINT16 overplane = vboy_world[num*16+10];
546546   UINT8 bg_map_num = def & 0x0f;
547   INT16 x,y,i;   
547   INT16 x,y,i;
548548   UINT8 mode   = (def >> 12) & 3;
549549   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]);
552552      if (BIT(def,15) && (right==0)) {
553         // Left screen
553         // Left screen
554554         for(y=0;y<=h;y++) {
555555            for(x=0;x<=w;x++) {
556556               INT16 y1 = (y+gy);
557               INT16 x1 = (x+gx-gp);                 
557               INT16 x1 = (x+gx-gp);
558558               UINT16 pix = 0;
559559               if (mode==1) {
560560                  x1 += vboy_paramtab[y*2];
561561               }
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);
563563               if (pix!=0) {
564564                  if (y1>=0 && y1<224) {
565565                     if (x1>=0 && x1<384) {
r5932r5933
571571         }
572572      }
573573      if (BIT(def,14) && (right==1)) {
574         // Right screen
574         // Right screen
575575         for(y=0;y<=h;y++) {
576576            for(x=0;x<=w;x++) {
577577               INT16 y1 = (y+gy);
r5932r5933
593593      }
594594   }
595595   if(mode==2) {
596     
596
597597   }
598598   if(mode==3) {
599599      // just for test
r5932r5933
608608         } else {
609609            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]);
610610         }
611      }         
611      }
612612   }
613613   // Return END world status
614614   return BIT(def,6);
r5932r5933
619619   int i;
620620   UINT8 right = 0;
621621   const device_config *_3d_right_screen = devtag_get_device(screen->machine, "3dright");
622   
622
623623   bitmap_fill(screen_output, cliprect, vip_regs.BKCOL);
624     
624
625625   if (screen == _3d_right_screen) right = 1;
626626
627627   for(i=31;i>=0;i--) {
628628      if (display_world(i,screen_output,right)) break;
629629   }
630630   copybitmap(bitmap, screen_output, 0, 0, 0, 0, cliprect);
631   
631
632632   vip_regs.DPSTTS = ((vip_regs.DPCTRL&0x0302)|0x7c);
633633   return 0;
634634}
r5932r5933
641641static const rgb_t vboy_palette[18] = {
642642   MAKE_RGB(0x00, 0x00, 0x00), // 0
643643   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
646646};
647647
648648PALETTE_INIT( vboy )
r5932r5933
659659   MDRV_MACHINE_RESET(vboy)
660660
661661   MDRV_TIMER_ADD_PERIODIC("video", video_tick, HZ(100))
662   
663   /* video hardware */   
664   MDRV_DEFAULT_LAYOUT(layout_vboy)   
665662
663   /* video hardware */
664   MDRV_DEFAULT_LAYOUT(layout_vboy)
665
666666   MDRV_PALETTE_LENGTH(4)
667667   MDRV_PALETTE_INIT(vboy)
668668
669669   MDRV_VIDEO_START(vboy)
670670   MDRV_VIDEO_UPDATE(vboy)
671     
671
672672   /* Left screen */
673673   MDRV_SCREEN_ADD("3dleft", RASTER)
674674   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
r5932r5933
698698
699699/* Driver */
700700
701/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY      FULLNAME       FLAGS */
701/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY     FULLNAME       FLAGS */
702702CONS( 1995, vboy,   0,      0,        vboy,       vboy,     0,      0,    "Nintendo", "Virtual Boy", GAME_NOT_WORKING )
src/mess/drivers/votrpss.c
r5932r5933
1919<kevtris> IOA6 = strobe (SC-01)
2020<kevtris> IOA7 = vochord control, 0 = off, 1 = on
2121<kevtris> IOB0-IOB7 = dip switches
22<kevtris> there ya go, complete IO port map
22<kevtris> there ya go, complete IO port map
2323<LordNLptp> cool :)
2424<kevtris> I pinned the IO to the serial port from the 8251 but I don't think it's too useful
2525<LordNLptp> eh, its useful
r5932r5933
3434<kevtris> 4MHz for the Z80
3535<kevtris> 2MHz for the 8253 and '8910
3636<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
3838<LordNLptp> on the z80?
3939<LordNLptp> ok how does that work?
4040<kevtris> IRQ rate is umm
src/mess/drivers/fk1.c
r5932r5933
1515UINT8 fk1_video_rol;
1616/*
1717Port A:
18      Printer
19Port B:
20      Keyboard
18        Printer
19Port B:
20        Keyboard
2121Port 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
3434 */
3535
3636static WRITE8_DEVICE_HANDLER (fk1_ppi_1_a_w )
3737{
38//   logerror("fk1_ppi_1_a_w %02x\n",data);
38//  logerror("fk1_ppi_1_a_w %02x\n",data);
3939}
4040static WRITE8_DEVICE_HANDLER (fk1_ppi_1_b_w )
4141{
42//   logerror("fk1_ppi_1_b_w %02x\n",data);
42//  logerror("fk1_ppi_1_b_w %02x\n",data);
4343}
4444static WRITE8_DEVICE_HANDLER (fk1_ppi_1_c_w )
4545{
r5932r5933
5353}
5454static READ8_DEVICE_HANDLER (fk1_ppi_1_b_r )
5555{
56//   logerror("fk1_ppi_1_b_r\n");
56//  logerror("fk1_ppi_1_b_r\n");
5757   return 0;
5858}
5959static READ8_DEVICE_HANDLER (fk1_ppi_1_c_r )
6060{
61//   logerror("fk1_ppi_1_c_r\n");
61//  logerror("fk1_ppi_1_c_r\n");
6262   return 0;
6363}
6464I8255A_INTERFACE( fk1_ppi8255_interface_1 )
r5932r5933
6666   DEVCB_HANDLER(fk1_ppi_1_a_r),
6767   DEVCB_HANDLER(fk1_ppi_1_b_r),
6868   DEVCB_HANDLER(fk1_ppi_1_c_r),
69   DEVCB_HANDLER(fk1_ppi_1_a_w),   
69   DEVCB_HANDLER(fk1_ppi_1_a_w),
7070   DEVCB_HANDLER(fk1_ppi_1_b_w),
7171   DEVCB_HANDLER(fk1_ppi_1_c_w)
7272};
7373
7474/*
75Port A:
76   Writing data to disk
75Port A:
76    Writing data to disk
7777Port B:
78   Reading data from disk
79Port 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
79Port 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
8989
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
9393*/
9494static WRITE8_DEVICE_HANDLER (fk1_ppi_2_a_w )
9595{
96//   logerror("write to disk %02x\n",data);
96//  logerror("write to disk %02x\n",data);
9797}
9898
9999static WRITE8_DEVICE_HANDLER (fk1_ppi_2_c_w )
100100{
101//   logerror("fk1_ppi_2_c_w %02x\n",data);
101//  logerror("fk1_ppi_2_c_w %02x\n",data);
102102}
103103
104104static READ8_DEVICE_HANDLER (fk1_ppi_2_b_r )
105105{
106//   logerror("read from disk\n");
106//  logerror("read from disk\n");
107107   return 0;
108108}
109109static READ8_DEVICE_HANDLER (fk1_ppi_2_c_r )
110110{
111//   logerror("fk1_ppi_2_c_r\n");
111//  logerror("fk1_ppi_2_c_r\n");
112112   return 0;
113113}
114114I8255A_INTERFACE( fk1_ppi8255_interface_2 )
r5932r5933
116116   DEVCB_NULL,
117117   DEVCB_HANDLER(fk1_ppi_2_b_r),
118118   DEVCB_HANDLER(fk1_ppi_2_c_r),
119   DEVCB_HANDLER(fk1_ppi_2_a_w),   
119   DEVCB_HANDLER(fk1_ppi_2_a_w),
120120   DEVCB_NULL,
121121   DEVCB_HANDLER(fk1_ppi_2_c_w)
122122};
r5932r5933
125125/*
126126
127127Port 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).
132132
133133Port B:
134   Video ROL register
135Port C
134    Video ROL register
135Port C
136136
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
148142
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
149149*/
150150static WRITE8_DEVICE_HANDLER (fk1_ppi_3_a_w )
151151{
152//   logerror("fk1_ppi_3_a_w %02x\n",data);
152//  logerror("fk1_ppi_3_a_w %02x\n",data);
153153}
154154static WRITE8_DEVICE_HANDLER (fk1_ppi_3_b_w )
155155{
r5932r5933
157157}
158158static WRITE8_DEVICE_HANDLER (fk1_ppi_3_c_w )
159159{
160//   logerror("fk1_ppi_3_c_w %02x\n",data);
160//  logerror("fk1_ppi_3_c_w %02x\n",data);
161161}
162162
163163static READ8_DEVICE_HANDLER (fk1_ppi_3_a_r )
164164{
165//   logerror("fk1_ppi_3_a_r\n");
165//  logerror("fk1_ppi_3_a_r\n");
166166   return 0;
167167}
168168static READ8_DEVICE_HANDLER (fk1_ppi_3_b_r )
r5932r5933
171171}
172172static READ8_DEVICE_HANDLER (fk1_ppi_3_c_r )
173173{
174//   logerror("fk1_ppi_3_c_r\n");
174//  logerror("fk1_ppi_3_c_r\n");
175175   return 0;
176176}
177177I8255A_INTERFACE( fk1_ppi8255_interface_3 )
r5932r5933
179179   DEVCB_HANDLER(fk1_ppi_3_a_r),
180180   DEVCB_HANDLER(fk1_ppi_3_b_r),
181181   DEVCB_HANDLER(fk1_ppi_3_c_r),
182   DEVCB_HANDLER(fk1_ppi_3_a_w),   
182   DEVCB_HANDLER(fk1_ppi_3_a_w),
183183   DEVCB_HANDLER(fk1_ppi_3_b_w),
184184   DEVCB_HANDLER(fk1_ppi_3_c_w)
185185};
r5932r5933
192192
193193static PIT8253_OUTPUT_CHANGED(fk1_pit_out1)
194194{
195   // Timeout for disk operation
195   // Timeout for disk operation
196196   logerror("PIT8253_OUTPUT_CHANGED(fk1_pit_out1)\n");
197197}
198198
r5932r5933
222222};
223223
224224/*
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.
229229*/
230230
231231WRITE8_HANDLER( fk1_intr_w )
r5932r5933
237237{
238238   const address_space *space_mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
239239   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);
242242   return 0;
243243}
244244
r5932r5933
246246{
247247   const address_space *space_mem = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
248248   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);
251251   return 0;
252252}
253253
254254/*
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.
261261*/
262262WRITE8_HANDLER( fk1_disk_w )
263263{
264//   logerror("fk1_disk_w %02x\n",data);
264//  logerror("fk1_disk_w %02x\n",data);
265265}
266266
267267/*
2687 and 6 - 1 to connected mouse and 0 if not connected,
2687 and 6 - 1 to connected mouse and 0 if not connected,
2692695 - / T2, right-click
2702704 - / T1, left-click
2713 - / BY, Y-axis
2722 - / AY, Y-axis
2731 - / BX, X-axis
2713 - / BY, Y-axis
2722 - / AY, Y-axis
2731 - / BX, X-axis
2742740 - / AX, X-axis
275275*/
276276READ8_HANDLER( fk1_mouse_r )
277277{
278//   logerror("fk1_mouse_r\n");
278//  logerror("fk1_mouse_r\n");
279279   return 0;
280280}
281281
r5932r5933
283283
284284WRITE8_HANDLER( fk1_reset_int_w )
285285{
286   logerror("fk1_reset_int_w\n");   
286   logerror("fk1_reset_int_w\n");
287287}
288288
289289static ADDRESS_MAP_START(fk1_mem, ADDRESS_SPACE_PROGRAM, 8)
r5932r5933
324324
325325static TIMER_CALLBACK(keyboard_callback)
326326{
327   if (input_port_read(machine, "LINE0")) {     
328      int_vector = 6;   
327   if (input_port_read(machine, "LINE0")) {
328      int_vector = 6;
329329      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
330330   }
331331}
332332
333333/*
3347 – DATA_READY
3356 – TIMEOUT
3365 – OVERFLOW
3374 – RTC_50HZ
3383 – MOUSE
3392 – SIO
3401 – KEYBOARD
3410 – PRINTER
3347 ? DATA_READY
3356 ? TIMEOUT
3365 ? OVERFLOW
3374 ? RTC_50HZ
3383 ? MOUSE
3392 ? SIO
3401 ? KEYBOARD
3410 ? PRINTER
342342*/
343343
344344static IRQ_CALLBACK (fk1_irq_callback)
345{     
345{
346346   logerror("IRQ %02x\n",int_vector*2);
347347   return int_vector * 2;
348348}
r5932r5933
362362   memory_set_bankptr(machine, 2, mess_ram + 0x10000); // VRAM
363363   memory_set_bankptr(machine, 3, mess_ram + 0x8000);
364364   memory_set_bankptr(machine, 4, mess_ram + 0xc000);
365   
365
366366   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), fk1_irq_callback);
367367   timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback);
368368   timer_pulse(machine, ATTOTIME_IN_HZ(50), NULL, 0, vsync_callback);
r5932r5933
411411
412412    MDRV_VIDEO_START(fk1)
413413    MDRV_VIDEO_UPDATE(fk1)
414   
414
415415   MDRV_PIT8253_ADD( "pit8253", fk1_pit8253_intf )
416416   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 )
419419   /* uart */
420   MDRV_MSM8251_ADD("uart", default_msm8251_interface)   
420   MDRV_MSM8251_ADD("uart", default_msm8251_interface)
421421MACHINE_DRIVER_END
422422
423423static SYSTEM_CONFIG_START(fk1)
r5932r5933
428428ROM_START( fk1 )
429429    ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
430430    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))
432432   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))
434434ROM_END
435435
436436/* Driver */
src/mess/drivers/osborne1.c
r5932r5933
160160
161161static const z80_daisy_chain osborne1_daisy_chain[] =
162162{
163/*   { osborne1_z80_reset, osborne1_z80_irq_state, osborne1_z80_irq_ack, osborne1_z80_irq_reti, 0 }, */
163/*  { osborne1_z80_reset, osborne1_z80_irq_state, osborne1_z80_irq_ack, osborne1_z80_irq_reti, 0 }, */
164164   { "osborne1_daisy" },
165165   { NULL }
166166};
r5932r5933
180180      TRACKS([40])
181181      SECTORS([10])
182182      SECTOR_LENGTH([256])
183      FIRST_SECTOR_ID([1]))   
183      FIRST_SECTOR_ID([1]))
184184   FLOPPY_OPTION( odd, "img", "Osborne double density", basicdsk_identify_default, basicdsk_construct_default,
185185      HEADS([1])
186186      TRACKS([40])
r5932r5933
192192      TRACKS([40])
193193      SECTORS([8])
194194      SECTOR_LENGTH([512])
195      FIRST_SECTOR_ID([1]))               
195      FIRST_SECTOR_ID([1]))
196196   FLOPPY_OPTION( xerox, "img", "Xerox 820 Computer", basicdsk_identify_default, basicdsk_construct_default,
197197      HEADS([1])
198198      TRACKS([40])
199199      SECTORS([18])
200200      SECTOR_LENGTH([128])
201      FIRST_SECTOR_ID([1]))               
201      FIRST_SECTOR_ID([1]))
202202   FLOPPY_OPTION( dec, "img", "DEC 1820 double density", basicdsk_identify_default, basicdsk_construct_default,
203203      HEADS([1])
204204      TRACKS([40])
205205      SECTORS([9])
206206      SECTOR_LENGTH([512])
207      FIRST_SECTOR_ID([1]))               
207      FIRST_SECTOR_ID([1]))
208208FLOPPY_OPTIONS_END
209209
210210static const floppy_config osborne1_floppy_config =
r5932r5933
235235   MDRV_SPEAKER_STANDARD_MONO( "mono" )
236236   MDRV_SOUND_ADD( "beep", BEEP, 0 )
237237   MDRV_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
238   
238
239239   MDRV_PIA6821_ADD( "pia_0", osborne1_ieee_pia_config )
240240   MDRV_PIA6821_ADD( "pia_1", osborne1_video_pia_config )
241241
242242   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)
245245MACHINE_DRIVER_END
246246
247247
src/mess/drivers/vtech1.c
r5932r5933
282282   PORT_CONFNAME( 0x01, 0x01, "Autorun on Quickload")
283283   PORT_CONFSETTING(    0x00, DEF_STR(No))
284284   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))
288288INPUT_PORTS_END
289289
290290
r5932r5933
475475   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
476476
477477   /* 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 */
483483
484484   memory_write_word_16le(space, 0x791c, end_address + 1);
485485   memory_write_word_16le(space, 0x781e, execute_address);
r5932r5933
487487   if (start_address == 0x7ae9)
488488   {
489489      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
497497
498498      for (i = 0; i < ARRAY_LENGTH(data); i++)
499499         memory_write_byte(space, 0x791e + i, data[i]);
src/mess/drivers/camplynx.c
r5932r5933
44
55      05/2009 Skeleton driver.
66
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
1111      1983). It was possible reach 192 kB with RAM expansions on-board.
1212
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
1515      the optional 5.25" floppy disk-drive on the 96 kB and 128 kB models.
1616      Approximately 30,000 Lynx units were sold world-wide.
1717
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.
2020
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
2525      came into being.
2626
2727      Hardware info:
r5932r5933
4242      Bank 0  |      BASIC ROM       |    Not Available       |  Ext  |  Ext
4343              |                      |                        |  ROM1 |  ROM2
4444     -------------------------------------------------------------------------
45              |                      |   
45              |                      |
4646      Bank 1  |        STORE         |           Workspace RAM
47              |                      |   
47              |                      |
4848     -------------------------------------------------------------------------
4949              |               |               |               |
5050      Bank 2  |       RED     |     BLUE      |     GREEN     |     Alt
5151              |               |               |               |    Green
5252     -------------------------------------------------------------------------
53              |   
53              |
5454      Bank 3  |              Available for Video Expansion
55              |   
55              |
5656     -------------------------------------------------------------------------
57              |         
57              |
5858      Bank 4  |              Available for User RAM Expansion
59              |       
59              |
6060
6161
6262
63   48k and 96k are basically the same machine. 128k is different.
63    48k and 96k are basically the same machine. 128k is different.
6464
65   The work so far is without the benefit of manuals, schematic etc [Robbbert]
65    The work so far is without the benefit of manuals, schematic etc [Robbbert]
6666
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.
7070
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
7676
7777****************************************************************************/
7878
r5932r5933
8484static const device_config *mc6845;
8585
8686/* 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. */
8989
9090static WRITE8_HANDLER( lynx48k_bank_w )
9191{
r5932r5933
196196
197197static ADDRESS_MAP_START( lynx128k_io , ADDRESS_SPACE_IO, 8)
198198   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)
206206   AM_RANGE(0x0080,0x0080) AM_MIRROR(0xff00) AM_WRITE(SMH_NOP)      /* to be emulated */
207207   AM_RANGE(0x0080,0x0080) AM_READ_PORT("LINE0")
208208   AM_RANGE(0x0180,0x0180) AM_READ_PORT("LINE1")
r5932r5933
323323
324324static const UINT8 lynx48k_palette[8*3] =
325325{
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     */
334334};
335335
336336static PALETTE_INIT( lynx48k )
src/mess/drivers/amstrad.c
r5932r5933
5858
5959   January 2008 - added preliminary Aleste 520EX support
6060               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.
6363
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.
7070
7171
7272   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.
7575
7676
7777Some bugs left :
r5932r5933
7979    - CRTC all type support (0,1,2,3,4) ?
8080    - 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)!
8181    - Implement full Asic for CPC+ emulation.  Soft scroll is rather dodgy.
82   - The KC Compact should not reuse the gate array functionality. Instead z8536 support should be added. (bug #42)
82    - The KC Compact should not reuse the gate array functionality. Instead z8536 support should be added. (bug #42)
8383
8484 ******************************************************************************/
8585
r5932r5933
374374   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
375375As far as I know, the KC compact used HD6845S only.
376376*/
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")
385385
386386   PORT_START("multiface")
387387   PORT_CONFNAME(0x01, 0x00, "Multiface Two" )
r5932r5933
901901   MDRV_CASSETTE_ADD( "cassette", amstrad_cassette_config )
902902
903903   MDRV_NEC765A_ADD("nec765", amstrad_nec765_interface)
904   
904
905905   MDRV_FLOPPY_2_DRIVES_ADD(cpc6128_floppy_config)
906906MACHINE_DRIVER_END
907907
r5932r5933
961961   MDRV_NEC765A_ADD("nec765", amstrad_nec765_interface)
962962
963963   MDRV_IMPORT_FROM(cpcplus_cartslot)
964   
964
965965   MDRV_FLOPPY_2_DRIVES_ADD(cpc6128_floppy_config)
966966MACHINE_DRIVER_END
967967
r5932r5933
10151015   MDRV_PALETTE_INIT(aleste)
10161016   MDRV_NVRAM_HANDLER(mc146818)
10171017   MDRV_NEC765A_MODIFY("nec765", aleste_8272_interface)
1018   
1018
10191019   MDRV_FLOPPY_2_DRIVES_MODIFY(aleste_floppy_config)
10201020MACHINE_DRIVER_END
10211021
src/mess/drivers/ng_aes.c
r5932r5933
2020    MESS cartridge support by R. Belmont based on work by Michael Zapf
2121
2222    Current status:
23       - Cartridges run.
23        - Cartridges run.
2424
25    ToDo :
25    ToDo :
2626        - Change input code to allow selection of the mahjong panel in PORT_CATEGORY.
2727        - Clean up code, to reduce duplication of MAME source
2828
r5932r5933
310310   switch (offset)
311311   {
312312   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;
315315   case 0x28: upd4990a_control_16_w(upd4990a, 0, data, mem_mask); break;
316316//  case 0x30: break; // coin counters
317317//  case 0x31: break; // coin counters
r5932r5933
382382
383383static void calendar_clock(void)
384384{
385//   pd4990a_addretrace();
385//  pd4990a_addretrace();
386386}
387387#endif
388388
r5932r5933
807807   create_interrupt_timers(machine);
808808
809809   /* initialize the celander IC to 'right now' */
810//   calendar_init(machine);
810//  calendar_init(machine);
811811
812812   /* initialize the memcard data structure */
813813   memcard_data = auto_alloc_array_clear(machine, UINT8, MEMCARD_SIZE);
r5932r5933
11371137
11381138static INPUT_PORTS_START( aes )
11391139// 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) */
11661166
11671167   PORT_START("CTRLSEL")  /* Select Controller Type */
11681168   PORT_CATEGORY_CLASS( 0x0f, 0x01, "P1 Controller")
r5932r5933
12411241 *
12421242 *  Driver initalization
12431243 *
1244 *************************************/
1244? *************************************/
12451245
12461246static DRIVER_INIT( neogeo )
12471247{
r5932r5933
12961296
12971297   ROM_REGION( 0x10000, "ym", ROMREGION_ERASEFF )
12981298
1299//   NO_DELTAT_REGION
1299//  NO_DELTAT_REGION
13001300
13011301   ROM_REGION( 0x100000, "sprites", ROMREGION_ERASEFF )
13021302ROM_END
r5932r5933
13201320
13211321   ROM_REGION( 0x10000, "ym", ROMREGION_ERASEFF )
13221322
1323//   NO_DELTAT_REGION
1323//  NO_DELTAT_REGION
13241324
13251325   ROM_REGION( 0x100000, "sprites", ROMREGION_ERASEFF )
13261326ROM_END
src/mess/drivers/kyocera.c
r5932r5933
11/******************************************************************************************
22
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)
74
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)
97
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.
249
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
2525******************************************************************************************/
2626
2727/*
2828
29   TODO:
29    TODO:
3030
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
5050
5151*/
5252
5353/*
5454
55                    * PC-8201/8300 HARDWARE PORT DEFINITIONS *
55                          * PC-8201/8300 HARDWARE PORT DEFINITIONS *
5656
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
6868
6969*/
7070
r5932r5933
9191static READ8_HANDLER( pc8201_bank_r )
9292{
9393   /*
94     
95      bit      signal      description
9694
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
10596
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
107105
106    */
107
108108   kc85_state *state = space->machine->driver_data;
109109
110110   return (state->iosel << 5) | state->bank;
r5932r5933
173173static WRITE8_HANDLER( pc8201_bank_w )
174174{
175175   /*
176     
177      bit      signal      description
178176
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
187178
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
189187
188    */
189
190190   pc8201_bankswitch(space->machine, data & 0x0f);
191191}
192192
193193static WRITE8_HANDLER( pc8201_ctrl_w )
194194{
195195   /*
196     
197      bit      signal      description
198196
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
207198
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
209207
208    */
209
210210   kc85_state *state = space->machine->driver_data;
211   
211
212212   /* cassette motor */
213213   cassette_change_state(state->cassette, BIT(data, 3) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
214214
r5932r5933
226226{
227227   /*
228228
229      bit      signal      description
229        bit     signal      description
230230
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
239239
240   */
240    */
241241/*
242   kc85_state *state = space->machine->driver_data;
242    kc85_state *state = space->machine->driver_data;
243243
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));
249249*/
250250}
251251
r5932r5933
253253{
254254   /*
255255
256      bit      signal      description
256        bit     signal      description
257257
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
266266
267   */
267    */
268268/*
269   kc85_state *state = space->machine->driver_data;
269    kc85_state *state = space->machine->driver_data;
270270
271   UINT8 data = 0;
271    UINT8 data = 0;
272272
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);
278278
279   data = (tbre << 4) | (pe << 3) | (fe << 2) | (oe << 1) | cd;
279    data = (tbre << 4) | (pe << 3) | (fe << 2) | (oe << 1) | cd;
280280
281   return data;
281    return data;
282282*/
283283
284284   return 0xf0;
r5932r5933
288288{
289289   /*
290290
291      bit      signal      description
291        bit     signal      description
292292
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
301301
302   */
302    */
303303/*
304   kc85_state *state = space->machine->driver_data;
304    kc85_state *state = space->machine->driver_data;
305305
306   UINT8 data = 0;
306    UINT8 data = 0;
307307
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);
313313
314   data = (tbre << 4) | (pe << 3) | (fe << 2) | (oe << 1) | cd;
314    data = (tbre << 4) | (pe << 3) | (fe << 2) | (oe << 1) | cd;
315315
316   return data;
316    return data;
317317*/
318318
319319   return 0xf0;
r5932r5933
323323{
324324   /*
325325
326      bit      signal      description
326        bit     signal      description
327327
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
336336
337   */
337    */
338338/*
339   kc85_state *state = space->machine->driver_data;
339    kc85_state *state = space->machine->driver_data;
340340
341   mc14412_en_w(state->mc14412, BIT(data, 1));
341    mc14412_en_w(state->mc14412, BIT(data, 1));
342342*/
343343}
344344
r5932r5933
346346{
347347   /*
348348
349      bit      signal      description
349        bit     signal      description
350350
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
359359
360   */
360    */
361361
362362   kc85_state *state = space->machine->driver_data;
363363
r5932r5933
449449static WRITE8_HANDLER( tandy200_stbk_w )
450450{
451451   /*
452     
453      bit      signal   description
454452
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
463454
464   */
455        0       _PSTB   printer strobe output
456        1       REMOTE  cassette motor
457        2
458        3
459        4
460        5
461        6
462        7
465463
464    */
465
466466   tandy200_state *state = space->machine->driver_data;
467467
468468   /* printer strobe */
r5932r5933
495495
496496static ADDRESS_MAP_START( kc85_io, ADDRESS_SPACE_IO, 8 )
497497   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
502502   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w)
503//   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
503//  AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
504504   AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(uart_status_r, uart_ctrl_w)
505505   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(keyboard_r, kc85_ctrl_w)
506506   AM_RANGE(0xf0, 0xf0) AM_MIRROR(0x0e) AM_READWRITE(kc85_lcd_status_r, kc85_lcd_command_w)
r5932r5933
509509
510510static ADDRESS_MAP_START( trsm100_io, ADDRESS_SPACE_IO, 8 )
511511   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
515515   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(modem_w)
516516   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w)
517//   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
517//  AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
518518   AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(uart_status_r, uart_ctrl_w)
519519   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(keyboard_r, kc85_ctrl_w)
520520   AM_RANGE(0xf0, 0xf0) AM_MIRROR(0x0e) AM_READWRITE(kc85_lcd_status_r, kc85_lcd_command_w)
r5932r5933
523523
524524static ADDRESS_MAP_START( pc8201_io, ADDRESS_SPACE_IO, 8 )
525525   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
528528   AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) AM_WRITE(pc8201_ctrl_w)
529529   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_READWRITE(pc8201_bank_r, pc8201_bank_w)
530530   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w )
531//   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
531//  AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
532532   AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(pc8201_uart_status_r, uart_ctrl_w)
533533   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READ(keyboard_r)
534534   AM_RANGE(0xf0, 0xf0) AM_MIRROR(0x0e) AM_READWRITE(kc85_lcd_status_r, kc85_lcd_command_w)
r5932r5933
538538static ADDRESS_MAP_START( tandy200_io, ADDRESS_SPACE_IO, 8 )
539539   ADDRESS_MAP_UNMAP_HIGH
540540   AM_RANGE(0x90, 0x9f) AM_DEVREADWRITE(RP5C01A_TAG, rp5c01a_r, rp5c01a_w)
541//   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_DEVWRITE(TCM5089_TAG, tcm5089_w)
541//  AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_DEVWRITE(TCM5089_TAG, tcm5089_w)
542542   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w)
543543   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0e) AM_DEVREADWRITE(MSM8251_TAG, msm8251_data_r, msm8251_data_w)
544544   AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x0e) AM_DEVREADWRITE(MSM8251_TAG, msm8251_status_r, msm8251_control_w)
r5932r5933
677677   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
678678   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
679679   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL BKSP") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
680   
680
681681   PORT_MODIFY("KEY7")
682682   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 )
685685   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
686686   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
687687   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("f.3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
r5932r5933
815815static READ8_DEVICE_HANDLER( kc85_8155_port_c_r )
816816{
817817   /*
818   
819      bit      description
820818
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
827820
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
829827
828    */
829
830830   kc85_state *state = device->machine->driver_data;
831831
832832   UINT8 data = 0;
r5932r5933
842842{
843843   /*
844844
845      bit      description
845        bit     description
846846
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
855855
856   */
856    */
857857
858858   kc85_state *state = device->machine->driver_data;
859859
r5932r5933
882882{
883883   /*
884884
885      bit      signal      description
885        bit     signal      description
886886
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
895895
896   */
896    */
897897
898898   kc85_state *state = device->machine->driver_data;
899899
r5932r5933
935935static READ8_DEVICE_HANDLER( pc8201_8155_port_c_r )
936936{
937937   /*
938   
939      bit      signal      description
940938
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
947940
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
949947
948    */
949
950950   kc85_state *state = device->machine->driver_data;
951951
952952   UINT8 data = 0;
r5932r5933
962962{
963963   /*
964964
965      bit      signal      description
965        bit     signal      description
966966
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
975975
976   */
976    */
977977
978978   kc85_state *state = device->machine->driver_data;
979979
r5932r5933
10051005static READ8_DEVICE_HANDLER( tandy200_8155_port_c_r )
10061006{
10071007   /*
1008   
1009      bit      signal   description
10101008
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
10171010
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
10191017
1018    */
1019
10201020   tandy200_state *state = device->machine->driver_data;
10211021
10221022   UINT8 data = 0x01;
r5932r5933
10311031{
10321032   /*
10331033
1034      bit      description
1034        bit     description
10351035
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
10441044
1045   */
1045    */
10461046
10471047   tandy200_state *state = device->machine->driver_data;
10481048
r5932r5933
10551055{
10561056   /*
10571057
1058      bit      signal      description
1058        bit     signal      description
10591059
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
10681068
1069   */
1069    */
10701070
10711071   tandy200_state *state = device->machine->driver_data;
10721072
r5932r5933
11981198   kc85_state *state = machine->driver_data;
11991199
12001200   const address_space *program = cputag_get_address_space(machine, I8085_TAG, ADDRESS_SPACE_PROGRAM);
1201   
1201
12021202   /* find devices */
12031203   state->upd1990a = devtag_get_device(machine, UPD1990A_TAG);
12041204   state->centronics = devtag_get_device(machine, CENTRONICS_TAG);
r5932r5933
13901390   MDRV_MACHINE_START(trsm100)
13911391
13921392   /* devices */
1393//   MDRV_MC14412_ADD(MC14412_TAG, XTAL_1MHz)
1393//  MDRV_MC14412_ADD(MC14412_TAG, XTAL_1MHz)
13941394MACHINE_DRIVER_END
13951395
13961396static MACHINE_DRIVER_START( tandy200 )
r5932r5933
14141414   MDRV_SPEAKER_STANDARD_MONO("mono")
14151415   MDRV_SOUND_ADD("speaker", SPEAKER, 0)
14161416   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
1417//   MDRV_TCM5089_ADD(TCM5089_TAG, XTAL_3_579545MHz)
1417//  MDRV_TCM5089_ADD(TCM5089_TAG, XTAL_3_579545MHz)
14181418
14191419   /* devices */
14201420   MDRV_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, tandy200_8155_intf)
14211421   MDRV_RP5C01A_ADD(RP5C01A_TAG, XTAL_32_768kHz, tandy200_rp5c01a_intf)
14221422   MDRV_MSM8251_ADD(MSM8251_TAG, /*XTAL_4_9152MHz/2,*/ tandy200_msm8251_interface)
1423//   MDRV_MC14412_ADD(MC14412_TAG, XTAL_1MHz)
1423//  MDRV_MC14412_ADD(MC14412_TAG, XTAL_1MHz)
14241424
14251425   /* printer */
14261426   MDRV_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
r5932r5933
14541454
14551455ROM_START( trsm100 )
14561456   /*
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    */
14631463   ROM_REGION( 0x8000, I8085_TAG, 0 )
14641464   ROM_LOAD( "m100rom.m12",  0x0000, 0x8000, CRC(730a3611) SHA1(094dbc4ac5a4ea5cdf51a1ac581a40a9622bb25d) )
14651465
r5932r5933
14681468ROM_END
14691469
14701470ROM_START( olivm10 )
1471   // 3256C02-4B3/I      Italian
1471   // 3256C02-4B3/I        Italian
14721472   ROM_REGION( 0x8010, I8085_TAG, 0 )
14731473   ROM_LOAD( "m10rom.m12", 0x0000, 0x8000, CRC(f0e8447a) SHA1(d58867276213116a79f7074109b7d7ce02e8a3af) )
14741474
r5932r5933
15061506static SYSTEM_CONFIG_START( pc8201 )
15071507   CONFIG_RAM_DEFAULT   (16 * 1024)
15081508   CONFIG_RAM         (32 * 1024)
1509//   CONFIG_RAM         (48 * 1024)
1509//  CONFIG_RAM          (48 * 1024)
15101510   CONFIG_RAM         (64 * 1024)
15111511   CONFIG_RAM         (96 * 1024)
15121512SYSTEM_CONFIG_END
r5932r5933
15311531
15321532/* System Drivers */
15331533
1534/*    YEAR  NAME      PARENT   COMPAT   MACHINE      INPUT      INIT   CONFIG      COMPANY               FULLNAME */
1534/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY                 FULLNAME */
15351535COMP( 1983,   kc85,      0,      0,      kc85,      kc85,      0,      kc85,      "Kyosei",            "Kyotronic 85 (Japan)", 0 )
15361536COMP( 1983, olivm10,   kc85,   0,      kc85,      olivm10,   0,      kc85,      "Olivetti",            "M-10", 0 )
1537//COMP( 1983, olivm10m,   kc85,   0,      kc85,      olivm10,   0,      kc85,      "Olivetti",            "M-10 Modem (US)", 0 )
1537//COMP( 1983, olivm10m, kc85,   0,      kc85,       olivm10,    0,      kc85,       "Olivetti",             "M-10 Modem (US)", 0 )
15381538COMP( 1983, trsm100,   0,      0,      trsm100,   kc85,      0,      trsm100,   "Tandy Radio Shack",   "TRS-80 Model 100", 0 )
15391539COMP( 1986, tandy102,   trsm100,0,      trsm100,   kc85,      0,      tandy102,   "Tandy Radio Shack",   "Tandy 102", 0 )
1540//COMP( 1983, npc8201,   0,      0,      pc8201,      pc8201a,   0,      pc8201,      "NEC",               "PC-8201 (Japan)", 0 )
1540//COMP( 1983, npc8201,  0,      0,      pc8201,     pc8201a,    0,      pc8201,     "NEC",                  "PC-8201 (Japan)", 0 )
15411541COMP( 1983, npc8201a,   0,      0,      pc8201,      pc8201a,   0,      pc8201,      "NEC",               "PC-8201A", 0 )
1542//COMP( 1987, npc8300,   npc8201,0,      pc8300,      pc8300,      0,      pc8300,      "NEC",               "PC-8300", 0 )
1542//COMP( 1987, npc8300,  npc8201,0,      pc8300,     pc8300,     0,      pc8300,     "NEC",                  "PC-8300", 0 )
15431543COMP( 1984, tandy200,   0,      0,      tandy200,   kc85,      0,      tandy200,   "Tandy Radio Shack",   "Tandy 200", 0 )
src/mess/drivers/cdi.c
r5932r5933
17931793   //fflush(stdout);
17941794
17951795   /*
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++;
18341834
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    */
18601860
18611861   while(!done)
18621862   {
src/mess/drivers/sdk86.c
r5932r5933
11/***************************************************************************
2   
2
33        Intel SDK-86
44
55        12/05/2009 Skeleton driver.
r5932r5933
2323INPUT_PORTS_END
2424
2525
26static MACHINE_RESET(sdk86)
27{   
26static MACHINE_RESET(sdk86)
27{
2828}
2929
3030static VIDEO_START( sdk86 )
r5932r5933
4040    /* basic machine hardware */
4141    MDRV_CPU_ADD("maincpu",I8086, XTAL_5MHz) /* jumper selection slow it down on 2.5MHz*/
4242    MDRV_CPU_PROGRAM_MAP(sdk86_mem)
43    MDRV_CPU_IO_MAP(sdk86_io)   
43    MDRV_CPU_IO_MAP(sdk86_io)
4444
4545    MDRV_MACHINE_RESET(sdk86)
46   
46
4747    /* video hardware */
4848    MDRV_SCREEN_ADD("screen", RASTER)
4949    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
6565     ROM_LOAD16_BYTE( "0456_104531-001.a36", 0xfe000, 0x0800, CRC(f9c4a809) SHA1(aea324c3f52dd393f1eed2b856ba11f050a35b93))
6666     ROM_LOAD16_BYTE( "0457_104532-001.a37", 0xfe001, 0x0800, CRC(a245ba5c) SHA1(7f67277f866fca5377cb123e9cc405b5fdfe61d3))
6767   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))
6969ROM_END
7070
7171/* Driver */
src/mess/drivers/sms.c
r5932r5933
246246   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */
247247INPUT_PORTS_END
248248
249static PALETTE_INIT( sms )
249static PALETTE_INIT( sms )
250250{
251251   int i;
252   for( i = 0; i < 64; i++ )
252   for( i = 0; i < 64; i++ )
253253   {
254254      int r = i & 0x03;
255255      int g = ( i & 0x0C ) >> 2;
r5932r5933
275275   palette_set_color_rgb(machine, 64+15, 255, 255, 255 );
276276}
277277
278static PALETTE_INIT( gamegear )
278static PALETTE_INIT( gamegear )
279279{
280280   int i;
281   for( i = 0; i < 4096; i++ )
281   for( i = 0; i < 4096; i++ )
282282   {
283283      int r = i & 0x000F;
284284      int g = ( i & 0x00F0 ) >> 4;
r5932r5933
292292static const smsvdp_configuration config_315_5378 = { MODEL_315_5378, sms_int_callback };
293293static const smsvdp_configuration config_store = { MODEL_315_5124, sms_store_int_callback };
294294
295static VIDEO_START(sega_315_5124)
295static VIDEO_START(sega_315_5124)
296296{
297297   smsvdp_video_init( machine, &config_315_5124 );
298298}
299299
300static VIDEO_START(sega_315_5246)
300static VIDEO_START(sega_315_5246)
301301{
302302   smsvdp_video_init( machine, &config_315_5246 );
303303}
304304
305static VIDEO_START(sega_315_5378)
305static VIDEO_START(sega_315_5378)
306306{
307307   smsvdp_video_init( machine, &config_315_5378 );
308308}
309309
310static VIDEO_START(sega_store_315_5124)
310static VIDEO_START(sega_store_315_5124)
311311{
312312   smsvdp_video_init( machine, &config_store );
313313}
r5932r5933
346346   MDRV_SPEAKER_STANDARD_MONO("mono")
347347   MDRV_SOUND_ADD("smsiii", SMSIII, XTAL_53_693175MHz/15)
348348   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
349   
349
350350   MDRV_IMPORT_FROM( sms_cartslot )
351351MACHINE_DRIVER_END
352352
r5932r5933
413413   MDRV_SPEAKER_STANDARD_MONO("mono")
414414   MDRV_SOUND_ADD("smsiii", SMSIII, MASTER_CLOCK_PAL/15)
415415   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
416   
416
417417   MDRV_IMPORT_FROM( sms_cartslot )
418418MACHINE_DRIVER_END
419419
src/mess/drivers/poly88.c
r5932r5933
2626static ADDRESS_MAP_START( poly88_io , ADDRESS_SPACE_IO, 8)
2727   ADDRESS_MAP_UNMAP_HIGH
2828   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)
3030   AM_RANGE(0x04, 0x04) AM_WRITE(poly_baud_rate_w)
3131   AM_RANGE(0x08, 0x08) AM_WRITE(poly_intr_w)
3232   AM_RANGE(0xf8, 0xf8) AM_READ(poly_keyboard_r)
r5932r5933
3838   AM_RANGE(0x0400, 0x0bff) AM_ROM // Disk System ROM
3939   AM_RANGE(0x0c00, 0x0fff) AM_RAM // System RAM
4040   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
4242ADDRESS_MAP_END
4343
4444static ADDRESS_MAP_START( poly8813_io , ADDRESS_SPACE_IO, 8)
r5932r5933
4747
4848/* Input ports */
4949static INPUT_PORTS_START( poly88 )
50   PORT_START("LINEC")   
50   PORT_START("LINEC")
5151   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
5252   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
5353   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
r5932r5933
7070   PORT_START("LINE1")
7171   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
7272   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)
7777   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)
7979
8080   PORT_START("LINE2")
8181   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_END)
r5932r5933
9696   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
9797   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
9898   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
99                                                 
99
100100   PORT_START("LINE4")
101101   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
102102   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
r5932r5933
106106   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
107107   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
108108   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
109                       
109
110110   PORT_START("LINE5")
111111   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
112112   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
113113   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)
115115   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH)
116116   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]")  PORT_CODE(KEYCODE_CLOSEBRACE)
117117   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~")  PORT_CODE(KEYCODE_TILDE)
118118   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL")PORT_CODE(KEYCODE_BACKSPACE)
119   
119
120120   PORT_START("LINE6")
121121   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT)
122122   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT)
123123   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP)
124124   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN)
125125   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)
129129INPUT_PORTS_END
130130
131131static const struct CassetteOptions poly88_cassette_options =
r5932r5933
164164
165165    MDRV_VIDEO_START(poly88)
166166    MDRV_VIDEO_UPDATE(poly88)
167   
167
168168   /* audio hardware */
169169   MDRV_SPEAKER_STANDARD_MONO("mono")
170170   MDRV_SOUND_WAVE_ADD("wave", "cassette")
r5932r5933
172172
173173    /* cassette */
174174   MDRV_CASSETTE_ADD( "cassette", poly88_cassette_config )
175   
175
176176    /* uart */
177177   MDRV_MSM8251_ADD("uart", poly88_usart_interface)
178   
178
179179   /* snapshot */
180   MDRV_SNAPSHOT_ADD("snapshot", poly88, "img", 0)   
180   MDRV_SNAPSHOT_ADD("snapshot", poly88, "img", 0)
181181MACHINE_DRIVER_END
182182
183183static MACHINE_DRIVER_START( poly8813 )
184184   MDRV_IMPORT_FROM(poly88)
185   
185
186186   MDRV_CPU_MODIFY("maincpu")
187187   MDRV_CPU_PROGRAM_MAP(poly8813_mem)
188188   MDRV_CPU_IO_MAP(poly8813_io)
r5932r5933
204204ROM_END
205205/* Driver */
206206
207/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY                 FULLNAME       FLAGS */
207/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY                   FULLNAME       FLAGS */
208208COMP( 1976, poly88,  0,     0,        poly88,    poly88,  poly88, 0,"PolyMorphic Systems",   "Poly-88",    0)
209209COMP( 1977, poly8813,poly88,0,        poly8813,    poly88,  poly88, 0,"PolyMorphic Systems",   "Poly-8813",GAME_NOT_WORKING)
210210
src/mess/drivers/junior.c
r5932r5933
11/***************************************************************************
2   
2
33        Elektor Junior
44
55        17/07/2009 Skeleton driver.
r5932r5933
1414static UINT8      junior_port_a;
1515static UINT8      junior_port_b;
1616static UINT8      junior_led_time[6];
17 
1817
18
1919 static ADDRESS_MAP_START(junior_mem, ADDRESS_SPACE_PROGRAM, 8)
2020   ADDRESS_MAP_GLOBAL_MASK(0x1FFF)
2121   ADDRESS_MAP_UNMAP_HIGH
r5932r5933
163163   for ( i = 0; i < 6; i++ )
164164   {
165165      if ( junior_led_time[i] )
166         junior_led_time[i]--;
166         junior_led_time[i]--;
167167      else
168168         output_set_digit_value( i, 0 );
169169   }
r5932r5933
177177}
178178
179179
180static MACHINE_RESET(junior)
181{   
180static MACHINE_RESET(junior)
181{
182182   int i;
183183
184184   timer_pulse(machine,  ATTOTIME_IN_HZ(50), NULL, 0, junior_update_leds );
r5932r5933
198198
199199   MDRV_MACHINE_START( junior )
200200    MDRV_MACHINE_RESET(junior)
201   
201
202202    /* video hardware */
203203    MDRV_DEFAULT_LAYOUT( layout_junior )
204204
src/mess/drivers/llc.c
r5932r5933
1919   AM_RANGE(0x0000, 0x07ff) AM_ROM // Monitor ROM
2020   AM_RANGE(0x0800, 0x13ff) AM_ROM // BASIC ROM
2121   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
2323   AM_RANGE(0x2000, 0xffff) AM_RAM // RAM
2424ADDRESS_MAP_END
2525
2626static ADDRESS_MAP_START( llc1_io, ADDRESS_SPACE_IO, 8 )
2727   ADDRESS_MAP_GLOBAL_MASK(0xff)
28   ADDRESS_MAP_UNMAP_HIGH     
28   ADDRESS_MAP_UNMAP_HIGH
2929   AM_RANGE(0xEC, 0xEF) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w)
3030   //AM_RANGE(0xF4, 0xF7) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w)
3131   AM_RANGE(0xF8, 0xFB) AM_DEVREADWRITE("z80ctc", z80ctc_r, z80ctc_w)
r5932r5933
4040
4141static ADDRESS_MAP_START( llc2_io, ADDRESS_SPACE_IO, 8 )
4242   ADDRESS_MAP_GLOBAL_MASK(0xff)
43   ADDRESS_MAP_UNMAP_HIGH   
43   ADDRESS_MAP_UNMAP_HIGH
4444   AM_RANGE(0xE0, 0xE3) AM_WRITE(llc2_rom_disable_w)
4545   AM_RANGE(0xE8, 0xEB) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w)
4646   AM_RANGE(0xEC, 0xEC) AM_WRITE(llc2_basic_enable_w)
r5932r5933
5959      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
6060      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
6161   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)
6767      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)
7070   PORT_START("LINE2")
7171      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_TILDE)
7272      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_TILDE)
7373      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\"")PORT_CODE(KEYCODE_TILDE)
7474      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)
7979   PORT_START("LINE3")
8080      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
8181      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
r5932r5933
156156      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
157157      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
158158      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
160160INPUT_PORTS_END
161161
162162INPUT_PORTS_START( k7659 )
r5932r5933
169169      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
170170      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
171171      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
172   PORT_START("A2")     
172   PORT_START("A2")
173173      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
174174      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)
176176      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
177177      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
178178      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
179179      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
180180      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
181   PORT_START("A3")   
181   PORT_START("A3")
182182      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
183183      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
184184      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
r5932r5933
196196      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
197197      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
198198      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
199   PORT_START("A5")   
199   PORT_START("A5")
200200      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
201201      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
202202      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
r5932r5933
223223      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC)
224224      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_TILDE)
225225      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)
232232      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
233233      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT)
234234      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT)
235235   PORT_START("A9")
236      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD)
236      PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD)
237237      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLS") PORT_CODE(KEYCODE_TILDE)
238238      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_TILDE)
239239      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F01") PORT_CODE(KEYCODE_TILDE)
r5932r5933
250250      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_TILDE)
251251      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F13") PORT_CODE(KEYCODE_TILDE)
252252      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)
256256      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP)
257257      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN)
258258      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
259259      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)
261261      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E95") PORT_CODE(KEYCODE_TILDE)
262262   PORT_START("A12")
263263      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)
267267      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)
269269      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
270270      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
271271INPUT_PORTS_END
r5932r5933
284284   MDRV_CPU_CONFIG(llc1_daisy_chain)
285285   MDRV_CPU_PROGRAM_MAP(llc1_mem)
286286   MDRV_CPU_IO_MAP(llc1_io)
287   
287
288288   MDRV_MACHINE_START( llc1 )
289289   MDRV_MACHINE_RESET( llc1 )
290290
r5932r5933
299299   MDRV_PALETTE_INIT(black_and_white)
300300
301301   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 )
305305   MDRV_Z80CTC_ADD( "z80ctc", XTAL_3MHz, llc1_ctc_intf )
306306MACHINE_DRIVER_END
307307
r5932r5933
310310   MDRV_CPU_ADD("maincpu", Z80, XTAL_3MHz)
311311   MDRV_CPU_PROGRAM_MAP(llc2_mem)
312312   MDRV_CPU_IO_MAP(llc2_io)
313   
313
314314   MDRV_MACHINE_RESET( llc2 )
315315
316316    /* video hardware */
r5932r5933
324324   MDRV_PALETTE_INIT(black_and_white)
325325
326326   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 )
330330   MDRV_Z80CTC_ADD( "z80ctc", XTAL_3MHz, llc2_ctc_intf )
331331MACHINE_DRIVER_END
332332/* ROM definition */
r5932r5933
350350   ROM_REGION(0x0800, "k7659",0)
351351   ROM_LOAD ("k7659n.bin", 0x0000, 0x0800, CRC(7454bf0a) SHA1(b97e7df93778fa371b96b6f4fb1a5b1c8b89d7ba) )
352352ROM_END
353
353
354354static SYSTEM_CONFIG_START(llc2)
355355   CONFIG_RAM_DEFAULT(64 * 1024)
356356SYSTEM_CONFIG_END
357357
358358/* Driver */
359359
360/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT       INIT     CONFIG COMPANY          FULLNAME      FLAGS */
360/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT       INIT     CONFIG COMPANY          FULLNAME       FLAGS */
361361COMP( 1984, llc1,   0,      0,      llc1,       llc1,       llc1,     0,    "",       "LLC-1",       GAME_NOT_WORKING)
362362COMP( 1984, llc2,   llc1,   0,      llc2,       k7659,       llc2,     llc2,    "",       "LLC-2",       0)
src/mess/drivers/psx.c
r5932r5933
379379         load_cpe( cpu, exe_buffer, exe_size ) ||
380380         load_psf( cpu, exe_buffer, exe_size ) )
381381      {
382/*         DEBUGGER_BREAK; */
382/*          DEBUGGER_BREAK; */
383383
384384         address = cpu_get_reg( cpu, PSXCPU_PC );
385385      }
src/mess/drivers/samcoupe.c
r5932r5933
546546      SECTORS(1-[10]-12)
547547      SECTOR_LENGTH(128/256/[512]/1024)
548548      FIRST_SECTOR_ID([1])
549   )   
549   )
550550FLOPPY_OPTIONS_END
551551
552552static const floppy_config samcoupe_floppy_config =
r5932r5933
589589   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
590590   MDRV_SOUND_ADD("saa1099", SAA1099, SAMCOUPE_XTAL_X1/3) /* 8 MHz */
591591   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
592   
592
593593   MDRV_FLOPPY_2_DRIVES_ADD(samcoupe_floppy_config)
594594MACHINE_DRIVER_END
595595
src/mess/drivers/tutor.c
r5932r5933
7878                   *** $0000-$7FFF is the 32K BIOS ***
7979 it is also possible to replace the BIOS with an external ROM (see $E000 range)
8080
810000                           
810000
8282                                reset vector (level 0)
8383                                0000-0001: WP   0002-0003: PC (%)
84840004
r5932r5933
8888                                additional vectors
89890040
9090                                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.
93930080
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)
97974000
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)
102102
103103              *** $8000-$BFFF is the 16K option ROM area ***
104104
1051058000
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.
110110
111111                         *** end ROM ***
112112C000
113            unmapped (possible use in 24K cartridges)
113                unmapped (possible use in 24K cartridges)
114114E000
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
149149F000
150150                                TMS9995 RAM (*)
151151F0FC
r5932r5933
411411   switch (offset)
412412   {
413413   case 0x20:
414      /* busy */     
414      /* busy */
415415      reply = centronics_busy_r(device) ? 0x00 : 0xff;
416416      break;
417417
r5932r5933
426426}
427427
428428static WRITE8_DEVICE_HANDLER(tutor_printer_w)
429{   
429{
430430   switch (offset)
431431   {
432432   case 0x10:
r5932r5933
521521   AM_RANGE(0xed0, 0xed0) AM_READ(tutor_cassette_r)      /*cassette interface*/
522522ADDRESS_MAP_END
523523
524/* tutor keyboard: 56 keys
524/* tutor keyboard: 56 keys
525525
5262008-05 FP:
5262008-05 FP:
527527Small note about natural keyboard support: currently,
528528- "MON" is mapped to 'F1'
529529- "MOD" is mapped to 'F2'
r5932r5933
677677   MDRV_CARTSLOT_NOT_MANDATORY
678678   MDRV_CARTSLOT_LOAD(tutor_cart)
679679   MDRV_CARTSLOT_UNLOAD(tutor_cart)
680     
680
681681   MDRV_CENTRONICS_ADD("printer", standard_centronics)
682682MACHINE_DRIVER_END
683683
src/mess/drivers/z1013.c
r5932r5933
1616static ADDRESS_MAP_START(z1013_mem, ADDRESS_SPACE_PROGRAM, 8)
1717    AM_RANGE( 0x0000, 0xefff ) AM_RAM
1818    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
2020ADDRESS_MAP_END
2121
2222static ADDRESS_MAP_START( z1013_io, ADDRESS_SPACE_IO, 8 )
r5932r5933
3131      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TAB)
3232      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
3333      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)
3535   PORT_START("LINE1")
3636      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
3737      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
r5932r5933
6363      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
6464      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
6565   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)
6767      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
6868      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
6969      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER)
7070INPUT_PORTS_END
71   
71
7272static INPUT_PORTS_START( z1013_8x8 )
7373   PORT_START("LINE0")
7474      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
7575      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
7676      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)
7878      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
7979      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
8080      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)
8282   PORT_START("LINE1")
8383      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
8484      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
r5932r5933
8787      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
8888      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
8989      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)
9191   PORT_START("LINE2")
9292      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
9393      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
r5932r5933
9696      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
9797      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
9898      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)
100100   PORT_START("LINE3")
101101      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
102102      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
103103      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)
105105      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
106106      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
107107      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)
109109   PORT_START("LINE4")
110110      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
111111      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
r5932r5933
114114      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
115115      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
116116      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)
118118   PORT_START("LINE5")
119119      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS)
120120      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE)
r5932r5933
123123      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
124124      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
125125      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)
127127   PORT_START("LINE6")
128128      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Graph") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT)
129129      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ent") PORT_CODE(KEYCODE_ENTER)
r5932r5933
133133      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
134134      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP)
135135      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN)
136   PORT_START("LINE7")                                                                   
136   PORT_START("LINE7")
137137      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
138138      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
139139      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
r5932r5933
152152   MDRV_CPU_ADD("maincpu", Z80, XTAL_1MHz )
153153   MDRV_CPU_PROGRAM_MAP(z1013_mem)
154154   MDRV_CPU_IO_MAP(z1013_io)
155   
155
156156   MDRV_MACHINE_RESET( z1013 )
157157
158158   /* video hardware */
r5932r5933
167167   MDRV_PALETTE_INIT(black_and_white)
168168
169169   MDRV_VIDEO_START(z1013)
170   MDRV_VIDEO_UPDATE(z1013)   
171   
170   MDRV_VIDEO_UPDATE(z1013)
171
172172   MDRV_Z80PIO_ADD( "z80pio", z1013_z80pio_intf )
173   
173
174174   /* snapshot */
175175   MDRV_SNAPSHOT_ADD("snapshot", z1013, "z80", 0)
176176MACHINE_DRIVER_END
r5932r5933
187187   ROM_SYSTEM_BIOS( 0, "202", "Original" )
188188   ROMX_LOAD( "mon_202.bin", 0xf000, 0x0800, CRC(5884edab) SHA1(c3a45ea5cc4da2b7c270068ba1e2d75916960709), ROM_BIOS(1))
189189   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))
191191   ROM_REGION(0x1000, "gfx1",0)
192192   ROM_LOAD ("z1013font.bin",   0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c))
193193   ROM_LOAD ("altfont.bin",     0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979))
r5932r5933
195195
196196ROM_START( z1013a2 )
197197   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))
199199   ROM_REGION(0x1000, "gfx1",0)
200200   ROM_LOAD ("z1013font.bin",   0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c))
201201   ROM_LOAD ("altfont.bin",     0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979))
r5932r5933
203203
204204ROM_START( z1013k76 )
205205   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))
207207   ROM_REGION(0x1000, "gfx1",0)
208208   ROM_LOAD ("z1013font.bin",   0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c))
209209   ROM_LOAD ("altfont.bin",     0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979))
210210   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) )
212212ROM_END
213213
214214ROM_START( z1013s60 )
215215   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
216216   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))
218218   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))
220220   ROM_REGION(0x1000, "gfx1",0)
221221   ROM_LOAD ("z1013font.bin",   0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c))
222222   ROM_LOAD ("altfont.bin",     0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979))
r5932r5933
224224
225225ROM_START( z1013k69 )
226226   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))
228228   ROM_REGION(0x1000, "gfx1",0)
229229   ROM_LOAD ("z1013font.bin",   0x0000, 0x0800, CRC(7023088f) SHA1(8b197a51c070efeba173d10be197bd41e764358c))
230230   ROM_LOAD ("altfont.bin",     0x0800, 0x0800, CRC(2dc96f9c) SHA1(d0b9b0751cc1e91be731547f6442c649b6dd6979))
231231ROM_END
232232/* Driver */
233233
234/*    YEAR  NAME   PARENT  COMPAT  MACHINE     INPUT      INIT  CONFIG COMPANY                 FULLNAME   FLAGS */
234/*    YEAR  NAME   PARENT  COMPAT  MACHINE      INPUT       INIT  CONFIG COMPANY                 FULLNAME   FLAGS */
235235COMP( 1985, z1013,     0,      0,    z1013,       z1013_8x4,    z1013, 0,  "VEB Robotron Electronics Riesa",     "Z1013 (matrix 8x4)",       0)
236236COMP( 1985, z1013a2,   z1013,  0,    z1013,       z1013_8x8,    z1013, 0,  "VEB Robotron Electronics Riesa",     "Z1013 (matrix 8x8)",       0)
237237COMP( 1985, z1013k76,  z1013,  0,    z1013k76,    k7659,       z1013, 0,  "VEB Robotron Electronics Riesa",     "Z1013 (K7659)",       GAME_NOT_WORKING)
src/mess/drivers/comx35.c
r5932r5933
11/*
22
3   TODO:
3    TODO:
44
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
1010
1111*/
1212
r5932r5933
7171   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
7272   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
7373   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('?')
7575
7676   PORT_START("D2")
7777   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('[')
r5932r5933
386386
387387   /* peripheral hardware */
388388   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 )
390390   MDRV_QUICKLOAD_ADD("quickload", comx35, "comx", 0)
391391   MDRV_CASSETTE_ADD(CASSETTE_TAG, comx35_cassette_config)
392392   MDRV_PRINTER_ADD("printer")
393   
393
394394   MDRV_FLOPPY_2_DRIVES_ADD(comx35_floppy_config)
395395MACHINE_DRIVER_END
396396
r5932r5933
411411
412412   /* peripheral hardware */
413413   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 )
415415   MDRV_QUICKLOAD_ADD("quickload", comx35, "comx", 0)
416416   MDRV_CASSETTE_ADD(CASSETTE_TAG, comx35_cassette_config)
417417   MDRV_PRINTER_ADD("printer")
418   
418
419419   MDRV_FLOPPY_2_DRIVES_ADD(comx35_floppy_config)
420420MACHINE_DRIVER_END
421421
r5932r5933
467467
468468/* System Drivers */
469469
470//    YEAR  NAME      PARENT  COMPAT   MACHINE      INPUT     INIT   CONFIG    COMPANY                  FULLNAME         FLAGS
470//    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT     INIT  CONFIG    COMPANY                       FULLNAME            FLAGS
471471COMP( 1983, comx35p,   0,      0,      comx35_pal,   comx35,   0,    comx35,   "Comx World Operations Ltd",   "COMX 35 (PAL)",   GAME_IMPERFECT_SOUND )
472472COMP( 1983, comx35n,   comx35p,0,      comx35_ntsc,comx35,   0,    comx35,   "Comx World Operations Ltd",   "COMX 35 (NTSC)",   GAME_IMPERFECT_SOUND )
src/mess/drivers/jtc.c
r5932r5933
11/***************************************************************************
2   
2
33    Jugend+Technik CompJU+TEr
44
55    15/07/2009 Skeleton driver.
r5932r5933
2020{
2121   /*
2222
23      bit      description
23        bit     description
2424
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
3333
34   */
34    */
3535
3636   jtc_state *state = space->machine->driver_data;
3737
r5932r5933
4242{
4343   /*
4444
45      bit      description
45        bit     description
4646
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
5555
56   */
56    */
5757
5858   jtc_state *state = space->machine->driver_data;
5959
6060   UINT8 data = 0;
6161
62   data |= (cassette_input(state->cassette) < 0.0) ? 1 : 0;
62   data |= (cassette_input(state->cassette) < 0.0) ? 1 : 0;
6363   data |= centronics_busy_r(state->centronics) << 3;
6464
6565   return data;
r5932r5933
6969{
7070   /*
7171
72      bit      description
72        bit     description
7373
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
8282
83   */
83    */
8484
8585   jtc_state *state = space->machine->driver_data;
8686
r5932r5933
246246
247247   PORT_START("Y5")
248248   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('?')
250250   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
251251   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
252252   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
r5932r5933
608608
609609/* Machine Initialization */
610610
611static MACHINE_START( jtc )
611static MACHINE_START( jtc )
612612{
613613   jtc_state *state = machine->driver_data;
614614
r5932r5933
636636   /* basic machine hardware */
637637    MDRV_CPU_ADD(UB8830D_TAG, UB8830D, XTAL_8MHz)
638638    MDRV_CPU_PROGRAM_MAP(jtc_mem)
639    MDRV_CPU_IO_MAP(jtc_io)   
639    MDRV_CPU_IO_MAP(jtc_io)
640640
641641    MDRV_MACHINE_START(jtc)
642   
642
643643   /* sound hardware */
644644   MDRV_SPEAKER_STANDARD_MONO("mono")
645645   MDRV_SOUND_ADD(SPEAKER_TAG, SPEAKER, 0)
r5932r5933
657657
658658static MACHINE_DRIVER_START( jtc )
659659   MDRV_IMPORT_FROM(basic)
660   
660
661661    /* video hardware */
662662    MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
663663    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
686686    /* basic machine hardware */
687687    MDRV_CPU_MODIFY(UB8830D_TAG)
688688    MDRV_CPU_PROGRAM_MAP(jtc_es23_mem)
689   
689
690690    /* video hardware */
691691    MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
692692    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
707707    /* basic machine hardware */
708708    MDRV_CPU_MODIFY(UB8830D_TAG)
709709    MDRV_CPU_PROGRAM_MAP(jtc_es40_mem)
710   
710
711711    /* video hardware */
712712    MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
713713    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
772772
773773/* System Drivers */
774774
775/*    YEAR   NAME      PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG      COMPANY               FULLNAME               FLAGS */
775/*    YEAR  NAME        PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG      COMPANY                 FULLNAME                    FLAGS */
776776COMP( 1987, jtc,      0,       0,    jtc,    jtc,     0,      jtc,         "Jugend+Technik",   "CompJU+TEr",               GAME_NOT_WORKING )
777777COMP( 1988, jtces88,   jtc,     0,    jtces88,jtc,     0,      jtces88,       "Jugend+Technik",   "CompJU+TEr (EMR-ES 1988)",   GAME_NOT_WORKING )
778778COMP( 1989, jtces23,   jtc,     0,    jtces23,jtces23, 0,      jtces23,       "Jugend+Technik",   "CompJU+TEr (ES 2.3)",      GAME_NOT_WORKING )
src/mess/drivers/trs80.c
r5932r5933
3939It is assumed that the TRS80L2 UART setup is identical to the System80, apart from the address ports used.
4040Due to the above, the only working emulated UART is for the Model 3.
4141
42Cassette 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.
42Cassette 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.
4747
4848I/O ports
4949FF:
r5932r5933
8686- UART Master Reset (write) on a Model III/4
8787
8888Model 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)
9191
9292About the Model II - this runs a boostrap rom, and boots a floppy. The rom is then bankswitched
9393out, and RAM takes its place. There is no rom basic, and no cassette support. Display sizes are
r5932r5933
9696It was extremely expensive, non-standard, and not many were sold. A rom dump does not seem to exist.
9797
9898About 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.
103103
104104About 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.
108108
109109Model 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.
118118
119119Model 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.
122122
123123***************************************************************************
124124
r5932r5933
305305+--+---+---+---+---+---+---+---+---+  +--+---+---+---+---+---+---+---+---+
306306NB: row 7 contains some originally unused bits
307307    only the shift bit was there in the TRS80
308   
3092008-05 FP:
310NB2: 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?
314NB3: the 12-keys keypad present in later models
315   is mapped to the corrispondent keys of the
316   keyboard: '0' -> '9', 'Enter', '.'
308
3092008-05 FP:
310NB2: 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?
314NB3: the 12-keys keypad present in later models
315    is mapped to the corrispondent keys of the
316    keyboard: '0' -> '9', 'Enter', '.'
317317NB4: 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.
324324
325325***************************************************************************/
326326
r5932r5933
366366   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)          PORT_CHAR('y') PORT_CHAR('Y')
367367   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)          PORT_CHAR('z') PORT_CHAR('Z')
368368   /* 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'    */
371371   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)")
372372   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)")
373373   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("(n/c)")
r5932r5933
503503   MDRV_CASSETTE_MODIFY( "cassette", trs80l2_cassette_config )
504504   MDRV_QUICKLOAD_ADD("quickload", trs80_cmd, "cmd", 0.5)
505505   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)
507507   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
508508   MDRV_AY31015_ADD( "tr1602", trs80_ay31015_config )
509509MACHINE_DRIVER_END
r5932r5933
644644
645645ROM_START(trs80m3)
646646/* ROMS we have and are missing:
647HAVE   TRS-80 Model III Level 1 ROM (U104)
648MISSING   TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC BBC4
649MISSING   TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC DA75
650HAVE   TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC 9639
651HAVE   TRS-80 Model III Level 2 (ENGLISH) ROM B (U105) ver. CRC 407C
652MISSING   TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2B91 - early mfg. #80040316
653MISSING   TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 278A - no production REV A
654HAVE   TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2EF8 - Manufacturing #80040316 REV B
655HAVE   TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2F84 - Manufacturing #80040316 REV C
656MISSING   TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 2764 - Network III v1
657HAVE   TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 276A - Network III v2
658MISSING   TRS-80 Model III Level 2 (BELGIUM) CRC ????
647HAVE    TRS-80 Model III Level 1 ROM (U104)
648MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC BBC4
649MISSING TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC DA75
650HAVE    TRS-80 Model III Level 2 (ENGLISH) ROM A (U104) ver. CRC 9639
651HAVE    TRS-80 Model III Level 2 (ENGLISH) ROM B (U105) ver. CRC 407C
652MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2B91 - early mfg. #80040316
653MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 278A - no production REV A
654HAVE    TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2EF8 - Manufacturing #80040316 REV B
655HAVE    TRS-80 Model III Level 2 (ENGLISH) ROM C (U106) ver. CRC 2F84 - Manufacturing #80040316 REV C
656MISSING TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 2764 - Network III v1
657HAVE    TRS-80 Model III Level 2 (ENGLISH) ROM C ver. CRC 276A - Network III v2
658MISSING TRS-80 Model III Level 2 (BELGIUM) CRC ????
659659Note: Be careful when dumping rom C: if dumped on the trs-80 m3 with software, bytes 0x7e8 and 0x7e9 (addresses 0x37e8, 0x0x37e9)
660660      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.
661661*/
r5932r5933
761761   videoram = memory_region(machine, "gfx2")+0x4000;
762762}
763763
764/*    YEAR  NAME      PARENT  COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
764/*    YEAR  NAME      PARENT  COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
765765COMP( 1977, trs80,    0,   0,   trs80,    trs80,   trs80,    0,      "Tandy Radio Shack",  "TRS-80 Model I (Level I Basic)" , 0 )
766766COMP( 1978, trs80l2,  trs80,   0,   model1,   trs80,   trs80l2,  0,   "Tandy Radio Shack",  "TRS-80 Model I (Level II Basic)" , 0 )
767767COMP( 1983, radionic, trs80,   0,   radionic, trs80,   trs80,    0,   "Komtek",  "Radionic" , 0 )
src/mess/drivers/atm.c
r5932r5933
1313static const device_config* beta;
1414
1515static DIRECT_UPDATE_HANDLER( atm_direct )
16{   
16{
1717   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))
2020   {
21      if (pc >= 0x4000)
21      if (pc >= 0x4000)
2222      {
2323         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0;
2424         betadisk_disable(beta);
2525         memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
2626         memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14));
27      }   
27      }
2828   } else if (((pc & 0xff00) == 0x3d00) && (ROMSelection==1))
2929   {
3030      ROMSelection = 3;
31      if (beta->started)
31      if (beta->started)
3232         betadisk_enable(beta);
33     
34   }
35   if((address>=0x0000) && (address<=0x3fff))
36   {   
33
34   }
35   if((address>=0x0000) && (address<=0x3fff))
36   {
3737      memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
38      if (ROMSelection == 3) {         
38      if (ROMSelection == 3) {
3939         direct->raw = direct->decrypted =  memory_region(space->machine, "maincpu") + 0x018000 ;
4040      } else {
4141         direct->raw = direct->decrypted =  memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14);
r5932r5933
4747}
4848
4949static void atm_update_memory(running_machine *machine)
50{   
50{
5151   spectrum_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14));
5252
5353   memory_set_bankptr(machine, 4, mess_ram + ((spectrum_128_port_7ffd_data & 0x07) * 0x4000));
5454
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   {
5757      ROMSelection = 3;
5858   }
59   else {   
59   else {
6060      /* ROM switching */
6161      ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ;
6262   }
r5932r5933
7777   atm_update_memory(space->machine);
7878}
7979
80static ADDRESS_MAP_START (atm_io, ADDRESS_SPACE_IO, 8)   
80static ADDRESS_MAP_START (atm_io, ADDRESS_SPACE_IO, 8)
8181   ADDRESS_MAP_UNMAP_HIGH
8282   AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_status_r,betadisk_command_w) AM_MIRROR(0xff00)
8383   AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_track_r,betadisk_track_w) AM_MIRROR(0xff00)
8484   AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_sector_r,betadisk_sector_w) AM_MIRROR(0xff00)
8585   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)
8787   AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_state_r, betadisk_param_w) AM_MIRROR(0xff00)
8888   AM_RANGE(0x4000, 0x4000) AM_WRITE(atm_port_7ffd_w)  AM_MIRROR(0x3ffd)
8989   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd)
r5932r5933
9494{
9595   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
9696   beta = devtag_get_device(machine, BETA_DISK_TAG);
97   
97
9898   memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
9999   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
100100
r5932r5933
103103      betadisk_clear_status(beta);
104104   }
105105
106   memory_set_direct_update_handler( space, atm_direct );
107   
106   memory_set_direct_update_handler( space, atm_direct );
107
108108   memset(mess_ram,0,128*1024);
109   
109
110110   /* Bank 5 is always in 0x4000 - 0x7fff */
111111   memory_set_bankptr(machine, 2, mess_ram + (5<<14));
112112
r5932r5933
115115
116116   spectrum_128_port_7ffd_data = 0;
117117
118   atm_update_memory(machine);   
118   atm_update_memory(machine);
119119}
120120
121121static MACHINE_DRIVER_START( atm )
r5932r5933
123123   MDRV_CPU_MODIFY("maincpu")
124124   MDRV_CPU_IO_MAP(atm_io)
125125   MDRV_MACHINE_RESET( atm )
126   
126
127127   MDRV_BETA_DISK_ADD(BETA_DISK_TAG)
128128MACHINE_DRIVER_END
129129
r5932r5933
151151
152152     ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
153153ROM_END
154   
154
155155ROM_START(atm2)
156156   ROM_REGION(0x020000, "maincpu", ROMREGION_ERASEFF)
157157   ROM_SYSTEM_BIOS(0, "v1", "v.1.07.12 joined")
r5932r5933
163163   ROMX_LOAD( "atmtb2-4.rom", 0x01c000, 0x4000, CRC(5869d8c4) SHA1(c3e198138f528ac4a8dff3c76cd289fd4713abff), ROM_BIOS(2))
164164   ROM_SYSTEM_BIOS(2, "v3", "v.1.07.13")
165165   ROMX_LOAD( "atmtb213.rom", 0x010000, 0x10000, CRC(34a91d53) SHA1(8f0af0f3c0ff1644535f20545c73d01576d6e52f), ROM_BIOS(3))
166     
166
167167   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)
169169   // XT Keyboard
170170   ROM_LOAD( "rf2ve3.rom",  0x0000, 0x0580, CRC(35e0f9ec) SHA1(adcf14758fab8472cfa0167af7e8326c66416416))
171171   // AT Keyboard
172172   ROM_LOAD( "rfat710.rom", 0x0600, 0x0680, CRC(03734365) SHA1(6cb6311727fad9bc4ccb18919c3c39b37529b8e6))
173173   ROM_REGION(0x08000, "charrom", ROMREGION_ERASEFF)
174174   // 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))
176176ROM_END
177177
178178static SYSTEM_CONFIG_START(atm)
src/mess/drivers/odyssey2.c
r5932r5933
202202   MDRV_SOUND_CONFIG(the_voice_sp0256)
203203   /* The Voice uses a speaker with its own volume control so the relative volumes to use are subjective, these sound good */
204204   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
205   
205
206206   MDRV_IMPORT_FROM(odyssey2_cartslot)
207207MACHINE_DRIVER_END
208208
r5932r5933
235235   MDRV_SOUND_ADD("sp0256_speech", SP0256, 3120000)
236236   MDRV_SOUND_CONFIG(the_voice_sp0256)
237237   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
238   
238
239239   MDRV_IMPORT_FROM(odyssey2_cartslot)
240240MACHINE_DRIVER_END
241241
r5932r5933
258258   MDRV_PALETTE_INIT( odyssey2 )
259259
260260   MDRV_VIDEO_START( odyssey2 )
261//   MDRV_VIDEO_UPDATE( odyssey2 )
261//  MDRV_VIDEO_UPDATE( odyssey2 )
262262
263263   /* sound hardware */
264264   MDRV_SPEAKER_STANDARD_MONO("mono")
265265   MDRV_SOUND_ADD("custom", ODYSSEY2, 3547000)
266266   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
267   
267
268268   MDRV_IMPORT_FROM(odyssey2_cartslot)
269269MACHINE_DRIVER_END
270270
r5932r5933
281281   ROM_LOAD( "sp0256b-019.bin",   0x1000, 0x0800, CRC(19355075) SHA1(13bc08f08d161c30ff386d1f0d15676d82afde63) )
282282
283283   /* 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    */
291291   /* External 16KiB speech ROM (spr128-003) from "The Voice" */
292292   ROM_LOAD( "spr128-003.bin",   0x4000, 0x4000, CRC(66041b03) SHA1(31acbaf1ae92b3efbb5093d63b0472170699da85) )
293293   /* Additional External 16KiB ROM (spr128-004) from S.I.D. the Spellbinder */
src/mess/drivers/tiki100.c
r5932r5933
44
55    12/05/2009 Skeleton driver.
66
7   http://www.djupdal.org/tiki/
7    http://www.djupdal.org/tiki/
88
99****************************************************************************/
1010
1111/*
1212
13   TODO:
13    TODO:
1414
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
2323
2424*/
2525
r5932r5933
129129static WRITE8_HANDLER( keyboard_w )
130130{
131131   tiki100_state *state = space->machine->driver_data;
132   
132
133133   state->keylatch = 0;
134134}
135135
r5932r5933
137137{
138138   /*
139139
140      bit      description
140        bit     description
141141
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
150150
151   */
151    */
152152
153153   tiki100_state *state = space->machine->driver_data;
154   
154
155155   state->mode = data;
156156
157157   if (BIT(data, 7))
r5932r5933
167167{
168168   /*
169169
170      bit      description
170        bit     description
171171
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
180180
181   */
181    */
182182
183183   tiki100_state *state = space->machine->driver_data;
184   
184
185185   state->palette = data;
186186}
187187
r5932r5933
189189{
190190   /*
191191
192      bit      signal   description
192        bit     signal  description
193193
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
202202
203   */
203    */
204204
205205   tiki100_state *state = space->machine->driver_data;
206206
r5932r5933
252252   AM_RANGE(0x17, 0x17) AM_DEVREADWRITE(AY8912_TAG, ay8910_r, ay8910_data_w)
253253   AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w)
254254   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
261261ADDRESS_MAP_END
262262
263263/* Input Ports */
264264
265265static INPUT_PORTS_START( tiki100 )
266266/*
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    ----+---------+---------+---------+---------+---------+---------+---------+---------+
282282*/
283283   PORT_START("ROW1")
284284   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
r5932r5933
388388   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD)
389389   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD)
390390   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 )
392392
393393   PORT_START("ROW12")
394394   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HJEM") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
r5932r5933
396396   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD)
397397   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD)
398398   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 )
402402INPUT_PORTS_END
403403
404404/* Video */
r5932r5933
552552/* FD1797 Interface */
553553
554554static const wd17xx_interface tiki100_wd17xx_interface =
555{
555{
556556   NULL,
557557   NULL,
558558   {FLOPPY_0,FLOPPY_1,NULL,NULL}
r5932r5933
676676    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
677677    MDRV_SCREEN_SIZE(1024, 256)
678678    MDRV_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 256-1)
679   
679
680680   MDRV_PALETTE_LENGTH(16)
681681
682682    MDRV_VIDEO_UPDATE(tiki100)
r5932r5933
687687   MDRV_Z80CTC_ADD(Z80CTC_TAG, 2000000, ctc_intf)
688688   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(2000000))
689689   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)
691691   /* sound hardware */
692692   MDRV_SPEAKER_STANDARD_MONO("mono")
693693   MDRV_SOUND_ADD(AY8912_TAG, AY8912, 2000000)
r5932r5933
719719
720720/* System Drivers */
721721
722/*    YEAR   NAME      PARENT      COMPAT   MACHINE      INPUT      INIT   CONFIG      COMPANY            FULLNAME      FLAGS */
722/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY             FULLNAME        FLAGS */
723723COMP( 1984, kontiki,   0,         0,      tiki100,   tiki100,   0,      tiki100,   "Kontiki Data A/S",   "KONTIKI 100",   GAME_SUPPORTS_SAVE )
724724COMP( 1984, tiki100,   kontiki,   0,      tiki100,   tiki100,   0,      tiki100,   "Tiki Data A/S",   "TIKI 100",      GAME_SUPPORTS_SAVE )
src/mess/drivers/primo.c
r5932r5933
2626    A-48 - 32kB RAM + 16KB ROM
2727    A-64 - 48kB RAM + 16KB ROM
2828    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
3131
3232CPU:
3333    U880D (DDR clone of Z80), 2.5 MHz
r5932r5933
282282
283283   /* floppy from serial bus */
284284   /* for some reason machine/primo.c sets up the serial bus
285   but no floppy drive has been apparently added... incomplete driver? */
285    but no floppy drive has been apparently added... incomplete driver? */
286286   MDRV_IMPORT_FROM(simulated_drive)
287287
288288   /* cartridge */
r5932r5933
406406
407407/*static void primo_cartslot_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
408408{
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;
415415
416      default:                              cartslot_device_getinfo(devclass, state, info); break;
417   }
416        default:                                        cartslot_device_getinfo(devclass, state, info); break;
417    }
418418}
419419
420420*/
src/mess/drivers/pockstat.c
r5932r5933
55    05/2009 Skeleton driver.
66
77
8    This should be emulated alongside PS1 (and especially its memory cards,
8    This should be emulated alongside PS1 (and especially its memory cards,
99    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
1212    system and its BIOS.
1313
1414    CPU: ARM7T (32 bit RISC Processor)
r5932r5933
1616    Graphics: 32 x 32 dot monochrome LCD
1717    Sound: Miniature speaker (12 bit PCM) x 1 unit
1818    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
2020        conventional remote control systems)
2121    Other: 1 LED indicator
2222
r5932r5933
3030#include "cpu/arm7/arm7.h"
3131
3232static 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   */
5858ADDRESS_MAP_END
5959
6060/* Input ports */
src/mess/drivers/ti85.c
r5932r5933
162162    7: Memory page 2
163163    10: Controll port for the display controller
164164    11: Data port for the display controller
165   
165
166166TI-85 ports:
167167    0: Video buffer offset (write only)
168168    1: Keypad
r5932r5933
477477
478478static INPUT_PORTS_START (ti83)
479479   PORT_INCLUDE( ti82 )
480   
480
481481   PORT_START("BATTERY")
482482      PORT_DIPNAME( 0x01, 0x01, "Battery Status" )
483483      PORT_DIPSETTING( 0x01, DEF_STR( Normal ) )
r5932r5933
571571   MDRV_CPU_MODIFY("maincpu")
572572   MDRV_CPU_PROGRAM_MAP(ti86_mem)
573573   MDRV_CPU_IO_MAP(ti83p_io)
574   
574
575575   MDRV_MACHINE_START( ti83p )
576576   MDRV_VIDEO_UPDATE( ti82 )
577577
r5932r5933
611611   ROMX_LOAD( "ti82v18.bin", 0x10000, 0x20000, CRC(6a320f03) SHA1(9ee15ebf0a1f8bde5bef982b5db4ce120c605d29), ROM_BIOS(3) )
612612   ROM_SYSTEM_BIOS( 3, "v19", "V 19.0" )
613613   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
615615ROM_END
616616
617617ROM_START (ti83)
r5932r5933
644644   ROM_SYSTEM_BIOS( 1, "v103m", "V 1.03 [m]" )
645645    ROMX_LOAD( "ti83pv103m.bin", 0x10000, 0x80000, CRC(281c9375) SHA1(80d698fed42976015a3e53fd59ebe7f49699b27e), ROM_BIOS(2))
646646    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))
648648   ROM_SYSTEM_BIOS( 3, "v110", "V 1.10" )
649649   ROMX_LOAD( "ti83pv110.bin", 0x10000, 0x80000, CRC(62683990) SHA1(F86CDEFE4ED5EF9965CD9EB667CB859E2CB10E19), ROM_BIOS(4) )
650650   ROM_SYSTEM_BIOS( 4, "v112", "V 1.12" )
r5932r5933
696696   ROMX_LOAD( "ti86v15.bin", 0x10000, 0x40000, BAD_DUMP CRC(e6e10546) SHA1(5ca63fdfc965ae3fb8e0695263cf9da41f6ecb90), ROM_BIOS(4) )
697697   ROM_SYSTEM_BIOS( 4, "v16", "V 1.6" )
698698   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
700700ROM_END
701701
702702
r5932r5933
713713   ROM_SYSTEM_BIOS( 0, "v241", "V 2.41" )
714714   ROMX_LOAD( "ti84sev241.bin", 0x10000, 0x200000, CRC(5758db36) SHA1(7daa4f22e9b5dc8a1cc8fd31bceece9fa8b43515), ROM_BIOS(1) )
715715ROM_END
716 
716
717717static void ti85_serial_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
718718{
719719   /* serial */
src/mess/drivers/svi318.c
r5932r5933
325325   MDRV_CASSETTE_ADD( "cassette", svi318_cassette_config )
326326
327327   MDRV_WD179X_ADD("wd179x", svi_wd17xx_interface )
328   
328
329329   MDRV_FLOPPY_2_DRIVES_ADD(svi318_floppy_config)
330330
331331   MDRV_IMPORT_FROM( svi318_cartslot )
r5932r5933
410410   MDRV_WD179X_ADD("wd179x", svi_wd17xx_interface )
411411
412412   MDRV_FLOPPY_2_DRIVES_ADD(svi318_floppy_config)
413   
413
414414   MDRV_IMPORT_FROM( svi318_cartslot )
415415MACHINE_DRIVER_END
416416
src/mess/drivers/vcs80.c
r5932r5933
44
55    12/05/2009 Skeleton driver.
66
7   http://hc-ddr.hucki.net/entwicklungssysteme.htm#VCS_80_von_Eckhard_Schiller
7    http://hc-ddr.hucki.net/entwicklungssysteme.htm#VCS_80_von_Eckhard_Schiller
88
99****************************************************************************/
1010
r5932r5933
9292static TIMER_DEVICE_CALLBACK( vcs80_keyboard_tick )
9393{
9494   /*
95     
96      bit      description
9795
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
10697
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
108106
107    */
108
109109   vcs80_state *state = timer->machine->driver_data;
110110
111111   UINT8 data = 0;
r5932r5933
130130static WRITE8_DEVICE_HANDLER( pio_port_b_w )
131131{
132132   /*
133     
134      bit      description
135133
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
144135
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
146144
145    */
146
147147   vcs80_state *state = device->machine->driver_data;
148148
149149   UINT8 led_data = BITSWAP8(data & 0x7f, 7, 5, 6, 4, 3, 2, 1, 0);
r5932r5933
244244
245245/* System Drivers */
246246
247/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY            FULLNAME   FLAGS */
247/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY             FULLNAME    FLAGS */
248248COMP( 1983, vcs80,  0,      0,      vcs80,   vcs80,   vcs80,   vcs80,   "Eckhard Schiller",   "VCS-80",   GAME_SUPPORTS_SAVE )
src/mess/drivers/interact.c
r5932r5933
33        Interact Family Computer
44
55        12/05/2009 Skeleton driver - Micko
6   31/05/2009 Added notes and video - Robbbert
6    31/05/2009 Added notes and video - Robbbert
77
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.
1919
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
2626
2727****************************************************************************/
2828
r5932r5933
9797   /* basic machine hardware */
9898   MDRV_CPU_ADD("maincpu",8080, XTAL_2MHz)
9999   MDRV_CPU_PROGRAM_MAP(interact_mem)
100//   MDRV_CPU_VBLANK_INT("maincpu", interact_interrupt)
100//  MDRV_CPU_VBLANK_INT("maincpu", interact_interrupt)
101101
102102   MDRV_MACHINE_RESET(interact)
103103
r5932r5933
129129
130130/* Driver */
131131
132/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG      COMPANY   FULLNAME       FLAGS */
132/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG      COMPANY   FULLNAME       FLAGS */
133133COMP(1979, interact, 0,        0,       interact, interact, 0,   0,      "Interact",   "Interact Family Computer", GAME_NOT_WORKING)
134134COMP(????, hector1,  interact, 0,    interact, interact, 0,  0,      "Micronique", "Hector 1",   GAME_NOT_WORKING)
135135
src/mess/drivers/nanos.c
r5932r5933
11/***************************************************************************
2   
2
33        Nanos
44
55        12/05/2009 Skeleton driver.
r5932r5933
109109};
110110static ADDRESS_MAP_START( nanos_io , ADDRESS_SPACE_IO, 8)
111111   ADDRESS_MAP_UNMAP_HIGH
112   ADDRESS_MAP_GLOBAL_MASK(0xff)   
112   ADDRESS_MAP_GLOBAL_MASK(0xff)
113113   /* CPU card */
114114   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("z80pio", z80pio_r, z80pio_w)
115   
115
116116   /* I/O card */
117117   AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("z80pio_0", z80pio_r, z80pio_w)
118118   AM_RANGE(0x84, 0x84) AM_DEVREADWRITE("z80sio_0", z80sio_d_r, z80sio_d_w)
r5932r5933
121121   AM_RANGE(0x87, 0x87) AM_DEVREADWRITE("z80sio_0", z80sio_c_r, z80sio_c_w)
122122   AM_RANGE(0x88, 0x8B) AM_DEVREADWRITE("z80pio_1", z80pio_r, z80pio_w)
123123   AM_RANGE(0x8C, 0x8F) AM_DEVREADWRITE("z80ctc_0", z80ctc_r, z80ctc_w)
124   
124
125125   /* FDC card */
126126   AM_RANGE(0x92, 0x92) AM_WRITE(nanos_tc_w)
127127   AM_RANGE(0x94, 0x94) AM_DEVREAD("nec765", nec765_status_r)
r5932r5933
132132   AM_RANGE(0xA2, 0xA2) AM_DEVREADWRITE("z80sio_1", z80sio_d_r, z80sio_d_w)
133133   AM_RANGE(0xA3, 0xA3) AM_DEVREADWRITE("z80sio_1", z80sio_c_r, z80sio_c_w)
134134   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 */
137137   //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 */
140140   //AM_RANGE(0xC8, 0xCF)
141141ADDRESS_MAP_END
142142
143143/* Input ports */
144144static INPUT_PORTS_START( nanos )
145   PORT_START("LINEC")   
145   PORT_START("LINEC")
146146   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
147147   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
148148   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
r5932r5933
165165   PORT_START("LINE1")
166166   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
167167   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)
172172   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)
174174
175175   PORT_START("LINE2")
176176   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_END)
r5932r5933
191191   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
192192   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
193193   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
194                                                 
194
195195   PORT_START("LINE4")
196196   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
197197   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
r5932r5933
201201   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
202202   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
203203   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
204                       
204
205205   PORT_START("LINE5")
206206   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
207207   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
208208   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)
210210   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH)
211211   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]")  PORT_CODE(KEYCODE_CLOSEBRACE)
212212   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~")  PORT_CODE(KEYCODE_TILDE)
213213   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL")PORT_CODE(KEYCODE_BACKSPACE)
214   
214
215215   PORT_START("LINE6")
216216   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT)
217217   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT)
218218   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP)
219219   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN)
220220   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)
224224INPUT_PORTS_END
225225
226226
r5932r5933
231231
232232static VIDEO_UPDATE( nanos )
233233{
234//   static UINT8 framecnt=0;
234//  static UINT8 framecnt=0;
235235   UINT8 y,ra,chr,gfx;
236236   UINT16 sy=0,ma=0,x;
237237
238//   framecnt++;
238//  framecnt++;
239239
240240   for (y = 0; y < 25; y++)
241241   {
r5932r5933
275275UINT8 last_code = 0;
276276UINT8 key_pressed = 0xff;
277277static READ8_DEVICE_HANDLER (nanos_port_a_r)
278{   
278{
279279   UINT8 retVal;
280280   if (key_command==0)  {
281281      return key_pressed;
r5932r5933
294294
295295static WRITE8_DEVICE_HANDLER (nanos_port_b_w)
296296{
297   key_command = BIT(data,1);
297   key_command = BIT(data,1);
298298   if (BIT(data,7)) {
299299      memory_set_bankptr(device->machine, 1, memory_region(device->machine, "maincpu"));
300300   } else {
r5932r5933
309309   if BIT(code,4) return 4;
310310   if BIT(code,5) return 5;
311311   if BIT(code,6) return 6;
312   if BIT(code,7) return 7;   
312   if BIT(code,7) return 7;
313313   return 0;
314314}
315315
316316static TIMER_CALLBACK(keyboard_callback)
317317{
318318   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6" };
319   
319
320320   int i;
321321   UINT8 code;
322322   UINT8 key_code = 0;
323323   UINT8 shift = input_port_read(machine, "LINEC") & 0x02 ? 1 : 0;
324324   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++)
327327   {
328     
328
329329      code =    input_port_read(machine, keynames[i]);
330      if (code != 0)
330      if (code != 0)
331331      {
332332         if (i==0 && shift==0) {
333333            key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs
r5932r5933
376376            key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl
377377         }
378378         if (i==6) {
379            switch(row_number(code))
379            switch(row_number(code))
380380            {
381381               case 0: key_code = 0x11; break;
382382               case 1: key_code = 0x12; break;
r5932r5933
390390         }
391391         last_code = key_code;
392392      }
393   }   
394   if (key_code==0){     
395      key_pressed = 0xf7;           
396393   }
394   if (key_code==0){
395      key_pressed = 0xf7;
396   }
397397}
398398
399static MACHINE_RESET(nanos)
400{   
399static MACHINE_RESET(nanos)
400{
401401   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
406406   memory_set_bankptr(machine, 1, memory_region(machine, "maincpu"));
407407   memory_set_bankptr(machine, 2, mess_ram + 0x1000);
408408   memory_set_bankptr(machine, 3, mess_ram);
409   
409
410410   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1);
411   
411
412412   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1);
413413   timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback);
414414}
r5932r5933
454454    /* basic machine hardware */
455455    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
456456    MDRV_CPU_PROGRAM_MAP(nanos_mem)
457    MDRV_CPU_IO_MAP(nanos_io)   
457    MDRV_CPU_IO_MAP(nanos_io)
458458    MDRV_CPU_CONFIG(nanos_daisy_chain)
459459
460460
461461    MDRV_MACHINE_RESET(nanos)
462   
462
463463    /* video hardware */
464464    MDRV_SCREEN_ADD("screen", RASTER)
465465    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
472472
473473    MDRV_VIDEO_START(nanos)
474474    MDRV_VIDEO_UPDATE(nanos)
475   
475
476476    /* devices */
477477   MDRV_Z80CTC_ADD( "z80ctc_0", XTAL_4MHz, ctc_intf)
478478   MDRV_Z80CTC_ADD( "z80ctc_1", XTAL_4MHz, ctc_intf)
r5932r5933
482482   MDRV_Z80SIO_ADD( "z80sio_1", XTAL_4MHz, sio_intf)
483483   MDRV_Z80PIO_ADD( "z80pio", nanos_z80pio_intf )
484484   /* NEC765 */
485   MDRV_NEC765A_ADD("nec765", nanos_nec765_interface)   
486   
485   MDRV_NEC765A_ADD("nec765", nanos_nec765_interface)
486
487487   MDRV_FLOPPY_4_DRIVES_ADD(nanos_floppy_config)
488488MACHINE_DRIVER_END
489489
src/mess/drivers/gp2x.c
r5932r5933
3838   "",
3939   "",
4040   "",
41   "Active width",   
41   "Active width",
4242   "Active height",
4343   "HSYNC width",
4444   "HSYNC start",
r5932r5933
108108   "V End region A top",
109109   "V End region A bottom",
110110   "YUV Source region A L",   // a0
111   "YUV Source region A H",   
111   "YUV Source region A H",
112112};
113113#endif
114114static VIDEO_UPDATE( gp2x )
r5932r5933
122122         int x, y;
123123         UINT16 *vram = (UINT16 *)&gp2x_ram[0x2100000/4];
124124
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)]);*/
131131
132132
133133         for (y = 0; y < 240; y++)
r5932r5933
157157   if (mem_mask == 0xffff)
158158   {
159159      gp2x_vidregs[offset*2] = data;
160//      printf("%x to video reg %x (%s)\n", data, offset*2, gp2x_regnames[offset*2]);
160//      printf("%x to video reg %x (%s)\n", data, offset*2, gp2x_regnames[offset*2]);
161161   }
162162   else if (mem_mask == 0xffff0000)
163163   {
164164      gp2x_vidregs[(offset*2)+1] = data>>16;
165//      printf("%x to video reg %x (%s)\n", data>>16, (offset*2)+1, gp2x_regnames[(offset*2)+1]);
165//      printf("%x to video reg %x (%s)\n", data>>16, (offset*2)+1, gp2x_regnames[(offset*2)+1]);
166166   }
167167   else
168168   {
r5932r5933
213213
214214         case 0x90:   // read ID
215215            switch (nand_stage++)
216            {   
216            {
217217               case 0:
218218                  return 0xec;   // Samsung
219219               case 1:
r5932r5933
227227      }
228228   }
229229
230//   printf("Read unknown nand offset %x\n", offset);
230//  printf("Read unknown nand offset %x\n", offset);
231231
232232   return 0;
233233}
r5932r5933
238238   {
239239      case 4:   // command
240240         nand_cmd = data;
241//         printf("NAND: command %x (PC %x0)\n", data, cpu_get_pc(space->cpu));
241//          printf("NAND: command %x (PC %x0)\n", data, cpu_get_pc(space->cpu));
242242         nand_stage = 0;
243243         nand_subword_stage = 0;
244244         break;
r5932r5933
264264                  nand_ptr_temp &= ~0xff000000;
265265                  nand_ptr_temp |= data<<24;
266266
267//                  printf("NAND: ptr now %x, /2 %x, replacing %x\n", nand_ptr_temp, nand_ptr_temp/2, nand_ptr);
267//                      printf("NAND: ptr now %x, /2 %x, replacing %x\n", nand_ptr_temp, nand_ptr_temp/2, nand_ptr);
268268                  nand_ptr = nand_ptr_temp/2;
269269                  break;
270270            }
r5932r5933
301301
302302static WRITE32_HANDLER(nand_ctrl_w)
303303{
304//   printf("%08x to nand_ctrl_w\n", data);
304//  printf("%08x to nand_ctrl_w\n", data);
305305}
306306
307307static READ32_HANDLER(sdcard_r)
src/mess/drivers/z9001.c
r5932r5933
11/***************************************************************************
2   
2
33        Robotron Z9001 (KC85/1)
44
55        12/05/2009 Skeleton driver.
r5932r5933
1212static UINT8 *z9001_video_ram;
1313
1414static 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)
1818   AM_RANGE( 0xf000, 0xffff ) AM_ROM
1919ADDRESS_MAP_END
2020
r5932r5933
2727INPUT_PORTS_END
2828
2929
30static MACHINE_RESET(z9001)
31{   
30static MACHINE_RESET(z9001)
31{
3232   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, 0xf000);
3333}
3434
r5932r5933
4141   UINT8 code;
4242    UINT8 line;
4343   int y, x, j, b;
44   
44
4545   UINT8 *gfx = memory_region(screen->machine, "gfx1");
46   
46
4747   for (y = 0; y < 24; y++)
4848   {
4949      for (x = 0; x < 40; x++)
r5932r5933
5353         {
5454            line = gfx[code*8 + j];
5555            for (b = 0; b < 8; b++)
56            {               
56            {
5757               *BITMAP_ADDR16(bitmap, y*8+j, x * 8 + (7 - b)) =  ((line >> b) & 0x01);
5858            }
5959         }
r5932r5933
6666    /* basic machine hardware */
6767    MDRV_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz)
6868    MDRV_CPU_PROGRAM_MAP(z9001_mem)
69    MDRV_CPU_IO_MAP(z9001_io)   
69    MDRV_CPU_IO_MAP(z9001_io)
7070
7171    MDRV_MACHINE_RESET(z9001)
72   
72
7373    /* video hardware */
7474    MDRV_SCREEN_ADD("screen", RASTER)
7575    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
9494   ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" )
9595   ROMX_LOAD( "os_rb21.rom",  0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3))
9696   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))
9898   ROM_LOAD( "zg_cga.rom",  0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff))
9999   ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621))
100100   ROM_LOAD( "zg_de.rom",   0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34))
r5932r5933
110110   ROMX_LOAD( "os_rb20.rom",  0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2))
111111   ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" )
112112   ROMX_LOAD( "os_rb21.rom",  0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3))
113   
113
114114    ROM_LOAD( "basic_c0.87a", 0xc000, 0x2800, CRC(c508d45e) SHA1(ea85b53e21429c4cb85cdb81b92f278a8f4eb574))
115115
116116   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))
118118   ROM_LOAD( "zg_cga.rom",  0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff))
119119   ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621))
120120   ROM_LOAD( "zg_de.rom",   0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34))
r5932r5933
130130   ROMX_LOAD( "os_rb20.rom",  0xf000, 0x1000, CRC(c783124d) SHA1(c2893ce5bb23b280ba4e982e860586d21de2469b), ROM_BIOS(2))
131131   ROM_SYSTEM_BIOS( 2, "rb21", "ROM-Bank System with menu" )
132132   ROMX_LOAD( "os_rb21.rom",  0xf000, 0x1000, CRC(11eec2dd) SHA1(5dbb661bdf4daf92d6c4ffbbdec674e57917e9eb), ROM_BIOS(3))
133   
133
134134    ROM_LOAD( "basic_c0.87b", 0xc000, 0x2800, CRC(9e8f6380) SHA1(8ffecc64ba35c953c93738f8568c83dc6af1ae72))
135135
136136   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))
138138   ROM_LOAD( "zg_cga.rom",  0x0800, 0x0800, CRC(697cefb1) SHA1(f57a78a928fe1151b2fedb7f1a93a141195422ff))
139139   ROM_LOAD( "zg_cgai.rom", 0x1000, 0x0800, CRC(ecadf355) SHA1(4d36fefd335903680c45a5e3f38b969d2e9bb621))
140140   ROM_LOAD( "zg_de.rom",   0x1800, 0x0800, CRC(71854b0a) SHA1(912bb7d1f8b4582894125e82da080bd9c3b88f34))
141141ROM_END
142 
142
143143#define rom_kc87_21 rom_kc87_20
144 
144
145145/* Driver */
146146
147147/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY   FULLNAME       FLAGS */
148148COMP( 198?, z9001,   0,       0,    z9001,    z9001,     0,       0,      "Robotron",   "Z9001 (KC 85/1.10)",   GAME_NOT_WORKING)
149COMP( 198?, kc85_111,z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 85/1.11",         GAME_NOT_WORKING)
150COMP( 198?, kc87_10, z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 87.10",            GAME_NOT_WORKING)
151COMP( 198?, kc87_11, z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 87.11",            GAME_NOT_WORKING)
152COMP( 198?, kc87_20, z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 87.20",            GAME_NOT_WORKING)
153COMP( 198?, kc87_21, z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 87.21",            GAME_NOT_WORKING)
149COMP( 198?, kc85_111,z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 85/1.11",         GAME_NOT_WORKING)
150COMP( 198?, kc87_10, z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 87.10",            GAME_NOT_WORKING)
151COMP( 198?, kc87_11, z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 87.11",            GAME_NOT_WORKING)
152COMP( 198?, kc87_20, z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 87.20",            GAME_NOT_WORKING)
153COMP( 198?, kc87_21, z9001,   0,    z9001,    z9001,     0,       0,      "Robotron",   "KC 87.21",            GAME_NOT_WORKING)
src/mess/drivers/galaxy.c
r5932r5933
4141static ADDRESS_MAP_START (galaxy_mem, ADDRESS_SPACE_PROGRAM, 8)
4242   AM_RANGE(0x0000, 0x0fff) AM_ROM
4343   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 )
4545ADDRESS_MAP_END
4646
4747static ADDRESS_MAP_START (galaxyp_mem, ADDRESS_SPACE_PROGRAM, 8)
4848   AM_RANGE(0x0000, 0x0fff) AM_ROM // ROM A
4949   AM_RANGE(0x1000, 0x1fff) AM_ROM // ROM B
5050   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 )
5252   AM_RANGE(0xe000, 0xefff) AM_ROM // ROM C
5353   AM_RANGE(0xf000, 0xffff) AM_ROM // ROM D
5454ADDRESS_MAP_END
r5932r5933
211211
212212   MDRV_VIDEO_START( generic_bitmapped )
213213   MDRV_VIDEO_UPDATE( galaxy )
214   
214
215215   /* snapshot */
216216   MDRV_SNAPSHOT_ADD("snapshot", galaxy, "gal", 0)
217217
src/mess/drivers/amico2k.c
r5932r5933
88    IC10 - Recorder PROM, yet to be found
99    IC6/IC7 - PROMs reconstructed by Luigi Serrantoni
1010
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
1313       at the link below) and i8255
1414
1515    http://www.computerhistory.it/index.php?option=com_content&task=view&id=85&Itemid=117
r5932r5933
3434static ADDRESS_MAP_START(amico2k_mem, ADDRESS_SPACE_PROGRAM, 8)
3535   ADDRESS_MAP_UNMAP_HIGH
3636   AM_RANGE(0x0000, 0x03ff) AM_RAM
37//   AM_RANGE(0x0400, 0x07ff) AM_RAM   // optional expansion RAM
37//  AM_RANGE(0x0400, 0x07ff) AM_RAM // optional expansion RAM
3838   AM_RANGE(0xfb00, 0xfcff) AM_ROM
3939   AM_RANGE(0xfd00, 0xfd03) AM_DEVREADWRITE("i8255a", amico2k_i8255a_r, amico2k_i8255a_w)
4040   AM_RANGE(0xfe00, 0xffff) AM_ROM
r5932r5933
8888
8989/* Driver */
9090
91/*     YEAR  NAME    PARENT  COMPAT MACHINE INPUT   INIT  CONFIG COMPANY  FULLNAME                 FLAGS */
91/*    YEAR  NAME    PARENT  COMPAT MACHINE INPUT   INIT  CONFIG COMPANY  FULLNAME                 FLAGS */
9292COMP( 1978, amico2k,    0,    0,     amico2k,    amico2k,    0,    0,     "A.S.EL.",   "Amico 2000",            GAME_NOT_WORKING)
src/mess/drivers/huebler.c
r5932r5933
254254
255255/* System Drivers */
256256
257/*    YEAR   NAME      PARENT   COMPAT   MACHINE      INPUT      INIT   CONFIG      COMPANY                        FULLNAME         FLAGS */
257/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY                             FULLNAME            FLAGS */
258258COMP( 1985, huebler,   0,      0,      huebler,   huebler,   0,      huebler,   "Bernd Hubler, Klaus-Peter Evert",   "Hubler/Everts",   GAME_NOT_WORKING )
src/mess/drivers/fm7.c
r5932r5933
11/***********************************************************************************************
22
3   Fujitsu Micro 7 (FM-7)
3    Fujitsu Micro 7 (FM-7)
44
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
99                 | Release |    Main CPU    |  Sub CPU  |              RAM              |
1010    =====================================================================================
1111    FM-8         | 1981-05 | M68A09 @ 1MHz  |  M6809    |    64K (main) + 48K (VRAM)    |
r5932r5933
1919    FM-77AV40EX  | 1987-11 | M68B09E @ 2MHz |  M68B09   | 192/448K (main) + 144K (VRAM) |
2020    FM-77AV40SX  | 1988-11 | M68B09E @ 2MHz |  M68B09   | 192/448K (main) + 144K (VRAM) |
2121
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?
2424
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
2727
2828
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)
3535
3636************************************************************************************************/
3737
r5932r5933
5555UINT8* fm7_boot_ram;  // Boot RAM (AV only)
5656UINT8 fm7_type;
5757static UINT8 irq_flags;  // active IRQ flags
58static UINT8 irq_mask;  // IRQ mask
58static UINT8 irq_mask;  // IRQ mask
5959emu_timer* fm7_timer;  // main timer, triggered every 2.0345ms
6060emu_timer* fm7_subtimer;  // sub-CPU timer, triggered every 20ms
6161emu_timer* fm7_keyboard_timer;
r5932r5933
108108 * when kana is active.
109109 */
110110 // TODO: fill in shift,ctrl,graph and kana code
111static const UINT16 fm7_key_list[0x60][7] = 
111static const UINT16 fm7_key_list[0x60][7] =
112112{ // norm  shift ctrl  graph kana  sh.kana scan
113113   {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
114114   {0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x01},  // ESC
r5932r5933
139139   {0x70, 0x50, 0x10, 0x8d, 0xbe, 0x00, 0x1a},  // P
140140   {0x40, 0x60, 0x00, 0x8a, 0xde, 0x00, 0x1b},  // @
141141   {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
143143   {0x61, 0x41, 0x01, 0x95, 0xc1, 0x00, 0x1e},  // A
144144   {0x73, 0x53, 0x13, 0x96, 0xc4, 0x00, 0x1f},  // S
145145
r5932r5933
162162   {0x6d, 0x4d, 0x0d, 0x86, 0xd3, 0x00, 0x30},  // M
163163   {0x2c, 0x3c, 0x00, 0x87, 0xc8, 0xa4, 0x31},  // <
164164   {0x2e, 0x3e, 0x00, 0x88, 0xd9, 0xa1, 0x32},  // >
165   {0x2f, 0x3f, 0x00, 0x97, 0xd2, 0xa5, 0x33},  // / 
165   {0x2f, 0x3f, 0x00, 0x97, 0xd2, 0xa5, 0x33},  // /
166166   {0x22, 0x5f, 0x1f, 0xe0, 0xdb, 0x00, 0x34},  // "
167167   {0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x35},  // Space
168168   {0x2a, 0x2a, 0x00, 0x98, 0x2a, 0x2a, 0x36},  // Tenkey
169169   {0x2f, 0x2f, 0x00, 0x91, 0x2f, 0x2f, 0x37},
170170   {0x2b, 0x2b, 0x00, 0x99, 0x2b, 0x2b, 0x38},
171171   {0x2d, 0x2d, 0x00, 0xee, 0x2d, 0x2d, 0x39},
172   {0x37, 0x37, 0x00, 0xe1, 0x37, 0x37, 0x3a}, 
172   {0x37, 0x37, 0x00, 0xe1, 0x37, 0x37, 0x3a},
173173   {0x38, 0x38, 0x00, 0xe2, 0x38, 0x38, 0x3b},
174174   {0x39, 0x39, 0x00, 0xe3, 0x39, 0x39, 0x3c},
175175   {0x3d, 0x3d, 0x00, 0xef, 0x3d, 0x3d, 0x3d},  // Tenkey =
r5932r5933
214214static void main_irq_set_flag(running_machine* machine, UINT8 flag)
215215{
216216   irq_flags |= flag;
217   
217
218218   if(irq_flags != 0)
219219      cputag_set_input_line(machine,"maincpu",M6809_IRQ_LINE,ASSERT_LINE);
220220}
r5932r5933
230230
231231/*
232232 * Main CPU: I/O port 0xfd02
233 *
233 *
234234 * 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
236236 *   bit 0 - keypress
237237 *   bit 1 - printer
238238 *   bit 2 - timer
r5932r5933
241241 *   bit 5 - TXRDY
242242 *   bit 6 - RXRDY
243243 *   bit 7 - SYNDET
244 *
244 *
245245 */
246246static WRITE8_HANDLER( fm7_irq_mask_w )
247247{
r5932r5933
251251
252252/*
253253 * Main CPU: I/O port 0xfd03
254 *
254 *
255255 * On read: returns which IRQ is currently active (typically read by IRQ handler)
256256 *   bit 0 - keypress
257257 *   bit 1 - printer
r5932r5933
265265static READ8_HANDLER( fm7_irq_cause_r )
266266{
267267   UINT8 ret = ~irq_flags;
268   
268
269269   // Timer and Printer IRQ flags are cleared when this port is read
270270   // 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)
272272   if(irq_flags & 0x04)
273273      main_irq_clear_flag(space->machine,IRQ_FLAG_TIMER);
274274   if(irq_flags & 0x02)
275275      main_irq_clear_flag(space->machine,IRQ_FLAG_PRINTER);
276     
276
277277   logerror("IRQ flags read: 0x%02x\n",ret);
278278   return ret;
279279}
r5932r5933
287287static WRITE8_HANDLER( fm7_beeper_w )
288288{
289289   speaker_active = data & 0x01;
290   
290
291291   if(!speaker_active)  // speaker not active, disable all beeper sound
292292   {
293293      beep_set_state(devtag_get_device(space->machine,"beeper"),0);
294294      return;
295295   }
296     
296
297297   if(data & 0x80)
298298   {
299299      if(speaker_active)
r5932r5933
301301   }
302302   else
303303      beep_set_state(devtag_get_device(space->machine,"beeper"),0);
304   
304
305305   if(data & 0x40)
306306   {
307307      if(speaker_active)
r5932r5933
349349static WRITE8_HANDLER( vector_w )
350350{
351351   UINT8* RAM = memory_region(space->machine,"maincpu");
352   
352
353353   if(fm7_type == SYS_FM7)
354354      RAM[0xfff0+offset] = data;
355355   else
r5932r5933
358358
359359/*
360360 * Main CPU: I/O port 0xfd04
361 *
361 *
362362 *  bit 0 - attention IRQ active, clears flag when read.
363363 *  bit 1 - break key active
364364 */
365365static READ8_HANDLER( fm7_fd04_r )
366366{
367367   UINT8 ret = 0xff;
368   
368
369369   if(fm7_video.attn_irq != 0)
370370   {
371371      ret &= ~0x01;
r5932r5933
378378   return ret;
379379}
380380
381/*
381/*
382382 *  Main CPU: I/O port 0xfd0f
383 *
383 *
384384 *  On read, enables BASIC ROM at 0x8000 (default)
385385 *  On write, disables BASIC ROM, enables RAM (if more than 32kB)
386386 */
387387static READ8_HANDLER( fm7_rom_en_r )
388388{
389389   UINT8* RAM = memory_region(space->machine,"maincpu");
390   
390
391391   basic_rom_en = 1;
392392   if(fm7_type == SYS_FM7)
393393   {
r5932r5933
403403static WRITE8_HANDLER( fm7_rom_en_w )
404404{
405405   UINT8* RAM = memory_region(space->machine,"maincpu");
406   
406
407407   basic_rom_en = 0;
408408   if(fm7_type == SYS_FM7)
409409   {
r5932r5933
419419 *  Main CPU: port 0xfd10
420420 *  Initiate ROM enable. (FM-77AV and later only)
421421 *  Port is write-only.  Initiate ROM is on by default.
422 *
422 *
423423 */
424424WRITE8_HANDLER( fm7_init_en_w )
425425{
r5932r5933
457457         break;
458458   }
459459}
460
460
461461static READ8_HANDLER( fm7_fdc_r )
462462{
463463   const device_config* dev = devtag_get_device(space->machine,"fdc");
464464   UINT8 ret = 0;
465   
465
466466   switch(offset)
467467   {
468468      case 0:
r5932r5933
531531      case 6:
532532         // FM77AV and later only. FM-7 returns 0xff;
533533         // bit 6 = 320k(1)/640k(0) FDD
534         // bits 2,3 = logical drive
534         // bits 2,3 = logical drive
535535         logerror("FDC: mode write - %02x\n",data);
536536         break;
537537      default:
r5932r5933
542542/*
543543 *  Main CPU: I/O ports 0xfd00-0xfd01
544544 *  Sub CPU: I/O ports 0xd400-0xd401
545 *
545 *
546546 *  The scancode of the last key pressed is stored in fd/d401, with the 9th
547547 *  bit (MSB) in bit 7 of fd/d400.  0xfd00 also holds a flag for the main
548548 *  CPU clock speed in bit 0 (0 = 1.2MHz, 1 = 2MHz)
r5932r5933
584584/*
585585 *  Sub CPU: port 0xd431, 0xd432
586586 *  Keyboard encoder
587 *
587 *
588588 *  d431 (R/W): Data register (8 bit)
589589 *  d432 (R/O): Status register
590590 *              bit 0 - ACK
591591 *              bit 7 - LATCH (0 if ready to receive)
592 *
592 *
593593 *  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 *
607607 *  ACK is received after 5us.
608608 */
609609READ8_HANDLER( fm77av_key_encoder_r )
r5932r5933
629629            ret &= ~0x01;
630630         break;
631631   }
632   
632
633633   return ret;
634634}
635635
r5932r5933
755755      {
756756         if(fm7_encoder.buffer[0] == 0x80 || fm7_encoder.buffer[1] == 0x01)
757757         {
758            fm7_encoder.tx_count = 8; // 80 01 command is 9 bytes 
758            fm7_encoder.tx_count = 8; // 80 01 command is 9 bytes
759759         }
760760      }
761761      fm7_encoder.buffer[fm7_encoder.position] = data;
r5932r5933
763763      fm7_encoder.tx_count--;
764764      if(fm7_encoder.tx_count == 0)  // last byte
765765         fm77av_encoder_handle_command();
766     
766
767767      // wait 5us to set ACK flag
768768      timer_set(space->machine,ATTOTIME_IN_USEC(5),NULL,0,fm77av_encoder_ack);
769         
769
770770      //logerror("ENC: write 0x%02x to data register, moved to pos %i\n",data,fm7_encoder.position);
771771   }
772772}
r5932r5933
781781   // bit 1: printer error
782782   // bit 0: printer busy
783783   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"));
785785   const device_config* printer_dev = devtag_get_device(space->machine,"lpt");
786786   UINT8 pdata;
787787   int x;
788   
788
789789   if(data > 0.03)
790790      ret |= 0x80;
791   
791
792792   if(cassette_get_state(devtag_get_device(space->machine,"cass")) & CASSETTE_MOTOR_DISABLED)
793793      ret |= 0x80;  // cassette input is high when not in use.
794   
794
795795   ret |= 0x70;
796796
797797   if(input_port_read(space->machine,"config") & 0x01)
r5932r5933
806806      }
807807   }
808808   else
809   {   
809   {
810810      if(image_exists(devtag_get_device(space->machine,"lpt:printer")))
811811      {
812812         if(centronics_pe_r(printer_dev))
r5932r5933
850850
851851/*
852852 *  Main CPU: 0xfd0b
853 *   - bit 0: Boot mode: 0=BASIC, 1=DOS
853 *   - bit 0: Boot mode: 0=BASIC, 1=DOS
854854 */
855855READ8_HANDLER( fm77av_boot_mode_r )
856856{
857857   UINT8 ret = 0xff;
858   
858
859859   if(input_port_read(space->machine,"DSW") & 0x02)
860860      ret &= ~0x01;
861   
861
862862   return 0xff;
863863}
864864
r5932r5933
946946
947947static READ8_HANDLER( fm7_psg_data_r )
948948{
949//   fm7_update_psg(space->machine);
949//  fm7_update_psg(space->machine);
950950   return psg_data;
951951}
952952
953953static WRITE8_HANDLER( fm7_psg_data_w )
954954{
955955   psg_data = data;
956//   fm7_update_psg(space->machine);
956//  fm7_update_psg(space->machine);
957957}
958958
959959static WRITE8_HANDLER( fm77av_bootram_w )
r5932r5933
981981static READ8_HANDLER( fm7_fmirq_r )
982982{
983983   UINT8 ret = 0xff;
984   
984
985985   if(fm77av_ym_irq != 0)
986986      ret &= ~0x08;
987     
987
988988   return ret;
989989}
990990
r5932r5933
10111011/*
10121012 * Memory Management Register
10131013 * Main CPU: 0xfd80 - 0xfd93  (FM-77L4, FM-77AV and later only)
1014 *
1014 *
10151015 * fd80-fd8f (R/W): RAM bank select for current segment (A19-A12)
10161016 * fd90 (W/O): segment select register (3-bit, default = 0)
10171017 * fd92 (W/O): window offset register (OA15-OA8)
10181018 * 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 *
10231023 */
10241024static READ8_HANDLER( fm7_mmr_r )
10251025{
r5932r5933
10361036{
10371037   UINT8* RAM = memory_region(space->machine,"maincpu");
10381038   UINT16 size = 0xfff;
1039   
1039
10401040   if(bank == 15)
10411041      size = 0xbff;
1042   
1042
10431043   if(physical >= 0x10 && physical <= 0x1b)
10441044   {
10451045      switch(physical)
r5932r5933
10811081            memory_install_readwrite8_handler(space,bank*0x1000,(bank*0x1000)+size,0,0,fm7_vramB_r,fm7_vramB_w);
10821082            break;
10831083      }
1084//      memory_set_bankptr(space->machine,bank+1,RAM+(physical<<12)-0x10000);
1084//      memory_set_bankptr(space->machine,bank+1,RAM+(physical<<12)-0x10000);
10851085      return;
10861086   }
10871087   if(physical == 0x1c)
r5932r5933
11231123   int x;
11241124   UINT16 window_addr;
11251125   UINT8* RAM = memory_region(space->machine,"maincpu");
1126   
1126
11271127   if(fm7_mmr.enabled)
11281128   {
11291129      for(x=0;x<16;x++)
r5932r5933
11421142      // memory (0x00000-0x0ffff) defined by the window address register
11431143      // 0x00 = 0x07c00, 0x04 = 0x08000 ... 0xff = 0x07400.
11441144      window_addr = ((fm7_mmr.window_offset << 8) + 0x7c00) & 0xffff;
1145//      if(window_addr < 0xfc00)
1145//      if(window_addr < 0xfc00)
11461146      {
11471147         memory_install_readwrite8_handler(space,0x7c00,0x7fff,0,0,SMH_BANK(24),SMH_BANK(24));
11481148         memory_set_bankptr(space->machine,24,RAM+window_addr);
r5932r5933
11831183
11841184/*
11851185 *  Main CPU: ports 0xfd20-0xfd23
1186 *    Kanji ROM read ports
1186 * Kanji ROM read ports
11871187 *  FD20 (W/O): ROM address high
11881188 *  FD21 (W/O): ROM address low
11891189 *  FD22 (R/O): Kanji data high
11901190 *  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?)
11931193 */
11941194static READ8_HANDLER( fm7_kanji_r )
11951195{
11961196   UINT8* KROM = memory_region(space->machine,"kanji1");
11971197   UINT32 addr = fm7_kanji_address << 1;
1198   
1198
11991199   switch(offset)
12001200   {
12011201      case 0:
r5932r5933
12151215static WRITE8_HANDLER( fm7_kanji_w )
12161216{
12171217   UINT16 addr;
1218   
1218
12191219   switch(offset)
12201220   {
12211221      case 0:
r5932r5933
12561256
12571257   if(scancode == 0)
12581258      return;
1259   
1259
12601260   if(irq_mask & IRQ_FLAG_KEY)
12611261   {
12621262      main_irq_set_flag(machine,IRQ_FLAG_KEY);
r5932r5933
12761276   UINT32 keys;
12771277   UINT32 modifiers = input_port_read(machine,"key_modifiers");
12781278   UINT16 modscancodes[6] = { 0x52, 0x53, 0x54, 0x55, 0x56, 0x5a };
1279   
1279
12801280   for(x=0;x<3;x++)
12811281   {
12821282      keys = input_port_read(machine,portnames[x]);
1283     
1283
12841284      for(y=0;y<32;y++)  // loop through each bit in the port
12851285      {
12861286         if((keys & (1<<y)) != 0 && (key_data[x] & (1<<y)) == 0)
r5932r5933
12911291         {
12921292            key_press(machine,fm7_key_list[bit][6] | 0x80); // key release
12931293         }
1294         bit++;
1294         bit++;
12951295      }
1296     
1296
12971297      key_data[x] = keys;
12981298   }
12991299   // check modifier keys
r5932r5933
13081308      {
13091309         key_press(machine,modscancodes[bit] | 0x80); // key release
13101310      }
1311      bit++;
1311      bit++;
13121312   }
13131313   mod_data = modifiers;
13141314}
r5932r5933
13361336      fm7_keyboard_poll_scan(machine);
13371337      return;
13381338   }
1339   
1339
13401340   // check key modifiers (Shift, Ctrl, Kana, etc...)
13411341   if(modifiers & 0x02 || modifiers & 0x04)
13421342      mod = 1;  // shift
r5932r5933
13481348      mod = 4;  // kana (overrides all)
13491349   if((modifiers & 0x22) == 0x22 || (modifiers & 0x24) == 0x24)
13501350      mod = 5;  // shifted kana
1351   
1351
13521352   for(x=0;x<3;x++)
13531353   {
13541354      keys = input_port_read(machine,portnames[x]);
1355     
1355
13561356      for(y=0;y<32;y++)  // loop through each bit in the port
13571357      {
13581358         if((keys & (1<<y)) != 0 && (key_data[x] & (1<<y)) == 0)
13591359         {
13601360            key_press(machine,fm7_key_list[bit][mod]); // key press
13611361         }
1362         bit++;
1362         bit++;
13631363      }
1364     
1364
13651365      key_data[x] = keys;
13661366   }
13671367}
r5932r5933
14071407*/
14081408// The FM-7 has only 64kB RAM, so we'll worry about banking when we do the later models
14091409static ADDRESS_MAP_START( fm7_mem, ADDRESS_SPACE_PROGRAM, 8 )
1410   AM_RANGE(0x0000,0x7fff) AM_RAM
1410   AM_RANGE(0x0000,0x7fff) AM_RAM
14111411   AM_RANGE(0x8000,0xfbff) AM_ROMBANK(1) // also F-BASIC ROM, when enabled
14121412   AM_RANGE(0xfc00,0xfc7f) AM_RAM
14131413   AM_RANGE(0xfc80,0xfcff) AM_RAM AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w)
r5932r5933
14311431   // Boot ROM
14321432   AM_RANGE(0xfe00,0xffdf) AM_ROMBANK(17)
14331433   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)
14351435ADDRESS_MAP_END
14361436
14371437/*
r5932r5933
14781478   AM_RANGE(0xc000,0xcfff) AM_RAMBANK(13)
14791479   AM_RANGE(0xd000,0xdfff) AM_RAMBANK(14)
14801480   AM_RANGE(0xe000,0xefff) AM_RAMBANK(15)
1481   AM_RANGE(0xf000,0xfbff) AM_RAMBANK(16)
1481   AM_RANGE(0xf000,0xfbff) AM_RAMBANK(16)
14821482   AM_RANGE(0xfc00,0xfc7f) AM_RAM
14831483   AM_RANGE(0xfc80,0xfcff) AM_RAM AM_READWRITE(fm7_main_shared_r,fm7_main_shared_w)
14841484   // I/O space (FD00-FDFF)
r5932r5933
15141514   // Boot ROM (RAM on FM77AV and later)
15151515   AM_RANGE(0xfe00,0xffdf) AM_RAM_WRITE(fm77av_bootram_w) AM_BASE(&fm7_boot_ram)
15161516   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)
15181518ADDRESS_MAP_END
15191519
15201520static ADDRESS_MAP_START( fm77av_sub_mem, ADDRESS_SPACE_PROGRAM, 8 )
r5932r5933
15971597  PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
15981598  PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.')
15991599  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("_")
16011601  PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
16021602  PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey *") PORT_CODE(KEYCODE_ASTERISK)
16031603  PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey /") PORT_CODE(KEYCODE_SLASH_PAD)
16041604  PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey +") PORT_CODE(KEYCODE_PLUS_PAD)
16051605  PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey -") PORT_CODE(KEYCODE_MINUS_PAD)
16061606  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)
16081608  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 =")
16101610  PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 4") PORT_CODE(KEYCODE_4_PAD)
16111611  PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tenkey 5") PORT_CODE(KEYCODE_5_PAD)
16121612
r5932r5933
16311631  PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
16321632  PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_ESC)
16331633  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)
16351635  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)
16371637  PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF5") PORT_CODE(KEYCODE_F5)
16381638  PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF6") PORT_CODE(KEYCODE_F6)
16391639  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)
16411641  PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF9") PORT_CODE(KEYCODE_F9)
16421642  PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("PF10") PORT_CODE(KEYCODE_F10)
16431643
r5932r5933
16451645  PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL)
16461646  PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT)
16471647  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)
16501650  PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Kana") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE
16511651
16521652  PORT_START("lptjoy")
r5932r5933
16561656  PORT_BIT(0x08,IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN) PORT_NAME("LPT Joystick Down") PORT_8WAY PORT_PLAYER(1)
16571657  PORT_BIT(0x10,IP_ACTIVE_HIGH,IPT_BUTTON2) PORT_NAME("LPT Joystick Button 2") PORT_PLAYER(1)
16581658  PORT_BIT(0x20,IP_ACTIVE_HIGH,IPT_BUTTON1) PORT_NAME("LPT Joystick Button 1") PORT_PLAYER(1)
1659 
1659
16601660  PORT_START("joy1")
16611661  PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_JOYSTICK_UP) PORT_NAME("1P Joystick Up") PORT_8WAY PORT_PLAYER(1)
16621662  PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_JOYSTICK_DOWN) PORT_NAME("1P Joystick Down") PORT_8WAY PORT_PLAYER(1)
r5932r5933
16761676  PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_BUTTON1) PORT_NAME("2P Joystick Button 1") PORT_PLAYER(2)
16771677  PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_UNUSED)
16781678  PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED)
1679 
16801679
1680
16811681  PORT_START("DSW")
16821682  PORT_DIPNAME(0x01,0x01,"Switch A") PORT_DIPLOCATION("SWA:1")
16831683  PORT_DIPSETTING(0x00,DEF_STR( Off ))
r5932r5933
17001700
17011701static DRIVER_INIT(fm7)
17021702{
1703//   shared_ram = auto_alloc_array(machine,UINT8,0x80);
1703//  shared_ram = auto_alloc_array(machine,UINT8,0x80);
17041704   fm7_video_ram = auto_alloc_array(machine,UINT8,0x18000);  // 2 pages on some systems
17051705   fm7_timer = timer_alloc(machine,fm7_timer_irq,NULL);
17061706   fm7_subtimer = timer_alloc(machine,fm7_subtimer_irq,NULL);
r5932r5933
17161716   // The FM-7 has no initialisation ROM, and no other obvious
17171717   // way to set the reset vector, so for now this will have to do.
17181718   UINT8* RAM = memory_region(machine,"maincpu");
1719   
1719
17201720   RAM[0xfffe] = 0xfe;
1721   RAM[0xffff] = 0x00;
1722   
1721   RAM[0xffff] = 0x00;
1722
17231723   memset(shared_ram,0xff,0x80);
17241724   fm7_type = SYS_FM7;
1725   
1725
17261726   beep_set_frequency(devtag_get_device(machine,"beeper"),1200);
17271727   beep_set_state(devtag_get_device(machine,"beeper"),0);
17281728}
r5932r5933
17341734
17351735   memset(shared_ram,0xff,0x80);
17361736
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)
17381738   memcpy(RAM+0x3fff0,ROM+0x1ff0,16);
17391739
17401740   fm7_video.subrom = 0;  // default sub CPU ROM is type C.
r5932r5933
17421742   memory_set_bankptr(machine,20,RAM);
17431743   RAM = memory_region(machine,"subsys_c");
17441744   memory_set_bankptr(machine,21,RAM+0x800);
1745   
1745
17461746   fm7_type = SYS_FM77AV;
17471747   beep_set_frequency(devtag_get_device(machine,"beeper"),1200);
17481748   beep_set_state(devtag_get_device(machine,"beeper"),0);
r5932r5933
17521752{
17531753   UINT8* RAM = memory_region(machine,"maincpu");
17541754   UINT8* ROM = memory_region(machine,"init");
1755   
1755
17561756   timer_adjust_periodic(fm7_timer,ATTOTIME_IN_NSEC(2034500),0,ATTOTIME_IN_NSEC(2034500));
17571757   timer_adjust_periodic(fm7_subtimer,ATTOTIME_IN_MSEC(20),0,ATTOTIME_IN_MSEC(20));
17581758   timer_adjust_periodic(fm7_keyboard_timer,attotime_zero,0,ATTOTIME_IN_MSEC(10));
17591759   if(fm7_type != SYS_FM7)
17601760      timer_adjust_oneshot(fm77av_vsync_timer,video_screen_get_time_until_vblank_end(machine->primary_screen),0);
1761     
1761
17621762   irq_mask = 0x00;
17631763   irq_flags = 0x00;
17641764   fm7_video.attn_irq = 0;
r5932r5933
17691769   else
17701770   {
17711771      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)
17731773      memcpy(RAM+0x3fff0,ROM+0x1ff0,16);
1774   }   
1774   }
17751775   if(fm7_type == SYS_FM7)
17761776      memory_set_bankptr(machine,1,RAM+0x38000);
17771777   key_delay = 700;  // 700ms on FM-7
r5932r5933
18591859   MDRV_CPU_ADD("sub", M6809, XTAL_2MHz)
18601860   MDRV_CPU_PROGRAM_MAP(fm7_sub_mem)
18611861   MDRV_QUANTUM_PERFECT_CPU("sub")
1862   
1862
18631863   MDRV_SPEAKER_STANDARD_MONO("mono")
18641864   MDRV_SOUND_ADD("psg", AY8910, XTAL_4_9152MHz / 4)
18651865   MDRV_SOUND_CONFIG(fm7_psg_intf)
r5932r5933
18741874
18751875   /* video hardware */
18761876   MDRV_SCREEN_ADD("screen", RASTER)
1877   
1877
18781878   MDRV_SCREEN_REFRESH_RATE(60)
18791879   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
18801880   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
r5932r5933
18851885
18861886   MDRV_VIDEO_START(fm7)
18871887   MDRV_VIDEO_UPDATE(fm7)
1888   
1888
18891889   MDRV_CASSETTE_ADD("cass",fm7_cassette_config)
1890   
1890
18911891   MDRV_MB8877_ADD("fdc",fm7_mb8877a_interface)
1892   
1892
18931893   MDRV_CENTRONICS_ADD("lpt",standard_centronics)
1894   
1894
18951895   MDRV_FLOPPY_2_DRIVES_ADD(fm7_floppy_config)
18961896MACHINE_DRIVER_END
18971897
r5932r5933
19311931   MDRV_VIDEO_UPDATE(fm7)
19321932
19331933   MDRV_CASSETTE_ADD("cass",fm7_cassette_config)
1934   
1934
19351935   MDRV_MB8877_ADD("fdc",fm7_mb8877a_interface)
1936   
1936
19371937   MDRV_CENTRONICS_ADD("lpt",standard_centronics)
1938   
1938
19391939   MDRV_FLOPPY_2_DRIVES_ADD(fm7_floppy_config)
19401940MACHINE_DRIVER_END
19411941
r5932r5933
19511951   ROM_REGION( 0x200, "basic", 0 )
19521952   ROM_LOAD( "boot_bas.rom", 0x0000,  0x0200, CRC(c70f0c74) SHA1(53b63a301cba7e3030e79c59a4d4291eab6e64b0) )
19531953
1954   ROM_REGION( 0x200, "dos", 0 )   
1954   ROM_REGION( 0x200, "dos", 0 )
19551955   ROM_LOAD( "boot_dos.rom", 0x0000,  0x0200, CRC(198614ff) SHA1(037e5881bd3fed472a210ee894a6446965a8d2ef) )
19561956
19571957   // optional Kanji ROM
r5932r5933
19731973   ROM_REGION( 0x10000, "sub", 0 )
19741974   ROM_FILL(0x0000,0x10000,0xff)
19751975
1976   // sub CPU ROMs   
1976   // sub CPU ROMs
19771977   ROM_REGION( 0x2800, "subsys_c", 0 )
19781978   ROM_LOAD( "subsys_c.rom", 0x0000,  0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) )
19791979   ROM_REGION( 0x2000, "subsys_a", 0 )
r5932r5933
20022002   ROM_REGION( 0x10000, "sub", 0 )
20032003   ROM_FILL(0x0000,0x10000,0xff)
20042004
2005   // sub CPU ROMs   
2005   // sub CPU ROMs
20062006   ROM_REGION( 0x2800, "subsys_c", 0 )
20072007   ROM_LOAD( "subsys_c.rom", 0x0000,  0x2800, CRC(24cec93f) SHA1(50b7283db6fe1342c6063fc94046283f4feddc1c) )
20082008   ROM_REGION( 0x2000, "subsys_a", 0 )
src/mess/drivers/compis.c
r5932r5933
4747static READ8_DEVICE_HANDLER( compis_ppi_r )
4848{
4949/* 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 */
5858
5959   if (offset == 3) return 0;
6060   else
r5932r5933
113113- "Compis S" is mapped to 'F6'
114114- "Avbryt" is mapped to 'F7'
115115- "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'
118118- "Start / Stop" is mapped to 'Pause'
119119- "TabL" is mapped to 'Page Up'
120120- "TabR" is mapped to 'Page Down'
r5932r5933
244244
245245static const mm58274c_interface compis_mm58274c_interface =
246246{
247   0,   /*    mode 24*/
247   0,   /* mode 24*/
248248   1   /*  first day of week */
249249};
250250
r5932r5933
301301   MDRV_MM58274C_ADD("mm58274c", compis_mm58274c_interface)
302302
303303   MDRV_NEC765A_ADD("nec765", compis_fdc_interface)
304   
304
305305   MDRV_FLOPPY_2_DRIVES_ADD(compis_floppy_config)
306306MACHINE_DRIVER_END
307307
src/mess/drivers/vtech2.c
r5932r5933
8787   AM_RANGE(0x45, 0x45) AM_WRITE(laser_two_color_w)
8888ADDRESS_MAP_END
8989
90/* 2008-05 FP:
90/* 2008-05 FP:
9191Small note about natural keyboard: currently,
9292- "Graph" is mapped to 'F11'
9393- "Del Line" is mapped to 'F12'
r5932r5933
214214   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT)         PORT_CHAR(UCHAR_MAMEKEY(INSERT))
215215INPUT_PORTS_END
216216
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.
218However, 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.
218However, old-computers.com describes it as a laser 500/700 in a laser 300/310 case. The missing inputs seem to
219219confirm this. */
220220static INPUT_PORTS_START( laser350 )
221221   PORT_INCLUDE( laser500 )
src/mess/drivers/wswan.c
r5932r5933
158158   MDRV_SOUND_ADD("custom", WSWAN, 0)
159159   MDRV_SOUND_ROUTE(0, "lspeaker", 0.50)
160160   MDRV_SOUND_ROUTE(1, "rspeaker", 0.50)
161   
161
162162   /* cartridge */
163163   MDRV_CARTSLOT_ADD("cart")
164164   MDRV_CARTSLOT_EXTENSION_LIST("ws,wsc,bin")
src/mess/drivers/zx.c
r5932r5933
1313        14.05.2004 Finally fixed and readded.
1414
1515    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.
2323
2424    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.
3333
3434
3535****************************************************************************/
r5932r5933
7070
7171static INPUT_PORTS_START( zx80 )
7272/* 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
7474these functions in Input (This System) menu, hence we live some empty space in the menu */
7575   PORT_START("ROW0")
7676   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
r5932r5933
332332
333333static PALETTE_INIT( ts1000 )
334334{
335   palette_set_color(machine,0,MAKE_RGB(64, 244, 244)); /* cyan */   
335   palette_set_color(machine,0,MAKE_RGB(64, 244, 244)); /* cyan */
336336   palette_set_color(machine,1,RGB_BLACK); /* black */
337337   palette_set_color(machine,2,RGB_BLACK); /* black */
338338   palette_set_color(machine,3,MAKE_RGB(64, 244, 244)); /* cyan */
r5932r5933
389389   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
390390   MDRV_SCREEN_SIZE(ZX81_PIXELS_PER_SCANLINE, ZX81_PAL_SCANLINES)
391391   MDRV_SCREEN_VISIBLE_AREA(0, ZX81_PIXELS_PER_SCANLINE-1, 0, ZX81_PAL_SCANLINES-1)
392//   MDRV_GFXDECODE(zx80)
392//  MDRV_GFXDECODE(zx80)
393393   MDRV_PALETTE_LENGTH(4)
394394   MDRV_PALETTE_INIT(zx80)
395395
r5932r5933
413413   MDRV_CPU_MODIFY("maincpu")
414414   MDRV_CPU_IO_MAP(zx81_io_map)
415415
416//   MDRV_GFXDECODE(zx81)
416//  MDRV_GFXDECODE(zx81)
417417
418418   MDRV_CASSETTE_MODIFY( "cassette", zx81_cassette_config )
419419MACHINE_DRIVER_END
r5932r5933
437437   MDRV_SCREEN_SIZE(ZX81_PIXELS_PER_SCANLINE, ZX81_NTSC_SCANLINES)
438438   MDRV_SCREEN_VISIBLE_AREA(0, ZX81_PIXELS_PER_SCANLINE-1, 0, ZX81_NTSC_SCANLINES-1)
439439
440//   MDRV_GFXDECODE(pc8300)
440//  MDRV_GFXDECODE(pc8300)
441441   MDRV_PALETTE_INIT(zx80)
442442MACHINE_DRIVER_END
443443
r5932r5933
448448   MDRV_CPU_IO_MAP(pow3000_io_map)
449449
450450   MDRV_MACHINE_RESET(pow3000)
451//   MDRV_GFXDECODE(pc8300)
451//  MDRV_GFXDECODE(pc8300)
452452   MDRV_PALETTE_INIT(zx80)
453453MACHINE_DRIVER_END
454454
r5932r5933
484484
485485ROM_START(ts1500)
486486   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) )
488488ROM_END
489489
490490ROM_START(ringo470)
r5932r5933
522522ROM_END
523523
524524/* This homebrew has 192k of RAM and 32k of ROM via bankswitching. One of the primary bankswitching lines is /M1,
525   which is not emulated by MAME's z80. */
525    which is not emulated by MAME's z80. */
526526ROM_START( zx97 )
527527   ROM_REGION( 0x10000, "maincpu", 0 )
528528   ROM_LOAD( "zx97.rom", 0x0000, 0x2000, CRC(5cf49744) SHA1(b2a486efdc7b2bc3dc8e5a441ea5532bfa3207bd) )
src/mess/drivers/cpschngr.c
r5932r5933
11/***************************************************************************
22
3   CPS Changer
3    CPS Changer
44
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.
1111
1212***************************************************************************/
1313
r5932r5933
194194
195195/***************************************
196196
197   Address Maps
197    Address Maps
198198
199199****************************************/
200200
r5932r5933
254254
255255/***********************************************************
256256
257   Inputs and Dips
257    Inputs and Dips
258258
259259***********************************************************/
260260
r5932r5933
310310
311311/***************************************
312312
313   Graphics Decode
313    Graphics Decode
314314
315315****************************************/
316316
r5932r5933
441441
442442/***************************************
443443
444   Driver Initialisation
444    Driver Initialisation
445445
446446****************************************/
447447
r5932r5933
454454
455455/***************************************
456456
457   Roms
457    Roms
458458
459459***************************************/
460460
r5932r5933
599599
600600/***************************************************************************
601601
602   Game driver(s)
602    Game driver(s)
603603
604604***************************************************************************/
605605
src/mess/drivers/exp85.c
r5932r5933
11/***************************************************************************
2   
2
33    Explorer 85
44
55    12/05/2009 Skeleton driver.
r5932r5933
88
99/*
1010
11   TODO:
11    TODO:
1212
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
1717
1818*/
1919
r5932r5933
3939   ADDRESS_MAP_UNMAP_HIGH
4040   AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE(I8355_TAG, i8355_r, i8355_w)
4141   AM_RANGE(0xf8, 0xfd) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w)
42//   AM_RANGE(0xfe, 0xff) AM_DEVREADWRITE(I8279_TAG, i8279_r, i8279_w)
42//  AM_RANGE(0xfe, 0xff) AM_DEVREADWRITE(I8279_TAG, i8279_r, i8279_w)
4343ADDRESS_MAP_END
4444
4545/* Input Ports */
r5932r5933
9090{
9191   /*
9292
93        bit      description
93        bit     description
9494
95      PA0     tape control
95        PA0     tape control
9696        PA1     jumper S17 (open=+5V closed=GND)
9797        PA2     J5:13
98        PA3     
99        PA4      J2:22
100        PA5     
101        PA6     
98        PA3
99        PA4     J2:22
100        PA5
101        PA6
102102        PA7     speaker output
103   
104   */
105103
104    */
105
106106   return 0x02;
107107}
108108
r5932r5933
110110{
111111   /*
112112
113        bit      description
113        bit     description
114114
115      PA0     tape control
115        PA0     tape control
116116        PA1     jumper S17 (open=+5V closed=GND)
117117        PA2     J5:13
118        PA3     
119        PA4      J2:22
120        PA5     
121        PA6     
118        PA3
119        PA4     J2:22
120        PA5
121        PA6
122122        PA7     speaker output
123   
124   */
125123
124    */
125
126126   exp85_state *state = device->machine->driver_data;
127127
128128   /* tape control */
r5932r5933
174174/* Machine Initialization */
175175
176176static MACHINE_START( exp85 )
177{   
177{
178178   exp85_state *state = machine->driver_data;
179179   const address_space *program = cputag_get_address_space(machine, I8085A_TAG, ADDRESS_SPACE_PROGRAM);
180   
180
181181   /* setup memory banking */
182182   memory_install_readwrite8_handler(program, 0x0000, 0x07ff, 0, 0, SMH_BANK(1), SMH_UNMAP);
183183   memory_configure_bank(machine, 1, 0, 1, memory_region(machine, I8085A_TAG) + 0xf000, 0);
r5932r5933
204204    /* basic machine hardware */
205205    MDRV_CPU_ADD(I8085A_TAG, 8085A, XTAL_6_144MHz)
206206    MDRV_CPU_PROGRAM_MAP(exp85_mem)
207    MDRV_CPU_IO_MAP(exp85_io)   
207    MDRV_CPU_IO_MAP(exp85_io)
208208   MDRV_CPU_CONFIG(exp85_i8085_config)
209209
210210    MDRV_MACHINE_START(exp85)
211   
211
212212    /* video hardware */
213213    MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
214214    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
216216    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
217217    MDRV_SCREEN_SIZE(640, 480)
218218    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
219   
219
220220   MDRV_PALETTE_LENGTH(2)
221221    MDRV_PALETTE_INIT(black_and_white)
222   
222
223223   MDRV_VIDEO_START(exp85)
224224    MDRV_VIDEO_UPDATE(exp85)
225225
r5932r5933
250250   ROMX_LOAD( "hex.u105", 0xf000, 0x0800, NO_DUMP, ROM_BIOS(2) )
251251
252252   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) )*/
258258ROM_END
259259
260260/* System Configuration */
r5932r5933
266266
267267/* System Drivers */
268268
269/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY         FULLNAME      FLAGS */
269/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY         FULLNAME        FLAGS */
270270COMP( 1979, exp85,  0,      0,      exp85,   exp85,   0,      exp85,   "Netronics",   "Explorer/85",   GAME_NOT_WORKING )
src/mess/drivers/esq1.c
r5932r5933
55    Ensoniq ESQ-1 and SQ-80 Digital Wave Synthesizers
66    Preliminary driver by R. Belmont
77
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)
1717
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)
2929
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)
3838
3939If SEQRAM is mapped at 4000, DUART port 2 determines the 32KB "master bank" and ports 0 and 1
4040determine which of the 4 8KB "sub banks" is visible.
r5932r5933
4545NMI is from the IRQ line on the FDC (again, SQ-80 only).
4646
4747TODO:
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)
5353
5454***************************************************************************/
5555
r5932r5933
9797{
9898   int bank = ((uart_outputport >> 1) & 0x7) ^ 7;
9999
100//   printf("bank %d => offset %x (PC=%x)\n", bank, bank * 0x1000, cpu_get_pc(machine->cpu[0]));
100//  printf("bank %d => offset %x (PC=%x)\n", bank, bank * 0x1000, cpu_get_pc(machine->cpu[0]));
101101   memory_set_bankptr(machine, 1, memory_region(machine, "osrom") + (bank * 0x1000) );
102102}
103103
104104static READ8_HANDLER( uart_r )
105105{
106//   printf("Read UART @ %x\n", offset);
106//  printf("Read UART @ %x\n", offset);
107107
108108   switch (offset)
109109   {
r5932r5933
119119{
120120   uart_regs[offset] = data;
121121
122//   printf("%x to UART %x\n", data, offset);
122//  printf("%x to UART %x\n", data, offset);
123123
124124   switch (offset)
125125   {
126      case 0xb:
127//         printf("%02x to 6500\n", data);
126      case 0xb:
127//          printf("%02x to 6500\n", data);
128128         break;
129129
130130      case 0xe:   // set output port bits
r5932r5933
193193/*
194194
1951957 to UART 6                counter/timer upper
196d0 to UART 7               counter/timer lower                                                 
196d0 to UART 7               counter/timer lower
19719760 to UART 4               aux control (C/T timer mode using external clock)
19820 to UART a               command register B                                                 
19930 to UART a               command register B                                                 
20010 to UART a               command register B                                                 
19820 to UART a               command register B
19930 to UART a               command register B
20010 to UART a               command register B
20120113 to UART 8               mode register B => 8 bits no parity
202f to UART 8                mode register B => force odd parity, 8 bits (?)                                               
202f to UART 8                mode register B => force odd parity, 8 bits (?)
203203ee to UART 9               clock select register B
2042045 to UART a                command register B (Enable Tx/Enable Rx)
205205e7 to UART b               Tx holding register B (send E7 to display)
src/mess/drivers/ami1200.c
r5932r5933
2222     * 4 8-bit audio channels (2 for left, 2 for right)
2323     * Gamepad, Serial port, 2 Gameports, Interfaces for keyboard
2424
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
3333*/
3434
3535#include "driver.h"
r5932r5933
631631
632632/***************************************************************************************************/
633633
634/*     YEAR  NAME     PARENT   COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY       FULLNAME */
634/*    YEAR  NAME     PARENT   COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY       FULLNAME */
635635COMP( 1992, a1200n,  0,       0,      a1200n, a1200,  a1200,  a1200,  "Commodore",  "Amiga 1200 (NTSC)" , GAME_NOT_WORKING )
636636COMP( 1992, a1200p,  a1200n,  0,      a1200p, a1200,  a1200,  a1200,  "Commodore",  "Amiga 1200 (PAL)" , GAME_NOT_WORKING )
637637CONS( 1993, cd32,    0,       0,      cd32,   cd32,   cd32,   0,      "Commodore",  "Amiga CD32 (NTSC)" , GAME_NOT_WORKING )
src/mess/drivers/apple2gs.c
r5932r5933
153153/*
154154static void apple2gs_floppy35_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
155155{
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;
160160
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;
167167
168      default:                              sonydriv_device_getinfo(devclass, state, info); break;
169   }
168        default:                                        sonydriv_device_getinfo(devclass, state, info); break;
169    }
170170}
171171
172172
173173
174174static void apple2gs_floppy525_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
175175{
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;
181181
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;
188188
189      default:                              apple525_device_getinfo(devclass, state, info); break;
190   }
189        default:                                        apple525_device_getinfo(devclass, state, info); break;
190    }
191191}*/
192192
193193static const floppy_config apple2gs_floppy35_floppy_config =
r5932r5933
234234   /* replace the old-style FDC with an IWM */
235235   MDRV_DEVICE_REMOVE("fdc")
236236   MDRV_IWM_ADD("fdc", apple2_fdc_interface)
237   /* SCC */   
237   /* SCC */
238238   MDRV_SCC8530_ADD("scc")
239   
239
240240   MDRV_FLOPPY_APPLE_2_DRIVES_REMOVE()
241241   MDRV_FLOPPY_APPLE_2_DRIVES_ADD(apple2gs_floppy525_floppy_config,15,16)
242242   MDRV_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(apple2gs_floppy35_floppy_config)
src/mess/drivers/vt320.c
r5932r5933
11/***************************************************************************
2   
2
33        DEC VT320
44
55        30/06/2009 Skeleton driver.
r5932r5933
2121Toshiba TC5565APL-12, 2 off
2222Static RAM, 64K bit = 8K byte.
2323ST TDA1170N
24Vertical deflection system IC.
24Vertical deflection system IC.
2525UC 80343Q
262620 pins. Unknown.
2727UC 80068Q
r5932r5933
3333Texas Inst. 749X 75146
34348 pins. Unknown.
3535Signetics? 74LS373N
368-bit D-type latch. This has eight inputs and eight outputs.
368-bit D-type latch. This has eight inputs and eight outputs.
3737*/
3838static ADDRESS_MAP_START(vt320_mem, ADDRESS_SPACE_PROGRAM, 8)
3939   AM_RANGE(0x0000, 0xffff) AM_ROM
r5932r5933
4646INPUT_PORTS_START( vt320 )
4747INPUT_PORTS_END
4848
49static MACHINE_RESET(vt320)
50{   
49static MACHINE_RESET(vt320)
50{
5151   memset(mess_ram,0,16*1024);
5252}
5353
r5932r5933
6565    /* basic machine hardware */
6666    MDRV_CPU_ADD("maincpu", I8051, XTAL_16MHz)
6767    MDRV_CPU_PROGRAM_MAP(vt320_mem)
68    MDRV_CPU_IO_MAP(vt320_io)   
68    MDRV_CPU_IO_MAP(vt320_io)
6969
7070    MDRV_MACHINE_RESET(vt320)
71   
71
7272    /* video hardware */
7373    MDRV_SCREEN_ADD("screen", RASTER)
7474    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
9797
9898/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY   FULLNAME       FLAGS */
9999COMP( 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)
103103
src/mess/drivers/votrtnt.c
r5932r5933
100100/*
101101static ACIA6850_INTERFACE( acia_intf )
102102{
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
111111};*/
112112
113113/******************************************************************************
src/mess/drivers/atari.c
r5932r5933
55
66    Juergen Buchmueller, June 1998
77
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)
1818
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
2929
3030******************************************************************************/
3131
r5932r5933
412412Small note about natural keyboard support: currently,
413413- "Break" is mapped to 'F1'
414414- "Clear" is mapped to 'F2'
415- "Atari" is mapped to 'F3'                     */
415- "Atari" is mapped to 'F3'                         */
416416
417417static INPUT_PORTS_START( atari_keyboard )
418418   PORT_START("keyboard_0")
r5932r5933
420420   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
421421   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
422422   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)
424424   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
425425   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('+') PORT_CHAR('\\')
426426   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('*') PORT_CHAR('^')
r5932r5933
480480   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
481481   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
482482   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))
484484   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('@')
485485   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<  Clear") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('<') PORT_CHAR(UCHAR_MAMEKEY(F2))
486486   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(">  Insert") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('>') PORT_CHAR(UCHAR_MAMEKEY(INSERT))
r5932r5933
713713{
714714   int i;
715715
716   for ( i = 0; i < sizeof(atari_palette) / 3; i++ )
716   for ( i = 0; i < sizeof(atari_palette) / 3; i++ )
717717   {
718718      palette_set_color_rgb(machine, i, atari_palette[i*3], atari_palette[i*3+1], atari_palette[i*3+2]);
719719   }
r5932r5933
791791      base2 = memory_region(machine, "maincpu") + 0x15000;  /* 0x0800 bytes */
792792   }
793793   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);
795795}
796796
797797/* BASIC was available in a separate cart, so we don't test it */
r5932r5933
843843      base2 = memory_region(machine, "maincpu") + 0x15000;  /* 0x0800 bytes */
844844   }
845845   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);
847847}
848848
849849/**************************************************************
r5932r5933
10111011   MDRV_SCREEN_MODIFY("screen")
10121012   MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ)
10131013   MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ)
1014   
1014
10151015   MDRV_IMPORT_FROM(a400_cartslot)
10161016MACHINE_DRIVER_END
10171017
r5932r5933
10281028   MDRV_SCREEN_MODIFY("screen")
10291029   MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_50HZ)
10301030   MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_50HZ)
1031   
1031
10321032   MDRV_IMPORT_FROM(a400_cartslot)
10331033MACHINE_DRIVER_END
10341034
r5932r5933
10451045   MDRV_SCREEN_MODIFY("screen")
10461046   MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ)
10471047   MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ)
1048   
1048
10491049   MDRV_IMPORT_FROM(a800_cartslot)
10501050MACHINE_DRIVER_END
10511051
r5932r5933
10811081   MDRV_SCREEN_MODIFY("screen")
10821082   MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ)
10831083   MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ)
1084   
1084
10851085   MDRV_IMPORT_FROM(a400_cartslot)
10861086MACHINE_DRIVER_END
10871087
r5932r5933
11001100   MDRV_SCREEN_MODIFY("screen")
11011101   MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ)
11021102   MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ)
1103   
1103
11041104   MDRV_IMPORT_FROM(a400_cartslot)
11051105MACHINE_DRIVER_END
11061106
r5932r5933
11241124   MDRV_SCREEN_MODIFY( "screen" )
11251125   MDRV_SCREEN_REFRESH_RATE(FRAME_RATE_60HZ)
11261126   MDRV_SCREEN_SIZE(HWIDTH*8, TOTAL_LINES_60HZ)
1127   
1127
11281128   MDRV_CARTSLOT_ADD("cart")
11291129   MDRV_CARTSLOT_EXTENSION_LIST("rom,bin,a52")
11301130   MDRV_CARTSLOT_NOT_MANDATORY
r5932r5933
12061206ROM_START(a65xea)
12071207   ROM_REGION(0x18000, "maincpu", 0)
12081208   ROM_LOAD( "basic_ar.rom", 0x10000, 0x2000, CRC(c899f4d6) SHA1(043df191d1fe402e792266a108e147ffcda35130) )   // is this correct? or shall we use Rev. C?
1209//   ROM_LOAD( "c101700.rom",  0x14000, 0x4000, CRC(7f9a76c8) SHA1(57eb6d87850a763f11767f53d4eaede186f831a2) )   // this was from Savetz and has wrong bits!
1209//  ROM_LOAD( "c101700.rom",  0x14000, 0x4000, CRC(7f9a76c8) SHA1(57eb6d87850a763f11767f53d4eaede186f831a2) )   // this was from Savetz and has wrong bits!
12101210   ROM_LOAD( "c101700.rom",  0x14000, 0x4000, CRC(45f47988) SHA1(a36b8b20f657580f172749bb0625c08706ed824c) )   // Rev. 3B ?
12111211ROM_END
12121212
src/mess/drivers/mac.c
r5932r5933
11/****************************************************************************
22
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
3838****************************************************************************/
3939
4040#include "driver.h"
r5932r5933
5050// LC: boot needs 50f04000 bit 0 to go "1" at a49f00.  SCC.
5151
5252/*
53   Apple Sound Chip
53    Apple Sound Chip
5454
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
5757
58   Verified to be only 8 bits wide by Apple documentation.
58    Verified to be only 8 bits wide by Apple documentation.
5959
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
6666*/
6767
6868static UINT8 mac_asc_regs[0x2000];
r5932r5933
183183   /* devices */
184184   MDRV_IWM_ADD("fdc", mac_iwm_interface)
185185   MDRV_FLOPPY_SONY_2_DRIVES_ADD(mac128512_floppy_config)
186   
186
187187   MDRV_SCC8530_ADD("scc")
188188   MDRV_SCC8530_ACK(mac_scc_ack)
189189   MDRV_VIA6522_ADD("via6522_0", 1000000, mac_via6522_intf)
r5932r5933
198198
199199   MDRV_HARDDISK_ADD( "harddisk1" )
200200   MDRV_HARDDISK_ADD( "harddisk2" )
201   
201
202202   MDRV_FLOPPY_SONY_2_DRIVES_MODIFY(mac_floppy_config)
203203MACHINE_DRIVER_END
204204
src/mess/drivers/nc.c
r5932r5933
17041704   MDRV_DEVICE_REMOVE("rtc")
17051705
17061706   MDRV_NEC765A_ADD("nec765", nc200_nec765_interface)
1707   
1707
17081708   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, nc200_floppy_config)
17091709MACHINE_DRIVER_END
17101710
src/mess/drivers/p8k.c
r5932r5933
11/***************************************************************************
2   
3    P8000 
42 
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.
66    P8000emu (http://knothusa.net/Home.php) has been a great source of info.
77    Other info from
88      * http://www.pofo.de/P8000/notes/books/
99      * http://www.pofo.de/P8000/
1010 
1111    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
1313        8bit IO Map, and hence I commented out the whole map)
1414      * add floppy emulation to 8 bit board
1515      * properly implement Z80 daisy chain in 16 bit board
r5932r5933
6969ADDRESS_MAP_END
7070 
7171static ADDRESS_MAP_START(p8k_iomap, ADDRESS_SPACE_IO, 8)
72//   AM_RANGE(0x00, 0x07) // MH7489
72//  AM_RANGE(0x00, 0x07) // MH7489
7373   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80ctc_0", z80ctc_r, z80ctc_w)
7474   AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80pio_0", z80pio_alt_r, z80pio_alt_w)
7575   AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("z80pio_1", z80pio_alt_r, z80pio_alt_w)
7676   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//   AM_RANGE(0x20, 0x23) // FDC
77//  AM_RANGE(0x20, 0x23) // FDC
7878   AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("z80sio_0", sio2_r, sio2_w)
7979   AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("z80sio_1", sio2_r, sio2_w)
8080   AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80ctc_1", z80ctc_r, z80ctc_w)
r5932r5933
150150}
151151 
152152static ADDRESS_MAP_START(p8k_16_iomap, ADDRESS_SPACE_IO, 16)
153//   AM_RANGE(0x0fef0, 0x0feff) // clock
153//  AM_RANGE(0x0fef0, 0x0feff) // clock
154154   AM_RANGE(0x0ff80, 0x0ff87) AM_DEVREADWRITE("z80sio_0", p8k_16_sio_r, p8k_16_sio_w)
155155   AM_RANGE(0x0ff88, 0x0ff8f) AM_DEVREADWRITE("z80sio_1", p8k_16_sio_r, p8k_16_sio_w)
156156   AM_RANGE(0x0ff90, 0x0ff97) AM_DEVREADWRITE("z80pio_0", p8k_16_pio_r, p8k_16_pio_w)
r5932r5933
158158   AM_RANGE(0x0ffa0, 0x0ffa7) AM_DEVREADWRITE("z80pio_2", p8k_16_pio_r, p8k_16_pio_w)
159159   AM_RANGE(0x0ffa8, 0x0ffaf) AM_DEVREADWRITE("z80ctc_0", p8k_16_ctc_r, p8k_16_ctc_w)
160160   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
168168ADDRESS_MAP_END
169169 
170170#endif
r5932r5933
175175INPUT_PORTS_END
176176 
177177 
178static MACHINE_RESET( p8k )
178static MACHINE_RESET( p8k )
179179{
180180}
181181 
182static MACHINE_RESET( p8k_16 )
182static MACHINE_RESET( p8k_16 )
183183{
184184}
185185 
r5932r5933
194194 
195195 
196196/***************************************************************************
197   
197
198198    P8000 8bit Peripherals
199199 
200200****************************************************************************/
r5932r5933
245245/* Z80 CTC 1 */
246246// to implement: callbacks!
247247// 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,
249249 
250250static const z80ctc_interface p8k_ctc_1_intf =
251251{
r5932r5933
347347 
348348 
349349/***************************************************************************
350   
350
351351    P8000 16bit Peripherals
352352 
353353****************************************************************************/
r5932r5933
468468};
469469 
470470/***************************************************************************
471   
471
472472    Machine Drivers
473473 
474474****************************************************************************/
r5932r5933
480480   MDRV_CPU_PROGRAM_MAP(p8k_memmap)
481481   MDRV_CPU_IO_MAP(p8k_iomap)
482482 
483//   MDRV_MACHINE_START( p8000_8 )
483//  MDRV_MACHINE_START( p8000_8 )
484484   MDRV_MACHINE_RESET(p8k)
485485 
486486   /* peripheral hardware */
r5932r5933
517517   MDRV_CPU_ADD("maincpu", Z8000, XTAL_4MHz )   // actually z8001, appropriate changes pending
518518   MDRV_CPU_CONFIG(p8k_16_daisy_chain)
519519   MDRV_CPU_PROGRAM_MAP(p8k_16_memmap)
520//   MDRV_CPU_IO_MAP(p8k_16_iomap)
520//  MDRV_CPU_IO_MAP(p8k_16_iomap)
521521 
522//   MDRV_MACHINE_START( p8000_16 )
522//  MDRV_MACHINE_START( p8000_16 )
523523   MDRV_MACHINE_RESET(p8k_16)
524524 
525525   /* peripheral hardware */
src/mess/drivers/ac1.c
r5932r5933
2020   ADDRESS_MAP_UNMAP_HIGH
2121    AM_RANGE( 0x0000, 0x07ff ) AM_ROM  // Monitor
2222    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
2424    AM_RANGE( 0x1800, 0x1fff ) AM_RAM  // RAM
2525ADDRESS_MAP_END
2626
r5932r5933
2828   ADDRESS_MAP_UNMAP_HIGH
2929    AM_RANGE( 0x0000, 0x07ff ) AM_ROM  // Monitor
3030    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
3232    AM_RANGE( 0x1800, 0xffff ) AM_RAM  // RAM
3333ADDRESS_MAP_END
3434
r5932r5933
104104   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl")  PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL)
105105   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
106106   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)
108108INPUT_PORTS_END
109109
110110/* Machine driver */
r5932r5933
133133   MDRV_VIDEO_UPDATE(ac1)
134134MACHINE_DRIVER_END
135135
136static MACHINE_DRIVER_START( ac1_32 )   
136static MACHINE_DRIVER_START( ac1_32 )
137137   MDRV_IMPORT_FROM( ac1 )
138   
138
139139   MDRV_CPU_MODIFY("maincpu")
140140   MDRV_CPU_PROGRAM_MAP(ac1_32_mem)
141   
141
142142   MDRV_SCREEN_MODIFY("screen")
143143   MDRV_SCREEN_SIZE(64*6, 32*8)
144144   MDRV_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1)
145145   MDRV_VIDEO_UPDATE(ac1_32)
146146MACHINE_DRIVER_END
147   
147
148148/* ROM definition */
149149ROM_START( ac1 )
150150   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
151151   ROM_SYSTEM_BIOS( 0, "v1", "Version 3.1 (orig)" )
152152   ROMX_LOAD( "mon_v31_16.bin",  0x0000, 0x0800, CRC(1ba65e4d) SHA1(3382b8d03f31166a56aea49fd1ec1e82a7108300), ROM_BIOS(1))
153153   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
156156   ROM_LOAD( "minibasic.bin",   0x0800, 0x0800, CRC(06782639) SHA1(3fd57b3ae3f538374b0d794d8aa15d06bcaaddd8))
157157   ROM_REGION(0x0800, "gfx1",0)
158158   // 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))
160160   ROM_COPY("gfx1", 0x0000, 0x0200, 0x0200)
161161   ROM_COPY("gfx1", 0x0000, 0x0400, 0x0200)
162162   ROM_COPY("gfx1", 0x0000, 0x0600, 0x0200)
r5932r5933
165165ROM_START( ac1_32 )
166166   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
167167   ROM_LOAD( "mon_v31_32.bin",  0x0000, 0x0800, CRC(bea78b1a) SHA1(8a3e2ac2033aa0bb016be742cfea7e4b09c0813b))
168   // from Funkamateur 01/85
168   // from Funkamateur 01/85
169169   ROM_LOAD( "minibasic.bin",   0x0800, 0x0800, CRC(06782639) SHA1(3fd57b3ae3f538374b0d794d8aa15d06bcaaddd8))
170170   ROM_REGION(0x0800, "gfx1",0)
171171   ROM_SYSTEM_BIOS( 0, "128", "128 chars" )
r5932r5933
179179
180180ROM_START( ac1scch )
181181   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
182   ROM_SYSTEM_BIOS( 0, "v7", "Version 7" )   
182   ROM_SYSTEM_BIOS( 0, "v7", "Version 7" )
183183   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" )
185185   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" )
187187   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)
191191   ROM_LOAD ("zg_scch.bin", 0x0000, 0x0800, CRC(fbfaf5da) SHA1(667568c5909e9a17675cf09dfbce2fc090c420ab))
192192ROM_END
193193
src/mess/drivers/sord.c
r5932r5933
1717    Kevin Thacker [MESS driver]
1818
1919
20   TODO:
20    TODO:
2121
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
2727
2828 ******************************************************************************/
2929
r5932r5933
590590
591591   MDRV_QUANTUM_TIME(HZ(1200))
592592   MDRV_MACHINE_RESET(sord_m5_fd5)
593   
593
594594   MDRV_FLOPPY_4_DRIVES_ADD(sordm5_floppy_config)
595595MACHINE_DRIVER_END
596596
src/mess/drivers/bw12.c
r5932r5933
11/***************************************************************************
2   
2
33    Bondwell 12/14
44
55    12/05/2009 Skeleton driver.
66
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
2020
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
2323
2424****************************************************************************/
2525
r5932r5933
4040
4141/*
4242
43   TODO:
43    TODO:
4444
45   - Osborne 1 DD disk format
46   - floppy motor off timer
45    - Osborne 1 DD disk format
46    - floppy motor off timer
4747
4848*/
4949
r5932r5933
110110      /* trigger floppy motor off NE556 timer */
111111      /*
112112
113         R18 = RES_K(100)
114         C11 = CAP_U(4.7)
113            R18 = RES_K(100)
114            C11 = CAP_U(4.7)
115115
116      */
116        */
117117      timer_adjust_oneshot(state->floppy_motor_off_timer, attotime_zero, 0);
118118   }
119119}
r5932r5933
218218static INPUT_PORTS_START( bw12 )
219219   /*
220220
221     KB3600 PRO2 Keyboard matrix
221      KB3600 PRO2 Keyboard matrix
222222
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      ----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
244244
245   */
245    */
246246
247247   PORT_START("X0")
248248   PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
r5932r5933
380380      {
381381         int x = (column * 8) + bit;
382382         int color = BIT(data, 7);
383           
383
384384         *BITMAP_ADDR16(bitmap, y, x) = color;
385385
386386         data <<= 1;
r5932r5933
419419
420420   mc6845_update(state->mc6845, bitmap, cliprect);
421421
422   return 0;   
422   return 0;
423423}
424424
425425/* NEC765 Interface */
r5932r5933
465465static READ8_DEVICE_HANDLER( bw12_pia6821_pa_r )
466466{
467467   /*
468     
469      bit      description
470468
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
479470
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
482482   bw12_state *state = device->machine->driver_data;
483   
483
484484   UINT8 data = 0;
485485
486486   data |= centronics_busy_r(state->centronics);
r5932r5933
524524   {
525525      /* keyboard shift clock */
526526      driver_state->key_shift++;
527     
527
528528      if (driver_state->key_shift < 10)
529529      {
530530         driver_state->key_sin = driver_state->key_data[driver_state->key_shift];
r5932r5933
689689
690690   /* allocate floppy motor off timer */
691691   state->floppy_motor_off_timer = timer_alloc(machine, floppy_motor_off_tick, NULL);
692   
692
693693   /* setup memory banking */
694694   memory_configure_bank(machine, 1, 0, 1, memory_region(machine, Z80_TAG), 0);
695695   memory_configure_bank(machine, 1, 1, 1, mess_ram, 0);
r5932r5933
765765   /* basic machine hardware */
766766    MDRV_CPU_ADD(Z80_TAG, Z80, XTAL_16MHz/4)
767767    MDRV_CPU_PROGRAM_MAP(bw12_mem)
768    MDRV_CPU_IO_MAP(bw12_io)   
768    MDRV_CPU_IO_MAP(bw12_io)
769769
770770    MDRV_MACHINE_START(bw12)
771771    MDRV_MACHINE_RESET(bw12)
772   
772
773773    /* video hardware */
774774   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
775775   MDRV_SCREEN_REFRESH_RATE(60)
r5932r5933
785785    MDRV_VIDEO_UPDATE(bw12)
786786
787787   MDRV_MC6845_ADD(MC6845_TAG, MC6845, XTAL_16MHz/8, bw12_mc6845_interface)
788   
788
789789   /* sound hardware */
790790   MDRV_SPEAKER_STANDARD_MONO("mono")
791791
r5932r5933
801801
802802   /* printer */
803803   MDRV_CENTRONICS_ADD(CENTRONICS_TAG, bw12_centronics_intf)
804   
804
805805   MDRV_FLOPPY_2_DRIVES_ADD(bw12_floppy_config)
806806MACHINE_DRIVER_END
807807
r5932r5933
828828
829829/* System Drivers */
830830
831/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY                        FULLNAME      FLAGS */
831/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY                             FULLNAME        FLAGS */
832832COMP( 1984,   bw12,   0,      0,      bw12,    bw12,   0,      bw12,   "Bondwell International Limited",   "Bondwell 12",   GAME_SUPPORTS_SAVE )
833833COMP( 1984,   bw14,   bw12,   0,      bw12,   bw12,   0,      bw14,   "Bondwell International Limited",   "Bondwell 14",   GAME_SUPPORTS_SAVE )
src/mess/drivers/pentagon.c
r5932r5933
1515static const device_config* beta;
1616
1717static DIRECT_UPDATE_HANDLER( pentagon_direct )
18{   
18{
1919   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))
2222   {
23      if (pc >= 0x4000)
23      if (pc >= 0x4000)
2424      {
2525         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0;
2626         betadisk_disable(beta);
2727         memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
2828         memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14));
29      }   
29      }
3030   } else if (((pc & 0xff00) == 0x3d00) && (ROMSelection==1))
3131   {
3232      ROMSelection = 3;
33      if (beta->started)
33      if (beta->started)
3434         betadisk_enable(beta);
35     
36   }
37   if((address>=0x0000) && (address<=0x3fff))
38   {   
35
36   }
37   if((address>=0x0000) && (address<=0x3fff))
38   {
3939      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)
4242            direct->raw = direct->decrypted =  memory_region(space->machine, "beta:beta");
4343      } else {
4444         direct->raw = direct->decrypted =  memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14);
r5932r5933
5050}
5151
5252static void pentagon_update_memory(running_machine *machine)
53{   
53{
5454   spectrum_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14));
5555
5656   memory_set_bankptr(machine, 4, mess_ram + ((spectrum_128_port_7ffd_data & 0x07) * 0x4000));
5757
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   {
6060      /* GLUK */
6161      if (strcmp(machine->gamedrv->name, "pent1024")==0) {
6262         ROMSelection = 2;
r5932r5933
6464         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ;
6565      }
6666   }
67   else {   
67   else {
6868      /* ROM switching */
6969      ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ;
7070   }
r5932r5933
8585   pentagon_update_memory(space->machine);
8686}
8787
88static ADDRESS_MAP_START (pentagon_io, ADDRESS_SPACE_IO, 8)   
88static ADDRESS_MAP_START (pentagon_io, ADDRESS_SPACE_IO, 8)
8989   ADDRESS_MAP_UNMAP_HIGH
9090   AM_RANGE(0x001f, 0x001f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_status_r,betadisk_command_w) AM_MIRROR(0xff00)
9191   AM_RANGE(0x003f, 0x003f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_track_r,betadisk_track_w) AM_MIRROR(0xff00)
9292   AM_RANGE(0x005f, 0x005f) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_sector_r,betadisk_sector_w) AM_MIRROR(0xff00)
9393   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)
9595   AM_RANGE(0x00ff, 0x00ff) AM_DEVREADWRITE(BETA_DISK_TAG, betadisk_state_r, betadisk_param_w) AM_MIRROR(0xff00)
9696   AM_RANGE(0x4000, 0x4000) AM_WRITE(pentagon_port_7ffd_w)  AM_MIRROR(0x3ffd)
9797   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd)
r5932r5933
102102{
103103   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
104104   beta = devtag_get_device(machine, BETA_DISK_TAG);
105   
105
106106   memory_install_read8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK(1));
107107   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
108108
r5932r5933
111111      betadisk_clear_status(beta);
112112   }
113113
114   memory_set_direct_update_handler( space, pentagon_direct );
115   
114   memory_set_direct_update_handler( space, pentagon_direct );
115
116116   memset(mess_ram,0,128*1024);
117   
117
118118   /* Bank 5 is always in 0x4000 - 0x7fff */
119119   memory_set_bankptr(machine, 2, mess_ram + (5<<14));
120120
r5932r5933
123123
124124   spectrum_128_port_7ffd_data = 0;
125125
126   pentagon_update_memory(machine);   
126   pentagon_update_memory(machine);
127127}
128128
129129static MACHINE_DRIVER_START( pentagon )
r5932r5933
131131   MDRV_CPU_MODIFY("maincpu")
132132   MDRV_CPU_IO_MAP(pentagon_io)
133133   MDRV_MACHINE_RESET( pentagon )
134   
134
135135   MDRV_BETA_DISK_ADD(BETA_DISK_TAG)
136136MACHINE_DRIVER_END
137137
r5932r5933
151151   ROM_SYSTEM_BIOS(1, "v2", "Pentagon 128K 93")
152152   ROMX_LOAD("128tr93.rom",0x010000, 0x4000, CRC(08ad241c) SHA1(16daba547c644ef01ce76d2686ccfbff72e13dbe), ROM_BIOS(2))
153153   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)")
155155   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")
157157   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))
160160   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")
162162   ROMX_LOAD("128p-0.rom",  0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(6))
163163   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")
165165   ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(7))
166166   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")
168168   ROMX_LOAD("128p-0.rom", 0x010000, 0x4000, CRC(124ad9e0) SHA1(d07fcdeca892ee80494d286ea9ea5bf3928a1aca), ROM_BIOS(8))
169169   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")
171171    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")
174174     ROMX_LOAD( "zxvg-29-0.rom", 0x010000, 0x4000, CRC(3b66f433) SHA1(d21df9e7f1ee99d8b38c2e6a32727aac0f1d5dc6), ROM_BIOS(10))
175175     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")
177177     ROMX_LOAD( "zxvg-30-0.rom", 0x010000, 0x4000, CRC(533e0f26) SHA1(b5f157c5d0da414ec77e445fdc40b78450129709), ROM_BIOS(11))
178178     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")
180180     ROMX_LOAD( "zxvg-31-0.rom", 0x010000, 0x4000, CRC(76f43500) SHA1(1c7cd52894847668418876d55b93b213d89d92ee), ROM_BIOS(12))
181181     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")
183183     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")
186186     ROMX_LOAD("neos_512.rom", 0x010000, 0x4000, CRC(1657fa43) SHA1(647545f06257bce9b1919fcb86b2a49a21c851a7), ROM_BIOS(14))
187187   ROMX_LOAD("128p-1.rom",   0x014000, 0x4000, CRC(b96a36be) SHA1(80080644289ed93d71a1103992a154cc9802b2fa), ROM_BIOS(14))
188188   ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
r5932r5933
191191ROM_START(pent1024)
192192   ROM_REGION(0x01c000, "maincpu", ROMREGION_ERASEFF)
193193   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))
195195   ROM_SYSTEM_BIOS(0, "v1", "Gluk 6.3r")
196196   ROMX_LOAD( "gluk63r.rom",0x018000, 0x4000, CRC(ca321d79) SHA1(015eb96dafb273d4f4512c467e9b43c305fd1bc4), ROM_BIOS(1))
197197   ROM_SYSTEM_BIOS(1, "v2", "Gluk 5.2i")
r5932r5933
205205   ROM_SYSTEM_BIOS(5, "v6", "Gluk 5.5rr")
206206   ROMX_LOAD( "gluk55rr.rom",0x018000, 0x4000, CRC(6b60b818) SHA1(9d606275d17770c9341b33b43f40aee227078827), ROM_BIOS(6))
207207   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))
209209   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))
211211   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))
213213   ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
214214ROM_END
215215
src/mess/drivers/et3400.c
r5932r5933
3535
3636static MACHINE_DRIVER_START( et3400 )
3737    /* basic machine hardware */
38    MDRV_CPU_ADD("maincpu", M6800, XTAL_1MHz )
38    MDRV_CPU_ADD("maincpu", M6800, XTAL_1MHz )
3939    MDRV_CPU_PROGRAM_MAP(et3400_mem)
4040
4141    MDRV_MACHINE_RESET(et3400)
src/mess/drivers/pk8000.c
r5932r5933
11/***************************************************************************
2   
2
33        PK-8000
44
5      18/07/2009 Mostly working driver
5        18/07/2009 Mostly working driver
66        12/05/2009 Skeleton driver.
77
88****************************************************************************/
r5932r5933
2323   return devtag_get_device(machine, "cassette");
2424}
2525
26static void pk8000_set_bank(running_machine *machine,UINT8 data)
27{
26static void pk8000_set_bank(running_machine *machine,UINT8 data)
27{
2828   UINT8 *rom = memory_region(machine, "maincpu");
2929   UINT8 block1 = data & 3;
3030   UINT8 block2 = (data >> 2) & 3;
3131   UINT8 block3 = (data >> 4) & 3;
3232   UINT8 block4 = (data >> 6) & 3;
33   
33
3434   switch(block1) {
3535      case 0:
3636            memory_set_bankptr(machine, 1, rom + 0x10000);
r5932r5933
3838            break;
3939      case 1: break;
4040      case 2: break;
41      case 3:           
41      case 3:
4242            memory_set_bankptr(machine, 1, mess_ram);
4343            memory_set_bankptr(machine, 5, mess_ram);
4444            break;
4545   }
46   
46
4747   switch(block2) {
48      case 0:           
48      case 0:
4949            memory_set_bankptr(machine, 2, rom + 0x14000);
5050            memory_set_bankptr(machine, 6, mess_ram + 0x4000);
5151            break;
r5932r5933
7979            memory_set_bankptr(machine, 4, mess_ram + 0xc000);
8080            memory_set_bankptr(machine, 8, mess_ram + 0xc000);
8181            break;
82   }                 
82   }
8383}
8484static WRITE8_DEVICE_HANDLER(pk8000_80_porta_w)
8585{
r5932r5933
9797
9898static WRITE8_DEVICE_HANDLER(pk8000_80_portc_w)
9999{
100   keyboard_line = data & 0x0f;     
101     
100   keyboard_line = data & 0x0f;
101
102102   speaker_level_w(devtag_get_device(device->machine, "speaker"), BIT(data,7));
103     
103
104104   cassette_change_state(cassette_device_image(device->machine),
105105                  (BIT(data,4)) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
106106                  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);
108108}
109109
110110static I8255A_INTERFACE( pk8000_ppi8255_interface_1 )
r5932r5933
118118};
119119
120120static READ8_DEVICE_HANDLER(pk8000_84_porta_r)
121{   
121{
122122   return pk8000_video_mode;
123123}
124124
125125static WRITE8_DEVICE_HANDLER(pk8000_84_porta_w)
126{   
126{
127127   pk8000_video_mode = data;
128128}
129129
130130static WRITE8_DEVICE_HANDLER(pk8000_84_portc_w)
131{   
131{
132132   pk8000_video_enable = BIT(data,4);
133133}
134134static I8255A_INTERFACE( pk8000_ppi8255_interface_2 )
r5932r5933
166166   ADDRESS_MAP_UNMAP_HIGH
167167   AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("ppi8255_1", i8255a_r, i8255a_w)
168168   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)
170170   AM_RANGE(0x8c, 0x8c) AM_READ(pk8000_joy_1_r)
171171   AM_RANGE(0x8d, 0x8d) AM_READ(pk8000_joy_2_r)
172172   AM_RANGE(0x90, 0x90) AM_READWRITE(pk8000_text_start_r,pk8000_text_start_w)
r5932r5933
176176   AM_RANGE(0xa0, 0xbf) AM_READWRITE(pk8000_color_r,pk8000_color_w)
177177ADDRESS_MAP_END
178178
179/*    Input ports */
179/*  Input ports */
180180static INPUT_PORTS_START( pk8000 )
181181   PORT_START("LINE0")
182182      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
r5932r5933
195195      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
196196      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE)
197197      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)
199199   PORT_START("LINE2")
200200      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
201201      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("|") PORT_CODE(KEYCODE_BACKSLASH)
r5932r5933
204204      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS)
205205      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_MINUS_PAD)
206206      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)
208208   PORT_START("LINE3")
209209      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
210210      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
r5932r5933
213213      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
214214      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
215215      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)
217217   PORT_START("LINE4")
218218      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
219219      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
r5932r5933
222222      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
223223      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
224224      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)
226226   PORT_START("LINE5")
227227      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
228228      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
r5932r5933
231231      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
232232      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
233233      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)
235235   PORT_START("LINE6")
236236      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rg") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
237237      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Upr") PORT_CODE(KEYCODE_LCONTROL)
r5932r5933
240240      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("???") PORT_CODE(KEYCODE_LALT)
241241      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1)
242242      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)
244244   PORT_START("LINE7")
245245      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4)
246246      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5)
r5932r5933
249249      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_F12)
250250      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("VSh") PORT_CODE(KEYCODE_BACKSPACE)
251251      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)
253253   PORT_START("LINE8")
254254      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Probel") PORT_CODE(KEYCODE_SPACE)
255255      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Cls") PORT_CODE(KEYCODE_HOME)
r5932r5933
258258      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT)
259259      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP)
260260      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)
262262   PORT_START("LINE9")
263263      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up-Left") PORT_CODE(KEYCODE_7_PAD)
264264      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down-Right") PORT_CODE(KEYCODE_3_PAD)
r5932r5933
270270      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
271271   PORT_START("JOY1")
272272      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)
274274      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_CATEGORY(10) PORT_PLAYER(1)
275275      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_CATEGORY(10) PORT_PLAYER(1)
276276      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CATEGORY(10) PORT_PLAYER(1)
r5932r5933
279279      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
280280   PORT_START("JOY2")
281281      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)
283283      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_CATEGORY(10) PORT_PLAYER(2)
284284      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_CATEGORY(10) PORT_PLAYER(2)
285285      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CATEGORY(10) PORT_PLAYER(2)
r5932r5933
294294}
295295
296296static IRQ_CALLBACK(pk8000_irq_callback)
297{   
297{
298298   return 0xff;
299}
299}
300300
301301
302static MACHINE_RESET(pk8000)
302static MACHINE_RESET(pk8000)
303303{
304   pk8000_set_bank(machine,0);   
304   pk8000_set_bank(machine,0);
305305   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), pk8000_irq_callback);
306306}
307307
r5932r5933
326326    /* basic machine hardware */
327327    MDRV_CPU_ADD("maincpu",8080, 1780000)
328328    MDRV_CPU_PROGRAM_MAP(pk8000_mem)
329    MDRV_CPU_IO_MAP(pk8000_io)   
329    MDRV_CPU_IO_MAP(pk8000_io)
330330    MDRV_CPU_VBLANK_INT("screen", pk8000_interrupt)
331331
332332    MDRV_MACHINE_RESET(pk8000)
333   
333
334334    /* video hardware */
335335    MDRV_SCREEN_ADD("screen", RASTER)
336336    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
343343
344344    MDRV_VIDEO_START(pk8000)
345345    MDRV_VIDEO_UPDATE(pk8000)
346   
346
347347    MDRV_I8255A_ADD( "ppi8255_1", pk8000_ppi8255_interface_1 )
348348    MDRV_I8255A_ADD( "ppi8255_2", pk8000_ppi8255_interface_2 )
349   
349
350350    /* audio hardware */
351351   MDRV_SPEAKER_STANDARD_MONO("mono")
352352   MDRV_SOUND_ADD("speaker", SPEAKER, 0)
353353   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
354354   MDRV_SOUND_WAVE_ADD("wave", "cassette")
355355   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
356       
356
357357    MDRV_CASSETTE_ADD( "cassette", pk8000_cassette_config )
358358MACHINE_DRIVER_END
359359
src/mess/drivers/concept.c
r5932r5933
5757
5858static const mm58274c_interface concept_mm58274c_interface =
5959{
60   0,   /*    mode 24*/
60   0,   /* mode 24*/
6161   1   /*  first day of week */
6262};
6363
r5932r5933
140140   /* no sound? */
141141
142142   MDRV_HARDDISK_ADD( "harddisk1" )
143   
143
144144   /* rtc */
145145   MDRV_MM58274C_ADD("mm58274c", concept_mm58274c_interface)
146146
147147   /* via */
148148   MDRV_VIA6522_ADD("via6522_0", 1022750, concept_via6522_intf)
149   
149
150150   MDRV_WD179X_ADD("wd179x", concept_wd17xx_interface )
151   
151
152152   MDRV_FLOPPY_4_DRIVES_ADD(concept_floppy_config)
153153MACHINE_DRIVER_END
154154
src/mess/drivers/ti990_4.c
r5932r5933
255255   MDRV_SOUND_ADD("beep", BEEP, 0)
256256   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
257257#endif
258   MDRV_FLOPPY_4_DRIVES_ADD(ti990_4_floppy_config)   
258   MDRV_FLOPPY_4_DRIVES_ADD(ti990_4_floppy_config)
259259
260260MACHINE_DRIVER_END
261261
src/mess/drivers/msx.c
r5932r5933
415415
416416These keys corresponds to the following symbols
417417
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*  |  _    |  _    |  < >  |  / ?  |
423423
424424* DK = "Dead Key"
425425Notice that 'expert' input_ports covers both versions 1.0 and 1.1.
r5932r5933
10761076   MDRV_CASSETTE_ADD( "cassette", msx_cassette_config )
10771077
10781078   MDRV_WD179X_ADD("wd179x", msx_wd17xx_interface )
1079   
1079
10801080   MDRV_FLOPPY_2_DRIVES_ADD(msx_floppy_config)
1081   
1081
10821082   MDRV_IMPORT_FROM(msx_cartslot)
10831083MACHINE_DRIVER_END
10841084
r5932r5933
11511151   MDRV_WD179X_ADD("wd179x", msx_wd17xx_interface )
11521152
11531153   MDRV_FLOPPY_2_DRIVES_ADD(msx_floppy_config)
1154   
1154
11551155   MDRV_IMPORT_FROM(msx_cartslot)
11561156MACHINE_DRIVER_END
11571157
r5932r5933
21282128   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
21292129   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x10000, 0x0000)   /* 64KB RAM */
21302130MSX_LAYOUT_END
2131 
2132 
2131
2132
21332133/********************************  MSX 2 **********************************/
21342134
21352135/* MSX2 */
r5932r5933
33033303
33043304MSX_LAYOUT_INIT (hx23)
33053305   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 */
33073307   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
33083308   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
33093309   MSX_LAYOUT_SLOT (3, 0, 0, 2, RAM, 0x8000, 0x0000)   /* 32KB RAM */
src/mess/drivers/vt100.c
r5932r5933
4949// 7 - Keyboard TBMT H
5050static READ8_HANDLER(vt100_flags_r)
5151{
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;
5555   return retVal;
5656}
5757
r5932r5933
6060static TIMER_CALLBACK(keyboard_callback)
6161{
6262   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",
6666                                 "LINEC", "LINED", "LINEE", "LINEF" };
6767   UINT8 code;
6868   if (vt100_key_scan == 1) {
69      for(i = 0; i < 16; i++)
69      for(i = 0; i < 16; i++)
7070      {
7171         code =    input_port_read(machine, keynames[i]);
7272         if (code!=0xff) {
r5932r5933
8080
8181static WRITE8_HANDLER(vt100_keyboard_w)
8282{
83   
83
8484   const device_config *speaker = devtag_get_device(space->machine, "speaker");
85   
85
8686   output_set_value("online_led",BIT(data,5) ? 0 : 1);
8787   output_set_value("local_led", BIT(data,5));
8888   output_set_value("locked_led",BIT(data,4) ? 0 : 1);
8989   output_set_value("l1_led",      BIT(data,3) ? 0 : 1);
9090   output_set_value("l2_led",      BIT(data,2) ? 0 : 1);
9191   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);
9393   vt100_key_scan = BIT(data,6);
9494   speaker_level_w(speaker, BIT(data,7));
9595}
r5932r5933
100100}
101101static WRITE8_HANDLER(vt100_baud_rate_w)
102102{
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,
104104      1800, 2000, 2400, 3600, 4800, 9600, 19200 };
105   
105
106106   vt100_send_baud_rate = baud_rate[(data >>4) & 0x0f];
107107   vt100_recv_baud_rate = baud_rate[data & 0x0f];
108108}
r5932r5933
113113
114114static ADDRESS_MAP_START( vt100_io , ADDRESS_SPACE_IO, 8)
115115   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
119119   AM_RANGE (0x02, 0x02) AM_WRITE(vt100_baud_rate_w)
120120   // 0x22 Modem buffer
121   // AM_RANGE (0x22, 0x22)
121   // AM_RANGE (0x22, 0x22)
122122   // 0x42 Flags buffer
123123   AM_RANGE (0x42, 0x42) AM_READ(vt100_flags_r)
124124   // 0x42 Brightness D/A latch
r5932r5933
134134   // 0xC2 Video processor DC011
135135   AM_RANGE (0xc2, 0xc2) AM_DEVWRITE("vt100_video", dc011_w)
136136   // 0xE2 Graphics port
137   // AM_RANGE (0xe2, 0xe2)
137   // AM_RANGE (0xe2, 0xe2)
138138ADDRESS_MAP_END
139139
140140/* Input ports */
141141static INPUT_PORTS_START( vt100 )
142142   PORT_START("LINE0")
143      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
143      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
144144      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT)
145145      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT)
146146      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP)
r5932r5933
168168      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 6") PORT_CODE(KEYCODE_6_PAD)
169169   PORT_START("LINE3")
170170      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)
172172      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_F6)
173173      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE)
174174      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Num 0") PORT_CODE(KEYCODE_0_PAD)
r5932r5933
269269//          A5 - vertical fequency
270270//          all other set to 1
271271static IRQ_CALLBACK(vt100_irq_callback)
272{   
272{
273273   UINT8 retVal = 0xc7 | (0x08 * vt100_keyboard_int) | (0x10 * vt100_receiver_int) | (0x20 * vt100_vertical_int);
274274   vt100_receiver_int = 0;
275275   return retVal;
276}
276}
277277
278static MACHINE_RESET(vt100)
278static MACHINE_RESET(vt100)
279279{
280280   vt100_keyboard_int = 0;
281281   vt100_receiver_int = 0;
r5932r5933
286286   output_set_value("l1_led",      1);
287287   output_set_value("l2_led",      1);
288288   output_set_value("l3_led",      1);
289   output_set_value("l4_led",      1);   
290   
289   output_set_value("l4_led",      1);
290
291291   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);
295295}
296296
297297static READ8_DEVICE_HANDLER (vt100_read_video_ram_r )
r5932r5933
301301
302302static WRITE8_DEVICE_HANDLER (vt100_clear_video_interrupt)
303303{
304   vt100_vertical_int = 0;   
304   vt100_vertical_int = 0;
305305}
306306
307307static const vt_video_interface vt100_video_interface = {
r5932r5933
327327   MDRV_CPU_VBLANK_INT("screen", vt100_vertical_interrupt)
328328
329329   MDRV_MACHINE_RESET(vt100)
330   
330
331331    /* video hardware */
332332   MDRV_SCREEN_ADD("screen", RASTER)
333333   MDRV_SCREEN_REFRESH_RATE(60)
r5932r5933
341341   MDRV_DEFAULT_LAYOUT( layout_vt100 )
342342   MDRV_VIDEO_START(generic_bitmapped)
343343   MDRV_VIDEO_UPDATE(vt100)
344   
344
345345   MDRV_VT100_VIDEO_ADD("vt100_video", vt100_video_interface)
346   
346
347347   /* audio hardware */
348348   MDRV_SPEAKER_STANDARD_MONO("mono")
349349   MDRV_SOUND_ADD("speaker", SPEAKER, 0)
r5932r5933
354354 * VT100 - 1978 base model. the 'later' rom is from 1979 or 1980.
355355 *    The vt100 had a whole series of -XX models branching off of it; the
356356       ones I know of are described here, as well as anything special about
357      them:
357       them:
358358 *    VT100-AA - standard model with 120vac cable \__voltage can be switched
359359 *    VT100-AB - standard model with 240vac cable /  inside any VT100 unit
360360 *    VT100-W* - word processing series:
r5932r5933
396396   have the normal vt100 romset variant, and also can have the multiple word
397397   processing variations (which use the same roms as the vt100 ones do).
398398 * 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
400400   (for simple chart-type line-compare-made raster graphics using some built
401401   in functions), AVO optional; was intended for use on the MINC analog data
402402   acquisition computer.
r5932r5933
415415   AVO character rom set. Has its own base firmware roms which support block
416416   serial mode.
417417 * vt180 - 1980 vt10x (w/vt100 expansion backplane) with a z80 daughterboard
418   installed;
418   installed;
419419   The daughterboard has two roms on it: 23-017e3-00 and 23-021e3-00
420420   (both are 0x1000 long, 2332 mask roms)
421421 * 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;
423423   very little info so far, more research needed
424424   see vk100.c for current driver for this
425   
425
426426 * Upgrade kits for vt1xx:
427427 * 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
429429              this board if needed)
430430 * VT1xx-AC : STP serial printer board (includes a special romset)
431431 * VT1xx-CA : p/n 5413206? 20ma current loop interface pcb for vt101/vt102/vt131
432432 * VT1xx-CB or CL: GPO "ReGIS" board vt100->vt125 upgrade kit (p/n 5414275 paddle board and 5414277 gpo board)
433
433
434434 * Info about mask roms and other nasties:
435435 * A normal 2716 rom has pin 18: /CE; pin 20: /OE; pin 21: VPP (acts as CE2)
436436 * The vt100 23-031e2/23-061e2, 23-032e2, 23-033e2, and 23-034e2 mask roms
r5932r5933
451451       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.
452452 * The optional AVO character set roms (see below) have: pin 18: /CS2*; pin 20: /CS1; pin 21: CS3 hence they match a normal 2716
453453   *(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
456456   and http://vt100.net/dec/ek-vt1ac-ug-002.pdf )
457457   at least eight of these AVO roms were made, and are used as such:
458458 * No roms - normal vt100 system with AVO installed
r5932r5933
487487// 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)
488488// NOTE: according to dunnington's ROMList, this is actually the VT132 romset, but I'm not convinced.
489489   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)
494494
495495   ROM_REGION(0x1000, "gfx1", 0)
496496   ROM_LOAD( "23-018e2-00.e4", 0x0000, 0x0800, BAD_DUMP CRC(6958458b) SHA1(103429674fc01c215bbc2c91962ae99231f8ae53)) // probably correct but needs redump
r5932r5933
499499
500500/*
501501ROM_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
503503// which is only used when the STP 'printer port expansion' card is installed into the terminal board.
504504// 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)
514514// 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.
515515// 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.
516516// 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
526526ROM_END
527527*/
528528
529529ROM_START( vt103 ) // This is from the schematics at http://www.bitsavers.org/pdf/dec/terminal/vt103/MP00731_VT103_Aug80.pdf
530530// 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
532532// DEC TU58 dual 256k tape drive integrated; It was intended that you would put an LSI-11 cpu card in there, which
533533// Would talk to the terminal as its input/output device. Several LSI-11 cpu cards were available?
534534   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
r5932r5933
563563   ROM_LOAD_OPTIONAL( "23-094e2-00.e9", 0x0800, 0x0800, NO_DUMP) // optional (comes default with some models) alternate character set rom
564564ROM_END
565565
566ROM_START( vt110 )
566ROM_START( vt110 )
567567// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a
568568// DECDataway DPM01 board, which adds 4 or 5 special network-addressable 50ohm? current loop serial lines
569569// and may add its own processor and ram to control them. see http://bitsavers.org/pdf/dec/terminal/EK-VT110_UG-001_Dec78.pdf
r5932r5933
600600// does not have integrated STP or AVO populated
601601// 8085 based instead of 8080
602602   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)
604604   ROM_LOAD( "23-???e4-00.e71", 0x2000, 0x2000, NO_DUMP)
605605
606606   ROM_REGION(0x1000, "gfx1", 0)
r5932r5933
639639ROM_START( vt132 ) // This is from anecdotal evidence and vt100.net, as the vt132 schematics are not scanned
640640// VT100 board with ? roms, AVO, STP, custom firmware with block serial mode; dunnington insists these roms
641641// 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)
647647
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
651651ROM_END
652652*/
653ROM_START( vt180 )
653ROM_START( vt180 )
654654// This is the standard VT100 cpu board with the 'normal' roms (but later rev of eprom 0) populated but with a
655655// Z80 daughterboard added to the expansion slot, and replacing the STP adapter (STP roms are replaced with the normal set)
656656   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
r5932r5933
673673/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY   FULLNAME       FLAGS */
674674COMP( 1978, vt100,  0,       0,     vt100,     vt100,     0,       0,      "DEC",   "VT100",      GAME_NOT_WORKING)
675675COMP( 1978, vt100wp,  vt100, 0,     vt100,     vt100,     0,       0,      "DEC",   "VT100-Wx",      GAME_NOT_WORKING)
676//COMP( 1978, vt100stp,  vt100,       0,    vt100,     vt100,     0,       0,      "DEC",   "VT100 w/VT1xx-AC STP",      GAME_NOT_WORKING)
676//COMP( 1978, vt100stp,  vt100,       0,    vt100, vt100,     0,       0,    "DEC",   "VT100 w/VT1xx-AC STP",       GAME_NOT_WORKING)
677677COMP( 1981, vt101,  0,       0,     vt100,     vt100,     0,       0,      "DEC",   "VT101",      GAME_NOT_WORKING)
678678COMP( 1981, vt102,  vt101,   0,     vt100,     vt100,     0,       0,      "DEC",   "VT102",      GAME_NOT_WORKING)
679679COMP( 1979, vt103,  vt100,   0,     vt100,     vt100,     0,       0,      "DEC",   "VT103",      GAME_NOT_WORKING)
r5932r5933
681681COMP( 1978, vt110,  vt100,   0,     vt100,     vt100,     0,       0,      "DEC",   "VT110",      GAME_NOT_WORKING)
682682COMP( 1981, vt125,  vt100,   0,     vt100,     vt100,     0,       0,      "DEC",   "VT125",      GAME_NOT_WORKING)
683683COMP( 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,     0,       0,      "DEC",   "VT132",      GAME_NOT_WORKING)
684//COMP( 1979, vt132,  vt100,   0,    vt100,   vt100,    0,       0,    "DEC",   "VT132",      GAME_NOT_WORKING)
685685COMP( 1983, vt180,  vt100,   0,     vt100,   vt100,     0,       0,      "DEC",   "VT180",      GAME_NOT_WORKING)
src/mess/drivers/prof80.c
r5932r5933
11/*
22
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 (?)
66
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
99
1010*/
1111
1212/*
1313
14   TODO:
14    TODO:
1515
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
2929*/
3030
3131#include "driver.h"
r5932r5933
123123         {
124124            /* latch key data */
125125            keydata = ~prof80_keycodes[table][row][col];
126           
126
127127            if (state->keydata != keydata)
128128            {
129129               state->keydata = keydata;
r5932r5933
184184      default:
185185         memory_install_readwrite8_handler(program, start_addr, end_addr, 0, 0, SMH_BANK(bank + 1), SMH_UNMAP);
186186      }
187     
187
188188      //logerror("Segment %u address %04x-%04x block %u\n", bank, start_addr, end_addr, block);
189189   }
190190}
r5932r5933
298298{
299299   /*
300300
301      bit      description
301        bit     description
302302
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
311311
312   */
312    */
313313
314314   int fa = BIT(data, 7);
315315   int sa = (data >> 4) & 0x07;
r5932r5933
324324{
325325   /*
326326
327      bit      signal      description
327        bit     signal      description
328328
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
337337
338   */
338    */
339339
340340   prof80_state *state = space->machine->driver_data;
341341
r5932r5933
346346{
347347   /*
348348
349      bit      signal      description
349        bit     signal      description
350350
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
359359
360   */
360    */
361361
362362   prof80_state *state = space->machine->driver_data;
363363
r5932r5933
428428{
429429   /*
430430
431      bit      signal      description
431        bit     signal      description
432432
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
441441
442   */
442    */
443443
444444   prof80_state *state = space->machine->driver_data;
445445
r5932r5933
484484
485485static WRITE8_HANDLER( unio_ctrl_w )
486486{
487//   prof80_state *state = space->machine->driver_data;
487//  prof80_state *state = space->machine->driver_data;
488488
489//   int flag = BIT(data, 0);
489//  int flag = BIT(data, 0);
490490   int flad = (data >> 1) & 0x07;
491491
492492   switch (flad)
r5932r5933
525525ADDRESS_MAP_END
526526
527527static 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)
531531   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)
534534   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0xff00) AM_READ(gripc_r)
535535   AM_RANGE(0xc1, 0xc1) AM_MIRROR(0xff00) AM_READWRITE(gripd_r, gripd_w)
536536   AM_RANGE(0xd8, 0xd8) AM_MIRROR(0xff00) AM_WRITE(flr_w)
r5932r5933
550550static ADDRESS_MAP_START( grip_io, ADDRESS_SPACE_IO, 8 )
551551   ADDRESS_MAP_GLOBAL_MASK(0xff)
552552   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)
556556   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)
559559   AM_RANGE(0x16, 0x16) AM_WRITE(flash_w)
560//   AM_RANGE(0x17, 0x17) AM_WRITE(vol1_w)
560//  AM_RANGE(0x17, 0x17) AM_WRITE(vol1_w)
561561   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE(Z80STI_TAG, z80sti_r, z80sti_w)
562562   AM_RANGE(0x30, 0x30) AM_READWRITE(lrs_r, lrs_w)
563563   AM_RANGE(0x40, 0x40) AM_READ(stat_r)
r5932r5933
566566   AM_RANGE(0x53, 0x53) AM_DEVREAD(MC6845_TAG, mc6845_register_r)
567567   AM_RANGE(0x60, 0x60) AM_DEVWRITE("centronics", centronics_data_w)
568568   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)
577577ADDRESS_MAP_END
578578
579579static ADDRESS_MAP_START( grip5_mem, ADDRESS_SPACE_PROGRAM, 8 )
r5932r5933
585585static ADDRESS_MAP_START( grip5_io, ADDRESS_SPACE_IO, 8 )
586586   ADDRESS_MAP_GLOBAL_MASK(0xff)
587587   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)
591591   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)
596596   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE(Z80STI_TAG, z80sti_r, z80sti_w)
597597   AM_RANGE(0x30, 0x30) AM_READWRITE(lrs_r, lrs_w)
598598   AM_RANGE(0x40, 0x40) AM_READ(stat_r)
r5932r5933
602602   AM_RANGE(0x60, 0x60) AM_DEVWRITE("centronics", centronics_data_w)
603603   AM_RANGE(0x70, 0x73) AM_DEVREADWRITE(I8255A_TAG, i8255a_r, i8255a_w)
604604
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)
610610
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)
619619ADDRESS_MAP_END
620620
621621/* Input Ports */
r5932r5933
650650   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
651651   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
652652   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
653   
653
654654   PORT_START("ROW3")
655655   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
656656   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
r5932r5933
660660   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
661661   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
662662   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
663   
663
664664   PORT_START("ROW4")
665665   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
666666   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD)
r5932r5933
670670   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
671671   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
672672   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
673   
673
674674   PORT_START("ROW5")
675675   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
676676   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
r5932r5933
680680   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
681681   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
682682   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
683   
683
684684   PORT_START("ROW6")
685685   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
686686   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD)
r5932r5933
690690   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD)
691691   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
692692   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
693   
693
694694   PORT_START("ROW7")
695695   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
696696   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
r5932r5933
700700   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
701701   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
702702   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
703   
703
704704   PORT_START("ROW8")
705705   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
706706   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
r5932r5933
708708   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD)
709709   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK)
710710   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 )
713713
714714   PORT_START("ROW9")
715715   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
r5932r5933
881881   z80sti_i2_w(driver_state->z80sti, state);
882882}
883883
884static const mc6845_interface grip_mc6845_interface =
884static const mc6845_interface grip_mc6845_interface =
885885{
886886   SCREEN_TAG,
887887   8,
r5932r5933
947947{
948948   /*
949949
950        bit      description
950        bit     description
951951
952952        PA0     ECB bus
953953        PA1     ECB bus
r5932r5933
957957        PA5     ECB bus
958958        PA6     ECB bus
959959        PA7     ECB bus
960   
961   */
962960
961    */
962
963963   prof80_state *state = device->machine->driver_data;
964964
965965   return state->gripd;
r5932r5933
969969{
970970   /*
971971
972        bit      description
972        bit     description
973973
974974        PA0     ECB bus
975975        PA1     ECB bus
r5932r5933
979979        PA5     ECB bus
980980        PA6     ECB bus
981981        PA7     ECB bus
982   
983   */
984982
983    */
984
985985   prof80_state *state = device->machine->driver_data;
986986
987987   state->gripd = data;
r5932r5933
991991{
992992   /*
993993
994        bit      description
994        bit     description
995995
996996        PB0     Keyboard input
997997        PB1     Keyboard input
r5932r5933
10011001        PB5     Keyboard input
10021002        PB6     Keyboard input
10031003        PB7     Keyboard input
1004   
1005   */
10061004
1005    */
1006
10071007   prof80_state *state = device->machine->driver_data;
10081008
10091009   return state->keydata;
r5932r5933
10131013{
10141014   /*
10151015
1016        bit      signal      description
1016        bit     signal      description
10171017
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)
10281026
1027    */
1028
10291029   prof80_state *state = device->machine->driver_data;
10301030
10311031   /* keyboard interrupt */
r5932r5933
10571057{
10581058   /*
10591059
1060        bit      signal      description
1060        bit     signal      description
10611061
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
10721070
1071    */
1072
10731073   prof80_state *state = device->machine->driver_data;
10741074
10751075   return centronics_busy_r(state->centronics) << 3;
r5932r5933
12191219    MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 479)
12201220    MDRV_PALETTE_LENGTH(2)
12211221    MDRV_PALETTE_INIT(black_and_white)
1222
1222
12231223    MDRV_VIDEO_START(prof80)
12241224    MDRV_VIDEO_UPDATE(prof80)
12251225
r5932r5933
12331233
12341234   /* printer */
12351235   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
1236   
1236
12371237   MDRV_FLOPPY_4_DRIVES_ADD(prof80_floppy_config)
12381238MACHINE_DRIVER_END
12391239
r5932r5933
12421242ROM_START( prof80 )
12431243   ROM_REGION( 0x100000, Z80_TAG, 0 )
12441244   ROM_DEFAULT_BIOS( "v17" )
1245   
1245
12461246   ROM_SYSTEM_BIOS( 0, "v15", "v1.5" )
12471247   ROMX_LOAD( "prof80v15.z7", 0xf0000, 0x02000, CRC(8f74134c) SHA1(83f9dcdbbe1a2f50006b41d406364f4d580daa1f), ROM_BIOS(1) )
12481248   ROM_SYSTEM_BIOS( 1, "v16", "v1.6" )
src/mess/drivers/vectrex.c
r5932r5933
208208   /* via */
209209   MDRV_DEVICE_REMOVE("via6522_0")
210210   MDRV_VIA6522_ADD("via6522_0", 0, spectrum1_via6522_interface)
211   
211
212212   MDRV_DEVICE_REMOVE("cart")
213213MACHINE_DRIVER_END
214214
src/mess/drivers/hx20.c
r5932r5933
11/***************************************************************************
2   
2
33        Epson HX20
44
55        29/09/2009 Skeleton driver.
r5932r5933
1010#include "cpu/m6800/m6800.h"
1111
1212static 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
1414   AM_RANGE(0x8000, 0xffff) AM_ROM
1515ADDRESS_MAP_END
1616
r5932r5933
1919INPUT_PORTS_END
2020
2121
22static MACHINE_RESET(ehx20)
23{   
22static MACHINE_RESET(ehx20)
23{
2424}
2525
2626static VIDEO_START( ehx20 )
r5932r5933
3838    MDRV_CPU_PROGRAM_MAP(ehx20_mem)
3939
4040    MDRV_MACHINE_RESET(ehx20)
41   
41
4242    /* video hardware */
4343    MDRV_SCREEN_ADD("screen", RASTER)
4444    MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/dc.c
r5932r5933
1010    GD-ROM drive (modified ATAPI interface)
1111
1212            NTSC/N  NTSC/I   PAL/N   PAL/I   VGA
13       (x/240) (x/480) (x/240)  (x/480) (640x480)
13        (x/240) (x/480) (x/240)  (x/480) (640x480)
1414    VTOTAL   262     524      312     624    524
1515    HTOTAL   857     857      863     863    857
1616
r5932r5933
216216   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
217217
218218   MDRV_PALETTE_LENGTH(0x1000)
219   
219
220220   MDRV_VIDEO_START(dc)
221221   MDRV_VIDEO_UPDATE(dc)
222222
src/mess/drivers/lisa.c
r5932r5933
11/*********************************************************************
22
3   drivers/lisa.c
3    drivers/lisa.c
44
5   Experimental LISA driver
5    Experimental LISA driver
66
77    Raphael Nabet, 2000
88
r5932r5933
8686/*
8787static void lisa_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
8888{
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;
9292
93      default:                              sonydriv_device_getinfo(devclass, state, info); break;
94   }
93        default:                                        sonydriv_device_getinfo(devclass, state, info); break;
94    }
9595}
9696*/
9797
r5932r5933
143143   /* devices */
144144   MDRV_IWM_ADD("fdc", lisa2_fdc_interface)
145145   MDRV_FLOPPY_SONY_2_DRIVES_ADD(lisa_floppy_config)
146   
146
147147   /* via */
148148   MDRV_VIA6522_ADD("via6522_0", 500000, lisa_via6522_0_intf)
149149   MDRV_VIA6522_ADD("via6522_1", 500000, lisa_via6522_1_intf)
r5932r5933
155155   MDRV_CPU_MODIFY( "fdccpu" )
156156   MDRV_CPU_PROGRAM_MAP(lisa210_fdc_map)
157157
158   /* Lisa 2/10 and MacXL had a slightly different FDC interface */   
158   /* Lisa 2/10 and MacXL had a slightly different FDC interface */
159159   MDRV_IWM_MODIFY("fdc", lisa210_fdc_interface)
160160
161161   /* via */
r5932r5933
226226   /* European layout */
227227   PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("~  `") PORT_CODE(KEYCODE_BACKSLASH2)
228228   /* 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    */
235235#endif
236236   PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)            PORT_CHAR('p') PORT_CHAR('P')
237237   PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE)      PORT_CHAR(8)
r5932r5933
301301INPUT_PORTS_END
302302
303303   /* Note we're missing a whole bunch of lisa bootrom revisions; based on http://www.cs.dartmouth.edu/~woz/bootrom.pdf :
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. */
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. */
305305   /* 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     */
312312    /* 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.*/
313313   /* 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   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. */
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. */
315315   /* which systems used the 341-0193-A parallel interface card rom? */
316316
317317
318318ROM_START( lisa ) /* with twiggy drives, io40 i/o rom; technically any of the bootroms will work on this. */
319319   ROM_REGION16_BE(0x204000,"maincpu",0)   /* 68k rom and ram */
320320   ROM_DEFAULT_BIOS( "revh" )
321   
321
322322   ROM_SYSTEM_BIOS( 0, "revh", "LISA Bootrom Rev H (2/24/84)")
323323   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) */
324324   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) */
r5932r5933
334334   ROM_SYSTEM_BIOS( 3, "reve", "LISA Bootrom Rev E (10/20/83)")
335335   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) */
336336   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
338338   ROM_SYSTEM_BIOS( 4, "revd", "LISA Bootrom Rev D (5/12/83)")
339339   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) */
340340   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) */
r5932r5933
387387   ROM_SYSTEM_BIOS( 4, "rev3b", "LISA Bootrom Rev 3B (9/8/83)") /* Earliest lisa2 rom, prototype. */
388388   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) */
389389   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
391391   ROM_REGION(0x2000,"fdccpu",0)      /* 6504 RAM and ROM */
392392   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 */
393393
r5932r5933
427427   ROM_REGION(0x4000,"widget", 0)      /* Widget HDD controller */
428428   ROM_LOAD( "341-0288-a", 0x0000, 0x800, CRC(a26ef1c6) SHA1(5aaeb6ff7f7d4f7ce7c70402f75e82533635dda4)) /* 341-0288-A z8 mcu piggyback rom */
429429   ROM_LOAD( "341-0289-d", 0x2000, 0x2000, CRC(25e86e95) SHA1(72a346c2074d2256adde491b930023ebdcb5f51a)) /* 341-0289-D external rom on widget board */
430   
430
431431   ROM_REGION(0x100,"gfx1", 0)      /* video ROM (includes S/N) */
432432   ROM_LOAD( "vidstate.rom", 0x00, 0x100, CRC(75904783) SHA1(3b0023bd90f2ca1be0b099160a566b044856885d))
433433ROM_END
src/mess/drivers/aquarius.c
r5932r5933
33    Mattel Aquarius
44
55
6   TODO:
6    TODO:
77
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
1818
1919***************************************************************************/
2020
r5932r5933
5050***************************************************************************/
5151
5252/*
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.
6262*/
6363static READ8_HANDLER( cassette_r )
6464{
r5932r5933
6868
6969
7070/*
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.
7474*/
7575static WRITE8_HANDLER( cassette_w )
7676{
r5932r5933
8383
8484
8585/*
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:
8888
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    +++++                             +++++++++
9696*/
9797static READ8_HANDLER( vsync_r )
9898{
r5932r5933
102102
103103
104104/*
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.
108108*/
109109static WRITE8_HANDLER( mapper_w )
110110{
r5932r5933
112112
113113
114114/*
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.
118118*/
119119static READ8_HANDLER( printer_r )
120120{
r5932r5933
123123
124124
125125/*
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.
130130*/
131131static WRITE8_HANDLER( printer_w )
132132{
r5932r5933
134134
135135
136136/*
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:
139139
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.
146146*/
147147static READ8_HANDLER( keyboard_r )
148148{
r5932r5933
162162
163163
164164/*
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.
173173
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.
177177
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.
181181*/
182182static WRITE8_HANDLER( scrambler_w )
183183{
r5932r5933
239239ADDRESS_MAP_END
240240
241241static ADDRESS_MAP_START( aquarius_io, ADDRESS_SPACE_IO, 8 )
242//   AM_RANGE(0x7e, 0x7f) AM_MIRROR(0xff00) AM_READWRITE(modem_r, modem_w)
242//  AM_RANGE(0x7e, 0x7f) AM_MIRROR(0xff00) AM_READWRITE(modem_r, modem_w)
243243   AM_RANGE(0xf6, 0xf6) AM_MIRROR(0xff00) AM_DEVREADWRITE("ay8910", ay8910_r, ay8910_data_w)
244244   AM_RANGE(0xf7, 0xf7) AM_MIRROR(0xff00) AM_DEVWRITE("ay8910", ay8910_address_w)
245245   AM_RANGE(0xfc, 0xfc) AM_MIRROR(0xff00) AM_READWRITE(cassette_r, cassette_w)
r5932r5933
451451   MDRV_CPU_IO_MAP(aquarius_qd_io)
452452
453453   MDRV_DEVICE_REMOVE("cart")
454   
454
455455   MDRV_FLOPPY_2_DRIVES_ADD(aquarius_floppy_config)
456456MACHINE_DRIVER_END
457457
r5932r5933
514514/*    YEAR  NAME         PARENT    COMPAT  MACHINE      INPUT     INIT      CONFIG       COMPANY   FULLNAME                         FLAGS */
515515COMP( 1983, aquarius,    0,        0,      aquarius,    aquarius, aquarius, aquarius,    "Mattel", "Aquarius (NTSC)",               0 )
516516COMP( 1983, aquarius_qd, aquarius, 0,      aquarius_qd, aquarius, aquarius, aquarius, "Mattel", "Aquarius w/ Quick Disk (NTSC)", 0 )
517//COMP(   1984,   aquariu2,   aquarius,   0,      aquarius,   aquarius,   0,      aquarius,   "Mattel",   "Aquarius II",   GAME_NOT_WORKING )
517//COMP( 1984,   aquariu2,   aquarius,   0,      aquarius,   aquarius,   0,      aquarius,   "Mattel",   "Aquarius II",  GAME_NOT_WORKING )
src/mess/drivers/cgenie.c
r5932r5933
175175      PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT)         PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
176176      PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)         PORT_CHAR(' ')
177177
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)  */
181181   PORT_START("ROW7")
182182      PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
183183      PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Mod Sel") PORT_CODE(KEYCODE_LALT)  PORT_CHAR(UCHAR_MAMEKEY(F9))
r5932r5933
213213   /* FB/DF  2  [1] [4] [7] [*]  */
214214
215215   /* 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    */
220220
221   PORT_START("KP0")
221   PORT_START("KP0")
222222      PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [3]") PORT_CODE(KEYCODE_3_PAD)
223223      PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [6]") PORT_CODE(KEYCODE_6_PAD)
224224      PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [9]") PORT_CODE(KEYCODE_9_PAD)
r5932r5933
230230      PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [8]") PORT_CODE(KEYCODE_8_PAD)
231231      PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [0]") PORT_CODE(KEYCODE_0_PAD)
232232
233   PORT_START("KP2")
233   PORT_START("KP2")
234234      PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [1]") PORT_CODE(KEYCODE_1_PAD)
235235      PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [4]") PORT_CODE(KEYCODE_4_PAD)
236236      PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 1 [7]") PORT_CODE(KEYCODE_7_PAD)
r5932r5933
242242      PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [9]")
243243      PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [#]") PORT_CODE(JOYCODE_BUTTON1)
244244
245   PORT_START("KP4")
245   PORT_START("KP4")
246246      PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [2]") PORT_CODE(JOYCODE_BUTTON2)
247247      PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [5]") PORT_CODE(JOYCODE_BUTTON5)
248248      PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("Joy 2 [8]")
r5932r5933
406406      TRACKS([40])
407407      SECTORS([10])
408408      SECTOR_LENGTH([256])
409      FIRST_SECTOR_ID([1]))   
409      FIRST_SECTOR_ID([1]))
410410FLOPPY_OPTIONS_END
411411
412412static const floppy_config cgenie_floppy_config =
r5932r5933
490490
491491//
492492//   abbreviations used:
493//   GPL   Granules Per Lump
494//   GAT   Granule Allocation Table
493//   GPL    Granules Per Lump
494//   GAT    Granule Allocation Table
495495//   GATL GAT Length
496496//   GATM GAT Mask
497497//   DDGA Disk Directory Granule Allocation
498498typedef struct
499499{
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;
511511
512512static 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
525525};
526526
527527// basic-dsk is a disk image format which has the tracks and sectors
r5932r5933
531531//
532532DEVICE_IMAGE_LOAD( cgenie_floppy )
533533{
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;
541541
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;
545545
546   // determine image geometry
547   image_fseek(image, 0, SEEK_SET);
546    // determine image geometry
547    image_fseek(image, 0, SEEK_SET);
548548
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);
558558
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;
561561
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        }
583583
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);
587587
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;
598598
599         // calc sector offset
600         sector_offset = dir_sector + j;
599            // calc sector offset
600            sector_offset = dir_sector + j;
601601
602         // get track offset
603         track_offset = sector_offset / spt;
602            // get track offset
603            track_offset = sector_offset / spt;
604604
605         // calc track
606         track = track_offset / heads;
605            // calc track
606            track = track_offset / heads;
607607
608         // calc side
609         side = track_offset % heads;
608            // calc side
609            side = track_offset % heads;
610610
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;
613613
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        }
617617
618   }
619   return INIT_PASS;
618    }
619    return INIT_PASS;
620620}
621621*/
622622static SYSTEM_CONFIG_START(cgenie)
src/mess/drivers/lynx.c
r5932r5933
9191
9292   /* devices */
9393   MDRV_QUICKLOAD_ADD("quickload", lynx, "o", 0)
94   
94
9595   MDRV_IMPORT_FROM(lynx_cartslot)
9696MACHINE_DRIVER_END
9797
r5932r5933
173173   memory_write_byte(space, 0x1fc, start & 0xff);
174174   memory_write_byte(space, 0x1fd, start >> 8);
175175
176   lynx_crc_keyword(devtag_get_device(image->machine, "quickload"));
176   lynx_crc_keyword(devtag_get_device(image->machine, "quickload"));
177177
178178   cpu_set_reg(cpu, REG_GENPC, start);
179179
src/mess/drivers/specpls3.c
r5932r5933
11/***************************************************************************
22
3   NOTE: ****** Specbusy: press N, R, or E to boot *************
3    NOTE: ****** Specbusy: press N, R, or E to boot *************
44
55
66        Spectrum/Inves/TK90X etc. memory map:
r5932r5933
212212void spectrum_plus3_update_memory(running_machine *machine)
213213{
214214   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
215   
215
216216   if (spectrum_128_port_7ffd_data & 8)
217217   {
218218         logerror("+3 SCREEN 1: BLOCK 7\n");
r5932r5933
337337The function decodes the ports appropriately */
338338static ADDRESS_MAP_START (spectrum_plus3_io, ADDRESS_SPACE_IO, 8)
339339   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)
341341   AM_RANGE(0x001f, 0x001f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00)
342342   AM_RANGE(0x4000, 0x4000) AM_WRITE(spectrum_plus3_port_7ffd_w) AM_MIRROR(0x3ffd)
343343   AM_RANGE(0x8000, 0x8000) AM_DEVWRITE("ay8912", ay8910_data_w) AM_MIRROR(0x3ffd)
r5932r5933
350350static MACHINE_RESET( spectrum_plus3 )
351351{
352352   memset(mess_ram,0,128*1024);
353   
353
354354   /* Initial configuration */
355355   spectrum_128_port_7ffd_data = 0;
356356   spectrum_plus3_port_1ffd_data = 0;
r5932r5933
374374   MDRV_SCREEN_REFRESH_RATE(50.01)
375375
376376   MDRV_MACHINE_RESET( spectrum_plus3 )
377   
377
378378   MDRV_NEC765A_ADD("nec765", spectrum_plus3_nec765_interface)
379379   MDRV_FLOPPY_2_DRIVES_ADD(specpls3_floppy_config)
380380MACHINE_DRIVER_END
r5932r5933
424424   ROMX_LOAD("romb-en.rom",0x18000,0x8000, CRC(ef8d5d92) SHA1(983aa53aa76e25a3af123c896016bacf6829b72b), ROM_BIOS(1))
425425   ROM_SYSTEM_BIOS( 1, "sp", "Spanish" )
426426   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))
428428   ROM_CART_LOAD("cart", 0x10000, 0x4000, ROM_NOCLEAR | ROM_NOMIRROR | ROM_OPTIONAL)
429429ROM_END
430430
r5932r5933
460460SYSTEM_CONFIG_END
461461
462462
463/*    YEAR  NAME      PARENT    COMPAT  MACHINE         INPUT       INIT    CONFIG      COMPANY     FULLNAME */
463/*    YEAR  NAME      PARENT    COMPAT  MACHINE         INPUT       INIT    CONFIG      COMPANY     FULLNAME */
464464COMP( 1987, specpl2a, spec128,  0,      spectrum_plus3, spec_plus,   0,      specpls3,   "Amstrad plc",          "ZX Spectrum +2a" , 0 )
465465COMP( 1987, specpls3, spec128,  0,      spectrum_plus3, spec_plus,   0,      specpls3,   "Amstrad plc",          "ZX Spectrum +3" , 0 )
466466COMP( 2000, specpl3e, spec128,  0,      spectrum_plus3, spec_plus,   0,      specpls3,   "Amstrad plc",          "ZX Spectrum +3e" , GAME_COMPUTER_MODIFIED )
src/mess/drivers/x68k.c
r5932r5933
466466      x68k_sys.keyboard.headpos = 0;
467467//      mfp_trigger_irq(MFP_IRQ_RX_ERROR);
468468      current_vector[6] = 0x4b;
469//      cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x4b);
469//      cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x4b);
470470   }
471471}
472472
r5932r5933
637637   if(x68k_sys.mouse.bufferempty != 0)  // nothing to do if the mouse data buffer is empty
638638      return;
639639
640//   if((x68k_sys.ioc.irqstatus & 0xc0) != 0)
641//      return;
640//  if((x68k_sys.ioc.irqstatus & 0xc0) != 0)
641//      return;
642642
643643   // hard-code the IRQ vector for now, until the SCC code is more complete
644644   if((scc_get_reg_a(scc, 9) & 0x08) || (scc_get_reg_b(scc, 9) & 0x08))  // SCC reg WR9 is the same for both channels
r5932r5933
694694      UINT8 porta = input_port_read(device->machine,"md3b") & 0xff;
695695      UINT8 portb = (input_port_read(device->machine,"md3b") >> 8) & 0xff;
696696      if(x68k_sys.mdctrl.mux1 & 0x10)
697      {   
697      {
698698         return porta | 0x90;
699699      }
700700      else
701      {   
701      {
702702         return (portb & 0x60) | (porta & 0x03) | 0x90;
703703      }
704704   }
r5932r5933
707707      UINT8 porta = (input_port_read(device->machine,"md3b") >> 16) & 0xff;
708708      UINT8 portb = (input_port_read(device->machine,"md3b") >> 24) & 0xff;
709709      if(x68k_sys.mdctrl.mux2 & 0x20)
710      {   
710      {
711711         return porta | 0x90;
712712      }
713713      else
714      {   
714      {
715715         return (portb & 0x60) | (porta & 0x03) | 0x90;
716716      }
717717   }
r5932r5933
742742      UINT8 porta = input_port_read(device->machine,"md6b") & 0xff;
743743      UINT8 portb = (input_port_read(device->machine,"md6b") >> 8) & 0xff;
744744      UINT8 extra = input_port_read(device->machine,"md6b_extra") & 0x0f;
745     
745
746746      switch(x68k_sys.mdctrl.seq1)
747747      {
748748         case 1:
749749         default:
750750            if(x68k_sys.mdctrl.mux1 & 0x10)
751            {   
751            {
752752               return porta | 0x90;
753753            }
754754            else
755            {   
755            {
756756               return (portb & 0x60) | (porta & 0x03) | 0x90;
757757            }
758758         case 2:
759759            if(x68k_sys.mdctrl.mux1 & 0x10)
760            {   
760            {
761761               return porta | 0x90;
762762            }
763763            else
764            {   
764            {
765765               return (portb & 0x60) | 0x90;
766766            }
767767         case 3:
768768            if(x68k_sys.mdctrl.mux1 & 0x10)
769            {   
769            {
770770               return (porta & 0x60) | (extra & 0x0f) | 0x90;
771771            }
772772            else
773            {   
773            {
774774               return (portb & 0x60) | 0x9f;
775775            }
776776      }
r5932r5933
786786         case 1:
787787         default:
788788            if(x68k_sys.mdctrl.mux2 & 0x20)
789            {   
789            {
790790               return porta | 0x90;
791791            }
792792            else
793            {   
793            {
794794               return (portb & 0x60) | (porta & 0x03) | 0x90;
795795            }
796796         case 2:
797797            if(x68k_sys.mdctrl.mux2 & 0x20)
798            {   
798            {
799799               return porta | 0x90;
800800            }
801801            else
802            {   
802            {
803803               return (portb & 0x60) | 0x90;
804804            }
805805         case 3:
806806            if(x68k_sys.mdctrl.mux2 & 0x20)
807            {   
807            {
808808               return (porta & 0x60) | (extra & 0x0f) | 0x90;
809809            }
810810            else
811            {   
811            {
812812               return (portb & 0x60) | 0x9f;
813813            }
814814      }
r5932r5933
830830      UINT8 porta = input_port_read(device->machine,"xpd1lr") & 0xff;
831831      UINT8 portb = (input_port_read(device->machine,"xpd1lr") >> 8) & 0xff;
832832      if(x68k_sys.mdctrl.mux1 & 0x10)
833      {   
833      {
834834         return porta;
835835      }
836836      else
837      {   
837      {
838838         return portb | (porta & 0x60);
839839      }
840840   }
r5932r5933
843843      UINT8 porta = (input_port_read(device->machine,"xpd1lr") >> 16) & 0xff;
844844      UINT8 portb = (input_port_read(device->machine,"xpd1lr") >> 24) & 0xff;
845845      if(x68k_sys.mdctrl.mux2 & 0x20)
846      {   
846      {
847847         return porta;
848848      }
849849      else
850      {   
850      {
851851         return portb | (porta & 0x60);
852852      }
853853   }
r5932r5933
858858static READ8_DEVICE_HANDLER( ppi_port_a_r )
859859{
860860   int ctrl = input_port_read(device->machine,"ctrltype") & 0x0f;
861   
861
862862   switch(ctrl)
863863   {
864864      case 0x00:  // standard MSX/FM-Towns joystick
r5932r5933
873873      case 0x03:  // XPD-1LR
874874         return xpd1lr_r(device,1);
875875   }
876   
876
877877   return 0xff;
878878}
879879
880880static READ8_DEVICE_HANDLER( ppi_port_b_r )
881881{
882882   int ctrl = input_port_read(device->machine,"ctrltype") & 0xf0;
883   
883
884884   switch(ctrl)
885885   {
886886      case 0x00:  // standard MSX/FM-Towns joystick
r5932r5933
895895      case 0x30:  // XPD-1LR
896896         return xpd1lr_r(device,2);
897897   }
898   
898
899899   return 0xff;
900900}
901901
r5932r5933
919919   static UINT16 prev1;
920920   static UINT16 prev2;
921921   static UINT16 prevA;
922   
922
923923   ppi_port[2] = data;
924924   if((data & 0x0f) != (prevA & 0x0f))
925925   {
r5932r5933
929929      okim6258_set_divider(oki, (data >> 2) & 3);
930930   }
931931   prevA = data & 0x0f;
932   
932
933933   // The joystick enable bits also handle the multiplexer for various controllers
934934   x68k_sys.joy.joy1_enable = data & 0x10;
935935   x68k_sys.mdctrl.mux1 = data & 0x10;
r5932r5933
10171017      floppy_drive_set_ready_state(floppy_get_device(space->machine, 1),1,1);
10181018      floppy_drive_set_ready_state(floppy_get_device(space->machine, 2),1,1);
10191019      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//      }
10271027      logerror("FDC: Drive #%i: Drive selection set to %02x\n",data & 0x03,data);
10281028      break;
10291029   default:
r5932r5933
10371037   unsigned int ret;
10381038   int x;
10391039   const device_config *fdc = devtag_get_device(space->machine, "nec72065");
1040   
1040
10411041   switch(offset)
10421042   {
10431043   case 0x00:
r5932r5933
12621262
12631263/*static READ16_HANDLER( x68k_mfp_r )
12641264{
1265   const device_config *x68k_mfp = devtag_get_device(space->machine, MC68901_TAG);
1265    const device_config *x68k_mfp = devtag_get_device(space->machine, MC68901_TAG);
12661266
1267   return mc68901_register_r(x68k_mfp, offset);
1267    return mc68901_register_r(x68k_mfp, offset);
12681268}*/
12691269
12701270static READ16_HANDLER( x68k_mfp_r )
r5932r5933
15071507static READ16_HANDLER( x68k_sram_r )
15081508{
15091509   // 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;
15121512   if(offset == 0x08/2)
15131513      return mess_ram_size >> 16;  // RAM size
15141514   /*if(offset == 0x46/2)
r5932r5933
16491649       then access causes a bus error */
16501650   current_vector[2] = 0x02;  // bus error
16511651   current_irq_line = 2;
1652//   cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
1652//  cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
16531653   if(input_port_read(space->machine, "options") & 0x02)
16541654   {
16551655      offset *= 2;
r5932r5933
16661666       then access causes a bus error */
16671667   current_vector[2] = 0x02;  // bus error
16681668   current_irq_line = 2;
1669//   cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
1669//  cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
16701670   if(input_port_read(space->machine, "options") & 0x02)
16711671   {
16721672      offset *= 2;
r5932r5933
17551755   data &= ~(x68k_sys.crtc.vblank << 4);
17561756   data |= 0x23;  // GPIP5 is unused, always 1
17571757
1758//   mc68901_tai_w(mfp, x68k_sys.crtc.vblank);
1758//  mc68901_tai_w(mfp, x68k_sys.crtc.vblank);
17591759
17601760   return data;
17611761}
r5932r5933
17651765   static int prev;
17661766   if(prev == CLEAR_LINE && state == CLEAR_LINE)  // eliminate unnecessary calls to set the IRQ line for speed reasons
17671767      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;
17701770   cputag_set_input_line(device->machine, "maincpu", 6, state);
17711771   current_vector[6] = 0;
17721772   prev = state;
r5932r5933
18021802      logerror("SYS: IRQ acknowledged (vector=0x%02x, line = %i)\n",current_vector[6],irqline);
18031803      return current_vector[6];
18041804   }
1805   
1805
18061806   cputag_set_input_line_and_vector(device->machine, "maincpu",irqline,CLEAR_LINE,current_vector[irqline]);
18071807   if(irqline == 1)  // IOSC
18081808   {
r5932r5933
21012101
21022102   PORT_START("mouse3")  // Y-axis
21032103   PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
2104   
2104
21052105   // 3-button Megadrive gamepad
21062106   PORT_START("md3b")
21072107   PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 1 Up") PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(11)
r5932r5933
21392139   PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 A Button") PORT_CATEGORY(21)
21402140   PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_START ) PORT_PLAYER(2) PORT_NAME("MD Pad 2 Start Button") PORT_CATEGORY(21)
21412141   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CATEGORY(21)
2142   
2142
21432143   // 6-button Megadrive gamepad
21442144   PORT_START("md6b")
21452145   PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("MD Pad 1 Up") PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(12)
r5932r5933
22312231INPUT_PORTS_END
22322232
22332233static void x68k_load_proc(const device_config *image)
2234{   
2234{
22352235   if(x68k_sys.ioc.irqstatus & 0x02)
22362236   {
22372237      current_vector[1] = 0x61;
r5932r5933
23402340      floppy_install_unload_proc(floppy_get_device(machine, drive), x68k_unload_proc);
23412341      floppy_install_load_proc(floppy_get_device(machine, drive), x68k_load_proc);
23422342   }
2343   
2343
23442344   // reset CPU
23452345   device_reset(cputag_get_cpu(machine, "maincpu"));
23462346}
r5932r5933
24092409   x68k_vblank_irq = timer_alloc(machine, x68k_crtc_vblank_irq,NULL);
24102410   mouse_timer = timer_alloc(machine, x68k_scc_ack,NULL);
24112411   led_timer = timer_alloc(machine, x68k_led_callback,NULL);
2412   
2412
24132413   // Initialise timers for 6-button MD controllers
24142414   md_6button_init(machine);
24152415}
r5932r5933
24342434   MDRV_X68KHDC_ADD( "x68k_hdc" )
24352435
24362436   MDRV_SCC8530_ADD( "scc" )
2437   
2437
24382438   MDRV_RP5C15_ADD( "rp5c15" , rtc_intf)
24392439
24402440    /* video hardware */
r5932r5933
24662466
24672467   MDRV_NVRAM_HANDLER( generic_0fill )
24682468
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)
24712471MACHINE_DRIVER_END
24722472
24732473static SYSTEM_CONFIG_START(x68000)
src/mess/drivers/apexc.c
r5932r5933
2323
2424/*
2525    APEXC RAM loading/saving from cylinder image
26   
26
2727    Note that, in an actual APEXC, the RAM contents are not read from the cylinder :
2828    the cylinder IS the RAM.
2929
src/mess/drivers/ondra.c
r5932r5933
6161   PORT_START("LINE4")
6262      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
6363      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)
6565      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
6666      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UpCase") PORT_CODE(KEYCODE_LSHIFT)
6767      PORT_BIT(0xE0, IP_ACTIVE_LOW, IPT_UNUSED)
r5932r5933
100100      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON1)        PORT_CODE(KEYCODE_0_PAD) PORT_CODE(JOYCODE_BUTTON1)      PORT_PLAYER(1)
101101      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT)PORT_CODE(KEYCODE_6_PAD) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1)
102102      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)
105105INPUT_PORTS_END
106106
107107static INTERRUPT_GEN( ondra_interrupt )
r5932r5933
123123   MDRV_CPU_PROGRAM_MAP(ondra_mem)
124124   MDRV_CPU_IO_MAP(ondra_io)
125125   MDRV_CPU_VBLANK_INT("screen", ondra_interrupt)
126   
126
127127   MDRV_MACHINE_START( ondra )
128128   MDRV_MACHINE_RESET( ondra )
129129
r5932r5933
139139
140140   MDRV_VIDEO_START(ondra)
141141    MDRV_VIDEO_UPDATE(ondra)
142   
143   // sound hardware   
142
143   // sound hardware
144144   MDRV_SPEAKER_STANDARD_MONO("mono")
145145   MDRV_SOUND_WAVE_ADD("wave", "cassette")
146146   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 )
149149MACHINE_DRIVER_END
150150
151151static SYSTEM_CONFIG_START(ondra)
r5932r5933
180180
181181/* Driver */
182182
183/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT       INIT     CONFIG COMPANY          FULLNAME      FLAGS */
183/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT       INIT     CONFIG COMPANY          FULLNAME       FLAGS */
184184COMP( 1989, ondrat, 0,       0,      ondra,       ondra,       ondra,     ondra, "Tesla",       "Ondra",       0)
185185COMP( 1989, ondrav, ondrat,   0,      ondra,       ondra,       ondra,     ondra, "ViLi",           "Ondra ViLi",   0)
186186
src/mess/drivers/kaypro.c
r5932r5933
11/*************************************************************************************************
22
33
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.
99
10   There are 2 major problems preventing this driver from working
10    There are 2 major problems preventing this driver from working
1111
12   - MESS is not capable of conducting realtime serial communications between devices
12    - MESS is not capable of conducting realtime serial communications between devices
1313
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 ??
1919
2020
21   Things that need doing:
21    Things that need doing:
2222
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.
2525
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).
2929
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.
3232
3333
3434**************************************************************************************************/
r5932r5933
4949
5050/***********************************************************
5151
52   Address Maps
52    Address Maps
5353
5454************************************************************/
5555
r5932r5933
8585   AM_RANGE(0x1f, 0x1f) AM_READWRITE(kaypro2x_videoram_r,kaypro2x_videoram_w)
8686
8787   /* 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 */
9898   AM_RANGE(0x20, 0x87) AM_NOP
9999ADDRESS_MAP_END
100100
101101
102102/***************************************************************
103103
104   Interfaces
104    Interfaces
105105
106106****************************************************************/
107107
r5932r5933
136136
137137/***********************************************************
138138
139   Machine Driver
139    Machine Driver
140140
141141************************************************************/
142142static FLOPPY_OPTIONS_START(kayproii)
r5932r5933
205205   MDRV_Z80PIO_ADD( "z80pio_g", kayproii_pio_g_intf )
206206   MDRV_Z80PIO_ADD( "z80pio_s", kayproii_pio_s_intf )
207207   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro_sio_intf )   /* start at 300 baud */
208   
208
209209   MDRV_FLOPPY_2_DRIVES_ADD(kayproii_floppy_config)
210210MACHINE_DRIVER_END
211211
r5932r5933
245245   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
246246   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro_sio_intf )
247247   MDRV_Z80SIO_ADD( "z80sio_2x", 4800, kaypro_sio_intf )   /* extra sio for modem and printer */
248   
248
249249   MDRV_FLOPPY_2_DRIVES_ADD(kaypro2x_floppy_config)
250250MACHINE_DRIVER_END
251251
r5932r5933
256256
257257/***********************************************************
258258
259   Game driver
259    Game driver
260260
261261************************************************************/
262262
r5932r5933
343343   ROM_LOAD("81-817.u31",   0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) )
344344ROM_END
345345
346/*    YEAR  NAME      PARENT    COMPAT  MACHINE     INPUT    INIT    CONFIG       COMPANY  FULLNAME */
346/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT    INIT    CONFIG       COMPANY  FULLNAME */
347347COMP( 1982, kayproii,   0,        0,    kayproii, kay_kbd, 0,      0,   "Non Linear Systems",  "Kaypro II - 2/83" , 0 )
348COMP( 1983, kaypro4,    kayproii, 0,    kayproii, kay_kbd, 0,      0,    "Non Linear Systems",  "Kaypro 4 - 4/83" , GAME_NOT_WORKING ) // model 81-004
348COMP( 1983, kaypro4,    kayproii, 0,    kayproii, kay_kbd, 0,      0,    "Non Linear Systems",  "Kaypro 4 - 4/83" , GAME_NOT_WORKING ) // model 81-004
349349COMP( 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
350350COMP( 198?, omni2,      kayproii, 0,    omni2,    kay_kbd, 0,      0,    "Non Linear Systems",  "Omni II" , GAME_NOT_WORKING )
351351COMP( 1984, kaypro2x,   0,        0,    kaypro2x, kay_kbd, 0,      0,    "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING ) // model 81-025
src/mess/drivers/a51xx.c
r5932r5933
11/***************************************************************************
2   
2
33        A51xx
44
55        12/05/2009 Skeleton driver.
r5932r5933
1212static ADDRESS_MAP_START(a5120_mem, ADDRESS_SPACE_PROGRAM, 8)
1313   ADDRESS_MAP_UNMAP_HIGH
1414   AM_RANGE( 0x0000, 0x03ff ) AM_ROM
15   AM_RANGE( 0x0400, 0xffff ) AM_RAM   
15   AM_RANGE( 0x0400, 0xffff ) AM_RAM
1616ADDRESS_MAP_END
1717
1818static ADDRESS_MAP_START( a5120_io , ADDRESS_SPACE_IO, 8)
r5932r5933
2222static ADDRESS_MAP_START(a5130_mem, ADDRESS_SPACE_PROGRAM, 8)
2323   ADDRESS_MAP_UNMAP_HIGH
2424   AM_RANGE( 0x0000, 0x0fff ) AM_ROM
25   AM_RANGE( 0x1000, 0xffff ) AM_RAM   
25   AM_RANGE( 0x1000, 0xffff ) AM_RAM
2626ADDRESS_MAP_END
2727
2828static ADDRESS_MAP_START( a5130_io , ADDRESS_SPACE_IO, 8)
r5932r5933
3535INPUT_PORTS_END
3636
3737
38static MACHINE_RESET(a5120)
39{   
38static MACHINE_RESET(a5120)
39{
4040}
4141
4242static VIDEO_START( a5120 )
r5932r5933
5454INPUT_PORTS_END
5555
5656
57static MACHINE_RESET(a5130)
58{   
57static MACHINE_RESET(a5130)
58{
5959}
6060
6161static VIDEO_START( a5130 )
r5932r5933
7373    /* basic machine hardware */
7474    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
7575    MDRV_CPU_PROGRAM_MAP(a5120_mem)
76    MDRV_CPU_IO_MAP(a5120_io)   
76    MDRV_CPU_IO_MAP(a5120_io)
7777
7878    MDRV_MACHINE_RESET(a5120)
79   
79
8080    /* video hardware */
8181    MDRV_SCREEN_ADD("screen", RASTER)
8282    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
9595    /* basic machine hardware */
9696    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
9797    MDRV_CPU_PROGRAM_MAP(a5130_mem)
98    MDRV_CPU_IO_MAP(a5130_io)   
98    MDRV_CPU_IO_MAP(a5130_io)
9999
100100    MDRV_MACHINE_RESET(a5130)
101   
101
102102    /* video hardware */
103103    MDRV_SCREEN_ADD("screen", RASTER)
104104    MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/super80.c
r5932r5933
3232/**************************** MEMORY AND I/O MAPPINGS *****************************************************************/
3333
3434/* A read_byte or write_byte to unmapped memory crashes MESS, and UNMAP doesnt fix it.
35   This makes the H and E monitor commands show FF */
35    This makes the H and E monitor commands show FF */
3636static READ8_HANDLER( super80_read_ff ) { return 0xff; }
3737
3838static ADDRESS_MAP_START( super80_map, ADDRESS_SPACE_PROGRAM, 8 )
src/mess/drivers/geneve.c
r5932r5933
216216#include "machine/smartmed.h"
217217#include "devices/harddriv.h"
218218#include "machine/idectrl.h"
219#include "machine/smc92x4.h"
219#include "machine/smc92x4.h"
220220#include "machine/mm58274c.h"
221221
222222
r5932r5933
448448
449449static const mm58274c_interface geneve_mm58274c_interface =
450450{
451   1,   /*    mode 24*/
451   1,   /* mode 24*/
452452   0   /*  first day of week */
453453};
454454
455455
456456static const mm58274c_interface floppy_mm58274c_interface =
457457{
458   1,   /*    mode 24*/
458   1,   /* mode 24*/
459459   0   /*  first day of week */
460460};
461461
r5932r5933
505505   MDRV_IMPORT_FROM( smc92x4_hd )
506506
507507   MDRV_IDE_HARDDISK_ADD( "ide_harddisk" )
508   
508
509509   /* rtc */
510510   MDRV_MM58274C_ADD("mm58274c", geneve_mm58274c_interface)
511511   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
512   
512
513513   /* tms9901 */
514   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99)   
515   
514   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99)
515
516516   MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface )
517   
517
518518   MDRV_FLOPPY_4_DRIVES_ADD(geneve_floppy_config)
519   
519
520520   MDRV_SMARTMEDIA_ADD("smartmedia")
521   
521
522522   MDRV_TI99_4_RS232_CARD_ADD("rs232")
523523MACHINE_DRIVER_END
524524
src/mess/drivers/beta.c
r5932r5933
11/***************************************************************************
2   
2
33    Beta Computer
44
5   http://retro.hansotten.nl/index.php?page=beta-computer
5    http://retro.hansotten.nl/index.php?page=beta-computer
66
77****************************************************************************/
88
99/*
1010
11   TODO:
11    TODO:
1212
13   - write EPROM back to file
14   - fix display flickering
13    - write EPROM back to file
14    - fix display flickering
1515
1616*/
1717
r5932r5933
4545   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4')
4646   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7')
4747   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
5050   PORT_START("Q7")
5151   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
5252   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2')
5353   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5')
5454   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')
5555   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
5858   PORT_START("Q8")
5959   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
6060   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3')
6161   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6')
6262   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9')
6363   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
6666   PORT_START("Q9")
6767   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
6868   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
6969   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
7070   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
7171   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 )
7373
7474   PORT_START("SPECIAL")
7575   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_R) PORT_CHANGED(trigger_reset, 0)
r5932r5933
9090{
9191   /*
9292
93      bit      description
93        bit     description
9494
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
103103
104   */
104    */
105105
106106   beta_state *state = device->machine->driver_data;
107107
r5932r5933
113113   case 7: data &= input_port_read(device->machine, "Q7"); break;
114114   case 8: data &= input_port_read(device->machine, "Q8"); break;
115115   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)
118118      {
119119         data = memory_region(device->machine, EPROM_TAG)[state->eprom_addr & 0x7ff];
120120         popmessage("EPROM read %04x = %02x\n", state->eprom_addr & 0x7ff, data);
r5932r5933
128128{
129129   /*
130130
131      bit      description
131        bit     description
132132
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
141141
142   */
142    */
143143
144144   beta_state *state = device->machine->driver_data;
145145
146//   logerror("PA %02x\n", data);
146//  logerror("PA %02x\n", data);
147147
148148   /* display */
149149   state->segment = BITSWAP8(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f;
r5932r5933
162162{
163163   /*
164164
165      bit      description
165        bit     description
166166
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
175175
176   */
176    */
177177
178178   beta_state *state = device->machine->driver_data;
179179
r5932r5933
238238
239239/* Machine Initialization */
240240
241static MACHINE_START( beta )
241static MACHINE_START( beta )
242242{
243243   beta_state *state = machine->driver_data;
244244
r5932r5933
265265    MDRV_CPU_PROGRAM_MAP(beta_mem)
266266
267267    MDRV_MACHINE_START(beta)
268   
268
269269    /* video hardware */
270270   MDRV_DEFAULT_LAYOUT( layout_beta )
271271
r5932r5933
275275   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
276276
277277   /* 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)
279279
280280   /* EPROM socket */
281281   MDRV_CARTSLOT_ADD(EPROM_TAG)
r5932r5933
302302
303303/* System Drivers */
304304
305/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY         FULLNAME   FLAGS */
305/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY         FULLNAME    FLAGS */
306306COMP( 1984, beta,   0,      0,      beta,   beta,   0,      beta,   "Pitronics",   "Beta",      GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
src/mess/drivers/px4.c
r5932r5933
22
33    Epson PX-4
44
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.
77
88***************************************************************************/
99
src/mess/drivers/exidy.c
r5932r5933
7171    Interestingly the data on cassette is stored in xmodem-checksum.
7272
7373
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.
8585
8686    Sound:
8787
r5932r5933
403403   MDRV_CARTSLOT_ADD("cart")
404404   MDRV_CARTSLOT_EXTENSION_LIST("rom")
405405   MDRV_CARTSLOT_NOT_MANDATORY
406   
406
407407   MDRV_FLOPPY_4_DRIVES_ADD(exidy_floppy_config)
408408MACHINE_DRIVER_END
409409
r5932r5933
415415
416416   MDRV_MACHINE_START( exidy )
417417   MDRV_MACHINE_RESET( exidy )
418   
418
419419   MDRV_FLOPPY_4_DRIVES_REMOVE()
420420MACHINE_DRIVER_END
421421
src/mess/drivers/pc8801.c
r5932r5933
11/*****************************************************************************************************
22
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
64
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)
356
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)
4435
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
5337
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
6144
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
6653
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)
7661
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)
7966
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.
8076
77    Usage:
78        These machines take a long time to start. Be patient (or press Insert to FastForward)
8179
80
81
8282*****************************************************************************************************/
8383
8484#include "driver.h"
r5932r5933
286286Therefore, in Full Emulation mode, "F1" goes to 'F3' and so on
287287
288288Also, the Keypad has 16 keys, making impossible to map it in a satisfactory
289way to a PC keypad. Therefore, default settings for these keys in Full
290Emulation are currently based on the effect of the key rather than on
289way to a PC keypad. Therefore, default settings for these keys in Full
290Emulation are currently based on the effect of the key rather than on
291291their real position
292292
293293About natural keyboards: currently,
r5932r5933
299299- "Roll Up" and "Roll Down" are mapped to 'Page Up' and 'Page Down'
300300- "Help" is mapped to 'F8'
301301 */
302
302
303303static INPUT_PORTS_START( pc88sr )
304304   PORT_START("KEY0")
305305   PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD)      PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
r5932r5933
418418
419419   PORT_START("KEY12")      /* port 0x0c */
420420   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
421   
421
422422   PORT_START("KEY13")      /* port 0x0d */
423423   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
424   
424
425425   PORT_START("KEY14")      /* port 0x0e */
426426   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
427   
427
428428   PORT_START("KEY15")      /* port 0x0f */
429429   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
430430
r5932r5933
622622   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
623623   MDRV_SOUND_ADD("beep", BEEP, 0)
624624   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
625   
625
626626   MDRV_NEC765A_ADD("nec765", pc8801_fdc_interface)
627   
627
628628   MDRV_FLOPPY_2_DRIVES_ADD(pc88_floppy_config)
629629MACHINE_DRIVER_END
630630
r5932r5933
704704   ROM_LOAD( "font.rom", 0x0000, 0x0800, CRC(56653188) SHA1(84b90f69671d4b72e8f219e1fe7cd667e976cf7f) )
705705ROM_END
706706
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
708708at least 1 Kanji ROM). */
709709ROM_START( pc88m2 )
710710   ROM_REGION( 0x18000, "maincpu", 0 )
src/mess/drivers/poly880.c
r5932r5933
44
55    12/05/2009 Skeleton driver.
66
7   http://www.kc85-museum.de/books/poly880/index.html
7    http://www.kc85-museum.de/books/poly880/index.html
88
99****************************************************************************/
1010
r5932r5933
1919
2020/*
2121
22   TODO:
22    TODO:
2323
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
2929
3030*/
3131
r5932r5933
8484static INPUT_PORTS_START( poly880 )
8585   PORT_START("KI1")
8686   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 )
8888   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("EXEC") PORT_CODE(KEYCODE_ENTER)
8989   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACK") PORT_CODE(KEYCODE_BACKSPACE)
9090   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("REG") PORT_CODE(KEYCODE_R)
r5932r5933
154154static WRITE8_DEVICE_HANDLER( pio1_port_a_w )
155155{
156156   /*
157     
158      bit      signal   description
159157
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
168159
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
170168
169    */
170
171171   poly880_state *state = device->machine->driver_data;
172172
173173   state->segment = BITSWAP8(data, 3, 4, 6, 0, 1, 2, 7, 5);
r5932r5933
178178static READ8_DEVICE_HANDLER( pio1_port_b_r )
179179{
180180   /*
181     
182      bit      signal   description
183181
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
192183
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
194192
193    */
194
195195   poly880_state *state = device->machine->driver_data;
196196
197197   UINT8 data = 0xf0 | ((cassette_input(state->cassette) < +0.0) << 1);
r5932r5933
213213static WRITE8_DEVICE_HANDLER( pio1_port_b_w )
214214{
215215   /*
216     
217      bit      signal   description
218216
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
227218
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
229227
228    */
229
230230   poly880_state *state = device->machine->driver_data;
231231
232232   /* tape output */
r5932r5933
325325
326326/* System Drivers */
327327
328/*    YEAR   NAME      PARENT   COMPAT   MACHINE      INPUT      INIT   CONFIG      COMPANY            FULLNAME            FLAGS */
328/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY             FULLNAME                FLAGS */
329329COMP( 1983, poly880,   0,      0,      poly880,   poly880,   0,      poly880,   "VEB Polytechnik",   "Poly-Computer 880",   GAME_SUPPORTS_SAVE )
src/mess/drivers/socrates.c
r5932r5933
33*  V-tech Socrates Driver
44*  By Jonathan Gevaryahu AKA Lord Nightmare
55*  with dumping help from Kevin 'kevtris' Horton
6* 
6*
77*  (driver structure copied from vtech1.c)
88TODO:
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
1615
1716
17
1818  Socrates Educational Video System
1919        FFFF|----------------|
2020            | RAM (window 1) |
r5932r5933
3030            |                |
3131        0000|----------------|
3232
33   * cartridge lives in banks 10 onward, see below
33    * cartridge lives in banks 10 onward, see below
3434
3535        Banked rom area (4000-7fff) bankswitching
3636        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
4141        ... 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
4444       10          0x40000 - 0x43fff Expansion Cartridge page 0 (cart ROM 0x0000-0x3fff)
4545       11          0x44000 - 0x47fff Expansion Cartridge page 1 (cart ROM 0x4000-0x7fff)
4646        ... etc ...
r5932r5933
180180 socrates.kb_latch_low[0] = 0xFF;
181181 socrates.kb_latch_high[0] = 0x8F;
182182 socrates.kb_latch_low[1] = 0x00;
183 socrates.kb_latch_high[1] = 0x01;
183 socrates.kb_latch_high[1] = 0x01;
184184 socrates.kb_latch_mouse = 0;
185185 socrates.io40_latch = 0;
186186 socrates.hblankstate = 0;
r5932r5933
318318/* all this really tells us is: 0x80 is the speech start command;
319319   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 */
320320/*  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.
329329
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
347347end hd38880 info.*/
348348/* the socrates speech chip does not QUITE match the hd38880 though, but is very similar */
349349   switch(data&0xF0)
r5932r5933
447447/* NTSC-based Palette stuff */
448448// max for I and Q
449449#define M_I 0.5957
450#define M_Q 0.5226
450#define M_Q 0.5226
451451 /* luma amplitudes, measured on scope */
452452#define LUMAMAX 1.420
453453#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,
454454#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,
455455#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,
456456#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
458458 /* chroma amplitudes, measured on scope */
459459#define CHROMAMAX 0.42075
460460#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,
r5932r5933
466466static rgb_t socrates_create_color(UINT8 color)
467467{
468468rgb_t composedcolor;
469double lumatable[256] = {
469double lumatable[256] = {
470470    LUMA_COL_0
471471    LUMA_COL_COMMON
472472    LUMA_COL_2
r5932r5933
484484    LUMA_COL_COMMON
485485    LUMA_COL_F
486486  };
487double chromaintensity[256] = {
487double chromaintensity[256] = {
488488  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
489489    CHROMA_COL_COMMON
490490    CHROMA_COL_2
r5932r5933
645645   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 */
646646   AM_RANGE(0x10, 0x17) AM_READWRITE(read_f3, socrates_sound_w) AM_MIRROR (0x8) /* sound section:
647647        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    */
658658   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    */
663663   AM_RANGE(0x30, 0x30) AM_READWRITE(read_f3, unknownlatch_30) AM_MIRROR (0xf) /* unknown, write only. may relate to waitstate timing? */
664664   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 */
665665   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 */
r5932r5933
677677keycode low
678678|   keycode high
679679|   |   key name
68000   01   No key pressed
68000  01  No key pressed
681681// pads on the sides of the kb; this acts like a giant bitfield, both dpads/buttons can send data at once
68200   81   left dpad right
68300   82   left dpad up
68400   84   left dpad left
68500   88   left dpad down
68601   80   right dpad down
68702   80   right dpad left
68804   80   right dpad up
68908   80   right dpad right
69010   80   left red button
69120   80   right red button
68200  81  left dpad right
68300  82  left dpad up
68400  84  left dpad left
68500  88  left dpad down
68601  80  right dpad down
68702  80  right dpad left
68804  80  right dpad up
68908  80  right dpad right
69010  80  left red button
69120  80  right red button
692692// top row (right to left)
69344   82   ENTER
69444   83   MENU
69544   84   ANSWER
69644   85   HELP
69744   86   ERASE
69844   87   divide_sign
69944   88   multiply_sign
70044   89   minus_sign
70144   80   plus_sign
69344  82  ENTER
69444  83  MENU
69544  84  ANSWER
69644  85  HELP
69744  86  ERASE
69844  87  divide_sign
69944  88  multiply_sign
70044  89  minus_sign
70144  80  plus_sign
702702//second row (right to left)
70343   81   0
70443   82   9
70543   83   8
70643   84   7
70743   85   6
70843   86   5
70943   87   4
71043   88   3
71143   89   2
71243   80   1
70343  81  0
70443  82  9
70543  83  8
70643  84  7
70743  85  6
70843  86  5
70943  87  4
71043  88  3
71143  89  2
71243  80  1
713713// third row (right to left)
71442   82   I/La
71542   83   H/So
71642   84   G/Fa
71742   85   F/Mi
71842   86   E/Re
71942   87   D/Do
72042   88   C/Ti.
72142   89   B/La.
72242   80   A/So.
72342   81   hyphen/period
71442  82  I/La
71542  83  H/So
71642  84  G/Fa
71742  85  F/Mi
71842  86  E/Re
71942  87  D/Do
72042  88  C/Ti.
72142  89  B/La.
72242  80  A/So.
72342  81  hyphen/period
724724// fourth row (right to left)
72541   81   S
72641   82   R
72741   83   Q/NEW
72841   84   P/PLAY
72941   85   O/PAUSE
73041   86   N/Fa`
73141   87   M/Mi`
73241   88   L/Re`
73341   89   K/Do`
73441   80   J/Ti
72541  81  S
72641  82  R
72741  83  Q/NEW
72841  84  P/PLAY
72941  85  O/PAUSE
73041  86  N/Fa`
73141  87  M/Mi`
73241  88  L/Re`
73341  89  K/Do`
73441  80  J/Ti
735735// fifth row (right to left)
73640   82   SPACE
73740   83   Z
73840   84   Y
73940   85   X
74040   86   W
74140   87   V
74240   88   U
74340   89   T
74450   80   SHIFT
73640  82  SPACE
73740  83  Z
73840  84  Y
73940  85  X
74040  86  W
74140  87  V
74240  88  U
74340  89  T
74450  80  SHIFT
745745// socrates mouse pad (separate from keyboard)
7468x   8y   mouse movement
7468x  8y  mouse movement
747747x: down = 1 (small) thru 7 (large), up = 8 (small) thru F (large)
748748y: right = 1 (small) thru 7 (large), left = 8 (small) thru F (large)
74990   80   right click
750A0   80   left click
751B0   80   both buttons click
75290   81   right click (mouse movement in queue, will be in regs after next latch clear)
753A0   81   left click (mouse movement in queue, will be in regs after next latch clear)
754B0   81   both buttons click (mouse movement in queue, will be in regs after next latch clear)
74990  80  right click
750A0  80  left click
751B0  80  both buttons click
75290  81  right click (mouse movement in queue, will be in regs after next latch clear)
753A0  81  left click (mouse movement in queue, will be in regs after next latch clear)
754B0  81  both buttons click (mouse movement in queue, will be in regs after next latch clear)
755755// socrates touch pad
756756// unknown yet, but probably uses the 60/70/c0/d0/e0/f0 low reg vals
757757*/
r5932r5933
770770   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
771771   PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED)
772772   /* 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    */
785785
786786   PORT_START("keyboard_50") // lowest 'row' (technically the shift key is on the 5th row but it has its own keycode)
787787   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
r5932r5933
801801
802802   PORT_START("keyboard_41") // 4th row
803803   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
805805   PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_NAME("R") // 41 82
806806   PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_NAME("Q/NEW") // 41 83
807807   PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_NAME("P/PLAY") // 41 84
r5932r5933
814814
815815   PORT_START("keyboard_42") // 3rd row
816816   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
818818   PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_NAME("I/La") // 42 82
819819   PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_NAME("H/So") // 42 83
820820   PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_NAME("G/Fa") // 42 84
r5932r5933
827827
828828   PORT_START("keyboard_43") // 2nd row
829829   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
831831   PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_NAME("9") // 43 82
832832   PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_NAME("8") // 43 83
833833   PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_NAME("7") // 43 84
r5932r5933
840840
841841   PORT_START("keyboard_44") // 1st row
842842   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
844844   PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_NAME("ENTER") // 44 82
845845   PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_NAME("MENU") // 44 83
846846   PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) PORT_NAME("ANSWER") // 44 84
r5932r5933
850850   PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') PORT_NAME("*") // 44 88
851851   PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_NAME("-") // 44 89
852852   PORT_BIT(0xfffffc00, IP_ACTIVE_HIGH, IPT_UNUSED)
853   
853
854854   // mouse goes here
855855INPUT_PORTS_END
856856
r5932r5933
912912    /* Socrates US NTSC */
913913   /* all cart roms are 28 pin 23c1000/tc531000 128Kx8 roms */
914914   /* 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    */
945945    ROM_DEFAULT_BIOS("nocart")
946946    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"
947947    ROM_SYSTEM_BIOS( 0, "nocart", "Socrates w/o cartridge installed")
r5932r5933
977977    ROM_LOAD_OPTIONAL("speech_eng_vsm3.bin", 0x8000, 0x4000, CRC(972384aa) SHA1(FFCB1D633CA6BFFC7F481EC505DA447E5B847F16)) // 16k in serial rom
978978    ROM_FILL(0xC000, 0x4000, 0xff) // last vsm isn't present, FF fill
979979ROM_END
980   
980
981981ROM_START(socratfc)
982982    ROM_REGION(0x80000, "maincpu", 0)
983983    /* Socrates SAITOUT (French Canadian) NTSC */
src/mess/drivers/mk85.c
r5932r5933
11/***************************************************************************
2   
2
33        Elektronika MK-85
44
55        12/05/2009 Skeleton driver.
r5932r5933
2020INPUT_PORTS_END
2121
2222
23static MACHINE_RESET(mk85)
24{   
23static MACHINE_RESET(mk85)
24{
2525}
2626
2727static VIDEO_START( mk85 )
r5932r5933
4343    MDRV_CPU_ADD("maincpu",T11, XTAL_4MHz)
4444    MDRV_CPU_CONFIG(t11_data)
4545    MDRV_CPU_PROGRAM_MAP(mk85_mem)
46   
46
4747    MDRV_MACHINE_RESET(mk85)
48   
48
4949    /* video hardware */
5050    MDRV_SCREEN_ADD("screen", RASTER)
5151    MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/univac.c
r5932r5933
11/***************************************************************************
22
3   Univac Terminals
3    Univac Terminals
44
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).
77
8   25/05/2009 Skeleton driver [Robbbert].
8    25/05/2009 Skeleton driver [Robbbert].
99
1010****************************************************************************/
1111
src/mess/drivers/timex.c
r5932r5933
11/***************************************************************************
22
3   NOTE: ****** Specbusy: press N, R, or E to boot *************
3    NOTE: ****** Specbusy: press N, R, or E to boot *************
44
55
66        Spectrum/Inves/TK90X etc. memory map:
r5932r5933
542542   memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, wh);
543543}
544544
545static ADDRESS_MAP_START (ts2068_io, ADDRESS_SPACE_IO, 8)   
545static ADDRESS_MAP_START (ts2068_io, ADDRESS_SPACE_IO, 8)
546546   AM_RANGE(0x1f, 0x1f) AM_READ( spectrum_port_1f_r ) AM_MIRROR(0xff00)
547547   AM_RANGE(0x7f, 0x7f) AM_READ( spectrum_port_7f_r ) AM_MIRROR(0xff00)
548548   AM_RANGE(0xdf, 0xdf) AM_READ( spectrum_port_df_r ) AM_MIRROR(0xff00)
r5932r5933
586586}
587587
588588static 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)
590590   AM_RANGE(0x1f, 0x1f) AM_READ(spectrum_port_1f_r) AM_MIRROR(0xff00)
591591   AM_RANGE(0x7f, 0x7f) AM_READ(spectrum_port_7f_r) AM_MIRROR(0xff00)
592592   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)
594594ADDRESS_MAP_END
595595
596596static ADDRESS_MAP_START (tc2048_mem, ADDRESS_SPACE_PROGRAM, 8)
r5932r5933
628628   /* sound */
629629   MDRV_SOUND_REPLACE("ay8912", AY8912, XTAL_14_112MHz/8)        /* From Schematic; 1.764 MHz */
630630   MDRV_SOUND_CONFIG(spectrum_ay_interface)
631   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)   
631   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
632632
633633   /* cartridge */
634634   MDRV_CARTSLOT_MODIFY("cart")
635635   MDRV_CARTSLOT_EXTENSION_LIST("dck")
636636   MDRV_CARTSLOT_NOT_MANDATORY
637637   MDRV_CARTSLOT_LOAD(timex_cart)
638   MDRV_CARTSLOT_UNLOAD(timex_cart)     
638   MDRV_CARTSLOT_UNLOAD(timex_cart)
639639MACHINE_DRIVER_END
640640
641641
src/mess/drivers/bw2.c
r5932r5933
11/***************************************************************************
22
3   drivers/bw2.c
3    drivers/bw2.c
44
5   Bondwell BW 2
5    Bondwell BW 2
66
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
1616
1717  http://www.thebattles.net/bondwell/
1818
r5932r5933
2121  http://www2.okisemi.com/site/productscatalog/displaydrivers/availabledocuments/Intro-7090.html
2222
2323
24   TODO:
24    TODO:
2525
26   - modem card
26    - modem card
2727
2828***************************************************************************/
2929
r5932r5933
5757{
5858   /*
5959
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
6868
69   */
69    */
7070
7171   bw2_state *state = machine->driver_data;
7272
r5932r5933
138138{
139139   /*
140140
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
149149
150   */
150    */
151151
152152   bw2_state *state = machine->driver_data;
153153
r5932r5933
352352   const device_config *fdc = devtag_get_device(device->machine, "wd179x");
353353   /*
354354
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
363363
364   */
364    */
365365
366366   bw2_state *state = device->machine->driver_data;
367367
r5932r5933
386386{
387387   /*
388388
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
397397
398   */
398    */
399399
400400   bw2_state *state = device->machine->driver_data;
401401
r5932r5933
414414{
415415   /*
416416
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
421421
422   */
422    */
423423
424424   if (get_ramdisk_size(device->machine) > 0)
425425   {
r5932r5933
435435{
436436   /*
437437
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
442442
443   */
443    */
444444
445445   bw2_state *state = device->machine->driver_data;
446446
r5932r5933
617617   AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE(I8255A_TAG, i8255a_r, i8255a_w )
618618   AM_RANGE( 0x10, 0x13 ) AM_DEVREADWRITE(PIT8253_TAG, pit8253_r, pit8253_w )
619619   AM_RANGE( 0x20, 0x21 ) AM_DEVREADWRITE(MSM6255_TAG, msm6255_register_r, msm6255_register_w )
620//   AM_RANGE( 0x30, 0x3f ) SLOT
620//  AM_RANGE( 0x30, 0x3f ) SLOT
621621   AM_RANGE( 0x40, 0x40 ) AM_DEVREADWRITE( MSM8251_TAG, msm8251_data_r, msm8251_data_w )
622622   AM_RANGE( 0x41, 0x41 ) AM_DEVREADWRITE( MSM8251_TAG, msm8251_status_r, msm8251_control_w )
623623   AM_RANGE( 0x50, 0x50 ) AM_DEVWRITE(CENTRONICS_TAG, centronics_data_w)
624624   AM_RANGE( 0x60, 0x63 ) AM_READWRITE( bw2_wd2797_r, bw2_wd2797_w )
625//   AM_RANGE( 0x70, 0x7f ) MODEMSEL
625//  AM_RANGE( 0x70, 0x7f ) MODEMSEL
626626ADDRESS_MAP_END
627627
628628/*
r5932r5933
794794      TRACKS([80])
795795      SECTORS([18])
796796      SECTOR_LENGTH([256])
797      FIRST_SECTOR_ID([0]))     
797      FIRST_SECTOR_ID([0]))
798798FLOPPY_OPTIONS_END
799799
800800static const floppy_config bw2_floppy_config =
r5932r5933
841841   MDRV_MSM8251_ADD(MSM8251_TAG, default_msm8251_interface)
842842
843843   MDRV_WD179X_ADD("wd179x", bw2_wd17xx_interface )
844   
844
845845   MDRV_FLOPPY_2_DRIVES_ADD(bw2_floppy_config)
846846MACHINE_DRIVER_END
847847
r5932r5933
902902   }
903903}
904904
905static SYSTEM_CONFIG_START( bw2 )   
905static SYSTEM_CONFIG_START( bw2 )
906906   CONFIG_DEVICE( bw2_serial_getinfo )
907907   CONFIG_RAM_DEFAULT( 64 * 1024 )
908908   CONFIG_RAM( 96 * 1024 )
src/mess/drivers/jr200.c
r5932r5933
44
55    12/05/2009 Skeleton driver.
66
7   http://www.armchairarcade.com/neo/node/1598
7    http://www.armchairarcade.com/neo/node/1598
88
99****************************************************************************/
1010
1111/*
1212
13   TODO:
13    TODO:
1414
15   - MN1544 4-bit CPU core and ROM dump
15    - MN1544 4-bit CPU core and ROM dump
1616
1717*/
1818
r5932r5933
2121
2222static UINT8 *textram;
2323static UINT8 *border;
24static UINT8 io_reg[0x20] = {    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
24static UINT8 io_reg[0x20] = {    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2525                  0, 0, 0, 0, 0, 0, 0, 0, 0, 0   };
2626
2727static const UINT8 jr200_keycodes[4][9][8] =
r5932r5933
8282/*
8383static READ8_HANDLER( test_r )
8484{
85   return 0x00;
85    return 0x00;
8686}
8787*/
8888
r5932r5933
123123               }
124124            }
125125         }
126     
126
127127         value = keydata;
128128      }
129129      break;
r5932r5933
167167}
168168
169169/*
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*/
178178
179179static ADDRESS_MAP_START(jr200_mem, ADDRESS_SPACE_PROGRAM, 8)
180180   AM_RANGE(0x0000, 0x000c) AM_RAM
r5932r5933
221221   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
222222   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
223223   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
224   
224
225225   PORT_START("ROW3")
226226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
227227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
r5932r5933
231231   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
232232   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
233233   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
234   
234
235235   PORT_START("ROW4")
236236   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
237237   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD)
r5932r5933
241241   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
242242   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
243243   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
244   
244
245245   PORT_START("ROW5")
246246   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
247247   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
r5932r5933
251251   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
252252   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
253253   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
254   
254
255255   PORT_START("ROW6")
256256   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
257257   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD)
r5932r5933
261261   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD)
262262   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
263263   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
264   
264
265265   PORT_START("ROW7")
266266   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
267267   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
r5932r5933
271271   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
272272   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
273273   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
274   
274
275275   PORT_START("ROW8")
276276   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
277277   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
r5932r5933
279279   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD)
280280   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK)
281281   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 )
284284
285285   PORT_START("ROW9")
286286   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
r5932r5933
377377MDRV_CPU_PERIODIC_INT(jr200_nmi,20)
378378MDRV_CPU_PERIODIC_INT(jr200_irq,20)
379379/*
380   MDRV_CPU_ADD("mn1544", MN1544, ?)
380    MDRV_CPU_ADD("mn1544", MN1544, ?)
381381*/
382382   MDRV_MACHINE_RESET(jr200)
383383
src/mess/drivers/enterp.c
r5932r5933
2832832008-05 FP:
284284Notice that I updated the matrix above with the following new info:
285285l1:b1 is LOCK: you press it with CTRL to switch to Caps, you press it again to switch back
286   (you can also use it with ALT)
286    (you can also use it with ALT)
287287l3:b7 is ESC: you use it to exit from nested programs (e.g. if you start to write a program in BASIC,
288   then start EXDOS, you can use ESC to go back to BASIC without losing the program you were writing)
288    then start EXDOS, you can use ESC to go back to BASIC without losing the program you were writing)
289289
290290According to pictures and manuals, there seem to be no more keys connected, so I label the remaining N/C
291291as IPT_UNUSED.
r5932r5933
460460   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
461461
462462   MDRV_WD1770_ADD("wd1770", enterp_wd1770_interface )
463   
463
464464   MDRV_FLOPPY_4_DRIVES_ADD(enterprise_floppy_config)
465465MACHINE_DRIVER_END
466466
src/mess/drivers/coleco.c
r5932r5933
1111  Sean Young
1212
1313  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:
1616        The I/O map is broken into 4 write and 4 read ports:
1717            80-9F (W) = Set both controllers to keypad mode
1818            80-9F (R) = Not Connected
r5932r5933
2626            E0-FF (W) = Sound Chip (SN76489A)
2727            E0-FF (R) = Read Controller data, A1=0 -> read controller 1, A1=1 -> read controller 2
2828
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
3333
3434    EXTRA CONTROLLERS INFO:
3535
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.
4444
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)
5050
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.
5454
5555*******************************************************************************************************/
5656
5757/*
5858
59   TODO:
59    TODO:
6060
61   - Dina SG-1000 mode
61    - Dina SG-1000 mode
6262
6363*/
6464
r5932r5933
9393            ipt1 = input_port_read(space->machine, "SAC_KPD1");
9494
9595         /* 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 */
9898         /* Super Action Controller additional buttons are read in the same way */
9999         if ((ctrl_sel & 0x07) != 0x03) /* If Driving Controller enabled -> no keypad 1*/
100100         {
r5932r5933
159159            ipt2 = input_port_read(space->machine, "SAC_KPD2");
160160
161161         /* 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 */
164164         /* Super Action Controller additional buttons are read in the same way */
165165         if (!(ipt2 & 0x0001)) data &= 0x0a; /* 0 */
166166         if (!(ipt2 & 0x0002)) data &= 0x0d; /* 1 */
r5932r5933
190190            data = input_port_read(space->machine, "SAC_JOY2") & 0xcf;
191191
192192         /* 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))
194194         {
195195            if (joy_status[1] == 0) data |= 0x30;
196196            else if (joy_status[1] == 1) data |= 0x20;
r5932r5933
369369   PORT_START("DRIV")   // Driving Controller
370370   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)
371371
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)
374374INPUT_PORTS_END
375375
376376static INPUT_PORTS_START( roller )
r5932r5933
467467static void coleco_vdp_interrupt(running_machine *machine, int state)
468468{
469469    // only if it goes up
470   if (state && !last_state)
470   if (state && !last_state)
471471      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
472472
473473   last_state = state;
r5932r5933
476476static TIMER_CALLBACK( paddle_callback )
477477{
478478   UINT8 analog1 = 0x00;
479   UINT8 analog2 = 0x00;
479   UINT8 analog2 = 0x00;
480480   UINT8 ctrl_sel = input_port_read_safe(machine, "CTRLSEL", 0);
481481
482482   /* which controller shall we read? */
483483   if ((ctrl_sel & 0x07) == 0x03)   // Driving controller
484484      analog1 = input_port_read_safe(machine, "DRIV", 0);
485   
485
486486   else
487487   {
488488      if ((ctrl_sel & 0x07) == 0x02)   // Super Action Controller P1
r5932r5933
491491      if ((ctrl_sel & 0x70) == 0x20)   // Super Action Controller P2
492492         analog2 = input_port_read_safe(machine, "SAC_SLIDE2", 0);
493493
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. */
498498      if (ctrl_sel & 0x80)            // Roller controller
499499      {
500500         analog1 = input_port_read_safe(machine, "ROLLER_X", 0);
r5932r5933
545545
546546//static int coleco_cart_verify(const UINT8 *cartdata, size_t size)
547547//{
548//   int retval = IMAGE_VERIFY_FAIL;
548//  int retval = IMAGE_VERIFY_FAIL;
549549//
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;
555555//
556//   return retval;
556//  return retval;
557557//}
558558
559559static DEVICE_IMAGE_LOAD( czz50_cart )
r5932r5933
665665
666666/* System Drivers */
667667
668//    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    CONFIG  COMPANY            FULLNAME                     FLAGS
668//    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    CONFIG  COMPANY             FULLNAME                            FLAGS
669669CONS( 1982, coleco,   0,      0,      coleco,   coleco,   0,      0,   "Coleco",         "ColecoVision",                  0 )
670670CONS( 1982, colecoa,  coleco,   0,      coleco,   coleco,   0,      0,   "Coleco",         "ColecoVision (Thick Characters)",   0 )
671671CONS( 1983, colecob,  coleco,   0,      coleco,   coleco,   0,      0,   "Spectravideo",      "SVI-603 Coleco Game Adapter",      0 )
src/mess/drivers/lc80.c
r5932r5933
88
99/*
1010
11   TODO:
11    TODO:
1212
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
1818
1919*/
2020
r5932r5933
144144static WRITE8_DEVICE_HANDLER( pio1_port_a_w )
145145{
146146   /*
147     
148      bit      description
149147
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
158149
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
160158
159    */
160
161161   lc80_state *state = device->machine->driver_data;
162162
163163   state->segment = BITSWAP8(~data, 4, 3, 1, 6, 7, 5, 0, 2);
r5932r5933
168168static READ8_DEVICE_HANDLER( pio1_port_b_r )
169169{
170170   /*
171     
172      bit      description
173171
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
182173
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
184182
183    */
184
185185   lc80_state *state = device->machine->driver_data;
186186
187187   return (cassette_input(state->cassette) < +0.0);
r5932r5933
190190static WRITE8_DEVICE_HANDLER( pio1_port_b_w )
191191{
192192   /*
193     
194      bit      description
195193
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
204195
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
206204
205    */
206
207207   lc80_state *state = device->machine->driver_data;
208208
209209   /* tape output */
r5932r5933
236236static READ8_DEVICE_HANDLER( pio2_port_b_r )
237237{
238238   /*
239     
240      bit      description
241239
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
250241
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
252250
251    */
252
253253   lc80_state *state = device->machine->driver_data;
254254   UINT8 data = 0xf0;
255255   int i;
r5932r5933
309309   memory_configure_bank(machine, 2, 0, 1, memory_region(machine, Z80_TAG) + 0x800, 0); // TODO
310310   memory_configure_bank(machine, 2, 1, 1, memory_region(machine, Z80_TAG) + 0x800, 0);
311311   memory_set_bank(machine, 2, 1);
312   
312
313313   memory_configure_bank(machine, 3, 0, 1, memory_region(machine, Z80_TAG) + 0x1000, 0); // TODO
314314   memory_configure_bank(machine, 3, 1, 1, memory_region(machine, Z80_TAG) + 0x1000, 0);
315315   memory_set_bank(machine, 3, 1);
r5932r5933
411411
412412static MACHINE_DRIVER_START( sc80 )
413413   MDRV_IMPORT_FROM( lc80_2 )
414   
414
415415   /* basic machine hardware */
416416    MDRV_CPU_MODIFY(Z80_TAG)
417417    MDRV_CPU_PROGRAM_MAP(sc80_mem)
r5932r5933
455455
456456/* System Drivers */
457457
458/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY               FULLNAME            FLAGS */
458/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY                 FULLNAME                FLAGS */
459459COMP( 1984, lc80,   0,      0,      lc80,   lc80,   0,      lc80,   "VEB Mikroelektronik",   "Lerncomputer LC 80",   GAME_SUPPORTS_SAVE )
460460COMP( 1984, lc80_2,   lc80,   0,      lc80_2,   lc80,   0,      lc80_2,   "VEB Mikroelektronik",   "Lerncomputer LC 80.2",   GAME_SUPPORTS_SAVE )
461461COMP( 1984, sc80,   lc80,   0,      lc80_2,   lc80,   0,      lc80_2,   "VEB Mikroelektronik",   "Schachcomputer SC-80",   GAME_SUPPORTS_SAVE )
src/mess/drivers/apf.c
r5932r5933
523523   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 5") PORT_CODE(KEYCODE_5_PAD) PORT_PLAYER(2)
524524   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 8") PORT_CODE(KEYCODE_8_PAD) PORT_PLAYER(2)
525525
526//   PORT_INCLUDE( m6847_artifacting ) // breaks apfimag keyboard
526//  PORT_INCLUDE( m6847_artifacting ) // breaks apfimag keyboard
527527INPUT_PORTS_END
528528
529529
r5932r5933
667667
668668static MACHINE_DRIVER_START( apf_imagination )
669669   /* basic machine hardware */
670   //   MDRV_CPU_ADD("maincpu", M6800, 3750000)        /* 7.8336 MHz, only 6800p type used 1 MHz max*/
670   //  MDRV_CPU_ADD("maincpu", M6800, 3750000)        /* 7.8336 MHz, only 6800p type used 1 MHz max*/
671671   MDRV_CPU_ADD("maincpu", M6800, 1000000 )        /* backgammon uses timing from vertical interrupt to switch between video modes during frame */
672672   MDRV_CPU_PROGRAM_MAP(apf_imagination_map)
673673   MDRV_SCREEN_ADD("screen", RASTER)
r5932r5933
728728ROM_START(apfm1000)
729729   ROM_REGION(0x10000+0x0800,"maincpu",0)
730730   ROM_LOAD("apf_4000.rom",0x010000, 0x0800, CRC(2a331a33) SHA1(387b90882cd0b66c192d9cbaa3bec250f897e4f1))
731//   ROM_LOAD("apf-m1000rom.bin",0x010000, 0x0800, CRC(cc6ac840) SHA1(1110a234bcad99bd0894ad44c591389d16376ca4))
731//  ROM_LOAD("apf-m1000rom.bin",0x010000, 0x0800, CRC(cc6ac840) SHA1(1110a234bcad99bd0894ad44c591389d16376ca4))
732732   ROM_CART_LOAD("cart", 0x8000, 0x2000, ROM_OPTIONAL)
733733ROM_END
734734
src/mess/drivers/gp32.c
r5932r5933
3434      vramaddr = (vramaddr & 0x1fffff);
3535      vramaddr |= (s3c240x_vidregs[5]&0xffe00000)<<1;
3636
37      vram = (UINT8 *)&s3c240x_ram[(vramaddr-0x0c000000)/4];
37      vram = (UINT8 *)&s3c240x_ram[(vramaddr-0x0c000000)/4];
3838
3939      for (y = 0; y < 240; y++)
4040      {
4141         UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0);
42         
42
4343         for (x = 0; x < 320; x++)
4444         {
4545            *scanline++ = vram[(160*y)+x];
r5932r5933
8282
8383static WRITE32_HANDLER(s3c240x_irq_w)
8484{
85//   printf("%08x to interrupt controller @ 0x144000%02x\n", data, offset<<2);
85//  printf("%08x to interrupt controller @ 0x144000%02x\n", data, offset<<2);
8686
8787   COMBINE_DATA(&s3c240x_irq_regs[offset]);
8888}
r5932r5933
122122{
123123   if (ctrl_bits & 1)   // timer start?
124124   {
125//      printf("starting timer %d\n", timer);
125//      printf("starting timer %d\n", timer);
126126   }
127127   else   // stopping is easy
128128   {
129//      printf("stopping timer %d\n", timer);
129//      printf("stopping timer %d\n", timer);
130130      timer_adjust_oneshot(s3c240x_timers[timer], attotime_never, 0);
131   }   
131   }
132132}
133133
134134static WRITE32_HANDLER(s3c240x_timer_w)
135135{
136136   UINT32 old_value = s3c240x_timer_regs[offset];
137137
138//   printf("%08x to timer @ 0x151000%02x (%s)\n", data, offset<<2, timer_reg_names[offset]);
138//  printf("%08x to timer @ 0x151000%02x (%s)\n", data, offset<<2, timer_reg_names[offset]);
139139
140140   COMBINE_DATA(&s3c240x_timer_regs[offset]);
141141
r5932r5933
155155      {
156156         s3c240x_timer_recalc(space->machine, 2, (data>>12)&0xf, 0x24);
157157      }
158     
158
159159      if ((data & 0x10000) != (old_value & 0x10000))   // timer 3 status change
160160      {
161161         s3c240x_timer_recalc(space->machine, 3, (data>>16)&0xf, 0x30);
r5932r5933
188188
189189static READ32_HANDLER( s3c240x_gpio_r )
190190{
191//   printf("read GPIO @ 0x156000%02x (PC %x)\n", offset*4, cpu_get_pc(space->cpu));
191//  printf("read GPIO @ 0x156000%02x (PC %x)\n", offset*4, cpu_get_pc(space->cpu));
192192
193193   return s3c240x_gpio[offset];
194194}
r5932r5933
197197{
198198   COMBINE_DATA(&s3c240x_gpio[offset]);
199199
200//   printf("%08x to GPIO @ 0x156000%02x (PC %x)\n", data, offset*4, cpu_get_pc(space->cpu));
200//  printf("%08x to GPIO @ 0x156000%02x (PC %x)\n", data, offset*4, cpu_get_pc(space->cpu));
201201
202//   if (offset == 0x30/4) printf("[%08x] %s %s\n", data, (data & 0x200) ? "SCL" : "scl", (data & 0x400) ? "SDL" : "sdl");
202//  if (offset == 0x30/4) printf("[%08x] %s %s\n", data, (data & 0x200) ? "SCL" : "scl", (data & 0x400) ? "SDL" : "sdl");
203203}
204204
205205static ADDRESS_MAP_START( gp32_map, ADDRESS_SPACE_PROGRAM, 32 )
src/mess/drivers/partner.c
r5932r5933
191191   MDRV_DMA8257_ADD("dma8257", XTAL_16MHz / 9, partner_dma)
192192
193193   MDRV_CASSETTE_ADD( "cassette", partner_cassette_config )
194   
194
195195   MDRV_WD1793_ADD("wd1793", partner_wd17xx_interface )
196   
196
197197   MDRV_FLOPPY_2_DRIVES_ADD(partner_floppy_config)
198198MACHINE_DRIVER_END
199199
src/mess/drivers/saturn.c
r5932r5933
488488
489489   pad = input_port_read(machine, padnames[intback_stage-2]);
490490
491//   if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2);
491//  if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2);
492492   smpc_ram[33] = 0xf1;   // no tap, direct connect
493493   smpc_ram[35] = 0x02;   // saturn pad
494494   smpc_ram[37] = pad>>8;
r5932r5933
526526         if (LOG_SMPC) logerror("SMPC: SH-2 direct mode, returning data for phase %d\n", hshake);
527527
528528         return_data = 0x9f;
529         
529
530530         switch (hshake)
531531         {
532532            case 0:
533533               return_data = 0x90;
534//               return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>4) & 0xf);
534//                  return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>4) & 0xf);
535535               break;
536536
537537            case 1:
538//               return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>12) & 0xf);
538//                  return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>12) & 0xf);
539539               break;
540540
541541            case 2:
542//               return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>8) & 0xf);
542//                  return_data = 0xf0 | ((input_port_read(space->machine, "JOY1")>>8) & 0xf);
543543               break;
544544
545545            case 3:
546546               return_data = 0x94;
547//               return_data = 0xf0 | (input_port_read(space->machine, "JOY1")&0x8) | 0x4;
547//                  return_data = 0xf0 | (input_port_read(space->machine, "JOY1")&0x8) | 0x4;
548548               break;
549549         }
550550      }
r5932r5933
599599
600600   if (offset == 0x75)   // PDR1
601601   {
602      PDR1 = (data & smpc_ram[0x79]);   
602      PDR1 = (data & smpc_ram[0x79]);
603603   }
604604
605605   if (offset == 0x77)   // PDR2
r5932r5933
19471947   AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x01f00000) AM_SHARE(3) AM_BASE(&stv_workram_h)
19481948   AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE(6)  // bios mirror
19491949   AM_RANGE(0x22000000, 0x24ffffff) AM_ROM AM_SHARE(7)  // cart mirror
1950ADDRESS_MAP_END                   
1950ADDRESS_MAP_END
19511951
19521952static ADDRESS_MAP_START( sound_mem, ADDRESS_SPACE_PROGRAM, 16 )
19531953   AM_RANGE(0x000000, 0x07ffff) AM_RAM AM_BASE(&sound_ram)
r5932r5933
22142214   smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
22152215   smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
22162216   smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??)
2217//   smpc_ram[0x33] = input_port_read(machine, "???");
2217//  smpc_ram[0x33] = input_port_read(machine, "???");
22182218    smpc_ram[0x5f] = 0x10;
22192219}
22202220
r5932r5933
22572257   state_save_register_global(machine, EXLE2);
22582258   state_save_register_global(machine, PDR1);
22592259   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);
22622262   state_save_register_global(machine, scsp_last_line);
22632263   state_save_register_global(machine, intback_stage);
22642264   state_save_register_global(machine, pmode);
src/mess/drivers/4004clk.c
r5932r5933
11/***************************************************************************
2   
2
33        4004 Nixie Clock
44
55        03/08/2009 Initial driver
r5932r5933
1919   const device_config *dac;
2020};
2121
22static READ8_HANDLER(data_r)
22static READ8_HANDLER(data_r)
2323{
2424   return input_port_read(space->machine, "INPUT") & 0x0f;
2525}
r5932r5933
4949   output_set_indexed_value("neon", index, value);
5050}
5151
52static void update_nixie(running_machine *machine)
52static void update_nixie(running_machine *machine)
5353{
5454   _4004clk_state *state = machine->driver_data;
5555
r5932r5933
6161   output_set_nixie_value(0,nixie_to_num((state->nixie[14] << 6) | (state->nixie[13] << 2) | (state->nixie[12] >>2)));
6262}
6363
64static WRITE8_HANDLER(nixie_w)
64static WRITE8_HANDLER(nixie_w)
6565{
6666   _4004clk_state *state = space->machine->driver_data;
6767   state->nixie[offset] = data;
6868   update_nixie(space->machine);
6969}
7070
71static WRITE8_HANDLER(neon_w)
71static WRITE8_HANDLER(neon_w)
7272{
7373   output_set_neon_value(0,BIT(data,3));
7474   output_set_neon_value(1,BIT(data,2));
r5932r5933
7676   output_set_neon_value(3,BIT(data,0));
7777}
7878
79static WRITE8_HANDLER(relays_w)
80{   
79static WRITE8_HANDLER(relays_w)
80{
8181   _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
8383}
8484
8585static ADDRESS_MAP_START(4004clk_rom, ADDRESS_SPACE_PROGRAM, 8)
r5932r5933
8787ADDRESS_MAP_END
8888
8989static ADDRESS_MAP_START(4004clk_mem, ADDRESS_SPACE_DATA, 8)
90   ADDRESS_MAP_UNMAP_HIGH   
90   ADDRESS_MAP_UNMAP_HIGH
9191   AM_RANGE(0x0000, 0x007F) AM_RAM
9292ADDRESS_MAP_END
9393
9494static ADDRESS_MAP_START( 4004clk_io , ADDRESS_SPACE_IO, 8)
95   ADDRESS_MAP_UNMAP_HIGH   
95   ADDRESS_MAP_UNMAP_HIGH
9696   AM_RANGE(0x00, 0x0e) AM_WRITE(nixie_w)
9797   AM_RANGE(0x00, 0x00) AM_READ(data_r)
9898   AM_RANGE(0x0f, 0x0f) AM_WRITE(neon_w)
r5932r5933
113113INPUT_PORTS_END
114114
115115/*
116      16ms Int generator
117        __  __
118      _| |_|
119      0 1 0 1
120     
116        16ms Int generator
117          __  __
118        _| |_|
119        0 1 0 1
120
121121*/
122122
123123static TIMER_CALLBACK(timer_callback)
r5932r5933
127127   state->timer^=1;
128128}
129129
130static MACHINE_START(4004clk)
130static MACHINE_START(4004clk)
131131{
132132   _4004clk_state *state = machine->driver_data;
133133   state->timer = 0;
134134   state->dac = devtag_get_device(machine, "dac");
135135
136136   timer_pulse(machine, ATTOTIME_IN_HZ(120), NULL, 0, timer_callback);
137   
137
138138   /* register for state saving */
139139   state_save_register_global(machine, state->timer);
140140   state_save_register_global_pointer(machine, state->nixie, 6);
r5932r5933
146146    MDRV_CPU_ADD("maincpu",I4004, XTAL_5MHz / 8)
147147    MDRV_CPU_PROGRAM_MAP(4004clk_rom)
148148    MDRV_CPU_DATA_MAP(4004clk_mem)
149    MDRV_CPU_IO_MAP(4004clk_io)   
149    MDRV_CPU_IO_MAP(4004clk_io)
150150
151151    MDRV_MACHINE_START(4004clk)
152   
152
153153   /* video hardware */
154   MDRV_DEFAULT_LAYOUT(layout_4004clk)   
155   
154   MDRV_DEFAULT_LAYOUT(layout_4004clk)
155
156156   /* sound hardware */
157157   MDRV_SPEAKER_STANDARD_MONO("mono")
158158   MDRV_SOUND_ADD("dac", DAC, 0)
r5932r5933
182182
183183/* Driver */
184184
185/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG  COMPANY               FULLNAME             FLAGS */
185/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG  COMPANY                FULLNAME            FLAGS */
186186COMP( 2008, 4004clk,  0,    0,       4004clk,    4004clk,  0,      0,      "John L. Weinrich",   "4004 Nixie Clock", GAME_SUPPORTS_SAVE)
187187
src/mess/drivers/c80.c
r5932r5933
8181static READ8_DEVICE_HANDLER( pio1_port_a_r )
8282{
8383   /*
84     
85      bit      description
8684
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
9586
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
9795
96    */
97
9898   c80_state *state = device->machine->driver_data;
9999
100100   UINT8 data = !state->pio1_brdy << 4 | 0x07;
r5932r5933
119119static WRITE8_DEVICE_HANDLER( pio1_port_a_w )
120120{
121121   /*
122     
123      bit      description
124122
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
133124
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
136136   c80_state *state = device->machine->driver_data;
137137
138138   state->pio1_a5 = BIT(data, 5);
r5932r5933
148148static WRITE8_DEVICE_HANDLER( pio1_port_b_w )
149149{
150150   /*
151     
152      bit      description
153151
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
162153
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
164162
163    */
164
165165   c80_state *state = device->machine->driver_data;
166166
167167   if (!state->pio1_a5)
r5932r5933
281281
282282/* System Drivers */
283283
284/*    YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY            FULLNAME   FLAGS */
284/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY             FULLNAME    FLAGS */
285285COMP( 1986, c80,   0,      0,      c80,   c80,   0,      c80,   "Joachim Czepa",   "C-80",      GAME_SUPPORTS_SAVE )
src/mess/drivers/tmc2000e.c
r5932r5933
11/*
22
3   Telmac 2000E
3    Telmac 2000E
44    ------------
55    (c) 1980 Telercas Oy, Finland
66
r5932r5933
214214   // tape in
215215
216216   if (cassette_input(state->cassette) > +1.0) flags -= EF2;
217   
217
218218   // keyboard
219219
220220   if (~input_port_read(device->machine, keynames[state->keylatch / 8]) & (1 << (state->keylatch % 8))) flags -= EF3;
r5932r5933
324324
325325   // video hardware
326326   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
327   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
327   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
328328   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)
329329
330330   MDRV_PALETTE_LENGTH(8)
r5932r5933
338338   /* devices */
339339   MDRV_PRINTER_ADD("printer")
340340   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)
343343MACHINE_DRIVER_END
344344
345345/* ROMs */
src/mess/drivers/hec2hrp.c
r5932r5933
33        Hector 2HR+
44
55        12/05/2009 Skeleton driver - Micko
6   31/06/2009 Video - Robbbert
6    31/06/2009 Video - Robbbert
77
88****************************************************************************/
99
src/mess/drivers/unior.c
r5932r5933
11/***************************************************************************
2   
2
33        Unior
44
55        12/05/2009 Skeleton driver.
r5932r5933
2424INPUT_PORTS_END
2525
2626
27static MACHINE_RESET(unior)
28{   
27static MACHINE_RESET(unior)
28{
2929}
3030
3131static VIDEO_START( unior )
r5932r5933
4141    /* basic machine hardware */
4242    MDRV_CPU_ADD("maincpu",8080, 2222222)
4343    MDRV_CPU_PROGRAM_MAP(unior_mem)
44    MDRV_CPU_IO_MAP(unior_io)   
44    MDRV_CPU_IO_MAP(unior_io)
4545
4646    MDRV_MACHINE_RESET(unior)
47   
47
4848    /* video hardware */
4949    MDRV_SCREEN_ADD("screen", RASTER)
5050    MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/bebox.c
r5932r5933
162162   /*MDRV_PCI_BUS_DEVICE(12, NULL, scsi53c810_pci_read, scsi53c810_pci_write)*/
163163
164164   MDRV_SMC37C78_ADD("smc37c78", pc_fdc_nec765_connected_1_drive_interface)
165   
165
166166   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, bebox_floppy_config)
167167MACHINE_DRIVER_END
168168
src/mess/drivers/apogee.c
r5932r5933
4444   PORT_START("LINE1")
4545   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t')
4646   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)
4848   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
4949   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
5050   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
src/mess/drivers/vk100.c
r5932r5933
9090   //AM_RANGE (0x51, 0x51) AM_READ(uart_1)   // UAR
9191   //AM_RANGE (0x58, 0x58) AM_READ(unknown_58)
9292   //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
9494   //AM_RANGE (0x70, 0x70) AM_READ(unknown_70)
9595   //AM_RANGE (0x78, 0x7f) AM_READ(unknown_78)
9696ADDRESS_MAP_END
src/mess/drivers/ec65.c
r5932r5933
11/***************************************************************************
2   
2
33        EC-65
44
55        16/07/2009 Initial driver.
r5932r5933
3434   AM_RANGE(0xe110, 0xe11f) AM_DEVREADWRITE(VIA6522_1_TAG, via_r, via_w)
3535   AM_RANGE(0xe130, 0xe133) AM_DEVREADWRITE(ACIA6551_TAG,  acia_6551_r, acia_6551_w )
3636   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)
3838   AM_RANGE(0xe400, 0xe7ff) AM_RAM // 1KB on-board RAM
3939   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&video_ram)
4040   AM_RANGE(0xf000, 0xffff) AM_ROM
r5932r5933
9595
9696const via6522_interface ec65_via_1_intf=
9797{
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 */
106106   DEVCB_NULL,                       /* out_ca1_func */
107107   DEVCB_NULL,                       /* out_cb1_func */
108108   DEVCB_NULL,                       /* out_ca2_func */
109109   DEVCB_NULL,                       /* out_cb2_func */
110   DEVCB_NULL,                       /* irq_func */   
110   DEVCB_NULL,                       /* irq_func */
111111};
112112
113113const via6522_interface ec65_via_0_intf=
114114{
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 */
123123   DEVCB_NULL,      /* out_ca1_func */
124124   DEVCB_NULL,      /* out_cb1_func */
125125   DEVCB_NULL,      /* out_ca2_func */
126126   DEVCB_NULL,      /* out_cb2_func */
127   DEVCB_NULL,      /* irq_func */   
127   DEVCB_NULL,      /* irq_func */
128128};
129129
130130/* Input ports */
r5932r5933
133133INPUT_PORTS_END
134134
135135
136static MACHINE_RESET(ec65)
136static MACHINE_RESET(ec65)
137137{
138138}
139139
r5932r5933
162162      {
163163         data = 0xff;
164164      }
165     
165
166166      for (bit = 0; bit < 8; bit++)
167167      {
168168         int x = (column * 8) + bit;
169169         int color = BIT(data, 7) ? 1 : 0;
170           
170
171171         *BITMAP_ADDR16(bitmap, y, x) = color;
172172
173173         data <<= 1;
r5932r5933
195195    MDRV_CPU_PROGRAM_MAP(ec65_mem)
196196
197197    MDRV_MACHINE_RESET(ec65)
198   
198
199199    /* video hardware */
200200   MDRV_SCREEN_ADD("screen", RASTER)
201201   MDRV_SCREEN_REFRESH_RATE(60)
r5932r5933
206206   MDRV_PALETTE_LENGTH(2)
207207   MDRV_PALETTE_INIT(black_and_white)
208208
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
211211    MDRV_VIDEO_START(ec65)
212212    MDRV_VIDEO_UPDATE(ec65)
213   
213
214214    /* devices */
215215   MDRV_PIA6821_ADD( PIA6821_TAG, ec65_pia_interface )
216216   MDRV_ACIA6850_ADD(ACIA6850_TAG, ec65_acia_intf)
r5932r5933
225225    MDRV_CPU_PROGRAM_MAP(ec65k_mem)
226226
227227    MDRV_MACHINE_RESET(ec65)
228   
228
229229    /* video hardware */
230230   MDRV_SCREEN_ADD("screen", RASTER)
231231   MDRV_SCREEN_REFRESH_RATE(60)
r5932r5933
236236   MDRV_PALETTE_LENGTH(2)
237237   MDRV_PALETTE_INIT(black_and_white)
238238
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
241241    MDRV_VIDEO_START(ec65)
242242    MDRV_VIDEO_UPDATE(ec65)
243243MACHINE_DRIVER_END
src/mess/drivers/vg5k.c
r5932r5933
22
33    Philips VG-5000mu
44
5   05/2009 Skeleton driver.
5    05/2009 Skeleton driver.
66
77    Informations ( see the very informative http://vg5k.free.fr/ ):
88     - Variants: Radiola VG5000 and Schneider VG5000
r5932r5933
1919     - Keyboard: 63 keys AZERTY, Caps Lock, CTRL key to access 33 BASIC instructions
2020     - I/O: Tape recorder connector (1200/2400 bauds), Scart connector to TV (RGB),
2121       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,
2323       contained in two 8 KB ROMs, and one with Basic 1.1, contained in
2424       a single 16 KB ROM.
2525     - RAM: 24 KB (3 x 8 KB) type SRAM D4168C, more precisely:
2626         2 x 8 KB, used by the system
2727         1 x 8 KB, used by the video processor
2828     - Memory Map:
29      $0000 - $3fff  BASIC + monitor
29        $0000 - $3fff  BASIC + monitor
3030         $4000 - $47cf  Screen
3131         $47d0 - $7fff  reserved area for BASIC, variables, etc
3232         $8000 - $bfff  Memory Expansion 16K or ROM cart
src/mess/drivers/intv.c
r5932r5933
1616 *            Separate stic & video better, get rid of *2 for kbd comp
1717 *          Add better runtime cart loading
1818 *          Switch to tilemap system
19 *      Add IntelliVoice Support
19 *      Add IntelliVoice Support
2020 * Note from kevtris about IntelliVoice Hookup:
2121<kevtris> the intv uses a special chip
2222<kevtris> called the SPB640
r5932r5933
214214
2152152008-05 FP:
216216The 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
218218you would expect the braces. Moreover, Shift + Cursor keys produce characters.
219219The emulated layout moves 'Esc', '[' and ']' to their usual position.
220220
r5932r5933
334334   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD)
335335   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD)
336336   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD)
337   
337
338338   /* 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 */
341341   PORT_INCLUDE( intv )
342342INPUT_PORTS_END
343343
src/mess/drivers/elwro800.c
r5932r5933
44
55        Driver by Mariusz Wojcieszek
66
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)
1919
2020****************************************************************************/
2121
r5932r5933
7676   UINT8 *prom = memory_region(machine, "proms") + 0x200;
7777   UINT8 cs;
7878   UINT8 ls175;
79   
79
8080   ls175 = BITSWAP8(data, 7, 6, 5, 4, 4, 5, 7, 6) & 0x0f;
8181
8282   cs = prom[((0x0000 >> 10) | (ls175 << 6)) & 0x1ff];
r5932r5933
519519   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
520520
521521   MDRV_CASSETTE_ADD( "cassette", elwro800jr_cassette_config )
522   
522
523523   MDRV_FLOPPY_2_DRIVES_ADD(elwro800jr_floppy_config)
524524MACHINE_DRIVER_END
525525
526526static SYSTEM_CONFIG_START(elwro800)
527   CONFIG_RAM_DEFAULT(64 * 1024)   
527   CONFIG_RAM_DEFAULT(64 * 1024)
528528SYSTEM_CONFIG_END
529529
530530/*************************************
src/mess/drivers/special.c
r5932r5933
8282/* Input ports */
8383
8484/* Inputs will need to be adapted when/if support for non-latin keys is added to natural keyboard:
85these systems have different keys to switch among alphabets! 
85these systems have different keys to switch among alphabets!
8686*/
8787static INPUT_PORTS_START( special )
8888/* Alt switches between Latin and Cyrillic alphabets */
r5932r5933
443443   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
444444
445445   MDRV_CASSETTE_ADD( "cassette", special_cassette_config )
446     
446
447447MACHINE_DRIVER_END
448448
449449static MACHINE_DRIVER_START( specialp )
r5932r5933
478478    /* audio hardware */
479479   MDRV_SOUND_ADD("custom", SPECIMX, 0)
480480   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
481     
481
482482   MDRV_WD1793_ADD("wd1793", default_wd17xx_interface_2_drives )
483   
483
484484   MDRV_FLOPPY_2_DRIVES_ADD(specimx_floppy_config)
485485MACHINE_DRIVER_END
486486
r5932r5933
514514   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
515515
516516   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
520520   MDRV_FLOPPY_2_DRIVES_ADD(specimx_floppy_config)
521521MACHINE_DRIVER_END
522522
src/mess/drivers/jupiter.c
r5932r5933
6161
6262/* port i/o functions */
6363static 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 )
6565ADDRESS_MAP_END
6666
6767
r5932r5933
170170   }
171171   if ( ! ( offset & 0x8000 ) )
172172   {
173//      cassette_output( devtag_get_device(space->machine, "cassette"), -1 );
173//      cassette_output( devtag_get_device(space->machine, "cassette"), -1 );
174174      speaker_level_w(speaker,0);
175175      data = ( data & 0xe0 ) | ( data & input_port_read( space->machine, "KEY7" ) );;
176176   }
r5932r5933
185185static WRITE8_HANDLER( jupiter_port_fe_w )
186186{
187187   const device_config *speaker = devtag_get_device(space->machine, "speaker");
188//   cassette_output( devtag_get_device(machine, "cassette"), 1 );
188//  cassette_output( devtag_get_device(machine, "cassette"), 1 );
189189   speaker_level_w(speaker,1);
190190}
191191
r5932r5933
334334   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
335335
336336   MDRV_CASSETTE_ADD( "cassette", jupiter_cassette_config )
337   
337
338338   MDRV_CARTSLOT_ADD("cart")
339339   MDRV_CARTSLOT_EXTENSION_LIST("ace")
340340   MDRV_CARTSLOT_NOT_MANDATORY
src/mess/drivers/mikro80.c
r5932r5933
4141   AM_RANGE( 0x04, 0x04) AM_DEVWRITE  ( "dac", radio99_dac_w )
4242   AM_RANGE( 0x05, 0x05) AM_READWRITE ( mikro80_8255_portc_r, mikro80_8255_portc_w )
4343   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)
4545ADDRESS_MAP_END
4646
4747/* Input ports */
r5932r5933
180180    MDRV_IMPORT_FROM(mikro80)
181181    MDRV_CPU_MODIFY("maincpu")
182182    MDRV_CPU_IO_MAP(radio99_io)
183       
183
184184   MDRV_SOUND_ADD("dac", DAC, 0)
185   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 16.00)   
185   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 16.00)
186186MACHINE_DRIVER_END
187187
188188
r5932r5933
201201   ROM_REGION(0x0800, "gfx1",0)
202202   ROM_LOAD ("mikro80.fnt", 0x0000, 0x0800, CRC(43eb72bb) SHA1(761319cc6747661b33e84aa449cec83800543b5b) )
203203ROM_END
204   
205204
205
206206/* Driver */
207207/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT       INIT     CONFIG COMPANY                  FULLNAME   FLAGS */
208208COMP( 1983, mikro80,     0,      0,   mikro80,    mikro80,    mikro80, 0,     "",                 "Mikro-80",    0)
src/mess/drivers/pyl601.c
r5932r5933
2828static WRITE8_HANDLER (rom_page_w)
2929{
3030   rom_page =data;
31   if (data & 8)
31   if (data & 8)
3232   {
3333      int chip = (data >> 4) % 5;
3434      int page = data & 7;
r5932r5933
3838   {
3939      memory_set_bankptr(space->machine, 2, mess_ram + 0xc000);
4040   }
41}
41}
4242
4343
4444static WRITE8_HANDLER (vdisk_page_w)
4545{
46   vdisk_addr = (vdisk_addr & 0x0ffff) | ((data & 0x0f)<<16);
46   vdisk_addr = (vdisk_addr & 0x0ffff) | ((data & 0x0f)<<16);
4747}
4848
4949static WRITE8_HANDLER (vdisk_h_w)
5050{
51   vdisk_addr = (vdisk_addr & 0xf00ff) | (data<<8);
51   vdisk_addr = (vdisk_addr & 0xf00ff) | (data<<8);
5252}
5353
5454static WRITE8_HANDLER (vdisk_l_w)
5555{
56   vdisk_addr = (vdisk_addr & 0xfff00) | data;
56   vdisk_addr = (vdisk_addr & 0xfff00) | data;
5757}
5858
5959static WRITE8_HANDLER (vdisk_data_w)
r5932r5933
7171   return retVal;
7272}
7373
74UINT8 selectedline(UINT16 data)
74UINT8 selectedline(UINT16 data)
7575{
7676   UINT8 i;
77   for(i = 0; i < 16; i++)
77   for(i = 0; i < 16; i++)
7878   {
79      if (BIT(data, i))
79      if (BIT(data, i))
8080      {
8181         return i;
8282      }
83   }   
83   }
8484   return 0;
8585}
8686
8787static READ8_HANDLER ( keyboard_r )
8888{
89   return key_code;   
89   return key_code;
9090}
9191
9292static READ8_HANDLER ( keycheck_r )
9393{
94   UINT8 retVal = 0x3f;   
94   UINT8 retVal = 0x3f;
9595   UINT8 *keyboard = memory_region(space->machine, "keyboard");
9696   UINT16 row1 = input_port_read(space->machine, "ROW1");
9797   UINT16 row2 = input_port_read(space->machine, "ROW2");
9898   UINT16 row3 = input_port_read(space->machine, "ROW3");
9999   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");
101101   UINT16 all = row1 | row2 | row3 | row4 | row5;
102102   UINT16 addr = (input_port_read(space->machine, "SHIFT") & 1) | (input_port_read(space->machine, "CTRL") & 1) << 1;
103103   if (all != 0xff)
r5932r5933
113113      key_code = keyboard[addr];
114114      keyboard_clk = ~keyboard_clk;
115115
116      if (keyboard_clk)
116      if (keyboard_clk)
117117         retVal |= 0x80;
118   }   
118   }
119119   return retVal;
120120}
121121
r5932r5933
142142
143143static WRITE8_HANDLER (led_w)
144144{
145//   UINT8 caps_led = BIT(data,4);
145//  UINT8 caps_led = BIT(data,4);
146146}
147147
148148INLINE const device_config *get_floppy_image(running_machine *machine, int drive)
149149{
150150   return floppy_get_device(machine, drive);
151}
151}
152152
153153static NEC765_GET_IMAGE( pyldin_nec765_get_image )
154154{
155155   return get_floppy_image(device->machine, (floppy_index & 1)^1);
156156}
157157UINT8 floppy_ctrl = 0;
158static WRITE8_HANDLER (floppy_w)
158static WRITE8_HANDLER (floppy_w)
159159{
160160   // bit 0 is reset (if zero)
161161   // bit 1 is TC state
162162   // bit 2 is drive selected
163163   // bit 3 is motor state
164164   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
167167      nec765_reset(floppy,0);
168168   }
169169   floppy_drive_set_motor_state(get_floppy_image(space->machine, BIT(data,2)), BIT(data,3));
170   
170
171171   floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), BIT(data,2), 0);
172   
172
173173   nec765_tc_w(floppy, BIT(data,1));
174   
174
175175   floppy_ctrl = data;
176176}
177static READ8_HANDLER (floppy_r)
177static READ8_HANDLER (floppy_r)
178178{
179179   return floppy_ctrl;
180180}
r5932r5933
202202   AM_RANGE( 0xe62a, 0xe62a ) AM_READWRITE(keycheck_r,led_w)
203203   AM_RANGE( 0xe62b, 0xe62b ) AM_READWRITE(timer_r,speaker_w)
204204   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)
206206   AM_RANGE( 0xe680, 0xe680 ) AM_WRITE(vdisk_page_w)
207207   AM_RANGE( 0xe681, 0xe681 ) AM_WRITE(vdisk_h_w)
208208   AM_RANGE( 0xe682, 0xe682 ) AM_WRITE(vdisk_l_w)
r5932r5933
318318static MACHINE_RESET(pyl601)
319319{
320320   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"));
328328}
329329
330330static VIDEO_START( pyl601 )
r5932r5933
344344
345345   int column, bit, i;
346346   UINT8 data;
347   if (BIT(video_mode, 5) == 0)
347   if (BIT(video_mode, 5) == 0)
348348   {
349349      for (column = 0; column < x_count; column++)
350350      {
351         UINT8 code = mess_ram[(((ma + column) & 0x0fff) + 0xf000)];     
351         UINT8 code = mess_ram[(((ma + column) & 0x0fff) + 0xf000)];
352352         code = ((code << 1) | (code >> 7)) & 0xff;
353353         data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff];
354354         if (column == cursor_x-2)
r5932r5933
359359         {
360360            int x = (column * 8) + bit;
361361            int color = BIT(data, 7) ? 1 : 0;
362               
362
363363            *BITMAP_ADDR16(bitmap, y, x) = color;
364   
364
365365            data <<= 1;
366366         }
367367      }
368368   }
369   else
369   else
370370   {
371371      for (i = 0; i < x_count; i++)
372      {     
372      {
373373         UINT8 data = mess_ram[(((ma + i) << 3) | (ra & 0x07)) & 0xffff];
374374         for (bit = 0; bit < 8; bit++)
375375         {
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;
377377            data <<= 1;
378378         }
379      }     
379      }
380380   }
381381}
382382
r5932r5933
390390   {
391391      for (column = 0; column < x_count; column++)
392392      {
393         UINT8 code = mess_ram[(((ma + column) & 0x0fff) + 0xf000)];     
393         UINT8 code = mess_ram[(((ma + column) & 0x0fff) + 0xf000)];
394394         data = charrom[((code << 4) | (ra & 0x07)) & 0xfff];
395395         if (column == cursor_x)
396396         {
397397            data = 0xff;
398398         }
399   
399
400400         for (bit = 0; bit < 8; bit++)
401401         {
402402            int x = (column * 8) + bit;
403403            int color = BIT(data, 7) ? 1 : 0;
404               
404
405405            *BITMAP_ADDR16(bitmap, y, x) = color;
406   
406
407407            data <<= 1;
408408         }
409409      }
410   }
411   else
410   }
411   else
412412   {
413413      for (i = 0; i < x_count; i++)
414      {     
414      {
415415         UINT8 data = mess_ram[(((ma + i) << 3) | (ra & 0x07)) & 0xffff];
416416         for (bit = 0; bit < 8; bit++)
417417         {
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;
419419            data <<= 1;
420420         }
421      }     
421      }
422422   }
423423}
424424
r5932r5933
483483   MDRV_CPU_ADD("maincpu",M6800, XTAL_1MHz)
484484   MDRV_CPU_PROGRAM_MAP(pyl601_mem)
485485   MDRV_CPU_VBLANK_INT("screen", pyl601_interrupt)
486   
486
487487   MDRV_MACHINE_RESET(pyl601)
488488
489   /* video hardware */
489   /* video hardware */
490490   MDRV_SCREEN_ADD("screen", RASTER)
491491   MDRV_SCREEN_REFRESH_RATE(50)
492492   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
r5932r5933
496496   MDRV_PALETTE_LENGTH(2)
497497   MDRV_PALETTE_INIT(monochrome_green)
498498
499   MDRV_MC6845_ADD("crtc", MC6845, XTAL_2MHz, pyl601_crtc6845_interface)
499   MDRV_MC6845_ADD("crtc", MC6845, XTAL_2MHz, pyl601_crtc6845_interface)
500500
501501   MDRV_VIDEO_START( pyl601 )
502   MDRV_VIDEO_UPDATE( pyl601 )   
503   
502   MDRV_VIDEO_UPDATE( pyl601 )
503
504504   MDRV_NEC765A_ADD("nec765", pyldin_nec765_interface)
505   
505
506506   MDRV_FLOPPY_2_DRIVES_ADD(pyldin_floppy_config)
507507MACHINE_DRIVER_END
508508
r5932r5933
525525   ROM_REGION(0x0800, "gfx1",0)
526526   ROM_LOAD( "video.rom",  0x0000, 0x0800, CRC(1c23ba43) SHA1(eb1cfc139858abd0aedbbf3d523f8ba55d27a11d))
527527
528   ROM_REGION(0x50000, "romdisk",ROMREGION_ERASEFF)     
528   ROM_REGION(0x50000, "romdisk",ROMREGION_ERASEFF)
529529   ROM_LOAD( "rom0.rom", 0x00000, 0x10000, CRC(60103920) SHA1(ee5b4ee5b513c4a0204da751e53d63b8c6c0aab9))
530530   ROM_LOAD( "rom1.rom", 0x10000, 0x10000, CRC(cb4a9b22) SHA1(dd09e4ba35b8d1a6f60e6e262aaf2f156367e385))
531531   ROM_LOAD( "rom2.rom", 0x20000, 0x08000, CRC(0b7684bf) SHA1(c02ad1f2a6f484cd9d178d8b060c21c0d4e53442))
src/mess/drivers/mz80.c
r5932r5933
1717
1818
1919/* Note about natural keyboard support:
20   - Keys G1 -> G25 are not mapped in natural mode, switch to emulated mode to use them
20    - Keys G1 -> G25 are not mapped in natural mode, switch to emulated mode to use them
2121 */
2222static INPUT_PORTS_START( mz80k )
2323   PORT_START("LINE0")
r5932r5933
118118   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
119119   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G21") PORT_CODE(KEYCODE_ENTER_PAD)
120120   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)
122122INPUT_PORTS_END
123123
124124// 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
r5932r5933
199199   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
200200   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
201201   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))
203203   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
204204   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
205205
r5932r5933
280280
281281   MDRV_VIDEO_START(mz80k)
282282   MDRV_VIDEO_UPDATE(mz80k)
283   
283
284284   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
285   MDRV_GFXDECODE( mz80k )     
285   MDRV_GFXDECODE( mz80k )
286286   MDRV_PALETTE_LENGTH(2)
287287   MDRV_PALETTE_INIT(black_and_white)
288288   MDRV_SCREEN_SIZE(320, 200)
289289   MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 199)
290   
290
291291   MDRV_SPEAKER_STANDARD_MONO("mono")
292292   MDRV_SOUND_WAVE_ADD("wave", "cassette")
293293   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
294294   MDRV_SOUND_ADD("speaker", SPEAKER, 0)
295295   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 )
300300MACHINE_DRIVER_END
301301
302302static MACHINE_DRIVER_START( mz80kj )
303303   MDRV_IMPORT_FROM( mz80k )
304   MDRV_GFXDECODE( mz80kj )     
304   MDRV_GFXDECODE( mz80kj )
305305MACHINE_DRIVER_END
306306
307307
src/mess/drivers/h19.c
r5932r5933
6262      {
6363         int x = (column * 8) + bit;
6464         int color = BIT(data, 7) ? 1 : 0;
65           
65
6666         *BITMAP_ADDR16(bitmap, y, x) = color;
6767
6868         data <<= 1;
src/mess/drivers/a310.c
r5932r5933
234234   MDRV_SPEAKER_STANDARD_MONO("a310")
235235   MDRV_SOUND_ADD("dac", DAC, 0)
236236   MDRV_SOUND_ROUTE(0, "a310", 1.00)
237   
237
238238   MDRV_WD1772_ADD("wd1772", a310_wd17xx_interface )
239   
239
240240   //MDRV_FLOPPY_4_DRIVES_ADD(a310_floppy_config)
241241MACHINE_DRIVER_END
242242
src/mess/drivers/pp01.c
r5932r5933
5959      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
6060      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
6161      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)
6464   PORT_START("LINE2")
6565      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3)
6666      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4)
r5932r5933
8686      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
8787      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
8888      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)
9191   PORT_START("LINE5")
9292      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9)
9393      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10)
r5932r5933
162162      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
163163   PORT_START("LINED")
164164      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)
167167      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
168168      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
169169      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
r5932r5933
189189      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
190190   PORT_START("LINEALL")
191191      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)
193193      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
194194INPUT_PORTS_END
195195
r5932r5933
215215
216216   MDRV_VIDEO_START(pp01)
217217   MDRV_VIDEO_UPDATE(pp01)
218   
218
219219   MDRV_PIT8253_ADD( "pit8253", pp01_pit8253_intf )
220220
221   MDRV_I8255A_ADD( "ppi8255", pp01_ppi8255_interface )   
221   MDRV_I8255A_ADD( "ppi8255", pp01_ppi8255_interface )
222222MACHINE_DRIVER_END
223223
224224static SYSTEM_CONFIG_START(pp01)
src/mess/drivers/apple2.c
r5932r5933
559559/*
560560static void apple2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
561561{
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;
566566
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;
573573
574      default:                              apple525_device_getinfo(devclass, state, info); break;
575   }
574        default:                                        apple525_device_getinfo(devclass, state, info); break;
575    }
576576}
577577*/
578578static const floppy_config apple2_floppy_config =
r5932r5933
623623   MDRV_APPLE2_SLOT_ADD(0, "langcard", apple2_langcard_r, apple2_langcard_w)
624624   MDRV_APPLE2_SLOT_ADD(4, "mockingboard", mockingboard_r, mockingboard_w)
625625   MDRV_APPLE2_SLOT_ADD(6, "fdc", applefdc_r, applefdc_w)
626   
626
627627   MDRV_FLOPPY_APPLE_2_DRIVES_ADD(apple2_floppy_config,15,16)
628628MACHINE_DRIVER_END
629629
r5932r5933
689689   ROM_LOAD ( "341-0003-00.f0", 0x3000, 0x0800, CRC(62230d38) SHA1(f268022da555e4c809ca1ae9e5d2f00b388ff61c)) /* Needs verification. From eBay: Label: S7908E // C48709 // 3410003 // CAPPLE78 F0 */
690690   ROM_LOAD ( "341-0004-00.f8", 0x3800, 0x0800, CRC(020a86d0) SHA1(52a18bd578a4694420009cad7a7a5779a8c00226))
691691   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 */
694694   //ROMX_LOAD ( "341-0009.p5", 0x4500, 0x0100, CRC(d34eb2ff) SHA1(afd060e6f35faf3bb0146fa889fc787adf56330a), ROM_BIOS(1)) /* 341-0009: 13-sector disk drive, PROM P5 */
695695   //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 */
696696   //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)*/
r5932r5933
752752   ROM_LOAD( "shugart7.rom", 0x4500, 0x0100, CRC(c6e4850c) SHA1(71626d3d2d4bbeeac2b77585b45a5566d20b8d34))
753753   ROM_LOAD( "teac.rom",      0x4500, 0x0100, CRC(94266928) SHA1(5d369bad6cdd6a70b0bb16480eba69640de87a2e))
754754   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))
756756ROM_END
757757
758758ROM_START( agat9 )
r5932r5933
811811
812812   ROM_REGION(0x4700,"maincpu",0)
813813   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
816816   ROM_LOAD ( "341-0027-a.p5", 0x4500, 0x0100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16)) /* Disk II ROM - DOS 3.3 version */
817817ROM_END
818818
r5932r5933
956956SYSTEM_CONFIG_END
957957
958958
959/*    YEAR  NAME      PARENT    COMPAT  MACHINE      INPUT     INIT CONFIG     COMPANY            FULLNAME */
959/*    YEAR  NAME      PARENT    COMPAT  MACHINE     INPUT     INIT CONFIG     COMPANY            FULLNAME */
960960COMP( 1977, apple2,   0,        0,   apple2,      apple2,   0,   apple2,   "Apple Computer", "Apple ][" , 0)
961961COMP( 1979, apple2p,  apple2,   0,   apple2p,   apple2p,  0,   apple2p,   "Apple Computer", "Apple ][+" , 0)
962962COMP( 1982, prav82,   apple2,   0,   apple2p,   apple2p,  0,   apple2p,   "Pravetz", "Pravetz 82" , 0)
src/mess/drivers/zrt80.c
r5932r5933
11/***************************************************************************
2   
2
33        DEC ZRT-80
44
55        12/05/2009 Skeleton driver.
r5932r5933
2020   AM_RANGE(0x4000, 0x43ff) AM_RAM   // Board RAM
2121   // Normaly video RAM is 0x800 but could be expanded up to 8K
2222   AM_RANGE(0xc000, 0xdfff) AM_RAM    AM_BASE(&video_ram) // Video RAM
23   
23
2424ADDRESS_MAP_END
2525
2626static ADDRESS_MAP_START( zrt80_io , ADDRESS_SPACE_IO, 8)
r5932r5933
5050      PORT_DIPSETTING(    0x00, "Alternate Keyboard" )
5151      PORT_DIPNAME( 0x10, 0x10, "Horizontal Sync" )
5252      PORT_DIPSETTING(    0x10, "Negative" )
53      PORT_DIPSETTING(    0x00, "Positive" )
53      PORT_DIPSETTING(    0x00, "Positive" )
5454      PORT_DIPNAME( 0x20, 0x20, "CPU" )
5555      PORT_DIPSETTING(    0x20, "Operating" )
5656      PORT_DIPSETTING(    0x00, "Reset" )
r5932r5933
5959      PORT_DIPSETTING(    0x00, "Positive" )
6060      PORT_DIPNAME( 0x80, 0x00, "Beeper" )
6161      PORT_DIPSETTING(    0x80, "Silent" )
62      PORT_DIPSETTING(    0x00, "Enable" )
62      PORT_DIPSETTING(    0x00, "Enable" )
6363   PORT_START("DIPSW2")
6464      PORT_DIPNAME( 0x0f, 0x05, "Baud rate" )
6565      PORT_DIPSETTING(    0x00, "50" )
r5932r5933
8888      PORT_DIPSETTING(    0x00, "XON/XOFF" )
8989      PORT_DIPNAME( 0x80, 0x80, "Line Feed" )
9090      PORT_DIPSETTING(    0x80, "No LF on CR" )
91      PORT_DIPSETTING(    0x00, "Auto" )
91      PORT_DIPSETTING(    0x00, "Auto" )
9292   PORT_START("DIPSW3")
9393      PORT_DIPNAME( 0x07, 0x07, "Video" )
9494      PORT_DIPSETTING(    0x00, "96 x 24 15750Hz, 50Hz" )
9595      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" )
9797      PORT_DIPSETTING(    0x03, "96 x 24 15750Hz, 60Hz" )
9898      PORT_DIPSETTING(    0x04, "80 x 48 18700Hz, 50Hz" )
9999      PORT_DIPSETTING(    0x05, "80 x 24 17540Hz, 60Hz" )
r5932r5933
112112      PORT_DIPSETTING(    0x00, "Half" )
113113      PORT_DIPNAME( 0x80, 0x80, "Wraparound" )
114114      PORT_DIPSETTING(    0x80, "Disabled" )
115      PORT_DIPSETTING(    0x00, "Enabled" )
115      PORT_DIPSETTING(    0x00, "Enabled" )
116116INPUT_PORTS_END
117117
118118
119static MACHINE_RESET(zrt80)
120{   
119static MACHINE_RESET(zrt80)
120{
121121}
122122
123123static VIDEO_START( zrt80 )
r5932r5933
150150         if (input_port_read(device->machine, "DIPSW1") & 0x04) {
151151            color = color ? 0 : 1;
152152         }
153           
153
154154         *BITMAP_ADDR16(bitmap, y, x) = color;
155155
156156         data <<= 1;
r5932r5933
189189    /* basic machine hardware */
190190    MDRV_CPU_ADD("maincpu",Z80, XTAL_2_4576MHz)
191191    MDRV_CPU_PROGRAM_MAP(zrt80_mem)
192    MDRV_CPU_IO_MAP(zrt80_io)   
192    MDRV_CPU_IO_MAP(zrt80_io)
193193
194194    MDRV_MACHINE_RESET(zrt80)
195   
195
196196    /* video hardware */
197197    /* video hardware */
198198   MDRV_SCREEN_ADD("screen", RASTER)
r5932r5933
204204   MDRV_PALETTE_LENGTH(2)
205205   MDRV_PALETTE_INIT(black_and_white)
206206
207   MDRV_MC6845_ADD("crtc", MC6845, XTAL_20MHz / 8, zrt80_crtc6845_interface)
207   MDRV_MC6845_ADD("crtc", MC6845, XTAL_20MHz / 8, zrt80_crtc6845_interface)
208208
209209    MDRV_VIDEO_START(zrt80)
210210    MDRV_VIDEO_UPDATE(zrt80)
211   
211
212212    MDRV_INS8250_ADD( "ins8250", zrt80_com_interface )
213213MACHINE_DRIVER_END
214214
src/mess/drivers/svision.c
r5932r5933
505505   MDRV_SOUND_ADD("custom", SVISION, 0)
506506   MDRV_SOUND_ROUTE(0, "lspeaker", 0.50)
507507   MDRV_SOUND_ROUTE(1, "rspeaker", 0.50)
508   
508
509509   /* cartridge */
510510   MDRV_CARTSLOT_ADD("cart")
511511   MDRV_CARTSLOT_EXTENSION_LIST("bin,ws,sv")
src/mess/drivers/ti89.c
r5932r5933
11/***************************************************************************
2   
2
33        TI-89
44
55        12/05/2009 Skeleton driver.
r5932r5933
2020INPUT_PORTS_END
2121
2222
23static MACHINE_RESET(ti89)
24{   
23static MACHINE_RESET(ti89)
24{
2525}
2626
2727static VIDEO_START( ti89 )
r5932r5933
3939    MDRV_CPU_PROGRAM_MAP(ti89_mem)
4040
4141    MDRV_MACHINE_RESET(ti89)
42   
42
4343    /* video hardware */
4444    MDRV_SCREEN_ADD("screen", RASTER)
4545    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
6363  ROMX_LOAD( "ti89v100a.rom",  0x000000, 0x200000, CRC(95199934) SHA1(b8e3cdeb4705b0c7e0a15ab6c6f62bcde14a3a55), ROM_BIOS(2))
6464  ROM_SYSTEM_BIOS( 2, "v100", "V 1.00 [m] - HW1" )
6565  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" )
6767  ROMX_LOAD( "ti89v100m2.rom", 0x000000, 0x200000, CRC(cdd69d34) SHA1(1686362b0997bb9597f39b443490d4d8d85b56cc), ROM_BIOS(4))
6868  ROM_SYSTEM_BIOS( 4, "v105", "V 1.05 - HW1" )
6969  ROMX_LOAD( "ti89v105.rom",   0x000000, 0x200000, CRC(3bc0b474) SHA1(46fe0cd511eb81d53dc12cc4bdacec8a5bba5171), ROM_BIOS(5))
7070  ROM_SYSTEM_BIOS( 5, "v201", "V 2.01 - HW1" )
7171  ROMX_LOAD( "ti89v201.rom",   0x000000, 0x200000, CRC(fa6745e9) SHA1(e4ee6067df9b975356cef6c5a81d0ec664371c1d), ROM_BIOS(6))
7272  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))
7474  ROM_SYSTEM_BIOS( 7, "v203m", "V 2.03 [m] - HW 1" )
7575  ROMX_LOAD( "ti89v203m.rom",  0x000000, 0x200000, CRC(d79068f7) SHA1(5b6f571417889b11ae19eef99a5fda4f027d5ec2), ROM_BIOS(8))
7676  ROM_SYSTEM_BIOS( 8, "v209",  "V 2.09 - HW 1" )
7777  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" )
7979  ROMX_LOAD( "ti89v105-2.rom", 0x000000, 0x200000, CRC(83817402) SHA1(b2ddf785e973cc3f9a437d058a68abdf7ca52ea2), ROM_BIOS(10))
8080  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))
8484  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))
8686  ROM_SYSTEM_BIOS( 13, "v205-2m", "V 2.05[m] - HW2" )
8787  ROMX_LOAD( "ti89v205m-2.rom", 0x000000, 0x200000, CRC(e58a23f9) SHA1(d4cb23fb4b414a43802c37dc3c572a8ede670e0f), ROM_BIOS(14))
8888  ROM_SYSTEM_BIOS( 14, "v205-2m2","V 2.05[m2] - HW2" )
r5932r5933
9494ROM_START( ti92 )
9595  ROM_REGION( 0x300000, "maincpu", ROMREGION_ERASEFF )
9696  // 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" )
100100  ROMX_LOAD( "ti92v13e.rom",  0x100000, 0x100000, CRC(316c8196) SHA1(82c8cd484c6aebe36f814a2023d2afad6d87f840), ROM_BIOS(1))
101101  ROM_SYSTEM_BIOS( 1, "v14", "V 1.4" )
102102  ROMX_LOAD( "ti92v14e.rom",  0x100000, 0x100000, CRC(239e9405) SHA1(df2f1ab17d490fda43a02f5851b5a15052361b28), ROM_BIOS(2))
r5932r5933
130130  ROM_SYSTEM_BIOS( 7, "v204", "V 2.04 - HW2" )
131131  ROMX_LOAD( "ti92pv204.rom", 0x0000, 0x200000, CRC(86819be3) SHA1(78032a0f5f11d1e9a45ffbea91e7f9657fd1a8ae), ROM_BIOS(8))
132132  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))
134134  ROM_SYSTEM_BIOS( 9, "v205m", "V 2.05 [m] - HW2" )
135135  ROMX_LOAD( "ti92pv205m.rom",  0x000000, 0x200000, CRC(13ef4d57) SHA1(6ef290bb0dda72f645cd3eca9cc1185f6a2d32dc), ROM_BIOS(10))
136136  ROM_SYSTEM_BIOS( 10, "v209", "V 2.09 - HW2" )
src/mess/drivers/xerox820.c
r5932r5933
99
1010/*
1111
12   TODO:
12    TODO:
1313
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?)
2121
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
2525
2626*/
2727
r5932r5933
117117         {
118118            /* latch key data */
119119            keydata = ~xerox820_keycodes[table][row][col];
120           
120
121121            if (state->keydata != keydata)
122122            {
123123               state->keydata = keydata;
r5932r5933
174174{
175175   /*
176176
177      bit      signal      description
177        bit     signal      description
178178
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)
187187
188   */
188    */
189189}
190190#endif
191191
r5932r5933
243243   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
244244   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
245245   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
246   
246
247247   PORT_START("ROW3")
248248   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
249249   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
r5932r5933
253253   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
254254   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
255255   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
256   
256
257257   PORT_START("ROW4")
258258   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
259259   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad +") PORT_CODE(KEYCODE_PLUS_PAD)
r5932r5933
263263   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
264264   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
265265   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
266   
266
267267   PORT_START("ROW5")
268268   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
269269   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
r5932r5933
273273   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
274274   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
275275   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
276   
276
277277   PORT_START("ROW6")
278278   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('\r')
279279   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD)
r5932r5933
283283   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD)
284284   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
285285   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
286   
286
287287   PORT_START("ROW7")
288288   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
289289   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
r5932r5933
293293   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
294294   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
295295   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
296   
296
297297   PORT_START("ROW8")
298298   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
299299   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
r5932r5933
301301   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD)
302302   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_ASTERISK)
303303   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 )
306306
307307   PORT_START("ROW9")
308308   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
r5932r5933
330330{
331331   /*
332332
333      bit      signal         description
333        bit     signal          description
334334
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
343343
344   */
344    */
345345
346346   xerox820_state *state = device->machine->driver_data;
347347
r5932r5933
352352{
353353   /*
354354
355      bit      signal         description
355        bit     signal          description
356356
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)
365365
366   */
366    */
367367
368368   xerox820_state *state = device->machine->driver_data;
369369
r5932r5933
393393{
394394   /*
395395
396      bit      description
396        bit     description
397397
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
406406
407   */
407    */
408408
409409   xerox820_state *state = device->machine->driver_data;
410410
r5932r5933
457457
458458static WRITE8_DEVICE_HANDLER( ctc_z0_w )
459459{
460//   z80ctc_trg_w(device, 1, data);
460//  z80ctc_trg_w(device, 1, data);
461461}
462462
463463static WRITE8_DEVICE_HANDLER( ctc_z1_w )
r5932r5933
467467
468468static WRITE8_DEVICE_HANDLER( ctc_z2_w )
469469{
470//   z80ctc_trg_w(device, 3, data);
470//  z80ctc_trg_w(device, 3, data);
471471}
472472
473473static const z80ctc_interface ctc_intf =
r5932r5933
518518
519519static const wd17xx_interface wd1771_intf =
520520{
521   wd1771_callback,
521   wd1771_callback,
522522   NULL,
523523   {FLOPPY_0,FLOPPY_1,NULL,NULL}
524524};
r5932r5933
593593   return 0;
594594}
595595static void xerox820_load_proc(const device_config *image)
596{   
596{
597597   xerox820_state *state = image->machine->driver_data;
598   
598
599599   switch (image_length(image))
600600   {
601601   case 77*1*26*128: // 250K 8" SSSD
r5932r5933
603603      state->dsdd = 0;
604604      return;
605605
606   case 77*1*26*256: // 500K 8" SSDD     
606   case 77*1*26*256: // 500K 8" SSDD
607607      state->_8n5 = 1;
608608      state->dsdd = 0;
609609      return;
610610
611   case 40*1*18*128: // 90K 5.25" SSSD     
611   case 40*1*18*128: // 90K 5.25" SSSD
612612      state->_8n5 = 0;
613613      state->dsdd = 0;
614614      return;
615615
616   case 40*2*18*128: // 180K 5.25" DSSD     
616   case 40*2*18*128: // 180K 5.25" DSSD
617617      state->_8n5 = 0;
618618      state->dsdd = 1;
619619      return;
r5932r5933
648648
649649   /* bank switch */
650650   xerox820_bankswitch(machine, 1);
651   
651
652652   for(drive=0;drive<2;drive++)
653653   {
654654      floppy_install_load_proc(floppy_get_device(machine, drive), xerox820_load_proc);
r5932r5933
674674      TRACKS([77])
675675      SECTORS([26])
676676      SECTOR_LENGTH([128])
677      FIRST_SECTOR_ID([1]))   
677      FIRST_SECTOR_ID([1]))
678678   FLOPPY_OPTION( ssdd8, "dsk", "8\" SSDD", basicdsk_identify_default, basicdsk_construct_default,
679679      HEADS([1])
680680      TRACKS([77])
r5932r5933
686686      TRACKS([40])
687687      SECTORS([18])
688688      SECTOR_LENGTH([128])
689      FIRST_SECTOR_ID([1]))               
689      FIRST_SECTOR_ID([1]))
690690   FLOPPY_OPTION( ssdd5, "dsk", "5.25\" SSDD", basicdsk_identify_default, basicdsk_construct_default,
691691      HEADS([2])
692692      TRACKS([40])
693693      SECTORS([18])
694694      SECTOR_LENGTH([128])
695      FIRST_SECTOR_ID([1]))               
695      FIRST_SECTOR_ID([1]))
696696FLOPPY_OPTIONS_END
697697
698698static const floppy_config xerox820_floppy_config =
r5932r5933
736736   MDRV_Z80PIO_ADD(Z80GPPIO_TAG, gppio_intf)
737737   MDRV_Z80CTC_ADD(Z80CTC_TAG, XTAL_20MHz/8, ctc_intf)
738738   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)
740740   MDRV_COM8116_ADD(COM8116_TAG, XTAL_5_0688MHz, com8116_intf)
741741MACHINE_DRIVER_END
742742
r5932r5933
783783
784784/* System Configuration */
785785static SYSTEM_CONFIG_START( xerox820 )
786   CONFIG_RAM_DEFAULT   (64 * 1024)   
786   CONFIG_RAM_DEFAULT   (64 * 1024)
787787SYSTEM_CONFIG_END
788788/*
789789static 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
793793SYSTEM_CONFIG_END
794794*/
795795/* System Drivers */
796796
797/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT      INIT   CONFIG      COMPANY                     FULLNAME      FLAGS */
797/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT    CONFIG      COMPANY                         FULLNAME        FLAGS */
798798COMP( 1981, xerox820,   0,         0,      xerox820,   xerox820,   0,      xerox820,   "Xerox",                  "Xerox 820",   0)
799799/*
800COMP( 1980, bigboard,   0,         0,      bigboard,   bigboard,   0,      bigboard,   "Digital Research Computers",   "Big Board",   GAME_NOT_WORKING)
801COMP( 1983, bigbord2,   0,         0,      bigbord2,   bigboard,   0,      bigbord2,   "Digital Research Computers",   "Big Board II",   GAME_NOT_WORKING)
802COMP( 1983, xerox820ii,   0,         0,      xerox820ii,   xerox820,   0,      xerox820ii,   "Xerox",                  "Xerox 820-II",   GAME_NOT_WORKING)
803COMP( 1983, xerox168,   0,         0,      xerox168,   xerox168,   0,      xerox168,   "Xerox",                  "Xerox 16/8",   GAME_NOT_WORKING)
800COMP( 1980, bigboard,   0,          0,      bigboard,   bigboard,   0,      bigboard,   "Digital Research Computers",   "Big Board",    GAME_NOT_WORKING)
801COMP( 1983, bigbord2,   0,          0,      bigbord2,   bigboard,   0,      bigbord2,   "Digital Research Computers",   "Big Board II", GAME_NOT_WORKING)
802COMP( 1983, xerox820ii, 0,          0,      xerox820ii, xerox820,   0,      xerox820ii, "Xerox",                        "Xerox 820-II", GAME_NOT_WORKING)
803COMP( 1983, xerox168,   0,          0,      xerox168,   xerox168,   0,      xerox168,   "Xerox",                        "Xerox 16/8",   GAME_NOT_WORKING)
804804*/
src/mess/drivers/ti99_4p.c
r5932r5933
268268   MDRV_SPEAKER_STANDARD_MONO("mono")
269269   MDRV_SOUND_ADD("dac", DAC, 0)
270270   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)
273273   MDRV_SOUND_ADD("sn76496", SN76496, 3579545)   /* 3.579545 MHz */
274274   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
275275   MDRV_SOUND_ADD("tms5220", TMS5220, 680000L)
r5932r5933
284284   MDRV_IDE_HARDDISK_ADD( "ide_harddisk" )
285285
286286   /* MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) */
287   
287
288288   /* tms9901 */
289   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)   
289   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)
290290
291   MDRV_FLOPPY_4_DRIVES_ADD(ti99_4p_floppy_config)   
292   
291   MDRV_FLOPPY_4_DRIVES_ADD(ti99_4p_floppy_config)
292
293293   MDRV_SMARTMEDIA_ADD("smartmedia")
294   
294
295295   MDRV_TI99_4_RS232_CARD_ADD("rs232")
296296MACHINE_DRIVER_END
297297
src/mess/drivers/busicom.c
r5932r5933
11/***************************************************************************
2   
2
33        Busicom 141-PF
44
55        04/08/2009 Initial driver by Miodrag Milanovic
r5932r5933
1919   int i;
2020   for(i=0;i<num;i++) {
2121      if (BIT(val,i)==0) return i;
22   }   
22   }
2323   return 0;
2424}
25static READ8_HANDLER(keyboard_r)
25static READ8_HANDLER(keyboard_r)
2626{
2727   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8" , "LINE9"};
2828   return input_port_read(space->machine,keynames[get_bit_selected(keyboard_shifter & 0x3ff,10)]);
2929}
3030
31static READ8_HANDLER(printer_r)
31static READ8_HANDLER(printer_r)
3232{
3333   UINT8 retVal = 0;
3434   if (drum_index==0) retVal |= 1;
r5932r5933
3737}
3838
3939
40static WRITE8_HANDLER(shifter_w)
40static WRITE8_HANDLER(shifter_w)
4141{
4242   if (BIT(data,0)) {
4343      keyboard_shifter <<= 1;
r5932r5933
4949   }
5050}
5151
52static WRITE8_HANDLER(printer_w)
52static WRITE8_HANDLER(printer_w)
5353{
54   int i,j;   
55   if (BIT(data,0)) {     
54   int i,j;
55   if (BIT(data,0)) {
5656      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
5959   }
6060   if (BIT(data,1)) {
6161      for(i=3;i<18;i++) {
6262         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         }
6565      }
6666      if(BIT(printer_shifter,0)) {
6767         busicom_printer_line[10][15] = drum_index + 13 + 1;
r5932r5933
7171      }
7272   }
7373   if (BIT(data,3)) {
74     
74
7575      for(j=0;j<10;j++) {
7676         for(i=0;i<17;i++) {
7777            busicom_printer_line[j][i] = busicom_printer_line[j+1][i];
r5932r5933
8080      }
8181      for(i=0;i<17;i++) {
8282         busicom_printer_line[10][i] = 0;
83      }     
83      }
8484      busicom_printer_line_color[10] = 0;
85     
85
8686   }
8787}
88static WRITE8_HANDLER(status_w)
88static WRITE8_HANDLER(status_w)
8989{
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*/
9494   //logerror("status %c %c %c\n",mem_lamp ? 'M':'x',over_lamp ? 'O':'x',minus_lamp ? '-':'x');
9595}
9696
r5932r5933
9999}
100100
101101static ADDRESS_MAP_START(busicom_rom, ADDRESS_SPACE_PROGRAM, 8)
102   ADDRESS_MAP_UNMAP_HIGH   
102   ADDRESS_MAP_UNMAP_HIGH
103103   AM_RANGE(0x0000, 0x04FF) AM_ROM
104104ADDRESS_MAP_END
105105
r5932r5933
168168         PORT_CONFSETTING( 0x04, "4" )
169169         PORT_CONFSETTING( 0x05, "5" )
170170         PORT_CONFSETTING( 0x06, "6" )
171         PORT_CONFSETTING( 0x08, "8" )     
171         PORT_CONFSETTING( 0x08, "8" )
172172   PORT_START("LINE9")
173173      PORT_CONFNAME( 0x0f, 0x00, "Rounding")
174174         PORT_CONFSETTING( 0x01, "/N" )
r5932r5933
186186   timer ^=1;
187187   if (timer==1) drum_index++;
188188   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
191191}
192static MACHINE_RESET(busicom)
192static MACHINE_RESET(busicom)
193193{
194194   int i,j;
195195   drum_index =0;
196196   keyboard_shifter = 0;
197197   printer_shifter = 0;
198198   timer_pulse(machine, ATTOTIME_IN_MSEC(28*2), NULL, 0, timer_callback);
199   
199
200200   for(i=0;i<17;i++) {
201201      for(j=0;j<11;j++) {
202202         busicom_printer_line[j][i] = 0;
203203         busicom_printer_line_color[j] = 0;
204204      }
205205   }
206   
206
207207}
208208
209209static const char layout_busicom [] = "busicom";
r5932r5933
213213    MDRV_CPU_ADD("maincpu",I4004, 750000)
214214    MDRV_CPU_PROGRAM_MAP(busicom_rom)
215215    MDRV_CPU_DATA_MAP(busicom_mem)
216    MDRV_CPU_IO_MAP(busicom_io)   
216    MDRV_CPU_IO_MAP(busicom_io)
217217
218218    MDRV_MACHINE_RESET(busicom)
219   
219
220220    /* video hardware */
221221    MDRV_SCREEN_ADD("screen", RASTER)
222222    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
226226    MDRV_SCREEN_VISIBLE_AREA(0, 40*17-1, 0, 44*11-1)
227227    MDRV_PALETTE_LENGTH(16)
228228    MDRV_PALETTE_INIT(busicom)
229   
229
230230   MDRV_VIDEO_START(busicom)
231   MDRV_VIDEO_UPDATE(busicom)       
231   MDRV_VIDEO_UPDATE(busicom)
232232MACHINE_DRIVER_END
233233
234234/* ROM definition */
src/mess/drivers/pc.c
r5932r5933
7777those added for the IBM PC Jr.
7878
7979Tandy 1000 (8088) variations:
801000            128KB-640KB RAM      4.77 MHz      v01.00.00, v01.01.00
811000A/1000HD      128KB-640KB RAM      4.77 MHz      v01.01.00
821000SX/1000AX      384KB-640KB RAM      7.16/4.77 MHz   v01.02.00
831000EX            256KB-640KB RAM      7.16/4.77 MHz   v01.02.00
841000HX            256KB-640KB RAM      7.16/4.77 MHz   v02.00.00
801000                128KB-640KB RAM     4.77 MHz        v01.00.00, v01.01.00
811000A/1000HD        128KB-640KB RAM     4.77 MHz        v01.01.00
821000SX/1000AX       384KB-640KB RAM     7.16/4.77 MHz   v01.02.00
831000EX              256KB-640KB RAM     7.16/4.77 MHz   v01.02.00
841000HX              256KB-640KB RAM     7.16/4.77 MHz   v02.00.00
8585
8686Tandy 1000 (8086) variations:
871000RL/1000RL-HD   512KB-768KB RAM      9.44/4.77 MHz   v02.00.00, v02.00.01
871000RL/1000RL-HD    512KB-768KB RAM     9.44/4.77 MHz   v02.00.00, v02.00.01
88881000SL/1000PC       384KB-640KB RAM     8.0/4.77 MHz    v01.04.00, v01.04.01, v01.04.02, v02.00.01
89891000SL/2            512KB-640KB RAM     8.0/4.77 MHz    v01.04.04
9090
9191Tandy 1000 (80286) variations:
921000TX            640KB-768KB RAM      8.0/4.77 MHz   v01.03.00
931000TL            640KB-768KB RAM      8.0/4.77 MHz   v01.04.00, v01.04.01, v01.04.02
941000TL/2         640KB-768KB RAM      8.0/4.77 MHz   v02.00.00
951000TL/3         640KB-768KB RAM      10.0/5.0 MHz   v02.00.00
961000RLX            512KB-1024KB RAM   10.0/5.0 MHz   v02.00.00
971000RLX-HD         1024MB RAM         10.0/5.0 MHz   v02.00.00
921000TX              640KB-768KB RAM     8.0/4.77 MHz    v01.03.00
931000TL              640KB-768KB RAM     8.0/4.77 MHz    v01.04.00, v01.04.01, v01.04.02
941000TL/2            640KB-768KB RAM     8.0/4.77 MHz    v02.00.00
951000TL/3            640KB-768KB RAM     10.0/5.0 MHz    v02.00.00
961000RLX             512KB-1024KB RAM    10.0/5.0 MHz    v02.00.00
971000RLX-HD          1024MB RAM          10.0/5.0 MHz    v02.00.00
9898
9999Tandy 1000 (80386) variations:
1001000RSX/1000RSX-HD   1M-9M RAM         25.0/8.0 MHz   v01.10.00
1001000RSX/1000RSX-HD  1M-9M RAM           25.0/8.0 MHz    v01.10.00
101101
102102IBM PC Jr:
103103
r5932r5933
329329   AM_RANGE(0x0388, 0x0388) AM_DEVREADWRITE("ym3812", ym3812_status_port_r,ym3812_control_port_w)
330330   AM_RANGE(0x0389, 0x0389) AM_DEVWRITE("ym3812", ym3812_write_port_w)
331331#endif
332//   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w)
332//  AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w)
333333   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_r, ins8250_w)
334334   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r,            pc_fdc_w)
335335   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w)
r5932r5933
854854   PORT_DIPSETTING(   0x02, "On (12 MHz)" )
855855   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
856856
857//   PORT_INCLUDE( at_keyboard )      /* IN4 - IN11 */
857//  PORT_INCLUDE( at_keyboard )     /* IN4 - IN11 */
858858    PORT_INCLUDE( kb_keytronic_pc )
859859   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
860860   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
r5932r5933
929929   PORT_DIPNAME( 0x04, 0x04, "HDC2 (CA00:0 port 324-327)")
930930   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
931931   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)" )
935935   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
936936
937937   PORT_INCLUDE( pc_keyboard )      /* IN4 - IN11 */
r5932r5933
10071007   PORT_DIPSETTING(   0x08, "0x08" )
10081008/* 2008-05 FP: This Dip Switch overlaps the next one.
10091009Since 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" ) */
10131013   PORT_DIPNAME( 0x30, 0x00, "Integrated Graphics Adapter")
10141014   PORT_DIPSETTING(   0x00, "CGA 1" )
10151015   PORT_DIPSETTING(   0x10, "CGA 2" )
r5932r5933
11721172
11731173   PORT_START("DSW0") /* IN1 */
11741174   PORT_DIPNAME( 0x07, 0x07, "Name/Language")
1175//   PORT_DIPSETTING(    0x00, "PC 512k" ) // machine crashes with ega bios at 0xc0000
1175//  PORT_DIPSETTING(    0x00, "PC 512k" ) // machine crashes with ega bios at 0xc0000
11761176   PORT_DIPSETTING(   0x01, DEF_STR( Italian ) ) //prego attendere
11771177   PORT_DIPSETTING(   0x02, "V.g. v\xC3\xA4nta" )
11781178   PORT_DIPSETTING(   0x03, "Vent et cjeblik" ) // seldom c
r5932r5933
12611261
12621262   PORT_INCLUDE( amstrad_keyboard )   /* IN4 - IN14 */
12631263
1264//   PORT_INCLUDE( pc_mouse_microsoft )  /* IN12 - IN14 */
1264//  PORT_INCLUDE( pc_mouse_microsoft )  /* IN12 - IN14 */
12651265
12661266INPUT_PORTS_END
12671267
r5932r5933
14421442   MDRV_IMPORT_FROM( pc_hdc )
14431443
14441444   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1445   
1445
14461446   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
14471447MACHINE_DRIVER_END
14481448
r5932r5933
15011501   MDRV_IMPORT_FROM( pc_hdc )
15021502
15031503   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1504   
1504
15051505   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
15061506MACHINE_DRIVER_END
15071507
r5932r5933
15711571   MDRV_CASSETTE_ADD( "cassette", ibm5150_cassette_config )
15721572
15731573   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1574   
1574
15751575   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
15761576MACHINE_DRIVER_END
15771577
r5932r5933
16291629   MDRV_IMPORT_FROM( pc_hdc )
16301630
16311631   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1632   
1632
16331633   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
16341634MACHINE_DRIVER_END
16351635
r5932r5933
16781678   MDRV_IMPORT_FROM( pc_hdc )
16791679
16801680   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1681   
1681
16821682   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
16831683MACHINE_DRIVER_END
16841684
r5932r5933
17341734   MDRV_IMPORT_FROM( pc_hdc )
17351735
17361736   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1737   
1737
17381738   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
17391739MACHINE_DRIVER_END
17401740
r5932r5933
17761776   MDRV_IMPORT_FROM( pc_hdc )
17771777
17781778   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1779   
1779
17801780   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
17811781MACHINE_DRIVER_END
17821782
r5932r5933
18201820   MDRV_IMPORT_FROM( pc_hdc )
18211821
18221822   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1823   
1823
18241824   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
18251825MACHINE_DRIVER_END
18261826
r5932r5933
18641864   MDRV_IMPORT_FROM( pc_hdc )
18651865
18661866   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1867   
1867
18681868   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
18691869MACHINE_DRIVER_END
18701870
r5932r5933
19201920   MDRV_IMPORT_FROM( pc_hdc )
19211921
19221922   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1923   
1923
19241924   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
19251925MACHINE_DRIVER_END
19261926
r5932r5933
19641964   MDRV_IMPORT_FROM( pc_hdc )
19651965
19661966   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
1967   
1967
19681968   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
19691969MACHINE_DRIVER_END
19701970
r5932r5933
20082008   MDRV_IMPORT_FROM( pc_hdc )
20092009
20102010   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
2011   
2011
20122012   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
20132013MACHINE_DRIVER_END
20142014
r5932r5933
20522052   MDRV_NEC765A_ADD("nec765", pc_fdc_nec765_not_connected_interface)
20532053
20542054   MDRV_FLOPPY_2_DRIVES_ADD(ibmpc_floppy_config)
2055   
2055
20562056   /* cartridge */
20572057   MDRV_CARTSLOT_ADD("cart1")
20582058   MDRV_CARTSLOT_EXTENSION_LIST("jrc")
r5932r5933
21262126ROM_START( ibm5150 )
21272127   ROM_REGION(0x100000,"maincpu", 0)
21282128   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
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 */
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 */
21302130
21312131   /* 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) */
21362136
21372137   /* IBM PC 5150 (rev 3: 1501-476 10/27/82) 5-screw case 64-256k MB w/1501981 CGA Card, ROM Basic 1.1 */
21382138   ROM_DEFAULT_BIOS( "rev3" )
r5932r5933
21612161   ROMX_LOAD("5700671.u33", 0xfe000, 0x2000, CRC(b7d4ec46) SHA1(bdb06f846c4768f39eeff7e16b6dbff8cd2117d2), ROM_BIOS(3))
21622162
21632163   /* 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 */
21672167
21682168   /* IBM 1501981(CGA) and 1501985(MDA) Character rom */
21692169   ROM_REGION(0x2000,"gfx1", 0)
r5932r5933
22362236ROM_START( pc )
22372237   ROM_REGION(0x100000,"maincpu", 0)
22382238   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
2239//   ROM_LOAD("xthdd.rom",  0xc8000, 0x02000, CRC(a96317da))
2239//  ROM_LOAD("xthdd.rom",  0xc8000, 0x02000, CRC(a96317da))
22402240   ROM_LOAD("pcxt.rom",    0xfe000, 0x02000, CRC(031aafad) SHA1(a641b505bbac97b8775f91fe9b83d9afdf4d038f))
22412241
22422242   /* IBM 1501981(CGA) and 1501985(MDA) Character rom */
r5932r5933
23602360
23612361ROM_START( t1000rl )
23622362   ROM_REGION(0x100000,"maincpu", 0)
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
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
23642364
23652365   /* v2.0.0.1 */
23662366   /* Rom is labeled "(C) TANDY CORP. 1990 // 8079073 // LH534G70 JAPAN // 9034 D" */
r5932r5933
23762376ROM_START( ibm5160 )
23772377   ROM_REGION16_LE(0x100000,"maincpu", 0)
23782378   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
2379//   ROM_LOAD("600963.u12", 0xc8000, 0x02000, CRC(f3daf85f) SHA1(3bd29538832d3084cbddeec92593988772755283))  /* Tandon/Western Digital Fixed Disk Adapter 600963-001__TYPE_5.U12.2764.bin */
2379//  ROM_LOAD("600963.u12", 0xc8000, 0x02000, CRC(f3daf85f) SHA1(3bd29538832d3084cbddeec92593988772755283))  /* Tandon/Western Digital Fixed Disk Adapter 600963-001__TYPE_5.U12.2764.bin */
23802380
23812381   /* 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
23862386                  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))
23962396
23972397   /* 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) */
24022402
24032403
24042404   ROM_DEFAULT_BIOS( "rev4" )
r5932r5933
24192419   ROMX_LOAD("68x4370.u19", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2), ROM_BIOS(4))
24202420   ROMX_LOAD("62x0890.u18", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb), ROM_BIOS(4))
24212421
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) )
24282428
24292429   /* IBM 1501981(CGA) and 1501985(MDA) Character rom */
24302430   ROM_REGION(0x2000,"gfx1", 0)
24312431   ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f)) /* "AMI 8412PI // 5788005 // (C) IBM CORP. 1981 // KOREA" */
24322432
24332433   /* 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 */
24372437
24382438
24392439   /* PC/3270 and AT/3270 have a set of two (optionally 3) 3270PGC programmable graphics controller cards on them which
24402440           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.
24592459
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)
24702470
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)
24802480
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)
24882488//      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*/
24892489//      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*/
24902490
r5932r5933
25052505/*
25062506Sinclair PC200 ROMs (from a v1.2 PC200):
25072507
250840109.ic159     -- Character set, the same as in the 1.5 PC200. Label:
2509     
2510         AMSTRAD
2511         40109
2512         8827 B
250840109.ic159     -- Character set, the same as in the 1.5 PC200. Label:
25132509
251440184.ic132   -- BIOS v1.2.
251540185.ic129      Labels are:
2510            AMSTRAD
2511            40109
2512            8827 B
25162513
2517         AMSTRAD         AMSTRAD
2518         40184         40185
2519         V1.2:5EA8      V1.2:A058
251440184.ic132 -- BIOS v1.2.
251540185.ic129    Labels are:
2516
2517            AMSTRAD         AMSTRAD
2518            40184           40185
2519            V1.2:5EA8       V1.2:A058
25202520*/
25212521ROM_START( pc200 )
25222522//    ROM_REGION(0x100000,"maincpu", 0)
r5932r5933
26442644SYSTEM_CONFIG_END
26452645
26462646static SYSTEM_CONFIG_START(pcjr)
2647//   CONFIG_RAM( 128 * 1024 )
2647//  CONFIG_RAM( 128 * 1024 )
26482648   CONFIG_RAM_DEFAULT( 640 * 1024 )
2649//   CONFIG_RAM( 768 * 1024 )
2649//  CONFIG_RAM( 768 * 1024 )
26502650SYSTEM_CONFIG_END
26512651
26522652/***************************************************************************
src/mess/drivers/pecom.c
r5932r5933
3131   AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1869_TAG, cdp1869_out5_w)
3232   AM_RANGE(0x06, 0x06) AM_DEVWRITE(CDP1869_TAG, cdp1869_out6_w)
3333   AM_RANGE(0x07, 0x07) AM_DEVWRITE(CDP1869_TAG, cdp1869_out7_w)
34ADDRESS_MAP_END
34ADDRESS_MAP_END
3535
3636/* Input ports */
3737/* Pecom 64 keyboard layout is as follows
r5932r5933
156156   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ch") PORT_CODE(KEYCODE_UP)  //ch up
157157   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(DEL))
158158
159   PORT_START("CNT")     
159   PORT_START("CNT")
160160   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2)
161161   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_1)
162162   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
r5932r5933
178178/* Machine driver */
179179static MACHINE_DRIVER_START( pecom64 )
180180   MDRV_DRIVER_DATA(pecom_state)
181   
182    /* basic machine hardware */
181
182    /* basic machine hardware */
183183   MDRV_CPU_ADD("maincpu", CDP1802, CDP1869_DOT_CLK_PAL/3)
184184   MDRV_CPU_PROGRAM_MAP(pecom64_mem)
185185     MDRV_CPU_IO_MAP(pecom64_io)
186186     MDRV_CPU_CONFIG(pecom64_cdp1802_config)
187     
187
188188     MDRV_MACHINE_START( pecom )
189189     MDRV_MACHINE_RESET( pecom )
190     
190
191191   // sound and video hardware
192192
193193   MDRV_IMPORT_FROM(pecom_video)
194   
194
195195   MDRV_CASSETTE_ADD( "cassette", pecom_cassette_config )
196196MACHINE_DRIVER_END
197197
r5932r5933
208208
209209/* Driver */
210210
211/*    YEAR  NAME   PARENT  COMPAT        MACHINE     INPUT   INIT     CONFIG    COMPANY  FULLNAME      FLAGS */
211/*    YEAR  NAME   PARENT  COMPAT       MACHINE     INPUT   INIT    CONFIG   COMPANY  FULLNAME      FLAGS */
212212COMP( 1987, pecom64,     0,      0,    pecom64,    pecom,    pecom, pecom64,  "Ei Nis", "Pecom 64",   0)
src/mess/drivers/ptcsol.c
r5932r5933
1717      - DPMON (3rd party)
1818
1919    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
2121        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
2323        SOL-20 board only
2424
2525****************************************************************************/
src/mess/drivers/pce.c
r5932r5933
205205   MDRV_SOUND_ROUTE( 1, "rspeaker", 1.00 )
206206
207207   MDRV_CDROM_ADD( "cdrom" )
208   
208
209209   MDRV_IMPORT_FROM( pce_cartslot )
210210MACHINE_DRIVER_END
211211
r5932r5933
246246   MDRV_SOUND_ADD( "cdda", CDDA, 0 )
247247   MDRV_SOUND_ROUTE( 0, "lspeaker", 1.00 )
248248   MDRV_SOUND_ROUTE( 1, "rspeaker", 1.00 )
249   
249
250250   MDRV_IMPORT_FROM( pce_cartslot )
251251MACHINE_DRIVER_END
252252
src/mess/drivers/ti99_4x.c
r5932r5933
5353   AM_RANGE(0x0000, 0x1fff) AM_ROM                              /*system ROM*/
5454   AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ti99_nop_8_r, ti99_nop_8_w)   /*lower 8kb of RAM extension - installed dynamically*/
5555   AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4x_peb_r, ti99_4x_peb_w)   /*DSR ROM space*/
56//   AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w)      /*cartridge memory*/
56//  AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w)     /*cartridge memory*/
5757   AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w)
5858   AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAMBANK(1)         /*RAM PAD, mirrored 4 times*/
5959   AM_RANGE(0x8400, 0x87ff) AM_READWRITE(ti99_nop_8_r, ti99_wsnd_w)   /*soundchip write*/
r5932r5933
144144         PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
145145         PORT_DIPSETTING( 1 << config_pcode_bit, DEF_STR( On ) )
146146
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")
148148         PORT_DIPSETTING( 0, "auto" )
149149         PORT_DIPSETTING( 1 << config_cartslot_bit, "Slot 1" )
150150         PORT_DIPSETTING( 2 << config_cartslot_bit, "Slot 2" )
r5932r5933
510510
511511static const mm58274c_interface floppy_mm58274c_interface =
512512{
513   1,   /*    mode 24*/
513   1,   /* mode 24*/
514514   0   /*  first day of week */
515515};
516516
r5932r5933
560560
561561   MDRV_CASSETTE_ADD( "cassette1", default_cassette_config )
562562   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
563   
563
564564   /* rtc */
565   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)     
565   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
566566   /* tms9901 */
567   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)   
568   
567   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)
568
569569   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
573573   MDRV_TI99_CARTRIDGE_ADD("ti99_multicart")
574   
574
575575   MDRV_SMARTMEDIA_ADD("smartmedia")
576   
576
577577   MDRV_TI99_4_RS232_CARD_ADD("rs232")
578578MACHINE_DRIVER_END
579579
r5932r5933
615615   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
616616
617617   /* rtc */
618   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)   
618   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
619619   /* tms9901 */
620   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)   
621   
620   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)
621
622622   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
625625   MDRV_TI99_CARTRIDGE_ADD("ti99_multicart")
626   
627   MDRV_SMARTMEDIA_ADD("smartmedia")   
628   
626
627   MDRV_SMARTMEDIA_ADD("smartmedia")
628
629629   MDRV_TI99_4_RS232_CARD_ADD("rs232")
630630MACHINE_DRIVER_END
631631
r5932r5933
667667   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
668668
669669   /* rtc */
670   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)   
671   
670   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
671
672672   /* 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
678678   MDRV_TI99_CARTRIDGE_ADD("ti99_multicart")
679   
680   MDRV_SMARTMEDIA_ADD("smartmedia")   
681   
679
680   MDRV_SMARTMEDIA_ADD("smartmedia")
681
682682   MDRV_TI99_4_RS232_CARD_ADD("rs232")
683683MACHINE_DRIVER_END
684684
r5932r5933
721721   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
722722
723723   /* rtc */
724   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)     
724   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
725725   /* tms9901 */
726   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)   
727   
726   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)
727
728728   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
731731   MDRV_TI99_CARTRIDGE_ADD("ti99_multicart")
732732
733733   MDRV_SMARTMEDIA_ADD("smartmedia")
734   
734
735735   MDRV_TI99_4_RS232_CARD_ADD("rs232")
736736MACHINE_DRIVER_END
737737
r5932r5933
782782   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
783783
784784   /* rtc */
785   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)   
785   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
786786   /* tms9901 */
787787   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)
791791   MDRV_TI99_CARTRIDGE_ADD("ti99_multicart")
792792   MDRV_SMARTMEDIA_ADD("smartmedia")
793   
793
794794   MDRV_TI99_4_RS232_CARD_ADD("rs232")
795795MACHINE_DRIVER_END
796796
r5932r5933
849849   ROM_LOAD_OPTIONAL("bwg.bin", offset_bwg_dsr, 0x8000, CRC(06f1ec89) SHA1(6ad77033ed268f986d9a5439e65f7d391c4b7651)) /* BwG disk DSR ROM */
850850   ROM_LOAD_OPTIONAL("hfdc.bin", offset_hfdc_dsr, 0x4000, CRC(66fbe0ed) SHA1(11df2ecef51de6f543e4eaf8b2529d3e65d0bd59)) /* HFDC disk DSR ROM */
851851   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
856856   /* HSGPL memory space */
857857   ROM_REGION(region_hsgpl_len, region_hsgpl, ROMREGION_ERASEFF)
858858
src/mess/drivers/vc4000.c
r5932r5933
2929Type 1: 2K Rom or EPROM mapped from $0000 - $07FF
3030Type 2: 4K Rom or EPROM mapped from $0000 - $0FFF
3131Type 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
3434Type 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
3737
3838One other type is known for Radofin (compatible to VC4000, but not the Cartridge Pins)
3939which consisted of 2K ROM and 2K RAM which are properly mapped as follows:
r5932r5933
4444
4545Go to the bottom to see the game list and emulation status of each.
4646******************************************************************************/
47   
47
4848#include "driver.h"
4949#include "cpu/s2650/s2650.h"
5050
5151#include "includes/vc4000.h"
5252#include "devices/cartslot.h"
53#include "devices/snapquik.h"
53#include "devices/snapquik.h"
5454
5555static QUICKLOAD_LOAD( vc4000 );
5656
r5932r5933
174174   MAKE_RGB(200, 200, 0), // yellow
175175   MAKE_RGB(200, 200, 200), // white
176176   /* 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 */
179179};
180180
181181static PALETTE_INIT( vc4000 )
r5932r5933
207207      memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x1000);
208208      memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x1000);
209209   }
210     
210
211211   if (size > 0)
212212   {
213213      image_fread(image, memory_region(machine, "maincpu") + 0x0000, size);
r5932r5933
218218
219219static MACHINE_DRIVER_START( vc4000 )
220220   /* basic machine hardware */
221//   MDRV_CPU_ADD("maincpu", S2650, 865000)        /* 3550000/4, 3580000/3, 4430000/3 */
221//  MDRV_CPU_ADD("maincpu", S2650, 865000)        /* 3550000/4, 3580000/3, 4430000/3 */
222222   MDRV_CPU_ADD("maincpu", S2650, 3546875/4)
223223   MDRV_CPU_PROGRAM_MAP(vc4000_mem)
224224   MDRV_CPU_IO_MAP(vc4000_io)
r5932r5933
274274   read_ = image_fread(image, quick_data, quick_length);
275275   if (read_ != quick_length)
276276      return INIT_FAIL;
277   
277
278278   if (quick_data[0] != 2)
279279      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
283283   //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
289289   for (i = 0; i < quick_length - 5; i++)
290290   {   if ((quick_addr + i) < 0x1000)
291291         memory_write_byte(space, i + quick_addr, quick_data[i+5]);
292292   }
293   
293
294294   logerror("quick loading at %.4x size:%.4x\n", quick_addr, (quick_length-5));
295295   return INIT_PASS;
296296}
297297
298298
299/*   YEAR   NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   CONFIG   COMPANY      FULLNAME */
299/*   YEAR   NAME    PARENT  COMPAT  MACHINE INPUT   INIT    CONFIG  COMPANY     FULLNAME */
300300CONS(1978,   vc4000,   0,   0,   vc4000,   vc4000,   0,   0,   "Interton",   "VC 4000", GAME_IMPERFECT_GRAPHICS )
301301
302/*   Game List and Emulation Status
302/*  Game List and Emulation Status
303303
304304When you load a game it will normally appear to be unresponsive. Most carts contain a number of variants
305305of each game (e.g. Difficulty, Player1 vs Player2 or Player1 vs Computer, etc).
r5932r5933
318318
319319The game names and numbers were obtained from the Amigan Software site.
320320
321Cart Num   Name
321Cart Num    Name
322322----------------------------------------------
3231.      Grand Prix / Car Races / Autosport / Motor Racing / Road Race
3231.      Grand Prix / Car Races / Autosport / Motor Racing / Road Race
324324Config: Paddle, NAC
325325Status: Working
326326Controls: Left-Right: Steer; Up: Accelerate
327327
3282.      Black Jack
3282.      Black Jack
329329Status: Not working (some digits missing; indicator missing; dealer's cards missing)
330330Controls: 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)
331331Indicator: E make a bet then deal; I choose insurance; - you lost; + you won; X hit or stay
332332
3333.      Olympics / Paddle Games / Bat & Ball / Pro Sport 60 / Sportsworld
3333.      Olympics / Paddle Games / Bat & Ball / Pro Sport 60 / Sportsworld
334334Config: Paddle, NAC
335335Status: Working
336336
3374.      Tank Battle / Combat
3374.      Tank Battle / Combat
338338Config: Button, 90
339339Status: Working
340340Controls: Left-Right: Steer; Up: Accelerate; Fire: Shoot
341341
3425.      Maths 1
3425.      Maths 1
343343Status: Working
344344Controls: 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
345345
3466.      Maths 2
3466.      Maths 2
347347Status: Not working
348348Controls: Same as above.
349349
3507.      Air Sea Attack / Air Sea Battle
3507.      Air Sea Attack / Air Sea Battle
351351Config: Button, 90
352352Status: Working
353353Controls: Left-Right: Move; Fire: Shoot
354354
3558.      Treasure Hunt / Capture the Flag / Concentration / Memory Match
3558.      Treasure Hunt / Capture the Flag / Concentration / Memory Match
356356Config: Buttons
357357Status: Working
358358
3599.      Labyrinth / Maze / Intelligence 1
3599.      Labyrinth / Maze / Intelligence 1
360360Config: Buttons
361361Status: Working
362362
36310.      Winter Sports
36310.     Winter Sports
364364Notes: Background colours should be Cyan and White instead of Red and Black
365365
36611.      Hippodrome / Horse Race
36611.     Hippodrome / Horse Race
367367
36812.      Hunting / Shooting Gallery
36812.     Hunting / Shooting Gallery
369369
37013.      Chess 1
37013.     Chess 1
371371Status: Can't see what you're typing, wrong colours
372372
37314.      Moto-cros
37314.     Moto-cros
374374
37515.      Four in a row / Intelligence 2
37515.     Four in a row / Intelligence 2
376376Config: Buttons
377377Status: Working
378378Notes: Seems the unused squares should be black. The screen jumps about while the computer is "thinking".
379379
38016.      Code Breaker / Master Mind / Intelligence 3 / Challenge
38016.     Code Breaker / Master Mind / Intelligence 3 / Challenge
381381
38217.      Circus
38217.     Circus
383383STatus: severe gfx issues
384384
38518.      Boxing / Prize Fight
38518.     Boxing / Prize Fight
386386
38719.      Outer Space / Spacewar / Space Attack / Outer Space Combat
38719.     Outer Space / Spacewar / Space Attack / Outer Space Combat
388388
38920.      Melody Simon / Musical Memory / Follow the Leader / Musical Games / Electronic Music / Face the Music
38920.     Melody Simon / Musical Memory / Follow the Leader / Musical Games / Electronic Music / Face the Music
390390
39121.      Capture / Othello / Reversi / Attack / Intelligence 4
39121.     Capture / Othello / Reversi / Attack / Intelligence 4
392392Config: Buttons
393393Status: Working
394394Notes: Seems the unused squares should be black
395395
39622.      Chess 2
39622.     Chess 2
397397Status: Can't see what you're typing, wrong colours
398398
39923.      Pinball / Flipper / Arcade
39923.     Pinball / Flipper / Arcade
400400Status: gfx issues
401401
40224.      Soccer
40224.     Soccer
403403
40425.      Bowling / NinePins
40425.     Bowling / NinePins
405405Config: Paddle, rotated 90 degrees, up/down autocentre, left-right does not
406406Status: Working
407407
40826.      Draughts
40826.     Draughts
409409
41027.      Golf
41027.     Golf
411411Status: gfx issues
412412
41328.      Cockpit
41328.     Cockpit
414414Status: gfx issues
415415
41629.      Metropolis / Hangman
41629.     Metropolis / Hangman
417417Status: gfx issues
418418
41930.      Solitaire
41930.     Solitaire
420420
42131.      Casino
42131.     Casino
422422Status: gfx issues, items missing and unplayable
423423Controls: 1 or 3=START; q=GO; E=STOP; D=$; Z=^; X=tens; C=units
424424
42532.      Invaders / Alien Invasion / Earth Invasion
42532.     Invaders / Alien Invasion / Earth Invasion
426426Status: Works
427427Config: Buttons
428428
42933.      Super Invaders
42933.     Super Invaders
430430Status: Stars are missing, colours are wrong
431431Config: Buttons (90)
432432
43336.      BackGammon
43336.     BackGammon
434434Status: Not all counters are visible, Dice & game number not visible.
435435Controls: Fire=Exec; 1=D+; 3=D-; Q,W,E=4,5,6; A,S,D=1,2,3; Z=CL; X=STOP; C=SET
436436
43737.      Monster Man / Spider's Web
43737.     Monster Man / Spider's Web
438438Status: Works
439439Config: Buttons
440440
44138.      Hyperspace
44138.     Hyperspace
442442Status: Works
443443Config: Buttons (90)
444444Controls: 3 - status button; Q,W,E,A,S,D,Z,X,C selects which galaxy to visit
445445
446446
44740.      Super Space
44740.     Super Space
448448Status: Works, some small gfx issues near the bottom
449449Config: Buttons
450450
src/mess/drivers/pcm.c
r5932r5933
1414static ADDRESS_MAP_START(pcm_mem, ADDRESS_SPACE_PROGRAM, 8)
1515   ADDRESS_MAP_UNMAP_HIGH
1616    AM_RANGE( 0x0000, 0x1fff ) AM_ROM  // ROM
17    AM_RANGE( 0x2000, 0xf7ff ) AM_RAM  // RAM   
17    AM_RANGE( 0x2000, 0xf7ff ) AM_RAM  // RAM
1818    AM_RANGE( 0xf800, 0xffff ) AM_RAM AM_BASE(&pcm_video_ram) // Video RAM
1919ADDRESS_MAP_END
2020
r5932r5933
2525/* Input ports */
2626INPUT_PORTS_EXTERN( k7659 );
2727
28static MACHINE_RESET(pcm)
29{   
28static MACHINE_RESET(pcm)
29{
3030}
3131
3232static VIDEO_START( pcm )
r5932r5933
3838    UINT8 code;
3939    UINT8 line;
4040   int y, x, j, b;
41   
41
4242   UINT8 *gfx = memory_region(screen->machine, "gfx1");
43   
43
4444   for (y = 0; y < 32; y++)
4545   {
4646      for (x = 0; x < 64; x++)
r5932r5933
5050         {
5151            line = gfx[code*8 + j];
5252            for (b = 0; b < 8; b++)
53            {               
53            {
5454               *BITMAP_ADDR16(bitmap, y*8+j, x * 8 + (7 - b)) =  ((line >> b) & 0x01);
5555            }
5656         }
r5932r5933
6464    /* basic machine hardware */
6565    MDRV_CPU_ADD("maincpu",Z80, XTAL_10MHz /4)
6666    MDRV_CPU_PROGRAM_MAP(pcm_mem)
67    MDRV_CPU_IO_MAP(pcm_io)   
67    MDRV_CPU_IO_MAP(pcm_io)
6868
6969    MDRV_MACHINE_RESET(pcm)
70   
70
7171    /* video hardware */
7272    MDRV_SCREEN_ADD("screen", RASTER)
7373    MDRV_SCREEN_REFRESH_RATE(50)
r5932r5933
8181    MDRV_VIDEO_START(pcm)
8282    MDRV_VIDEO_UPDATE(pcm)
8383MACHINE_DRIVER_END
84
84
8585/* ROM definition */
8686ROM_START( pcm )
8787    ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
r5932r5933
103103   ROM_REGION(0x0800, "gfx1",0)
104104   ROM_LOAD( "charrom.d113", 0x0000, 0x0800, CRC(5684b3c3) SHA1(418054aa70a0fd120611e32059eb2051d3b82b5a))
105105   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) )
107107ROM_END
108108
109109/* Driver */
src/mess/drivers/pk8020.c
r5932r5933
183183
184184   MDRV_VIDEO_START(pk8020)
185185   MDRV_VIDEO_UPDATE(pk8020)
186   
186
187187    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 )
189189    MDRV_I8255A_ADD( "ppi8255_3", pk8020_ppi8255_interface_3 )
190   
190
191191    MDRV_PIT8253_ADD( "pit8253", pk8020_pit8253_intf )
192192
193   MDRV_PIC8259_ADD( "pic8259", pk8020_pic8259_config )   
193   MDRV_PIC8259_ADD( "pic8259", pk8020_pic8259_config )
194194   MDRV_MSM8251_ADD( "rs232", default_msm8251_interface)
195195   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
199199    /* audio hardware */
200200   MDRV_SPEAKER_STANDARD_MONO("mono")
201201   MDRV_SOUND_ADD("speaker", SPEAKER, 0)
202202   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
203203   MDRV_SOUND_WAVE_ADD("wave", "cassette")
204204   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
208208   MDRV_FLOPPY_4_DRIVES_ADD(pk8020_floppy_config)
209209MACHINE_DRIVER_END
210210
r5932r5933
214214    ROM_REGION( 0x16000, "maincpu", ROMREGION_ERASEFF )
215215    ROM_LOAD( "korvet11.rom", 0x10000, 0x6000, CRC(81BDC2AF) SHA1(c3484c3f1f3d252475979283c073286b8661d2b9) )
216216   ROM_REGION( 0x2000, "gfx1", 0 )
217   ROM_LOAD ( "korvet2.fnt", 0x0000, 0x2000, CRC(FB1CD3D4))   
217   ROM_LOAD ( "korvet2.fnt", 0x0000, 0x2000, CRC(FB1CD3D4))
218218ROM_END
219219
220220static SYSTEM_CONFIG_START(pk8020)
src/mess/drivers/bbc.c
r5932r5933
268268
269269   AM_RANGE(0xfc00, 0xfeff) AM_READWRITE(SMH_BANK(8)         , bbcm_w         )   /*    this is now processed directly because it can be ROM or hardware */
270270
271   //AM_RANGE(0xfc00, 0xfeff) AM_READWRITE(bbcm_r         , bbcm_w         )   /*    this is now processed directly because it can be ROM or hardware */
271   //AM_RANGE(0xfc00, 0xfeff) AM_READWRITE(bbcm_r          , bbcm_w            )   /*    this is now processed directly because it can be ROM or hardware */
272272   /*
273273    AM_RANGE(0xfc00, 0xfdff) AM_READWRITE(SMH_BANK(2)        , SMH_ROM          )       fc00-fdff                   FRED & JIM Pages
274274
275275                                                                                          fe00-feff                 Shiela Address Page
276276    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)
279279    AM_RANGE(0xfe10, 0xfe17) AM_NOP                                                       fe10-fe17  Serial ULA     Serial system chip
280280    AM_RANGE(0xfe18, 0xfe1f) M_DEVREADWRITE(UPD7002, "uPD7002",uPD7002_r, uPD7002_w )         fec0-fedf  uPD7002        Analogue to digital converter
281281    AM_RANGE(0xfe20, 0xfe23) AM_READWRITE(return8_FE        , bbc_videoULA_w        )         fe20-fe23  Video ULA      Video system chip
r5932r5933
827827   /* devices */
828828   MDRV_UPD7002_ADD("upd7002",BBC_uPD7002)
829829   MDRV_VIA6522_ADD("via6522_0", 1000000, bbcb_system_via)
830   
830
831831   MDRV_I8271_ADD("i8271", bbc_i8271_interface)
832832MACHINE_DRIVER_END
833833
r5932r5933
842842   MDRV_VIA6522_ADD("via6522_1", 1000000, bbcb_user_via)
843843   MDRV_CENTRONICS_ADD("centronics", bbcb_centronics_config)
844844
845   MDRV_WD177X_ADD("wd177x", bbc_wd17xx_interface )   
845   MDRV_WD177X_ADD("wd177x", bbc_wd17xx_interface )
846846   MDRV_FLOPPY_2_DRIVES_ADD(bbc_floppy_config)
847847   MDRV_IMPORT_FROM(bbc_cartslot)
848848MACHINE_DRIVER_END
r5932r5933
926926   MDRV_UPD7002_ADD("upd7002",BBC_uPD7002)
927927   MDRV_VIA6522_ADD("via6522_0", 1000000, bbcb_system_via)
928928   MDRV_VIA6522_ADD("via6522_1", 1000000, bbcb_user_via)
929     
929
930930   MDRV_WD177X_ADD("wd177x", bbc_wd17xx_interface )
931931   MDRV_FLOPPY_2_DRIVES_ADD(bbc_floppy_config)
932932
src/mess/drivers/gba.c
r5932r5933
77  By R. Belmont & Harmony
88
99  TODO:
10  - Raster timing issues.  Castlevania (HOD and AOS)'s raster effects
10  - Raster timing issues.  Castlevania (HOD and AOS)'s raster effects
1111    work if the VBlank is fired on scanline 0, else they're offset by
1212    the height of the vblank region.  Is scanline 0 the start of the
1313    visible area?
r5932r5933
100100
101101   ch = param;
102102
103//   printf("dma complete: ch %d\n", ch);
103//  printf("dma complete: ch %d\n", ch);
104104
105105   timer_adjust_oneshot(gba_state->dma_timer[ch], attotime_never, 0);
106106
r5932r5933
116116   // always clear active for immediate DMAs though
117117   if (!((ctrl>>9) & 1) || ((ctrl & 0x3000) == 0))
118118   {
119//      printf("clear active for ch %d\n", ch);
119//      printf("clear active for ch %d\n", ch);
120120      gba_state->dma_regs[(ch*3)+2] &= ~0x80000000;   // clear "active" bit
121121   }
122122   else
r5932r5933
182182   }
183183   else
184184   {
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");
187187   }
188188
189189   for (i = 0; i < cnt; i++)
r5932r5933
266266   gba_state->dma_src[ch] = src;
267267   gba_state->dma_dst[ch] = dst;
268268
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);
271271   dma_complete(machine, NULL, ch);
272272}
273273
r5932r5933
367367   FPTR tmr = (FPTR) param;
368368   gba_state *gba_state = machine->driver_data;
369369
370//   printf("Timer %d expired, SOUNDCNT_H %04x\n", tmr, gba_state->SOUNDCNT_H);
370//  printf("Timer %d expired, SOUNDCNT_H %04x\n", tmr, gba_state->SOUNDCNT_H);
371371
372372   // check if timers 0 or 1 are feeding directsound
373373   if (tmr == 0)
r5932r5933
839839            double time, ticks;
840840            int timer = offset-(0x100/4);
841841
842//            printf("Read timer reg %x (PC=%x)\n", timer, cpu_get_pc(space->cpu));
842//              printf("Read timer reg %x (PC=%x)\n", timer, cpu_get_pc(space->cpu));
843843
844            // update times for
844            // update times for
845845            if (gba_state->timer_regs[timer] & 0x800000)
846846            {
847847               time = attotime_to_double(timer_timeelapsed(gba_state->tmr_timer[timer]));
848848
849849               ticks = (double)(0x10000 - (gba_state->timer_regs[timer] & 0xffff));
850850
851//               printf("time %f ticks %f 1/hz %f\n", time, ticks, 1.0 / gba_state->timer_hz[timer]);
851//                  printf("time %f ticks %f 1/hz %f\n", time, ticks, 1.0 / gba_state->timer_hz[timer]);
852852
853853               time *= ticks;
854854               time /= (1.0 / gba_state->timer_hz[timer]);
855855
856856               elapsed = (UINT32)time;
857857
858//               printf("elapsed = %x\n", elapsed);
858//                  printf("elapsed = %x\n", elapsed);
859859            }
860860            else
861861            {
862//               printf("Reading inactive timer!\n");
862//                  printf("Reading inactive timer!\n");
863863               elapsed = 0;
864864            }
865865
r5932r5933
973973      case 0x0200/4:
974974         if( (mem_mask) & 0x0000ffff )
975975         {
976//            printf("Read: IE (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), gba_state->IE );
976//              printf("Read: IE (%08x) = %04x\n", 0x04000000 + ( offset << 2 ), gba_state->IE );
977977         }
978978         if( (mem_mask) & 0xffff0000 )
979979         {
r5932r5933
10081008         retval = gba_state->HALTCNT << 8;
10091009         break;
10101010      default:
1011//         verboselog(machine, 0, "Unknown GBA I/O register Read: %08x (%08x)\n", 0x04000000 + ( offset << 2 ), ~mem_mask );
1011//          verboselog(machine, 0, "Unknown GBA I/O register Read: %08x (%08x)\n", 0x04000000 + ( offset << 2 ), ~mem_mask );
10121012         break;
10131013   }
10141014   return retval;
r5932r5933
15861586
15871587            ch = offset / 3;
15881588
1589//            printf("%08x: DMA(%d): %x to reg %d (mask %08x)\n", activecpu_get_pc(), ch, data, offset%3, ~mem_mask);
1589//              printf("%08x: DMA(%d): %x to reg %d (mask %08x)\n", activecpu_get_pc(), ch, data, offset%3, ~mem_mask);
15901590
15911591            if (((offset % 3) == 2) && ((~mem_mask & 0xffff0000) == 0))
15921592            {
r5932r5933
16281628
16291629            COMBINE_DATA(&gba_state->timer_regs[offset]);
16301630
1631//            printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, cpu_get_pc(space->cpu));
1631//              printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, cpu_get_pc(space->cpu));
16321632
16331633            if (ACCESSING_BITS_0_15)
16341634            {
r5932r5933
16481648
16491649               gba_state->timer_hz[offset] = final;
16501650
1651//               printf("Enabling timer %d @ %f Hz\n", offset, final);
1651//                  printf("Enabling timer %d @ %f Hz\n", offset, final);
16521652
16531653               // enable the timer
16541654               if( !(data & 0x40000) ) // if we're not in Count-Up mode
r5932r5933
16971697      case 0x0130/4:
16981698         if( (mem_mask) & 0xffff0000 )
16991699         {
1700//            printf("KEYCNT = %04x\n", data>>16);
1700//              printf("KEYCNT = %04x\n", data>>16);
17011701            verboselog(machine, 2, "GBA IO Register Write: KEYCNT (%08x) = %04x (%08x)\n", 0x04000000 + ( offset << 2 ), ( data & mem_mask ) >> 16, ~mem_mask );
17021702                gba_state->KEYCNT = ( gba_state->KEYCNT & ( ~mem_mask >> 16 ) ) | ( ( data & mem_mask ) >> 16 );
17031703         }
r5932r5933
17631763      case 0x0200/4:
17641764         if( (mem_mask) & 0x0000ffff )
17651765         {
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));
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));
17671767            gba_state->IE = ( gba_state->IE & ~mem_mask ) | ( data & mem_mask );
17681768             /*
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                */
17741774         }
17751775         if( (mem_mask) & 0xffff0000 )
17761776         {
r5932r5933
18321832         }
18331833         break;
18341834      default:
1835//         verboselog(machine, 0, "Unknown GBA I/O register write: %08x = %08x (%08x)\n", 0x04000000 + ( offset << 2 ), data, ~mem_mask );
1835//          verboselog(machine, 0, "Unknown GBA I/O register write: %08x = %08x (%08x)\n", 0x04000000 + ( offset << 2 ), data, ~mem_mask );
18361836         break;
18371837   }
18381838}
r5932r5933
22522252   switch (gba_state->eeprom_state)
22532253   {
22542254      case EEP_IDLE:
2255//         printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), 1);
2255//          printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), 1);
22562256         return 0x00010001;   // "ready"
22572257         break;
22582258
r5932r5933
22712271         if ((gba_state->eeprom_bits == 0) && (gba_state->eeprom_count))
22722272         {
22732273            gba_state->eep_data = gba_state->gba_eeprom[gba_state->eeprom_addr];
2274             //      printf("EEPROM read @ %x = %x (%x)\n", gba_state->eeprom_addr, gba_state->eep_data, (gba_state->eep_data & 0x80) ? 1 : 0);
2274             //       printf("EEPROM read @ %x = %x (%x)\n", gba_state->eeprom_addr, gba_state->eep_data, (gba_state->eep_data & 0x80) ? 1 : 0);
22752275            gba_state->eeprom_addr++;
22762276            gba_state->eeprom_bits = 8;
22772277         }
r5932r5933
22882288            gba_state->eeprom_state = EEP_IDLE;
22892289         }
22902290
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);
22932293         return out;
22942294         break;
22952295   }
2296//   printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), 0);
2296//  printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), 0);
22972297   return 0;
22982298}
22992299
r5932r5933
23062306      data >>= 16;
23072307   }
23082308
2309//   printf("eeprom_w: %x @ %x (state %d) (PC=%x)\n", data, offset, gba_state->eeprom_state, activecpu_get_pc());
2309//  printf("eeprom_w: %x @ %x (state %d) (PC=%x)\n", data, offset, gba_state->eeprom_state, activecpu_get_pc());
23102310
23112311   switch (gba_state->eeprom_state)
23122312   {
src/mess/drivers/bbcbc.c
r5932r5933
1717
1818#define MAIN_CLOCK XTAL_4_433619MHz
1919
20   
20
2121static ADDRESS_MAP_START( bbcbc_prg, ADDRESS_SPACE_PROGRAM, 8 )
2222   AM_RANGE(0x00000, 0x03fff) AM_ROM
2323   AM_RANGE(0x04000, 0x0bfff) AM_ROM
r5932r5933
143143   MDRV_IMPORT_FROM( tms9928a )
144144   MDRV_SCREEN_MODIFY("screen")
145145   MDRV_SCREEN_REFRESH_RATE( 50 )
146   
146
147147   MDRV_CARTSLOT_ADD("cart")
148148MACHINE_DRIVER_END
149149
src/mess/drivers/kc.c
r5932r5933
204204
205205
206206
207/* this is a fake keyboard layout. The keys are converted into codes
208which 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
208which are transmitted by the keyboard to the base-unit. key code can
209209be calculated as (line*8)+bit_index */
210210
211211/* 2008-05 FP:
r5932r5933
367367
368368   //FIX: put right clock value for CTC
369369   MDRV_Z80CTC_ADD( "z80ctc_1", KC85_4_CLOCK, kc85_disc_ctc_intf )
370   
370
371371   MDRV_NEC765A_ADD("nec765", kc_fdc_interface)
372372MACHINE_DRIVER_END
373373
r5932r5933
430430   MDRV_IMPORT_FROM( cpu_kc_disc )
431431   MDRV_QUANTUM_TIME(HZ(120))
432432   MDRV_MACHINE_RESET( kc85_4d )
433   
433
434434   MDRV_FLOPPY_4_DRIVES_ADD(kc85_floppy_config)
435435MACHINE_DRIVER_END
436436
r5932r5933
443443    ROM_SYSTEM_BIOS(0, "caos42", "CAOS 4.2" )
444444    ROMX_LOAD("caos__c0.854", 0x12000, 0x1000, CRC(57d9ab02) SHA1(774fc2496a59b77c7c392eb5aa46420e7722797e), ROM_BIOS(1))
445445    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" )
447447     ROMX_LOAD( "caos41c.854", 0x12000, 0x1000, CRC(c7e1c011) SHA1(acd998e3d9e8f592cd884aafc8ac4d291e40e097), ROM_BIOS(2))
448448     ROMX_LOAD( "caos41e.854", 0x13000, 0x2000, CRC(60e045e5) SHA1(e19819fb477dcb742a13729a9bf5943d63abe863), ROM_BIOS(2))
449449ROM_END
r5932r5933
454454    ROM_SYSTEM_BIOS(0, "caos42", "CAOS 4.2" )
455455    ROMX_LOAD("caos__c0.854", 0x12000, 0x1000, CRC(57d9ab02) SHA1(774fc2496a59b77c7c392eb5aa46420e7722797e), ROM_BIOS(1))
456456    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" )
458458     ROMX_LOAD( "caos41c.854", 0x12000, 0x1000, CRC(c7e1c011) SHA1(acd998e3d9e8f592cd884aafc8ac4d291e40e097), ROM_BIOS(2))
459459     ROMX_LOAD( "caos41e.854", 0x13000, 0x2000, CRC(60e045e5) SHA1(e19819fb477dcb742a13729a9bf5943d63abe863), ROM_BIOS(2))
460460
r5932r5933
475475   ROM_SYSTEM_BIOS(4, "pi88sw", "OS PI/88 (black/white)" )
476476   ROMX_LOAD( "pi88_sw.853",  0x12000, 0x2000, CRC(f7d2e8fc) SHA1(9b5c068f10ff34bc3253f5b51abad51c8da9dd5d), ROM_BIOS(5))
477477   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))
479479ROM_END
480480
481481ROM_START(kc85_2)
r5932r5933
483483   ROM_SYSTEM_BIOS(0, "hc900", "HC900 CAOS" )
484484   ROMX_LOAD( "hc900.852",    0x12000, 0x2000, CRC(e6f4c0ab) SHA1(242a777788c774c5f764313361b1e0a65139ab32), ROM_BIOS(1))
485485   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))
487487ROM_END
488488
489489ROM_START(kc85_5)
r5932r5933
492492   ROM_LOAD("basic_c0.855", 0x10000, 0x8000, CRC(0ed9f8b0) SHA1(be2c68a5b461014c57e33a127c3ffb32b0ff2346))
493493    ROM_SYSTEM_BIOS(0, "caos44", "CAOS 4.4" )
494494    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" )
497497   ROMX_LOAD( "caos43c.855", 0x18000, 0x2000, CRC(2f0f9eaa) SHA1(5342be5104206d15e7471b094c7749a8a3d708ad), ROM_BIOS(2))
498498   ROMX_LOAD( "caos43e.855", 0x1A000, 0x2000, CRC(b66fc6c3) SHA1(521ac2fbded4148220f8af2d5a5ab99634364079), ROM_BIOS(2))
499499ROM_END

Previous 15994 Revisions Next


© 1998-2018 The MESS Team