Previous 15994 Revisions Next

r1462 Sunday 30th December, 2007 at 23:56:29 UTC by Nathan Woods
Removed whitespace [Atari Ace]
[src/mess]artworkx.c device.c device.h filemngr.c hashfile.c image.c image.h infomess.c inputx.c inputx.h messdriv.c mesvalid.c mscommon.c osdmess.h pile.c tapectrl.c
[src/mess/audio]arcadia.c dave.c dave.h lynx.c mea8000.c odyssey2.c sblaster.c svision.c vc4000.c
[src/mess/devices]appldriv.c appldriv.h basicdsk.c cassette.c coco_fdc.c coco_vhd.c cococart.c cococart.h flopdrv.c mflopimg.c printer.h snapquik.c sonydriv.c sonydriv.h thomflop.c
[src/mess/drivers]3do.c a310.c abc80.c abc80x.c acrnsys1.c apple2gs.c at.c atari.c atarist.c avigo.c bbcbc.c c16.c c64.c cgenie.c coco.c coleco.c compis.c coupe.c crvision.c dai.c dgn_beta.c einstein.c ex800.c exidy.c gamecom.c gb.c genesis.c geneve.c glasgow.c hp48.c intv.c ip22.c jaguar.c kc.c lviv.c mac.c mbee.c mephisto.c microtan.c mk2.c mpf1.c msx.c mtx.c nascom1.c odyssey2.c oric.c osi.c pc.c pc8801.c pcw.c pcw16.c pmd85.c pocketc.c ql.c saturn.c sg1000.c sms.c snes.c sord.c spectrum.c ssystem3.c studio2.c super80.c svi318.c svision.c sym1.c thomson.c ti85.c tm990189.c tmc1800.c tmc600.c trs80.c vectrex.c vip.c wswan.c x68k.c z88.c zx.c
[src/mess/formats]ap_dsk35.c apf_apt.c basicdsk.c cassimg.c coco_cas.c coco_dsk.c flopimg.c fmsx_cas.c lviv_lvt.c oric_tap.c pc_dsk.c pmd_pmd.c primoptp.c thom_cas.c thom_cas.h thom_dsk.c thom_dsk.h ti85_ser.c trs_dsk.c vt_dsk.c wavfile.c zx81_p.c
[src/mess/includes]at.h cbmdrive.h centroni.h compis.h crtc6845.h dgn_beta.h europc.h hd6402.h hp48.h i8271.h jupiter.h kc.h mac.h msm8251.h msx_slot.h odyssey2.h pc_ide.h pclpt.h pcw16.h sblaster.h serial.h sym1.h ted7360.h ti85.h z88.h
[src/mess/machine]3do.c 6551.c 68901mfp.c 74145.c 99_dsk.c 99_usbsm.c abcbus.h adam.c amigacd.c amigacrt.c amigafdc.c amigakbd.c amstr_pc.c apple1.c apple2.c apple2gs.c apple3.c applefdc.c applefdc.h at.c atarifdc.c ay3600.c bebox.c c128.c c16.c c64.c cbm.c centroni.c coco.c coleco.c compis.c concept.c corvushd.c dgn_beta.c ds1315.c ds1315.h electron.c europc.c galaxy.c geneve.c hd63450.c hd63450.h hd6402.c hp48.c i8271.c ibmpc.c kc.c lisa.h lviv.c lynx.c mac.c matsucd.c mbee.c mc6843.c mc6846.c mc6846.h mc6854.c mc6854.h mm58274c.c mpc105.c msm8251.c msx.c msx_slot.c ncr5380.c nec765.c nes.c nes_mmc.c odyssey2.c oric.c osi.c pc.c pc1251.c pc1350.c pc1403.c pc_fdc.c pc_hdc.c pc_ide.c pc_joy.c pc_mouse.c pc_turbo.c pclpt.c pdp1.c pet.c pmd85.c primo.c rp5c15.c rriot.c rriot.h smc92x4.c sms.c svi318.c sym1.c tandy1t.c tc8521.c thomson.c ti85.c ti99_4x.c tms5501.c tx0.c vectrex.c wd17xx.c wswan.c z80dart.c
[src/mess/osd/sdl]glob.c sdlmess.c
[src/mess/osd/windows]dialog.c glob.c menu.c messres.h opcntrl.c winutils.c
[src/mess/osd/winui]devview.c messui.c propertiesms.c softwarepicker.c
[src/mess/tools/dat2html]dat2html.c
[src/mess/tools/imgtool]charconv.c filtbas.c iflopimg.c imghd.c imgterrs.h imgtool.c library.h stream.c
[src/mess/tools/imgtool/modules]cococas.c concept.c crt.c d64.c fat.c imgwave.c lynx.c mac.c macbin.c msx_dsk.c nccard.c os9.c prodos.c svi_cas.c t64.c thomson.c ti85.c ti99.c ti990hd.c vmsx_tap.c vzdos.c xsa.c
[src/mess/tools/imgtool/windows]assoc.c assocdlg.c attrdlg.c hexview.c secview.c wimgres.h wimgtool.c wmain.c
[src/mess/tools/messtest]core.c main.c testimgt.c testmess.c
[src/mess/video]abc80.c abc80x.c amstrad.c apple1.c apple2.c apple2gs.c atarist.c avigo.c cdp1861.c cdp1864.c cgapal.c cirrus.c coco.c coco3.c crtc6845.c dai.c dgn_beta.c epnick.h exidy.c galaxy.c gb.c hp48.c i82720.c i82720.h i82720cm.h intv.c kc.c lviv.c m6845.c m6847.c mac.c microtan.c nc.c odyssey2.c oric.c pc1251.c pc1350.c pc1401.c pc1403.c pc8801.c pc_aga.c pc_cga.c pc_mda.c pc_t1t.c pc_vga.c pc_vga.h pc_video.c pcw.c pmd85.c primo.c smsvdp.c ssystem3.c thomson.c thomson.h ti85.c vc4000.c vdc.c vectrex.c x68k.c z88.c zx.c

src/mess/devices/cococart.h
r1461r1462
2020{
2121   COCOCART_LINE_CART,      /* connects to PIA1 CB1 */
2222   COCOCART_LINE_NMI,      /* connects to NMI line on CPU */
23   COCOCART_LINE_HALT      /* connects to HALT line on CPU */   
23   COCOCART_LINE_HALT      /* connects to HALT line on CPU */
2424} cococart_line;
2525
2626typedef enum _cococart_line_value
src/mess/devices/cassette.c
r1461r1462
274274      /* opening an image */
275275      do
276276      {
277         is_writable = image_is_writable(image);
277         is_writable = image_is_writable(image);
278278         cassette_flags = is_writable ? (CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT) : CASSETTE_FLAG_READONLY;
279279         extension = image_filetype(image);
280280         err = cassette_open_choices(image, &mess_ioprocs, extension, formats, cassette_flags, &tag->cassette);
r1461r1462
307307static void device_unload_cassette(mess_image *image)
308308{
309309   struct mess_cassetteimg *tag;
310   
310
311311   tag = get_cassimg(image);
312312
313313   /* if we are recording, write the value to the image */
src/mess/devices/flopdrv.c
r1461r1462
372372   /* inform disk image of step operation so it can cache information */
373373   if (image_exists(img) && pDrive->interface_.seek_callback)
374374      pDrive->interface_.seek_callback(img, pDrive->current_track);
375       
375
376376        pDrive->id_index = 0;
377377}
378378
src/mess/devices/sonydriv.c
r1461r1462
494494{
495495   int id;
496496   device_unload_handler parent_unload;
497   
497
498498   id = image_index_in_device(image);
499499   save_track_data(id);
500500   memset(&sony_floppy[id], 0, sizeof(sony_floppy[id]));
src/mess/devices/sonydriv.h
r1461r1462
11/*********************************************************************
22
33   sonydriv.h
4   
4
55   Apple/Sony 3.5" floppy drive emulation (to be interfaced with applefdc.c)
66
77*********************************************************************/
src/mess/devices/coco_fdc.c
r1461r1462
1111    uses the WD2797, however as this is a built in interface and not an external
1212    cartrige, it is dealt with in the main coco.c file.
1313
14   The wd's variables are mapped to $FF48-$FF4B on the CoCo and on $FF40-$FF43
14   The wd's variables are mapped to $FF48-$FF4B on the CoCo and on $FF40-$FF43
1515    on the Dragon.  In addition, there is another register
1616   called DSKREG that controls the interface with the wd1793.  DSKREG is
1717   detailed below:  But they appear to be
r1461r1462
4141
4242   ---------------------------------------------------------------------------
4343
44   2007-02-22, P.Harvey-Smith
44   2007-02-22, P.Harvey-Smith
4545
4646   Began implementing the Dragon Delta Dos controler, this was actually the first
4747   Dragon disk controler to market, beating Dragon Data's by a couple of months,
4848   it is based around the WD2791 FDC, which is compatible with the WD1793/WD2797 used
4949   by the standard CoCo and Dragon disk controlers except that it used an inverted
50   data bus, which is the reason the read/write handlers invert the data. This 
50   data bus, which is the reason the read/write handlers invert the data. This
5151   controler like, the DragonDos WD2797 is mapped at $FF40-$FF43, in the normal
5252   register order.
53 
54   The Delta cart also has a register (74LS174 hex flipflop) at $FF44 encoded as
53
54   The Delta cart also has a register (74LS174 hex flipflop) at $FF44 encoded as
5555   follows :-
5656
5757   Bit
5858   7 not used
5959   6 not used
60   5 not used
61   4 Single (0) / Double (1) density select
60   5 not used
61   4 Single (0) / Double (1) density select
6262   3 5.25"(0) / 8"(1) Clock select
6363   2 Side select
6464   1 Drive select ms bit
src/mess/devices/mflopimg.c
r1461r1462
122122   mess_flopimg *flopimg;
123123   int cylinder, sector, N;
124124   UINT32 sector_length;
125   
125
126126   flopimg = get_flopimg(image);
127127   if (!flopimg || !flopimg->floppy)
128128      return;
r1461r1462
161161      return;
162162
163163   floppy_read_indexed_sector(flopimg->floppy, side, flopimg->track, index1, 0, ptr, length);
164   
164
165165   if (LOG_FLOPPY)
166166      log_readwrite("sector_read", side, flopimg->track, index1, ptr, length);
167167}
r1461r1462
306306   }
307307
308308   /* if we can get head and track counts, then set the geometry accordingly */
309   if (!flopimg_keep_geometry
309   if (!flopimg_keep_geometry
310310            && floppy_callbacks(flopimg->floppy)->get_heads_per_disk
311311      && floppy_callbacks(flopimg->floppy)->get_tracks_per_disk)
312312   {
313313      floppy_drive_set_geometry_absolute(image,
314         floppy_get_tracks_per_disk(flopimg->floppy),
314         floppy_get_tracks_per_disk(flopimg->floppy),
315315         floppy_get_heads_per_disk(flopimg->floppy));
316316   }
317317   return INIT_PASS;
r1461r1462
382382/************
383383 *  Another hack for ti99: Drive track count may differ from medium track count.
384384 *  It is possible to insert a 40 track medium in an 80 track drive; the TI
385 *  controllers read the track count from sector 0 and automatically
385 *  controllers read the track count from sector 0 and automatically
386386 *  apply double steps. Setting the track count of the drive to the medium
387387 *  track count will lead to unreachable tracks.
388 *  This function is called from 99_dsk.c to switch off the lines in
388 *  This function is called from 99_dsk.c to switch off the lines in
389389 *  internal_floppy_device_load which set the drive geometry to the medium
390390 *  geometry.
391391 *************/
src/mess/devices/appldriv.c
r1461r1462
11/*********************************************************************
22
33   appldriv.c
4   
4
55   Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c)
66
77*********************************************************************/
r1461r1462
7878   int pseudo_track;
7979
8080   apple525_save_current_track(img, FALSE);
81   
81
8282   track = floppy_drive_get_current_track(img);
8383   pseudo_track = (track * 2) + disk->tween_tracks;
84   
84
8585   pseudo_track += step;
8686   if (pseudo_track < 0)
8787      pseudo_track = 0;
src/mess/devices/basicdsk.c
r1461r1462
203203   pDisk->track_divider = track_skipping ? 2 : 1;
204204
205205   floppy_drive_set_geometry_absolute(img, tracks * pDisk->track_divider, heads );
206   
206
207207   pDisk->image_size = pDisk->tracks * pDisk->heads * pDisk->sec_per_track * pDisk->sector_length;
208208
209209   /* setup a new ddam map */
src/mess/devices/coco_vhd.c
r1461r1462
196196WRITE8_HANDLER(coco_vhd_io_w)
197197{
198198   int pos;
199   
199
200200   switch(offset)
201201   {
202202      case 0xff80 - 0xff40:
src/mess/devices/appldriv.h
r1461r1462
11/*********************************************************************
22
33   appldriv.h
4   
4
55   Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c)
66
77*********************************************************************/
src/mess/devices/printer.h
r1461r1462
1111
1212/*
1313 * functions for the IODevice entry IO_PRINTER
14 *
15 * Currently only a simple port which only supports status
14 *
15 * Currently only a simple port which only supports status
1616 * ("online/offline") and output of bytes is supported.
1717 */
1818
src/mess/devices/thomflop.c
r1461r1462
8383  => at most  392 bytes / sector
8484  => at most 6272 bytes / track
8585
86  Notes:
86  Notes:
8787  - the BIOS puts 4E bytes as spaces after id and data fields
8888  - some protected games expect F7 bytes (instead of 4E) after id fields
8989*/
r1461r1462
9797/* build an identifier, with header & space */
9898static int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size )
9999{
100   if ( sector_size == 128 )
100   if ( sector_size == 128 )
101101   {
102102      /* single density */
103103      memset( dst, 0x00, 6 ); /* synchro bytes */
r1461r1462
111111      memset( dst + 14, 0xff, 12 ); /* end mark */
112112      return 36;
113113   }
114   else
114   else
115115   {
116116      /* double density */
117117      memset( dst, 0xa1, 3 ); /* synchro bytes */
r1461r1462
132132/* build a sector, with header & space */
133133static int thom_floppy_make_sector( mess_image* img, chrn_id id, UINT8* dst, int sector_size )
134134{
135   if ( sector_size == 128 )
135   if ( sector_size == 128 )
136136   {
137137      /* single density */
138138      memset( dst, 0x00, 6 ); /* synchro bytes */
r1461r1462
144144      memset( dst + sector_size + 9, 0xff, 22 ); /* end mark */
145145      return sector_size + 31;
146146   }
147   else
147   else
148148   {
149149      /* double density */
150150      memset( dst, 0xa1, 3 ); /* synchro bytes */
r1461r1462
169169   int nb;
170170
171171   /* go to start of track */
172   while ( ! floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
172   while ( ! floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
173173   {
174      if ( ! floppy_drive_get_next_id( img, side, &id ) )
174      if ( ! floppy_drive_get_next_id( img, side, &id ) )
175175         return 0;
176176   }
177177
178178   /* for each sector... */
179   for ( nb = 0; nb < 16; nb++ )
179   for ( nb = 0; nb < 16; nb++ )
180180   {
181      if ( ! floppy_drive_get_next_id( img, side, &id ) )
181      if ( ! floppy_drive_get_next_id( img, side, &id ) )
182182         break;
183183
184184      memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO;
r1461r1462
186186      memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO;
187187      dst += thom_floppy_make_sector( img, id, dst, sector_size );
188188
189      if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
189      if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
190190         break;
191191   }
192192   return dst - org;
r1461r1462
258258
259259   memset( dst, 0x16, THOM_QDD_SYNCH_DISK ); dst += THOM_QDD_SYNCH_DISK;
260260
261   for ( i = 1; i <= 400; i++ )
261   for ( i = 1; i <= 400; i++ )
262262   {
263263      memset( dst, 0x16, THOM_QDD_SYNCH_ADDR ); dst += THOM_QDD_SYNCH_ADDR;
264264      dst += thom_qdd_make_addr( i, dst );
r1461r1462
288288
289289static READ8_HANDLER ( to7_5p14_r )
290290{
291   if ( offset < 4 )
291   if ( offset < 4 )
292292      return wd17xx_r( offset );
293   else if ( offset == 8 )
293   else if ( offset == 8 )
294294      return to7_5p14_select;
295295   else
296296      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset );
r1461r1462
301301
302302static WRITE8_HANDLER( to7_5p14_w )
303303{
304   if ( offset < 4 )
304   if ( offset < 4 )
305305      wd17xx_w( offset, data );
306   else if ( offset == 8 )
306   else if ( offset == 8 )
307307   {
308308      /* drive select */
309309      int drive = -1, side = 0;
310310      DENSITY dens;
311   
312      switch ( data & 7 )
311
312      switch ( data & 7 )
313313      {
314314      case 0: break;
315315      case 2: drive = 0; side = 0; break;
r1461r1462
319319      default:
320320         logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data );
321321      }
322   
322
323323      dens = (data & 0x80) ? DEN_FM_LO : DEN_MFM_LO;
324324      thom_floppy_set_density( dens );
325325      wd17xx_set_density( dens );
326   
326
327327      to7_5p14_select = data;
328328
329      if ( drive != -1 )
329      if ( drive != -1 )
330330      {
331331         thom_floppy_active( 0 );
332332         wd17xx_set_drive( drive );
333333         wd17xx_set_side( side );
334         LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n",
334         LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n",
335335               attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
336336               data, drive, side, (dens == DEN_FM_LO) ? "FM" : "MFM" ));
337337      }
338338   }
339339   else
340      logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n",
340      logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n",
341341            attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data );
342342}
343343
r1461r1462
349349   LOG(( "to7_5p14_reset: CD 90-640 controller\n" ));
350350   thom_floppy_set_density( DEN_MFM_LO );
351351   wd17xx_reset();
352   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
352   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
353353   {
354354      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
355355      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
r1461r1462
385385
386386static READ8_HANDLER ( to7_5p14sd_r )
387387{
388   if ( offset < 8 )
388   if ( offset < 8 )
389389      return mc6843_r( offset );
390   else if ( offset >= 8 && offset <= 9 )
390   else if ( offset >= 8 && offset <= 9 )
391391      return to7_5p14sd_select;
392392   else
393393      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset );
r1461r1462
398398
399399static WRITE8_HANDLER( to7_5p14sd_w )
400400{
401   if ( offset < 8 )
401   if ( offset < 8 )
402402      mc6843_w( offset, data );
403   else if ( offset >= 8 && offset <= 9 )
403   else if ( offset >= 8 && offset <= 9 )
404404   {
405405      /* drive select */
406406      int drive = -1, side = 0;
407   
408      if ( data & 1 )     
409      {
410         drive = 0;
411         side = 0;
407
408      if ( data & 1 )
409      {
410         drive = 0;
411         side = 0;
412412      }
413      else if ( data & 2 )
414      {
415         drive = 1;
416         side = 1;
413      else if ( data & 2 )
414      {
415         drive = 1;
416         side = 1;
417417      }
418      else if ( data & 4 )
419      {
420         drive = 2;
421         side = 0;
418      else if ( data & 4 )
419      {
420         drive = 2;
421         side = 0;
422422      }
423      else if ( data & 8 )
424      {
425         drive = 3;
426         side = 1;
423      else if ( data & 8 )
424      {
425         drive = 3;
426         side = 1;
427427      }
428428
429429      to7_5p14sd_select = data;
430430
431      if ( drive != -1 )
431      if ( drive != -1 )
432432      {
433433         thom_floppy_active( 0 );
434434         mc6843_set_drive( drive );
435435         mc6843_set_side( side );
436         LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n",
436         LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n",
437437               attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, drive, side ));
438438      }
439439   }
440440   else
441      logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n",
441      logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n",
442442            attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data );
443443}
444444
r1461r1462
450450   LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" ));
451451   thom_floppy_set_density( DEN_FM_LO );
452452   mc6843_reset();
453   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
453   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
454454   {
455455      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
456456      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
r1461r1462
479479   used in TO7, TO7/70, MO5 computers
480480   it is based on a MC6852 SSDA
481481
482   Note: the MC6852 is only partially emulated, most features are not used in
482   Note: the MC6852 is only partially emulated, most features are not used in
483483   the controller and are ignored.
484484*/
485485
r1461r1462
517517#define QDD_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512
518518
519519
520static struct
520static struct
521521{
522522   /* MC6852 registers */
523523   UINT8 status;
r1461r1462
544544{
545545   to7qdd->index_pulse = state;
546546
547   if ( state )
547   if ( state )
548548   {
549549      /* rewind to disk start */
550550      to7qdd->data_idx = 0;
r1461r1462
571571
572572   /* byte-ready */
573573   to7qdd->status |= QDD_S_RDA | QDD_S_TDRA;
574   if ( ! to7qdd->drive )
574   if ( ! to7qdd->drive )
575575      to7qdd->status |= QDD_S_PE;
576576
577577   /* write-protect */
578   if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
578   if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
579579      to7qdd->status |= QDD_S_NCTS;
580580
581581   /* sticky reset conditions */
582   if ( to7qdd->ctrl1 & QDD_C1_RRESET )
582   if ( to7qdd->ctrl1 & QDD_C1_RRESET )
583583      to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR);
584   if ( to7qdd->ctrl1 & QDD_C1_TRESET )
584   if ( to7qdd->ctrl1 & QDD_C1_TRESET )
585585      to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF);
586 
586
587587   /* irq update */
588588
589589   if ( ( (to7qdd->ctrl1 & QDD_C1_RIE) && !(to7qdd->status & QDD_S_RDA ) ) ||
r1461r1462
602602static UINT8 to7_qdd_read_byte( void )
603603{
604604   UINT8 data;
605 
605
606606   /* rebuild disk if needed */
607   if ( !to7qdd->data_size )
607   if ( !to7qdd->data_size )
608608   {
609609      to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data );
610610      assert( to7qdd->data_idx < sizeof( to7qdd->data ) );
611611   }
612 
613   if ( to7qdd->data_idx >= to7qdd->data_size )
612
613   if ( to7qdd->data_idx >= to7qdd->data_size )
614614      data = 0;
615   else
615   else
616616      data = to7qdd->data[ to7qdd->data_idx ];
617 
618   VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n",
619          attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
617
618   VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n",
619          attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
620620          to7qdd->data_idx, to7qdd->data_size, data ));
621 
621
622622   to7qdd->data_idx++;
623623   to7qdd->start_idx = to7qdd->data_idx;
624 
624
625625   return data;
626626}
627627
r1461r1462
637637   int i;
638638
639639   /* rebuild disk if needed */
640   if ( !to7qdd->data_size )
640   if ( !to7qdd->data_size )
641641   {
642642      to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data );
643643      assert( to7qdd->data_idx < sizeof( to7qdd->data ) );
r1461r1462
647647          data==0xA5 || data==0x5A ) &&    /* first byte of tentative field */
648648        to7qdd->data_idx <to7qdd->data_size )
649649   {
650   
650
651651      /* this is the first byte of the field */
652      if ( to7qdd->start_idx == to7qdd->data_idx )
652      if ( to7qdd->start_idx == to7qdd->data_idx )
653653         to7qdd->data_crc = 0;
654   
654
655655      /* accumulate bytes */
656656      to7qdd->data[ to7qdd->data_idx ] = data;
657657      to7qdd->data_idx++;
658   
659      VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n",
658
659      VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n",
660660         attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data,
661661         to7qdd->start_idx, to7qdd->data_idx ));
662   
662
663663      /* end of tentative id field */
664664      if ( to7qdd->data_idx == to7qdd->start_idx + 4 &&
665           to7qdd->data[ to7qdd->start_idx ] == 0xA5 &&
666           to7qdd->data[ to7qdd->start_idx + 3 ] == to7qdd->data_crc )
665           to7qdd->data[ to7qdd->start_idx ] == 0xA5 &&
666           to7qdd->data[ to7qdd->start_idx + 3 ] == to7qdd->data_crc )
667667      {
668     
668
669669         /* got an id field => format */
670670         int sector = (int) to7qdd->data[ to7qdd->start_idx + 1 ] * 256 + (int) to7qdd->data[ to7qdd->start_idx + 2 ];
671671         UINT8 filler = 0xff;
672     
673         LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n",
672
673         LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n",
674674               attotime_to_double(timer_get_time()), activecpu_get_previouspc(), sector ));
675     
675
676676         floppy_drive_format_sector( to7_qdd_image(),
677677                      0, sector, 0, 0, sector, 128, filler );
678678         to7qdd->start_idx = to7qdd->data_idx;
679679      }
680   
680
681681      /* end of tentative data field */
682682      else if ( to7qdd->data_idx == to7qdd->start_idx + 130 &&
683           to7qdd->data[ to7qdd->start_idx  ] == 0x5A &&
684           to7qdd->data[ to7qdd->start_idx + 129 ] == to7qdd->data_crc )
683           to7qdd->data[ to7qdd->start_idx  ] == 0x5A &&
684           to7qdd->data[ to7qdd->start_idx + 129 ] == to7qdd->data_crc )
685685      {
686     
686
687687         /* look backwards for previous id field */
688688         for ( i = to7qdd->start_idx - 3; i >= 0; i-- )
689689         {
690690            if ( to7qdd->data[ i ] == 0xA5 &&
691                 ( ( to7qdd->data[ i ] + to7qdd->data[ i + 1 ] +
692                to7qdd->data[ i + 2 ] ) & 0xff
691                 ( ( to7qdd->data[ i ] + to7qdd->data[ i + 1 ] +
692                to7qdd->data[ i + 2 ] ) & 0xff
693693                    ) == to7qdd->data[ i + 3 ] )
694694               break;
695695         }
696     
697         if ( i >= 0 )
696
697         if ( i >= 0 )
698698         {
699699            /* got an id & a data field => write */
700700            int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ];
701   
702            LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n",
701
702            LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n",
703703                  attotime_to_double(timer_get_time()), activecpu_get_previouspc(), sector ));
704           
704
705705            floppy_drive_write_sector_data( to7_qdd_image(), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 );
706706         }
707     
707
708708         to7qdd->start_idx = to7qdd->data_idx;
709709      }
710   
710
711711      else to7qdd->data_crc += data;
712712   }
713713}
r1461r1462
716716
717717static READ8_HANDLER ( to7_qdd_r )
718718{
719   switch ( offset )
719   switch ( offset )
720720   {
721721
722722   case 0: /* MC6852 status */
r1461r1462
738738      return to7_qdd_read_byte();
739739
740740   case 8: /* floppy status */
741   {
741   {
742742      UINT8 data = 0;
743743      mess_image* img = to7_qdd_image();
744      if ( ! image_exists( img ) )
744      if ( ! image_exists( img ) )
745745         data |= 0x40; /* disk present */
746      if ( to7qdd->index_pulse )
746      if ( to7qdd->index_pulse )
747747         data |= 0x80; /* disk start */
748748      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
749749      return data;
750750   }
751
751
752752   default:
753753      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset );
754754      return 0;
r1461r1462
759759
760760static WRITE8_HANDLER( to7_qdd_w )
761761{
762   switch ( offset )
762   switch ( offset )
763763   {
764   
764
765765   case 0: /* MC6852 control 1 */
766766      /* reset */
767      if ( data & QDD_C1_RRESET )
767      if ( data & QDD_C1_RRESET )
768768         to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR);
769      if ( data & QDD_C1_TRESET )
769      if ( data & QDD_C1_TRESET )
770770         to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF);
771771
772772      to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data &  (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 );
r1461r1462
776776             data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-',
777777             data & QDD_C1_STRIPSYNC ? "strip-sync " : "",
778778             data & QDD_C1_CLRSYNC ? "clear-sync " : "",
779             data & QDD_C1_RIE ? 'r' : '-',
779             data & QDD_C1_RIE ? 'r' : '-',
780780             data & QDD_C1_TIE ? 't' : '-' ));
781781      break;
782   
782
783783   case 1:
784      switch ( to7qdd->ctrl1 >> 6 )
784      switch ( to7qdd->ctrl1 >> 6 )
785785      {
786     
786
787787      case 0: /* MC6852 control 2 */
788      {
788      {
789789#if 0
790790         /* most of these are unused now */
791791         static const int bit[8] = { 6, 6, 7, 8, 7, 7, 8, 8 };
r1461r1462
804804         to7qdd->ctrl2 = data;
805805         break;
806806      }
807     
807
808808      case 1: /* MC6852 control 3 */
809809         to7qdd->ctrl3 = data;
810810         /* reset just once each write, not sticky */
811         if ( data & QDD_C3_CLRTUF )
811         if ( data & QDD_C3_CLRTUF )
812812            to7qdd->status &= ~QDD_S_TUF;
813         if ( data & QDD_C3_CLRCTS )
813         if ( data & QDD_C3_CLRCTS )
814814            to7qdd->status &= ~QDD_S_NCTS;
815815         to7_qdd_stat_update();
816816         VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n",
r1461r1462
856856
857857   thom_floppy_set_density( DEN_MFM_LO );
858858
859   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
859   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
860860   {
861861      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
862862      floppy_drive_set_index_pulse_callback( img, to7_qdd_index_pulse_cb );
r1461r1462
925925#define THOM_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512
926926
927927
928static struct
928static struct
929929{
930930
931931   UINT8   op;
r1461r1462
971971
972972static void thmfc_floppy_index_pulse_cb ( mess_image *img, int state )
973973{
974   if ( img != thmfc_floppy_image() )
974   if ( img != thmfc_floppy_image() )
975975      return;
976976
977   if ( thmfc_floppy_is_qdd() )
977   if ( thmfc_floppy_is_qdd() )
978978   {
979979      /* pulse each time the whole-disk spiraling track ends */
980980      floppy_drive_set_rpm( img, 423. / 25. );
981981      thmfc1->ipl = state;
982      if ( state )
982      if ( state )
983983      {
984984         thmfc1->data_raw_size = 0;
985985         thmfc1->data_raw_idx = 0;
986986         thmfc1->data_idx = 0;
987987      }
988988   }
989   else
989   else
990990   {
991991      floppy_drive_set_rpm( img, 300. );
992992      thmfc1->ipl = state;
993      if ( state  )
993      if ( state  )
994994         thmfc1->data_raw_idx = 0;
995995   }
996996
r1461r1462
10061006   int r = 0;
10071007
10081008   /* scan track, try 4 revolutions */
1009   while ( r < 4 )
1009   while ( r < 4 )
10101010   {
10111011
1012      if ( floppy_drive_get_next_id( img, thmfc1->side, &id ) )
1012      if ( floppy_drive_get_next_id( img, thmfc1->side, &id ) )
10131013      {
10141014         if ( id.C == thmfc1->track &&
10151015              id.R == thmfc1->sector &&
10161016              (128 << id.N) == thmfc1->sector_size
1017              /* check side ?  id.H == thmfc1->side */ )
1017              /* check side ?  id.H == thmfc1->side */ )
10181018         {
1019            if ( dst )
1019            if ( dst )
10201020               memcpy( dst, &id, sizeof( chrn_id ) );
10211021            thmfc1->stat0 = THMFC1_STAT0_BYTE_READY_POL;
10221022            LOG (( "thmfc_floppy_find_sector: sector found C=%i H=%i R=%i N=%i\n", id.C, id.H, id.R, id.N ));
r1461r1462
10241024         }
10251025      }
10261026
1027      if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
1027      if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
10281028         r++;
10291029   }
10301030
r1461r1462
10381038/* complete command (by read, write, or timeout) */
10391039static void thmfc_floppy_cmd_complete(void)
10401040{
1041   LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n",
1042          attotime_to_double(timer_get_time()), thmfc1->op, thmfc1->data_idx,
1041   LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n",
1042          attotime_to_double(timer_get_time()), thmfc1->op, thmfc1->data_idx,
10431043          thmfc1->data_finish - 1, thmfc1->data_size - 1 ));
10441044
1045   if ( thmfc1->op == THMFC1_OP_WRITE_SECT )
1045   if ( thmfc1->op == THMFC1_OP_WRITE_SECT )
10461046   {
10471047      /* TODO: detect ddam (?) */
10481048      mess_image * img = thmfc_floppy_image();
r1461r1462
10681068static UINT8 thmfc_floppy_read_byte ( void )
10691069{
10701070   UINT8 data = thmfc1->data[ thmfc1->data_idx ];
1071 
1072   VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n",
1073          attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
1074          thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1,
1071
1072   VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n",
1073          attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
1074          thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1,
10751075          data ));
1076 
1076
10771077   if ( thmfc1->data_idx >= thmfc1->data_size - 1 )
10781078      thmfc_floppy_cmd_complete();
1079   else
1079   else
10801080      thmfc1->data_idx++;
10811081
10821082   if ( thmfc1->data_idx >= thmfc1->data_finish )
10831083      thmfc1->stat0 |= THMFC1_STAT0_FINISHED;
1084   
1084
10851085   return data;
10861086}
10871087
r1461r1462
10911091static UINT8 thmfc_floppy_raw_read_byte ( void )
10921092{
10931093   UINT8 data;
1094 
1094
10951095   /* rebuild track if needed */
10961096   if ( ! thmfc1->data_raw_size )
10971097   {
10981098      if ( thmfc_floppy_is_qdd() )
10991099         /* QDD: track = whole disk */
11001100         thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data );
1101      else
1101      else
11021102      {
11031103         thmfc1->data_raw_idx = 0;
1104         thmfc1->data_raw_size = thom_floppy_make_track( thmfc_floppy_image(), thmfc1->data,
1104         thmfc1->data_raw_size = thom_floppy_make_track( thmfc_floppy_image(), thmfc1->data,
11051105                           thmfc1->sector_size, thmfc1->side );
11061106      }
11071107      assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) );
11081108   }
1109 
1110   if ( thmfc1->data_raw_idx >= thmfc1->data_raw_size )
1109
1110   if ( thmfc1->data_raw_idx >= thmfc1->data_raw_size )
11111111      data = 0;
1112   else
1112   else
11131113      data = thmfc1->data[ thmfc1->data_raw_idx ];
11141114
1115   VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n",
1116          attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
1115   VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n",
1116          attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
11171117          thmfc1->data_raw_idx, thmfc1->data_raw_size, data ));
1118 
1118
11191119   thmfc1->data_raw_idx++;
1120 
1120
11211121   return data;
1122} 
1122}
11231123
11241124
11251125
r1461r1462
11281128{
11291129   int i;
11301130
1131   if ( thmfc1->formatting &&
1132        ( thmfc1->data_idx || data==0xA5 || data==0x5A ) && 
1133        thmfc1->data_raw_idx < THOM_MAXBUF )
1131   if ( thmfc1->formatting &&
1132        ( thmfc1->data_idx || data==0xA5 || data==0x5A ) &&
1133        thmfc1->data_raw_idx < THOM_MAXBUF )
11341134   {
1135   
1136      if ( ! thmfc1->data_raw_size )
1135
1136      if ( ! thmfc1->data_raw_size )
11371137      {
11381138         thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data );
11391139         assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) );
11401140      }
1141   
1141
11421142      /* accumulate bytes to form a field */
11431143      thmfc1->data[ thmfc1->data_raw_idx ] = data;
11441144      thmfc1->data_raw_idx++;
1145   
1146      if ( ! thmfc1->data_idx  )
1147      {
1145
1146      if ( ! thmfc1->data_idx  )
1147      {
11481148         /* start */
11491149         thmfc1->data_crc = 0;
11501150         thmfc1->data_idx = thmfc1->data_raw_idx;
11511151      }
1152   
1153      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n",
1152
1153      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n",
11541154         attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data,
11551155         thmfc1->data_idx,thmfc1->data_raw_idx ));
1156   
1156
11571157      if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 &&
1158           thmfc1->data[ thmfc1->data_idx - 1 ] == 0xA5 &&
1159           thmfc1->data[ thmfc1->data_idx + 2 ] == thmfc1->data_crc )
1158           thmfc1->data[ thmfc1->data_idx - 1 ] == 0xA5 &&
1159           thmfc1->data[ thmfc1->data_idx + 2 ] == thmfc1->data_crc )
11601160      {
1161     
1161
11621162         /* got an id field => format */
11631163         int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ];
11641164         UINT8 filler = 0xff;
1165     
1165
11661166         LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), sector ));
1167     
1167
11681168         floppy_drive_format_sector( thmfc_floppy_image(), 0, sector, 0, 0, sector, 128, filler );
11691169         thmfc1->data_idx = 0;
11701170      }
1171   
1171
11721172      else if ( thmfc1->data_raw_idx == thmfc1->data_idx + 129 &&
1173           thmfc1->data[ thmfc1->data_idx -   1 ] == 0x5A &&
1174           thmfc1->data[ thmfc1->data_idx + 128 ] == thmfc1->data_crc )
1173           thmfc1->data[ thmfc1->data_idx -   1 ] == 0x5A &&
1174           thmfc1->data[ thmfc1->data_idx + 128 ] == thmfc1->data_crc )
11751175      {
1176     
1176
11771177         /* look backwards for previous id field */
11781178         for ( i = thmfc1->data_idx - 4; i >= 0; i-- )
11791179         {
11801180            if ( thmfc1->data[ i ] == 0xA5 &&
1181                 ( ( thmfc1->data[ i ] + thmfc1->data[ i + 1 ] +
1182                thmfc1->data[ i + 2 ] ) & 0xff
1181                 ( ( thmfc1->data[ i ] + thmfc1->data[ i + 1 ] +
1182                thmfc1->data[ i + 2 ] ) & 0xff
11831183                    ) == thmfc1->data[ i + 3 ] )
11841184               break;
11851185         }
1186     
1187         if ( i >= 0 )
1186
1187         if ( i >= 0 )
11881188         {
11891189            /* got an id & a data field => write */
11901190            mess_image * img = thmfc_floppy_image();
1191            int sector = (int) thmfc1->data[ i + 1 ] * 256 +
1191            int sector = (int) thmfc1->data[ i + 1 ] * 256 +
11921192               (int) thmfc1->data[ i + 2 ];
1193   
1194            LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n",
1193
1194            LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n",
11951195                  attotime_to_double(timer_get_time()), activecpu_get_previouspc(), sector ));
1196           
1196
11971197            floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 );
11981198         }
1199         
1199
12001200         thmfc1->data_idx = 0;
1201     
1201
12021202      }
1203      else
1203      else
12041204         thmfc1->data_crc += data;
12051205   }
12061206   else
r1461r1462
12081208      thmfc1->data_raw_idx++;
12091209      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
12101210   }
1211 
1211
12121212}
12131213
12141214
r1461r1462
12161216/* intelligent writing */
12171217static void thmfc_floppy_write_byte ( UINT8 data )
12181218{
1219   VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n",
1220      attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
1219   VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n",
1220      attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
12211221      thmfc1->data_idx, thmfc1->data_size - 1, data ));
1222 
1222
12231223   thmfc1->data_raw_size = 0;
12241224   thmfc1->data[ thmfc1->data_idx ] = data;
12251225   if ( thmfc1->data_idx >= thmfc1->data_size - 1 )
12261226      thmfc_floppy_cmd_complete();
1227   else
1227   else
12281228      thmfc1->data_idx++;
12291229}
12301230
r1461r1462
12321232static void thmfc_floppy_format_byte ( UINT8 data )
12331233{
12341234   VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
1235 
1235
12361236   thmfc1->data_raw_size = 0;
1237 
1237
12381238   /* accumulate bytes to form an id field */
1239   if ( thmfc1->data_idx || data==0xA1 )
1239   if ( thmfc1->data_idx || data==0xA1 )
12401240   {
12411241      UINT8 header[] = { 0xa1, 0xa1, 0xa1, 0xfe };
12421242      thmfc1->data[ thmfc1->data_idx ] = data;
12431243      thmfc1->data_idx++;
1244      if ( thmfc1->data_idx > 11 )
1244      if ( thmfc1->data_idx > 11 )
12451245      {
1246     
1247         if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) )
1246
1247         if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) )
12481248         {
12491249            /* got id field => format */
12501250            mess_image * img = thmfc_floppy_image();
r1461r1462
12551255            UINT8 filler = 0xe5;            /* standard Thomson filler */
12561256            floppy_drive_format_sector( img, side, sector, track, thmfc1->side, sector, length, filler );
12571257         }
1258         
1258
12591259         thmfc1->data_idx = 0;
12601260      }
1261     
1261
12621262   }
12631263}
12641264
r1461r1462
12661266
12671267READ8_HANDLER ( thmfc_floppy_r )
12681268{
1269   switch ( offset )
1269   switch ( offset )
12701270   {
1271     
1271
12721272   case 0: /* STAT0 */
12731273      thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL;
12741274      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), thmfc1->stat0 ));
12751275      return thmfc1->stat0;
1276   
1276
12771277   case 1: /* STAT1 */
12781278   {
12791279      UINT8 data = 0;
12801280      mess_image * img = thmfc_floppy_image();
12811281      int flags = floppy_drive_get_flag_state( img, -1 );
1282      if ( thmfc_floppy_is_qdd() )
1282      if ( thmfc_floppy_is_qdd() )
12831283      {
1284         if ( ! image_exists(img) )
1284         if ( ! image_exists(img) )
12851285            data |= 0x40; /* disk present */
1286         if ( ! thmfc1->ipl )
1286         if ( ! thmfc1->ipl )
12871287            data |= 0x02;       /* disk start */
12881288         data |= 0x08; /* connected */
12891289      }
1290      else
1290      else
12911291      {
1292         if ( thmfc1->ipl )
1292         if ( thmfc1->ipl )
12931293            data |= 0x40;
1294         if ( image_exists(img) )
1294         if ( image_exists(img) )
12951295            data |= 0x20; /* disk change (?) */
1296         if ( flags & FLOPPY_DRIVE_HEAD_AT_TRACK_0 )
1296         if ( flags & FLOPPY_DRIVE_HEAD_AT_TRACK_0 )
12971297            data |= 0x08;
1298         if ( flags & FLOPPY_DRIVE_READY )
1298         if ( flags & FLOPPY_DRIVE_READY )
12991299            data |= 0x02;
13001300      }
1301      if ( ! (flags & FLOPPY_DRIVE_MOTOR_ON ) )
1301      if ( ! (flags & FLOPPY_DRIVE_MOTOR_ON ) )
13021302         data |= 0x10;
1303      if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
1303      if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
13041304         data |= 0x04;
13051305      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
13061306      return data;
13071307   }
1308   
1308
13091309   case 3: /* RDATA */
1310     
1311      if ( thmfc1->op == THMFC1_OP_READ_SECT || thmfc1->op == THMFC1_OP_READ_ADDR )
1310
1311      if ( thmfc1->op == THMFC1_OP_READ_SECT || thmfc1->op == THMFC1_OP_READ_ADDR )
13121312         return thmfc_floppy_read_byte();
13131313      else
13141314         return thmfc_floppy_raw_read_byte();
13151315
13161316   case 6:
13171317      return 0;
1318   
1319   case 8:
1320   {
1318
1319   case 8:
1320   {
13211321      /* undocumented => emulate TO7 QDD controller ? */
13221322      UINT8 data = thmfc1->ipl << 7;
13231323      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
r1461r1462
13451345      thom_floppy_set_density( dens );
13461346      thmfc1->formatting = (data >> 2) & 1;
13471347      LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n",
1348             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data, 
1348             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data,
13491349             (dens == DEN_FM_LO) ? "MF" : "MFM",
13501350             wsync, (data >> 3) & 1,
13511351             thmfc1->formatting, data & 3 ));
1352     
1352
13531353      /* abort previous command, if any */
13541354      thmfc1->op = THMFC1_OP_RESET;
13551355      timer_adjust( thmfc_floppy_cmd, attotime_never, 0, attotime_never );
1356     
1357      switch ( data & 3 )
1356
1357      switch ( data & 3 )
13581358      {
13591359
13601360      case THMFC1_OP_RESET:
13611361         thmfc1->stat0 = THMFC1_STAT0_FINISHED;
13621362         break;
1363   
1363
13641364      case THMFC1_OP_WRITE_SECT:
1365         if ( qdd )
1365         if ( qdd )
13661366            logerror( "thmfc_floppy_w: smart operation 1 not supported for QDD\n" );
1367         else if ( thmfc_floppy_find_sector( NULL ) )
1367         else if ( thmfc_floppy_find_sector( NULL ) )
13681368         {
13691369            thmfc1->data_idx = 0;
13701370            thmfc1->data_size = thmfc1->sector_size + 3; /* A1 A1 FB <data> */
r1461r1462
13741374            timer_adjust( thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 10 ), 0, attotime_never );
13751375         }
13761376         break;
1377   
1377
13781378      case THMFC1_OP_READ_ADDR:
1379         if ( qdd )
1379         if ( qdd )
13801380            logerror( "thmfc_floppy_w: smart operation 2 not supported for QDD\n" );
1381         else if ( thmfc_floppy_find_sector( &id ) )
1381         else if ( thmfc_floppy_find_sector( &id ) )
13821382         {
1383            thmfc1->data_size =
1383            thmfc1->data_size =
13841384               thom_floppy_make_addr( id, thmfc1->data, thmfc1->sector_size );
13851385            assert( thmfc1->data_size < sizeof( thmfc1->data ) );
13861386            thmfc1->data_finish = 10;
r1461r1462
13901390            timer_adjust( thmfc_floppy_cmd, ATTOTIME_IN_MSEC( 1 ), 0, attotime_never );
13911391         }
13921392         break;
1393   
1393
13941394      case THMFC1_OP_READ_SECT:
1395         if ( qdd )
1395         if ( qdd )
13961396            logerror( "thmfc_floppy_w: smart operation 3 not supported for QDD\n" );
1397         else if ( thmfc_floppy_find_sector( &id ) )
1397         else if ( thmfc_floppy_find_sector( &id ) )
13981398         {
13991399            thmfc1->data_size = thom_floppy_make_sector
14001400               ( thmfc_floppy_image(), id, thmfc1->data, thmfc1->sector_size );
r1461r1462
14211421   }
14221422
14231423   break;
1424   
1425   
1424
1425
14261426   case 1: /* CMD1 */
14271427      thmfc1->data_raw_size = 0;
14281428      thmfc1->sector_size = 128 << ( (data >> 5) & 3);
14291429      thmfc1->side = (data >> 4) & 1;
1430      if ( thmfc1->sector_size > 256 )
1430      if ( thmfc1->sector_size > 256 )
14311431      {
14321432         logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n",
14331433              activecpu_get_previouspc(), thmfc1->sector_size );
14341434         thmfc1->sector_size = 256;
14351435      }
1436   
1436
14371437      LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n",
14381438             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data,
14391439             thmfc1->sector_size, (data >> 1) & 7, thmfc1->side ));
r1461r1462
14461446      int seek = 0, motor;
14471447      thmfc1->drive = data & 2;
14481448
1449      if ( thmfc_floppy_is_qdd() )
1449      if ( thmfc_floppy_is_qdd() )
14501450      {
14511451         motor = !(data & 0x40);
14521452         /* no side select & no seek for QDD */
14531453      }
1454      else
1454      else
14551455      {
1456         if ( data & 0x10 )
1456         if ( data & 0x10 )
14571457            seek = (data & 0x20) ? 1 : -1;
14581458         motor =  (data >> 2) & 1;
14591459         thmfc1->drive |= 1 ^ ((data >> 6) & 1);
r1461r1462
14611461
14621462      img = thmfc_floppy_image();
14631463      thom_floppy_active( 0 );
1464     
1464
14651465      LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n",
1466             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data,
1466             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data,
14671467             thmfc1->drive, seek, motor ));
1468 
1469      if ( seek )
1470      {
1468
1469      if ( seek )
1470      {
14711471         thmfc1->data_raw_size = 0;
14721472         floppy_drive_seek( img, seek );
14731473      }
r1461r1462
14831483
14841484   case 3: /* WDATA */
14851485      thmfc1->wsync = data;
1486      if ( thmfc_floppy_is_qdd() )
1486      if ( thmfc_floppy_is_qdd() )
14871487         thmfc_floppy_qdd_write_byte( data );
1488      else if ( thmfc1->op==THMFC1_OP_WRITE_SECT )
1488      else if ( thmfc1->op==THMFC1_OP_WRITE_SECT )
14891489         thmfc_floppy_write_byte( data );
1490      else if ( thmfc1->formatting )
1490      else if ( thmfc1->formatting )
14911491         thmfc_floppy_format_byte( data );
1492      else
1492      else
14931493      {
14941494         /* TODO: implement other forms of raw track writing */
1495         LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n",
1495         LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n",
14961496                attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
14971497      }
14981498      break;
1499   
15001499
1500
15011501   case 4: /* WCLK (unemulated) */
15021502      /* clock configuration: FF for data, 0A for synchro */
1503      LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n",
1503      LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n",
15041504             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data,
15051505             (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" ));
15061506      break;
15071507
15081508   case 5: /* WSECT */
15091509      thmfc1->sector = data;
1510      LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n",
1510      LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n",
15111511             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
15121512      break;
15131513
15141514   case 6: /* WTRCK */
15151515      thmfc1->track = data;
1516      LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
1516      LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
15171517             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data,
15181518             floppy_drive_get_current_track( thmfc_floppy_image() ) ));
15191519      break;
15201520
15211521   case 7: /* WCELL */
15221522      /* precompensation (unemulated) */
1523      LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n",
1523      LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n",
15241524             attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
15251525      break;
1526     
1526
15271527   default:
1528      logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n",
1528      logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n",
15291529            attotime_to_double(timer_get_time()), activecpu_get_previouspc(), offset, data );
15301530   }
15311531}
r1461r1462
15361536{
15371537   int i;
15381538   LOG(( "thmfc_floppy_reset: THMFC1 controller\n" ));
1539 
1540   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
1539
1540   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
15411541   {
15421542      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
15431543      floppy_drive_set_index_pulse_callback( img, thmfc_floppy_index_pulse_cb );
r1461r1462
16021602   toplevel network emulation here!
16031603*/
16041604
1605/* NOTE: This is work in progress!
1605/* NOTE: This is work in progress!
16061606   For the moment, only hand-checks works: the TO7 can take the line, then
16071607   perform a DKBOOT request. We do not have the server emulated yet, so,
16081608   no way to answer the request.
r1461r1462
16371637/* consigne DKBOOT
16381638
16391639   MO5 BASIC
1640   $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $01 $00<$41 $00 $FF $20
1640   $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $01 $00<$41 $00 $FF $20
16411641   $3D $4C $01 $60 $20 $3C $4F $01 $05 $20 $3F $9C $19 $25 $03 $11
1642   $93 $15 $10 $25 $32 $8A $7E $FF $E1 $FD $E9 $41>$00 $00 $00 $00
1642   $93 $15 $10 $25 $32 $8A $7E $FF $E1 $FD $E9 $41>$00 $00 $00 $00
16431643   $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
16441644
16451645   TO7/70 BASIC
1646   $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $02 $00<$20 $42 $41 $53
1646   $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $02 $00<$20 $42 $41 $53
16471647   $49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30
1648   $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00
1648   $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00
16491649   $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
16501650
16511651   TO7 BASIC
1652   $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$20 $42 $41 $53
1652   $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$20 $42 $41 $53
16531653   $49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30
1654   $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00
1654   $04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00
16551655   $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
16561656
16571657   TO7 LOGO
1658   $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$00 $00 $00 $00
1658   $00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$00 $00 $00 $00
16591659   $00 $20 $4C $4F $47 $4F $04 $00 $00 $00 $00 $00 $00 $00 $00 $00
1660   $00 $00 $00 $00 $00 $00 $AA $FF $01 $16 $00 $C8>$00 $00 $00 $00
1660   $00 $00 $00 $00 $00 $00 $AA $FF $01 $16 $00 $C8>$00 $00 $00 $00
16611661   $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
16621662
16631663
r1461r1462
16711671      LOG(( " $%02X", data[i] ));
16721672   LOG(( "\n" ));
16731673
1674   if ( data[1] == 0xff )
1674   if ( data[1] == 0xff )
16751675   {
16761676      LOG(( "to7_network_got_frame: %i phones %i\n", data[2], data[0] ));
16771677      timer_set(  ATTOTIME_IN_USEC( 100 ), NULL, 0, ans  );
16781678      mc6854_set_cts( 0 );
16791679   }
1680   else if ( ! data[1] )
1680   else if ( ! data[1] )
16811681   {
16821682      char name[33];
16831683      int i;
1684      memcpy( name, data + 12, 32 );   
1684      memcpy( name, data + 12, 32 );
16851685      name[32] = 0;
1686      for (i=0;i<32;i++)
1686      for (i=0;i<32;i++)
16871687      {
1688         if ( name[i]<32 || name[i]>=127 )
1688         if ( name[i]<32 || name[i]>=127 )
16891689            name[i]=' ';
16901690      }
16911691      LOG(( "to7_network_got_frame: DKBOOT system=%s appli=\"%s\"\n",
16921692            (data[10] == 0) ? "TO7" : (data[10] == 1) ? "MO5" :
16931693            (data[10] == 2) ? "TO7/70" : "?", name ));
16941694   }
1695 
1695
16961696}
16971697
16981698
r1461r1462
17211721
17221722static READ8_HANDLER ( to7_network_r )
17231723{
1724   if ( offset >= 0 && offset < 4 )
1724   if ( offset >= 0 && offset < 4 )
17251725      return mc6854_r( offset );
17261726
1727   if ( offset == 8 )
1727   if ( offset == 8 )
17281728   {
17291729      /* network ID of the computer */
17301730      UINT8 id = readinputport( THOM_INPUT_FCONFIG ) >> 3;
r1461r1462
17591759
17601760   NOTE: you need to reset the computer after changing the floppy controller!
17611761
1762   The CD 90-351 controller seems similar to the THMFC1 gate-array
1762   The CD 90-351 controller seems similar to the THMFC1 gate-array
17631763   => we reuse the THMFC code!
17641764*/
17651765
r1461r1462
17871787{
17881788   to7_controller_type = (readinputport( THOM_INPUT_FCONFIG ) ) & 7;
17891789
1790   switch ( to7_controller_type )
1790   switch ( to7_controller_type )
17911791   {
17921792
17931793   case 1:
r1461r1462
17971797
17981798   case 2:
17991799      to7_floppy_bank = 2;
1800      to7_5p14_reset();
1800      to7_5p14_reset();
18011801      break;
18021802
18031803   case 3:
r1461r1462
18051805      thmfc_floppy_reset();
18061806      break;
18071807
1808   case 4: 
1808   case 4:
18091809      to7_floppy_bank = 7;
1810      to7_qdd_reset();
1810      to7_qdd_reset();
18111811      break;
18121812
1813   case 5: 
1813   case 5:
18141814      to7_floppy_bank = 8;
1815      to7_network_reset();
1815      to7_network_reset();
18161816      break;
18171817
18181818   default:
r1461r1462
18271827
18281828READ8_HANDLER ( to7_floppy_r )
18291829{
1830   switch ( to7_controller_type )
1830   switch ( to7_controller_type )
18311831   {
18321832
1833   case 1: 
1833   case 1:
18341834      return to7_5p14sd_r( offset );
18351835
1836   case 2: 
1836   case 2:
18371837      return to7_5p14_r( offset );
1838   
1839   case 3: 
1838
1839   case 3:
18401840      return thmfc_floppy_r( offset );
1841   
1842   case 4: 
1841
1842   case 4:
18431843      return to7_qdd_r( offset );
18441844
1845   case 5: 
1845   case 5:
18461846      return to7_network_r( offset );
18471847   }
18481848
r1461r1462
18531853
18541854WRITE8_HANDLER ( to7_floppy_w )
18551855{
1856   switch ( to7_controller_type )
1856   switch ( to7_controller_type )
18571857   {
1858   
1858
18591859   case 1:
18601860      to7_5p14sd_w( offset, data );
18611861      return;
18621862
18631863   case 2:
1864      to7_5p14_w( offset, data );
1864      to7_5p14_w( offset, data );
18651865      break;
1866   
1866
18671867   case 3:
1868      if ( offset == 8 )
1868      if ( offset == 8 )
18691869      {
18701870         to7_floppy_bank = 3 + (data & 3);
18711871         memory_set_bank( THOM_FLOP_BANK,  to7_floppy_bank );
18721872         VLOG (( "to7_floppy_w: set CD 90-351 ROM bank to %i\n", data & 3 ));
18731873      }
1874      else
1875         thmfc_floppy_w( offset, data );
1874      else
1875         thmfc_floppy_w( offset, data );
18761876      break;
18771877
18781878   case 4:
1879      to7_qdd_w( offset, data );
1879      to7_qdd_w( offset, data );
18801880      break;
18811881
1882   case 5: 
1883      to7_network_w( offset, data );
1882   case 5:
1883      to7_network_w( offset, data );
18841884      break;
18851885   }
18861886}
r1461r1462
18891889
18901890/*********************** TO9 ************************/
18911891
1892/* the internal controller is WD2793-based (so, similar to to7_5p14)
1892/* the internal controller is WD2793-based (so, similar to to7_5p14)
18931893   we also emulate external controllers
18941894*/
18951895
r1461r1462
19061906void to9_floppy_reset( void )
19071907{
19081908   to7_floppy_reset();
1909   if ( THOM_FLOPPY_EXT )
1909   if ( THOM_FLOPPY_EXT )
19101910   {
19111911      LOG(( "to9_floppy_reset: external controller\n" ));
19121912   }
r1461r1462
19221922
19231923READ8_HANDLER ( to9_floppy_r )
19241924{
1925   if ( THOM_FLOPPY_EXT )
1925   if ( THOM_FLOPPY_EXT )
19261926      return to7_floppy_r( offset );
1927   else
1927   else
19281928      return  to7_5p14_r( offset );
19291929}
19301930
19311931WRITE8_HANDLER ( to9_floppy_w )
19321932{
1933   if ( THOM_FLOPPY_EXT )
1933   if ( THOM_FLOPPY_EXT )
19341934      to7_floppy_w( offset, data );
1935   else
1935   else
19361936      to7_5p14_w( offset, data );
19371937}
src/mess/devices/snapquik.c
r1461r1462
2828   struct snapquick_info *si = (struct snapquick_info *) ptr;
2929   snapquick_loadproc loadproc;
3030   const char *file_type;
31   
31
3232   loadproc = (snapquick_loadproc) device_get_info_fct(&si->dev->devclass, DEVINFO_PTR_SNAPSHOT_LOAD);
3333   file_type = image_filetype(si->img);
3434   loadproc(si->img, file_type, si->file_size);
src/mess/devices/cococart.c
r1461r1462
7070
7171   /* identify the cartridge type */
7272   cart_proc = find_cart(carttype);
73   assert_always(cart_proc != NULL, "Invalid cartridge hardware type");   
73   assert_always(cart_proc != NULL, "Invalid cartridge hardware type");
7474
7575   /* allocate the cartridge structure */
7676   extra_data_size = (size_t) cococart_get_info_int(cart_proc, COCOCARTINFO_INT_DATASIZE);
src/mess/tapectrl.c
r1461r1462
5757      strcat(name, " ");
5858      strcat(name, ui_getstring(UI_righthilight));
5959      ui_draw_message_window(name);
60     
60
6161      if (input_ui_pressed(IPT_UI_SELECT) || input_ui_pressed(IPT_UI_CANCEL))
6262         sel = -1;
6363      if (input_ui_pressed(IPT_UI_CONFIGURE))
src/mess/tools/dat2html/dat2html.c
r1461r1462
143143            {
144144               char *eq = strchr(line, '=');
145145               strcpy(system_name, eq + 1);
146                       
146
147147               sprintf(system_filename, "%s/%s.htm", html_directory, system_name);
148148               fprintf(html, "&bull;&nbsp;&nbsp;<a href=\"%s\">%s</a>\n", system_filename, system_name);
149               
149
150150               systemcount++;
151151
152152                             html_system = fopen(system_filename, "w");
153               
153
154154               if( !html_system )
155155               {
156156                  fprintf(stderr, "cannot create system_name file '%s'.\n", system_filename);
src/mess/tools/messtest/testimgt.c
r1461r1462
6464      return;
6565   }
6666   driver = attr_node->value;
67   
67
6868   /* does image creation support options? */
6969   module = imgtool_find_module(attr_node->value);
7070   if (module && module->createimage_optguide && module->createimage_optspec)
r1461r1462
677677
678678   attr_node = xml_get_attribute(node, "name");
679679   report_testcase_begin(attr_node ? attr_node->value : NULL);
680   
680
681681   memset(&state, 0, sizeof(state));
682682
683683   for (child_node = node->child; child_node; child_node = child_node->next)
src/mess/tools/messtest/main.c
r1461r1462
7979
8080   /* test case for memory allocation system */
8181   test_memory_pools();
82   
82
8383   /* expand wildcards so '*' can be used */
8484   expand_wildcards(&argc, &argv);
8585
r1461r1462
9191    * have to init first */
9292   cpuintrf_init(NULL);
9393   sndintrf_init(NULL);
94   
94
9595   /* register options */
9696   messtest_options = options_create(messtest_fail);
9797   options_add_entries(messtest_options, messtest_option_entries);
src/mess/tools/messtest/testmess.c
r1461r1462
247247   int pos, nextpos;
248248
249249   vsnprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), format, argptr);
250   
250
251251   pos = 0;
252252   while(buffer[pos] != '\0')
253253   {
r1461r1462
619619            break;
620620         view_index++;
621621      }
622     
622
623623      if (view_name)
624624      {
625625         render_target_set_view(target, view_index);
r1461r1462
752752         case MESSTEST_COMMAND_IMAGE_CREATE:
753753            success = (image_create(image, astring_c(filepath), format_index, NULL) == INIT_PASS);
754754            break;
755         
755
756756         case MESSTEST_COMMAND_IMAGE_LOAD:
757757            success = (image_load(image, astring_c(filepath)) == INIT_PASS);
758758            break;
r1461r1462
13001300      return;
13011301   }
13021302   new_command.u.image_args.device_type = device_type;
1303   
1303
13041304   /* 'slot' attribute */
13051305   attr_node = xml_get_attribute(node, "slot");
13061306   new_command.u.image_args.device_slot = attr_node ? atoi(attr_node->value) : 0;
src/mess/tools/messtest/core.c
r1461r1462
609609      state = STATE_ABORTED;
610610      final_time = timer_get_time();
611611      if (final_time > 0.0)
612         dump_screenshot();
612         dump_screenshot();
613613   }
614614*/
615615}
src/mess/tools/imgtool/imgterrs.h
r1461r1462
1010#define IMGTERRS_H
1111
1212/* Error codes */
13typedef enum
13typedef enum
1414{
1515   IMGTOOLERR_SUCCESS,
1616   IMGTOOLERR_OUTOFMEMORY,
src/mess/tools/imgtool/charconv.c
r1461r1462
1919static char *utf8_from_latin1(const char *src)
2020{
2121   char *buffer, *bufptr;
22   
22
2323   /* validate input */
2424   if (!src)
2525   {
2626      return NULL;
2727   }
28   
28
2929   /* allocate space for result, twice the source len to be safe */
3030   buffer = (char *) malloc(strlen(src) * 2 + 1);
31   
31
3232   /* point to the start */
3333   bufptr = buffer;
34   
34
3535   do
3636   {
3737      unsigned char c = *src;
38     
38
3939      if (c < 0x80)
4040      {
4141         *bufptr++ = c;
r1461r1462
4848      else
4949      {
5050         *bufptr++ = '\xc3';
51         *bufptr++ = c - 0x40;         
51         *bufptr++ = c - 0x40;
5252      }
5353   } while (*src++);
5454
r1461r1462
7070   {
7171      return NULL;
7272   }
73   
73
7474   /* allocate space for result */
7575   buffer = (char *) malloc(strlen(src) + 1);
76   
76
7777   /* point to the start */
7878   bufptr = buffer;
79   
79
8080   do
8181   {
8282      unsigned char c = *src;
83     
83
8484      if (c < 0x80)
8585      {
8686         *bufptr++ = c;
r1461r1462
102102         break;
103103      }
104104   } while(*src++);
105   
105
106106   return buffer;
107107}
108108
src/mess/tools/imgtool/iflopimg.c
r1461r1462
2929
3030      case FLOPPY_ERROR_UNSUPPORTED:
3131         return IMGTOOLERR_UNIMPLEMENTED;
32         
32
3333      default:
3434         return IMGTOOLERR_UNEXPECTED;
3535   }
r1461r1462
340340      if (err)
341341         goto done;
342342   }
343   
343
344344   err = FLOPPY_ERROR_SUCCESS;
345345
346346done:
src/mess/tools/imgtool/library.h
r1461r1462
150150   IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES,
151151   IMGTOOLINFO_INT_PATH_SEPARATOR,
152152   IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR,
153   IMGTOOLINFO_INT_PREFER_UCASE,
153   IMGTOOLINFO_INT_PREFER_UCASE,
154154   IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR,
155155   IMGTOOLINFO_INT_OPEN_IS_STRICT,
156156   IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME,
r1461r1462
341341   const char *eoln;
342342
343343   size_t image_extra_bytes;
344   
344
345345   /* flags */
346346   unsigned int initial_path_separator : 1;
347347   unsigned int open_is_strict : 1;
src/mess/tools/imgtool/windows/assocdlg.c
r1461r1462
9999            _sntprintf(buf, sizeof(buf) / sizeof(buf[0]), TEXT(".%s"), t_extension);
100100            free(t_extension);
101101
102            control = CreateWindow(TEXT("BUTTON"), buf, style,
102            control = CreateWindow(TEXT("BUTTON"), buf, style,
103103                xmargin, y, width, height, dialog, NULL, NULL, NULL);
104104            if (!control)
105105               return -1;
src/mess/tools/imgtool/windows/wimgtool.c
r1461r1462
9292   struct foreach_entry *first_entry = NULL;
9393   struct foreach_entry *last_entry = NULL;
9494   struct foreach_entry *entry;
95   
95
9696   info = get_wimgtool_info(window);
9797
9898   if (info->image)
r1461r1462
126126            if (err)
127127               return err;
128128
129            // if we have a path, prepend the path
129            // if we have a path, prepend the path
130130            if (info->current_directory && info->current_directory[0])
131131            {
132132               char path_separator = (char) imgtool_partition_get_info_int(info->partition, IMGTOOLINFO_INT_PATH_SEPARATOR);
r1461r1462
669669   }
670670
671671   win_set_window_text_utf8(window, buf);
672   
672
673673   for (i = 0; i < sizeof(statusbar_text) / sizeof(statusbar_text[0]); i++)
674674   {
675675      TCHAR *tempstr = statusbar_text[i] ? tstring_from_utf8(statusbar_text[i]) : NULL;
r1461r1462
899899         snprintf(local_subpath, sizeof(local_subpath) / sizeof(local_subpath[0]),
900900            "%s\\%s", local_path, entry.filename);
901901         subpath = imgtool_partition_path_concatenate(partition, path, entry.filename);
902         
902
903903         if (entry.directory)
904904            err = get_recursive_directory(partition, subpath, local_subpath);
905905         else
r1461r1462
10081008      err = IMGTOOLERR_OUTOFMEMORY;
10091009      goto done;
10101010   }
1011   
1011
10121012   // try to open the image
10131013   err = imgtool_image_open(module, filename, read_or_write, &image);
10141014   if ((ERRORCODE(err) == IMGTOOLERR_READONLY) && read_or_write)
r1461r1462
10531053
10541054   // refresh the window
10551055   full_refresh_image(window);
1056   
1056
10571057done:
10581058   return err;
10591059}
r1461r1462
10831083      goto done;
10841084
10851085   module = find_filter_module(ofn.filter_index, TRUE);
1086   
1086
10871087   err = imgtool_image_create(module, ofn.filename, resolution, NULL);
10881088   if (err)
10891089      goto done;
r1461r1462
12641264         ofi = (OPENFILENAME *) lparam;
12651265         info = (struct transfer_suggestion_info *) ofi->lCustData;
12661266         SetWindowLongPtr(dlgwnd, GWLP_USERDATA, (LONG_PTR) info);
1267         
1267
12681268         for (i = 0; info->suggestions[i].viability; i++)
12691269         {
12701270            SendMessage(filter_combo, CB_ADDSTRING, 0, (LPARAM) info->suggestions[i].description);
r1461r1462
16971697   htinfo.pt.x = pt.x - r.left;
16981698   htinfo.pt.y = pt.y - r.top;
16991699   ListView_HitTest(info->listview, &htinfo);
1700   
1700
17011701   if (htinfo.flags & LVHT_ONITEM)
17021702   {
17031703      memset(&entry, 0, sizeof(entry));
r1461r1462
17071707      ListView_GetItem(info->listview, &item);
17081708
17091709      selected_item = item.lParam;
1710   
1710
17111711      if (selected_item < 0)
17121712      {
17131713         strcpy(entry.filename, "..");
src/mess/tools/imgtool/windows/attrdlg.c
r1461r1462
388388   HWND ok_button, cancel_button;
389389   RECT r1, r2;
390390   LONG_PTR l;
391   
391
392392   switch(message)
393393   {
394394      case WM_INITDIALOG:
src/mess/tools/imgtool/windows/secview.c
r1461r1462
369369void win_sectorview_dialog(HWND parent, imgtool_image *image)
370370{
371371   struct sectorview_info info;
372   
372
373373   memset(&info, 0, sizeof(info));
374374   info.image = image;
375375
src/mess/tools/imgtool/windows/assoc.c
r1461r1462
2828   int i;
2929
3030   GetModuleFileName(GetModuleHandle(NULL), buf, buflen);
31   
31
3232   for (i = 0; buf[i]; i++)
3333      buf[i] = toupper(buf[i]);
3434   buf[i++] = ' ';
src/mess/tools/imgtool/windows/wmain.c
r1461r1462
2222   int pos, rc = -1;
2323   imgtoolerr_t err;
2424   HACCEL accel = NULL;
25   
25
2626   // initialize Windows classes
2727   InitCommonControls();
2828   if (!wimgtool_registerclass())
r1461r1462
6161         command_line[strlen(command_line)-1] = '\0';
6262         pos++;
6363      }
64     
64
6565      err = wimgtool_open_image(window, NULL, command_line + pos, OSD_FOPEN_RW);
6666      if (err)
6767         wimgtool_report_error(window, err, command_line + pos, NULL);
src/mess/tools/imgtool/windows/hexview.c
r1461r1462
199199   struct hexview_info *info;
200200
201201   info = get_hexview_info(hexview);
202   
202
203203   switch(message)
204204   {
205205      case WM_CREATE:
src/mess/tools/imgtool/windows/wimgres.h
r1461r1462
4343#define IDC_STATIC                      -1
4444
4545// Next default values for new objects
46//
46//
4747#ifdef APSTUDIO_INVOKED
4848#ifndef APSTUDIO_READONLY_SYMBOLS
4949#define _APS_NEXT_RESOURCE_VALUE        126
src/mess/tools/imgtool/imgtool.c
r1461r1462
146146static char *normalize_filename(imgtool_partition *partition, const char *src)
147147{
148148   imgtool_charset charset;
149   
149
150150   /* get charset from module */
151   charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET);
151   charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET);
152152
153153   /* and dupe it */
154154   return native_from_utf8(charset, src);
r1461r1462
10771077   memset(image, '\0', size);
10781078   image->pool = pool;
10791079   image->module = module;
1080   
1080
10811081   /* actually call create or open */
10821082   if (read_or_write == OSD_FOPEN_RW_CREATE)
10831083      err = module->create(image, f, createopts);
r1461r1462
12391239   char path_separator, alt_path_separator;
12401240   const char *s;
12411241   int in_path_separator, i, j;
1242   
1242
12431243   path_separator = partition->path_separator;
12441244   alt_path_separator = partition->alternate_path_separator;
12451245
r1461r1462
12561256         err = IMGTOOLERR_FILENOTFOUND;
12571257      goto done;
12581258   }
1259   
1259
12601260   if (path_separator == '\0')
12611261   {
12621262      if (flags & PATH_MUSTBEDIR)
r1461r1462
14451445      err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY;
14461446      goto done;
14471447   }
1448   
1449   path = new_fname;   
14501448
1449   path = new_fname;
1450
14511451   /* cannonicalize path */
14521452   err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path);
14531453   if (err)
r1461r1462
14901490      err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY;
14911491      goto done;
14921492   }
1493   
1493
14941494   path = new_fname;
1495   
1495
14961496   /* cannonicalize path */
14971497   err = cannonicalize_path(partition, PATH_LEAVENULLALONE, &path, &alloc_path);
14981498   if (err)
r1461r1462
15981598      err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY;
15991599      goto done;
16001600   }
1601   
1601
16021602   path = new_fname;
1603   
1603
16041604   /* cannonicalize path */
16051605   err = cannonicalize_path(partition, 0, &path, &alloc_path);
16061606   if (err)
r1461r1462
20642064      err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY;
20652065      goto done;
20662066   }
2067   
2067
20682068   filename = new_fname;
2069   
2069
20702070   err = imgtool_partition_read_file(partition, filename, fork, f, filter);
20712071   if (err)
20722072      goto done;
r1461r1462
20952095   imgtool_stream *f = NULL;
20962096   imgtool_charset charset;
20972097   char *alloc_newfname = NULL;
2098   
2098
20992099   if (!newfname)
21002100      newfname = (const char *) osd_basename((char *) source);
21012101
2102   charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET);
2102   charset = (imgtool_charset) (int) imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET);
21032103   if (charset != IMGTOOL_CHARSET_UTF8)
21042104   {
2105      /* convert to native format */
2105      /* convert to native format */
21062106      alloc_newfname = native_from_utf8(charset, newfname);
21072107      if (alloc_newfname == NULL)
21082108      {
r1461r1462
21402140   imgtoolerr_t err;
21412141   char *alloc_path = NULL;
21422142   char *new_fname = NULL;
2143   
2143
21442144   if (!partition->delete_file)
21452145   {
21462146      err = IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY;
r1461r1462
21532153      err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY;
21542154      goto done;
21552155   }
2156   
2156
21572157   fname = new_fname;
2158   
2158
21592159   /* cannonicalize path */
21602160   err = cannonicalize_path(partition, 0, &fname, &alloc_path);
21612161   if (err)
r1461r1462
22012201      err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY;
22022202      goto done;
22032203   }
2204   
2204
22052205   path = new_fname;
2206   
2206
22072207   /* cannonicalize path */
22082208   err = cannonicalize_path(partition, 0, &path, &alloc_path);
22092209   if (err)
r1461r1462
22332233   imgtoolerr_t err;
22342234   char *alloc_path = NULL;
22352235   char *new_path = NULL;
2236   
2236
22372237   /* implemented? */
22382238   if (!partition->create_dir)
22392239   {
r1461r1462
22472247      err = IMGTOOLERR_BADFILENAME | IMGTOOLERR_SRC_FUNCTIONALITY;
22482248      goto done;
22492249   }
2250   
2250
22512251   path = new_path;
2252   
2252
22532253   /* cannonicalize path */
22542254   err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path);
22552255   if (err)
r1461r1462
22792279   imgtoolerr_t err;
22802280   char *alloc_path = NULL;
22812281   char *new_path = NULL;
2282   
2282
22832283   /* implemented? */
22842284   if (!partition->delete_dir)
22852285   {
22862286      err = IMGTOOLERR_UNIMPLEMENTED | IMGTOOLERR_SRC_FUNCTIONALITY;
22872287      goto done;
22882288   }
2289   
2289
22902290   new_path = normalize_filename(partition, path);
22912291   if (new_path == NULL)
22922292   {
r1461r1462
22952295   }
22962296
22972297   path = new_path;
2298   
2298
22992299   /* cannonicalize path */
23002300   err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path);
23012301   if (err)
r1461r1462
25892589
25902590   new_path = normalize_filename(partition, path);
25912591   path = new_path;
2592   
2592
25932593   err = cannonicalize_path(partition, PATH_MUSTBEDIR, &path, &alloc_path);
25942594   if (err)
25952595      goto done;
r1461r1462
26672667   if (err)
26682668      return markerrorsource(err);
26692669
2670   charset = imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET);
2671   
2670   charset = imgtool_partition_get_info_int(partition, IMGTOOLINFO_INT_CHARSET);
2671
26722672   if (charset)
26732673   {
26742674      char *new_fname = utf8_from_native(charset, ent->filename);
2675   
2675
26762676      if (!new_fname)
26772677         return IMGTOOLERR_BADFILENAME;
2678   
2678
26792679      strcpy(ent->filename, new_fname);
26802680      free(new_fname);
26812681   }
2682   
2682
26832683   /* don't trust the module! */
26842684   if (!partition->supports_creation_time && (ent->creation_time != 0))
26852685   {
src/mess/tools/imgtool/filtbas.c
r1461r1462
7474      else
7575      {
7676         address = (UINT16) pick_integer_le(line_header, 0, 2);
77         line_number = (UINT16) pick_integer_le(line_header, 2, 2);         
77         line_number = (UINT16) pick_integer_le(line_header, 2, 2);
7878      }
7979
8080      stream_printf(destf, "%u ", (unsigned) line_number);
r1461r1462
8484      {
8585         if (b == 0x22)
8686            in_string = in_string ? FALSE : TRUE;
87           
87
8888         if ((b & 0x80) && (!in_string))
8989         {
9090            token = NULL;
src/mess/tools/imgtool/modules/ti99.c
r1461r1462
974974
975975   if (img_format == if_harddisk)
976976   {
977      const hard_disk_info *info;
977      const hard_disk_info *info;
978978
979979      err = imghd_open(file_handle, &l1_img->harddisk_handle);
980980      if (err)
r1461r1462
16501650} win_fdr;
16511651
16521652/*
1653   tifile header: stand-alone file
1653   tifile header: stand-alone file
16541654*/
16551655typedef struct tifile_header
16561656{
r1461r1462
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{
r1461r1462
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{
src/mess/tools/imgtool/modules/imgwave.c
r1461r1462
425425      }
426426   }
427427   while(strcmp(ent.fname, fname));
428   
428
429429   imgwave_closeenum(enumeration);
430430   enumeration = NULL;
431431
src/mess/tools/imgtool/modules/os9.c
r1461r1462
348348   return free_lsns;
349349}
350350
351   
352351
352
353353static imgtoolerr_t os9_corrupt_file_error(const struct os9_fileinfo *file_info)
354354{
355355   imgtoolerr_t err;
r1461r1462
527527      {
528528         entry_index = index;
529529         entry_lsn = os9_lookup_lsn(img, &dir_info, &entry_index);
530         
530
531531         err = os9_read_lsn(img, entry_lsn, entry_index, entry, sizeof(entry));
532532         if (err)
533533            goto done;
r1461r1462
544544            if (!strcmp(path, filename))
545545               break;
546546         }
547         
547
548548      }
549549
550550      /* at the end of the file? */
r1461r1462
562562         err = os9_allocate_lsn(img, &allocated_lsn);
563563         if (err)
564564            goto done;
565         
565
566566         /* write the file */
567567         memset(block, 0, sizeof(block));
568568         place_integer_be(block, 0, 1, 0x1B | ((create == CREATE_DIR) ? 0x80 : 0x00));
569569         err = os9_write_lsn(img, allocated_lsn, 0, block, sizeof(block));
570570         if (err)
571571            goto done;
572         
572
573573         if( free_entry_index == 0xffffffff )
574574         {
575575            /* expand the directory to hold the new entry */
r1461r1462
761761   place_integer_be(header,  17,  2, sectors);
762762   place_string(header,   31, 32, title);
763763   place_integer_be(header, 103, 2, sector_bytes / 256);
764   
764
765765   /* path descriptor options */
766766   place_integer_be(header, 0x3f+0x00, 1, 1); /* device class */
767767   place_integer_be(header, 0x3f+0x01, 1, 1); /* drive number */
r1461r1462
773773   place_integer_be(header, 0x3f+0x0b, 2, sectors); /* sectors on track zero */
774774   place_integer_be(header, 0x3f+0x0d, 1, 3); /* sector interleave factor */
775775   place_integer_be(header, 0x3f+0x0e, 1, 8); /* default sectors per allocation */
776   
776
777777   err = floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id, 0, header, sector_bytes);
778778   if (err)
779779      goto done;
r1461r1462
783783   for (i = 0; i < allocation_bitmap_lsns; i++)
784784   {
785785      memset(header, 0x00, sector_bytes);
786     
786
787787      if (total_allocated_sectors > (8 * 256))
788788      {
789789         memset(header, 0xff, sector_bytes);
r1461r1462
793793      {
794794         int offset;
795795         UINT8 mask;
796           
796
797797         while( total_allocated_sectors >= 0 )
798798         {
799799            offset = total_allocated_sectors / 8;
r1461r1462
803803            total_allocated_sectors--;
804804         }
805805      }
806     
806
807807      err = floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + i, 0, header, sector_bytes);
808808      if (err)
809809         goto done;
r1461r1462
959959
960960   /* fill out imgtool_dirent structure */
961961   snprintf(ent->filename, sizeof(ent->filename) / sizeof(ent->filename[0]), "%s", filename);
962   snprintf(ent->attr, sizeof(ent->attr) / sizeof(ent->attr[0]), "%c%c%c%c%c%c%c%c",
962   snprintf(ent->attr, sizeof(ent->attr) / sizeof(ent->attr[0]), "%c%c%c%c%c%c%c%c",
963963      file_info.directory      ? 'd' : '-',
964964      file_info.non_sharable   ? 's' : '-',
965965      file_info.public_execute ? 'x' : '-',
src/mess/tools/imgtool/modules/cococas.c
r1461r1462
9898   }
9999   if (err)
100100      return err;
101   
101
102102   /* If block is not a filename block, fail */
103103   if (blk.type != COCOCAS_BLOCKTYPE_FILENAME)
104104      return IMGTOOLERR_CORRUPTIMAGE;
r1461r1462
126126
127127   if (blk.type != COCOCAS_BLOCKTYPE_EOF)
128128      return IMGTOOLERR_CORRUPTIMAGE;
129   
129
130130   ent->filesize = filesize;
131131
132132   return 0;
r1461r1462
141141   err = readblock(img, &blk);
142142   if (err)
143143      return err;
144   
144
145145   /* If block is not a filename block, fail */
146146   if (blk.type != COCOCAS_BLOCKTYPE_FILENAME)
147147      return IMGTOOLERR_CORRUPTIMAGE;
r1461r1462
158158
159159   if (blk.type != COCOCAS_BLOCKTYPE_EOF)
160160      return IMGTOOLERR_CORRUPTIMAGE;
161   
161
162162   return 0;
163163}
164164
src/mess/tools/imgtool/modules/thomson.c
r1461r1462
2525
2626   Notes:
2727
28   - 2"8 QDD actually contain a single spiraling track, with 400 128-byte
28   - 2"8 QDD actually contain a single spiraling track, with 400 128-byte
2929   sectors; however, the filesystem considers it has 25 virtual tracks of
30   16 sectors => we do the same in imgtool (but thomflop.c uses a 400-sector
30   16 sectors => we do the same in imgtool (but thomflop.c uses a 400-sector
3131   addressing to emulate the device hardware)
3232
3333   - tracks always have 16 sectors, this is requred by the filesystem
3434
3535   - two-sided floppies are handled as two one-sided floppies in two
3636   logical floppy drives on the original Thomsons; each has its own
37   independent FAT and directory.
37   independent FAT and directory.
3838   In imgtool, we handle two-sided images as two partitions.
3939   For now, only 3"1/2 .fd and QDD .qd files can be two-sided.
4040
r1461r1462
5353   Depending on the number of tracks, there can be 50, 80 or 160 blocks.
5454
5555   Filesystem data always occupy track 20, whatever the floppy geometry.
56   
57   * sector 1:
56
57   * sector 1:
5858     - bytes 0-7: floppy name
5959     - remaining bytes: undocumented, seem unused
6060
r1461r1462
7777     Note: in single density, we can reference only 127 blocks. This is not
7878     a problem because single density floppies can only have 50 or 80 blocks,
7979     never 160.
80     
80
8181   * sector 3-16: directory
8282
8383     no subdirectories
r1461r1462
162162} thom_dirent;
163163
164164
165static void thom_basic_get_info(const imgtool_class *clas, UINT32 param,
165static void thom_basic_get_info(const imgtool_class *clas, UINT32 param,
166166            union imgtoolinfo *info);
167167
168static UINT8* thom_get_sector(thom_floppy* f, unsigned head,
168static UINT8* thom_get_sector(thom_floppy* f, unsigned head,
169169               unsigned track, unsigned sector);
170170
171171
r1461r1462
183183{
184184  thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
185185  int size = stream_size( stream );
186 
186
187187  f->stream = stream;
188188  f->modified = 0;
189189
r1461r1462
197197    f->heads = 1;
198198    break;
199199
200  case 163840:
200  case 163840:
201201    f->tracks = 40;
202202    f->sector_size = 256;
203203    f->sectuse_size = 255;
r1461r1462
238238  default:
239239    return IMGTOOLERR_CORRUPTIMAGE;
240240  }
241
241
242242  assert( size == f->heads * f->tracks * 16 * f->sector_size );
243243
244244  stream_seek( stream, 0, SEEK_SET );
r1461r1462
266266
267267/*********************** .sap format ************************/
268268
269/* SAP format, Copyright 1998 by Alexandre Pukall
269/* SAP format, Copyright 1998 by Alexandre Pukall
270270
271271   image is composed of:
272272   - byte 0:        version (0 or 1)
273273   - bytes 1..65:   signature
274274   - bytes 66..end: sectors
275 
275
276276   each sector is composed of
277277   - a 4-byte header:
278278     . byte 0:     format
r1461r1462
313313{
314314  thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
315315  UINT8 buf[262];
316 
316
317317  f->stream = stream;
318318  f->modified = 0;
319319
r1461r1462
342342    break;
343343  default: return IMGTOOLERR_CORRUPTIMAGE;
344344  }
345 
345
346346 stream_seek( stream, 66, SEEK_SET );
347347  while ( 1) {
348348    int i, sector, track;
349349    UINT16 crc;
350350
351351    /* load sector */
352    if ( stream_read( stream, buf, 6 + f->sector_size ) < 6 + f->sector_size )
352    if ( stream_read( stream, buf, 6 + f->sector_size ) < 6 + f->sector_size )
353353      break;
354354
355355    /* parse sector header */
r1461r1462
389389      logerror( "thom_diskimage_close_sap: write error\n" );
390390      return;
391391    }
392   
392
393393    for ( track = 0; track < f->tracks; track++ )
394394      for ( sector = 1; sector <= 16; sector++ ) {
395395
r1461r1462
398398   buf[1] = 0;
399399   buf[2] = track;
400400   buf[3] = sector;
401   memcpy( buf + 4,
401   memcpy( buf + 4,
402402      thom_get_sector( f, 0, track, sector), f->sector_size );
403403
404404   /* compute crc */
r1461r1462
410410   for ( i = 0; i < f->sector_size; i++ ) buf[ i + 4 ] ^= sap_magic_num;
411411
412412   /* save */
413   if ( stream_write( f->stream, buf, f->sector_size + 6 ) <
413   if ( stream_write( f->stream, buf, f->sector_size + 6 ) <
414414        f->sector_size + 6 ) {
415415     logerror( "thom_diskimage_close_sap: write error\n" );
416416     return;
417417   }
418418      }
419419  }
420 
420
421421  stream_close( f->stream );
422422}
423423
424424
425425/*********************** low-level functions *********************/
426426
427static UINT8* thom_get_sector(thom_floppy* f, unsigned head,
427static UINT8* thom_get_sector(thom_floppy* f, unsigned head,
428428               unsigned track, unsigned sector)
429429{
430430  assert( head < f->heads);
431431  assert( track < f->tracks );
432432  assert( sector > 0 && sector <= 16 );
433  return & f->data[ ( (head * f->tracks + track) * 16 + (sector-1) ) *
433  return & f->data[ ( (head * f->tracks + track) * 16 + (sector-1) ) *
434434          f->sector_size ];
435435}
436436
r1461r1462
553553  }
554554}
555555
556static void thom_set_dirent(thom_floppy* f, unsigned head,
556static void thom_set_dirent(thom_floppy* f, unsigned head,
557557             unsigned n, thom_dirent* d)
558558{
559559  UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32;
r1461r1462
774774      d->lastsectsize = size;
775775      break;
776776    }
777   
777
778778    /* find next free block & update fat */
779779    i = block;
780780    for ( block++; block < nbblocks && fat[ block + 1 ] != 0xff; block++ );
r1461r1462
795795
796796/********************** module functions ***********************/
797797
798static imgtoolerr_t thom_get_sector_size(imgtool_image* img, UINT32 track,
799                UINT32 head, UINT32 sector,
798static imgtoolerr_t thom_get_sector_size(imgtool_image* img, UINT32 track,
799                UINT32 head, UINT32 sector,
800800                UINT32 *sector_size)
801801{
802802  thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
803 
803
804804  if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) {
805805    if ( sector_size ) *sector_size = 0;
806806    return IMGTOOLERR_SEEKERROR;
r1461r1462
809809  return IMGTOOLERR_SUCCESS;
810810}
811811
812static imgtoolerr_t thom_get_geometry(imgtool_image* img, UINT32* tracks,
812static imgtoolerr_t thom_get_geometry(imgtool_image* img, UINT32* tracks,
813813                  UINT32* heads, UINT32* sectors)
814814{
815815  thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
r1461r1462
819819  return IMGTOOLERR_SUCCESS;
820820}
821821
822static imgtoolerr_t thom_read_sector(imgtool_image* img, UINT32 track,
823                 UINT32 head, UINT32 sector, void *buf,
822static imgtoolerr_t thom_read_sector(imgtool_image* img, UINT32 track,
823                 UINT32 head, UINT32 sector, void *buf,
824824                 size_t len)
825825{
826826  thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
r1461r1462
831831  return IMGTOOLERR_SUCCESS;
832832}
833833
834static imgtoolerr_t thom_write_sector(imgtool_image *img, UINT32 track,
835                  UINT32 head, UINT32 sector,
834static imgtoolerr_t thom_write_sector(imgtool_image *img, UINT32 track,
835                  UINT32 head, UINT32 sector,
836836                  const void *buf, size_t len)
837837{
838838  thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
r1461r1462
861861
862862/* each side of a floppy has its own filesystem, we treat them as'partitions'
863863 */
864static imgtoolerr_t thom_list_partitions(imgtool_image *img,
865                imgtool_partition_info *partitions,
864static imgtoolerr_t thom_list_partitions(imgtool_image *img,
865                imgtool_partition_info *partitions,
866866                size_t len)
867867{
868868  thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
r1461r1462
879879  return IMGTOOLERR_SUCCESS;
880880}
881881
882static imgtoolerr_t thom_open_partition(imgtool_partition *part,
882static imgtoolerr_t thom_open_partition(imgtool_partition *part,
883883               UINT64 first_block, UINT64 block_count)
884884{
885885  imgtool_image* img = imgtool_partition_image( part );
r1461r1462
891891}
892892
893893
894static imgtoolerr_t thom_begin_enum(imgtool_directory *enumeration,
894static imgtoolerr_t thom_begin_enum(imgtool_directory *enumeration,
895895                const char *path)
896896{
897897  int* n = (int*) imgtool_directory_extrabytes( enumeration );
r1461r1462
899899  return IMGTOOLERR_SUCCESS;
900900}
901901
902static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration,
902static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration,
903903               imgtool_dirent *ent)
904904{
905905  imgtool_partition *part = imgtool_directory_partition( enumeration);
r1461r1462
909909  int* n = (int*) imgtool_directory_extrabytes( enumeration );
910910  thom_dirent d;
911911
912  do {
912  do {
913913    thom_get_dirent( f, head, *n, &d );
914914    (*n) ++;
915  }
915  }
916916  while ( d.type == THOM_DIRENT_FREE );
917917  if ( d.type == THOM_DIRENT_END ) ent->eof = 1;
918918  else if ( d.type == THOM_DIRENT_INVALID ) {
r1461r1462
922922    int size;
923923    snprintf( ent->filename, sizeof(ent->filename), "%s.%s", d.name, d.ext );
924924    snprintf( ent->attr, sizeof(ent->attr), "%c %c %s",
925         (d.ftype == 0) ? 'B' :  (d.ftype == 1) ? 'D' :
925         (d.ftype == 0) ? 'B' :  (d.ftype == 1) ? 'D' :
926926         (d.ftype == 2) ? 'M' :  (d.ftype == 3) ? 'A' : '?',
927927         (d.format == 0) ? 'B' : (d.format == 0xff) ? 'A' : '?',
928928         d.comment );
r1461r1462
947947  return IMGTOOLERR_SUCCESS;
948948}
949949
950static imgtoolerr_t thom_read_file(imgtool_partition *part,
951               const char *filename,
952               const char *fork,
950static imgtoolerr_t thom_read_file(imgtool_partition *part,
951               const char *filename,
952               const char *fork,
953953               imgtool_stream *destf)
954954{
955955  int head = *( (int*) imgtool_partition_extra_bytes( part ) );
r1461r1462
963963  thom_conv_filename( filename, name, ext );
964964  sprintf( fname, "%s.%s", name, ext );
965965
966  if ( ! thom_find_dirent( f, head, fname, &d ) )
966  if ( ! thom_find_dirent( f, head, fname, &d ) )
967967    return IMGTOOLERR_FILENOTFOUND;
968968  size = thom_get_file_size( f, head, &d );
969969  if ( size < 0 ) return IMGTOOLERR_CORRUPTFILE;
r1461r1462
971971  return IMGTOOLERR_SUCCESS;
972972}
973973
974static imgtoolerr_t thom_delete_file(imgtool_partition *part,
974static imgtoolerr_t thom_delete_file(imgtool_partition *part,
975975                 const char *filename)
976976{
977977  int head = *( (int*) imgtool_partition_extra_bytes( part ) );
r1461r1462
983983  /* convert filename */
984984  thom_conv_filename( filename, name, ext );
985985  sprintf( fname, "%s.%s", name, ext );
986 
987  if ( ! thom_find_dirent( f, head, fname, &d ) )
986
987  if ( ! thom_find_dirent( f, head, fname, &d ) )
988988    return IMGTOOLERR_FILENOTFOUND;
989989  /*if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE;*/
990990  if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR;
r1461r1462
992992  return IMGTOOLERR_SUCCESS;
993993}
994994
995static imgtoolerr_t thom_write_file(imgtool_partition *part,
996                const char *filename,
997                const char *fork,
998                imgtool_stream *sourcef,
995static imgtoolerr_t thom_write_file(imgtool_partition *part,
996                const char *filename,
997                const char *fork,
998                imgtool_stream *sourcef,
999999                option_resolution *opts)
10001000{
10011001  int head = *( (int*) imgtool_partition_extra_bytes( part ) );
r1461r1462
10361036
10371037  /* file type */
10381038  switch ( option_resolution_lookup_int( opts, 'T' ) ) {
1039  case 0:
1039  case 0:
10401040    if ( ! is_new ) break;
10411041    if ( ! mame_stricmp( ext, "BAS" ) ) d.ftype = 0;
10421042    else if ( ! mame_stricmp( ext, "BAT" ) ) d.ftype = 0;
r1461r1462
10561056
10571057 /* format flag */
10581058 switch ( option_resolution_lookup_int( opts, 'F' ) ) {
1059  case 0:
1059  case 0:
10601060    if ( ! is_new ) break;
10611061    if ( ! mame_stricmp( ext, "DAT" ) ) d.format = 0xff;
10621062    else if ( ! mame_stricmp( ext, "ASC" ) ) d.format = 0xff;
r1461r1462
10661066  case 1: d.format = 0; break;
10671067  case 2: d.format = 0xff; break;
10681068  }
1069
1069
10701070 /* comment */
10711071 comment = option_resolution_lookup_string( opts, 'C' );
10721072 if ( comment && *comment )
r1461r1462
10771077 return IMGTOOLERR_SUCCESS;
10781078}
10791079
1080static imgtoolerr_t thom_suggest_transfer(imgtool_partition *part,
1081                 const char *fname,
1080static imgtoolerr_t thom_suggest_transfer(imgtool_partition *part,
1081                 const char *fname,
10821082                 imgtool_transfer_suggestion *suggestions,
10831083                 size_t suggestions_length)
10841084{
r1461r1462
10911091  if ( suggestions_length < 1 ) return IMGTOOLERR_SUCCESS;
10921092
10931093  if ( fname ) {
1094    if ( ! thom_find_dirent( f, head, fname, &d ) )
1094    if ( ! thom_find_dirent( f, head, fname, &d ) )
10951095      return IMGTOOLERR_FILENOTFOUND;
10961096    if ( d.ftype == 0 && d.format == 0 ) is_basic = 1;
10971097  }
r1461r1462
11211121}
11221122
11231123static imgtoolerr_t thom_create(imgtool_image* img,
1124            imgtool_stream *stream,
1124            imgtool_stream *stream,
11251125            option_resolution *opts)
11261126{
11271127  thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
r1461r1462
11621162      thom_unstringity( (char*)buf, 8 );
11631163    }
11641164    else memset( buf, ' ', 8 );
1165   
1165
11661166    /* FAT */
11671167    buf = thom_get_sector( f, i, 20, 2 );
11681168    memset( buf, 0, f->sector_size );
11691169    memset( buf + 1, 0xff, thom_nb_blocks( f ) );
11701170    buf[ 41 ] = buf[ 42 ] = 0xfe; /* reserved for FAT */
1171   
1171
11721172    /* (empty) directory */
11731173    buf = thom_get_sector( f, i, 20, 3 );
11741174    memset( buf, 0xff, 14 * f->sector_size );
r1461r1462
11841184
11851185/* character codes >= 128 are reserved for BASIC keywords */
11861186
1187static const char *const thombas7[2][128] = {
1187static const char *const thombas7[2][128] = {
11881188  { /* statements */
11891189    "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF",
11901190    "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
1191    "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO",
1191    "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO",
11921192    "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
11931193    "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT",
11941194    "CONT", "LIST", "CLEAR", "WHILE", "WHEN", "NEW", "SAVE", "LOAD", "MERGE",
11951195    "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
1196    "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
1196    "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
11971197    "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
11981198    ">", "=", "<",
11991199    /* DOS specific */
12001200    "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
1201    "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
1201    "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
12021202    "BACKUP", "COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "DENSITY",
12031203  },
12041204  { /* functions: 0xff prefix */
r1461r1462
12181218  { /* statements */
12191219    "END", "FOR", "NEXT", "DATA", "DIM", "READ", NULL, "GO", "RUN", "IF",
12201220    "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
1221    "DEFINT", "DEFSNG", NULL, "ON", "TUNE", "ERROR", "RESUME", "AUTO",
1221    "DEFINT", "DEFSNG", NULL, "ON", "TUNE", "ERROR", "RESUME", "AUTO",
12221222    "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
12231223    "BEEP", "COLOR", "LINE", "BOX", NULL, "ATTRB", "DEF", "POKE", "PRINT",
12241224    "CONT", "LIST", "CLEAR", "DOS", NULL, "NEW", "SAVE", "LOAD", "MERGE",
12251225    "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
1226    "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
1226    "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
12271227    "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
12281228    ">", "=", "<",
12291229    /* DOS specific */
12301230    "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
12311231    "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
1232    "BACKUP","COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "SEARCH",
1232    "BACKUP","COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "SEARCH",
12331233    "DENSITY",
12341234  },
12351235  { /* functions: 0xff prefix */
r1461r1462
12401240    "SCREEN", "POS", "PTRIG",
12411241    /* DOS specific */
12421242    "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF",
1243    "SPACE$", "STRING$", "DSKI$",
1243    "SPACE$", "STRING$", "DSKI$",
12441244  }
12451245};
12461246
r1461r1462
12521252  { /* statements */
12531253    "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF",
12541254    "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
1255    "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO",
1255    "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO",
12561256    "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
12571257    "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT",
12581258    "CONT", "LIST", "CLEAR", "INTERVAL", "KEY", "NEW", "SAVE", "LOAD", "MERGE",
12591259    "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
1260    "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
1260    "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
12611261    "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
1262    ">", "=", "<",
1262    ">", "=", "<",
12631263    "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
1264    "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
1264    "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
12651265    "BACKUP", "COPY", "CIRCLE", "PAINT", "RESET", "RENUM", "SWAP", "DENSITY",
1266    "WINDOW", "PATTERN", "DO", "LOOP", "EXIT", "INMOUSE", "MOUSE", "CHAINE",
1266    "WINDOW", "PATTERN", "DO", "LOOP", "EXIT", "INMOUSE", "MOUSE", "CHAINE",
12671267    "COMMON", "SEARCH", "FWD", "TURTLE",
12681268  },
12691269  { /* functions: 0xff prefix */
r1461r1462
12731273    "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT",
12741274    "SCREEN", "POS", "PTRIG",
12751275    "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF",
1276    "SPACE$", "STRING$", "DSKI$",
1277    "FKEY$", "MIN(", "MAX(", "ATN", "CRUNCH$", "MTRIG", "EVAL", "PALETTE",
1276    "SPACE$", "STRING$", "DSKI$",
1277    "FKEY$", "MIN(", "MAX(", "ATN", "CRUNCH$", "MTRIG", "EVAL", "PALETTE",
12781278    "BANK", "HEAD", "ROT", "SHOW", "ZOOM", "TRACE",
12791279  }
12801280};
12811281
12821282/* tables for simple XOR encryption sieve */
1283static const UINT8 crypt1[11] = {
1284  0x80, 0x19, 0x56, 0xAA, 0x80, 0x76, 0x22, 0xF1,  0x82, 0x38, 0xAA
1283static const UINT8 crypt1[11] = {
1284  0x80, 0x19, 0x56, 0xAA, 0x80, 0x76, 0x22, 0xF1,  0x82, 0x38, 0xAA
12851285};
12861286
12871287static const UINT8 crypt2[13] = {
r1461r1462
13181318  }
13191319}
13201320
1321static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part,
1321static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part,
13221322               const char *name,
13231323               const char *fork, imgtool_stream *dst)
13241324{
r1461r1462
13511351  return IMGTOOLERR_SUCCESS;
13521352}
13531353
1354static imgtoolerr_t thomcrypt_write_file(imgtool_partition *part,
1354static imgtoolerr_t thomcrypt_write_file(imgtool_partition *part,
13551355                const char *name,
13561356                const char *fork, imgtool_stream *src,
13571357                option_resolution *opts)
13581358{
13591359  UINT8 buf[3];
1360
1360
13611361  if ( stream_read( src, buf, 3 ) < 3 || buf[0] == 0xfe ) {
13621362    /* too short or already encrypted file */
13631363    stream_seek( src, 0, SEEK_SET );
r1461r1462
13971397}
13981398
13991399/* untokenization automatically decrypt protected files */
1400static imgtoolerr_t thom_basic_read_file(imgtool_partition *part,
1401                const char *name,
1402                const char *fork,
1400static imgtoolerr_t thom_basic_read_file(imgtool_partition *part,
1401                const char *name,
1402                const char *fork,
14031403                imgtool_stream *dst,
14041404                const char *const table[2][128])
14051405{
r1461r1462
14201420  while ( 1 ) {
14211421    int in_str = 0, in_fun = 0;
14221422    int linelength, linenum;
1423   
1423
14241424    /* line header: line length and line number */
14251425    /* I am not sure this is 100% correct but it works in many cases */
14261426    if ( stream_read( org, buf, 2 ) < 2 ) goto end;
r1461r1462
14681468}
14691469
14701470static imgtoolerr_t thom_basic_write_file(imgtool_partition *part,
1471                const char *name,
1472                const char *fork,
1473                imgtool_stream *src,
1471                const char *name,
1472                const char *fork,
1473                imgtool_stream *src,
14741474                option_resolution *opts,
14751475                const char *const table[2][128])
14761476{
r1461r1462
15131513      }                           \
15141514  }
15151515
1516FILTER( thombas5,   
1516FILTER( thombas5,
15171517   "Thomson MO5 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" )
1518FILTER( thombas7,   
1518FILTER( thombas7,
15191519   "Thomson TO7 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" )
1520FILTER( thombas128,
1520FILTER( thombas128,
15211521   "Thomson w/ BASIC 128/512, Tokenized Files (read-only, auto-decrypt)" )
15221522
15231523
r1461r1462
15491549  OPTION_STRING( 'C', "comment", "Comment" )
15501550OPTION_GUIDE_END
15511551
1552static void thom_basic_get_info(const imgtool_class *clas,
1553            UINT32 param,
1552static void thom_basic_get_info(const imgtool_class *clas,
1553            UINT32 param,
15541554            union imgtoolinfo *info)
15551555{
15561556  switch ( param ) {
r1461r1462
16121612  }
16131613}
16141614
1615void thom_fd_basic_get_info(const imgtool_class *clas,
1616             UINT32 param,
1615void thom_fd_basic_get_info(const imgtool_class *clas,
1616             UINT32 param,
16171617             union imgtoolinfo *info)
16181618{
16191619  switch ( param ) {
16201620  case IMGTOOLINFO_STR_NAME:
16211621    strcpy( info->s = imgtool_temp_str(), "thom_fd" ); break;
16221622  case IMGTOOLINFO_STR_DESCRIPTION:
1623    strcpy( info->s = imgtool_temp_str(),
1623    strcpy( info->s = imgtool_temp_str(),
16241624       "Thomson .fd disk image, BASIC format" );
16251625    break;
16261626  case IMGTOOLINFO_STR_FILE_EXTENSIONS:
r1461r1462
16361636  }
16371637}
16381638
1639void thom_qd_basic_get_info(const imgtool_class *clas,
1640             UINT32 param,
1639void thom_qd_basic_get_info(const imgtool_class *clas,
1640             UINT32 param,
16411641             union imgtoolinfo *info)
16421642{
16431643  switch ( param ) {
r1461r1462
16601660  }
16611661}
16621662
1663void thom_sap_basic_get_info(const imgtool_class *clas,
1664              UINT32 param,
1663void thom_sap_basic_get_info(const imgtool_class *clas,
1664              UINT32 param,
16651665              union imgtoolinfo *info)
16661666{
16671667  switch ( param ) {
16681668  case IMGTOOLINFO_STR_NAME:
16691669    strcpy( info->s = imgtool_temp_str(), "thom_sap" ); break;
16701670  case IMGTOOLINFO_STR_DESCRIPTION:
1671    strcpy( info->s = imgtool_temp_str(),
1671    strcpy( info->s = imgtool_temp_str(),
16721672       "Thomson .sap disk image, BASIC format" );
16731673    break;
16741674  case IMGTOOLINFO_STR_FILE_EXTENSIONS:
src/mess/tools/imgtool/modules/crt.c
r1461r1462
66#include "imgtoolx.h"
77
88#ifdef LSB_FIRST
9typedef struct {
9typedef struct {
1010   unsigned char high, low;
1111} biguword;
1212typedef struct {
r1461r1462
37370019 UBYTE Game line
3838001A UBYTE[6] For future use...
39390020 UBYTE[20] Name (null-terminated string)
400040 Chip Packets
400040 Chip Packets
4141...
4242
4343Chip Packets:
r1461r1462
100100
101101$8080:
102102
103 
104103
104
105105EXAMPLE FOR KCS POWER CARTRIDGE
106106
107107$0000: 'C64 CARTRIDGE   '
r1461r1462
119119
120120$4060:
121121
122 
123122
123
124124EXAMPLE FOR FINAL CARTRIDGE III
125125
126126$0000: 'C64 CARTRIDGE   '
r1461r1462
146146
147147$10080:
148148
149 
150149
150
151151EXAMPLE FOR SIMONS BASIC
152152
153153$0000: 'C64 CARTRIDGE   '
r1461r1462
165165
166166$4060:
167167
168 
169168
169
170170EXAMPLE FOR OCEAN TYPE1
171171
172172$0000: 'C64 CARTRIDGE   '
r1461r1462
192192...
193193$40240:
194194
195 
196195
196
197197EXAMPLE FOR FUN PLAY TYPE
198198
199199$0000: 'C64 CARTRIDGE '
r1461r1462
220220
221221$20140:
222222
223 
224223
224
225225EXAMPLE FOR SUPER GAMES TYPE
226226
227227$0000: 'C64 CARTRIDGE '
r1461r1462
247247
248248$10080:
249249
250 
251250
251
252252EXAMPLE FOR ATOMIC POWER CARTRIDGE
253253
254254$0000: 'C64 CARTRIDGE   '
r1461r1462
274274
275275$8080:
276276
277 
278277
278
279279EXAMPLE FOR EPYX FASTLOAD TYPE
280280
281281$0000: 'C64 CARTRIDGE '
r1461r1462
289289
290290$2050:
291291
292 
293292
293
294294EXAMPLE FOR WESTERMANN TYPE
295295
296296$0000: 'C64 CARTRIDGE '
r1461r1462
304304
305305$4050:
306306*/
307
307
308308static const char *const hardware_types[]={
309309   "Normal cartridge",
310310   "Action Replay",
r1461r1462
327327   unsigned char exrom_line;
328328   unsigned char game_line;
329329   unsigned char reserved[6];
330   char name[0x20];
330   char name[0x20];
331331} crt_header;
332   
332
333333static const char *const chip_types[]={ "ROM", "RAM", "FLASH" };
334334typedef struct {
335335   char id[4]; // CHIP
r1461r1462
495495   crt_iterator *iter=(crt_iterator*)enumeration;
496496
497497   ent->corrupt=0;
498   
498
499499   if (!(ent->eof=(iter->pos>=iter->image->size))) {
500500      sprintf(ent->fname,"%d", iter->number);
501501      ent->filesize=GET_UWORD( PACKET(iter->image, iter->pos)->length );
r1461r1462
555555   int size;
556556   int pos;
557557
558   if (!(pos=crt_image_findfile(image, fname)) )
558   if (!(pos=crt_image_findfile(image, fname)) )
559559      return IMGTOOLERR_MODULENOTFOUND;
560560
561561   size=GET_UWORD( PACKET(image, pos)->length );
r1461r1462
566566   return 0;
567567}
568568
569static int crt_image_writefile(imgtool_image *img, const char *fname, imgtool_stream *sourcef,
569static int crt_image_writefile(imgtool_image *img, const char *fname, imgtool_stream *sourcef,
570570                        const ResolvedOption *_options)
571571{
572572   crt_image *image=(crt_image*)img;
r1461r1462
586586      if (!(image->data=realloc(image->data, image->size+size+sizeof(crt_packet)-oldsize) ) )
587587         return IMGTOOLERR_OUTOFMEMORY;
588588      if (image->size-pos-oldsize!=0) {
589         memmove(image->data+pos+size+sizeof(crt_packet), image->data+pos+oldsize,
589         memmove(image->data+pos+size+sizeof(crt_packet), image->data+pos+oldsize,
590590               image->size-pos-oldsize);
591591      }
592592      image->size+=size+sizeof(crt_packet)-oldsize;
r1461r1462
634634   header.game_line=_options[C64CRT_CREATEOPTION_GAMELINE].i;
635635   header.exrom_line=_options[C64CRT_CREATEOPTION_EXROMLINE].i;
636636   if (_options[C64CRT_CREATEOPTION_LABEL].s) strcpy(header.name, _options[C64CRT_CREATEOPTION_LABEL].s);
637   return (stream_write(f, &header, sizeof(crt_header)) == sizeof(crt_header))
637   return (stream_write(f, &header, sizeof(crt_header)) == sizeof(crt_header))
638638      ? 0 : IMGTOOLERR_WRITEERROR;
639639}
640640
src/mess/tools/imgtool/modules/ti85.c
r1461r1462
319319
320320   for (i = 0; i < file->number_of_entries; i++)
321321      if (!strnicmp(fname, (char *) file->data+file->entries[i].offset+0x06, file->entries[i].name_size) )
322         return i;     
322         return i;
323323
324324   return -1;
325325}
r1461r1462
386386
387387   if (stream_read(sourcef, file->data+offset+head_size+0x04, data_size)!=data_size)
388388      return IMGTOOLERR_READERROR;
389   
389
390390   file->data[file->size-2] = ti85_calculate_checksum(file->data+TI85_HEADER_SIZE, file->size-2-TI85_HEADER_SIZE)&0x00ff;
391391   file->data[file->size-1] = (ti85_calculate_checksum(file->data+TI85_HEADER_SIZE, file->size-2-TI85_HEADER_SIZE)&0xff00)>>8;
392392
r1461r1462
434434   char checksum[] = {0x00, 0x00};
435435
436436   strncpy(header.comment, options_[TI85_OPTION_COMMENT].s,0x2a);
437   if (stream_write(f, &header, sizeof(ti85_header)) != sizeof(ti85_header))
437   if (stream_write(f, &header, sizeof(ti85_header)) != sizeof(ti85_header))
438438      return  IMGTOOLERR_WRITEERROR;
439   if (stream_write(f, &checksum, 2) != 2)
439   if (stream_write(f, &checksum, 2) != 2)
440440      return  IMGTOOLERR_WRITEERROR;
441441
442442   return 0;
r1461r1462
545545            break;
546546      }
547547
548     
548
549549      ent->corrupt=0;
550550      iter->index++;
551551   }
src/mess/tools/imgtool/modules/macbin.c
r1461r1462
3434    120       2  [II]  Secondary Header Length
3535    122       1  [II]  MacBinary II Version Number (II: 0x81, III: 0x82)
3636    123       1  [II]  Minimum Compatible MacBinary II Version Number (0x81)
37    124       2  [II]  CRC of previous 124 bytes 
38   
37    124       2  [II]  CRC of previous 124 bytes
38
3939   For more information, consult http://www.lazerware.com/formats/macbinary.html
4040
4141   TODO: I believe that the script code is some sort of identifier identifying
r1461r1462
154154   place_integer_be(header, 124, 2, ccitt_crc16(0, header, 124));
155155
156156   stream_write(destf, header, sizeof(header));
157   
157
158158   if (data_fork)
159159   {
160160      err = imgtool_partition_read_file(partition, filename, "", destf, NULL);
r1461r1462
163163
164164      stream_fill(destf, 0, pad128(data_fork->size));
165165   }
166   
166
167167   if (resource_fork)
168168   {
169169      err = imgtool_partition_read_file(partition, filename, "RESOURCE_FORK", destf, NULL);
src/mess/tools/imgtool/modules/ti990hd.c
r1461r1462
3535#define MAX_SAFE_PATH_LEN 39
3636
3737#define MAX_DIR_LEVEL 25   /* We need to put a recursion limit to avoid endless recursion hazard */
38 
3938
39
4040typedef struct UINT16BE
4141{
4242   UINT8 bytes[2];
r1461r1462
317317#if 0
318318
319319/*
320   tifile header: stand-alone file
320   tifile header: stand-alone file
321321*/
322322typedef struct tifile_header
323323{
r1461r1462
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{
src/mess/tools/imgtool/modules/lynx.c
r1461r1462
191191   strncpy(name_with_null, HEADER(image)->description, 24);
192192   sprintf(string,"%s\n%s\nversion:%.4x max entries:%d",
193193         dostext_with_null,
194         name_with_null,
194         name_with_null,
195195         GET_UWORD(HEADER(image)->version),
196196         HEADER(image)->max_entries);
197197}
r1461r1462
216216{
217217   lynx_iterator *iter=(lynx_iterator*)enumeration;
218218   ent->corrupt=0;
219   
219
220220   ent->eof=iter->index>=iter->image->count;
221221   if (!ent->eof) {
222222      strcpy(ent->fname, iter->image->entries[iter->index].name);
r1461r1462
226226         case 'S': strcpy(ent->attr,"SEQ");break;
227227         case 'R': strcpy(ent->attr,"REL");break;
228228         case 'U': strcpy(ent->attr,"USR");break;
229         default:
229         default:
230230            sprintf(ent->attr,"type:%c",
231231                  iter->image->entries[iter->index].filetype );
232232         }
src/mess/tools/imgtool/modules/nccard.c
r1461r1462
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.
50   
49   Blocks are fixed at 256 bytes in size.
50
5151   Block 0 and Block 1 are reserved for a boot program.
5252
5353   Block 2 is reserved for root directory.
r1461r1462
6666   another number (other than 0x0ffff and 0x0fffe), this is the next
6767   block used by the file. If the number is 0x0ffff this means this
6868   block is the last used by the file.
69   
69
7070   0x0fffe indicates a reserved block.
7171
7272   The maximum supported PCMCIA Ram card size is 1mb, and there are
7373   4096 256-byte blocks on each card. Therefore a FAT entry uses 12-bits
7474   to store the block index, leaving the top 4-bits as a status??
75   
75
7676   Maximum size of a file on the PCMCIA Ram card is 65536 bytes.
7777*/
7878struct nc_card_dir_entry
r1461r1462
218218         {
219219            return offset;
220220         }
221     
221
222222         offset+=32;
223223      }
224224
225225      previous_block = current_block;
226226      current_block = memcard_fat_get_next_block(memcard,current_block);
227     
227
228228      if (current_block!=NC_FAT_END_OF_LIST)
229229      {
230230         current_block &= 0x0fff;
r1461r1462
353353               return offset;
354354            }
355355         }
356     
356
357357         offset+=32;
358358      }
359359
360360      current_block = memcard_fat_get_next_block(memcard,current_block);
361     
361
362362      if (current_block!=NC_FAT_END_OF_LIST)
363363      {
364364         current_block = current_block & 0x0fff;
r1461r1462
386386      while (current_block!=0)
387387      {
388388         int next_block;
389     
389
390390         /* get next block in list */
391391         next_block = memcard_fat_get_next_block(memcard,current_block);
392392         /* zero out this block */
393393         memcard_fat_write(memcard,current_block,0);
394         
394
395395         /* go to next block */
396396         current_block = next_block;
397397
r1461r1462
488488   int code;
489489
490490   struct nc_memcard memcard;
491   
491
492492   /* allocate a big chunk of memory for memcard data - max size will be 1mb! */
493493   if (!memcard_init(&memcard, 1024*1024))
494494   {
r1461r1462
546546
547547   if (memcard_del(&nc_card->memcard,nc_filename))
548548   {
549      return IMGTOOLERR_MODULENOTFOUND;     
549      return IMGTOOLERR_MODULENOTFOUND;
550550   }
551551
552552   return 0;
r1461r1462
560560   struct nc_card_image *nc_card = (struct nc_card_image *)img;
561561   char nc_filename[12];
562562   unsigned long dir_entry_offset;
563   
563
564564   setup_nc_filename(nc_filename, fname);
565565
566566   dir_entry_offset = memcard_locate_dir_entry(&nc_card->memcard,(char *)nc_filename);
r1461r1462
575575
576576      /* get size of file from directory entry */
577577      length_remaining = ((dir_entry->size_high_byte & 0x0ff)<<8) | (dir_entry->size_low_byte & 0x0ff);
578   
578
579579      /* get first block index from directory entry */
580580      current_block = ((dir_entry->first_block_high & 0x0f)<<8) | dir_entry->first_block_low;
581581
r1461r1462
587587
588588         /* get offset of block data in memcard data */
589589         block_offset = memcard_block_to_offset(current_block);
590     
590
591591         /* calc amount of data to copy from block */
592592         if (length_remaining<NC_BLOCK_SIZE)
593593         {
r1461r1462
601601         /* output to file */
602602         if (stream_write(destf, &nc_card->memcard.memcard_data[block_offset], copy_length)!=copy_length)
603603            return IMGTOOLERR_WRITEERROR;
604     
604
605605         /* update length of data remaining to write */
606         length_remaining -=copy_length;   
606         length_remaining -=copy_length;
607607
608608         /* get next block in list */
609609         current_block = memcard_fat_get_next_block(&nc_card->memcard,current_block);
610         
610
611611         if (current_block!=NC_FAT_END_OF_LIST)
612612         {
613613            current_block &= 0x0fff;
r1461r1462
671671         dir_entry->first_block_low = (current_block & 0x0ff);
672672         /* setup filename */
673673         strncpy((char *)dir_entry->filename,(char *)nc_filename, 12);
674         
674
675675         while (length_remaining!=0)
676676         {
677677            /* get offset of block data */
678678            block_offset = memcard_block_to_offset(current_block);
679         
679
680680            /* calc amount of data to copy to block */
681681            if (length_remaining<NC_BLOCK_SIZE)
682682            {
r1461r1462
691691            if (stream_read(sourcef, &nc_card->memcard.memcard_data[block_offset], copy_length)!=copy_length)
692692               return IMGTOOLERR_WRITEERROR;
693693
694            length_remaining -=copy_length;   
694            length_remaining -=copy_length;
695695            file_offset+=copy_length;
696696
697697            /* mark block as used */
r1461r1462
699699
700700            previous_block = current_block;
701701            current_block = memcard_fat_get_free_block(&nc_card->memcard);
702     
702
703703            if (current_block==-1)
704704               break;
705         
705
706706            /* link up block chain */
707707            memcard_fat_write(&nc_card->memcard,previous_block, current_block|0x02000);
708708         }
709     
709
710710         /* end block chain */
711711         memcard_fat_write(&nc_card->memcard,current_block, NC_FAT_END_OF_LIST);
712712      }
r1461r1462
716716   return 0;
717717}
718718
719/* directory fills 1 or more blocks.
719/* directory fills 1 or more blocks.
720720current_block holds index of current block we are accessing,
721721offset_in_block holds offset within block referenced by current_block.
722722eod is 1 if end of directory (no more blocks) or 0 if not end of directory */
723723
724struct nc_card_direnum
724struct nc_card_direnum
725725{
726726   imgtool_directory base;
727727   /* card image */
r1461r1462
743743   if (memcard_is_executable(&nc_card->memcard))
744744   {
745745      return IMGTOOLERR_MODULENOTFOUND;
746   }   
746   }
747747
748748   card_enum = (struct nc_card_direnum *) malloc(sizeof(struct nc_card_direnum));
749749   if (!card_enum)
r1461r1462
792792
793793               /* no more directory blocks, end of directory reached */
794794               card_enum->eod = 1;
795     
795
796796               /* no more blocks - so quit */
797797               quit = 1;
798798            }
r1461r1462
810810            dir_entry = (struct nc_card_dir_entry *)&card_enum->img->memcard.memcard_data[dir_block_offset + card_enum->offset_in_block];
811811
812812            if (dir_entry->filename[0]!=0)
813            {   
813            {
814814               /* got a used directory entry */
815815
816816               if (ent->fname_len<13)
r1461r1462
828828               ent->corrupt = 0;
829829
830830               if (ent->attr_len)
831               {   
831               {
832832                  switch (dir_entry->type)
833833                  {
834834                     case 0:
src/mess/tools/imgtool/modules/d64.c
r1461r1462
1111#define GET_UWORD(a) a
1212#define SET_UWORD(a,v) a=v
1313#else
14typedef struct {
14typedef struct {
1515   unsigned char low, high;
1616} littleuword;
1717#define GET_UWORD(a) (a.low|(a.high<<8))
r1461r1462
7878   unsigned char unused2[0x2d]; // zer0
7979} D71_HEADER;
8080
81static const D64_HEADER d64_header={
82   18,1,'A',
81static const D64_HEADER d64_header={
82   18,1,'A',
8383   0, // 1571 0x80
8484   { { 0 } },
8585   { '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0',
86     '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0' },
86     '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0' },
8787   { 0xa0, 0xa0 }, { 0xa0, 0xa0 } , 0xa0, { '2', 'A' } , { '\xa0','\xa0','\xa0','\xa0' },
8888};
8989
r1461r1462
117117   unsigned char unused1[227]; // zero
118118} D81_HEADER;
119119
120static const D81_HEADER d81_header={
121   40,3,'D',
120static const D81_HEADER d81_header={
121   40,3,'D',
122122   0,
123123   { '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0',
124     '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0', 0xa0, 0xa0 },
124     '\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0','\xa0', 0xa0, 0xa0 },
125125   { 0xa0, 0xa0 } , 0xa0, { '3', 'D' } , { '\xa0','\xa0' },
126126};
127127
r1461r1462
352352   D81_BAM *bam[2];
353353   bam[0] = (D81_BAM*) (image->data + image->get_offset(image->directory.track, image->directory.sector+1)),
354354   bam[1] = (D81_BAM*) (image->data + image->get_offset(image->directory.track, image->directory.sector+1));
355   
355
356356   /* this contains the tracks for the search strategy for free sectors */
357357   for (i=0,j=image->directory.track-1; j>0; i++,j--) tracks[i]=j;
358358   for (j=image->directory.track+1;j<80;i++,j++) tracks[i]=j;
r1461r1462
396396          +image->get_offset(image->directory.track,
397397                        image->directory.sector+2));
398398   }
399   
399
400400   bam->bam[track-1].free++;
401401   bam->bam[track-1].map[i]|=mask;
402402}
r1461r1462
479479{
480480   int size = 0;
481481   int i=image->get_offset(entry->track, entry->sector);
482   
482
483483   while (image->data[i] != 0)
484484   {
485485      size += 254;
r1461r1462
848848
849849   ent->corrupt=0;
850850   ent->eof=0;
851   
851
852852   while ((iter->track >= 1) && (iter->track <= iter->image->tracks)) //safer
853853//   while (iter->track != 0)
854854   {
r1461r1462
959959   while (image->data[pos]!=0) {
960960      if (stream_write(destf, image->data+pos+2, 254)!=254)
961961         return IMGTOOLERR_WRITEERROR;
962     
962
963963      pos = image->get_offset (image->data[pos + 0], image->data[pos + 1]);
964964   }
965965   if (image->data[pos+1]-1>0) {
r1461r1462
983983
984984   if ((entry=d64_image_findfile(image, (const unsigned char *)fname))!=NULL ) {
985985      /* overriding */
986      if ((freespace + GET_UWORD(entry->blocks))*254<fsize)
986      if ((freespace + GET_UWORD(entry->blocks))*254<fsize)
987987         return IMGTOOLERR_NOSPACE;
988988      track=entry->track;
989989      sector=entry->sector;
990     
990
991991      while (track!=0) {
992992         image->free_sector(image, track, sector);
993993         pos = image->get_offset(track, sector);
r1461r1462
10051005   memcpy(entry->name, fname, strlen(fname));
10061006
10071007   image->alloc_sector(image, &track, &sector);
1008   entry->track=track;
1008   entry->track=track;
10091009   entry->sector=sector;
10101010   pos = image->get_offset(track, sector);
10111011
r1461r1462
10131013   {
10141014      if (stream_read(sourcef, image->data+pos+2, 254)!=254)
10151015         return IMGTOOLERR_READERROR;
1016     
1016
10171017      image->alloc_sector(image, &track, &sector);
1018      image->data[pos]=track;
1018      image->data[pos]=track;
10191019      image->data[pos+1]=sector;
10201020      pos = image->get_offset (track, sector);
10211021   }
r1461r1462
10271027         return IMGTOOLERR_READERROR;
10281028   }
10291029   image->data[pos+2+fsize-i]=0;
1030   
1030
10311031   SET_UWORD(entry->blocks, b);
10321032   image->modified=1;
10331033
r1461r1462
10991099            }
11001100            //d64_header.name=0xa0;
11011101            //d64_header.id=0xa0;
1102            if (stream_write(f, &d64_header, sizeof(d64_header)) != sizeof(d64_header))
1102            if (stream_write(f, &d64_header, sizeof(d64_header)) != sizeof(d64_header))
11031103               return  IMGTOOLERR_WRITEERROR;
11041104         } else {
1105            if (stream_write(f, &sector, sizeof(sector)) != sizeof(sector))
1105            if (stream_write(f, &sector, sizeof(sector)) != sizeof(sector))
11061106               return  IMGTOOLERR_WRITEERROR;
11071107         }
11081108      }
11091109   }
11101110   if (crc) {
11111111      for (t=1; t<=tracks; t++) {
1112         if (stream_write(f, &d64_header, d64_sectors_per_track[t-1])
1113            != d64_sectors_per_track[t-1])
1112         if (stream_write(f, &d64_header, d64_sectors_per_track[t-1])
1113            != d64_sectors_per_track[t-1])
11141114            return  IMGTOOLERR_WRITEERROR;
11151115         }
11161116   }
r1461r1462
11191119
11201120static int x64_image_create(const imgtool_module *mod, imgtool_stream *f, const ResolvedOption *options_)
11211121{
1122   struct {
1122   struct {
11231123      unsigned char data[0x40];
1124   } x64_header={
1124   } x64_header={
11251125      { 0x43, 0x15, 0x41, 0x64,
1126        0x01, 0x02, 0x01, 0x23,
1126        0x01, 0x02, 0x01, 0x23,
11271127        0x01
11281128      }
11291129   };
1130   if (stream_write(f, &x64_header, sizeof(x64_header)) != sizeof(x64_header))
1130   if (stream_write(f, &x64_header, sizeof(x64_header)) != sizeof(x64_header))
11311131      return  IMGTOOLERR_WRITEERROR;
11321132
11331133   d64_image_create(mod, f, options_);
r1461r1462
11671167            }
11681168            //d64_header.name=0xa0;
11691169            //d64_header.id=0xa0;
1170            if (stream_write(f, &d64_header, sizeof(d64_header)) != sizeof(d64_header))
1170            if (stream_write(f, &d64_header, sizeof(d64_header)) != sizeof(d64_header))
11711171               return  IMGTOOLERR_WRITEERROR;
11721172         } else if ((t==35+18)&&(s==0)) {
11731173            for (i=36;i<=70;i++) {
r1461r1462
11861186                  d71_header.bam2[i-36].map2[2]=0;
11871187               }
11881188            }
1189            if (stream_write(f, &d71_header, sizeof(d71_header))
1190               != sizeof(d71_header))
1189            if (stream_write(f, &d71_header, sizeof(d71_header))
1190               != sizeof(d71_header))
11911191               return  IMGTOOLERR_WRITEERROR;
11921192         } else {
1193            if (stream_write(f, &sector, sizeof(sector)) != sizeof(sector))
1193            if (stream_write(f, &sector, sizeof(sector)) != sizeof(sector))
11941194               return  IMGTOOLERR_WRITEERROR;
11951195         }
11961196      }
r1461r1462
12101210            //d81_header.name=0xa0;
12111211            d81_header.id[0]=id[0];
12121212            d81_header.id[0]=id[1];
1213            if (stream_write(f, &d81_header, sizeof(d81_header)) != sizeof(d81_header))
1213            if (stream_write(f, &d81_header, sizeof(d81_header)) != sizeof(d81_header))
12141214               return  IMGTOOLERR_WRITEERROR;
12151215         } else if ((t==40)&&(s==1)){
12161216            d81_bam.id[0]=id[0];
r1461r1462
12251225            }
12261226            d81_bam.bam[40-1].free=36;
12271227            d81_bam.bam[40-1].map[0]=0xf0;
1228            if (stream_write(f, &d81_bam, sizeof(d81_bam)) != sizeof(d81_bam))
1228            if (stream_write(f, &d81_bam, sizeof(d81_bam)) != sizeof(d81_bam))
12291229               return  IMGTOOLERR_WRITEERROR;
12301230            d81_bam.bam[40-1].free=40;
12311231            d81_bam.bam[40-1].map[0]=0xff;
12321232         } else if ((t==40)&&(s==2)){
12331233            d81_bam.track=0;
1234            if (stream_write(f, &d81_bam, sizeof(d81_bam)) != sizeof(d81_bam))
1234            if (stream_write(f, &d81_bam, sizeof(d81_bam)) != sizeof(d81_bam))
12351235               return  IMGTOOLERR_WRITEERROR;
12361236         } else {
1237            if (stream_write(f, &sector, sizeof(sector)) != sizeof(sector))
1237            if (stream_write(f, &sector, sizeof(sector)) != sizeof(sector))
12381238               return  IMGTOOLERR_WRITEERROR;
12391239         }
12401240      }
src/mess/tools/imgtool/modules/mac.c
r1461r1462
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{
src/mess/tools/imgtool/modules/vmsx_tap.c
r1461r1462
1/*
1/*
22    vMSX tap format
33
44    Virtual MSX 1.x (being replaced by the MSX driver in mess) had
55    it's on format for cassette recordings. The format is similar
66    to .cas files; however several recordings could be stored in
7    one file.
7    one file.
88
99    Virtual MSX was never really popular; I haven't seen any of these
1010    files on the internet. However for completeness sake I've added
1111    this converter. It's read only; the MSX driver cannot read
1212    these files, but can read the .cas files (like most other MSX
13    emulators). Further use and specially distribution of the .tap files
13    emulators). Further use and specially distribution of the .tap files
1414    is discouraged as Virtual MSX is obsolete (along with its private
1515    file formats).
1616
r1461r1462
2121   Original code in Virtual MSX:
2222
2323      ftp://ftp.komkon.org/pub/EMUL8/MSX/Emulators/VMSX1SRC.zip
24   
24
2525   It's in the file TAPE.C.
2626
2727   RIFF format specs:
r1461r1462
3434    dir - list all the files in the archive as "%title%-%type%.cas"
3535    getall - writes all the files to disk
3636    get - gets one file. If "getall" fails, due to characters in the
37          filename your FS/OS doesn't support, use:
37          filename your FS/OS doesn't support, use:
3838
3939   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"
r1461r1462
154154         }
155155
156156      return 0;
157      }   
157      }
158158
159159   return IMGTOOLERR_MODULENOTFOUND;
160160   }
r1461r1462
198198
199199   /* OK we've got the right data chunk. Now we can start looking for
200200      the blocks */
201   pos = 0;
201   pos = 0;
202202   while ( (pos + 8) < size)
203203      {
204204      offset = *((UINT32*)(pmem + pos + 4));
r1461r1462
221221         tappos += 4;
222222         tapblock = LITTLE_ENDIANIZE_INT32 (tapblock);
223223         if (tapblock == 0xffffffff) break;
224         memcpy (p + caspos, CasHeader, 8);
224         memcpy (p + caspos, CasHeader, 8);
225225         caspos += 8;
226         memcpy (p + caspos, pmem + pos + tappos, tapblock);
226         memcpy (p + caspos, pmem + pos + tappos, tapblock);
227227         caspos += tapblock;
228228         tappos += tapblock;
229229         }
r1461r1462
231231
232232      *psize = caspos;
233233      *pcas = p;
234   
234
235235      return 0;
236236      }
237237
r1461r1462
261261      return IMGTOOLERR_OUTOFMEMORY;
262262   }
263263
264   if (stream_read(f, image->data, image->size)!=image->size)
264   if (stream_read(f, image->data, image->size)!=image->size)
265265   {
266266      free(image);
267267      *outimg=NULL;
268268      return IMGTOOLERR_READERROR;
269269   }
270270
271   if ( (rc=vmsx_tap_read_image(image)) )   
271   if ( (rc=vmsx_tap_read_image(image)) )
272272   {
273273      if (image->entries) free(image->entries);
274274      free(image);
r1461r1462
309309   TAP_ITERATOR *iter=(TAP_ITERATOR*)enumeration;
310310   unsigned char *p;
311311   int size, rc;
312   
312
313313   ent->eof=iter->index>=iter->image->count;
314   if (!ent->eof)
314   if (!ent->eof)
315315      {
316      sprintf (ent->fname, "%s-%s.cas",
316      sprintf (ent->fname, "%s-%s.cas",
317317         iter->image->entries[iter->index].title,
318318         iter->image->entries[iter->index].type);
319319      size = 0;
320320      p = NULL;
321      rc = vmsx_tap_image_read_data (iter->image,
322         iter->image->entries[iter->index].chunk, &p, &size);
321      rc = vmsx_tap_image_read_data (iter->image,
322         iter->image->entries[iter->index].chunk, &p, &size);
323323
324324      ent->corrupt=rc;
325325      if (!rc) ent->filesize = size;
r1461r1462
343343
344344   for (i=0; i<image->count; i++)
345345      {
346      sprintf (filename, "%s-%s.cas",
346      sprintf (filename, "%s-%s.cas",
347347         image->entries[i].title, image->entries[i].type);
348348      if (!strcmp(fname, filename) ) return image->entries+i;
349349      }
r1461r1462
357357   unsigned char* p;
358358   int size, rc;
359359
360   if ((entry=vmsx_tap_image_findfile(image, fname))==NULL )
360   if ((entry=vmsx_tap_image_findfile(image, fname))==NULL )
361361      return IMGTOOLERR_MODULENOTFOUND;
362362
363363   rc = vmsx_tap_image_read_data (image, entry->chunk, &p, &size);
src/mess/tools/imgtool/modules/vzdos.c
r1461r1462
7373{
7474   int len;
7575
76   for (len = 7; len > 0; len--)         
76   for (len = 7; len > 0; len--)
7777      if (fname[len] != 0x20)
7878         break;
79   
80   return len;   
79
80   return len;
8181}
8282
8383/* calculate checksum-16 of buffer */
r1461r1462
8585{
8686   int i;
8787   UINT16 sum = 0;
88   
88
8989   for (i = 0; i < len; i++)
90      sum += buffer[i];   
91   
90      sum += buffer[i];
91
9292   return sum;
9393}
9494
r1461r1462
100100
101101   ret = floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], 0, &buffer, sizeof(buffer));
102102   if (ret) return ret;
103     
103
104104   /* search for start of data */
105105   if (memcmp(buffer + 19, "\xC3\x18\xE7\xFE", 4) == 0)
106106      *start = 23;
r1461r1462
131131      return IMGTOOLERR_CORRUPTFILE;
132132
133133   memcpy(data, &buffer, DATA_SIZE + 2);
134   
134
135135   return IMGTOOLERR_SUCCESS;
136136}
137137
r1461r1462
146146
147147   memcpy(buffer, data, DATA_SIZE + 2);
148148   place_integer_le(buffer, DATA_SIZE + 2, 2, chksum16(data, DATA_SIZE + 2));
149   
149
150150   ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], data_start, buffer, sizeof(buffer));
151151   if (ret) return ret;
152   
152
153153   return IMGTOOLERR_SUCCESS;
154154}
155155
r1461r1462
157157static imgtoolerr_t vzdos_clear_sector(imgtool_image *img, int track, int sector)
158158{
159159   UINT8 data[DATA_SIZE + 2];
160   
160
161161   memset(data, 0x00, sizeof(data));
162   
163   return vzdos_write_sector_data(img, track, sector, data);   
162
163   return vzdos_write_sector_data(img, track, sector, data);
164164}
165165
166166/* return a directory entry for an index */
r1461r1462
171171
172172   ret = vzdos_read_sector_data(img, 0, (int) index / 8, buffer);
173173   if (ret) return ret;
174   
174
175175   entry = ((index % 8) * sizeof(vzdos_dirent));
176176
177177   memcpy(ent, &buffer[entry], 10);
r1461r1462
186186   /* check values */
187187   if (ent->start_track > 39)
188188      return IMGTOOLERR_CORRUPTIMAGE;
189     
189
190190   if (ent->start_sector > 15)
191191      return IMGTOOLERR_CORRUPTIMAGE;
192192
r1461r1462
210210   place_integer_le(buffer, entry + 11, 1, ent.start_sector);
211211   place_integer_le(buffer, entry + 12, 2, ent.start_address);
212212   place_integer_le(buffer, entry + 14, 2, ent.end_address);
213   
213
214214   /* save new sector */
215215   ret = vzdos_write_sector_data(img, 0, (int) index / 8, buffer);
216216   if (ret) return ret;
217   
218   return IMGTOOLERR_SUCCESS;   
217
218   return IMGTOOLERR_SUCCESS;
219219}
220220
221221/* clear a directory entry */
r1461r1462
228228
229229   ret = vzdos_set_dirent(img, index, entry);
230230   if (ret) return ret;
231     
231
232232   return IMGTOOLERR_SUCCESS;
233233}
234234
r1461r1462
241241   /* check for invalid filenames */
242242   if (strlen(fname) > 8)
243243      return IMGTOOLERR_BADFILENAME;
244     
244
245245   /* TODO: check for invalid characters */
246   
246
247247   *entry = -1;
248     
248
249249   for (i = 0; i < MAX_DIRENTS; i++) {
250250
251251      ret = vzdos_get_dirent(image, i, &ent);
252252      if (ret) return ret;
253     
253
254254      len = vzdos_get_fname_len(ent.fname) + 1;
255255
256256      if (strlen(fname) != len)
257257         continue;
258     
258
259259      memset(filename, 0x00, sizeof(filename));
260260      memcpy(filename, ent.fname, len);
261261
r1461r1462
263263         *entry = i;
264264         break;
265265      }
266     
266
267267   }
268   
268
269269   if (*entry == -1)
270270      return IMGTOOLERR_FILENOTFOUND;
271271
272272   return IMGTOOLERR_SUCCESS;
273}
273}
274274
275275/* return a directory entry for a filename */
276276static imgtoolerr_t vzdos_get_dirent_fname(imgtool_image *img, const char *fname, vzdos_dirent *ent)
r1461r1462
279279
280280   ret = vzdos_searchentry(img, fname, &index);
281281   if (ret) return ret;
282   
282
283283   ret = vzdos_get_dirent(img, index, ent);
284   if (ret) return ret;   
285   
284   if (ret) return ret;
285
286286   return IMGTOOLERR_SUCCESS;
287287}
288288
r1461r1462
305305
306306   ret = vzdos_write_sector_data(img, 0, 15, buffer);
307307   if (ret) return ret;
308     
308
309309   return IMGTOOLERR_SUCCESS;
310310}
311311
r1461r1462
339339   else
340340      *used = 0;
341341
342   return IMGTOOLERR_SUCCESS;   
342   return IMGTOOLERR_SUCCESS;
343343}
344344
345345/* return the next free sector */
346346static imgtoolerr_t vzdos_free_trackmap(imgtool_image *img, int *track, int *sector)
347347{
348348   int ret, used = 0;
349   
349
350350   for (*track = 1; *track < 40; (*track)++) {
351351      for (*sector = 0; *sector < 16; (*sector)++) {
352352         ret = vzdos_get_trackmap(img, *track, *sector, &used);
353353         if (ret) return ret;
354354         if (!used) return IMGTOOLERR_SUCCESS;
355      }   
355      }
356356   }
357   
357
358358   return IMGTOOLERR_NOSPACE;
359359}
360360
r1461r1462
368368      0x18, 0xC3, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
369369      0x80, 0x80, 0x80, 0x00, 0xC3, 0x18, 0xE7, 0xFE
370370   };
371   
371
372372   memset(sector_data, 0x00, sizeof(sector_data));
373373
374374   sector_header[10] = (UINT8) track;         /* current track */
r1461r1462
406406   vz_iterator *iter = (vz_iterator *) imgtool_directory_extrabytes(enumeration);
407407
408408   if (iter->eof == 1 || iter->index > MAX_DIRENTS) {
409   
409
410410      ent->eof = 1;
411   
411
412412   } else {
413     
413
414414      const char *type;
415415      int ret, len;
416416      vzdos_dirent dirent;
417417
418418      ret = vzdos_get_dirent(imgtool_directory_image(enumeration), iter->index - 1, &dirent);
419     
419
420420      if (dirent.ftype == 0x00) {
421421         iter->eof = 1;
422422         ent->eof = 1;
423423         return IMGTOOLERR_SUCCESS;
424424      }
425     
425
426426      /* kill trailing spaces */
427      for (len = 7; len > 0; len--) {         
427      for (len = 7; len > 0; len--) {
428428         if (dirent.fname[len] != 0x20) {
429429            break;
430430         }
431431      }
432     
432
433433      memcpy(ent->filename, &dirent.fname, len + 1);
434434      ent->filesize = dirent.end_address - dirent.start_address;
435     
435
436436      switch (dirent.ftype) {
437437         case 'T': type = "Basic";      break;
438438         case 'B': type = "Binary";     break;
r1461r1462
444444         default: type = "Unknown";
445445      }
446446      snprintf(ent->attr, sizeof(ent->attr) / sizeof(ent->attr[0]), "%s", type);
447     
448      iter->index++;   
447
448      iter->index++;
449449   }
450   
450
451451   return IMGTOOLERR_SUCCESS;
452452}
453453
r1461r1462
483483   int filesize, track, sector;
484484   vzdos_dirent ent;
485485   UINT8 buffer[DATA_SIZE + 2];
486     
486
487487   ret = vzdos_get_dirent_fname(image, filename, &ent);
488488   if (ret) return ret;
489   
489
490490   filesize = ent.end_address - ent.start_address;
491491   track = ent.start_track;
492492   sector = ent.start_sector;
r1461r1462
501501      if ((track == pick_integer_le(buffer, DATA_SIZE, 1)) && (sector == pick_integer_le(buffer, DATA_SIZE + 1, 1)))
502502         return IMGTOOLERR_CORRUPTIMAGE;
503503
504      /* load next track and sector values */               
504      /* load next track and sector values */
505505      track  = pick_integer_le(buffer, DATA_SIZE, 1);
506506      sector = pick_integer_le(buffer, DATA_SIZE + 1, 1);
507     
507
508508      /* track 0 is invalid */
509509      if ((track == 0) && (filesize > DATA_SIZE))
510510         return IMGTOOLERR_CORRUPTIMAGE;
511     
511
512512      /* write either DATA_SIZE or the remaining bytes */
513513      towrite = filesize > DATA_SIZE ? DATA_SIZE : filesize;
514     
514
515515      if (stream_write(destf, buffer, towrite) != towrite)
516516         return IMGTOOLERR_WRITEERROR;
517517
518518      filesize -= DATA_SIZE;
519519   }
520     
520
521521   return IMGTOOLERR_SUCCESS;
522522}
523523
r1461r1462
565565      while ((ret = vzdos_get_dirent(img, index + 1, &next_entry)) != IMGTOOLERR_FILENOTFOUND) {
566566         if (ret) return ret;
567567         ret = vzdos_set_dirent(img, index++, next_entry);
568         if (ret) return ret;
568         if (ret) return ret;
569569      }
570570
571571      ret = vzdos_clear_dirent(img, index);
572572      if (ret) return ret;
573     
573
574574   }
575   
575
576576   /* clear sectors and trackmap entries */
577577   while (filesize > 0) {
578   
578
579579      filesize -= DATA_SIZE;
580   
580
581581      /* clear trackmap entry */
582582      ret = vzdos_clear_trackmap(img, track, sector);
583583      if (ret) return ret;
584584
585      /* load next track and sector values */               
585      /* load next track and sector values */
586586      next_track  = pick_integer_le(buffer, DATA_SIZE, 1);
587587      next_sector = pick_integer_le(buffer, DATA_SIZE + 1, 1);
588     
588
589589      /* overwrite sector with default values */
590590      ret = vzdos_clear_sector(img, track, sector);
591591      if (ret) return ret;
r1461r1462
597597      if (filesize > 0) {
598598         ret = floppy_read_sector(imgtool_floppy(img), 0, track, sector_order[sector], 24, &buffer, DATA_SIZE + 2);
599599         if (ret) return ret;
600      }     
601           
600      }
601
602602   }
603   
603
604604   return IMGTOOLERR_SUCCESS;
605605}
606606
r1461r1462
630630      /* another error occured, return it */
631631      return ret;
632632   }
633   
633
634634   ret = stream_seek(sourcef, offset, SEEK_SET);
635635   if (ret) return ret;
636636
r1461r1462
642642
643643   if (filesize > freespace)
644644      return IMGTOOLERR_NOSPACE;
645   
645
646646   /* get next free track and sector */
647647   ret = vzdos_free_trackmap(img, &track, &sector);
648648   if (ret) return ret;
r1461r1462
666666
667667   next_track  = 0;
668668   next_sector = 0;
669   
669
670670   /* write data to disk */
671671   while (filesize > 0) {
672   
672
673673      toread = filesize > DATA_SIZE ? DATA_SIZE : filesize;
674674      stream_read(sourcef, buffer, toread);
675675
676      filesize -= toread;   
676      filesize -= toread;
677677
678678      /* mark sector as used */
679679      ret = vzdos_set_trackmap(img, track, sector);
680680      if (ret) return ret;
681681
682682      /* get track and sector for next sector */
683      if (filesize > 0) {   
683      if (filesize > 0) {
684684         ret = vzdos_free_trackmap(img, &next_track, &next_sector);
685685         if (ret) return ret;
686686      } else {
r1461r1462
697697      track  = next_track;
698698      sector = next_sector;
699699   }
700     
700
701701   return IMGTOOLERR_SUCCESS;
702   
702
703703}
704704
705705/* create a new file or overwrite a file */
r1461r1462
712712   /* TODO: check for leading spaces and strip */
713713   if (strlen(filename) > 8 || strlen(filename) < 1)
714714      return IMGTOOLERR_BADFILENAME;
715     
715
716716   /* prepare directory entry */
717717   ftype = option_resolution_lookup_int(opts, 'T');
718718
r1461r1462
732732      default:
733733         break;
734734   }
735   
735
736736   entry.delimitor = ':';
737737   memset(&entry.fname, 0x20, 8); /* pad with spaces */
738   memcpy(&entry.fname, filename, strlen(filename));     
738   memcpy(&entry.fname, filename, strlen(filename));
739739
740740   /* write file to disk */
741741   ret = vzdos_writefile(partition, 0, sourcef, &entry);
742742   if (ret) return ret;
743   
743
744744   return IMGTOOLERR_SUCCESS;
745745}
746746
r1461r1462
749749   imgtoolerr_t ret;
750750   imgtool_image *image = imgtool_partition_image(partition);
751751   vzdos_dirent entry;
752   
752
753753   if (fname) {
754754
755755      ret = vzdos_get_dirent_fname(image, fname, &entry);
756756      if (ret) return ret;
757     
757
758758      switch (entry.ftype) {
759759         case 'B':
760760            suggestions[0].viability = SUGGESTION_RECOMMENDED;
r1461r1462
770770            suggestions[0].description = "VZ Snapshot";
771771            suggestions[1].viability = SUGGESTION_POSSIBLE;
772772            suggestions[1].filter = NULL;
773            suggestions[1].description = "Raw";           
773            suggestions[1].description = "Raw";
774774            suggestions[2].viability = SUGGESTION_POSSIBLE;
775775            suggestions[2].filter = filter_vzbas_getinfo;
776776            suggestions[2].description = "Tokenized Basic";
r1461r1462
778778         default:
779779            suggestions[0].viability = SUGGESTION_RECOMMENDED;
780780            suggestions[0].filter = NULL;
781            suggestions[0].description = "Raw";         
781            suggestions[0].description = "Raw";
782782      }
783     
784   } else {   
783
784   } else {
785785      suggestions[0].viability = SUGGESTION_RECOMMENDED;
786786      suggestions[0].filter = NULL;
787787      suggestions[0].description = "Raw";
r1461r1462
789789      suggestions[1].filter = filter_vzsnapshot_getinfo;
790790      suggestions[1].description = "VZ Snapshot";
791791   }
792     
792
793793   return IMGTOOLERR_SUCCESS;
794794}
795795
r1461r1462
804804         if (ret) return ret;
805805      }
806806   }
807   
807
808808   return IMGTOOLERR_SUCCESS;
809809}
810810
r1461r1462
818818   imgtool_image *image = imgtool_partition_image(partition);
819819   vzdos_dirent entry;
820820   UINT8 header[24];
821   
822   /* get directory entry from disk */   
821
822   /* get directory entry from disk */
823823   ret = vzdos_get_dirent_fname(image, filename, &entry);
824824   if (ret) return ret;
825825
r1461r1462
827827   header[0] = 'V';
828828   header[1] = 'Z';
829829   header[2] = 'F';
830   
830
831831   switch (entry.ftype) {
832832      case 'B':
833833         header[3] = '1';
r1461r1462
835835         break;
836836      case 'T':
837837         header[3] = '0';
838         header[21] = 0xF0;   
838         header[21] = 0xF0;
839839         break;
840840      default:
841841         memset(header, 0x00, 4);
842842         header[21] = 0x00;
843843   }
844     
844
845845   memset(header + 4, 0x00, 17);
846846   memcpy(header + 4, entry.fname, vzdos_get_fname_len(entry.fname) + 1);
847847   place_integer_le(header, 22, 2, entry.start_address);
r1461r1462
865865
866866   /* get header infos from file */
867867   stream_read(sourcef, header, sizeof(header));
868   
869   /* prepare directory entry */   
868
869   /* prepare directory entry */
870870   entry.ftype         = header[21] == 0xF1 ? 'B' : 'T';
871871   entry.delimitor     = ':';
872872   entry.start_address = pick_integer_le(header, 22, 2);
873   
873
874874   /* filename from header or directly? */
875875   fnameopt = option_resolution_lookup_int(opts, 'F');
876   
876
877877   if (fnameopt == 0) {
878      memcpy(&entry.fname, &header[4], 8);         
878      memcpy(&entry.fname, &header[4], 8);
879879   } else {
880880      /* TODO: check for leading spaces and strip */
881881      if (strlen(filename) > 8 || strlen(filename) < 1)
882882      return IMGTOOLERR_BADFILENAME;
883     
883
884884      memcpy(&entry.fname, filename, strlen(filename) - 3);
885885   }
886   
886
887887   /* write file to disk */
888888   ret = vzdos_writefile(partition, 24, sourcef, &entry);
889889   if (ret) return ret;
r1461r1462
920920OPTION_GUIDE_END
921921
922922/*
923T   Basic Editor File     
924B   Binary File     
925D   Sequential Access Program Data File     
926F   Quickwrite Document       
927A   Russell Harrison's Edit Ass. File     
928S   Dave Mitchell/Mark Hardwood Edit Ass. File  Start Addr A280H   
929S   Quickwrite/Diskops System File/Label       Except Above   
930W   Edit Ass. with Diskops File   Start           Addr A813H   
931W   E & F Word Pro with Patch 3.3 File           End Addr D000H   
932W   Russell Harrison Word Pro File              Except above two   
923T   Basic Editor File
924B   Binary File
925D   Sequential Access Program Data File
926F   Quickwrite Document
927A   Russell Harrison's Edit Ass. File
928S   Dave Mitchell/Mark Hardwood Edit Ass. File  Start Addr A280H
929S   Quickwrite/Diskops System File/Label       Except Above
930W   Edit Ass. with Diskops File   Start           Addr A813H
931W   E & F Word Pro with Patch 3.3 File           End Addr D000H
932W   Russell Harrison Word Pro File              Except above two
933933*/
934934
935935void vzdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info)
src/mess/tools/imgtool/modules/prodos.c
r1461r1462
304304   prodos_find_block_525(image, block, &track, &head, &sector1, &sector2);
305305
306306   /* read first sector */
307   ferr = floppy_read_sector(imgtool_floppy(image), head, track,
307   ferr = floppy_read_sector(imgtool_floppy(image), head, track,
308308      sector1, 0, ((UINT8 *) buffer) + 0, 256);
309309   if (ferr)
310310      return imgtool_floppy_error(ferr);
r1461r1462
329329   prodos_find_block_525(image, block, &track, &head, &sector1, &sector2);
330330
331331   /* read first sector */
332   ferr = floppy_write_sector(imgtool_floppy(image), head, track,
332   ferr = floppy_write_sector(imgtool_floppy(image), head, track,
333333      sector1, 0, ((const UINT8 *) buffer) + 0, 256);
334334   if (ferr)
335335      return imgtool_floppy_error(ferr);
r1461r1462
760760   {
761761      if (side)
762762         return NULL;
763     
763
764764      side = 0x100;
765765      subpos = 8;
766766   }
r1461r1462
11111111         !is_dir_storagetype(ent->storage_type))));
11121112
11131113      old_path = path;
1114      path += strlen(path) + 1;   
1114      path += strlen(path) + 1;
11151115      if (*path)
11161116      {
11171117         /* we have found part of the path; we are not finished yet */
r1461r1462
12431243   }
12441244
12451245   for (i = 0; i < 256; i++)
1246   {     
1246   {
12471247      sub_block_allocated = FALSE;
12481248
12491249      sub_block = buffer[i + 256];
r1461r1462
13911391      block <<= 8;
13921392      block |= buffer[0];
13931393      key_pointer = block;
1394   
1394
13951395      depth--;
13961396   }
13971397
r1461r1462
17291729
17301730   if (key_pointer != 0)
17311731   {
1732      err = prodos_read_file_tree(image, &ent.filesize[fork_num], key_pointer,
1732      err = prodos_read_file_tree(image, &ent.filesize[fork_num], key_pointer,
17331733         nest_level, destf);
17341734      if (err)
17351735         return err;
r1461r1462
21752175         if (err)
21762176            return err;
21772177         break;
2178     
2178
21792179      case 0x50:
21802180         /* extended ProDOS file */
21812181         chain[chain_pos].level = 0;
src/mess/tools/imgtool/modules/msx_dsk.c
r1461r1462
3535 */
3636
3737/*
38 * .dsk multidisks are used by fmsx-dos 1.6. These files are always double
38 * .dsk multidisks are used by fmsx-dos 1.6. These files are always double
3939 * sided 3.5" disks (720kB), simply appended to one another.
4040 */
4141
r1461r1462
4646
4747
4848typedef struct {
49   imgtool_image         base;
49   imgtool_image         base;
5050   char         *file_name;
5151   imgtool_stream          *file_handle;
5252   int          size, format, disks;
r1461r1462
178178    UINT8 header;
179179
180180   size = stream_size (f);
181   if (size < (360*1024) )
181   if (size < (360*1024) )
182182      return IMGTOOLERR_MODULENOTFOUND;
183   
183
184184   disks = 1;
185185
186186   correct = 0;
r1461r1462
188188   if (!strcmp(mod->name, "msx_img"))
189189   {
190190      format = FORMAT_IMG;
191      if (1 != stream_read (f, &header, 1) )
191      if (1 != stream_read (f, &header, 1) )
192192         return IMGTOOLERR_READERROR;
193193
194194      if ( (size == (720*1024+1) ) && (header == 2) )
r1461r1462
232232      assert(0);
233233      return IMGTOOLERR_UNEXPECTED;
234234   }
235   
235
236236   if (!correct) return IMGTOOLERR_MODULENOTFOUND;
237237
238238   image = (DSK_IMAGE*)malloc (sizeof (DSK_IMAGE) );
r1461r1462
267267   iter=*(DSK_ITERATOR**)outenum = (DSK_ITERATOR*) malloc(sizeof(DSK_ITERATOR));
268268   if (!iter) return IMGTOOLERR_OUTOFMEMORY;
269269
270   iter->base.module = image->base.module;
270   iter->base.module = image->base.module;
271271   iter->image=image;
272272   iter->index = 1;
273273
r1461r1462
314314   /*  check file name */
315315   switch (image->format)
316316      {
317      case FORMAT_IMG:
318      case FORMAT_DDI:
319      case FORMAT_MSX:
320         if (strcmpi (fname, "msx.dsk") )
317      case FORMAT_IMG:
318      case FORMAT_DDI:
319      case FORMAT_MSX:
320         if (strcmpi (fname, "msx.dsk") )
321321            return IMGTOOLERR_MODULENOTFOUND;
322322         break;
323323      case FORMAT_MULTI:
r1461r1462
359359            }
360360
361361         return 0;
362      case FORMAT_IMG:
363         offset = 1; i = (image->size / 0x1200);
362      case FORMAT_IMG:
363         offset = 1; i = (image->size / 0x1200);
364364         break;
365      case FORMAT_DDI:
366         offset = 0x1200; i = 160;
365      case FORMAT_DDI:
366         offset = 0x1200; i = 160;
367367         break;
368368      case FORMAT_MULTI:   /* multi disk */
369369         i = 160; offset = 720*1024 * (disks - 1);
src/mess/tools/imgtool/modules/fat.c
r1461r1462
7070     38       1  Signature
7171     39       4  ID
7272     43      11  Volume Label
73     54       8  FAT file system type
73     54       8  FAT file system type
7474     62     448  Boot machine code
7575    510       2  Magic bytes (0x55 0xAA)
7676
r1461r1462
119119     14      12  Name characters (six UTF-16LE chars)
120120     26       2  Entry Cluster (always 0x00)
121121     28       4  Name characters (two UTF-16LE chars)
122 
122
123123  Valid characters in DOS file names:
124124   - Upper case letters A-Z
125125   - Numbers 0-9
126126   - Space (though there is no way to identify a trailing space)
127   - ! # $ % & ( ) - @ ^ _ ` { } ~
127   - ! # $ % & ( ) - @ ^ _ ` { } ~
128128   - Characters 128-255 (though the code page is indeterminate)
129129
130130  For more information:
r1461r1462
230230/* boot sector code taken from FreeDOS */
231231static const UINT8 boot_sector_code[] =
232232{
233   0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xd8, 0xbd, 0x00, 0x7c, 0xb8, 0xe0, 0x1f,
234   0x8e, 0xc0, 0x89, 0xee, 0x89, 0xef, 0xb9, 0x00, 0x01, 0xf3, 0xa5, 0xea,
235   0x5e, 0x7c, 0xe0, 0x1f, 0x00, 0x00, 0x60, 0x00, 0x8e, 0xd8, 0x8e, 0xd0,
236   0x8d, 0x66, 0xa0, 0xfb, 0x80, 0x7e, 0x24, 0xff, 0x75, 0x03, 0x88, 0x56,
237   0x24, 0xc7, 0x46, 0xc0, 0x10, 0x00, 0xc7, 0x46, 0xc2, 0x01, 0x00, 0x8b,
238   0x76, 0x1c, 0x8b, 0x7e, 0x1e, 0x03, 0x76, 0x0e, 0x83, 0xd7, 0x00, 0x89,
239   0x76, 0xd2, 0x89, 0x7e, 0xd4, 0x8a, 0x46, 0x10, 0x98, 0xf7, 0x66, 0x16,
240   0x01, 0xc6, 0x11, 0xd7, 0x89, 0x76, 0xd6, 0x89, 0x7e, 0xd8, 0x8b, 0x5e,
241   0x0b, 0xb1, 0x05, 0xd3, 0xeb, 0x8b, 0x46, 0x11, 0x31, 0xd2, 0xf7, 0xf3,
242   0x89, 0x46, 0xd0, 0x01, 0xc6, 0x83, 0xd7, 0x00, 0x89, 0x76, 0xda, 0x89,
243   0x7e, 0xdc, 0x8b, 0x46, 0xd6, 0x8b, 0x56, 0xd8, 0x8b, 0x7e, 0xd0, 0xc4,
244   0x5e, 0x5a, 0xe8, 0xac, 0x00, 0xc4, 0x7e, 0x5a, 0xb9, 0x0b, 0x00, 0xbe,
245   0xf1, 0x7d, 0x57, 0xf3, 0xa6, 0x5f, 0x26, 0x8b, 0x45, 0x1a, 0x74, 0x0b,
246   0x83, 0xc7, 0x20, 0x26, 0x80, 0x3d, 0x00, 0x75, 0xe7, 0x72, 0x68, 0x50,
247   0xc4, 0x5e, 0x5a, 0x8b, 0x7e, 0x16, 0x8b, 0x46, 0xd2, 0x8b, 0x56, 0xd4,
248   0xe8, 0x7e, 0x00, 0x58, 0x1e, 0x07, 0x8e, 0x5e, 0x5c, 0xbf, 0x00, 0x20,
249   0xab, 0x89, 0xc6, 0x01, 0xf6, 0x01, 0xc6, 0xd1, 0xee, 0xad, 0x73, 0x04,
250   0xb1, 0x04, 0xd3, 0xe8, 0x80, 0xe4, 0x0f, 0x3d, 0xf8, 0x0f, 0x72, 0xe8,
251   0x31, 0xc0, 0xab, 0x0e, 0x1f, 0xc4, 0x5e, 0x5a, 0xbe, 0x00, 0x20, 0xad,
252   0x09, 0xc0, 0x75, 0x05, 0x88, 0xd3, 0xff, 0x6e, 0x5a, 0x48, 0x48, 0x8b,
253   0x7e, 0x0d, 0x81, 0xe7, 0xff, 0x00, 0xf7, 0xe7, 0x03, 0x46, 0xda, 0x13,
254   0x56, 0xdc, 0xe8, 0x34, 0x00, 0xeb, 0xe0, 0x5e, 0xac, 0x56, 0xb4, 0x0e,
255   0xcd, 0x10, 0x3c, 0x2e, 0x75, 0xf5, 0xc3, 0xe8, 0xf1, 0xff, 0x45, 0x72,
256   0x72, 0x6f, 0x72, 0x21, 0x20, 0x48, 0x69, 0x74, 0x20, 0x61, 0x20, 0x6b,
257   0x65, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74,
258   0x2e, 0x30, 0xe4, 0xcd, 0x13, 0xcd, 0x16, 0xcd, 0x19, 0x56, 0x89, 0x46,
259   0xc8, 0x89, 0x56, 0xca, 0x8c, 0x46, 0xc6, 0x89, 0x5e, 0xc4, 0xe8, 0xbe,
260   0xff, 0x2e, 0xb4, 0x41, 0xbb, 0xaa, 0x55, 0x8a, 0x56, 0x24, 0x84, 0xd2,
261   0x74, 0x19, 0xcd, 0x13, 0x72, 0x15, 0xd1, 0xe9, 0x81, 0xdb, 0x54, 0xaa,
262   0x75, 0x0d, 0x8d, 0x76, 0xc0, 0x89, 0x5e, 0xcc, 0x89, 0x5e, 0xce, 0xb4,
263   0x42, 0xeb, 0x26, 0x8b, 0x4e, 0xc8, 0x8b, 0x56, 0xca, 0x8a, 0x46, 0x18,
264   0xf6, 0x66, 0x1a, 0x91, 0xf7, 0xf1, 0x92, 0xf6, 0x76, 0x18, 0x89, 0xd1,
265   0x88, 0xc6, 0x86, 0xe9, 0xd0, 0xc9, 0xd0, 0xc9, 0x08, 0xe1, 0x41, 0xc4,
266   0x5e, 0xc4, 0xb8, 0x01, 0x02, 0x8a, 0x56, 0x24, 0xcd, 0x13, 0x0f, 0x82,
267   0x75, 0xff, 0x8b, 0x46, 0x0b, 0xf6, 0x76, 0xc0, 0x01, 0x46, 0xc6, 0x83,
268   0x46, 0xc8, 0x01, 0x83, 0x56, 0xca, 0x00, 0x4f, 0x75, 0x98, 0x8e, 0x46,
269   0xc6, 0x5e, 0xc3, 0x4d, 0x45, 0x54, 0x41, 0x4b, 0x45, 0x52, 0x4e, 0x53,
233   0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xd8, 0xbd, 0x00, 0x7c, 0xb8, 0xe0, 0x1f,
234   0x8e, 0xc0, 0x89, 0xee, 0x89, 0xef, 0xb9, 0x00, 0x01, 0xf3, 0xa5, 0xea,
235   0x5e, 0x7c, 0xe0, 0x1f, 0x00, 0x00, 0x60, 0x00, 0x8e, 0xd8, 0x8e, 0xd0,
236   0x8d, 0x66, 0xa0, 0xfb, 0x80, 0x7e, 0x24, 0xff, 0x75, 0x03, 0x88, 0x56,
237   0x24, 0xc7, 0x46, 0xc0, 0x10, 0x00, 0xc7, 0x46, 0xc2, 0x01, 0x00, 0x8b,
238   0x76, 0x1c, 0x8b, 0x7e, 0x1e, 0x03, 0x76, 0x0e, 0x83, 0xd7, 0x00, 0x89,
239   0x76, 0xd2, 0x89, 0x7e, 0xd4, 0x8a, 0x46, 0x10, 0x98, 0xf7, 0x66, 0x16,
240   0x01, 0xc6, 0x11, 0xd7, 0x89, 0x76, 0xd6, 0x89, 0x7e, 0xd8, 0x8b, 0x5e,
241   0x0b, 0xb1, 0x05, 0xd3, 0xeb, 0x8b, 0x46, 0x11, 0x31, 0xd2, 0xf7, 0xf3,
242   0x89, 0x46, 0xd0, 0x01, 0xc6, 0x83, 0xd7, 0x00, 0x89, 0x76, 0xda, 0x89,
243   0x7e, 0xdc, 0x8b, 0x46, 0xd6, 0x8b, 0x56, 0xd8, 0x8b, 0x7e, 0xd0, 0xc4,
244   0x5e, 0x5a, 0xe8, 0xac, 0x00, 0xc4, 0x7e, 0x5a, 0xb9, 0x0b, 0x00, 0xbe,
245   0xf1, 0x7d, 0x57, 0xf3, 0xa6, 0x5f, 0x26, 0x8b, 0x45, 0x1a, 0x74, 0x0b,
246   0x83, 0xc7, 0x20, 0x26, 0x80, 0x3d, 0x00, 0x75, 0xe7, 0x72, 0x68, 0x50,
247   0xc4, 0x5e, 0x5a, 0x8b, 0x7e, 0x16, 0x8b, 0x46, 0xd2, 0x8b, 0x56, 0xd4,
248   0xe8, 0x7e, 0x00, 0x58, 0x1e, 0x07, 0x8e, 0x5e, 0x5c, 0xbf, 0x00, 0x20,
249   0xab, 0x89, 0xc6, 0x01, 0xf6, 0x01, 0xc6, 0xd1, 0xee, 0xad, 0x73, 0x04,
250   0xb1, 0x04, 0xd3, 0xe8, 0x80, 0xe4, 0x0f, 0x3d, 0xf8, 0x0f, 0x72, 0xe8,
251   0x31, 0xc0, 0xab, 0x0e, 0x1f, 0xc4, 0x5e, 0x5a, 0xbe, 0x00, 0x20, 0xad,
252   0x09, 0xc0, 0x75, 0x05, 0x88, 0xd3, 0xff, 0x6e, 0x5a, 0x48, 0x48, 0x8b,
253   0x7e, 0x0d, 0x81, 0xe7, 0xff, 0x00, 0xf7, 0xe7, 0x03, 0x46, 0xda, 0x13,
254   0x56, 0xdc, 0xe8, 0x34, 0x00, 0xeb, 0xe0, 0x5e, 0xac, 0x56, 0xb4, 0x0e,
255   0xcd, 0x10, 0x3c, 0x2e, 0x75, 0xf5, 0xc3, 0xe8, 0xf1, 0xff, 0x45, 0x72,
256   0x72, 0x6f, 0x72, 0x21, 0x20, 0x48, 0x69, 0x74, 0x20, 0x61, 0x20, 0x6b,
257   0x65, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74,
258   0x2e, 0x30, 0xe4, 0xcd, 0x13, 0xcd, 0x16, 0xcd, 0x19, 0x56, 0x89, 0x46,
259   0xc8, 0x89, 0x56, 0xca, 0x8c, 0x46, 0xc6, 0x89, 0x5e, 0xc4, 0xe8, 0xbe,
260   0xff, 0x2e, 0xb4, 0x41, 0xbb, 0xaa, 0x55, 0x8a, 0x56, 0x24, 0x84, 0xd2,
261   0x74, 0x19, 0xcd, 0x13, 0x72, 0x15, 0xd1, 0xe9, 0x81, 0xdb, 0x54, 0xaa,
262   0x75, 0x0d, 0x8d, 0x76, 0xc0, 0x89, 0x5e, 0xcc, 0x89, 0x5e, 0xce, 0xb4,
263   0x42, 0xeb, 0x26, 0x8b, 0x4e, 0xc8, 0x8b, 0x56, 0xca, 0x8a, 0x46, 0x18,
264   0xf6, 0x66, 0x1a, 0x91, 0xf7, 0xf1, 0x92, 0xf6, 0x76, 0x18, 0x89, 0xd1,
265   0x88, 0xc6, 0x86, 0xe9, 0xd0, 0xc9, 0xd0, 0xc9, 0x08, 0xe1, 0x41, 0xc4,
266   0x5e, 0xc4, 0xb8, 0x01, 0x02, 0x8a, 0x56, 0x24, 0xcd, 0x13, 0x0f, 0x82,
267   0x75, 0xff, 0x8b, 0x46, 0x0b, 0xf6, 0x76, 0xc0, 0x01, 0x46, 0xc6, 0x83,
268   0x46, 0xc8, 0x01, 0x83, 0x56, 0xca, 0x00, 0x4f, 0x75, 0x98, 0x8e, 0x46,
269   0xc6, 0x5e, 0xc3, 0x4d, 0x45, 0x54, 0x41, 0x4b, 0x45, 0x52, 0x4e, 0x53,
270270   0x59, 0x53, 0x00, 0x00, 0x55, 0xaa
271271};
272272
r1461r1462
410410      fat_bits = 8;
411411      has_extended_bios_param_block = FALSE;
412412   }
413   
413
414414   info->fat_bits            = fat_bits;
415415   sector_size               = pick_integer_le(header, 11, 2);
416416   info->sectors_per_cluster   = pick_integer_le(header, 13, 1);
r1461r1462
704704      else if (last_entry != (UINT32) entry)
705705         return 1;   /* if the FATs disagree; mark this as reserved */
706706   }
707   
707
708708   /* normalize special clusters */
709709   if (last_entry >= (0xFFFFFFF0 & bit_mask))
710710   {
r1461r1462
980980      delete_file = TRUE;
981981      new_size = 0;
982982   }
983   
983
984984   /* if this is the trivial case (not changing the size), succeed */
985985   if (!delete_file && (file->filesize == new_size))
986986   {
r1461r1462
10411041                  err = IMGTOOLERR_NOSPACE;
10421042                  goto done;
10431043               }
1044               
1044
10451045               write_cluster = cluster;
10461046            }
10471047            else if (i >= new_cluster_count)
r1461r1462
14381438   memset(created_entry +  0, ' ', 11);
14391439   memset(created_entry + 12, '\0', FAT_DIRENT_SIZE - 12);
14401440   created_entry[11] = (create == CREATE_DIR) ? 0x10 : 0x00;
1441   
1441
14421442   /* set up file dates in the new dirent */
14431443   now = fat_setup_time(time(NULL));
14441444   place_integer_le(created_entry, 14, 4, now);
r1461r1462
15411541               break;
15421542         }
15431543
1544         memcpy(&created_entry[created_entry_pos], &buf[i], 2);
1544         memcpy(&created_entry[created_entry_pos], &buf[i], 2);
15451545         created_entry_pos += 2;
15461546      }
15471547   }
r1461r1462
15991599   UINT8 *sfn_entry;
16001600   int pos, digit_count, i;
16011601   UINT32 digit_place, val = 0;
1602   
1602
16031603   sfn_entry = &entry[entry_len - FAT_DIRENT_SIZE];
16041604
16051605   digit_place = 1;
r1461r1462
17591759         err = fat_seek_file(partition, file, freeent.position);
17601760         if (err)
17611761            goto done;
1762         
1762
17631763         err = fat_write_file(partition, file, created_entry, created_entry_len, NULL);
17641764         if (err)
17651765            goto done;
src/mess/tools/imgtool/modules/t64.c
r1461r1462
1212#define SET_UWORD(a,v) a=v
1313#define SET_ULONG(a,v) a=v
1414#else
15typedef struct {
15typedef struct {
1616   unsigned char low, high;
1717} littleuword;
18typedef struct {
18typedef struct {
1919   unsigned char low, mid, high, highest;
2020} littleulong;
2121#define GET_UWORD(a) (a.low|(a.high<<8))
r1461r1462
6565      16, 16    C64 file name
6666
6767*/
68
68
6969typedef struct{
7070   char dostext[0x20]; // dos text
7171   littleuword version; // packed bcd
r1461r1462
7474   littleuword reserved;
7575   char description[24];
7676} t64_header;
77   
77
7878typedef struct {
7979   unsigned char type;
8080   unsigned char file_type;
r1461r1462
194194   strncpy(name_with_null, HEADER(image)->description, 24);
195195   sprintf(string,"%s\n%s\nversion:%.4x max entries:%d",
196196         dostext_with_null,
197         name_with_null,
197         name_with_null,
198198         GET_UWORD(HEADER(image)->version),
199199         HEADER(image)->max_entries);
200200}
r1461r1462
218218{
219219   t64_iterator *iter=(t64_iterator*)enumeration;
220220   ent->corrupt=0;
221   
221
222222   for (;!(ent->eof=(iter->index>=GET_UWORD(HEADER(iter->image)->max_entries)));iter->index++ ){
223223      if (ENTRY(iter->image, iter->index)->type==0) continue;
224224      memset(ent->fname,0,17);
r1461r1462
318318         if (GET_ULONG(ENTRY(image,i)->offset)-pos>=size) continue;
319319         size=GET_ULONG(ENTRY(image, i)->offset)-pos;
320320      }
321      if ((size!=0)&&(image->size-pos-size!=0))
321      if ((size!=0)&&(image->size-pos-size!=0))
322322         memmove(image->data+pos, image->data+pos+size, image->size-pos-size);
323323      // correct offset positions in other entries
324324      for (i=0;i<GET_UWORD(HEADER(image)->max_entries); i++) {
r1461r1462
369369      if (GET_ULONG(ENTRY(image,i)->offset)-pos>=size) continue;
370370      size=GET_ULONG(ENTRY(image, i)->offset)-pos;
371371   }
372   if ((size!=0)&&(image->size-pos-size!=0))
372   if ((size!=0)&&(image->size-pos-size!=0))
373373      memmove(image->data+pos, image->data+pos+size, image->size-pos-size);
374374   // correct offset positions in other entries
375375   for (i=0;i<GET_UWORD(HEADER(image)->max_entries); i++) {
r1461r1462
403403   SET_UWORD(header.version, 0x0101);
404404   SET_UWORD(header.max_entries, entries);
405405   if (_options[T64_OPTION_LABEL].s) strcpy(header.description, _options[T64_OPTION_LABEL].s);
406   if (stream_write(f, &header, sizeof(t64_header)) != sizeof(t64_header))
406   if (stream_write(f, &header, sizeof(t64_header)) != sizeof(t64_header))
407407      return  IMGTOOLERR_WRITEERROR;
408408   for (i=0; i<entries; i++) {
409   if (stream_write(f, &entry, sizeof(t64_entry)) != sizeof(t64_entry))
409   if (stream_write(f, &entry, sizeof(t64_entry)) != sizeof(t64_entry))
410410      return  IMGTOOLERR_WRITEERROR;
411411   }
412412
src/mess/tools/imgtool/modules/svi_cas.c
r1461r1462
99/*
1010   SVI module
1111
12   SVI style .cas for the svi-318 and svi-328. Converts them to .wav files.
12   SVI style .cas for the svi-318 and svi-328. Converts them to .wav files.
1313   Uses the mess/formats/svi_cas.[ch] files, for the actual conversion.
1414*/
1515
src/mess/tools/imgtool/modules/xsa.c
r1461r1462
6666   size = stream_size (f);
6767   if (size < 5) return IMGTOOLERR_MODULENOTFOUND;
6868   if (4 != stream_read (f, header, 4) ) return IMGTOOLERR_READERROR;
69   
69
7070    if (memcmp (header, "PCK\010", 4) )
7171      return IMGTOOLERR_MODULENOTFOUND;
72   
72
7373   if (4 != stream_read (f, &size, 4) ) return IMGTOOLERR_READERROR;
7474   size = LITTLE_ENDIANIZE_INT32 (size);
7575   if (4 != stream_read (f, header, 4) ) return IMGTOOLERR_READERROR;
76   
76
7777   /* get name from XSA header, can't be longer than 8.3 really */
7878   /* but could be, it's zero-terminated */
7979   file_name = NULL;
r1461r1462
166166   XSA_IMAGE *image=(XSA_IMAGE*)img;
167167
168168   /*  check file name */
169   if (mame_stricmp (fname, image->file_name) )
169   if (mame_stricmp (fname, image->file_name) )
170170      return IMGTOOLERR_MODULENOTFOUND;
171171
172172   return xsa_extract (image->file_handle, destf);
src/mess/tools/imgtool/modules/concept.c
r1461r1462
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{
src/mess/tools/imgtool/imghd.c
r1461r1462
121121      }
122122   }
123123
124   
124
125125done:
126126   if (cache)
127127      free(cache);
src/mess/tools/imgtool/stream.c
r1461r1462
329329         assert(0);
330330         break;
331331   }
332   
332
333333   /* advance the file pointer */
334334   s->position += result;
335335
src/mess/audio/mea8000.c
r1461r1462
77  The MEA 8000 is a speech synthesis chip.
88  The French company TMPI (Techni-musique & parole informatique) provided
99  speech extensions for several 8-bit computers (Thomson, Amstrad, Oric).
10  It was quite popular in France because of its ability to spell 'u'
10  It was quite popular in France because of its ability to spell 'u'
1111  (unlike the more widespread SPO 296 chip).
1212
1313  The synthesis is based on a 4-formant model.
r1461r1462
6363
6464
6565
66typedef struct
66typedef struct
6767{
6868#ifdef FLOAT_MODE
6969   double fm, last_fm;         /* frequency, in Hz */
r1461r1462
7878
7979
8080
81static struct
81static struct
8282{
8383
8484   /* configuration parameters */
r1461r1462
111111   UINT8  noise;
112112
113113   emu_timer *timer;
114 
114
115115} mea8000;
116116
117117
r1461r1462
143143
144144/* frequency, in Hz */
145145
146static const int fm1_table[32] =
146static const int fm1_table[32] =
147147{
148   150,  162,  174,  188,  202,  217,  233,  250,
149   267,  286,  305,  325,  346,  368,  391,  415,
150   440,  466,  494,  523,  554,  587,  622,  659,
148   150,  162,  174,  188,  202,  217,  233,  250,
149   267,  286,  305,  325,  346,  368,  391,  415,
150   440,  466,  494,  523,  554,  587,  622,  659,
151151   698,  740,  784,  830,  880,  932,  988, 1047
152152};
153153
154static const int fm2_table[32] =
154static const int fm2_table[32] =
155155{
156   440,  466,  494,  523,  554,  587,  622,  659,
156   440,  466,  494,  523,  554,  587,  622,  659,
157157   698,  740,  784,  830,  880,  932,  988, 1047,
158158   1100, 1179, 1254, 1337, 1428, 1528, 1639, 1761,
159159   1897, 2047, 2214, 2400, 2609, 2842, 3105, 3400
160160};
161161
162static const int fm3_table[8] =
162static const int fm3_table[8] =
163163{
164164   1179, 1337, 1528, 1761, 2047, 2400, 2842, 3400
165165};
r1461r1462
174174
175175
176176/* amplitude * 1000 */
177static const int ampl_table[16] =
177static const int ampl_table[16] =
178178{
179179   0,   8,  11,  16,  22,  31,  44,   62,
180180   88, 125, 177, 250, 354, 500, 707, 1000
r1461r1462
183183
184184
185185/* pitch increment, in Hz / 8 ms */
186static const int pi_table[32] =
186static const int pi_table[32] =
187187{
188   0, 1,  2,  3,  4,  5,  6,  7,
188   0, 1,  2,  3,  4,  5,  6,  7,
189189   8, 9, 10, 11, 12, 13, 14, 15,
190   0 /* noise */, -15, -14, -13, -12, -11, -10, -9,
190   0 /* noise */, -15, -14, -13, -12, -11, -10, -9,
191191   -8, -7, -6, -5, -4, -3, -2, -1
192192};
193193
r1461r1462
199199
200200static int mea8000_accept_byte( void )
201201{
202   return
202   return
203203      mea8000.state == MEA8000_STOPPED ||
204204      mea8000.state == MEA8000_WAIT_FIRST ||
205205      (mea8000.state == MEA8000_STARTED && mea8000.bufpos < 4);
r1461r1462
212212      buffer contains a complete frame and the CPU nees to wait for the next
213213      frame end to compose a new frame.
214214   */
215   if (mea8000.req_out_func)
215   if (mea8000.req_out_func)
216216      mea8000.req_out_func(0, mea8000_accept_byte());
217217}
218218
r1461r1462
241241static void mea8000_init_tables( void )
242242{
243243   int i;
244   for (i=0; i<TABLE_LEN; i++)
244   for (i=0; i<TABLE_LEN; i++)
245245   {
246246      double f = (double)i / F0;
247247      cos_table[i]  = 2. * cos(2.*M_PI*f) * QUANT;
r1461r1462
319319   int in, out;
320320   int ampl = mea8000_interp_i(mea8000.last_ampl, mea8000.ampl);
321321
322   if (mea8000.noise)
322   if (mea8000.noise)
323323      in = mea8000_noise_gen();
324   else
324   else
325325      in = mea8000_freq_gen();
326326   in = (in * ampl) / 1024;
327327
r1461r1462
329329      in = mea8000_filter_step(i, in);
330330   out = in;
331331   return out;
332}
332}
333333
334334
335335
r1461r1462
378378   double in, out;
379379   double ampl = mea8000_interp_f(mea8000.last_ampl, mea8000.ampl);
380380
381   if (mea8000.noise)
381   if (mea8000.noise)
382382      in = mea8000_noise_gen();
383   else
383   else
384384      in = mea8000_freq_gen();
385385   in *= ampl / 1000.;
386386
387   for (i=0; i<4; i++)
387   for (i=0; i<4; i++)
388388   {
389389      in = mea8000_filter_step(i, in);
390390      out += in;
391391   }
392392   return out;
393}
393}
394394
395395
396396
r1461r1462
407407{
408408   int i;
409409   mea8000.last_pitch = mea8000.pitch;
410   for (i=0; i<4; i++)
410   for (i=0; i<4; i++)
411411   {
412412      mea8000.f[i].last_bw = mea8000.f[i].bw;
413413      mea8000.f[i].last_fm = mea8000.f[i].fm;
r1461r1462
432432   mea8000.f[2].fm = fm3_table[ mea8000.buf[1] >> 5 ];
433433   mea8000.f[1].fm = fm2_table[ mea8000.buf[1] & 0x1f ];
434434   mea8000.f[0].fm = fm1_table[ mea8000.buf[2] >> 3 ];
435   mea8000.ampl = ampl_table[ ((mea8000.buf[2] & 7) << 1) |
435   mea8000.ampl = ampl_table[ ((mea8000.buf[2] & 7) << 1) |
436436               (mea8000.buf[3] >> 7) ];
437437   mea8000.framelog = fd + 6 /* 64 samples / ms */ + 3;
438438   mea8000.framelength = 1 <<  mea8000.framelog;
439439   mea8000.bufpos = 0;
440440#ifdef FLOAT_MODE
441441   LOG(( "mea800_decode_frame: pitch=%i noise=%i  fm1=%gHz bw1=%gHz  fm2=%gHz bw2=%gHz  fm3=%gHz bw3=%gHz  fm4=%gHz bw4=%gHz  ampl=%g fd=%ims\n",
442         mea8000.pitch, mea8000.noise,
442         mea8000.pitch, mea8000.noise,
443443         mea8000.f[0].fm, mea8000.f[0].bw, mea8000.f[1].fm, mea8000.f[1].bw,
444444         mea8000.f[2].fm, mea8000.f[2].bw, mea8000.f[3].fm, mea8000.f[3].bw,
445445         mea8000.ampl/1000., 8 << fd ));
446446#else
447447   LOG(( "mea800_decode_frame: pitch=%i noise=%i  fm1=%iHz bw1=%iHz  fm2=%iHz bw2=%iHz  fm3=%iHz bw3=%iHz  fm4=%iHz bw4=%iHz  ampl=%g fd=%ims\n",
448         mea8000.pitch, mea8000.noise,
448         mea8000.pitch, mea8000.noise,
449449         mea8000.f[0].fm, mea8000.f[0].bw, mea8000.f[1].fm, mea8000.f[1].bw,
450450         mea8000.f[2].fm, mea8000.f[2].bw, mea8000.f[3].fm, mea8000.f[3].bw,
451451         mea8000.ampl/1000., 8 << fd ));
r1461r1462
478478{
479479   int pos = mea8000.framepos % SUPERSAMPLING;
480480
481   if (!pos)
481   if (!pos)
482482   {
483483      /* sample is really computed only every 8-th time */
484484      mea8000.lastsample = mea8000.sample;
485485      mea8000.sample = mea8000_compute_sample();
486486      DAC_signed_data_16_w(mea8000.channel, mea8000.lastsample);
487487   }
488   else
488   else
489489   {
490490      /* other samples are simply interpolated */
491      int sample =
492         mea8000.lastsample +
491      int sample =
492         mea8000.lastsample +
493493         ((pos*(mea8000.sample-mea8000.lastsample)) / SUPERSAMPLING);
494494      DAC_signed_data_16_w(mea8000.channel, sample);
495495   }
496496
497497   mea8000.framepos++;
498   if (mea8000.framepos == mea8000.framelength)
498   if (mea8000.framepos == mea8000.framelength)
499499   {
500500      mea8000_shift_frame();
501501      /* end of frame */
502      if (mea8000.bufpos == 4)
502      if (mea8000.bufpos == 4)
503503      {
504504         /* we have a successor */
505505         LOG(( "%f mea8000_timer_expire: new frame\n", attotime_to_double(timer_get_time()) ));
506506         mea8000_decode_frame();
507507         mea8000_start_frame();
508508      }
509      else if (mea8000.cont) 
509      else if (mea8000.cont)
510510      {
511511         /* repeat mode */
512512         LOG(( "%f mea8000_timer_expire: repeat frame\n", attotime_to_double(timer_get_time()) ));
513513         mea8000_start_frame();
514514      }
515515      /* slow stop */
516      else if (mea8000.state == MEA8000_STARTED)
516      else if (mea8000.state == MEA8000_STARTED)
517517      {
518518         mea8000.ampl = 0;
519519         LOG(( "%f mea8000_timer_expire: fade frame\n", attotime_to_double(timer_get_time()) ));
520520         mea8000_start_frame();
521521         mea8000.state = MEA8000_SLOWING;
522522      }
523      else if (mea8000.state == MEA8000_SLOWING)
523      else if (mea8000.state == MEA8000_SLOWING)
524524      {
525525         LOG(( "%f mea8000_timer_expire: stop frame\n", attotime_to_double(timer_get_time()) ));
526526         mea8000_stop_frame();
527527      }
528528      mea8000_update_req();
529529   }
530   else
530   else
531531   {
532532      /* continue frame */
533533      timer_reset( mea8000.timer, SAMPLING );
r1461r1462
542542
543543READ8_HANDLER ( mea8000_r )
544544{
545   switch ( offset )
545   switch ( offset )
546546   {
547547
548548   case 0: /* status register */
r1461r1462
561561
562562WRITE8_HANDLER ( mea8000_w )
563563{
564   switch ( offset )
564   switch ( offset )
565565   {
566566
567567   case 0: /* data register */
568      if (mea8000.state == MEA8000_STOPPED) 
568      if (mea8000.state == MEA8000_STOPPED)
569569      {
570570         /* got pitch byte before first frame */
571571         mea8000.pitch = 2 * data;
r1461r1462
573573         mea8000.state = MEA8000_WAIT_FIRST;
574574         mea8000.bufpos = 0;
575575      }
576      else if (mea8000.bufpos == 4)
576      else if (mea8000.bufpos == 4)
577577      {
578578         /* overflow */
579579         LOG(( "$%04x %f: mea8000_w data overflow %02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
580580      }
581      else
581      else
582582      {
583583         /* enqueue frame byte */
584         LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
584         LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
585585               data, mea8000.bufpos ));
586586         mea8000.buf[mea8000.bufpos] = data;
587587         mea8000.bufpos++;
r1461r1462
605605   {
606606      int stop = (data >> 4) & 1;
607607
608      if (data & 8)
608      if (data & 8)
609609         mea8000.cont = (data >> 2) & 1;
610610
611      if (data & 2)
611      if (data & 2)
612612         mea8000.roe = data & 1;
613613
614      if (stop)
614      if (stop)
615615         mea8000_stop_frame();
616616
617      LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n",
618            activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
619            stop, mea8000.cont, mea8000.roe ));     
617      LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n",
618            activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
619            stop, mea8000.cont, mea8000.roe ));
620620
621621      mea8000_update_req();
622622      break;
r1461r1462
643643   mea8000.roe = 0;
644644   mea8000.state = MEA8000_STOPPED;
645645   mea8000_update_req();
646   for (i=0; i<4; i++)
646   for (i=0; i<4; i++)
647647   {
648648      mea8000.f[i].last_output = 0;
649649      mea8000.f[i].output = 0;
r1461r1462
676676   state_save_register_item( "mea8000", 0, mea8000.lastsample );
677677   state_save_register_item( "mea8000", 0, mea8000.sample );
678678   state_save_register_item( "mea8000", 0, mea8000.phi );
679   for (i=0; i<4; i++)
679   for (i=0; i<4; i++)
680680   {
681681      state_save_register_item( "mea8000", i, mea8000.f[i].fm );
682682      state_save_register_item( "mea8000", i, mea8000.f[i].last_fm );
src/mess/audio/vc4000.c
r1461r1462
4848   stream_sample_t *buffer = _buffer[0];
4949
5050   for (i = 0; i < length; i++, buffer++)
51   {   
51   {
5252      *buffer = 0;
5353      if (vc4000_sound.reg[0] && vc4000_sound.pos <= vc4000_sound.size/2)
5454      {
src/mess/audio/dave.c
r1461r1462
4444   int int_wanted;
4545
4646   logerror("int latch: %02x enable: %02x input: %02x\n", (int) dave.int_latch, (int) dave.int_enable, (int) dave.int_input);
47   
47
4848   int_wanted = (((dave.int_enable<<1) & dave.int_latch)!=0);
4949
5050   if (dave_iface->int_callback)
r1461r1462
8282         dave.int_input |= (dave.fifty_hz_state & 0x01)<<0;
8383      }
8484      break;
85     
8685
86
8787      default:
8888         break;
8989   }
r1461r1462
117117
118118      dave.fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD;
119119      dave.fifty_hz_state^=0x0ffffffff;
120   
120
121121      if (dave.fifty_hz_state!=0)
122122      {
123123         dave.int_irq |= (1<<1);
r1461r1462
130130   {
131131      /* reload counter */
132132      dave.one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD;
133   
133
134134      /* change state */
135135      dave.int_input ^= (1<<2);
136136
r1461r1462
168168   dave.fifty_hz_count = DAVE_FIFTY_HZ_COUNTER_RELOAD;
169169   dave.one_hz_count = DAVE_ONE_HZ_COUNTER_RELOAD;
170170   timer_pulse(ATTOTIME_IN_HZ(1000), NULL, 0, dave_1khz_callback);
171   
171
172172   for (i=0; i<3; i++)
173173   {
174174      dave.Period[i] = ((STEP  * Machine->sample_rate)/125000);
r1461r1462
178178}
179179
180180static void dave_update_sound(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
181{     
181{
182182   stream_sample_t *buffer1, *buffer2;
183183   /* 0 = channel 0 left volume, 1 = channel 0 right volume,
184184   2 = channel 1 left volume, 3 = channel 1 right volume,
185   4 = channel 2 left volume, 5 = channel 2 right volume
185   4 = channel 2 left volume, 5 = channel 2 right volume
186186   6 = noise channel left volume, 7 = noise channel right volume */
187187   int output_volumes[8];
188188   int left_volume;
r1461r1462
295295      case 5:
296296      {
297297         int count = 0;
298         int channel_index = offset>>1;
298         int channel_index = offset>>1;
299299
300300         /* Fout = 125,000 / (n+1) hz */
301301
302302         /* sample rate/clock */
303         
304303
304
305305         /* get down-count */
306306         switch (offset & 0x01)
307307         {
r1461r1462
318318            }
319319            break;
320320         }
321         
321
322322         count++;
323323
324     
324
325325         dave.Period[channel_index] = ((STEP  * Machine->sample_rate)/125000) * count;
326326
327327      }
r1461r1462
356356         /*   force => the value of this register is forced regardless of the wave
357357               state,
358358            remove => this value is force to zero so that it has no influence over
359               the final volume calculation, regardless of wave state
359               the final volume calculation, regardless of wave state
360360            use => the volume value is dependant on the wave state and is included
361361               in the final volume calculation */
362362
r1461r1462
368368               logerror("1khz\n");
369369            }
370370            break;
371           
371
372372            case 1:
373373            {
374374               logerror("50hz\n");
r1461r1462
396396            /* force r8 value */
397397            dave.level_or[0] = 0x0ffff;
398398            dave.level_and[0] = 0x00;
399         
399
400400            /* remove r9 value */
401401            dave.level_or[2] = 0x000;
402402            dave.level_and[2] = 0x00;
r1461r1462
414414            /* use r8 value */
415415            dave.level_or[0] = 0x000;
416416            dave.level_and[0] = 0xffff;
417         
417
418418            /* use r9 value */
419419            dave.level_or[2] = 0x000;
420420            dave.level_and[2] = 0xffff;
r1461r1462
434434            /* force r12 value */
435435            dave.level_or[1] = 0x0ffff;
436436            dave.level_and[1] = 0x00;
437         
437
438438            /* remove r13 value */
439439            dave.level_or[3] = 0x000;
440440            dave.level_and[3] = 0x00;
r1461r1462
452452            /* use r12 value */
453453            dave.level_or[1] = 0x000;
454454            dave.level_and[1] = 0xffff;
455         
455
456456            /* use r13 value */
457457            dave.level_or[3] = 0x000;
458458            dave.level_and[3] = 0xffff;
r1461r1462
568568
569569      case 0x014:
570570         return (dave.int_latch & 0x0aa) | (dave.int_input & 0x055);
571   
572571
572
573573      default:
574574         break;
575575   }
r1461r1462
611611
612612      }
613613      break;
614   
614
615615      case DAVE_INT2_ID:
616616      {
617617         int previous_state;
src/mess/audio/sblaster.c
r1461r1462
2121
2222   0x20 input 8 bit direct
2323   0x24 input 8 bit with dma
24   
24
2525   0xd1 speaker on
2626   0xd3 speaker off
2727   0xd8 read speaker
28   
28
2929   0x40 samplerate adjust
3030
3131   0x48 blockgroesse einstellen
r1461r1462
141141   }
142142   return 0;
143143}
144   
144
145145WRITE8_HANDLER( soundblaster_w )
146146{
147147   switch (offset) {
148   case 6:
148   case 6:
149149      if (data!=0) { //reset
150150      } else { // reset off
151151      }
src/mess/audio/odyssey2.c
r1461r1462
1111
1212sound_stream *odyssey2_sh_channel;
1313
14const struct CustomSound_interface odyssey2_sound_interface =
14const struct CustomSound_interface odyssey2_sound_interface =
1515{
1616   odyssey2_sh_start
1717};
src/mess/audio/dave.h
r1461r1462
6868   the volume will be forced on,else it is dependant on
6969   the state of the wave */
7070   int level_or[8];
71   /* if one of the values is 0x00, this means the
71   /* if one of the values is 0x00, this means the
7272   volume is forced off, else it is dependant on the wave */
7373   int level_and[8];
7474
7575   /* these are the current channel volumes in MAME form */
7676   int mame_volumes[8];
77   
77
7878   /* update step */
7979   int UpdateStep;
8080
src/mess/audio/arcadia.c
r1461r1462
5252   stream_sample_t *buffer = _buffer[0];
5353
5454   for (i = 0; i < length; i++, buffer++)
55   {   
55   {
5656      *buffer = 0;
5757      if (arcadia_sound.reg[1] && arcadia_sound.pos <= arcadia_sound.size/2)
5858      {
src/mess/audio/lynx.c
r1461r1462
4242AUD_INTEGRATE   EQU %00100000
4343AUD_RELOAD   EQU %00010000
4444AUD_CNTEN   EQU %00001000
45AUD_LINK   EQU %00000111   
45AUD_LINK   EQU %00000111
4646; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1
4747AUD_64us   EQU %00000110
4848AUD_32us   EQU %00000101
r1461r1462
110110    int ticks;
111111    int count;
112112} LYNX_AUDIO;
113static LYNX_AUDIO lynx_audio[4]= {
113static LYNX_AUDIO lynx_audio[4]= {
114114   { 0 },
115115   { 1 },
116116   { 2 },
117   { 3 }
117   { 3 }
118118};
119119
120120static void lynx_audio_reset_channel(LYNX_AUDIO *This)
r1461r1462
134134{
135135    channel->shifter=((channel->shifter<<1)&0x3ff)
136136   |shift_xor[channel->shifter&channel->mask];
137   
137
138138    if (channel->reg.n.control1&0x20) {
139139   if (channel->shifter&1) {
140140       channel->reg.n.output+=channel->reg.n.volume;
r1461r1462
189189    stream_update(mixer_channel);
190190    switch (offset) {
191191    case 0x20: case 0x21: case 0x22: case 0x24: case 0x25:
192    case 0x28: case 0x29: case 0x2a: case 0x2c: case 0x2d:
193    case 0x30: case 0x31: case 0x32: case 0x34: case 0x35:
194    case 0x38: case 0x39: case 0x3a: case 0x3c: case 0x3d:
192    case 0x28: case 0x29: case 0x2a: case 0x2c: case 0x2d:
193    case 0x30: case 0x31: case 0x32: case 0x34: case 0x35:
194    case 0x38: case 0x39: case 0x3a: case 0x3c: case 0x3d:
195195   data=lynx_audio[(offset>>3)&3].reg.data[offset&7];
196196   break;
197    case 0x23: case 0x2b: case 0x33: case 0x3b:
197    case 0x23: case 0x2b: case 0x33: case 0x3b:
198198   data=lynx_audio[(offset>>3)&3].shifter&0xff;
199199   break;
200200    case 0x26:case 0x2e:case 0x36:case 0x3e:
r1461r1462
204204   data=(lynx_audio[(offset>>3)&3].shifter>>4)&0xf0;
205205   data|=lynx_audio[(offset>>3)&3].reg.data[offset&7]&0x0f;
206206   break;
207    case 0x40: case 0x41: case 0x42: case 0x43:
207    case 0x40: case 0x41: case 0x42: case 0x43:
208208   data=lynx_audio[offset&3].attenuation;
209209   break;
210    case 0x44:
210    case 0x44:
211211   data=attenuation_enable;
212212   break;
213213    case 0x50:
r1461r1462
229229    case 0x38: case 0x3a: case 0x3c: case 0x3e:
230230   lynx_audio[(offset>>3)&3].reg.data[offset&7]=data;
231231   break;
232    case 0x23: case 0x2b: case 0x33: case 0x3b:
232    case 0x23: case 0x2b: case 0x33: case 0x3b:
233233   lynx_audio[(offset>>3)&3].reg.data[offset&7]=data;
234234   lynx_audio[(offset>>3)&3].shifter&=~0xff;
235235   lynx_audio[(offset>>3)&3].shifter|=data;
r1461r1462
250250    case 0x40: case 0x41: case 0x42: case 0x43: // lynx2 only, howard extension board
251251   lynx_audio[offset&3].attenuation=data;
252252   break;
253    case 0x44:
253    case 0x44:
254254   attenuation_enable=data; //lynx2 only, howard extension board
255255   break;
256256    case 0x50:
r1461r1462
297297         lynx_audio_execute(channel);
298298         v=channel->reg.n.output;
299299         if (!(master_enable&(0x10<<j)))
300         {         
300         {
301301            if (attenuation_enable&(0x10<<j)) {
302302               *left+=v*(channel->attenuation>>4);
303303            } else {
r1461r1462
382382    mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, lynx2_update);
383383
384384    usec_per_sample = 1000000 / Machine->sample_rate;
385   
385
386386    lynx_audio_init();
387387   return (void *) ~0;
388388}
src/mess/audio/svision.c
r1461r1462
4242      case 4:
4343         svision_dma.on = data & 0x80;
4444         if (svision_dma.on)
45         {
46            svision_dma.pos = 0.0;
45         {
46            svision_dma.pos = 0.0;
4747         }
4848         break;
4949   }
src/mess/image.c
r1461r1462
4545   char *dir;
4646   char *hash;
4747   char *basename_noext;
48   
48
4949   /* flags */
5050   unsigned int writeable : 1;
5151   unsigned int created : 1;
r1461r1462
841841
842842/****************************************************************************
843843  Tag management functions.
844 
844
845845  When devices have private data structures that need to be associated with a
846846  device, it is recommended that image_alloctag() be called in the device
847847  init function.  If the allocation succeeds, then a pointer will be returned
r1461r1462
11541154{
11551155   const char *hash_string;
11561156   UINT32 crc = 0;
1157   
1157
11581158   hash_string = image_hash(img);
11591159   if (hash_string)
11601160      crc = hash_data_extract_crc32(hash_string);
r1461r1462
13551355   /* first set up the working directory to be the MESS directory */
13561356   osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory));
13571357   image->working_directory = mame_strdup(mess_directory);
1358   
1358
13591359   /* now try browsing down to "software" */
13601360   if (try_change_working_directory(image, "software"))
13611361   {
src/mess/infomess.c
r1461r1462
8383   int i, count;
8484   UINT32 ram;
8585   UINT32 default_ram;
86   
86
8787   count = ram_option_count(game);
8888   default_ram = ram_default(game);
8989
src/mess/includes/compis.h
r1461r1462
55
66   Per Ola Ingvarsson
77   Tomas Karlsson
8     
8
99 ******************************************************************************/
1010
1111/*----------- defined in machine/compis.c -----------*/
src/mess/includes/kc.h
r1461r1462
5656 READ8_HANDLER(kc85_ctc_r);
5757WRITE8_HANDLER(kc85_ctc_w);
5858
59/* this is a fake keyboard layout.
59/* this is a fake keyboard layout.
6060The keys are converted into codes which are transmitted by the keyboard to the base-unit */
6161/* key code can be calculated as (line*8)+bit_index */
6262
src/mess/includes/dgn_beta.h
r1461r1462
4242
4343/***** Video Modes *****/
4444
45typedef enum
45typedef enum
4646{
4747   TEXT_40x25,               /* Text mode 40x25 */
4848   TEXT_80x25,               /* Text mode 80x25 */
r1461r1462
5050   GRAPH_320x256x16,            /* Graphics 320x256x16 */
5151   GRAPH_640x512x2               /* Graphics 640X512X2 */
5252} BETA_VID_MODES;
53   
53
5454/*----------- defined in machine/dgn_beta.c -----------*/
5555
5656MACHINE_START( dgnbeta );
src/mess/includes/hp48.h
r1461r1462
5050
5151/*----------- defined in machine/hp48.c -----------*/
5252
53typedef struct {
54   int data[0x40];
53typedef struct {
54   int data[0x40];
5555   UINT16 crc;
5656   UINT32 timer2;
5757} HP48_HARDWARE;
src/mess/includes/mac.h
r1461r1462
11/*********************************************************************
22
33   mac.h
4   
4
55   MESS Macintosh driver declarations
66
77*********************************************************************/
src/mess/includes/hd6402.h
r1461r1462
77
88  to set an input to a specified state.
99
10  The outputs can also be wired in any order to a I/O port, so
11  a callback is executed with the updated output state.
10  The outputs can also be wired in any order to a I/O port, so
11  a callback is executed with the updated output state.
1212  Use
1313
1414   hd6402_set_callback
src/mess/includes/msx_slot.h
r1461r1462
1414} msx_slot_layout;
1515
1616#define MSX_LAYOUT_INIT(msx) \
17static const msx_slot_layout msx_slot_layout_##msx[] = {
17static const msx_slot_layout msx_slot_layout_##msx[] = {
1818
1919#define MSX_LAYOUT_SLOT(prim, sec, page, extend, type, size, option) \
2020   {                        \
src/mess/includes/i8271.h
r1461r1462
5151   /* mode special register */
5252   unsigned long Mode;
5353
54   
54
5555   /* drive outputs */
5656   int drive;
5757   int side;
r1461r1462
8181
8282   /* sector counter and id counter */
8383   int Counter;
84   
84
8585   /* ==0, to cpu, !=0 =from cpu */
8686   int data_direction;
8787   i8271_interface   fdc_interface;
src/mess/includes/z88.h
r1461r1462
3535   int sta;
3636   int ack;
3737   int mem[4];
38   
38
3939   /* rtc acknowledge */
4040   /* bit 2 = min */
4141   /* bit 1 = sec */
src/mess/includes/pcw16.h
r1461r1462
44#define PCW16_DISPLAY_WIDTH 640
55#define PCW16_DISPLAY_HEIGHT 480
66
7#define PCW16_SCREEN_WIDTH   (PCW16_DISPLAY_WIDTH + (PCW16_BORDER_WIDTH<<1))
7#define PCW16_SCREEN_WIDTH   (PCW16_DISPLAY_WIDTH + (PCW16_BORDER_WIDTH<<1))
88#define PCW16_SCREEN_HEIGHT   (PCW16_DISPLAY_HEIGHT  + (PCW16_BORDER_HEIGHT<<1))
99
1010/*----------- defined in video/pcw16.c -----------*/
src/mess/includes/serial.h
r1461r1462
33
44/* internal serial transmission */
55
6/*
6/*
77
88   This code is used to transmit a file stored on the host filesystem
99   (e.g. PC harddrive) to an emulated system.
10   
10
1111   The file is converted into a serial bit-stream which can be received
1212   by the emulated serial chip in the emulated system.
1313
1414   The file can be transmitted using different protocols
1515*/
1616
17/*
18   A and B are two computers linked with a serial connection
19 
17/*
18   A and B are two computers linked with a serial connection
19
2020   A and B can transmit and receive data, through the same connection
2121*/
2222
23/*
23/*
2424   these flags apply to A and B, and give the state of the input & output
2525   signals at each side.
2626*/
2727
2828
29/*   
29/*
3030   CTS = Clear to Send. (INPUT)
3131   Other end of connection is ready to accept data
32   
33     
34   NOTE:
35   
36     This output is active low on serial chips (e.g. 0 is CTS is set),
32
33
34   NOTE:
35
36     This output is active low on serial chips (e.g. 0 is CTS is set),
3737     but here it is active high!
3838*/
39   
39
4040#define SERIAL_STATE_CTS   0x0001
41/*
41/*
4242   RTS = Request to Send. (OUTPUT)
4343   This end is ready to send data, and requests if the other
4444   end is ready to accept it
4545
46   NOTE:
47   
48     This output is active low on serial chips (e.g. 0 is RTS is set),
46   NOTE:
47
48     This output is active low on serial chips (e.g. 0 is RTS is set),
4949     but here it is active high!
5050*/
5151#define SERIAL_STATE_RTS   0x0002
5252
53/*
53/*
5454   DSR = Data Set ready. (INPUT)
55   Other end of connection has data
55   Other end of connection has data
5656
5757
58   NOTE:
59   
60     This output is active low on serial chips (e.g. 0 is DSR is set),
58   NOTE:
59
60     This output is active low on serial chips (e.g. 0 is DSR is set),
6161     but here it is active high!
6262*/
6363#define SERIAL_STATE_DSR   0x0004
6464
65/*
65/*
6666   DTR = Data terminal Ready. (OUTPUT)
6767   TX contains new data.
6868
69     NOTE:
70   
71     This output is active low on serial chips (e.g. 0 is DTR is set),
69     NOTE:
70
71     This output is active low on serial chips (e.g. 0 is DTR is set),
7272     but here it is active high!
7373*/
7474#define SERIAL_STATE_DTR   0x0008
75/* RX = Recieve data. (INPUT) */
75/* RX = Recieve data. (INPUT) */
7676#define SERIAL_STATE_RX_DATA   0x00010
7777/* TX = Transmit data. (OUTPUT) */
7878#define SERIAL_STATE_TX_DATA   0x00020
r1461r1462
8383and stop bits. These are programmable. */
8484enum
8585{
86   SERIAL_PROTOCOL_NONE,      /* no protocol applied */     
86   SERIAL_PROTOCOL_NONE,      /* no protocol applied */
8787   SERIAL_PROTOCOL_XMODEM      /* transfer data using xmodem protocol */
8888};
8989
r1461r1462
122122
123123   /* state of other side - store here */
124124   unsigned long input_state;
125   
125
126126   /* this callback is executed when this side has refreshed it's state,
127127   to let the other end know */
128128   void   (*out_callback)(int id, unsigned long state);
r1461r1462
167167/*******************************************************************************/
168168/**** RECEIVE AND TRANSMIT GENERIC CODE ****/
169169
170/* this can be used by most of the serial chip implementations,
170/* this can be used by most of the serial chip implementations,
171171because they all work in roughly the same way.
172172There is generic code to send and receive data in the specified form */
173173
src/mess/includes/pclpt.h
r1461r1462
1010
1111/*----------- defined in machine/pclpt.c -----------*/
1212
13typedef enum {
13typedef enum {
1414   LPT_UNIDIRECTIONAL
1515//   , LPT_BIDIRECTIONAL
1616// epp, ecp
src/mess/includes/sym1.h
r1461r1462
11/******************************************************************************
22 Synertek Systems Corp. SYM-1
3
3
44 Early driver by PeT mess@utanet.at May 2000
55 Rewritten by Dirk Best October 2007
6
6
77******************************************************************************/
88
99
src/mess/includes/crtc6845.h
r1461r1462
8888
8989int mscrtc6845_get_personality(struct mscrtc6845 *crtc);
9090
91/* cursor off, cursor on, cursor 16 frames on/off, cursor 32 frames on/off
91/* cursor off, cursor on, cursor 16 frames on/off, cursor 32 frames on/off
9292   start line, end line */
9393void mscrtc6845_get_cursor(struct mscrtc6845 *crtc, struct mscrtc6845_cursor *cursor);
9494
r1461r1462
100100
101101/* to be called when reading from port */
102102 READ8_HANDLER ( mscrtc6845_0_port_r );
103   
103
104104/***************************************************************************
105105
106106   6845 variant macros
src/mess/includes/europc.h
r1461r1462
1919
2020ESC, [SPACE], F1,F2,F3,F4,[SPACE],F5,F6,F7,F8,[SPACE],F9,F0,F11,F12
2121[SPACE]
22\|, 1,2,3,4,5,6,7,8,9,0 -,+, BACKSPACE,[SPACE], NUM LOCK, SCROLL LOCK, PRINT SCREEN, KEYPAD -
23TAB,Q,W,E,R,T,Y,U,I,O,P,[,], RETURN, [SPACE], KEYPAD 7, KEYPAD 8, KEYPAD 9, KEYPAD +
22\|, 1,2,3,4,5,6,7,8,9,0 -,+, BACKSPACE,[SPACE], NUM LOCK, SCROLL LOCK, PRINT SCREEN, KEYPAD -
23TAB,Q,W,E,R,T,Y,U,I,O,P,[,], RETURN, [SPACE], KEYPAD 7, KEYPAD 8, KEYPAD 9, KEYPAD +
2424CTRL, A,S,D,F,G,H,J,K,L,;,@,~, RETURN, [SPACE],KEYPAD 4,KEYPAD 5,KEYPAD 6, KEYPAD +
2525LEFT SHIFT, Z,X,C,V,B,N,M,<,>,?,RIGHT SHIFT,[SPACE],KEYPAD 1, KEYPAD 2, KEYPAD 3, KEYPAD ENTER
2626ALT,[SPACE], SPACE BAR,[SPACE],CAPS LOCK,[SPACE], KEYPAD 0, KEYPAD ., KEYPAD ENTER
src/mess/includes/at.h
r1461r1462
11/***************************************************************************
2   
2
33   IBM AT Compatibles
44
55***************************************************************************/
src/mess/includes/sblaster.h
r1461r1462
2121
2222typedef struct {
2323   int dma;
24   int irq;   
24   int irq;
2525   struct { UINT8 major, minor; } version;
2626} SOUNDBLASTER_CONFIG;
2727
src/mess/includes/centroni.h
r1461r1462
11/*
2  defines centronics/parallel port printer interface 
2  defines centronics/parallel port printer interface
33
44  provides a centronics printer simulation (sends output to IO_PRINTER)
55*/
r1461r1462
1313extern "C" {
1414#endif
1515
16typedef enum {
17   PRINTER_CENTRONICS,
16typedef enum {
17   PRINTER_CENTRONICS,
1818   PRINTER_IBM // select line not important
1919} PRINTER_TYPE;
2020
src/mess/includes/pc_ide.h
r1461r1462
1/*
2   ibm at mfm hard disk
1/*
2   ibm at mfm hard disk
33   interface still used in ide devices!
44*/
55
src/mess/includes/cbmdrive.h
r1461r1462
1/*
1/*
22 * private area for the
33 * commodore cbm floppy drives vc1541 c1551
44 * synthetic simulation
5 *
5 *
66 * contains state machines and file system accesses
7 *
7 *
88 */
99#ifndef __CBMDRIVE_H_
1010#define __CBMDRIVE_H_
r1461r1462
5151         attotime time;
5252      }
5353      serial;
54      struct
54      struct
5555      {
5656         int device;
5757         int state;
src/mess/includes/jupiter.h
r1461r1462
2828/*----------- defined in drivers/jupiter.c -----------*/
2929
3030extern const gfx_layout jupiter_charlayout;
31                                   
31
src/mess/includes/odyssey2.h
r1461r1462
77#define P1_VDC_ENABLE             (0x08)  /* active low */
88#define P1_EXT_RAM_ENABLE         (0x10)  /* active low */
99#define P1_VDC_COPY_MODE_ENABLE   (0x40)
10                                 
10
1111#define P2_KEYBOARD_SELECT_MASK   (0x07)  /* select row to scan */
1212
1313#define VDC_CONTROL_REG_STROBE_XY (0x02)
src/mess/includes/ti85.h
r1461r1462
5050PALETTE_INIT( ti85 );
5151extern const unsigned char ti85_palette[32*7][3];
5252extern const unsigned short ti85_colortable[32][7];
53                                   
53
src/mess/includes/ted7360.h
r1461r1462
1616/* pal version */
1717/* dma_read: videochip fetched 1 byte data from system bus */
1818extern void ted7360_init (int pal);
19extern void ted7360_set_dma (read8_handler dma_read,
19extern void ted7360_set_dma (read8_handler dma_read,
2020                      read8_handler dma_read_rom);
2121
2222#define TED7360NTSC_VRETRACERATE 60
src/mess/includes/msm8251.h
r1461r1462
4242   UINT8 mode_byte;
4343
4444   /* data being received */
45   UINT8 data;   
45   UINT8 data;
4646
4747   /* receive reg */
4848   struct serial_receive_register receive_reg;
src/mess/video/zx.c
r1461r1462
1111
1212   The video chip draws the scanline until a HALT instruction (0x76) is
1313   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,
14   other video byte is used to generate a tile and at the same time,
1515   appears to the CPU as a NOP (0x00) instruction.
1616
1717****************************************************************************/
src/mess/video/dgn_beta.c
r1461r1462
11/*
22   video/dgn_beta.c
33
4The Dragon Beta uses a 68B45 for it's display generation, this is used in the
4The 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
66standard 40x25 and 80x25. In adition to the 6845 there is some TTL logic which
7provides colour and attributes. In text modes the video ram is organised as pairs
7provides colour and attributes. In text modes the video ram is organised as pairs
88of character and attribute, in alternate bytes.
99
1010The attributes decode as follows :-
1111
1212   7-6-5-4-3-2-1-0
1313   f-u-F-F-F-B-B-B
14   
14
1515   f=flash
1616   u=underline
17   
17
1818   FFF = foreground colour
1919   BBB = bakcground colour
20     
20
2121      000   black
2222      001   red
2323      010   green
r1461r1462
2929
3030   If flash is true, foreground and background colours will be exchanged.
3131
32It is interesting to note that the 6845 uses 16 bit wide access to the ram, in contrast
33to the 8 bit accesses from the CPUs, this allows each increment of the MA lines to move
342 bytes at a time, and therefore feed both the character rom and the attribute decode
32It is interesting to note that the 6845 uses 16 bit wide access to the ram, in contrast
33to the 8 bit accesses from the CPUs, this allows each increment of the MA lines to move
342 bytes at a time, and therefore feed both the character rom and the attribute decode
3535circuit simultaniously.
3636
3737The RAM addresses are made up of two parts, the MA0..13 from the 6845, plus two output
38lines from the 6821 PIA, I28, the lines are BP6 and PB7, with PB7 being the most
38lines from the 6821 PIA, I28, the lines are BP6 and PB7, with PB7 being the most
3939significant. This effectivly allows the 6845 access to the first 128K of memory, as there
4040are 16 address lines, accessing a 16 bit wide memory.
4141
4242The relationship between how the cpu sees the RAM, and the way the 6845 sees it is simply
43CPU addr=2x6845 addr. So for the default video address of $1F000, the CPU sees this as
44being at $1F000 (after DAT trasnlation). The 6845 is programmed to start it's MA lines
43CPU addr=2x6845 addr. So for the default video address of $1F000, the CPU sees this as
44being at $1F000 (after DAT trasnlation). The 6845 is programmed to start it's MA lines
4545counting at $3800, plus A14 and A15 being supplied by PB6 and PB7 from I28, gives an address
4646of $F800, which is the same as $1F000 / 2.
4747
r1461r1462
6060      640   512   4
6161      640   256   4**
6262      640   512   2
63     
63
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
6666which is needed for some of the modes above (specifically, 640x512x4, which needs 80K).
6767
68682006-11-30, Text mode is almost completely implemented, in both 40 and 80 column modes.
6969I have made a start on implementing the graphics modes of the beta, drawing from technical
70documents, from the project, this is still a work in progress. I have however managed to get
70documents, from the project, this is still a work in progress. I have however managed to get
7171it to display a distorted graphical image, so I know I am going in the correct direction !
7272
73** 2006-12-05, this mode is not documented in any of the printed documentation, however it
74is supported and displayed by the graphics test rom, it is basically the 640x512x4 mode with
73** 2006-12-05, this mode is not documented in any of the printed documentation, however it
74is supported and displayed by the graphics test rom, it is basically the 640x512x4 mode with
7575half the number of vertical lines, and in non-interlaced mode.
7676
77It seems that the 640x512 modes operate the 6845 in interlaced mode, just how this affects
77It seems that the 640x512 modes operate the 6845 in interlaced mode, just how this affects
7878the access to the video memory is unclear to me at the moment.
7979
8080*/
r1461r1462
105105   V_TOTAL_ADJ,      // Vertical total adjust
106106   V_DISPLAYED,      // Vertical displayed
107107   V_SYNC_POS,      // Vertical sync pos
108   INTERLACE,      // Interlace
108   INTERLACE,      // Interlace
109109   MAX_SCAN,      // Maximum scan line
110110   CURS_START,      // Cursor start pos
111111   CURS_END,      // Cursor end pos
r1461r1462
207207
208208#define IsTextMode    (GCtrl & GCtrlChrGfx) ? 1 : 0               // Is this text mode ?
209209#define IsGfx16    ((~GCtrl & GCtrlChrGfx) && (~GCtrl & GCtrlControl)) ? 1 : 0   // is this 320x256x16bpp mode
210#define IsGfx2      ((GCtrl & GCtrlHiLo) && (~GCtrl & GCtrlFS)) ? 1 : 0      // Is this a 2 colour mode
210#define IsGfx2      ((GCtrl & GCtrlHiLo) && (~GCtrl & GCtrlFS)) ? 1 : 0      // Is this a 2 colour mode
211211#define SWChar      (GCtrl & GCtrlSWChar)>>1               // Swchar bit
212212
213213//static int beta_state;
r1461r1462
231231{
232232   GCtrl=data;
233233#ifdef MAME_DEBUG
234   if (LogRegWrites)
234   if (LogRegWrites)
235235      debug_console_printf("I28-PB=$%2X, %2X-%s-%s-%s-%s-%s-%s PC=%4X\n",
236236                 data,
237237                 data & GCtrlAddrLines,
r1461r1462
242242                 data & GCtrlSWChar      ? "C0" : "C1",
243243                 data & GCtrlWI      ? "Wi" : "  ",
244244                 activecpu_get_pc());
245     
246245
247#endif   
246
247#endif
248248}
249249
250250// called when the 6845 changes the character row
r1461r1462
257257static void beta_Set_HSync(int offset, int data)
258258{
259259   int Dots;    /* Pixels per 16 bits */
260   
260
261261   beta_HSync=data;
262   
262
263263   if(IsGfx16)
264264      Dots=2;
265265   else
266266      Dots=8;
267   
267
268268   if(!beta_HSync)
269269   {
270270      int HT=m6845_get_register(H_TOTAL);         // Get H total
271271      int HS=m6845_get_register(H_SYNC_POS);      // Get Hsync pos
272272      int HW=m6845_get_register(H_SYNC_WIDTH)&0xF;   // Hsync width (in chars)
273     
273
274274      beta_scr_y++;
275275//      beta_scr_x=0-(((HT-HS)-HW)*8);   // Number of dots after HS to wait before start of next line
276276      beta_scr_x=0-((HT-(HS+HW))*Dots);
277     
277
278278//debug_console_printf("HT=%d, HS=%d, HW=%d, (HS+HW)=%d, HT-(HS+HW)=%d\n",HT,HS,HW,(HS+HW),(HT-(HS+HW)));
279//debug_console_printf("Scanline=%d, row=%d\n",m6845_get_scanline_counter(),m6845_get_row_counter());     
279//debug_console_printf("Scanline=%d, row=%d\n",m6845_get_scanline_counter(),m6845_get_row_counter());
280280#ifdef MAME_DEBUG
281281      HSyncMin=beta_scr_x;
282282#endif
r1461r1462
296296         FlashCount=0;         // Reset counter
297297         FlashBit=(!FlashBit) & 0x01;   // Invert flash bit.
298298      }
299     
299
300300      if (DrawInterlace==INTERLACE_AT_VS)
301301      {
302302         DrawInterlace=INTERLACE_ON;
r1461r1462
311311      VSyncMin=beta_scr_y;
312312#endif
313313   }
314   
314
315315   dgn_beta_frame_interrupt(data);
316316}
317317
r1461r1462
319319{
320320   beta_DE = data;
321321
322#ifdef MAME_DEBUG   
322#ifdef MAME_DEBUG
323323   if(beta_DE)
324324      DEPos=beta_scr_x;
325#endif   
325#endif
326326}
327327
328328/* Video init */
r1461r1462
331331   /* initialise 6845 */
332332   m6845_config(&beta_m6845_interface);
333333   m6845_set_personality(M6845_PERSONALITY_HD6845S);
334   
334
335335   GCtrl=0;
336   
336
337337   videoram=mess_ram;
338338
339339   ClkMax=65000;
r1461r1462
342342   DoubleHL=1;         /* Default to normal height */
343343   DoubleY=1;
344344   DrawInterlace=INTERLACE_OFF;   /* No interlace by default */
345   
345
346346#ifdef MAME_DEBUG
347347   /* setup debug commands */
348348   if (Machine->debug_mode)
r1461r1462
380380   }
381381
382382   PlotY=y*2;
383   
383
384384   /* Error check, make sure we're drawing onm the actual bitmap ! */
385385   if (((PlotX+1)<bitmap->width) && ((PlotY+1)<bitmap->height))
386386   {
r1461r1462
390390      /* Plot characters twice as wide in 40 col mode */
391391      if(Double)
392392      {
393         *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+0)) = Colour;     
393         *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+0)) = Colour;
394394         *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+1)) = Colour;
395   
396         *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+0)) = Colour;     
395
396         *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+0)) = Colour;
397397         *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+1)) = Colour;
398398      }
399399      else
400400      {
401         *BITMAP_ADDR16(bitmap, (PlotY+0), PlotX) = Colour;   
402         *BITMAP_ADDR16(bitmap, (PlotY+1), PlotX) = Colour;   
401         *BITMAP_ADDR16(bitmap, (PlotY+0), PlotX) = Colour;
402         *BITMAP_ADDR16(bitmap, (PlotY+1), PlotX) = Colour;
403403      }
404404   }
405405}
r1461r1462
420420   int UnderLine;                     // Underline
421421   int FlashChar;                     // Flashing char
422422   int ULActive;                     // Underline active
423   
423
424424   bit=bitmap;
425     
425
426426   if (beta_DE)
427   {   
427   {
428428      /* The beta text RAM contains alternate character and attribute bytes */
429429      /* Top two address lines from PIA, IC28 PB6,7 */
430430      crtcAddr=m6845_memory_address_r(0)-1;
431431      Offset=(crtcAddr | ((GCtrl & GCtrlAddrLines)<<8))*2;
432      if (Offset<0)
432      if (Offset<0)
433433         Offset=0;
434     
434
435435      /* Get the character to display */
436436      char_code    = videoram[Offset];
437437
r1461r1462
440440      /* to indicate a double height character */
441441      UnderLine=(videoram[Offset+1] & 0x40) >> 6;
442442      FlashChar=(videoram[Offset+1] & 0x80) >> 7;
443     
443
444444      // underline is active for character set 0, on character row 9
445445      ULActive=(UnderLine && (beta_6845_RA==9) && ~SWChar);
446     
446
447447      /* If Character set one, and undeline set, latch double height */
448      DoubleY=(UnderLine & SWChar & DoubleHL) |
448      DoubleY=(UnderLine & SWChar & DoubleHL) |
449449              (SWChar & ~DoubleY & DoubleHL) |
450450         (SWChar & ~DoubleY & (beta_6845_RA==9));
451   
451
452452      /* Invert forground and background if flashing char and flash acive */
453453      Invert=(FlashChar & FlashBit);
454     
454
455455      /* Underline inverts flash */
456      if (ULActive)
456      if (ULActive)
457457         Invert=~Invert;
458458
459459      /* Cursor on also inverts */
460460      if (CursorOn)
461461         Invert=~Invert;
462     
462
463463      /* Invert colours if invert is true */
464464      if(!Invert)
465465      {
r1461r1462
471471         BgColour   = (videoram[Offset+1] & 0x38) >> 3;
472472         FgColour   = (videoram[Offset+1] & 0x07);
473473      }
474     
474
475475      /* The beta Character ROM has characters of 8x10, each aligned to a 16 byte boundry */
476476      data_byte = data[(char_code*16) + beta_6845_RA];
477477
r1461r1462
480480         if (data_byte & 0x080)
481481            plot_text_pixel(x,y,Dot,FgColour,CharsPerLine,bitmap);
482482         else
483            plot_text_pixel(x,y,Dot,BgColour,CharsPerLine,bitmap);     
484         
483            plot_text_pixel(x,y,Dot,BgColour,CharsPerLine,bitmap);
484
485485         data_byte = data_byte<<1;
486486      }
487487   }
r1461r1462
489489   {
490490      for (Dot=0; Dot<8; Dot++)
491491         plot_text_pixel(x,y,Dot,Background,CharsPerLine,bitmap);
492     
492
493493   }
494494
495495}
r1461r1462
506506   int   DoubleY      = (~m6845_get_register(INTERLACE) & 0x03) ? 1 : 0;
507507   int   PlotX;
508508   int   PlotY;
509   
510   if (DoubleX)
509
510   if (DoubleX)
511511      PlotX=(x+Dot)*2;
512512   else
513513      PlotX=x+Dot;
514   
514
515515   if(DoubleY)
516516      PlotY=(y)*2;
517517   else
518518      PlotY=y;
519     
519
520520   if(DrawInterlace==INTERLACE_ON)
521521   {
522522      PlotY=(y*2);//+Field;
r1461r1462
534534         *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+0)) = Colour;
535535         *BITMAP_ADDR16(bitmap, (PlotY+0), (PlotX+1)) = Colour;
536536      }
537     
537
538538      /* Plot pixels twice as high if in x256 modes */
539539      if (DoubleY)
540540      {
541         *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+0)) = Colour;     
541         *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+0)) = Colour;
542542         *BITMAP_ADDR16(bitmap, (PlotY+1), (PlotX+1)) = Colour;
543543      }
544     
544
545545      if (~(DoubleX | DoubleY))
546546      {
547         *BITMAP_ADDR16(bitmap, PlotY, PlotX) = Colour;           
547         *BITMAP_ADDR16(bitmap, PlotY, PlotX) = Colour;
548548      }
549549   }
550550}
r1461r1462
565565   int Lo;
566566   int Word;
567567   int Dots;   /* pixesls per byte */
568   
568
569569   /* We have to do this here so that it is correct for border and drawing area ! */
570570   if (IsGfx16)
571571      Dots=4;
572572   else if (IsGfx2)
573573      Dots=16;
574   else   
574   else
575575      Dots=8;
576   
576
577577   if (beta_DE)
578   {   
578   {
579579      /* Calculate address of graphics pixels */
580580      crtcAddr=(m6845_memory_address_r(0) & 0x1FFF);
581581      Addr=((crtcAddr<<3) | (beta_6845_RA & 0x07))*2;
582   
583      if(Addr<MinAddr)
582
583      if(Addr<MinAddr)
584584         MinAddr=Addr;
585585
586      if(Addr>MaxAddr)
586      if(Addr>MaxAddr)
587587         MaxAddr=Addr;
588588
589589      if(x>MaxX) MaxX=x;
r1461r1462
610610         for (Dot=0;Dot<Dots;Dot++)
611611         {
612612            plot_gfx_pixel(x,y,Dot,Colour,bitmap);
613           
613
614614            Intense   =Intense<<1;
615615            Red   =Red<<1;
616616            Green   =Green<<1;
r1461r1462
637637         {
638638            Colour=ColourRAM[((Word&0x8000)>>14) | ((Word&0x80)>>7)];
639639            plot_gfx_pixel(x,y,Dot,Colour,bitmap);
640     
640
641641            Hi=Word&0x8000;
642642            Word=((Word<<1)&0xFFFE) | (Hi>>15);
643643         }
644644      }
645     
645
646646    }
647647   else
648648   {
r1461r1462
655655
656656/* Update video screen, calls either text or graphics update routine as needed */
657657VIDEO_UPDATE( dgnbeta )
658{   
658{
659659   long c=0; // this is used to time out the screen redraw, in the case that the 6845 is in some way out state.
660   
660
661661   bit=bitmap;
662662
663663   c=0;
r1461r1462
685685         // check that we are on the emulated screen area.
686686         if ((beta_scr_x>=0) && (beta_scr_x<699) && (beta_scr_y>=0) && (beta_scr_y<549))
687687         {
688            if(IsTextMode)
688            if(IsTextMode)
689689               beta_plot_char_line(beta_scr_x, beta_scr_y, bitmap);
690690            else
691691               beta_plot_gfx_line(beta_scr_x, beta_scr_y, bitmap);
r1461r1462
716716}
717717
718718WRITE8_HANDLER(dgnbeta_6845_w)
719{   
719{
720720   if(offset&0x1)
721721   {
722722      m6845_register_w(offset,data);
723   
723
724724      if(VidAddr==INTERLACE)
725725      {
726726         DrawInterlace=(data & 0x03) ? INTERLACE_AT_VS : INTERLACE_OFF;
r1461r1462
732732      VidAddr=data;            /* Record reg being written to */
733733   }
734734#ifdef MAME_DEBUG
735   if (LogRegWrites)
735   if (LogRegWrites)
736736      RegLog(offset,data);
737737#endif
738738}
r1461r1462
762762{
763763   char   RegName[16];
764764
765   switch (VidAddr)
765   switch (VidAddr)
766766   {
767767      case H_TOTAL      : sprintf(RegName,"H Total      "); break;
768768      case H_DISPLAYED   : sprintf(RegName,"H Displayed  "); break;
r1461r1462
780780      case START_ADDR_L   : sprintf(RegName,"Start Addr L "); break;
781781      case CURS_H      : sprintf(RegName,"Cursor H     "); break;
782782      case CURS_L      : sprintf(RegName,"Cursor L     "); break;
783   }   
784   
783   }
784
785785   if(offset&0x1)
786786      debug_console_printf("6845 write Reg %s Addr=%3d Data=%3d ($%2.2X) \n",RegName,VidAddr,data,data);
787787}
r1461r1462
789789static void FillScreen(int ref, int params, const char *param[])
790790{
791791   int   x;
792   
792
793793   for(x=1;x<899;x++)
794794   {
795795      plot_box(bit, x, 1, 1, 698, x & 0x07);
r1461r1462
800800static void ScreenBox(int ref, int params, const char *param[])
801801{
802802   int   x,y;
803   
803
804804   if(params>0)   sscanf(param[0],"%d",&BoxMinX);
805805   if(params>1)   sscanf(param[1],"%d",&BoxMinY);
806806   if(params>2)   sscanf(param[2],"%d",&BoxMaxX);
807807   if(params>3)   sscanf(param[3],"%d",&BoxMaxY);
808808   if(params>4)   sscanf(param[4],"%d",&BoxColour);
809   
809
810810   for(x=BoxMinX;x<BoxMaxX;x++)
811811   {
812812      *BITMAP_ADDR16(bit, BoxMinY, x) = BoxColour;
r1461r1462
844844}
845845
846846static void SetClkMax(int ref, int params, const char *param[])
847{   
847{
848848   if(params>0)   sscanf(param[0],"%d",&ClkMax);
849849}
850850
src/mess/video/pc1401.c
r1461r1462
3737static const POCKETC_FIGURE   line={ /* simple line */
3838   "11111",
3939   "11111",
40   "11111e"
40   "11111e"
4141};
42static const POCKETC_FIGURE busy={
42static const POCKETC_FIGURE busy={
4343   "11  1 1  11 1 1",
4444   "1 1 1 1 1   1 1",
4545   "11  1 1  1  1 1",
4646   "1 1 1 1   1  1",
4747   "11   1  11   1e"
48}, def={
48}, def={
4949   "11  111 111",
5050   "1 1 1   1",
5151   "1 1 111 11",
5252   "1 1 1   1",
53   "11  111 1e"
53   "11  111 1e"
5454}, shift={
5555   " 11 1 1 1 111 111",
5656   "1   1 1 1 1    1",
5757   " 1  111 1 11   1",
5858   "  1 1 1 1 1    1",
59   "11  1 1 1 1    1e"
59   "11  1 1 1 1    1e"
6060}, hyp={
6161   "1 1 1 1 11",
6262   "1 1 1 1 1 1",
6363   "111 1 1 11",
6464   "1 1  1  1",
65   "1 1  1  1e"
65   "1 1  1  1e"
6666}, de={
6767   "11  111",
6868   "1 1 1",
r1461r1462
7474   "1",
7575   "1 1",
7676   "1 1",
77   " 11e"
77   " 11e"
7878}, rad={
7979   "11   1  11",
8080   "1 1 1 1 1 1",
r1461r1462
9898   "1",
9999   "111",
100100   "1",
101   "111e"
102}, run={
101   "111e"
102}, run={
103103   "11  1 1 1  1",
104104   "1 1 1 1 11 1",
105105   "11  1 1 1 11",
106106   "1 1 1 1 1  1",
107   "1 1  1  1  1e"
108}, pro={
107   "1 1  1  1  1e"
108}, pro={
109109   "11  11   1  ",
110110   "1 1 1 1 1 1",
111111   "11  11  1 1",
112112   "1   1 1 1 1",
113   "1   1 1  1e"
114}, japan={
113   "1   1 1  1e"
114}, japan={
115115   "  1  1  11   1  1  1",
116116   "  1 1 1 1 1 1 1 11 1",
117117   "  1 111 11  111 1 11",
118118   "1 1 1 1 1   1 1 1  1",
119   " 1  1 1 1   1 1 1  1e"
120}, sml={
119   " 1  1 1 1   1 1 1  1e"
120}, sml={
121121   " 11 1 1 1",
122122   "1   111 1",
123123   " 1  1 1 1",
124124   "  1 1 1 1",
125   "11  1 1 111e"
126}, rsv={
125   "11  1 1 111e"
126}, rsv={
127127   "11   11 1   1",
128128   "1 1 1   1   1",
129129   "11   1   1 1",
130130   "1 1   1  1 1",
131   "1 1 11    1e"
131   "1 1 11    1e"
132132};
133133
134134#define DOWN 57
r1461r1462
144144   /* HJB: we cannot initialize array with values from other arrays, thus... */
145145    color[0] = machine->pens[pocketc_colortable[CONTRAST][0]];
146146   color[1] = machine->pens[pocketc_colortable[CONTRAST][1]];
147   
147
148148    if (pc1401_portc&1) {
149149      for (x=RIGHT,y=DOWN,i=0; i<0x28;x+=2) {
150150         for (j=0; j<5;j++,i++,x+=2)
src/mess/video/apple2gs.c
r1461r1462
5252      if ((beamy < BORDER_TOP) || (beamy >= 200+BORDER_TOP))
5353      {
5454         // don't draw past the bottom border
55         if (beamy >= 231+BORDER_TOP)
55         if (beamy >= 231+BORDER_TOP)
5656         {
5757            return 0;
5858         }
r1461r1462
118118               scanline[col * 4 + 3 + BORDER_LEFT] = pixel;
119119            }
120120         }
121      }     
121      }
122122   }
123123   else
124124   {
src/mess/video/hp48.c
r1461r1462
7979   int j, xi=0;
8080   for (j=0; figure[j]; j++) {
8181      switch (figure[j]) {
82      case '1':
82      case '1':
8383         *BITMAP_ADDR16(bitmap, y, x+xi) = color;
8484         xi++;
8585         break;
86      case ' ':
86      case ' ':
8787         xi++;
8888         break;
8989      case '\r':
9090         xi=0;
9191         y++;
92         break;           
92         break;
9393      };
9494   }
9595}
r1461r1462
9797
9898#define LCD_LINES (hp48_hardware.data[0x28]|((hp48_hardware.data[0x29]&3)<<4)
9999
100static const char *hp48_orange={
100static const char *hp48_orange={
101101   "11111111111\r"
102102   "111 1111111\r"
103103   "11  1111111\r"
r1461r1462
172172
173173   for (y=0,i=LCD_BASE_ADDRESS; y<64; y+=8, i+=LCD_LINE_OFFSET) {
174174      for (x=0; x<131; x++) {
175         drawgfx(bitmap, machine->gfx[0],
175         drawgfx(bitmap, machine->gfx[0],
176176               program_read_byte(i+x),
177177               contrast,0,0,
178178               x*2+RIGHT,y*2+DOWN,
src/mess/video/i82720.c
r1461r1462
55
66   Per Ola Ingvarsson
77   Tomas Karlsson
8         
8
99 ******************************************************************************/
1010
1111/*-------------------------------------------------------------------------*/
r1461r1462
3636#define GDC_LOG_CMD_3(x,y,z) (logerror(x,y,z))
3737#define GDC_LOG_CMD_4(x,y,z,a) (logerror(x,y,z,a))
3838#else
39#define GDC_LOG_CMD_1(x)     
40#define GDC_LOG_CMD_2(x,y)   
39#define GDC_LOG_CMD_1(x)
40#define GDC_LOG_CMD_2(x,y)
4141#define GDC_LOG_CMD_3(x,y,z)
42#define GDC_LOG_CMD_4(x,y,z,a)
42#define GDC_LOG_CMD_4(x,y,z,a)
4343#endif
4444
4545/* FIFO */
r1461r1462
4848   UINT8   data[16];         /* The data of the fifo               */
4949   UINT8   cmd_flags[16];      /* 0 for params 1 for commands        */
5050   UINT8   direction;         /* Direction flag (R=1/W=0)           */
51   UINT8 write_pos;        /* Position for next write operation  */                           
51   UINT8 write_pos;        /* Position for next write operation  */
5252   UINT8 read_pos;         /* Position for next read operation   */
5353   UINT8 count;            /* The number of entries in the fifo  */
5454   UINT8 nbr_cmds;         /* The number of commands in the fifo */
r1461r1462
235235      gdcp->fifo.direction = GDC_FIFO_DIR_WRITE;
236236   }
237237   gdc_fifo_enqueue(gdcp, data, cmdflag);
238   
238
239239}
240240
241241/*-------------------------------------------------------------------------*/
r1461r1462
334334}
335335
336336static UINT32 gdc_get_base_addr(TYP_GDC* gdcp)
337{ 
337{
338338  int i;
339339  UINT32 ret_val = 0;
340340  int shift_amount = 0;
r1461r1462
350350
351351
352352static UINT32 gdc_partition_length(TYP_GDC* gdcp)
353{ 
353{
354354   /* Get a byte and put it into a temp */
355355   UINT32 pram_byte_low = gdcp->pram[2] >> 4;
356356   UINT32 pram_byte_high = gdcp->pram[3] & 0x3f;
r1461r1462
379379
380380INLINE void gdc_write(UINT32 address,
381381               UINT16 data)
382{   
382{
383383   gdc_mess.vram[address % gdc_mess.vramsize] = data;
384384}
385385
r1461r1462
455455                         UINT8  operation)
456456{
457457   gdc_write_data(data, gdc.registers.display.mask, operation);
458   
458
459459   gdc_mess.dirty = 1;
460460   gdc_update_ead_and_mask();
461461}
r1461r1462
464464{
465465   /* Save address */
466466   UINT32 address = gdc.registers.display.ead;
467   
467
468468   return gdc_mess.vram[address & gdc_mess.vramsize] & mask;
469469}
470470
471471static UINT16 gdc_auto_read_data(void)
472472{
473   UINT16 ret_val = gdc_read_data(gdc.registers.display.mask);   
473   UINT16 ret_val = gdc_read_data(gdc.registers.display.mask);
474474   /* Update the ead and mask */
475475   gdc_update_ead_and_mask();
476476   return ret_val;
r1461r1462
532532
533533   if ( i == 0 )
534534      return;
535   
536   /* Update display mode */   
535
536   /* Update display mode */
537537   reg = (gdc.registers.command.sync[0] & 0x20) ? 0x02 : 0;
538538   reg += (gdc.registers.command.sync[0] & 0x02) ? 0x01 : 0;
539539   gdc.registers.display.display_mode = reg;
540   
540
541541   GDC_LOG_CMD_2("gdc_cmd_sync: mode byte = %02X\n",
542542                 gdc.registers.command.sync[0]);
543543   GDC_LOG_CMD_2("gdc_cmd_sync: mode is %s\n", gdc_disp_mode_to_str(reg));
544   
545544
545
546546   if ( i == 1 )
547547      return;
548   
548
549549   /* Update words per line */
550550   reg = gdc.registers.command.sync[1] & 0xfe;
551551   /* The register contains the number of lines - 2 */
552552   gdc.registers.display.words_per_line = reg + 2;
553553   gdc.registers.display.display_width =  reg + 2;
554   
554
555555   GDC_LOG_CMD_2("gdc_cmd_sync: words_per_line set to %d\n",
556556                 gdc.registers.display.words_per_line);
557557   GDC_LOG_CMD_2("gdc_cmd_sync: display_width set to %d\n",
r1461r1462
594594
595595   if ( i == 6 )
596596      return;
597   
597
598598   /* Low bits of active display lines per video field */
599599   reg16 = gdc.registers.command.sync[6];
600600
r1461r1462
607607
608608   gdc.registers.display.vert_back_porch =
609609      gdc.registers.command.sync[7] >> 2;
610   
610
611611   gdc_dump_disp_regs();
612612}
613613
r1461r1462
665665   int i,k,x;
666666   char tmp_str[9];
667667   UINT8 tmpParam[16];
668   UINT32 base_addr_before = gdc_get_base_addr(&gdc); 
669   /* Upside down */   
668   UINT32 base_addr_before = gdc_get_base_addr(&gdc);
669   /* Upside down */
670670   k = 0;
671671   while ( (param_p = gdc_fifo_dequeue_param(&gdc)) != NULL ) {
672672      /* This is for printing */
r1461r1462
706706   UINT8 temp_reg;
707707   UINT8* param_p;
708708   TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display;
709   
709
710710   if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
711711   /* Cursor on or off */
712712   dispregs->disp_cursor = (*param_p & 0x80) != 0;
r1461r1462
736736                 dispregs->cursor_blink_rate);
737737   GDC_LOG_CMD_2("gdc_cmd_cchar: Cursor bottom line = %d\n",
738738                 dispregs->cursor_bottom_line);
739   
740   
739
740
741741}
742742
743743/*-------------------------------------------------------------------------*/
r1461r1462
758758   dispregs->figs_d1_param = 0xff;
759759   dispregs->figs_dm_param = 0xff;
760760
761   
761
762762   if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
763763   /* What will be done next time? */
764764   dispregs->figs_operation = (*param_p & 0xf1) >> 3;
r1461r1462
770770      if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
771771      temp_reg = *param_p;
772772      if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) != NULL ) {
773         temp_reg |= (*param_p & 0x3f) << 8;         
773         temp_reg |= (*param_p & 0x3f) << 8;
774774      } else {
775775         quit = 1;
776776      }
r1461r1462
787787         case 3:
788788            dispregs->figs_d1_param = temp_reg;
789789            break;
790         case 4:           
790         case 4:
791791            dispregs->figs_dm_param = temp_reg;
792792            break;
793793      }
r1461r1462
807807   UINT8* param_p;
808808   UINT16 temp_reg;
809809   TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display;
810   
810
811811   if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
812812   temp_reg = *param_p;
813813   if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
r1461r1462
825825   UINT8* param_p;
826826   UINT32 temp_reg;
827827   TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display;
828   
828
829829   if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
830830   temp_reg = *param_p;
831831   dispregs->ead = temp_reg;
r1461r1462
860860   TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display;
861861
862862   dispregs->cur_mod = command & 0x03;
863   
863
864864   /* Seems like there can be many parameters to the WDAT and that
865865      dc is only used for the first set */
866866   for ( ;; ) { /* Use up all parameters */
867867      UINT16 orig_mask = gdc.registers.display.mask;
868868      /* Low byte */
869869      if ( ( param_p = gdc_fifo_dequeue_param(&gdc)) == NULL ) return;
870     
870
871871      temp_reg = *param_p;
872     
872
873873      /* FIXME: Check type of transfer. There can be bytes or words */
874874      /* One optional high byte */
875875      switch(command & 0x18) {
r1461r1462
895895         case 0x18:
896896            /* FIXME: Bor bara anvanda en byte i detta fallet */
897897            /* FIXME: Save the mask */
898            gdc.registers.display.mask &= 0xff00;
898            gdc.registers.display.mask &= 0xff00;
899899            temp_reg = ( (temp_reg  & 0xff ) << 8);
900900            break;
901901         default:
902902            return;
903903      }
904     
904
905905      GDC_LOG_CMD_4("gdc_cmd_wdat: data = %04X, dc = %02X, mod = %x",
906906                    temp_reg, dispregs->figs_dc_param, dispregs->cur_mod);
907907      GDC_LOG_CMD_3(" mask = %04X, transfer = %02X\n", dispregs->mask,
r1461r1462
914914/*              temp_reg = 0x0000; */
915915/*           } */
916916/*        } */
917     
917
918918      for ( i=0; i < dispregs->figs_dc_param + 1; ++i ) {
919         gdc_auto_write_data(temp_reg,
919         gdc_auto_write_data(temp_reg,
920920                             dispregs->cur_mod);
921921      }
922922      gdc.registers.display.mask = orig_mask;
923923      /* Now dc should be zero for the other parameters */
924924      dispregs->figs_dc_param = 0;
925925   }
926   
926
927927}
928928
929929/*-------------------------------------------------------------------------*/
r1461r1462
936936   /* FIXME: Check in-parameter too */
937937   int i;
938938   for ( i=0; i < (dispregs->figs_dc_param); ++i ) {
939      UINT16 data = gdc_auto_read_data();     
939      UINT16 data = gdc_auto_read_data();
940940      gdc_fifo_add_from_inside(&gdc, data & 0xff, 0);
941941      gdc_fifo_add_from_inside(&gdc, (data >> 8) & 0xff, 0);
942942   }
r1461r1462
966966   int row;
967967   int bitnbr;
968968   UINT16 writeWord;
969   
969
970970   TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display;
971971   /* This will only work if the character is 8 by 8 and direction is
972972      2 and it may not even work then */
973973   UINT16 saved_mask = dispregs->mask;
974   UINT32 saved_ead = dispregs->ead;   
974   UINT32 saved_ead = dispregs->ead;
975975   for ( row = 0; row < 8;  ++row ) {
976976      int zy;
977977      for ( zy = 0; zy < dispregs->zoom_gchr; ++zy ) {
r1461r1462
979979         dispregs->ead = saved_ead -
980980             (dispregs->zoom_gchr*row+zy) * dispregs->words_per_line;
981981         GDC_LOG_CMD_2("gdc_cmd_gchrd: pram : %1x\n", gdc.pram[15-row]);
982         /* Reset pixel mask (x) */         
982         /* Reset pixel mask (x) */
983983         dispregs->mask = saved_mask;
984984         for ( bitnbr = 0; bitnbr < 8; ++bitnbr ) {
985            int zx;           
985            int zx;
986986            for ( zx = 0; zx < dispregs->zoom_gchr; ++zx ) {
987987               UINT16 bit = (gdc.pram[15-row] >> bitnbr) & 0x01;
988988               writeWord = bit ? 0xffff : 0x0000;
r1461r1462
990990                  ((~dispregs->mask) & gdc_mess.vram[dispregs->ead]);
991991               /* The mode is set by wdat */
992992               gdc_write_data(writeWord, 0xffff, dispregs->cur_mod);
993                             
993
994994               if ( dispregs->mask & 0x8000 ) {
995995                  dispregs->ead++;
996996               }
r1461r1462
10041004   }
10051005   // Back up 8 lines
10061006   dispregs->ead = saved_ead -
1007                   dispregs->words_per_line * 8 * dispregs->zoom_gchr;
1008   dispregs->mask = saved_mask; 
1007                   dispregs->words_per_line * 8 * dispregs->zoom_gchr;
1008   dispregs->mask = saved_mask;
10091009   gdc_mess.dirty = 1;
10101010}
10111011
r1461r1462
10511051         GDC_LOG_CMD_1("gdc_command: CCHAR\n");
10521052         gdc_cmd_cchar();
10531053         break;
1054         
1054
10551055      /* Display control commands */
10561056      case CMD_START:      /* Ends idle mode and unblanks the display */
10571057         GDC_LOG_CMD_1("gdc_command: START\n");
r1461r1462
10611061      case CMD_BCTRL_OFF:   /* Controls the blanking and unblanking of the display */
10621062         GDC_LOG_CMD_1("gdc_command: BCTRL_OFF\n");
10631063         break;
1064         
1064
10651065      case CMD_BCTRL_ON:   /* Controls the blanking and unblanking of the display */
10661066         GDC_LOG_CMD_1("gdc_command: BCTRL_ON\n");
10671067         break;
1068         
1068
10691069         /* Specifies zoom factors for the display and graphics characters writing */
10701070      case CMD_ZOOM:
10711071         GDC_LOG_CMD_1("gdc_command: ZOOM\n");
10721072         gdc_cmd_zoom();
10731073         break;
1074         
1075         
1074
1075
10761076      case CMD_CURS:
10771077          /* Sets the position of the cursor in display memory */
10781078         GDC_LOG_CMD_1("gdc_command: CURS\n");
10791079         gdc_cmd_curs();
10801080         break;
10811081
1082      case CMD_PITCH:     
1082      case CMD_PITCH:
10831083          /* Specifies the width of the X dimension of the display memory */
10841084          GDC_LOG_CMD_1("gdc_command: PITCH\n");
10851085          gdc_cmd_pitch();
10861086          break;
1087         
1087
10881088      /* Drawing control commands */
10891089
10901090      case CMD_MASK:      /* Sets the MASK register contents */
10911091         GDC_LOG_CMD_1("gdc_command: MASK\n");
10921092         gdc_cmd_mask();
10931093         break;
1094         
1094
10951095      case CMD_FIGS:      /* Specifies the parameters for the drawing processor */
10961096         GDC_LOG_CMD_1("gdc_command: FIGS\n");
10971097         gdc_cmd_figs();
r1461r1462
11161116         GDC_LOG_CMD_1("gdc_command: LPRD\n");
11171117         gdc_cmd_lprd();
11181118         break;
1119   
1119
11201120      default:
1121         
1121
11221122         /* Display control commands */
11231123         if ((command & CMD_PRAM_BITMASK) == CMD_PRAM_BITMASK)
11241124         {
r1461r1462
11321132            switch(command & 0xe4)
11331133            {
11341134               /* Drawing control commands */
1135   
1135
11361136               case CMD_WDAT_BITMASK:
11371137                  /* Writes data words or bytes into display memory */
11381138                  GDC_LOG_CMD_1("gdc_command: WDAT\n");
11391139                  gdc_cmd_wdat(command);
11401140                  break;
1141               
1141
11421142               /* Memory data read commands */
1143               
1143
11441144               case CMD_RDAT_BITMASK:   /* Reads data words or bytes from display */
11451145                  GDC_LOG_CMD_1("gdc_command: RDAT\n");
11461146                  gdc_cmd_rdat(command);
11471147                  break;
1148   
1148
11491149               /* Data control commands */
1150         
1150
11511151               case CMD_DMAR_BITMASK:   /* Requests a DMA read transfer */
11521152                  GDC_LOG_CMD_1("gdc_command: DMAR\n");
11531153                  break;
1154   
1154
11551155               case CMD_DMAW_BITMASK:   /* Requests a DMA write transfer */
11561156                  GDC_LOG_CMD_1("gdc_command: DMAW\n");
11571157                  break;
1158   
1158
11591159               default:
11601160                  logerror("GDC Unknown Command %04X\n", command);
1161                 
1161
11621162                  break;
11631163            }
11641164         }
r1461r1462
12051205      case CMD_CCHAR:
12061206      case CMD_CURS:
12071207         return 3;
1208      case CMD_RESET:     
1209      case CMD_SYNC_OFF:   
1210      case CMD_SYNC_ON:     
1208      case CMD_RESET:
1209      case CMD_SYNC_OFF:
1210      case CMD_SYNC_ON:
12111211         return 8;
12121212      case CMD_FIGS:
12131213         return 11;
1214      default:         
1214      default:
12151215         if ((command & CMD_PRAM_BITMASK) == CMD_PRAM_BITMASK) {
12161216            return 16; /* XXX */
12171217         } else {
r1461r1462
12391239/*-------------------------------------------------------------------------*/
12401240WRITE16_HANDLER ( compis_gdc_w )
12411241{
1242   /* FIXME: Move to better place. Must be signed and larger than 8 bits */ 
1242   /* FIXME: Move to better place. Must be signed and larger than 8 bits */
12431243   static INT16 last_command = -1;
12441244   /* FIXME: Move to better place */
12451245   static int nbr_expected_params = 17;
1246   
1246
12471247   switch (offset)
12481248   {
12491249      case 0x00:   /* Parameter into FIFO */
r1461r1462
12661266      case 0x01:   /* Command into FIFO */
12671267         if (LOG_PORTS)
12681268            logerror("GDC Port %04X (CMD) Write %02X\n", offset, data);
1269         
1269
12701270         if ( last_command >= 0 ) {
12711271            /* If there is a command in the fifo we can process that one now */
1272            /* Later we should add a counter for the params too */               
1272            /* Later we should add a counter for the params too */
12731273            gdc_command_processor(last_command & 0xff);
12741274         }
1275         
1275
12761276         /* Check if it is a command without parameters, if so process it now */
12771277         if ( gdc_nbr_expected_params(data) == 0 ) {
12781278            GDC_LOG_CMD_1("GDC: Command takes zero parameters\n");
r1461r1462
12821282            /* Save the command */
12831283            last_command = data;
12841284            nbr_expected_params = gdc_nbr_expected_params(data);
1285         }         
1285         }
12861286         break;
12871287
12881288      default:
r1461r1462
13001300READ16_HANDLER (compis_gdc_r)
13011301{
13021302   UINT16 data;
1303   
1303
13041304   data = 0xff;
1305   
1305
13061306   switch(offset & 0x07) {
13071307      case 0x00:   /* Status register */
1308         
1308
13091309         GDC_LOG_CMD_3("%04X: GDC Port %04X (Status) Read",
13101310                       activecpu_get_pc(), offset);
13111311         /* Optimize this later, i.e. when we know what to return */
r1461r1462
13191319         break;
13201320
13211321      case 0x01:   /* FIFO Read */
1322         
1322
13231323         GDC_LOG_CMD_3("%04X: GDC Port %04X (Fifo) Read",
13241324                       activecpu_get_pc(),
13251325                       offset);
r1461r1462
14431443   /* TODO - copy only the dirty parts of the memory to the bitmap */
14441444   /* Or plot stuff in write-functions until scrolling occurs */
14451445   dirty = gdc_mess.dirty;
1446   if (dirty)
1446   if (dirty)
14471447   {
14481448/*      TYP_GDC_REGS_DISPLAY* dispregs = &gdc.registers.display; */
14491449      UINT32 base_addr = gdc_get_base_addr(&gdc);
src/mess/video/dai.c
r1461r1462
101101                  10 - sixteen colour graphics
102102                   11 - sixteen colour characters */
103103   UINT8 unit_mode;
104     
104
105105   UINT8 current_data_1, current_data_2;
106106
107107   UINT8 current_colour;
r1461r1462
766766            break;
767767         }
768768         break;
769      }     
769      }
770770      current_scan_line += line_repeat_count*2+2;
771771      LOG_DAI_VIDEO_LINE(display_mode, unit_mode, horizontal_resolution, line_repeat_count, current_scan_line);
772772   }
src/mess/video/nc.c
r1461r1462
8686      height = NC_SCREEN_HEIGHT;
8787      width = NC_SCREEN_WIDTH;
8888      pens[0] = machine->pens[2];
89      pens[1] = machine->pens[3];   
89      pens[1] = machine->pens[3];
9090   }
9191
9292
r1461r1462
113113         }
114114
115115         x = px;
116                     
116
117117         line_ptr = line_ptr+1;
118118      }
119119   }
src/mess/video/mac.c
r1461r1462
11/***************************************************************************
22
33   video/mac.c
4   
4
55   Macintosh video hardware
66
77   Emulates the video hardware for compact Macintosh series (original
src/mess/video/i82720.h
r1461r1462
55   Video driver for the Intel 82720 and NEC uPD7220 GDC.
66   Per Ola Ingvarsson
77   Tomas Karlsson
8   
8
99 ******************************************************************************/
10
10
1111#include "driver.h"
1212
1313#define COMPIS_PALETTE_SIZE           16
r1461r1462
3535*/
3636typedef enum
3737{
38   GDC_MODE_HRG,     
38   GDC_MODE_HRG,
3939   GDC_MODE_UHRG
4040} compis_gdc_modes;
4141
src/mess/video/cirrus.c
r1461r1462
2828
2929
3030
31               
31
3232   GC 09h:         Set 64k bank (bits 3-0 only)
3333   GC 20h:         Blit Width (bits 7-0)
3434   GC 21h:         Blit Width (bits 12-8)
src/mess/video/pc1350.c
r1461r1462
44#include "includes/pocketc.h"
55#include "includes/pc1350.h"
66
7static const POCKETC_FIGURE busy={
7static const POCKETC_FIGURE busy={
88   "11  1 1  11 1 1",
99   "1 1 1 1 1   1 1",
1010   "11  1 1  1  1 1",
1111   "1 1 1 1   1  1",
1212   "11   1  11   1e"
13}, def={
13}, def={
1414   "11  111 111",
1515   "1 1 1   1",
1616   "1 1 111 11",
1717   "1 1 1   1",
18   "11  111 1e"
18   "11  111 1e"
1919}, shift={
2020   " 11 1 1 1 111 111",
2121   "1   1 1 1 1    1",
2222   " 1  111 1 11   1",
2323   "  1 1 1 1 1    1",
24   "11  1 1 1 1    1e"
24   "11  1 1 1 1    1e"
2525}, hyp={
2626   "1 1 1 1 11",
2727   "1 1 1 1 1 1",
2828   "111 1 1 11",
2929   "1 1  1  1",
30   "1 1  1  1e"
30   "1 1  1  1e"
3131}, de={
3232   "11  111",
3333   "1 1 1",
r1461r1462
3939   "1",
4040   "1 1",
4141   "1 1",
42   " 11e"
42   " 11e"
4343}, rad={
4444   "11   1  11",
4545   "1 1 1 1 1 1",
r1461r1462
6363   "1",
6464   "111",
6565   "1",
66   "111e"
67}, run={
66   "111e"
67}, run={
6868   "11  1 1 1  1",
6969   "1 1 1 1 11 1",
7070   "11  1 1 1 11",
7171   "1 1 1 1 1  1",
72   "1 1  1  1  1e"
73}, pro={
72   "1 1  1  1  1e"
73}, pro={
7474   "11  11   1  ",
7575   "1 1 1 1 1 1",
7676   "11  11  1 1",
7777   "1   1 1 1 1",
78   "1   1 1  1e"
79}, japan={
78   "1   1 1  1e"
79}, japan={
8080   "  1  1  11   1  1  1",
8181   "  1 1 1 1 1 1 1 11 1",
8282   "  1 111 11  111 1 11",
8383   "1 1 1 1 1   1 1 1  1",
84   " 1  1 1 1   1 1 1  1e"
85}, sml={
84   " 1  1 1 1   1 1 1  1e"
85}, sml={
8686   " 11 1 1 1",
8787   "1   111 1",
8888   " 1  1 1 1",
8989   "  1 1 1 1",
90   "11  1 1 111e"
91}, rsv={
90   "11  1 1 111e"
91}, rsv={
9292   "11   11 1   1",
9393   "1 1 1   1   1",
9494   "11   1   1 1",
9595   "1 1   1  1 1",
96   "1 1 11    1e"
96   "1 1 11    1e"
9797};
9898
9999static struct {
r1461r1462
135135{
136136   int x, y, i, j, k, b;
137137   int color[2];
138   
138
139139   bitmap_fill(bitmap, cliprect, 5);
140   
140
141141   /* HJB: we cannot initialize array with values from other arrays, thus... */
142142    color[0] = machine->pens[pocketc_colortable[PC1350_CONTRAST][0]];
143143   color[1] = machine->pens[pocketc_colortable[PC1350_CONTRAST][1]];
src/mess/video/coco.c
r1461r1462
55   driver by Nathan Woods
66
77   See mess/machine/coco.c for references
8
8
99   TODO: Determine how the CoCo 2B (which used the M6847T1 was hooked up
1010   to the M6847T1 chip to generate its text video modes.  My best guess is as
1111   follows:
r1461r1462
7070
7171   memset(&cfg, 0, sizeof(cfg));
7272   cfg.type = type;
73   
73
7474   /* NPW 14-May-2006 - Ugly hack; using CPU timing factor seems to break some
7575    * Dragon games */
7676   if (Machine->gamedrv->name[0] == 'c')
src/mess/video/gb.c
r1461r1462
10701070};
10711071
10721072static const UINT8 cgb_oam_fingerprint[0x100] = {
1073   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1074   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1075   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10761073   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1077   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1078   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1079   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10801074   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1081   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1082   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1075   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1076   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1077   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1078   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1079   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1080   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1081   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1082   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10831083   0x74, 0xFF, 0x09, 0x00, 0x9D, 0x61, 0xA8, 0x28, 0x36, 0x1E, 0x58, 0xAA, 0x75, 0x74, 0xA1, 0x42,
10841084   0x05, 0x96, 0x40, 0x09, 0x41, 0x02, 0x60, 0x00, 0x1F, 0x11, 0x22, 0xBC, 0x31, 0x52, 0x22, 0x54,
10851085   0x22, 0xA9, 0xC4, 0x00, 0x1D, 0xAD, 0x80, 0x0C, 0x5D, 0xFA, 0x51, 0x92, 0x93, 0x98, 0xA4, 0x04,
r1461r1462
10911091/*
10921092  For an AGS in CGB mode this data is:
10931093static const UINT8 abs_oam_fingerprint[0x100] = {
1094   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1095   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10961094   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1097   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1098   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1099   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1100   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11011095   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1102   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1103   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1096   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1097   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1098   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1099   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1100   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1101   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1102   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1103   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11041104   0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
11051105   0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
11061106   0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
r1461r1462
11401140   gb_vram = new_memory_region( Machine, REGION_GFX1, vram_size, 0 );
11411141   gb_oam = new_memory_region( Machine, REGION_GFX2, 0x100, 0 );
11421142   memset( gb_vram, 0, vram_size );
1143
1143
11441144   gb_vram_ptr = gb_vram;
11451145   gb_chrgen = gb_vram;
11461146   gb_bgdtab = gb_vram + 0x1C00;
r1461r1462
13561356            /* Internally switch to mode 2 */
13571357            gb_lcd.mode = 2;
13581358            /* Generate lcd interrupt if requested */
1359            if ( ! gb_lcd.mode_irq && ( LCDSTAT & 0x20 ) &&
1359            if ( ! gb_lcd.mode_irq && ( LCDSTAT & 0x20 ) &&
13601360                ( ( ! gb_lcd.triggering_line_irq && ! gb_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) {
13611361               gb_lcd.mode_irq = 1;
13621362               cpunum_set_input_line( 0, LCD_INT, HOLD_LINE );
src/mess/video/z88.c
r1461r1462
33  z88.c
44
55  Functions to emulate the video hardware of the Acorn Z88
6 
6
77***************************************************************************/
88
99#include "driver.h"
r1461r1462
182182            if (byte1 & Z88_SCR_HW_REV)
183183            {
184184            pen1 = machine->pens[0];
185           
185
186186            if (byte1 & Z88_SCR_HW_GRY)
187187            {
188188               pen0 = machine->pens[2];
r1461r1462
193193            }
194194            }
195195            else
196                {       
196                {
197197            pen0 = machine->pens[0];
198198            if (byte1 & Z88_SCR_HW_GRY)
199199            {
r1461r1462
273273      }
274274
275275      stored_ptr+=256;
276   }     
276   }
277277   return 0;
278278}
src/mess/video/pc_vga.c
r1461r1462
2222   (oti 037 chip)
2323    ROM_LOAD("oakvga.bin", 0xc0000, 0x8000, 0x318c5f43)
2424   (tseng labs famous et4000 isa vga card (oem))
25    ROM_LOAD("et4000b.bin", 0xc0000, 0x8000, 0xa903540d)   
25    ROM_LOAD("et4000b.bin", 0xc0000, 0x8000, 0xa903540d)
2626   (tseng labs famous et4000 isa vga card)
2727    ROM_LOAD("et4000.bin", 0xc0000, 0x8000, 0xf01e4be0)
2828
r1461r1462
643643            memory_install_write64_handler(0, ADDRESS_SPACE_PROGRAM, 0xa0000, 0xbffff, 0, 0, MWA64_BANK1 );
644644         }
645645         break;
646         
646
647647      default:
648648         fatalerror("VGA:  Bus width %d not supported\n", buswidth);
649649         break;
r1461r1462
677677         if (diff%columns<vga.monitor.get_sync_columns()) data|=1;
678678      }
679679#elif 1
680      if (vga.monitor.retrace)
680      if (vga.monitor.retrace)
681681      {
682682         data |= 1;
683683         if (attotime_compare(attotime_sub(timer_get_time(), vga.monitor.start_time), ATTOTIME_IN_USEC(300)) > 0)
r1461r1462
685685            data |= 8;
686686            vga.monitor.retrace=0;
687687         }
688      }
689      else
688      }
689      else
690690      {
691691         if (attotime_compare(attotime_sub(timer_get_time(), vga.monitor.start_time), ATTOTIME_IN_MSEC(15)) > 0)
692692            vga.monitor.retrace=1;
r1461r1462
943943      {
944944         vga.sequencer.data[vga.sequencer.index] = data;
945945         vga_cpu_interface();
946   
946
947947         if (vga.sequencer.index == 0)
948948            vga.monitor.start_time = timer_get_time();
949949      }
r1461r1462
11631163         memory_install_write64_handler(0, vga.vga_intf.port_addressspace, vga.vga_intf.port_offset + 0x3c0, vga.vga_intf.port_offset + 0x3cf, 0, 0, vga_port64be_03c0_w );
11641164         memory_install_write64_handler(0, vga.vga_intf.port_addressspace, vga.vga_intf.port_offset + 0x3d0, vga.vga_intf.port_offset + 0x3df, 0, 0, vga_port64be_03d0_w );
11651165         break;
1166   }     
1166   }
11671167
11681168   pc_vga_reset();
11691169}
r1461r1462
13201320{
13211321   int pos, line, column, c, addr, curr_addr;
13221322   UINT16 *bitmapline;
1323   
1323
13241324   curr_addr = 0;
13251325   if(vga.sequencer.data[4] & 0x08)
13261326   {
src/mess/video/pc_vga.h
r1461r1462
102102  ROM_LOAD("oakvga.bin", 0xc0000, 0x8000, CRC(318c5f43))
103103*/
104104#if 0
105        int i;
105        int i;
106106        UINT8 *memory=memory_region(REGION_CPU1)+0xc0000;
107107        UINT8 chksum;
108108
src/mess/video/epnick.h
r1461r1462
2626     ( ( (x & (1<<4)) >>4) <<1) | \
2727     ( ( (x & (1<<7)) >>7) <<0) \
2828   )<<5)
29
29
3030/* given a colour index in range 0..255 gives the Red component */
3131#define NICK_GET_BLUE8(x) \
3232   (( \
r1461r1462
7878#define   NICK_2_COLOUR_MODE   0
7979#define   NICK_4_COLOUR_MODE   1
8080#define   NICK_16_COLOUR_MODE   2
81#define   NICK_256_COLOUR_MODE   3   
81#define   NICK_256_COLOUR_MODE   3
8282
8383/* Display mode types */
8484#define   NICK_VSYNC_MODE   0
src/mess/video/i82720cm.h
r1461r1462
55
66   Per Ola Ingvarsson
77   Tomas Karlsson
8         
8
99 ******************************************************************************/
1010
1111enum I82720_GDC_COMMANDS
r1461r1462
1717   CMD_VSYNC_SLAVE    = 0x6e,   /* Selects slave video synchronization mode */
1818   CMD_VSYNC_MASTER = 0x6f,   /* Selects master video synchronization mode */
1919   CMD_CCHAR    = 0x4b,   /* Specifies the cursor and character row heights */
20                           
20
2121   /* Display control commands */
2222   CMD_START    = 0x6b,   /* Ends idle mode and unblanks the display */
2323   CMD_BCTRL_OFF    = 0x0c,   /* Controls the blanking and unblanking of the display */
r1461r1462
2626   CMD_CURS    = 0x49,   /* Sets the position of the cursor in display memory */
2727   CMD_PRAM_BITMASK = 0x70,   /* Defines starting addresses and lengths of the display areas and specifies the eight bytes for the graphics character */
2828   CMD_PITCH    = 0x47,   /* Specifies the width of the X dimension of the display memory */
29   
29
3030   /* Drawing control commands */
3131   CMD_WDAT_BITMASK = 0x20,   /* Writes data words or bytes into display memory */
3232   CMD_MASK    = 0x4a,   /* Sets the MASK register contents */
r1461r1462
3838   CMD_RDAT_BITMASK = 0xa0,   /* Reads data words or bytes from display */
3939   CMD_CURD    = 0xe0,   /* Reads the cursor position */
4040   CMD_LPRD    = 0xc0,   /* Reads the light pen address */
41   
41
4242   /* Data control commands */
4343   CMD_DMAR_BITMASK = 0xa4,   /* Requests a DMA read transfer */
4444   CMD_DMAW_BITMASK = 0x24      /* Requests a DMA write transfer */
src/mess/video/vectrex.c
r1461r1462
3636{
3737   v_via_pa_r, v_via_pb_r,         /* read PA/B */
3838   0, 0, 0, 0,                     /* read ca1, cb1, ca2, cb2 */
39   v_via_pa_w, v_via_pb_w,         /* write PA/B */
39   v_via_pa_w, v_via_pb_w,         /* write PA/B */
4040   0, 0, v_via_ca2_w, v_via_cb2_w, /* write ca1, cb1, ca2, cb2 */
4141   v_via_irq,                      /* IRQ */
4242};
r1461r1462
147147         lightpen_down=0;
148148         color=0x00ffffff;
149149      }
150     
150
151151      pen_x = readinputport(8)*(x_max/0xff);
152152      pen_y = readinputport(7)*(y_max/0xff);
153153
r1461r1462
157157      vector_add_point(pen_x-250000,pen_y+250000,color,0xff);
158158   }
159159   else
160      lightpen_down=0;   
160      lightpen_down=0;
161161}
162162
163163/*********************************************************************
r1461r1462
311311             * off when the beam reaches the pen. Exact
312312             * timing is important here.
313313             *
314             *    lightpen
314             *    lightpen
315315             *       ^
316316             *  _   /|
317317             *  b  / |
r1461r1462
418418      {
419419         /* RAMP inactive */
420420         /* This generates a dot (here we take the dwell time into account) */
421         
421
422422         if (data)
423423            vectrex_dot();
424424      }
425425      else
426426      {
427         /* RAMP active
427         /* RAMP active
428428          * Take MAX because RAMP is slower than BLANK
429429          */
430430         time_now = MAX(attotime_to_double(timer_get_time()),start_time);
src/mess/video/m6847.c
r1461r1462
1010
1111
1212   AG  AS  INTEXT  INV  GM2  GM1  GM0
13   --  --  ------  ---  ---  ---  ---   
13   --  --  ------  ---  ---  ---  ---
1414    0   0       0    0    X    X    X   Internal Alphanumerics
1515    0   0       0    1    X    X    X   Internal Alphanumerics Inverted
1616    0   0       1    0    X    X    X   External Alphanumerics
r1461r1462
164164
165165static const UINT8 pal_round_fontdata8x12[] =
166166{
167   0x00, 0x00, 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00, 0x00, 0x00,
168   0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, 0x00,
169   0x00, 0x00, 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00,
170   0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
171   0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00,
172   0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
173   0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
174   0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00, 0x00, 0x00,
175   0x00, 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
176   0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
177   0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
178   0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00,
179   0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
180   0x00, 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
181   0x00, 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00,
182   0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
183   0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
184   0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00,
185   0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00,
186   0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
187   0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
188   0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
189   0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00,
190   0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00, 0x00, 0x00,
191   0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00,
192   0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
193   0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00,
194   0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00,
195   0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00,
196   0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00,
197   0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
198   0x00, 0x00, 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00,
199   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
200   0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
201   0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
202   0x00, 0x00, 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, 0x00,
203   0x00, 0x00, 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00, 0x00,
204   0x00, 0x00, 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00, 0x00, 0x00,
205   0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00,
206   0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
207   0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
208   0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
209   0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00,
210   0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
211   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00,
212   0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
214   0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00,
215   0x00, 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00,
216   0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
217   0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
218   0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
219   0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00,
220   0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
221   0x00, 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
222   0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00,
223   0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
224   0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00,
225   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
226   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00,
227   0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
228   0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
229   0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
230   0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
167   0x00, 0x00, 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00, 0x00, 0x00,
168   0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, 0x00,
169   0x00, 0x00, 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00,
170   0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
171   0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00,
172   0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
173   0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
174   0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00, 0x00, 0x00,
175   0x00, 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
176   0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
177   0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
178   0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00,
179   0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
180   0x00, 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
181   0x00, 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00,
182   0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
183   0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
184   0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00,
185   0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00,
186   0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
187   0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
188   0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
189   0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00,
190   0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00, 0x00, 0x00,
191   0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00,
192   0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
193   0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00,
194   0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00,
195   0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00,
196   0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00,
197   0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
198   0x00, 0x00, 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00,
199   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
200   0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
201   0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
202   0x00, 0x00, 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, 0x00,
203   0x00, 0x00, 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00, 0x00,
204   0x00, 0x00, 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00, 0x00, 0x00,
205   0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00,
206   0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
207   0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
208   0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
209   0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00,
210   0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
211   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00,
212   0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
214   0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00,
215   0x00, 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00,
216   0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
217   0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
218   0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
219   0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00,
220   0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
221   0x00, 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
222   0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00,
223   0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
224   0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00,
225   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
226   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00,
227   0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
228   0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
229   0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
230   0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
231231
232232   /* Lower case */
233   0x00, 0x00, 0x18, 0x24, 0x20, 0x70, 0x20, 0x24, 0x78, 0x00, 0x00, 0x00,
234   0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, 0x00,
235   0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, 0x00, 0x00,
236   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
237   0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00,
238   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00, 0x00, 0x00,
239   0x00, 0x00, 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
240   0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x04, 0x38, 0x00,
241   0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
242   0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
243   0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00,
244   0x00, 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, 0x00,
245   0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
246   0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00,
247   0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
248   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
249   0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00,
250   0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00,
251   0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
252   0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00,
253   0x00, 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00,
254   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00,
255   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00,
256   0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, 0x00,
257   0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00,
258   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00,
259   0x00, 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x00,
260   0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00,
261   0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
262   0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00,
263   0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00,
233   0x00, 0x00, 0x18, 0x24, 0x20, 0x70, 0x20, 0x24, 0x78, 0x00, 0x00, 0x00,
234   0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, 0x00,
235   0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, 0x00, 0x00,
236   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
237   0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00,
238   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00, 0x00, 0x00,
239   0x00, 0x00, 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
240   0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x04, 0x38, 0x00,
241   0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
242   0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
243   0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00,
244   0x00, 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, 0x00,
245   0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
246   0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00,
247   0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
248   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
249   0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00,
250   0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00,
251   0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
252   0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00,
253   0x00, 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00,
254   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00,
255   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00,
256   0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, 0x00,
257   0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00,
258   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00,
259   0x00, 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x00,
260   0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00,
261   0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
262   0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00,
263   0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00,
265265
266266   /* Semigraphics 6 */
267   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
269   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
270   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
271   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
272   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
273   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
274   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
275   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
276   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
277   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
278   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
279   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
280   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
281   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
282   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
283   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
284   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
285   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
286   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
287   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
288   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
289   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
290   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
291   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
292   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
293   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
294   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
295   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
296   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
297   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
298   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
299   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
300   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
301   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
302   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
303   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
304   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
305   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
306   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
307   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
308   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
309   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
310   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
311   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
312   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
313   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
314   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
315   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
317   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
318   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
319   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
320   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
321   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
322   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
323   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
324   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
325   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
326   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
327   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
328   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
329   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
330   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
267   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
269   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
270   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
271   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
272   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
273   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
274   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
275   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
276   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
277   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
278   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
279   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
280   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
281   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
282   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
283   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
284   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
285   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
286   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
287   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
288   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
289   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
290   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
291   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
292   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
293   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
294   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
295   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
296   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
297   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
298   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
299   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
300   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
301   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
302   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
303   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
304   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
305   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
306   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
307   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
308   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
309   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
310   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
311   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
312   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
313   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
314   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
315   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
317   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
318   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
319   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
320   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
321   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
322   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
323   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
324   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
325   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
326   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
327   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
328   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
329   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
330   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
331331
332332   /* Block Graphics (Semigraphics 4 Graphics ) */
333   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
334   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
335   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
336   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
337   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
338   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
339   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
340   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
341   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
343   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
344   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
345   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
347   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
348   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
333   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
334   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
335   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
336   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
337   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
338   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
339   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
340   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
341   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
343   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
344   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
345   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
347   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
348   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
349349};
350350
351351
352352
353353static const UINT8 pal_square_fontdata8x12[] =
354354{
355   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C, 0x00, 0x00,
356   0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, 0x00,
357   0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x1C, 0x12, 0x12, 0x3C, 0x00, 0x00,
358   0x00, 0x00, 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C, 0x00, 0x00,
359   0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x12, 0x12, 0x12, 0x3C, 0x00, 0x00,
360   0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x3E, 0x00, 0x00,
361   0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00,
362   0x00, 0x00, 0x00, 0x1E, 0x20, 0x20, 0x26, 0x22, 0x22, 0x1E, 0x00, 0x00,
363   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22, 0x00, 0x00,
364   0x00, 0x00, 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00,
365   0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x22, 0x22, 0x1C, 0x00, 0x00,
366   0x00, 0x00, 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x00, 0x00,
367   0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00,
368   0x00, 0x00, 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x00, 0x00,
369   0x00, 0x00, 0x00, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00,
370   0x00, 0x00, 0x00, 0x3E, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3E, 0x00, 0x00,
371   0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00,
372   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A, 0x00, 0x00,
373   0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00,
374   0x00, 0x00, 0x00, 0x1C, 0x22, 0x10, 0x08, 0x04, 0x22, 0x1C, 0x00, 0x00,
375   0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
376   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x00,
377   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00,
378   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x36, 0x22, 0x00, 0x00,
379   0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22, 0x00, 0x00,
380   0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
381   0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E, 0x00, 0x00,
382   0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00,
383   0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00,
384   0x00, 0x00, 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E, 0x00, 0x00,
385   0x00, 0x00, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
386   0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, 0x00, 0x00,
387   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
388   0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
389   0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390   0x00, 0x00, 0x00, 0x14, 0x14, 0x36, 0x00, 0x36, 0x14, 0x14, 0x00, 0x00,
391   0x00, 0x00, 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 0x00, 0x00,
392   0x00, 0x00, 0x00, 0x32, 0x32, 0x04, 0x08, 0x10, 0x26, 0x26, 0x00, 0x00,
393   0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2A, 0x24, 0x1A, 0x00, 0x00,
394   0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395   0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00,
396   0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00, 0x00,
397   0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00,
398   0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00,
399   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00,
400   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
401   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00,
402   0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
403   0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
404   0x00, 0x00, 0x00, 0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00,
405   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1C, 0x20, 0x20, 0x3E, 0x00, 0x00,
406   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x0C, 0x02, 0x22, 0x1C, 0x00, 0x00,
407   0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x3E, 0x04, 0x04, 0x04, 0x00, 0x00,
408   0x00, 0x00, 0x00, 0x3E, 0x20, 0x3C, 0x02, 0x02, 0x22, 0x1C, 0x00, 0x00,
409   0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x1C, 0x00, 0x00,
410   0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
411   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00,
412   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x1C, 0x00, 0x00,
413   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
414   0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00,
415   0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00,
416   0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00,
417   0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00,
418   0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
355   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C, 0x00, 0x00,
356   0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, 0x00,
357   0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x1C, 0x12, 0x12, 0x3C, 0x00, 0x00,
358   0x00, 0x00, 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C, 0x00, 0x00,
359   0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x12, 0x12, 0x12, 0x3C, 0x00, 0x00,
360   0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x3E, 0x00, 0x00,
361   0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00,
362   0x00, 0x00, 0x00, 0x1E, 0x20, 0x20, 0x26, 0x22, 0x22, 0x1E, 0x00, 0x00,
363   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22, 0x00, 0x00,
364   0x00, 0x00, 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00,
365   0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x22, 0x22, 0x1C, 0x00, 0x00,
366   0x00, 0x00, 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x00, 0x00,
367   0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00,
368   0x00, 0x00, 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x00, 0x00,
369   0x00, 0x00, 0x00, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00,
370   0x00, 0x00, 0x00, 0x3E, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3E, 0x00, 0x00,
371   0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00,
372   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A, 0x00, 0x00,
373   0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00,
374   0x00, 0x00, 0x00, 0x1C, 0x22, 0x10, 0x08, 0x04, 0x22, 0x1C, 0x00, 0x00,
375   0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
376   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x00,
377   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00,
378   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x36, 0x22, 0x00, 0x00,
379   0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22, 0x00, 0x00,
380   0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
381   0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E, 0x00, 0x00,
382   0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00,
383   0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00,
384   0x00, 0x00, 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E, 0x00, 0x00,
385   0x00, 0x00, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
386   0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, 0x00, 0x00,
387   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
388   0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
389   0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390   0x00, 0x00, 0x00, 0x14, 0x14, 0x36, 0x00, 0x36, 0x14, 0x14, 0x00, 0x00,
391   0x00, 0x00, 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 0x00, 0x00,
392   0x00, 0x00, 0x00, 0x32, 0x32, 0x04, 0x08, 0x10, 0x26, 0x26, 0x00, 0x00,
393   0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2A, 0x24, 0x1A, 0x00, 0x00,
394   0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395   0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00,
396   0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00, 0x00,
397   0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00,
398   0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00,
399   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00,
400   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
401   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00,
402   0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
403   0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
404   0x00, 0x00, 0x00, 0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00,
405   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1C, 0x20, 0x20, 0x3E, 0x00, 0x00,
406   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x0C, 0x02, 0x22, 0x1C, 0x00, 0x00,
407   0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x3E, 0x04, 0x04, 0x04, 0x00, 0x00,
408   0x00, 0x00, 0x00, 0x3E, 0x20, 0x3C, 0x02, 0x02, 0x22, 0x1C, 0x00, 0x00,
409   0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x1C, 0x00, 0x00,
410   0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
411   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00,
412   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x1C, 0x00, 0x00,
413   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
414   0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00,
415   0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00,
416   0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00,
417   0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00,
418   0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
419419
420420   /* Lower case */
421   0x00, 0x00, 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x12, 0x3C, 0x00, 0x00,
422   0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, 0x00,
421   0x00, 0x00, 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x12, 0x3C, 0x00, 0x00,
422   0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, 0x00,
423423   0x00, 0x00, 0x00, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x22, 0x3C, 0x00, 0x00,
424424   0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x20, 0x1C, 0x00, 0x00,
425425   0x00, 0x00, 0x00, 0x02, 0x02, 0x1E, 0x22, 0x22, 0x22, 0x1E, 0x00, 0x00,
r1461r1462
540540
541541static const UINT8 ntsc_round_fontdata8x12[] =
542542{
543   0x00, 0x00, 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00, 0x00, 0x00,
544   0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, 0x00,
545   0x00, 0x00, 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00,
546   0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
547   0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00,
548   0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
549   0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
550   0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00, 0x00, 0x00,
551   0x00, 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
552   0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
553   0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
554   0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00,
555   0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
556   0x00, 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
557   0x00, 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00,
558   0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
559   0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
560   0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00,
561   0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00,
562   0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
563   0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
564   0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
565   0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00,
566   0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00, 0x00, 0x00,
567   0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00,
568   0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
569   0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00,
570   0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00,
571   0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00,
572   0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00,
573   0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
574   0x00, 0x00, 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00,
575   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
576   0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
577   0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
578   0x00, 0x00, 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, 0x00,
579   0x00, 0x00, 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00, 0x00,
580   0x00, 0x00, 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00, 0x00, 0x00,
581   0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00,
582   0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
583   0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
584   0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
585   0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00,
586   0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
587   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00,
588   0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
589   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
590   0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00,
591   0x00, 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00,
592   0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
593   0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
594   0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
595   0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00,
596   0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
597   0x00, 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
598   0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00,
599   0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
600   0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00,
601   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
602   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00,
603   0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
604   0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
605   0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
606   0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
543   0x00, 0x00, 0x38, 0x44, 0x04, 0x34, 0x4C, 0x4C, 0x38, 0x00, 0x00, 0x00,
544   0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00, 0x00,
545   0x00, 0x00, 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00,
546   0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
547   0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x00, 0x00,
548   0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
549   0x00, 0x00, 0x7C, 0x40, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
550   0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x4C, 0x44, 0x38, 0x00, 0x00, 0x00,
551   0x00, 0x00, 0x44, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
552   0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
553   0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
554   0x00, 0x00, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00,
555   0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
556   0x00, 0x00, 0x44, 0x6C, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
557   0x00, 0x00, 0x44, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x00,
558   0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
559   0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
560   0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00,
561   0x00, 0x00, 0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x00, 0x00, 0x00,
562   0x00, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
563   0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
564   0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
565   0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00,
566   0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x54, 0x6C, 0x44, 0x00, 0x00, 0x00,
567   0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0x00, 0x00, 0x00,
568   0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
569   0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x00,
570   0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00,
571   0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00,
572   0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00,
573   0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
574   0x00, 0x00, 0x00, 0x10, 0x20, 0x7C, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00,
575   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
576   0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
577   0x00, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
578   0x00, 0x00, 0x28, 0x28, 0x7C, 0x28, 0x7C, 0x28, 0x28, 0x00, 0x00, 0x00,
579   0x00, 0x00, 0x10, 0x3C, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x00, 0x00,
580   0x00, 0x00, 0x60, 0x64, 0x08, 0x10, 0x20, 0x4C, 0x0C, 0x00, 0x00, 0x00,
581   0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x00,
582   0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
583   0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
584   0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
585   0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00,
586   0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
587   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00,
588   0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
589   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
590   0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00,
591   0x00, 0x00, 0x38, 0x44, 0x4C, 0x54, 0x64, 0x44, 0x38, 0x00, 0x00, 0x00,
592   0x00, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
593   0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x40, 0x40, 0x7C, 0x00, 0x00, 0x00,
594   0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
595   0x00, 0x00, 0x08, 0x18, 0x28, 0x48, 0x7C, 0x08, 0x08, 0x00, 0x00, 0x00,
596   0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
597   0x00, 0x00, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
598   0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00,
599   0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
600   0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00,
601   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
602   0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00,
603   0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00,
604   0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
605   0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
606   0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
607607
608608   /* Lower case */
609   0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
610   0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, 0x00,
611   0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, 0x00, 0x00,
612   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
613   0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00,
614   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00, 0x00, 0x00,
615   0x00, 0x00, 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
616   0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x04, 0x38, 0x00,
617   0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
618   0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
619   0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00,
620   0x00, 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, 0x00,
621   0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
622   0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00,
623   0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
624   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
625   0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00,
626   0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00,
627   0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
628   0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00,
629   0x00, 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00,
630   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00,
631   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00,
632   0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, 0x00,
633   0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00,
634   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00,
635   0x00, 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x00,
636   0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00,
637   0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
638   0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00,
639   0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
640   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00,
609   0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
610   0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x3C, 0x44, 0x3C, 0x00, 0x00, 0x00,
611   0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, 0x00, 0x00,
612   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
613   0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00,
614   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x38, 0x00, 0x00, 0x00,
615   0x00, 0x00, 0x08, 0x14, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
616   0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x44, 0x4C, 0x34, 0x04, 0x38, 0x00,
617   0x00, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
618   0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
619   0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00,
620   0x00, 0x00, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, 0x00, 0x00,
621   0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00,
622   0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00,
623   0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00,
624   0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
625   0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00,
626   0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00,
627   0x00, 0x00, 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
628   0x00, 0x00, 0x00, 0x00, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00, 0x00,
629   0x00, 0x00, 0x20, 0x20, 0x70, 0x20, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00,
630   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x4C, 0x34, 0x00, 0x00, 0x00,
631   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00,
632   0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00, 0x00,
633   0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00,
634   0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00,
635   0x00, 0x00, 0x00, 0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x00,
636   0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00,
637   0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
638   0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00,
639   0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
640   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00,
641641
642642   /* Semigraphics 6 */
643   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
644   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
645   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
646   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
647   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
648   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
649   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
650   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
651   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
652   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
653   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
654   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
655   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
656   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
657   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
658   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
659   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
660   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
661   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
662   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
663   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
664   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
665   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
666   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
667   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
668   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
669   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
670   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
671   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
672   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
673   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
674   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
675   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
676   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
677   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
678   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
679   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
680   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
681   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
682   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
683   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
684   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
685   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
686   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
687   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
688   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
689   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
690   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
691   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
692   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
693   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
694   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
695   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
696   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
697   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
698   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
699   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
700   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
701   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
702   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
703   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
704   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
705   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
706   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
643   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
644   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
645   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
646   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
647   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
648   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
649   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
650   0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
651   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
652   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
653   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
654   0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
655   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
656   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
657   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
658   0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
659   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
660   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
661   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
662   0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
663   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
664   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
665   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
666   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
667   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
668   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
669   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
670   0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
671   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
672   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
673   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
674   0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
675   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
676   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
677   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
678   0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
679   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
680   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
681   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
682   0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
683   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
684   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
685   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
686   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
687   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
688   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
689   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
690   0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
691   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
692   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
693   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
694   0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
695   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
696   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
697   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
698   0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF,
699   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
700   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
701   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
702   0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF,
703   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
704   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F,
705   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0,
706   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
707707
708708   /* Block Graphics (Semigraphics 4 Graphics ) */
709   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
710   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
711   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
712   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
713   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
714   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
715   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
716   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
717   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
718   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
719   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
720   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
721   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
722   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
723   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
724   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
709   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
710   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
711   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
712   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
713   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
714   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
715   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
716   0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
717   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
718   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
719   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
720   0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
721   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
722   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
723   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
724   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
725725};
726726
727727
728728
729729static const UINT8 ntsc_square_fontdata8x12[] =
730730{
731   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C, 0x00, 0x00,
732   0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, 0x00,
733   0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x1C, 0x12, 0x12, 0x3C, 0x00, 0x00,
734   0x00, 0x00, 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C, 0x00, 0x00,
735   0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x12, 0x12, 0x12, 0x3C, 0x00, 0x00,
736   0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x38, 0x20, 0x20, 0x3E, 0x00, 0x00,
737   0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x38, 0x20, 0x20, 0x20, 0x00, 0x00,
738   0x00, 0x00, 0x00, 0x1E, 0x20, 0x20, 0x26, 0x22, 0x22, 0x1E, 0x00, 0x00,
739   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22, 0x00, 0x00,
740   0x00, 0x00, 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00,
741   0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x22, 0x22, 0x1C, 0x00, 0x00,
742   0x00, 0x00, 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x00, 0x00,
743   0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00,
744   0x00, 0x00, 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x00, 0x00,
745   0x00, 0x00, 0x00, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00,
746   0x00, 0x00, 0x00, 0x3E, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3E, 0x00, 0x00,
747   0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00,
748   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A, 0x00, 0x00,
749   0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00,
750   0x00, 0x00, 0x00, 0x1C, 0x22, 0x10, 0x08, 0x04, 0x22, 0x1C, 0x00, 0x00,
751   0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
752   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x00,
753   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00,
754   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x36, 0x22, 0x00, 0x00,
755   0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22, 0x00, 0x00,
756   0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
757   0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E, 0x00, 0x00,
758   0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00,
759   0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00,
760   0x00, 0x00, 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E, 0x00, 0x00,
761   0x00, 0x00, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
762   0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, 0x00, 0x00,
763   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
764   0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
765   0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
766   0x00, 0x00, 0x00, 0x14, 0x14, 0x36, 0x00, 0x36, 0x14, 0x14, 0x00, 0x00,
767   0x00, 0x00, 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 0x00, 0x00,
768   0x00, 0x00, 0x00, 0x32, 0x32, 0x04, 0x08, 0x10, 0x26, 0x26, 0x00, 0x00,
769   0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2A, 0x24, 0x1A, 0x00, 0x00,
770   0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
771   0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00,
772   0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00, 0x00,
773   0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00,
774   0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00,
775   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00,
776   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
777   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00,
778   0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
779   0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
780   0x00, 0x00, 0x00, 0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00,
781   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1C, 0x20, 0x20, 0x3E, 0x00, 0x00,
782   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x04, 0x02, 0x22, 0x1C, 0x00, 0x00,
783   0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x3E, 0x04, 0x04, 0x04, 0x00, 0x00,
784   0x00, 0x00, 0x00, 0x3E, 0x20, 0x3C, 0x02, 0x02, 0x22, 0x1C, 0x00, 0x00,
785   0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x1C, 0x00, 0x00,
786   0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
787   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00,
788   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x1C, 0x00, 0x00,
789   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
790   0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00,
791   0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00,
792   0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00,
793   0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00,
794   0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
731   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C, 0x00, 0x00,
732   0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x00, 0x00,
733   0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x1C, 0x12, 0x12, 0x3C, 0x00, 0x00,
734   0x00, 0x00, 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C, 0x00, 0x00,
735   0x00, 0x00, 0x00, 0x3C, 0x12, 0x12, 0x12, 0x12, 0x12, 0x3C, 0x00, 0x00,
736   0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x38, 0x20, 0x20, 0x3E, 0x00, 0x00,
737   0x00, 0x00, 0x00, 0x3E, 0x20, 0x20, 0x38, 0x20, 0x20, 0x20, 0x00, 0x00,
738   0x00, 0x00, 0x00, 0x1E, 0x20, 0x20, 0x26, 0x22, 0x22, 0x1E, 0x00, 0x00,
739   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22, 0x00, 0x00,
740   0x00, 0x00, 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00,
741   0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x22, 0x22, 0x1C, 0x00, 0x00,
742   0x00, 0x00, 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22, 0x00, 0x00,
743   0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E, 0x00, 0x00,
744   0x00, 0x00, 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x00, 0x00,
745   0x00, 0x00, 0x00, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00,
746   0x00, 0x00, 0x00, 0x3E, 0x22, 0x22, 0x22, 0x22, 0x22, 0x3E, 0x00, 0x00,
747   0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20, 0x00, 0x00,
748   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A, 0x00, 0x00,
749   0x00, 0x00, 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22, 0x00, 0x00,
750   0x00, 0x00, 0x00, 0x1C, 0x22, 0x10, 0x08, 0x04, 0x22, 0x1C, 0x00, 0x00,
751   0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
752   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C, 0x00, 0x00,
753   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00,
754   0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x36, 0x22, 0x00, 0x00,
755   0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22, 0x00, 0x00,
756   0x00, 0x00, 0x00, 0x22, 0x22, 0x14, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
757   0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E, 0x00, 0x00,
758   0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00,
759   0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00,
760   0x00, 0x00, 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E, 0x00, 0x00,
761   0x00, 0x00, 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
762   0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x3E, 0x10, 0x08, 0x00, 0x00, 0x00,
763   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
764   0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
765   0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
766   0x00, 0x00, 0x00, 0x14, 0x14, 0x36, 0x00, 0x36, 0x14, 0x14, 0x00, 0x00,
767   0x00, 0x00, 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 0x00, 0x00,
768   0x00, 0x00, 0x00, 0x32, 0x32, 0x04, 0x08, 0x10, 0x26, 0x26, 0x00, 0x00,
769   0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2A, 0x24, 0x1A, 0x00, 0x00,
770   0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
771   0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00,
772   0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08, 0x00, 0x00,
773   0x00, 0x00, 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00,
774   0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x00, 0x00,
775   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00,
776   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
777   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00,
778   0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
779   0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
780   0x00, 0x00, 0x00, 0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x1C, 0x00, 0x00,
781   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x1C, 0x20, 0x20, 0x3E, 0x00, 0x00,
782   0x00, 0x00, 0x00, 0x1C, 0x22, 0x02, 0x04, 0x02, 0x22, 0x1C, 0x00, 0x00,
783   0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x3E, 0x04, 0x04, 0x04, 0x00, 0x00,
784   0x00, 0x00, 0x00, 0x3E, 0x20, 0x3C, 0x02, 0x02, 0x22, 0x1C, 0x00, 0x00,
785   0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x1C, 0x00, 0x00,
786   0x00, 0x00, 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x00, 0x00,
787   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00,
788   0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x1C, 0x00, 0x00,
789   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
790   0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00,
791   0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00,
792   0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00,
793   0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00,
794   0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00,
795795
796796   /* Lower case */
797   0x00, 0x00, 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x12, 0x3C, 0x00, 0x00,
798   0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, 0x00,
797   0x00, 0x00, 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x12, 0x3C, 0x00, 0x00,
798   0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, 0x00,
799799   0x00, 0x00, 0x00, 0x20, 0x20, 0x3C, 0x22, 0x22, 0x22, 0x3C, 0x00, 0x00,
800800   0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x20, 0x20, 0x1C, 0x00, 0x00,
801801   0x00, 0x00, 0x00, 0x02, 0x02, 0x1E, 0x22, 0x22, 0x22, 0x1E, 0x00, 0x00,
r1461r1462
948948   M6847_RGB(0x00, 0xff, 0x00),   /* GREEN */
949949   M6847_RGB(0x00, 0x00, 0x00),   /* BLACK */
950950   M6847_RGB(0xff, 0xff, 0xff),   /* BUFF */
951   
951
952952   M6847_RGB(0x00, 0x40, 0x00),   /* ALPHANUMERIC DARK GREEN */
953953   M6847_RGB(0x00, 0xff, 0x00),   /* ALPHANUMERIC BRIGHT GREEN */
954954   M6847_RGB(0x40, 0x10, 0x00),   /* ALPHANUMERIC DARK ORANGE */
r1461r1462
10481048static int attr_index_from_attribute(UINT8 attr)
10491049{
10501050   int result;
1051   
1051
10521052   result = ((attr & (M6847_AG | M6847_AS | M6847_INTEXT | M6847_INV | M6847_CSS)) >> 3)
10531053      | ((attr & (M6847_GM1 | M6847_GM0)) << 5);
10541054
r1461r1462
18321832   m6847->new_frame_callback = cfg->new_frame_callback;
18331833   m6847->custom_prepare_scanline = cfg->custom_prepare_scanline;
18341834   m6847->has_lowercase = v->has_lowercase;
1835   
1835
18361836   /* assert our assumptions */
18371837   assert((v->scanlines_per_frame * FACTOR_SCANLINES_PER_FRAME)
18381838      == (UINT32) (v->scanlines_per_frame * FACTOR_SCANLINES_PER_FRAME));
src/mess/video/thomson.c
r1461r1462
7070   UINT8 p = readinputport( THOM_INPUT_VCONFIG );
7171   int new_w, new_h, changed = 0;
7272
73   switch ( p & 3 )
73   switch ( p & 3 )
7474   {
7575   case 0:  thom_bwidth = 56; thom_bheight = 47; break; /* as in original (?) */
7676   case 1:  thom_bwidth = 16; thom_bheight = 16; break; /* small */
7777   default: thom_bwidth =  0; thom_bheight =  0; break; /* none */
7878   }
7979
80   switch ( p & 0xc )
80   switch ( p & 0xc )
8181   {
8282   case 0:  thom_hires = 0; break;                 /* low */
8383   case 4:  thom_hires = 1; break;                 /* high */
r1461r1462
8686
8787   new_w = ( 320 + thom_bwidth * 2 ) * ( thom_hires + 1 ) - 1;
8888   new_h = ( 200 + thom_bheight * 2 ) /** (thom_hires + 1 )*/ - 1;
89   if ( ( Machine->screen[0].visarea.max_x != new_w ) || ( Machine->screen[0].visarea.max_y != new_h ) )
89   if ( ( Machine->screen[0].visarea.max_x != new_w ) || ( Machine->screen[0].visarea.max_y != new_h ) )
9090   {
9191      changed = 1;
9292      video_screen_set_visarea( 0, 0, new_w, 0, new_h );
r1461r1462
113113   unsigned u;
114114   attotime elapsed = timer_timeelapsed( thom_video_timer );
115115   u = attotime_mul( elapsed, 1000000 ).seconds;
116   if ( u >= 19968 )
116   if ( u >= 19968 )
117117      u = 19968;
118118   return u;
119119}
r1461r1462
124124{
125125   struct thom_vsignal v;
126126   int gpl = thom_video_elapsed() - 64 * THOM_BORDER_HEIGHT - 7;
127   if ( gpl < 0 )
127   if ( gpl < 0 )
128128      gpl += 19968;
129129
130130   v.inil = ( gpl & 63 ) <= 40;
r1461r1462
151151   *x = readinputport( THOM_INPUT_LIGHTPEN     );
152152   *y = readinputport( THOM_INPUT_LIGHTPEN + 1 );
153153
154   if ( *x < 0 )
154   if ( *x < 0 )
155155      *x = 0;
156156
157   if ( *y < 0 )
157   if ( *y < 0 )
158158      *y = 0;
159159
160   if ( *x > 2 * thom_bwidth  + 319 )
160   if ( *x > 2 * thom_bwidth  + 319 )
161161      *x = 2 * thom_bwidth  + 319;
162162
163   if ( *y > 2 * thom_bheight + 199 )
163   if ( *y > 2 * thom_bheight + 199 )
164164      *y = 2 * thom_bheight + 199;
165165}
166166
r1461r1462
177177   y += ydec - thom_bheight;
178178
179179   gpl = (x >> 3) + y * 64;
180   if ( gpl < 0 )
180   if ( gpl < 0 )
181181      gpl += 19968;
182 
182
183183   v.inil = (gpl & 63) <= 41;
184184
185185   v.init = (gpl <= 64 * THOM_ACTIVE_HEIGHT - 24);
186186
187   v.lt3 = ( gpl & 8 ) ? 1 : 0;
187   v.lt3 = ( gpl & 8 ) ? 1 : 0;
188188
189189   v.line = y;
190190
191191   if ( v.inil && v.init )
192      v.count =
192      v.count =
193193         ( gpl >> 6 ) * 320 +  /* line */
194194         ( gpl & 63 ) *   8 +  /* gpl inside line */
195195         ( (x + xdec2) & 7 );  /* pixel inside gpl */
196   else
196   else
197197      v.count = 0;
198198
199199   return v;
r1461r1462
225225{
226226   int step = param;
227227
228   if ( thom_lightpen_cb )
228   if ( thom_lightpen_cb )
229229      thom_lightpen_cb( step );
230230
231231   if ( step < thom_lightpen_nb )
r1461r1462
239239/* This code, common for all Thomson machines, emulates the TO8
240240   video hardware, with its 16-colors chosen among 4096, 9 video modes,
241241   and 4 video pages. Moreover, it emulates changing the palette several times
242   per frame to simulate more than 16 colors per frame (and the same for mode
242   per frame to simulate more than 16 colors per frame (and the same for mode
243243   and page switchs) and cooper effects (distinguishing the left and right
244244   border color of each row).
245245
r1461r1462
265265static UINT8  thom_pal_changed;    /* whether pal != old_pal */
266266static UINT8  thom_border_index;   /* current border color index */
267267
268/* the left and right border color for each row (including top and bottom
268/* the left and right border color for each row (including top and bottom
269269   border rows); -1 means unchanged wrt last scanline
270270*/
271271static  INT16 thom_border_l[THOM_TOTAL_HEIGHT+1];
r1461r1462
289289/* one dirty flag for each video memory line */
290290static UINT8 thom_vmem_dirty[205];
291291
292/* set to 1 if undirty scanlines need to be redrawn due to other video state
292/* set to 1 if undirty scanlines need to be redrawn due to other video state
293293   changes */
294294static UINT8 thom_vstate_dirty;
295295static UINT8 thom_vstate_last_dirty;
r1461r1462
312312   unsigned x = l & 63;
313313   unsigned color =  thom_pal[ thom_border_index ];
314314
315   if ( y >= THOM_TOTAL_HEIGHT )
315   if ( y >= THOM_TOTAL_HEIGHT )
316316   {
317317      /* end of page */
318318      thom_border_r[ THOM_TOTAL_HEIGHT ] = color;
319319   }
320   else if ( ! x )
320   else if ( ! x )
321321   {
322322      /* start of line */
323323      thom_border_l[ y ] = color;
324324      thom_border_r[ y ] = color;
325325   }
326   else if ( x <= 19 )
326   else if ( x <= 19 )
327327   {
328328      /* between left and right border */
329329      /* NOTE: this makes the lower right part of the color picker blink
r1461r1462
332332      thom_border_r[ y ] = color;
333333      thom_border_l[ y + 1 ] = color;
334334   }
335   else
335   else
336336   {
337337      /* end of line */
338338      thom_border_l[ y + 1 ] = color;
r1461r1462
350350   unsigned y = l >> 6;
351351   unsigned x = l & 63;
352352   int modepage = ((int)thom_vmode << 8) | thom_vpage;
353   if ( y >= 200 || x>= 40 )
353   if ( y >= 200 || x>= 40 )
354354      thom_vmodepage[ 40 ] = modepage;
355   else
355   else
356356      thom_vmodepage[ x ] = modepage;
357357   thom_vmodepage_changed = 1;
358358}
r1461r1462
362362void thom_set_border_color ( unsigned index )
363363{
364364   assert( index < 16 );
365   if ( index != thom_border_index )
365   if ( index != thom_border_index )
366366   {
367367      LOG (( "thom_set_border_color: %i at line %i col %i\n", index, thom_video_elapsed() / 64, thom_video_elapsed() % 64  ));
368368      thom_border_index = index;
r1461r1462
376376{
377377   assert( index < 16 );
378378
379   if ( color != 0x1000 )
379   if ( color != 0x1000 )
380380      color &= 0xfff;
381381
382   if ( thom_pal[ index ] == color )
382   if ( thom_pal[ index ] == color )
383383      return;
384384
385385   LOG (( "thom_set_palette: %i to %03x at line %i col %i\n", index, color, thom_video_elapsed() / 64, thom_video_elapsed() % 64  ));
386386
387387   thom_pal[ index ] = color;
388   if ( index == thom_border_index )
388   if ( index == thom_border_index )
389389      thom_border_changed();
390390   thom_pal_changed = 1;
391391   thom_vstate_dirty = 1;
r1461r1462
397397{
398398   assert( mode < THOM_VMODE_NB );
399399
400   if ( mode != thom_vmode )
400   if ( mode != thom_vmode )
401401   {
402402      LOG (( "thom_set_video_mode: %i at line %i, col %i\n", mode, thom_video_elapsed() / 64, thom_video_elapsed() % 64 ));
403403      thom_vmode = mode;
r1461r1462
425425
426426
427427
428typedef void ( *thom_scandraw ) ( UINT8* vram, UINT16* dst, UINT16* pal,
428typedef void ( *thom_scandraw ) ( UINT8* vram, UINT16* dst, UINT16* pal,
429429              int org, int len );
430430
431431
r1461r1462
439439      dst += org * res;               \
440440      for ( gpl = 0; gpl < len; gpl++, dst += res, vram++ ) {   \
441441         UINT8 rama = vram[ 0      ];         \
442         UINT8 ramb = vram[ 0x2000 ];           
442         UINT8 ramb = vram[ 0x2000 ];
443443
444444#define UPDATE_HI( name )  UPDATE( name, 16 )
445445#define UPDATE_LOW( name ) UPDATE( name,  8 )
r1461r1462
477477
478478/* as above, different (more logical but TO7-incompatible) color encoding */
479479
480UPDATE_HI( mo5 )
480UPDATE_HI( mo5 )
481481{
482482   int i;
483483   pen_t c[2];
r1461r1462
488488}
489489END_UPDATE
490490
491UPDATE_LOW( mo5 )
491UPDATE_LOW( mo5 )
492492{
493493   int i;
494494   pen_t c[2];
r1461r1462
529529
530530/* 320x200, 4-colors, no constraint */
531531
532UPDATE_HI( bitmap4 )
532UPDATE_HI( bitmap4 )
533533{
534534   int i;
535535   pen_t c[2][2];
r1461r1462
542542}
543543END_UPDATE
544544
545UPDATE_LOW( bitmap4 )
545UPDATE_LOW( bitmap4 )
546546{
547547   int i;
548548   pen_t c[2][2];
r1461r1462
559559
560560/* as above, but using 2-bit pixels instead of 2 planes of 1-bit pixels  */
561561
562UPDATE_HI( bitmap4alt )
562UPDATE_HI( bitmap4alt )
563563{
564564   int i;
565565   pen_t c[4];
r1461r1462
574574}
575575END_UPDATE
576576
577UPDATE_LOW( bitmap4alt )
577UPDATE_LOW( bitmap4alt )
578578{
579579   int i;
580580   pen_t c[4];
r1461r1462
593593
594594/* 160x200, 16-colors, no constraint */
595595
596UPDATE_HI( bitmap16 )
596UPDATE_HI( bitmap16 )
597597{
598598   dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = Machine->pens[ pal[ rama >> 4 ] ];
599599   dst[ 4] = dst[ 5] = dst[ 6] = dst[ 7] = Machine->pens[ pal[ rama & 15 ] ];
r1461r1462
602602}
603603END_UPDATE
604604
605UPDATE_LOW( bitmap16 )
605UPDATE_LOW( bitmap16 )
606606{
607607   dst[0] = dst[1] = Machine->pens[ pal[ rama >> 4 ] ];
608608   dst[2] = dst[3] = Machine->pens[ pal[ rama & 15 ] ];
r1461r1462
615615
616616/* 640x200 (80 text column), 2-colors, no constraint */
617617
618UPDATE_HI( mode80 )
618UPDATE_HI( mode80 )
619619{
620620   int i;
621621   pen_t c[2];
r1461r1462
628628}
629629END_UPDATE
630630
631UPDATE_LOW( mode80 )
631UPDATE_LOW( mode80 )
632632{
633633   /* 640-pixel mode but 320 pixels emulated => we merge pixels */
634634   int i;
r1461r1462
646646
647647/* as above, but TO9 flavor */
648648
649UPDATE_HI( mode80_to9 )
649UPDATE_HI( mode80_to9 )
650650{
651651   int i;
652652   pen_t c[2];
r1461r1462
659659}
660660END_UPDATE
661661
662UPDATE_LOW( mode80_to9 )
662UPDATE_LOW( mode80_to9 )
663663{
664664   int i;
665665   pen_t c[4];
r1461r1462
676676
677677/* 320x200, 2-colors, two pages (untested) */
678678
679UPDATE_HI( page1 )
679UPDATE_HI( page1 )
680680{
681681   int i;
682682   pen_t c[2];
r1461r1462
688688}
689689END_UPDATE
690690
691UPDATE_LOW( page1 )
691UPDATE_LOW( page1 )
692692{
693693   int i;
694694   pen_t c[2];
r1461r1462
700700}
701701END_UPDATE
702702
703UPDATE_HI( page2 )
703UPDATE_HI( page2 )
704704{
705705   int i;
706706   pen_t c[2];
r1461r1462
728728
729729/* 320x200, 2-colors, two overlaid pages (untested) */
730730
731UPDATE_HI( overlay )
731UPDATE_HI( overlay )
732732{
733733   int i;
734734   pen_t c[2][2];
r1461r1462
740740}
741741END_UPDATE
742742
743UPDATE_LOW( overlay )
743UPDATE_LOW( overlay )
744744{
745745   int i;
746746   pen_t c[2][2];
r1461r1462
756756
757757/* 160x200, 4-colors, four overlaid pages (untested) */
758758
759UPDATE_HI( overlay3 )
759UPDATE_HI( overlay3 )
760760{
761   static const int p[2][2][2][2] =
762      { { { { 0, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } },
761   static const int p[2][2][2][2] =
762      { { { { 0, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } },
763763        { { { 8, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } } };
764764   int i;
765765   for ( i = 0; i < 16; i += 4, rama >>= 1, ramb >>= 1 )
766      dst[ 15 - i ] = dst[ 14 - i ] = dst[ 13 - i ] = dst[ 12 - i ] =
767         Machine->pens[ pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ]
766      dst[ 15 - i ] = dst[ 14 - i ] = dst[ 13 - i ] = dst[ 12 - i ] =
767         Machine->pens[ pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ]
768768                   [ rama & 1 ] [ (rama >> 4) & 1 ] ] ];
769769}
770770END_UPDATE
771771
772UPDATE_LOW( overlay3 )
772UPDATE_LOW( overlay3 )
773773{
774   static const int p[2][2][2][2] =
775      { { { { 0, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } },
774   static const int p[2][2][2][2] =
775      { { { { 0, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } },
776776        { { { 8, 1 }, { 2, 1 }, }, { { 4, 1 }, { 2, 1 } } } };
777777   int i;
778778   for ( i = 0; i < 8; i += 2, rama >>= 1, ramb >>= 1 )
779779      dst[ 7 - i ] = dst[ 6 - i ] =
780         Machine->pens[ pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ]
780         Machine->pens[ pal[ p[ ramb & 1 ] [ (ramb >> 4) & 1 ]
781781                   [ rama & 1 ] [ (rama >> 4) & 1 ] ] ];
782782}
783783END_UPDATE
r1461r1462
787787#define FUN(x) { x##_scandraw_8, x##_scandraw_16 }
788788
789789
790static const thom_scandraw thom_scandraw_funcs[THOM_VMODE_NB][2] =
790static const thom_scandraw thom_scandraw_funcs[THOM_VMODE_NB][2] =
791791{
792   FUN(to770),    FUN(mo5),    FUN(bitmap4), FUN(bitmap4alt),  FUN(mode80), 
792   FUN(to770),    FUN(mo5),    FUN(bitmap4), FUN(bitmap4alt),  FUN(mode80),
793793   FUN(bitmap16), FUN(page1),  FUN(page2),   FUN(overlay),     FUN(overlay3),
794   FUN(to9), FUN(mode80_to9),
794   FUN(to9), FUN(mode80_to9),
795795};
796796
797797
r1461r1462
804804   int y = param;
805805
806806   /* update active-area */
807   if ( y >= 0 && (thom_vstate_dirty || thom_vstate_last_dirty || thom_vmem_dirty[y]) )
807   if ( y >= 0 && (thom_vstate_dirty || thom_vstate_last_dirty || thom_vmem_dirty[y]) )
808808   {
809      int x = 0; 
810      while ( x < 40 )
809      int x = 0;
810      while ( x < 40 )
811811      {
812812         int xx = x;
813813         unsigned mode = thom_vmodepage[x] >> 8;
814814         unsigned page = thom_vmodepage[x] & 0xff;
815815         assert( mode < THOM_VMODE_NB );
816816         assert( page < 4 );
817         do
818         {
819            xx++;
817         do
818         {
819            xx++;
820820         } while ( xx < 40 && thom_vmodepage[xx] == -1 );
821821         thom_scandraw_funcs[ mode ][ thom_hires ]
822822            ( thom_vram + y * 40 + page * 0x4000,
r1461r1462
828828   }
829829
830830   /* prepare for next scanline */
831   if ( y == 199 )
831   if ( y == 199 )
832832      timer_adjust( thom_scanline_timer, attotime_never, 0, attotime_zero);
833   else
834   {
833   else
834   {
835835
836      if ( thom_vmodepage_changed )
836      if ( thom_vmodepage_changed )
837837      {
838838         int x, m = 0;
839839         for ( x = 0; x <= 40; x++ )
840840         {
841            if ( thom_vmodepage[x] !=-1 )
841            if ( thom_vmodepage[x] !=-1 )
842842            {
843843               m = thom_vmodepage[x];
844844               thom_vmodepage[x] = -1;
r1461r1462
847847         thom_vmodepage[0] = m;
848848         thom_vmodepage_changed = 0;
849849      }
850   
851      if ( thom_pal_changed )
850
851      if ( thom_pal_changed )
852852      {
853853         memcpy( thom_last_pal, thom_pal, 32 );
854854         thom_pal_changed = 0;
r1461r1462
887887   int fold = FLOP_STATE, fnew;
888888
889889   /* stays up for a few frames */
890   if ( write )
891      thom_floppy_wcount = 25;
892   else       
890   if ( write )
891      thom_floppy_wcount = 25;
892   else
893893      thom_floppy_rcount = 25;
894894
895895   /* update icon */
896896   fnew = FLOP_STATE;
897   if ( fold != fnew )
897   if ( fold != fnew )
898898      output_set_value( "floppy", fnew );
899899}
900900
r1461r1462
925925   /* upper border */
926926   for ( y = 0; y < THOM_BORDER_HEIGHT - thom_bheight; y++ )
927927   {
928      if ( thom_border_l[ y ] != -1 )
928      if ( thom_border_l[ y ] != -1 )
929929         border = machine->pens[ thom_border_l[ y ] ];
930930   }
931931   ypos = 0;
932   while ( y < THOM_BORDER_HEIGHT )
932   while ( y < THOM_BORDER_HEIGHT )
933933   {
934      if ( thom_border_l[ y ] != -1 )
934      if ( thom_border_l[ y ] != -1 )
935935         border = machine->pens[ thom_border_l[ y ] ];
936936      wrect.min_y = ypos;
937      do
938      {
939         y++;
940         ypos ++ /* += scale */;
937      do
938      {
939         y++;
940         ypos ++ /* += scale */;
941941      }
942942      while ( y < THOM_BORDER_HEIGHT && thom_border_l[ y ] == -1 );
943943      wrect.max_y = ypos - 1;
r1461r1462
945945   }
946946
947947   /* left border */
948   while ( y < yup )
948   while ( y < yup )
949949   {
950      if ( thom_border_l[ y ] != -1 )
950      if ( thom_border_l[ y ] != -1 )
951951         border = machine->pens[ thom_border_l[ y ] ];
952952      lrect.min_y = ypos;
953      do
954      {
955         y++;
956         ypos ++ /* += scale */;
953      do
954      {
955         y++;
956         ypos ++ /* += scale */;
957957      }
958958      while ( y < yup && thom_border_l[ y ] == -1 );
959959      lrect.max_y = ypos - 1;
r1461r1462
961961   }
962962
963963   /* lower border */
964   while (y < ybot )
964   while (y < ybot )
965965   {
966      if ( thom_border_l[ y ] != -1 )
966      if ( thom_border_l[ y ] != -1 )
967967         border = machine->pens[ thom_border_l[ y ] ];
968968      wrect.min_y = ypos;
969      do
970      {
971         y++;
969      do
970      {
971         y++;
972972         ypos ++ /* += scale */; }
973973      while ( y < ybot && thom_border_l[ y ] == -1 );
974974      wrect.max_y = ypos - 1;
r1461r1462
977977
978978   /* right border */
979979   for ( y = 0; y < THOM_BORDER_HEIGHT; y++ ) {
980      if ( thom_border_r[ y ] != -1 )
980      if ( thom_border_r[ y ] != -1 )
981981         border = machine->pens[ thom_border_r[ y ] ];
982982   }
983983   ypos = thom_bheight /* * scale */;
984   while ( y < yup )
984   while ( y < yup )
985985   {
986      if ( thom_border_r[ y ] != -1 )
986      if ( thom_border_r[ y ] != -1 )
987987         border = machine->pens[ thom_border_r[ y ] ];
988988      rrect.min_y = ypos;
989      do
990      {
991         y++;
992         ypos ++ /* += scale */;
989      do
990      {
991         y++;
992         ypos ++ /* += scale */;
993993      }
994994      while ( y < yup && thom_border_r[ y ] == -1 );
995995      rrect.max_y = ypos - 1;
r1461r1462
998998
999999   /* active area */
10001000   ypos = thom_bheight /* * scale */;
1001   for ( y = 0; y < 200; v += xwidth, y++ , ypos ++ /* += scale */ )
1001   for ( y = 0; y < 200; v += xwidth, y++ , ypos ++ /* += scale */ )
10021002   {
10031003      draw_scanline16( bitmap, xbleft, ypos, xwidth, v, NULL, -1 );
10041004#if 0
r1461r1462
10341034   int init = param;
10351035   LOG (( "%f thom_set_init: %i, at line %i col %i\n", attotime_to_double(timer_get_time()), init, thom_video_elapsed() / 64, thom_video_elapsed() % 64 ));
10361036
1037   if ( thom_init_cb )
1037   if ( thom_init_cb )
10381038      thom_init_cb( init );
10391039   if ( ! init )
10401040      timer_adjust( thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_ACTIVE_HEIGHT - 24 ), 1-init, attotime_zero );
r1461r1462
10471047   int i;
10481048   UINT16 b = 0;
10491049   struct thom_vsignal l = thom_get_lightpen_vsignal( 0, -1, 0 );
1050 
1050
10511051   LOG (( "%f thom: video eof called\n", attotime_to_double(timer_get_time()) ));
10521052
10531053   /* floppy indicator count */
1054   if ( thom_floppy_wcount )
1054   if ( thom_floppy_wcount )
10551055      thom_floppy_wcount--;
1056   if ( thom_floppy_rcount )
1056   if ( thom_floppy_rcount )
10571057      thom_floppy_rcount--;
10581058   fnew = FLOP_STATE;
1059   if ( fnew != fold )
1059   if ( fnew != fold )
10601060      output_set_value( "floppy", fnew );
10611061
10621062   /* prepare state for next frame */
1063   for ( i = 0; i <= THOM_TOTAL_HEIGHT; i++ )
1063   for ( i = 0; i <= THOM_TOTAL_HEIGHT; i++ )
10641064   {
1065      if ( thom_border_l[ i ] != -1 )
1065      if ( thom_border_l[ i ] != -1 )
10661066         b = thom_border_l[ i ];
1067      if ( thom_border_r[ i ] != -1 )
1067      if ( thom_border_r[ i ] != -1 )
10681068         b = thom_border_r[ i ];
10691069   }
10701070   memset( thom_border_l, 0xff, sizeof( thom_border_l ) );
r1461r1462
10731073   thom_border_r[ 0 ] = b;
10741074   thom_vstate_last_dirty = thom_vstate_dirty;
10751075   thom_vstate_dirty = 0;
1076 
1076
10771077   /* schedule first init signal */
10781078   timer_adjust( thom_init_timer, ATTOTIME_IN_USEC( 64 * THOM_BORDER_HEIGHT + 7 ), 0, attotime_zero );
10791079
r1461r1462
11041104
11051105
11061106
1107static const UINT16 thom_pal_init[16] =
1108{
1107static const UINT16 thom_pal_init[16] =
1108{
11091109   0x1000, /* 0: black */        0x000f, /* 1: red */
11101110   0x00f0, /* 2: geen */         0x00ff, /* 3: yellow */
11111111   0x0f00, /* 4: blue */         0x0f0f, /* 5: purple */
r1461r1462
11731173
11741174   thom_init_cb = NULL;
11751175   thom_init_timer = timer_alloc( thom_set_init , NULL);
1176 
1176
11771177   video_eof_thom(machine);
11781178
11791179   state_save_register_global( thom_bwidth );
r1461r1462
11911191
11921192   LOG (( "thom: palette init called\n" ));
11931193
1194   for ( i = 0; i < 4097; i++ ) 
1194   for ( i = 0; i < 4097; i++ )
11951195   {
11961196      UINT8 r = 255. * pow( (i & 15) / 15., gamma );
11971197      UINT8 g = 255. * pow( ((i>> 4) & 15) / 15., gamma );
r1461r1462
12121212{
12131213   assert( offset >= 0 && offset < 0x2000 );
12141214   /* force two topmost color bits to 1 */
1215   if ( thom_mode_point )
1215   if ( thom_mode_point )
12161216      data |= 0xc0;
1217   if ( thom_vram[ offset + thom_mode_point ] == data )
1217   if ( thom_vram[ offset + thom_mode_point ] == data )
12181218      return;
12191219   thom_vram[ offset + thom_mode_point ] = data;
12201220   /* dirty whole scanline */
r1461r1462
12321232   thom_get_lightpen_pos( &x, &y );
12331233   x -= thom_bwidth;
12341234   y -= thom_bheight;
1235   if ( x < 0 || y < 0 || x >= 320 || y >= 200 )
1235   if ( x < 0 || y < 0 || x >= 320 || y >= 200 )
12361236      return 0;
12371237   x += decx;
12381238   y += decy;
r1461r1462
12451245
12461246
12471247
1248/* write to video memory through addresses 0x4000-0x5fff (TO)
1248/* write to video memory through addresses 0x4000-0x5fff (TO)
12491249   or 0x0000-0x1fff (MO) */
12501250WRITE8_HANDLER ( to770_vram_w )
12511251{
12521252   assert( offset >= 0 && offset < 0x2000 );
1253   if ( thom_vram[ offset + thom_mode_point ] == data )
1253   if ( thom_vram[ offset + thom_mode_point ] == data )
12541254      return;
12551255   thom_vram[ offset + thom_mode_point ] = data;
12561256   /* dirty whole scanline */
r1461r1462
12701270{
12711271   UINT8* dst = thom_vram + offset + 0x6000;
12721272   assert( offset >= 0 && offset < 0x2000 );
1273   if ( *dst == data )
1273   if ( *dst == data )
12741274      return;
12751275   *dst = data;
12761276   /* dirty whole scanline */
r1461r1462
12971297{
12981298   UINT8* dst = thom_vram + offset + 0x4000 * to8_data_vpage + 0x2000;
12991299   assert( offset >= 0 && offset < 0x2000 );
1300   if ( *dst == data )
1300   if ( *dst == data )
13011301      return;
13021302   *dst = data;
13031303   /* dirty whole scanline */
1304   if ( to8_data_vpage >= 4 )
1304   if ( to8_data_vpage >= 4 )
13051305      return;
13061306   thom_vmem_dirty[ offset / 40 ] = 1;
13071307}
r1461r1462
13121312{
13131313   UINT8* dst = thom_vram + offset + 0x4000 * to8_data_vpage;
13141314   assert( offset >= 0 && offset < 0x2000 );
1315   if ( *dst == data )
1315   if ( *dst == data )
13161316      return;
13171317   *dst = data;
13181318   /* dirty whole scanline */
1319   if ( to8_data_vpage >= 4 )
1319   if ( to8_data_vpage >= 4 )
13201320      return;
13211321   thom_vmem_dirty[ offset / 40 ] = 1;
13221322}
r1461r1462
13281328{
13291329   UINT8* dst = thom_vram + offset + 0x4000 * to8_cart_vpage;
13301330   assert( offset>=0 && offset < 0x4000 );
1331   if ( *dst == data )
1331   if ( *dst == data )
13321332      return;
13331333   *dst = data;
13341334   /* dirty whole scanline */
1335   if ( to8_cart_vpage >= 4  )
1335   if ( to8_cart_vpage >= 4  )
13361336      return;
13371337   thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = 1;
13381338}
src/mess/video/thomson.h
r1461r1462
66
77**********************************************************************/
88
9/*
9/*
1010   TO7 video:
1111   one line (64 us) =
1212      56 left border pixels ( 7 us)
r1461r1462
7272extern unsigned to7_lightpen_gpl ( int decx, int decy );
7373
7474/* video position corresponding to lightpen (with some offset) */
75extern struct thom_vsignal thom_get_lightpen_vsignal ( int xdec, int ydec,
75extern struct thom_vsignal thom_get_lightpen_vsignal ( int xdec, int ydec,
7676                         int xdec2 );
7777
7878/* specify a lightpencall-back function, called nb times per frame */
src/mess/video/pmd85.c
r1461r1462
6262{
6363   int pmd85_scanline;
6464
65   for (pmd85_scanline=0; pmd85_scanline<256; pmd85_scanline++)                     
65   for (pmd85_scanline=0; pmd85_scanline<256; pmd85_scanline++)
6666      pmd85_draw_scanline (bitmap, pmd85_scanline);
6767   return 0;
6868}
src/mess/video/abc80.c
r1461r1462
3434      abc80_bank = 0;
3535      abc80_row = row;
3636   }
37   
37
3838   if (code == ABC80_MODE_TEXT)
3939   {
4040      abc80_bank = 0;
r1461r1462
6464   abc80_blink_timer = timer_alloc(abc80_blink_tick, NULL);
6565   timer_adjust(abc80_blink_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC80_XTAL/2/6/64/312/16));
6666
67   tx_tilemap = tilemap_create(abc80_get_tile_info, abc80_tilemap_scan,
67   tx_tilemap = tilemap_create(abc80_get_tile_info, abc80_tilemap_scan,
6868      TILEMAP_TYPE_PEN, 6, 10, 40, 24);
6969
7070   tilemap_set_scrolldx(tx_tilemap, ABC80_HDSTART, ABC80_HDSTART);
src/mess/video/x68k.c
r1461r1462
4444
4545static mame_bitmap* x68k_text_bitmap;  // 1024x1024 4x1bpp planes text
4646static mame_bitmap* x68k_gfx_0_bitmap_16;  // 16 colour, 512x512, 4 pages
47static mame_bitmap* x68k_gfx_1_bitmap_16;
48static mame_bitmap* x68k_gfx_2_bitmap_16;
49static mame_bitmap* x68k_gfx_3_bitmap_16;
47static mame_bitmap* x68k_gfx_1_bitmap_16;
48static mame_bitmap* x68k_gfx_2_bitmap_16;
49static mame_bitmap* x68k_gfx_3_bitmap_16;
5050static mame_bitmap* x68k_gfx_0_bitmap_256;  // 256 colour, 512x512, 2 pages
51static mame_bitmap* x68k_gfx_1_bitmap_256;
51static mame_bitmap* x68k_gfx_1_bitmap_256;
5252static mame_bitmap* x68k_gfx_0_bitmap_65536;  // 65536 colour, 512x512, 1 page
5353
5454static tilemap* x68k_bg0_8;  // two 64x64 tilemaps, 8x8 characters
r1461r1462
172172   visiblescr.max_x = sys.crtc.hend;
173173   visiblescr.min_y = sys.crtc.vbegin;
174174   visiblescr.max_y = sys.crtc.vend;
175   
175
176176   // expand visible area to the size indicated by CRTC reg 20
177177   length = sys.crtc.hend - sys.crtc.hbegin;
178178   if (length < sys.crtc.width)
r1461r1462
195195      visiblescr.max_x = scr.max_x - 1;
196196   if(visiblescr.max_y >= scr.max_y)
197197      visiblescr.max_y = scr.max_y - 1;
198   
198
199199   logerror("video_screen_configure(0,%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);
200200   video_screen_configure(0,scr.max_x,scr.max_y,&visiblescr,HZ_TO_ATTOSECONDS(55.45));
201/*   
201/*
202202   rect.min_x = rect.min_y = 0;
203203   sys.crtc.visible_width = (sys.crtc.reg[3] - sys.crtc.reg[2]) * 8;
204204   if(sys.crtc.height == 256)
r1461r1462
241241{
242242   int state = param;
243243   attotime hsync_time;
244   
245   sys.crtc.hblank = state;   
244
245   sys.crtc.hblank = state;
246246   if(state == 1)
247247   {
248248      int scan = video_screen_get_vpos(0);
r1461r1462
356356 *      bits 15-8 - Source Line
357357 *      bits 7-0 - Destination Line
358358 * 23 - Text Screen Mask Pattern
359 *
359 *
360360 * 0xe80481 - Operation Port (8-bit):
361361 *      bit 3 - Text Screen Line Copy Begin
362362 *      bit 1 - Graphic Screen High-speed Clear Begin
363363 *      bit 0 - Image Taking Begin (?)
364364 *    Operation Port bits are cleared automatically when the requested
365 *    operation is completed.
365 *    operation is completed.
366366 */
367367WRITE16_HANDLER( x68k_crtc_w )
368368{
r1461r1462
387387         {
388388            attotime irq_time;
389389            irq_time = video_screen_get_time_until_pos(0,(data - 1) / sys.crtc.vmultiple,2);
390   
390
391391            if(attotime_to_double(irq_time) > 0)
392392               timer_adjust(raster_irq,irq_time,(data - 1) / sys.crtc.vmultiple,attotime_never);
393393            logerror("CRTC: Time until next raster IRQ = %f\n",attotime_to_double(irq_time));
r1461r1462
433433      {
434434         sys.crtc.interlace = 0;
435435         if(data & 0x0400)  // real size 1024x1024
436            sys.crtc.interlace = 1;         
436            sys.crtc.interlace = 1;
437437      }
438438      x68k_crtc_refresh_mode();
439439      break;
r1461r1462
552552   int xloc,yloc,pageoffset;
553553   /*
554554      G-VRAM usage is determined by colour depth and "real" screen size.
555     
555
556556      For screen size of 1024x1024, all G-VRAM space is used, in one big page.
557557      At 1024x1024 real screen size, colour depth is always 4bpp, and ranges from
558558      0xc00000-0xdfffff.
559     
559
560560      For screen size of 512x512, the colour depth determines the page usage.
561561      16 colours = 4 pages
562562      256 colours = 2 pages
r1461r1462
565565      Page 3 - 0xd00000-0xd7ffff    Page 4 - 0xd80000-0xdfffff
566566   */
567567   COMBINE_DATA(gvram+offset);
568   
568
569569   pageoffset = offset & 0x3ffff;
570570   xloc = pageoffset % 512;
571571   yloc = pageoffset / 512;
r1461r1462
719719         {
720720            xscr = sys.crtc.hbegin-(sys.crtc.reg[12] & 0x1ff);
721721            yscr = sys.crtc.vbegin-(sys.crtc.reg[13] & 0x1ff);
722            copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
722            copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
723723            xscr+=512;
724            copyscrollbitmap(bitmap, x68k_gfx_1_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
724            copyscrollbitmap(bitmap, x68k_gfx_1_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
725725            yscr+=512;
726            copyscrollbitmap(bitmap, x68k_gfx_2_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
726            copyscrollbitmap(bitmap, x68k_gfx_2_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
727727            xscr-=512;
728            copyscrollbitmap(bitmap, x68k_gfx_3_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
728            copyscrollbitmap(bitmap, x68k_gfx_3_bitmap_16, 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
729729         }
730730      }
731731      else  // 512x512 "real" screen size
r1461r1462
742742               rect.max_y=rect.min_y + sys.crtc.visible_height-1;
743743               xscr = sys.crtc.hbegin-(sys.crtc.reg[12] & 0x1ff);
744744               yscr = sys.crtc.vbegin-(sys.crtc.reg[13] & 0x1ff);
745               copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_65536, 1, &xscr, 1, &yscr,&cliprect, TRANSPARENCY_PEN,0);
745               copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_65536, 1, &xscr, 1, &yscr,&cliprect, TRANSPARENCY_PEN,0);
746746            }
747747            break;
748748         case 0x01:
r1461r1462
755755            {
756756               xscr = sys.crtc.hbegin-(sys.crtc.reg[16] & 0x1ff);
757757               yscr = sys.crtc.vbegin-(sys.crtc.reg[17] & 0x1ff);
758               copyscrollbitmap(bitmap, x68k_gfx_1_bitmap_256, 1, &xscr, 1, &yscr, &cliprect, TRANSPARENCY_PEN,0);
758               copyscrollbitmap(bitmap, x68k_gfx_1_bitmap_256, 1, &xscr, 1, &yscr, &cliprect, TRANSPARENCY_PEN,0);
759759            }
760760            if(sys.video.reg[2] & 0x0001 && sys.video.reg[2] & 0x0002 && priority == sys.video.gfxlayer_pri[0])
761761            {
762762               xscr = sys.crtc.hbegin-(sys.crtc.reg[12] & 0x1ff);
763763               yscr = sys.crtc.vbegin-(sys.crtc.reg[13] & 0x1ff);
764               copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_256, 1, &xscr, 1, &yscr, &cliprect, TRANSPARENCY_PEN,0);
764               copyscrollbitmap(bitmap, x68k_gfx_0_bitmap_256, 1, &xscr, 1, &yscr, &cliprect, TRANSPARENCY_PEN,0);
765765            }
766766            break;
767767         case 0x00:
r1461r1462
774774            {
775775               xscr = sys.crtc.hbegin-(sys.crtc.reg[18] & 0x1ff);
776776               yscr = sys.crtc.vbegin-(sys.crtc.reg[19] & 0x1ff);
777               copyscrollbitmap(bitmap, x68k_get_gfx_pri(3,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
777               copyscrollbitmap(bitmap, x68k_get_gfx_pri(3,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
778778            }
779779            if(sys.video.reg[2] & 0x0004)  // Pri2
780780            {
781781               xscr = sys.crtc.hbegin-(sys.crtc.reg[16] & 0x1ff);
782782               yscr = sys.crtc.vbegin-(sys.crtc.reg[17] & 0x1ff);
783               copyscrollbitmap(bitmap, x68k_get_gfx_pri(2,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
783               copyscrollbitmap(bitmap, x68k_get_gfx_pri(2,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
784784            }
785785            if(sys.video.reg[2] & 0x0002)  // Pri1
786786            {
787787               xscr = sys.crtc.hbegin-(sys.crtc.reg[14] & 0x1ff);
788788               yscr = sys.crtc.vbegin-(sys.crtc.reg[15] & 0x1ff);
789               copyscrollbitmap(bitmap, x68k_get_gfx_pri(1,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
789               copyscrollbitmap(bitmap, x68k_get_gfx_pri(1,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
790790            }
791791            if(sys.video.reg[2] & 0x0001)  // Pri0
792792            {
793793               xscr = sys.crtc.hbegin-(sys.crtc.reg[12] & 0x1ff);
794794               yscr = sys.crtc.vbegin-(sys.crtc.reg[13] & 0x1ff);
795               copyscrollbitmap(bitmap, x68k_get_gfx_pri(0,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
795               copyscrollbitmap(bitmap, x68k_get_gfx_pri(0,GFX16), 1, &xscr, 1, &yscr ,&cliprect, TRANSPARENCY_PEN,0);
796796            }
797797            break;
798798         }
r1461r1462
10821082#ifdef MAME_DEBUG
10831083         if(!input_code_pressed(KEYCODE_Q))
10841084#endif
1085            copyscrollbitmap(bitmap, x68k_text_bitmap, 1, &xscr, 1, &yscr, &rect, TRANSPARENCY_PEN,0x100);
1085            copyscrollbitmap(bitmap, x68k_text_bitmap, 1, &xscr, 1, &yscr, &rect, TRANSPARENCY_PEN,0x100);
10861086      }
10871087   }
10881088
src/mess/video/atarist.c
r1461r1462
136136   shifter.ir[shifter.bitplane] = (RAM[1] << 8) | RAM[0];
137137   shifter.bitplane++;
138138   shifter.ofs += 2;
139   
139
140140   if (shifter.bitplane == 4)
141141   {
142142      shifter.bitplane = 0;
143     
143
144144      shifter.rr[0] = shifter.ir[0];
145145      shifter.rr[1] = shifter.ir[1];
146146      shifter.rr[2] = shifter.ir[2];
r1461r1462
215215   case 0x01:
216216      return (shifter.base >> 8) & 0xff;
217217   }
218   
218
219219   return 0;
220220}
221221
r1461r1462
276276{
277277   return shifter.palette[offset];
278278}
279     
279
280280WRITE16_HANDLER( atarist_shifter_palette_w )
281281{
282282   shifter.palette[offset] = data;
r1461r1462
368368
369369/* Atari ST Blitter */
370370
371static const int BLITTER_NOPS[16][4] =
371static const int BLITTER_NOPS[16][4] =
372372{
373373   { 1, 1, 1, 1 },
374374   { 2, 2, 3, 3 },
r1461r1462
471471      {
472472         blitter.src += blitter.src_inc_x;
473473         blitter.dst += blitter.dst_inc_x;
474         
474
475475         if (blitter.xcount == 1)
476476         {
477477            if (!(blitter.skew & ATARIST_BLITTER_SKEW_NFSR))
src/mess/video/lviv.c
r1461r1462
7171   int pen;
7272   UINT8 data;
7373
74   for (y=0; y<256; y++)                     
74   for (y=0; y<256; y++)
7575      for (x=0; x<256; x+=4)
7676      {
7777         data = lviv_video_ram[y*64+x/4];
src/mess/video/crtc6845.c
r1461r1462
113113 * had these hardwired values: */
114114static UINT8 pc1512_defaults[] =
115115{
116   113, 80, 90, 10, 127, 6, 100, 112, 2
116   113, 80, 90, 10, 127, 6, 100, 112, 2
117117};
118118
119119/***************************************************************************
r1461r1462
201201   }
202202}
203203
204int mscrtc6845_get_char_columns(struct mscrtc6845 *crtc)
205{
204int mscrtc6845_get_char_columns(struct mscrtc6845 *crtc)
205{
206206   return CRTC6845_CHAR_COLUMNS;
207207}
208208
209int mscrtc6845_get_char_height(struct mscrtc6845 *crtc)
209int mscrtc6845_get_char_height(struct mscrtc6845 *crtc)
210210{
211211   return CRTC6845_CHAR_HEIGHT;
212212}
213213
214int mscrtc6845_get_char_lines(struct mscrtc6845 *crtc)
215{
214int mscrtc6845_get_char_lines(struct mscrtc6845 *crtc)
215{
216216   return CRTC6845_CHAR_LINES;
217217}
218218
219int mscrtc6845_get_start(struct mscrtc6845 *crtc)
219int mscrtc6845_get_start(struct mscrtc6845 *crtc)
220220{
221221   return CRTC6845_VIDEO_START;
222222}
223223
224224
225225void mscrtc6845_set_char_columns(struct mscrtc6845 *crtc, UINT8 columns)
226{
226{
227227   crtc->reg[1] = columns;
228228}
229229
230230
231231void mscrtc6845_set_char_lines(struct mscrtc6845 *crtc, UINT8 lines)
232{
232{
233233   crtc->reg[6] = lines;
234234}
235235
r1461r1462
308308            break;
309309         }
310310
311         /* since the PC1512 does not support the number of lines register directly,
311         /* since the PC1512 does not support the number of lines register directly,
312312          * this value is keyed off of register 9
313313          */
314314         if ((crtc->config.personality == M6845_PERSONALITY_PC1512) && (idx == 9))
src/mess/video/exidy.c
r1461r1462
6666
6767         /* prom at 0x0f800, user chars from 0x0fc00 */
6868         char_addr = 0x0f800 + (ch<<3);
69     
69
7070         for (cheight=0; cheight<8; cheight++)
7171         {
7272            int byte;
src/mess/video/pc8801.c
r1461r1462
129129    case GRAPH_200_BW:
130130      x=(offset&0x3fff)%80;
131131      y=(offset&0x3fff)/80/2;
132      break;
132      break;
133133    case GRAPH_400_BW:
134134      x=(offset&0x3fff)%80;
135135      y=(offset&0x3fff)/80/4+(offset/0x4000)*50;
r1461r1462
289289    }
290290  }
291291
292 
292
293293   if (rh5) memory_install_read8_handler(0,  ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, rh5);
294294   if (wh5) memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xefff, 0, 0, wh5);
295295   if (rh6) memory_install_read8_handler(0,  ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, rh6);
r1461r1462
677677      case 0xc0:
678678   blink_period=32;
679679   break;
680      }   
680      }
681681      if((data&0x3f)==0x13) {
682682   text_height=20;
683683   return;
src/mess/video/pc_video.c
r1461r1462
8686
8787   if (video_update)
8888   {
89      if ((pc_current_width != w) || (pc_current_height != h))
89      if ((pc_current_width != w) || (pc_current_height != h))
9090      {
9191         pc_current_width = w;
9292         pc_current_height = h;
src/mess/video/pcw.c
r1461r1462
7070      pen1^=1;
7171      pen0^=1;
7272   }
73   
73
7474   pen0 = machine->pens[pen0];
7575   pen1 = machine->pens[pen1];
7676
src/mess/video/oric.c
r1461r1462
11/***************************************************************************
22
33   video/oric.c
4   
4
55   All graphic effects are supported including mid-line changes.
66   There may be some small bugs.
77
88   TODO:
99   - speed up this code a bit?
10   
10
1111***************************************************************************/
1212
1313#include "driver.h"
r1461r1462
4141   unsigned char *char_data;
4242   /* base of char data */
4343   unsigned char *char_base;
44   
44
4545   /* if (1<<3), display graphics, if 0, hide graphics */
4646   int flash_state;
4747   /* current count */
r1461r1462
5656   /* update flash count */
5757   vh_state.flash_count++;
5858   if (vh_state.flash_count == 30)
59   {   
59   {
6060      vh_state.flash_count = 0;
6161      vh_state.flash_state ^=(1<<3);
6262      oric_vh_update_flash();
r1461r1462
9191         return;
9292      }
9393   }
94   
9594
95
9696   /* show */
9797   vh_state.active_foreground_colour = vh_state.foreground_colour;
9898   vh_state.active_background_colour = vh_state.background_colour;
r1461r1462
166166            /* set screen memory base and standard charset location for this mode */
167167            vh_state.read_addr = 0x0a000;
168168            if (oric_ram)
169               vh_state.char_base = oric_ram + (unsigned long)0x09800;
169               vh_state.char_base = oric_ram + (unsigned long)0x09800;
170170            else
171171               vh_state.char_base = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0x09800);
172           
172
173173            /* changing the mode also changes the position of the standard charset
174174            and alternative charset */
175175            oric_refresh_charset();
r1461r1462
182182               vh_state.char_base = oric_ram + (unsigned long)0x0b400;
183183            else
184184               vh_state.char_base = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0x0b400);
185         
185
186186            /* changing the mode also changes the position of the standard charset
187187            and alternative charset */
188188            oric_refresh_charset();
r1461r1462
203203   int i;
204204   int pens[2];
205205   int px;
206   
206
207207   /* invert? */
208208   if (invert_flag)
209209   {
r1461r1462
213213
214214   pens[1] = Machine->pens[fg];
215215   pens[0] = Machine->pens[bg];
216   
216
217217   px = x;
218218   for (i=0; i<6; i++)
219219   {
r1461r1462
226226   }
227227}
228228
229         
230229
231230
232231
232
233233/***************************************************************************
234234  oric_vh_screenrefresh
235235***************************************************************************/
r1461r1462
254254   else
255255   {
256256      hires_active = 0;
257   }         
257   }
258258
259259
260260   for (y = 0; y < 224; y++)
r1461r1462
267267      oric_vh_update_attribute((1<<3));
268268
269269      oric_vh_update_attribute((1<<4));
270     
270
271271      for (byte_offset=0; byte_offset<40; byte_offset++)
272272      {
273273         int c;
r1461r1462
287287               int char_line;
288288
289289               char_line = (y>>3);
290               read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40);     
290               read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40);
291291            }
292292         }
293293         else
r1461r1462
295295            int char_line;
296296
297297            char_line = ((y-200)>>3);
298            read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40);     
298            read_addr = (unsigned long)read_addr_base + (unsigned long)byte_offset + (unsigned long)(char_line*40);
299299         }
300300
301301         /* fetch data */
r1461r1462
310310            oric_vh_render_6pixels(bitmap,x,y,vh_state.active_foreground_colour, vh_state.active_background_colour, 0,(c & 0x080));
311311
312312            if (y<200)
313            {           
313            {
314314               /* is hires active? */
315315               if (vh_state.mode & (1<<2))
316316               {
r1461r1462
320320               {
321321                  hires_active = 0;
322322               }
323               
323
324324               read_addr_base = vh_state.read_addr;
325325            }
326326         }
r1461r1462
345345
346346               /* is double height set? */
347347               if (vh_state.text_attributes & (1<<1))
348               {
348               {
349349                  /* if char line is even, top half of character is displayed,
350350                  if char line is odd, bottom half of character is displayed */
351351                  int double_height_flag = ((y>>3) & 0x01);
r1461r1462
353353                  /* calculate line to fetch */
354354                  ch_line = (ch_line>>1) + (double_height_flag<<2);
355355               }
356               
356
357357               /* fetch pixel data for this char line */
358358               char_data = vh_state.char_data[(char_index<<3) | ch_line] & 0x03f;
359359
360360               /* draw! */
361361               oric_vh_render_6pixels(bitmap,x,y,
362                  vh_state.active_foreground_colour,
362                  vh_state.active_foreground_colour,
363363                  vh_state.active_background_colour, char_data, (c & 0x080));
364364            }
365365
366366         }
367         
368         x=x+6;   
367
368         x=x+6;
369369      }
370     
370
371371      /* after 200 lines have been drawn, force a change of the read address */
372372      /* there are 200 lines of hires/text mode, then 24 lines of text mode */
373373      /* the mode can't be changed in the last 24 lines. */
src/mess/video/pc1403.c
r1461r1462
7070static const POCKETC_FIGURE   line={ /* simple line */
7171   "11111",
7272   "11111",
73   "11111e"
73   "11111e"
7474};
75static const POCKETC_FIGURE busy={
75static const POCKETC_FIGURE busy={
7676   "11  1 1  11 1 1",
7777   "1 1 1 1 1   1 1",
7878   "11  1 1  1  1 1",
7979   "1 1 1 1   1  1",
8080   "11   1  11   1e"
81}, def={
81}, def={
8282   "11  111 111",
8383   "1 1 1   1",
8484   "1 1 111 11",
8585   "1 1 1   1",
86   "11  111 1e"
86   "11  111 1e"
8787}, shift={
8888   " 11 1 1 1 111 111",
8989   "1   1 1 1 1    1",
9090   " 1  111 1 11   1",
9191   "  1 1 1 1 1    1",
92   "11  1 1 1 1    1e"
92   "11  1 1 1 1    1e"
9393}, hyp={
9494   "1 1 1 1 11",
9595   "1 1 1 1 1 1",
9696   "111 1 1 11",
9797   "1 1  1  1",
98   "1 1  1  1e"
98   "1 1  1  1e"
9999}, de={
100100   "11  111",
101101   "1 1 1",
r1461r1462
107107   "1",
108108   "1 1",
109109   "1 1",
110   " 11e"
110   " 11e"
111111}, rad={
112112   "11   1  11",
113113   "1 1 1 1 1 1",
r1461r1462
131131   "1",
132132   "111",
133133   "1",
134   "111e"
134   "111e"
135135}, kana={ // katakana charset
136136   "  1     1 ",
137137   " 11111 111",
138138   "  1  1  1 ",
139139   " 1   1  1 ",
140   "1   1  1e"
140   "1   1  1e"
141141}, shoo={ // minor
142142   "    1    ",
143143   " 1  1  1 ",
144144   "1   1   1",
145145   "    1    ",
146146   "   1e"
147}, sml={
147}, sml={
148148   " 11 1 1 1",
149149   "1   111 1",
150150   " 1  1 1 1",
151151   "  1 1 1 1",
152   "11  1 1 111e"
152   "11  1 1 111e"
153153};
154154
155155VIDEO_UPDATE( pc1403 )
156156{
157157   int x, y, i, j;
158158   int color[3];
159   
159
160160   bitmap_fill(bitmap, cliprect, 5);
161   
161
162162   /* HJB: we cannot initialize array with values from other arrays, thus... */
163163   color[0] = machine->pens[pocketc_colortable[CONTRAST][0]];
164164   color[2] = machine->pens[pocketc_colortable[CONTRAST][1]];
r1461r1462
202202            0, TRANSPARENCY_NONE,0);
203203      }
204204   }
205    /* if display is off, busy is always visible? it seems to behave like
205    /* if display is off, busy is always visible? it seems to behave like
206206that. */
207207    /* But if computer is off, busy is hidden. */
208208    if(!(pc1403_portc&8))
r1461r1462
211211     else pocketc_draw_special(bitmap,RIGHT,DOWN-13,busy,color[2]);
212212    }
213213    else pocketc_draw_special(bitmap,RIGHT,DOWN-13,busy,color[0]);
214   
214
215215    pocketc_draw_special(bitmap,RIGHT+18,DOWN-13,def,
216216          pc1403_lcd.reg[0x3d]&2?color[1]:color[0]);
217217    pocketc_draw_special(bitmap,RIGHT+43,DOWN-13,shift,
r1461r1462
239239          pc1403_lcd.reg[0x7c]&2?color[1]:color[0]);
240240    pocketc_draw_special(bitmap,RIGHT+281,DOWN-13,e,
241241          pc1403_lcd.reg[0x7c]&1?color[1]:color[0]);
242   
242
243243    pocketc_draw_special(bitmap, RIGHT+10,DOWN+27,line /* empty */,
244244          (pc1403_lcd.reg[0x3c]&0x40) ?color[1]:color[0]);
245245    pocketc_draw_special(bitmap,RIGHT+31,DOWN+27,line /*calc*/,
r1461r1462
250250          (pc1403_lcd.reg[0x3d]&0x10) ? color[1]:color[0]);
251251    pocketc_draw_special(bitmap, RIGHT+94,DOWN+27,line /* empty */,
252252          (pc1403_lcd.reg[0x3c]&0x20) ? color[1]:color[0]);
253         
254    pocketc_draw_special(bitmap,RIGHT+232,DOWN+27,line/*matrix*/,
253
254    pocketc_draw_special(bitmap,RIGHT+232,DOWN+27,line/*matrix*/,
255255          pc1403_lcd.reg[0x3c]&0x10?color[1]:color[0]);
256256    pocketc_draw_special(bitmap,RIGHT+253,DOWN+27,line/*stat*/,
257257          pc1403_lcd.reg[0x3c]&8?color[1]:color[0]);
258258    pocketc_draw_special(bitmap,RIGHT+274,DOWN+27,line/*print*/,
259259          pc1403_lcd.reg[0x7c]&0x40?color[1]:color[0]);
260   
260
261261   return 0;
262262}
263263
src/mess/video/apple1.c
r1461r1462
212212   }
213213
214214   return double_to_attotime(
215      attotime_to_double(video_screen_get_time_until_pos(0, cursor_scanline, 0)) +
215      attotime_to_double(video_screen_get_time_until_pos(0, cursor_scanline, 0)) +
216216      scanline_period * cursor_hfrac);
217217}
218218
src/mess/video/pc_mda.c
r1461r1462
2323
2424const unsigned char mda_palette[4][3] = {
2525   { 0x00,0x00,0x00 },
26   { 0x00,0x55,0x00 },
27   { 0x00,0xaa,0x00 },
26   { 0x00,0x55,0x00 },
27   { 0x00,0xaa,0x00 },
2828   { 0x00,0xff,0x00 }
2929};
3030
r1461r1462
5252
5353/* to be done:
5454   only 2 digital color lines to mda/hercules monitor
55   (maximal 4 colors)
55   (maximal 4 colors)
5656   PC200 uses different attributes from IBM.
5757*/
5858const unsigned short mda_colortable[] =
r1461r1462
6868/* nb: This---------------------------------------------^ should refer to a "dim" colour which
6969 * we don't do yet */
7070
71/* flashing is done by dirtying the videoram buffer positions with attr bit #7 set
71/* flashing is done by dirtying the videoram buffer positions with attr bit #7 set
7272 * These attributes are used for the flashing characters when they're visible. */
7373   0, 0, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10,
7474   0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10, 0,10,
r1461r1462
158158   int i, y;
159159
160160   /* Support up to 4 fonts for PC200 */
161   for (i = 0; i < 4; i++)
161   for (i = 0; i < 4; i++)
162162   {
163163      mda.gfx_char[i] = Machine->gfx[gfx_char + (i & gfx_char_mask)];
164164   }
r1461r1462
314314
315315   for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height) {
316316
317      for (sx=0, r.min_x=0, r.max_x = char_width-1; sx<columns;
317      for (sx=0, r.min_x=0, r.max_x = char_width-1; sx<columns;
318318          sx++, offs=(offs+2)&0x3fff, r.min_x += char_width, r.max_x += char_width) {
319319         if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) {
320           
321            attr = videoram[offs+1];   
320
321            attr = videoram[offs+1];
322322            drawgfx(bitmap, mda.gfx_char[CGA_FONT], videoram[offs], attr,
323323                  0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0);
324            /* Underlining */
325            if ((attr & 7) == 1)
326               plot_box(bitmap, r.min_x, r.min_y + 12, char_width,
324            /* Underlining */
325            if ((attr & 7) == 1)
326               plot_box(bitmap, r.min_x, r.min_y + 12, char_width,
327327                  1, Machine->pens[2 + (attr & 8)]);
328328
329329            if (cursor.on&&(mda.pc_framecnt&32)&&(offs==cursor.pos*2)) {
330330               int k=height-cursor.top;
331331               rectangle rect2=r;
332               rect2.min_y+=cursor.top;
332               rect2.min_y+=cursor.top;
333333               if (cursor.bottom<height) k=cursor.bottom-cursor.top+1;
334334
335335               if (k>0)
336                  plot_box(bitmap, r.min_x,
337                         r.min_y+cursor.top,
336                  plot_box(bitmap, r.min_x,
337                         r.min_y+cursor.top,
338338                         char_width, k, Machine->pens[2/*?*/]);
339339            }
340340
r1461r1462
369369
370370   for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height) {
371371
372      for (sx=0, r.min_x=0, r.max_x = char_width-1; sx<columns;
372      for (sx=0, r.min_x=0, r.max_x = char_width-1; sx<columns;
373373          sx++, offs=(offs+2)&0x3fff, r.min_x += char_width, r.max_x += char_width) {
374374
375375         if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1]) {
376           
376
377377            int attr = videoram[offs+1];
378378            if (attr & 0x80)   /* blinking ? */
379379            {
r1461r1462
382382
383383            drawgfx(bitmap, mda.gfx_char[CGA_FONT], videoram[offs], attr,
384384                  0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0);
385            /* Underlining */
386            if ((attr & 7) == 1)
387               plot_box(bitmap, r.min_x, r.min_y + 12, char_width,
385            /* Underlining */
386            if ((attr & 7) == 1)
387               plot_box(bitmap, r.min_x, r.min_y + 12, char_width,
388388                  1, Machine->pens[2 + (attr & 8)]);
389389
390390//            if ((cursor.on)&&(offs==cursor.pos*2)) {
391391            if (cursor.on&&(mda.pc_framecnt&32)&&(offs==cursor.pos*2)) {
392392               int k=height-cursor.top;
393393               rectangle rect2=r;
394               rect2.min_y+=cursor.top;
394               rect2.min_y+=cursor.top;
395395               if (cursor.bottom<height) k=cursor.bottom-cursor.top+1;
396396
397397               if (k>0)
398                  plot_box(bitmap, r.min_x,
399                         r.min_y+cursor.top,
398                  plot_box(bitmap, r.min_x,
399                         r.min_y+cursor.top,
400400                         char_width, k, Machine->pens[2/*?*/]);
401401            }
402402
src/mess/video/abc80x.c
r1461r1462
5151
5252VIDEO_START( abc800m )
5353{
54   tx_tilemap = tilemap_create(abc800_get_tile_info, tilemap_scan_rows,
54   tx_tilemap = tilemap_create(abc800_get_tile_info, tilemap_scan_rows,
5555      TILEMAP_TYPE_PEN, 6, 10, 80, 24);
5656}
5757
r1461r1462
9999
100100VIDEO_START( abc802 )
101101{
102   tx_tilemap_40 = tilemap_create(abc802_get_tile_info_40, tilemap_scan_rows,
102   tx_tilemap_40 = tilemap_create(abc802_get_tile_info_40, tilemap_scan_rows,
103103      TILEMAP_TYPE_PEN, 12, 10, 40, 24);
104104
105   tx_tilemap = tilemap_create(abc802_get_tile_info_80, tilemap_scan_rows,
105   tx_tilemap = tilemap_create(abc802_get_tile_info_80, tilemap_scan_rows,
106106      TILEMAP_TYPE_PEN, 6, 10, 80, 24);
107107
108108   abc802_columns = 80;
src/mess/video/cgapal.c
r1461r1462
11
2/* CGA palettes
2/* CGA palettes
33 *
44 * The first 16 are for RGB monitors
55 * The next  16 are for greyscale modes
66 * The next  16 are for text modes on colour composite
77 * The next  16*16 are Mode 6 (colour composite) }
88 * The next  64*16 are Mode 4 (colour composite) } both indexed by the CGA colour select register 0x3D9
9 *
10 */
9 *
10 */
1111
1212const unsigned char cga_palette[1328][3] =
1313{
r1461r1462
2222   { 0x88, 0x88, 0x88 }, { 0x99, 0x99, 0x99 }, { 0xCC, 0xCC, 0xCC }, { 0xDD, 0xDD, 0xDD },
2323   { 0xAA, 0xAA, 0xAA }, { 0xBB, 0xBB, 0xBB }, { 0xEE, 0xEE, 0xEE }, { 0xFF, 0xFF, 0xFF },
2424/* Text mode, composite monitor */
25   { 0x00, 0x00, 0x00 }, { 0x0E, 0x00, 0x7A }, { 0x07, 0x55, 0x00 }, { 0x02, 0x65, 0x39 },   
25   { 0x00, 0x00, 0x00 }, { 0x0E, 0x00, 0x7A }, { 0x07, 0x55, 0x00 }, { 0x02, 0x65, 0x39 },
2626   { 0x51, 0x00, 0x1A }, { 0x54, 0x00, 0x76 }, { 0x48, 0x63, 0x00 }, { 0x8c, 0x8c, 0x8c },
2727   { 0x38, 0x38, 0x38 }, { 0x58, 0x49, 0xD5 }, { 0x5F, 0xAD, 0x26 }, { 0x5B, 0xB9, 0xAC },
2828   { 0xAA, 0x4A, 0x5E }, { 0xA7, 0x55, 0xD2 }, { 0xA2, 0xB9, 0x31 }, { 0xE2, 0xE2, 0xE2 },
r1461r1462
6767   { 0x20, 0x33, 0x00 }, { 0x00, 0x85, 0x00 }, { 0x2E, 0x25, 0x28 }, { 0x00, 0x98, 0x3B },
6868   { 0xb1, 0x11, 0x00 }, { 0x6A, 0x75, 0x00 }, { 0xcc, 0x16, 0x81 }, { 0x91, 0x8e, 0x91 },
6969/* Composite hi-res, colour reg = 8 */
70   { 0x00, 0x00, 0x00 }, { 0x00, 0x12, 0x0F }, { 0x04, 0x00, 0x5F }, { 0x00, 0x02, 0x67 },
70   { 0x00, 0x00, 0x00 }, { 0x00, 0x12, 0x0F }, { 0x04, 0x00, 0x5F }, { 0x00, 0x02, 0x67 },
7171   { 0x31, 0x00, 0x01 }, { 0x04, 0x01, 0x04 }, { 0x37, 0x00, 0x52 }, { 0x17, 0x00, 0x6d },
7272   { 0x00, 0x10, 0x00 }, { 0x00, 0x29, 0x00 }, { 0x04, 0x03, 0x04 }, { 0x00, 0x24, 0x16 },
7373   { 0x2f, 0x00, 0x00 }, { 0x07, 0x23, 0x00 }, { 0x43, 0x00, 0x08 }, { 0x25, 0x23, 0x24 },
r1461r1462
127127   { 0x26, 0x46, 0x73 }, { 0x2f, 0x34, 0x27 }, { 0x50, 0x00, 0x0b }, { 0x48, 0x31, 0x47 },
128128   { 0x3e, 0x70, 0x1e }, { 0x40, 0x5f, 0x00 }, { 0x57, 0x1d, 0x00 }, { 0x4a, 0x62, 0x00 },
129129/* Composite lo-res, colour reg = 4 */
130   { 0x52, 0x00, 0x14 }, { 0x2e, 0x32, 0x25 }, { 0x52, 0x00, 0x14 }, { 0x46, 0x2f, 0x47 },
131   { 0x1f, 0x09, 0x00 }, { 0x04, 0x55, 0x00 }, { 0x21, 0x0e, 0x00 }, { 0x11, 0x50, 0x02 },
130   { 0x52, 0x00, 0x14 }, { 0x2e, 0x32, 0x25 }, { 0x52, 0x00, 0x14 }, { 0x46, 0x2f, 0x47 },
131   { 0x1f, 0x09, 0x00 }, { 0x04, 0x55, 0x00 }, { 0x21, 0x0e, 0x00 }, { 0x11, 0x50, 0x02 },
132132   { 0x52, 0x00, 0x14 }, { 0x2d, 0x33, 0x25 }, { 0x52, 0x00, 0x14 }, { 0x40, 0x36, 0x3f },
133133   { 0x5c, 0x18, 0x00 }, { 0x40, 0x5f, 0x00 }, { 0x5e, 0x19, 0x00 }, { 0x4b, 0x62, 0x00 },
134134/* Composite lo-res, colour reg = 5 */
r1461r1462
152152   { 0x4d, 0x10, 0x5f }, { 0x2c, 0x33, 0x26 }, { 0x51, 0x00, 0x0f }, { 0x41, 0x35, 0x47 },
153153   { 0x5a, 0x35, 0x00 }, { 0x43, 0x5f, 0x00 }, { 0x5f, 0x15, 0x00 }, { 0x4d, 0x62, 0x00 },
154154/* Composite lo-res, colour reg = 9 */
155   { 0x92, 0x47, 0xd3 }, { 0x47, 0x47, 0x1b }, { 0x66, 0x00, 0x09 }, { 0x54, 0x44, 0x37 },
155   { 0x92, 0x47, 0xd3 }, { 0x47, 0x47, 0x1b }, { 0x66, 0x00, 0x09 }, { 0x54, 0x44, 0x37 },
156156   { 0x15, 0x4b, 0x8a }, { 0x05, 0x55, 0x00 }, { 0x00, 0x10, 0x00 }, { 0x10, 0x52, 0x02 },
157157   { 0x40, 0x33, 0xd4 }, { 0x2f, 0x33, 0x26 }, { 0x51, 0x00, 0x0d }, { 0x3e, 0x37, 0x3e },
158158   { 0x51, 0x59, 0x75 }, { 0x3b, 0x63, 0x00 }, { 0x5b, 0x1a, 0x00 }, { 0x49, 0x64, 0x00 },
r1461r1462
274274/* Composite lo-res, colour reg = 21 */
275275   { 0x06, 0x00, 0x7C }, { 0x00, 0x3B, 0xA0 }, { 0x14, 0x00, 0x93 }, { 0x00, 0x49, 0xF7 },
276276   { 0x19, 0x12, 0x13 }, { 0x02, 0x63, 0x3f }, { 0x25, 0x16, 0x2b }, { 0x09, 0x71, 0x93 },
277   { 0x46, 0x00, 0x65 }, { 0x28, 0x45, 0x93 }, { 0x50, 0x00, 0x80 }, { 0x32, 0x55, 0xe6 },
277   { 0x46, 0x00, 0x65 }, { 0x28, 0x45, 0x93 }, { 0x50, 0x00, 0x80 }, { 0x32, 0x55, 0xe6 },
278278   { 0x9c, 0x2d, 0x0c }, { 0x86, 0x78, 0x44 }, { 0xaa, 0x29, 0x33 }, { 0x92, 0x84, 0x84 },
279279/* Composite lo-res, colour reg = 22 */
280280   { 0x05, 0x56, 0x00 }, { 0x04, 0x69, 0x32 }, { 0x21, 0x1d, 0x13 }, { 0x07, 0x76, 0x7e },
r1461r1462
285285   { 0x02, 0x61, 0x49 }, { 0x02, 0x61, 0x49 }, { 0x24, 0x15, 0x27 }, { 0x05, 0x73, 0x84 },
286286   { 0x02, 0x61, 0x49 }, { 0x02, 0x61, 0x49 }, { 0x24, 0x15, 0x27 }, { 0x05, 0x73, 0x84 },
287287   { 0x2a, 0x43, 0x96 }, { 0x2a, 0x43, 0x96 }, { 0x51, 0x00, 0x7d }, { 0x31, 0x5a, 0xdc },
288   { 0x86, 0x79, 0x3d }, { 0x86, 0x79, 0x3d }, { 0xa8, 0x2a, 0x21 }, { 0x8a, 0x8a, 0x8a },
288   { 0x86, 0x79, 0x3d }, { 0x86, 0x79, 0x3d }, { 0xa8, 0x2a, 0x21 }, { 0x8a, 0x8a, 0x8a },
289289/* Composite lo-res, colour reg = 24 */
290290   { 0x51, 0x00, 0x0e }, { 0x2b, 0x49, 0x76 }, { 0x4c, 0x04, 0x53 }, { 0x23, 0x5a, 0xf5 },
291291   { 0x22, 0x05, 0x00 }, { 0x04, 0x06, 0x4b }, { 0x22, 0x13, 0x22 }, { 0x03, 0x74, 0x82 },
r1461r1462
390390   { 0x24, 0x24, 0x24 }, { 0x06, 0x91, 0xd8 }, { 0x2a, 0x44, 0xb9 }, { 0x0f, 0x9e, 0xfe },
391391   { 0x7a, 0x49, 0x00 }, { 0x58, 0xbc, 0x98 }, { 0x7a, 0x6d, 0x7f }, { 0x5e, 0xc8, 0xeb },
392392   { 0xa3, 0x36, 0x3a }, { 0x7f, 0x9c, 0xec }, { 0xa8, 0x54, 0xd7 }, { 0x8a, 0xad, 0xff },
393   { 0xf7, 0x64, 0x00 }, { 0xe1, 0xd1, 0x9c }, { 0xfd, 0x7f, 0x8b }, { 0xe4, 0xe4, 0xe4 },   
393   { 0xf7, 0x64, 0x00 }, { 0xe1, 0xd1, 0x9c }, { 0xfd, 0x7f, 0x8b }, { 0xe4, 0xe4, 0xe4 },
394394/* Composite lo-res, colour reg = 39 */
395395   { 0x62, 0x46, 0xd3 }, { 0x3d, 0x93, 0xf2 }, { 0x6b, 0x46, 0xeb }, { 0x4f, 0xa0, 0xff },
396396   { 0x6f, 0x69, 0x6b }, { 0x58, 0xbb, 0x9b }, { 0x7b, 0x6e, 0x80 }, { 0x5e, 0xc8, 0xec },
src/mess/video/pc_t1t.c
r1461r1462
135135   memcpy(colortable, pcjr_colortable, sizeof(pcjr_colortable));
136136}
137137
138static struct {
138static struct {
139139   UINT8 mode_control, color_select;
140140   UINT8 status;
141141
142142   int full_refresh;
143   
143
144144   // used in tandy1000hx; used in pcjr???
145145   struct {
146146      UINT8 index;
r1461r1462
151151         2 border color
152152         3 mode control 2
153153         4 reset
154         0x10-0x1f palette registers
154         0x10-0x1f palette registers
155155      */
156156   } reg;
157157
r1461r1462
324324        case 0x14: case 0x15: case 0x16: case 0x17:
325325        case 0x18: case 0x19: case 0x1a: case 0x1b:
326326        case 0x1c: case 0x1d: case 0x1e: case 0x1f:
327         palette_set_color_rgb(Machine, pcjr.reg.index-0x10,
327         palette_set_color_rgb(Machine, pcjr.reg.index-0x10,
328328                         cga_palette[data&0xf][0],
329329                         cga_palette[data&0xf][1],
330330                         cga_palette[data&0xf][2]);
r1461r1462
498498   gfx_element *gfx;
499499
500500   gfx = Machine->gfx[ch & 0x80 ? 1 : 0];
501   drawgfx(bitmap, gfx, ch & 0x7f, attr,
501   drawgfx(bitmap, gfx, ch & 0x7f, attr,
502502         0, 0, r->min_x, r->min_y, r, TRANSPARENCY_NONE, 0);
503503
504504   height = r->max_y - r->min_y + 1;
r1461r1462
532532
533533   for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height) {
534534
535      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
535      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
536536          sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8)
537537      {
538538         if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1])
539539         {
540540            UINT8 ch = pcjr.displayram[offs];
541541            UINT8 attr = pcjr.displayram[offs + 1];
542           
542
543543            t1t_plot_char(bitmap, &r, ch, attr);
544544
545545            if (cursor.on && (pcjr.pc_framecnt & 32) && (offs == cursor.pos * 2))
546546            {
547547               int k = height - cursor.top;
548548               rectangle rect2 = r;
549               rect2.min_y += cursor.top;
549               rect2.min_y += cursor.top;
550550               if (cursor.bottom<height)
551551                  k=cursor.bottom-cursor.top+1;
552552
553553               if (k>0)
554                  plot_box(bitmap, r.min_x,
555                           r.min_y+cursor.top,
554                  plot_box(bitmap, r.min_x,
555                           r.min_y+cursor.top,
556556                           8, k, Machine->pens[7]);
557557            }
558558
r1461r1462
584584
585585   for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height)
586586   {
587      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
587      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
588588         sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8)
589589      {
590590         if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1])
591591         {
592592            UINT8 ch = pcjr.displayram[offs + 0];
593593            UINT8 attr = pcjr.displayram[offs + 1];
594               
594
595595            if (attr & 0x80)   /* blinking ? */
596596            {
597597               if (pcjr.pc_blink)
r1461r1462
612612                  k = cursor.bottom - cursor.top + 1;
613613
614614               if (k>0)
615                  plot_box(bitmap, r.min_x,
616                     r.min_y+cursor.top,
615                  plot_box(bitmap, r.min_x,
616                     r.min_y+cursor.top,
617617                     8, k, Machine->pens[7]);
618618            }
619619
src/mess/video/coco3.c
r1461r1462
132132   for (i = 0; i < count; i++)
133133   {
134134      c = current_palette[indexes[i] & 0x3F];
135   
135
136136      if (is_black_white)
137137      {
138138         /* We are on a composite monitor/TV and the monochrome phase invert
r1461r1462
144144         UINT32 blue  = ((c & 0x0000FF) >>  0);
145145         c = (red + green + blue) / 3;
146146      }
147     
147
148148      results[i] = c;
149149   }
150150}
r1461r1462
422422         {
423423            line = BITMAP_ADDR32(bitmap, row, 0);
424424            for (i = 319; i >= 0; i--)
425               line[i * 2 + 0] = line[i * 2 + 1] = line[i];           
425               line[i * 2 + 0] = line[i * 2 + 1] = line[i];
426426         }
427427      }
428428   }
r1461r1462
463463static int coco3_new_frame(void)
464464{
465465   int gime_field_sync = 0;
466   
466
467467   /* changing from non-legacy to legacy video? */
468468   if (!video->legacy_video && (coco3_gimereg[0] & 0x80))
469469      coco3_set_dirty();
r1461r1462
671671    * The code below is based on an algorithm specified in the following
672672    * CoCo BASIC program was used to approximate composite colors.
673673    * (Program by SockMaster):
674    *
674    *
675675    * 10 POKE65497,0:DIMR(63),G(63),B(63):WIDTH80:PALETTE0,0:PALETTE8,54:CLS1
676676    * 20 SAT=92:CON=70:BRI=-50:L(0)=0:L(1)=47:L(2)=120:L(3)=255
677677    * 30 W=.4195456981879*1.01:A=W*9.2:S=A+W*5:D=S+W*5:P=0:FORH=0TO3:P=P+1
r1461r1462
802802   for (i = 0; i < 32; i++)
803803   {
804804      /* characters 0-31 are at $FA10 - $FB0F */
805      memcpy(video->fontdata[i], &rom[0xFA10 - 0x8000 + (i * 8)], 8);   
805      memcpy(video->fontdata[i], &rom[0xFA10 - 0x8000 + (i * 8)], 8);
806806   }
807807   for (i = 32; i < 128; i++)
808808   {
809809      /* characters 32-127 are at $F09D - $F39C */
810      memcpy(video->fontdata[i], &rom[0xF09D - 0x8000 + ((i - 32) * 8)], 8);   
810      memcpy(video->fontdata[i], &rom[0xF09D - 0x8000 + ((i - 32) * 8)], 8);
811811   }
812812
813813   /* GIME field sync timer */
src/mess/video/pc_aga.c
r1461r1462
297297 READ8_HANDLER( pc_aga_videoram_r )
298298{
299299   switch (aga.mode) {
300   case AGA_COLOR:
300   case AGA_COLOR:
301301      if (offset>=0x8000) return videoram[offset-0x8000];
302302      return 0;
303303   case AGA_MONO:
r1461r1462
311311{
312312   switch (aga.mode)
313313   {
314      default:
314      default:
315315         if (offset>=0x8000) return videoram[offset-0x8000];
316316         return 0;
317317      case AGA_MONO:
r1461r1462
363363
364364/* The bottom 3 bits of this port are:
365365 * Bit 2: Disable AGA
366 * Bit 1: Select MDA
366 * Bit 1: Select MDA
367367 * Bit 0: Select external display (monitor) rather than internal display
368368 *       (TV for PC200; LCD for PPC512) */
369369      if ((pc200.porte & 7) != (data & 7))
src/mess/video/smsvdp.c
r1461r1462
795795            }
796796         }
797797      }
798   
798
799799      if ( smsvdp.reg[0x01] & 0x02 ) {
800800         spriteTileSelected += 2;
801801         pattern = spritePatternTable[ spriteTileSelected * 8 + spriteLine ];
r1461r1462
863863            penSelected = colors >> 4;
864864         } else {
865865            penSelected = colors & 0x0F;
866         }
866         }
867867         if ( ! penSelected ) {
868868            penSelected = BACKDROP_COLOR;
869869         }
r1461r1462
881881
882882static void sms_refresh_line_mode0(int *lineBuffer, int line) {
883883   int tileColumn;
884   int pixelX, pixelPlotX;
884   int pixelX, pixelPlotX;
885885   UINT8 *nameTable, *colorTable, *patternTable;
886886
887887   /* Draw background layer */
888888   nameTable = smsvdp.VRAM + ( ( smsvdp.reg[0x02] & 0x0F ) << 10 ) + ( ( line >> 3 ) * 32 );
889889   colorTable = smsvdp.VRAM + ( ( smsvdp.reg[0x03] << 6 ) & ( VRAM_SIZE - 1 ) );
890   patternTable = smsvdp.VRAM + ( ( smsvdp.reg[0x04] << 11 ) & ( VRAM_SIZE - 1 ) );
890   patternTable = smsvdp.VRAM + ( ( smsvdp.reg[0x04] << 11 ) & ( VRAM_SIZE - 1 ) );
891891   for ( tileColumn = 0; tileColumn < 32; tileColumn++ ) {
892892      UINT8 pattern;
893893      UINT8 colors;
src/mess/video/pc_cga.c
r1461r1462
120120/* the color sets for 2bpp graphics mode. There are 32*3 = 96 of these,
121121 * though only the first 64 are documented. */
122122/* Red/Green/Yellow set */
123      0, 2, 4, 6,  1, 2, 4, 6,  2, 2, 4, 6,  3, 2, 4, 6,
124      4, 2, 4, 6,  5, 2, 4, 6,  6, 2, 4, 6,  7, 2, 4, 6,
125      8, 2, 4, 6,  9, 2, 4, 6, 10, 2, 4, 6, 11, 2, 4, 6,
126     12, 2, 4, 6, 13, 2, 4, 6, 14, 2, 4, 6, 15, 2, 4, 6,
123      0, 2, 4, 6,  1, 2, 4, 6,  2, 2, 4, 6,  3, 2, 4, 6,
124      4, 2, 4, 6,  5, 2, 4, 6,  6, 2, 4, 6,  7, 2, 4, 6,
125      8, 2, 4, 6,  9, 2, 4, 6, 10, 2, 4, 6, 11, 2, 4, 6,
126     12, 2, 4, 6, 13, 2, 4, 6, 14, 2, 4, 6, 15, 2, 4, 6,
127127      0,10,12,14,  1,10,12,14,  2,10,12,14,  3,10,12,14,
128128      4,10,12,14,  5,10,12,14,  6,10,12,14,  7,10,12,14,
129129      8,10,12,14,  9,10,12,14, 10,10,12,14, 11,10,12,14,
130130     12,10,12,14, 13,10,12,14, 14,10,12,14, 15,10,12,14,
131131/* Magenta/Cyan/White set */
132      0, 3, 5, 7,  1, 3, 5, 7,  2, 3, 5, 7,  3, 3, 5, 7,
133      4, 3, 5, 7,  5, 3, 5, 7,  6, 3, 5, 7,  7, 3, 5, 7,
134      8, 3, 5, 7,  9, 3, 5, 7, 10, 3, 5, 7, 11, 3, 5, 7,
135     12, 3, 5, 7, 13, 3, 5, 7, 14, 3, 5, 7, 15, 3, 5, 7,
132      0, 3, 5, 7,  1, 3, 5, 7,  2, 3, 5, 7,  3, 3, 5, 7,
133      4, 3, 5, 7,  5, 3, 5, 7,  6, 3, 5, 7,  7, 3, 5, 7,
134      8, 3, 5, 7,  9, 3, 5, 7, 10, 3, 5, 7, 11, 3, 5, 7,
135     12, 3, 5, 7, 13, 3, 5, 7, 14, 3, 5, 7, 15, 3, 5, 7,
136136      0,11,13,15,  1,11,13,15,  2,11,13,15,  3,11,13,15,
137137      4,11,13,15,  5,11,13,15,  6,11,13,15,  7,11,13,15,
138138      8,11,13,15,  9,11,13,15, 10,11,13,15, 11,11,13,15,
139139     12,11,13,15, 13,11,13,15, 14,11,13,15, 15,11,13,15,
140140/* Red/Cyan/White set (undocumented) */
141      0, 3, 4, 7,  1, 3, 4, 7,  2, 3, 4, 7,  3, 3, 4, 7,
142      4, 3, 4, 7,  5, 3, 4, 7,  6, 3, 4, 7,  7, 3, 4, 7,
143      8, 3, 4, 7,  9, 3, 4, 7, 10, 3, 4, 7, 11, 3, 4, 7,
144     12, 3, 4, 7, 13, 3, 4, 7, 14, 3, 4, 7, 15, 3, 4, 7,
141      0, 3, 4, 7,  1, 3, 4, 7,  2, 3, 4, 7,  3, 3, 4, 7,
142      4, 3, 4, 7,  5, 3, 4, 7,  6, 3, 4, 7,  7, 3, 4, 7,
143      8, 3, 4, 7,  9, 3, 4, 7, 10, 3, 4, 7, 11, 3, 4, 7,
144     12, 3, 4, 7, 13, 3, 4, 7, 14, 3, 4, 7, 15, 3, 4, 7,
145145      0,11,12,15,  1,11,12,15,  2,11,12,15,  3,11,12,15,
146146      4,11,12,15,  5,11,12,15,  6,11,12,15,  7,11,12,15,
147147      8,11,12,15,  9,11,12,15, 10,11,12,15, 11,11,12,15,
r1461r1462
219219#define CGA_CHIPSET_PC1512      0x20   /* PC1512 CGA subset */
220220#define CGA_CHIPSET_PC200      0x40   /* PC200 in CGA mode */
221221#define CGA_CHIPSET_ATI         0x60   /* ATI (supports Plantronics) */
222#define CGA_CHIPSET_PARADISE   0x80   /* Paradise (used in PC1640) */
222#define CGA_CHIPSET_PARADISE   0x80   /* Paradise (used in PC1640) */
223223
224224static struct
225{
225{
226226   UINT8 mode_control;   /* wo 0x3d8 */
227227   UINT8 color_select;   /* wo 0x3d9 */
228228   UINT8 status;      /* ro 0x3da */
229229   UINT8 plantronics;   /* wo 0x3dd, ATI chipset only */
230   
230
231231   int pc_blink;
232232   int frame;
233233   int palette;
r1461r1462
287287   int buswidth;
288288
289289   /* Changed video RAM size to full 32k, for cards which support the
290    * Plantronics chipset.
291    * TODO: Cards which don't support Plantronics should repeat at
290    * Plantronics chipset.
291    * TODO: Cards which don't support Plantronics should repeat at
292292    * BC000h */
293293   buswidth = cputype_databus_width(machine->drv->cpu[0].type, ADDRESS_SPACE_PROGRAM);
294294   switch(buswidth)
r1461r1462
336336
337337   switch(CGA_MONITOR)
338338   {
339      case CGA_MONITOR_COMPOSITE:
339      case CGA_MONITOR_COMPOSITE:
340340         if (cga.mode_control & 4)
341341         {
342342            p = 1;   /* Greyscale palette */
r1461r1462
368368   if (p != cga.palette)
369369   {
370370      for(i = 0; i < (sizeof(cga_palette) / (3 * CGA_PALETTE_SETS)); i++)
371         palette_set_color_rgb(Machine, i, cga_palette[i + p][0],
371         palette_set_color_rgb(Machine, i, cga_palette[i + p][0],
372372                    cga_palette[i + p][1],
373373                    cga_palette[i + p][2]);
374374      cga.palette = p;
r1461r1462
388388   CGA_LOG(1,"CGA_mode_control_w",(errorlog, "$%02x: columns %d, gfx %d, hires %d, blink %d\n",
389389      data, (data&1)?80:40, (data>>1)&1, (data>>4)&1, (data>>5)&1));
390390
391   /* CGA composite: Switching between mono & colour behaves like a
391   /* CGA composite: Switching between mono & colour behaves like a
392392    * mode change */
393393   if(CGA_MONITOR == CGA_MONITOR_COMPOSITE) mask = 0x3F;
394394
r1461r1462
415415
416416
417417
418/*
419 * Select Plantronics modes
418/*
419 * Select Plantronics modes
420420 */
421421static void pc_cga_plantronics_w(int data)
422422{
r1461r1462
537537   {
538538      if (r.min_y >= Machine->screen[0].height)
539539         break;
540      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
540      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
541541          sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8)
542542      {
543543         if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1])
544544         {
545            drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], videoram[offs+1],
545            drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], videoram[offs+1],
546546                  0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0);
547547            if (height > 16)
548548            {
r1461r1462
559559
560560               if (k>0)
561561               {
562                  plot_box(bitmap, r.min_x,
563                         r.min_y+cursor.top,
562                  plot_box(bitmap, r.min_x,
563                         r.min_y+cursor.top,
564564                         8, k, Machine->pens[7]);
565565               }
566566            }
r1461r1462
589589   rectangle r;
590590   struct mscrtc6845_cursor cursor;
591591
592   if (CGA_CHIPSET != CGA_CHIPSET_PC200)
592   if (CGA_CHIPSET != CGA_CHIPSET_PC200)
593593   {
594594      cga_text_inten(bitmap, crtc);
595595      return;
r1461r1462
601601
602602   for (sy=0, r.min_y=0, r.max_y=height-1; sy<lines; sy++, r.min_y+=height,r.max_y+=height)
603603   {
604      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
604      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
605605          sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8)
606606      {
607607         if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1])
608608         {
609            drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], (videoram[offs+1] & 15),
609            drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], (videoram[offs+1] & 15),
610610                  0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0);
611611            if (cursor.on && cga_blinkthisframe() && (offs==cursor.pos*2))
612612            {
r1461r1462
615615
616616               if (k>0)
617617               {
618                  plot_box(bitmap, r.min_x,
619                         r.min_y+cursor.top,
618                  plot_box(bitmap, r.min_x,
619                         r.min_y+cursor.top,
620620                         8, k, Machine->pens[7]);
621621               }
622622            }
r1461r1462
653653      if (r.min_y >= Machine->screen[0].height)
654654         break;
655655
656      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
656      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
657657          sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8)
658658      {
659659         if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1])
660660         {
661           
661
662662            int attr = videoram[offs+1];
663           
663
664664            if (attr & 0x80)   /* blinking ? */
665665            {
666666               if (cga.pc_blink)
r1461r1462
669669                  attr = attr & 0x7f;
670670            }
671671
672            drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], attr,
672            drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], attr,
673673                  0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0);
674674            if (height>16)
675675            {
r1461r1462
686686
687687               if (k > 0)
688688               {
689                  plot_box(bitmap, r.min_x,
690                         r.min_y+cursor.top,
689                  plot_box(bitmap, r.min_x,
690                         r.min_y+cursor.top,
691691                         8, k, Machine->pens[7]);
692692               }
693693            }
r1461r1462
715715   int columns = mscrtc6845_get_char_columns(crtc);
716716   rectangle r;
717717   struct mscrtc6845_cursor cursor;
718   
719   if (CGA_CHIPSET != CGA_CHIPSET_PC200)
718
719   if (CGA_CHIPSET != CGA_CHIPSET_PC200)
720720   {
721721      cga_text_blink(bitmap, crtc);
722722      return;
r1461r1462
731731      if (r.min_y >= Machine->screen[0].height)
732732         break;
733733
734      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
734      for (sx=0, r.min_x=0, r.max_x=7; sx<columns;
735735          sx++, offs=(offs+2)&0x3fff, r.min_x+=8, r.max_x+=8)
736736      {
737737         if (!dirtybuffer || dirtybuffer[offs] || dirtybuffer[offs+1])
738738         {
739           
739
740740            int attr = videoram[offs+1];
741           
741
742742            if ((attr & 0x80) && cga.pc_blink)   /* blinking ? */
743743               attr = (attr & 0x70) >> 4;
744744            else
745745               attr = attr & 0x0F;
746746
747            drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], attr,
747            drawgfx(bitmap, Machine->gfx[CGA_FONT], videoram[offs], attr,
748748                  0,0,r.min_x,r.min_y,&r,TRANSPARENCY_NONE,0);
749749
750750            if (cga_blinkthisframe() && (offs==cursor.pos*2))
r1461r1462
754754
755755               if (k > 0)
756756               {
757                  plot_box(bitmap, r.min_x,
758                         r.min_y+cursor.top,
757                  plot_box(bitmap, r.min_x,
758                         r.min_y+cursor.top,
759759                         8, k, Machine->pens[7]);
760760               }
761761            }
r1461r1462
780780   const UINT16 *palette;
781781   int colorset = cga.color_select & 0x3F;
782782
783   /* Most chipsets use bit 2 of the mode control register to
783   /* Most chipsets use bit 2 of the mode control register to
784784    * access a third palette. But not consistently. */
785785   pc_cga_check_palette();
786786   switch(CGA_CHIPSET)
r1461r1462
797797      case CGA_CHIPSET_PARADISE:
798798      if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64;
799799      break;
800   }   
800   }
801801
802802   /* The fact that our palette is located in cga_colortable is a vestigial
803803    * aspect from when we were doing that ugly trick where drawgfx() would
r1461r1462
833833
834834
835835
836INLINE void cga_plot_unit_4bpp(mame_bitmap *bitmap,
836INLINE void cga_plot_unit_4bpp(mame_bitmap *bitmap,
837837             int x, int y, int offs, int scale)
838838{
839839   int color;
r1461r1462
856856
857857   pc_cga_check_palette();
858858
859   for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff)
859   for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff)
860860   {
861      for (sh=0; sh<height; sh++, offs|=0x2000)
862      {
861      for (sh=0; sh<height; sh++, offs|=0x2000)
862      {
863863         // char line 0 used as a12 line in graphic mode
864864         if (!(sh & 1))
865865         {
866            for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff)
866            for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff)
867867            {
868               if (!dirtybuffer || dirtybuffer[i])
868               if (!dirtybuffer || dirtybuffer[i])
869869               {
870870                  cga_plot_unit_4bpp(bitmap, sx*scale, sy*height+sh, i, scale/2);
871871                  if (dirtybuffer)
r1461r1462
875875         }
876876         else
877877         {
878            for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000)
878            for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000)
879879            {
880               if (!dirtybuffer || dirtybuffer[i])
880               if (!dirtybuffer || dirtybuffer[i])
881881               {
882882                  cga_plot_unit_4bpp(bitmap, sx*scale, sy*height+sh, i, scale/2);
883883                  if (dirtybuffer)
r1461r1462
890890}
891891
892892
893/* The hi-res graphics mode on a colour composite monitor
893/* The hi-res graphics mode on a colour composite monitor
894894 *
895895 * The different scaling factors mean that the '160x200' versions of screens
896896 * are the same size as the normal colour ones.
897 */
897 */
898898static void cga_gfx_4bpph(mame_bitmap *bitmap, struct mscrtc6845 *crtc)
899899{
900900   pc_cga_check_palette();
901901   cga_gfx_4bpp(bitmap, crtc, 8);
902902}
903903
904   
904
905905/* The lo-res graphics mode on a colour composite monitor */
906906static void cga_gfx_4bppl(mame_bitmap *bitmap, struct mscrtc6845 *crtc)
907907{
908908   pc_cga_check_palette();
909909   cga_gfx_4bpp(bitmap, crtc, 4);
910910}
911   
912911
913912
914913
915INLINE void pgfx_plot_unit_4bpp(mame_bitmap *bitmap,
914
915INLINE void pgfx_plot_unit_4bpp(mame_bitmap *bitmap,
916916                      int x, int y, int offs)
917917{
918918   int color, values[2];
919919   int i;
920920
921   if (cga.plantronics & 0x40)
921   if (cga.plantronics & 0x40)
922922   {
923923      values[0] = videoram[offs | 0x4000];
924924      values[1] = videoram[offs];
r1461r1462
930930   }
931931   for (i=3; i>=0; i--)
932932   {
933      color = ((values[0] & 0x3) << 1) |
933      color = ((values[0] & 0x3) << 1) |
934934         ((values[1] & 2)   >> 1) |
935935         ((values[1] & 1)   << 3);
936936      *BITMAP_ADDR16(bitmap, y, x+i) = Machine->pens[color];
r1461r1462
944944/***************************************************************************
945945  Draw graphics mode with 640x200 pixels (default) with 2 bits/pixel.
946946  Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000
947  Second plane at CGA_base + 0x4000 / 0x6000
947  Second plane at CGA_base + 0x4000 / 0x6000
948948***************************************************************************/
949949
950950static void cga_pgfx_4bpp(mame_bitmap *bitmap, struct mscrtc6845 *crtc)
r1461r1462
955955   int height = mscrtc6845_get_char_height(crtc);
956956   int columns = mscrtc6845_get_char_columns(crtc)*2;
957957
958   for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff)
958   for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff)
959959   {
960      for (sh=0; sh<height; sh++, offs|=0x2000)
961      {
960      for (sh=0; sh<height; sh++, offs|=0x2000)
961      {
962962         // char line 0 used as a12 line in graphic mode
963963         if (!(sh & 1))
964964         {
965            for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff)
965            for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff)
966966            {
967               if (!dirtybuffer || dirtybuffer[i])
967               if (!dirtybuffer || dirtybuffer[i])
968968               {
969969                  pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i);
970970                  if (dirtybuffer)
r1461r1462
974974         }
975975         else
976976         {
977            for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000)
977            for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000)
978978            {
979               if (!dirtybuffer || dirtybuffer[i])
979               if (!dirtybuffer || dirtybuffer[i])
980980               {
981981                  pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i);
982982                  if (dirtybuffer)
r1461r1462
990990
991991
992992
993INLINE void pgfx_plot_unit_2bpp(mame_bitmap *bitmap,
993INLINE void pgfx_plot_unit_2bpp(mame_bitmap *bitmap,
994994                int x, int y, const UINT16 *palette, int offs)
995995{
996996   int i;
997997   UINT8 bmap[2], values[2];
998998   UINT16 *dest;
999999
1000   if (cga.plantronics & 0x40)
1000   if (cga.plantronics & 0x40)
10011001   {
10021002      values[0] = videoram[offs];
10031003      values[1] = videoram[offs | 0x4000];
r1461r1462
10101010   bmap[0] = bmap[1] = 0;
10111011   for (i=3; i>=0; i--)
10121012   {
1013      bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1;
1014      bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1;
1015      bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1;
1016      bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1;
1017      values[0] = values[0] << 1;   
1018      values[1] = values[1] << 1;   
1013      bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1;
1014      bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1;
1015      bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1;
1016      bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1;
1017      values[0] = values[0] << 1;
1018      values[1] = values[1] << 1;
10191019   }
10201020
10211021   dest = BITMAP_ADDR16(bitmap, y, x);
r1461r1462
10471047   int colorset = cga.color_select & 0x3F;
10481048   const UINT16 *palette;
10491049
1050   /* Most chipsets use bit 2 of the mode control register to
1050   /* Most chipsets use bit 2 of the mode control register to
10511051    * access a third palette. But not consistently. */
10521052   pc_cga_check_palette();
10531053   switch(CGA_CHIPSET)
r1461r1462
10641064      case CGA_CHIPSET_PARADISE:
10651065      if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64;
10661066      break;
1067   }   
1067   }
10681068
10691069
10701070   /* The fact that our palette is located in cga_colortable is a vestigial
r1461r1462
11111111// mapping of the 4 planes into videoram
11121112// (text data should be readable at videoram+0)
11131113static const int videoram_offset[4]= { 0xc000, 0x8000, 0x4000, 0 };
1114INLINE void pc1512_plot_unit(mame_bitmap *bitmap,
1114INLINE void pc1512_plot_unit(mame_bitmap *bitmap,
11151115                      int x, int y, int offs)
11161116{
11171117   int color, values[4];
r1461r1462
11511151   int height = mscrtc6845_get_char_height(crtc);
11521152   int columns = mscrtc6845_get_char_columns(crtc)*2;
11531153
1154   for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff)
1154   for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff)
11551155   {
11561156      for (sh=0; sh<height; sh++)
1157      {
1157      {
11581158          if (sy*height+sh >= bitmap->height)
11591159            break;
11601160         // char line 0 used as a12 line in graphic mode
11611161         if (!(sh & 1))
11621162         {
1163            for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff)
1163            for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff)
11641164            {
1165               if (!dirtybuffer || dirtybuffer[i])
1165               if (!dirtybuffer || dirtybuffer[i])
11661166               {
11671167                  pc1512_plot_unit(bitmap, sx*8, sy*height+sh, i);
11681168               }
r1461r1462
11701170         }
11711171         else
11721172         {
1173            for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000)
1173            for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000)
11741174            {
1175               if (!dirtybuffer || dirtybuffer[i])
1175               if (!dirtybuffer || dirtybuffer[i])
11761176               {
11771177                  pc1512_plot_unit(bitmap, sx*8, sy*height+sh, i);
11781178               }
r1461r1462
12271227{
12281228   return cga.frame & 1;
12291229}
1230   
12311230
12321231
1232
12331233/***************************************************************************
12341234  Choose the appropriate video mode
12351235***************************************************************************/
r1461r1462
12981298      if ((cga.mode_control & 2) && (cga.plantronics & 0x10))
12991299         proc = cga_pgfx_4bpp;
13001300
1301      /* The 160x200 modes are only available on a composite
1302       * monitor */   
1303      if (proc == cga_gfx_4bppl &&
1301      /* The 160x200 modes are only available on a composite
1302       * monitor */
1303      if (proc == cga_gfx_4bppl &&
13041304          CGA_MONITOR != CGA_MONITOR_COMPOSITE) proc = cga_gfx_2bpp;
1305      if (proc == cga_gfx_4bpph &&
1305      if (proc == cga_gfx_4bpph &&
13061306          CGA_MONITOR != CGA_MONITOR_COMPOSITE) proc = cga_gfx_1bpp;
13071307
13081308      /* Modes that are 640 pixels wide */
1309      if (proc == cga_gfx_1bpp    ||
1309      if (proc == cga_gfx_1bpp    ||
13101310          proc == cga_gfx_4bpph   ||
1311          proc == pc1512_gfx_4bpp ||
1311          proc == pc1512_gfx_4bpp ||
13121312            proc == cga_pgfx_2bpp)
13131313      {
13141314         *width *= 16;
r1461r1462
14241424   memory_set_bankptr(1,videoram + videoram_offset[0]);
14251425   pc1512.write = 0xf;
14261426   pc1512.read = 0;
1427   
1427
14281428   /* PC1512 cut-down 6845 */
14291429   internal_pc_cga_video_start(M6845_PERSONALITY_PC1512);
14301430}
src/mess/video/microtan.c
r1461r1462
3939
4040VIDEO_START( microtan )
4141{
42   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
42   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
4343      TILEMAP_TYPE_PEN, 8, 16, 32, 16);
4444
4545   microtan_chunky_buffer = auto_malloc(videoram_size);
src/mess/video/intv.c
r1461r1462
9696            (s1->doubleyres ? 2 : 1);
9797    h2 = 8 * (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) *
9898            (s2->doubleyres ? 2 : 1);
99   
99
100100    if ((x1 + w1 <= x2) || (y1 + h1 <= y2) ||
101101            (x1 >= x2 + w2) || (y1 >= y2 + h2))
102102        return FALSE;
r1461r1462
609609            }
610610            offs++;
611611         } // next col
612      } // next row
612      } // next row
613613   }
614614}
615615*/
src/mess/video/cdp1864.c
r1461r1462
9494      }
9595
9696      timer_adjust(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_WAIT, 0), 0, attotime_zero);
97     
97
9898      cdp1864.dmaout = 0;
9999   }
100100   else
r1461r1462
108108      }
109109
110110      timer_adjust(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_ACTIVE, 0), 0, attotime_zero);
111     
111
112112      cdp1864.dmaout = 1;
113113   }
114114}
r1461r1462
129129      }
130130
131131      *BITMAP_ADDR16(cdptmpbitmap, y, sx + x) = Machine->pens[color];
132     
132
133133      data <<= 1;
134134   }
135135
r1461r1462
154154   {
155155      cdp1864.latch = CDP1864_DEFAULT_LATCH;
156156   }
157   
157
158158   cdp1864.audio = value;
159159
160160   beep_set_state(0, value);
r1461r1462
205205
206206   /* ensure the contents of the bitmap are saved */
207207   state_save_register_bitmap("video", 0, "cdptmpbitmap", cdptmpbitmap);
208   
208
209209   state_save_register_global(cdp1864.disp);
210210   state_save_register_global(cdp1864.dmaout);
211211   state_save_register_global(cdp1864.dmaptr);
src/mess/video/ssystem3.c
r1461r1462
8888      case 'e': mask=0x10; break;
8989      case 'f': mask=0x20; break;
9090      case 'g': mask=0x40; break;
91      case 'h':
91      case 'h':
9292         // this is more likely wired to the separate leds
93         mask=0x80;
93         mask=0x80;
9494         break;
9595      }
96     
96
9797      if (mask!=0) {
9898         color=Machine->pens[(value&mask)?1:0];
9999         *BITMAP_ADDR16(bitmap, y+yi, x+xi) = color;
r1461r1462
164164         }
165165         xi++;
166166         break;
167      case ' ':
167      case ' ':
168168         xi++;
169169         break;
170170      case '\r':
171171         xi=0;
172172         y++;
173         break;           
173         break;
174174      };
175175   }
176176}
r1461r1462
180180   int i;
181181
182182   for (i=0; i<4; i++) {
183      ssystem3_draw_7segment(bitmap, ssystem3_led[i]&0x7f, ssystem3_led_pos[i].x,
183      ssystem3_draw_7segment(bitmap, ssystem3_led[i]&0x7f, ssystem3_led_pos[i].x,
184184                        ssystem3_led_pos[i].y);
185185   }
186186
187   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
187   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
188188             ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '0');
189   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
189   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
190190             ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '1');
191   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
191   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
192192             ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '2');
193   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
193   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
194194             ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '3');
195   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
195   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
196196             ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '4');
197   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
197   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
198198             ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '5');
199   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
199   ssystem3_draw_led(bitmap, machine->pens[ssystem3_led[4]&8?1:0],
200200             ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '6');
201201   return 0;
202202}
src/mess/video/amstrad.c
r1461r1462
2323extern int amstrad_plus_pri;
2424extern int amstrad_system_type;
2525extern int amstrad_plus_irq_cause;
26extern int amstrad_plus_scroll_x; 
27extern int amstrad_plus_scroll_y; 
28extern int amstrad_plus_scroll_border; 
26extern int amstrad_plus_scroll_x;
27extern int amstrad_plus_scroll_y;
28extern int amstrad_plus_scroll_border;
2929
3030extern int amstrad_plus_dma_status;
3131extern int amstrad_plus_dma_0_addr;   // DMA channel address
32extern int amstrad_plus_dma_1_addr;
33extern int amstrad_plus_dma_2_addr;
32extern int amstrad_plus_dma_1_addr;
33extern int amstrad_plus_dma_2_addr;
3434extern int amstrad_plus_dma_prescaler[3];  // DMA channel prescaler
3535
3636static int amstrad_plus_dma_repeat[3];  // marks the location of the channels' last repeat
r1461r1462
3939
4040extern unsigned char *amstrad_plus_asic_ram;
4141
42static int amstrad_plus_split_scanline;  // ASIC split screen
42static int amstrad_plus_split_scanline;  // ASIC split screen
4343static int amstrad_plus_split_address;
4444static int amstrad_screen_width;  // width in bytes
4545
r1461r1462
9595static void (*draw_function)(void);
9696/* current programmed mode */
9797static int amstrad_current_mode;
98
98
9999static unsigned long Mode0Lookup[256];
100100static unsigned long Mode1Lookup[256];
101101static unsigned long Mode3Lookup[256];
102102
103103/* The Amstrad CPC has a fixed palette of 27 colours generated from 3 levels of Red, Green and Blue.
104The hardware allows selection of 32 colours, but these extra colours are copies of existing colours.*/
104The hardware allows selection of 32 colours, but these extra colours are copies of existing colours.*/
105105
106106static const rgb_t amstrad_palette[32] =
107107{
r1461r1462
190190The palette is defined by a colour rom. The only rom dump that exists (from the KC-Club webpage)
191191is 2K, which seems correct. In this rom the same 32 bytes of data is repeated throughout the rom.
192192
193When a I/O write is made to "Gate Array" to select the colour, Bit 7 and 6 are used by the
194"Gate Array" to define the function, bit 7 = 0, bit 6 = 1. In the  Amstrad CPC, bits 4..0
195define the hardware colour number, but in the KC Compact, it seems bits 5..0
193When a I/O write is made to "Gate Array" to select the colour, Bit 7 and 6 are used by the
194"Gate Array" to define the function, bit 7 = 0, bit 6 = 1. In the  Amstrad CPC, bits 4..0
195define the hardware colour number, but in the KC Compact, it seems bits 5..0
196196define the hardware colour number allowing 64 colours to be chosen.
197197
198198It is possible therefore that the colour rom could be reprogrammed, so that other colour
r1461r1462
201201
202202colour rom byte:
203203
204Bit Function
2057 not used
2066 not used
204Bit Function
2057 not used
2066 not used
2072075,4 Green value
2082083,2 Red value
2092091,0 Blue value
210210
211211Green value, Red value, Blue value: 0 = 0%, 01/10 = 50%, 11 = 100%.
212212The 01 case is not used, it is unknown if this produces a different amount of colour.
213*/
213*/
214214
215215static unsigned char kccomp_get_colour_element(int colour_value)
216216{
r1461r1462
261261   int i;
262262
263263   palette_set_colors(machine, 0, amstrad_palette, sizeof(amstrad_palette) / 3);
264   for ( i = 0; i < 0x1000; i++ )
264   for ( i = 0; i < 0x1000; i++ )
265265   {
266266      int r, g, b;
267267
r1461r1462
336336void amstrad_vh_update_mode(int new_mode)
337337{
338338   amstrad_current_mode = new_mode;
339   
339
340340}
341341
342342static void amstrad_draw_screen_disabled(void)
r1461r1462
426426   int x = x_screen_pos;
427427   int y = y_screen_pos;
428428
429  int i, cpcpen, messpen;
429  int i, cpcpen, messpen;
430430  unsigned char data1;
431431  unsigned char data2;
432432
r1461r1462
497497      messpen = 48 + (amstrad_plus_asic_ram[0x2400+cpcpen*2]);//amstrad_GateArray_render_colours[cpcpen];
498498      messpen += (amstrad_plus_asic_ram[0x2401+cpcpen*2]) << 8;
499499      *BITMAP_ADDR16(bitmap, y, x) = messpen;
500      x++;       
500      x++;
501501      data = data<<1;
502502   }
503503}
r1461r1462
622622   int x = x_screen_pos;
623623   int y = y_screen_pos;
624624
625  int i, cpcpen, messpen;
625  int i, cpcpen, messpen;
626626  unsigned char data1 = mess_ram[addr];
627627  unsigned char data2 = mess_ram[addr+1];
628628
r1461r1462
676676      messpen = amstrad_GateArray_render_colours[cpcpen];
677677      if ((x >= 0) && (x < bitmap->width) && (y >= 0) && (y < bitmap->height))
678678         *BITMAP_ADDR16(bitmap, y, x) = messpen;
679      x++;       
679      x++;
680680      data = data<<1;
681681   }
682682}
r1461r1462
804804   amstrad_plus_split_address = address;
805805}
806806
807/*
807/*
808808DMA commands
809809
8108100RDDh    LOAD R,D    Load 8 bit data D to PSG register R (0<=R<=15)
r1461r1462
8138133xxxh    (reserved)    Do not use
8148144000h    NOP    No operation (64us idle)
8158154001h    LOOP    If loop counter non zero, loop back to the first instruction after REPEAT instruction and decrement loop counter.
8164010h    INT    Interrupt the CPU
8164010h    INT    Interrupt the CPU
8178174020h    STOP    Stop processing the sound list.
818818*/
819819
r1461r1462
966966         y_screen_pos++;
967967      }
968968//   The GA has a counter that increments on every falling edge of the CRTC generated HSYNC signal.
969
969
970970      amstrad_CRTC_HS_Counter++;
971971      amstrad_scanline++;
972972
973973      if (amstrad_CRTC_HS_After_VS_Counter != 0)  // counters still operate regardless of PRI state
974974      {
975975         amstrad_CRTC_HS_After_VS_Counter--;
976         
976
977977         if (amstrad_CRTC_HS_After_VS_Counter == 0)
978978         {
979979            if (amstrad_CRTC_HS_Counter >= 32)
r1461r1462
986986            amstrad_CRTC_HS_Counter = 0;
987987         }
988988      }
989     
989
990990      if (amstrad_CRTC_HS_Counter == 52)
991991      {
992992         amstrad_CRTC_HS_Counter = 0;
r1461r1462
997997      }
998998      if(amstrad_plus_asic_enabled != 0)
999999      {
1000         // CPC+/GX4000 Programmable Raster Interrupt (disabled if &6800 in ASIC RAM is 0)     
1000         // CPC+/GX4000 Programmable Raster Interrupt (disabled if &6800 in ASIC RAM is 0)
10011001         if(amstrad_plus_pri != 0)
10021002         {
1003            if(m6845_get_row_counter() == ((amstrad_plus_pri >> 3) & 0x1f) && m6845_get_scanline_counter() == (amstrad_plus_pri & 0x07)) 
1003            if(m6845_get_row_counter() == ((amstrad_plus_pri >> 3) & 0x1f) && m6845_get_scanline_counter() == (amstrad_plus_pri & 0x07))
10041004            {
10051005//               logerror("PRI: triggered, scanline %i, VSync width = %i\n",amstrad_scanline,vid.vertical_sync_width);
10061006               cpunum_set_input_line(0,0,ASSERT_LINE);
r1461r1462
10331033   amstrad_CRTC_HS = data;
10341034   if(amstrad_scanline > 311) // 312 scanlines by default
10351035      amstrad_scanline = 0;
1036}
1036}
10371037
10381038/* CRTC - Set new Vertical Sync Status*/
10391039static void amstrad_Set_VS(int offset, int data)
r1461r1462
10631063   amstrad_Set_HS, // Horizontal status
10641064   amstrad_Set_VS, // Vertical status
10651065   amstrad_Set_DE, // Display Enabled status
1066   amstrad_Set_CR, // Cursor status
1066   amstrad_Set_CR, // Cursor status
10671067};
10681068
10691069/************************************************************************
r1461r1462
10911091      }
10921092   }
10931093#endif
1094    copybitmap(bitmap, amstrad_bitmap, 0,0,0,0,&rect, TRANSPARENCY_NONE,0);
1094    copybitmap(bitmap, amstrad_bitmap, 0,0,0,0,&rect, TRANSPARENCY_NONE,0);
10951095   if(amstrad_plus_asic_enabled != 0)
10961096      amstrad_plus_sprite_draw(bitmap);
10971097   amstrad_scanline = y_screen_pos - 32;
r1461r1462
11131113   m6845_config(&amstrad6845);
11141114   m6845_reset(0);
11151115   m6845_get_state(0, &amstrad_vidhrdw_6845_state);
1116   
1116
11171117   draw_function = amstrad_draw_screen_disabled;
1118   
1118
11191119   amstrad_CRTC_HS_After_VS_Counter = 2;
11201120   x_screen_pos = x_screen_offset;
11211121   y_screen_pos = y_screen_offset;
src/mess/video/avigo.c
r1461r1462
135135   /*stylus_pointer->colortable = stylus_color_table;*/
136136   stylus_pointer->total_colors = 3;
137137   stylus_color_table[1] = machine->pens[0];
138   stylus_color_table[2] = machine->pens[1];
138   stylus_color_table[2] = machine->pens[1];
139139}
140140
141141/* two colours */
r1461r1462
178178#ifdef AVIGO_VIDEO_DEBUG
179179         logerror("backdrop %s successfully loaded\n", backdrop_name);
180180#endif
181            memcpy (&sys_palette[used * 3], avigo_backdrop->orig_palette,
181            memcpy (&sys_palette[used * 3], avigo_backdrop->orig_palette,
182182                    avigo_backdrop->num_pens_used * 3 * sizeof (unsigned char));
183183      }
184184      else
r1461r1462
218218        int by;
219219
220220        unsigned char *line_ptr = avigo_video_memory +  (y*(AVIGO_SCREEN_WIDTH>>3));
221     
221
222222        x = 0;
223223        for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--)
224224        {
r1461r1462
236236            }
237237
238238            x = px;
239                           
239
240240            line_ptr = line_ptr+1;
241241        }
242242     }
src/mess/video/vdc.c
r1461r1462
380380{
381381   int i;
382382
383   /* our line buffer */
383   /* our line buffer */
384384   UINT16 *line_buffer = BITMAP_ADDR16( vce.bmp, line, 0 );
385   
385
386386   for( i=0; i< VDC_WPF; i++ )
387387      line_buffer[i] = get_black_pen( Machine );
388388}
r1461r1462
394394   /* Are we in greyscale mode or in color mode? */
395395   int color_base = vce.vce_control & 0x80 ? 512 : 0;
396396
397   /* our line buffer */
397   /* our line buffer */
398398   UINT16 *line_buffer = BITMAP_ADDR16( vce.bmp, line, 0 );
399   
399
400400   for ( i = 0; i < VDC_WPF; i++ )
401401      line_buffer[i] = Machine->pens[color_base + vce.vce_data[0x100].w];
402402}
r1461r1462
409409
410410   /* our line buffer */
411411   UINT16 *line_buffer = BITMAP_ADDR16( vce.bmp, line, 0 );
412   
412
413413   for ( i = 0; i < VDC_WPF; i++ )
414414      line_buffer[i] = Machine->pens[color_base + vce.vce_data[0].w];
415415}
r1461r1462
762762   /* Are we in greyscale mode or in color mode? */
763763   int color_base = vce.vce_control & 0x80 ? 512 : 0;
764764
765   /* count up: Highest priority is Sprite 0 */
765   /* count up: Highest priority is Sprite 0 */
766766   for(i=0; i<64; i++)
767767   {
768768      static const int cgy_table[] = {16, 32, 64, 64};
r1461r1462
807807            vdc[which].status |= VDC_OR;
808808            if(vdc[which].vdc_data[CR].w&CR_OV)
809809               cpunum_set_input_line(0, 0, ASSERT_LINE);
810            continue;  /* Should cause an interrupt */
810            continue;  /* Should cause an interrupt */
811811         }
812812
813813         cgypos = (obj_l >> 4);
r1461r1462
828828                     if( drawn[pixel_x] < 2 ) {
829829                        if( priority || drawn[pixel_x] == 0 ) {
830830                           line_buffer[pixel_x] = Machine->pens[color_base + vce.vce_data[0x100 + (palette << 4) + buf[x]].w];
831                           if ( vdc[which].physical_width != 512 ) {
831                           if ( vdc[which].physical_width != 512 ) {
832832                              int dp = 1;
833                              while ( pixel_x + dp < ( ( ( obj_x + x + 1 ) * 512 ) / vdc[which].physical_width ) ) {
833                              while ( pixel_x + dp < ( ( ( obj_x + x + 1 ) * 512 ) / vdc[which].physical_width ) ) {
834834                                 drawn[pixel_x + dp] = i + 2;
835835                                 line_buffer[pixel_x + dp] = Machine->pens[color_base + vce.vce_data[0x100 + (palette << 4) + buf[x]].w];
836836                                 dp++;
r1461r1462
921921                                    line_buffer[pixel_x + dp] = Machine->pens[color_base + vce.vce_data[0x100 + (palette << 4) + buf[x]].w];
922922                                    dp++;
923923                                 }
924                              }                                   
924                              }
925925                           }
926926                           drawn[pixel_x] = i + 2;
927927                        }
r1461r1462
950950   int src = vdc[which].vdc_data[SOUR].w;
951951   int dst = vdc[which].vdc_data[DESR].w;
952952   int len = vdc[which].vdc_data[LENR].w;
953   
953
954954   int did = (vdc[which].vdc_data[DCR].w >> 3) & 1;
955955   int sid = (vdc[which].vdc_data[DCR].w >> 2) & 1;
956956   int dvc = (vdc[which].vdc_data[DCR].w >> 1) & 1;
957   
957
958958   do {
959959      UINT8 l, h;
960960
r1461r1462
966966
967967      if(sid) src = (src - 1) & 0xFFFF;
968968      else   src = (src + 1) & 0xFFFF;
969     
969
970970      if(did) dst = (dst - 1) & 0xFFFF;
971971      else   dst = (dst + 1) & 0xFFFF;
972     
972
973973      len = (len - 1) & 0xFFFF;
974     
974
975975   } while (len != 0xFFFF);
976   
976
977977   vdc[which].status |= VDC_DV;
978978   vdc[which].vdc_data[SOUR].w = src;
979979   vdc[which].vdc_data[DESR].w = dst;
r1461r1462
982982   {
983983      cpunum_set_input_line(0, 0, ASSERT_LINE);
984984   }
985   
985
986986}
987987
988988static void vpc_update_prio_map( void ) {
src/mess/video/odyssey2.c
r1461r1462
220220    UINT8 data = 0;
221221    int bit, i;
222222
223    switch (offset)
223    switch (offset)
224224    {
225        case 0xa1:
225        case 0xa1:
226226
227227            if (horiz_scan_active())
228228                data |= 1;
r1461r1462
232232
233233            break;
234234
235        case 0xa2:
235        case 0xa2:
236236
237237            bit = 0x01;
238238
r1461r1462
240240            {
241241                /* o2_vdc.s.collision at this point has the requested bit(s)
242242                 * to test the current collisions against.  TODO: Sometimes
243                 * $A2 has more than one bit set.  What are the correct semantics
243                 * $A2 has more than one bit set.  What are the correct semantics
244244                 * of that when reading back?  For now having an entire byte
245245                 * for each graphics object that can collide is working.
246246                 */
247247
248                if (bit & o2_vdc.s.collision)
248                if (bit & o2_vdc.s.collision)
249249                    data |= (collision[i] & ~bit);
250250
251251                bit <<= 1;
r1461r1462
253253
254254            break;
255255
256        case 0xa4:
256        case 0xa4:
257257
258258            if ((o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY))
259259                y_beam_pos = line;
r1461r1462
287287
288288    if (offset == 0xa0)
289289    {
290        if (    o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY
290        if (    o2_vdc.s.control & VDC_CONTROL_REG_STROBE_XY
291291             && !(data & VDC_CONTROL_REG_STROBE_XY))
292292        {
293293            /* Toggling strobe bit, tuck away values */
294            x_beam_pos = get_horiz_clock_beam_pos();
294            x_beam_pos = get_horiz_clock_beam_pos();
295295            y_beam_pos = line;
296296
297297            /* This is wrong but more games work with it, TODO: Figure
298298             * out correct change.  Maybe update the screen here??
299             * It seems what happens is 0x0 is written to $A0 just before
299             * It seems what happens is 0x0 is written to $A0 just before
300300             * VLBANK (video update) so no screen updates happen.
301301             */
302302
r1461r1462
320320    line_time = timer_get_time();
321321    line = (line + 1) % 262;
322322
323    switch (line)
323    switch (line)
324324    {
325325        case 252:
326326            cpunum_set_input_line(0, 0, ASSERT_LINE); /* vsync?? */
r1461r1462
388388    color  = o2_vdc.s.color & 7;
389389    color |= (o2_vdc.s.color >> 3) & 8;
390390
391    for (i=0, x=0; x<9; x++, i++)
391    for (i=0, x=0; x<9; x++, i++)
392392    {
393        for (j=1, y=0; y<9; y++, j<<=1)
393        for (j=1, y=0; y<9; y++, j<<=1)
394394        {
395395            if ( ((j<=0x80)&&(o2_vdc.s.hgrid[0][i]&j))
396396                    ||((j>0x80)&&(o2_vdc.s.hgrid[1][i]&1)) )
r1461r1462
404404    if (o2_vdc.s.control & 0x80)        /* fill solid to end of next vert line */
405405        w=width;
406406
407    for (i=0, x=0; x<10; x++, i++)
407    for (i=0, x=0; x<10; x++, i++)
408408    {
409409        for (j=1, y=0; y<8; y++, j<<=1)
410410        {
411            if (o2_vdc.s.vgrid[i] & j)
411            if (o2_vdc.s.vgrid[i] & j)
412412            {
413413                odyssey2_draw_box(bg, x_grid_offset + x * width, y_grid_offset + y * height, w, height, COLLISION_VERTICAL_GRID);
414414                plot_box(bitmap, x_grid_offset + x * width, y_grid_offset + y * height, w, height, Machine->pens[color]);
r1461r1462
432432    // invaders aliens (!) and shoot (-)
433433    n = 8 - (ptr & 7) - ((y >> 1) & 7);
434434
435    if (n < 3)
435    if (n < 3)
436436        n += 7;
437437
438    for (i=0; i<n; i++)
438    for (i=0; i<n; i++)
439439    {
440440        if (y + i * 2 >= bitmap->height )
441            break;     
441            break;
442442
443443        odyssey2_draw(bg, ((char*)o2_shape)[offset], x, y+i*2, 1, 2, COLLISION_CHARACTERS);
444444        drawgfxzoom(bitmap, Machine->gfx[0], ((char*)o2_shape)[offset],0,
445445                0,0,x,y+i*2,
446                0, TRANSPARENCY_PEN,0, 0x10000, 0x20000);   
446                0, TRANSPARENCY_PEN,0, 0x10000, 0x20000);
447447        offset=(offset+1) & 0x1ff;
448448    }
449449}
r1461r1462
468468
469469    if (o2_vdc.s.control & 0x20)        /* show foreground objects */
470470   {
471      for (i=0; i<ARRAY_LENGTH(o2_vdc.s.foreground); i++)
471      for (i=0; i<ARRAY_LENGTH(o2_vdc.s.foreground); i++)
472472        {
473473         odyssey2_draw_char(bitmap, bg,
474474            o2_vdc.s.foreground[i].x, o2_vdc.s.foreground[i].y,
r1461r1462
500500         {
501501            if (o2_vdc.s.sprites[i].color & 4)
502502            {
503               if (y+4*j>=bitmap->height)
503               if (y+4*j>=bitmap->height)
504504                        break;
505505               odyssey2_draw_sprite(bg, o2_vdc.s.shape[i][j], x, y+j*4, 2, 4, 1<<i);    /* 1 << i is sprite collision index */
506506               drawgfxzoom(bitmap, machine->gfx[1], o2_vdc.s.shape[i][j],0,
r1461r1462
510510
511511            else
512512            {
513               if (y+j*2>=bitmap->height)
513               if (y+j*2>=bitmap->height)
514514                        break;
515515               odyssey2_draw_sprite(bg, o2_vdc.s.shape[i][j], x, y+j*2, 1, 2, 1<<i);    /* 1 << i is sprite collision index */
516516               drawgfxzoom(bitmap, machine->gfx[1], o2_vdc.s.shape[i][j],0,
r1461r1462
527527   {
528528      for (x=0; x<320; x++)
529529      {
530         switch (bg[y][x])
530         switch (bg[y][x])
531531            {
532532                case 0: case 1: case 2: case 4: case 8:
533533                case 0x10: case 0x20: case 0x80:
src/mess/video/m6845.c
r1461r1462
271271               /* not sure about M6845_PERSONALITY_PREASIC */
272272               retval=R12_screen_start_address_H;
273273               break;
274               
274
275275            default:
276276               retval = 0;
277277               break;
r1461r1462
287287               /* not sure about M6845_PERSONALITY_PREASIC */
288288               retval=R13_screen_start_address_L;
289289               break;
290               
290
291291            default:
292292               retval = 0;
293293               break;
src/mess/video/apple2.c
r1461r1462
280280         w =      (((UINT32) vram_row[col+0] & 0x7f) <<  0)
281281            |   (((UINT32) vram_row[col+1] & 0x7f) <<  7)
282282            |   (((UINT32) vram_row[col+2] & 0x7f) << 14);
283   
283
284284         switch(columns)
285285         {
286286            case 40:
src/mess/video/primo.c
r1461r1462
6161{
6262   int primo_scanline;
6363
64   for (primo_scanline=0; primo_scanline<192; primo_scanline++)                     
64   for (primo_scanline=0; primo_scanline<192; primo_scanline++)
6565      primo_draw_scanline(bitmap, primo_scanline);
6666   return 0;
6767}
src/mess/video/ti85.c
r1461r1462
102102   { 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 },
103103   { 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf }
104104};
105
105
106106PALETTE_INIT( ti85 )
107107{
108108   int used = sizeof (ti85_palette) / 3;
r1461r1462
160160   lcdmem =  ((ti85_LCD_memory_base & 0x3F) + 0xc0) << 0x08;
161161
162162   memcpy (ti85_frames, ti85_frames+ti_video_memory_size, sizeof (UINT8) * (ti_number_of_frames-1) * ti_video_memory_size);
163   
164        for (y=0; y<ti_screen_y_size; y++)                     
163
164        for (y=0; y<ti_screen_y_size; y++)
165165      for (x=0; x<ti_screen_x_size; x++)
166166         *(ti85_frames+(ti_number_of_frames-1)*ti_video_memory_size+y*ti_screen_x_size+x) = program_read_byte(lcdmem+y*ti_screen_x_size+x);
167167
168          for (y=0; y<ti_screen_y_size; y++)                     
168          for (y=0; y<ti_screen_y_size; y++)
169169      for (x=0; x<ti_screen_x_size; x++)
170170         for (b=0; b<8; b++)
171171         {
src/mess/video/pc1251.c
r1461r1462
44#include "includes/pocketc.h"
55#include "includes/pc1251.h"
66
7static const POCKETC_FIGURE busy={
7static const POCKETC_FIGURE busy={
88   "11  1 1  11 1 1",
99   "1 1 1 1 1   1 1",
1010   "11  1 1  1  1 1",
1111   "1 1 1 1   1  1",
1212   "11   1  11   1e"
13}, def={
13}, def={
1414   "11  111 111",
1515   "1 1 1   1",
1616   "1 1 111 11",
1717   "1 1 1   1",
18   "11  111 1e"
18   "11  111 1e"
1919}, shift={
2020   " 11 1 1 1 111 111",
2121   "1   1 1 1 1    1",
2222   " 1  111 1 11   1",
2323   "  1 1 1 1 1    1",
24   "11  1 1 1 1    1e"
24   "11  1 1 1 1    1e"
2525}, hyp={
2626   "1 1 1 1 11",
2727   "1 1 1 1 1 1",
2828   "111 1 1 11",
2929   "1 1  1  1",
30   "1 1  1  1e"
30   "1 1  1  1e"
3131}, de={
3232   "11  111",
3333   "1 1 1",
r1461r1462
3939   "1",
4040   "1 1",
4141   "1 1",
42   " 11e"
42   " 11e"
4343}, rad={
4444   "11   1  11",
4545   "1 1 1 1 1 1",
r1461r1462
6363   "1",
6464   "111",
6565   "1",
66   "111e"
67}, run={
66   "111e"
67}, run={
6868   "11  1 1 1  1",
6969   "1 1 1 1 11 1",
7070   "11  1 1 1 11",
7171   "1 1 1 1 1  1",
72   "1 1  1  1  1e"
73}, pro={
72   "1 1  1  1  1e"
73}, pro={
7474   "11  11   1  ",
7575   "1 1 1 1 1 1",
7676   "11  11  1 1",
7777   "1   1 1 1 1",
78   "1   1 1  1e"
79}, japan={
78   "1   1 1  1e"
79}, japan={
8080   "  1  1  11   1  1  1",
8181   "  1 1 1 1 1 1 1 11 1",
8282   "  1 111 11  111 1 11",
8383   "1 1 1 1 1   1 1 1  1",
84   " 1  1 1 1   1 1 1  1e"
85}, sml={
84   " 1  1 1 1   1 1 1  1e"
85}, sml={
8686   " 11 1 1 1",
8787   "1   111 1",
8888   " 1  1 1 1",
8989   "  1 1 1 1",
90   "11  1 1 111e"
91}, rsv={
90   "11  1 1 111e"
91}, rsv={
9292   "11   11 1   1",
9393   "1 1 1   1   1",
9494   "11   1   1 1",
9595   "1 1   1  1 1",
96   "1 1 11    1e"
96   "1 1 11    1e"
9797};
9898
9999static struct {
r1461r1462
121121{
122122   int x, y, i, j;
123123   int color[2];
124   
124
125125   bitmap_fill(bitmap, cliprect, 5);
126   
126
127127   /* HJB: we cannot initialize array with values from other arrays, thus... */
128128    color[0] = machine->pens[pocketc_colortable[PC1251_CONTRAST][0]];
129129   color[1] = machine->pens[pocketc_colortable[PC1251_CONTRAST][1]];
src/mess/video/vc4000.c
r1461r1462
6767   mame_bitmap *bitmap;
6868} vc4000_video =
6969{
70    {
70    {
7171      { &vc4000_video.reg.d.sprites[0],1 },
72      { &vc4000_video.reg.d.sprites[1],2 },
72      { &vc4000_video.reg.d.sprites[1],2 },
7373      { &vc4000_video.reg.d.sprites[2],4 },
7474      { &vc4000_video.reg.d.sprite4,8 }
75    }   
75    }
7676};
7777
7878VIDEO_START(vc4000)
7979{
8080    int i;
81   
81
8282   for (i=0;i<0x20; i++)
8383   {
8484      sprite_collision[i]=0;
r1461r1462
111111         data |= 1;
112112         vc4000_video.sprites[3].finished = FALSE;
113113      }
114     
114
115115      if (vc4000_video.sprites[2].finished)
116116      {
117117         data |= 2;
r1461r1462
151151      // between 20 and 225
152152      if (!activecpu_get_reg(S2650_FO))
153153      {
154         if (input_port_7_r(0)&0x1) data=20;
154         if (input_port_7_r(0)&0x1) data=20;
155155         if (input_port_7_r(0)&0x2) data=225;
156156      }
157157      else
r1461r1462
245245
246246static void vc4000_draw_digit(mame_bitmap *bitmap, int x, int y, int d, int line)
247247{
248    static const int digit_to_segment[0x10]={
248    static const int digit_to_segment[0x10]={
249249   0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff
250250    };
251251    int i,j;
r1461r1462
324324      }
325325
326326      if (This->y>252) break;
327     
327
328328      This->delay=0;
329329      This->state++;
330330
r1461r1462
382382      case 3: w=4;break;
383383   }
384384   switch (i&3) {
385   case 0:
385   case 0:
386386      if (k&1) w=8;break;
387387   case 1:
388388      if ((line%40)<=10) {
r1461r1462
472472      (vc4000_video.sprites[2].finished_now) |
473473      (vc4000_video.sprites[1].finished_now) |
474474      (vc4000_video.sprites[0].finished_now))
475   {
475   {
476476      cpunum_set_input_line_vector(0, 0, 3);
477477      cpunum_set_input_line(0, 0, PULSE_LINE);
478478   }
src/mess/video/galaxy.c
r1461r1462
7474      horizontal_pos = program_read_byte(0x2ba8);
7575      if (horizontal_pos > 0x0b)
7676      {
77         black_area.min_x =  0;
77         black_area.min_x =  0;
7878         black_area.max_x =  8*(horizontal_pos-0x0b)-1;
7979      }
8080      if (horizontal_pos < 0x0b)
8181      {
82         black_area.min_x = 8*(21+horizontal_pos);
82         black_area.min_x = 8*(21+horizontal_pos);
8383         black_area.max_x = 32*8-1;
8484      }
8585      if (horizontal_pos == 0x0b)
86         black_area.min_x =  black_area.max_x = 0;
86         black_area.min_x =  black_area.max_x = 0;
8787      fillbitmap(bitmap, machine->pens[1], &black_area);
88   }   
88   }
8989
9090   for( offs = 0; offs < 512; offs++ )
9191   {
r1461r1462
9393      int code = videoram[offs];
9494
9595      sx = (offs % 32) * 8 + horizontal_pos*8-88;
96   
96
9797      if (sx>=0 && sx<32*8)
9898      {
9999         if ((code>63 && code<96) || (code>127 && code<192))
src/mess/video/cdp1861.c
r1461r1462
8686      }
8787
8888      timer_adjust(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_WAIT, 0), 0, attotime_zero);
89     
89
9090      cdp1861.dmaout = 0;
9191   }
9292   else
r1461r1462
100100      }
101101
102102      timer_adjust(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_ACTIVE, 0), 0, attotime_zero);
103     
103
104104      cdp1861.dmaout = 1;
105105   }
106106}
src/mess/video/kc.c
r1461r1462
2222
2323/*
2424   foreground:
25
25
2626      "full" of each component
2727
28      black,
29      blue,
30      red,
31      magenta,
32      green,
28      black,
29      blue,
30      red,
31      magenta,
32      green,
3333      cyan
3434      yellow
3535      white
3636
3737      "full of each component + half of another component"
3838      black
39      violet
39      violet
4040      red/purple
4141      pastel green
4242      sky blue
r1461r1462
6060static const unsigned char kc85_palette[KC85_PALETTE_SIZE * 3] =
6161{
6262      /* 3 bit colour value. bit 2->green, bit 1->red, bit 0->blue */
63       
63
6464      /* foreground colours */
6565      0x00, 0x00, 0x00,
6666      0x00, 0x00, 0xd0,
r1461r1462
130130   /* bit 5,4,3 = foreground colour */
131131      /* bit 5: background colour -> Green */
132132      /* bit 4: background colour -> Red */
133      /* bit 3: background colour -> Blue */   
133      /* bit 3: background colour -> Blue */
134134   /* bit 2,1,0 = background colour */
135135      /* bit 2: background colour -> Green */
136136      /* bit 1: background colour -> Red */
137137      /* bit 0: background colour -> Blue */
138    background_pen = (colour_byte&7) + 16;   
139    foreground_pen = ((colour_byte>>3) & 0x0f);   
138    background_pen = (colour_byte&7) + 16;
139    foreground_pen = ((colour_byte>>3) & 0x0f);
140140
141141   if (colour_byte & kc85_blink_state)
142142   {
r1461r1462
151151    for (a=0; a<8; a++)
152152    {
153153        int pen;
154     
154
155155      pen = pens[(gfx_byte>>7) & 0x01];
156156
157157      if ((px >= 0) && (px < bitmap->width)
r1461r1462
195195#define KC85_CYCLES_PER_LINE (KC85_CYCLES_PER_FRAME/KC85_FRAME_NUM_LINES)
196196#define KC85_CYCLES_PER_PIXEL (KC85_CYCLES_PER_LINE/KC85_LINE_SIZE)
197197
198/*
198/*
199199
200200   - 1750000 cpu cycles per second
201201   - 35000 cpu cycles per frame
r1461r1462
205205
206206/* Operation:
207207
208   - Vertical and horizontal dimensions are split into states.
208   - Vertical and horizontal dimensions are split into states.
209209   - Horizontal states take a multiple of horizontal cycles, and vertical states take a multiple of lines.
210210   - The horizontal states comprise left border, main display, right border and horizontal retrace timing.
211211   - The vertical states comprise top border, main display, bottom border and vertical retrace timing.
212212
213213
214214   - if frame rate is 50hz, and there are 312 lines, then the line rate is 15600hz.
215   - Each frame takes 0.02 seconds, and each line takes 0.0000064 seconds - approx 64microseconds per line
215   - Each frame takes 0.02 seconds, and each line takes 0.0000064 seconds - approx 64microseconds per line
216216
217217   - the event list is based on cpu time
218     
218
219219*/
220220
221221static int horizontal_next_state_table[]=
r1461r1462
308308         /* border */
309309         case 0:
310310         {
311         //   video_update->render_x+=(cycles_to_do)*8;           
311         //   video_update->render_x+=(cycles_to_do)*8;
312312         }
313313         break;
314314
315315         /* pixels */
316316         case 1:
317         {           
317         {
318318            int i;
319   
319
320320            for (i=0; i<cycles_to_do; i++)
321321            {
322322               unsigned char colour_byte;
r1461r1462
360360         }
361361         break;
362362      }
363     
363
364364      video_update->horizontal.cycles_remaining_in_state -=cycles_to_do;
365365
366366      /* is state over? */
r1461r1462
385385   {
386386      /* do as many cycles as will fit onto the line */
387387      cycles_to_do = MIN(cycles,video_update->horizontal.cycles_remaining);
388   
388
389389      //logerror("process line: cycles_to_do: %d\n",cycles_to_do);
390     
390
391391      /* do the cycles - draw them */
392392      kc85_common_process_cycles(video_update, cycles_to_do);
393393
r1461r1462
404404      /* update x,y fetch pos */
405405      video_update->x = 0;
406406      video_update->y++;
407   
407
408408      /* update x,y render pos */
409409      video_update->render_x = 0;
410410      video_update->render_y++;
r1461r1462
432432   {
433433      int cycles_to_do;
434434      int cycles_done;
435     
435
436436      cycles_to_do = MIN(cycles, KC85_CYCLES_PER_LINE);
437437      cycles_done = cycles_to_do;
438438
r1461r1462
476476         break;
477477      }
478478
479         
479
480480      //logerror("cycles done: %d\n",cycles_done);
481481      video_update->vertical.cycles_remaining_in_state -=cycles_done;
482482
r1461r1462
527527   while (NumItems)
528528   {
529529      int delta_cycles;
530     
530
531531      /* number of cycles until event will trigger */
532532      delta_cycles = pItem->Event_Time - cycles_offset;
533533
r1461r1462
670670      {
671671         unsigned char colour_byte, gfx_byte;
672672         int offset;
673         
673
674674         offset = y | (x<<8);
675675
676676         colour_byte = colour_ram[offset];
677677          gfx_byte = pixel_ram[offset];
678678
679679         kc85_draw_8_pixels(bitmap,(x<<3),y, colour_byte, gfx_byte);
680     
680
681681      }
682682   }
683683#endif
r1461r1462
739739{
740740#if 0
741741   /* colour ram takes up 0x02800 bytes */
742      unsigned char *pixel_ram = mess_ram+0x08000;   
742      unsigned char *pixel_ram = mess_ram+0x08000;
743743    unsigned char *colour_ram = pixel_ram + 0x02800;
744744
745745    int x,y;
r1461r1462
750750      {
751751         unsigned char colour_byte, gfx_byte;
752752         int pixel_offset,colour_offset;
753         
753
754754         if ((x & 0x020)==0)
755755         {
756756            pixel_offset = (x & 0x01f) | (((y>>2) & 0x03)<<5) |
757757            ((y & 0x03)<<7) | (((y>>4) & 0x0f)<<9);
758   
758
759759            colour_offset = (x & 0x01f) | (((y>>2) & 0x03f)<<5);
760760         }
761761         else
r1461r1462
765765
766766            pixel_offset = 0x02000+((x & 0x07) | (((y>>4) & 0x03)<<3) |
767767               (((y>>2) & 0x03)<<5) | ((y & 0x03)<<7) | ((y>>6) & 0x03)<<9);
768   
768
769769            colour_offset = 0x0800+((x & 0x07) | (((y>>4) & 0x03)<<3) |
770770               (((y>>2) & 0x03)<<5) | ((y>>6) & 0x03)<<7);
771771         }
772     
772
773773            colour_byte = colour_ram[colour_offset];
774774            gfx_byte = pixel_ram[pixel_offset];
775775
src/mess/inputx.c
r1461r1462
4949
5050static const char_info charinfo[] =
5151{
52   { 0x0008,               "Backspace",   NULL },      /* Backspace */   
52   { 0x0008,               "Backspace",   NULL },      /* Backspace */
5353   { 0x0009,               "Tab",         "    " },   /* Tab */
5454   { 0x000c,               "Clear",      NULL },      /* Clear */
5555   { 0x000d,               "Enter",      NULL },      /* Enter */
r1461r1462
278278   { 0xffeb,               NULL,         "\xE2\x86\x92" },   /* fullwidth right arrow */
279279   { 0xffec,               NULL,         "\xE2\x86\x93" },   /* fullwidth down arrow */
280280   { 0xffed,               NULL,         "\xE2\x96\xAA" },   /* fullwidth solid box */
281   { 0xffee,               NULL,         "\xE2\x97\xA6" },   /* fullwidth open circle */   
281   { 0xffee,               NULL,         "\xE2\x97\xA6" },   /* fullwidth open circle */
282282   { UCHAR_MAMEKEY(F1),      "F1",         NULL },      /* F1 function key */
283283   { UCHAR_MAMEKEY(F2),      "F2",         NULL },      /* F2 function key */
284284   { UCHAR_MAMEKEY(F3),      "F3",         NULL },      /* F3 function key */
src/mess/image.h
r1461r1462
7777
7878/****************************************************************************
7979  Tag management functions.
80 
80
8181  When devices have private data structures that need to be associated with a
8282  device, it is recommended that image_alloctag() be called in the device
8383  init function.  If the allocation succeeds, then a pointer will be returned
src/mess/inputx.h
r1461r1462
6060
6161#define PORT_CONFSETTING(default,name) \
6262   INPUT_PORT_UINT32_PAIR(INPUT_TOKEN_CONFSETTING, default), INPUT_PORT_PTR(name),
63   
63
6464/* categories */
6565#define PORT_CATEGORY(category) \
6666   INPUT_PORT_UINT32_PAIR(INPUT_TOKEN_CATEGORY, category),
src/mess/messdriv.c
r1461r1462
172172   /* WATARA */
173173   DRIVER( svision )   /* Supervision Handheld                        */
174174TESTDRIVER( svisions )
175   
175
176176TESTDRIVER( svisionp )
177177TESTDRIVER( svisionn )
178178TESTDRIVER( tvlinkp )
r1461r1462
432432   DRIVER( specp3sp )   /* 1987 ZX Spectrum +3 (Spain)                  */
433433   DRIVER( specpl3e )   /* 2000 ZX Spectrum +3e                        */
434434   DRIVER( specp3es )   /* 2000 ZX Spectrum +3e (Spain)                  */
435   
435
436436TESTDRIVER( scorpion )
437437TESTDRIVER( pentagon )
438438
r1461r1462
564564   DRIVER( cp400 )      /* Prologica CP400                           */
565565   DRIVER( mc10 )      /* MC-10                                 */
566566   DRIVER( alice )      /* Matra & Hachette Ordinateur Alice            */
567   
567
568568   /* EACA */
569569   DRIVER( cgenie )   /* Colour Genie EG2000                        */
570570   /* system 80 trs80 compatible */
src/mess/device.c
r1461r1462
248248      {
249249         devices[i].devclass.get_info = handlers[i];
250250         devices[i].devclass.gamedrv = gamedrv;
251         
251
252252         /* convert file extensions from comma delimited to null delimited */
253253         converted_file_extensions = NULL;
254254         file_extensions = device_get_info_string(&devices[i].devclass, DEVINFO_STR_FILE_EXTENSIONS);
r1461r1462
263263            converted_file_extensions[j + 0] = '\0';
264264            converted_file_extensions[j + 1] = '\0';
265265         }
266         
266
267267         info_string = device_get_info_string(&devices[i].devclass, DEVINFO_STR_DEV_TAG);
268268         devices[i].tag               = info_string ? pool_strdup(pool, info_string) : NULL;
269269         devices[i].type               = device_get_info_int(&devices[i].devclass, DEVINFO_INT_TYPE);
r1461r1462
292292         devices[i].name               = default_device_name;
293293
294294         devices[i].createimage_optguide   = (const struct OptionGuide *) device_get_info_ptr(&devices[i].devclass, DEVINFO_PTR_CREATE_OPTGUIDE);
295         
295
296296         createimage_optcount = (int) device_get_info_int(&devices[i].devclass, DEVINFO_INT_CREATE_OPTCOUNT);
297297         if (createimage_optcount > 0)
298298         {
src/mess/filemngr.c
r1461r1462
268268         exit(-1);
269269      }
270270   }
271   
271
272272   memset(&fs_item[fs_total], 0, sizeof(fs_item[fs_total]));
273273   fs_order[fs_total] = fs_total;
274274   return fs_total++;
r1461r1462
291291   osd_directory *dir;
292292   int qsort_start, count, i, n;
293293   ui_menu_item *tmp_menu_item;
294   int *tmp_types;   
294   int *tmp_types;
295295
296296   /* just to be safe */
297297   fs_free();
src/mess/device.h
r1461r1462
268268
269269   /* image creation options */
270270   const struct OptionGuide *createimage_optguide;
271   struct CreateImageOptions *createimage_options;
271   struct CreateImageOptions *createimage_options;
272272};
273273
274274
src/mess/mesvalid.c
r1461r1462
5151   }
5252
5353   /* File Extensions Checks
54    *
54    *
5555    * Checks the following
5656    *
5757    * 1.  Tests the integrity of the string list
r1461r1462
134134            error = 1;
135135         }
136136         break;
137         
137
138138      default:
139139         break;
140140   }
src/mess/osd/sdl/glob.c
r1461r1462
372372   if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
373373      return pattern;
374374
375   /*
376    * Copy up to the end of the string or /
375   /*
376    * Copy up to the end of the string or /
377377    */
378378   eb = &patbuf[patbuf_len - 1];
379379   for (p = pattern + 1, h = (char *) patbuf;
r1461r1462
437437   int c, err, oldpathc;
438438   Char *bufnext, patbuf[_MAX_PATH+1];
439439
440   qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char),
440   qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char),
441441       pglob);
442442   oldpathc = pglob->gl_pathc;
443443   bufnext = patbuf;
src/mess/osd/sdl/sdlmess.c
r1461r1462
55#include <sys/types.h>
66#include <ctype.h>
77#include <errno.h>
8   
8
99#include "osdmess.h"
1010#include "utils.h"
1111
r1461r1462
127127      basename = "tempfile";
128128
129129   sprintf(tempbuf, "/tmp/%s", basename);
130   unlink(tempbuf);   
130   unlink(tempbuf);
131131
132   strncpy(buffer, tempbuf, buffer_len);   
132   strncpy(buffer, tempbuf, buffer_len);
133133
134134   return FILERR_NONE;
135135}
src/mess/osd/windows/dialog.c
r1461r1462
862862   HWND dlgwnd, editwnd;
863863   int value, id;
864864   LONG_PTR l;
865   
865
866866   l = GetWindowLongPtr(sbwnd, GWLP_USERDATA);
867867   stuff = (struct adjuster_sb_stuff *) l;
868868
r1461r1462
10751075   if (strcmp(buffer, astring_c(seqstring)))
10761076      win_set_window_text_utf8(editwnd, astring_c(seqstring));
10771077
1078   // reset the selection
1078   // reset the selection
10791079   if (GetFocus() == editwnd)
10801080      SendMessage(editwnd, EM_SETSEL, 0, -1);
10811081
r1461r1462
11581158   // get the basics
11591159   editwnd = (HWND) param;
11601160   stuff = get_seqselect_info(editwnd);
1161   
1161
11621162   // stop the read
11631163   if (stuff->poll_state == SEQSELECT_STATE_POLLING)
11641164      stuff->poll_state = SEQSELECT_STATE_POLLING_COMPLETE;
r1461r1462
13491349
13501350   port_name = input_port_name(port);
13511351   assert(port_name);
1352   
1352
13531353   if (port_type_is_analog(port->type))
13541354   {
13551355      seq_types[seq_count] = SEQ_TYPE_STANDARD;
r1461r1462
13931393         // no positions specified
13941394         dialog_new_control(di, &x, &y);
13951395
1396         if (dialog_write_item(di, WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX, x, y,
1396         if (dialog_write_item(di, WS_CHILD | WS_VISIBLE | SS_LEFT | SS_NOPREFIX, x, y,
13971397               dialog->layout->label_width, DIM_NORMAL_ROW_HEIGHT, this_port_name, DLGITEM_STATIC, NULL))
13981398            return 1;
13991399         x += dialog->layout->label_width + DIM_HORIZONTAL_SPACING;
r1461r1462
14201420         width   /= pixels_to_xdlgunits;
14211421         height   /= pixels_to_ydlgunits;
14221422
1423         if (dialog_add_single_seqselect(di, x, y, width, height,
1423         if (dialog_add_single_seqselect(di, x, y, width, height,
14241424               port, is_analog[seq], seq_types[seq]))
14251425            return 1;
14261426      }
src/mess/osd/windows/menu.c
r1461r1462
292292   input_port_entry *in;
293293   const char *switch_name = NULL;
294294   UINT32 type;
295   
295
296296   dlg = win_dialog_init(ui_getstring(title_string_num), NULL);
297297   if (!dlg)
298298      goto done;
r1461r1462
397397   const char *name;
398398   char buf[255];
399399   static const struct dialog_layout layout = { 120, 52 };
400   
400
401401   dlg = win_dialog_init(ui_getstring(UI_analogcontrols), &layout);
402402   if (!dlg)
403403      goto done;
r1461r1462
555555
556556   // compute our parameters
557557   dev = params->dev;
558   guide = dev->createimage_optguide;   
558   guide = dev->createimage_optguide;
559559   optspec = dev->createimage_options[format_combo_val].optspec;
560560
561561   // set the default extension
r1461r1462
611611   struct storeval_optres_params *params;
612612   const struct IODevice *dev;
613613   char buf[16];
614   
614
615615   params = (struct storeval_optres_params *) storeval_param;
616616   dev = params->fdparams->dev;
617617
r1461r1462
764764
765765   // add the description
766766   pos += snprintf(&dest[pos], dest_len - pos, "%s (", description);
767   
767
768768   // add the extensions to the description
769769   pos += copy_extension_list(&dest[pos], dest_len - pos, extensions);
770770
r1461r1462
903903
904904   if (!OpenClipboard(NULL))
905905      return;
906   
906
907907   h = GetClipboardData(CF_TEXT);
908908   if (h)
909909   {
r1461r1462
13471347         img = image_from_device_and_index(dev, i);
13481348
13491349         if (!dev->not_working)
1350         {   
1350         {
13511351            new_item = ID_DEVICE_0 + (image_absolute_index(img) * DEVOPTION_MAX);
13521352            flags_for_exists = MF_STRING;
1353   
1353
13541354            if (!image_exists(img))
13551355               flags_for_exists |= MF_GRAYED;
1356   
1356
13571357            flags_for_writing = flags_for_exists;
13581358            if (!image_is_writable(img))
13591359               flags_for_writing |= MF_GRAYED;
1360   
1360
13611361            sub_menu = CreateMenu();
13621362            append_menu_uistring(sub_menu, MF_STRING,      new_item + DEVOPTION_OPEN,      UI_mount);
1363   
1363
13641364            if (dev->creatable)
13651365               append_menu_uistring(sub_menu, MF_STRING,   new_item + DEVOPTION_CREATE,   UI_create);
1366   
1366
13671367            append_menu_uistring(sub_menu, flags_for_exists,   new_item + DEVOPTION_CLOSE,   UI_unmount);
13681368
13691369#if HAS_WAVE
r1461r1462
16061606static mess_image *decode_deviceoption(int command, int *devoption)
16071607{
16081608   int absolute_index;
1609   
1609
16101610   command -= ID_DEVICE_0;
16111611   absolute_index = command / DEVOPTION_MAX;
16121612
r1461r1462
19151915   mii.cbSize = sizeof(mii);
19161916   mii.fMask = MIIM_TYPE;
19171917   mii.dwTypeData = t_text;
1918   SetMenuItemInfo(menu_bar, command, FALSE, &mii);   
1918   SetMenuItemInfo(menu_bar, command, FALSE, &mii);
19191919
19201920   // cleanup
19211921   free(t_text);
src/mess/osd/windows/winutils.c
r1461r1462
170170   scroll_pos = si.nPos;
171171
172172   // change scroll_pos in accordance with this message
173   switch(LOWORD(wparam))
173   switch(LOWORD(wparam))
174174   {
175175      case SB_BOTTOM:
176176         scroll_pos = si.nMax;
src/mess/osd/windows/opcntrl.c
r1461r1462
103103            option_count++;
104104         }
105105      }
106     
106
107107      // if there is only one option, it is effectively disabled
108108      if (option_count <= 1)
109109         has_option = FALSE;
src/mess/osd/windows/glob.c
r1461r1462
378378   if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
379379      return pattern;
380380
381   /*
382    * Copy up to the end of the string or /
381   /*
382    * Copy up to the end of the string or /
383383    */
384384   eb = &patbuf[patbuf_len - 1];
385385   for (p = pattern + 1, h = (char *) patbuf;
r1461r1462
443443   int c, err, oldpathc;
444444   Char *bufnext, patbuf[_MAX_PATH+1];
445445
446   qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char),
446   qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char),
447447       pglob);
448448   oldpathc = pglob->gl_pathc;
449449   bufnext = patbuf;
src/mess/osd/windows/messres.h
r1461r1462
5959#define IDC_STATUS                      6005
6060
6161// Next default values for new objects
62//
62//
6363#ifdef APSTUDIO_INVOKED
6464#ifndef APSTUDIO_READONLY_SYMBOLS
6565#define _APS_NEXT_RESOURCE_VALUE        129
src/mess/osd/winui/messui.c
r1461r1462
118118   NULL,                        // pfnFindItemParent
119119   SoftwarePicker_Idle,            // pfnIdle
120120   SoftwarePicker_OnHeaderContextMenu,   // pfnOnHeaderContextMenu
121   NULL                        // pfnOnBodyContextMenu
121   NULL                        // pfnOnBodyContextMenu
122122};
123123
124124
r1461r1462
128128   NULL,                        // pfnGetShowTabCtrl
129129   SetCurrentSoftwareTab,            // pfnSetCurrentTab
130130   GetCurrentSoftwareTab,            // pfnGetCurrentTab
131   NULL,                        // pfnSetShowTab
132   NULL,                        // pfnGetShowTab
131   NULL,                        // pfnSetShowTab
132   NULL,                        // pfnGetShowTab
133133
134134   SoftwareTabView_GetTabShortName,   // pfnGetTabShortName
135135   SoftwareTabView_GetTabLongName,      // pfnGetTabLongName
136136
137137   SoftwareTabView_OnSelectionChanged,   // pfnOnSelectionChanged
138   SoftwareTabView_OnMoveSize         // pfnOnMoveSize
138   SoftwareTabView_OnMoveSize         // pfnOnMoveSize
139139};
140140
141141
r1461r1462
158158   { IO_CARTSLOT,   "roms",      "Cartridge images" },
159159   { IO_FLOPPY,   "floppy",   "Floppy disk images" },
160160   { IO_HARDDISK,   "hard",      "Hard disk images" },
161   { IO_CYLINDER,   NULL,      "Cylinders" },         
161   { IO_CYLINDER,   NULL,      "Cylinders" },
162162   { IO_CASSETTE,   NULL,      "Cassette images" },
163163   { IO_PUNCHCARD,   NULL,      "Punchcard images" },
164164   { IO_PUNCHTAPE,   NULL,      "Punchtape images" },
r1461r1462
341341   const game_driver *drv;
342342   HWND hwndSoftwarePicker;
343343   HWND hwndSoftwareDevView;
344   
344
345345   hwndSoftwarePicker = GetDlgItem(GetMainWindow(), IDC_SWLIST);
346346   hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
347347
r1461r1462
702702        *(s++) = '|';
703703    }
704704    *(s++) = '|';
705   
705
706706    t_buffer = tstring_from_utf8(szFilter);
707707    if( !t_buffer )
708708       return FALSE;
r1461r1462
741741    {
742742        //GetDirectory(filename,last_directory,sizeof(last_directory));
743743    }
744   
744
745745    return success;
746746}
747747
r1461r1462
900900   LPCTSTR t_buffer = NULL;
901901   TCHAR* t_s;
902902   LPCSTR s = GetSelectedSoftware(nDriverIndex, &dev->devclass, nID);
903   
903
904904   t_s = tstring_from_utf8(s);
905905   if( !t_s )
906906      return t_buffer;
907   
907
908908   _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s);
909   free(t_s);   
909   free(t_s);
910910   t_buffer = pszBuffer;
911   
911
912912   return t_buffer;
913913}
914914
r1461r1462
939939      switch(nType)
940940      {
941941         case IO_UNKNOWN:
942            // Unknowns
942            // Unknowns
943943            nIcon = FindIconIndex(IDI_WIN_UNKNOWN);
944944            break;
945945
r1461r1462
10651065   INT_PTR result = 0;
10661066   int nColumnCount = Picker_GetColumnCount(MyColumnDialogProc_hwndPicker);
10671067   const LPCTSTR *ppszColumnNames = Picker_GetColumnNames(MyColumnDialogProc_hwndPicker);
1068   
1068
10691069   result = InternalColumnDialogProc(hDlg, Msg, wParam, lParam, nColumnCount,
10701070      MyColumnDialogProc_shown, MyColumnDialogProc_order, ppszColumnNames,
10711071      MyGetRealColumnOrder, MyGetColumnInfo, MySetColumnInfo);
1072     
1072
10731073   return result;
10741074}
10751075
r1461r1462
11621162
11631163
11641164// ------------------------------------------------------------------------
1165// Software Tab View
1165// Software Tab View
11661166// ------------------------------------------------------------------------
11671167
11681168static LPCSTR s_tabs[] =
src/mess/osd/winui/devview.c
r1461r1462
11// ------------------------------------------------------------------------
2// Software Device View class                                             
2// Software Device View class
33// ------------------------------------------------------------------------
44
55#define WIN32_LEAN_AND_MEAN
r1461r1462
145145static void DevView_TextChanged(HWND hwndDevView, int nChangedEntry, LPCTSTR pszFilename)
146146{
147147   struct DevViewInfo *pDevViewInfo;
148   
148
149149   pDevViewInfo = GetDevViewInfo(hwndDevView);
150150   if (!pDevViewInfo->bSurpressFilenameChanged && pDevViewInfo->pCallbacks->pfnSetSelectedSoftware)
151151   {
r1461r1462
427427               l = GetWindowLongPtr(hwndButton, GWLP_USERDATA);
428428               pEnt = (struct DevViewEntry *) l;
429429               DevView_ButtonClick(hwndDevView, pEnt, hwndButton);
430               break;           
430               break;
431431         }
432432         break;
433433   }
src/mess/osd/winui/softwarepicker.c
r1461r1462
204204         }
205205         pPickerInfo->nHashesRealized = 0;
206206      }
207     
208207
208
209209      pPickerInfo->pDriver = pDriver;
210     
210
211211      if (pDriver)
212212      {
213213         while(pDriver && !pPickerInfo->pHashFile)
r1461r1462
444444
445445   // copy the filename
446446   strcpy(pInfo->szFilename, pszFilename);
447   
447
448448   // set up device and CRC, if specified
449449   pInfo->devclass = devclass;
450450   if (devclass.gamedrv && device_get_info_fct(&devclass, DEVINFO_PTR_PARTIAL_HASH))
r1461r1462
506506   s = (LPSTR) alloca(nLength);
507507   snprintf(s, nLength, "%s\\%s", pszZipPath, pZipEnt->filename);
508508
509   return SoftwarePicker_AddFileEntry(hwndPicker, s,
509   return SoftwarePicker_AddFileEntry(hwndPicker, s,
510510      nZipEntryNameLength, pZipEnt->crc, bForce);
511511}
512512
r1461r1462
643643   char* utf8_FileName;
644644
645645   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
646   
646
647647   utf8_FileName = utf8_from_tstring(pSearchInfo->fd.cFileName);
648648   if( !utf8_FileName )
649649      return FALSE;
r1461r1462
662662      rc = SoftwarePicker_AddDirectory(hwndPicker, pszFilename);
663663   else
664664      rc = SoftwarePicker_InternalAddFile(hwndPicker, pszFilename, FALSE);
665     
665
666666      free(utf8_FileName);
667667   return rc;
668668}
r1461r1462
768768   unsigned int nHashFunction = 0;
769769   char szBuffer[256];
770770   TCHAR* t_buf;
771   
771
772772   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
773773   if ((nRow < 0) || (nRow >= pPickerInfo->nIndexLength))
774774      return NULL;
r1461r1462
781781         t_buf = tstring_from_utf8(pFileInfo->pszSubName);
782782         if( !t_buf )
783783            return s;
784         _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf);   
784         _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf);
785785         s = pszBuffer;
786786         free(t_buf);
787787         break;
r1461r1462
812812               t_buf = tstring_from_utf8(pszUtf8);
813813               if( !t_buf )
814814                  return s;
815               _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf);   
815               _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf);
816816               s = pszBuffer;
817817               free(t_buf);
818818            }
r1461r1462
832832         {
833833            t_buf = tstring_from_utf8(szBuffer);
834834            if( !t_buf )
835               return s;   
835               return s;
836836            _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf);
837837            s = pszBuffer;
838838            free(t_buf);
r1461r1462
849849{
850850   struct SoftwarePickerInfo *pPickerInfo;
851851   LRESULT rc;
852   
852
853853   pPickerInfo = GetSoftwarePickerInfo(hwndPicker);
854854   rc = CallWindowProc(pPickerInfo->pfnOldWndProc, hwndPicker, nMessage, wParam, lParam);
855855
r1461r1462
880880
881881   if (!SetProp(hwndPicker, s_szSoftwarePickerProp, (HANDLE) pPickerInfo))
882882      goto error;
883   
883
884884   l = (LONG_PTR) SoftwarePicker_WndProc;
885885   l = SetWindowLongPtr(hwndPicker, GWLP_WNDPROC, l);
886886   pPickerInfo->pfnOldWndProc = (WNDPROC) l;
src/mess/osd/winui/propertiesms.c
r1461r1462
426426         // add this option to the combo box
427427         (void)ComboBox_InsertString(control, i, win_tstring_strdup(t_ramstring));
428428         (void)ComboBox_SetItemData(control, i, ram);
429         
429
430430         free(t_ramstring);
431431
432432         // is this the current option?  record the index if so
src/mess/artworkx.c
r1461r1462
166166                     customizations->y = y1;
167167                     customizations->width = x2 - x1;
168168                     customizations->height = y2 - y1;
169                     customizations++;           
169                     customizations++;
170170                     customizations_length--;
171171                     item_count++;
172172                  }
src/mess/osdmess.h
r1461r1462
4949
5050      buffer_len - length of buffer
5151
52      basename - basename of file to create
52      basename - basename of file to create
5353
5454    Return value:
5555
src/mess/machine/wswan.c
r1461r1462
299299{
300300   UINT8 value = ws_portram[offset];
301301
302   if ( offset != 2 )
302   if ( offset != 2 )
303303   logerror( "PC=%X: port read %02X\n", activecpu_get_pc(), offset );
304304   switch( offset )
305305   {
r1461r1462
572572               Bit 4-7 - Palette 0 index 3 */
573573      case 0x22:   /* Bit 0-3 - Palette 1 index 0
574574               Bit 4-7 - Palette 1 index 1 */
575      case 0x23:   /* Bit 0-3 - Palette 1 index 2
575      case 0x23:   /* Bit 0-3 - Palette 1 index 2
576576               Bit 4-7 - Palette 1 index 3 */
577577      case 0x24:   /* Bit 0-3 - Palette 2 index 0
578578               Bit 4-7 - Palette 2 index 1 */
r1461r1462
14051405      }
14061406   }
14071407
1408//   vdp.current_line = (vdp.current_line + 1) % 159;
1408//   vdp.current_line = (vdp.current_line + 1) % 159;
14091409
14101410   if ( vdp.current_line == vdp.line_compare ) {
14111411      wswan_set_irq_line( WSWAN_IFLAG_LCMP );
src/mess/machine/cbm.c
r1461r1462
3131      image_fseek(image, 26, SEEK_SET);
3232      snapshot_size -= 26;
3333   }
34   else if (!mame_stricmp(file_type, "t64"))
34   else if (!mame_stricmp(file_type, "t64"))
3535   {
3636      /* t64 files - for GB64 Single T64s loading to x0801 - header is always the same size */
3737      if (image_fread(image, buffer, sizeof(buffer)) != sizeof(buffer))
r1461r1462
4848
4949   image_fread(image, &address, 2);
5050   address = LITTLE_ENDIANIZE_INT16(address);
51   if (!mame_stricmp(file_type, "t64"))
51   if (!mame_stricmp(file_type, "t64"))
5252      address = 2049;
5353   snapshot_size -= 2;
5454
src/mess/machine/dgn_beta.c
r1461r1462
33  machine\dgn_beta.c (machine.c)
44
55   Moved out of dragon.c, 2005-05-05, P.Harvey-Smith.
6   
7   I decided to move this out of the main Dragon/CoCo source files, as
8   the Beta is so radically different from the other Dragon machines that
6
7   I decided to move this out of the main Dragon/CoCo source files, as
8   the Beta is so radically different from the other Dragon machines that
99   this made more sense (to me at least).
1010
1111  Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
r1461r1462
1313
1414  References:
1515   Disassembly of Dragon Beta ROM, examination of only (known) surviving board.
16   
16
1717  TODO:
1818   Pretty much everything !
19   
19
2020   Display working with 6845 taking data from rom.
21   
21
2222  2005-05-10
2323   Memory banking seems to be working, as documented in code comments below.
2424
r1461r1462
2626   CPU#2 now executes code correctly to do transfers from WD2797.
2727
2828  2005-06-03
29 
29
3030   When fed a standard OS-9 boot disk it reads in the boot file and attempts
3131   to start it, not being able to find init, it fails. Hopefully I will
3232   soon have an image of a Beta boot disk.
33   
33
3434  2005-11-29
35 
36   Major track tracing excersise on scans of bare beta board, reveal where a
35
36   Major track tracing excersise on scans of bare beta board, reveal where a
3737   whole bunch of the PIA lines go, especially the IRQs, most of them go back
3838   to the IRQ line on the main CPU.
3939
4040  2005-12-07
41 
41
4242   First booted to OS9 prompt, did not execute startup scripts.
4343
4444  2005-12-08
45   
45
4646   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
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
4949   boot track, however the rest of the disk is double density.
5050   Booted completely to OS-9, including running startup script.
51   
51
5252  2006-09-27
53 
53
5454   Clean up of IRQ/FIRQ handling code allows correct booting again.
55   
55
5656***************************************************************************/
5757
5858#include <math.h>
r1461r1462
197197   { dgnbeta_ram_bG_w, 0xFF00, 0xFfff }
198198};
199199
200struct PageReg
200struct PageReg
201201{
202202   int   value;         /* Value of the page register */
203203   UINT8   *memory;      /* The memory it actually points to */
r1461r1462
219219
220220//
221221// Memory pager, maps machine's 1Mb total address space into the 64K addressable by the 6809.
222// This is in some way similar to the system used on the CoCo 3, except the beta uses 4K
222// This is in some way similar to the system used on the CoCo 3, except the beta uses 4K
223223// pages (instead of 8K on the CoCo), and has 16 task registers instead of the 2 on the CoCo.
224224//
225// Each block of 16 page registers (1 for each task), is paged in at $FE00-$FE0F, the bottom
225// Each block of 16 page registers (1 for each task), is paged in at $FE00-$FE0F, the bottom
226226// 4 bits of the PIA register at $FCC0 seem to contain which task is active.
227227// bit 6 of the same port seems to enable the memory paging
228228//
229229// For the purpose of this driver any block that is not ram, and is not a known ROM block,
230230// is mapped to the first page of the boot rom, I do not know what happens in the real
231// hardware, however this does allow the boot rom to correctly size the RAM.
231// hardware, however this does allow the boot rom to correctly size the RAM.
232232// this should probably be considdered a hack !
233233//
234234
r1461r1462
247247   {
248248      bank_start   = bank_info[Page].start;
249249      bank_end   = bank_info[Page].end;
250     
250
251251      if (!IsIOPage(Page))
252252         MapPage   = PageRegs[TaskReg][Page].value;
253253      else
r1461r1462
258258      //
259259      if ((MapPage*4) < ((mess_ram_size / 1024)-1))      // Block is ram
260260      {
261         if (!IsIOPage(Page))       
261         if (!IsIOPage(Page))
262262         {
263263            readbank = &mess_ram[MapPage*RamPageSize];
264264#ifdef MAME_DEBUG
r1461r1462
278278         if (MapPage>0xfB)
279279         {
280280            if (Page!=IOPage+1)
281               readbank=&system_rom[(MapPage-0xFC)*0x1000];     
281               readbank=&system_rom[(MapPage-0xFC)*0x1000];
282282            else
283283               readbank=&system_rom[0x3F00];
284284         }
285285         else
286286            readbank=system_rom;
287         
287
288288         writebank=MWA8_ROM;
289289      }
290290
r1461r1462
308308{
309309   int      Idx;
310310
311#ifdef LOG_DEFAULT_TASK   
311#ifdef LOG_DEFAULT_TASK
312312   logerror("SetDefaultTask()\n");
313313   debug_console_printf("Set Default task\n");
314314#endif
315315
316316   TaskReg=NoPagingTask;
317   
317
318318   /* Reset ram pages */
319319   for(Idx=0;Idx<ROMPage-1;Idx++)
320320   {
321321      PageRegs[TaskReg][Idx].value=NoMemPageValue;
322   }     
322   }
323323
324324   /* Reset RAM Page */
325325   PageRegs[TaskReg][RAMPage].value=RAMPageValue;
326   
326
327327   /* Reset Video mem page */
328328   PageRegs[TaskReg][VideoPage].value=VideoPageValue;
329329
330330   /* Reset rom page */
331331   PageRegs[TaskReg][ROMPage].value=ROMPageValue;
332   
332
333333   /* Reset IO Page */
334334   PageRegs[TaskReg][IOPage].value=IOPageValue;
335335   PageRegs[TaskReg][IOPage+1].value=IOPageValue;
r1461r1462
352352// setup the mappings.
353353
354354WRITE8_HANDLER( dgn_beta_page_w )
355{   
355{
356356   PageRegs[PIATaskReg][offset].value=data;
357357
358358#ifdef LOG_PAGE_WRITE
359359   logerror("PageRegWrite : task=$%X  offset=$%X value=$%X\n",PIATaskReg,offset,data);
360360#endif
361361
362   if (EnableMapRegs)
363   {     
362   if (EnableMapRegs)
363   {
364364      UpdateBanks(offset,offset);
365365      if (offset==15)
366366         UpdateBanks(offset+1,offset+1);
r1461r1462
459459   dgn_beta_bank_memory(offset,data,16);
460460}
461461
462/*
463The keyrow being scanned for any key is the lest significant bit
464of the output shift register that is zero, most of the time there should
462/*
463The keyrow being scanned for any key is the lest significant bit
464of the output shift register that is zero, most of the time there should
465465only be one row active e.g.
466466
467467Shifter      Row being scanned
r1461r1462
473473
474474Returns row number or -1 if none selected.
475475
4762006-12-03, P.Harvey-Smith, modified to scan from msb to lsb, and stop at
477first row with zero, as the beta_test fills the shifter with zeros, rather
4762006-12-03, P.Harvey-Smith, modified to scan from msb to lsb, and stop at
477first row with zero, as the beta_test fills the shifter with zeros, rather
478478than using a walking zero as the OS-9 driver does. This meant that SelectKeyrow
479479never moved past the first row, by scanning for the last active row
480480the beta_test rom works, and it does not break the OS-9 driver :)
r1461r1462
485485   int   Row;   /* Row selected */
486486   int   Mask;   /* Mask to test row */
487487   int   Found;   /* Set true when found */
488   
488
489489   Row=INVALID_KEYROW;   /* Pretend no rows selected */
490490   Mask=0x200;      /* Start with row 9 */
491491   Found=0;      /* Start with not found */
492492   Idx=9;
493   
493
494494   while ((Mask>0) && !Found)
495495   {
496496      if((~Rows & Mask) && !Found)
r1461r1462
501501      Idx=Idx-1;         /* Decrement row count */
502502      Mask=Mask>>1;         /* Select next bit */
503503   }
504     
504
505505   return Row;
506506}
507507
r1461r1462
549549   int RetVal;
550550   int Idx;
551551   int Selected;
552   
552
553553#ifdef LOG_KEYBOARD
554554   logerror("PB Read\n");
555555#endif
556556
557557   KAny_next=0;
558   
558
559559   Selected=SelectedKeyrow(RowShifter);
560   
560
561561   /* Scan the whole keyboard, if output shifter is all low */
562562   /* This actually scans in the keyboard */
563563   if(RowShifter==0x00)
r1461r1462
577577            case 8 : Keyboard[Idx]=input_port_8_r(0); break;
578578            case 9 : Keyboard[Idx]=input_port_9_r(0); break;
579579         }
580         
580
581581         if(Keyboard[Idx]!=0x7F)
582582         {
583583            KAny_next=1;
r1461r1462
591591         KAny_next=1;
592592      }
593593   }
594   
594
595595   RetVal = (KInDat_next<<5) | (KAny_next<<2);
596   
596
597597#ifdef LOG_KEYBOARD
598598   logerror("FC22=$%02X KAny=%d\n",RetVal,KAny_next);
599599#endif
600   
600
601601   return RetVal;
602602}
603603
r1461r1462
605605{
606606   int   InClkState;
607607   int   OutClkState;
608   
608
609609#ifdef LOG_KEYBOARD
610610   logerror("PB Write\n");
611611#endif
612   
612
613613   InClkState   = data & KInClk;
614614   OutClkState   = data & KOutClk;
615   
615
616616#ifdef LOG_KEYBOARD
617617   logerror("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(d_pia0_pb_last & KInClk),Keyrow);
618618#endif
r1461r1462
630630#endif
631631      }
632632   }
633     
633
634634   d_pia0_pb_last=data;
635635}
636636
r1461r1462
642642#endif
643643   /* load keyrow on rising edge of CB2 */
644644   if((data==1) && (d_pia0_cb2_last==0))
645   {   
645   {
646646      RowNo=SelectedKeyrow(RowShifter);
647647      Keyrow=GetKeyRow(RowNo);
648648
r1461r1462
655655      debug_console_printf("rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",RowShifter,RowNo,Keyrow);
656656#endif
657657   }
658   
658
659659   d_pia0_cb2_last=data;
660660}
661661
r1461r1462
670670   cpu0_recalc_firq(state);
671671}
672672
673/* PIA #1 at $FC24-$FC27 I63
673/* PIA #1 at $FC24-$FC27 I63
674674   This handles :-
675675      Mouse + Disk Select on side A
676676      Halt on DMA CPU      PA7
r1461r1462
706706      /* CPU un-halted let it run ! */
707707      if (HALT_DMA==CLEAR_LINE)
708708         cpu_yield();
709   
709
710710      d_pia1_pa_last=data & 0x80;
711711   }
712   
712
713713   /* Drive selects are binary encoded on PA0 & PA1 */
714714   wd17xx_set_drive(~data & DSMask);
715   
715
716716   /* Set density of WD2797 */
717   if (data & DDenCtrl)
717   if (data & DDenCtrl)
718718   {
719719      wd17xx_set_density(DEN_FM_LO);
720720#ifdef MAME_DEBUG
r1461r1462
759759      /* CPU un-halted let it run ! */
760760      if (HALT_CPU==CLEAR_LINE)
761761         cpu_yield();
762   }   
762   }
763763}
764764
765765static void d_pia1_irq_a(int state)
r1461r1462
772772   cpu0_recalc_irq(state);
773773}
774774
775/* PIA #2 at FCC0-FCC3 I28
775/* PIA #2 at FCC0-FCC3 I28
776776   This handles :-
777777      DAT task select   PA0..PA3
778     
778
779779      DMA CPU NMI   PA7
780     
780
781781      Graphics control PB0..PB7 ???
782782      VSYNC intutrupt CB2
783783*/
r1461r1462
798798
799799   /* Bit 7 of $FFC0, seems to control NMI on second CPU */
800800   NMI=(data & 0x80);
801   
801
802802   /* only take action if NMI changed */
803   if(NMI!=DMA_NMI_LAST)
803   if(NMI!=DMA_NMI_LAST)
804804   {
805805#ifdef LOG_INTS
806806      logerror("cpu1 NMI : %d\n",NMI);
r1461r1462
826826      EnableMapRegs=0;
827827   else
828828      EnableMapRegs=1;
829   
829
830830   /* Bits 0..3 seem to control which task register is selected */
831831   OldTask=PIATaskReg;
832832   PIATaskReg=data & 0x0F;
r1461r1462
852852   else
853853   {
854854      // Update ram banks only if task reg changed and mapping enabled
855      if ((PIATaskReg!=OldTask) && (EnableMapRegs))     
855      if ((PIATaskReg!=OldTask) && (EnableMapRegs))
856856      {
857857         TaskReg=PIATaskReg;
858858         UpdateBanks(0,IOPage+1);
859859      }
860860   }
861#ifdef LOG_TASK   
861#ifdef LOG_TASK
862862   logerror("TaskReg=$%02X PIATaskReg=$%02X\n",TaskReg,PIATaskReg);
863863#endif
864864}
r1461r1462
896896   UINT8 pia2_irq_a = pia_get_irq_a(2);
897897   UINT8 pia2_irq_b = pia_get_irq_b(2);
898898   UINT8 IRQ;
899   
899
900900   if (pia0_irq_a || pia1_irq_a || pia1_irq_b || pia2_irq_a || pia2_irq_b)
901901      IRQ = ASSERT_LINE;
902902   else
r1461r1462
912912{
913913   UINT8 pia0_irq_b = pia_get_irq_b(0);
914914   UINT8 FIRQ;
915   
915
916916   if (pia0_irq_b)
917917      FIRQ = ASSERT_LINE;
918918   else
919919      FIRQ = CLEAR_LINE;
920     
920
921921   cpunum_set_input_line(0, M6809_FIRQ_LINE, FIRQ);
922   
922
923923#ifdef LOG_INTS
924924   logerror("cpu0 FIRQ : %d\n",FIRQ);
925925#endif
r1461r1462
943943{
944944   /* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */
945945   /* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */
946   
947   switch(event)
946
947   switch(event)
948948   {
949949      case WD17XX_IRQ_CLR:
950950         pia_2_ca1_w(0,CLEAR_LINE);
r1461r1462
959959      case WD17XX_DRQ_SET:
960960         /*wd2797_drq=ASSERT_LINE;*/
961961         cpu1_recalc_firq(ASSERT_LINE);
962         break;     
962         break;
963963   }
964964
965965#ifdef MAME_DEBUG
r1461r1462
972972{
973973   int result = 0;
974974
975   switch(offset & 0x03)
975   switch(offset & 0x03)
976976   {
977977      case 0:
978978         result = wd17xx_status_r(0);
r1461r1462
993993      default:
994994         break;
995995   }
996     
996
997997   return result;
998998}
999999
10001000WRITE8_HANDLER(dgnbeta_wd2797_w)
10011001{
1002    switch(offset & 0x3)
1002    switch(offset & 0x3)
10031003   {
10041004      case 0:
10051005         /* disk head is encoded in the command byte */
r1461r1462
10651065void dgn_beta_frame_interrupt (int data)
10661066{
10671067   /* Set PIA line, so it recognises inturrupt */
1068   if (!data)
1068   if (!data)
10691069   {
10701070      pia_2_cb2_w(0,ASSERT_LINE);
10711071   }
r1461r1462
10771077   logerror("Vblank\n");
10781078#endif
10791079   ScanInKeyboard();
1080}   
1080}
10811081
10821082void dgn_beta_line_interrupt (int data)
10831083{
10841084//   /* Set PIA line, so it recognises inturrupt */
1085//   if (data)
1085//   if (data)
10861086//   {
10871087//      pia_0_cb1_w(0,ASSERT_LINE);
10881088//   }
r1461r1462
11011101
11021102   /* Make sure CPU 1 is started out halted ! */
11031103   cpunum_set_input_line(1, INPUT_LINE_HALT, ASSERT_LINE);
1104   
1104
11051105   /* Reset to task 0, and map banks disabled, so standard memory map */
11061106   /* with ram at $0000-$BFFF, ROM at $C000-FBFF, IO at $FC00-$FEFF */
11071107   /* and ROM at $FF00-$FFFF */
r1461r1462
11271127
11281128   KInDat_next=0x00;         /* Next data bit to input */
11291129   KAny_next=0x00;            /* Next value for KAny */
1130   
1130
11311131   DMA_NMI_LAST=0x80;         /* start with DMA NMI inactive, as pulled up */
11321132//   DMA_NMI=CLEAR_LINE;         /* start with DMA NMI inactive */
1133   
1133
11341134   wd17xx_reset();
11351135   wd17xx_set_density(DEN_MFM_LO);
11361136   wd17xx_set_drive(0);
r1461r1462
11431143{
11441144   pia_config(0, &dgnbeta_pia_intf[0]);
11451145   pia_config(1, &dgnbeta_pia_intf[1]);
1146   pia_config(2, &dgnbeta_pia_intf[2]);
1146   pia_config(2, &dgnbeta_pia_intf[2]);
11471147
11481148   init_video();
1149   
1149
11501150   wd17xx_init(WD_TYPE_179X,dgnbeta_fdc_callback, NULL);
11511151#ifdef MAME_DEBUG
11521152   cpuintrf_set_dasm_override(0,dgnbeta_dasm_override);
r1461r1462
13511351static void DumpKeys(int ref, int params, const char *param[])
13521352{
13531353   int Idx;
1354   
1354
13551355   for(Idx=0;Idx<NoKeyrows;Idx++)
13561356   {
13571357      debug_console_printf("KeyRow[%d]=%2X\n",Idx,Keyboard[Idx]);
src/mess/machine/pdp1.c
r1461r1462
246246      0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00,
247247      0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00,
248248      0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00,
249     
249
250250      /* non-spacing middle dot */
251251      0x00,
252252      0x00,
r1461r1462
622622 * Reader Buffer 100 010 101 001 011 111
623623 *
624624 * (Vertical dashed line indicates sprocket holes and the symbols "X" indicate holes
625 * punched in tape).
625 * punched in tape).
626626 *
627627 * If bits 5 and 6 of the rpb instruction are both zero (720002), the contents of
628628 * the Reader Buffer must be transferred to the IO Register by executing
629629 * a rrb instruction.  When the Reader Buffer has information ready to be transferred
630630 * to the IO Register, Status Register Bit 1 is set to one.  If bits 5 and 6 are
631631 * different (730002 or 724002) the 18-bit word read from tape is automatically
632 * transferred to the IO Register via the Reader Buffer.
632 * transferred to the IO Register via the Reader Buffer.
633633 */
634634void iot_rpb(int op2, int nac, int mb, int *io, int ac)
635635{
r1461r1462
687687*/
688688/*
689689 * Punch Perforated Tape, Binary
690 * ppb Addres 0006
690 * ppb Addres 0006
691691 *
692692 * For each In-Out Transfer instruction one line of tape is punched. In-Out Register
693693 * Bit 5 conditions Hole 1. Bit 4 conditions Hole 2, etc. Bit 0 conditions Hole 6.
694 * Hole 7 is left blank. Hole 8 is always punched in this mode.
694 * Hole 7 is left blank. Hole 8 is always punched in this mode.
695695 */
696696void iot_ppb(int op2, int nac, int mb, int *io, int ac)
697697{
src/mess/machine/nec765.c
r1461r1462
8888   unsigned int    nec765_status[4];
8989   /* present cylinder number per drive */
9090   unsigned int    pcn[4];
91   
91
9292   /* drive being accessed. drive outputs from fdc */
9393   unsigned int    drive;
9494   /* side being accessed: side output from fdc */
9595   unsigned int   side;
9696
97   
97
9898   /* step rate time in us */
9999   unsigned long   srt_in_ms;
100100
r1461r1462
207207
208208   /* if a seek is done without drive connected: */
209209   /*  abnormal termination of command,
210      seek complete,
210      seek complete,
211211      not ready
212212   */
213213
r1461r1462
242242
243243   /* if a seek is done with drive connected, but disc missing: */
244244   /* seek complete */
245   
245
246246   /* if a seek is done with drive connected and disc in drive: */
247247   /* seek complete */
248248
249249   /* On Amstrad CPC:
250      If drive not connected, or drive connected but disc not in drive, not ready!
250      If drive not connected, or drive connected but disc not in drive, not ready!
251251      If drive connected and drive motor on, ready!
252252      On PC:
253253       Drive is always ready!
r1461r1462
296296   else
297297   {
298298      /* abnormal termination, not ready */
299      fdc.nec765_status[0] = 0x040 | 0x020 | 0x08;     
299      fdc.nec765_status[0] = 0x040 | 0x020 | 0x08;
300300   }
301301
302302   /* set drive and side */
r1461r1462
325325      nec765_set_data_request();
326326
327327      fdc.timer_type = 4;
328     
328
329329      if (!(fdc.nec765_flags & NEC765_DMA_MODE))
330330      {
331331         /* for pcw */
r1461r1462
346346      case 5:      /* write data */
347347      case 6:      /* read data */
348348      case 9:      /* write deleted data */
349      case 10:   /* read id */         
350      case 12:   /* read deleted data */         
349      case 10:   /* read id */
350      case 12:   /* read deleted data */
351351      case 13:   /* format at track */
352352      case 17:   /* scan equal */
353353      case 19:   /* scan low or equal */
r1461r1462
401401
402402   if (!(fdc.nec765_flags & NEC765_DMA_MODE))
403403   {
404      timer_adjust(fdc.timer, duration, 0, attotime_zero);     
404      timer_adjust(fdc.timer, duration, 0, attotime_zero);
405405   }
406406   else
407407   {
r1461r1462
414414static void nec765_setup_timed_data_request(int bytes)
415415{
416416   /* setup timer to trigger in NEC765_DATA_RATE us */
417   nec765_setup_timed_generic(0, ATTOTIME_IN_USEC(32-27)   /*NEC765_DATA_RATE)*bytes*/);     
417   nec765_setup_timed_generic(0, ATTOTIME_IN_USEC(32-27)   /*NEC765_DATA_RATE)*bytes*/);
418418}
419419
420420/* setup result data request */
r1461r1462
459459
460460      /* if drive is already at track 0, or drive is not ready */
461461      if (
462         floppy_drive_get_flag_state(img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) ||
462         floppy_drive_get_flag_state(img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) ||
463463         (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
464464         )
465465      {
r1461r1462
474474            /* yes - calculate real number of tracks to seek */
475475
476476            int current_track;
477   
477
478478            /* get current track */
479479            current_track = floppy_drive_get_current_track(img);
480480
r1461r1462
492492         {
493493            /* perform seek - if drive isn't present it will not do anything */
494494            floppy_drive_seek(img, signed_tracks);
495         
495
496496            nec765_setup_timed_int(signed_tracks);
497497         }
498498         else
r1461r1462
627627
628628/* Drive ready */
629629
630/*
630/*
631631
632632A drive will report ready if:
633633- drive is selected
r1461r1462
635635- disk is rotating at a constant speed (normally 300rpm)
636636
637637On more modern PCs, a ready signal is not provided by the drive.
638This signal is not used in the PC design and was eliminated to save costs
638This signal is not used in the PC design and was eliminated to save costs
639639If you look at the datasheets for the modern NEC765 variants, you will see the Ready
640640signal is not mentioned.
641641
r1461r1462
770770         }
771771      }
772772      /* deleted data? */
773      else
773      else
774774      if (fdc.command == 0x0c)
775775      {
776776         /* did we just find a sector with data mark ? */
r1461r1462
878878      {
879879         index_count++;
880880      }
881   
881
882882   }
883883   while (index_count!=2);
884884
885885   /* no data - specified sector ID was not found */
886886    fdc.nec765_status[1] |= NEC765_ST1_NO_DATA;
887 
887
888888   return 0;
889889}
890890
r1461r1462
993993         }
994994      }
995995      while (found_sector_to_read==0);
996   }   
997     
996   }
997
998998   {
999999      int data_size;
10001000
r1461r1462
10641064
10651065
10661066   data_size = nec765_n_to_bytes(id.N);
1067   
1067
10681068   floppy_drive_read_sector_data(current_image(), fdc.side, fdc.sector_id,nec765_data_buffer,data_size);
10691069
10701070   nec765_setup_execution_phase_read(nec765_data_buffer, data_size);
r1461r1462
10921092    - terminal count input is not set
10931093    - AND the the sector specified by EOT was read
10941094    */
1095   
1095
10961096   /* if end of cylinder is set, and we did receive a terminal count, then clear it */
10971097   if ((fdc.nec765_flags & NEC765_TC)!=0)
10981098   {
r1461r1462
11711171   }
11721172
11731173
1174   
1174
11751175   /* multi-track? */
11761176   if (fdc.nec765_command_bytes[0] & 0x080)
11771177   {
r1461r1462
11801180      or is it ignored the first time and not the next, so that
11811181      if it is started on side 0, it will end at EOT on side 1,
11821182      but if started on side 1 it will end at end of track????
1183     
1183
11841184      PC driver requires this to end at last sector on side 1, and
11851185      ignore EOT parameter.
1186     
1186
11871187      To be checked!!!!
11881188      */
11891189
r1461r1462
12191219      /* completed */
12201220      return 1;
12211221   }
1222   
1222
12231223   /* Multi-Track operation:
12241224
12251225   Verified on Amstrad CPC.
r1461r1462
12291229         2 sides
12301230         Sector IDs: &01, &02, &03, &04, &05, &06, &07, &08, &09
12311231
1232      Command specified:
1232      Command specified:
12331233         SIDE = 0,
12341234         C = 0,H = 0,R = 1, N = 2, EOT = 1
12351235      Sectors read:
12361236         Sector 1 side 0
12371237         Sector 1 side 1
12381238
1239      Command specified:
1239      Command specified:
12401240         SIDE = 0,
12411241         C = 0,H = 0,R = 1, N = 2, EOT = 3
12421242      Sectors read:
r1461r1462
12471247         Sector 2 side 1
12481248         Sector 3 side 1
12491249
1250         
1250
12511251      Command specified:
12521252         SIDE = 0,
12531253         C = 0, H = 0, R = 7, N = 2, EOT = 3
r1461r1462
12781278      /* multi-track? */
12791279      if (fdc.nec765_command_bytes[0] & 0x080)
12801280      {
1281         /* if we have reached EOT (fdc.nec765_command_bytes[6])
1281         /* if we have reached EOT (fdc.nec765_command_bytes[6])
12821282         on side 1, then read is complete */
12831283         if (fdc.side==1)
12841284            return 1;
r1461r1462
13521352         }
13531353      }
13541354      /* deleted data? */
1355      else
1355      else
13561356      if (fdc.command == 0x0c)
13571357      {
13581358         /* did we just read a sector with data? */
r1461r1462
14811481               nec765_read_complete();
14821482            }
14831483            else
1484            {   
1484            {
14851485               nec765_increment_sector();
14861486               nec765_read_data();
14871487            }
r1461r1462
15121512            /* version */
15131513            case 0x010:
15141514               return 1;
1515         
1515
15161516            /* verify */
15171517            case 0x016:
15181518               return 9;
r1461r1462
15241524            /* dumpreg */
15251525            case 0x0e:
15261526               return 1;
1527         
1527
15281528            /* perpendicular mode */
15291529            case 0x012:
15301530               return 1;
r1461r1462
15321532            /* lock */
15331533            case 0x014:
15341534               return 1;
1535         
1535
15361536            /* seek/relative seek are together! */
15371537
15381538            default:
r1461r1462
18251825         }
18261826
18271827         fdc.nec765_status[3] |= 0x08;
1828                                 
1828
18291829         /* two side and fault not set but should be? */
18301830         fdc.nec765_result_bytes[0] = fdc.nec765_status[3];
18311831         nec765_setup_result_phase(1);
r1461r1462
18801880                  }
18811881               }
18821882               while (index_count!=2);
1883                 
1883
18841884               /* at this point, we have seen a id or two index pulses have occured! */
18851885               fdc.nec765_result_bytes[0] = fdc.nec765_status[0];
18861886               fdc.nec765_result_bytes[1] = fdc.nec765_status[1];
r1461r1462
20652065                  case 0x13:      /* configure */
20662066                     nec765_idle();
20672067                     break;
2068                     
2068
20692069                  case 0x0e:      /* dump reg */
20702070                     fdc.nec765_result_bytes[0] = fdc.pcn[0];
20712071                     fdc.nec765_result_bytes[1] = fdc.pcn[1];
20722072                     fdc.nec765_result_bytes[2] = fdc.pcn[2];
20732073                     fdc.nec765_result_bytes[3] = fdc.pcn[3];
2074                       
2074
20752075                     nec765_setup_result_phase(10);
20762076                     break;
20772077
r1461r1462
21032103{
21042104   /* clear data request */
21052105   nec765_set_dma_drq(CLEAR_LINE);
2106   
2106
21072107   /* read data */
2108   return nec765_data_r(offset);   
2108   return nec765_data_r(offset);
21092109}
21102110
21112111
r1461r1462
21292129      int a_drive_is_ready;
21302130
21312131      fdc.nec765_status[0] = 0x080 | 0x040;
2132   
2132
21332133      /* for the purpose of pc-xt. If any of the drives have a disk inserted,
21342134      do not set not-ready - need to check with pc_fdc.c whether all drives
21352135      are checked or only the drive selected with the drive select bits?? */
r1461r1462
21502150         fdc.nec765_status[0] |= 0x08;
21512151      }
21522152
2153      nec765_set_int(1);   
2153      nec765_set_int(1);
21542154   }
21552155}
21562156
src/mess/machine/apple2gs.c
r1461r1462
66
77
88   Apple IIgs specific softswitches:
9   
9
1010   C019 - RDVBLBAR
1111      bits 7 - set during vblank (when at scanline 192 or higher)
1212
r1461r1462
1616
1717   C023 - VGCINT
1818      bit 7 - set for interrupt generated by VGC
19 
19
2020      bit 6 - set during one second interrupt
2121      bit 5 - set during scanline interrupt
22       
22
2323      bit 4 - set during external interrupt
2424      bit 3 - ???
2525      bit 2 - set for interrupt every second
26       
26
2727      bit 1 - set for scanline interrupt
2828      bit 0 - set for external interrupt
2929
r1461r1462
4848      bit 0 - command register full
4949
5050   C02D - SLTROMSEL
51   
51
5252   C031 - DISKREG
5353      bit 7 - set to select head on 3.5" drive
5454      bit 6 - set to enable 3.5" drive, clear to enable 5.25" drive
r1461r1462
350350 * ADB
351351 * ----------------------------------------------------------------------- */
352352
353typedef enum
353typedef enum
354354{
355355   ADBSTATE_IDLE,
356356   ADBSTATE_INCOMMAND,
r1461r1462
774774
775775   // make sure we're in the 65816's context
776776   cpuintrf_push_context(0);
777                           
777
778778   scanline = video_screen_get_vpos(0);
779779
780780   video_screen_update_partial(0, scanline);
781   
781
782782   /* scanline interrupt */
783783   if ((apple2gs_newvideo & 0x80) && (apple2gs_vgcint & 0x02) && (scanline >= (BORDER_TOP-1)) && (scanline < (200+BORDER_TOP-1)))
784784   {
r1461r1462
948948   {
949949      result = scan - BORDER_TOP + 0x100 + 1;
950950   }
951   
951
952952   return result;
953953}
954954
r1461r1462
963963      case 0x19:   /* C019 - RDVBLBAR */
964964         result = (video_screen_get_vpos(0) >= (192+BORDER_TOP)) ? 0x80 : 0x00;
965965         break;
966         
966
967967      case 0x22:   /* C022 - TBCOLOR */
968968         result = (apple2_get_fgcolor() << 4)
969969            | apple2_get_bgcolor();
r1461r1462
13871387   {
13881388      meminfo->read_mem      = 0x03D000 | APPLE2_MEM_ROM;
13891389   }
1390   
1390
13911391   if (a2 & VAR_LCWRITE)
13921392   {
13931393      if (a2 & VAR_LCRAM2)
r1461r1462
15801580{
15811581   UINT8 *opptr = NULL;
15821582   int slot;
1583   
1583
15841584   if (((address & 0xFEF000) == 0x00C000) || ((address & 0xFEF000) == 0xE0C000))
15851585   {
15861586      if ((apple2gs_shadow & 0x40) && ((address & 0xF00000) == 0x000000))
r1461r1462
17281728MACHINE_START( apple2gs )
17291729{
17301730   apple2_config cfg;
1731   
1731
17321732   memset(&cfg, 0, sizeof(cfg));
17331733   cfg.slots[0] = &apple2_slot_langcard;
17341734   cfg.slots[4] = &apple2_slot_mockingboard;
17351735   cfg.slots[6] = &apple2_slot_iwm;
1736   
1736
17371737   apple2_init_common(machine, &cfg);
17381738
17391739   /* set up Apple IIgs vectoring */
src/mess/machine/applefdc.c
r1461r1462
11/*********************************************************************
22
33   applefdc.c
4   
4
55   Implementation of various Apple Floppy Disk Controllers, including
66   the classic Apple controller and the IWM (Integrated Woz Machine)
77   chip
r1461r1462
1616   XGS and KEGS emulators which also contain IWM emulations.
1717
1818   TODO
19     -   Implement the unimplemented IWM modes
19     -   Implement the unimplemented IWM modes
2020         - IWM_MODE_CLOCKSPEED
2121         - IWM_MODE_BITCELLTIME
2222         - IWM_MODE_HANDSHAKEPROTOCOL
r1461r1462
360360               }
361361               else
362362                  result = applefdc_read_reg(0);
363                 
363
364364               break;
365365            case 0x0D:
366366               result = applefdc_read_reg(IWM_Q6);
src/mess/machine/hp48.c
r1461r1462
3737static struct {
3838   int state;
3939   struct {
40      int realsize,
40      int realsize,
4141         adr,/* a11..a0 ignored */
4242         size;/* a19..a12 comparator select, 1 means address line must match adr */
4343   } mem[5];
r1461r1462
9191   }
9292   if (hp48s.mem[HDW].adr!=-1)
9393   {
94      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, hp48s.mem[HDW].adr&~0x3f,
94      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, hp48s.mem[HDW].adr&~0x3f,
9595                         hp48s.mem[HDW].adr|0x3f, 0, 0, hp48_read);
9696      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, hp48s.mem[HDW].adr&~0x3f,
9797                          hp48s.mem[HDW].adr|0x3f, 0, 0, hp48_write);
r1461r1462
187187}
188188
189189#define TIMER1_VALUE hp48_hardware.data[0x37]
190HP48_HARDWARE hp48_hardware={
191   {0}
190HP48_HARDWARE hp48_hardware={
191   {0}
192192};
193193
194194void hp48_crc(int adr, int data)
r1461r1462
196196   if ((hp48s.mem[HDW].adr==-1)
197197      ||(adr<(hp48s.mem[HDW].adr&~0x3f))
198198      ||(adr>(hp48s.mem[HDW].adr|0x3f)) )
199      hp48_hardware.crc=(hp48_hardware.crc >> 4)
199      hp48_hardware.crc=(hp48_hardware.crc >> 4)
200200         ^ (((hp48_hardware.crc ^ data) & 0xf) * 0x1081);
201   else
202      hp48_hardware.crc=(hp48_hardware.crc >> 4)
201   else
202      hp48_hardware.crc=(hp48_hardware.crc >> 4)
203203         ^ ((hp48_hardware.crc& 0xf) * 0x1081);
204204}
205205
r1461r1462
210210   case 0: case 1: case 2: case 3:
211211   case 0xb: case 0xc:
212212      hp48_hardware.data[offset]=data;
213      break;     
213      break;
214214   case 0x20: case 0x21: case 0x22: case 0x23: case 0x24:
215215   case 0x25: case 0x26: case 0x27:
216216   case 0x28: case 0x29: //wo
217217   case 0x30: case 0x31: case 0x32: case 0x33: case 0x34:
218218      hp48_hardware.data[offset]=data;
219      break;     
219      break;
220220      // uart
221   case 0xd: case 0x10: case 0x11: case 0x12:
221   case 0xd: case 0x10: case 0x11: case 0x12:
222222   case 0x13: //w0
223223   case 0x14: case 0x15: //r0
224224   case 0x16: case 0x17: //w0
r1461r1462
276276      break;
277277   case 0x18: case 0x19: //lsb of service request
278278      hp48_hardware.data[offset]=data;
279      break;     
279      break;
280280   case 0x1b: // base nibble offset
281281      hp48_hardware.data[offset]=data;
282282      break;
r1461r1462
295295{
296296   int data=0;
297297   switch (offset) {
298      // lcd
298      // lcd
299299   case 0: case 1: case 2: case 3:
300300   case 9:
301301      data=1; //reset
src/mess/machine/applefdc.h
r1461r1462
11/*********************************************************************
22
33   applefdc.h
4   
4
55   Implementation of various Apple Floppy Disk Controllers, including
66   the classic Apple controller and the IWM (Integrated Woz Machine)
77   chip
src/mess/machine/apple3.c
r1461r1462
378378      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xC000, 0xC0FF, 0, 0, apple3_c0xx_r);
379379      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xC000, 0xC0FF, 0, 0, apple3_c0xx_w);
380380   }
381   else
381   else
382382   {
383383      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xC000, 0xC0FF, 0, 0, MRA8_BANK8);
384384      if (via_0_a & 0x08)
src/mess/machine/3do.c
r1461r1462
154154READ32_HANDLER( clio_r )
155155{
156156   logerror( "%08X: CLIO read offset = %08X\n", activecpu_get_pc(), offset );
157   
157
158158   switch( offset )
159159   {
160160      case 0x0a: return 0x40; break;
r1461r1462
162162      {
163163         static UINT32 irq_sequence[3] = { 0, 4, 12 };
164164         static int counter = 0;
165         
165
166166         return irq_sequence[(counter++)%3];
167167      }
168168      break;
r1461r1462
173173WRITE32_HANDLER( clio_w )
174174{
175175   logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", activecpu_get_pc(), offset, data, mem_mask );
176   
176
177177   switch( offset )
178178   {
179179      case 0x0A:   /* 03400028 - bits 0,1, and 6 are tested (irq sources?) */
180180      break;
181     
181
182182      case 0x0B:   /* 0340002C - ?? during boot 0000000B is written here counter reload related?? */
183183      break;
184     
184
185185      case 0x88:   /* set timer frequency */
186         
186
187187      break;
188188   }
189189}
src/mess/machine/mac.c
r1461r1462
11/****************************************************************************
22   Mac hardware
3   
3
44   The hardware for Mac 128k, 512k, 512ke, Plus (SCSI, SCC, etc).
55
66   Nate Woods
r1461r1462
88   Raphael Nabet
99
1010   Mac Model Feature Summary:
11     
11
1212                  CPU      FDC      Keyb   PRAM   ROMMir
1313       - Mac 128k      68k      IWM      orig   orig   ???
1414       - Mac 512k      68k      IWM      orig   orig   ???
r1461r1462
434434      }
435435      else
436436      {
437         /* Communication is over */
437         /* Communication is over */
438438         kbd_comm = FALSE;
439439      }
440440   }
r1461r1462
489489
490490      keyboard_reply = scan_keyboard();
491491      if (keyboard_reply == 0x7B)
492      {   
492      {
493493         /* if NULL, wait until key pressed or timeout */
494494         timer_adjust(inquiry_timeout,
495495            attotime_make(0, DOUBLE_TO_ATTOSECONDS(0.25)),
r1461r1462
903903   if (rtc_state == RTC_STATE_XPCOMMAND)
904904   {
905905      rtc_xpaddr = ((rtc_cmd & 7)<<5) | ((data&0x7c)>>2);
906      if ((rtc_cmd & 0x80) != 0)   
906      if ((rtc_cmd & 0x80) != 0)
907907      {
908908         // read command
909909         if (LOG_RTC)
src/mess/machine/adam.c
r1461r1462
165165    else {KbRepeatTable[0x0E]=0;}
166166    if (controlKey && !shiftKey && !(keyboard[1] & 0x80)) addToKeyboardBuffer(0x0F); /* controlKey + O */
167167    else {KbRepeatTable[0x0F]=0;}
168   
168
169169    if (controlKey && !shiftKey && !(keyboard[2] & 0x01)) addToKeyboardBuffer(0x10); /* controlKey + P */
170170    else {KbRepeatTable[0x10]=0;}
171171    if (controlKey && !shiftKey && !(keyboard[2] & 0x02)) addToKeyboardBuffer(0x11); /* controlKey + Q */
r1461r1462
557557         buffer=(memory_region(REGION_CPU1)[statusDCB+0x01])+(memory_region(REGION_CPU1)[statusDCB+0x02]<<8);
558558         byteCount=(memory_region(REGION_CPU1)[statusDCB+0x03])+(memory_region(REGION_CPU1)[statusDCB+0x04]<<8);
559559
560         if (deviceNum>=4 && deviceNum<=7)
560         if (deviceNum>=4 && deviceNum<=7)
561561         {
562562            image = image_from_devtype_and_index(IO_FLOPPY, deviceNum - 4);
563563            if (image_exists(image))
r1461r1462
618618            case 4: /* Read Data */
619619               /*
620620               AdamNet Error codes on low nibble for tape1,disk1,disk2 and on high nibble for tape2 (share DCB with tape1):
621                   
621
622622                  0x00  No Error (everything is OK)
623623                  0x01  CRC Error (block corrupt; data failed cyclic redundancy check)
624624                  0x02  Missing Block (attempt to access past physical end of medium)
r1461r1462
700700}
701701
702702 READ8_HANDLER( adamnet_r )
703{ 
703{
704704    //logerror("adam_net_data Read %2xh\n",adam_net_data);
705705    return adam_net_data;
706706}
r1461r1462
708708WRITE8_HANDLER( adamnet_w )
709709{
710710   /*
711   If SmartWriter ROM is selected on lower Z80 memory
711   If SmartWriter ROM is selected on lower Z80 memory
712712   if data bit1 is 1 -> Lower 32k = EOS otherwise Lower 32k = SmartWriter
713713   */
714714   UINT8 *BankBase;
r1461r1462
735735         memory_set_bankptr(2, BankBase+0x22000);
736736         memory_set_bankptr(3, BankBase+0x24000);
737737         memory_set_bankptr(4, BankBase+0x26000);
738           
738
739739         memory_set_bankptr(6, BankBase+0x3A000); /* Write protecting ROM */
740740         memory_set_bankptr(7, BankBase+0x3A000); /* Write protecting ROM */
741741         memory_set_bankptr(8, BankBase+0x3A000); /* Write protecting ROM */
r1461r1462
754754{
755755    /*
756756    Writes to ports 0x60 to 0x7F set memory map:
757   
757
758758    - D1,D0 -> Lower Memory configuration (0x0000, 0x7FFF)
759759       0  0    SmartWriter Rom
760760       0  1    Internal RAM (32k)
761761       1  0    RAM Expansion (32k)
762762       1  1    OS7 ROM (8k) + Internal RAM (24k) (for partial ColecoVision compatibility)
763   
763
764764    - D3,D2 -> Upper Memory configuration (0x8000, 0xFFFF)
765765       0  0    Internal RAM (32k)
766766       0  1    ROM Expansion (32k). The first expansion ROM byte must be 0x66, and the second 0x99.
767767       1  0    RAM Expansion (32k)
768768       1  1    Cartridge ROM (32k)
769   
769
770770    - D7,D4 -> Reserved for future expansions, must be 0.
771771
772772    */
773   
773
774774    adam_lower_memory = (data & 0x03);
775775    adam_upper_memory = (data & 0x0C)>>2;
776776    set_memory_banks();
r1461r1462
778778}
779779
780780 READ8_HANDLER(adam_video_r)
781{ 
781{
782782    return ((offset&0x01) ? TMS9928A_register_r(1) : TMS9928A_vram_r(0));
783783}
784784
r1461r1462
788788}
789789
790790 READ8_HANDLER( master6801_ram_r )
791{ 
791{
792792    /*logerror("Offset %04Xh = %02Xh\n",offset ,memory_region(REGION_CPU1)[offset]);*/
793793    return memory_region(REGION_CPU1)[offset+0x4000];
794794}
r1461r1462
813813         inport0 = readinputportbytag("controller1_keypad1");
814814         inport1 = readinputportbytag("controller1_keypad2");
815815         inport6 = readinputportbytag("controllers");
816         
817         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
816
817         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
818818         than one, a real ColecoVision think that it is a third button, so we are going to emulate
819819         the right behaviour */
820         
820
821821         data = 0x0F;   /* No key pressed by default */
822822         if (!(inport6&0x01)) /* If Driving Controller enabled -> no keypad 1 */
823823         {
r1461r1462
841841      {
842842         int data = readinputportbytag("controller1_joystick") & 0xCF;
843843         int inport6 = readinputportbytag("controllers");
844         
844
845845         if (inport6&0x07) /* If Extra Contollers enabled */
846846         {
847847             if (adam_joy_stat[0]==0)
848848               data |= 0x30; /* Spinner Move Left */
849849             else if (adam_joy_stat[0]==1)
850850               data |= 0x20; /* Spinner Move Right */
851         } 
851         }
852852         return data | 0x80;
853853      }
854854   }
r1461r1462
863863         inport3 = readinputportbytag("controller2_keypad1");
864864         inport4 = readinputportbytag("controller2_keypad2");
865865
866         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
866         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
867867         than one, a real ColecoVision think that it is a third button, so we are going to emulate
868868         the right behaviour */
869         
869
870870         data = 0x0F;   /* No key pressed by default */
871871         if (!(inport3 & 0x01)) data &= 0x0A; /* 0 */
872872         if (!(inport3 & 0x02)) data &= 0x0D; /* 1 */
r1461r1462
888888      {
889889         int data = readinputportbytag("controller2_joystick") & 0xCF;
890890         int inport6 = readinputportbytag("controllers");
891         
891
892892         if (inport6&0x02) /* If Roller Controller enabled */
893893         {
894894             if (adam_joy_stat[1]==0) data|=0x30;
895895             else if (adam_joy_stat[1]==1) data|=0x20;
896         } 
896         }
897897
898898         return data | 0x80;
899899      }
src/mess/machine/ncr5380.c
r1461r1462
11/*
22 * ncr5380.c
33 *
4 * NCR 5380 SCSI controller, as seen in many 680x0 Macs,
4 * NCR 5380 SCSI controller, as seen in many 680x0 Macs,
55 * official Apple add-on cards for the Apple II series,
66 * and probably some PC cards as well.
77 *
r1461r1462
1313 *
1414 * NOTES:
1515 * This implementation is tied closely to the drivers found in the Mac Plus ROM and the routines in Mac
16 * System 6.0.3 that it patches out the ROM traps with.  While attempts have been made to
16 * System 6.0.3 that it patches out the ROM traps with.  While attempts have been made to
1717 * have the behavior work according to the manual and not the specific Apple driver code,
1818 * there are almost certainly areas where that is true.  In particular, IRQs are not implemented
1919 * as they are unused on the Mac Plus.
r1461r1462
5353typedef struct
5454{
5555   void *data;      // device's "this" pointer
56   pSCSIDispatch handler;   // device's handler routine   
56   pSCSIDispatch handler;   // device's handler routine
5757} SCSIDev;
5858
5959static SCSIDev devices[8];   // SCSI IDs 0-7
r1461r1462
178178                  d_limit = devices[last_id].handler(SCSIOP_EXEC_COMMAND, devices[last_id].data, 0, &n5380_Command[0]);
179179
180180                  d_ptr = 0;
181   
181
182182                  // is data available?
183183                  if (d_limit > 0)
184184                  {
r1461r1462
187187                     {
188188                        n5380_Data[d_limit] = 0;
189189                     }
190                 
190
191191                     // read back the amount available, or 512 bytes, whichever is smaller
192192                     ncr5380_read_data((d_limit < 512) ? d_limit : 512, n5380_Data);
193193
r1461r1462
240240            n5380_Registers[R5380_INICOMMAND] &= ~0x20;   // clear "lost arbitration"
241241         }
242242
243         if (data == 0)   
243         if (data == 0)
244244         {
245245            // drop DMA mode
246246            n5380_Registers[R5380_BUSANDSTAT] &= ~0x40;
r1461r1462
287287   {
288288      case R5380_CURDATA:
289289         rv = n5380_Registers[reg];
290         
290
291291         // if we're in the data transfer phase, readback device data instead
292292         if ((n5380_Registers[R5380_BUSSTATUS] & 0x1c) == 0x04)
293293         {
r1461r1462
306306                if (d_ptr < 511)
307307               {
308308                  d_ptr++;
309               }   
309               }
310310               else
311311               {
312312                  d_limit -= 512;
r1461r1462
350350      /* compilation error */
351351      /* devices[interface->scsidevs->devices[i].scsiID].handler = interface->scsidevs->devices[i].handler; */
352352      /* interface->scsidevs->devices[i].handler(SCSIOP_ALLOC_INSTANCE, &devices[interface->scsidevs->devices[i].scsiID].data, interface->scsidevs->devices[i].diskID, (UINT8 *)NULL); */
353   }   
353   }
354354
355355   state_save_register_item_array("ncr5380", 0, n5380_Registers);
356356   state_save_register_item_array("ncr5380", 0, n5380_Command);
src/mess/machine/mpc105.c
r1461r1462
119119            case 1:
120120               result = 0xFF008010;
121121               break;
122               
122
123123            default:
124124               fatalerror("Unknown CPU");
125125               break;
src/mess/machine/hd6402.c
r1461r1462
1717   uart.callback = NULL;
1818   serial_connection_init(&uart.connection);
1919   serial_connection_set_in_callback(&uart.connection, hd6402_in_callback);
20   uart.connection.input_state = 0;   
20   uart.connection.input_state = 0;
2121   receive_register_reset(&uart.receive_reg);
2222   transmit_register_reset(&uart.transmit_reg);
2323}
r1461r1462
3838      /* set it up */
3939      transmit_register_setup(&uart.transmit_reg, &uart.data_form, uart.data);
4040   }
41     
41
4242   /* if transmit is not empty... transmit data */
4343   if ((uart.transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0)
4444   {
r1461r1462
7070{
7171   /* get bit received from other side and update receive register */
7272   receive_register_update_bit(&uart.receive_reg, get_in_data_bit(uart.connection.input_state));
73   
73
7474   if (uart.receive_reg.flags & RECEIVE_REGISTER_FULL)
7575   {
7676      receive_register_extract(&uart.receive_reg, &uart.data_form);
r1461r1462
154154   }
155155
156156   uart.data_form.stop_bit_count = stop_bits;
157   
157
158158   logerror("hd6402: stop bits: %d\n",stop_bits);
159159}
160160
r1461r1462
188188      if ((data & HD6402_INPUT_DRR)==0)
189189      {
190190         uart.state &=~HD6402_OUTPUT_DR;
191         
191
192192         /* refresh outputs */
193193         if (uart.callback)
194194            uart.callback(HD6402_OUTPUT_PE|HD6402_OUTPUT_FE|HD6402_OUTPUT_OE|HD6402_OUTPUT_DR|HD6402_OUTPUT_TRE,  uart.state);
r1461r1462
210210      uart.state |=(data & mask);
211211      hd6402_update_parity();
212212   }
213   
213
214214   /* character length set */
215215   if (mask & (HD6402_INPUT_CLS1|HD6402_INPUT_CLS2))
216216   {
src/mess/machine/mbee.c
r1461r1462
1111   until A15 is asserted.  The Z80 NOP instruction is 0x00, so the effect is
1212   to cause reset to skip all memory up to 0x8000, where the actual handling
1313   code resides.
14   
14
1515****************************************************************************/
1616
1717#include "driver.h"
src/mess/machine/msx_slot.c
r1461r1462
11/*
2 * msx_slot.c : definitions of the different slots
2 * msx_slot.c : definitions of the different slots
33 *
44 * Copyright (C) 2004 Sean Young
55 *
r1461r1462
9696MSX_SLOT_MAP(rom)
9797{
9898   UINT8 *mem = state->mem + (page - state->start_page) * 0x4000;
99   
99
100100   msx_cpu_setbank (page * 2 + 1, mem);
101101   msx_cpu_setbank (page * 2 + 2, mem + 0x2000);
102102}
r1461r1462
111111
112112   return 0;
113113}
114   
114
115115MSX_SLOT_MAP(ram)
116116{
117117   UINT8 *mem = state->mem + (page - state->start_page) * 0x4000;
r1461r1462
131131#ifdef MONMSX
132132   FILE *f;
133133#endif
134   
134
135135   nsize = 0x10000; /* 64 kb */
136136   mask = 3;
137137   for (i=0; i<6; i++) {
r1461r1462
177177
178178MSX_SLOT_MAP(rammm)
179179{
180   UINT8 *mem = state->mem +
180   UINT8 *mem = state->mem +
181181         0x4000 * (msx1.ram_mapper[page] & state->bank_mask);
182   
182
183183   msx1.ram_pages[page] = mem;
184184   msx_cpu_setbank (page * 2 + 1, mem);
185185   msx_cpu_setbank (page * 2 + 2, mem + 0x2000);
r1461r1462
358358   case 2:
359359      msx_cpu_setbank (5, state->mem + state->banks[2] * 0x2000);
360360      msx_cpu_setbank (6, state->mem + state->banks[3] * 0x2000);
361      memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9fff, 0, 0,
361      memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9fff, 0, 0,
362362            state->cart.scc.active ? konami_scc_bank5 : MRA8_BANK7);
363363      break;
364364   case 3:
r1461r1462
375375      if (msx1.state[3] == state) {
376376         slot_konami_scc_map (state, 3);
377377      }
378   }
378   }
379379   else if (addr >= 0x7000 && addr < 0x7800) {
380380      state->banks[1] = val & state->bank_mask;
381381      slot_konami_scc_map (state, 1);
382382      if (msx1.state[3] == state) {
383383         slot_konami_scc_map (state, 3);
384384      }
385   }
385   }
386386   else if (addr >= 0x9000 && addr < 0x9800) {
387387      state->banks[2] = val & state->bank_mask;
388388      state->cart.scc.active = ((val & 0x3f) == 0x3f);
r1461r1462
390390      if (msx1.state[0] == state) {
391391         slot_konami_scc_map (state, 0);
392392      }
393   }
393   }
394394   else if (state->cart.scc.active && addr >= 0x9800 && addr < 0xa000) {
395395      int offset = addr & 0xff;
396396
r1461r1462
414414         /* deformation register */
415415      }
416416#endif
417   }
417   }
418418   else if (addr >= 0xb000 && addr < 0xb800) {
419419      state->banks[3] = val & state->bank_mask;
420420      slot_konami_scc_map (state, 2);
r1461r1462
649649   }
650650   if (addr >= 0x8000 && addr < 0xc000) {
651651      bank = addr < 0xa000 ? 2 : 3;
652      if (!(state->banks[bank] & state->cart.sram.empty_mask) &&
652      if (!(state->banks[bank] & state->cart.sram.empty_mask) &&
653653           (state->banks[bank] & state->cart.sram.sram_mask)) {
654654         state->cart.sram.mem[addr & 0x1fff] = val;
655655      }
r1461r1462
800800      }
801801   }
802802   else if (addr >= 0x8000 && addr < 0xc000) {
803      if (!(state->banks[1] & state->cart.sram.empty_mask) &&
803      if (!(state->banks[1] & state->cart.sram.empty_mask) &&
804804           (state->banks[1] & state->cart.sram.sram_mask)) {
805805         int offset, i;
806806
r1461r1462
831831
832832      if (mame_fread (f, state->cart.sram.mem, 0x200) == 0x200) {
833833         int offset, i;
834         
834
835835         mame_fclose (f);
836836
837837         offset = 0;
r1461r1462
979979   case 1:
980980      msx_cpu_setbank (1 + page * 2, state->mem); /* bank 0 is hardwired */
981981      if (state->banks[1] > 15) {
982         msx_cpu_setbank (2 + page * 2, state->cart.sram.mem +
982         msx_cpu_setbank (2 + page * 2, state->cart.sram.mem +
983983               (state->banks[1] - 16) * 0x2000);
984984      }
985985      else {
r1461r1462
11371137   case 2: return wd17xx_sector_r (0);
11381138   case 3: return wd17xx_data_r (0);
11391139   case 7: return msx1.dsk_stat;
1140   default:
1140   default:
11411141      return msx1.state[1]->mem[offset + 0x3ff8];
11421142   }
11431143}
1144                                                           
1144
11451145static  READ8_HANDLER (msx_diskrom_page2_r)
11461146{
11471147   if (offset >= 0x7f8) {
11481148      switch (offset) {
1149      case 0x7f8:
1149      case 0x7f8:
11501150         return wd17xx_status_r (0);
1151      case 0x7f9:
1151      case 0x7f9:
11521152         return wd17xx_track_r (0);
1153      case 0x7fa:
1153      case 0x7fa:
11541154         return wd17xx_sector_r (0);
1155      case 0x7fb:
1155      case 0x7fb:
11561156         return wd17xx_data_r (0);
1157      case 0x7ff:
1157      case 0x7ff:
11581158         return msx1.dsk_stat;
1159      default:
1159      default:
11601160         return msx1.state[2]->mem[offset + 0x3800];
11611161      }
11621162   }
r1461r1462
12471247   case 2: return wd17xx_sector_r (0);
12481248   case 3: return wd17xx_data_r (0);
12491249   case 4: return msx1.dsk_stat;
1250   default:
1250   default:
12511251      return msx1.state[1]->mem[offset + 0x3ff8];
12521252   }
12531253}
1254                                                           
1254
12551255static  READ8_HANDLER (msx_diskrom2_page2_r)
12561256{
12571257   if (offset >= 0x7b8) {
12581258      switch (offset) {
1259      case 0x7b8:
1259      case 0x7b8:
12601260         return wd17xx_status_r (0);
1261      case 0x7b9:
1261      case 0x7b9:
12621262         return wd17xx_track_r (0);
1263      case 0x7ba:
1263      case 0x7ba:
12641264         return wd17xx_sector_r (0);
1265      case 0x7bb:
1265      case 0x7bb:
12661266         return wd17xx_data_r (0);
1267      case 0x7bc:
1267      case 0x7bc:
12681268         return msx1.dsk_stat;
1269      default:
1269      default:
12701270         return msx1.state[2]->mem[offset + 0x3800];
12711271      }
12721272   }
r1461r1462
13951395   for (i=0; i<4; i++) {
13961396      state->banks[i] = i;
13971397   }
1398}
1398}
13991399
14001400MSX_SLOT_MAP(majutsushi)
14011401{
r1461r1462
15281528         state->cart.fmpac.mem[addr & 0x1fff] = val;
15291529      }
15301530
1531      state->cart.fmpac.sram_active =
1531      state->cart.fmpac.sram_active =
15321532            (state->cart.fmpac.mem[0x1ffe] == 0x4d &&
15331533             state->cart.fmpac.mem[0x1fff] == 0x69);
15341534   }
15351535
15361536   switch (addr) {
1537   case 0x7ff4:
1537   case 0x7ff4:
15381538      if (state->cart.fmpac.opll_active) {
15391539         YM2413_register_port_0_w (0, val);
15401540      }
r1461r1462
15441544         YM2413_data_port_0_w (0, val);
15451545      }
15461546      break;
1547   case 0x7ff6:
1547   case 0x7ff6:
15481548      data = val & 0x11;
15491549      for (i=0; i<=state->bank_mask; i++) {
15501550         state->mem[0x3ff6 + i * 0x4000] = data;
r1461r1462
16301630   }
16311631
16321632   logerror ("fmpac: warning: could not open sram file for writing\n");
1633   
1633
16341634   return 1;
16351635}
16361636
r1461r1462
16581658MSX_SLOT_MAP(superloadrunner)
16591659{
16601660   if (page == 2) {
1661      UINT8 *mem = state->mem +
1661      UINT8 *mem = state->mem +
16621662            (msx1.superloadrunner_bank & state->bank_mask) * 0x4000;
16631663
16641664      msx_cpu_setbank (5, mem);
r1461r1462
18421842{
18431843   UINT8 *mem;
18441844   UINT8 mask = (msx1.korean90in1_bank & 0xc0) == 0x80 ? 0x3e : 0x3f;
1845   mem = state->mem +
1845   mem = state->mem +
18461846      ((msx1.korean90in1_bank & mask) & state->bank_mask) * 0x4000;
18471847
18481848   switch (page) {
r1461r1462
20392039   case 2:
20402040      msx_cpu_setbank (5, state->mem + state->banks[2] * 0x2000);
20412041      msx_cpu_setbank (6, state->mem + state->banks[3] * 0x2000);
2042      memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9fff, 0, 0,
2042      memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9fff, 0, 0,
20432043         state->cart.sccp.scc_active ? soundcartridge_scc : MRA8_BANK7);
2044      memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0xb800, 0xbfff, 0, 0,
2045         state->cart.sccp.sccp_active ? soundcartridge_sccp : MRA8_BANK9);
2044      memory_install_read8_handler (0, ADDRESS_SPACE_PROGRAM, 0xb800, 0xbfff, 0, 0,
2045         state->cart.sccp.sccp_active ? soundcartridge_sccp : MRA8_BANK9);
20462046      break;
20472047   case 3:
20482048      msx_cpu_setbank (7, state->mem + state->banks[0] * 0x2000);
r1461r1462
20912091      else if (addr >= 0x9000 && addr < 0x9800) {
20922092         state->banks[2] = val & state->bank_mask;
20932093         state->cart.sccp.banks_saved[2] = val;
2094         state->cart.sccp.scc_active =
2094         state->cart.sccp.scc_active =
20952095               (((val & 0x3f) == 0x3f) && !(state->cart.sccp.mode & 0x20));
20962096
20972097         slot_soundcartridge_map (state, 2);
r1461r1462
21322132      else if (addr >= 0xb000 && addr < 0xb800) {
21332133         state->cart.sccp.banks_saved[3] = val;
21342134         state->banks[3] = val & state->bank_mask;
2135         state->cart.sccp.sccp_active =
2135         state->cart.sccp.sccp_active =
21362136               (val & 0x80) && (state->cart.sccp.mode & 0x20);
21372137         slot_soundcartridge_map (state, 2);
21382138         if (msx1.state[0] == state) {
r1461r1462
21862186
21872187      }
21882188
2189      state->cart.sccp.scc_active =
2190         (((state->cart.sccp.banks_saved[2] & 0x3f) == 0x3f) &&
2189      state->cart.sccp.scc_active =
2190         (((state->cart.sccp.banks_saved[2] & 0x3f) == 0x3f) &&
21912191          !(val & 0x20));
21922192
2193      state->cart.sccp.sccp_active =
2193      state->cart.sccp.sccp_active =
21942194            ((state->cart.sccp.banks_saved[3] & 0x80) && (val & 0x20));
21952195
21962196      slot_soundcartridge_map (state, 2);
r1461r1462
22062206   MSX_SLOT (SLOT_ASCII16, ascii16)
22072207   MSX_SLOT_SRAM (SLOT_GAMEMASTER2, gmaster2)
22082208   MSX_SLOT_SRAM (SLOT_ASCII8_SRAM, ascii8_sram)
2209   MSX_SLOT_SRAM (SLOT_ASCII16_SRAM, ascii16_sram)
2209   MSX_SLOT_SRAM (SLOT_ASCII16_SRAM, ascii16_sram)
22102210   MSX_SLOT (SLOT_RTYPE, rtype)
22112211   MSX_SLOT (SLOT_MAJUTSUSHI, majutsushi)
22122212   MSX_SLOT_SRAM (SLOT_FMPAC, fmpac)
src/mess/machine/i8271.c
r1461r1462
55/* TODO:
66
77   - Scan commands
8   - Check the commands work properly using a BBC disc copier program
8   - Check the commands work properly using a BBC disc copier program
99    - check if 0 is specified as number of sectors, how many sectors
1010    is actually transfered
1111   - deleted data functions (error if data finds deleted data?)
r1461r1462
6969    i8271_reset();
7070}
7171
72   
72
7373static void i8271_seek_to_track(int track)
7474{
7575   mess_image *img = current_image();
r1461r1462
9494      }
9595
9696      i8271.CurrentTrack[i8271.drive] = 0;
97   
97
9898      /* failed to find track 0? */
9999      if (StepCount==0)
100100      {
r1461r1462
116116
117117      /* step towards 0 */
118118      i8271.drive_control_output &= ~(1<<2);
119     
119
120120      if (SignedTracks>0)
121121      {
122122         /* step away from 0 */
r1461r1462
130130      i8271.CurrentTrack[i8271.drive] = track;
131131   }
132132}
133   
134133
134
135135static TIMER_CALLBACK(i8271_data_timer_callback)
136136{
137137   /* ok, trigger data request now */
138138   i8271_data_request();
139139
140140   /* stop it */
141   timer_reset(i8271.data_timer, attotime_never);
141   timer_reset(i8271.data_timer, attotime_never);
142142}
143143
144144/* setup a timed data request - data request will be triggered in a few usecs time */
r1461r1462
160160   i8271_command_complete(1,1);
161161
162162   /* stop it, but don't allow it to be free'd */
163   timer_reset(i8271.command_complete_timer, attotime_never);
163   timer_reset(i8271.command_complete_timer, attotime_never);
164164}
165165
166166/* setup a irq to occur 128us later - in reality this would be much later, because the int would
r1461r1462
250250   /* &80 = drive 1 side 0 */
251251
252252
253   
253
254254   if (i8271.CommandRegister & (1<<6))
255255   {
256256      i8271.drive = 0;
r1461r1462
286286         {
287287            /* setup data with byte */
288288            i8271.data = i8271.pExecutionPhaseData[i8271.ExecutionPhaseCount];
289         
289
290290/*            logerror("read data %02x\n", i8271.data); */
291291
292292            /* update counters */
r1461r1462
353353   /* read */
354354   i8271.flags |= I8271_FLAGS_DATA_DIRECTION;
355355   i8271.ExecutionPhaseCount = 0;
356   i8271.ExecutionPhaseTransferCount = transfer_size;   
356   i8271.ExecutionPhaseTransferCount = transfer_size;
357357   i8271.state = I8271_STATE_EXECUTION_READ;
358358}
359359
r1461r1462
392392{
393393   /* not busy, and not a execution phase data request in non-dma mode */
394394   i8271.StatusRegister &= ~(I8271_STATUS_COMMAND_BUSY | I8271_STATUS_NON_DMA_REQUEST);
395   
395
396396   if (result)
397397   {
398398      i8271.StatusRegister |= I8271_STATUS_RESULT_FULL;
r1461r1462
403403      /* trigger an int */
404404      i8271_set_irq_state(1);
405405    }
406   
406
407407   /* correct?? */
408408    i8271.drive_control_output &=~1;
409409}
r1461r1462
444444         /* end command? */
445445         if (i8271.Counter==0)
446446         {
447           
447
448448            i8271_timed_command_complete();
449449            return;
450450         }
451         
451
452452         i8271_do_read();
453453      }
454454      break;
r1461r1462
467467         /* end command? */
468468         if (i8271.Counter==0)
469469         {
470           
470
471471            i8271_timed_command_complete();
472472            return;
473473         }
474         
474
475475         i8271_do_write();
476476      }
477477      break;
r1461r1462
502502   {
503503      /* get the sector into the buffer */
504504      floppy_drive_read_sector_data(current_image(), i8271.side, i8271.data_id, i8271.pExecutionPhaseData, 1<<(i8271.ID_N+7));
505         
505
506506      /* initialise for reading */
507507        i8271_initialise_execution_phase_read(1<<(i8271.ID_N+7));
508     
508
509509      /* update state - gets first byte and triggers a data request */
510510      i8271_timed_data_request();
511511      return;
r1461r1462
540540   {
541541      /* initialise for reading */
542542        i8271_initialise_execution_phase_write(1<<(i8271.ID_N+7));
543     
543
544544      /* update state - gets first byte and triggers a data request */
545545      i8271_timed_data_request();
546546      return;
r1461r1462
598598      {
599599         index_count++;
600600      }
601   
601
602602   }
603603   while (index_count!=2);
604604
605605   /* completion type: command/drive error */
606606   /* completion code: sector not found */
607607   i8271.ResultRegister |= (3<<3);
608   
608
609609   return 0;
610610}
611611
r1461r1462
754754                  i8271.drive_control_input |= (1<<1);
755755               }
756756
757               
757
758758               /* need to setup this register based on drive selected */
759759               data = i8271.drive_control_input;
760760
761761
762         
763762
763
764764            }
765765            break;
766766
r1461r1462
960960
961961         /* no write fault */
962962         status = 0;
963         
963
964964         status |= (1<<2) | (1<<6);
965965
966966         /* these two do not appear to be set at all! ?? */
r1461r1462
973973         {
974974            status |= (1<<6);
975975         }
976         
976
977977         /* bit 3 = 1 if write protected */
978978         if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
979979         {
r1461r1462
11021102         i8271_get_drive();
11031103
11041104            i8271.drive_control_output &=~1;
1105           
1105
11061106         if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
11071107         {
11081108            /* Completion type: operation intervention probably required for recovery */
r1461r1462
11911191#endif
11921192
11931193         i8271_get_drive();
1194   
1194
11951195         if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
11961196         {
11971197            /* Completion type: operation intervention probably required for recovery */
r1461r1462
13571357         if (((data ^ i8271.ResetRegister) & 0x01)!=0)
13581358         {
13591359            if ((data & 0x01)==0)
1360            {   
1360            {
13611361               i8271_reset();
13621362            }
13631363         }
1364         
1364
13651365         i8271.ResetRegister = data;
13661366
1367     
1367
13681368      }
13691369      break;
13701370
src/mess/machine/pc1350.c
r1461r1462
7676   if (t&0x20) {
7777      if (PC1350_KEY_UP) data|=1;
7878      if (PC1350_KEY_DOWN) data|=2;
79      if (PC1350_KEY_LEFT) data|=4;
79      if (PC1350_KEY_LEFT) data|=4;
8080      if (PC1350_KEY_RIGHT) data|=8;
8181      if (PC1350_KEY_B) data|=0x10;
8282      if (PC1350_KEY_G) data|=0x20;
r1461r1462
115115   if (PC1350_KEY_OFF&&(outa&0xc0) ) data|=0xc0;
116116
117117   // missing lshift
118   
118
119119   return data;
120120}
121121
src/mess/machine/rp5c15.c
r1461r1462
66
77   Registers are separated into two banks, switchable through
88   the LSB of the MODE register.
9   
9
1010   Date and time are stored in BCD, one digit to each register
11   
11
1212   Register   BANK 0               BANK 1
1313   0         Timer seconds         CLKOUT
1414   1         Timer seconds (10s)      RTC Adjustment
r1461r1462
2626   13         MODE register         MODE register
2727   14         TEST register         TEST register
2828   15         RESET register         RESET register
29   
30   
29
30
3131   CLKOUT (W/O) - on the X68000, this is connected to the Timer LED
3232      xxxxx000 = always high (on)
3333      xxxxx001 = 16384Hz
r1461r1462
3737      xxxxx101 =     1Hz
3838      xxxxx110 =  1/60Hz
3939      xxxxx111 =  always low (off)
40     
40
4141   Adjustment register (R/W)
4242      bit 0 = if set, will reset the seconds to zero, and if the
4343              seconds were > 30, increment the minutes by 1.
4444              Always returns 0.
45             
45
4646   12/24 hour clock register (R/W) (not implemented yet)
4747      bit 0 = selects 12 or 24 hour clock
4848              presumably, on reading, returns AM/PM status.
49             
49
5050   Leap year register
5151      bit 0,1 = returns number of years until next leap year.
5252                Is simply year % 4.
53               
53
5454   MODE register (R/W)
5555      bit 0 = if set, selects BANK 1, if reset, selects BANK 0
5656      bit 2 = Alarm enable
5757      bit 3 = Timer enable
58     
58
5959   TEST register (not implemented yet)
6060      bits 0-3 = generally all set to 0, use is unknown.
61     
61
6262   RESET register (not implemented yet)
6363      bit 0 = Alarm reset
6464      bit 1 = Timer reset
r1461r1462
8484   {
8585      rtc.pulse16_state = 0;  // make low
8686   }
87     
87
8888   if(rtc.pulse_count == 8)
8989   {
9090      rtc.pulse1_state = 0;
r1461r1462
101101{
102102   mame_system_time systm;
103103   mame_system_tm time;
104   
104
105105   rtc.alarm_callback = intf->alarm_irq_callback;
106   
106
107107   mame_get_base_datetime(Machine,&systm);
108108   time = systm.local_time;
109   
109
110110   // date/time is stored as BCD
111111   rtc.systime.sec_1 = time.second % 10;
112112   rtc.systime.sec_10 = time.second / 10;
r1461r1462
134134   rtc.reset = 0x00;  // enable both 1Hz and 16Hz alarm counters by default
135135   rtc.test = 0x00;
136136   rtc.pulse_count = 0;
137   
137
138138   rtc_timer = timer_alloc(rtc_alarm_pulse, NULL);
139139   timer_adjust(rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(32));
140140}
r1461r1462
172172         case 12:
173173            return rtc.systime.year_10;
174174         case 13:
175            return rtc.mode & 0x0f;   
175            return rtc.mode & 0x0f;
176176      }
177177   }
178178   else  // BANK 1 selected
179179   {
180180      switch(offset)
181181      {
182         case 0:  // CLKOUT
182         case 0:  // CLKOUT
183183            return rtc.clkout & 0x07;
184184         case 1:  // Adjustment (always returns 0)
185185            return 0;
r1461r1462
299299         case 10:  // 12/24 hour clock selection
300300            rtc.hour24 = data;
301301            break;
302         
302
303303      }
304304   }
305305}
r1461r1462
345345void rtc_add_day()
346346{
347347   int d,m;
348   
348
349349   rtc.systime.dayofweek++;
350350   if(rtc.systime.dayofweek >= 7)
351351      rtc.systime.dayofweek = 0;
src/mess/machine/coco.c
r1461r1462
4848   research that for you if you want an exact number for scanlines before the
4949   screen starts and the scanline that the v-interrupt triggers..etc.
5050
51Dragon Alpha code added 21-Oct-2004,
51Dragon Alpha code added 21-Oct-2004,
5252         Phill Harvey-Smith (afra@aurigae.demon.co.uk)
5353
5454         Added AY-8912 and FDC code 30-Oct-2004.
r1461r1462
5959Re-implemented Alpha NMI enable/disable, using direct PIA reads, rather than
6060keeping track of it in a variable in the driver.
6161   P.Harvey-Smith, 25-Sep-2006.
62   
63Radically re-wrote memory emulation code for CoCo 1/2 & Dragon machines, the
64new code emulates the memory mapping of the SAM, dependent on what size of
62
63Radically re-wrote memory emulation code for CoCo 1/2 & Dragon machines, the
64new code emulates the memory mapping of the SAM, dependent on what size of
6565RAM chips it is programed to use, including proper mirroring of the RAM.
6666
67Replaced the kludged emulation of the cart line, with a timer based trigger
68this is set to toggle at 1Hz, this seems to be good enough to trigger the
69cartline, but is so slow in real terms that it should have very little
67Replaced the kludged emulation of the cart line, with a timer based trigger
68this is set to toggle at 1Hz, this seems to be good enough to trigger the
69cartline, but is so slow in real terms that it should have very little
7070impact on the emulation speed.
7171
7272Re-factored the code common to all machines, and seperated the code different,
73into callbacks/functions unique to the machines, in preperation for splitting
73into callbacks/functions unique to the machines, in preperation for splitting
7474the code for individual machine types into seperate files, I have preposed, that
7575the CoCo 1/2 should stay in coco.c, and that the coco3 and dragon specifc code
76should go into coco3.c and dragon.c which should (hopefully) make the code
76should go into coco3.c and dragon.c which should (hopefully) make the code
7777easier to manage.
7878   P.Harvey-Smith, Dec 2006-Feb 2007
7979***************************************************************************/
r1461r1462
616616   {
617617      romsize = destlength;
618618   }
619   
619
620620   image_fread(image, dest, romsize);
621621
622622   /* Now we need to repeat the mirror the ROM throughout the ROM memory */
r1461r1462
11441144   }
11451145}
11461146
1147/*
1148   Dragon Alpha AY-3-8912   
1147/*
1148   Dragon Alpha AY-3-8912
11491149*/
11501150
11511151READ8_HANDLER ( dgnalpha_psg_porta_read )
1152{   
1152{
11531153   return 0;
11541154}
11551155
r1461r1462
11571157{
11581158   /* Bits 0..3 are the drive select lines for the internal floppy interface */
11591159   /* Bit 4 is the motor on, in the real hardware these are inverted on their way to the drive */
1160   /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */
1160   /* Bits 5,6,7 are connected to /DDEN, ENP and 5/8 on the WD2797 */
11611161   switch (data & 0xF)
11621162   {
11631163      case(0x01) :
r1461r1462
12551255   if ((input_port_4_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x10;
12561256   if ((input_port_5_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x20;
12571257   if ((input_port_6_r(0) | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x40;
1258   
1258
12591259   switch(get_input_device(joystick ? INPUTPORT_LEFT_JOYSTICK : INPUTPORT_RIGHT_JOYSTICK))
12601260   {
12611261      case INPUTDEVICE_RIGHT_JOYSTICK:
r1461r1462
12981298            /* While in state 7, prepare to chech next video frame for a hit */
12991299            dclg_time = video_screen_get_time_until_pos(0, readinputportbytag_safe("dclg_y", 0), 0);
13001300         }
1301         
1301
13021302         break;
13031303
13041304      default:
13051305         fatalerror("Invalid value returned by get_input_device");
13061306         break;
13071307   }
1308   
1308
13091309   if( attotime_compare(dclg_time, attotime_zero) )
13101310   {
13111311      /* schedule lightgun events */
r1461r1462
13241324   /* sample joystick buttons */
13251325   porta &= ~readinputportbytag_safe("joystick_buttons", 0);
13261326   port_za &= ~readinputportbytag_safe("joystick_buttons", 0);
1327   
1327
13281328   pia_set_input_a(0, porta, port_za);
13291329   return porta;
13301330}
r1461r1462
14101410    */
14111411   UINT8 dac = pia_get_output_a(1) & 0xFC;
14121412   static int dclg_previous_bit;
1413   
1413
14141414   coco_sound_update();
14151415
14161416   if (get_input_device(INPUTPORT_SERIAL) == INPUTDEVICE_DIECOM_LIGHTGUN)
14171417   {
14181418      int dclg_this_bit = ((data & 2) >> 1);
1419     
1419
14201420      if( dclg_previous_bit == 1 )
14211421      {
14221422         if( dclg_this_bit == 0 )
r1461r1462
14241424            /* Clock Diecom Light gun interface on a high to low transistion */
14251425            dclg_state++;
14261426            dclg_state &= 0x0f;
1427           
1427
14281428            /* Clear hit bit for every transistion */
1429            dclg_output_h &= ~0x02;           
1429            dclg_output_h &= ~0x02;
14301430
14311431            if( dclg_state > 7 )
14321432            {
r1461r1462
14351435                  dclg_output_v |= 0x01;
14361436               else
14371437                  dclg_output_v &= ~0x01;
1438                 
1438
14391439               /* Bit 9 of timer is only avaiable if state == 8*/
14401440               if (dclg_state == 8 && (((dclg_timer >> 9) & 0x01) == 1) )
14411441                  dclg_output_v |= 0x02;
14421442               else
14431443                  dclg_output_v &= ~0x02;
14441444            }
1445           
1445
14461446            /* During state 15, this bit is high. */
14471447            if( dclg_state == 15 )
14481448               dclg_output_h |= 0x01;
r1461r1462
14651465      coco_hiresjoy_w(dac >= 0x80);
14661466
14671467   /* Handle printer output, serial for CoCos, Paralell for Dragons */
1468   
1468
14691469   printer_out(data);
14701470}
14711471
r1461r1462
14931493static WRITE8_HANDLER( dragon64_pia1_pb_w )
14941494{
14951495   int ddr;
1496   
1496
14971497   d_pia1_pb_w(0, data);
14981498
14991499   ddr = ~pia_get_port_b_z_mask(1);
1500   
1500
15011501   /* If bit 2 of the pia1 ddrb is 1 then this pin is an output so use it */
15021502   /* to control the paging of the 32k and 64k basic roms */
15031503   /* Otherwise it set as an input, with an EXTERNAL pull-up so it should */
r1461r1462
15051505   if (ddr & 0x04)
15061506   {
15071507      dragon_page_rom(data & 0x04);
1508   }   
1508   }
15091509}
15101510
15111511/***************************************************************************
r1461r1462
15181518   PIA2 PB0-PB7   connected to D0..7 of the AY8912.
15191519   CB1            DRQ from WD2797 disk controler.
15201520***************************************************************************/
1521 
1521
15221522static WRITE8_HANDLER( dgnalpha_pia2_pa_w )
15231523{
15241524   int   bc_flags;      /* BCDDIR/BC1, as connected to PIA2 port a bits 0 and 1 */
r1461r1462
15311531   {
15321532      dragon_page_rom(data & 0x04);   /* bit 2 controls boot or basic rom */
15331533   }
1534   
1534
15351535   /* Bits 0 and 1 for pia2 port a control the BCDIR and BC1 lines of the */
15361536   /* AY-8912 */
15371537   bc_flags = data & 0x03;   /* mask out bits */
1538   
1538
15391539   switch (bc_flags)
15401540   {
15411541      case 0x00   :       /* Inactive, do nothing */
1542         break;         
1542         break;
15431543      case 0x01   :       /* Write to selected port */
15441544         AY8910_write_port_0_w(0, pia_get_output_b(2));
15451545         break;
r1461r1462
15581558static void dragon_page_rom(int   romswitch)
15591559{
15601560   UINT8 *bank;
1561   
1562   if (romswitch)
1561
1562   if (romswitch)
15631563      bank = coco_rom;      /* This is the 32k mode basic(64)/boot rom(alpha)  */
15641564   else
15651565      bank = coco_rom + 0x8000;   /* This is the 64k mode basic(64)/basic rom(alpha) */
1566   
1566
15671567   bas_rom_bank = bank;         /* Record which rom we are using so that the irq routine */
15681568                  /* uses the vectors from the correct rom ! (alpha) */
15691569
r1461r1462
15791579   /* The NMI line on the alphaAlpha is gated through IC16 (early PLD), and is gated by pia2 CA2  */
15801580   /* The DRQ line goes through pia2 cb1, in exactly the same way as DRQ from DragonDos does */
15811581   /* for pia1 cb1 */
1582   switch(event)
1582   switch(event)
15831583   {
15841584      case WD17XX_IRQ_CLR:
15851585         cpunum_set_input_line(0, INPUT_LINE_NMI, CLEAR_LINE);
r1461r1462
15911591         }
15921592         else
15931593         {
1594            if (pia_get_output_ca2(2))
1594            if (pia_get_output_ca2(2))
15951595               cpunum_set_input_line(0, INPUT_LINE_NMI, ASSERT_LINE);
15961596         }
15971597         break;
r1461r1462
16091609{
16101610   int result = 0;
16111611
1612   switch(offset & 0x03)
1612   switch(offset & 0x03)
16131613   {
16141614      case 0:
16151615         result = wd17xx_data_r(0);
r1461r1462
16261626      default:
16271627         break;
16281628   }
1629     
1629
16301630   return result;
16311631}
16321632
16331633WRITE8_HANDLER(wd2797_w)
16341634{
1635    switch(offset & 0x3)
1635    switch(offset & 0x3)
16361636   {
16371637      case 0:
16381638         wd17xx_data_w(0, data);
r1461r1462
16771677    * and serial-in (pb0). Serial-in not yet implemented. */
16781678   int result;
16791679
1680   /* For the CoCo 1, the logic has been changed to only select 64K rams   
1681      if there is more than 16K of memory, as the Color Basic 1.0 rom   
1682      can only configure 4K or 16K ram banks (as documented in "Color   
1683      Basic Unreveled"), doing this allows this  allows the coco driver   
1684      to access 32K of ram, and also allows the cocoe driver to access   
1685      the full 64K, as this uses Color Basic 1.2, which can configure 64K rams */   
1680   /* For the CoCo 1, the logic has been changed to only select 64K rams
1681      if there is more than 16K of memory, as the Color Basic 1.0 rom
1682      can only configure 4K or 16K ram banks (as documented in "Color
1683      Basic Unreveled"), doing this allows this  allows the coco driver
1684      to access 32K of ram, and also allows the cocoe driver to access
1685      the full 64K, as this uses Color Basic 1.2, which can configure 64K rams */
16861686
16871687   if (mess_ram_size > 0x8000)      /* 1 bank of 64K rams */
16881688      result = (pia_get_output_b(0) & 0x80) >> 5;
r1461r1462
16961696
16971697static READ8_HANDLER ( d_pia1_pb_r_dragon32 )
16981698{
1699   /* This handles the reading of the memory sense switch (pb2) for the Dragon 32,
1699   /* This handles the reading of the memory sense switch (pb2) for the Dragon 32,
17001700    * and pb0, is the printer /busy line. */
1701   
1701
17021702   int result;
17031703
1704   /* Of the Dragon machines, Only the Dragon 32 needs the ram select bit
1705      as both the 64 and Alpha, always have 64K rams, also the meaning of
1704   /* Of the Dragon machines, Only the Dragon 32 needs the ram select bit
1705      as both the 64 and Alpha, always have 64K rams, also the meaning of
17061706      the bit is different with respect to the CoCo 1 */
1707     
1707
17081708   if (mess_ram_size > 0x8000)
17091709      result = 0x00;      /* 1 bank of 64K, rams */
17101710   else
17111711      result = 0x04;      /* 2 banks of 16K rams */
1712     
1712
17131713   return result;
17141714}
17151715
r1461r1462
17401740   return 0;
17411741}
17421742
1743/*
1743/*
17441744   When writing the bits have the following meanings :
17451745
17461746   bit   value   purpose
1747   0   0   First 2k of memory map determined by bits 1 & 2   
1748      1   6845 display RAM mapped into first 2K of map,
1749         
1747   0   0   First 2k of memory map determined by bits 1 & 2
1748      1   6845 display RAM mapped into first 2K of map,
1749
17501750   2,1   0,0   Normal bottom 32K or ram mapped (from mainboard).
17511751      0,1   First 32K of plus RAM mapped into $0000-$7FFF
17521752      1,0   Second 32K of plus RAM mapped into $0000-$7FFF
r1461r1462
17561756WRITE8_HANDLER ( plus_reg_w )
17571757{
17581758   int map;
1759   
1759
17601760   dragon_plus_reg = data;
1761   
1761
17621762   map = (data & 0x06)>>1;
1763   
1763
17641764   switch (map)
17651765   {
17661766      case 0x00   : bottom_32k=&mess_ram[0x00000]; break;
17671767      case 0x01   : bottom_32k=&mess_ram[0x10000]; break;
17681768      case 0x02   : bottom_32k=&mess_ram[0x18000]; break;
17691769      case 0x03   : bottom_32k=&mess_ram[0x00000]; break;
1770      default   : bottom_32k=&mess_ram[0x00000]; break; // Just to shut the compiler up !   
1771   }   
1772   
1770      default   : bottom_32k=&mess_ram[0x00000]; break; // Just to shut the compiler up !
1771   }
1772
17731773   setup_memory_map();
17741774}
17751775
r1461r1462
18131813
18141814static void setup_memory_map(void)
18151815{
1816   /*
1817   The following table contains the RAM block mappings for the CoCo 1/2 and Dragon computers
1818   This replicates the behavior of the SAM ram size programming bits which in ther real hardware
1816   /*
1817   The following table contains the RAM block mappings for the CoCo 1/2 and Dragon computers
1818   This replicates the behavior of the SAM ram size programming bits which in ther real hardware
18191819   allowed the use of various sizes of RAM chips, as follows :-
18201820
18211821   1 or 2 banks of 4K
r1461r1462
18251825
18261826   For the 4K and 16K chip sizes, if the second bank was empty it would be mapped to nothing.
18271827   For the 4K and 16K chip sizes, the banks would be mirrored at chip size*2 intervals.
1828   
1828
18291829   The following table holds the data required to implement this.
18301830
1831   Note though it is technically possible to have 2 banks of 4K rams, for a total of 8K, I
1831   Note though it is technically possible to have 2 banks of 4K rams, for a total of 8K, I
18321832   have never seen a machine with this configuration, so I have not implemented it.
18331833   */
1834   
1835   struct coco_meminfo
1834
1835   struct coco_meminfo
18361836   {
18371837      offs_t   start;      /* start address of bank */
18381838      offs_t   end;      /* End address of bank */
r1461r1462
18761876      last_ram_block=15;
18771877   else
18781878      last_ram_block=7;
1879     
1879
18801880   /* Map RAM blocks */
18811881   for(block_index=0;block_index<=last_ram_block;block_index++)
18821882   {
r1461r1462
18871887         wbank=memmap[block_index].wbank16_1;
18881888      else if ((memsize==1) && (mess_ram_size == 0x8000))   /* two banks of 16K rams */
18891889         wbank=memmap[block_index].wbank16_2;
1890      else
1890      else
18911891         wbank=memmap[block_index].wbank64;
18921892
18931893      /* If wbank is 0 then there is no ram here so set it up to return 0, note this may change in the future */
r1461r1462
19001900            memory_set_bankptr(block_index+1,&bottom_32k[memmap[wbank-1].start]);
19011901         else
19021902            memory_set_bankptr(block_index+1,&mess_ram[memmap[wbank-1].start]);
1903         
1904         memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1);   
1903
1904         memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1);
19051905         memory_install_write_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1);
19061906      }
19071907      else
1908      {   
1909         memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP);         
1910         memory_install_write_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP);   
1908      {
1909         memory_install_read_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP);
1910         memory_install_write_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP);
19111911      }
19121912   }
19131913
r1461r1462
19231923            offset=&bas_rom_bank[0x1000*block_index];
19241924         else
19251925            offset=&coco_rom[0x4000+(0x1000*(block_index-4))];
1926                       
1926
19271927         memory_set_bankptr(block_index+9,offset);
19281928         memory_install_write_handler(0, ADDRESS_SPACE_PROGRAM, memmap[block_index+8].start, memmap[block_index+8].end, 0, 0, STATIC_ROM);
19291929      }
r1461r1462
19391939    * TODO:  Actually implement this.  Also find out what the CoCo 3 did with
19401940    * this (it probably ignored it)
19411941    */
1942   
1942
19431943   if (!get_sam_maptype())      // Ignored in maptype 1
19441944   {
19451945      if((mess_ram_size>0x8000) && val)
r1461r1462
19761976    * TODO:  This should affect _all_ memory accesses, not just video ram
19771977    * TODO:  Verify that the CoCo 3 ignored this
19781978    */
1979   
1979
19801980   setup_memory_map();
19811981}
19821982
r1461r1462
27262726
27272727/***************************************************************************/
27282728
2729/* struct to hold callbacks and initializers to pass to generic_init_machine */
2729/* struct to hold callbacks and initializers to pass to generic_init_machine */
27302730typedef struct _machine_init_interface machine_init_interface;
27312731struct _machine_init_interface
27322732{
r1461r1462
27642764
27652765   /* this timer is used to schedule keyboard updating */
27662766   update_keyboard_timer = timer_alloc(coco_update_keyboard_timerproc, NULL);
2767   
2767
27682768   /* these are the timers to delay the MUX switching */
27692769   mux_sel1_timer = timer_alloc(coco_update_sel1_timerproc, NULL);
27702770   mux_sel2_timer = timer_alloc(coco_update_sel2_timerproc, NULL);
r1461r1462
27802780
27812781   /* setup printer output callback */
27822782   printer_out = init->printer_out_;
2783     
2783
27842784   pia_config(0, &init->piaintf[0]);
27852785   pia_config(1, &init->piaintf[1]);
27862786   pia_config(2, &init->piaintf[2]); /* Dragon Alpha 3rd pia */
r1461r1462
28292829/* Setup for hardware common to CoCo 1/2 & Dragon machines, calls genertic_init_machine, to process */
28302830/* the setup common with the CoCo3, and then does the init that is not common ! */
28312831static void generic_coco12_dragon_init(running_machine *machine, const machine_init_interface *init)
2832{   
2832{
28332833   /* Set default RAM mapping */
28342834   memory_set_bankptr(1, &mess_ram[0]);
2835   
2835
28362836   /* Do generic Inits */
28372837   generic_init_machine(machine, init);
2838   
2838
28392839   /* Init SAM */
28402840   sam_init(machine, &coco_sam_intf);
28412841}
r1461r1462
28452845MACHINE_START( dragon32 )
28462846{
28472847   machine_init_interface init;
2848   
2848
28492849   /* Setup machine initialization */
28502850   memset(&init, 0, sizeof(init));
28512851   init.piaintf         = dragon32_pia_intf;
r1461r1462
28542854   init.cart_timer_proc   = coco_cart_timer_proc;
28552855   init.map_memory         = coco_mapmemory;
28562856   init.fdc_cart_hardware   = "dragon_fdc";
2857   
2857
28582858   generic_coco12_dragon_init(machine, &init);
28592859}
28602860
28612861MACHINE_START( dragon64 )
28622862{
28632863   machine_init_interface init;
2864   
2864
28652865   /* Setup machine initialization */
28662866   memset(&init, 0, sizeof(init));
28672867   init.piaintf         = dragon64_pia_intf;
r1461r1462
28702870   init.cart_timer_proc   = coco_cart_timer_proc;
28712871   init.map_memory         = coco_mapmemory;
28722872   init.fdc_cart_hardware   = "dragon_fdc";
2873   
2873
28742874   generic_coco12_dragon_init(machine, &init);
28752875
28762876   /* Init Serial port */
r1461r1462
28812881MACHINE_START( d64plus )
28822882{
28832883   machine_init_interface init;
2884   
2884
28852885   /* Setup machine initialization */
28862886   memset(&init, 0, sizeof(init));
28872887   init.piaintf         = dragon64_pia_intf;
r1461r1462
28902890   init.cart_timer_proc   = coco_cart_timer_proc;
28912891   init.map_memory         = coco_mapmemory;
28922892   init.fdc_cart_hardware   = "dragon_fdc";
2893   
2893
28942894   generic_coco12_dragon_init(machine, &init);
2895   
2895
28962896   /* Init Serial port */
28972897   acia_6551_init();
2898   
2898
28992899   /* Init Dragon plus registers */
29002900   dragon_plus_reg = 0;
29012901   plus_reg_w(0,0);
r1461r1462
29052905MACHINE_START( tanodr64 )
29062906{
29072907   machine_init_interface init;
2908   
2908
29092909   /* Setup machine initialization */
29102910   memset(&init, 0, sizeof(init));
29112911   init.piaintf         = dragon64_pia_intf;
r1461r1462
29142914   init.cart_timer_proc   = coco_cart_timer_proc;
29152915   init.map_memory         = coco_mapmemory;
29162916   init.fdc_cart_hardware   = "coco_fdc";
2917   
2917
29182918   generic_coco12_dragon_init(machine, &init);
2919   
2919
29202920   /* Init Serial port */
29212921   acia_6551_init();
29222922}
r1461r1462
29242924MACHINE_START( dgnalpha )
29252925{
29262926   machine_init_interface init;
2927   
2927
29282928   /* Setup machine initialization */
29292929   memset(&init, 0, sizeof(init));
29302930   init.piaintf         = dgnalpha_pia_intf;
r1461r1462
29332933   init.cart_timer_proc   = coco_cart_timer_proc;
29342934   init.map_memory         = coco_mapmemory;
29352935   init.fdc_cart_hardware   = "dragon_fdc";
2936   
2936
29372937   generic_coco12_dragon_init(machine, &init);
2938   
2938
29392939   /* Init Serial port */
29402940   acia_6551_init();
2941       
2941
29422942   /* dgnalpha_just_reset, is here to flag that we should ignore the first irq generated */
29432943   /* by the WD2797, it is reset to 0 after the first inurrupt */
29442944   dgnalpha_just_reset=1;
2945   
2945
29462946   wd17xx_init(WD_TYPE_179X, dgnalpha_fdc_callback, NULL);
29472947}
29482948
r1461r1462
29512951MACHINE_START( coco )
29522952{
29532953   machine_init_interface init;
2954   
2954
29552955   /* Setup machine initialization */
29562956   memset(&init, 0, sizeof(init));
29572957   init.piaintf         = coco_pia_intf;
r1461r1462
29602960   init.cart_timer_proc   = coco_cart_timer_proc;
29612961   init.map_memory         = coco_mapmemory;
29622962   init.fdc_cart_hardware   = "coco_fdc";
2963   
2963
29642964   generic_coco12_dragon_init(machine, &init);
29652965}
29662966
29672967MACHINE_START( coco2 )
29682968{
29692969   machine_init_interface init;
2970   
2970
29712971   /* Setup machine initialization */
29722972   memset(&init, 0, sizeof(init));
29732973   init.piaintf         = coco2_pia_intf;
r1461r1462
29762976   init.cart_timer_proc   = coco_cart_timer_proc;
29772977   init.map_memory         = coco_mapmemory;
29782978   init.fdc_cart_hardware   = "coco_fdc";
2979   
2979
29802980   generic_coco12_dragon_init(machine, &init);
29812981}
29822982
r1461r1462
30093009MACHINE_START( coco3 )
30103010{
30113011   machine_init_interface init;
3012   
3012
30133013   /* Setup machine initialization */
30143014   memset(&init, 0, sizeof(init));
30153015   init.piaintf         = coco3_pia_intf;
r1461r1462
30183018   init.cart_timer_proc   = coco3_cart_timer_proc;
30193019   init.map_memory         = coco3_mapmemory;
30203020   init.fdc_cart_hardware   = "coco3_plus_fdc";
3021   
3021
30223022   generic_init_machine(machine, &init);
3023   
3023
30243024   /* Init SAM */
30253025   sam_init(machine, &coco3_sam_intf);
3026   
3026
30273027   /* CoCo 3 specific function pointers */
30283028   update_keyboard = coco3_update_keyboard;
30293029
30303030   coco3_timer_init();
30313031
30323032   coco3_interupt_line = 0;
3033   
3033
30343034   /* set up state save variables */
30353035   state_save_register_global_array(coco3_mmu);
30363036   state_save_register_global_array(coco3_gimereg);
src/mess/machine/amigacd.c
r1461r1462
11/***************************************************************************
22
33   Amiga cdrom controller emulation
4   
4
55Notes:
66Many thanks to Toni Willem for all the help and information about the
77DMAC controller.
r1461r1462
3232/***************************************************************************
3333
3434   DMAC
35   
35
3636***************************************************************************/
3737
3838/*
r1461r1462
7979   /* if interrupts are disabled, bail */
8080   if ( (dmac_data.cntr & CNTR_INTEN) == 0 )
8181      return;
82   
82
8383   /* if no interrupts are pending, bail */
8484   if ( (dmac_data.istr & ISTR_INT_P) == 0 )
8585      return;
86   
86
8787   /* otherwise, generate the IRQ */
8888   amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
8989}
r1461r1462
9494   {
9595      UINT16   dat16;
9696      UINT8   dat8;
97     
97
9898      if ( matsucd_get_next_byte( &dat8 ) < 0 )
9999         break;
100     
100
101101      dat16 = dat8;
102               
102
103103      if ( matsucd_get_next_byte( &dat8 ) < 0 )
104104         break;
105     
105
106106      dat16 <<= 8;
107107      dat16 |= dat8;
108     
108
109109      amiga_chip_ram_w(dmac_data.acr, dat16);
110     
110
111111      dmac_data.acr += 2;
112112      dmac_data.wtc--;
113113   }
114   
114
115115   if ( dmac_data.wtc > 0 )
116116   {
117117      matsucd_read_next_block();
r1461r1462
134134      {
135135         UINT8   v = dmac_data.istr;
136136         LOG( "DMAC: PC=%08x - ISTR Read(%04x)\n", activecpu_get_pc(), dmac_data.istr );
137         
137
138138         dmac_data.istr &= ~0x0f;
139139         return v;
140140      }
141141      break;
142     
142
143143      case 0x21:
144144      {
145145         LOG( "DMAC: PC=%08x - CNTR Read(%04x)\n", activecpu_get_pc(), dmac_data.cntr );
146146         return dmac_data.cntr;
147147      }
148148      break;
149     
149
150150      case 0x40:   /* wtc hi */
151151      {
152152         LOG( "DMAC: PC=%08x - WTC HI Read\n", activecpu_get_pc() );
153153         return (dmac_data.wtc >> 16);
154154      }
155155      break;
156         
156
157157      case 0x41:   /* wtc lo */
158158      {
159159         LOG( "DMAC: PC=%08x - WTC LO Read\n", activecpu_get_pc() );
160160         return dmac_data.wtc;
161161      }
162162      break;
163     
163
164164      case 0x42:   /* acr hi */
165165      {
166166         LOG( "DMAC: PC=%08x - ACR HI Read\n", activecpu_get_pc() );
167167         return (dmac_data.acr >> 16);
168168      }
169169      break;
170         
170
171171      case 0x43:   /* acr lo */
172172      {
173173         LOG( "DMAC: PC=%08x - ACR LO Read\n", activecpu_get_pc() );
r1461r1462
182182         return 0x00;   /* Not available without SCSI expansion */
183183      }
184184      break;
185     
185
186186      case 0x50:
187187      {
188188         LOG( "DMAC: PC=%08x - CDROM RESP Read\n", activecpu_get_pc() );
189189         return matsucd_response_r();
190190      }
191191      break;
192     
192
193193      case 0x51:   /* XT IO */
194194      case 0x52:
195195      case 0x53:
r1461r1462
198198         return 0xff;
199199      }
200200      break;
201     
201
202202      case 0x58:   /* TPI6525 */
203203      case 0x59:
204204      case 0x5A:
r1461r1462
220220         return tpi6525_0_port_r(offset - 0x58);
221221      }
222222      break;
223     
223
224224      case 0x70:   /* DMA start strobe */
225225      {
226226         LOG( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() );
227227         timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero );
228228      }
229229      break;
230     
230
231231      case 0x71:   /* DMA stop strobe */
232232      {
233233         LOG( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() );
234234         timer_reset( dmac_data.dma_timer, attotime_never );
235235      }
236236      break;
237     
237
238238      case 0x72:   /* Clear IRQ strobe */
239239      {
240240         LOG( "DMAC: PC=%08x - IRQ Clear Strobe\n", activecpu_get_pc() );
241241         dmac_data.istr &= ~ISTR_INT_P;
242242      }
243243      break;
244     
244
245245      case 0x74:   /* Flush strobe */
246246      {
247247         LOG( "DMAC: PC=%08x - Flush Strobe\n", activecpu_get_pc() );
248248         dmac_data.istr |= ISTR_FE_FLG;
249249      }
250250      break;
251           
251
252252      default:
253253         logerror( "DMAC-READ: PC=%08x, offset = %02x\n", activecpu_get_pc(), offset );
254254      break;
255255   }
256   
256
257257   return 0;
258258}
259259
r1461r1462
270270         check_interrupts();
271271      }
272272      break;
273     
273
274274      case 0x40:   /* wtc hi */
275275      {
276276         LOG( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", activecpu_get_pc(), data );
r1461r1462
278278         dmac_data.wtc |= ((UINT32)data) << 16;
279279      }
280280      break;
281         
281
282282      case 0x41:   /* wtc lo */
283283      {
284284         LOG( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", activecpu_get_pc(), data );
r1461r1462
286286         dmac_data.wtc |= data;
287287      }
288288      break;
289     
289
290290      case 0x42:   /* acr hi */
291291      {
292292         LOG( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", activecpu_get_pc(), data );
r1461r1462
294294         dmac_data.acr |= ((UINT32)data) << 16;
295295      }
296296      break;
297         
297
298298      case 0x43:   /* acr lo */
299299      {
300300         LOG( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", activecpu_get_pc(), data );
r1461r1462
302302         dmac_data.acr |= data;
303303      }
304304      break;
305     
305
306306      case 0x47:   /* dawr */
307307      {
308308         LOG( "DMAC: PC=%08x - DAWR Write - data = %04x\n", activecpu_get_pc(), data );
309309         dmac_data.dawr = data;
310310      }
311311      break;
312     
312
313313      case 0x48:   /* wd33c93 SCSI expansion */
314314      case 0x49:
315315      {
r1461r1462
317317         /* Not available without SCSI expansion */
318318      }
319319      break;
320     
320
321321      case 0x50:
322322      {
323323         LOG( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", activecpu_get_pc(), data );
324324         matsucd_command_w( data );
325325      }
326326      break;
327     
327
328328      case 0x58:   /* TPI6525 */
329329      case 0x59:
330330      case 0x5A:
r1461r1462
346346         tpi6525_0_port_w(offset - 0x58, data);
347347      }
348348      break;
349     
349
350350      case 0x70:   /* DMA start strobe */
351351      {
352352         LOG( "DMAC: PC=%08x - DMA Start Strobe\n", activecpu_get_pc() );
353353         timer_adjust( dmac_data.dma_timer, ATTOTIME_IN_MSEC( CD_SECTOR_TIME ), 0, attotime_zero );
354354      }
355355      break;
356     
356
357357      case 0x71:   /* DMA stop strobe */
358358      {
359359         LOG( "DMAC: PC=%08x - DMA Stop Strobe\n", activecpu_get_pc() );
360360         timer_reset( dmac_data.dma_timer, attotime_never );
361361      }
362362      break;
363     
363
364364      case 0x72:   /* Clear IRQ strobe */
365365      {
366366         LOG( "DMAC: PC=%08x - IRQ Clear Strobe\n", activecpu_get_pc() );
367367         dmac_data.istr &= ~ISTR_INT_P;
368368      }
369369      break;
370     
370
371371      case 0x74:   /* Flush Strobe */
372372      {
373373         LOG( "DMAC: PC=%08x - Flush Strobe\n", activecpu_get_pc() );
374374         dmac_data.istr |= ISTR_FE_FLG;
375375      }
376376      break;
377     
377
378378      default:
379379         logerror( "DMAC-WRITE: PC=%08x, offset = %02x, data = %04x\n", activecpu_get_pc(), offset, data );
380380      break;
r1461r1462
384384/***************************************************************************
385385
386386   Autoconfig
387   
387
388388***************************************************************************/
389389
390390static void   dmac_install(offs_t base)
r1461r1462
420420/***************************************************************************
421421
422422   TPI6525
423   
423
424424***************************************************************************/
425425
426426static int tp6525_portc_r( void )
427427{
428428   int   ret = 0;
429   
429
430430   if ( (tpi6525[0].c.ddr & 0x04) == 0 ) /* if pin 2 is set to input */
431431   {
432432      ret |= matsucd_stch_r() ? 0x00 : 0x04;   /* read status change signal */
433433   }
434   
434
435435   if ( (tpi6525[0].c.ddr & 0x08) == 0 ) /* if pin 3 is set to input */
436436      ret |= matsucd_sten_r() ? 0x08 : 0x00;   /* read enable signal */
437   
437
438438   return ret;
439439}
440440
r1461r1462
442442{
443443   if ( tpi6525[0].b.ddr & 0x01 ) /* if pin 0 is set to output */
444444      matsucd_cmd_w( data & 1 ); /* write to the /CMD signal */
445   
445
446446   if ( tpi6525[0].b.ddr & 0x02 ) /* if pin 1 is set to output */
447447      matsucd_enable_w( data & 2 ); /* write to the /ENABLE signal */
448448}
r1461r1462
452452static TIMER_CALLBACK(tp6525_delayed_irq)
453453{
454454   (void)param;
455   
455
456456   if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 )
457457   {
458458      amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_PORTS, 0);
r1461r1462
466466static void tp6525_irq( int level )
467467{
468468   LOG( "TPI6525 Interrupt: level = %d\n", level);
469   
469
470470   if ( level )
471471   {
472472      if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 )
r1461r1462
491491{
492492   /* invert */
493493   level = level ? 0 : 1;
494   
494
495495   /* PC2 on the 6525 */
496496   tpi6525_0_irq2_level( level );
497497}
r1461r1462
506506{
507507   /* initialize the dmac */
508508   memset( &dmac_data, 0, sizeof( dmac_data ) );
509   
509
510510   dmac_data.dma_timer = timer_alloc(dmac_dma_proc, NULL);
511511   tp6525_delayed_timer = timer_alloc(tp6525_delayed_irq, NULL);
512   
512
513513   /* initialize the 6525 TPI */
514514   tpi6525_0_reset();
515   
515
516516   tpi6525[0].a.read = NULL;
517517   tpi6525[0].b.read = NULL;
518518   tpi6525[0].c.read = tp6525_portc_r;
519   
519
520520   tpi6525[0].a.output = NULL;
521521   tpi6525[0].b.output = tp6525_portb_w;
522522   tpi6525[0].c.output = NULL;
523   
523
524524   tpi6525[0].interrupt.output = tp6525_irq;
525525   tpi6525[0].ca.output = NULL;
526526   tpi6525[0].cb.output = NULL;
527   
527
528528   /* initialize the cdrom */
529529   matsucd_init();
530530   matsucd_set_status_enabled_callback( cdrom_status_enabled );
531531   matsucd_set_status_changed_callback( cdrom_status_change );
532532   matsucd_set_subcode_ready_callback( cdrom_subcode_ready );
533   
533
534534   /* set up DMAC with autoconfig */
535535   amiga_add_autoconfig( &dmac_device );
536536}
src/mess/machine/nes.c
r1461r1462
314314   vals->i0 = 0;
315315   vals->i1 = 0;
316316   vals->i2 = 0;
317   
317
318318   switch(cfg & 0x0f)
319319   {
320320      case 0x01:   /* gamepad */
src/mess/machine/mc6854.c
r1461r1462
66
77  The MC6854 chip is an Advanced Data-Link Controller (ADLC).
88  It provides a high-level network interface that can transimit frames with
9  arbitrary data and address length, and is compatible with the following
9  arbitrary data and address length, and is compatible with the following
1010  standards:
1111  - ADCCP (Advanced Data Communication Control Procedure)
1212  - HDLC  (High-Level Data-Link Control)
1313  - SDLC  (Synchronous Data-Link Control)
1414  It is designed to be interfaced with a M6800-family CPU.
1515
16  It is used in the "Nano-network" extension of the Thomson computers to
16  It is used in the "Nano-network" extension of the Thomson computers to
1717  link up to 32 computers at 500 Kbps.
1818  Many networks involving one PC server and several MO5 or TO7/70 computers
1919  were build in French schools in the 1980's to teach computer science.
r1461r1462
4646#define MAX_FRAME_LENGTH 65536
4747/* arbitrary value, you may need to enlarge it if you get truncated frames */
4848
49#define FIFO_SIZE 3
49#define FIFO_SIZE 3
5050/* hardcoded size of the 6854 FIFO (this is a hardware limit) */
5151
5252#define FLAG 0x7e
r1461r1462
5959/******************* internal chip data structure ******************/
6060
6161
62static struct
62static struct
6363{
6464
6565   /* interface */
r1461r1462
231231{
232232   attotime expire;
233233   int i;
234   if ( zi )
234   if ( zi )
235235   {
236236      /* zero-insertion mode */
237237      UINT32 d = 0;
238238      int l = 0;
239239      for ( i = 0; i < len; i++, data >>= 1, l++ )
240240      {
241         if ( data & 1 )
241         if ( data & 1 )
242242         {
243243            d |= 1 << l;
244244            mc6854->tones++;
245            if ( mc6854->tones == 5 )
245            if ( mc6854->tones == 5 )
246246            {
247247               /* insert a '0' after 5 consecutive '1" */
248248               mc6854->tones = 0;
249               l++;     
249               l++;
250250            }
251251         }
252         else
252         else
253253            mc6854->tones = 0;
254254      }
255255      data = d;
256256      len = l;
257257   }
258   else
258   else
259259      mc6854->tones = 0;
260260
261261   /* send bits */
262   if ( mc6854->iface->out_tx )
262   if ( mc6854->iface->out_tx )
263263   {
264264      for ( i = 0; i < len; i++, data >>= 1 )
265265         mc6854->iface->out_tx( data & 1 );
r1461r1462
267267
268268   /* schedule when to ask the MC6854 for more bits */
269269   expire = timer_timeleft( mc6854->ttimer );
270   if ( ! attotime_compare( expire, attotime_never ) )
270   if ( ! attotime_compare( expire, attotime_never ) )
271271      expire = attotime_zero;
272272   timer_reset( mc6854->ttimer, attotime_add(expire, attotime_mul(BIT_LENGTH, len)) );
273273}
r1461r1462
279279{
280280   int i;
281281
282   if ( TRESET )
282   if ( TRESET )
283283      return;
284284
285285   /* push towards the rightmost free entry */
r1461r1462
289289         break;
290290   }
291291
292   if ( i >= 0 )
292   if ( i >= 0 )
293293      mc6854->tfifo[ i ] = data | 0x100;
294   else
294   else
295295      logerror( "%f mc6854_tfifo_push: FIFO overrun\n", attotime_to_double(timer_get_time()) );
296296
297297   /* start frame, if needed */
298   if ( ! mc6854->tstate )
298   if ( ! mc6854->tstate )
299299   {
300300      LOG(( "%f mc6854_tfifo_push: start frame\n", attotime_to_double(timer_get_time()) ));
301301      mc6854->tstate = 2;
r1461r1462
312312   int i;
313313   for ( i = 0; i < FIFO_SIZE; i++ )
314314   {
315      if ( mc6854->tfifo[ i ] & 0x100 )
315      if ( mc6854->tfifo[ i ] & 0x100 )
316316      {
317317         mc6854->tfifo[ i ] |= 0x200;
318318         break;
r1461r1462
327327{
328328   int i, data = mc6854->tfifo[ FIFO_SIZE - 1 ];
329329
330   if ( ! mc6854->tstate )
330   if ( ! mc6854->tstate )
331331      return;
332332
333333   /* shift FIFO to the right */
r1461r1462
335335      mc6854->tfifo[ i ] = mc6854->tfifo[ i - 1 ];
336336   mc6854->tfifo[ 0 ] = 0;
337337
338   if ( data & 0x100 )
338   if ( data & 0x100 )
339339   {
340340      /* got data */
341341
342342      int blen = 8;
343343
344      switch ( mc6854->tstate )
344      switch ( mc6854->tstate )
345345      {
346346
347347      case 2: /* 8-bit address field */
348         if ( ( data & 1 ) || ( ! AEX ) )
348         if ( ( data & 1 ) || ( ! AEX ) )
349349            mc6854->tstate = 3;
350350         LOG(( "%f mc6854_tfifo_cb: address field $%02X\n", attotime_to_double(timer_get_time()), data & 0xff ));
351351         break;
352352
353353      case 3: /* 8-bit control field */
354         if ( CEX ) 
355            mc6854->tstate = 4;
356         else if ( LCF )
357            mc6854->tstate = 5;
358         else
354         if ( CEX )
355            mc6854->tstate = 4;
356         else if ( LCF )
357            mc6854->tstate = 5;
358         else
359359            mc6854->tstate = 6;
360360         LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", attotime_to_double(timer_get_time()), data & 0xff ));
361361         break;
362     
362
363363      case 4: /* 8-bit extended control field (optional) */
364         if ( LCF )
365            mc6854->tstate = 5;
366         else
364         if ( LCF )
365            mc6854->tstate = 5;
366         else
367367            mc6854->tstate = 6;
368368         LOG(( "%f mc6854_tfifo_cb: control field $%02X\n", attotime_to_double(timer_get_time()), data & 0xff ));
369369         break;
370     
370
371371      case 5: /* 8-bit logical control (optional) */
372         if ( ! ( data & 0x80 ) )
372         if ( ! ( data & 0x80 ) )
373373            mc6854->tstate = 6;
374374         LOG(( "%f mc6854_tfifo_cb: logical control field $%02X\n", attotime_to_double(timer_get_time()), data & 0xff ));
375375         break;
376     
376
377377      case 6: /* variable-length data */
378         blen = TWL;
378         blen = TWL;
379379         LOG(( "%f mc6854_tfifo_cb: data field $%02X, %i bits\n", attotime_to_double(timer_get_time()), data & 0xff, blen ));
380380         break;
381381
r1461r1462
385385
386386      if ( mc6854->flen < MAX_FRAME_LENGTH )
387387         mc6854->frame[ mc6854->flen++ ] = data;
388      else
388      else
389389         logerror( "mc6854_tfifo_cb: truncated frame, max=%i\n", MAX_FRAME_LENGTH );
390390
391391      mc6854_send_bits( data, blen, 1 );
392392   }
393   else
393   else
394394   {
395395      /* data underrun => abort */
396396      logerror( "%f mc6854_tfifo_cb: FIFO underrun\n", attotime_to_double(timer_get_time()) );
r1461r1462
401401   }
402402
403403   /* close frame, if needed */
404   if ( data & 0x200 )
404   if ( data & 0x200 )
405405   {
406406      int len = mc6854->flen;
407407
408408      LOG(( "%f mc6854_tfifo_cb: end frame\n", attotime_to_double(timer_get_time()) ));
409409      mc6854_send_bits( 0xdeadbeef, 16, 1 );  /* send check-sum: TODO */
410410      mc6854_send_bits( FLAG, 8, 0 );         /* send closing flag */
411   
412      if ( mc6854->tfifo[ FIFO_SIZE - 1 ] & 0x100 )
411
412      if ( mc6854->tfifo[ FIFO_SIZE - 1 ] & 0x100 )
413413      {
414414         /* re-open frame asap */
415415         LOG(( "%f mc6854_tfifo_cb: start frame\n", attotime_to_double(timer_get_time()) ));
416         if ( TWOINTER )
416         if ( TWOINTER )
417417            mc6854_send_bits( FLAG, 8, 0 );
418418      }
419      else
419      else
420420         mc6854->tstate = 0;
421421
422422      mc6854->flen = 0;
r1461r1462
447447   int i, blen = 8;
448448   unsigned data = d;
449449
450   switch ( mc6854->rstate )
450   switch ( mc6854->rstate )
451451   {
452452
453453   case 0:
454454   case 1:
455455   case 2: /* 8-bit address field */
456      if ( ( data & 1 ) || ( ! AEX ) )
456      if ( ( data & 1 ) || ( ! AEX ) )
457457         mc6854->rstate = 3;
458      else
458      else
459459         mc6854->rstate = 2;
460460      LOG(( "%f mc6854_rfifo_push: address field $%02X\n", attotime_to_double(timer_get_time()), data ));
461461      data |= 0x400; /* address marker */
462462      break;
463463
464464   case 3: /* 8-bit control field */
465      if ( CEX )
466         mc6854->rstate = 4;
467      else if ( LCF )
468         mc6854->rstate = 5;
469      else
465      if ( CEX )
466         mc6854->rstate = 4;
467      else if ( LCF )
468         mc6854->rstate = 5;
469      else
470470         mc6854->rstate = 6;
471471      LOG(( "%f mc6854_rfifo_push: control field $%02X\n", attotime_to_double(timer_get_time()), data ));
472472      break;
473   
473
474474   case 4: /* 8-bit extended control field (optional) */
475      if ( LCF )
476         mc6854->rstate = 5;
477      else
475      if ( LCF )
476         mc6854->rstate = 5;
477      else
478478         mc6854->rstate = 6;
479479      LOG(( "%f mc6854_rfifo_push: control field $%02X\n", attotime_to_double(timer_get_time()), data ));
480480      break;
481   
481
482482   case 5: /* 8-bit logical control (optional) */
483      if ( ! ( data & 0x80 ) )
483      if ( ! ( data & 0x80 ) )
484484         mc6854->rstate = 6;
485485      LOG(( "%f mc6854_rfifo_push: logical control field $%02X\n", attotime_to_double(timer_get_time()), data ));
486486      break;
487   
487
488488   case 6: /* variable-length data */
489      blen = RWL;
489      blen = RWL;
490490      data >>= 8 - blen;
491491      LOG(( "%f mc6854_rfifo_push: data field $%02X, %i bits\n", attotime_to_double(timer_get_time()), data, blen ));
492492      break;
493493   }
494494
495495   /* no further FIFO fill until FV is cleared! */
496   if ( mc6854->sr2 & FV )
496   if ( mc6854->sr2 & FV )
497497   {
498498      LOG(( "%f mc6854_rfifo_push: field not pushed\n", attotime_to_double(timer_get_time()) ));
499499      return;
500500   }
501501
502502   data |= 0x100; /* entry full marker */
503 
503
504504   /* push towards the rightmost free entry */
505505   for ( i = FIFO_SIZE - 1; i >= 0; i-- )
506506   {
507      if ( ! ( mc6854->rfifo[ i ] & 0x100 ) )
507      if ( ! ( mc6854->rfifo[ i ] & 0x100 ) )
508508         break;
509509   }
510510
511   if ( i >= 0 )
511   if ( i >= 0 )
512512      mc6854->rfifo[ i ] = data | 0x100;
513   else
513   else
514514   {
515515      /* FIFO full */
516516      mc6854->sr2 |= OVRN;
r1461r1462
529529   int i;
530530   for ( i = 0; i < FIFO_SIZE; i++ )
531531   {
532      if ( mc6854->rfifo[ i ] & 0x100 )
532      if ( mc6854->rfifo[ i ] & 0x100 )
533533      {
534534         mc6854->tfifo[ i ] |= 0x200;
535535         break;
r1461r1462
553553      mc6854->rfifo[ i ] = mc6854->rfifo[ i - 1 ];
554554   mc6854->rfifo[ 0 ] = 0;
555555
556   if ( mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x200 )
556   if ( mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x200 )
557557   {
558558      /* last byte in frame */
559559      mc6854->sr2 |= FV; /* TODO: check CRC & set ERR instead of FV if error*/
560560   }
561561
562562   /* auto-refill in frame mode */
563   if ( mc6854->flen > 0 )
563   if ( mc6854->flen > 0 )
564564   {
565565      mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] );
566      if ( mc6854->fpos == mc6854->flen )
566      if ( mc6854->fpos == mc6854->flen )
567567         mc6854_rfifo_terminate();
568568   }
569569
r1461r1462
576576{
577577   int fieldlen = ( mc6854->rstate < 6 ) ? 8 : RWL;
578578
579   if ( RRESET || DCD )
579   if ( RRESET || DCD )
580580      return;
581581
582   if ( bit )
582   if ( bit )
583583   {
584584      mc6854->rones++;
585585      mc6854->rreg = (mc6854->rreg >> 1) | 0x80000000;
586      if ( mc6854->rones >= 8 )
586      if ( mc6854->rones >= 8 )
587587      {
588588         /* abort */
589589         mc6854->rstate = 0;
590         mc6854->rsize = 0;
591         if ( mc6854->rstate > 1 )
592         {
590         mc6854->rsize = 0;
591         if ( mc6854->rstate > 1 )
592         {
593593            /* only in-frame abort */
594594            mc6854->sr2 |= RABT;
595595            LOG(( "%f mc6854_receive_bit: abort\n", attotime_to_double(timer_get_time()) ));
596596         }
597597      }
598      else
598      else
599599      {
600600         mc6854->rsize++;
601601         if ( mc6854->rstate && mc6854->rsize >= fieldlen + 24 )
r1461r1462
608608      mc6854->rones = 0;
609609      return;
610610   }
611   else if ( mc6854->rones == 6 )
611   else if ( mc6854->rones == 6 )
612612   {
613613      /* flag */
614      if ( FDSE )
614      if ( FDSE )
615615         mc6854->sr1 |= FD;
616616
617      if ( mc6854->rstate > 1 )
617      if ( mc6854->rstate > 1 )
618618      {
619619         /* end of frame */
620620         mc6854->rreg >>= 1;
r1461r1462
627627      mc6854->rones = 0;
628628      mc6854->rstate = 1;
629629      mc6854->rsize = 0;
630   } else
630   } else
631631   {
632632      mc6854->rones = 0;
633633      mc6854->rreg >>= 1;
r1461r1462
656656   if ( mc6854->rstate > 1 || mc6854->tstate > 1 || RTS )
657657      return -1; /* busy */
658658
659   if ( len > MAX_FRAME_LENGTH )
659   if ( len > MAX_FRAME_LENGTH )
660660   {
661661      logerror( "mc6854_send_frame: truncated frame, size=%i, max=%i\n", len, MAX_FRAME_LENGTH );
662662      len = MAX_FRAME_LENGTH;
663663   }
664   else if ( len < 2 )
664   else if ( len < 2 )
665665   {
666666      logerror( "mc6854_send_frame: frame too short, size=%i, min=2\n", len );
667667      len = 2;
668668   }
669669   memcpy( mc6854->frame, data, len );
670   if ( FDSE )
670   if ( FDSE )
671671      mc6854->sr1 |= FD;
672672   mc6854->flen = len;
673673   mc6854->fpos = 0;
674674   mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] );
675675   mc6854_rfifo_push( mc6854->frame[ mc6854->fpos++ ] );
676   if ( mc6854->fpos == mc6854->flen )
676   if ( mc6854->fpos == mc6854->flen )
677677      mc6854_rfifo_terminate();
678678   return 0;
679679}
r1461r1462
686686
687687void mc6854_set_cts( int data )
688688{
689   if ( ! mc6854->cts && data )
689   if ( ! mc6854->cts && data )
690690      mc6854->sr1 |= CTS;
691691   mc6854->cts = data;
692692
693   if ( mc6854->cts )
693   if ( mc6854->cts )
694694      mc6854->sr1 |= CTS;
695   else
695   else
696696      mc6854->sr1 &= ~CTS;
697697}
698698
r1461r1462
700700
701701void mc6854_set_dcd( int data )
702702{
703   if ( ! mc6854->dcd && data )
703   if ( ! mc6854->dcd && data )
704704   {
705705      mc6854->sr2 |= DCD;
706706      /* partial reset */
r1461r1462
718718{
719719   /* update RDA */
720720   mc6854->sr2 |= RDA2;
721   if ( ! (mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x100) )
722      mc6854->sr2 &= ~RDA2;
723   else if ( TWOBYTES && ! (mc6854->tfifo[ FIFO_SIZE - 2 ] & 0x100) )
721   if ( ! (mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x100) )
724722      mc6854->sr2 &= ~RDA2;
725 
723   else if ( TWOBYTES && ! (mc6854->tfifo[ FIFO_SIZE - 2 ] & 0x100) )
724      mc6854->sr2 &= ~RDA2;
725
726726   /* update AP */
727   if ( mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x400 )
728      mc6854->sr2 |= AP;
729   else
727   if ( mc6854->rfifo[ FIFO_SIZE - 1 ] & 0x400 )
728      mc6854->sr2 |= AP;
729   else
730730      mc6854->sr2 &= ~AP;
731731}
732732
r1461r1462
737737   mc6854_update_sr2();
738738
739739   /* update S2RQ */
740   if ( mc6854->sr2 & 0x7f )
741      mc6854->sr1 |= S2RQ;
742   else
743      mc6854->sr1 &= ~S2RQ;
744 
740   if ( mc6854->sr2 & 0x7f )
741      mc6854->sr1 |= S2RQ;
742   else
743      mc6854->sr1 &= ~S2RQ;
744
745745   /* update TRDA (always prioritized by CTS) */
746   if ( TRESET || ( mc6854->sr1 & CTS ) )
746   if ( TRESET || ( mc6854->sr1 & CTS ) )
747747      mc6854->sr1 &= ~TDRA;
748   else
748   else
749749   {
750750      mc6854->sr1 |= TDRA;
751      if ( mc6854->tfifo[ 0 ] & 0x100 )
752         mc6854->sr1 &= ~TDRA;
753      else if ( TWOBYTES && (mc6854->tfifo[ 1 ] & 0x100) )
751      if ( mc6854->tfifo[ 0 ] & 0x100 )
754752         mc6854->sr1 &= ~TDRA;
753      else if ( TWOBYTES && (mc6854->tfifo[ 1 ] & 0x100) )
754         mc6854->sr1 &= ~TDRA;
755755   }
756756
757757   /* update RDA */
758   if ( mc6854->sr2 & RDA2 )
759      mc6854->sr1 |= RDA;
760   else
761      mc6854->sr1 &= ~RDA;
762 
758   if ( mc6854->sr2 & RDA2 )
759      mc6854->sr1 |= RDA;
760   else
761      mc6854->sr1 &= ~RDA;
762
763763   /* update IRQ */
764764   mc6854->sr1 &= ~IRQ;
765   if ( RIE && (mc6854->sr1 & (TU | TDRA) ) )
765   if ( RIE && (mc6854->sr1 & (TU | TDRA) ) )
766766      mc6854->sr1 |= IRQ;
767   if ( TIE )
767   if ( TIE )
768768   {
769      if ( mc6854->sr1 & (S2RQ | RDA | CTS) ) 
769      if ( mc6854->sr1 & (S2RQ | RDA | CTS) )
770770         mc6854->sr1 |= IRQ;
771      if ( mc6854->sr2 & (ERR | FV | DCD | OVRN | RABT | RIDLE | AP) )
771      if ( mc6854->sr2 & (ERR | FV | DCD | OVRN | RABT | RIDLE | AP) )
772772         mc6854->sr1 |= IRQ;
773773   }
774774}
r1461r1462
777777
778778READ8_HANDLER ( mc6854_r )
779779{
780   switch ( offset )
780   switch ( offset )
781781   {
782782
783783   case 0: /* status register 1 */
784784      mc6854_update_sr1();
785      LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n",
785      LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n",
786786            attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->sr1,
787            ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0,
787            ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0,
788788            ( mc6854->sr1 & FD ) ? 1 : 0, ( mc6854->sr1 & CTS ) ? 1 : 0,
789789            ( mc6854->sr1 & TU ) ? 1 : 0, ( mc6854->sr1 & TDRA) ? 1 : 0,
790790            ( mc6854->sr1 & IRQ) ? 1 : 0 ));
r1461r1462
792792
793793   case 1: /* status register 2 */
794794      mc6854_update_sr2();
795      LOG(( "%f $%04x mc6854_r: get SR2=$%02X (ap=%i,fv=%i,ridle=%i,rabt=%i,err=%i,dcd=%i,ovrn=%i,rda2=%i)\n",
795      LOG(( "%f $%04x mc6854_r: get SR2=$%02X (ap=%i,fv=%i,ridle=%i,rabt=%i,err=%i,dcd=%i,ovrn=%i,rda2=%i)\n",
796796            attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->sr2,
797            ( mc6854->sr2 & AP   ) ? 1 : 0, ( mc6854->sr2 & FV  ) ? 1 : 0,
798            ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0,
799            ( mc6854->sr2 & ERR  ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0,
797            ( mc6854->sr2 & AP   ) ? 1 : 0, ( mc6854->sr2 & FV  ) ? 1 : 0,
798            ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0,
799            ( mc6854->sr2 & ERR  ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0,
800800            ( mc6854->sr2 & OVRN ) ? 1 : 0, ( mc6854->sr2 & RDA2) ? 1 : 0 ));
801801      return mc6854->sr2;
802802
r1461r1462
804804   case 3:
805805   {
806806      UINT8 data = mc6854_rfifo_pop();
807      LOG(( "%f $%04x mc6854_r: get data $%02X\n",
807      LOG(( "%f $%04x mc6854_r: get data $%02X\n",
808808            attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
809809      return data;
810810   }
r1461r1462
819819
820820WRITE8_HANDLER ( mc6854_w )
821821{
822   switch ( offset )
822   switch ( offset )
823823   {
824824
825825   case 0: /* control register 1 */
826826      mc6854->cr1 = data;
827      LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n",
827      LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n",
828828            attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->cr1,
829            AC ? 1 : 0,
829            AC ? 1 : 0,
830830            RIE ? 'r' : '-', TIE ? 't' : '-',
831831            DISCONTINUE ? "discontinue," : "",
832832            RRESET ? 'r' : '-', TRESET ? 't' : '-'
833833             ));
834      if ( mc6854->cr1 & 0xc )
835         logerror( "$%04x mc6854 DMA not handled (CR1=$%02X)\n",
834      if ( mc6854->cr1 & 0xc )
835         logerror( "$%04x mc6854 DMA not handled (CR1=$%02X)\n",
836836              activecpu_get_previouspc(), mc6854->cr1 );
837      if ( DISCONTINUE )
837      if ( DISCONTINUE )
838838      {
839839         /* abort receive FIFO but keeps shift register & synchro */
840840         mc6854->rstate = 0;
841841         memset( mc6854->rfifo, 0, sizeof( mc6854->rfifo ) );
842842      }
843      if ( RRESET )
843      if ( RRESET )
844844      {
845845         /* abort FIFO & synchro */
846846         mc6854_rfifo_clear();
r1461r1462
848848         mc6854->sr2 &= ~(AP | FV | RIDLE | RABT | ERR | OVRN | DCD);
849849         if ( mc6854->dcd ) mc6854->sr2 |= DCD;
850850      }
851      if ( TRESET )
851      if ( TRESET )
852852      {
853853         mc6854_tfifo_clear();
854854         mc6854->sr1 &= ~(TU | TDRA | CTS);
r1461r1462
857857      break;
858858
859859   case 1:
860      if ( AC )
860      if ( AC )
861861      {
862862         /* control register 3 */
863863         mc6854->cr3 = data;
864         LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n",
864         LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n",
865865               attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->cr3,
866866               LCF ? (CEX ? 16 : 8) : 0,  AEX ? 1 : 0,
867867               IDL0 ? 0 : 1, FDSE ? 1 : 0, LOOP ? 1 : 0,
r1461r1462
876876            mc6854->iface->out_dtr( DTR ? 1 : 0 );
877877
878878      }
879      else
879      else
880880      {
881881         /* control register 2 */
882882         mc6854->cr2 = data;
883         LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n",
883         LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n",
884884               attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->cr2,
885               PSE ? 1 : 0,  TWOBYTES ? 2 : 1,  FMIDLE ? 1 : 0,
885               PSE ? 1 : 0,  TWOBYTES ? 2 : 1,  FMIDLE ? 1 : 0,
886886               FCTDRA ? "fc" : "tdra", TLAST ? 1 : 0,
887887               data & 0x20 ? 'r' : '-',  data & 0x40 ? 't' : '-',
888888               RTS ? 1 : 0 ));
889889         if ( PSE )
890890            logerror( "$%04x mc6854 status prioritization not handled (CR2=$%02X)\n", activecpu_get_previouspc(), mc6854->cr2 );
891         if ( TLAST )
891         if ( TLAST )
892892            mc6854_tfifo_terminate();
893         if ( data & 0x20 )
893         if ( data & 0x20 )
894894         {
895895            /* clear receiver status */
896896            mc6854->sr1 &= ~FD;
897897            mc6854->sr2 &= ~(AP | FV | RIDLE | RABT | ERR | OVRN | DCD);
898            if ( mc6854->dcd )
898            if ( mc6854->dcd )
899899               mc6854->sr2 |= DCD;
900900         }
901         if ( data & 0x40 )
901         if ( data & 0x40 )
902902         {
903903            /* clear transmitter status */
904904            mc6854->sr1 &= ~(TU | TDRA | CTS);
905            if ( mc6854->cts )
905            if ( mc6854->cts )
906906               mc6854->sr1 |= CTS;
907907         }
908908
909         if ( mc6854->iface->out_rts )
909         if ( mc6854->iface->out_rts )
910910            mc6854->iface->out_rts( RTS ? 1 : 0 );
911911      }
912912      break;
r1461r1462
917917      break;
918918
919919   case 3:
920      if ( AC )
920      if ( AC )
921921      {
922922         /* control register 4 */
923923         mc6854->cr4 = data;
924924         LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6854->cr4,
925               TWOINTER ? 2 : 1,
926               TWL, RWL,
925               TWOINTER ? 2 : 1,
926               TWL, RWL,
927927               ABT ? ( ABTEX ? "abort-ext," : "abort,") : "",
928928               NRZ ? "nrz" : "nrzi" ));
929         if ( ABT )
930         {
929         if ( ABT )
930         {
931931            mc6854->tstate = 0;
932932            mc6854_send_bits( 0xffff, ABTEX ? 16 : 8, 0 );
933933            mc6854->flen = 0;
934934         }
935935      }
936      else
936      else
937937      {
938938         /* transmitter data: last data */
939939         LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), data ));
r1461r1462
941941         mc6854_tfifo_terminate();
942942      }
943943      break;
944
944
945945   default:
946946      logerror( "$%04x mc6854 invalid write offset %i (data=$%02X)\n", activecpu_get_previouspc(), offset, data );
947947   }
src/mess/machine/tc8521.c
r1461r1462
152152static void tc8521_set_alarm_output(void)
153153{
154154   unsigned char alarm_output;
155   
155
156156   alarm_output = 0;
157157
158158   /* what happens when all are enabled? I assume they are all or'd together */
r1461r1462
181181      /* alarm output enabled? */
182182      alarm_output &= ~1;
183183   }
184   
184
185185    if (rtc.interface.alarm_output_callback!=NULL)
186186    {
187187      rtc.interface.alarm_output_callback(alarm_output);
r1461r1462
314314            logerror("8521 RTC R: %04x %02x\n", offset, rtc.registers[offset]);
315315#endif
316316              return rtc.registers[offset];
317     
317
318318         default:
319319            break;
320320      }
src/mess/machine/mc6854.h
r1461r1462
1515
1616   The bit-based interface is low-level and slow.
1717   Use it to simulate the actual bits sent into the wires, e.g., to connect
18   the emulator to another bit-based emulated network device, or an actual
18   the emulator to another bit-based emulated network device, or an actual
1919   device.
2020
2121   The frame-based interface is higher-level and faster.
2222   It passes bytes directly from one end to the other without bothering with
2323   the actual bit-encoding, synchronization, and CRC.
24   Once completed, a frame is sent through out_frame. Aborted frames are not
24   Once completed, a frame is sent through out_frame. Aborted frames are not
2525   transmitted at all. No start flag, stop flag, or crc bits are trasmitted.
2626   send_frame makes a frame available to the CPU through the 6854 (it may
2727   fail and return -1 if the 6854 is not ready to accept the frame; even
28   if the frame is accepted and 0 is returned, the CPU may abort it). Ony
28   if the frame is accepted and 0 is returned, the CPU may abort it). Ony
2929   full frames are accepted.
3030*/
3131
src/mess/machine/concept.c
r1461r1462
457457         {
458458            int slot = ((offset >> 4) & 7) - 1;
459459#if VERBOSE
460            logerror("concept_io_w: Slot I/O register written for slot %d at address 0x03%4.4x, data: 0x%4.4x\n",
460            logerror("concept_io_w: Slot I/O register written for slot %d at address 0x03%4.4x, data: 0x%4.4x\n",
461461               slot, offset << 1, data);
462462#endif
463463            if (expansion_slots[slot].reg_write)
src/mess/machine/99_dsk.c
r1461r1462
270270        /* Prevents internal_floppy_device_load (mflopimg) to set the drive
271271           geometry to the medium geometry. TI disk controllers determine the
272272           number of tracks from a field in sector 0, and if the medium has
273           40 tracks but the drive has 80, the DSR ROM automatically
274           double-steps the tracks.
273           40 tracks but the drive has 80, the DSR ROM automatically
274           double-steps the tracks.
275275        */
276276        floppy_keep_drive_geometry();
277277
src/mess/machine/msx.c
r1461r1462
111111   }
112112   mem = image_malloc (image, size_aligned);
113113   if (!mem) {
114      logerror ("cart #%d: error: failed to allocate memory for cartridge\n",
114      logerror ("cart #%d: error: failed to allocate memory for cartridge\n",
115115                  id);
116116      return INIT_FAIL;
117117   }
r1461r1462
119119      memset (mem, 0xff, size_aligned);
120120   }
121121   if (image_fread(image, mem, size) != size) {
122      logerror ("cart #%d: %s: can't read full %d bytes\n",
122      logerror ("cart #%d: %s: can't read full %d bytes\n",
123123                  id, image_filename (image), size);
124124      return INIT_FAIL;
125125   }
r1461r1462
130130      logerror("cart #%d: warning: no information in crc file\n", id);
131131      type = -1;
132132   }
133   else if ((1 != sscanf (extra, "%d", &type) ) ||
133   else if ((1 != sscanf (extra, "%d", &type) ) ||
134134         type < 0 || type > SLOT_LAST_CARTRIDGE_TYPE) {
135135      logerror("cart #%d: warning: information in crc file not valid\n", id);
136136      type = -1;
r1461r1462
162162         logerror ("cart #%d: error: cannot allocate memory\n", id);
163163         return INIT_FAIL;
164164      }
165     
165
166166      if (size < 0x10000) {
167167         memset (mem + size, 0xff, 0x10000 - size);
168168      }
r1461r1462
177177   /* mapper type 0 (ROM) might need moving around a bit */
178178   if (!type) {
179179      int i, page = 1;
180     
180
181181      /* find the correct page */
182182      if (mem[0] == 'A' && mem[1] == 'B') {
183183         for (i=2; i<=8; i += 2) {
r1461r1462
193193            /* copy to the respective page */
194194            memcpy (mem + (page * 0x4000), mem, 0x4000);
195195            memset (mem, 0xff, 0x4000);
196         }
196         }
197197         else {
198198            /* memory is repeated 4 times */
199199            page = -1;
r1461r1462
210210
211211            page = 1;
212212            i = 0xc000; m = mem + 0xffff;
213            while (i--) {
214               *m = *(m - 0x4000); m--;
213            while (i--) {
214               *m = *(m - 0x4000); m--;
215215            }
216216            memset (mem, 0xff, 0x4000);
217217         }
r1461r1462
270270DEVICE_UNLOAD (msx_cart)
271271{
272272   int id;
273   
273
274274   id = image_index_in_device (image);
275275   if (msx_slot_list[msx1.cart_state[id]->type].savesram)
276276   {
r1461r1462
323323static const ppi8255_interface msx_ppi8255_interface =
324324{
325325   1,
326   {NULL},
326   {NULL},
327327   {msx_ppi_port_b_r},
328328   {NULL},
329329   {msx_ppi_port_a_w},
330   {NULL},
330   {NULL},
331331   {msx_ppi_port_c_w}
332332};
333333
r1461r1462
712712
713713   /* cassette motor on/off */
714714   if ( (old_val ^ data) & 0x10)
715      cassette_change_state(cassette_device_image(),
716                  (data & 0x10) ? CASSETTE_MOTOR_DISABLED :
717                              CASSETTE_MOTOR_ENABLED,
715      cassette_change_state(cassette_device_image(),
716                  (data & 0x10) ? CASSETTE_MOTOR_DISABLED :
717                              CASSETTE_MOTOR_ENABLED,
718718                  CASSETTE_MASK_MOTOR);
719719
720720   /* cassette signal write */
r1461r1462
780780   }
781781
782782   for (; layout->entry != MSX_LAYOUT_LAST; layout++) {
783     
783
784784      switch (layout->entry) {
785785      case MSX_LAYOUT_SLOT_ENTRY:
786786         prim = layout->slot_primary;
r1461r1462
899899   if (!msx1.layout) {
900900      return;
901901   }
902   
903   for (layout = msx1.layout; layout->entry != MSX_LAYOUT_LAST;
902
903   for (layout = msx1.layout; layout->entry != MSX_LAYOUT_LAST;
904904               layout++) {
905905
906906      if (layout->entry == MSX_LAYOUT_SLOT_ENTRY) {
r1461r1462
942942
943943   if (VERBOSE)
944944   {
945      logerror ("mapping %s in %d/%d/%d\n", slot->name, slot_primary,
945      logerror ("mapping %s in %d/%d/%d\n", slot->name, slot_primary,
946946         slot_secondary, page);
947947   }
948948   slot->map (state, page);
r1461r1462
10751075   {
10761076      int latch;
10771077      UINT8 ret;
1078     
1078
10791079      latch = msx1.kanji_latch;
10801080      ret = msx1.kanji_mem[latch++];
10811081
r1461r1462
10911091{
10921092   if (offset)
10931093   {
1094      msx1.kanji_latch =
1094      msx1.kanji_latch =
10951095            (msx1.kanji_latch & 0x007E0) | ((data & 0x3f) << 11);
10961096   }
10971097   else
10981098   {
1099      msx1.kanji_latch =
1099      msx1.kanji_latch =
11001100            (msx1.kanji_latch & 0x1f800) | ((data & 0x3f) << 5);
11011101   }
11021102}
src/mess/machine/vectrex.c
r1461r1462
314314   }
315315
316316   artwork_use_device_art(image_from_devtype_and_index(IO_CARTSLOT, 0), "mine");
317   
317
318318   for (i = 0; i < vectrex_ram_size; i++)
319319      vectrex_ram_base[i] = mame_rand(machine);
320320}
src/mess/machine/nes_mmc.c
r1461r1462
21002100            ret = 1;
21012101         else if (last_side != nes_fds.current_side)
21022102         {
2103            /* If we've switched disks, report "no disk" for a few reads */         
2103            /* If we've switched disks, report "no disk" for a few reads */
21042104            ret = 1;
21052105            count ++;
21062106            if (count == 50)
r1461r1462
42124212
42134213   /* Set the vram bank-switch values to the default */
42144214   ppu2c0x_set_videorom_bank(0, 0, 8, 0, 64);
4215   
4215
42164216   /* Set the mapper irq callback */
42174217   mapper = nes_mapper_lookup(mapperNum);
42184218   ppu2c0x_set_scanline_callback (0, mapper ? mapper->mmc_scanline : NULL);
r1461r1462
42204220
42214221   if (!nes_irq_timer)
42224222      nes_irq_timer = timer_alloc(nes_irq_callback, NULL);
4223     
4223
42244224   mapper_warning = 0;
42254225   /* 8k mask */
42264226   prg_mask = ((nes.prg_chunks << 1) - 1);
src/mess/machine/pclpt.c
r1461r1462
121121#if 0
122122            /* set status 'out of paper', '*no* error', 'IRQ has *not* occured' */
123123            LPT[n].status = 0x09c;   //0x2c;
124           
124
125125#endif
126126         }
127127         data|=0x4; //?
r1461r1462
138138}
139139
140140void pc_lpt_handshake_in(int nr, int data, int mask)
141{   
141{
142142   PC_LPT *This=LPT+nr;
143143   int neu=(data&mask)|(This->status&~mask);
144144
src/mess/machine/pc_joy.c
r1461r1462
7171
7272INPUT_PORTS_START( pc_joystick )
7373   PORT_START_TAG("pc_joy")
74   PORT_BIT ( 0xf, 0xf,    IPT_UNUSED )
74   PORT_BIT ( 0xf, 0xf,    IPT_UNUSED )
7575   PORT_BIT( 0x0010, 0x0000, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1")
7676   PORT_BIT( 0x0020, 0x0000, IPT_BUTTON2) PORT_NAME("Joystick 1 Button 2")
7777   PORT_BIT( 0x0040, 0x0000, IPT_BUTTON1) PORT_NAME("Joystick 2 Button 1") PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2)
7878   PORT_BIT( 0x0080, 0x0000, IPT_BUTTON2) PORT_NAME("Joystick 2 Button 2") PORT_CODE(JOYCODE_BUTTON2) PORT_PLAYER(2)
79     
79
8080   PORT_START
8181   PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_REVERSE
82     
82
8383   PORT_START
8484   PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_REVERSE
85     
85
8686   PORT_START
8787   PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(2) PORT_REVERSE
88     
88
8989   PORT_START
9090   PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE
9191INPUT_PORTS_END
src/mess/machine/74145.c
r1461r1462
33 * machine/74145.h
44 *
55 * BCD-to-Decimal decoder
6 *
6 *
77 *        __ __
88 *     0-|  v  |-VCC
99 *     1-|     |-A
r1461r1462
1414 *     6-|     |-8
1515 *   GND-|_____|-7
1616 *
17 *
17 *
1818 * Truth table
1919 *  _______________________________
2020 * | Inputs  | Outputs             |
r1461r1462
3939 * | H H H L | H H H H H H H H H H |
4040 * | H H H H | H H H H H H H H H H |
4141 *  -------------------------------
42 *
42 *
4343 ****************************************************************************/
4444
4545#include "74145.h"
r1461r1462
6565{
6666   /* Pointer to our interface */
6767   const ttl74145_interface *intf;
68   
68
6969   /* Decoded number */
7070   UINT16 number;
7171};
r1461r1462
9696
9797   /* Assign interface */
9898   ttl74145[which].intf = intf;
99   
99
100100   /* Initialize */
101101   ttl74145_reset(which);
102102}
r1461r1462
114114{
115115   /* Decode number */
116116   UINT16 new_number = bcd_2_dec(data & 0x0f);
117   
117
118118   /* Call output callbacks if the number changed */
119119   if (new_number != ttl74145[which].number)
120120   {
121121      const ttl74145_interface *i = ttl74145[which].intf;
122     
122
123123      if (i->output_line_0) i->output_line_0(new_number == 0);
124124      if (i->output_line_1) i->output_line_1(new_number == 1);
125125      if (i->output_line_2) i->output_line_2(new_number == 2);
r1461r1462
129129      if (i->output_line_6) i->output_line_6(new_number == 6);
130130      if (i->output_line_7) i->output_line_7(new_number == 7);
131131      if (i->output_line_8) i->output_line_8(new_number == 8);
132      if (i->output_line_9) i->output_line_9(new_number == 9);           
132      if (i->output_line_9) i->output_line_9(new_number == 9);
133133   }
134   
134
135135   /* Update state */
136136   ttl74145[which].number = new_number;
137137}
src/mess/machine/mc6846.c
r1461r1462
3030/******************* internal chip data structure ******************/
3131
3232
33static struct
33static struct
3434{
35 
35
3636   const mc6846_interface* iface;
37 
37
3838   /* registers */
3939   UINT8    csr;      /* 0,4: combination status register */
4040   UINT8    pcr;      /* 1:   peripheral control register */
r1461r1462
9090
9191INLINE UINT16 mc6846_counter ( void )
9292{
93   if ( mc6846.timer_started )
93   if ( mc6846.timer_started )
9494   {
9595      attotime delay = timer_timeleft( mc6846.interval );
9696      return ATTOTIME_TO_CYCLES( mc6846.iface->cpunum, delay ) / FACTOR;
9797   }
98   else
98   else
9999      return mc6846.preset;
100100}
101101
102102
103103
104INLINE void mc6846_update_irq( void )
104INLINE void mc6846_update_irq( void )
105105{
106106   static int old_cif;
107107   int cif = 0;
r1461r1462
110110        ( (mc6846.csr & 2) && (mc6846.pcr & 1) ) ||
111111        ( (mc6846.csr & 4) && (mc6846.pcr & 8) && ! (mc6846.pcr & 0x20) ) )
112112      cif = 1;
113   if ( old_cif != cif )
114   {
115      LOG (( "%f: mc6846 interrupt %i (time=%i cp1=%i cp2=%i)\n",
116             attotime_to_double(timer_get_time()), cif,
113   if ( old_cif != cif )
114   {
115      LOG (( "%f: mc6846 interrupt %i (time=%i cp1=%i cp2=%i)\n",
116             attotime_to_double(timer_get_time()), cif,
117117             mc6846.csr & 1, (mc6846.csr >> 1 ) & 1, (mc6846.csr >> 2 ) & 1 ));
118118      old_cif = cif;
119119   }
120   if ( cif )
120   if ( cif )
121121   {
122122      mc6846.csr |= 0x80;
123123      if ( mc6846.iface->irq_func )
124124         mc6846.iface->irq_func( 1 );
125125   }
126   else
126   else
127127   {
128128      mc6846.csr &= ~0x80;
129129      if ( mc6846.iface->irq_func )
r1461r1462
137137{
138138   int cto = CTO;
139139   static int old_cto;
140   if ( cto != old_cto )
140   if ( cto != old_cto )
141141   {
142142      LOG (( "%f: mc6846 CTO set to %i\n", attotime_to_double(timer_get_time()), cto ));
143143      old_cto = cto;
144144   }
145   if ( mc6846.iface->out_cto_func )
145   if ( mc6846.iface->out_cto_func )
146146      mc6846.iface->out_cto_func( 0, cto );
147147}
148148
r1461r1462
153153   int delay = FACTOR * (mc6846.preset+1);
154154   LOG (( "%f: mc6846 timer launch called, mode=%i, preset=%i (x%i)\n", attotime_to_double(timer_get_time()), MODE, mc6846.preset, FACTOR ));
155155
156   if ( ! (mc6846.tcr & 2) )
156   if ( ! (mc6846.tcr & 2) )
157157   {
158158      logerror( "mc6846 external clock CTC not implemented\n" );
159159   }
160 
161   switch( MODE )
160
161   switch( MODE )
162162   {
163   
163
164164   case 0x00:
165165   case 0x10: /* continuous */
166166      mc6846.cto = 0;
167167      break;
168   
168
169169   case 0x20: /* single-shot */
170170      mc6846.cto = 0;
171171      timer_reset( mc6846.one_shot, ATTOTIME_IN_CYCLES( FACTOR, mc6846.iface->cpunum ) );
172172      break;
173   
173
174174   case 0x30:  /* cascaded single-shot */
175175      break;
176   
176
177177   default:
178178      logerror( "mc6846 timer mode %i not implemented\n", MODE );
179179      timer_reset( mc6846.interval, attotime_never );
180180      mc6846.timer_started = 0;
181181      return;
182182   }
183 
183
184184   timer_reset( mc6846.interval, ATTOTIME_IN_CYCLES( delay, mc6846.iface->cpunum ) );
185185   mc6846.timer_started = 1;
186 
186
187187   mc6846.csr &= ~1;
188188   mc6846_update_cto();
189189   mc6846_update_irq();
r1461r1462
205205   if ( ! (mc6846.tcr & 2) )
206206      logerror( "mc6846 external clock CTC not implemented\n" );
207207
208   switch ( MODE )
208   switch ( MODE )
209209   {
210210   case 0x00:
211211   case 0x10: /* continuous */
r1461r1462
215215   case 0x20: /* single-shot */
216216      mc6846.cto = 0;
217217      break;
218   
218
219219   case 0x30:  /* cascaded single-shot */
220220      mc6846.cto = ( mc6846.tcr & 0x80 ) ? 1 : 0;
221221      break;
r1461r1462
253253
254254READ8_HANDLER ( mc6846_r )
255255{
256   switch ( offset )
256   switch ( offset )
257257   {
258258   case 0:
259259   case 4:
260260      LOG (( "$%04x %f: mc6846 CSR read $%02X intr=%i (timer=%i, cp1=%i, cp2=%i)\n",
261             activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
262             mc6846.csr, (mc6846.csr >> 7) & 1,
261             activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
262             mc6846.csr, (mc6846.csr >> 7) & 1,
263263             mc6846.csr & 1, (mc6846.csr >> 1) & 1, (mc6846.csr >> 2) & 1 ));
264264      mc6846.csr0_to_be_cleared = mc6846.csr & 1;
265265      mc6846.csr1_to_be_cleared = mc6846.csr & 2;
266266      mc6846.csr2_to_be_cleared = mc6846.csr & 4;
267267      return mc6846.csr;
268   
269   case 1:
268
269   case 1:
270270      LOG (( "$%04x %f: mc6846 PCR read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846.pcr ));
271271      return mc6846.pcr;
272272
273   case 2:
273   case 2:
274274      LOG (( "$%04x %f: mc6846 DDR read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846.ddr ));
275275      return mc6846.ddr;
276276
277277   case 3:
278278      LOG (( "$%04x %f: mc6846 PORT read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), PORT ));
279      if ( ! (mc6846.pcr & 0x80) )
279      if ( ! (mc6846.pcr & 0x80) )
280280      {
281         if ( mc6846.csr1_to_be_cleared )
281         if ( mc6846.csr1_to_be_cleared )
282282            mc6846.csr &= ~2;
283         if ( mc6846.csr2_to_be_cleared )
283         if ( mc6846.csr2_to_be_cleared )
284284            mc6846.csr &= ~4;
285285         mc6846_update_irq();
286286         mc6846.csr1_to_be_cleared = 0;
r1461r1462
294294
295295   case 6:
296296      LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846_counter() >> 8 ));
297      if ( mc6846.csr0_to_be_cleared )
297      if ( mc6846.csr0_to_be_cleared )
298298      {
299299         mc6846.csr &= ~1;
300300         mc6846_update_irq();
r1461r1462
304304
305305   case 7:
306306      LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846_counter() & 0xff ));
307      if ( mc6846.csr0_to_be_cleared )
307      if ( mc6846.csr0_to_be_cleared )
308308      {
309309         mc6846.csr &= ~1;
310310         mc6846_update_irq();
r1461r1462
322322
323323WRITE8_HANDLER ( mc6846_w )
324324{
325   switch ( offset )
325   switch ( offset )
326326   {
327327   case 0:
328328   case 4:
r1461r1462
332332   case 1:
333333   {
334334#if VERBOSE
335      const char* cp2[8] =
336         {
337         "in,neg-edge", "in,neg-edge,intr", "in,pos-edge", "in,pos-edge,intr",
338         "out,intr-ack", "out,i/o-ack", "out,0", "out,1"
335      const char* cp2[8] =
336         {
337         "in,neg-edge", "in,neg-edge,intr", "in,pos-edge", "in,pos-edge,intr",
338         "out,intr-ack", "out,i/o-ack", "out,0", "out,1"
339339      };
340340      const char* cp1[8] = {
341341         "neg-edge", "neg-edge,intr", "pos-edge", "pos-edge,intr",
342         "latched,neg-edge", "latched,neg-edge,intr",
343         "latcged,pos-edge", "latcged,pos-edge,intr"
342         "latched,neg-edge", "latched,neg-edge,intr",
343         "latcged,pos-edge", "latcged,pos-edge,intr"
344344      };
345      LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n",
345      LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n",
346346             activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
347347             (data >> 7) & 1, cp2[ (data >> 3) & 7 ], cp1[ data & 7 ] ));
348348#endif
r1461r1462
357357   }
358358   if ( data & 4 )
359359      logerror( "$%04x mc6846 CP1 latching not implemented\n", activecpu_get_previouspc() );
360   if (data & 0x20)
360   if (data & 0x20)
361361   {
362      if (data & 0x10)
362      if (data & 0x10)
363363      {
364364         mc6846.cp2_cpu = (data >> 3) & 1;
365365         if ( mc6846.iface->out_cp2_func )
r1461r1462
372372
373373   case 2:
374374      LOG (( "$%04x %f: mc6846 DDR write $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
375      if ( ! (mc6846.pcr & 0x80) )
375      if ( ! (mc6846.pcr & 0x80) )
376376      {
377377         mc6846.ddr = data;
378         if ( mc6846.iface->out_port_func )
378         if ( mc6846.iface->out_port_func )
379379            mc6846.iface->out_port_func( 0, mc6846.pdr & mc6846.ddr );
380380      }
381381      break;
382     
382
383383   case 3:
384384      LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,mc6846.ddr ));
385      if ( ! (mc6846.pcr & 0x80) )
385      if ( ! (mc6846.pcr & 0x80) )
386386      {
387387         mc6846.pdr = data;
388         if ( mc6846.iface->out_port_func )
388         if ( mc6846.iface->out_port_func )
389389            mc6846.iface->out_port_func( 0, mc6846.pdr & mc6846.ddr );
390         if ( mc6846.csr1_to_be_cleared && (mc6846.csr & 2) )
390         if ( mc6846.csr1_to_be_cleared && (mc6846.csr & 2) )
391391         {
392392            mc6846.csr &= ~2;
393393            LOG (( "$%04x %f: mc6846 CP1 intr reset\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()) ));
r1461r1462
406406   case 5:
407407   {
408408#if VERBOSE
409      const char* mode[8] =
410         {
411            "continuous", "cascaded", "continuous", "one-shot",
409      const char* mode[8] =
410         {
411            "continuous", "cascaded", "continuous", "one-shot",
412412            "freq-cmp", "freq-cmp", "pulse-cmp", "pulse-cmp"
413413         };
414      LOG (( "$%04x %f: mc6846 TCR write $%02X reset=%i clock=%s scale=%i mode=%s out=%s\n",
414      LOG (( "$%04x %f: mc6846 TCR write $%02X reset=%i clock=%s scale=%i mode=%s out=%s\n",
415415             activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
416416             (data >> 7) & 1, (data & 0x40) ? "extern" : "sys",
417417             (data & 0x40) ? 1 : 8, mode[ (data >> 1) & 7 ],
418418             (data & 1) ? "enabled" : "0" ));
419419#endif
420420      mc6846.tcr = data;
421      if ( mc6846.tcr & 1 )
421      if ( mc6846.tcr & 1 )
422422      {
423423         /* timer preset = initialization without launch */
424424         mc6846.preset = mc6846.latch;
425425         mc6846.csr &= ~1;
426         if ( MODE != 0x30 )
426         if ( MODE != 0x30 )
427427            mc6846.cto = 0;
428428         mc6846_update_cto();
429429         timer_reset( mc6846.interval, attotime_never );
430430         timer_reset( mc6846.one_shot, attotime_never );
431431         mc6846.timer_started = 0;
432432      }
433      else
433      else
434434      {
435435         /* timer launch */
436         if ( ! mc6846.timer_started )
436         if ( ! mc6846.timer_started )
437437            mc6846_timer_launch();
438438      }
439439      mc6846_update_irq();
440440   }
441441   break;
442   
442
443443   case 6:
444444      mc6846.time_MSB = data;
445445      break;
r1461r1462
447447   case 7:
448448      mc6846.latch = ( ((UINT16) mc6846.time_MSB) << 8 ) + data;
449449      LOG (( "$%04x %f: mc6846 COUNT write %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), mc6846.latch  ));
450      if (!(mc6846.tcr & 0x38))
450      if (!(mc6846.tcr & 0x38))
451451      {
452452         /* timer initialization */
453453         mc6846.preset = mc6846.latch;
r1461r1462
456456         mc6846.cto = 0;
457457         mc6846_update_cto();
458458         /* launch only if started */
459         if (!(mc6846.tcr & 1))
459         if (!(mc6846.tcr & 1))
460460            mc6846_timer_launch();
461461      }
462462      break;
463
463
464464   default:
465465      logerror( "$%04x mc6846 invalid write offset %i\n", activecpu_get_previouspc(), offset );
466466   }
r1461r1462
475475void mc6846_set_input_cp1 ( int data )
476476{
477477   data = (data != 0 );
478   if ( data == mc6846.cp1 )
478   if ( data == mc6846.cp1 )
479479      return;
480480   mc6846.cp1 = data;
481481   LOG (( "%f: mc6846 input CP1 set to %i\n",  attotime_to_double(timer_get_time()), data ));
482   if (( data &&  (mc6846.pcr & 2)) || (!data && !(mc6846.pcr & 2)))
482   if (( data &&  (mc6846.pcr & 2)) || (!data && !(mc6846.pcr & 2)))
483483   {
484484      mc6846.csr |= 2;
485485      mc6846_update_irq();
r1461r1462
489489void mc6846_set_input_cp2 ( int data )
490490{
491491   data = (data != 0 );
492   if ( data == mc6846.cp2 )
492   if ( data == mc6846.cp2 )
493493      return;
494494   mc6846.cp2 = data;
495495   LOG (( "%f: mc6846 input CP2 set to %i\n", attotime_to_double(timer_get_time()), data ));
496   if (mc6846.pcr & 0x20)
496   if (mc6846.pcr & 0x20)
497497   {
498      if (( data &&  (mc6846.pcr & 0x10)) || (!data && !(mc6846.pcr & 0x10)))
498      if (( data &&  (mc6846.pcr & 0x10)) || (!data && !(mc6846.pcr & 0x10)))
499499      {
500500         mc6846.csr |= 4;
501501         mc6846_update_irq();
502      }   
502      }
503503   }
504504}
505505
r1461r1462
573573   mc6846.iface = iface;
574574   mc6846.interval = timer_alloc( mc6846_timer_expire , NULL);
575575   mc6846.one_shot = timer_alloc( mc6846_timer_one_shot , NULL);
576 
576
577577   state_save_register_item( "mc6846", 0, mc6846.csr );
578578   state_save_register_item( "mc6846", 0, mc6846.pcr );
579579   state_save_register_item( "mc6846", 0, mc6846.ddr );
src/mess/machine/thomson.c
r1461r1462
6868
6969   if ( state )
7070      thom_irq |= 1 << line;
71   else
71   else
7272      thom_irq &= ~(1 << line);
7373
7474#if VERBOSE_IRQ
r1461r1462
8585
8686static void thom_set_firq ( int line, int state )
8787{
88   
88
8989#if VERBOSE_IRQ
9090   int old = thom_irq;
9191#endif
92   
93   if ( state )
92
93   if ( state )
9494      thom_firq |= 1 << line;
95   else
95   else
9696      thom_firq &= ~(1 << line);
97   
97
9898#if VERBOSE_IRQ
9999   if ( !old && thom_firq )
100100      logerror( "%f thom_set_firq: firq line up %i\n", attotime_to_double(timer_get_time()), line );
101101   if ( old && !thom_firq )
102102      logerror( "%f thom_set_firq: firq line down %i\n", attotime_to_double(timer_get_time()), line );
103103#endif
104   
104
105105   cpunum_set_input_line( 0, M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE );
106106}
107107
r1461r1462
125125
126126
127127
128static void thom_irq_0  ( int state )
128static void thom_irq_0  ( int state )
129129{
130   thom_set_irq  ( 0, state );
130   thom_set_irq  ( 0, state );
131131}
132132
133static void thom_irq_1  ( int state )
134{
135   thom_set_irq  ( 1, state );
133static void thom_irq_1  ( int state )
134{
135   thom_set_irq  ( 1, state );
136136}
137137
138static void thom_irq_3  ( int state )
139{
140   thom_set_irq  ( 3, state );
138static void thom_irq_3  ( int state )
139{
140   thom_set_irq  ( 3, state );
141141}
142142
143static void thom_firq_1 ( int state )
144{
145   thom_set_firq ( 1, state );
143static void thom_firq_1 ( int state )
144{
145   thom_set_firq ( 1, state );
146146}
147147
148static void thom_firq_2 ( int state )
149{
150   thom_set_firq ( 2, state );
148static void thom_firq_2 ( int state )
149{
150   thom_set_firq ( 2, state );
151151}
152152
153153#ifdef CHARDEV
154static void thom_irq_4  ( int state )
155{
156   thom_set_irq  ( 4, state );
154static void thom_irq_4  ( int state )
155{
156   thom_set_irq  ( 4, state );
157157}
158158#endif
159159
160160
161/*
161/*
162162   current IRQ usage:
163163
164164   line 0 => 6846 interrupt
r1461r1462
192192int thom_serial_init ( mess_image *image )
193193{
194194   int idx = image_index_in_device(image);
195   
196   if ( serial_device_init( image ) != INIT_PASS )
195
196   if ( serial_device_init( image ) != INIT_PASS )
197197      return INIT_FAIL;
198
198
199199   switch ( idx ) {
200     
200
201201   case THOM_SERIAL_CC90323:
202202      LOG(( "thom_serial_init: init CD 90-320 RS232 device\n" ));
203203      serial_device_connect( image , &to7_io_line );
204204      break;
205     
205
206206   case THOM_SERIAL_RF57232:
207207      LOG(( "thom_serial_init: init RF 57-232 RS232 device\n" ));
208208      acia_6551_connect_to_serial_device( image );
209209      break;
210     
210
211211   case THOM_SERIAL_MODEM:
212212      LOG(( "thom_serial_init: init MODEM (MD 90-120) device\n" ));
213213      break;
214     
214
215215   default:
216216      logerror( "thom_serial_init: unknown serial device index %i\n", idx );
217217      return INIT_FAIL;
218218   }
219   
219
220220   serial_device_setup( image, 2400, 7, 2, SERIAL_PARITY_NONE ); /* default */
221221   serial_device_set_protocol( image, SERIAL_PROTOCOL_NONE );
222222   serial_device_set_transmit_state( image, 1 );
223   
223
224224   return INIT_PASS;
225225}
226226
r1461r1462
236236int thom_serial_load ( mess_image* image )
237237{
238238   int idx = image_index_in_device( image );
239   
240   if ( serial_device_load( image ) != INIT_PASS )
239
240   if ( serial_device_load( image ) != INIT_PASS )
241241   {
242242      logerror( "thom_serial_load: could not load serial image in device %i\n", idx );
243243      return INIT_FAIL;
244244   }
245   
245
246246   return INIT_PASS;
247247}
248248
r1461r1462
280280   char name[129];
281281
282282   /* get size & number of 16-KB banks */
283   if ( size <= 0x04000 )
283   if ( size <= 0x04000 )
284284      thom_cart_nb_banks = 1;
285   else if ( size == 0x08000 )
285   else if ( size == 0x08000 )
286286      thom_cart_nb_banks = 2;
287   else if ( size == 0x10000 )
287   else if ( size == 0x10000 )
288288      thom_cart_nb_banks = 4;
289   else
289   else
290290   {
291291      logerror( "to7_cartridge_load: invalid cartridge size %i\n", size );
292292      return INIT_FAIL;
293293   }
294294
295   if ( image_fread( image, pos, size ) != size )
295   if ( image_fread( image, pos, size ) != size )
296296   {
297297      logerror( "to7_cartridge_load: read error\n" );
298298      return INIT_FAIL;
r1461r1462
307307   /* sanitize name */
308308   for ( i = 0; name[i]; i++)
309309   {
310      if ( name[i] < ' ' || name[i] >= 127 )
310      if ( name[i] < ' ' || name[i] >= 127 )
311311         name[i] = '?';
312312   }
313   
313
314314   PRINT (( "to7_cartridge_load: cartridge \"%s\" banks=%i, size=%i\n", name, thom_cart_nb_banks, size ));
315315
316316   return INIT_PASS;
r1461r1462
322322{
323323   static int old_bank = -1;
324324   int bank = 0;
325   if ( thom_cart_nb_banks )
325   if ( thom_cart_nb_banks )
326326   {
327327      bank = thom_cart_bank % thom_cart_nb_banks;
328328      memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, to7_cartridge_r );
r1461r1462
342342/* write signal to 0000-1fff generates a bank switch */
343343WRITE8_HANDLER ( to7_cartridge_w )
344344{
345   if ( offset >= 0x2000 )
345   if ( offset >= 0x2000 )
346346      return;
347347
348348   thom_cart_bank = offset & 3;
r1461r1462
372372   thom_set_mode_point( data & 1 );          /* bit 0: video bank switch */
373373   thom_set_caps_led( (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */
374374   thom_set_border_color( ((data & 0x10) ? 1 : 0) | /* bits 4-6: border color */
375                ((data & 0x20) ? 2 : 0) |
375                ((data & 0x20) ? 2 : 0) |
376376                ((data & 0x40) ? 4 : 0) );
377377}
378378
r1461r1462
402402
403403
404404
405static const mc6846_interface to7_timer =
406{
407   to7_timer_port_out, NULL, to7_timer_cp2_out,
408   to7_timer_port_in, to7_timer_tco_out,
409   thom_irq_0
405static const mc6846_interface to7_timer =
406{
407   to7_timer_port_out, NULL, to7_timer_cp2_out,
408   to7_timer_port_in, to7_timer_tco_out,
409   thom_irq_0
410410};
411411
412412
r1461r1462
423423
424424static void to7_lightpen_cb ( int step )
425425{
426   if ( ! to7_lightpen )
426   if ( ! to7_lightpen )
427427      return;
428428
429429#if VERBOSE_VIDEO
430430   logerror( "%f to7_lightpen_cb: step=%i\n", attotime_to_double(timer_get_time()), step );
431431#endif
432   
432
433433   pia_set_input_cb1( THOM_PIA_SYS, 1 );
434434   pia_set_input_cb1( THOM_PIA_SYS, 0 );
435435   to7_lightpen_step = step;
r1461r1462
459459
460460
461461static WRITE8_HANDLER ( to7_sys_cb2_out )
462{
462{
463463   to7_lightpen = !data;
464464}
465465
466466
467467
468468static WRITE8_HANDLER ( to7_sys_portb_out )
469{
469{
470470   /* value fetched in to7_sys_porta_in */
471471}
472472
r1461r1462
478478
479479static READ8_HANDLER ( to7_sys_porta_in )
480480{
481   if ( to7_lightpen )
481   if ( to7_lightpen )
482482   {
483483      /* lightpen hi */
484484      return to7_lightpen_gpl( TO7_LIGHTPEN_DECAL, to7_lightpen_step ) >> 8;
485485   }
486   else
486   else
487487   {
488488      /* keyboard  */
489489      int keyline = pia_get_output_b( THOM_PIA_SYS );
r1461r1462
495495            val &= readinputport( THOM_INPUT_KEYBOARD + i );
496496      }
497497      return val;
498   }
498   }
499499}
500500
501501
r1461r1462
508508
509509
510510
511static const pia6821_interface to7_sys =
511static const pia6821_interface to7_sys =
512512{
513   to7_sys_porta_in, to7_sys_portb_in,
513   to7_sys_porta_in, to7_sys_portb_in,
514514   NULL, NULL, NULL, NULL,
515515   NULL, to7_sys_portb_out, to7_set_cassette_motor, to7_sys_cb2_out,
516516   thom_firq_1, thom_firq_1
r1461r1462
532532
533533
534534
535typedef enum
535typedef enum
536536{
537537   TO7_IO_NONE,
538538   TO7_IO_CENTRONICS,
r1461r1462
569569{
570570   int tx  = data & 1;
571571   int dtr = ( data & 2 ) ? 1 : 0;
572   
572
573573#if VERBOSE_IO
574574   logerror( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  activecpu_get_previouspc(), attotime_to_double(timer_get_time()), tx, dtr );
575575#endif
576576
577   if ( dtr )
577   if ( dtr )
578578      to7_io_line.State |=  SERIAL_STATE_DTR;
579   else       
579   else
580580      to7_io_line.State &= ~SERIAL_STATE_DTR;
581581
582582   set_out_data_bit( to7_io_line.State, tx );
r1461r1462
590590   int cts = 1;
591591   int dsr = ( to7_io_line.input_state & SERIAL_STATE_DSR ) ? 0 : 1;
592592   int rd  = get_in_data_bit( to7_io_line.input_state );
593   
593
594594   if ( to7_io_mode() == TO7_IO_RS232 )
595595      cts = to7_io_line.input_state & SERIAL_STATE_CTS ? 0 : 1;
596596   else
597597      cts = ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY ) ? 1 : 0;
598 
598
599599#if VERBOSE_IO
600600   logerror( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_io_mode(), cts, dsr, rd );
601601#endif
602   
602
603603   return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0);
604604}
605605
r1461r1462
609609{
610610   /* set 8-bit data */
611611
612#if VERBOSE_IO     
612#if VERBOSE_IO
613613   logerror( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
614614#endif
615615
r1461r1462
622622{
623623  /* send STROBE to printer */
624624
625#if VERBOSE_IO     
625#if VERBOSE_IO
626626   logerror( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
627627#endif
628628
r1461r1462
644644
645645
646646
647static const pia6821_interface to7_io =
647static const pia6821_interface to7_io =
648648{
649649   to7_io_porta_in, NULL, NULL, NULL, NULL, NULL,
650650   to7_io_porta_out, to7_io_portb_out, NULL, to7_io_cb2_out,
r1461r1462
659659
660660static void thom_centronics_reset( void )
661661{
662   centronics_write_handshake
663      ( 0,
662   centronics_write_handshake
663      ( 0,
664664        CENTRONICS_SELECT | CENTRONICS_NOT_BUSY | CENTRONICS_STROBE,
665665        CENTRONICS_SELECT | CENTRONICS_NO_RESET | CENTRONICS_NOT_BUSY |
666666        CENTRONICS_STROBE | CENTRONICS_ACKNOWLEDGE );
r1461r1462
748748
749749
750750
751static const pia6821_interface to7_pia_modem =
751static const pia6821_interface to7_pia_modem =
752752{
753753   NULL, NULL, NULL, NULL, NULL, NULL,
754   NULL, NULL, NULL, NULL,
754   NULL, NULL, NULL, NULL,
755755   NULL, NULL
756756};
757757
758758
759759
760static const struct acia6850_interface to7_acia_modem =
760static const struct acia6850_interface to7_acia_modem =
761761{
762762   1200, 1200, /* 1200 bauds, might be divided by 16 */
763763   &to7_modem_rx, &to7_modem_tx,
r1461r1462
797797{
798798   if ( readinputport( THOM_INPUT_MCONFIG ) & 1 )
799799      return mea8000_r( offset );
800   else
800   else
801801   {
802802      switch ( offset ) {
803803      case 0: return acia6850_0_stat_r( 0 );
r1461r1462
813813{
814814   if ( readinputport( THOM_INPUT_MCONFIG ) & 1 )
815815      mea8000_w( offset, data );
816   else
816   else
817817   {
818818      switch ( offset ) {
819819      case 0: acia6850_0_ctrl_w( 0, data ); break;
r1461r1462
827827/* ------------ SX 90-018 (model 2) music & game extension ------------ */
828828
829829/* features:
830   - 6821 PIA
830   - 6821 PIA
831831   - two 8-position, 2-button game pads
832832   - 2-button mouse (exclusive with pads)
833833     do not confuse with the TO9-specific mouse
r1461r1462
854854   axis rotation. The two signals are not in phase, so that whether A is
855855   toggled before B or B before A gives the direction of rotation.
856856   This is similar Atari & Amiga mouses.
857   Returns: 0 0 0 0 0 0 YB XB YA XA
857   Returns: 0 0 0 0 0 0 YB XB YA XA
858858 */
859859static UINT8 to7_get_mouse_signal( void )
860860{
r1461r1462
880880static READ8_HANDLER ( to7_game_porta_in )
881881{
882882   UINT8 data;
883   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
883   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
884884   {
885885      /* mouse */
886886      data = to7_get_mouse_signal() & 0x0c;             /* XB, YB */
887887      data |= readinputport( THOM_INPUT_GAME + 4 ) & 3; /* buttons */
888888   }
889   else
889   else
890890   {
891891      /* joystick */
892892      data = readinputport( THOM_INPUT_GAME );
r1461r1462
896896         bit 3=0 => P1 right   bit 7=0 => P2 right
897897      */
898898      /* remove impossible combinations: up+down, left+right */
899      if ( ! ( data & 0x03 ) )
899      if ( ! ( data & 0x03 ) )
900900         data |= 0x03;
901      if ( ! ( data & 0x0c ) )
901      if ( ! ( data & 0x0c ) )
902902         data |= 0x0c;
903      if ( ! ( data & 0x30 ) )
903      if ( ! ( data & 0x30 ) )
904904         data |= 0x30;
905      if ( ! ( data & 0xc0 ) )
905      if ( ! ( data & 0xc0 ) )
906906         data |= 0xc0;
907      if ( ! ( data & 0x03 ) )
907      if ( ! ( data & 0x03 ) )
908908         data |= 0x03;
909      if ( ! ( data & 0x0c ) )
909      if ( ! ( data & 0x0c ) )
910910         data |= 0x0c;
911      if ( ! ( data & 0x30 ) )
911      if ( ! ( data & 0x30 ) )
912912         data |= 0x30;
913913      if ( ! ( data & 0xc0 ) )
914914         data |= 0xc0;
r1461r1462
921921static READ8_HANDLER ( to7_game_portb_in )
922922{
923923   UINT8 data;
924   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
924   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
925925   {
926926      /* mouse */
927927      UINT8 mouse =  to7_get_mouse_signal();
928928      data = 0;
929      if ( mouse & 1 )
929      if ( mouse & 1 )
930930         data |= 0x04; /* XA */
931      if ( mouse & 2 )
931      if ( mouse & 2 )
932932         data |= 0x40; /* YA */
933933   }
934   else
934   else
935935   {
936936      /* joystick */
937937      /* bits 6-7: action buttons A (0=pressed) */
r1461r1462
955955
956956
957957static WRITE8_HANDLER ( to7_game_cb2_out )
958{
958{
959959   /* undocumented */
960960   /* some TO8 games (e.g.: F15) seem to write here a lot */
961961}
962962
963963
964964
965static const pia6821_interface to7_game =
965static const pia6821_interface to7_game =
966966{
967967   to7_game_porta_in, to7_game_portb_in,
968968   NULL, NULL, NULL, NULL,
r1461r1462
975975/* this should be called periodically */
976976static TIMER_CALLBACK(to7_game_update_cb)
977977{
978   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
978   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
979979   {
980980      /* mouse */
981981      UINT8 mouse = to7_get_mouse_signal();
982982      pia_set_input_ca1( THOM_PIA_GAME, (mouse & 1) ? 1 : 0 ); /* XA */
983983      pia_set_input_ca2( THOM_PIA_GAME, (mouse & 2) ? 1 : 0 ); /* YA */
984984   }
985   else
985   else
986986   {
987987      /* joystick */
988988      UINT8 in = readinputport( THOM_INPUT_GAME );
r1461r1462
10511051
10521052   Emulation is based on the Motorola 6850 documentation, not EF 6850.
10531053
1054   We do not emulate the seral line but pass bytes directly between the
1054   We do not emulate the seral line but pass bytes directly between the
10551055   6850 registers and the MIDI device.
10561056*/
10571057
r1461r1462
10681068{
10691069   if ( (to7_midi_intr & 4) && (to7_midi_status & ACIA_6850_RDRF) )
10701070      to7_midi_status |= ACIA_6850_irq; /* byte received interrupt */
1071   
1071
10721072   if ( (to7_midi_intr & 4) && (to7_midi_status & ACIA_6850_OVRN) )
10731073      to7_midi_status |= ACIA_6850_irq; /* overrun interrupt */
1074   
1074
10751075   if ( (to7_midi_intr & 3) == 1 && (to7_midi_status & ACIA_6850_TDRE) )
10761076      to7_midi_status |= ACIA_6850_irq; /* ready to transmit interrupt */
1077   
1077
10781078   thom_irq_4( to7_midi_status & ACIA_6850_irq );
10791079}
10801080
r1461r1462
10831083static void to7_midi_byte_received_cb( chardev_err s )
10841084{
10851085   to7_midi_status |= ACIA_6850_RDRF;
1086   if ( s == CHARDEV_OVERFLOW )
1086   if ( s == CHARDEV_OVERFLOW )
10871087      to7_midi_overrun = 1;
10881088   to7_midi_update_irq();
10891089}
r1461r1462
10931093static void to7_midi_ready_to_send_cb( void )
10941094{
10951095   to7_midi_status |= ACIA_6850_TDRE;
1096   to7_midi_update_irq(); 
1096   to7_midi_update_irq();
10971097}
10981098
10991099
r1461r1462
11011101READ8_HANDLER ( to7_midi_r )
11021102{
11031103   /* ACIA 6850 registers */
1104   
1105   switch ( offset )
1104
1105   switch ( offset )
11061106   {
1107     
1107
11081108   case 0: /* get status */
11091109      /* bit 0:     data received */
11101110      /* bit 1:     ready to transmit data */
r1461r1462
11151115      /* bit 6:     parity error (ignored) */
11161116      /* bit 7:     interrupt */
11171117#if VERBOSE_MIDI
1118      logerror( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
1118      logerror( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
11191119           activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to7_midi_status,
1120           (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0,
1120           (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0,
11211121           (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0,
1122           (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0,
1122           (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0,
11231123           (to7_midi_status & ACIA_6850_irq) ? 1 : 0 );
11241124#endif
11251125      return to7_midi_status;
1126     
11271126
1127
11281128   case 1: /* get input data */
11291129   {
11301130      UINT8 data = chardev_in( to7_midi_chardev );
11311131      to7_midi_status &= ~(ACIA_6850_irq | ACIA_6850_RDRF);
1132      if ( to7_midi_overrun )
1132      if ( to7_midi_overrun )
11331133         to7_midi_status |= ACIA_6850_OVRN;
1134      else
1134      else
11351135         to7_midi_status &= ~ACIA_6850_OVRN;
11361136      to7_midi_overrun = 0;
11371137#if VERBOSE_MIDI
1138      logerror( "$%04x %f to7_midi_r: read data $%02X\n",
1138      logerror( "$%04x %f to7_midi_r: read data $%02X\n",
11391139           activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
11401140#endif
11411141      to7_midi_update_irq();
11421142      return data;
11431143   }
1144   
11451144
1146   default:
1145
1146   default:
11471147      logerror( "$%04x to7_midi_r: invalid offset %i\n",
11481148           activecpu_get_previouspc(),  offset );
11491149      return 0;
r1461r1462
11551155WRITE8_HANDLER ( to7_midi_w )
11561156{
11571157   /* ACIA 6850 registers */
1158   
1159   switch ( offset )
1158
1159   switch ( offset )
11601160   {
1161     
1161
11621162   case 0: /* set control */
11631163      /* bits 0-1: clock divide (ignored) or reset */
1164      if ( (data & 3) == 3 )
1164      if ( (data & 3) == 3 )
11651165      {
11661166         /* reset */
11671167#if VERBOSE_MIDI
r1461r1462
11721172         to7_midi_intr = 0;
11731173         chardev_reset( to7_midi_chardev );
11741174      }
1175      else
1175      else
11761176      {
11771177         /* bits 2-4: parity  */
11781178         /* bits 5-6: interrupt on transmit */
r1461r1462
11831183            static const int bits[8] = { 7,7,7,7,8,8,8,8 };
11841184            static const int stop[8] = { 2,2,1,1,2,1,1,1 };
11851185            static const char parity[8] = { 'e','o','e','o','-','-','e','o' };
1186            logerror( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
1186            logerror( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
11871187                 activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
1188                 data,
1188                 data,
11891189                 bits[ (data >> 2) & 7 ],
11901190                 stop[ (data >> 2) & 7 ],
11911191                 parity[ (data >> 2) & 7 ],
1192                 to7_midi_intr >> 2,
1192                 to7_midi_intr >> 2,
11931193                 (to7_midi_intr & 3) ? 1 : 0);
11941194         }
11951195#endif
11961196      }
11971197      to7_midi_update_irq();
11981198      break;
1199   
12001199
1200
12011201   case 1: /* output data */
12021202#if VERBOSE_MIDI
12031203      logerror( "$%04x %f to7_midi_w: write data $%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
12041204#endif
1205      if ( data == 0x55 )
1205      if ( data == 0x55 )
12061206         /* cable-detect: shortcut */
12071207         chardev_fake_in( to7_midi_chardev, 0x55 );
1208      else
1208      else
12091209      {
12101210         /* send to MIDI */
12111211         to7_midi_status &= ~(ACIA_6850_irq | ACIA_6850_TDRE);
1212         chardev_out( to7_midi_chardev, data );
1212         chardev_out( to7_midi_chardev, data );
12131213      }
12141214      break;
1215   
1216     
1217   default:
1215
1216
1217   default:
12181218      logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", activecpu_get_previouspc(), offset, data );
12191219   }
12201220}
12211221
12221222
12231223
1224static chardev_interface to7_midi_interface =
1224static chardev_interface to7_midi_interface =
12251225{
12261226   to7_midi_byte_received_cb,
12271227   to7_midi_ready_to_send_cb,
r1461r1462
12951295MACHINE_RESET ( to7 )
12961296{
12971297   LOG (( "to7: machine reset called\n" ));
1298   
1298
12991299   /* subsystems */
13001300   thom_irq_reset();
13011301   pia_reset();
r1461r1462
13071307   to7_midi_reset();
13081308   to7_rf57932_reset();
13091309   mea8000_reset();
1310   
1310
13111311   /* video */
13121312   thom_set_video_mode( THOM_VMODE_TO770 );
13131313   thom_set_init_callback( to7_set_init );
r1461r1462
13151315   thom_set_mode_point( 0 );
13161316   thom_set_border_color( 0 );
13171317   pia_set_input_cb1( THOM_PIA_SYS, 0 );
1318   
1318
13191319   /* memory */
13201320   to7_update_cart_bank();
13211321   /* thom_cart_bank not reset */
1322   
1322
13231323   /* lightpen */
13241324   to7_lightpen = 0;
13251325}
r1461r1462
13291329MACHINE_START ( to7 )
13301330{
13311331   UINT8* mem = memory_region(REGION_CPU1);
1332   
1332
13331333   LOG (( "to7: machine start called\n" ));
1334   
1334
13351335   /* subsystems */
13361336   thom_irq_init();
13371337   pia_config( THOM_PIA_SYS, &to7_sys );
r1461r1462
13431343   to7_midi_init();
13441344   to7_rf57932_init();
13451345   mea8000_config( THOM_SOUND_SPEECH, NULL );
1346   
1346
13471347   /* memory */
13481348   thom_cart_bank = 0;
13491349   thom_vram = mess_ram;
r1461r1462
13511351   memory_configure_bank( THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 );
13521352   memory_configure_bank( THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 );
13531353   memory_set_bank( THOM_BASE_BANK, 0 );
1354   
1355   if ( mess_ram_size > 24*1024 )
1354
1355   if ( mess_ram_size > 24*1024 )
13561356   {
13571357      /* install 16 KB or 16 KB + 8 KB memory extensions */
13581358      /* BASIC instruction to see free memory: ?FRE(0) */
13591359      int extram = mess_ram_size - 24*1024;
1360      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0,
1360      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0,
13611361                      (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) );
1362      memory_install_read8_handler(  0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0,
1362      memory_install_read8_handler(  0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000 + extram - 1, 0, 0,
13631363                      (read8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) );
13641364      memory_configure_bank( THOM_RAM_BANK,  0, 1, mess_ram + 0x6000, extram );
13651365      memory_set_bank( THOM_RAM_BANK, 0 );
13661366   }
1367   
1367
13681368   /* force 2 topmost color bits to 1 */
13691369   memset( thom_vram + 0x2000, 0xc0, 0x2000 );
13701370
r1461r1462
13881388
13891389
13901390static WRITE8_HANDLER ( to770_sys_cb2_out )
1391{
1391{
13921392   /* video overlay: black pixels are transparent and show TV image underneath */
13931393   LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", activecpu_get_previouspc(), data ));
13941394}
r1461r1462
13971397
13981398static READ8_HANDLER ( to770_sys_porta_in )
13991399{
1400   /* keyboard */   
1400   /* keyboard */
14011401   int keyline = pia_get_output_b( THOM_PIA_SYS ) & 7;
14021402   return readinputport( THOM_INPUT_KEYBOARD + 7 - keyline );
14031403}
r1461r1462
14101410   static int old_bank = -1;
14111411   int bank;
14121412
1413   switch (portb & 0xf8)
1413   switch (portb & 0xf8)
14141414   {
14151415      /* 2 * 16 KB internal RAM */
14161416   case 0xf0: bank = 0; break;
r1461r1462
14251425      /* none selected */
14261426   case 0xf8: return;
14271427
1428   default: 
1429      logerror( "to770_update_ram_bank unknown bank $%02X\n", portb & 0xf8 );
1428   default:
1429      logerror( "to770_update_ram_bank unknown bank $%02X\n", portb & 0xf8 );
14301430      return;
14311431   }
14321432
r1461r1462
14361436#endif
14371437
14381438   memory_set_bank( THOM_RAM_BANK, bank );
1439   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0,
1439   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0,
14401440                   (mess_ram_size == 128*1024 || bank < 2) ?
14411441                   (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) : MWA8_UNMAP );
14421442   old_bank = bank;
r1461r1462
14451445
14461446
14471447static WRITE8_HANDLER ( to770_sys_portb_out )
1448{
1448{
14491449   to770_update_ram_bank();
14501450}
14511451
14521452
14531453
1454static const pia6821_interface to770_sys =
1454static const pia6821_interface to770_sys =
14551455{
14561456   to770_sys_porta_in, NULL,
14571457   NULL, NULL, NULL, NULL,
r1461r1462
14701470   thom_set_mode_point( data & 1 );          /* bit 0: video bank switch */
14711471   thom_set_caps_led( (data & 8) ? 1 : 0 ) ; /* bit 3: keyboard led */
14721472   thom_set_border_color( ((data & 0x10) ? 1 : 0) | /* 4-bit border color */
1473                ((data & 0x20) ? 2 : 0) |
1473                ((data & 0x20) ? 2 : 0) |
14741474                ((data & 0x40) ? 4 : 0) |
14751475                ((data & 0x04) ? 0 : 8) );
14761476}
14771477
14781478
14791479
1480static const mc6846_interface to770_timer =
1481{
1482   to770_timer_port_out, NULL, to7_timer_cp2_out,
1483   to7_timer_port_in, to7_timer_tco_out,
1480static const mc6846_interface to770_timer =
1481{
1482   to770_timer_port_out, NULL, to7_timer_cp2_out,
1483   to7_timer_port_in, to7_timer_tco_out,
14841484   thom_irq_0
14851485};
14861486
r1461r1462
14991499   inil  = to7_lightpen ? l.inil  : v.inil;
15001500   init  = to7_lightpen ? l.init  : v.init;
15011501   lt3   = to7_lightpen ? l.lt3   : v.lt3;
1502   
1503   switch ( offset )
1502
1503   switch ( offset )
15041504   {
15051505   case 0: return (count >> 8) & 0xff;
15061506   case 1: return count & 0xff;
r1461r1462
15161516
15171517WRITE8_HANDLER ( to770_gatearray_w )
15181518{
1519   if ( ! offset )
1519   if ( ! offset )
15201520      to7_lightpen = data & 1;
15211521}
15221522
r1461r1462
15541554   to7_update_cart_bank();
15551555   to770_update_ram_bank();
15561556   /* thom_cart_bank not reset */
1557
1557
15581558   /* lightpen */
15591559   to7_lightpen = 0;
15601560}
r1461r1462
16111611static void mo5_lightpen_cb ( int step )
16121612{
16131613   /* MO5 signals ca1 (TO7 signals cb1) */
1614   if ( ! to7_lightpen )
1614   if ( ! to7_lightpen )
16151615      return;
16161616
16171617   pia_set_input_ca1( THOM_PIA_SYS, 1 );
r1461r1462
16221622
16231623/* ------------ periodic interrupt ------------ */
16241624
1625/* the MO5 & MO6 do not have a MC 6846 timer,
1625/* the MO5 & MO6 do not have a MC 6846 timer,
16261626   they have a fixed 50 Hz timer instead
16271627*/
16281628
r1461r1462
16541654
16551655
16561656static WRITE8_HANDLER ( mo5_sys_porta_out )
1657{
1657{
16581658   thom_set_mode_point( data & 1 );               /* bit 0: video bank switch */
16591659   thom_set_border_color( (data >> 1) & 15 );     /* bit 1-4: border color */
16601660   mo5_set_cassette( (data & 0x40) ? 1 : 0 );     /* bit 6: cassette output */
r1461r1462
16641664
16651665static READ8_HANDLER ( mo5_sys_porta_in )
16661666{
1667   return
1667   return
16681668      (mo5_get_cassette() ? 0x80 : 0) |     /* bit 7: cassette input */
1669      ((readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 0x20 : 0)
1669      ((readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 0x20 : 0)
16701670      /* bit 5: lightpen button */;
16711671}
16721672
16731673
16741674
16751675static WRITE8_HANDLER ( mo5_sys_portb_out )
1676{
1676{
16771677   DAC_data_w( THOM_SOUND_BUZ, (data & 1) ? 0x80 : 0); /* 1-bit buzzer */
16781678}
16791679
r1461r1462
16891689
16901690
16911691
1692static const pia6821_interface mo5_sys =
1692static const pia6821_interface mo5_sys =
16931693{
16941694   mo5_sys_porta_in, mo5_sys_portb_in,
16951695   NULL, NULL, NULL, NULL,
r1461r1462
17321732
17331733WRITE8_HANDLER ( mo5_gatearray_w )
17341734{
1735   if ( ! offset )
1735   if ( ! offset )
17361736      to7_lightpen = data & 1;
17371737}
17381738
r1461r1462
17541754   char name[129];
17551755
17561756   /* get size & number of 16-KB banks */
1757   if ( size > 32 && size <= 0x04000 )
1757   if ( size > 32 && size <= 0x04000 )
17581758      thom_cart_nb_banks = 1;
1759   else if ( size == 0x08000 )
1759   else if ( size == 0x08000 )
17601760      thom_cart_nb_banks = 2;
1761   else if ( size == 0x10000 )
1761   else if ( size == 0x10000 )
17621762      thom_cart_nb_banks = 4;
1763   else
1763   else
17641764   {
17651765      logerror( "mo5_cartridge_load: invalid cartridge size %u\n", (unsigned) size );
17661766      return INIT_FAIL;
17671767   }
17681768
1769   if ( image_fread( image, pos, size ) != size )
1769   if ( image_fread( image, pos, size ) != size )
17701770   {
17711771      logerror( "mo5_cartridge_load: read error\n" );
17721772      return INIT_FAIL;
r1461r1462
17751775   /* extract name */
17761776   i = size - 32;
17771777   while ( i < size && !pos[i] ) i++;
1778   for ( j = 0; i < size && pos[i] >= 0x20; j++, i++)
1778   for ( j = 0; i < size && pos[i] >= 0x20; j++, i++)
17791779      name[j] = pos[i];
17801780   name[j] = 0;
17811781
r1461r1462
18011801   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0,
18021802                  (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) );
18031803
1804   if ( rom_is_ram && thom_cart_nb_banks == 4 )
1804   if ( rom_is_ram && thom_cart_nb_banks == 4 )
18051805   {
18061806      /* 64 KB ROM from "JANE" cartridge */
18071807      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, MWA8_NOP );
r1461r1462
18111811         logerror( "mo5_update_cart_bank: CART is cartridge bank %i (A7CB style)\n", bank );
18121812#endif
18131813   }
1814   else if ( rom_is_ram )
1814   else if ( rom_is_ram )
18151815   {
18161816      /* 64 KB RAM from network extension */
18171817      int write_enable = mo5_reg_cart & 8;
18181818      bank = 4 + ( mo5_reg_cart & 3 );
1819      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ?
1819      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ?
18201820                      (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :  MWA8_NOP );
18211821#if VERBOSE_BANK
18221822      if ( bank != old_bank )
18231823         logerror( "mo5_update_cart_bank: CART is nanonetwork RAM bank %i (write-enable=%i)\n", mo5_reg_cart & 3, write_enable ? 1 : 0 );
18241824#endif
18251825   }
1826   else
1826   else
18271827   {
18281828      /* regular cartridge bank switch */
18291829      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, mo5_cartridge_w );
1830      if ( thom_cart_nb_banks )
1830      if ( thom_cart_nb_banks )
18311831      {
18321832         bank = thom_cart_bank % thom_cart_nb_banks;
18331833         memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xbffc, 0xbfff, 0, 0, mo5_cartridge_r );
r1461r1462
18461846/* write signal to b000-cfff generates a bank switch */
18471847WRITE8_HANDLER ( mo5_cartridge_w )
18481848{
1849   if ( offset >= 0x2000 )
1849   if ( offset >= 0x2000 )
18501850      return;
18511851
18521852   thom_cart_bank = offset & 3;
r1461r1462
19051905   pia_set_input_ca1( THOM_PIA_SYS, 0 );
19061906
19071907   /* memory */
1908   mo5_update_cart_bank();
1908   mo5_update_cart_bank();
19091909   /* mo5_reg_cart not reset */
19101910   /* thom_cart_bank not reset */
19111911
r1461r1462
19181918MACHINE_START ( mo5 )
19191919{
19201920   UINT8* mem = memory_region(REGION_CPU1);
1921 
1921
19221922   LOG (( "mo5: machine start called\n" ));
19231923
19241924   /* subsystems */
r1461r1462
20002000   init  = to7_lightpen ? l.init  : v.init;
20012001   lt3   = to7_lightpen ? l.lt3   : v.lt3;
20022002
2003   switch ( offset )
2003   switch ( offset )
20042004   {
20052005   case 0: return (count >> 8) & 0xff;
20062006   case 1: return count & 0xff;
r1461r1462
20162016
20172017WRITE8_HANDLER ( to9_gatearray_w )
20182018{
2019   if ( ! offset )
2019   if ( ! offset )
20202020      to7_lightpen = data & 1;
20212021}
20222022
r1461r1462
20342034/* style: 0 => TO9, 1 => TO8/TO9, 2 => MO6 */
20352035static void to9_set_video_mode( UINT8 data, int style )
20362036{
2037   switch ( data & 0x7f )
2037   switch ( data & 0x7f )
20382038   {
2039   case 0x00:
2040      if ( style == 2 )     
2039   case 0x00:
2040      if ( style == 2 )
20412041         thom_set_video_mode( THOM_VMODE_MO5 );
20422042      else if ( style == 1 )
20432043         thom_set_video_mode( THOM_VMODE_TO770 );
2044      else                   
2044      else
20452045         thom_set_video_mode( THOM_VMODE_TO9 );
20462046      break;
20472047
20482048   case 0x21: thom_set_video_mode( THOM_VMODE_BITMAP4 );     break;
20492049
2050   case 0x41: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT ); break;
2050   case 0x41: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT ); break;
20512051
20522052   case 0x2a:
2053      if ( style==0 )
2053      if ( style==0 )
20542054         thom_set_video_mode( THOM_VMODE_80_TO9 );
2055      else           
2055      else
20562056         thom_set_video_mode( THOM_VMODE_80 );
20572057      break;
20582058
r1461r1462
20752075
20762076READ8_HANDLER  ( to9_vreg_r )
20772077{
2078   switch ( offset )
2078   switch ( offset )
20792079   {
20802080
20812081   case 0: /* palette data */
r1461r1462
21062106   logerror( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset, 0xe7da + offset, data );
21072107#endif
21082108
2109   switch ( offset )
2109   switch ( offset )
21102110   {
21112111
21122112   case 0: /* palette data */
r1461r1462
21222122   }
21232123   break;
21242124
2125   case 1: /* palette address */
2125   case 1: /* palette address */
21262126      to9_palette_idx = data & 31;
21272127      break;
21282128
r1461r1462
21662166   /* reset cartridge read handler */
21672167   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) );
21682168
2169   switch ( slot )
2169   switch ( slot )
21702170   {
21712171   case 0:
21722172      /* BASIC (64 KB) */
r1461r1462
21942194      break;
21952195   case 3:
21962196      /* external cartridge */
2197      if ( thom_cart_nb_banks )
2197      if ( thom_cart_nb_banks )
21982198      {
21992199         bank = thom_cart_bank % thom_cart_nb_banks;
22002200         memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, to7_cartridge_r );
r1461r1462
22172217{
22182218   int slot = ( mc6846_get_output_port() >> 4 ) & 3; /* bits 4-5: ROM bank */
22192219
2220   if ( offset >= 0x2000 )
2220   if ( offset >= 0x2000 )
22212221      return;
22222222
2223   if ( slot == 3 )
2223   if ( slot == 3 )
22242224      thom_cart_bank = offset & 3;
2225   else
2225   else
22262226      to9_soft_bank = offset & 3;
22272227   to9_update_cart_bank();
22282228}
r1461r1462
22492249   UINT8 disk = ((port >> 2) & 1) | ((port >> 5) & 2); /* bits 6,2: RAM bank */
22502250   int bank;
22512251
2252   switch ( portb & 0xf8 )
2252   switch ( portb & 0xf8 )
22532253   {
22542254      /* TO7/70 compatible */
22552255   case 0xf0: bank = 0; break;
r1461r1462
22752275      logerror( "to9_update_ram_bank: bank %i selected (pia=$%02X disk=%i)\n", bank, portb & 0xf8, disk );
22762276#endif
22772277
2278   memory_set_bank( THOM_RAM_BANK, bank );
2279   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0,
2280                   (mess_ram_size == 192*1024 || bank < 6) ?
2278   memory_set_bank( THOM_RAM_BANK, bank );
2279   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xdfff, 0, 0,
2280                   (mess_ram_size == 192*1024 || bank < 6) ?
22812281                   (write8_handler)(STATIC_BANK1 + THOM_RAM_BANK - 1) : MWA8_NOP );
22822282   old_bank = bank;
22832283}
r1461r1462
22892289/* The 6805 chip scans the keyboard and sends ASCII codes to the 6909.
22902290   Data between the 6809 and 6805 is serialized at 9600 bauds.
22912291   On the 6809 side, a 6850 ACIA is used.
2292   We do not emulate the seral line but pass bytes directly between the
2292   We do not emulate the seral line but pass bytes directly between the
22932293   keyboard and the 6850 registers.
22942294   Note that the keyboard protocol uses the parity bit as an extra data bit.
22952295*/
r1461r1462
23202320static UINT16 to9_mouse_x, to9_mouse_y;
23212321
23222322static UINT8  to9_kbd_last_key;  /* for key repetition */
2323static UINT16 to9_kbd_key_count;
2323static UINT16 to9_kbd_key_count;
23242324
23252325static UINT8  to9_kbd_caps;  /* caps-lock */
23262326static UINT8  to9_kbd_pad;   /* keypad outputs special codes */
23272327
2328static emu_timer* to9_kbd_timer;
2328static emu_timer* to9_kbd_timer;
23292329
23302330
23312331
r1461r1462
23342334{
23352335   int line, bit;
23362336
2337   for ( line = 0; line < 10; line++ )
2337   for ( line = 0; line < 10; line++ )
23382338   {
23392339      UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line );
23402340
2341      if ( line == 7 || line == 9 )
2341      if ( line == 7 || line == 9 )
23422342         port |= 1; /* shift & control */
23432343
23442344      for ( bit = 0; bit < 8; bit++ )
23452345      {
2346         if ( ! (port & (1 << bit)) )
2346         if ( ! (port & (1 << bit)) )
23472347            return 1;
23482348      }
23492349   }
r1461r1462
23722372{
23732373   /* ACIA 6850 registers */
23742374
2375   switch ( offset )
2375   switch ( offset )
23762376   {
23772377
23782378   case 0: /* get status */
r1461r1462
23852385      /* bit 6:     parity error */
23862386      /* bit 7:     interrupt */
23872387#if VERBOSE_KBD
2388      logerror( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n",
2388      logerror( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n",
23892389           activecpu_get_previouspc(), attotime_to_double(timer_get_time()), to9_kbd_status,
2390           (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0,
2390           (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0,
23912391           (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0,
2392           (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0,
2392           (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0,
23932393           (to9_kbd_status & ACIA_6850_PE) ? 1 : 0,
23942394           (to9_kbd_status & ACIA_6850_irq) ? 1 : 0 );
23952395#endif
r1461r1462
23972397
23982398   case 1: /* get input data */
23992399      to9_kbd_status &= ~(ACIA_6850_irq | ACIA_6850_PE);
2400      if ( to9_kbd_overrun )
2400      if ( to9_kbd_overrun )
24012401         to9_kbd_status |= ACIA_6850_OVRN;
2402      else
2402      else
24032403         to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF);
24042404      to9_kbd_overrun = 0;
24052405#if VERBOSE_KBD
r1461r1462
24082408      to9_kbd_update_irq();
24092409      return to9_kbd_in;
24102410
2411   default:
2411   default:
24122412      logerror( "$%04x to9_kbd_r: invalid offset %i\n", activecpu_get_previouspc(),  offset );
24132413      return 0;
24142414   }
r1461r1462
24202420{
24212421   /* ACIA 6850 registers */
24222422
2423   switch ( offset )
2423   switch ( offset )
24242424   {
24252425
24262426   case 0: /* set control */
24272427      /* bits 0-1: clock divide (ignored) or reset */
2428      if ( (data & 3) == 3 )
2428      if ( (data & 3) == 3 )
24292429      {
24302430         /* reset */
24312431         to9_kbd_overrun = 0;
r1461r1462
24352435         logerror( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data );
24362436#endif
24372437      }
2438      else
2438      else
24392439      {
24402440         /* bits 2-4: parity */
2441         if ( (data & 0x18) == 0x10 )
2441         if ( (data & 0x18) == 0x10 )
24422442            to9_kbd_parity = 2;
2443         else
2443         else
24442444            to9_kbd_parity = (data >> 2) & 1;
24452445         /* bits 5-6: interrupt on transmit */
24462446         /* bit 7:    interrupt on receive */
24472447         to9_kbd_intr = data >> 5;
24482448#if VERBOSE_KBD
2449         logerror( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n",
2450              activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
2451              data, to9_kbd_parity, to9_kbd_intr >> 2,
2449         logerror( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n",
2450              activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
2451              data, to9_kbd_parity, to9_kbd_intr >> 2,
24522452              (to9_kbd_intr & 3) ? 1 : 0 );
24532453#endif
24542454      }
r1461r1462
24612461      /* TODO: 1 ms delay here ? */
24622462      to9_kbd_status |= ACIA_6850_TDRE; /* data transmit ready again */
24632463      to9_kbd_update_irq();
2464   
2465      switch ( data )
2464
2465      switch ( data )
24662466      {
24672467      case 0xF8:
24682468         /* reset */
r1461r1462
24842484
24852485      thom_set_caps_led( ! to9_kbd_caps );
24862486
2487      LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n",
2487      LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n",
24882488            activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
24892489            to9_kbd_caps, to9_kbd_pad, to9_kbd_periph ));
24902490
24912491      break;
24922492
2493   default:
2493   default:
24942494      logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", activecpu_get_previouspc(), offset, data );
24952495   }
24962496}
r1461r1462
25032503*/
25042504static void to9_kbd_send ( UINT8 data, int parity )
25052505{
2506   if ( to9_kbd_status & ACIA_6850_RDRF )
2506   if ( to9_kbd_status & ACIA_6850_RDRF )
25072507   {
25082508      /* overrun will be set when the current valid byte is read */
25092509      to9_kbd_overrun = 1;
r1461r1462
25112511      logerror( "%f to9_kbd_send: overrun => drop data=$%02X, parity=%i\n", attotime_to_double(timer_get_time()), data, parity );
25122512#endif
25132513   }
2514   else
2514   else
25152515   {
25162516      /* valid byte */
25172517      to9_kbd_in = data;
r1461r1462
25302530
25312531
25322532/* keycode => TO9 code (extended ASCII), shifted and un-shifted */
2533static const int to9_kbd_code[80][2] =
2533static const int to9_kbd_code[80][2] =
25342534{
25352535   { 145, 150 }, { '_', '6' }, { 'Y', 'Y' }, { 'H', 'H' },
2536   { 11, 11 }, { 9, 9 }, { 30, 12 }, { 'N', 'N' },
2536   { 11, 11 }, { 9, 9 }, { 30, 12 }, { 'N', 'N' },
25372537
25382538   { 146, 151 }, { '(', '5' }, { 'T', 'T' }, { 'G', 'G' },
25392539   { '=', '+' }, { 8, 8 }, { 28, 28 }, { 'B', 'B' },
r1461r1462
25432543
25442544   { 148, 153 }, { '"', '3' }, { 'E', 'E' }, { 'D', 'D' },
25452545   { 161, 161 }, { 158, 158 },
2546   { 154, 154 }, { 'C', 'C' },
2546   { 154, 154 }, { 'C', 'C' },
25472547
25482548   { 144, 149 }, { 128, '2' }, { 'Z', 'Z' }, { 'S', 'S' },
25492549   { 162, 162 }, { 156, 156 },
2550   { 164, 164 }, { 'X', 'X' },
2550   { 164, 164 }, { 'X', 'X' },
25512551
25522552   { '#', '@' }, { '*', '1' }, { 'A', 'A' }, { 'Q', 'Q' },
25532553   { '[', '{' }, { 159, 159 }, { 160, 160 }, { 'W', 'W' },
25542554
25552555   { 2, 2 }, { 129, '7' }, { 'U', 'U' }, { 'J', 'J' },
25562556   { ' ', ' ' }, { 163, 163 }, { 165, 165 },
2557   { ',', '?' },
2557   { ',', '?' },
25582558
25592559   { 0, 0 }, { '!', '8' }, { 'I', 'I' }, { 'K', 'K' },
2560   { '$', '&' }, { 10, 10 }, { ']', '}' },  { ';', '.' },
2560   { '$', '&' }, { 10, 10 }, { ']', '}' },  { ';', '.' },
25612561
25622562   { 0, 0 }, { 130, '9' }, { 'O', 'O' }, { 'L', 'L' },
2563   { '-', '\\' }, { 132, '%' }, { 13, 13 }, { ':', '/' },
2563   { '-', '\\' }, { 132, '%' }, { 13, 13 }, { ':', '/' },
25642564
25652565   { 0, 0 }, { 131, '0' }, { 'P', 'P' }, { 'M', 'M' },
25662566   { ')', 134 }, { '^', 133 }, { 157, 157 }, { '>', '<' }
r1461r1462
25752575   int shift   = ! (readinputport( THOM_INPUT_KEYBOARD + 9 ) & 1);
25762576   int key = -1, line, bit;
25772577
2578   for ( line = 0; line < 10; line++ )
2578   for ( line = 0; line < 10; line++ )
25792579   {
25802580      UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line );
25812581
2582      if ( line == 7 || line == 9 )
2582      if ( line == 7 || line == 9 )
25832583         port |= 1; /* shift & control */
25842584
25852585      /* TODO: correct handling of simultaneous keystokes:
r1461r1462
25922592      }
25932593   }
25942594
2595   if ( key == -1 )
2595   if ( key == -1 )
25962596   {
25972597      to9_kbd_last_key = 0xff;
25982598      to9_kbd_key_count = 0;
25992599      return 0;
26002600   }
2601   else if ( key == 64 )
2601   else if ( key == 64 )
26022602   {
26032603      /* caps lock */
2604      if ( to9_kbd_last_key == key )
2604      if ( to9_kbd_last_key == key )
26052605         return 0; /* no repeat */
26062606
26072607      to9_kbd_last_key = key;
r1461r1462
26092609      thom_set_caps_led( ! to9_kbd_caps );
26102610      return 0;
26112611   }
2612   else
2612   else
26132613   {
26142614      int asc;
26152615      asc = to9_kbd_code[key][shift];
r1461r1462
26172617
26182618      /* keypad */
26192619      if ( ! to9_kbd_pad ) {
2620         if ( asc >= 154 && asc <= 163 ) 
2620         if ( asc >= 154 && asc <= 163 )
26212621            asc += '0' - 154;
2622         else if ( asc == 164 )
2622         else if ( asc == 164 )
26232623            asc = '.';
2624         else if ( asc == 165 )
2624         else if ( asc == 165 )
26252625            asc = 13;
26262626      }
26272627
26282628      /* shifted letter */
2629      if ( asc >= 'A' && asc <= 'Z' && ( ! to9_kbd_caps ) && ( ! shift ) )
2629      if ( asc >= 'A' && asc <= 'Z' && ( ! to9_kbd_caps ) && ( ! shift ) )
26302630         asc += 'a' - 'A';
26312631
26322632      /* control */
2633      if ( control )
2633      if ( control )
26342634         asc &= ~0x40;
26352635
2636      if ( key == to9_kbd_last_key )
2636      if ( key == to9_kbd_last_key )
26372637      {
26382638         /* repeat */
26392639         to9_kbd_key_count++;
r1461r1462
26592659
26602660static TIMER_CALLBACK(to9_kbd_timer_cb)
26612661{
2662   if ( to9_kbd_periph )
2662   if ( to9_kbd_periph )
26632663   {
26642664      /* peripherial mode: every 10 ms we send 4 bytes */
26652665
2666      switch ( to9_kbd_byte_count )
2666      switch ( to9_kbd_byte_count )
26672667      {
26682668
26692669      case 0: /* key */
r1461r1462
26942694         UINT8 data = 0;
26952695         if ( b & 1 ) data |= 1;
26962696         if ( b & 2 ) data |= 4;
2697         to9_kbd_send( data, 1 );
2697         to9_kbd_send( data, 1 );
26982698         break;
26992699      }
27002700
r1461r1462
27032703      to9_kbd_byte_count = ( to9_kbd_byte_count + 1 ) & 3;
27042704      timer_adjust( to9_kbd_timer, to9_kbd_byte_count ? TO9_KBD_BYTE_SPACE : TO9_KBD_END_SPACE, 0, attotime_never );
27052705   }
2706   else
2706   else
27072707   {
27082708      int key = to9_kbd_get_key();
27092709      /* keyboard mode: send a byte only if a key is down */
2710      if ( key )
2710      if ( key )
27112711         to9_kbd_send( key, 0 );
27122712      timer_adjust( to9_kbd_timer, TO9_KBD_POLL_PERIOD, 0, attotime_never );
27132713   }
r1461r1462
27682768   centronics_write_data( 0, data );
27692769   centronics_write_handshake( 0, (b & 2) ? CENTRONICS_STROBE : 0, CENTRONICS_STROBE );
27702770
2771#if VERBOSE_IO 
2771#if VERBOSE_IO
27722772   logerror( "$%04x %f to9_update_centronics: data=$%02X strobe=%i\n",
27732773        activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data,
27742774        (b & 2) ? 1 : 0 );
r1461r1462
27982798
27992799
28002800static WRITE8_HANDLER ( to9_sys_portb_out )
2801{
2801{
28022802   to9_update_centronics(); /* bits 0-1: printer */
28032803   to9_update_ram_bank();
28042804
r1461r1462
28102810
28112811
28122812
2813static const pia6821_interface to9_sys =
2813static const pia6821_interface to9_sys =
28142814{
28152815   to9_sys_porta_in, NULL,
28162816   NULL, NULL, NULL, NULL,
r1461r1462
28362836
28372837
28382838
2839static const mc6846_interface to9_timer =
2840{
2841   to9_timer_port_out, NULL, to7_timer_cp2_out,
2842   to7_timer_port_in, to7_timer_tco_out,
2843   thom_irq_0
2839static const mc6846_interface to9_timer =
2840{
2841   to9_timer_port_out, NULL, to7_timer_cp2_out,
2842   to7_timer_port_in, to7_timer_tco_out,
2843   thom_irq_0
28442844};
28452845
28462846
r1461r1462
28732873   thom_set_border_color( 8 );
28742874   thom_set_mode_point( 0 );
28752875   pia_set_input_cb1( THOM_PIA_SYS, 0 );
2876
2876
28772877   /* memory */
28782878   to9_soft_bank = 0;
28792879   to9_update_cart_bank();
r1461r1462
29472947   We do not emulate the 6804 but pass serialized data directly through the
29482948   PIA ports.
29492949
2950   Note: if we conform to the (scarce) documentation the CPU tend to lock
2950   Note: if we conform to the (scarce) documentation the CPU tend to lock
29512951   waitting for keyboard input.
2952   The protocol documentation is pretty scarce and does not account for these
2952   The protocol documentation is pretty scarce and does not account for these
29532953   behaviors!
29542954   The emulation code contains many hacks (delays, timeouts, spurious
29552955   pulses) to improve the stability.
r1461r1462
29882988{
29892989   int line, bit;
29902990
2991   if ( readinputport( THOM_INPUT_CONFIG ) & 2 )
2991   if ( readinputport( THOM_INPUT_CONFIG ) & 2 )
29922992      return 0; /* disabled */
29932993
2994   for ( line = 0; line < 10; line++ )
2994   for ( line = 0; line < 10; line++ )
29952995   {
29962996      UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line );
29972997
2998      if ( line == 7 || line == 9 )
2998      if ( line == 7 || line == 9 )
29992999         port |= 1; /* shift & control */
30003000
30013001      for ( bit = 0; bit < 8; bit++ )
30023002      {
3003         if ( ! (port & (1 << bit)) )
3003         if ( ! (port & (1 << bit)) )
30043004            return 1;
30053005      }
30063006   }
r1461r1462
30173017   int shift   = (readinputport( THOM_INPUT_KEYBOARD + 9 ) & 1) ? 0 : 0x080;
30183018   int key = -1, line, bit;
30193019
3020   if ( readinputport( THOM_INPUT_CONFIG ) & 2 )
3020   if ( readinputport( THOM_INPUT_CONFIG ) & 2 )
30213021      return -1; /* disabled */
30223022
3023   for ( line = 0; line < 10; line++ )
3023   for ( line = 0; line < 10; line++ )
30243024   {
30253025      UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line );
30263026
3027      if ( line == 7 || line == 9 )
3027      if ( line == 7 || line == 9 )
30283028         port |= 1; /* shift & control */
30293029
30303030      /* TODO: correct handling of simultaneous keystokes:
r1461r1462
30373037      }
30383038   }
30393039
3040   if ( key == -1 )
3040   if ( key == -1 )
30413041   {
30423042      to8_kbd_last_key = 0xff;
30433043      to8_kbd_key_count = 0;
30443044      return -1;
30453045   }
3046   else if ( key == 64 )
3046   else if ( key == 64 )
30473047   {
30483048      /* caps lock */
3049      if ( to8_kbd_last_key == key )
3049      if ( to8_kbd_last_key == key )
30503050         return -1; /* no repeat */
30513051      to8_kbd_last_key = key;
30523052      to8_kbd_caps = !to8_kbd_caps;
3053      if ( to8_kbd_caps )
3053      if ( to8_kbd_caps )
30543054         key |= 0x080; /* auto-shift */
30553055      thom_set_caps_led( ! to8_kbd_caps );
30563056      return key;
30573057   }
3058   else if ( key == to8_kbd_last_key )
3058   else if ( key == to8_kbd_last_key )
30593059   {
30603060      /* repeat */
30613061      to8_kbd_key_count++;
r1461r1462
30633063         return -1;
30643064      return key | shift | control;
30653065   }
3066   else
3066   else
30673067   {
30683068      to8_kbd_last_key = key;
30693069      to8_kbd_key_count = 0;
r1461r1462
30763076   0     = idle, key polling
30773077   1     = wait for ack to go down (key to send)
30783078   99-117 = key data transmit
3079   91-117 = signal
3079   91-117 = signal
30803080   255    = timeout
30813081*/
30823082
r1461r1462
30893089   logerror( "%f to8_kbd_timer_cb: step=%i ack=%i data=$%03X\n", attotime_to_double(timer_get_time()), to8_kbd_step, to8_kbd_ack, to8_kbd_data );
30903090#endif
30913091
3092   if( ! to8_kbd_step )
3092   if( ! to8_kbd_step )
30933093   {
30943094      /* key polling */
30953095      int k = to8_kbd_get_key();
30963096      /* if not in transfer, send pulse from time to time
30973097         (helps avoiding CPU lock)
30983098      */
3099      if ( ! to8_kbd_ack )
3099      if ( ! to8_kbd_ack )
31003100         mc6846_set_input_cp1( 0 );
31013101      mc6846_set_input_cp1( 1 );
31023102
3103      if ( k == -1 )
3103      if ( k == -1 )
31043104         d = TO8_KBD_POLL_PERIOD;
3105      else
3105      else
31063106      {
31073107         /* got key! */
31083108#if VERBOSE_KBD
r1461r1462
31133113         d = ATTOTIME_IN_USEC( 100 );
31143114      }
31153115   }
3116   else if ( to8_kbd_step == 255 )
3116   else if ( to8_kbd_step == 255 )
31173117   {
31183118      /* timeout */
31193119      to8_kbd_last_key = 0xff;
r1461r1462
31223122      mc6846_set_input_cp1( 1 );
31233123      d = TO8_KBD_POLL_PERIOD;
31243124   }
3125   else if ( to8_kbd_step == 1 )
3125   else if ( to8_kbd_step == 1 )
31263126   {
31273127      /* schedule timeout waiting for ack to go down */
31283128      mc6846_set_input_cp1( 0 );
31293129      to8_kbd_step = 255;
31303130      d = TO8_KBD_TIMEOUT;
31313131   }
3132   else if ( to8_kbd_step == 117 )
3132   else if ( to8_kbd_step == 117 )
31333133   {
31343134      /* schedule timeout  waiting for ack to go up */
31353135      mc6846_set_input_cp1( 0 );
31363136      to8_kbd_step = 255;
31373137      d = TO8_KBD_TIMEOUT;
31383138   }
3139   else if ( to8_kbd_step & 1 )
3139   else if ( to8_kbd_step & 1 )
31403140   {
31413141      /* send silence between bits */
31423142      mc6846_set_input_cp1( 0 );
31433143      d = ATTOTIME_IN_USEC( 100 );
31443144      to8_kbd_step++;
31453145   }
3146   else
3146   else
31473147   {
31483148      /* send bit */
31493149      int bpos = 8 - ( (to8_kbd_step - 100) / 2);
r1461r1462
31673167/* cpu <-> keyboard hand-check */
31683168static void to8_kbd_set_ack ( int data )
31693169{
3170   if ( data == to8_kbd_ack )
3170   if ( data == to8_kbd_ack )
31713171      return;
31723172   to8_kbd_ack = data;
3173 
3174   if ( data )
3173
3174   if ( data )
31753175   {
31763176      double len = attotime_to_double(timer_timeelapsed( to8_kbd_signal )) * 1000. - 2.;
31773177#if VERBOSE_KBD
31783178      logerror( "%f to8_kbd_set_ack: CPU end ack, len=%f\n", attotime_to_double(timer_get_time()), len );
31793179#endif
3180      if ( to8_kbd_data == 0xfff )
3180      if ( to8_kbd_data == 0xfff )
31813181      {
31823182         /* end signal from CPU */
3183         if ( len >= 0.6 && len <= 0.8 )
3183         if ( len >= 0.6 && len <= 0.8 )
31843184         {
31853185            LOG (( "%f to8_kbd_set_ack: INIT signal\n", attotime_to_double(timer_get_time()) ));
31863186            to8_kbd_last_key = 0xff;
r1461r1462
31913191            to8_kbd_step = 0;
31923192            timer_adjust( to8_kbd_timer, ATTOTIME_IN_MSEC( 1 ), 0, attotime_never );
31933193         }
3194         else
3194         else
31953195         {
31963196            to8_kbd_step = 0;
31973197            timer_adjust( to8_kbd_timer, TO8_KBD_POLL_PERIOD, 0, attotime_never );
3198            if ( len >= 1.2 && len <= 1.4 )
3198            if ( len >= 1.2 && len <= 1.4 )
31993199            {
32003200               LOG (( "%f to8_kbd_set_ack: CAPS on signal\n", attotime_to_double(timer_get_time()) ));
32013201               to8_kbd_caps = 1;
32023202            }
3203            else if ( len >= 1.8 && len <= 2.0 )
3203            else if ( len >= 1.8 && len <= 2.0 )
32043204            {
32053205               LOG (( "%f to8_kbd_set_ack: CAPS off signal\n", attotime_to_double(timer_get_time()) ));
32063206               to8_kbd_caps = 0;
r1461r1462
32083208         }
32093209         thom_set_caps_led( ! to8_kbd_caps );
32103210      }
3211      else
3211      else
32123212      {
32133213         /* end key transmission */
32143214         to8_kbd_step = 0;
r1461r1462
32163216      }
32173217   }
32183218
3219   else
3219   else
32203220   {
3221      if ( to8_kbd_step == 255 )
3221      if ( to8_kbd_step == 255 )
32223222      {
32233223         /* CPU accepts key */
32243224         to8_kbd_step = 99;
32253225         timer_adjust( to8_kbd_timer, ATTOTIME_IN_USEC( 400 ), 0, attotime_never );
32263226      }
3227      else
3227      else
32283228      {
32293229         /* start signal from CPU */
32303230         to8_kbd_data = 0xfff;
r1461r1462
32463246   to8_kbd_key_count = 0;
32473247   to8_kbd_step = 0;
32483248   to8_kbd_data = 0;
3249   to8_kbd_ack = 1;
3249   to8_kbd_ack = 1;
32503250   to8_kbd_caps = 1;
32513251   thom_set_caps_led( ! to8_kbd_caps );
32523252   to8_kbd_timer_func();
r1461r1462
32863286   static int old_bank = -1;
32873287   int bank = (to8_reg_sys1 & 0x80) ? to7_floppy_bank : (to8_bios_bank + TO7_NB_FLOP_BANK);
32883288#if VERBOSE_BANK
3289   if ( bank != old_bank )
3289   if ( bank != old_bank )
32903290      logerror( "to8_update_floppy_bank: floppy ROM is %s bank %i\n",
32913291           (to8_reg_sys1 & 0x80) ? "external" : "internal",
32923292           bank % TO7_NB_FLOP_BANK );
r1461r1462
33013301{
33023302   UINT8 bank = 0;
33033303
3304   if ( to8_reg_sys1 & 0x10 ) 
3304   if ( to8_reg_sys1 & 0x10 )
33053305   {
33063306      bank = to8_reg_ram & 31;
33073307#if VERBOSE_BANK
3308      if ( bank != to8_data_vpage )
3308      if ( bank != to8_data_vpage )
33093309         logerror( "to8_update_ram_bank: select bank %i (new style)\n", bank );
33103310#endif
33113311   }
3312   else
3312   else
33133313   {
33143314      UINT8 portb = pia_get_port_b_z_mask( THOM_PIA_SYS );
33153315
3316      switch ( portb & 0xf8 )
3316      switch ( portb & 0xf8 )
33173317      {
33183318         /*  in compatibility mode, banks 5 and 6 are reversed wrt TO7/70 */
33193319      case 0xf0: bank = 2; break;
r1461r1462
33363336   /*  due to adressing distortion, the 16 KB banked memory space is
33373337       split into two 8 KB spaces:
33383338       - 0xa000-0xbfff maps to 0x2000-0x3fff in 16 KB bank
3339       - 0xc000-0xdfff maps to 0x0000-0x1fff in 16 KB bank
3339       - 0xc000-0xdfff maps to 0x0000-0x1fff in 16 KB bank
33403340       this is important if we map a bank that is also reachable by another,
33413341       undistorted space, such as cartridge, page 0 (video), or page 1
33423342   */
33433343   to8_data_vpage = bank;
33443344   memory_set_bank( TO8_DATA_LO, to8_data_vpage );
33453345   memory_set_bank( TO8_DATA_HI, to8_data_vpage );
3346   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0,
3347                   (mess_ram_size == 512*1024 || to8_data_vpage < 16) ?
3346   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0,
3347                   (mess_ram_size == 512*1024 || to8_data_vpage < 16) ?
33483348                   to8_data_vpage <= 4 ? to8_data_lo_w :
33493349                   (write8_handler)(STATIC_BANK1 + TO8_DATA_LO - 1) :
33503350                   MWA8_NOP );
3351   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0,
3351   memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0,
33523352                   (mess_ram_size == 512*1024 || to8_data_vpage < 16) ?
33533353                   to8_data_vpage <= 4 ? to8_data_hi_w :
3354                   (write8_handler)(STATIC_BANK1 + TO8_DATA_HI - 1) :
3354                   (write8_handler)(STATIC_BANK1 + TO8_DATA_HI - 1) :
33553355                   MWA8_NOP );
33563356}
33573357
r1461r1462
33653365   /* reset bank switch */
33663366   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0003, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) );
33673367
3368   if ( to8_reg_cart & 0x20 )
3368   if ( to8_reg_cart & 0x20 )
33693369   {
33703370      /* RAM space */
33713371      to8_cart_vpage = to8_reg_cart & 31;
r1461r1462
33733373      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0,
33743374                      ((to8_cart_vpage < 8 || mess_ram_size == 512*1024) && (to8_reg_cart & 0x40)) ?
33753375                      (to8_cart_vpage <= 4) ? to8_vcart_w :
3376                      (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :
3376                      (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :
33773377                      MWA8_NOP );
33783378#if VERBOSE_BANK
33793379      if ( bank != old_bank )
33803380         logerror( "to8_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 );
33813381#endif
33823382   }
3383   else
3383   else
33843384   {
33853385      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, to8_cartridge_w );
3386      if ( to8_soft_select )
3387      {
3386      if ( to8_soft_select )
3387      {
33883388         /* internal software ROM space */
33893389         bank = 4 + to8_soft_bank;
33903390#if VERBOSE_BANK
33913391         if ( bank != old_bank )
3392            logerror( "to8_update_cart_bank: CART is internal bank %i\n",
3392            logerror( "to8_update_cart_bank: CART is internal bank %i\n",
33933393                 to8_soft_bank );
33943394#endif
33953395      }
3396      else
3396      else
33973397      {
33983398         /* external cartridge ROM space */
33993399         if ( thom_cart_nb_banks )
r1461r1462
34183418/* ROM bank switch */
34193419WRITE8_HANDLER ( to8_cartridge_w )
34203420{
3421   if ( offset >= 0x2000 )
3421   if ( offset >= 0x2000 )
34223422      return;
34233423
3424   if ( to8_soft_select )
3424   if ( to8_soft_select )
34253425      to8_soft_bank = offset & 3;
3426   else
3426   else
34273427      thom_cart_bank = offset & 3;
34283428
34293429   to8_update_cart_bank();
r1461r1462
34583458{
34593459   UINT8* mem = memory_region(REGION_CPU1);
34603460   to7_floppy_reset();
3461   if ( THOM_FLOPPY_INT )
3461   if ( THOM_FLOPPY_INT )
34623462      thmfc_floppy_reset();
34633463   memory_configure_bank( THOM_FLOP_BANK, TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 );
34643464}
r1461r1462
34673467
34683468READ8_HANDLER ( to8_floppy_r )
34693469{
3470   if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) 
3470   if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT )
34713471      /* external controller */
34723472      return to7_floppy_r( offset );
3473   else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT )
3473   else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT )
34743474      /* internal controller */
34753475      return thmfc_floppy_r( offset );
3476   else
3476   else
34773477      /* no controller */
34783478      return 0;
34793479}
r1461r1462
34823482
34833483WRITE8_HANDLER ( to8_floppy_w )
34843484{
3485   if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT )
3485   if ( (to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT )
34863486      /* external controller */
34873487      to7_floppy_w( offset, data );
3488   else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT )
3488   else if ( ! (to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT )
34893489      /* internal controller */
34903490      thmfc_floppy_w( offset, data );
34913491}
r1461r1462
35113511   init  = to7_lightpen ? l.init  : v.init;
35123512   lt3   = to7_lightpen ? l.lt3   : v.lt3;
35133513
3514   switch ( offset )
3514   switch ( offset )
35153515   {
35163516
35173517   case 0: /* system 2 / lightpen register 1 */
3518      if ( to7_lightpen )
3518      if ( to7_lightpen )
35193519         res = (count >> 8) & 0xff;
3520      else
3520      else
35213521         res = to8_reg_sys2 & 0xf0;
35223522      break;
35233523
35243524   case 1: /* ram register / lightpen register 2 */
3525      if ( to7_lightpen )
3525      if ( to7_lightpen )
35263526      {
35273527         thom_firq_2( 0 );
3528         to8_lightpen_intr = 0;
3528         to8_lightpen_intr = 0;
35293529         res = count & 0xff;
35303530      }
3531      else
3531      else
35323532         res = to8_reg_ram & 0x1f;
35333533      break;
35343534
35353535   case 2: /* cartrige register / lightpen register 3 */
3536      if ( to7_lightpen )
3536      if ( to7_lightpen )
35373537         res = (lt3 << 7) | (inil << 6);
3538      else
3538      else
35393539         res = to8_reg_cart;
35403540      break;
35413541
r1461r1462
35623562WRITE8_HANDLER ( to8_gatearray_w )
35633563{
35643564#if VERBOSE_VIDEO
3565   logerror( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", 
3565   logerror( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n",
35663566        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
35673567        offset, 0xe7e4 + offset, data );
35683568#endif
35693569
3570   switch ( offset )
3570   switch ( offset )
35713571   {
35723572
35733573   case 0: /* switch */
r1461r1462
35753575      break;
35763576
35773577   case 1: /* ram register */
3578      if ( to8_reg_sys1 & 0x10 )
3578      if ( to8_reg_sys1 & 0x10 )
35793579      {
35803580         to8_reg_ram = data;
35813581         to8_update_ram_bank();
r1461r1462
35953595      break;
35963596
35973597   default:
3598      logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n",
3598      logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n",
35993599           activecpu_get_previouspc(), offset, data );
36003600   }
36013601}
r1461r1462
36093609READ8_HANDLER  ( to8_vreg_r )
36103610{
36113611   /* 0xe7dc from external floppy drive aliases the video gate-array */
3612   if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) )
3612   if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) )
36133613   {
3614      if ( THOM_FLOPPY_EXT )
3614      if ( THOM_FLOPPY_EXT )
36153615         return to7_floppy_r( 0xc );
3616      else
3616      else
36173617         return 0;
36183618   }
36193619
3620   switch ( offset )
3620   switch ( offset )
36213621   {
36223622
36233623   case 0: /* palette data */
r1461r1462
36453645WRITE8_HANDLER ( to8_vreg_w )
36463646{
36473647#if VERBOSE_VIDEO
3648   logerror( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", 
3648   logerror( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n",
36493649        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
36503650        offset, 0xe7da + offset, data );
36513651#endif
36523652
3653   switch ( offset )
3653   switch ( offset )
36543654   {
36553655
36563656   case 0: /* palette data */
r1461r1462
36653665   }
36663666   break;
36673667
3668   case 1: /* palette address */
3668   case 1: /* palette address */
36693669      to9_palette_idx = data & 31;
36703670      break;
36713671
r1461r1462
36733673      to9_set_video_mode( data, 1 );
36743674      break;
36753675
3676   case 3: /* system register 2 */
3676   case 3: /* system register 2 */
36773677      /* 0xe7dc from external floppy drive aliases the video gate-array */
3678      if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) )
3678      if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) && ( to8_reg_sys1 & 0x80 ) )
36793679      {
3680         if ( THOM_FLOPPY_EXT )
3680         if ( THOM_FLOPPY_EXT )
36813681            to7_floppy_w( 0xc, data );
36823682      }
3683      else
3683      else
36843684      {
36853685         to8_reg_sys2 = data;
36863686         thom_set_video_page( data >> 6 );
r1461r1462
37133713
37143714
37153715static WRITE8_HANDLER ( to8_sys_portb_out )
3716{
3716{
37173717   to9_update_centronics(); /* bits 0-1: printer */
37183718   to8_update_ram_bank();
37193719#if VERBOSE
r1461r1462
37243724
37253725
37263726
3727static const pia6821_interface to8_sys =
3727static const pia6821_interface to8_sys =
37283728{
37293729   to8_sys_porta_in, NULL,
37303730   NULL, NULL, NULL, NULL,
37313731   to9_sys_porta_out, to8_sys_portb_out, to7_set_cassette_motor, NULL,
3732   NULL, thom_firq_1
3732   NULL, thom_firq_1
37333733};
37343734
37353735
r1461r1462
37723772
37733773
37743774
3775static const mc6846_interface to8_timer =
3776{
3777   to8_timer_port_out, NULL, to8_timer_cp2_out,
3778   to8_timer_port_in, to7_timer_tco_out,
3779   thom_irq_0
3775static const mc6846_interface to8_timer =
3776{
3777   to8_timer_port_out, NULL, to8_timer_cp2_out,
3778   to8_timer_port_in, to7_timer_tco_out,
3779   thom_irq_0
37803780};
37813781
37823782
r1461r1462
37883788/* direct connection to interrupt line instead of through a PIA */
37893789static void to8_lightpen_cb ( int step )
37903790{
3791   if ( ! to7_lightpen )
3791   if ( ! to7_lightpen )
37923792      return;
3793   
3793
37943794   thom_firq_2( 1 );
37953795   to7_lightpen_step = step;
37963796   to8_lightpen_intr = 1;
r1461r1462
38693869   to7_midi_init();
38703870   to7_rf57932_init();
38713871   mea8000_config( THOM_SOUND_SPEECH, NULL );
3872 
3872
38733873   /* memory */
38743874   thom_cart_bank = 0;
38753875   thom_vram = mess_ram;
r1461r1462
38833883   memory_configure_bank( TO8_BIOS_BANK,  0,  2, mem + 0x30800, 0x2000 );
38843884   memory_set_bank( TO8_SYS_LO, 0 );
38853885   memory_set_bank( TO8_SYS_HI, 0 );
3886 
3886
38873887   /* save-state */
38883888   state_save_register_global( thom_cart_nb_banks );
38893889   state_save_register_global( thom_cart_bank );
r1461r1462
39153915
39163916
39173917
3918static const pia6821_interface to9p_sys =
3918static const pia6821_interface to9p_sys =
39193919{
39203920   to9_sys_porta_in, NULL,
39213921   NULL, NULL, NULL, NULL,
r1461r1462
39513951
39523952
39533953
3954static const mc6846_interface to9p_timer =
3955{
3956   to9p_timer_port_out, NULL, to8_timer_cp2_out,
3957   to9p_timer_port_in, to7_timer_tco_out,
3958   thom_irq_0
3954static const mc6846_interface to9p_timer =
3955{
3956   to9p_timer_port_out, NULL, to8_timer_cp2_out,
3957   to9p_timer_port_in, to7_timer_tco_out,
3958   thom_irq_0
39593959};
39603960
39613961
r1461r1462
40314031   to7_midi_init();
40324032   to7_rf57932_init();
40334033   mea8000_config( THOM_SOUND_SPEECH, NULL );
4034 
4034
40354035   /* memory */
40364036   thom_cart_bank = 0;
40374037   thom_vram = mess_ram;
r1461r1462
40454045   memory_configure_bank( TO8_BIOS_BANK,  0,  2, mem + 0x30800, 0x2000 );
40464046   memory_set_bank( TO8_SYS_LO, 0 );
40474047   memory_set_bank( TO8_SYS_HI, 0 );
4048 
4048
40494049   /* save-state */
40504050   state_save_register_global( thom_cart_nb_banks );
40514051   state_save_register_global( thom_cart_bank );
r1461r1462
40814081{
40824082   UINT8 bank = 0;
40834083
4084   if ( to8_reg_sys1 & 0x10 ) 
4084   if ( to8_reg_sys1 & 0x10 )
40854085   {
40864086      bank = to8_reg_ram & 7; /* 128 KB RAM only = 8 pages */
40874087#if VERBOSE_BANK
4088      if ( bank != to8_data_vpage )
4088      if ( bank != to8_data_vpage )
40894089         logerror( "mo6_update_ram_bank: select bank %i (new style)\n", bank );
40904090#endif
40914091   }
r1461r1462
41034103   int bank = 0;
41044104
41054105   memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, (read8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) );
4106 
4107   if ( ( ( to8_reg_sys1 & 0x40 ) && ( to8_reg_cart & 0x20 ) ) || ( ! ( to8_reg_sys1 & 0x40 ) && ( mo5_reg_cart & 4 ) ) )
4106
4107   if ( ( ( to8_reg_sys1 & 0x40 ) && ( to8_reg_cart & 0x20 ) ) || ( ! ( to8_reg_sys1 & 0x40 ) && ( mo5_reg_cart & 4 ) ) )
41084108   {
41094109      /* RAM space */
4110      if ( to8_reg_sys1 & 0x40 )
4110      if ( to8_reg_sys1 & 0x40 )
41114111      {
41124112         /* use a7e6 */
41134113         to8_cart_vpage = to8_reg_cart & 7; /* 128 KB RAM only = 8 pages */
r1461r1462
41204120            logerror( "mo6_update_cart_bank: CART is RAM bank %i (write-enable=%i)\n", to8_cart_vpage, (to8_reg_cart & 0x40) ? 1 : 0 );
41214121#endif
41224122      }
4123      else if ( thom_cart_nb_banks == 4 )
4123      else if ( thom_cart_nb_banks == 4 )
41244124      {
41254125         /* "JANE"-style cartridge bank switching */
41264126         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, MWA8_NOP );
r1461r1462
41304130            logerror( "mo6_update_cart_bank: CART is external cartridge bank %i (A7CB style)\n", bank );
41314131#endif
41324132      }
4133      else
4133      else
41344134      {
41354135         /* RAM from MO5 network extension */
41364136         int write_enable = mo5_reg_cart & 8;
41374137         to8_cart_vpage = (mo5_reg_cart & 3) | 4;
41384138         bank = 8 + to8_cart_vpage;
4139         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ?
4139         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, write_enable ?
41404140                         (write8_handler)(STATIC_BANK1 + THOM_CART_BANK - 1) :  MWA8_NOP );
41414141#if VERBOSE_BANK
41424142         if ( bank != old_bank )
r1461r1462
41444144#endif
41454145      }
41464146   }
4147   else
4147   else
41484148   {
41494149      /* ROM space */
41504150      memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, MWA8_NOP );
4151      if ( to8_reg_sys2 & 0x20 )
4151      if ( to8_reg_sys2 & 0x20 )
41524152      {
41534153         /* internal ROM */
4154         if ( to8_reg_sys2 & 0x10)
4154         if ( to8_reg_sys2 & 0x10)
41554155            bank = b + 6; /* BASIC 128 */
4156         else
4156         else
41574157            bank = b + 4;                      /* BASIC 1 */
41584158#if VERBOSE_BANK
41594159         if ( bank != old_bank )
41604160            logerror( "mo6_update_cart_bank: CART is internal ROM bank %i\n", b );
41614161#endif
41624162      }
4163      else
4163      else
41644164      {
41654165         /* cartridge */
41664166         memory_install_write8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xefff, 0, 0, mo6_cartridge_w );
4167         if ( thom_cart_nb_banks )
4167         if ( thom_cart_nb_banks )
41684168         {
41694169            bank = thom_cart_bank % thom_cart_nb_banks;
41704170            memory_install_read8_handler( 0, ADDRESS_SPACE_PROGRAM, 0xbffc, 0xbfff, 0, 0, mo6_cartridge_r );
r1461r1462
41864186/* write signal generates a bank switch */
41874187WRITE8_HANDLER ( mo6_cartridge_w )
41884188{
4189   if ( offset >= 0x2000 )
4189   if ( offset >= 0x2000 )
41904190      return;
41914191
41924192   thom_cart_bank = offset & 3;
r1461r1462
42454245{
42464246   /* centronics strobe */
42474247   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ));
4248   centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0,
4248   centronics_write_handshake( 0, data ? CENTRONICS_STROBE : 0,
42494249                CENTRONICS_STROBE );
42504250}
4251 
42524251
42534252
4254static const pia6821_interface mo6_game =
4253
4254static const pia6821_interface mo6_game =
42554255{
42564256   to7_game_porta_in, to7_game_portb_in,
42574257   NULL, mo6_game_cb1_in, NULL, NULL,
r1461r1462
42644264static TIMER_CALLBACK(mo6_game_update_cb)
42654265{
42664266   /* unlike the TO8, CB1 & CB2 are not connected to buttons */
4267   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
4267   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
42684268   {
42694269      UINT8 mouse = to7_get_mouse_signal();
42704270      pia_set_input_ca1( THOM_PIA_GAME, mouse & 1 ); /* XA */
42714271      pia_set_input_ca2( THOM_PIA_GAME, mouse & 2 ); /* YA */
42724272   }
4273   else
4273   else
42744274   {
42754275      /* joystick */
42764276      UINT8 in = readinputport( THOM_INPUT_GAME );
r1461r1462
43104310
43114311static READ8_HANDLER ( mo6_sys_porta_in )
43124312{
4313   return
4313   return
43144314      (mo5_get_cassette() ? 0x80 : 0) |     /* bit 7: cassette input */
43154315      8 |                                   /* bit 3: kbd-line float up to 1 */
43164316      ((readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0);
r1461r1462
43274327   int col = (portb >> 4) & 7;    /* B bits 4-6: kbd column */
43284328   int lin = (portb >> 1) & 7;    /* B bits 1-3: kbd line */
43294329
4330   if ( ! (porta & 8) )
4330   if ( ! (porta & 8) )
43314331      lin = 8;     /* A bit 3: 9-th kbd line select */
43324332
4333   return
4334      ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) )
4333   return
4334      ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) )
43354335      ?  0x80 : 0; /* bit 7: key up */
43364336}
43374337
43384338
43394339
43404340static WRITE8_HANDLER ( mo6_sys_porta_out )
4341{
4341{
43424342   thom_set_mode_point( data & 1 );           /* bit 0: video bank switch */
43434343   to7_game_mute = data & 4;                  /* bit 2: sound mute */
43444344   thom_set_caps_led( (data & 16) ? 0 : 1 ) ; /* bit 4: keyboard led */
r1461r1462
43504350
43514351
43524352static WRITE8_HANDLER ( mo6_sys_portb_out )
4353{
4353{
43544354   DAC_data_w( THOM_SOUND_BUZ, (data & 1) ? 0x80 : 0); /* bit 0: buzzer */
43554355}
43564356
r1461r1462
43644364
43654365
43664366
4367static const pia6821_interface mo6_sys =
4367static const pia6821_interface mo6_sys =
43684368{
43694369   mo6_sys_porta_in, mo6_sys_portb_in,
43704370   NULL, NULL, NULL, NULL,
r1461r1462
43914391   init  = to7_lightpen ? l.init  : v.init;
43924392   lt3   = to7_lightpen ? l.lt3   : v.lt3;
43934393
4394   switch ( offset )
4394   switch ( offset )
43954395   {
43964396
43974397   case 0: /* system 2 / lightpen register 1 */
4398      if ( to7_lightpen )
4398      if ( to7_lightpen )
43994399         res = (count >> 8) & 0xff;
4400      else
4400      else
44014401         res = to8_reg_sys2 & 0xf0;
44024402      break;
44034403
44044404   case 1: /* ram register / lightpen register 2 */
4405      if ( to7_lightpen )
4405      if ( to7_lightpen )
44064406      {
44074407         thom_firq_2( 0 );
4408         to8_lightpen_intr = 0;
4408         to8_lightpen_intr = 0;
44094409         res =  count & 0xff;
44104410      }
4411      else
4411      else
44124412         res = to8_reg_ram & 0x1f;
44134413      break;
44144414
44154415   case 2: /* cartrige register / lightpen register 3 */
4416      if ( to7_lightpen )
4416      if ( to7_lightpen )
44174417         res = (lt3 << 7) | (inil << 6);
4418      else
4418      else
44194419         res = 0;
44204420      break;
44214421
r1461r1462
44424442WRITE8_HANDLER ( mo6_gatearray_w )
44434443{
44444444#if VERBOSE_VIDEO
4445   logerror( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", 
4445   logerror( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n",
44464446        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
44474447        offset, 0xa7e4 + offset, data );
44484448#endif
44494449
4450   switch ( offset )
4450   switch ( offset )
44514451   {
44524452
44534453   case 0: /* switch */
r1461r1462
44554455      break;
44564456
44574457   case 1: /* ram register */
4458      if ( to8_reg_sys1 & 0x10 )
4458      if ( to8_reg_sys1 & 0x10 )
44594459      {
44604460         to8_reg_ram = data;
44614461         mo6_update_ram_bank();
r1461r1462
44894489   if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) )
44904490      return to7_floppy_r( 0xc );
44914491
4492   switch ( offset )
4492   switch ( offset )
44934493   {
44944494
44954495   case 0: /* palette data */
r1461r1462
45114511WRITE8_HANDLER ( mo6_vreg_w )
45124512{
45134513#if VERBOSE_VIDEO
4514   logerror( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", 
4514   logerror( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n",
45154515        activecpu_get_previouspc(), attotime_to_double(timer_get_time()),
45164516        offset, 0xa7da + offset, data );
45174517#endif
45184518
4519   switch ( offset )
4519   switch ( offset )
45204520   {
45214521
45224522   case 0: /* palette data */
r1461r1462
45274527   case 2: /* display / external floppy register */
45284528      if ( ( to8_reg_sys1 & 0x80 ) && ( to8_reg_ram & 0x80 ) )
45294529         to7_floppy_w( 0xc, data );
4530      else
4530      else
45314531         to9_set_video_mode( data, 2 );
45324532      break;
45334533
45344534   case 3: /* system register 2 */
45354535      /* 0xa7dc from external floppy drive aliases the video gate-array */
4536      if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) )
4536      if ( ( offset == 3 ) && ( to8_reg_ram & 0x80 ) )
45374537         to7_floppy_w( 0xc, data );
4538      else
4538      else
45394539      {
45404540         to8_reg_sys2 = data;
45414541         thom_set_video_page( data >> 6 );
r1461r1462
46164616   to7_rf57932_init();
46174617   mo5_periodic_timer = timer_alloc( mo5_periodic_cb , NULL);
46184618   mea8000_config( THOM_SOUND_SPEECH, NULL );
4619 
4619
46204620   /* memory */
46214621   thom_cart_bank = 0;
46224622   mo5_reg_cart = 0;
r1461r1462
46334633   memory_configure_bank( TO8_BIOS_BANK,  0, 2, mem + 0x23000, 0x4000 );
46344634   memory_set_bank( TO8_SYS_LO, 0 );
46354635   memory_set_bank( TO8_SYS_HI, 0 );
4636
4636
46374637   /* save-state */
46384638   state_save_register_global( thom_cart_nb_banks );
46394639   state_save_register_global( thom_cart_bank );
r1461r1462
46644664
46654665READ8_HANDLER ( mo5nr_net_r )
46664666{
4667   if ( to7_controller_type )
4667   if ( to7_controller_type )
46684668      return to7_floppy_r ( offset );
46694669
46704670   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset );
46714671
4672   if ( to7_controller_type )
4672   if ( to7_controller_type )
46734673      return to7_floppy_r ( offset );
46744674
46754675   return 0;
r1461r1462
46794679
46804680WRITE8_HANDLER ( mo5nr_net_w )
46814681{
4682   if ( to7_controller_type )
4682   if ( to7_controller_type )
46834683      to7_floppy_w ( offset, data );
46844684   else
46854685      logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n",
r1461r1462
46974697
46984698READ8_HANDLER ( mo5nr_prn_r )
46994699{
4700   switch ( offset )
4700   switch ( offset )
47014701   {
47024702
47034703   case 1:
r1461r1462
47054705
47064706   case 3:
47074707      /* TODO: understand other bits */
4708      if ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY )
4708      if ( centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY )
47094709         return 0;
47104710      else
47114711         return 0x80;
47124712
47134713   default:
4714      logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset ); 
4714      logerror( "$%04x %f mo5nr_prn_r: unhandled read from reg %i\n", activecpu_get_previouspc(), attotime_to_double(timer_get_time()), offset );
47154715      return 0;
47164716   }
47174717}
r1461r1462
47204720
47214721WRITE8_HANDLER ( mo5nr_prn_w )
47224722{
4723   switch ( offset )
4723   switch ( offset )
47244724   {
47254725
47264726   case 1:
r1461r1462
47494749   UINT8 portb = pia_get_output_b( THOM_PIA_SYS );
47504750   int col = (portb >> 4) & 7;    /* B bits 4-6: kbd column */
47514751   int lin = (portb >> 1) & 7;    /* B bits 1-3: kbd line */
4752   return
4753      ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) )
4752   return
4753      ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) )
47544754      ?  0x80 : 0; /* bit 7: key up */
47554755}
47564756
47574757
47584758
47594759static WRITE8_HANDLER ( mo5nr_sys_porta_out )
4760{
4760{
47614761   /* no keyboard LED */
47624762   thom_set_mode_point( data & 1 );           /* bit 0: video bank switch */
47634763   to7_game_mute = data & 4;                  /* bit 2: sound mute */
r1461r1462
47684768
47694769
47704770
4771static const pia6821_interface mo5nr_sys =
4771static const pia6821_interface mo5nr_sys =
47724772{
47734773   mo6_sys_porta_in, mo5nr_sys_portb_in,
47744774   NULL, NULL, NULL, NULL,
r1461r1462
47854785
47864786
47874787
4788static const pia6821_interface mo5nr_game =
4788static const pia6821_interface mo5nr_game =
47894789{
47904790   to7_game_porta_in, to7_game_portb_in,
47914791   NULL, NULL, NULL, NULL,
r1461r1462
48834883   to7_rf57932_init();
48844884   mo5_periodic_timer = timer_alloc( mo5_periodic_cb , NULL);
48854885   mea8000_config( THOM_SOUND_SPEECH, NULL );
4886 
4886
48874887   /* memory */
48884888   thom_cart_bank = 0;
48894889   mo5_reg_cart = 0;
r1461r1462
49004900   memory_configure_bank( TO8_BIOS_BANK,  0, 2, mem + 0x23000, 0x4000 );
49014901   memory_set_bank( TO8_SYS_LO, 0 );
49024902   memory_set_bank( TO8_SYS_HI, 0 );
4903
4903
49044904   /* save-state */
49054905   state_save_register_global( thom_cart_nb_banks );
49064906   state_save_register_global( thom_cart_bank );
src/mess/machine/sym1.c
r1461r1462
7878/* The speaker is connected to output 6 of the 74145 */
7979static void sym1_74145_output_6_w(int state)
8080{
81   speaker_level_w(0, state);   
81   speaker_level_w(0, state);
8282}
8383
8484
r1461r1462
197197{
198198   logerror("SYM1 VIA2 W 0x%02x\n", data);
199199
200   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa600, 0xa67f, 0, 0, 
200   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa600, 0xa67f, 0, 0,
201201      ((readinputportbytag("WP") & 0x01) && !(data & 0x01)) ? MWA8_NOP : MWA8_BANK5);
202202
203   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM,   0x0400, 0x07ff, 0, 0,
203   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM,   0x0400, 0x07ff, 0, 0,
204204      ((readinputportbytag("WP") & 0x02) && !(data & 0x02)) ? MWA8_NOP : MWA8_BANK2);
205205
206   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM,   0x0800, 0x0bff, 0, 0,
206   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM,   0x0800, 0x0bff, 0, 0,
207207      ((readinputportbytag("WP") & 0x04) && !(data & 0x04)) ? MWA8_NOP : MWA8_BANK3);
208208
209   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM,   0x0c00, 0x0fff, 0, 0,
209   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM,   0x0c00, 0x0fff, 0, 0,
210210      ((readinputportbytag("WP") & 0x08) && !(data & 0x08)) ? MWA8_NOP : MWA8_BANK4);
211211}
212212
r1461r1462
287287   r6532_config(0, &r6532_interface);
288288   r6532_set_clock(0, OSC_Y1);
289289   r6532_reset(0);
290   
290
291291   /* configure 74145 */
292292   ttl74145_config(0, &ttl74145_intf);
293   
293
294294   /* allocate a timer to refresh the led display */
295295   led_update = timer_alloc(led_refresh, NULL);
296296}
src/mess/machine/lynx.c
r1461r1462
1818      UINT8 data[0x100];
1919      struct
2020      {
21         struct { UINT8 l, h; }
21         struct { UINT8 l, h; }
2222         // eng used by the blitter engine
2323         // scb written by the blitter scb blocks to engine expander
2424         //     used by the engine
2525         //     might be used directly by software!
26         eng1, eng2,     
26         eng1, eng2,
2727         h_offset, v_offset, vidbas, colbas,
28         eng3, eng4,
28         eng3, eng4,
2929         scb1, scb2, scb3, scb4, scb5, scb6,
3030         eng5, eng6, eng7, eng8,
3131         colloff,
r1461r1462
4444         UINT8 SPRSYS;
4545      } s;
4646    } u;
47    int accumulate_overflow;   
47    int accumulate_overflow;
4848    UINT8 high;
4949    int low;
5050} SUZY;
r1461r1462
8787#define GET_WORD(mem, index) ((mem)[(index)]|((mem)[(index)+1]<<8))
8888
8989/*
90mode from blitter command
90mode from blitter command
9191#define SHADOW         (0x07)
9292#define XORSHADOW      (0x06)
9393#define NONCOLLIDABLE  (0x05)
r1461r1462
103103    int back;
104104    UINT8 *screen;
105105    UINT8 *colbuf;
106   
106
107107    blitter.everon=TRUE;
108108    screen=blitter.mem+blitter.screen+y*80+x/2;
109109    colbuf=blitter.mem+blitter.colbuf+y*80+x/2;
r1461r1462
201201   }
202202   blitter.memory_accesses+=2;
203203   break;
204    case 0x04: // pen 0 transparent,
204    case 0x04: // pen 0 transparent,
205205    case 0x07: // shadow: pen e doesn't collide
206206    case 0x05: // non collidable sprite
207207    case 0x15:
r1461r1462
289289#define INCLUDE_LYNX_LINE_FUNCTION
290290static void lynx_blit_2color_line(const int y, const int xdir)
291291{
292   const int bits=1;
292   const int bits=1;
293293   const int mask=0x1;
294294#include "includes/lynx.h"
295295}
296296static void lynx_blit_4color_line(const int y, const int xdir)
297297{
298   const int bits=2;
298   const int bits=2;
299299   const int mask=0x3;
300300#include "includes/lynx.h"
301301}
302302static void lynx_blit_8color_line(const int y, const int xdir)
303303{
304   const int bits=3;
304   const int bits=3;
305305   const int mask=0x7;
306306#include "includes/lynx.h"
307307}
308308static void lynx_blit_16color_line(const int y, const int xdir)
309309{
310   const int bits=4;
310   const int bits=4;
311311   const int mask=0xf;
312312#include "includes/lynx.h"
313313}
r1461r1462
330330 0, 4 bit repeat count-1, 3 bit color
331331 1, 4 bit count of values-1, 3 bit color, ....
332332*/
333   
333
334334/*
33533516 color rle:
336336 0, 4 bit repeat count-1, 4 bit color
r1461r1462
339339#define INCLUDE_LYNX_LINE_RLE_FUNCTION
340340static void lynx_blit_2color_rle_line(const int y, const int xdir)
341341{
342   const int bits=1;
342   const int bits=1;
343343   const int mask=0x1;
344344#include "includes/lynx.h"
345345}
346346static void lynx_blit_4color_rle_line(const int y, const int xdir)
347347{
348   const int bits=2;
348   const int bits=2;
349349   const int mask=0x3;
350350#include "includes/lynx.h"
351351}
352352static void lynx_blit_8color_rle_line(const int y, const int xdir)
353353{
354   const int bits=3;
354   const int bits=3;
355355   const int mask=0x7;
356356#include "includes/lynx.h"
357357}
358358static void lynx_blit_16color_rle_line(const int y, const int xdir)
359359{
360   const int bits=4;
360   const int bits=4;
361361   const int mask=0xf;
362362#include "includes/lynx.h"
363363}
r1461r1462
380380   ydir=1;
381381   if (blitter.mem[blitter.cmd]&0x10) { ydir=-1;blitter.y--;/*?*/ }
382382   switch (blitter.mem[blitter.cmd+1]&3) {
383   case 0:
383   case 0:
384384      flip =0;
385385      break;
386386   case 1: // blockout
r1461r1462
515515static void lynx_blitter(void)
516516{
517517    static const int lynx_colors[4]={2,4,8,16};
518   
518
519519    static void (* const blit_line[4])(const int y, const int xdir)= {
520520   lynx_blit_2color_line,
521521   lynx_blit_4color_line,
522522   lynx_blit_8color_line,
523523   lynx_blit_16color_line
524524    };
525   
525
526526    static void (* const blit_rle_line[4])(const int y, const int xdir)= {
527527   lynx_blit_2color_rle_line,
528528   lynx_blit_4color_rle_line,
r1461r1462
530530   lynx_blit_16color_rle_line
531531    };
532532    int i; int o;int colors;
533   
533
534534    blitter.memory_accesses=0;
535535    blitter.mem = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0x0000);
536536    blitter.colbuf=GET_WORD(suzy.u.data, 0xa);
r1461r1462
545545    blitter.height=0x100;
546546    blitter.stretch=0;
547547    blitter.tilt=0;
548   
548
549549    blitter.memory_accesses+=2;
550550    for (blitter.cmd=GET_WORD(suzy.u.data, 0x10); blitter.cmd; ) {
551   
551
552552   blitter.memory_accesses+=1;
553553   if (!(blitter.mem[blitter.cmd+1]&4)) {
554   
554
555555       blitter.colpos=GET_WORD(suzy.u.data, 0x24)+blitter.cmd;
556   
556
557557       blitter.bitmap=GET_WORD(blitter.mem,blitter.cmd+5);
558558       blitter.x=(INT16)GET_WORD(blitter.mem, blitter.cmd+7)-blitter.xoff;
559559       blitter.y=(INT16)GET_WORD(blitter.mem, blitter.cmd+9)-blitter.yoff;
560560       blitter.memory_accesses+=6;
561       
561
562562       blitter.mode=blitter.mem[blitter.cmd]&07;
563563       if (blitter.mem[blitter.cmd+1]&0x80) {
564564      blitter.line_function=blit_line[blitter.mem[blitter.cmd]>>6];
565565       } else {
566566      blitter.line_function=blit_rle_line[blitter.mem[blitter.cmd]>>6];
567567       }
568       
568
569569       if (!(blitter.mem[blitter.cmd+2]&0x20) && !( suzy.u.s.SPRSYS&0x20) ) {
570570      switch (blitter.mode) {
571571      case 0: case 2: case 3: case 4: case 6: case 7:
r1461r1462
574574          blitter.spritenr=blitter.mem[blitter.cmd+2]&0xf;
575575      }
576576       }
577       
577
578578       o=0xb;
579579       if (blitter.mem[blitter.cmd+1]&0x30) {
580580      blitter.width=GET_WORD(blitter.mem, blitter.cmd+11);
r1461r1462
582582      blitter.memory_accesses+=4;
583583      o+=4;
584584       }
585       
585
586586       if (blitter.mem[blitter.cmd+1]&0x20) {
587587      blitter.stretch=GET_WORD(blitter.mem, blitter.cmd+o);
588588      blitter.memory_accesses+=2;
r1461r1462
594594      }
595595       }
596596       colors=lynx_colors[blitter.mem[blitter.cmd]>>6];
597       
597
598598       if (!(blitter.mem[blitter.cmd+1]&8)) {
599599      for (i=0; i<colors/2; i++) {
600600          blitter.color[i*2]=blitter.mem[blitter.cmd+o+i]>>4;
r1461r1462
713713         if (input&PAD_RIGHT) data|=PAD_LEFT;
714714      } else {
715715         data=input;
716      }     
716      }
717717      break;
718718   case 0xb1: data=readinputport(1);break;
719719   case 0xb2:
r1461r1462
784784TIM_MAGMODE     EQU %00100000   ; nonsense in Lynx !!
785785TIM_RELOAD      EQU %00010000   ; enable reload
786786TIM_COUNT       EQU %00001000   ; enable counter
787TIM_LINK        EQU %00000111   
787TIM_LINK        EQU %00000111
788788; link timers (0->2->4 / 1->3->5->7->Aud0->Aud1->Aud2->Aud3->1
789789TIM_64us        EQU %00000110
790790TIM_32us        EQU %00000101
r1461r1462
835835      lynx_timer_count_down( 2 );
836836      lynx_line++;
837837      break;
838    case 2:
839      lynx_timer_count_down( 4 );
838    case 2:
839      lynx_timer_count_down( 4 );
840840      lynx_draw_lines( -1 );
841841      lynx_line=0;
842842      break;
r1461r1462
983983    if (uart.buffer_loaded) {
984984   uart.data_to_send=uart.buffer;
985985   uart.buffer_loaded=FALSE;
986   timer_set(ATTOTIME_IN_USEC(11), NULL, 0, lynx_uart_timer);   
986   timer_set(ATTOTIME_IN_USEC(11), NULL, 0, lynx_uart_timer);
987987    } else {
988988   uart.sending=FALSE;
989989    }
r1461r1462
10961096      mikey.data[0x81]&=~data; // clear interrupt source
10971097      logerror("mikey write %.2x %.2x\n",offset,data);
10981098      if (!mikey.data[0x81])
1099         cpunum_set_input_line(0, M65SC02_IRQ_LINE, CLEAR_LINE);       
1099         cpunum_set_input_line(0, M65SC02_IRQ_LINE, CLEAR_LINE);
11001100      break;
11011101
11021102   case 0x87:
r1461r1462
11801180   int i;
11811181   lynx_memory_config_w(0, 0);
11821182
1183   cpunum_set_input_line(0, M65SC02_IRQ_LINE, CLEAR_LINE);       
1183   cpunum_set_input_line(0, M65SC02_IRQ_LINE, CLEAR_LINE);
11841184
11851185   memset(&suzy, 0, sizeof(suzy));
11861186   memset(&mikey, 0, sizeof(mikey));
src/mess/machine/mc6846.h
r1461r1462
1919  write8_handler out_port_func;  /* 8-bit output */
2020  write8_handler out_cp1_func;   /* 1-bit output */
2121  write8_handler out_cp2_func;   /* 1-bit output */
22 
22
2323  /* CPU read from the outside through chip */
2424  read8_handler in_port_func; /* 8-bit input */
25 
25
2626  /* asynchronous timer output to outside world */
2727  write8_handler out_cto_func; /* 1-bit output */
28 
28
2929  /* timer interrupt */
3030  void ( * irq_func ) ( int state );
3131
src/mess/machine/lisa.h
r1461r1462
11/*********************************************************************
22
33   lisa.h
4   
4
55   MESS Lisa driver declarations
66
77*********************************************************************/
src/mess/machine/pmd85.c
r1461r1462
441441
442442   I/O board
443443   1xxx11aa   external interfaces connector (K2)
444               
444
445445   0xxx11aa   I/O board interfaces
446446      000111aa   8251 (casette recorder, V24)
447447      010011aa   8255 (GPIO/0, GPIO/1)
r1461r1462
714714               else
715715               {
716716                  current_level = (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0.038) ? 1 : 0;
717               
717
718718                  if (previous_level!=current_level)
719                  {         
719                  {
720720                     data = (!previous_level && current_level) ? 1 : 0;
721         
721
722722                     set_out_data_bit(pmd85_cassette_serial_connection.State, data);
723723                     serial_connection_out(&pmd85_cassette_serial_connection);
724724                     msm8251_receive_clock();
r1461r1462
733733            case ALFA:
734734               /* not hardware data decoding */
735735               return;
736         }     
736         }
737737      }
738738
739739      /* tape writing */
src/mess/machine/rriot.c
r1461r1462
9292   rriot[nr].port_b.ddr=0;
9393   if (rriot[nr].config->port_b.output)
9494      rriot[nr].config->port_b.output(nr,0xff);
95   
95
9696   rriot[nr].irq=0;rriot[nr].irqen=0;
97   if (rriot[nr].config->irq_callback)
98      rriot[nr].config->irq_callback(nr, 0);
97   if (rriot[nr].config->irq_callback)
98      rriot[nr].config->irq_callback(nr, 0);
9999}
100100
101101int rriot_r(int chip, int offset)
r1461r1462
217217      }
218218      rriot[chip].irqen = (offset & 8) ? 1 : 0;
219219      rriot[chip].irq =0;
220     
220
221221      switch (offset&3) {
222222      case 0: /* Timer 1 start */
223223         LOG(("rriot(%d) TMR1  write: $%02x%s\n", chip, data, (char*)((offset & 8) ? " (IRQ)":" ")));
r1461r1462
247247static int rriot_a_r(int chip)
248248{
249249   int data;
250   if (rriot[chip].config->port_a.input)
250   if (rriot[chip].config->port_a.input)
251251      data = rriot[chip].config->port_a.input(chip);
252252   else
253253      data = 0xff;
r1461r1462
259259static int rriot_b_r(int chip)
260260{
261261   int data;
262   if (rriot[chip].config->port_b.input)
262   if (rriot[chip].config->port_b.input)
263263      data = rriot[chip].config->port_b.input(chip);
264264   else
265265      data = 0xff;
r1461r1462
277277
278278static void rriot_b_w(int chip, int data)
279279{
280   
280
281281}
282282
283283 READ8_HANDLER ( rriot_0_r ) { return rriot_r(0,offset); }
src/mess/machine/rriot.h
r1461r1462
55
66/* ram and rom areas are not handled in this rriot compoment */
77
8/*
8/*
99internal 64 byte ram
1010internal 1024 byte rom
1111inputs and output
r1461r1462
1313interrupt logic
1414logic to connect up to 7 6530 without additional address decoding logic
1515
161kb rom selection
17a0..a9,
161kb rom selection
17a0..a9,
1818rs0, cs1, cs2 mask programmed!
1919
202064byte ram selection
r1461r1462
7878*/
7979
8080
81/*
81/*
8282mos 6532
8383chip also contains 128 bytes ram (own chip select line)
8484no rom
8585separate irq output
8686some significant differences, so unique component
8787*/
88
88
8989#ifdef __cplusplus
9090extern "C" {
9191#endif
r1461r1462
103103
104104/* This has to be called from a driver at startup */
105105void rriot_init(int nr, const RRIOT_CONFIG *riot);
106   
106
107107int rriot_r(int chip, int offs);
108108void rriot_w(int chip, int offs, int data);
109109
src/mess/machine/geneve.c
r1461r1462
205205       tms9901_init(0, & tms9901reset_param_ti99);
206206
207207        /* Initialize all. Actually, at this point, we don't know
208           how the switches are set. Later we use the configuration switches to
208           how the switches are set. Later we use the configuration switches to
209209           determine which one to use. */
210210   ti99_peb_init();
211211        ti99_fdc_init();
r1461r1462
851851                  else
852852                  {
853853                     GPL_port.addr = ((int) data << 8) | (GPL_port.addr & 0xFF);
854   
854
855855                     GPL_port.waddr_LSB = TRUE;
856856                  }
857857               }
src/mess/machine/tx0.c
r1461r1462
509509
510510   7-track tape, 6-bit data, 1-bit parity
511511
512   
512
513513*/
514514
515515static void schedule_select(void)
src/mess/machine/c128.c
r1461r1462
529529          * (presumably set up by CPU #1.) This always worked, but when I
530530          * changed the m8502 CPU core to use an internal memory map, it
531531          * started BRK-ing forever when trying to execute 0x0000.
532          *
532          *
533533          * I am not sure whether the C128 actually executes this invalid
534534          * memory or if this is a bug in the C128 driver.  In any case, the
535535          * driver used to work with this behavior, so I am doing this hack
src/mess/machine/pc_turbo.c
r1461r1462
2626{
2727   struct pc_turbo_info *ti = (struct pc_turbo_info *) ptr;
2828   int val;
29   
29
3030   val = readinputport(ti->port) & ti->mask;
3131
3232   if (val != ti->cur_val)
src/mess/machine/lviv.c
r1461r1462
334334
335335   lviv_setup_snapshot (lviv_snapshot_data);
336336
337   dump_registers();   
337   dump_registers();
338338
339339   free(lviv_snapshot_data);
340340
src/mess/machine/ds1315.c
r1461r1462
44
55/* This is an emulation of Dallas Semiconductor's Phantom Time Chip.
66   DS1315.
7   
7
88   by tim lindner, November 2001.
99*/
1010
r1461r1462
1818static void ds1315_input_raw_data( void );
1919
2020static int ds1315_count;
21static int ds1315_mode;                   
21static int ds1315_mode;
2222static int ds1315_raw_data[8*8];
2323static int ds1315_pattern[] = {  1, 0, 1, 0, 0, 0, 1, 1,
2424                          0, 1, 0, 1, 1, 1, 0, 0,
r1461r1462
5555
5656   return 0;
5757}
58   
58
5959 READ8_HANDLER ( ds1315_r_1 )
6060{
6161   if( ds1315_pattern[ ds1315_count++ ] == 1 )
6262      return 0;
63   
63
6464   ds1315_count = 0;
6565   ds1315_mode = ds_seek_matching;
6666   return 0;
6767}
68   
68
6969 READ8_HANDLER ( ds1315_r_data )
7070{
7171   UINT8   result;
72   
72
7373   if( ds1315_mode == ds_calendar_io )
7474   {
7575      result = ds1315_raw_data[ ds1315_count++ ];
76     
76
7777      if( ds1315_count == 64 )
7878      {
7979         ds1315_mode = ds_seek_matching;
8080         ds1315_count = 0;
8181      }
82     
82
8383      return result;
8484   }
85   
85
8686   ds1315_count = 0;
8787   return 0;
8888}
8989
9090WRITE8_HANDLER ( ds1315_w_data )
9191{
92   
92
9393   if( ds1315_mode == ds_calendar_io )
9494   {
9595      ds1315_raw_data[ ds1315_count++ ] = data & 0x01;
96     
96
9797      if( ds1315_count == 64 )
9898      {
9999         ds1315_mode = ds_seek_matching;
100100         ds1315_count = 0;
101101         ds1315_input_raw_data();
102102      }
103     
103
104104      return;
105105   }
106   
106
107107   ds1315_count = 0;
108108   return;
109109}
r1461r1462
116116
117117   mame_system_time systime;
118118   int raw[8], i, j;
119   
119
120120   /* get the current date/time from the core */
121121   mame_get_current_datetime(Machine, &systime);
122   
122
123123   raw[0] = 0;   /* tenths and hundreths of seconds are always zero */
124124   raw[1] = dec_2_bcd(systime.local_time.second);
125125   raw[2] = dec_2_bcd(systime.local_time.minute);
r1461r1462
131131   raw[7] = dec_2_bcd(systime.local_time.year - 1900); /* Epoch is 1900 */
132132
133133   /* Ok now we have the raw bcd bytes. Now we need to push them into our bit array */
134   
134
135135   for( i=0; i<64; i++ )
136136   {
137137      j = i / 8;
r1461r1462
149149   /* This routine is called when new date and time has been written to the
150150      clock chip. Currently we ignore setting the date and time in the clock
151151      chip.
152     
152
153153      We always return the host's time when asked.
154154   */
155155}
src/mess/machine/ay3600.c
r1461r1462
361361   /* only repeat keys on a 2/2+ if special REPT key is pressed */
362362   if (a2_has_repeat())
363363      time_until_repeat = readinputportbytag("keyb_repeat") & 0x01 ? 0 : ~0;
364         
364
365365   /* check caps lock and set LED here */
366366   if (pressed_specialkey(SPECIALKEY_CAPSLOCK))
367367   {
src/mess/machine/ds1315.h
r1461r1462
11/* This is an emulation of Dallas Semiconductor's Phantom Time Chip.
22   DS1315.
3   
3
44   by tim lindner, November 2001.
55*/
66
src/mess/machine/pet.c
r1461r1462
225225}
226226
227227
228static const struct via6522_interface pet_via =
228static const struct via6522_interface pet_via =
229229{
230230   NULL,               /* in_a_func */
231231   pet_via_port_b_r,      /* in_b_func */
src/mess/machine/c16.c
r1461r1462
501501
502502      memory_install_write8_handler (0, ADDRESS_SPACE_PROGRAM, 0xff20, 0xff3d, 0, 0, MWA8_BANK10);
503503      memory_install_write8_handler (0, ADDRESS_SPACE_PROGRAM, 0xff40, 0xffff, 0, 0, MWA8_BANK11);
504      memory_set_bankptr(10, mess_ram + (0xff20 % mess_ram_size));
505      memory_set_bankptr(11, mess_ram + (0xff40 % mess_ram_size));
504      memory_set_bankptr(10, mess_ram + (0xff20 % mess_ram_size));
505      memory_set_bankptr(11, mess_ram + (0xff40 % mess_ram_size));
506506
507507      if (SIDCARD_HACK)
508508         memory_install_write8_handler (0, ADDRESS_SPACE_PROGRAM,  0xd400, 0xd41f, 0, 0, c16_sidcart_16k);
r1461r1462
613613
614614   size = image_length (image);
615615
616   filetype = image_filetype(image);   
616   filetype = image_filetype(image);
617617   if (filetype && !mame_stricmp (filetype, "prg"))
618618   {
619619      unsigned short in;
src/mess/machine/osi.c
r1461r1462
2121{
2222   if (sb2m600_tape_image && (sb2m600_tape_index < sb2m600_tape_size))
2323      return ACIA_6850_RDRF;
24   
24
2525   return 0;
2626}
2727
src/mess/machine/oric.c
r1461r1462
253253PB6
254254 tape connector motor control 0
255255
256PB7
256PB7
257257 tape connector output high 1
258258
259259 */
r1461r1462
11161116MACHINE_START( oric )
11171117{
11181118   oric_common_init_machine();
1119   
1119
11201120   oric_is_telestrat = 0;
11211121
11221122   oric_ram_0x0c000 = auto_malloc(16384);
r1461r1462
12161216   {
12171217      if ((offset & 0x0f)!=0x0d)
12181218      {
1219         logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpunum_get_reg(0, REG_PC));
1219         logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpunum_get_reg(0, REG_PC));
12201220      }
12211221   }
12221222   /* it is repeated */
r1461r1462
12561256#endif
12571257   if (enable_logging)
12581258   {
1259      logerror("via 0 w: %04x %02x %04x\n",offset,data,(unsigned) cpunum_get_reg(0, REG_PC));
1259      logerror("via 0 w: %04x %02x %04x\n",offset,data,(unsigned) cpunum_get_reg(0, REG_PC));
12601260   }
12611261
12621262   via_0_w(offset & 0x0f,data);
src/mess/machine/europc.c
r1461r1462
2525    fdb3e 0x8..0xc
2626   fd7f8
2727     fdb5f
28  fe172
28  fe172
2929   fecc5 // 801a video setup error
3030    fd6c9
3131   copyright output
r1461r1462
6363   read low 4 nibble at jim 0xa
6464   read low 4 nibble at jim 0xa
6565   return first nibble<<4|second nibble in ah
66  ff046 seldom compares ret
66  ff046 seldom compares ret
6767  ffe87 0 -> ds
6868
6969  469:
r1461r1462
145145   switch (europc_jim.state) {
146146   case 0: europc_jim.state++; return 0;
147147   case 1: europc_jim.state++; return 0x80;
148   case 2:
148   case 2:
149149      europc_jim.state=0;
150150      switch (europc_jim.mode) {
151151      case AGA_COLOR: return 0x87; // for color;
src/mess/machine/6551.c
r1461r1462
5151{
5252   /* get bit received from other side and update receive register */
5353   receive_register_update_bit(&acia.receive_reg, get_in_data_bit(acia.connection.input_state));
54   
54
5555   if (acia.receive_reg.flags & RECEIVE_REGISTER_FULL)
5656   {
5757      receive_register_extract(&acia.receive_reg, &acia.data_form);
r1461r1462
7272         acia_6551_refresh_ints();
7373      }
7474   }
75   
75
7676   /* if transmit is not empty... transmit data */
7777   if ((acia.transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0)
7878   {
r1461r1462
111111
112112   /* receive interrupts */
113113
114   /* receive data register full? */
114   /* receive data register full? */
115115   if (acia.status_register & (1<<3))
116116   {
117117      /* receiver interrupt enable? */
r1461r1462
244244
245245      case 1:
246246      {
247         /* telstrat writes 0x07f! */     
247         /* telstrat writes 0x07f! */
248248      }
249249      break;
250250
251251
252      /*
252      /*
253253      Command Register:
254254
255255      b0   Data Terminal Ready
r1461r1462
296296               acia.connection.State &=~SERIAL_STATE_RTS;
297297            }
298298            break;
299           
299
300300            case 1:
301301            case 2:
302302            case 3:
r1461r1462
351351         unsigned char previous_control_register;
352352
353353            previous_control_register = acia.control_register;
354   
354
355355            if (((previous_control_register^data) & 0x07)!=0)
356356         {
357357            int rate;
r1461r1462
372372
373373               switch (rate)
374374               {
375                 
375
376376                  default:
377377                  case 1:
378378                  {
379379                     baud_rate = 50;
380380                  }
381381                  break;
382                 
382
383383                  case 2:
384384                  {
385385                     baud_rate = 75;
r1461r1462
397397                     baud_rate = 135;
398398                  }
399399                  break;
400                 
400
401401                  case 5:
402402                  {
403403                     baud_rate = 150;
404404                  }
405                  break;                 
406                 
405                  break;
406
407407                  case 6:
408408                  {
409409                     baud_rate = 300;
r1461r1462
414414                  {
415415                     baud_rate = 600;
416416                  }
417                  break;   
418                 
417                  break;
418
419419                  case 8:
420420                  {
421421                     baud_rate = 1200;
422422                  }
423                  break;                 
424                 
423                  break;
424
425425                  case 9:
426426                  {
427427                     baud_rate = 1800;
428428                  }
429                  break;                 
430                 
429                  break;
430
431431                  case 10:
432432                  {
433433                     baud_rate = 2400;
r1461r1462
439439                     baud_rate = 3600;
440440                  }
441441                  break;
442                 
442
443443                  case 12:
444444                  {
445445                     baud_rate = 4800;
446446                  }
447447                  break;
448         
448
449449                  case 13:
450450                  {
451451                     baud_rate = 7200;
452452                  }
453453                  break;
454         
454
455455                  case 14:
456456                  {
457457                     baud_rate = 9600;
458458                  }
459459                  break;
460         
460
461461                  case 15:
462462                  {
463463                     baud_rate = 19200;
src/mess/machine/coleco.c
r1461r1462
4343         inport0 = input_port_0_r(0);
4444         inport1 = input_port_1_r(0);
4545         inport6 = input_port_6_r(0);
46         
47         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
46
47         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
4848         than one, a real ColecoVision think that it is a third button, so we are going to emulate
4949         the right behaviour */
50         
50
5151         data = 0x0F;   /* No key pressed by default */
5252         if (!(inport6&0x01)) /* If Driving Controller enabled -> no keypad 1*/
5353         {
r1461r1462
7171      {
7272         int data = input_port_2_r(0) & 0xCF;
7373         int inport6 = input_port_6_r(0);
74         
74
7575         if (inport6&0x07) /* If Extra Contollers enabled */
7676         {
7777             if (JoyStat[0]==0) data|=0x30; /* Spinner Move Left*/
7878             else if (JoyStat[0]==1) data|=0x20; /* Spinner Move Right */
79         } 
79         }
8080         return data | 0x80;
8181      }
8282   }
r1461r1462
9191         inport3 = input_port_3_r(0);
9292         inport4 = input_port_4_r(0);
9393
94         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
94         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
9595         than one, a real ColecoVision think that it is a third button, so we are going to emulate
9696         the right behaviour */
97         
97
9898         data = 0x0F;   /* No key pressed by default */
9999         if (!(inport3 & 0x01)) data &= 0x0A; /* 0 */
100100         if (!(inport3 & 0x02)) data &= 0x0D; /* 1 */
r1461r1462
116116      {
117117         int data = input_port_5_r(0) & 0xCF;
118118         int inport6 = input_port_6_r(0);
119         
119
120120         if (inport6&0x02) /* If Roller Controller enabled */
121121         {
122122             if (JoyStat[1]==0) data|=0x30;
123123             else if (JoyStat[1]==1) data|=0x20;
124         } 
124         }
125125
126126         return data | 0x80;
127127      }
src/mess/machine/at.c
r1461r1462
11/***************************************************************************
2   
2
33   IBM AT Compatibles
44
55***************************************************************************/
src/mess/machine/99_usbsm.c
r1461r1462
112112      /*
113113         bit
114114         0   >1x00   0: USB Host controller requests interrupt.
115         1   >1x02   0: USB Device controller requests interrupt.
115         1   >1x02   0: USB Device controller requests interrupt.
116116         2   >1x04   1: USB Host controller suspended.
117117         3   >1x06   1: USB Device controller suspended.
118118         4   >1x08   0: Strata FEEPROM is busy.
src/mess/machine/pc1403.c
r1461r1462
1313static int power=1; /* simulates pressed cce when mess is started */
1414
1515
16/*
16/*
1717   port 2:
1818     bits 0,1: external rom a14,a15 lines
19   port 3:
19   port 3:
2020     bits 0..6 keyboard output select matrix line
2121*/
2222static UINT8 asic[4];
r1461r1462
145145   if (KEY_UP) data|=0x10;
146146   if (KEY_U) data|=0x20;
147147   if (KEY_J) data|=0x40;
148   if (KEY_M) data|=0x80;   
148   if (KEY_M) data|=0x80;
149149    }
150150    if (outa&4) {
151151   if (KEY_BRACE_LEFT) data|=8;
src/mess/machine/electron.c
r1461r1462
236236      // video_update
237237      ula.current_pal[i+10] = (ula.current_pal[i+10] & 0x06) | ((data & 0x08) >> 3);
238238      ula.current_pal[i+8] = (ula.current_pal[i+8] & 0x06) | ((data & 0x04) >> 2);
239      ula.current_pal[i+2] = (ula.current_pal[i+2] & 0x04) | (((data & 0x20) >> 4) | ((data & 0x02) >> 1)); 
239      ula.current_pal[i+2] = (ula.current_pal[i+2] & 0x04) | (((data & 0x20) >> 4) | ((data & 0x02) >> 1));
240240      ula.current_pal[i] = (ula.current_pal[i] & 0x04) | (((data & 0x10) >> 3) | ((data & 0x01)));
241241      break;
242242   }
r1461r1462
289289MACHINE_START( electron )
290290{
291291   memory_configure_bank(2, 0, 16, memory_region(REGION_USER1), 0x4000);
292   
292
293293   ula.interrupt_status = 0x82;
294294   ula.interrupt_control = 0x00;
295295   timer_set( attotime_zero, NULL, 0, setup_beep );
src/mess/machine/pc_fdc.c
r1461r1462
44
55   TODO:
66      - check how the drive select from DOR register, and the drive select
7      from the fdc are related !!!!
7      from the fdc are related !!!!
88      - if all drives do not have a disk in them, and the fdc is reset, is a int generated?
99      (if yes, indicates drives are ready without discs, if no indicates no drives are ready)
1010      - status register a, status register b
r1461r1462
5252static void pc_fdc_hw_dma_drq(int,int);
5353static mess_image *pc_fdc_get_image(int floppy_index);
5454
55static const nec765_interface pc_fdc_nec765_interface =
55static const nec765_interface pc_fdc_nec765_interface =
5656{
5757   pc_fdc_hw_interrupt,
5858   pc_fdc_hw_dma_drq,
r1461r1462
205205      /* toggle reset state */
206206      nec765_set_reset_state(1);
207207       nec765_set_reset_state(0);
208   
208
209209      /* bit is self-clearing */
210210      data &= ~0x080;
211211   }
r1461r1462
281281         when the fdc is reset.
282282         In the FDC docs, it states that a INT will
283283         be generated if READY input is true when the
284         fdc is reset.
285         
284         fdc is reset.
285
286286            It also states, that outputs to drive are set to 0.
287287            Maybe this causes the drive motor to go on, and therefore
288            the ready line is set.
288            the ready line is set.
289289
290290         This in return causes a int?? ---
291     
292     
291
292
293293      what is not yet clear is if this is a result of the drives ready state
294294      changing...
295295      */
src/mess/machine/pc_hdc.c
r1461r1462
120120   "CMD_WRITESBUFF",      /* 0x0F */
121121
122122   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x10-0x17 */
123   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x18-0x1F */
123   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x18-0x1F */
124124   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x20-0x27 */
125   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x28-0x2F */
125   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x28-0x2F */
126126   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x30-0x37 */
127   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x38-0x3F */
127   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x38-0x3F */
128128   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x40-0x47 */
129   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x48-0x4F */
129   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x48-0x4F */
130130   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x50-0x57 */
131   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x58-0x5F */
131   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x58-0x5F */
132132   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x60-0x67 */
133   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x68-0x6F */
133   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x68-0x6F */
134134   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x70-0x77 */
135   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x78-0x7F */
135   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x78-0x7F */
136136   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x80-0x87 */
137   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x88-0x8F */
137   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x88-0x8F */
138138   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x90-0x97 */
139   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x98-0x9F */
139   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x98-0x9F */
140140   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xA0-0xA7 */
141   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xA8-0xAF */
141   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xA8-0xAF */
142142   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xB0-0xB7 */
143   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xB8-0xBF */
143   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xB8-0xBF */
144144   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xC0-0xC7 */
145   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xC8-0xCF */
145   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xC8-0xCF */
146146   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xD0-0xD7 */
147   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xD8-0xDF */
147   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xD8-0xDF */
148148
149149   "CMD_RAMDIAG",         /* 0xE0 */
150150   NULL,               /* 0xE1 */
r1461r1462
155155   "CMD_WRITELONG",      /* 0xE6 */
156156   NULL,               /* 0xE7 */
157157
158   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xE8-0xEF */
158   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xE8-0xEF */
159159   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0xF0-0xF7 */
160   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL  /* 0xF8-0xFF */
160   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL  /* 0xF8-0xFF */
161161};
162162
163163
r1461r1462
188188static hard_disk_file *pc_hdc_file(int id)
189189{
190190   mess_image *img;
191   
191
192192   img = image_from_devtype_and_index(IO_HARDDISK, id);
193193   if (!image_exists(img))
194194      return NULL;
r1461r1462
252252
253253   file = pc_hdc_file(idx);
254254   info = hard_disk_get_info(file);
255   
255
256256   lbasector = cylinder[idx];
257257   lbasector *= info->heads;
258258   lbasector += head[idx];
r1461r1462
284284   UINT8 result;
285285   hard_disk_info *info;
286286   hard_disk_file *file;
287   
287
288288   file = pc_hdc_file(idx);
289289   if (!file)
290290      return 0;
r1461r1462
324324{
325325   hard_disk_info *info;
326326   hard_disk_file *file;
327   
327
328328   file = pc_hdc_file(idx);
329329   if (!file)
330330      return;
331   info = hard_disk_get_info(file);   
331   info = hard_disk_get_info(file);
332332
333333   *(hdcdma_dst++) = data;
334334
r1461r1462
631631         status[n] &= ~STA_REQUEST;
632632         status[n] &= ~STA_READY;
633633         status[n] |= STA_INPUT;
634         
634
635635         assert(timer[n]);
636636         timer_adjust(timer[n], ATTOTIME_IN_MSEC(1), n, attotime_zero);
637637        }
src/mess/machine/centroni.c
r1461r1462
11/*
2  defines centronics/parallel port printer interface 
2  defines centronics/parallel port printer interface
33
44  provides a centronics printer simulation (sends output to IO_PRINTER)
55*/
r1461r1462
1616   /* These bytes are used in the timer callback. When the timer callback
1717   is executed, the control value is updated with the new data. The mask
1818   defines the bits that are changing, and the data is the new data */
19   /* The user defined callback in CENTRONICS_CONFIG is called with the
19   /* The user defined callback in CENTRONICS_CONFIG is called with the
2020   change. This allows systems that have interrupts triggered from the centronics
2121   interface to function correctly. e.g. Amstrad NC100 */
2222   /* mask of data to set in timer callback */
r1461r1462
9191void centronics_write_handshake(int nr, int data, int mask)
9292{
9393   CENTRONICS *This=cent+nr;
94   
94
9595   int neu=(data&mask)|(This->control&(~mask));
96   
96
9797   if (neu & CENTRONICS_NO_RESET)
9898   {
9999     /* strobe down */
r1461r1462
126126   }
127127   else
128128   {
129      if (This->control & CENTRONICS_SELECT)
129      if (This->control & CENTRONICS_SELECT)
130130         data|=CENTRONICS_ONLINE;
131131   }
132132   data |= CENTRONICS_NO_ERROR;
src/mess/machine/apple1.c
r1461r1462
473473**   through repeated accesses, rather than by writing to an address.
474474**   Data was read by reading an odd input address and comparing the
475475**   ROM byte returned to detect signal changes.
476**   
476**
477477**   The standard tape signal was a simple square wave, although this
478478**   was often greatly distorted by the cassette recorder.  A single
479479**   tape record consisted of a 10-second 800-Hz leader, followed by a
src/mess/machine/pc_ide.c
r1461r1462
1717   int sector_cnt;      /* sector count */
1818   int error;         /* error code */
1919   int status;         /* drive status */
20   
20
2121   int data_cnt;                /* data count */
2222   UINT8 *buffer;            /* data buffer */
2323   UINT8 *ptr;               /* data pointer */
src/mess/machine/mc6843.c
r1461r1462
4949
5050   /* interface */
5151   const mc6843_interface* iface;
52   
52
5353   /* registers */
5454   UINT8 CTAR;       /* current track */
5555   UINT8 CMR;        /* command */
r1461r1462
7373
7474   /* trigger delayed actions (bottom halves) */
7575   emu_timer* timer_cont;
76   
76
7777} * mc6843;
7878
7979
r1461r1462
9696
9797
9898#if VERBOSE
99static const char* mc6843_cmd[16] =
100{
99static const char* mc6843_cmd[16] =
100{
101101   "---", "---", "STZ", "SEK", "SSR", "SSW", "RCR", "SWD",
102102   "---", "---", "FFR", "FFW", "MSR", "MSW", "---", "---",
103103};
r1461r1462
145145   int irq = 0;
146146
147147   /* ISR3 */
148   if ( (mc6843->CMR & 0x40) || ! mc6843->STRB )
148   if ( (mc6843->CMR & 0x40) || ! mc6843->STRB )
149149      mc6843->ISR &= ~8;
150150   else
151151      mc6843->ISR |=  8;
152152
153153   /* interrupts */
154   if ( mc6843->ISR & 4 )
154   if ( mc6843->ISR & 4 )
155155      irq = 1; /* unmaskable */
156   if ( ! (mc6843->CMR & 0x80) )
156   if ( ! (mc6843->CMR & 0x80) )
157157   {
158158      /* maskable */
159      if ( mc6843->ISR & ~4 )
159      if ( mc6843->ISR & ~4 )
160160         irq = 1;
161161   }
162162
163   if ( mc6843->iface->irq_func )
163   if ( mc6843->iface->irq_func )
164164   {
165165      mc6843->iface->irq_func( irq );
166166      LOG(( "mc6843_status_update: irq=%i (CMR=%02X, ISR=%02X)\n", irq, mc6843->CMR, mc6843->ISR ));
r1461r1462
204204   /* seek to track zero */
205205   for ( i=0; i<83; i++ )
206206   {
207      if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) )
207      if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) )
208208         break;
209209      floppy_drive_seek( img, -1 );
210210   }
211211
212212   LOG(( "%f mc6843_finish_STZ: actual=%i\n", attotime_to_double(timer_get_time()), floppy_drive_get_current_track( img ) ));
213     
213
214214   /* update state */
215215   mc6843->CTAR = 0;
216216   mc6843->GCR = 0;
r1461r1462
248248   mess_image* img = mc6843_floppy_image();
249249   int r = 0;
250250
251   while ( 1 )
251   while ( 1 )
252252   {
253     
253
254254      if ( ( ! floppy_drive_get_next_id( img, mc6843->side, id ) ) || ( id->flags & ID_FLAG_CRC_ERROR_IN_ID_FIELD ) || ( id->N != 0 ) )
255255      {
256256         /* read address error */
r1461r1462
274274      {
275275         /* found! */
276276         LOG(( "%f mc6843_address_search: sector %i found on track %i\n", attotime_to_double(timer_get_time()), id->R, id->C ));
277         if ( ! (mc6843->CMR & 0x20) )
277         if ( ! (mc6843->CMR & 0x20) )
278278         {
279279            mc6843->ISR |= 0x04; /* if no DMA, set Status Sense */
280280         }
281281         return 1;
282282      }
283283
284      if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
284      if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
285285      {
286286         r++;
287287         if ( r >= 4 )
r1461r1462
303303/* preamble specific to read commands (adds extra checks) */
304304static int mc6843_address_search_read( chrn_id* id )
305305{
306   if ( ! mc6843_address_search( id ) )
307      return 0;   
306   if ( ! mc6843_address_search( id ) )
307      return 0;
308308
309309   if ( id->flags & ID_FLAG_CRC_ERROR_IN_DATA_FIELD )
310310   {
r1461r1462
330330static void mc6843_finish_RCR( void )
331331{
332332   chrn_id id;
333   if ( ! mc6843_address_search_read( &id ) )
333   if ( ! mc6843_address_search_read( &id ) )
334334      return;
335335   mc6843_cmd_end();
336336}
r1461r1462
344344   mess_image* img = mc6843_floppy_image();
345345
346346   /* sector seek */
347   if ( ! mc6843_address_search_read( &id ) )
347   if ( ! mc6843_address_search_read( &id ) )
348348      return;
349349
350350   /* sector read */
r1461r1462
363363   chrn_id id;
364364
365365   /* sector seek */
366   if ( ! mc6843_address_search( &id ) )
366   if ( ! mc6843_address_search( &id ) )
367367      return;
368368
369369   /* setup sector write buffer */
r1461r1462
409409   UINT8 data = 0;
410410
411411   switch ( offset ) {
412     
412
413413   case 0: /* Data Input Register (DIR) */
414414   {
415415      int cmd = mc6843->CMR & 0x0f;
416416
417417      LOG(( "%f $%04x mc6843_r: data input cmd=%s(%i), pos=%i/%i, GCR=%i, ",
418            attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
419            mc6843_cmd[cmd], cmd, mc6843->data_idx,
418            attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
419            mc6843_cmd[cmd], cmd, mc6843->data_idx,
420420            mc6843->data_size, mc6843->GCR ));
421421
422422      if ( cmd == CMD_SSR || cmd == CMD_MSR )
423      {         
423      {
424424         /* sector read */
425425         assert( mc6843->data_size > 0 );
426426         assert( mc6843->data_idx < mc6843->data_size );
r1461r1462
439439               /* schedule next sector in multiple sector read */
440440               mc6843->GCR--;
441441               mc6843->SAR++;
442               if ( mc6843->GCR == 0xff )
442               if ( mc6843->GCR == 0xff )
443443               {
444444                  mc6843_cmd_end();
445445               }
446               else if ( mc6843->SAR > 26 )
447                 
446               else if ( mc6843->SAR > 26 )
447
448448               {
449449                  mc6843->STRB |= 0x08; /* set Sector Address Undetected */
450450                  mc6843_cmd_end();
r1461r1462
464464      {
465465         data = mc6843->data[0];
466466      }
467      else
467      else
468468      {
469469         /* XXX TODO: other read modes */
470470         data = mc6843->data[0];
r1461r1462
501501      mess_image* img = mc6843_floppy_image();
502502      int flag = floppy_drive_get_flag_state( img, FLOPPY_DRIVE_READY | FLOPPY_DRIVE_HEAD_AT_TRACK_0 | FLOPPY_DRIVE_DISK_WRITE_PROTECTED );
503503      mc6843->STRA &= 0xa3;
504      if ( flag & FLOPPY_DRIVE_READY )
504      if ( flag & FLOPPY_DRIVE_READY )
505505         mc6843->STRA |= 0x04;
506      if ( flag & FLOPPY_DRIVE_HEAD_AT_TRACK_0 )
506      if ( flag & FLOPPY_DRIVE_HEAD_AT_TRACK_0 )
507507         mc6843->STRA |= 0x08;
508      if ( flag & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
508      if ( flag & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
509509         mc6843->STRA |= 0x10;
510      if ( mc6843->index_pulse )
510      if ( mc6843->index_pulse )
511511         mc6843->STRA |= 0x40;
512512
513513      data = mc6843->STRA;
r1461r1462
529529      mc6843->STRB &= ~0xfb;
530530      mc6843_status_update();
531531      break;
532     
532
533533   case 7: /* Logical-Track Address Register (LTAR) */
534534      data = mc6843->LTAR;
535535      LOG(( "%f $%04x mc6843_r: read LTAR %i (actual=%i)\n",
r1461r1462
547547WRITE8_HANDLER ( mc6843_w )
548548{
549549   switch ( offset ) {
550     
550
551551   case 0: /* Data Output Register (DOR) */
552552   {
553553      int cmd = mc6843->CMR & 0x0f;
554554      int FWF = (mc6843->CMR >> 4) & 1;
555555
556556      LOG(( "%f $%04x mc6843_w: data output cmd=%s(%i), pos=%i/%i, GCR=%i, data=%02X\n",
557            attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
558            mc6843_cmd[cmd], cmd, mc6843->data_idx,
557            attotime_to_double(timer_get_time()), activecpu_get_previouspc(),
558            mc6843_cmd[cmd], cmd, mc6843->data_idx,
559559            mc6843->data_size, mc6843->GCR, data ));
560560
561561      if ( cmd == CMD_SSW || cmd == CMD_MSW || cmd == CMD_SWD )
r1461r1462
573573
574574            LOG(( "%f $%04x mc6843_w: write sector %i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6843->data_id ));
575575
576            floppy_drive_write_sector_data(
576            floppy_drive_write_sector_data(
577577               img, mc6843->side, mc6843->data_id,
578578               mc6843->data, mc6843->data_size,
579579               (cmd == CMD_SWD) ? ID_FLAG_DELETED_DATA : 0 );
r1461r1462
584584            {
585585               mc6843->GCR--;
586586               mc6843->SAR++;
587               if ( mc6843->GCR == 0xff )
587               if ( mc6843->GCR == 0xff )
588588               {
589589                  mc6843_cmd_end();
590590               }
591               else if ( mc6843->SAR > 26 )
592                 
591               else if ( mc6843->SAR > 26 )
592
593593               {
594594                  mc6843->STRB |= 0x08; /* set Sector Address Undetected */
595595                  mc6843_cmd_end();
r1461r1462
609609      {
610610         /* assume we are formatting */
611611         UINT8 nibble;
612         nibble =
612         nibble =
613613            (data & 0x01) |
614614            ((data & 0x04) >> 1 )|
615615            ((data & 0x10) >> 2 )|
r1461r1462
617617
618618         assert( mc6843->data_idx < sizeof(mc6843->data) );
619619
620         mc6843->data[mc6843->data_idx / 2] =
620         mc6843->data[mc6843->data_idx / 2] =
621621            (mc6843->data[mc6843->data_idx / 2] << 4) | nibble;
622622
623623         if ( (mc6843->data_idx == 0) && (mc6843->data[0] == 0xfe ) )
r1461r1462
748748            attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6843->LTAR, data,
749749            floppy_drive_get_current_track( mc6843_floppy_image() ) ));
750750      break;
751     
751
752752   default:
753753      logerror( "$%04x mc6843 invalid write offset %i (data=$%02X)\n", activecpu_get_previouspc(), offset, data );
754754   }
r1461r1462
766766   LOG (( "mc6843 reset\n" ));
767767
768768   /* setup/reset floppy drive */
769   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
769   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
770770   {
771771      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
772772      floppy_drive_set_index_pulse_callback( img, mc6843_index_pulse_callback );
r1461r1462
796796
797797void mc6843_config ( const mc6843_interface* iface )
798798{
799   assert( iface );
799   assert( iface );
800800   mc6843 = auto_malloc( sizeof( * mc6843 ) );
801801   assert( mc6843 );
802802   memset( mc6843, 0, sizeof( * mc6843 ) );
src/mess/machine/mm58274c.c
r1461r1462
9797
9898   {
9999      mame_system_time systime;
100     
100
101101      /* get the current date/time from the core */
102102      mame_get_current_datetime(Machine, &systime);
103103
src/mess/machine/ibmpc.c
r1461r1462
118118   /* KB port A */
119119   if (pc_ppi.keyboard_disabled)
120120   {
121      /*   0  0 - no floppy drives 
122       *   1  Not used 
123       * 2-3  The number of memory banks on the system board 
121      /*   0  0 - no floppy drives
122       *   1  Not used
123       * 2-3  The number of memory banks on the system board
124124       * 4-5  Display mode
125125       *       11 = monochrome
126126       *      10 - color 80x25
127       *      01 - color 40x25 
128       * 6-7  The number of floppy disk drives 
127       *      01 - color 40x25
128       * 6-7  The number of floppy disk drives
129129       */
130130      data = readinputport(1);
131131   }
src/mess/machine/68901mfp.c
r1461r1462
88   - disable GPIO3/4 interrupts when timer A/B in pulse mode
99   - spurious interrupt
1010
11      If you look at the MFP datasheet it is obvious that it can generate the conditions for a spurious interrupt.
11      If you look at the MFP datasheet it is obvious that it can generate the conditions for a spurious interrupt.
1212      However the fact that they indeed happen in the ST is quite interesting.
1313
14      The MFP will generate a spurious interrupt if interrupts are disabled (by changing the IERA/IERB registers)
15      at the “precise point”. The precise point would be after the system (but not necessarily the CPU, see below)
14      The MFP will generate a spurious interrupt if interrupts are disabled (by changing the IERA/IERB registers)
15      at the “precise point”. The precise point would be after the system (but not necessarily the CPU, see below)
1616      triggered an MFP interrupt, and before the CPU drives the interrupt acknowledge cycle.
1717
18      If the MFP was connected directly to the CPU, spurious interrupts probably couldn’t happen. However in the
19      ST, GLUE seats in the middle and handles all the interrupt timing. It is possible that GLUE introduces a
18      If the MFP was connected directly to the CPU, spurious interrupts probably couldn’t happen. However in the
19      ST, GLUE seats in the middle and handles all the interrupt timing. It is possible that GLUE introduces a
2020      delay between detecting a change in the MFP interrupt request signal and actually propagating the change to
21      the CPU IPL signals (it is even possible that GLUE make some kind of latching). This would create a window
22      long enough for the “precise point” described above.
21      the CPU IPL signals (it is even possible that GLUE make some kind of latching). This would create a window
22      long enough for the “precise point” described above.
2323
2424      "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.
2525      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."
26   
26
2727   - divide serial clock by 16
2828   - synchronous mode
2929   - 1.5/2 stop bits
r1461r1462
6868static mfp_68901 mfp[MAX_MFP];
6969
7070static const int MFP68901_INT_MASK_GPIO[] =
71{
72   MFP68901_IR_GPIP_0, MFP68901_IR_GPIP_1, MFP68901_IR_GPIP_2, MFP68901_IR_GPIP_3,
73   MFP68901_IR_GPIP_4, MFP68901_IR_GPIP_5, MFP68901_IR_GPIP_6, MFP68901_IR_GPIP_7
71{
72   MFP68901_IR_GPIP_0, MFP68901_IR_GPIP_1, MFP68901_IR_GPIP_2, MFP68901_IR_GPIP_3,
73   MFP68901_IR_GPIP_4, MFP68901_IR_GPIP_5, MFP68901_IR_GPIP_6, MFP68901_IR_GPIP_7
7474};
7575
7676static const int MFP68901_INT_MASK_TIMER[] =
r1461r1462
752752      }
753753      break;
754754
755   case MFP68901_REGISTER_TCDCR:
755   case MFP68901_REGISTER_TCDCR:
756756      mfp_p->tcdcr = data & 0x6f;
757757
758758      switch (mfp_p->tcdcr & 0x07)
r1461r1462
11731173   {
11741174      timer_pulse(ATTOTIME_IN_HZ(mfp_p->intf->rx_clock), NULL, which, rx_tick);
11751175   }
1176   
1176
11771177   // serial transmit timer
11781178
11791179   if (mfp_p->intf->tx_clock > 0)
src/mess/machine/amigafdc.c
r1461r1462
11/***************************************************************************
22
33   Amiga floppy disk controller emulation
4   
4
55   - The drive spins at 300 RPM = 1 Rev every 200ms
66   - At 2usec per bit, that's 12500 bytes per track, or 6250 words per track
77   - At 4usec per bit, that's 6250 bytes per track, or 3125 words per track
r1461r1462
8888   fdc_status[id].disk_changed = DISK_DETECT_DELAY;
8989
9090   memset( fdc_status[id].mfm, 0xaa, MAX_MFM_TRACK_LEN );
91   
91
9292   fdc_sel = 0x0f;
9393   fdc_dir = 0;
9494   fdc_side = 1;
9595   fdc_step = 1;
9696   fdc_rdy = 0;
97   
97
9898   return INIT_PASS;
9999}
100100
101101static void check_extended_image( int id )
102102{
103103   UINT8   header[8], data[4];
104   
104
105105   fdc_status[id].is_ext_image = 0;
106   
106
107107   if ( image_fseek( fdc_status[id].f, 0, SEEK_SET ) )
108108   {
109109      logerror("FDC: image_fseek failed!\n" );
r1461r1462
111111   }
112112
113113   image_fread( fdc_status[id].f, &header, sizeof( header ) );
114   
114
115115   if ( memcmp( header, "UAE--ADF", sizeof( header ) ) == 0 )
116116   {
117117      int      i;
118     
118
119119      for( i = 0; i < MAX_TRACKS; i++ )
120120      {
121121         image_fread( fdc_status[id].f, &data, sizeof( data ) );
122         
122
123123         /* data[0,1] = SYNC - data[2,3] = LEN */
124         
124
125125         fdc_status[id].extinfo[i] = data[0];
126126         fdc_status[id].extinfo[i] <<= 8;
127127         fdc_status[id].extinfo[i] |= data[1];
r1461r1462
129129         fdc_status[id].extinfo[i] |= data[2];
130130         fdc_status[id].extinfo[i] <<= 8;
131131         fdc_status[id].extinfo[i] |= data[3];
132         
132
133133         if ( i == 0 )
134134            fdc_status[id].extoffs[i] = sizeof( header ) + ( MAX_TRACKS * sizeof( data ) );
135135         else
136136            fdc_status[id].extoffs[i] = fdc_status[id].extoffs[i-1] + ( fdc_status[id].extinfo[i-1] & 0xffff );
137137      }
138     
138
139139      fdc_status[id].is_ext_image = 1;
140140   }
141141}
r1461r1462
153153   timer_reset( fdc_status[id].sync_timer, attotime_never );
154154   timer_reset( fdc_status[id].dma_timer, attotime_never );
155155   fdc_rdy = 0;
156   
156
157157   check_extended_image( id );
158158
159159   return INIT_PASS;
r1461r1462
162162static DEVICE_UNLOAD(amiga_fdc)
163163{
164164   int id = image_index_in_device(image);
165   
165
166166   fdc_status[id].disk_changed = DISK_DETECT_DELAY;
167167   fdc_status[id].f = NULL;
168168   fdc_status[id].cached = -1;
r1461r1462
233233}
234234
235235static TIMER_CALLBACK(fdc_sync_proc)
236{   
236{
237237   int drive = param;
238238   UINT16         sync = CUSTOM_REG(REG_DSRSYNC);
239239   int            cur_pos;
240240   int            sector;
241241   int            time;
242   
242
243243   /* if floppy got ejected, stop */
244244   if ( fdc_status[drive].disk_changed )
245245      goto bail;
246   
246
247247   if ( fdc_status[drive].motor_on == 0 )
248248      goto bail;
249   
249
250250   cur_pos = fdc_get_curpos( drive );
251   
251
252252   if ( cur_pos <= ( GAP_TRACK_BYTES + 6 ) )
253253   {
254254      sector = 0;
r1461r1462
257257   {
258258      sector = ( cur_pos - ( GAP_TRACK_BYTES + 6 ) ) / ONE_SECTOR_BYTES;
259259   }
260   
260
261261   setup_fdc_buffer( drive );
262   
262
263263   if ( cur_pos < 2 )
264264      cur_pos = 2;
265   
265
266266   if ( fdc_status[drive].mfm[cur_pos-2] == ( ( sync >> 8 ) & 0xff ) &&
267267       fdc_status[drive].mfm[cur_pos-1] == ( sync & 0xff ) )
268268   {
269269      amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKSYN, 0);
270270   }
271   
271
272272   if ( sector < 10 )
273273   {
274274      /* start the sync timer */
r1461r1462
278278      timer_adjust( fdc_status[drive].sync_timer, ATTOTIME_IN_USEC( time ), drive, attotime_zero );
279279      return;
280280   }
281   
281
282282bail:
283283   timer_reset( fdc_status[drive].sync_timer, attotime_never );
284284}
r1461r1462
296296   /* if floppy got ejected, also stop */
297297   if ( fdc_status[drive].disk_changed )
298298      goto bail;
299     
299
300300   if ( fdc_status[drive].motor_on == 0 )
301301      goto bail;
302302
r1461r1462
307307      if ( fdc_status[drive].len > 0 )
308308      {
309309         logerror("Write to disk unsupported yet\n" );
310     
310
311311         amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
312312      }
313313   }
r1461r1462
316316      offs_t offset = fdc_status[drive].ptr;
317317      int cur_pos = fdc_status[drive].pos;
318318      int len = fdc_status[drive].len;
319     
319
320320      if ( len > MAX_WORDS_PER_DMA_CYCLE ) len = MAX_WORDS_PER_DMA_CYCLE;
321         
321
322322      fdc_status[drive].len -= len;
323     
323
324324      while ( len-- )
325325      {
326326         int dat = ( fdc_status[drive].mfm[cur_pos++] ) << 8;
r1461r1462
335335
336336         offset += 2;
337337      }
338     
338
339339      fdc_status[drive].ptr = offset;
340340      fdc_status[drive].pos = cur_pos;
341     
341
342342      if ( fdc_status[drive].len <= 0 )
343343      {
344344         amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
r1461r1462
348348         int time;
349349         double   len_words = fdc_status[drive].len;
350350         if ( len_words > MAX_WORDS_PER_DMA_CYCLE ) len_words = MAX_WORDS_PER_DMA_CYCLE;
351           
351
352352         time = len_words * 2;
353353         time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
354354         time *= 8;
r1461r1462
356356         return;
357357      }
358358   }
359   
359
360360bail:
361361   timer_reset( fdc_status[drive].dma_timer, attotime_never );
362362}
r1461r1462
375375      amiga_custom_w(REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0);
376376      return;
377377   }
378   
378
379379   if ( ( CUSTOM_REG(REG_DSKLEN) & 0x8000 ) == 0 )
380380      goto bail;
381381
r1461r1462
384384
385385   if ( fdc_status[drive].disk_changed )
386386      goto bail;
387     
387
388388   setup_fdc_buffer( drive );
389389
390390   fdc_status[drive].len = CUSTOM_REG(REG_DSKLEN) & 0x3fff;
391391   fdc_status[drive].ptr = CUSTOM_REG_LONG(REG_DSKPTH);
392392   fdc_status[drive].pos = cur_pos = fdc_get_curpos( drive );
393   
393
394394   /* we'll do a set amount at a time */
395395   len_words = fdc_status[drive].len;
396396   if ( len_words > MAX_WORDS_PER_DMA_CYCLE ) len_words = MAX_WORDS_PER_DMA_CYCLE;
r1461r1462
419419         time += 2;
420420      }
421421   }
422   
422
423423   time += len_words * 2;
424424   time *= ( CUSTOM_REG(REG_ADKCON) & 0x0100 ) ? 2 : 4;
425425   time *= 8;
426426   timer_adjust( fdc_status[drive].dma_timer, ATTOTIME_IN_USEC( time ), drive, attotime_zero );
427   
427
428428   return;
429   
429
430430bail:
431431   timer_reset( fdc_status[drive].dma_timer, attotime_never );
432432}
r1461r1462
453453#if 0
454454   popmessage("T:%d S:%d", fdc_status[drive].cyl, fdc_side );
455455#endif
456   
456
457457   if ( fdc_status[drive].is_ext_image )
458458   {
459459      len = fdc_status[drive].extinfo[offset] & 0xffff;
460         
460
461461      if ( len > ( MAX_MFM_TRACK_LEN - 2 ) )
462462         len = MAX_MFM_TRACK_LEN - 2;
463         
463
464464      if ( image_fseek( fdc_status[drive].f, fdc_status[drive].extoffs[offset], SEEK_SET ) )
465465      {
466466         logerror("FDC: image_fseek failed!\n" );
r1461r1462
468468         fdc_status[drive].disk_changed = DISK_DETECT_DELAY;
469469         return;
470470      }
471     
471
472472      /* if SYNC is 0000, then its a regular amiga dos track image */
473473      if ( ( fdc_status[drive].extinfo[offset] >> 16 ) == 0x0000 )
474474      {
r1461r1462
494494         fdc_status[drive].disk_changed = DISK_DETECT_DELAY;
495495         return;
496496      }
497     
497
498498      image_fread( fdc_status[drive].f, temp_cyl, len );
499499   }
500500
r1461r1462
508508      UINT32 tmp;
509509      UINT32 even, odd;
510510      UINT32 hck = 0, dck = 0;
511     
511
512512      /* Preamble and sync */
513513      *(dest + 0) = 0xaa;
514514      *(dest + 1) = 0xaa;
r1461r1462
520520      *(dest + 7) = 0x89;
521521
522522      /* Track and sector info */
523     
523
524524      tmp = 0xff000000 | (offset<<16) | (sector<<8) | (11 - sector);
525525      odd = (tmp & 0x55555555) | 0xaaaaaaaa;
526526      even = ( ( tmp >> 1 ) & 0x55555555 ) | 0xaaaaaaaa;
r1461r1462
555555          hck ^= (((UINT32) *(dest + x))<<24) | (((UINT32) *(dest + x + 1))<<16) |
556556                (((UINT32) *(dest + x + 2))<<8) | ((UINT32) *(dest + x + 3));
557557
558      even = odd = hck;
558      even = odd = hck;
559559      odd >>= 1;
560560      even |= 0xaaaaaaaa;
561561      odd |= 0xaaaaaaaa;
562     
562
563563      *(dest + 48) = (UINT8) ((odd & 0xff000000)>>24);
564564      *(dest + 49) = (UINT8) ((odd & 0xff0000)>>16);
565565      *(dest + 50) = (UINT8) ((odd & 0xff00)>>8);
r1461r1462
601601
602602   timer_adjust(fdc_status[drive].rev_timer, ATTOTIME_IN_MSEC( ONE_REV_TIME ), drive, attotime_zero);
603603   fdc_status[drive].rev_timer_started = 1;
604   
604
605605   if ( fdc_status[drive].is_ext_image == 0 )
606606   {
607607      /* also start the sync timer */
r1461r1462
637637}
638638
639639static void fdc_setup_leds( int drive ) {
640   
640
641641   char portname[12];
642642   sprintf(portname, "drive_%d_led", drive);
643643   output_set_value(portname, fdc_status[drive].motor_on == 0 ? 0 : 1);
644   
644
645645   if ( drive == 0 )
646646      set_led_status( 1, fdc_status[drive].motor_on ); /* update internal drive led */
647647
r1461r1462
657657      if ( fdc_status[drive].cyl < 79 )
658658         fdc_status[drive].cyl++;
659659   }
660   
660
661661   /* Update disk detection if applicable */
662662   if ( fdc_status[drive].f != NULL )
663663   {
r1461r1462
685685void amiga_fdc_control_w( UINT8 data ) {
686686   int step_pulse;
687687   int drive;
688   
688
689689   if ( fdc_sel != ( ( data >> 3 ) & 15 ) )
690690      fdc_rdy = 0;
691691
r1461r1462
719719
720720   for ( drive = 0; drive < NUM_DRIVES; drive++ ) {
721721      if ( !( fdc_sel & ( 1 << drive ) ) ) {
722         
722
723723         if ( fdc_status[drive].motor_on ) {
724724            if ( fdc_rdy ) ret &= ~0x20;
725725            fdc_rdy = 1;
src/mess/machine/z80dart.c
r1461r1462
539539   int ch = param & 1;
540540   UINT8 old;
541541   char linename[4];
542   
542
543543   switch (line)
544544   {
545545   case DART_RR0_CTS:
src/mess/machine/amigakbd.c
r1461r1462
2121static void kbd_sendscancode( UINT8 scancode )
2222{
2323   int j;
24   
24
2525   /* send over to the cia A */
2626   for( j = 0; j < 8; j++ )
2727   {
r1461r1462
3434static TIMER_CALLBACK( kbd_update_callback )
3535{
3636   UINT8   scancode;
37   
37
3838   (void)param;
39   
39
4040   /* if we don't have pending data, bail */
4141   if ( key_buf_pos == key_cur_pos )
4242      return;
43   
43
4444   /* fetch the next scan code and send it to the Amiga */
4545   scancode = key_buf[key_cur_pos++];
4646   key_cur_pos %= KEYBOARD_BUFFER_SIZE;
4747   kbd_sendscancode( scancode );
48   
48
4949   /* if we still have more data, schedule another update */
5050   if ( key_buf_pos != key_cur_pos )
5151   {
r1461r1462
6262   if ( (index == 3) && ( delta & 0x80000000 ) && ( newvalue & 0x80000000 ) )
6363   {
6464      const amiga_machine_interface *amiga_intf = amiga_get_interface();
65     
65
6666      if ( amiga_intf != NULL && amiga_intf->nmi_callback )
6767      {
6868         (*amiga_intf->nmi_callback)();
r1461r1462
7171   else
7272   {
7373      int      key_buf_was_empty = ( key_buf_pos == key_cur_pos ) ? 1 : 0;
74         
74
7575      for( i = 0; i < 32; i++ )
7676      {
7777         if ( delta & ( 1 << i ) )
r1461r1462
7979            int   down = ( newvalue & ( 1 << i ) ) ? 0 : 1;
8080            int   scancode = ( ( (index*32)+i ) << 1 ) | down;
8181            int amigacode = ~scancode;
82     
83            /* add the keycode to the buffer */     
82
83            /* add the keycode to the buffer */
8484            key_buf[key_buf_pos++] = amigacode & 0xff;
8585            key_buf_pos %= KEYBOARD_BUFFER_SIZE;
8686         }
8787      }
88     
88
8989      /* if the buffer was empty and we have new data, start a timer to send the keystrokes */
9090      if ( key_buf_was_empty && ( key_buf_pos != key_cur_pos ) )
9191      {
r1461r1462
107107
108108      input_port_set_changed_callback( port_tag_to_index( buf ), 0xFFFFFFFF, kbd_update, &kbd_index[i] );
109109   }
110   
110
111111   /* allocate a keyboard buffer */
112112   key_buf = auto_malloc( KEYBOARD_BUFFER_SIZE );
113113   key_buf_pos = 0;
r1461r1462
254254   PORT_BIT( 0x20000000, 0x0000, IPT_UNUSED)               // 7D
255255   PORT_BIT( 0x40000000, 0x0000, IPT_UNUSED)               // 7E
256256   PORT_BIT( 0x80000000, 0x0000, IPT_KEYBOARD)   PORT_CODE(KEYCODE_PGUP)      // 7F NMI button
257   
257
258258INPUT_PORTS_END
src/mess/machine/bebox.c
r1461r1462
249249   for (cpunum = 0; cpunum < 2; cpunum++)
250250   {
251251      interrupt = bebox_interrupts & bebox_cpu_imask[cpunum];
252     
252
253253      if (LOG_INTERRUPTS)
254254      {
255255         logerror("\tbebox_update_interrupts(): CPU #%d [%08X|%08X] IRQ %s\n", cpunum,
r1461r1462
450450      result &= ~(0xFF << 8);
451451      result |= ide_controller_0_r(0x3F6) << 8;
452452   }
453   
453
454454   if (((mem_mask >> 0) & 0xFF) == 0)
455455   {
456456      result &= ~(0xFF << 0);
r1461r1462
466466
467467   if (((mem_mask >> 8) & 0xFF) == 0)
468468      ide_controller_0_w(0x3F6, (data >> 8) & 0xFF);
469   
469
470470   if (((mem_mask >> 0) & 0xFF) == 0)
471471      ide_controller_0_w(0x3F7, (data >> 0) & 0xFF);
472472}
src/mess/machine/matsucd.c
r1461r1462
11/***************************************************************************
22
33   Matsushita/Panasonic CDR521/522 type CDROM drive emulation
4   
4
55Notes:
66This version implements the drive found in Amiga CDTV. There are
77different drives supporting this command-set (look in the sbpcd driver
r1461r1462
6464void matsucd_init( void )
6565{
6666   memset(&cd, 0, sizeof( matsucd ) );
67   
67
6868   cd.cdrom = mess_cd_get_cdrom_file_by_number(0);
69   
69
7070   cd.frame_timer = timer_alloc(matsu_subcode_proc, NULL);
71   
71
7272   cd.stch_signal = 1;
7373}
7474
r1461r1462
9898      case 2324: return CD_TRACK_MODE2_FORM2; break;
9999      case 2336: return CD_TRACK_MODE2; break;
100100      case 2352: return CD_TRACK_MODE2_RAW; break;
101     
101
102102      default: logerror( "MATSUCD: Sector size %d unsupported!\n", cd.sector_size ); break;
103103   }
104   
104
105105   return CD_TRACK_RAW_DONTCARE;
106106}
107107
108108void matsucd_read_next_block( void )
109109{
110110   cd.xfer_offset = 0;
111   
111
112112   if ( cd.num_blocks )
113113   {
114114      cd.lba++;
115115      cd.num_blocks--;
116     
116
117117      if (!cdrom_read_data(cd.cdrom, cd.lba, cd.sector_buffer, matsucd_getsector_type()))
118118      {
119119         logerror( "MATSUCD - Warning: Read error on CD!\n" );
r1461r1462
126126   /* no more data to read on this sector */
127127   if ( cd.xfer_offset >= cd.sector_size )
128128      return -1;
129   
129
130130   if ( data )
131131      *data = cd.sector_buffer[cd.xfer_offset++];
132   
133   return 0;   
132
133   return 0;
134134}
135135
136136static void matsucd_cdda_stop( void )
137137{
138138   int cddanum = cdda_num_from_cdrom(cd.cdrom);
139   
139
140140   if (cddanum != -1)
141141   {
142142      cdda_stop_audio(cddanum);
r1461r1462
160160   if (cddanum != -1)
161161   {
162162      cdda_pause_audio(cddanum, pause);
163     
163
164164      if ( pause )
165165      {
166166         timer_reset( cd.frame_timer, attotime_never );
r1461r1462
175175static UINT8 matsucd_cdda_getstatus( UINT32 *lba )
176176{
177177   int cddanum = cdda_num_from_cdrom(cd.cdrom);
178   
178
179179   if ( lba ) *lba = 0;
180   
180
181181   if (cddanum != -1)
182182   {
183183      if (cdda_audio_active(cddanum))
184184      {
185185         if ( lba ) *lba = cdda_get_audio_lba(cddanum);
186           
186
187187         if (cdda_audio_paused(cddanum))
188188         {
189189            return 0x12;   /* audio paused */
r1461r1462
198198         return 0x13;   /* audio ended */
199199      }
200200   }
201   
201
202202   return 0x15;   /* no audio status */
203203}
204204
r1461r1462
230230static void update_status_enable( int level )
231231{
232232   cd.sten_signal = level;
233   
233
234234   if ( cd.sten_cb )
235235   {
236236      (*cd.sten_cb)(cd.sten_signal);
r1461r1462
240240static void update_status_changed( int level )
241241{
242242   cd.stch_signal = level;
243   
243
244244   if ( cd.stch_cb )
245245   {
246246      (*cd.stch_cb)(cd.stch_signal);
r1461r1462
250250static void update_subcode_ready( int level )
251251{
252252   cd.scor_signal = level;
253   
253
254254   if ( cd.scor_cb )
255255   {
256256      (*cd.scor_cb)(cd.scor_signal);
r1461r1462
267267   if ( status != cd.status )
268268   {
269269      cd.status = status;
270     
270
271271      if ( cd.stch_signal != 0 )
272272      {
273273         update_status_changed( 0 );
r1461r1462
279279static TIMER_CALLBACK(matsu_subcode_proc)
280280{
281281   int cddanum = cdda_num_from_cdrom(cd.cdrom);
282   
282
283283   (void)param;
284   
284
285285   if (cddanum != -1)
286286   {
287287      UINT8   s = matsucd_cdda_getstatus(NULL);
288288      UINT8   newstatus = cd.status;
289     
289
290290      if ( s == 0x11 || s == 0x12 )
291291      {
292292         if ( s == 0x11 )
r1461r1462
294294            update_subcode_ready( 1 );
295295            update_subcode_ready( 0 );
296296         }
297         
297
298298         newstatus |= MATSU_STATUS_PLAYING;
299         
299
300300         timer_adjust( cd.frame_timer, ATTOTIME_IN_HZ( 75 ), 0, attotime_zero );
301301      }
302302      else
303303      {
304304         newstatus &= ~MATSU_STATUS_PLAYING;
305305      }
306     
306
307307      matsucd_set_status( newstatus );
308308   }
309309}
r1461r1462
311311static void matsucd_command_error( void )
312312{
313313   UINT8   newstatus = cd.status;
314     
314
315315   newstatus &= ~MATSU_STATUS_SUCCESS;
316316   newstatus |= MATSU_STATUS_ERROR;
317   
317
318318   matsucd_set_status( newstatus );
319319}
320320
321321static void matsucd_complete_cmd( UINT8 len )
322322{
323323   UINT8   newstatus = cd.status;
324   
324
325325   cd.input_pos = 0;
326326   cd.output_pos = 0;
327327   cd.output_len = len;
328   
328
329329   newstatus &= ~MATSU_STATUS_ERROR;
330330   newstatus |= MATSU_STATUS_SUCCESS;
331   
331
332332   matsucd_set_status( newstatus );
333   
333
334334   update_status_enable( 1 );
335335   update_status_enable( 0 );
336336}
r1461r1462
338338UINT8 matsucd_response_r( void )
339339{
340340   UINT8   v = cd.output[cd.output_pos++];
341   
341
342342   if ( cd.output_pos < cd.output_len )
343343   {
344344      update_status_enable( 1 );
345345      update_status_enable( 0 );
346346   }
347   
347
348348   return v;
349349}
350350
351351void matsucd_command_w( UINT8 data )
352352{
353353   UINT8   cmd;
354   
354
355355   /* make sure we're enabled */
356356   if ( cd.enabled == 0 )
357357      return;
358   
358
359359   /* make sure /CMD is asserted */
360360   if ( cd.cmd_signal == 0 )
361361      return;
362   
362
363363   if ( cd.cdda_set == 0 )
364364   {
365365      if ( cd.cdrom )
366366         cdda_set_cdrom(0, cd.cdrom);
367     
367
368368      cd.cdda_set = 1;
369369   }
370   
370
371371   cd.input[cd.input_pos++] = data;
372372
373373   cmd = cd.input[0];
374   
374
375375   switch( cmd )
376376   {
377377      case 0x01:   /* seek */
378378      {
379379         if ( cd.input_pos < 7 )
380380            return;
381           
381
382382         /* stop CDDA audio if necessary */
383383         matsucd_cdda_stop();
384         
384
385385         cd.motor = 1;
386                 
386
387387         memset( cd.output, 0, 6 );
388388         matsucd_complete_cmd( 0 );
389389      }
390390      break;
391     
391
392392      case 0x02:   /* read sectors */
393393      {
394394         if ( cd.input_pos < 7 )
395395            return;
396         
396
397397         /* stop CDDA audio if necessary */
398398         matsucd_cdda_stop();
399           
399
400400         /* LBA */
401401         cd.lba = cd.input[1];
402402         cd.lba <<= 8;
403403         cd.lba |= cd.input[2];
404404         cd.lba <<= 8;
405405         cd.lba |= cd.input[3];
406         
406
407407         /* Number of blocks */
408408         cd.num_blocks = cd.input[4];
409409         cd.num_blocks <<= 8;
410410         cd.num_blocks |= cd.input[5];
411         
411
412412         /* Reset transfer count */
413413         cd.xfer_offset = 0;
414         
414
415415         /* go ahead and cache the first block */
416416         if (!cdrom_read_data(cd.cdrom, cd.lba, cd.sector_buffer, matsucd_getsector_type()))
417417         {
r1461r1462
419419            matsucd_command_error();
420420            return;
421421         }
422         
422
423423         cd.motor = 1;
424                 
424
425425         memset( cd.output, 0, 6 );
426426         matsucd_complete_cmd( 0 );
427427      }
428428      break;
429     
429
430430      case 0x04:   /* motor on */
431431      {
432432         if ( cd.input_pos < 7 )
433433            return;
434           
434
435435         cd.motor = 1;
436                 
436
437437         memset( cd.output, 0, 6 );
438438         matsucd_complete_cmd( 0 );
439439      }
440440      break;
441     
441
442442      case 0x05:   /* motor off */
443443      {
444444         if ( cd.input_pos < 7 )
445445            return;
446           
446
447447         /* stop CDDA audio if necessary */
448448         matsucd_cdda_stop();
449         
449
450450         cd.motor = 0;
451                 
451
452452         memset( cd.output, 0, 6 );
453453         matsucd_complete_cmd( 0 );
454454      }
455455      break;
456     
456
457457      case 0x09:   /* play audio cd, LBA mode */
458458      {
459459         UINT32   lba, numblocks;
460         
460
461461         if ( cd.input_pos < 7 )
462462            return;
463         
463
464464         lba = cd.input[1];
465465         lba <<= 8;
466466         lba |= cd.input[2];
467467         lba <<= 8;
468468         lba |= cd.input[3];
469         
469
470470         numblocks = cd.input[4];
471471         numblocks <<= 8;
472472         numblocks |= cd.input[5];
473473         numblocks <<= 8;
474474         numblocks |= cd.input[6];
475         
475
476476         matsucd_cdda_play( lba, numblocks );
477         
477
478478         cd.motor = 1;
479                 
479
480480         memset( cd.output, 0, 6 );
481481         matsucd_complete_cmd( 0 );
482482      }
483483      break;
484     
484
485485      case 0x0a:   /* play audio cd, MSF mode */
486486      {
487487         UINT32   start, end, lba_start, lba_end;
488         
488
489489         if ( cd.input_pos < 7 )
490490            return;
491         
491
492492         start = cd.input[1];
493493         start <<= 8;
494494         start |= cd.input[2];
495495         start <<= 8;
496496         start |= cd.input[3];
497         
497
498498         end = cd.input[4];
499499         end <<= 8;
500500         end |= cd.input[5];
501501         end <<= 8;
502502         end |= cd.input[6];
503         
503
504504         lba_start = MSF2LBA( start );
505505         lba_end = MSF2LBA( end );
506         
506
507507         if ( end == 0xffffff )
508508         {
509509            lba_end = cdrom_get_track_start(cd.cdrom,cdrom_get_last_track(cd.cdrom)-1);
510510            lba_end += cdrom_get_toc(cd.cdrom)->tracks[cdrom_get_last_track(cd.cdrom)-1].frames;
511511         }
512         
512
513513         if ( lba_end <= lba_start )
514514         {
515515            matsucd_cdda_stop();
r1461r1462
519519            matsucd_cdda_play( lba_start, lba_end - lba_start );
520520            cd.motor = 1;
521521         }
522         
522
523523         memset( cd.output, 0, 6 );
524524         matsucd_complete_cmd( 0 );
525525      }
526526      break;
527     
527
528528      case 0x0b:   /* play audio track and index */
529529      {
530530         UINT8   track_start = cd.input[1];
r1461r1462
532532         UINT8   track_end = cd.input[3];
533533         UINT8   index_end = cd.input[4];
534534         UINT32   lba_start, lba_end;
535         
535
536536         /* TODO: Add index support once the CDDA engine supports it */
537537         (void)index_start;
538538         (void)index_end;
539         
539
540540         /* sanitize values */
541541         if ( track_start == 0 ) track_start++;
542542         if ( track_end > cdrom_get_last_track(cd.cdrom) )
r1461r1462
545545         /* find the start and stop positions */
546546         lba_start = cdrom_get_track_start(cd.cdrom,track_start-1);
547547         lba_end = cdrom_get_track_start(cd.cdrom,track_end-1);
548         
548
549549         lba_end += cdrom_get_toc(cd.cdrom)->tracks[track_end-1].frames;
550         
550
551551         if ( lba_end <= lba_start )
552552         {
553553            matsucd_cdda_stop();
r1461r1462
557557            matsucd_cdda_play( lba_start, lba_end - lba_start );
558558            cd.motor = 1;
559559         }
560         
560
561561         memset( cd.output, 0, 6 );
562562         matsucd_complete_cmd( 0 );
563563      }
564564      break;
565     
565
566566      case 0x81:   /* status read */
567567      {
568568         UINT8   newstatus = cd.status;
569         
569
570570         newstatus &= MATSU_STATUS_SUCCESS | MATSU_STATUS_ERROR | MATSU_STATUS_PLAYING;
571571         newstatus |= MATSU_STATUS_READY;
572         
572
573573         if (cd.cdrom)
574574         {
575575            newstatus |= MATSU_STATUS_MEDIA;
576576         }
577         
577
578578         if (cd.motor)
579579            newstatus |= MATSU_STATUS_MOTOR;
580         
580
581581         cd.output[0] = newstatus;
582         
582
583583         matsucd_set_status( newstatus );
584         
584
585585         matsucd_complete_cmd( 1 );
586586      }
587587      break;
588     
588
589589      case 0x82:   /* error read */
590590      {
591591         if ( cd.input_pos < 7 )
592592            return;
593         
593
594594         memset( cd.output, 0, 6 );
595595         matsucd_complete_cmd( 6 );
596596      }
597597      break;
598     
598
599599      case 0x84:   /* set mode */
600600      {
601601         if ( cd.input_pos < 7 )
602602            return;
603           
603
604604         cd.sector_size = cd.input[2];
605605         cd.sector_size <<= 8;
606606         cd.sector_size |= cd.input[3];
607         
607
608608         memset( cd.output, 0, 6 );
609609         matsucd_complete_cmd( 0 );
610610      }
611611      break;
612     
612
613613      case 0x87:   /* read SUBQ */
614614      {
615615         int      msfmode;
616616         UINT32   lba;
617617         UINT8   track;
618                 
618
619619         if ( cd.input_pos < 7 )
620620            return;
621         
621
622622         msfmode = (cd.input[1] & 0x02) ? 1 : 0;
623           
623
624624         memset( cd.output, 0, 13 );
625         
625
626626         cd.output[0] = matsucd_cdda_getstatus( &lba );
627         
627
628628         if ( lba > 0 )
629629         {
630630            UINT32   disk_pos;
631631            UINT32   track_pos;
632           
632
633633            track = cdrom_get_track(cd.cdrom, lba);
634                 
634
635635            cd.output[1] = cdrom_get_adr_control(cd.cdrom, track);
636636            cd.output[2] = track+1;
637637            cd.output[3] = 0; /* index */
638         
638
639639            disk_pos = lba;
640640            if ( msfmode ) disk_pos = LBA2MSF(disk_pos);
641               
641
642642            cd.output[4] = (disk_pos >> 24) & 0xff;
643643            cd.output[5] = (disk_pos >> 16) & 0xff;
644644            cd.output[6] = (disk_pos >> 8) & 0xff;
645645            cd.output[7] = (disk_pos) & 0xff;
646         
646
647647            track_pos = lba - cdrom_get_track_start(cd.cdrom, track);
648648            if ( msfmode ) track_pos = LBA2MSF(track_pos);
649         
649
650650            cd.output[8] = (track_pos >> 24) & 0xff;
651651            cd.output[9] = (track_pos >> 16) & 0xff;
652652            cd.output[10] = (track_pos >> 8) & 0xff;
653653            cd.output[11] = (track_pos) & 0xff;
654         
654
655655            /* TODO: UPC flag at offset 12 */
656656            cd.output[12] = 0;
657657         }
658         
658
659659         matsucd_complete_cmd( 13 );
660660      }
661661      break;
662     
662
663663      case 0x89:   /* read disk info */
664664      {
665665         UINT32   end;
666         
666
667667         if ( cd.input_pos < 7 )
668668            return;
669         
669
670670         memset( cd.output, 0, 5 );
671         
671
672672         cd.output[0] = cdrom_get_last_track(cd.cdrom) ? 1 : 0;
673673         cd.output[1] = cdrom_get_last_track(cd.cdrom);
674674         end = cdrom_get_track_start(cd.cdrom,cd.output[1]-1);
r1461r1462
677677         cd.output[2] = (end >> 16) & 0xff;
678678         cd.output[3] = (end >> 8) & 0xff;
679679         cd.output[4] = (end) & 0xff;
680         
680
681681         matsucd_complete_cmd( 5 );
682682      }
683683      break;
684     
684
685685      case 0x8a:   /* read toc */
686686      {
687687         UINT8   track;
688688         int      msfmode;
689689         UINT32   track_start;
690         
690
691691         if ( cd.input_pos < 7 )
692692            return;
693         
693
694694         /* stop CDDA audio if necessary */
695695         matsucd_cdda_stop();
696                 
696
697697         track = cd.input[2];
698698         msfmode = (cd.input[1] & 0x02) ? 1 : 0;
699           
699
700700         if ( cd.cdrom == NULL )
701701         {
702702            logerror( "MATSUCD - Warning: Reading TOC without a CD!\n" );
703703            matsucd_command_error();
704704            return;
705705         }
706         
706
707707         if ( track > cdrom_get_last_track(cd.cdrom) )
708708         {
709709            logerror( "MATSUCD - Warning: Reading invalid track entry from TOC!\n" );
710710            matsucd_command_error();
711711            return;
712712         }
713         
713
714714         memset( cd.output, 0, 7 );
715   
715
716716         track_start = cdrom_get_track_start(cd.cdrom, track > 0 ? (track-1) : track );
717717         if ( msfmode ) track_start = LBA2MSF( track_start );
718718
r1461r1462
723723         cd.output[5] = (track_start >> 16) & 0xff;
724724         cd.output[6] = (track_start >> 8) & 0xff;
725725         cd.output[7] = (track_start) & 0xff;
726         
726
727727         cd.motor = 1;
728         
728
729729         matsucd_complete_cmd( 8 );
730730      }
731731      break;
732     
732
733733      case 0x8b:   /* pause audio */
734734      {
735735         if ( cd.input_pos < 7 )
736736            return;
737         
737
738738         matsucd_cdda_pause( (cd.input[1] == 0) ? 1 : 0 );
739739         memset( cd.output, 0, 7 );
740740         matsucd_complete_cmd( 0 );
741741      }
742742      break;
743     
743
744744      case 0xa3:   /* front panel */
745745      {
746746         if ( cd.input_pos < 7 )
747747            return;
748         
748
749749         /* TODO: ??? */
750           
750
751751         memset( cd.output, 0, 7 );
752752         matsucd_complete_cmd( 0 );
753753      }
754754      break;
755     
755
756756      default:
757757         logerror( "MATSUCD: Unknown/inimplemented command %08x\n", cmd );
758758      break;
src/mess/machine/abcbus.h
r1461r1462
4141   Type               Size      Tracks   Sides   Sectors/track   Sectors      Speed         Drives
4242
4343   ABC-830      Floppy      160 KB      40      1      16            640         250 Kbps      MPI 51, BASF 6106
44            Floppy      80 KB      40      1      8            320         250 Kbps      Scandia Metric FD2     
44            Floppy      80 KB      40      1      8            320         250 Kbps      Scandia Metric FD2
4545   ABC-832      Floppy      640 KB      80      2      16            2560      250 Kbps      Micropolis 1015, Micropolis 1115, BASF 6118
4646   ABC-834      Floppy      640 KB      80      2      16            2560      250 Kbps      Teac FD 55 F
4747   ABC-838      Floppy      1 MB      77      2      25            3978       500 Kbps      BASF 6104, BASF 6115
src/mess/machine/amigacrt.c
r1461r1462
11/***************************************************************************
22
33   Amiga cartridge emulation
4   
4
55TODO:
66- Investigate why the AR2/3 sometimes garble the video on exit from the cart
77- Add Nordic Power and similar carts
r1461r1462
3535static int check_kickstart_12_13( const char *cart_name )
3636{
3737   UINT16 * ksmem = (UINT16 *)memory_region( REGION_USER1 );
38   
38
3939   if ( ksmem[2] == 0x00FC )
4040      return 1;
41   
41
4242   logerror( "%s requires Kickstart version 1.2 or 1.3 - Cart not installed\n", cart_name );
43   
44   return 0;   
43
44   return 0;
4545}
4646
4747/***************************************************************************
4848
4949  Amiga Action Replay 1
50 
50
5151  Whenever you push the button, an NMI interrupt is generated.
52 
52
5353  The cartridge protects itself from being removed from memory by
5454  generating an interrupt whenever either the spurious interrupt
5555  vector is written at $60, or the nmi interrupt vector is written at
r1461r1462
5757  a NMI is generated, and the spurious irq vector is restored. If the
5858  NMI vector at $7c is written, then a spurious interrupt is generated,
5959  and the NMI vector is restored.
60 
60
6161  When breakpoints are set, the target address is replaced by a trap
6262  instruction, and the original contents of the address are kept in
6363  the cartridge's RAM. A trap handler is installed pointing to $40
r1461r1462
7676   {
7777      return M68K_INT_ACK_SPURIOUS;
7878   }
79   
79
8080   return (24+level);
8181}
8282
r1461r1462
9090{
9191   /* get the cart's built-in ram */
9292   UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x9fc000);
93   
93
9494   if ( ar_ram != NULL )
9595   {
9696      int i;
97     
97
9898      /* copy custom register values */
9999      for( i = 0; i < 256; i++ )
100100         ar_ram[0x1800+i] = CUSTOM_REG(i);
101   
101
102102      /* trigger NMI irq */
103103      amiga_ar1_spurious = 0;
104104      timer_set( ATTOTIME_IN_CYCLES(28,0), NULL, 0, amiga_ar1_delayed_nmi );
r1461r1462
108108static WRITE16_HANDLER( amiga_ar1_chipmem_w )
109109{
110110   int pc = safe_activecpu_get_pc();
111   
111
112112   /* see if we're inside the AR1 rom */
113113   if ( ((pc >> 16) & 0xff ) != 0xf0 )
114114   {
r1461r1462
121121         timer_set( ATTOTIME_IN_CYCLES(28,0), NULL, 0, amiga_ar1_delayed_nmi );
122122      }
123123   }
124   
124
125125   amiga_chip_ram_w( offset * 2, data );
126126}
127127
r1461r1462
133133static void amiga_ar1_init( void )
134134{
135135   void *ar_ram;
136   
136
137137   /* check kickstart version */
138138   if ( !check_kickstart_12_13( "Amiga Action Replay" ) )
139139   {
140140      amiga_cart_type = -1;
141141      return;
142142   }
143     
143
144144   /* setup the cart ram */
145145   ar_ram = auto_malloc(0x4000);
146146   memset(ar_ram, 0, 0x4000);
147     
147
148148   /* Install ROM */
149149   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf7ffff, 0, 0, MRA16_BANK2);
150150   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf7ffff, 0, 0, MWA16_ROM);
r1461r1462
156156   /* Configure Banks */
157157   memory_set_bankptr(2, memory_region(REGION_USER2));
158158   memory_set_bankptr(3, ar_ram);
159   
159
160160   amiga_ar1_spurious = 0;
161   
161
162162   /* Install IRQ ACK callback */
163163   cpunum_set_irq_callback(0,amiga_ar1_irqack);
164164}
r1461r1462
166166/***************************************************************************
167167
168168  Amiga Action Replay MKII/MKIII
169 
169
170170  Whenever you push the button, an overlay of the cartridge appears
171171  in RAM and an NMI interrupt is generated. Only reads are overlayed.
172172  Writes go directly to chipmem (so that the CPU can write the stack
173173  information for the NMI). Once the interrupt is taken, the cart
174174  disables the ROM overlay and checks it's internal mode register
175175  to see why it was invoked.
176 
176
177177  When a breakpoint is set the cart replaces the target instruction
178178  with a trap, and adds a trap handler that it locates in the $100-$120
179179  area. The handler simply has one instruction: TST.B $BFE001. This cia
180180  access is monitored, and the conditions match (PC < 120 and a previous
181181  command requested the monitoring of the cia) then the cart is invoked.
182 
182
183183***************************************************************************/
184184
185185static UINT16 amiga_ar23_mode;
r1461r1462
189189static READ16_HANDLER( amiga_ar23_cia_r )
190190{
191191   int pc = safe_activecpu_get_pc();
192   
192
193193   if ( ACCESSING_LSB && offset == 2048 && pc >= 0x40 && pc < 0x120 )
194194   {
195195      amiga_ar23_freeze();
196196   }
197   
197
198198   return amiga_cia_r( offset, mem_mask );
199199}
200200
r1461r1462
208208   {
209209      memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xbfd000, 0xbfefff, 0, 0, amiga_cia_r);
210210   }
211   
211
212212   amiga_ar23_mode = (data&0x3);
213213   if ( amiga_ar23_mode == 0 )
214214      amiga_ar23_mode = 1;
215   
215
216216}
217217
218218static READ16_HANDLER( amiga_ar23_mode_r )
219219{
220220   UINT16 *mem = (UINT16 *)memory_region( REGION_USER2 );
221   
221
222222   if ( ACCESSING_LSB )
223223   {
224224      if ( offset < 2 )
r1461r1462
227227      if ( offset == 0x03 ) /* disable cart oberlay on chip mem */
228228      {
229229         UINT32 mirror_mask = amiga_chip_ram_size;
230         
230
231231         memory_set_bank(1, 0);
232     
232
233233         while( (mirror_mask<<1) < 0x100000 )
234234         {
235235            mirror_mask |= ( mirror_mask << 1 );
236236         }
237     
237
238238         /* overlay disabled, map RAM on 0x000000 */
239239         memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x000000, amiga_chip_ram_size - 1, 0, mirror_mask, MWA16_BANK1);
240240      }
241241   }
242   
242
243243   return mem[offset];
244244}
245245
r1461r1462
250250      if ( amiga_ar23_mode & 1 )
251251         amiga_ar23_freeze();
252252   }
253   
253
254254   amiga_chip_ram_w( offset * 2, data );
255255}
256256
257257static void amiga_ar23_freeze( void )
258258{
259259   int pc = safe_activecpu_get_pc();
260   
260
261261   /* only freeze if we're not inside the cart's ROM */
262262   if ( ((pc >> 16) & 0xfe ) != 0x40 )
263263   {
264264      /* get the cart's built-in ram */
265265      UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x440000);
266   
266
267267      if ( ar_ram != NULL )
268268      {
269269         int      i;
270         
270
271271         for( i = 0; i < 0x100; i++ )
272272            ar_ram[0x7800+i] = CUSTOM_REG(i);
273273      }
274     
274
275275      /* overlay the cart rom's in chipram */
276276      memory_set_bank(1, 2);
277           
277
278278      /* writes go to chipram */
279279      memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x000000, amiga_chip_ram_size - 1, 0, 0, amiga_ar23_chipmem_w);
280     
280
281281      /* trigger NMI irq */
282282      cpunum_set_input_line(0, 7, PULSE_LINE);
283283   }
r1461r1462
293293static WRITE16_HANDLER( amiga_ar23_custom_w )
294294{
295295   int pc = safe_activecpu_get_pc();
296   
296
297297   /* see if we're inside the AR2 rom */
298298   if ( ((pc >> 16) & 0xfe ) != 0x40 )
299299   {
300300      /* get the cart's built-in ram */
301301      UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x440000);
302   
302
303303      if ( ar_ram != NULL )
304304      {
305305         ar_ram[0x7800+offset] = data;
306306      }
307307   }
308   
309   amiga_custom_w( offset, data, mem_mask );   
308
309   amiga_custom_w( offset, data, mem_mask );
310310}
311311
312312static READ16_HANDLER( amiga_ar23_custom_r )
313313{
314   UINT16 data = amiga_custom_r( offset, mem_mask );   
315   
314   UINT16 data = amiga_custom_r( offset, mem_mask );
315
316316   int pc = safe_activecpu_get_pc();
317   
317
318318   /* see if we're inside the AR2 rom */
319319   if ( ((pc >> 16) & 0xfe ) != 0x40 )
320320   {
321321      /* get the cart's built-in ram */
322322      UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, 0x440000);
323   
323
324324      if ( ar_ram != NULL )
325325      {
326326         ar_ram[0x7800+offset] = data;
r1461r1462
341341{
342342   UINT32 mirror = 0x20000, size = 0x1ffff;
343343   void *ar_ram;
344   
344
345345   /* check kickstart version */
346346   if ( !check_kickstart_12_13( "Action Replay MKII or MKIII" ) )
347347   {
348348      amiga_cart_type = -1;
349349      return;
350350   }
351   
351
352352   /* setup the cart ram */
353353   ar_ram = auto_malloc(0x10000);
354     
354
355355   memset(ar_ram, 0, 0x10000);
356   
356
357357   if ( ar3 )
358358   {
359359      mirror = 0;
360360      size = 0x3ffff;
361361   }
362     
362
363363   /* Install ROM */
364364   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400000+size, 0, mirror, MRA16_BANK2);
365365   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400000+size, 0, mirror, MWA16_ROM);
r1461r1462
367367   /* Install RAM */
368368   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x440000, 0x44ffff, 0, 0, MRA16_BANK3);
369369   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x440000, 0x44ffff, 0, 0, MWA16_BANK3);
370   
370
371371   /* Install Custom chip monitor */
372372//   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r);
373373//   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w);
374   
374
375375   /* Install status/mode handlers */
376376   memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r);
377377   memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400003, 0, mirror, amiga_ar23_mode_w);
r1461r1462
379379   /* Configure Banks */
380380   memory_set_bankptr(2, memory_region(REGION_USER2));
381381   memory_set_bankptr(3, ar_ram);
382   
382
383383   memory_configure_bank(1, 0, 2, amiga_chip_ram, 0);
384384   memory_configure_bank(1, 1, 2, memory_region(REGION_USER1), 0);
385385   memory_configure_bank(1, 2, 2, memory_region(REGION_USER2), 0);
386   
386
387387   amiga_ar23_mode = 3;
388388}
389389
r1461r1462
397397{
398398   /* see what is there */
399399   UINT16 *mem = (UINT16 *)memory_region( REGION_USER2 );
400   
400
401401   amiga_cart_type = -1;
402   
402
403403   if ( mem != NULL )
404404   {
405405      if ( mem[0x00] == 0x1111 )
r1461r1462
424424{
425425   if ( amiga_cart_type < 0 )
426426      return;
427   
427
428428   switch( amiga_cart_type )
429429   {
430430      case ACTION_REPLAY:
431431         amiga_ar1_check_overlay();
432432      break;
433         
433
434434      case ACTION_REPLAY_MKII:
435435      case ACTION_REPLAY_MKIII:
436436         amiga_ar23_check_overlay();
r1461r1462
442442{
443443   if ( amiga_cart_type < 0 )
444444      return;
445   
445
446446   switch( amiga_cart_type )
447447   {
448448      case ACTION_REPLAY:
449449         amiga_ar1_nmi();
450450      break;
451     
451
452452      case ACTION_REPLAY_MKII:
453453      case ACTION_REPLAY_MKIII:
454454         amiga_ar23_nmi();
src/mess/machine/sms.c
r1461r1462
745745      if ( !memcmp( &rom[0x7ff0], signatures[i], 16 ) ) {
746746         return 1;
747747      }
748   }
748   }
749749   return 0;
750750}
751751
src/mess/machine/wd17xx.c
r1461r1462
1010      - Removed disk image code and replaced it with floppy drive functions.
1111        Any disc image is now useable with this code.
1212      - Fixed write protect
13             
13
1414   2005-Apr-16 P.Harvey-Smith:
1515      - Increased the delay in wd17xx_timed_read_sector_request and
1616        wd17xx_timed_write_sector_request, to 40us to more closely match
1717        what happens on the real hardware, this has fixed the NitrOS9 boot
1818        problems.
19 
19
2020   2007-Nov-01 Wilbert Pol:
2121      Needed these changes to get the MB8877 for Osborne-1 to work:
2222      - Added support for multiple record read
r1461r1462
303303static TIMER_CALLBACK(wd17xx_busy_callback)
304304{
305305   wd17xx_info *info = (wd17xx_info *) ptr;
306   wd17xx_set_irq(info);         
306   wd17xx_set_irq(info);
307307   timer_reset(busy_timer, attotime_never);
308308}
309309
r1461r1462
322322static void wd17xx_restore(wd17xx_info *w)
323323{
324324   UINT8 step_counter;
325   
325
326326   if (current_drive >= device_count(IO_FLOPPY))
327327      return;
328328
329329   step_counter = 255;
330     
330
331331#if 0
332332   w->status |= STA_1_BUSY;
333333#endif
r1461r1462
357357#if 0
358358   /* simulate seek time busy signal */
359359   w->busy_count = 0;   //w->busy_count * ((w->data & FDC_STEP_RATE) + 1);
360   
360
361361   /* when command completes set irq */
362362   wd17xx_set_irq(w);
363363#endif
r1461r1462
377377   for (i = 0; i < device_count(IO_FLOPPY); i++)
378378   {
379379      mess_image *img = image_from_devtype_and_index(IO_FLOPPY, i);
380      floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);   
380      floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
381381      floppy_drive_set_rpm( img, 300.);
382382   }
383383
r1461r1462
419419         int track   = w->buffer[i+1];
420420         int side    = w->buffer[i+2];
421421         int sector  = w->buffer[i+3];
422         int len     = w->buffer[i+4];
422         int len     = w->buffer[i+4];
423423         int filler  = 0xe5; /* IBM and Thomson */
424424         int density = w->density;
425425         floppy_drive_format_sector(wd17xx_current_image(),side,sector,track,
r1461r1462
559559   w->data_count = (w->density) ? TRKSIZE_DD : TRKSIZE_SD;
560560
561561   floppy_drive_read_track_data_info_buffer( wd17xx_current_image(), hd, (char *)w->buffer, &(w->data_count) );
562   
562
563563   w->data_offset = 0;
564564
565565   wd17xx_set_data_request();
r1461r1462
627627      /* crc is stored hi-byte followed by lo-byte */
628628      w->buffer[4] = crc>>8;
629629      w->buffer[5] = crc & 255;
630     
630
631631      w->sector = id.C;
632632
633633      w->status |= STA_2_BUSY;
r1461r1462
805805   }
806806
807807   /* stop it, but don't allow it to be free'd */
808   timer_reset(w->timer, attotime_never);
808   timer_reset(w->timer, attotime_never);
809809}
810810
811811
r1461r1462
947947      wd17xx_read_sector(w);
948948
949949   /* stop it, but don't allow it to be free'd */
950   timer_reset(w->timer_rs, attotime_never);
950   timer_reset(w->timer_rs, attotime_never);
951951}
952952
953953
r1461r1462
998998   }
999999
10001000   /* stop it, but don't allow it to be free'd */
1001   timer_reset(w->timer_ws, attotime_never);
1001   timer_reset(w->timer_ws, attotime_never);
10021002}
10031003
10041004
r1461r1462
10721072
10731073   //   floppy_drive_set_ready_state(wd17xx_current_image(), 1,1);
10741074      w->status &= ~STA_1_NOT_READY;
1075     
1075
10761076      /* TODO: What is this?  We need some more info on this */
10771077      if ((w->type == WD_TYPE_179X) || (w->type == WD_TYPE_1773))
10781078      {
r1461r1462
10851085            w->status |= STA_1_NOT_READY;
10861086      }
10871087   }
1088   
1088
10891089   /* eventually set data request bit */
10901090//   w->status |= w->status_drq;
10911091
r1461r1462
11891189      else
11901190      {
11911191         /* issue a timed data request */
1192         wd17xx_timed_data_request();     
1192         wd17xx_timed_data_request();
11931193      }
11941194   }
11951195   else
r1461r1462
12051205WRITE8_HANDLER ( wd17xx_command_w )
12061206{
12071207   wd17xx_info *w = &wd;
1208   
1208
12091209   floppy_drive_set_motor_state(wd17xx_current_image(), 1);
12101210   floppy_drive_set_ready_state(wd17xx_current_image(), 1,0);
12111211   /* also cleared by writing command */
r1461r1462
12221222      w->data_count = 0;
12231223      w->data_offset = 0;
12241224      w->status &= ~(STA_2_BUSY);
1225     
1225
12261226      wd17xx_clear_data_request();
12271227
12281228      if (data & 0x0f)
r1461r1462
12351235
12361236//      w->status_ipl = STA_1_IPL;
12371237/*      w->status_ipl = 0; */
1238     
1238
12391239      w->busy_count = 0;
12401240      w->command_type = TYPE_IV;
12411241        return;
r1461r1462
13091309            }
13101310            else
13111311            {
1312   
1312
13131313                /* drive write protected? */
13141314                if (floppy_drive_get_flag_state(wd17xx_current_image(),FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
13151315                {
r1461r1462
13591359   }
13601360
13611361   w->status |= STA_1_BUSY;
1362   
1362
13631363   /* clear CRC error */
13641364   w->status &=~STA_1_CRC_ERR;
13651365
r1461r1462
15441544      /* put byte into buffer */
15451545      if (VERBOSE_DATA)
15461546         logerror("wd17xx_info buffered data: $%02X at offset %d.\n", data, w->data_offset);
1547   
1547
15481548      w->buffer[w->data_offset++] = data;
1549     
1549
15501550      if (--w->data_count < 1)
15511551      {
15521552         if (w->command == FDC_WRITE_TRK)
r1461r1462
15801580   UINT8 result = 0;
15811581
15821582   switch(offset % 4) {
1583   case 0:
1583   case 0:
15841584      result = wd17xx_status_r(0);
15851585      break;
1586   case 1:
1586   case 1:
15871587      result = wd17xx_track_r(0);
15881588      break;
1589   case 2:
1589   case 2:
15901590      result = wd17xx_sector_r(0);
15911591      break;
1592   case 3:
1592   case 3:
15931593      result = wd17xx_data_r(0);
15941594      break;
15951595   }
src/mess/machine/pc_mouse.c
r1461r1462
6060   int mbc;
6161
6262   /* Do not get deltas or send packets if queue is not empty (Prevents drifting) */
63   if (pc_mouse.head==pc_mouse.tail)
63   if (pc_mouse.head==pc_mouse.tail)
6464   {
6565      nx = readinputportbytag("pc_mouse_x");
66   
66
6767      dx = nx - ox;
6868      if (dx<=-0x800) dx = nx + 0x1000 - ox; /* Prevent jumping */
6969      if (dx>=0x800) dx = nx - 0x1000 - ox;
7070      ox = nx;
71   
71
7272      ny = readinputportbytag("pc_mouse_y");
73   
73
7474      dy = ny - oy;
7575      if (dy<=-0x800) dy = ny + 0x1000 - oy;
7676      if (dy>=0x800) dy = ny - 0x1000 - oy;
7777      oy = ny;
78   
78
7979      nb = readinputportbytag("pc_mouse_misc");
80      if ((nb & 0x80) != 0)
80      if ((nb & 0x80) != 0)
8181      {
8282         pc_mouse.protocol=TYPE_MOUSE_SYSTEMS;
8383      }
8484      else
85      {   
85      {
8686         pc_mouse.protocol=TYPE_MICROSOFT_MOUSE;
8787      }
88      mbc = nb^pc_mouse.mb;
88      mbc = nb^pc_mouse.mb;
8989      pc_mouse.mb = nb;
90   
90
9191      /* check if there is any delta or mouse buttons changed */
9292      if ( (dx!=0) || (dy!=0) || (mbc!=0) )
9393      {
9494         switch (pc_mouse.protocol)
9595         {
96   
96
9797         default:
9898         case TYPE_MICROSOFT_MOUSE:
9999            {
r1461r1462
106106                  m0 = 0x40 | ((nb << 4) & 0x30) | ((ddx >> 6) & 0x03) | ((ddy >> 4) & 0x0c);
107107                  m1 = ddx & 0x3f;
108108                  m2 = ddy & 0x3f;
109   
109
110110                  /* KT - changed to use a function */
111111                  pc_mouse_queue_data(m0 | 0x40);
112112                  pc_mouse_queue_data(m1 & 0x03f);
r1461r1462
115115                  {
116116                  pc_mouse_queue_data( (nb & 0x04) << 3);
117117                  }
118   
118
119119                  dx -= ddx;
120120                  dy -= ddy;
121121               } while( dx || dy );
122122            }
123123            break;
124   
124
125125            /* mouse systems mouse
126126            from "PC Mouse information" by Tomi Engdahl */
127   
127
128128            /*
129129            The data is sent in 5 byte packets in following format:
130130                  D7      D6      D5      D4      D3      D2      D1      D0
131   
131
132132            1.      1       0       0       0       0       LB      CB      RB
133133            2.      X7      X6      X5      X4      X3      X2      X1      X0
134134            3.      Y7      Y6      Y5      Y4      Y3      Y4      Y1      Y0
135135            4.      X7'     X6'     X5'     X4'     X3'     X2'     X1'     X0'
136136            5.      Y7'     Y6'     Y5'     Y4'     Y3'     Y4'     Y1'     Y0'
137   
137
138138            LB is left button state (0=pressed, 1=released)
139139            CB is center button state (0=pressed, 1=released)
140140            RB is right button state (0=pressed, 1=released)
r1461r1462
146146                 format (-128..+127), positive direction right
147147            Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte
148148                 format (-128..+127), positive direction up
149   
149
150150            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   
151
152152            case TYPE_MOUSE_SYSTEMS:
153153            {
154   
154
155155               dy =-dy;
156   
156
157157               do
158158               {
159159                  int ddx = (dx < -128) ? -128 : (dx > 127) ? 127 : dx;
160160                  int ddy = (dy < -128) ? -128 : (dy > 127) ? 127 : dy;
161   
161
162162                  /* KT - changed to use a function */
163163                  pc_mouse_queue_data(0x080 | ((((nb & 0x04) >> 1) + ((nb & 0x02) << 1) + (nb & 0x01)) ^ 0x07));
164164                  pc_mouse_queue_data(ddx);
r1461r1462
169169                  dx -= ddx;
170170                  dy -= ddy;
171171               } while( dx || dy );
172   
172
173173            }
174174            break;
175175         }
176176      }
177   }
177   }
178178
179179   /* Send any data from this scan or any pending data from a previous scan */
180180
r1461r1462
219219         /* reset mouse */
220220         pc_mouse.head = pc_mouse.tail = pc_mouse.mb = 0;
221221
222         if ((readinputportbytag("pc_mouse_misc") & 0x80) == 0 )
222         if ((readinputportbytag("pc_mouse_misc") & 0x80) == 0 )
223223         {
224224            /* Identify as Microsoft 3 Button Mouse */
225            pc_mouse.queue[pc_mouse.head] = 'M'; 
225            pc_mouse.queue[pc_mouse.head] = 'M';
226226            pc_mouse.head = ++pc_mouse.head % 256;
227            pc_mouse.queue[pc_mouse.head] = '3'; 
228            pc_mouse.head = ++pc_mouse.head % 256; 
227            pc_mouse.queue[pc_mouse.head] = '3';
228            pc_mouse.head = ++pc_mouse.head % 256;
229229         }
230230
231231         /* start a timer to scan the mouse input */
r1461r1462
235235      {
236236         /* CTS just went to 0 */
237237         timer_adjust(pc_mouse.timer, attotime_zero, pc_mouse.serial_port, attotime_zero);
238         pc_mouse.head = pc_mouse.tail = 0;
238         pc_mouse.head = pc_mouse.tail = 0;
239239      }
240240   }
241241
r1461r1462
251251
252252INPUT_PORTS_START( pc_mouse_mousesystems )
253253   PORT_START_TAG( "pc_mouse_misc" )
254   PORT_CONFNAME( 0x80, 0x80, "Mouse Protocol" )
254   PORT_CONFNAME( 0x80, 0x80, "Mouse Protocol" )
255255   PORT_CONFSETTING( 0x80, "Mouse Systems" )
256256   PORT_CONFSETTING( 0x00, "Microsoft" )
257257   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1)
258258   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3)
259259   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2)
260260
261   PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ 
261   PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */
262262   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
263263
264264   PORT_START_TAG( "pc_mouse_y" ) /* Mouse - Y AXIS */
r1461r1462
269269
270270INPUT_PORTS_START( pc_mouse_microsoft )
271271   PORT_START_TAG( "pc_mouse_misc" )
272   PORT_CONFNAME( 0x80, 0x00, "Mouse Protocol" )
273   PORT_CONFSETTING( 0x00, "Microsoft" )         
272   PORT_CONFNAME( 0x80, 0x00, "Mouse Protocol" )
273   PORT_CONFSETTING( 0x00, "Microsoft" )
274274   PORT_CONFSETTING( 0x80, "Mouse Systems" )
275275   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1)
276276   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3)
277277   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2)
278278
279   PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ 
279   PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */
280280   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
281281
282282   PORT_START_TAG( "pc_mouse_y" ) /* Mouse - Y AXIS */
src/mess/machine/odyssey2.c
r1461r1462
108108
109109    else
110110        p2 = p2 | 0xF0;
111   
111
112112    logerror("%.6f p2 read %.2x\n", attotime_to_double(timer_get_time()), p2);
113113    return p2;
114114}
src/mess/machine/apple2.c
r1461r1462
344344      apple2_c07x_w
345345   };
346346   int slot;
347   
347
348348   offset &= 0xFF;
349   
349
350350   if (offset < 0x80)
351351   {
352352      if (handlers[offset / 0x10])
r1461r1462
486486      meminfo->read_mem      = (a2 & VAR_ROMSWITCH) ? 0x005000 : 0x001000;
487487      meminfo->read_mem      |= APPLE2_MEM_ROM;
488488   }
489   
489
490490   if (a2 & VAR_LCWRITE)
491491   {
492492      if (a2 & VAR_LCRAM2)
r1461r1462
566566
567567/* -----------------------------------------------------------------------
568568 * Floating bus code
569 *
569 *
570570 *     preliminary floating bus video scanner code - look for comments
571571 *     with FIX:
572572 * ----------------------------------------------------------------------- */
r1461r1462
576576   enum
577577   {
578578      // scanner types
579      kScannerNone = 0, kScannerApple2, kScannerApple2e,
579      kScannerNone = 0, kScannerApple2, kScannerApple2e,
580580
581581      // scanner constants
582582      kHBurstClock      =    53, // clock when Color Burst starts
r1461r1462
10441044         result = attotime_to_double(timer_get_time()) < joystick_y2_time;
10451045         break;
10461046      default:
1047         /* c060 Empty Cassette head read
1047         /* c060 Empty Cassette head read
10481048          * and any other non joystick c06 port returns this according to applewin
10491049          */
10501050         return apple2_getfloatingbusvalue();
r1461r1462
15461546            token = a2_config->slots[i]->init(i);
15471547         else
15481548            token = (void *) ~0;
1549           
1549
15501550         a2_slot_tokens[i] = token;
15511551      }
15521552   }
1553   
1553
15541554   /* --------------------------------------------- *
15551555    * set up the softswitch mask/set                *
15561556    * --------------------------------------------- */
15571557   a2_mask = ~0;
15581558   a2_set = 0;
1559   
1559
15601560   /* disable VAR_ROMSWITCH if the ROM is only 16k */
15611561   if (memory_region_length(REGION_CPU1) < 0x8000)
15621562      a2_mask &= ~VAR_ROMSWITCH;
r1461r1462
15721572   apple2_memmap_config mem_cfg;
15731573   apple2_config a2_cfg;
15741574   void *apple2cp_ce00_ram = NULL;
1575   
1575
15761576   memset(&a2_cfg, 0, sizeof(a2_cfg));
15771577
15781578   /* specify slots */
src/mess/machine/tandy1t.c
r1461r1462
2828NVRAM_HANDLER( tandy1000 )
2929{
3030   if (file==NULL) {
31      // init only
31      // init only
3232   } else if (read_or_write) {
3333      mame_fwrite(file, eeprom.ee, sizeof(eeprom.ee));
3434   } else {
r1461r1462
8282            eeprom.state=200;
8383         } else eeprom.state=0;
8484         break;
85         
85
8686         /* read 16 bit */
8787      case 100:
8888         eeprom.state++;
r1461r1462
109109         eeprom.data<<=1;
110110         eeprom.state=0;
111111         break;
112         
112
113113         /* write 16 bit */
114114      case 200:
115115      case 201:
r1461r1462
234234   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_EQUALS) /* =                           0D  8D */
235235   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<--") PORT_CODE(KEYCODE_BACKSPACE) /* Backspace                   0E  8E */
236236   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) /* Tab                         0F  8F */
237     
237
238238   PORT_START   /* IN5 */
239239   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) /* Q                           10  90 */
240240   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) /* W                           11  91 */
r1461r1462
252252   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L-Ctrl") PORT_CODE(KEYCODE_LCONTROL) /* Left Ctrl                   1D  9D */
253253   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) /* A                           1E  9E */
254254   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) /* S                           1F  9F */
255     
255
256256   PORT_START   /* IN6 */
257257   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) /* D                           20  A0 */
258258   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) /* F                           21  A1 */
r1461r1462
270270   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) /* X                           2D  AD */
271271   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) /* C                           2E  AE */
272272   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) /* V                           2F  AF */
273     
273
274274   PORT_START   /* IN7 */
275275   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) /* B                           30  B0 */
276276   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) /* N                           31  B1 */
r1461r1462
288288   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) /* F3                          3D  BD */
289289   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) /* F4                          3E  BE */
290290   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) /* F5                          3F  BF */
291     
291
292292   PORT_START   /* IN8 */
293293   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) /* F6                          40  C0 */
294294   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) /* F7                          41  C1 */
r1461r1462
306306   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 6") PORT_CODE(KEYCODE_6_PAD) /* Keypad 6                    4D  CD */
307307   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Cursor Right") PORT_CODE(KEYCODE_RIGHT) /*                             4E  CE */
308308   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 1 (End)") PORT_CODE(KEYCODE_1_PAD) /* Keypad 1  (End)             4F  CF */
309     
309
310310   PORT_START   /* IN9 */
311311   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 2 `") PORT_CODE(KEYCODE_2_PAD) /* Keypad 2                    50  D0 */
312312   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("KP 3 (PgDn)") PORT_CODE(KEYCODE_3_PAD) /* Keypad 3  (PgDn)            51  D1 */
r1461r1462
319319   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Home") PORT_CODE(KEYCODE_HOME) /* HOME                        58  D8 */
320320   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) /* F11                         59  D9 */
321321   PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) /* F12                         5a  Da */
322     
322
323323   PORT_START   /* IN10 */
324324   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
325     
325
326326   PORT_START   /* IN11 */
327327   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
328328INPUT_PORTS_END
src/mess/machine/primo.c
r1461r1462
104104
105105   // bit 5 - SCLK
106106   if (!serial_clock || !cbm_serial_clock_read ())
107      data &= ~0x20;
107      data &= ~0x20;
108108
109109   // bit 4 - SDATA
110110   if (!serial_data || !cbm_serial_data_read ())
r1461r1462
136136
137137   // bit 4 - speaker
138138   speaker_level_w(0, (data&0x10)>>4);
139   
139
140140   // bit 3 - display buffer
141141   if (data & 0x08)
142142      primo_video_memory_base |= 0x2000;
r1461r1462
281281   cpunum_set_reg(0, Z80_R, snapshot_data[25]);
282282   cpunum_set_reg(0, Z80_IX, snapshot_data[26] + snapshot_data[27]*256);
283283   cpunum_set_reg(0, Z80_IY, snapshot_data[28] + snapshot_data[29]*256);
284   
285284
285
286286   /* IO ports */
287287
288288   // KI-1 bit 7 - NMI generator enable/disable
r1461r1462
310310      free(snapshot_data);
311311      return INIT_FAIL;
312312   }
313   
313
314314   if (strncmp((char *)snapshot_data, "PS01", 4))
315315   {
316316      free(snapshot_data);
317317      return INIT_FAIL;
318318   }
319   
319
320320   primo_setup_pss(snapshot_data, snapshot_size);
321321
322322   free(snapshot_data);
r1461r1462
360360      free(quickload_data);
361361      return INIT_FAIL;
362362   }
363   
363
364364   primo_setup_pp(quickload_data, quickload_size);
365365
366366   free(quickload_data);
src/mess/machine/ti85.c
r1461r1462
620620   {
621621      case TI_85: expected_snapshot_size = TI85_SNAPSHOT_SIZE; break;
622622      case TI_86: expected_snapshot_size = TI86_SNAPSHOT_SIZE; break;
623   }   
623   }
624624
625625   logerror("Snapshot loading\n");
626626
r1461r1462
674674         ti85_free_serial_stream (&ti85_serial_stream);
675675         return INIT_FAIL;
676676      }
677                                             
677
678678      ti85_serial_status = TI85_SEND_HEADER;
679679   }
680   else
680   else
681681   {
682682      return INIT_FAIL;
683683   }
src/mess/machine/c64.c
r1461r1462
9999   {
100100      if (is_c128())
101101      {
102         if (cpu_getactivecpu()==0)
102         if (cpu_getactivecpu()==0)
103103         {
104104            /* z80 */
105105            cpunum_set_input_line(0, INPUT_LINE_NMI, KEY_RESTORE||cia1irq);
src/mess/machine/hd63450.c
r1461r1462
3636
3737   switch(reg)
3838   {
39   case 0x00:  // CSR / CER
39   case 0x00:  // CSR / CER
4040      return (dmac.reg[channel].csr << 8) | dmac.reg[channel].cer;
4141   case 0x02:  // DCR / OCR
4242      return (dmac.reg[channel].dcr << 8) | dmac.reg[channel].ocr;
r1461r1462
8484   reg = offset & 0x1f;
8585   switch(reg)
8686   {
87   case 0x00:  // CSR / CER
88      if(ACCESSING_MSB)
87   case 0x00:  // CSR / CER
88      if(ACCESSING_MSB)
8989      {
9090//         dmac.reg[channel].csr = (data & 0xff00) >> 8;
9191//         logerror("DMA#%i: Channel status write : %02x\n",channel,dmac.reg[channel].csr);
r1461r1462
9393      // CER is read-only, so no action needed there.
9494      break;
9595   case 0x02:  // DCR / OCR
96      if(ACCESSING_MSB)
96      if(ACCESSING_MSB)
9797      {
9898         dmac.reg[channel].dcr = (data & 0xff00) >> 8;
9999         logerror("DMA#%i: Device Control write : %02x\n",channel,dmac.reg[channel].dcr);
100100      }
101      if(ACCESSING_LSB)
101      if(ACCESSING_LSB)
102102      {
103103         dmac.reg[channel].ocr = data & 0x00ff;
104104         logerror("DMA#%i: Operation Control write : %02x\n",channel,dmac.reg[channel].ocr);
105105      }
106106      break;
107107   case 0x03:  // SCR / CCR
108      if(ACCESSING_MSB)
108      if(ACCESSING_MSB)
109109      {
110110         dmac.reg[channel].scr = (data & 0xff00) >> 8;
111111         logerror("DMA#%i: Sequence Control write : %02x\n",channel,dmac.reg[channel].scr);
112112      }
113      if(ACCESSING_LSB)
113      if(ACCESSING_LSB)
114114      {
115115         dmac.reg[channel].ccr = data & 0x00ff;
116116         if((data & 0x0080))// && !dmac.intf->dma_read[channel] && !dmac.intf->dma_write[channel])
r1461r1462
266266            else
267267            {
268268               switch(dmac.reg[x].ocr & 0x30)  // operation size
269               {   
269               {
270270               case 0x00:  // 8 bit
271271                  data = program_read_byte(dmac.reg[x].dar);  // read from device address
272272                  program_write_byte(dmac.reg[x].mar, data);  // write to memory address
r1461r1462
304304            else
305305            {
306306               switch(dmac.reg[x].ocr & 0x30)  // operation size
307               {   
307               {
308308               case 0x00:  // 8 bit
309309                  data = program_read_byte(dmac.reg[x].mar);  // read from memory address
310                  program_write_byte(dmac.reg[x].dar, data);  // write to device address
310                  program_write_byte(dmac.reg[x].dar, data);  // write to device address
311311                  datasize = 1;
312312                  break;
313313               case 0x10:  // 16 bit
src/mess/machine/svi318.c
r1461r1462
365365   wd17xx_set_density(data & 0x01 ? DEN_FM_LO:DEN_MFM_LO);
366366
367367   wd17xx_set_side(data & 0x02 ? 1:0);
368           
368
369369   image = image_from_devtype_and_index(IO_FLOPPY, svi318_fdc.driveselect);
370370   if (image_exists(image))
371371   {
r1461r1462
387387{
388388   unsigned long o;
389389
390   if ((t==0) && (h==0))
391      o = (s-first_sector_id)*128;
390   if ((t==0) && (h==0))
391      o = (s-first_sector_id)*128;
392392   else
393393      o = ((t*heads+h)*17+s-first_sector_id)*256-2048; /* (17*256)-(18*128)=2048 */
394394
src/mess/machine/hd63450.h
r1461r1462
1212   void (*dma_end)(int channel,int irq);  // called when the DMA transfer ends
1313   void (*dma_error)(int channel, int irq);  // called when a DMA transfer error occurs
1414   int (*dma_read[4])(int addr);  // special read / write handlers for each channel
15   void (*dma_write[4])(int addr,int data); 
15   void (*dma_write[4])(int addr,int data);
1616};
1717
1818struct hd63450
r1461r1462
4343   int transfer_size[4];
4444   int halted[4];  // non-zero if a channel has been halted, and can be continued later.
4545   const struct hd63450_interface* intf;
46}; 
46};
4747
4848void hd63450_init(const struct hd63450_interface* intf);
4949int hd63450_read(int offset, UINT16 mem_mask);
src/mess/machine/pc.c
r1461r1462
6969   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
7070}
7171
72DRIVER_INIT( europc )
72DRIVER_INIT( europc )
7373{
7474   UINT8 *gfx = &memory_region(REGION_GFX1)[0x8000];
7575   UINT8 *rom = &memory_region(REGION_CPU1)[0];
src/mess/machine/amstr_pc.c
r1461r1462
5252    fca69
5353    fd680
5454      fd7f9
55    fca7b !keyboard interrupt routine for this check
55    fca7b !keyboard interrupt routine for this check
5656 */
5757
5858
r1461r1462
116116/* test sequence in bios
117117 write 00 to 65
118118 write 30 to 61
119 read 62 and (0x10)
119 read 62 and (0x10)
120120 write 34 to 61
121121 read 62 and (0x0f)
122 return or of the 2 62 reads
122 return or of the 2 62 reads
123123
124124 allows set of the original ibm pc "dipswitches"!!!!
125125
r1461r1462
127127*/
128128
129129/* mouse x counter at 0x78 (read- writable)
130   mouse y counter at 0x7a (read- writable)
130   mouse y counter at 0x7a (read- writable)
131131
132132   mouse button 1,2 keys
133133   joystick (4 directions, 2 buttons) keys
r1461r1462
164164         pc1640.port60=data;
165165      }
166166      break;
167   case 5:
167   case 5:
168168      // stores the configuration data for port 62 configuration dipswitch emulation
169      pc1640.port65=data;
169      pc1640.port65=data;
170170      break;
171171   }
172   
172
173173   logerror("pc1640 write %.2x %.2x\n",offset,data);
174174}
175175
r1461r1462
181181   case 0:
182182      if (pc1640.port61&0x80)
183183         data=pc1640.port60;
184      else
184      else
185185         data = pc_keyb_read();
186186      break;
187187
r1461r1462
189189      data = pc1640.port61;
190190      break;
191191
192   case 2:
192   case 2:
193193      data = pc1640.port62;
194194      if (pit8253_get_output(0, 2))
195195         data |= 0x20;
r1461r1462
393393   PORT_START_TAG("pc_mouse_misc")
394394   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
395395
396   PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */ 
396   PORT_START_TAG( "pc_mouse_x" ) /* Mouse - X AXIS */
397397   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_REVERSE
398398
399399   PORT_START_TAG( "pc_mouse_y" ) /* Mouse - Y AXIS */
src/mess/machine/smc92x4.c
r1461r1462
313313         return INIT_FAIL;
314314      }
315315      return INIT_PASS;
316   }   
316   }
317317
318318   return INIT_FAIL;
319319}
r1461r1462
502502}
503503
504504/*
505   Select currently selected drive
505   Select currently selected drive
506506*/
507507static int get_selected_drive(int which, select_mode_t *select_mode, int *disk_unit)
508508{
src/mess/machine/ti99_4x.c
r1461r1462
732732   tms9901_init(0, & tms9901reset_param_ti99_4x);
733733
734734   TMS9928A_configure(gfxparm);
735           
735
736736        /* Initialize all. Actually, at this point, we don't know
737           how the switches are set. Later we use the configuration switches to
737           how the switches are set. Later we use the configuration switches to
738738           determine which one to use. */
739739   ti99_peb_init();
740740        ti99_fdc_init();
r1461r1462
786786
787787   /* init tms9901 */
788788        tms9901_reset(0);
789   
789
790790   if (!has_evpc) TMS9928A_reset();
791791        else v9938_reset();
792792
r1461r1462
10191019
10201020/*
10211021   TI-99 cartridge port: attached to the 8-bit bus.
1022   
1022
10231023   Cartridges are usually made of ROM, through a few cartridges include some
10241024   RAM as well.  Bank switching is common: I know three banking schemes,
10251025   namely TI, MBX and Supercart.  The TI scheme writes a dummy value in
r1461r1462
18661866
18671867         return TRUE;
18681868      }
1869           
1869
18701870   }
18711871
18721872   current_key = 0;   /* default value if no key is down */
r1461r1462
18951895
18961896      return TRUE;
18971897   }
1898     
1898
18991899   return FALSE;
19001900}
19011901
src/mess/machine/pc1251.c
r1461r1462
158158
159159   timer_set(ATTOTIME_IN_SEC(1), NULL, 0, pc1251_power_up);
160160
161   // c600 b800 b000 a000 8000 tested   
161   // c600 b800 b000 a000 8000 tested
162162   // 4 kb memory feedback 512 bytes too few???
163163   // 11 kb ram: program stored at 8000
164164#if 1
src/mess/machine/msm8251.c
r1461r1462
5050   /* setup this side of the serial connection */
5151   serial_connection_init(&uart.connection);
5252   serial_connection_set_in_callback(&uart.connection, msm8251_in_callback);
53   uart.connection.input_state = 0;   
53   uart.connection.input_state = 0;
5454   /* reset chip */
5555   msm8251_reset();
5656
r1461r1462
7070
7171   if (uart.interface.rx_ready_callback)
7272      uart.interface.rx_ready_callback((state!=0));
73   
73
7474}
7575
7676void msm8251_receive_clock(void)
r1461r1462
8181      //logerror("MSM8251\n");
8282      /* get bit received from other side and update receive register */
8383      receive_register_update_bit(&uart.receive_reg, get_in_data_bit(uart.connection.input_state));
84     
84
8585      if (uart.receive_reg.flags & RECEIVE_REGISTER_FULL)
8686      {
8787         receive_register_extract(&uart.receive_reg, &uart.data_form);
r1461r1462
108108            uart.status |=MSM8251_STATUS_TX_EMPTY;
109109            /* ready for next transmit */
110110            uart.status |=MSM8251_STATUS_TX_READY;
111         
111
112112            msm8251_update_tx_empty();
113113            msm8251_update_tx_ready();
114114         }
115115      }
116     
116
117117      /* if transmit is not empty... transmit data */
118118      if ((uart.transmit_reg.flags & TRANSMIT_REGISTER_EMPTY)==0)
119119      {
r1461r1462
155155{
156156   /* clear tx ready state */
157157   int tx_ready;
158   
158
159159   /* tx ready output is set if:
160160      DB Buffer Empty &
161161      CTS is set &
162      Transmit enable is 1
162      Transmit enable is 1
163163   */
164164
165165
r1461r1462
193193   }
194194   if (uart.interface.tx_empty_callback)
195195      uart.interface.tx_empty_callback(((uart.status & MSM8251_STATUS_TX_EMPTY)!=0));
196   
196
197197}
198198
199199void   msm8251_reset(void)
r1461r1462
266266         if ((data & 0x03)!=0)
267267         {
268268            /*   Asynchronous
269           
269
270270               bit 7,6: stop bit length
271271                  0 = inhibit
272272                  1 = 1 bit
r1461r1462
283283                  1 = 6 bits
284284                  2 = 7 bits
285285                  3 = 8 bits
286               bit 1,0: baud rate factor
286               bit 1,0: baud rate factor
287287                  0 = defines command byte for synchronous or asynchronous
288288                  1 = x1
289289                  2 = x16
r1461r1462
354354            uart.data_form.word_length = ((data>>2) & 0x03)+5;
355355            uart.data_form.parity = SERIAL_PARITY_NONE;
356356            switch ((data>>6) & 0x03)
357            {           
357            {
358358               case 0:
359359               case 1:
360360                  uart.data_form.stop_bit_count =  1;
r1461r1462
365365                  break;
366366            }
367367            receive_register_setup(&uart.receive_reg, &uart.data_form);
368         
369368
369
370370#if 0
371371            /* data bits */
372372            uart.receive_char_length = (((data>>2) & 0x03)+5);
373           
373
374374            if (data & (1<<4))
375375            {
376376               /* parity */
r1461r1462
389389         }
390390         else
391391         {
392            /*   bit 7: Number of sync characters
392            /*   bit 7: Number of sync characters
393393                  0 = 1 character
394394                  1 = 2 character
395395               bit 6: Synchronous mode
r1461r1462
477477
478478
479479#endif
480     
481480
482      /*   bit 7:
481
482      /*   bit 7:
483483            0 = normal operation
484484            1 = hunt mode
485         bit 6:
485         bit 6:
486486            0 = normal operation
487487            1 = internal reset
488488         bit 5:
r1461r1462
502502            1 = /DTR set to 0
503503         bit 0:
504504            0 = transmit disable
505            1 = transmit enable
505            1 = transmit enable
506506      */
507   
507
508508      uart.connection.State &=~SERIAL_STATE_RTS;
509509      if (data & (1<<5))
510510      {
r1461r1462
575575   logerror("msm8251 receive char: %02x\n",ch);
576576
577577   uart.data = ch;
578   
578
579579   /* char has not been read and another has arrived! */
580580   if (uart.status & MSM8251_STATUS_RX_READY)
581581   {
r1461r1462
592592   logerror("read data: %02x\n",uart.data);
593593   /* reading clears */
594594   uart.status &= ~MSM8251_STATUS_RX_READY;
595   
595
596596   msm8251_update_rx_ready();
597597   return uart.data;
598598}
src/mess/machine/atarifdc.c
r1461r1462
445445         case 'S':   /* status */
446446            sprintf(atari_frame_message, "DRIVE #%d STATUS", drive+1);
447447            atari_frame_counter = Machine->screen[0].refresh/2;
448           
448
449449            if (VERBOSE_SERIAL)
450450               logerror("atari status\n");
451451
r1461r1462
629629         if (sector < 4)    /* sector 1 .. 3 might be different length */
630630         {
631631            offset = (sector - 1) * drv[drive].bseclen + drv[drive].header_skip;
632           
632
633633            if (VERBOSE_SERIAL)
634634               logerror("atari storing 128 byte sector %d at offset 0x%08X", sector, offset );
635635
src/mess/machine/tms5501.c
r1461r1462
5656#define TMS5501_TIMER_3_INT      0x40
5757#define TMS5501_TIMER_4_INT      0x80
5858#define TMS5501_INT_7_INT      0x80
59         
59
6060#define TMS5501_PIO_INT_7      0x80
6161
6262typedef struct tms5501_t
r1461r1462
125125   if (current_ints)
126126   {
127127      /* selecting interrupt with highest priority */
128      int level = find_first_bit(current_ints);   
128      int level = find_first_bit(current_ints);
129129      LOG_TMS5501(which, "Interrupt level", level);
130130
131131      /* reseting proper bit in pending interrupts register */
r1461r1462
349349         break;
350350      case 0x04:   /* Command register */
351351         data = tms5501[which].command;
352         LOG_TMS5501(which, "Command register read", data);   
352         LOG_TMS5501(which, "Command register read", data);
353353         break;
354354      case 0x05:   /* Serial rate register */
355355         data = tms5501[which].sio_rate;
r1461r1462
360360         break;
361361      case 0x08:   /* Interrupt mask register */
362362         data = tms5501[which].interrupt_mask;
363         LOG_TMS5501(which, "Interrupt mask read", data);   
363         LOG_TMS5501(which, "Interrupt mask read", data);
364364         break;
365365      case 0x09:   /* Timer 0 address */
366366      case 0x0a:   /* Timer 1 address */
src/mess/machine/galaxy.c
r1461r1462
142142   }
143143
144144   image_fread(image, snapshot_data, snapshot_size);
145   
145
146146   galaxy_setup_snapshot(snapshot_data, snapshot_size);
147147
148148   return INIT_PASS;
src/mess/machine/compis.c
r1461r1462
55
66   Per Ola Ingvarsson
77   Tomas Karlsson
8         
8
99 ******************************************************************************/
1010
1111/*-------------------------------------------------------------------------*/
r1461r1462
222222   UINT8 icol;
223223   UINT16 data;
224224   UINT16 ibit;
225   
225
226226   key_code = 0;
227227   key_status = 0x80;
228228
r1461r1462
314314   }
315315}
316316
317static const nec765_interface compis_fdc_interface =
317static const nec765_interface compis_fdc_interface =
318318{
319319   compis_fdc_int,
320320   compis_fdc_dma_drq
r1461r1462
329329     {
330330      data = nec765_dack_r(0);
331331   }
332   
332
333333   return data;
334334}
335335
r1461r1462
429429   /* FDC Reset */
430430   if (data & 0x40)
431431      compis_fdc_reset();
432 
432
433433   /* FDC Terminal count */
434434   compis_fdc_tc((data & 0x80)?1:0);
435435}
r1461r1462
852852         internal_timer_sync(which);
853853         update_int_timer = 1;
854854      }
855     
855
856856      t->maxB = new_maxB;
857     
857
858858      if (new_maxB == 0)
859859      {
860860               new_maxB = 0x10000;
861861            }
862862      }
863     
864863
864
865865   /* handle control changes */
866866   if (new_control != -1)
867867   {
r1461r1462
980980   /* check for control bits we don't handle */
981981   diff = new_control ^ d->control;
982982   if (diff & 0x6811)
983     logerror("%05X:ERROR! - unsupported DMA mode %04X\n",
983     logerror("%05X:ERROR! - unsupported DMA mode %04X\n",
984984         activecpu_get_pc(),
985985         new_control);
986986
r1461r1462
15821582
15831583   /* OSP PIT 8254 */
15841584   pit8253_init(2, compis_pit_config);
1585     
1585
15861586   /* PPI */
15871587   ppi8255_init(&compis_ppi_interface);
1588       
1588
15891589   /* FDC */
15901590   nec765_init(&compis_fdc_interface, NEC765A);
15911591   compis_fdc_reset();
src/mess/machine/kc.c
r1461r1462
236236   nec765_init(&kc_fdc_interface,NEC765A);
237237
238238   /* reset ctc */
239   z80ctc_reset(1);
239   z80ctc_reset(1);
240240
241241   /* hold cpu at reset */
242242   cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
r1461r1462
17191719static OPBASE_HANDLER( kc85_4_opbaseoverride )
17201720{
17211721   memory_set_opbase_handler(0,0);
1722   
1722
17231723   kc85_4_update_0x00000();
17241724
17251725   return (cpunum_get_reg(0, REG_PC) & 0x0ffff);
src/mess/machine/corvushd.c
r1461r1462
1//   
1//
22//   corvus_hd
3//   
3//
44//   Implementation of a Corvus Hard Drive / Host Bus Adapter pair.  The drive
55//   being emulated is a Rev B drive, functionally speaking, rather than an Omnidrive.
6//   
6//
77//   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
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.
r1461r1462
5454//   Brett Wyer
5555//
5656//
57//   TODO:
57//   TODO:
5858//      Implement READY line glitch after last byte of command (Disk System Tech Ref pp. 3)
5959//      Implement Read-after-Write (always happens on Rev B/H drives per Mass Storage GTI pp. 12)
6060//      Implement Multiple physical drive support - Up to four
r1461r1462
405405
406406   for(offset=0; offset < length; offset++) {
407407      if(offset % 16 == 0) {               // WHY IS 0 % 16 == 0???
408         if(offset > 0 && offset % 16 == 0)
408         if(offset > 0 && offset % 16 == 0)
409409            logerror("%16.16s", ascii_dump);
410410         logerror("\n%4.4x: %2.2x ", offset, *(buffer + offset));
411411      } else {
r1461r1462
471471            c->recv_bytes = corvus_cmd[data][0].recv_bytes;
472472            c->xmit_bytes = corvus_cmd[data][0].xmit_bytes;
473473            #if VERBOSE
474            logerror("parse_hdc_command: Single byte command recoginized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
474            logerror("parse_hdc_command: Single byte command recoginized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
475475               c->recv_bytes, c->xmit_bytes);
476476            #endif
477477            break;
r1461r1462
523523            c->recv_bytes = corvus_prep_cmd[data].recv_bytes;
524524            c->xmit_bytes = corvus_prep_cmd[data].xmit_bytes;
525525            #if VERBOSE
526            logerror("parse_hdc_command: Prep command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
526            logerror("parse_hdc_command: Prep command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
527527               c->recv_bytes, c->xmit_bytes);
528528            #endif
529529            break;
r1461r1462
647647   sector = (dadr->address_msn_and_drive & 0xf0 << 12) | (dadr->address_mid << 8) | dadr->address_lsb;
648648
649649   #if VERBOSE
650   logerror("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
650   logerror("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
651651      dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv);
652652   #endif
653653
r1461r1462
758758   sector = (dadr->address_msn_and_drive & 0xf0 << 12) | (dadr->address_mid << 8) | dadr->address_lsb;
759759
760760   #if VERBOSE
761   logerror("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
761   logerror("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
762762      dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv);
763763   #endif
764764
r1461r1462
10701070// Corvus_Read_Boot_Block
10711071//
10721072// Old-style Boot (0x14) command boot block reader
1073//
1073//
10741074// Pass:
10751075//      block:   Boot block number to read (0-7)
10761076//
r1461r1462
10861086   #endif
10871087
10881088   return corvus_read_sector(0, 25 + block, c->buffer.read_512_response.data, 512);
1089   
1089
10901090}
10911091
10921092
r1461r1462
12201220static hard_disk_file *corvus_hdc_file(int id) {
12211221
12221222   mess_image *img;
1223   
1223
12241224   img = image_from_devtype_and_index(IO_HARDDISK, id);
12251225   if (!image_exists(img))
12261226      return NULL;
r1461r1462
13011301                     c->buffer.single_byte_response.status = corvus_init_semaphore_table();
13021302                     break;
13031303                  case SEMAPHORE_STATUS_MOD:
1304                     c->buffer.semaphore_status_response.status =
1304                     c->buffer.semaphore_status_response.status =
13051305                        corvus_read_sector(0, 7, c->buffer.semaphore_status_response.table, 256);
13061306                     break;
13071307                  default:
r1461r1462
13741374      //
13751375      // An Illegal command was detected (Truly invalid, not just unimplemented)
13761376      //
1377      c->buffer.single_byte_response.status =
1377      c->buffer.single_byte_response.status =
13781378         STAT_FATAL_ERR | STAT_ILL_CMD_OP_CODE;      // Respond with an Illegal Op Code
13791379
13801380      logerror("corvus_hdc_data_w: Illegal Command, status: 0x%2.2x\n", c->buffer.single_byte_response.status);
r1461r1462
16691669      c->offset = 0;         // We've reached the end of valid data
16701670      c->xmit_bytes = 0;      // We don't have anything more to say
16711671      c->recv_bytes = 0;      // No active commands
1672     
1672
16731673      timer_set((ATTOTIME_IN_USEC(INTERBYTE_DELAY)), NULL, CALLBACK_HTC_MODE, corvus_hdc_callback);
16741674
16751675//      c->status &= ~(CONTROLLER_DIRECTION | CONTROLLER_BUSY);   // Put us in Idle, Host-to-Controller mode
r1461r1462
16771677      //
16781678      // Not finished with this packet.  Insert an interbyte delay and then let the host continue
16791679      //
1680      timer_set((ATTOTIME_IN_USEC(INTERBYTE_DELAY)), NULL, CALLBACK_SAME_MODE, corvus_hdc_callback);     
1680      timer_set((ATTOTIME_IN_USEC(INTERBYTE_DELAY)), NULL, CALLBACK_SAME_MODE, corvus_hdc_callback);
16811681   }
16821682
16831683   return result;
src/mess/hashfile.c
r1461r1462
4545   XML_Parser parser;
4646   hash_file *hashfile;
4747   int done;
48   
48
4949   int (*selector_proc)(hash_file *hashfile, void *param, const char *name, const char *hash);
5050   void (*use_proc)(hash_file *hashfile, void *param, struct hash_info *hi);
5151   void (*error_proc)(const char *message);
r1461r1462
317317   while(!state.done)
318318   {
319319      len = mame_fread(hashfile->file, buf, sizeof(buf));
320      state.done = mame_feof(hashfile->file);   
320      state.done = mame_feof(hashfile->file);
321321      if (XML_Parse(state.parser, buf, len, state.done) == XML_STATUS_ERROR)
322322      {
323323         parse_error(&state, "[%d:%d]: %s\n",
r1461r1462
365365   if (!pool)
366366      goto error;
367367
368   /* allocate space for this hash file */   
368   /* allocate space for this hash file */
369369   hashfile = (hash_file *) pool_malloc(pool, sizeof(*hashfile));
370370   if (!hashfile)
371371      goto error;
r1461r1462
471471int hashfile_verify(const char *sysname, void (*my_error_proc)(const char *message))
472472{
473473   hash_file *hashfile;
474   
474
475475   hashfile = hashfile_open(sysname, FALSE, my_error_proc);
476476   if (!hashfile)
477477      return -1;
src/mess/mscommon.c
r1461r1462
3636static TILE_GET_INFO(terminal_gettileinfo)
3737{
3838   int ch, gfxfont, code, color;
39   
39
4040   ch = current_terminal->mem[tile_index];
4141   code = ch & ((1 << current_terminal->char_bits) - 1);
4242   color = ch >> current_terminal->char_bits;
src/mess/pile.c
r1461r1462
9999{
100100   int count;
101101   char buf[1024];
102   
102
103103   count = vsnprintf(buf, sizeof(buf) / sizeof(buf[0]), fmt, args);
104104   if (pile_write(pile, buf, count * sizeof(*buf)))
105105      return 0;
src/mess/formats/thom_cas.h
r1461r1462
2424
2525CASSETTE_FORMATLIST_EXTERN( to7_cassette_formats );
2626
27extern void to7_cassette_getinfo( const device_class *devclass,
27extern void to7_cassette_getinfo( const device_class *devclass,
2828              UINT32 state, union devinfo *info );
2929
3030
r1461r1462
4040
4141CASSETTE_FORMATLIST_EXTERN( mo5_cassette_formats );
4242
43extern void mo5_cassette_getinfo( const device_class *devclass,
43extern void mo5_cassette_getinfo( const device_class *devclass,
4444              UINT32 state, union devinfo *info );
4545
4646#endif
src/mess/formats/fmsx_cas.c
r1461r1462
1616   if (memcmp (casdata, CasHeader, sizeof (CasHeader) ) ) return -1;
1717
1818   pos = size = 0;
19   
19
2020   while (pos < caslen)
2121   {
2222      if ( (pos + 8) < caslen)
23         if (!memcmp (casdata + pos, CasHeader, 8) )
23         if (!memcmp (casdata + pos, CasHeader, 8) )
2424         {
2525            size += (CAS_EMPTY_PERIODS + CAS_HEADER_PERIODS) * CAS_PERIOD;
2626            pos += 8;
src/mess/formats/trs_dsk.c
r1461r1462
33#include "formats/basicdsk.h"
44#include "formats/coco_dsk.h"
55
6/* -----------------------------------------------------------------------
7 * JV1 (Jeff Vavasour 1) format                                         
8 *                                                                         
9 * Used by Jeff Vavasour's TRS-80 Emulators                                 
6/* -----------------------------------------------------------------------
7 * JV1 (Jeff Vavasour 1) format
108 *
9 * Used by Jeff Vavasour's TRS-80 Emulators
10 *
1111 * Very straight basic disk; 1 head, 10 sectors, 256 sector length
1212 * ----------------------------------------------------------------------- */
1313
src/mess/formats/apf_apt.c
r1461r1462
1818/* 500 microsecond of bit 0 and 1000 microsecond of bit 1 */
1919
2020static INT16 *apf_emit_level(INT16 *p, int count)
21{   
21{
2222   int i;
2323
2424   for (i=0; i<count; i++)
r1461r1462
2929   return p;
3030}
3131
32/* 4 periods at 1200hz */
32/* 4 periods at 1200hz */
3333static INT16* apf_output_bit(INT16 *p, UINT8 b)
3434{
3535   if (b)
src/mess/formats/coco_dsk.c
r1461r1462
1515#include "formats/basicdsk.h"
1616#include "utils.h"
1717
18/* -----------------------------------------------------------------------
19 * JVC (Jeff Vavasour CoCo) format                                         
20 *                                                                         
21 * Used by Jeff Vavasour's CoCo Emulators                                 
22 *                                             
18/* -----------------------------------------------------------------------
19 * JVC (Jeff Vavasour CoCo) format
20 *
21 * Used by Jeff Vavasour's CoCo Emulators
22 *
2323 *   Documentation taken from Tim Linder's web site:
24 *      http://home.netcom.com/~tlindner/JVC.html
24 *      http://home.netcom.com/~tlindner/JVC.html
2525 *
26 *   A. Header length                                                       
27 *      The header length is determined by the file length modulo 256:     
28 *         headerSize = fileLength % 256;                                 
29 *      This means that the header is variable length and the minimum size
30 *      is zero bytes, and the maximum size of 255 bytes.                 
26 *   A. Header length
27 *      The header length is determined by the file length modulo 256:
28 *         headerSize = fileLength % 256;
29 *      This means that the header is variable length and the minimum size
30 *      is zero bytes, and the maximum size of 255 bytes.
3131 *
3232 * B. Header
3333 *      Here is a description of the header bytes:
34 *         Byte Offset     Description            Default
34 *         Byte Offset     Description            Default
3535 *         -----------      -----------------      -------
36 *                   0     Sectors per track      18
37 *                    1     Side count              1
38 *                    2     Sector size code        1
39 *                    3     First sector ID         1
40 *                    4     Sector attribute flag   0
36 *                   0     Sectors per track      18
37 *                    1     Side count              1
38 *                    2     Sector size code        1
39 *                    3     First sector ID         1
40 *                    4     Sector attribute flag   0
4141 *
4242 *  If the sector attribute flag is zero then the track count is determined
4343 *  by the formula:
r1461r1462
7474 *      The is the same value that is stored in the wd179x ID field to
7575 *      determine sector size:
7676 *
77 *         0x00       128 bytes
78 *         0x01       256 bytes
79 *         0x02       512 bytes
80 *         0x03      1024 bytes
77 *         0x00       128 bytes
78 *         0x01       256 bytes
79 *         0x02       512 bytes
80 *         0x03      1024 bytes
8181 *
8282 *   Other values are undefined. Every sector in the disk image must be the
8383 *   same size.
r1461r1462
9090 *   G. Sector Attribute Flag
9191 *      If this byte is non zero, then each sector contains an additional
9292 *      byte prepended to the sector data. If the attribute flag is zero then
93 *      there are no extra bytes in front of the sector data.
93 *      there are no extra bytes in front of the sector data.
9494 *
9595 *   H. Sector attribute byte
9696 *      This byte is put at the begining of every sector if the header flag
r1461r1462
187187}
188188
189189
190   
190
191191static FLOPPY_CONSTRUCT(coco_jvc_construct)
192192{
193193   struct basicdsk_geometry geometry;
r1461r1462
222222         header_size = 4;
223223      if (header[4] != 0)
224224         header_size = 5;
225   
225
226226      geometry.offset = header_size;
227   
227
228228      floppy_image_write(floppy, header, 0, header_size);
229229   }
230230   else
r1461r1462
237237}
238238
239239
240/* -----------------------------------------------------------------------
240/* -----------------------------------------------------------------------
241241 * OS-9 file format
242242 *
243243 * This file format is largely a hack because there are a large amount of
r1461r1462
269269 * $1A     5       date of creation Y:M:D:H:M
270270 * $1F     32      ASCII name of disk, last letter has $80 added to it,
271271 *                 the full 32 bytes do not need to be used.
272 *
272 *
273273 * Allocation bit map, fill with zeros and set bits from low to high as
274274 * sectors are used. So, for a fresh disk sectors LSN0,LSN1,LSN2, and LSN3
275275 * will be in use so the first byte will be $FF $C0 and all others
276276 * in the map are $00
277 *
277 *
278278 * Root directory LSN2
279279 * Byte    size     use
280280 * $00      1       attributes will be $BF
r1461r1462
459459
460460
461461
462/* -----------------------------------------------------------------------
462/* -----------------------------------------------------------------------
463463 * VDK file format
464464 *
465465 * Used by Paul Burgin's PC-Dragon emulator
r1461r1462
576576
577577
578578
579/* -----------------------------------------------------------------------
579/* -----------------------------------------------------------------------
580580 * DMK file format
581581 *
582582 * David M. Keil's disk image format is aptly called an 'on disk' image
r1461r1462
644644static floperr_t coco_dmk_get_offset(floppy_image *floppy, int head, int track, UINT64 *offset)
645645{
646646   struct dmk_tag *tag = get_dmk_tag(floppy);
647   
647
648648   if ((head < 0) || (head >= tag->heads) || (track < 0) || (track >= tag->tracks))
649649      return FLOPPY_ERROR_SEEKERROR;
650650
r1461r1462
655655   *offset += DMK_HEADER_LEN;
656656   return FLOPPY_ERROR_SUCCESS;
657657}
658   
659     
660658
659
660
661661static UINT32 coco_dmk_min_track_size(int sectors, int sector_length)
662662{
663663   int sector_physical_length;
r1461r1462
665665   return DMK_TOC_LEN * 2 + DMK_LEAD_IN + (sectors * sector_physical_length);
666666}
667667
668   
669   
668
669
670670static floperr_t coco_dmk_read_track(floppy_image *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
671671{
672672   floperr_t err;
673673   UINT64 track_offset;
674   
674
675675   err = coco_dmk_get_offset(floppy, head, track, &track_offset);
676676   if (err)
677677      return err;
r1461r1462
679679   floppy_image_read(floppy, buffer, offset + track_offset, buflen);
680680   return FLOPPY_ERROR_SUCCESS;
681681}
682   
683   
684682
683
684
685685static floperr_t coco_dmk_write_track(floppy_image *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen)
686686{
687687   floperr_t err;
r1461r1462
690690   err = coco_dmk_get_offset(floppy, head, track, &track_offset);
691691   if (err)
692692      return err;
693   
693
694694   floppy_image_write(floppy, buffer, offset + track_offset, buflen);
695695   return FLOPPY_ERROR_SUCCESS;
696696}
r1461r1462
704704}
705705
706706
707           
707
708708static floperr_t coco_dmk_format_track(floppy_image *floppy, int head, int track, option_resolution *params)
709709{
710710   int sectors;
r1461r1462
721721   void *track_data_v;
722722   UINT32 max_track_size;
723723   int *sector_map = NULL;
724           
724
725725   sectors         = option_resolution_lookup_int(params, PARAM_SECTORS);
726726   sector_length   = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH);
727727   interleave      = option_resolution_lookup_int(params, PARAM_INTERLEAVE);
r1461r1462
740740      err = FLOPPY_ERROR_NOSPACE;
741741      goto done;
742742   }
743     
743
744744   err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, NULL);
745745   if (err)
746746      goto done;
r1461r1462
768768      physical_sector += interleave + 1;
769769      physical_sector %= sectors;
770770   }
771     
771
772772   /* set up track table of contents */
773773   physical_sector = 0;
774774   track_position = DMK_TOC_LEN * 2 + DMK_LEAD_IN;
r1461r1462
783783      {
784784         /* this is a sector */
785785         logical_sector = sector_map[physical_sector];
786     
786
787787         /* write the sector */
788788         memset(&track_data[track_position], 0x00, 8);
789789         track_position += 8;
790     
790
791791         memset(&track_data[track_position], 0xA1, 3);
792792         track_position += 3;
793793
r1461r1462
800800         crc = ccitt_crc16(0xcdb4,   &track_data[track_position], DMK_IDAM_LENGTH - 2);
801801         dmk_idam_set_crc(         &track_data[track_position], crc);
802802         track_position += DMK_IDAM_LENGTH;
803   
803
804804         memset(&track_data[track_position], 0x4E, 22);
805805         track_position += 22;
806806
r1461r1462
809809
810810         memset(&track_data[track_position], 0xA1, 3);
811811         track_position += 3;
812   
812
813813         /* write sector body */
814814         track_data[track_position] = 0xFB;
815815         memset(&track_data[track_position + 1], floppy_get_filler(floppy), sector_length);
r1461r1462
817817         track_data[track_position + sector_length + 1] = (UINT8) (crc >> 8);
818818         track_data[track_position + sector_length + 2] = (UINT8) (crc >> 0);
819819         track_position += sector_length + 3;
820     
820
821821         /* write sector footer */
822822         memset(&track_data[track_position], 0x4E, 24);
823823         track_position += 24;
824824      }
825   
825
826826      /* write the TOC entry */
827827      track_data[physical_sector * 2 + 0] = (UINT8) (idam_offset >> 0);
828828      track_data[physical_sector * 2 + 1] = (UINT8) (idam_offset >> 8);
829     
829
830830      physical_sector++;
831831   }
832832
833833   /* write track lead in */
834834   memset(&track_data[physical_sector * 2], 0x4e, DMK_LEAD_IN);
835   
835
836836   /* write track footer */
837837   assert(max_track_size >= (UINT32)track_position);
838838   memset(&track_data[track_position], 0x4e, max_track_size - track_position);
r1461r1462
843843   return FLOPPY_ERROR_SUCCESS;
844844}
845845
846     
847   
846
847
848848static int coco_dmk_get_heads_per_disk(floppy_image *floppy)
849849{
850850   return get_dmk_tag(floppy)->heads;
851851}
852   
853852
854853
854
855855static int coco_dmk_get_tracks_per_disk(floppy_image *floppy)
856856{
857857   return get_dmk_tag(floppy)->tracks;
858858}
859859
860860
861   
861
862862static UINT32 coco_dmk_get_track_size(floppy_image *floppy, int head, int track)
863863{
864864   return get_dmk_tag(floppy)->track_size;
865865}
866   
867   
868866
867
868
869869static floperr_t coco_dmk_seek_sector_in_track(floppy_image *floppy, int head, int track, int sector, int sector_is_index, int dirtify, UINT8 **sector_data, UINT32 *sector_length)
870870{
871871   struct dmk_tag *tag = get_dmk_tag(floppy);
r1461r1462
884884   if (err)
885885      return err;
886886   track_data = (UINT8 *) track_data_v;
887     
887
888888   /* search for matching IDAM */
889889   for (i = 0; i < DMK_TOC_LEN; i++)
890890   {
r1461r1462
892892      idam_offset <<= 8;
893893      idam_offset |= track_data[i * 2 + 0];
894894      idam_offset &= 0x3FFF;
895   
895
896896      if (idam_offset == 0)
897897      {
898898         /* we've reached the end of the road */
r1461r1462
948948   }
949949   if (i >= DMK_DATA_GAP)
950950      return FLOPPY_ERROR_SEEKERROR;
951   
951
952952   offs += i + 1;
953953   sec_len = 128 << dmk_idam_sectorlength(&track_data[idam_offset]);
954954
r1461r1462
961961      *sector_length = sec_len;
962962   return FLOPPY_ERROR_SUCCESS;
963963}
964   
965     
966964
965
966
967967static floperr_t coco_dmk_get_sector_length(floppy_image *floppy, int head, int track, int sector, UINT32 *sector_length)
968968{
969969   return coco_dmk_seek_sector_in_track(floppy, head, track, sector, FALSE, FALSE, NULL, sector_length);
r1461r1462
10141014   UINT16 crc_on_disk;
10151015   UINT16 calculated_crc;
10161016   UINT8 *sector_data;
1017           
1017
10181018   err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, FALSE, &sector_data, &sector_length);
10191019   if (err)
10201020      return err;
r1461r1462
10261026   calculated_crc = ccitt_crc16(0xE295, sector_data, sector_length);
10271027   if (calculated_crc != crc_on_disk)
10281028      return FLOPPY_ERROR_INVALIDIMAGE;
1029     
1029
10301030   memcpy(buffer, sector_data, MIN(sector_length, buflen));
10311031
10321032   return FLOPPY_ERROR_SUCCESS;
r1461r1462
10401040   UINT32 sector_length;
10411041   UINT8 *sector_data;
10421042   UINT16 crc;
1043     
1043
10441044   err = coco_dmk_seek_sector_in_track(floppy, head, track, sector, sector_is_index, TRUE, &sector_data, &sector_length);
10451045   if (err)
10461046      return err;
1047     
1047
10481048   if (buflen > sector_length)
10491049      return FLOPPY_ERROR_INTERNAL;
1050     
1050
10511051   memcpy(sector_data, buffer, buflen);
1052     
1052
10531053   crc = ccitt_crc16(0xE295, sector_data, sector_length);
10541054   sector_data[sector_length + 0] = crc >> 8;
10551055   sector_data[sector_length + 1] = crc >> 0;
10561056   return FLOPPY_ERROR_SUCCESS;
10571057}
10581058
1059     
10601059
1060
10611061static floperr_t coco_dmk_read_sector(floppy_image *floppy, int head, int track, int sector, void *buffer, size_t buflen)
10621062{
10631063   return internal_coco_dmk_read_sector(floppy, head, track, sector, FALSE, buffer, buflen);
r1461r1462
10851085   UINT8 header[DMK_HEADER_LEN];
10861086
10871087   floppy_image_read(floppy, header, 0, DMK_HEADER_LEN);
1088     
1088
10891089   if (tracks)
10901090      *tracks = header[1];
10911091   if (heads)
r1461r1462
10931093   if (track_size)
10941094      *track_size = ((int) header[3]) * 0x100 + header[2];
10951095}
1096   
1097   
1098   
1096
1097
1098
10991099FLOPPY_CONSTRUCT(coco_dmk_construct)
11001100{
11011101   struct FloppyCallbacks *callbacks;
r1461r1462
11241124   {
11251125      coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size);
11261126   }
1127   
1127
11281128   tag = floppy_create_tag(floppy, DMK_TAG, sizeof(struct dmk_tag));
11291129   if (!tag)
11301130      return FLOPPY_ERROR_OUTOFMEMORY;
11311131   tag->heads = heads;
11321132   tag->track_size = track_size;
11331133   tag->tracks = tracks;
1134   
1134
11351135   callbacks = floppy_callbacks(floppy);
11361136   callbacks->read_track = coco_dmk_read_track;
11371137   callbacks->write_track = coco_dmk_write_track;
r1461r1462
11501150   return FLOPPY_ERROR_SUCCESS;
11511151}
11521152
1153   
1154     
1153
1154
11551155FLOPPY_IDENTIFY(coco_dmk_identify)
11561156{
11571157   int heads, tracks, track_size;
11581158   UINT64 size, expected_size;
1159     
1159
11601160   size = floppy_image_size(floppy);
11611161   coco_dmk_interpret_header(floppy, &heads, &tracks, &track_size);
11621162   expected_size = DMK_HEADER_LEN + (heads * tracks * track_size);
11631163   *vote = (size == expected_size) ? 100 : 0;
11641164   return FLOPPY_ERROR_SUCCESS;
11651165}
1166           
11671166
11681167
1168
11691169/* ----------------------------------------------------------------------- */
11701170
11711171FLOPPY_OPTIONS_START( coco )
src/mess/formats/wavfile.c
r1461r1462
8282      return CASSETTE_ERROR_INVALIDIMAGE;
8383   if (memcmp(&file_header[8], magic2, 4))
8484      return CASSETTE_ERROR_INVALIDIMAGE;
85   
85
8686   /* read and sanity check size */
8787   stated_size = get_leuint32(&file_header[4]) + 8;
8888   file_size = cassette_image_size(cassette);
r1461r1462
139139
140140         if (read_waveform)
141141         {
142            tag_samples = tag_size / (opts->bits_per_sample / 8) / opts->channels;
142            tag_samples = tag_size / (opts->bits_per_sample / 8) / opts->channels;
143143            cassette_read_samples(cassette, opts->channels, 0.0, tag_samples / ((double) opts->sample_frequency),
144144               tag_samples, offset, waveform_flags);
145145         }
r1461r1462
257257   int freq, samples, i;
258258   INT32 cassamp;
259259   INT16 wavsamp;
260   
260
261261   f = fopen(fname, "rb");
262262   if (!f)
263263      return;
src/mess/formats/flopimg.c
r1461r1462
587587
588588   memset(buffer, data, length);
589589
590   err = floppy_write_sector(floppy, head, track, sector, 0, buffer, length);
590   err = floppy_write_sector(floppy, head, track, sector, 0, buffer, length);
591591   if (err)
592592      goto done;
593593
src/mess/formats/ap_dsk35.c
r1461r1462
88   and the Apple IIgs.
99
1010   These disks have the following properties:
11     
11
1212      400k:   80 tracks, 1 head
1313      800k:   80 tracks, 2 heads
1414
r1461r1462
732732      if ((found_sectors & (1 << sector)) == 0)
733733      {
734734         sony_denibblize35(sector_data, nibble_data, checksum);
735   
735
736736         /* write the sector */
737737         err = apple35_write_sector_td(floppy, head, track, sector, sector_data, sizeof(sector_data) / sizeof(sector_data[0]));
738738         if (err)
r1461r1462
831831         sides = 1;
832832         is_1440k = FALSE;
833833      }
834      else if ((size == 80*2*10*512) || (size == 80*2*18*512))
834      else if ((size == 80*2*10*512) || (size == 80*2*18*512))
835835      {
836836         sides = 2;
837837         is_1440k = (size == 80*2*18*512);
r1461r1462
963963      header.magic = BIG_ENDIANIZE_INT16(0x100);
964964
965965      floppy_image_write(floppy, &header, 0, sizeof(header));
966      floppy_image_write_filler(floppy, 0, sizeof(header), data_size + tag_size);
966      floppy_image_write_filler(floppy, 0, sizeof(header), data_size + tag_size);
967967   }
968968
969969   /* load */
r1461r1462
11371137      TRACKS([80])
11381138      SECTOR_LENGTH([512])
11391139      FIRST_SECTOR_ID([0]))
1140   FLOPPY_OPTION( apple35_dc, "dc,dsk,img,image",   "Apple DiskCopy disk image",   apple35_diskcopy_identify,   apple35_diskcopy_construct,   
1140   FLOPPY_OPTION( apple35_dc, "dc,dsk,img,image",   "Apple DiskCopy disk image",   apple35_diskcopy_identify,   apple35_diskcopy_construct,
11411141      HEADS([1]-2)
11421142      TRACKS([80])
11431143      SECTOR_LENGTH([512])
src/mess/formats/ti85_ser.c
r1461r1462
2121{
2222   UINT16 checksum = 0;
2323   unsigned int i;
24   
24
2525   for (i = 0; i<size; i++)
2626      checksum += data[i];
2727   return checksum;
r1461r1462
4545static void ti85_backup_read (const UINT8 * ti85_data, unsigned int ti85_data_size, ti85_entry * ti85_entries)
4646{
4747   unsigned int pos = 0x42+2;
48       
48
4949   ti85_entries[0].head_size = 0x09;
5050   ti85_entries[0].data_size = ti85_data[0x39] + ti85_data[0x3a]*256;
5151   ti85_entries[0].offset = pos;
r1461r1462
284284   serial_data->end_size = TI85_PC_END_PACKET_SIZE*8;
285285
286286   free (ti85_entries);
287   
287
288288   return 1;
289289}
290290
src/mess/formats/pc_dsk.c
r1461r1462
6767      floppy_image_read(floppy, &scl, 0x0c, 1);
6868      floppy_image_read(floppy, &spt, 0x18, 1);
6969      floppy_image_read(floppy, &heads, 0x1A, 1);
70     
70
7171      if (size == ((UINT64) scl) * spt * heads * 0x200)
7272      {
7373         geometry->sectors = spt;
src/mess/formats/lviv_lvt.c
r1461r1462
1414#define LVIV_LVT_BLOCK_PILOT_LENGTH         1298
1515
1616static INT16 *lviv_emit_level(INT16 *p, int count, int level)
17{   
17{
1818   int i;
1919
2020   for (i=0; i<count; i++)
r1461r1462
8282   for (i=0; i<LVIV_LVT_HEADER_PILOT_LENGTH; i++)
8383      p = lviv_output_bit (p, 1);
8484
85   for (i=0; i<10; i++)                                 
85   for (i=0; i<10; i++)
8686      p = lviv_output_byte (p, bytes[0x09]);
8787
8888   for (i=0; i<6; i++)
r1461r1462
9090
9191   p = lviv_emit_level (p, LVIV_LVT_PAUSE_SAMPLES, WAVEENTRY_HIGH);
9292
93   for (i=0; i<LVIV_LVT_BLOCK_PILOT_LENGTH; i++)     
93   for (i=0; i<LVIV_LVT_BLOCK_PILOT_LENGTH; i++)
9494      p = lviv_output_bit (p, 1);
9595
9696   data_size = length - ( LVIV_LVT_HEADER_PILOT_SAMPLES +
r1461r1462
9999                LVIV_LVT_BLOCK_PILOT_SAMPLES );
100100   data_size/=660;
101101
102   for (i=0; i<data_size; i++)                     
102   for (i=0; i<data_size; i++)
103103      p = lviv_output_byte (p, bytes[0x10+i]);
104104
105105   return p - buffer;
src/mess/formats/thom_dsk.c
r1461r1462
3737#define THOM_SECT_INVALID  1 /* invalid header */
3838
3939
40typedef struct
40typedef struct
4141{
4242
4343   /* disk info */
r1461r1462
8181   {
8282      { 20,  2, 14,  8 }, { 21, 19, 13,  7 },
8383      { 22, 18, 12,  6 }, { 23, 17, 11,  5 },
84      { 24, 16, 10,  4 }, {  1, 15,  9,  3 }
84      { 24, 16, 10,  4 }, {  1, 15,  9,  3 }
8585   };
8686   static const int q[4] = { 0, 8, 4, 12 };
8787   int t, s;
r1461r1462
9797      thom_qdd_map[ 24*16 + s ] = q[ s%4 ] + (s/4);
9898   }
9999   LOG(( "thom_qdd_compute_map: QDD sector map\n" ));
100   for ( s = 0; s < 25; s++ )
100   for ( s = 0; s < 25; s++ )
101101   {
102102      for ( t = 0; t < 16; t++ )
103103      {
r1461r1462
111111
112112static UINT8* thom_floppy_sector_ptr ( thom_floppy_drive* d, int sector, int track, int side )
113113{
114   if ( track >= d->tracks )
114   if ( track >= d->tracks )
115115      track =  d->tracks - 1;
116   if ( track < 0 )
116   if ( track < 0 )
117117      track = 0;
118118
119   if ( d->data && sector >= 1 && sector <= d->sectors && side >= 0 && side < d->sides )
119   if ( d->data && sector >= 1 && sector <= d->sectors && side >= 0 && side < d->sides )
120120   {
121121      int s = track * d->sectors + sector - 1;
122      if ( d -> type == THOM_FLOPPY_QDD )
122      if ( d -> type == THOM_FLOPPY_QDD )
123123      {
124         if ( s >= 0 && s < 400 )
124         if ( s >= 0 && s < 400 )
125125            s = thom_qdd_map[ s ];
126         else
126         else
127127            return NULL;
128128      }
129129      return d->data + ( side * d->tracks * d->sectors + s ) * d->sector_size;
r1461r1462
134134
135135
136136
137static UINT8* thom_floppy_sector_flag ( thom_floppy_drive* d,
137static UINT8* thom_floppy_sector_flag ( thom_floppy_drive* d,
138138               int sector, int track, int side )
139139{
140140   int s = track * d->sectors + sector - 1;
141   if ( d -> type == THOM_FLOPPY_QDD )
141   if ( d -> type == THOM_FLOPPY_QDD )
142142      s = thom_qdd_map[ s ];
143   return
143   return
144144      d->sect_flag + side * d->tracks * d->sectors + s;
145145}
146146
r1461r1462
152152   /* format */
153153   PRINT (( "thom_floppy: drive %li, %s floppy, %s-sided, %i-byte sectors, %s, %i track(s), %i sectors, %i KB\n",
154154       (long) (d - thom_floppy_drives),
155       (d->type == THOM_FLOPPY_5_1_4) ? "5\"1/4" :
156       (d->type == THOM_FLOPPY_3_1_2) ? "3\"1/2" :
155       (d->type == THOM_FLOPPY_5_1_4) ? "5\"1/4" :
156       (d->type == THOM_FLOPPY_3_1_2) ? "3\"1/2" :
157157       (d->type == THOM_FLOPPY_QDD) ? "QDD" : "unknown type",
158158       (d->sides == 1) ? "one" : "two",
159159       d->sector_size,
r1461r1462
162162       (d->sides * d->tracks * d->sectors * d->sector_size) / 1024 ));
163163   LOG (( "thom_floppy: drive %li loaded\n", d - thom_floppy_drives ));
164164
165   if ( d->data )
165   if ( d->data )
166166   {
167167      UINT8* dir = d->data + 20 * 16 * d->sector_size;
168168      char name[] = "01234567";
r1461r1462
172172      memcpy( name, dir, 8 );
173173      for ( i = 0; name[i]; i++ )
174174      {
175         if ( name[i] < ' ' || name[i] >= 127 )
175         if ( name[i] < ' ' || name[i] >= 127 )
176176            name[i] = '?';
177177      }
178178      PRINT (( "thom_floppy: floppy name \"%s\"\n", name ));
179179
180180      /* BASIC directory */
181181      dir += d->sector_size*2;
182      for ( j = 0; j < d->sector_size * 14 / 32; j++, dir += 32 )
182      for ( j = 0; j < d->sector_size * 14 / 32; j++, dir += 32 )
183183      {
184184         char name[] = "01234567.ABC";
185185         char comment[] = "01234567";
186         if ( *dir == 255 )
186         if ( *dir == 255 )
187187            break; /* end of directory */
188         if ( *dir < ' ' || *dir > 127 )
188         if ( *dir < ' ' || *dir > 127 )
189189            continue; /* empty entry */
190190         memcpy( name, dir, 8 );
191191         memcpy( name+9, dir+8, 3 );
192192         for ( i = 0; name[i]; i++)
193193         {
194            if ( name[i] < ' ' || name[i] >= 127 )
194            if ( name[i] < ' ' || name[i] >= 127 )
195195               name[i] = '?';
196196         }
197197         memcpy( comment, dir + 16, 8 );
r1461r1462
201201               comment[i] = '?';
202202         }
203203         PRINT (( "thom_floppy: file \"%s\" type=%s,%s comment=\"%s\"\n", name,
204             (dir[11] == 0) ? "bas" : (dir[11] == 1) ? "dat" :
204             (dir[11] == 0) ? "bas" : (dir[11] == 1) ? "dat" :
205205             (dir[11] == 2) ? "bin" : (dir[11] == 3) ? "asm" : "???",
206206             (dir[12] == 0) ? "a" : (dir[12] == 0xff) ? "b" : "?", comment ));
207207      }
r1461r1462
221221{
222222   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
223223   thom_floppy_active( 0 );
224   if ( physical_track < 0 )
224   if ( physical_track < 0 )
225225      physical_track = 0;
226   if ( physical_track >= 80 )
226   if ( physical_track >= 80 )
227227      physical_track = 79;
228228   LOG(( "%f thom_floppy_seek: dev=%li track=%i\n", attotime_to_double(timer_get_time()), d - thom_floppy_drives, physical_track ));
229229   d->cur_track = physical_track;
r1461r1462
234234static int thom_floppy_get_sectors_per_track( mess_image *image, int side )
235235{
236236   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
237   VLOG(( "thom_floppy_get_sectors_per_track: track=%i/%i dens=%s/%s\n", d->cur_track, d->tracks, 
238          (thom_density == DEN_FM_LO) ? "FM" : "MFM",
237   VLOG(( "thom_floppy_get_sectors_per_track: track=%i/%i dens=%s/%s\n", d->cur_track, d->tracks,
238          (thom_density == DEN_FM_LO) ? "FM" : "MFM",
239239          (d->density == DEN_FM_LO) ? "FM" : "MFM" ));
240240   return d->sectors;
241241}
242242
243243
244244
245static void thom_floppy_get_id ( mess_image* image, chrn_id* id,
245static void thom_floppy_get_id ( mess_image* image, chrn_id* id,
246246             int id_index, int physical_side )
247247{
248248   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
249249   int trk =  d->cur_track;
250   if ( trk >= d->tracks )
250   if ( trk >= d->tracks )
251251      trk = d->tracks - 1;
252   VLOG(( "thom_floppy_get_id: dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n",
252   VLOG(( "thom_floppy_get_id: dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n",
253253          d - thom_floppy_drives, trk, id_index, physical_side,
254          (thom_density == DEN_FM_LO) ? "FM" : "MFM",
254          (thom_density == DEN_FM_LO) ? "FM" : "MFM",
255255          (d->density == DEN_FM_LO) ? "FM" : "MFM" ));
256256   thom_floppy_active( 0 );
257   if ( thom_floppy_sector_ptr( d, id_index+1, trk, 0 ) &&
257   if ( thom_floppy_sector_ptr( d, id_index+1, trk, 0 ) &&
258258#if 0
259259        /* fails with bobwinter */
260        * thom_floppy_sector_flag( d, id_index+1, trk, 0 ) ==
261        THOM_SECT_OK &&
260        * thom_floppy_sector_flag( d, id_index+1, trk, 0 ) ==
261        THOM_SECT_OK &&
262262#endif
263        thom_density == d->density )
263        thom_density == d->density )
264264   {
265265      int index = ( id_index * thom_floppy_interlace ) % d->sectors;
266266      id->C = d->cur_track;
r1461r1462
270270      id->data_id = 1 + index;
271271      id->flags = 0;
272272   }
273   else
273   else
274274   {
275275      /* error */
276276      id->C = 0;
r1461r1462
279279      id->N = 0;
280280      id->data_id = 0;
281281      id->flags = 0;
282      logerror( "thom_floppy_get_id: invalid operation dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n",
283           (long) (d - thom_floppy_drives), d->cur_track, id_index, physical_side,
284           (thom_density == DEN_FM_LO) ? "FM" : "MFM",
282      logerror( "thom_floppy_get_id: invalid operation dev=%li track=%i idx=%i phy-side=%i dens=%s/%s\n",
283           (long) (d - thom_floppy_drives), d->cur_track, id_index, physical_side,
284           (thom_density == DEN_FM_LO) ? "FM" : "MFM",
285285           (d->density == DEN_FM_LO) ? "FM" : "MFM" );
286286   }
287287}
r1461r1462
294294   UINT8* src = thom_floppy_sector_ptr( d, index1, d->cur_track, 0 );
295295   thom_floppy_active( 0 );
296296   LOG(( "thom_floppy_read_sector_data_into_buffer: dev=%li track=%i idx=%i side=%i len=%i\n", d - thom_floppy_drives, d->cur_track, index1, side, length ));
297   if ( length > d->sector_size )
297   if ( length > d->sector_size )
298298   {
299299      logerror( "thom_floppy_read_sector_data_into_buffer: sector size %i truncated to %i\n", length, d->sector_size );
300300      length = d->sector_size;
r1461r1462
311311   UINT8* dst = thom_floppy_sector_ptr( d, data_id, d->cur_track, 0 );
312312   thom_floppy_active( 1 );
313313   LOG(( "thom_floppy_write_sector_data_into_buffer: dev=%li track=%i idx=%i side=%i ddam=%i len=%i\n", d - thom_floppy_drives, d->cur_track, data_id, side, ddam, length ));
314   if ( length > d->sector_size )
314   if ( length > d->sector_size )
315315   {
316316      logerror( "thom_floppy_write_sector_data_from_buffer: sector size %i truncated to %i\n", length, d->sector_size );
317317      length = d->sector_size;
r1461r1462
332332   UINT8* dst;
333333   thom_floppy_active( 1 );
334334   LOG(( "thom_floppy_format_sector: dev=%li track=%i/%i side=%i/%i idx=%i/%i c=%i h=%i r=%i n=%i filler=$%02X\n",
335         d - thom_floppy_drives,
335         d - thom_floppy_drives,
336336         d->cur_track, d->tracks, side, d->sides, sector_index, d->sectors,
337337         c, h, r, n, filler ));
338338
339   if ( d -> type != THOM_FLOPPY_QDD )
339   if ( d -> type != THOM_FLOPPY_QDD )
340340   {
341      if ( sector_size != d->sector_size || ( d->cur_track >= d->tracks && d->tracks == 40 ) )
341      if ( sector_size != d->sector_size || ( d->cur_track >= d->tracks && d->tracks == 40 ) )
342342      {
343343         /* need to change image params */
344         if ( d->cur_track >= 40 )
344         if ( d->cur_track >= 40 )
345345            d->tracks = 80;
346         d->sector_size = sector_size;
346         d->sector_size = sector_size;
347347         d->density = thom_density;
348348         d->data = realloc( d->data, d->sides * d->tracks * d->sectors * d->sector_size );
349349         LOG (( "thom_floppy_format_sector: image enlarged to sides=%i tracks=%i sectors=%i sector_size=%i\n",d->sides, d->tracks, d->sectors, d->sector_size  ));
350350         assert( d->data );
351351      }
352352   }
353   
353
354354   dst = thom_floppy_sector_ptr( d, r, d->cur_track, 0 );
355355   if ( dst )
356356   {
r1461r1462
358358      * thom_floppy_sector_flag( d, r, d->cur_track, 0 ) = THOM_SECT_OK;
359359      d->has_changed = 1;
360360   }
361   else
361   else
362362      logerror( "thom_floppy_format_sector: invalid operation\n" );
363363}
364364
365365
366366
367static const floppy_interface thom_floppy_interface =
367static const floppy_interface thom_floppy_interface =
368368{
369369   thom_floppy_seek,
370370   thom_floppy_get_sectors_per_track,
r1461r1462
387387   int size = image_length( image );
388388
389389   /* O-sized => create */
390   if ( !size )
390   if ( !size )
391391   {
392392      PRINT(( "new image created in drive %i\n", image_index_in_device( image ) ));
393393      d->sides = 1;
r1461r1462
401401      memset( d->data, 0xff, d->sector_size * d->sectors * d->tracks * d->sides );
402402      return INIT_PASS;
403403   }
404 
404
405405   /* load */
406406   d->data = malloc( size );
407407   assert( d->data );
408   if ( image_fread( image, d->data, size ) != size )
408   if ( image_fread( image, d->data, size ) != size )
409409   {
410410      logerror( "thom_floppy_fd_load: read error\n" );
411411      goto error;
412412   }
413413
414414   /* guess format: TODO two-sided images */
415   if ( size == 81920 )
415   if ( size == 81920 )
416416   {
417417      d->type = THOM_FLOPPY_5_1_4;
418418      d->tracks = 40;
r1461r1462
421421      d->density = DEN_FM_LO;
422422      d->sector_size = 128;
423423   }
424   else if ( size == 163840 )
424   else if ( size == 163840 )
425425   {
426426#if 0
427427      /* this undocumented case can actually be built by the TO9 */
r1461r1462
439439      d->density = DEN_MFM_LO;
440440      d->sector_size = 256;
441441   }
442   else if ( size == 327680 )
442   else if ( size == 327680 )
443443   {
444444      d->type = THOM_FLOPPY_3_1_2;
445445      d->tracks = 80;
r1461r1462
453453      logerror( "thom_floppy_fd_load: disk format not recognized\n" );
454454      goto error;
455455   }
456 
456
457457   memset( d->sect_flag, THOM_SECT_OK, sizeof( d->sect_flag ) );
458458
459459   thom_floppy_show( d );
r1461r1462
463463
464464error:
465465   PRINT(( "could not load floppy image in drive %i\n", image_index_in_device( image ) ));
466   if ( d->data )
467      free( d->data );
466   if ( d->data )
467      free( d->data );
468468   d->data = NULL;
469469   d->type = THOM_FLOPPY_NONE;
470470   return INIT_FAIL;
r1461r1462
476476{
477477   thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image );
478478   unsigned size = d->sides * d->tracks * d->sectors * d->sector_size;
479   if ( !d->data )
479   if ( !d->data )
480480      return;
481   if ( !d->has_changed )
481   if ( !d->has_changed )
482482      return;
483483   PRINT (( "thom_floppy_fd_save: saving floppy %li, %i KB\n", (long) (d - thom_floppy_drives), size / 1024 ));
484484
r1461r1462
503503{
504504   thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image );
505505   int size = image_length( image );
506 
506
507507   /* only one format, TODO two-sided images */
508   if ( size == 51200 || size == 0 )
508   if ( size == 51200 || size == 0 )
509509   {
510510      d->type = THOM_FLOPPY_QDD;
511511      d->tracks = 1;
r1461r1462
514514      d->density = DEN_MFM_LO;
515515      d->sector_size = 128;
516516   }
517   else
517   else
518518   {
519519      logerror( "thom_floppy_qd_load: disk format not recognized\n" );
520520      return INIT_FAIL;
r1461r1462
525525   memset( d->data, 0xff, d->sector_size * d->sectors * d->tracks * d->sides );
526526   memset( d->sect_flag, THOM_SECT_OK, sizeof( d->sect_flag ) );
527527
528   if  ( !size )
528   if  ( !size )
529529   {
530530      PRINT(( "new image created in drive %i\n", image_index_in_device( image ) ));
531531      return INIT_PASS;
532532   }
533533
534   if ( image_fread( image, d->data, size ) != size )
534   if ( image_fread( image, d->data, size ) != size )
535535   {
536536      logerror( "thom_floppy_qd_load: read error\n" );
537537      goto error;
r1461r1462
543543
544544error:
545545   PRINT(( "could not load floppy image in drive %i\n", image_index_in_device( image ) ));
546   if ( d->data )
547      free( d->data );
546   if ( d->data )
547      free( d->data );
548548   d->data = NULL;
549549   d->type = THOM_FLOPPY_NONE;
550550   return INIT_FAIL;
r1461r1462
558558   unsigned size = d->sides * d->tracks * d->sectors * d->sector_size;
559559   if ( !d->data )
560560      return;
561   if ( !d->has_changed )
561   if ( !d->has_changed )
562562      return;
563563   PRINT (( "thom_floppy_qd_save: saving floppy %li, %i KB\n", (long) (d - thom_floppy_drives), size / 1024 ));
564564   /* TODO: truncation */
r1461r1462
580580   "(c) Alexandre PUKALL Avril 1998";
581581
582582
583static const UINT16 sap_crc[] =
583static const UINT16 sap_crc[] =
584584{
585585   0x0000, 0x1081, 0x2102, 0x3183,   0x4204, 0x5285, 0x6306, 0x7387,
586586   0x8408, 0x9489, 0xa50a, 0xb58b,   0xc60c, 0xd68d, 0xe70e, 0xf78f,
r1461r1462
589589
590590
591591static UINT16 thom_sap_crc( UINT8* data, int size )
592{ 
592{
593593   int i;
594594   UINT16 crc = 0xffff, crc2;
595   for ( i = 0; i < size; i++ )
595   for ( i = 0; i < size; i++ )
596596   {
597597      crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ];
598598      crc = ( crc2 >> 4 ) ^ sap_crc[ ( crc2 ^ (data[i] >> 4) ) & 15 ];
r1461r1462
612612   int i, format;
613613
614614   /* O-sized => create */
615   if ( !size )
615   if ( !size )
616616   {
617617      PRINT(( "new image created in drive %i\n", image_index_in_device( image ) ));
618618      d->sides = 1;
r1461r1462
629629
630630   /* check header */
631631   image_fread( image, buf, 66 );
632   if ( memcmp( buf+1, sap_header+1, 65 ) )
632   if ( memcmp( buf+1, sap_header+1, 65 ) )
633633   {
634634      logerror( "thom_floppy_sap_load: invalid sap header\n" );
635635      return INIT_FAIL;
r1461r1462
643643   d->sector_size = (format==1) ? 128 : 256;
644644   d->tracks = 0;
645645   d->sectors = 16;
646   for ( i = 66; i+4 < size; i += d->sector_size + 6 )
646   for ( i = 66; i+4 < size; i += d->sector_size + 6 )
647647   {
648648      int fmt, prot, track, sector;
649649      image_fseek( image, i, SEEK_SET );
r1461r1462
653653      track  = buf[2];
654654      sector = buf[3];
655655      LOG(( "thom_floppy_sap_load: drive %i found sector %i on track %i, fmt=%i, prot=%i\n", drive, sector, track, fmt, prot ));
656      if ( sector < 1 || sector > d->sectors )
656      if ( sector < 1 || sector > d->sectors )
657657      {
658658         logerror( "thom_floppy_sap_load: invalid sector %i (must be in 1..16)\n", sector );
659659         goto error;
660660      }
661      if ( track >= d->tracks )
661      if ( track >= d->tracks )
662662         d->tracks = track+1;
663663   }
664 
665   switch ( d->tracks )
664
665   switch ( d->tracks )
666666   {
667667   case 40: d->type = THOM_FLOPPY_5_1_4; break;
668668   case 80: d->type = THOM_FLOPPY_3_1_2; break;
669   default:
670      logerror( "thom_floppy_sap_load: invalid track number %i\n", d->tracks );
669   default:
670      logerror( "thom_floppy_sap_load: invalid track number %i\n", d->tracks );
671671      goto error;
672672   }
673673
674674   /* load */
675675   d->data = malloc( d->tracks * d->sectors * d->sector_size );
676676   assert( d->data );
677   for ( i = 0; i < d->tracks * d->sectors; i++ )
677   for ( i = 0; i < d->tracks * d->sectors; i++ )
678678   {
679679      UINT16 crc;
680680      int j, fmt, prot, track, sector;
r1461r1462
700700      /* check CRC */
701701      crc = thom_sap_crc( buf, d->sector_size + 4 );
702702      if ( ( (crc >> 8)   != buf[ d->sector_size + 4 ] ) ||
703           ( (crc & 0xff) != buf[ d->sector_size + 5 ] ) )
703           ( (crc & 0xff) != buf[ d->sector_size + 5 ] ) )
704704      {
705705         logerror( "thom_floppy_sap_load: CRC error for track %i, sector %i\n", track, sector );
706706      }
707707
708   
708
709709   }
710 
710
711711   thom_floppy_show( d );
712
712
713713   return INIT_PASS;
714714
715715error:
716716   PRINT(( "could not load floppy image in drive %i\n", image_index_in_device( image ) ));
717   if ( d->data ) free( d->data );
717   if ( d->data ) free( d->data );
718718   d->data = NULL;
719719   d->type = THOM_FLOPPY_NONE;
720720   return INIT_FAIL;
r1461r1462
730730   UINT8 buf[262];
731731   if ( !d->data )
732732      return;
733   if ( !d->has_changed )
733   if ( !d->has_changed )
734734      return;
735735   PRINT (( "thom_floppy_sap_save: saving floppy %li, %i KB\n", (long) (d - thom_floppy_drives), size / 1024 ));
736736
r1461r1462
746746   /* write sectors */
747747   for ( track = 0; track < d->tracks; track++ )
748748   {
749      for ( sector = 1; sector <= d->sectors; sector++ )
749      for ( sector = 1; sector <= d->sectors; sector++ )
750750      {
751751         UINT8 *p = thom_floppy_sector_ptr( d, sector, track, 0 );
752752         UINT16 crc;
r1461r1462
765765         buf[ d->sector_size + 5 ] = crc & 0xff;
766766
767767         /* crypt data */
768         for ( i = 0; i < d->sector_size; i++ )
768         for ( i = 0; i < d->sector_size; i++ )
769769            buf[ i + 4 ] ^= sap_magic_num;
770770
771771         image_fwrite( image, buf, d->sector_size + 6 );
r1461r1462
781781
782782static void thom_floppy_reset ( thom_floppy_drive* d )
783783{
784   if ( d->data )
784   if ( d->data )
785785      free( d->data );
786786   d->data = NULL;
787787   d->cur_track = 0;
r1461r1462
812812   d->cur_track = 0;
813813
814814   /* dispatch according to extension */
815   if ( typ )
815   if ( typ )
816816   {
817      if ( !mame_stricmp( typ, "sap" ) )
817      if ( !mame_stricmp( typ, "sap" ) )
818818         return thom_floppy_sap_load( image );
819      else if ( !mame_stricmp( typ, "fd" ) )
819      else if ( !mame_stricmp( typ, "fd" ) )
820820         return thom_floppy_fd_load( image );
821      else if ( !mame_stricmp( typ, "qd" ) )
821      else if ( !mame_stricmp( typ, "qd" ) )
822822         return thom_floppy_qd_load( image );
823823   }
824   
824
825825   return INIT_FAIL;
826826}
827827
r1461r1462
831831{
832832   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
833833   const char* typ = image_filetype( image );
834   if ( typ )
834   if ( typ )
835835   {
836      if ( !mame_stricmp( typ, "sap" ) ) 
836      if ( !mame_stricmp( typ, "sap" ) )
837837         thom_floppy_sap_save( image );
838      else if ( !mame_stricmp( typ, "fd" ) )
838      else if ( !mame_stricmp( typ, "fd" ) )
839839         thom_floppy_fd_save( image );
840      else if ( !mame_stricmp( typ, "qd" ) )
840      else if ( !mame_stricmp( typ, "qd" ) )
841841         thom_floppy_qd_save( image );
842842   }
843843   thom_floppy_reset( d );
r1461r1462
853853
854854   d->image = image;
855855   d->cur_track = 0;
856   if ( typ && !mame_stricmp( typ, "qd" ) ) 
856   if ( typ && !mame_stricmp( typ, "qd" ) )
857857   {
858858      d->sides = 1;
859859      d->sectors = 400;
r1461r1462
862862      d->density = DEN_MFM_LO;
863863      d->type = THOM_FLOPPY_QDD;
864864   }
865   else if ( typ && !mame_stricmp( typ, "fd" ) ) 
865   else if ( typ && !mame_stricmp( typ, "fd" ) )
866866   {
867867      d->sides = 1;
868868      d->sectors = 16;
r1461r1462
871871      d->density = DEN_FM_LO;
872872      d->type = THOM_FLOPPY_5_1_4;
873873   }
874   else
874   else
875875   {
876876      d->sides = 1;
877877      d->sectors = 16;
r1461r1462
913913
914914thom_floppy_type thom_floppy_get_type ( int drive )
915915{
916   if ( drive < 0 || drive >= 4 )
916   if ( drive < 0 || drive >= 4 )
917917      return THOM_FLOPPY_NONE;
918918   else
919919      return thom_floppy_drives[ drive ].type;
r1461r1462
923923
924924void thom_floppy_getinfo( const device_class *devclass, UINT32 state, union devinfo *info )
925925{
926   switch ( state )
926   switch ( state )
927927   {
928928   case DEVINFO_INT_TYPE:
929      info->i = IO_FLOPPY;
929      info->i = IO_FLOPPY;
930930      break;
931931   case DEVINFO_INT_READABLE:
932      info->i = 1;
932      info->i = 1;
933933      break;
934934   case DEVINFO_INT_WRITEABLE:
935935      info->i = 1;
r1461r1462
977977      strcpy( info->s = device_temp_str(), __FILE__ );
978978      break;
979979   case DEVINFO_STR_FILE_EXTENSIONS:
980      strcpy( info->s = device_temp_str(), "fd,qd,sap" );
980      strcpy( info->s = device_temp_str(), "fd,qd,sap" );
981981      break;
982982   }
983983}
src/mess/formats/coco_cas.c
r1461r1462
99   of these emulators patch the system as a shortcut.  Thus, the ones and
1010   zeroes in the file do not truly represent modulated pulses in the
1111   waveform, but what the BIOS reads and writes.
12   
12
1313   In doing so, they make the CoCo more tolerant of short headers and lack
1414   of delays between blocks.  This legacy is reflected in most CAS files in
1515    use, and thus presents a problem for a pure hardware emulation like MESS.
r1461r1462
8080      for (i = 0; i < 8; i++)
8181      {
8282         p.w.l >>= 1;
83         
83
8484         if (state == 0)
8585         {
8686            /* searching for a block */
r1461r1462
161161   {
162162      static const UINT8 dummy_bytes[] =
163163      {
164         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
165         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
166         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
167         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
168         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
169         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
170         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
171         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
172         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
173         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
174         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
175         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
176         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
177         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
178         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
179         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
180         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
181         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
182         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
183         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
184         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
164         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
165         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
166         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
167         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
168         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
169         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
170         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
171         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
172         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
173         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
174         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
175         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
176         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
177         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
178         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
179         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
180         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
181         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
182         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
183         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
184         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
185185         0x3C, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A
186186      };
187187      time_index = 10.0;
src/mess/formats/primoptp.c
r1461r1462
2626static UINT32 primo_tape_image_length;
2727
2828static INT16 *primo_emit_level(INT16 *p, int count, int level)
29{   
29{
3030   int i;
3131
3232   for (i=0; i<count; i++)   *(p++) = level;
r1461r1462
115115
116116         /* b is set on the first byte of block data */
117117         b += 3;
118         
118
119119         number_of_1 = primo_cassette_calculate_number_of_1(b, block_size);
120120         number_of_0 = (block_size)*8-number_of_1;
121121
r1461r1462
191191         block_size = *(b+1) + *(b+2)*256;
192192         b += 3;
193193
194         for (k=0; k<block_size; k++)                     
194         for (k=0; k<block_size; k++)
195195            p = primo_output_byte (p, *(b+k));
196196
197197         logerror ("Samples (block data): %ld\n", (long int)(p-buffer));
src/mess/formats/thom_dsk.h
r1461r1462
2828extern int  thom_floppy_init   ( mess_image *image );
2929extern int  thom_floppy_load   ( mess_image* image );
3030extern void thom_floppy_unload ( mess_image *image);
31extern int  thom_floppy_create ( mess_image *image,
31extern int  thom_floppy_create ( mess_image *image,
3232             int create_format, option_resolution *args );
3333
3434extern void    thom_floppy_set_density( DENSITY density );
r1461r1462
3636
3737extern thom_floppy_type thom_floppy_get_type( int drive );
3838
39extern void thom_floppy_getinfo( const device_class *devclass,
39extern void thom_floppy_getinfo( const device_class *devclass,
4040             UINT32 state, union devinfo *info );
4141
4242#endif
src/mess/formats/pmd_pmd.c
r1461r1462
1313#define PMD85_BITS_PER_BYTE   11
1414
1515static INT16 *pmd85_emit_level(INT16 *p, int count, int level)
16{   
16{
1717   int i;
1818
1919   for (i=0; i<count; i++)   *(p++) = level;
r1461r1462
7171      p = pmd85_output_bit(p, 1);
7272
7373   /* header */
74   for (i=0; i<PMD85_HEADER_BYTES; i++)                     
74   for (i=0; i<PMD85_HEADER_BYTES; i++)
7575      p = pmd85_output_byte(p, bytes[i]);
7676
7777   /* pause */
r1461r1462
7979      p = pmd85_output_bit(p, 1);
8080
8181   /* data */
82   for (i=0; i<data_size; i++)                     
82   for (i=0; i<data_size; i++)
8383      p = pmd85_output_byte(p, bytes[i+PMD85_HEADER_BYTES]);
8484
8585   return p - buffer;
src/mess/formats/cassimg.c
r1461r1462
762762         pulse_period = 1 / pulse_frequency;
763763         err = cassette_put_samples(cassette, 0, time_index, pulse_period, wave_bytes_length, 1, wave_bytes, CASSETTE_WAVEFORM_8BIT);
764764         if (err)
765            goto done;   
765            goto done;
766766         time_index += pulse_period;
767767         total_displacement += pulse_period;
768768      }
r1461r1462
873873   pulse_period = 1 / pulse_frequency;
874874   err = cassette_put_samples(cassette, 0, time_index, pulse_period, wave_bytes_length, 1, wave_bytes, CASSETTE_WAVEFORM_8BIT);
875875   if (err)
876      goto done;   
876      goto done;
877877   time_index += pulse_period;
878878   total_displacement += pulse_period;
879879
src/mess/formats/zx81_p.c
r1461r1462
5858/* common functions */
5959
6060static INT16 *zx81_emit_level(INT16 *p, int count, int level)
61{   
61{
6262   int i;
6363
6464   for (i=0; i<count; i++)   *(p++) = level;
r1461r1462
179179   p = zx81_emit_level (p, ZX81_PILOT_LENGTH, WAVEENTRY_ZERO);
180180
181181   /* name */
182   for (i=0; i<zx_file_name_length; i++)                     
182   for (i=0; i<zx_file_name_length; i++)
183183      p = zx81_output_byte(p, zx_file_name[i]);
184184
185185   /* data */
186   for (i=0; i<real_data_length; i++)                     
186   for (i=0; i<real_data_length; i++)
187187      p = zx81_output_byte(p, bytes[i]);
188188
189189   return p - buffer;
r1461r1462
247247   p = zx81_emit_level (p, ZX81_PILOT_LENGTH, WAVEENTRY_ZERO);
248248
249249   /* data */
250   for (i=0; i<real_data_length; i++)                     
250   for (i=0; i<real_data_length; i++)
251251      p = zx81_output_byte(p, bytes[i]);
252252
253253   return p - buffer;
src/mess/formats/vt_dsk.c
r1461r1462
1212#include "formats/basicdsk.h"
1313
1414static FLOPPY_IDENTIFY(vz_identify)
15{   
15{
1616   UINT64 size = floppy_image_size(floppy);
1717   *vote = ((size == 98560) || (size == 99200)) ? 100 : 0;
1818   return FLOPPY_ERROR_SUCCESS;
r1461r1462
2929      geometry.tracks          = option_resolution_lookup_int(params, PARAM_TRACKS);
3030      geometry.sectors         = option_resolution_lookup_int(params, PARAM_SECTORS);
3131      geometry.first_sector_id = option_resolution_lookup_int(params, PARAM_FIRST_SECTOR_ID);
32      geometry.sector_length   = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH);     
32      geometry.sector_length   = option_resolution_lookup_int(params, PARAM_SECTOR_LENGTH);
3333   }
3434   else
3535   {
r1461r1462
3838      geometry.sectors         = 16;
3939      geometry.first_sector_id = 0;
4040      geometry.sector_length   = floppy_image_size(floppy)/geometry.tracks/geometry.sectors;
41   }
41   }
4242
4343   return basicdsk_construct(floppy, &geometry);
4444}
src/mess/formats/oric_tap.c
r1461r1462
3838static INT16 xor_wave_state = WAVEENTRY_HIGH^WAVEENTRY_LOW;
3939
4040static INT16 *oric_emit_level(INT16 *p, int count)
41{   
41{
4242   int i;
4343
4444   for (i=0; i<count; i++)
r1461r1462
4949   return p;
5050}
5151
52/* 4 periods at 1200hz */
52/* 4 periods at 1200hz */
5353static INT16* oric_output_bit(INT16 *p, UINT8 b)
5454{
5555   p = oric_emit_level(p,1);
r1461r1462
8585}
8686
8787
88/*   each byte on cassette is stored as:
89   
88/*   each byte on cassette is stored as:
89
9090   start bit      0 * 1
9191   data bits      8 * x (x is 0 or 1, and depends on data-bit value)
9292   parity bit      1 * x (x is 0 or 1, and depends on the parity of the data bits)
r1461r1462
127127   /* start bit */
128128   count+=oric_get_bit_size_in_samples(0);
129129
130   /* set initial parity */   
130   /* set initial parity */
131131   parity = 1;
132   
132
133133   /* data bits, written bit 0, bit 1...bit 7 */
134134   data = byte;
135135   for (i=0; i<8; i++)
r1461r1462
165165
166166   /* start bit */
167167   p = oric_output_bit(p, 0);
168   
169   /* set initial parity */   
168
169   /* set initial parity */
170170   parity = 1;
171   
171
172172   /* data bits, written bit 0, bit 1...bit 7 */
173173   data = byte;
174174   for (i=0; i<8; i++)
r1461r1462
261261               count += oric_seconds_to_samples(0.25);
262262
263263               logerror("found end of sync bytes!\n");
264           
264
265265               /* oric writes approx 512 bytes */
266266               /* found end of sync bytes */
267267               for (i=0; i<ORIC_LEADER_LENGTH; i++)
r1461r1462
273273               {
274274                  //logerror("reading header!\n");
275275                  count+=oric_calculate_byte_size_in_samples(0x024);
276     
276
277277                  oric_cassette_state = ORIC_CASSETTE_READ_HEADER;
278278                  oric_data_count = 0;
279279                  oric_data_length = 9;
r1461r1462
286286         {
287287            header[oric_data_count] = data;
288288            count+=oric_calculate_byte_size_in_samples(data);
289     
289
290290            oric_data_count++;
291291
292292            if (oric_data_count==oric_data_length)
r1461r1462
315315
316316               oric_cassette_state = ORIC_CASSETTE_WRITE_DATA;
317317               oric_data_count = 0;
318               
318
319319               end = (((header[4] & 0x0ff)<<8) | (header[5] & 0x0ff));
320320               start = (((header[6] & 0x0ff)<<8) | (header[7] & 0x0ff));
321//#ifdef ORIC_WAV_DEBUG     
321//#ifdef ORIC_WAV_DEBUG
322322               logerror("start (from header): %02x\n",start);
323323               logerror("end (from header): %02x\n",end);
324324//#endif
r1461r1462
359359
360360
361361   /* header and trailer act as pauses */
362   /* the trailer is required so that the via sees the last bit of the last
362   /* the trailer is required so that the via sees the last bit of the last
363363      byte */
364364    if (bytes == CODE_HEADER) {
365365        for (i = 0; i < ORIC_WAVESAMPLES_HEADER; i++)
r1461r1462
453453               {
454454                                            p = oric_output_bit(p,1);
455455                                        }
456               
456
457457               oric_cassette_state = ORIC_CASSETTE_WRITE_DATA;
458458               oric_data_count = 0;
459               
459
460460               end = (((header[4] & 0x0ff)<<8) | (header[5] & 0x0ff));
461461               start = (((header[6] & 0x0ff)<<8) | (header[7] & 0x0ff));
462//#ifdef ORIC_WAV_DEBUG     
462//#ifdef ORIC_WAV_DEBUG
463463               logerror("start (from header): %02x\n",start);
464464               logerror("end (from header): %02x\n",end);
465465//#endif
src/mess/formats/basicdsk.c
r1461r1462
108108   }
109109   offs *= geom->sector_length;
110110   offs += geom->offset;
111   
111
112112   if (offset)
113113      *offset = offs;
114114   return FLOPPY_ERROR_SUCCESS;
r1461r1462
199199   }
200200
201201   memset(buffer, floppy_get_filler(floppy), sector_length);
202   
202
203203   for (sector = 0; sector < geometry->sectors; sector++)
204204   {
205205      err = basicdsk_write_sector(floppy, head, track, sector + geometry->first_sector_id, buffer, sector_length);
src/mess/formats/thom_cas.c
r1461r1462
6464   in FM format with a 1.1 ms period (900 bauds):
6565   - 0 is 5 periods at 4.5 KHz
6666   - 1 is 7 periods at 6.3 KHz
67   
67
6868   Moreover, a byte is represented using 11 bits:
6969   - one 0 start bit
7070   - eight data bits (low bit first)
7171   - two 1 stop bits
7272
7373   There are also long (1 s) sequences of 1 bits to re-synchronize the
74   cassette at places the motor can be cut off and back on (e.g., between
74   cassette at places the motor can be cut off and back on (e.g., between
7575   files).
7676
7777   The computer outputs a modulated wave that is directly put on the cassette.
7878   However, the input is demodulated by the cassette-reader before being
79   sent to the computer: we got 0 when the signal is around 4.5 KHz and
79   sent to the computer: we got 0 when the signal is around 4.5 KHz and
8080   1 when the signal is around 6.3 KHz.
8181*/
8282
r1461r1462
9393static UINT8* to7_k7_bits;
9494
9595
96/* 1-bit cassette input to the computer
97   inside the controller, two frequency filters (adjusted to 6.3 and 4.5 KHz)
96/* 1-bit cassette input to the computer
97   inside the controller, two frequency filters (adjusted to 6.3 and 4.5 KHz)
9898   and a comparator demodulate the raw signal into 0s and 1s.
9999*/
100100int to7_get_cassette ( void )
r1461r1462
107107      cassette_state state = cassette_get_state( img );
108108      double pos = cassette_get_position( img );
109109      int bitpos = pos / TO7_BIT_LENGTH;
110   
111      if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED )
110
111      if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED )
112112         return 1;
113113
114      if ( K7_SPEED_HACK && to7_k7_bits )
114      if ( K7_SPEED_HACK && to7_k7_bits )
115115      {
116116         /* hack, feed existing bits */
117         if ( bitpos >= to7_k7_bitsize )
117         if ( bitpos >= to7_k7_bitsize )
118118            bitpos = to7_k7_bitsize -1;
119         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n",
120            activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, bitpos,
119         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n",
120            activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, bitpos,
121121            to7_k7_bits[ bitpos ] ));
122122         return to7_k7_bits[ bitpos ];
123123      }
124      else
124      else
125125      {
126126         /* demodulate wave signal on-the-fly */
127127         /* we simply count sign changes... */
r1461r1462
129129         INT8 data[40];
130130         cassette_get_samples( cass, 0, pos, TO7_BIT_LENGTH * 15. / 14., 40, 1, data, 0 );
131131
132         for ( k = 1, chg = 0; k < 40; k++ )
132         for ( k = 1, chg = 0; k < 40; k++ )
133133         {
134            if ( data[ k - 1 ] >= 0 && data[ k ] < 0 )
134            if ( data[ k - 1 ] >= 0 && data[ k ] < 0 )
135135               chg++;
136            if ( data[ k - 1 ] <= 0 && data[ k ] > 0 )
136            if ( data[ k - 1 ] <= 0 && data[ k ] > 0 )
137137               chg++;
138138         }
139139         k = ( chg >= 13 ) ? 1 : 0;
140         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n",
141            activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, bitpos,
140         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n",
141            activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos, bitpos,
142142            k, chg ));
143143         return k;
144144      }
145     
145
146146   }
147   else
147   else
148148      return 0;
149149}
150150
r1461r1462
169169          activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ? "off" : "on",
170170          (int) (pos / TO7_BIT_LENGTH) ));
171171
172   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 )
172   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 )
173173   {
174174      /* rewind a little before starting the motor */
175175      cassette_seek( img, -0.3, SEEK_CUR );
r1461r1462
188188   computer which has to decode it in software (unlike TO7).
189189   A 1 bit is one period at 1200 Hz; a 0 bit is one half-period at 600 Hz.
190190   Bit-order is most significant bit first (unlike TO7).
191   
191
192192   Double-density MO6 cassettes follow the exact same mechanism, but with
193193   at double frequency (perdiods at 2400 Hz, and half-perdios at 1200 Hz).
194194*/
r1461r1462
202202{
203203   mess_image* img = thom_cassette_img();
204204
205   if ( image_exists( img ) )
205   if ( image_exists( img ) )
206206   {
207207      cassette_image* cass = cassette_get_image( img );
208208      cassette_state state = cassette_get_state( img );
209209      double pos = cassette_get_position( img );
210210      INT32 hbit;
211211
212      if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED )
212      if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED )
213213         return 1;
214214
215215      cassette_get_sample( cass, 0, pos, 0, &hbit );
216216      hbit = hbit >= 0;
217   
218      VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n",
219         activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos,
217
218      VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n",
219         activecpu_get_previouspc(), attotime_to_double(timer_get_time()), state, pos,
220220         (int) (pos / MO5_HBIT_LENGTH), hbit ));
221221      return hbit;
222222   }
223   else
223   else
224224      return 0;
225225}
226226
r1461r1462
244244          activecpu_get_previouspc(), attotime_to_double(timer_get_time()), data ? "off" : "on",
245245          (int) (pos / MO5_HBIT_LENGTH) ));
246246
247   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED &&  !data && pos > 0.3 )
247   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED &&  !data && pos > 0.3 )
248248   {
249249      /* rewind a little before starting the motor */
250250      cassette_seek( img, -0.3, SEEK_CUR );
r1461r1462
289289
290290
291291
292static const struct CassetteModulation to7_k7_modulation =
292static const struct CassetteModulation to7_k7_modulation =
293293{
294294   CASSETTE_MODULATION_SQUAREWAVE,
295295   4000.0,  4500.0, 5000.0,
r1461r1462
298298
299299
300300
301static casserr_t to7_k7_identify ( cassette_image *cass, struct CassetteOptions *opts )
301static casserr_t to7_k7_identify ( cassette_image *cass, struct CassetteOptions *opts )
302302{
303303   casserr_t e = cassette_modulation_identify( cass, &to7_k7_modulation, opts );
304304   return e;
r1461r1462
306306
307307
308308
309static casserr_t to7_k7_load( cassette_image *cass )
309static casserr_t to7_k7_load( cassette_image *cass )
310310{
311311#if ! K7_SPEED_HACK
312312   static const INT8 square_wave[] = { -128, 127 };
r1461r1462
319319   LOG (( "to7_k7_load: start conversion, size=%li\n", (long)size ));
320320   PRINT (( "to7_k7_load: open cassette, length: %li bytes\n", (long) size ));
321321
322   if ( to7_k7_bits )
323   {
324      free( to7_k7_bits );
325      to7_k7_bits = NULL;
322   if ( to7_k7_bits )
323   {
324      free( to7_k7_bits );
325      to7_k7_bits = NULL;
326326   }
327 
327
328328   to7_k7_bitsize = 0;
329329   to7_k7_bits = auto_malloc( bitmax );
330330
r1461r1462
380380      K7_PUT_BIT( 1 );            \
381381      K7_PUT_BIT( 1 );            \
382382   } while (0)
383   
383
384384#define K7_FILL_1( SIZE ) \
385385   do                        \
386386   {                        \
r1461r1462
391391         for ( ii = 0; ii < (SIZE); ii++ ) K7_PUT_BIT( 1 ); \
392392      }                     \
393393   } while (0)
394 
394
395395#define K7_FILL_ff( SIZE ) \
396396   do                        \
397397   {                        \
r1461r1462
406406
407407   /* check format */
408408   cassette_image_read( cass, block, 0, 64 );
409   for ( i = 3; ; i++ )
409   for ( i = 3; ; i++ )
410410   {
411      if ( ( i >= size ) || ( i >= 64 ) )
411      if ( ( i >= size ) || ( i >= 64 ) )
412412      {
413413         /* ? */
414414         PRINT (( "to7_k7_load: WARNING: this does not look like a MO or TO cassette.\n" ));
r1461r1462
420420         PRINT (( "to7_k7_load: WARNING: this looks like a MO cassette, not a TO one.\n" ));
421421         break;
422422      }
423      else if ( ( block[i-3] == 0xff ) && ( block[i-2] == 0x01 ) && ( block[i-1] == 0x3c ) && ! block[i] )
423      else if ( ( block[i-3] == 0xff ) && ( block[i-2] == 0x01 ) && ( block[i-1] == 0x3c ) && ! block[i] )
424424      {
425425         /* TO */
426426         break;
r1461r1462
428428   }
429429
430430   /* skip to first 0xff filler */
431   for ( sz = 0; pos < size; pos++, sz++ )
431   for ( sz = 0; pos < size; pos++, sz++ )
432432   {
433433      cassette_image_read( cass, &in, pos, 1 );
434      if ( in == 0xff )
434      if ( in == 0xff )
435435         break;
436436   }
437   if ( sz > 0 )
437   if ( sz > 0 )
438438      LOG (( "to7_k7_load: skip %i trash bytes\n", sz ));
439439
440440   /* loop over regular blocks */
441   while ( pos < size )
441   while ( pos < size )
442442   {
443   
443
444444   rebounce:
445445      /* skip 0xff filler */
446      for ( sz = 0; pos < size; pos++, sz++ )
446      for ( sz = 0; pos < size; pos++, sz++ )
447447      {
448448         cassette_image_read( cass, &in, pos, 1 );
449449         /* actually, we are bit laxist and treat as 0xff bytes with at least
450450            5 bits out of 8 set to 1
451451         */
452         for ( i = 0; in; in >>= 1 )
452         for ( i = 0; in; in >>= 1 )
453453            i += (in & 1);
454         if ( i < 5 )
454         if ( i < 5 )
455455            break;
456456      }
457457
458458      /* get block header */
459      if ( pos + 4 > size )
459      if ( pos + 4 > size )
460460      {
461         pos -= sz;
462         break;
461         pos -= sz;
462         break;
463463      }
464464      cassette_image_read( cass, block, pos, 4 );
465465      typ = block[2];
466466      sz2 = block[3]+1;
467      if ( block[0] != 0x01 || block[1] != 0x3c || ( typ != 0x00 && typ != 0x01 && typ !=  0xff ) )
467      if ( block[0] != 0x01 || block[1] != 0x3c || ( typ != 0x00 && typ != 0x01 && typ !=  0xff ) )
468468      {
469469         pos -= sz;
470         break;
470         break;
471471      }
472472      pos += 4;
473473
r1461r1462
476476      pos += sz2;
477477
478478      /* 1-filler and 0xff-filler */
479      if ( typ == 0 || typ == 0xff )
479      if ( typ == 0 || typ == 0xff )
480480         K7_FILL_1( 1000 );
481481      K7_FILL_ff( sz );
482482
483483      /* put block */
484484      LOG (( "to7_k7_load: block off=$%x type=$%02X size=%i bitstart=%i\n", (int) pos-sz2-4, typ, sz2, to7_k7_bitsize ));
485485      VLOG (( "to7_k7_load: data:" ));
486      for ( i = 0; i < sz2 + 4; i ++)
486      for ( i = 0; i < sz2 + 4; i ++)
487487      {
488488         VLOG (( " $%02X", block[i] ));
489489         K7_PUT_BYTE( block[i] );
r1461r1462
501501         memcpy( name+9, block+12, 3 );
502502         for ( i = 0; name[i]; i++)
503503         {
504            if ( name[i] < ' ' || name[i] >= 127 )
504            if ( name[i] < ' ' || name[i] >= 127 )
505505               name[i] = '?';
506506         }
507         PRINT (( "to7_k7_load: file \"%s\" type=%s,%s at %imn %is\n",
508             name,
507         PRINT (( "to7_k7_load: file \"%s\" type=%s,%s at %imn %is\n",
508             name,
509509             (t==0) ? "bas" : (t==1) ? "dat" : (t==2) ? "bin" : "???",
510510             (u == 0) ? "a" : (u == 0xff) ? "b" : "?",
511511             p / 60, p % 60 ));
512512      }
513     
513
514514      /* extra 1-fillers */
515      if ( typ == 0 || typ == 0xff )
515      if ( typ == 0 || typ == 0xff )
516516         K7_FILL_1( 1000 );
517517   }
518518
519519   /* trailing data with invalid block structure
520520      => dump it in a raw form, but stay alert for hidden block starts
521521   */
522   if ( pos < size )
522   if ( pos < size )
523523   {
524524      invalid++;
525525      LOG (( "to7_k7_load: trailing raw bytes off=$%x bitstart=%i\n", (int) pos, to7_k7_bitsize ));
526     
526
527527      /* put block */
528      for (; pos < size; pos++ )
528      for (; pos < size; pos++ )
529529      {
530530         cassette_image_read( cass, &in, pos, 1 );
531         for ( sz = 0; pos < size && in == 0xff; sz++ )
531         for ( sz = 0; pos < size && in == 0xff; sz++ )
532532         {
533533            pos++;
534            cassette_image_read( cass, &in, pos, 1 );
534            cassette_image_read( cass, &in, pos, 1 );
535535         }
536         if ( invalid < 10 && sz > 4 && in == 0x01 && pos + 4 <= size )
536         if ( invalid < 10 && sz > 4 && in == 0x01 && pos + 4 <= size )
537537         {
538538            UINT8 in1,in2;
539539            cassette_image_read( cass, &in1,   pos+1, 1 );
540540            cassette_image_read( cass, &in2, pos+2, 1 );
541            if ( (in1 == 0x3c) && ((in2 == 0x00) || (in2 == 0x01) ) )
541            if ( (in1 == 0x3c) && ((in2 == 0x00) || (in2 == 0x01) ) )
542542            {
543543               /* seems we have a regular block hidden in raw data => rebounce */
544544               LOG (( "to7_k7_load: hidden regular block found\n" ));
545545               pos -= sz;
546546               goto rebounce;
547547            }
548            if ( ( ( in1 == 0x3d ) && ( in2 == 0 ) ) || ( ( in1 == 0x57 ) && ( in2 == 0x49 ) ) )
548            if ( ( ( in1 == 0x3d ) && ( in2 == 0 ) ) || ( ( in1 == 0x57 ) && ( in2 == 0x49 ) ) )
549549            {
550550               /* special block (Infogrames) => just prepend filler */
551551               K7_FILL_1 ( 500 );
r1461r1462
560560
561561   if ( invalid )
562562      PRINT (( "to7_k7_load: WARNING: the k7 has an unknown structure and may not work\n" ));
563   
563
564564   sz = to7_k7_bitsize * TO7_BIT_LENGTH;
565565   PRINT (( "to7_k7_load: cassette length: %imn %is (%i samples)\n", sz / 60, sz % 60, to7_k7_bitsize ));
566566
567567   return CASSETTE_ERROR_SUCCESS;
568} 
568}
569569
570570
571571
572static const struct CassetteFormat to7_k7 =
572static const struct CassetteFormat to7_k7 =
573573{ "k7", to7_k7_identify, to7_k7_load, NULL /* no save */ };
574574
575575
r1461r1462
578578
579579
580580
581static casserr_t to7_wav_identify ( cassette_image *cass,
582                struct CassetteOptions *opts )
581static casserr_t to7_wav_identify ( cassette_image *cass,
582                struct CassetteOptions *opts )
583583{
584584   casserr_t e = wavfile_format.identify( cass, opts );
585585   return e;
r1461r1462
593593   struct CassetteInfo info;
594594   double len;
595595
596   if ( to7_k7_bits )
597   {
598      free( to7_k7_bits );
599      to7_k7_bits = NULL;
596   if ( to7_k7_bits )
597   {
598      free( to7_k7_bits );
599      to7_k7_bits = NULL;
600600   }
601601
602   if ( e != CASSETTE_ERROR_SUCCESS )
602   if ( e != CASSETTE_ERROR_SUCCESS )
603603      return e;
604604
605605   cassette_get_info( cass, &info );
606606
607607   len = (double) info.sample_count / info.sample_frequency;
608   
608
609609   PRINT (( "to7_wav_load: loading cassette, length %imn %is, %i Hz, %i bps, %i bits\n",
610       (int) len / 60, (int) len % 60,
611       info.sample_frequency, info.bits_per_sample,
610       (int) len / 60, (int) len % 60,
611       info.sample_frequency, info.bits_per_sample,
612612       (int) (len / TO7_BIT_LENGTH) ));
613613
614614   return CASSETTE_ERROR_SUCCESS;
r1461r1462
626626
627627
628628/* overloaded wav: dump info */
629const static struct CassetteFormat to7_wav =
629const static struct CassetteFormat to7_wav =
630630{ "wav", to7_wav_identify, to7_wav_load, to7_wav_save };
631631
632632
r1461r1462
635635
636636
637637
638static casserr_t mo5_k5_identify ( cassette_image *cass,
639               struct CassetteOptions *opts )
638static casserr_t mo5_k5_identify ( cassette_image *cass,
639               struct CassetteOptions *opts )
640640{
641641   opts -> bits_per_sample = 8;
642642   opts -> channels = 1;
r1461r1462
646646
647647
648648
649/* As the k7 format, the k5 format represents the stream of bytes returned by
649/* As the k7 format, the k5 format represents the stream of bytes returned by
650650   the BIOS cassette routine and need to be hacked back into the original
651651   cassette wave.
652652
r1461r1462
658658   FF = end of file
659659   - 1-byte size
660660   - size - 1 bytes of data (255 bytes of data if size = 0)
661   - one byte of CRC: sum from (and including) header up to (and including)
661   - one byte of CRC: sum from (and including) header up to (and including)
662662   CRC byte should be 0 modulo 256
663663
664   They are separated by 0x01 filler bytes (generally 10 of them),
665   for synchronisation. There are also extra 0 filler bits between certain
664   They are separated by 0x01 filler bytes (generally 10 of them),
665   for synchronisation. There are also extra 0 filler bits between certain
666666   kinds of blocks, when the motor is supposed to go off and back on.
667667*/
668668
669static casserr_t mo5_k5_load( cassette_image *cass )
669static casserr_t mo5_k5_load( cassette_image *cass )
670670{
671671   size_t size = cassette_image_size( cass ), pos = 0;
672672   int i, sz, sz2, hbit = 0;
r1461r1462
675675
676676   LOG (( "mo5_k5_load: start conversion, size=%li\n", (long)size ));
677677   PRINT (( "mo5_k5_load: open cassette, length: %li bytes\n", (long) size ));
678 
678
679679   /* store a half-bit */
680680#define K5_PUT_HBIT                     \
681681   do                        \
r1461r1462
683683      cassette_put_sample ( cass, 0, hbitsize * MO5_HBIT_LENGTH, MO5_HBIT_LENGTH, (hbit ? 1 : -1) << 30 ); \
684684      hbitsize++;                  \
685685   } while ( 0 )
686   
686
687687   /* store one bit */
688688#define K5_PUT_BIT( BIT )         \
689689   do               \
r1461r1462
701701      }            \
702702      hbit = !hbit;         \
703703   } while (0)
704   
704
705705   /* store one byte, no start / stop bit, converse order from TO7 */
706706#define K5_PUT_BYTE( BYTE ) \
707707   do                     \
r1461r1462
711711      for ( x = 0; x < 8; x++ )         \
712712         K5_PUT_BIT( (b >> (7 - x)) & 1 );   \
713713   } while (0)
714 
714
715715   /* store filler */
716716#define K5_FILL_0( SIZE ) \
717717   do                        \
r1461r1462
724724            K5_PUT_BIT( 0 );         \
725725      }                     \
726726   } while (0)
727 
727
728728#define K5_FILL_01( SIZE )                  \
729729   do                        \
730730   {                        \
r1461r1462
739739
740740   /* check format */
741741   cassette_image_read( cass, block, 0, 64 );
742   for ( i = 3; ; i++ )
742   for ( i = 3; ; i++ )
743743   {
744      if ( ( i >= size ) || ( i >= 64 ) )
744      if ( ( i >= size ) || ( i >= 64 ) )
745745      {
746746         /* ? */
747747         PRINT (( "to5_k5_load: WARNING: this does not look like a MO or TO cassette.\n" ));
748748         break;
749749      }
750      else if ( ( block[i-3] == 0x01 ) && ( block[i-2] == 0x3c ) && ( block[i-1] == 0x5a ) && ! block[i] )
750      else if ( ( block[i-3] == 0x01 ) && ( block[i-2] == 0x3c ) && ( block[i-1] == 0x5a ) && ! block[i] )
751751      {
752752         /* MO */
753753         break;
754754      }
755      else if ( ( block[i-3] == 0xff ) && ( block[i-2] == 0x01 ) && ( block[i-1] == 0x3c ) && ! block[i] )
755      else if ( ( block[i-3] == 0xff ) && ( block[i-2] == 0x01 ) && ( block[i-1] == 0x3c ) && ! block[i] )
756756      {
757757         /* TO */
758758         PRINT (( "to5_k5_load: WARNING: this looks like a TO cassette, not a MO one.\n" ));
r1461r1462
761761   }
762762
763763   cassette_image_read( cass, block, pos, 6 );
764   if ( ! memcmp( block, "DCMOTO", 6 ) || ! memcmp( block, "DCMO5", 5 ) || ! memcmp( block, "DCMO6", 5 ) )
764   if ( ! memcmp( block, "DCMOTO", 6 ) || ! memcmp( block, "DCMO5", 5 ) || ! memcmp( block, "DCMO6", 5 ) )
765765      dcmoto = 1;
766 
766
767767   /* loop over regular blocks */
768   while ( pos < size )
768   while ( pos < size )
769769   {
770770
771771   rebounce:
772772      /* skip DCMOTO header*/
773      if ( dcmoto )
773      if ( dcmoto )
774774      {
775775         cassette_image_read( cass, block, pos, 6 );
776         if ( ! memcmp( block, "DCMOTO", 6 ) )
776         if ( ! memcmp( block, "DCMOTO", 6 ) )
777777         {
778778            LOG (( "mo5_k5_load: DCMOTO signature found at off=$%x\n", pos ));
779779            pos += 6;
780780         }
781         else if ( ! memcmp( block, "DCMO", 4 ) )
781         else if ( ! memcmp( block, "DCMO", 4 ) )
782782         {
783783            LOG (( "mo5_k5_load: DCMO* signature found at off=$%x\n", pos ));
784784            pos += 5;
785785         }
786786      }
787   
787
788788      /* skip 0x01 filler */
789      for ( sz = 0; pos < size; pos++, sz++ )
789      for ( sz = 0; pos < size; pos++, sz++ )
790790      {
791791         cassette_image_read( cass, &in, pos, 1 );
792792         if ( in != 0x01 )
r1461r1462
794794      }
795795
796796      /* get block header */
797      if ( pos + 4 > size )
797      if ( pos + 4 > size )
798798      {
799799         pos -= sz;
800         break;
800         break;
801801      }
802802      cassette_image_read( cass, block, pos, 4 );
803803      typ = block[2];
804804      sz2 = (UINT8) (block[3]-1);
805      if ( block[0] != 0x3c || block[1] != 0x5a || ( typ != 0x00 && typ != 0x01 && typ !=  0xff ) || pos+sz2 > size )
806      {
805      if ( block[0] != 0x3c || block[1] != 0x5a || ( typ != 0x00 && typ != 0x01 && typ !=  0xff ) || pos+sz2 > size )
806      {
807807         pos -= sz;
808         break;
808         break;
809809      }
810810      pos += 4;
811811
r1461r1462
814814      pos += sz2;
815815
816816      /* 0-fillers and 0x01-fillers */
817      if ( typ == 0 || typ == 0xff )
817      if ( typ == 0 || typ == 0xff )
818818         K5_FILL_0( 1200 );
819      else
819      else
820820         K5_FILL_0( 300 ); /* for MO6 */
821821      K5_FILL_01( sz < 10 ? 10 : sz );
822822
823823      /* put block */
824824      LOG (( "mo5_k5_load: block off=$%x type=$%02X size=%i hbitstart=%i\n", (int) pos-sz2-4, typ, sz2, hbitsize ));
825825      VLOG (( "mo5_k5_load: data:" ));
826      for ( i = 0; i < sz2 + 4; i ++)
826      for ( i = 0; i < sz2 + 4; i ++)
827827      {
828828         VLOG (( " $%02X", block[i] ));
829829         K5_PUT_BYTE( block[i] );
r1461r1462
831831      VLOG (( "\n" ));
832832
833833      /* checksum */
834      for ( i = 0, sum = 0; i < sz2; i++ )
834      for ( i = 0, sum = 0; i < sz2; i++ )
835835         sum += block[i+4];
836836      if ( sum )
837837         LOG(( "mo5_k5_load: invalid checksum $%02X (should be 0)\n", sum ));
r1461r1462
847847         memcpy( name+9, block+12, 3 );
848848         for ( i = 0; name[i]; i++)
849849         {
850            if ( name[i] < ' ' || name[i] >= 127 )
850            if ( name[i] < ' ' || name[i] >= 127 )
851851               name[i] = '?';
852852         }
853         PRINT (( "mo5_k5_load: file \"%s\" type=%s,%s at %imn %is\n",
854             name,
853         PRINT (( "mo5_k5_load: file \"%s\" type=%s,%s at %imn %is\n",
854             name,
855855             (t==0) ? "bas" : (t==1) ? "dat" : (t==2) ? "bin" : "???",
856856             (u == 0) ? "a" : (u == 0xff) ? "b" : "?",
857857             p / 60, p % 60 ));
858858      }
859859
860860      /* 0-fillers */
861      if ( typ == 0xff || typ == 0x00 )
861      if ( typ == 0xff || typ == 0x00 )
862862         K5_FILL_0( 1800 );
863863   }
864864
865865   /* dump trailing bytes, but also look for beginings of blocks */
866   if ( pos < size )
866   if ( pos < size )
867867   {
868868      invalid++;
869869      K5_FILL_0( 1200 );
870870      LOG (( "mo5_k5_load: trailing trash off=$%x size=%i hbitstart=%i\n", (int) pos, (int) size-pos, hbitsize ));
871      for ( ; pos < size; pos++ )
871      for ( ; pos < size; pos++ )
872872      {
873         cassette_image_read( cass, &in, pos, 1 );
874         if ( dcmoto && in=='D' )
873         cassette_image_read( cass, &in, pos, 1 );
874         if ( dcmoto && in=='D' )
875875         {
876876            /* skip DCMOTO header*/
877877            cassette_image_read( cass, block, pos, 6 );
878878            if ( ! memcmp( block, "DCMOTO", 6 ) )
879879            {
880880               LOG (( "mo5_k5_load: DCMOTO signature found at off=$%x\n", pos ));
881               pos += 6;
882               cassette_image_read( cass, &in, pos, 1 );
881               pos += 6;
882               cassette_image_read( cass, &in, pos, 1 );
883883            }
884            else if ( ! memcmp( block, "DCMO", 4 ) )
884            else if ( ! memcmp( block, "DCMO", 4 ) )
885885            {
886886               LOG (( "mo5_k5_load: DCMO* signature found at off=$%x\n", pos ));
887               pos += 5;
888               cassette_image_read( cass, &in, pos, 1 );
887               pos += 5;
888               cassette_image_read( cass, &in, pos, 1 );
889889            }
890890         }
891         for ( sz = 0; pos < size && in == 0x01; sz++ )
891         for ( sz = 0; pos < size && in == 0x01; sz++ )
892892         {
893893            pos++;
894            cassette_image_read( cass, &in, pos, 1 );
894            cassette_image_read( cass, &in, pos, 1 );
895895         }
896         if ( sz > 6 )
896         if ( sz > 6 )
897897         {
898898            cassette_image_read( cass, &in2, pos+1, 1 );
899899            cassette_image_read( cass, &in3, pos+2, 1 );
900            if ( invalid < 10 &&  in == 0x3c && in2 == 0x5a && (in3 == 0x00 || in3 == 0x01 || in3 == 0xff ) )
900            if ( invalid < 10 &&  in == 0x3c && in2 == 0x5a && (in3 == 0x00 || in3 == 0x01 || in3 == 0xff ) )
901901            {
902902               /* regular block found */
903903               LOG (( "mo5_k5_load: hidden regular block found\n" ));
904904               pos -= sz;
905905               goto rebounce;
906906            }
907            if ( invalid < 10 && sz > 6 && ( (in == 0x3c && in2 == 0x5a) || (in == 0xc3 && in2 == 0x5a) || (in == 0xc3 && in2 == 0x3c) || (in == 0x87 && in2 == 0x4a)  ) )
907            if ( invalid < 10 && sz > 6 && ( (in == 0x3c && in2 == 0x5a) || (in == 0xc3 && in2 == 0x5a) || (in == 0xc3 && in2 == 0x3c) || (in == 0x87 && in2 == 0x4a)  ) )
908908            {
909909               /* special block found */
910910               K5_FILL_0( 1200 );
911911               LOG (( "mo5_k5_load: special block $%02X $%02X found off=$%x hbitstart=%i\n", in, in2, (int) pos-sz, hbitsize ));
912912            }
913913         }
914         
914
915915         VLOG (( "mo5_k5_load: special data:" ));
916         for ( i = 0; i < sz; i++ )
916         for ( i = 0; i < sz; i++ )
917917         {
918918            K5_PUT_BYTE( 0x01 );
919919            VLOG (( " $01" ));
r1461r1462
923923      }
924924   }
925925
926   if ( invalid )
926   if ( invalid )
927927      PRINT (( "mo5_k5_load: WARNING: the k5 has an unknown structure and may not work\n" ));
928928
929929   sz = hbitsize * MO5_HBIT_LENGTH;
930930   PRINT (( "mo5_k5_load: cassette length: %imn %is (%i half-bits)\n", sz / 60, sz % 60, hbitsize ));
931 
931
932932   return CASSETTE_ERROR_SUCCESS;
933933}
934934
935935
936936
937static const struct CassetteFormat mo5_k5 =
937static const struct CassetteFormat mo5_k5 =
938938{ "k5,k7", mo5_k5_identify, mo5_k5_load, NULL /* no save */ };
939939
940940
r1461r1462
942942
943943
944944
945static casserr_t mo5_wav_identify ( cassette_image *cass,
946              struct CassetteOptions *opts )
945static casserr_t mo5_wav_identify ( cassette_image *cass,
946              struct CassetteOptions *opts )
947947{
948948   casserr_t e = wavfile_format.identify( cass, opts );
949949   return e;
r1461r1462
956956   casserr_t e = wavfile_format.load( cass );
957957   struct CassetteInfo info;
958958   int len;
959   if ( e == CASSETTE_ERROR_SUCCESS )
959   if ( e == CASSETTE_ERROR_SUCCESS )
960960   {
961961      cassette_get_info( cass, &info );
962962      len = info.sample_count / info.sample_frequency;
r1461r1462
977977
978978
979979/* overloaded wav: dump info */
980const static struct CassetteFormat mo5_wav =
980const static struct CassetteFormat mo5_wav =
981981{ "wav", mo5_wav_identify, mo5_wav_load, mo5_wav_save };
982982
983983
r1461r1462
985985/********************* formats ************************/
986986
987987
988const struct CassetteFormat *const to7_cassette_formats[] =
988const struct CassetteFormat *const to7_cassette_formats[] =
989989{ &to7_wav, &to7_k7, NULL };
990990
991991
992const struct CassetteFormat *const mo5_cassette_formats[] =
992const struct CassetteFormat *const mo5_cassette_formats[] =
993993{ &mo5_wav, &mo5_k5, NULL };
994994
995995
r1461r1462
998998
999999void to7_cassette_getinfo( const device_class *devclass, UINT32 state, union devinfo *info )
10001000{
1001   switch ( state )
1001   switch ( state )
10021002   {
1003   case DEVINFO_INT_COUNT:       
1003   case DEVINFO_INT_COUNT:
10041004      info->i = 1;
10051005      break;
10061006   case DEVINFO_PTR_CASSETTE_FORMATS:
1007      info->p = (void *) to7_cassette_formats;
1007      info->p = (void *) to7_cassette_formats;
10081008      break;
1009   case DEVINFO_INT_CASSETTE_DEFAULT_STATE: 
1010      info->i =
1011         CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED;
1009   case DEVINFO_INT_CASSETTE_DEFAULT_STATE:
1010      info->i =
1011         CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED;
10121012      break;
10131013   case DEVINFO_STR_DEV_FILE:
10141014      strcpy( info->s = device_temp_str(), __FILE__ );
10151015      break;
1016   default:
1016   default:
10171017      cassette_device_getinfo( devclass, state, info );
10181018   }
10191019}
r1461r1462
10211021
10221022void mo5_cassette_getinfo( const device_class *devclass, UINT32 state, union devinfo *info )
10231023{
1024   switch ( state )
1024   switch ( state )
10251025   {
1026   case DEVINFO_INT_COUNT:       
1026   case DEVINFO_INT_COUNT:
10271027      info->i = 1;
10281028      break;
10291029   case DEVINFO_PTR_CASSETTE_FORMATS:
1030      info->p = (void *) mo5_cassette_formats;
1030      info->p = (void *) mo5_cassette_formats;
10311031      break;
1032   case DEVINFO_INT_CASSETTE_DEFAULT_STATE: 
1033      info->i =
1034         CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED;
1032   case DEVINFO_INT_CASSETTE_DEFAULT_STATE:
1033      info->i =
1034         CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED;
10351035      break;
10361036   case DEVINFO_STR_DEV_FILE:
10371037      strcpy( info->s = device_temp_str(), __FILE__ );
10381038      break;
1039   default:
1039   default:
10401040      cassette_device_getinfo( devclass, state, info );
10411041   }
10421042}
src/mess/drivers/vip.c
r1461r1462
11/*
22
33   TODO:
4   
4
55   - pcb layout guru-style readme
66   - tape interface
77   - discrete sound from NE555
r1461r1462
130130   set_led_status(1, level);
131131}
132132
133static const CDP1802_CONFIG vip_config =
133static const CDP1802_CONFIG vip_config =
134134{
135135   vip_mode_r,
136136   vip_ef_r,
src/mess/drivers/wswan.c
r1461r1462
8181
8282static INPUT_PORTS_START( wswan )
8383   PORT_START /* IN 0 : cursors (X1-X4) */
84   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("X1 - Up")
85   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("X3 - Down")
86   PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("X4 - Left")
87   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("X2 - Right")
84   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("X1 - Up")
85   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("X3 - Down")
86   PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("X4 - Left")
87   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("X2 - Right")
8888   PORT_START /* IN 1 : Buttons */
89   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start")
90   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Button A")
91   PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Button B")
89   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start")
90   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Button A")
91   PORT_BIT( 0x8, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Button B")
9292   PORT_START /* IN 2 : cursors (Y1-Y4) */
9393   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y1 - Left") PORT_CODE(KEYCODE_A)
9494   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y3 - Right") PORT_CODE(KEYCODE_D)
src/mess/drivers/zx.c
r1461r1462
123123
124124   PORT_START_TAG("IN9")   // special keys 1
125125   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
126   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
126   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
127127   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
128128
129129   PORT_START_TAG("IN10")   // special keys 2
130   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
130   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
131131   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2)
132   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
133   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
134   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
132   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
133   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
134   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
135135   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
136136INPUT_PORTS_END
137137
r1461r1462
208208
209209   PORT_START_TAG("IN9")   // special keys 1
210210   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
211   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
211   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
212212   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
213213
214214   PORT_START_TAG("IN10")   // special keys 2
215   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
215   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
216216   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2)
217   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
218   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
219   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
217   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
218   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
219   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
220220   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
221221INPUT_PORTS_END
222222
r1461r1462
290290
291291   PORT_START_TAG("IN9")   // special keys 1
292292   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
293   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
293   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
294294   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
295295
296296   PORT_START_TAG("IN10")   // special keys 2
297   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
298   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
299   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
300   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
297   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
298   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
299   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
300   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
301301   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRAPHICS") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_SHIFT_2)
302302   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
303303INPUT_PORTS_END
r1461r1462
490490   ROMX_LOAD( "zx81.rom",  0x0000, 0x2000, CRC(fcbbd617) SHA1(a0ade36540561cc1691bb6f0c42ceae12484a102), ROM_BIOS(2) )
491491   ROM_SYSTEM_BIOS(2, "2nd", "2nd rev.")
492492   ROMX_LOAD( "zx81a.rom", 0x0000, 0x2000, CRC(4b1dd6eb) SHA1(7b143ee964e9ada89d1f9e88f0bd48d919184cfc), ROM_BIOS(3) )
493ROM_END                                                                                                                                       
493ROM_END
494494
495495ROM_START(h4th)
496496   ROM_REGION( 0x10000, REGION_CPU1,0 )
497497   ROM_LOAD( "h4th.rom", 0x0000, 0x2000, CRC(257d5a32) SHA1(03809a6b464609ff924f7e55a85eef875cd47ae8) )
498ROM_END                                                                                                                                       
498ROM_END
499499
500500ROM_START(tree4th)
501501   ROM_REGION( 0x10000, REGION_CPU1,0 )
502502   ROM_LOAD( "tree4th.rom", 0x0000, 0x2000, CRC(71616238) SHA1(3ee15779e03482b10fc59eb4df2446376c56b00d) )
503ROM_END                                                                                                                                       
503ROM_END
504504
505505ROM_START(ts1000)
506506   ROM_REGION( 0x10000, REGION_CPU1,0 )
r1461r1462
529529
530530   ROM_REGION( 0x200, REGION_GFX1, 0 )
531531   ROM_LOAD( "8300_fnt.bin", 0x0000, 0x0200, CRC(6bd0408c) SHA1(34a7a5afee511dc8bba28eccf305c873d80a557a) )
532ROM_END                                                                                                                                       
532ROM_END
533533
534534/* System Configuration */
535535
src/mess/drivers/dgn_beta.c
r1461r1462
44
55   Dragon Beta prototype, based on two 68B09E processors, WD2797, 6845.
66
7Project Beta was the second machine that Dragon Data had in development at
8the time they ceased trading, the first being Project Alpha (also know as the
9Dragon Professional).
7Project Beta was the second machine that Dragon Data had in development at
8the time they ceased trading, the first being Project Alpha (also know as the
9Dragon Professional).
1010
11The machine uses dual 68B09 cpus which both sit on the same bus and access
12the same memory and IO chips ! The first is the main processor, used to run
13user code, the second is uses as a DMA controler, to amongst other things
14disk data transfers. The first processor controled the second by having the
15halt and nmi lines from the second cpu connected to PIA output lines so
16that the could be changed under OS control. The first CPU just passed
17instructions for the block to be transfered in 5 low ram addresses and
11The machine uses dual 68B09 cpus which both sit on the same bus and access
12the same memory and IO chips ! The first is the main processor, used to run
13user code, the second is uses as a DMA controler, to amongst other things
14disk data transfers. The first processor controled the second by having the
15halt and nmi lines from the second cpu connected to PIA output lines so
16that the could be changed under OS control. The first CPU just passed
17instructions for the block to be transfered in 5 low ram addresses and
1818generated an NMI on the second CPU.
1919
2020Project Beta like the other Dragons used a WD2797 floppy disk controler
2121which is memory mapped, and controled by the second CPU.
2222
23Unlike the other Dragon machines, project Beta used a 68b45 to generate video,
24and totally did away with the SAM.
23Unlike the other Dragon machines, project Beta used a 68b45 to generate video,
24and totally did away with the SAM.
2525
26The machine has a 6551 ACIA chip, but I have not yet found where this is
26The machine has a 6551 ACIA chip, but I have not yet found where this is
2727memory mapped.
2828
29Project Beta, had a custom MMU bilt from a combination of LSTTL logic, and
30PAL programable logic. This MMU could address 256 blocks of 4K, giving a
29Project Beta, had a custom MMU bilt from a combination of LSTTL logic, and
30PAL programable logic. This MMU could address 256 blocks of 4K, giving a
3131total addressable range of 1 megabyte, of this the first 768KB could be RAM,
3232however tha machine by default, came with 256K or ram, and a 16K boot rom,
3333which contained an OS-9 Level 2 bootstrap.
3434
3535A lot of the infomrmation required to start work on this driver has been
36infered from disassembly of the boot rom, and from what little hardware
37documentation still exists.
36infered from disassembly of the boot rom, and from what little hardware
37documentation still exists.
3838
3939***************************************************************************/
4040
r1461r1462
5252#include "mslegacy.h"
5353
5454/*
55 Colour codes are as below acording to os-9 headers, however the presise values
56 may not be quite correct, also this will need changing as the pallate seems to
57 be controled by a 4x4bit register file in the video hardware
58 The text video ram seems to be aranged of words of character, attribute
59 The colour codes are stored in the attribute byte along with :
60   Underline bit    $40   
55 Colour codes are as below acording to os-9 headers, however the presise values
56 may not be quite correct, also this will need changing as the pallate seems to
57 be controled by a 4x4bit register file in the video hardware
58 The text video ram seems to be aranged of words of character, attribute
59 The colour codes are stored in the attribute byte along with :
60   Underline bit    $40
6161   Flash bit   $80
6262
6363These are yet to be implemented.
r1461r1462
8989
9090/*
9191   2005-05-10
92   
92
9393   I *THINK* I know how the memory paging works, the 64K memory map is devided
9494   into 16x 4K pages, what is mapped into each page is controled by the IO at
9595   FE00-FE0F like so :-
9696
97   Location   Memory page    Initialised to
97   Location   Memory page    Initialised to
9898   $FE00      $0000-$0FFF      $00
9999   $FE01      $1000-$1FFF      $00   (used as ram test page, when sizing memory)
100100   $FE02      $2000-$2FFF      $00
r1461r1462
102102   $FE04      $4000-$4FFF      $00
103103   $FE05      $5000-$5FFF      $00
104104   $FE06      $6000-$6FFF      $1F   ($1F000)
105   $FE07      $7000-$7FFF      $00     
105   $FE07      $7000-$7FFF      $00
106106   $FE08      $8000-$8FFF      $00
107107   $FE09      $9000-$9FFF      $00
108108   $FE0A      $A000-$AFFF      $00
r1461r1462
112112   $FE0E      $E000-$EFFF      $FE
113113   $FE0F      $F000-$FFFF      $FF
114114
115   The value stored at each location maps it's page to a 4K page within a 1M address
116   space. Acording to the Beta product descriptions released by Dragon Data, the
117   machine could have up to 768K of RAM, if this where true then pages $00-$BF could
115   The value stored at each location maps it's page to a 4K page within a 1M address
116   space. Acording to the Beta product descriptions released by Dragon Data, the
117   machine could have up to 768K of RAM, if this where true then pages $00-$BF could
118118   potentially be RAM, and pages $C0-$FF would be ROM. The initialisation code maps in
119119   the memory as described above.
120120
121   At reset time the Paging would of course be disabled, as the boot rom needs to be
121   At reset time the Paging would of course be disabled, as the boot rom needs to be
122122   mapped in at $C000, the initalisation code would set up the mappings above and then
123123   enable the paging hardware.
124124
125   It appears to be more complicated than this, whilst the above is true, there appear to
125   It appears to be more complicated than this, whilst the above is true, there appear to
126126   be 16 sets of banking registers, the active set is controled by the bottom 4 bits of
127127   FCC0, bit 6 has something to do with enabling and disabling banking.
128   
128
129129   2005-11-28
130   
130
131131   The value $C0 is garanteed not to have any memory in it acording to the os9 headers,
132132   quite how the MMU deals with this is still unknown to me.
133   
133
134134   Bit 7 of $FCC0, sets maps in the system task which has fixed values for some pages,
135135   the presise nature of this is yet to be descovered.
136136
r1461r1462
143143   AM_RANGE(0x3000, 0x3FFF)    AM_READWRITE(MRA8_BANK4      ,MWA8_BANK4)
144144   AM_RANGE(0x4000, 0x4FFF)    AM_READWRITE(MRA8_BANK5      ,MWA8_BANK5)
145145   AM_RANGE(0x5000, 0x5FFF)    AM_READWRITE(MRA8_BANK6      ,MWA8_BANK6)
146   AM_RANGE(0x6000, 0x6FFF)    AM_READWRITE(MRA8_BANK7      ,MWA8_BANK7) AM_BASE(&videoram) AM_SIZE(&videoram_size)
146   AM_RANGE(0x6000, 0x6FFF)    AM_READWRITE(MRA8_BANK7      ,MWA8_BANK7) AM_BASE(&videoram) AM_SIZE(&videoram_size)
147147   AM_RANGE(0x7000, 0x7FFF)    AM_READWRITE(MRA8_BANK8      ,MWA8_BANK8)
148148   AM_RANGE(0x8000, 0x8FFF)    AM_READWRITE(MRA8_BANK9      ,MWA8_BANK9)
149149   AM_RANGE(0x9000, 0x9FFF)    AM_READWRITE(MRA8_BANK10   ,MWA8_BANK10)
r1461r1462
153153   AM_RANGE(0xD000, 0xDFFF)    AM_READWRITE(MRA8_BANK14   ,MWA8_BANK14)
154154   AM_RANGE(0xE000, 0xEFFF)    AM_READWRITE(MRA8_BANK15   ,MWA8_BANK15)
155155   AM_RANGE(0xF000, 0xFBFF)    AM_READWRITE(MRA8_BANK16   ,MWA8_BANK16)
156   AM_RANGE(0xfC00, 0xfC1F)   AM_READWRITE(MRA8_NOP      ,MWA8_NOP)   
156   AM_RANGE(0xfC00, 0xfC1F)   AM_READWRITE(MRA8_NOP      ,MWA8_NOP)
157157   AM_RANGE(0xFC20, 0xFC23)   AM_READWRITE(pia_0_r      ,pia_0_w)
158158   AM_RANGE(0xFC24, 0xFC27)   AM_READWRITE(pia_1_r      ,pia_1_w)
159   AM_RANGE(0xFC28, 0xfC7F)   AM_READWRITE(MRA8_NOP      ,MWA8_NOP)   
160   AM_RANGE(0xfc80, 0xfc81)   AM_READWRITE(dgnbeta_6845_r   ,dgnbeta_6845_w)   
159   AM_RANGE(0xFC28, 0xfC7F)   AM_READWRITE(MRA8_NOP      ,MWA8_NOP)
160   AM_RANGE(0xfc80, 0xfc81)   AM_READWRITE(dgnbeta_6845_r   ,dgnbeta_6845_w)
161161   AM_RANGE(0xfc82, 0xfC9F)   AM_READWRITE(MRA8_NOP      ,MWA8_NOP)
162162   AM_RANGE(0xFCA0, 0xFCA3)   AM_READWRITE(MRA8_NOP      ,colour_ram_w)      /* 4x4bit colour ram for graphics modes */
163163   AM_RANGE(0xFCC0, 0xFCC3)   AM_READWRITE(pia_2_r      ,pia_2_w)
r1461r1462
177177   /* Return shift if either shift key pressed */
178178   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
179179   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R-SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
180   
180
181181   /* Return FuNction key, if either ALT key pressed */
182   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-ALT") PORT_CODE(KEYCODE_LALT)
182   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-ALT") PORT_CODE(KEYCODE_LALT)
183183   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R-ALT") PORT_CODE(KEYCODE_RALT)
184184   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12)
185   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8  (") PORT_CODE(KEYCODE_8) PORT_CHAR('8')
185   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8  (") PORT_CODE(KEYCODE_8) PORT_CHAR('8')
186186
187187
188188   /* Set control on either CTRL key */
189189   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L-Ctrl") PORT_CODE(KEYCODE_LCONTROL)
190190   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R-Ctrl") PORT_CODE(KEYCODE_RCONTROL)
191   
191
192192   PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CapsLock") PORT_CODE(KEYCODE_CAPSLOCK)
193   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B)
193   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B)
194194
195195/*   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_HOME) PORT_CHAR(12)
196   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8  (") PORT_CODE(KEYCODE_8) PORT_CHAR('8')
197   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B)
196   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8  (") PORT_CODE(KEYCODE_8) PORT_CHAR('8')
197   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1B)
198198*/
199199
200200   PORT_START /* Key row 2 */
201   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) PORT_CHAR('b')
202   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) PORT_CHAR('j')
203   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) PORT_CHAR('i')
204   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9')
205   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) PORT_CHAR('u')
206   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) PORT_CHAR('h')
207   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7')
201   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("b") PORT_CODE(KEYCODE_B) PORT_CHAR('b')
202   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) PORT_CHAR('j')
203   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("i") PORT_CODE(KEYCODE_I) PORT_CHAR('i')
204   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9')
205   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u") PORT_CODE(KEYCODE_U) PORT_CHAR('u')
206   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("h") PORT_CODE(KEYCODE_H) PORT_CHAR('h')
207   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7')
208208
209209   PORT_START /* Key row 3 */
210   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) PORT_CHAR('n')
211   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) PORT_CHAR('k')
212   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) PORT_CHAR('o')
213   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0')
214   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y')
215   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) PORT_CHAR('g')
216   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6')
217   
210   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("n") PORT_CODE(KEYCODE_N) PORT_CHAR('n')
211   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("k") PORT_CODE(KEYCODE_K) PORT_CHAR('k')
212   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("o") PORT_CODE(KEYCODE_O) PORT_CHAR('o')
213   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0')
214   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y')
215   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("g") PORT_CODE(KEYCODE_G) PORT_CHAR('g')
216   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6')
217
218218   PORT_START /* Key row  4 */
219   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) PORT_CHAR('m')
220   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) PORT_CHAR('l')
221   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) PORT_CHAR('p')
222   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')
223   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) PORT_CHAR('t')
224   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) PORT_CHAR('f')
225   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5')
226   
219   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("m") PORT_CODE(KEYCODE_M) PORT_CHAR('m')
220   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("l") PORT_CODE(KEYCODE_L) PORT_CHAR('l')
221   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("p") PORT_CODE(KEYCODE_P) PORT_CHAR('p')
222   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')
223   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) PORT_CHAR('t')
224   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("f") PORT_CODE(KEYCODE_F) PORT_CHAR('f')
225   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5')
226
227227   PORT_START /* Key row  5 */
228   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
229   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';')
230   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@')
231   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_UP) PORT_CHAR('^')
232   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) PORT_CHAR('v')
233   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) PORT_CHAR('d')
234   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4')
235   
228   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
229   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';')
230   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('@')
231   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_UP) PORT_CHAR('^')
232   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("v") PORT_CODE(KEYCODE_V) PORT_CHAR('v')
233   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("d") PORT_CODE(KEYCODE_D) PORT_CHAR('d')
234   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4')
235
236236   PORT_START /* Key row  6 */
237   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.')
238   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')
239   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\')
240   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[')
241   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) PORT_CHAR('r')
242   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) PORT_CHAR('s')
243   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3')
244   
237   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.')
238   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')
239   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\')
240   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[')
241   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("r") PORT_CODE(KEYCODE_R) PORT_CHAR('r')
242   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("s") PORT_CODE(KEYCODE_S) PORT_CHAR('s')
243   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3')
244
245245   PORT_START /* Key row  7 */
246   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/')
247   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
248   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
249   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']')
250   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) PORT_CHAR('c')
251   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) PORT_CHAR('x')
252   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
253   
246   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/')
247   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
248   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
249   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']')
250   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("c") PORT_CODE(KEYCODE_C) PORT_CHAR('c')
251   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("x") PORT_CODE(KEYCODE_X) PORT_CHAR('x')
252   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
253
254254   PORT_START /* Key row  8 */
255   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ASTERISK") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*')
256   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7')
257   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4')
258   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1')
259   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) PORT_CHAR('e')
260   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z')
261   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2')
262   
255   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ASTERISK") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*')
256   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_7") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7')
257   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_4") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4')
258   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_1") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1')
259   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e") PORT_CODE(KEYCODE_E) PORT_CHAR('e')
260   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z')
261   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2')
262
263263   PORT_START /* Key row  9 */
264   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0')
265   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8')
266   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5')
267   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2')
268   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) PORT_CHAR('w')
269   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) PORT_CHAR('a')
270   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1')
271   
264   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_0") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0')
265   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_8") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8')
266   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_5") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5')
267   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_2") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2')
268   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("w") PORT_CODE(KEYCODE_W) PORT_CHAR('w')
269   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("a") PORT_CODE(KEYCODE_A) PORT_CHAR('a')
270   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1')
271
272272   PORT_START /* Key row  10 */
273   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_HASH") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('#')
274   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9')
275   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6')
276   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3')
277   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q')
278   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9)
279   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOT_PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.')
280     
273   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_HASH") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('#')
274   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_9") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9')
275   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_6") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6')
276   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PAD_3") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3')
277   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q')
278   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9)
279   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOT_PAD") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.')
280
281281   PORT_START
282282INPUT_PORTS_END
283283
r1461r1462
327327   /* basic machine hardware */
328328   MDRV_CPU_ADD_TAG("main", M6809E, DGNBETA_CPU_SPEED_HZ)        /* 2 Mhz */
329329   MDRV_CPU_PROGRAM_MAP(dgnbeta_map,0)
330   
330
331331   /* both cpus in the beta share the same address/data busses */
332332   MDRV_CPU_ADD_TAG("dma", M6809E, DGNBETA_CPU_SPEED_HZ)        /* 2 Mhz */
333333   MDRV_CPU_PROGRAM_MAP(dgnbeta_map,0)
334334
335335   MDRV_SCREEN_REFRESH_RATE(DGNBETA_FRAMES_PER_SECOND)
336336   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(100))
337   
337
338338   MDRV_MACHINE_START( dgnbeta )
339339
340340   /* video hardware */
341   
341
342342   MDRV_SCREEN_SIZE(700,550)
343343   MDRV_SCREEN_VISIBLE_AREA(0, 699, 0, 549)
344344   MDRV_PALETTE_LENGTH(sizeof (dgnbeta_palette) / sizeof (dgnbeta_palette[0]) / 3)
r1461r1462
351351
352352ROM_START(dgnbeta)
353353   ROM_REGION(0x4000,REGION_CPU1,0)
354    ROM_SYSTEM_BIOS( 0, "bootrom", "Dragon beta OS9 boot rom (1984)" )
354    ROM_SYSTEM_BIOS( 0, "bootrom", "Dragon beta OS9 boot rom (1984)" )
355355   ROMX_LOAD("beta_bt.rom"      ,0x0000   ,0x4000   ,CRC(4c54c1de) SHA1(141d9fcd2d187c305dff83fce2902a30072aed76), ROM_BIOS(1))
356    ROM_SYSTEM_BIOS( 1, "testrom", "Dragon beta test rom (1984?)" )
356    ROM_SYSTEM_BIOS( 1, "testrom", "Dragon beta test rom (1984?)" )
357357   ROMX_LOAD("beta_tst.rom"   ,0x2000   ,0x2000   ,CRC(01d79d00) SHA1(343e08cf7656b5e8970514868df37ea0af1e2362), ROM_BIOS(2))
358    ROM_SYSTEM_BIOS( 2, "cfiles", "cfiles rom" )
358    ROM_SYSTEM_BIOS( 2, "cfiles", "cfiles rom" )
359359   ROMX_LOAD("beta_cfi.rom"   ,0x2000   ,0x2000   ,CRC(d312e4c0) SHA1(5c00daac488eaf8d36d66de6ec6c746ab7b78ecf), ROM_BIOS(3))
360    ROM_SYSTEM_BIOS( 3, "dfiles", "dfiles rom" )
360    ROM_SYSTEM_BIOS( 3, "dfiles", "dfiles rom" )
361361   ROMX_LOAD("beta_dfi.rom"   ,0x2000   ,0x2000   ,CRC(c4ad7f64) SHA1(50aa92a1c383321485d5a1aa41dfe4f90b3beaed), ROM_BIOS(4))
362362
363363   ROM_REGION (0x2000, REGION_GFX1, 0)
364   ROM_LOAD("betachar.rom"   ,0x0000   ,0x2000   ,CRC(ca79d66c) SHA1(8e2090d471dd97a53785a7f44a49d3c8c85b41f2))   
364   ROM_LOAD("betachar.rom"   ,0x0000   ,0x2000   ,CRC(ca79d66c) SHA1(8e2090d471dd97a53785a7f44a49d3c8c85b41f2))
365365ROM_END
366366
367367/* Ram size can now be configured, since the machine was known as either the Dragon Beta or */
r1461r1462
371371/* in blocks of 128K up to this maximum.                                                    */
372372SYSTEM_CONFIG_START(dgnbeta)
373373   CONFIG_RAM(128 * 1024)
374   CONFIG_RAM_DEFAULT(RamSize * 1024)     
374   CONFIG_RAM_DEFAULT(RamSize * 1024)
375375   CONFIG_RAM(384 * 1024)
376376   CONFIG_RAM(512 * 1024)
377377   CONFIG_RAM(640 * 1024)
src/mess/drivers/jaguar.c
r1461r1462
198198    *
199199    *   Reading this register gives you the output of the selected columns
200200    *   of the pads.
201    *   The buttons pressed will appear as cleared bits.
202    *   See the description of the column addressing to map the bits
201    *   The buttons pressed will appear as cleared bits.
202    *   See the description of the column addressing to map the bits
203203    *   to the buttons.
204204    */
205205
r1461r1462
223223   /*
224224    *   16        12         8         4         0
225225    *   +-+-------^------+--+---------+---------+
226    *   |r|    unused    |mu|  col 1  |  col 0  | 
226    *   |r|    unused    |mu|  col 1  |  col 0  |
227227    *   +-+--------------+--+---------+---------+
228228    *    15                8   7...4     3...0
229229    *
230    *   col 0:   column control of joypad 0
230    *   col 0:   column control of joypad 0
231231    *
232    *      Here you select which column of the joypad to poll.
232    *      Here you select which column of the joypad to poll.
233233    *      The columns are:
234234    *
235    *                Joystick       Joybut
236    *      col_bit|11 10  9  8     1    0 
235    *                Joystick       Joybut
236    *      col_bit|11 10  9  8     1    0
237237    *      -------+--+--+--+--    ---+------
238238    *         0   | R  L  D  U     A  PAUSE       (RLDU = Joypad directions)
239    *         1   | *  7  4  1     B       
240    *         2   | 2  5  8  0     C       
239    *         1   | *  7  4  1     B
240    *         2   | 2  5  8  0     C
241241    *         3   | 3  6  9  #   OPTION
242242    *
243243    *      You select a column my clearing the appropriate bit and setting
244    *      all the other "column" bits.
244    *      all the other "column" bits.
245245    *
246246    *
247247    *   col1:    column control of joypad 1
248248    *
249249    *      This is pretty much the same as for joypad EXCEPT that the
250250    *      column addressing is reversed (strange!!)
251    *           
252    *                Joystick      Joybut
251    *
252    *                Joystick      Joybut
253253    *      col_bit|15 14 13 12     3    2
254254    *      -------+--+--+--+--    ---+------
255255    *         4   | 3  6  9  #   OPTION
r1461r1462
261261    *
262262    *      You can turn off the sound by clearing this bit.
263263    *
264    *   read enable (r): 
264    *   read enable (r):
265265    *
266266    *      Set this bit to read from the joysticks, clear it to write
267267    *      to them.
src/mess/drivers/apple2gs.c
r1461r1462
33   drivers/apple2gs.c
44   Apple IIgs
55   Driver by Nathan Woods and R. Belmont
6   
6
77    TODO:
88    - Fix spurious interrupt problem
99    - Fix 5.25" disks
r1461r1462
2727                |                                    |
2828                |                                    |
2929                |                                    |
30                |                                    |   0x1c0 (first line of Vblank, c019 and heartbeat trigger here, only true VBL if in A2 classic modes)
30                |                                    |   0x1c0 (first line of Vblank, c019 and heartbeat trigger here, only true VBL if in A2 classic modes)
3131                |                                    |
3232                 ____________________________________    0x1c8 (actual start of vblank in IIgs modes)
33   
33
3434                           0x1ff (end of frame, in vblank)
35   
35
3636    There are 64 HCounts total, and 704 pixels total, so HCounts do not map to the pixel clock.
3737    VCounts do map directly to scanlines however, and count 262 of them.
3838
r1461r1462
124124{
125125   extern PALETTE_INIT( apple2 );
126126   int i;
127   
127
128128   palette_init_apple2(machine, colortable, color_prom);
129129
130130   for (i = 0; i < 16; i++)
131131   {
132      palette_set_color_rgb(machine, i,
132      palette_set_color_rgb(machine, i,
133133         apple2gs_palette[(3*i)]*17,
134134         apple2gs_palette[(3*i)+1]*17,
135135         apple2gs_palette[(3*i)+2]*17);
r1461r1462
141141   return 0x80;
142142}
143143
144static const struct ES5503interface es5503_interface =
144static const struct ES5503interface es5503_interface =
145145{
146146   apple2gs_doc_irq,
147147   apple2gs_adc_read,
src/mess/drivers/hp48.c
r1461r1462
99
1010#include "includes/hp48.h"
1111
12/* hp28s
12/* hp28s
1313 0-0x3ffff rom
1414 0xc0000- 0xcffff ram also mapped at 0xd0000-0xdffff */
1515
r1461r1462
112112   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+/-") PORT_CODE(KEYCODE_MINUS)
113113   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EEX") PORT_CODE(KEYCODE_LEFT)
114114   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE)
115   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<==") PORT_CODE(KEYCODE_ENTER_PAD)   
115   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<==") PORT_CODE(KEYCODE_ENTER_PAD)
116116   PORT_START
117117   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("alp") PORT_CODE(KEYCODE_LALT)
118118   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SIN") PORT_CODE(KEYCODE_J)
r1461r1462
164164   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, hp48_charlayout, 0, 8 )
165165GFXDECODE_END
166166
167static const SATURN_CONFIG config={
168   hp48_out, hp48_in,
167static const SATURN_CONFIG config={
168   hp48_out, hp48_in,
169169   hp48_mem_reset, hp48_mem_config, hp48_mem_unconfig, hp48_mem_id,
170170   hp48_crc
171171};
src/mess/drivers/3do.c
r1461r1462
126126static MACHINE_RESET( 3do )
127127{
128128   memory_set_bankptr(2,memory_region(REGION_USER1));
129   
129
130130   /* configure overlay */
131131   memory_configure_bank(1, 0, 1, dram, 0);
132132   memory_configure_bank(1, 1, 1, memory_region(REGION_USER1), 0);
133   
133
134134   /* start with overlay enabled */
135135   memory_set_bank(1, 1);
136136
src/mess/drivers/dai.c
r1461r1462
3434      fc00-fcff 8253 programmable interval timer
3535      fd00-fdff discrete devices
3636      fe00-feff 8255 PIO (DCE bus)
37      ff00-ffff timer + 5501 interrupt controller
37      ff00-ffff timer + 5501 interrupt controller
3838
3939Interrupts:
4040-----------
src/mess/drivers/mac.c
r1461r1462
186186   PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("`") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
187187   PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('\010')
188188   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED)   /* keyboard Enter : */
189   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED)   /* escape: */   
189   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED)   /* escape: */
190190   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNUSED)   /* ??? */
191191   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Command") PORT_CODE(KEYCODE_LCONTROL)
192192   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
src/mess/drivers/atari.c
r1461r1462
2626    C000-CFFF ROM     unused or monitor ROM
2727
2828    ********* GTIA    ********************************
29   
29
3030   D000      m0pf    missile 0 playfield collisions
3131    D001      m1pf    missile 1 playfield collisions
3232    D002      m2pf    missile 2 playfield collisions
src/mess/drivers/sord.c
r1461r1462
11/******************************************************************************
22
33   drivers/sorc.c
4   
4
55   Sord m5   system driver
66
77   Thankyou to Roman Stec and Jan P. Naidr for the documentation and much
r1461r1462
8181
8282   cpu_yield();
8383
84   data = (obfa<<3)|(ibfa<<2)|2;     
84   data = (obfa<<3)|(ibfa<<2)|2;
8585#ifdef SORD_DEBUG
8686   logerror("fd5 0x030: %02x %04x\n",data, activecpu_get_pc());
8787#endif
r1461r1462
9696#ifdef SORD_DEBUG
9797   logerror("fd5 0x010 r: %02x %04x\n",fd5_databus,activecpu_get_pc());
9898#endif
99   
99
100100   ppi8255_set_portC(0, 0x50);
101101   ppi8255_set_portC(0, 0x10);
102102   ppi8255_set_portC(0, 0x50);
r1461r1462
123123static WRITE8_HANDLER(fd5_drive_control_w)
124124{
125125   int state;
126   
126
127127   if (data==0)
128128      state = 0;
129129   else
r1461r1462
132132#ifdef SORD_DEBUG
133133   logerror("fd5 drive state w: %02x\n",state);
134134#endif
135   
135
136136   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), state);
137137   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), state);
138138   floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1,1);
r1461r1462
159159
160160static ADDRESS_MAP_START( writeport_sord_fd5 , ADDRESS_SPACE_IO, 8)
161161   AM_RANGE( 0x001, 0x001) AM_WRITE( nec765_data_w)
162   AM_RANGE( 0x010, 0x010) AM_WRITE( fd5_data_w)   
162   AM_RANGE( 0x010, 0x010) AM_WRITE( fd5_data_w)
163163   AM_RANGE( 0x020, 0x020) AM_WRITE( fd5_communication_w)
164164   AM_RANGE( 0x040, 0x040) AM_WRITE( fd5_drive_control_w)
165165   AM_RANGE( 0x050, 0x050) AM_WRITE( fd5_tc_w)
r1461r1462
210210
211211static  READ8_HANDLER(sord_ppi_porta_r)
212212{
213   cpu_yield();
213   cpu_yield();
214214
215215   return fd5_databus;
216216}
r1461r1462
261261
262262static WRITE8_HANDLER(sord_ppi_porta_w)
263263{
264   cpu_yield();
264   cpu_yield();
265265
266266   fd5_databus = data;
267267}
r1461r1462
509509   PORT_START
510510   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL)
511511    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("FUNC") PORT_CODE(KEYCODE_LALT)
512    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT)
513    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT)
514   PORT_BIT  (0x10, 0x00, IPT_UNUSED)
515   PORT_BIT  (0x20, 0x00, IPT_UNUSED)
512    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LSHIFT") PORT_CODE(KEYCODE_LSHIFT)
513    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_RSHIFT)
514   PORT_BIT  (0x10, 0x00, IPT_UNUSED)
515   PORT_BIT  (0x20, 0x00, IPT_UNUSED)
516516   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE)
517517    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER)
518518   /* line 1 */
519519   PORT_START
520   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
521    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
522    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
523    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
524    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
525    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
526    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
527    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
520   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
521    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
522    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
523    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
524    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
525    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
526    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
527    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
528528   /* line 2 */
529529   PORT_START
530   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
531    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
532    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
533    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
534    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
535    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
536    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
537    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
530   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
531    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
532    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
533    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
534    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
535    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
536    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
537    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
538538   /* line 3 */
539539   PORT_START
540   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
541    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
542    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
543    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
544    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
545    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
546    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
547    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
540   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
541    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
542    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
543    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
544    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
545    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
546    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
547    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
548548   /* line 4 */
549549   PORT_START
550   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
551    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
552    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
553    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
554    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
555    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
556    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
557    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
550   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
551    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
552    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
553    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
554    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
555    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
556    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
557    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
558558   /* line 5 */
559559   PORT_START
560   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
561    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
562    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
563    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS)
564    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
565    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
566    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS_PAD)
567    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH)
560   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
561    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
562    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
563    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS)
564    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
565    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
566    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS_PAD)
567    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH)
568568   /* line 6 */
569569   PORT_START
570   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
571    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
572    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE)
573    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
574    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
575    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_PLUS_PAD)
576    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON)
577    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
570   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
571    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
572    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE)
573    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
574    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
575    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_PLUS_PAD)
576    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON)
577    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
578578   /* line 7 */
579579   PORT_START
580   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 RIGHT") PORT_CODE(JOYCODE_X_RIGHT_SWITCH)
581    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 UP") PORT_CODE(JOYCODE_Y_UP_SWITCH)
582    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH)
583    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 DOWN") PORT_CODE(JOYCODE_Y_DOWN_SWITCH)
584    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 RIGHT") PORT_CODE(JOYCODE_X_RIGHT_SWITCH)
585    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 UP") PORT_CODE(JOYCODE_Y_UP_SWITCH)
586    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH)
587    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 DOWN") PORT_CODE(JOYCODE_Y_DOWN_SWITCH)
580   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 RIGHT") PORT_CODE(JOYCODE_X_RIGHT_SWITCH)
581    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 UP") PORT_CODE(JOYCODE_Y_UP_SWITCH)
582    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH)
583    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 1 DOWN") PORT_CODE(JOYCODE_Y_DOWN_SWITCH)
584    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 RIGHT") PORT_CODE(JOYCODE_X_RIGHT_SWITCH)
585    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 UP") PORT_CODE(JOYCODE_Y_UP_SWITCH)
586    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 LEFT") PORT_CODE(JOYCODE_X_LEFT_SWITCH)
587    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("JOY 2 DOWN") PORT_CODE(JOYCODE_Y_DOWN_SWITCH)
588588   /* line 8 */
589589   PORT_START
590   PORT_BIT (0x0ff, 0x000, IPT_UNUSED)
590   PORT_BIT (0x0ff, 0x000, IPT_UNUSED)
591591   /* line 9 */
592592   PORT_START
593   PORT_BIT (0x0ff, 0x000, IPT_UNUSED)
593   PORT_BIT (0x0ff, 0x000, IPT_UNUSED)
594594   /* line 10 */
595595   PORT_START
596   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_2_PAD)
597    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_3_PAD)
598    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_4_PAD)
599    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_5_PAD)
600    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_6_PAD)
601    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_7_PAD)
602    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_8_PAD)
603    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_9_PAD)
596   PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_2_PAD)
597    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_3_PAD)
598    PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_4_PAD)
599    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_5_PAD)
600    PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_6_PAD)
601    PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_7_PAD)
602    PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_8_PAD)
603    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RSHIFT") PORT_CODE(KEYCODE_9_PAD)
604604/*   PORT_BIT (0x0ff, 0x000, IPT_UNUSED) */
605605   /* line 11 */
606606   PORT_START
r1461r1462
618618   PORT_START
619619   PORT_BIT (0x0ff, 0x000, IPT_UNUSED)
620620   PORT_START
621   PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC)
621   PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC)
622622
623623INPUT_PORTS_END
624624
src/mess/drivers/mbee.c
r1461r1462
7676
7777
7878static ADDRESS_MAP_START(mbee_ports, ADDRESS_SPACE_IO, 8)
79   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
79   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
8080   AM_RANGE(0x00, 0x03) AM_READWRITE(mbee_pio_r, mbee_pio_w)
8181   AM_RANGE(0x08, 0x08) AM_READWRITE(mbee_pcg_color_latch_r, mbee_pcg_color_latch_w)
8282   AM_RANGE(0x0a, 0x0a) AM_READWRITE(mbee_color_bank_r, mbee_color_bank_w)
src/mess/drivers/coco.c
r1461r1462
120120   AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION(REGION_CPU1, 0x3ff0)
121121ADDRESS_MAP_END
122122
123/*
123/*
124124   Dragon 64 with compusense Plus addon, this provided an extra 64K of memory
125125   and an 80x25 column text display, provided by a motorola 6845.
126   
127   Currently only the memory is emulated.   
126
127   Currently only the memory is emulated.
128128*/
129129
130130static ADDRESS_MAP_START( d64_plus_map, ADDRESS_SPACE_PROGRAM, 8 )
r1461r1462
156156   AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION(REGION_CPU1,0x3ff0)
157157ADDRESS_MAP_END
158158
159/*
160   The Dragon Alpha was a prototype in development when Dragon Data went bust,
161   it is basically an enhanced Dragon 64, with built in modem, disk system, and
159/*
160   The Dragon Alpha was a prototype in development when Dragon Data went bust,
161   it is basically an enhanced Dragon 64, with built in modem, disk system, and
162162   graphical boot rom.
163163
164164   It has the following extra hardware :-
165165   A third 6821 PIA mapped between FF24 and FF27
166166      An AY-8912, connected to the PIA.
167     
167
168168   Port A of the PIA is connected as follows :-
169   
169
170170      b0   BDIR of AY8912
171171      b1   BC1 of AY8912
172172      b2    Rom select, High= boot rom, low=BASIC rom
173173      b3..7 not used.
174     
174
175175   Port B
176176      b0..7 connected to D0..7 of the AY8912.
177     
177
178178   CB1 DRQ of WD2797.
179179
180180   /irqa
181181   /irqb   both connected to 6809 FIRQ.
182     
183   
182
183
184184   The analog outputs of the AY-8912 are connected to the standard sound multiplexer.
185185   The AY8912 output port is used as follows :-
186   
186
187187      b0..b3   /DS0../DS3 for the drive interface (through an inverter first).
188188      b4      /motor for the drive interface (through an inverter first).
189189      b5..b7   not used as far as I can tell.
190   
190
191191   A 6850 for the modem.
192   
192
193193   A WD2797, used as an internal disk interface, this is however connected in a slightly strange
194194   way that I am yet to completely determine.
195195   19/10/2004, WD2797 is mapped between FF2C and FF2F, however the order of the registers is
196   reversed so the command Register is at the highest address instead of the lowest. The Data
196   reversed so the command Register is at the highest address instead of the lowest. The Data
197197   request pin is connected to CB1(pin 18) of PIA2, to cause an firq, the INTRQ, is connected via
198198   an inverter to the 6809's NMI.
199   
199
200200   All these are as yet un-emulated.
201201
202202   29-Oct-2004, AY-8912 is now emulated.
203203   30-Oct-2004, Internal disk interface now emulated, Normal DragonDos rom replaced with a re-assembled
204            version, that talks to the alpha hardware (verified on a clone of the real machine).
204            version, that talks to the alpha hardware (verified on a clone of the real machine).
205205*/
206206
207207
r1461r1462
222222   AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK(14)
223223   AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK(15)
224224   AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK(16)
225   AM_RANGE(0xff00, 0xff03) AM_READWRITE(pia_0_r,         pia_0_w)   
226   AM_RANGE(0xff04, 0xff07) AM_READWRITE(acia_6551_r,      acia_6551_w)   
225   AM_RANGE(0xff00, 0xff03) AM_READWRITE(pia_0_r,         pia_0_w)
226   AM_RANGE(0xff04, 0xff07) AM_READWRITE(acia_6551_r,      acia_6551_w)
227227   AM_RANGE(0xff20, 0xff23) AM_READWRITE(pia_1_r,         coco_pia_1_w)
228228   AM_RANGE(0xff24, 0xff27) AM_READWRITE(pia_2_r,         pia_2_w)    /* Third PIA on Dragon Alpha */
229229   AM_RANGE(0xff2c, 0xff2f) AM_READWRITE(wd2797_r,         wd2797_w)   /* Alpha onboard disk interface */
r1461r1462
441441   PORT_INCLUDE( coco_joystick )
442442   PORT_INCLUDE( coco_joystick_buttons )
443443   PORT_INCLUDE( m6847_artifacting )
444   
444
445445   PORT_START /* 13 */
446446   PORT_CONFNAME( 0x03, 0x00, "Real Time Clock" )
447447   PORT_CONFSETTING(    0x00, "Disto" )
448448   PORT_CONFSETTING(    0x01, "Cloud-9" )
449   
449
450450   PORT_INCLUDE( cart_autostart )
451451INPUT_PORTS_END
452452
r1461r1462
536536   PORT_INCLUDE( coco_joystick )
537537   PORT_INCLUDE( coco3_joystick_buttons )
538538   PORT_INCLUDE( m6847_artifacting )
539   
539
540540   PORT_START_TAG("joystick_mode")
541541   PORT_CONFNAME( 0x70, 0x00, "Joystick Type" )
542542   PORT_CONFSETTING(   0x00, DEF_STR( Normal ) )
r1461r1462
10711071
10721072/*************************************
10731073*
1074*   Dragon only devices
1074*   Dragon only devices
10751075*
10761076**************************************/
10771077
src/mess/drivers/pocketc.c
r1461r1462
105105
106106static ADDRESS_MAP_START( pc1403_mem , ADDRESS_SPACE_PROGRAM, 8)
107107   AM_RANGE( 0x0000, 0x1fff) AM_ROM
108   AM_RANGE( 0x3000, 0x30bf) AM_READWRITE( pc1403_lcd_read, pc1403_lcd_write ) 
109   AM_RANGE( 0x3800, 0x3fff) AM_READWRITE( pc1403_asic_read, pc1403_asic_write )   
108   AM_RANGE( 0x3000, 0x30bf) AM_READWRITE( pc1403_lcd_read, pc1403_lcd_write )
109   AM_RANGE( 0x3800, 0x3fff) AM_READWRITE( pc1403_asic_read, pc1403_asic_write )
110110   AM_RANGE( 0x4000, 0x7fff) AM_ROMBANK(1)
111111   AM_RANGE( 0xe000, 0xffff) AM_RAM
112112ADDRESS_MAP_END
r1461r1462
698698*/
699699
700700/* cpu lh5801
701   pc1500
702   clone tandy pc2 look into drivers/pc1500.c
701   pc1500
702   clone tandy pc2 look into drivers/pc1500.c
703703   pc1600
704704*/
705705
src/mess/drivers/gb.c
r1461r1462
7575
7676
7777For lines 1 - 143 when stat changes to 2 the line counter is incremented.
78
78
7979Line 153 is little odd timing wise. The line counter stays 153 for ~4 clock cycles
8080and is then rolls over to 0.
8181
r1461r1462
533533
534534static INPUT_PORTS_START( gameboy )
535535   PORT_START   /* IN0 */
536   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left")
537   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right")
538   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up")
539   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down")
540   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button A")
541   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button B")
542   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start")
543   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select")
536   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("Left")
537   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("Right")
538   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("Up")
539   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("Down")
540   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Button A")
541   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Button B")
542   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start")
543   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select")
544544INPUT_PORTS_END
545545
546546static const struct CustomSound_interface gameboy_sound_interface =
src/mess/drivers/z88.c
r1461r1462
4848         return;
4949      }
5050   }
51   
51
5252   logerror("clear int\n");
5353   cpunum_set_input_line(0,0,CLEAR_LINE);
5454}
r1461r1462
100100         blink.sta |= STA_KEY;
101101
102102         cpu_trigger(Z88_SNOOZE_TRIGGER);
103     
103
104104         z88_interrupt_refresh();
105105      }
106106   }
r1461r1462
136136            /* set minutes int has occured */
137137            blink.tsta |=RTC_MIN_INT;
138138            refresh_ints = 1;
139           
139
140140            blink.tim[1]=0;
141141
142142            blink.tim[2]++;
r1461r1462
199199the lower 8k is replaced with the rom. Bank 0 has been split
200200into 2 8k chunks, and all other banks into 16k chunks.
201201I wanted to handle all banks in the code below, and this
202explains why the extra checks are done
202explains why the extra checks are done
203203
204204
205205   bank 0      0x0000-0x3FFF
r1461r1462
223223      block = blink.mem[bank]-0x020;
224224
225225      if (block >= 128)
226      {   
226      {
227227         read_addr = NULL;
228228         write_addr = NULL;
229229      }
r1461r1462
304304
305305    switch (reg_index)
306306   {
307   
307
308308      /* 1c000 */
309   
309
310310   case 0x00:
311311      {
312312/**/            blink.pb[0] = addr_written;
r1461r1462
602602
603603
604604static ADDRESS_MAP_START( z88_io, ADDRESS_SPACE_IO, 8)
605   ADDRESS_MAP_FLAGS( AMEF_ABITS(16) )
605   ADDRESS_MAP_FLAGS( AMEF_ABITS(16) )
606606   AM_RANGE(0x0000, 0x0ffff) AM_READWRITE(z88_port_r, z88_port_w)
607607ADDRESS_MAP_END
608608
r1461r1462
693693   PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MENU") PORT_CODE(KEYCODE_3_PAD)
694694   PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
695695   PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)
696   PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_4_PAD)
696   PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_4_PAD)
697697   /* 7 */
698698   PORT_START
699699   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT)
src/mess/drivers/pcw16.c
r1461r1462
13321332}
13331333
13341334
1335static const PC_LPT_CONFIG lpt_config =
1335static const PC_LPT_CONFIG lpt_config =
13361336{
13371337   1,
13381338   LPT_UNIDIRECTIONAL, // more one of these epp/ecp aware ports
src/mess/drivers/glasgow.c
r1461r1462
233233  lcd_flag=data>>8;
234234  //beep_set_state(0,lcd_flag&1?1:0);
235235  if (lcd_flag == 0) key_selector=1;
236 // The key function in the rom expects after writing to
236 // The key function in the rom expects after writing to
237237 // the  a value from  the second key row;
238238  if (lcd_flag!=0) led7=255;else led7=0;
239239  logerror("LCD Flag 16  = %x \n  ",data);
r1461r1462
270270 UINT8 board;
271271 board=data>>8;
272272 board_value=board;
273 if (board==0xff) key_selector=0;   
274 // The key function in the rom expects after writing to
273 if (board==0xff) key_selector=0;
274 // The key function in the rom expects after writing to
275275 // the chess board a value from  the first key row;
276276  logerror("Write Board   = %x \n  ",data>>8);
277277}
r1461r1462
806806  PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H8")  PORT_CODE(KEYCODE_H )
807807  PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G7")  PORT_CODE(KEYCODE_7 )
808808  PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H8")  PORT_CODE(KEYCODE_8 )
809 
809
810810  PORT_START
811811   PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X)  PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(0, 65535)    PORT_PLAYER(1)
812812
src/mess/drivers/msx.c
r1461r1462
748748   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
749749   MDRV_SOUND_ADD(AY8910, 1789773)
750750   MDRV_SOUND_CONFIG(ay8910_interface)
751   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)   
751   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
752752   MDRV_SOUND_ADD(K051649, 1789773)
753   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)   
753   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
754754   MDRV_SOUND_ADD(YM2413, 3579545)
755   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)   
755   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
756756MACHINE_DRIVER_END
757757
758758
r1461r1462
800800   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
801801   MDRV_SOUND_ADD(AY8910, 1789773)
802802   MDRV_SOUND_CONFIG(ay8910_interface)
803   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)   
803   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
804804   MDRV_SOUND_ADD(K051649, 1789773)
805   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)   
805   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
806806   MDRV_SOUND_ADD(YM2413, 3579545)
807   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)   
807   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
808808
809809   MDRV_NVRAM_HANDLER( msx2 )
810810MACHINE_DRIVER_END
r1461r1462
830830MSX_LAYOUT_INIT (msx)
831831   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
832832   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
833   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
833   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
834834   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
835835MSX_LAYOUT_END
836836
r1461r1462
845845   MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000)
846846   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
847847   MSX_LAYOUT_SLOT (2, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
848   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
848   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
849849MSX_LAYOUT_END
850850
851851ROM_START (hb75p)
r1461r1462
859859   MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000)
860860   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
861861   MSX_LAYOUT_SLOT (2, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
862   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
862   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
863863MSX_LAYOUT_END
864864
865865ROM_START (hb501p)
r1461r1462
870870MSX_LAYOUT_INIT (hb501p)
871871   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
872872   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
873   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
873   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
874874   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
875875MSX_LAYOUT_END
876876
r1461r1462
884884   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
885885   MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000)
886886   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
887   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
887   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
888888   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
889889MSX_LAYOUT_END
890890
r1461r1462
898898MSX_LAYOUT_INIT (svi738)
899899   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
900900   MSX_LAYOUT_SLOT (1, 0, 0, 4, RAM, 0x10000, 0x0000)  /* 64KB RAM */
901   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
901   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
902902   MSX_LAYOUT_SLOT (3, 0, 1, 1, ROM, 0x4000, 0xc000)
903903   MSX_LAYOUT_SLOT (3, 1, 1, 2, DISK_ROM2, 0x4000, 0x8000)
904904MSX_LAYOUT_END
r1461r1462
936936   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
937937   MSX_LAYOUT_SLOT (0, 0, 2, 2, RAM, 0x8000, 0x8000)   /* 32KB RAM */
938938   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
939   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
939   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
940940MSX_LAYOUT_END
941941
942942ROM_START (cf3000)
r1461r1462
948948   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
949949   MSX_LAYOUT_SLOT (1, 0, 0, 4, RAM, 0x10000, 0x0000)  /* 64KB RAM */
950950   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
951   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
951   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
952952MSX_LAYOUT_END
953953
954954ROM_START (cf3300)
r1461r1462
960960MSX_LAYOUT_INIT (cf3300)
961961   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
962962   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
963   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
963   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
964964   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)  /* 64KB RAM */
965965     MSX_LAYOUT_SLOT (3, 1, 1, 2, DISK_ROM2, 0x4000, 0x8000)
966966MSX_LAYOUT_END
r1461r1462
976976MSX_LAYOUT_INIT (fs4000)
977977   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
978978   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
979   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
980   MSX_LAYOUT_SLOT (3, 0, 0, 2, ROM, 0x8000, 0x8000)
981   MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x10000)
979   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
980   MSX_LAYOUT_SLOT (3, 0, 0, 2, ROM, 0x8000, 0x8000)
981   MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x10000)
982982   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
983983   MSX_LAYOUT_KANJI (0x18000)
984984MSX_LAYOUT_END
r1461r1462
991991MSX_LAYOUT_INIT (fs1300)
992992   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
993993   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
994   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
994   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
995995   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)  /* 64KB RAM */
996996MSX_LAYOUT_END
997997
r1461r1462
10051005   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
10061006   MSX_LAYOUT_SLOT (0, 0, 2, 2, ROM, 0x8000, 0x8000)
10071007   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1008   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1008   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
10091009   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
10101010MSX_LAYOUT_END
10111011
r1461r1462
10201020   MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000)
10211021   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
10221022   MSX_LAYOUT_SLOT (2, 0, 3, 1, RAM, 0x4000, 0xC000)   /* 16KB RAM */
1023   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1023   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
10241024MSX_LAYOUT_END
10251025
10261026ROM_START (dpc180)
r1461r1462
10341034   MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000)
10351035   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
10361036   MSX_LAYOUT_SLOT (2, 0, 2, 2, RAM, 0x8000, 0x8000)   /* 32KB RAM */
1037   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1037   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
10381038MSX_LAYOUT_END
10391039
10401040
r1461r1462
10491049   MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000)
10501050   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
10511051   MSX_LAYOUT_SLOT (2, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
1052   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1052   MSX_LAYOUT_SLOT (3, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
10531053MSX_LAYOUT_END
10541054
10551055ROM_START (hotbit11)
r1461r1462
10601060MSX_LAYOUT_INIT (hotbit11)
10611061   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
10621062   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1063   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1063   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
10641064   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
10651065MSX_LAYOUT_END
10661066
r1461r1462
10721072MSX_LAYOUT_INIT (hotbit12)
10731073   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
10741074   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1075   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1075   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
10761076   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
10771077MSX_LAYOUT_END
10781078
r1461r1462
10841084MSX_LAYOUT_INIT (expert10)
10851085   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
10861086   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1087   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1087   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
10881088   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
10891089MSX_LAYOUT_END
10901090
r1461r1462
10981098   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
10991099   MSX_LAYOUT_SLOT (0, 0, 2, 1, ROM, 0x4000, 0x8000)
11001100   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1101   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1101   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
11021102   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
11031103MSX_LAYOUT_END
11041104
r1461r1462
11111111MSX_LAYOUT_INIT (expertdp)
11121112   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
11131113   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1114   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1114   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
11151115   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)  /* 64KB RAM */
11161116     MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM2, 0x4000, 0x8000)
11171117MSX_LAYOUT_END
r1461r1462
11271127MSX_LAYOUT_INIT (msx2)
11281128   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
11291129   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1130   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1130   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
11311131   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
1132   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
1132   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
11331133   MSX_LAYOUT_SLOT (3, 3, 0, 4, RAM_MM, 0x20000, 0x0000)   /* 128KB Mapper RAM */
11341134   MSX_LAYOUT_RAMIO_SET_BITS (0xf8)
11351135MSX_LAYOUT_END
r1461r1462
11451145MSX_LAYOUT_INIT (nms8220)
11461146   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
11471147   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1148   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1148   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
11491149   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
11501150   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x10000, 0x0000)   /* 64KB Mapper RAM */
1151   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0xc000)
1151   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0xc000)
11521152   MSX_LAYOUT_RAMIO_SET_BITS (0xf8)
11531153MSX_LAYOUT_END
11541154
r1461r1462
11631163MSX_LAYOUT_INIT (nms8220a)
11641164   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
11651165   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1166   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1166   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
11671167   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
11681168   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x10000, 0x0000)   /* 64KB Mapper RAM */
1169   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0xc000)
1169   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0xc000)
11701170   MSX_LAYOUT_RAMIO_SET_BITS (0xf8)
11711171MSX_LAYOUT_END
11721172
r1461r1462
11811181MSX_LAYOUT_INIT (vg8235)
11821182   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
11831183   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1184   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1184   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
11851185   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
11861186   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000)   /* 128KB Mapper RAM */
1187   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
1187   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
11881188   MSX_LAYOUT_RAMIO_SET_BITS (0xf8)
11891189MSX_LAYOUT_END
11901190
r1461r1462
11991199MSX_LAYOUT_INIT (nms8245)
12001200   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
12011201   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1202   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1202   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
12031203   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
12041204   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000)   /* 128KB Mapper RAM */
1205   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
1205   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
12061206   MSX_LAYOUT_RAMIO_SET_BITS (0xf8)
12071207MSX_LAYOUT_END
12081208
r1461r1462
12171217MSX_LAYOUT_INIT (nms8250)
12181218   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
12191219   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1220   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1220   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
12211221   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
12221222   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000)   /* 128KB Mapper RAM */
1223   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
1223   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
12241224   MSX_LAYOUT_RAMIO_SET_BITS (0xf8)
12251225MSX_LAYOUT_END
12261226
r1461r1462
12351235MSX_LAYOUT_INIT (nms8255)
12361236   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
12371237   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1238   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1238   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
12391239   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
12401240   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000)   /* 128KB Mapper RAM */
1241   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
1241   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
12421242   MSX_LAYOUT_RAMIO_SET_BITS (0xf8)
12431243MSX_LAYOUT_END
12441244
r1461r1462
12531253MSX_LAYOUT_INIT (nms8280)
12541254   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
12551255   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1256   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1256   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
12571257   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
12581258   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000)   /* 128KB Mapper RAM */
1259   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
1259   MSX_LAYOUT_SLOT (3, 3, 1, 2, DISK_ROM, 0x4000, 0xc000)
12601260   MSX_LAYOUT_RAMIO_SET_BITS (0xf8)
12611261MSX_LAYOUT_END
12621262
r1461r1462
15321532   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
15331533   MSX_LAYOUT_SLOT (0, 0, 2, 2, RAM, 0x8000, 0x8000)   /* 32KB RAM */
15341534   MSX_LAYOUT_SLOT (0, 1, 0, 1, ROM, 0x4000, 0x8000)
1535   MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000)
1535   MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000)
15361536   MSX_LAYOUT_SLOT (0, 2, 0, 2, RAM, 0x8000, 0x0000)   /* 32KB RAM */
15371537   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
15381538   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
r1461r1462
15521552MSX_LAYOUT_INIT (hbf900)
15531553   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
15541554   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1555   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1555   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
15561556   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
1557   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
1557   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
15581558   MSX_LAYOUT_SLOT (3, 1, 0, 4, RAM_MM, 0x40000, 0x0000)   /* 256KB Mapper RAM */
1559   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x10000)
1559   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x10000)
15601560   MSX_LAYOUT_KANJI (0x24000)
15611561   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
15621562MSX_LAYOUT_END
r1461r1462
15741574MSX_LAYOUT_INIT (hbf900a)
15751575   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
15761576   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1577   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1577   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
15781578   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
1579   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
1579   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
15801580   MSX_LAYOUT_SLOT (3, 1, 0, 4, RAM_MM, 0x40000, 0x0000)   /* 256KB Mapper RAM */
1581   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x10000)
1581   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x10000)
15821582   MSX_LAYOUT_KANJI (0x24000)
15831583   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
15841584MSX_LAYOUT_END
r1461r1462
17511751MSX_LAYOUT_INIT (hbf9p)
17521752   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
17531753   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1754   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1754   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
17551755   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
17561756   MSX_LAYOUT_SLOT (3, 0, 1, 1, ROM, 0x4000, 0xc000)
1757   MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000)
1757   MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000)
17581758   MSX_LAYOUT_SLOT (3, 2, 0, 4, RAM_MM, 0x20000, 0x0000)   /* 128KB Mapper RAM */
17591759   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
17601760MSX_LAYOUT_END
r1461r1462
17711771   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
17721772   MSX_LAYOUT_SLOT (0, 0, 2, 2, RAM, 0x8000, 0x8000)   /* 32KB RAM */
17731773   MSX_LAYOUT_SLOT (0, 1, 0, 1, ROM, 0x4000, 0x8000)
1774   MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000)
1774   MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000)
17751775   MSX_LAYOUT_SLOT (0, 2, 0, 2, RAM, 0x8000, 0x0000)   /* 32KB RAM */
17761776   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1777   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1777   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
17781778   MSX_LAYOUT_SLOT (3, 0, 0, 4, ROM, 0x10000, 0x10000)
17791779MSX_LAYOUT_END
17801780
r1461r1462
17891789MSX_LAYOUT_INIT (hbf700d)
17901790   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
17911791   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1792   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1792   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
17931793   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
1794   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
1794   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
17951795   MSX_LAYOUT_SLOT (3, 3, 0, 4, RAM_MM, 0x40000, 0x0000)   /* 256KB Mapper RAM */
17961796   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
17971797MSX_LAYOUT_END
r1461r1462
18071807MSX_LAYOUT_INIT (hbf700p)
18081808   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
18091809   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1810   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1810   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
18111811   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
1812   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
1812   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
18131813   MSX_LAYOUT_SLOT (3, 3, 0, 4, RAM_MM, 0x40000, 0x0000)   /* 256KB Mapper RAM */
18141814   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
18151815MSX_LAYOUT_END
r1461r1462
18251825MSX_LAYOUT_INIT (hbf700s)
18261826   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
18271827   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1828   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1828   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
18291829   MSX_LAYOUT_SLOT (3, 0, 0, 1, ROM, 0x4000, 0x8000)
1830   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
1830   MSX_LAYOUT_SLOT (3, 0, 1, 2, DISK_ROM, 0x4000, 0xc000)
18311831   MSX_LAYOUT_SLOT (3, 3, 0, 4, RAM_MM, 0x40000, 0x0000)   /* 256KB Mapper RAM */
18321832   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
18331833MSX_LAYOUT_END
r1461r1462
18451845MSX_LAYOUT_INIT (hbg900p)
18461846   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
18471847   MSX_LAYOUT_SLOT (0, 1, 0, 1, ROM, 0x4000, 0x8000)
1848   MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000)
1848   MSX_LAYOUT_SLOT (0, 1, 1, 2, DISK_ROM, 0x4000, 0xc000)
18491849/*   MSX_LAYOUT_SLOT (0, 2, 1, 1, ROM, 0x4000, 0x20000) */ /* RS232C must be emulated */
18501850   MSX_LAYOUT_SLOT (0, 3, 1, 1, ROM, 0x4000, 0x24000)
18511851   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
1852   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
1852   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
18531853   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x10000, 0x0000)   /* 64KB Mapper RAM */
18541854   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
18551855MSX_LAYOUT_END
r1461r1462
18711871   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x20000, 0x0000)   /* 128KB Mapper RAM */
18721872   MSX_LAYOUT_SLOT (3, 1, 0, 1, ROM, 0x4000, 0x8000)
18731873   MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000)
1874   MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000)
1874   MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000)
18751875   MSX_LAYOUT_KANJI (0x28000)
18761876   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
18771877MSX_LAYOUT_END
r1461r1462
20022002   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x10000, 0x0000)   /* 64KB Mapper RAM */
20032003   MSX_LAYOUT_SLOT (3, 1, 0, 1, ROM, 0x4000, 0x8000)
20042004   MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000)
2005   MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000)
2005   MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000)
20062006   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x28000)
20072007   MSX_LAYOUT_KANJI (0x30000)
20082008   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
r1461r1462
20292029   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM_MM, 0x10000, 0x0000)   /* 64KB Mapper RAM */
20302030   MSX_LAYOUT_SLOT (3, 1, 0, 1, ROM, 0x4000, 0x8000)
20312031   MSX_LAYOUT_SLOT (3, 1, 1, 2, ROM, 0x8000, 0x20000)
2032   MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000)
2032   MSX_LAYOUT_SLOT (3, 2, 1, 2, DISK_ROM, 0x4000, 0xc000)
20332033   MSX_LAYOUT_SLOT (3, 3, 1, 1, ROM, 0x4000, 0x28000)
20342034   MSX_LAYOUT_KANJI (0x30000)
20352035   MSX_LAYOUT_RAMIO_SET_BITS (0x80)
r1461r1462
21282128MSX_LAYOUT_INIT (vg8020)
21292129   MSX_LAYOUT_SLOT (0, 0, 0, 2, ROM, 0x8000, 0x0000)
21302130   MSX_LAYOUT_SLOT (1, 0, 0, 4, CARTRIDGE1, 0x0000, 0x0000)
2131   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
2131   MSX_LAYOUT_SLOT (2, 0, 0, 4, CARTRIDGE2, 0x0000, 0x0000)
21322132   MSX_LAYOUT_SLOT (3, 0, 0, 4, RAM, 0x10000, 0x0000)   /* 64KB RAM */
21332133MSX_LAYOUT_END
21342134
r1461r1462
22042204SYSTEM_CONFIG_END
22052205
22062206MSX_DRIVER_LIST
2207   MSX_DRIVER (msx)
2207   MSX_DRIVER (msx)
22082208   MSX_DRIVER (hb75d)
22092209   MSX_DRIVER (hb75p)
22102210   MSX_DRIVER (hb501p)
r1461r1462
22182218   MSX_DRIVER (fs4000)
22192219   MSX_DRIVER (fs1300)
22202220   MSX_DRIVER (hb201)
2221   MSX_DRIVER (dpc100)
2222   MSX_DRIVER (dpc180)
2223   MSX_DRIVER (dpc200)
2224   MSX_DRIVER (hotbit11)
2225   MSX_DRIVER (hotbit12)
2226   MSX_DRIVER (expert10)
2227   MSX_DRIVER (expert11)
2228   MSX_DRIVER (expertdp)
2229   MSX_DRIVER (msx2)
2221   MSX_DRIVER (dpc100)
2222   MSX_DRIVER (dpc180)
2223   MSX_DRIVER (dpc200)
2224   MSX_DRIVER (hotbit11)
2225   MSX_DRIVER (hotbit12)
2226   MSX_DRIVER (expert10)
2227   MSX_DRIVER (expert11)
2228   MSX_DRIVER (expertdp)
2229   MSX_DRIVER (msx2)
22302230   MSX_DRIVER (nms8220)
22312231   MSX_DRIVER (nms8220a)
22322232   MSX_DRIVER (vg8235)
r1461r1462
22382238   MSX_DRIVER (hbf500p)
22392239   MSX_DRIVER (hbf700d)
22402240   MSX_DRIVER (hbf700p)
2241   MSX_DRIVER (hbf700s)
2241   MSX_DRIVER (hbf700s)
22422242   MSX_DRIVER (hbg900p)
22432243   MSX_DRIVER (fs5500)
22442244   MSX_DRIVER (fs4500)
src/mess/drivers/gamecom.c
r1461r1462
6868   PORT_BIT( 0xff, 80, IPT_LIGHTGUN_Y ) PORT_MINMAX(0,159) PORT_SENSITIVITY(50) PORT_KEYDELTA(8)
6969INPUT_PORTS_END
7070
71#define GAMECOM_PALETTE_LENGTH   5   
71#define GAMECOM_PALETTE_LENGTH   5
7272
7373static const unsigned char palette[] =
7474{
src/mess/drivers/tmc600.c
r1461r1462
112112      // set character color
113113      vismac_color_latch = data;
114114      break;
115   
115
116116   case 0x30:
117117      // write cdp1869 command on the data bus
118118      vismac_bkg_latch = data & 0x07;
119119      cdp1869_out3_w(0, data);
120120      break;
121   
121
122122   case 0x40:
123123      cdp1869_out4_w(0, data);
124124      break;
125   
125
126126   case 0x50:
127127      cdp1869_out5_w(0, data);
128128      break;
129   
129
130130   case 0x60:
131131      cdp1869_out6_w(0, data);
132132      break;
133   
133
134134   case 0x70:
135135      cdp1869_out7_w(0, data);
136136      break;
r1461r1462
336336/* Machine Drivers */
337337
338338static MACHINE_DRIVER_START( tmc600 )
339   
339
340340   // basic system hardware
341341
342342   MDRV_CPU_ADD(CDP1802, 3579545)   // ???
src/mess/drivers/vectrex.c
r1461r1462
108108   MDRV_PALETTE_LENGTH(256 + 32768)
109109   /*MDRV_ASPECT_RATIO(3, 4)*/
110110
111   MDRV_VIDEO_START( vectrex )   
111   MDRV_VIDEO_START( vectrex )
112112   MDRV_VIDEO_UPDATE( vectrex )
113113
114114   /* sound hardware */
r1461r1462
117117   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
118118   MDRV_SOUND_ADD(AY8910, 1500000)
119119   MDRV_SOUND_CONFIG(ay8910_interface)
120   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)   
120   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
121121MACHINE_DRIVER_END
122122
123123static void vectrex_cartslot_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
r1461r1462
163163  after that 2 and 3. You can leave the screen where you enter
164164  ads by pressing 8 several times.
165165
166  Character matrix is:
166  Character matrix is:
167167
168168  btn| 1  2  3  4  5  6  7  8
169169  ---+------------------------
170  1  | 0  1  2  3  4  5  6  7 
170  1  | 0  1  2  3  4  5  6  7
171171  2  | 8  9  A  B  C  D  E  F
172172  3  | G  H  I  J  K  L  M  N
173173  4  | O  P  Q  R  S  T  U  V
src/mess/drivers/tm990189.c
r1461r1462
319319
320320static VIDEO_START( tm990_189_v )
321321{
322   /* NPW 27-Feb-2006 - ewwww gross!!! maybe this can be fixed when
322   /* NPW 27-Feb-2006 - ewwww gross!!! maybe this can be fixed when
323323    * multimonitor support is added?*/
324324   LED_display_window_left = machine->screen[0].visarea.min_x;
325325   LED_display_window_top = machine->screen[0].visarea.max_y - 32;
r1461r1462
918918      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@ /") PORT_CODE(KEYCODE_MINUS)
919919      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("> %") PORT_CODE(KEYCODE_EQUALS)
920920      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 ^") PORT_CODE(KEYCODE_0)
921     
921
922922   PORT_START    /* row 2 */
923923      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 .") PORT_CODE(KEYCODE_1)
924924      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 ;") PORT_CODE(KEYCODE_2)
925925      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 :") PORT_CODE(KEYCODE_3)
926926      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 ?") PORT_CODE(KEYCODE_4)
927927      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 !") PORT_CODE(KEYCODE_5)
928     
928
929929   PORT_START    /* row 3 */
930930      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 _") PORT_CODE(KEYCODE_6)
931931      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 \"") PORT_CODE(KEYCODE_7)
src/mess/drivers/thomson.c
r1461r1462
55  Thomson 8-bit micro-computers.
66
77  A 6809E-based French family of personal computers developed in the 80's.
8  Despite their rather high price and poor design , they were quite popular
9  in France, probably due to the government plan "Informatique pour tous"
10  (Computer Science for Everyone) to put a network of MO5 computers in every
8  Despite their rather high price and poor design , they were quite popular
9  in France, probably due to the government plan "Informatique pour tous"
10  (Computer Science for Everyone) to put a network of MO5 computers in every
1111  school during 1984-1986. And maybe their very popular light-pen.
1212
1313  Drivers
r1461r1462
2424  - to8d   Thomson TO8D            (TO8 with integrated floppy, dec 1987)
2525  - pro128 Olivetti Prodest PC 128 (Italian MO6, built by Thomson, 1986)
2626
27  We do not consider here the few 16-bit computers built by Thomson
27  We do not consider here the few 16-bit computers built by Thomson
2828  (68000-based Micromega 32, 8088-based Micromega 16 or the TO16: Thomson's own
2929   8088-based PC).
3030
r1461r1462
4040  similar technologies, but with different cost/feature trade-offs and
4141  different compatibility (MO6 is MO5-compatible, TO9+ is TO9-compatible and
4242  TO8 and TO9+ are TO7-compatible).
43  Also note that the MO5NR is actually based on MO6 design, not MO5
43  Also note that the MO5NR is actually based on MO6 design, not MO5
4444  (although both MO5NR and MO6 are MO5-compatible)
4545
4646  Also of interest are the Platini and Hinault versions of the MO5
r1461r1462
4848  There were several versions of TO7/70 and MO5 with alternate keyboards.
4949
5050  Thomson stopped producing micro-computers in jan 1990.
51 
51
5252**********************************************************************/
5353
5454/* TODO (roughly in decreasing priority order):
r1461r1462
119119    connect either two 8-position 2-button game pads
120120    or a 2-button mouse (not both at the same time!)
121121
122  We emulate the SX 90-018 as it is fully compatible with the CM 90-112. 
122  We emulate the SX 90-018 as it is fully compatible with the CM 90-112.
123123
124124  Notes:
125125  * all extensions are compatible with all Thomson computers.
r1461r1462
127127  * the TO9 has its own, different mouse port
128128  * all extensions are based on a Motorola 6821 PIA
129129  * all extensions include a 6-bit sound DAC
130  * most pre-TO8 software (including TO9) do not recognise the mouse nor the
130  * most pre-TO8 software (including TO9) do not recognise the mouse nor the
131131  second button of each pad
132132  * the mouse cannot be used at the same time as the pads: they use the same
133  6821 input ports & physical port; we use a config switch to tell MESS
133  6821 input ports & physical port; we use a config switch to tell MESS
134134  whether pads or a mouse is connected
135135  * the mouse should not be used at the same time as the sound DAC: they use
136136  the same 6821 ports, either as input or output; starting from the TO8,
137137  there is a 'mute' signal to cut the DAC output and avoid producing an
138  audible buzz whenever the mouse is moved; unfortunately, mute is not
138  audible buzz whenever the mouse is moved; unfortunately, mute is not
139139  available on the TO7(/70), TO9 and MO5.
140140*/
141141
r1461r1462
155155     PORT_START_TAG ( "game_port_buttons" )
156156     PAD ( 0x40, 1, "Action A", BUTTON1, BUTTON1, LCONTROL )
157157     PAD ( 0x80, 2, "Action A", BUTTON1, BUTTON1, RCONTROL )
158
158
159159/* joysticks, SX 90-018 specific */
160160     PAD ( 0x04, 1, "Action B", BUTTON2, BUTTON2, LALT )
161161     PAD ( 0x08, 2, "Action B", BUTTON2, BUTTON2, RALT )
r1461r1462
164164
165165/* mouse, SX 90-018 specific */
166166     PORT_START_TAG ( "mouse_x" )
167     PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_X )
167     PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_X )
168168     PORT_NAME ( "Mouse X" )
169169     PORT_SENSITIVITY ( 150 )
170170     PORT_PLAYER (1)
171 
171
172172     PORT_START_TAG ( "mouse_y" )
173173     PORT_BIT ( 0xffff, 0x00, IPT_MOUSE_Y )
174174     PORT_NAME ( "Mouse Y" )
175     PORT_SENSITIVITY ( 150 )
175     PORT_SENSITIVITY ( 150 )
176176     PORT_PLAYER (1)
177177
178178     PORT_START_TAG ( "mouse_button" )
r1461r1462
225225   case DEVINFO_STR_FILE_EXTENSIONS:
226226      strcpy( info->s = device_temp_str(), "m7,rom" );
227227      break;
228   default:
228   default:
229229      cartslot_device_getinfo( devclass, state, info );
230   } 
230   }
231231}
232232
233233static void mo5_cartridge_getinfo( const device_class *devclass, UINT32 state, union devinfo *info )
r1461r1462
242242   case DEVINFO_STR_FILE_EXTENSIONS:
243243      strcpy( info->s = device_temp_str(), "m5,rom" );
244244      break;
245   default:
245   default:
246246      cartslot_device_getinfo( devclass, state, info );
247   } 
247   }
248248}
249249
250250
r1461r1462
254254{
255255   switch ( state ) {
256256   case DEVINFO_INT_COUNT:
257      info->i = 1;
257      info->i = 1;
258258      break;
259259   default:
260260      printer_device_getinfo( devclass, state, info );
r1461r1462
265265/* ------------ serial ------------ */
266266
267267static const char *const thom_serial_names[3][3]=
268{
268{
269269   { "cc90232", "c232", "RS232 (older, CC 90-232)" },
270270   { "rf57932", "r232", "RS232 (newer, RF 57-932)" },
271   { "modem", "modm", "Modem" }
272};
271   { "modem", "modm", "Modem" }
272};
273273
274274static void thom_serial_getinfo ( const device_class *devclass, UINT32 state, union devinfo *info )
275275{
276276   switch ( state ) {
277277   case DEVINFO_INT_COUNT:
278      info->i = 3;
278      info->i = 3;
279279      break;
280280   case DEVINFO_INT_TYPE:
281      info->i = IO_SERIAL;
281      info->i = IO_SERIAL;
282282      break;
283283   case DEVINFO_INT_READABLE:
284      info->i = 1;
284      info->i = 1;
285285      break;
286286   case DEVINFO_INT_WRITEABLE:
287      info->i = 1;
287      info->i = 1;
288288      break;
289289   case DEVINFO_INT_CREATABLE:
290      info->i = 1;
290      info->i = 1;
291291      break;
292   
292
293293   case DEVINFO_PTR_INIT:
294294      info->init = thom_serial_init;
295295      break;
296296   case DEVINFO_PTR_LOAD:
297      info->load = thom_serial_load;
297      info->load = thom_serial_load;
298298      break;
299299   case DEVINFO_PTR_UNLOAD:
300300      info->unload = thom_serial_unload;
301301      break;
302   
302
303303   case DEVINFO_STR_NAME+0:
304304   case DEVINFO_STR_NAME+1:
305305   case DEVINFO_STR_NAME+2:
306      strcpy( info->s = device_temp_str(),
306      strcpy( info->s = device_temp_str(),
307307         thom_serial_names[ state - DEVINFO_STR_NAME ][ 0 ] );
308308      break;
309309   case DEVINFO_STR_SHORT_NAME+0:
310310   case DEVINFO_STR_SHORT_NAME+1:
311311   case DEVINFO_STR_SHORT_NAME+2:
312      strcpy( info->s = device_temp_str(),
312      strcpy( info->s = device_temp_str(),
313313         thom_serial_names[ state - DEVINFO_STR_SHORT_NAME ][ 1 ] );
314314      break;
315315   case DEVINFO_STR_DESCRIPTION+0:
316316   case DEVINFO_STR_DESCRIPTION+1:
317317   case DEVINFO_STR_DESCRIPTION+2:
318      strcpy( info->s = device_temp_str(),
318      strcpy( info->s = device_temp_str(),
319319         thom_serial_names[ state - DEVINFO_STR_DESCRIPTION ][ 2 ] );
320320      break;
321   
321
322322   case DEVINFO_STR_DEV_FILE:
323323      strcpy( info->s = device_temp_str(), "serial" );
324324      break;
325325   case DEVINFO_STR_FILE_EXTENSIONS:
326      strcpy( info->s = device_temp_str(), "txt" );
326      strcpy( info->s = device_temp_str(), "txt" );
327327      break;
328328
329329   }
r1461r1462
340340Note that the computer comes with only a minimal BIOS and requires an
341341external cartridge to be usable.
342342Most software are distributed on cassette and require the BASIC 1.0 cartridge
343to be present (-cart basic.m7), as only it provides the necessary OS
343to be present (-cart basic.m7), as only it provides the necessary OS
344344capabilities (e.g., a cassette loader).
345To use disks, you will need both a BASIC 1.0 cartridge and a BASIC DOS
345To use disks, you will need both a BASIC 1.0 cartridge and a BASIC DOS
346346boot floppy.
347347
348348* chips:
r1461r1462
376376    . two 8-position 2-button game pads
377377    . 2-button mouse
378378    . based on a Motorola 6821 PIA
379  - CC 90-232 I/O extension:
380    . CENTRONICS (printer)
379  - CC 90-232 I/O extension:
380    . CENTRONICS (printer)
381381    . RS232 (unemulated)
382382    . based on a Motorola 6821 PIA
383383    . NOTE: you cannot use the CENTRONICS and RS232 at the same time
r1461r1462
391391  - 5"1/2 floppy drive extension
392392    . CD 90-640 floppy controller, based on a Western Digital 2793
393393    . DD 90-320 double-density double-sided 5"1/4 floppy
394      (2 drives considered as 4 simple-face drives: 0/1 for the first drive,
395       2/3 for the second drive, 1 and 3 for upper sides, 0 and 2 for lower
394      (2 drives considered as 4 simple-face drives: 0/1 for the first drive,
395       2/3 for the second drive, 1 and 3 for upper sides, 0 and 2 for lower
396396       sides)
397397    . floppies are 40 tracks/side, 16 sectors/track, 128 or 256 bytes/sector
398398      = from 80 KB one-sided single-density, to 320 KB two-sided double-density
r1461r1462
417417-----
418418
419419Early TO7 prototype.
420The hardware seems to be the exactly same. Only the BIOS is different.
420The hardware seems to be the exactly same. Only the BIOS is different.
421421It has some bug that were corrected later for the TO7.
422422Actually, the two computers are undistinguishable, except for the different
423423startup screen, and a couple BIOS addresses.
r1461r1462
434434     AM_RANGE ( 0x0000, 0x3fff ) AM_ROMBANK   ( THOM_CART_BANK ) /* 4 * 16 KB */
435435                                 AM_WRITE     ( to7_cartridge_w )
436436     AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK   ( THOM_VRAM_BANK )
437                                 AM_WRITE     ( to7_vram_w )
437                                 AM_WRITE     ( to7_vram_w )
438438     AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK   ( THOM_BASE_BANK ) /* 1 * 8 KB */
439439     AM_RANGE ( 0x8000, 0xbfff ) AM_NOP       /* 16 KB (for extension) */
440440     AM_RANGE ( 0xc000, 0xdfff ) AM_NOP       /*  8 KB (for extension) */
r1461r1462
447447     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w )
448448     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
449449     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
450     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
450     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
451451                  to7_modem_mea8000_w )
452452     AM_RANGE ( 0xe800, 0xffff ) AM_ROM       /* system bios  */
453453
454454/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */
455455/* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */
456     
456
457457/* mess_ram mapping:
458458   0x0000 - 0x3fff: 16 KB video RAM (actually 8 K x 8 bits + 8 K x 6 bits)
459459   0x4000 - 0x5fff:  8 KB base RAM
r1461r1462
501501     ROM_LOAD ( "cq90-028.rom", base+0x3800, 0x7c0,         \
502502      CRC(ca4dba3d)                  \
503503      MD5(0f58e167bf6ebcd2cbba946be2084fbe)         \
504      SHA1(949c1f777c892da62c242215d79757d61e71e62b) )         
505     
506/* external floppy / network controller: 9 banks */     
504      SHA1(949c1f777c892da62c242215d79757d61e71e62b) )
505
506/* external floppy / network controller: 9 banks */
507507#define ROM_FLOPPY5( base )            \
508508  ROM_FLOPPY( base )               \
509509  ROM_LOAD ( "nano5.rom", base+0x4000, 0x7c0,   \
r1461r1462
517517        CRC(42a1d1a6)            \
518518        MD5(77da8cfc9e0a14ef2ed7034f5941b542)    \
519519        SHA1(973209f4baa5e81bf7885c0602949e064bac7862) )
520     
521520
521
522522ROM_START ( to7 )
523523     ROM_REGION ( 0x24800, REGION_CPU1, 0 )
524524     ROM_LOAD ( "to7.rom", 0xe800, 0x1800,
525525      CRC(0e7826da)
526      MD5(5bf18521bf35293de942645f690b2845)
526      MD5(5bf18521bf35293de942645f690b2845)
527527      SHA1(23a2f84b03c01d385cc1923c8ece95c43756297a) )
528528     ROM_FILL ( 0x10000, 0x10000, 0x39 )
529529     ROM_FLOPPY7 ( 0x20000 )
r1461r1462
533533     ROM_REGION ( 0x24800, REGION_CPU1, 0 )
534534     ROM_LOAD ( "t9000.rom", 0xe800, 0x1800,
535535      CRC(daa8cfbf)
536      MD5(b3007f26e7b621c1a4f0fd2c287f80b9)
536      MD5(b3007f26e7b621c1a4f0fd2c287f80b9)
537537      SHA1(a5735db1ad4e529804fc46603f838d3f4ccaf5cf) )
538538     ROM_FILL ( 0x10000, 0x10000, 0x39 )
539539     ROM_FLOPPY7 ( 0x20000 )
r1461r1462
558558     PORT_CONFSETTING ( 0x00, "Normal (56x47)" )
559559     PORT_CONFSETTING ( 0x01, "Small (16x16)" )
560560     PORT_CONFSETTING ( 0x02, DEF_STR ( None ) )
561 
561
562562     PORT_CONFNAME ( 0x0c, 0x08, "Resolution" )
563563     PORT_CONFSETTING ( 0x00, DEF_STR ( Low ) )
564564     PORT_CONFSETTING ( 0x04, DEF_STR ( High  ) )
r1461r1462
738738
739739static MACHINE_DRIVER_START ( to7 )
740740
741     MDRV_MACHINE_START ( to7 )     
742     MDRV_MACHINE_RESET ( to7 )     
743 
741     MDRV_MACHINE_START ( to7 )
742     MDRV_MACHINE_RESET ( to7 )
743
744744/* cpu */
745745     MDRV_CPU_ADD_TAG ( "main", M6809, 1000000 )
746746     MDRV_CPU_PROGRAM_MAP ( to7, 0 )
747 
747
748748/* video */
749/* Finally, I figured it out. The video hardware overclocks the SECAM
749/* Finally, I figured it out. The video hardware overclocks the SECAM
750750   framerate from 50 Hz to 1/0.019968 Hz to get 312 64us lines per frame,
751751   i.e., 19.968 ms per frame, not 20 ms
752752*/
r1461r1462
755755     MDRV_VIDEO_ATTRIBUTES ( VIDEO_TYPE_RASTER )
756756     MDRV_SCREEN_FORMAT( BITMAP_FORMAT_INDEXED16 )
757757     MDRV_SCREEN_SIZE ( THOM_TOTAL_WIDTH * 2, THOM_TOTAL_HEIGHT )
758     MDRV_SCREEN_VISIBLE_AREA ( 0, THOM_TOTAL_WIDTH * 2 - 1,
758     MDRV_SCREEN_VISIBLE_AREA ( 0, THOM_TOTAL_WIDTH * 2 - 1,
759759            0, THOM_TOTAL_HEIGHT - 1 )
760760     MDRV_PALETTE_LENGTH ( 4097 ) /* 12-bit color + transparency */
761761     MDRV_PALETTE_INIT ( thom )
r1461r1462
795795extensions (floppy, game, communucation, etc.).
796796As the TO7, it is only usable with a cartridge, and most software require
797797the BASIC 1.0 cartridge to be present.
798Though, you may also use the more advanced BASIC 128 (-cart basic128.m7):
799it allows BASIC programs to access all the memory and the video capabilities,
800includes its own DOS (no need for a boot disk), but may not be compatible
798Though, you may also use the more advanced BASIC 128 (-cart basic128.m7):
799it allows BASIC programs to access all the memory and the video capabilities,
800includes its own DOS (no need for a boot disk), but may not be compatible
801801with all games.
802802
803803It has the following modifications:
804804
805805* chips:
806  - custom logics for video, lightpen, address map has been replaced with an
806  - custom logics for video, lightpen, address map has been replaced with an
807807    integrated Gate-Array (Motorola MC 1300 ALS)
808808
809809* memory:
810810  - 48 KB user base RAM (16 KB unswitchable + 2 switchable banks of 16 KB)
811    + 64 KB user extended RAM (EM 97-064, as 4 extra 16 KB banks)
811    + 64 KB user extended RAM (EM 97-064, as 4 extra 16 KB banks)
812812    = 112 KB total user RAM emulated
813813  - now 8-bit x 8 K color RAM (instead of 6-bit x 8 K)
814814
r1461r1462
839839     AM_RANGE ( 0x0000, 0x3fff ) AM_ROMBANK   ( THOM_CART_BANK ) /* 4 * 16 KB */
840840                                 AM_WRITE     ( to7_cartridge_w )
841841     AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK   ( THOM_VRAM_BANK )
842                                 AM_WRITE     ( to770_vram_w )
842                                 AM_WRITE     ( to770_vram_w )
843843     AM_RANGE ( 0x6000, 0x9fff ) AM_RAMBANK   ( THOM_BASE_BANK ) /* 16 KB */
844844     AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK   ( THOM_RAM_BANK )  /* 6 * 16 KB */
845845     AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
r1461r1462
848848     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
849849     AM_RANGE ( 0xe7d0, 0xe7df ) AM_READWRITE ( to7_floppy_r, to7_floppy_w )
850850     AM_RANGE ( 0xe7e0, 0xe7e3 ) AM_READWRITE ( pia_2_alt_r, pia_2_alt_w )
851     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to770_gatearray_r,
851     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to770_gatearray_r,
852852                                                to770_gatearray_w )
853853     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w )
854854     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
855855     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
856     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
856     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
857857                  to7_modem_mea8000_w )
858858     AM_RANGE ( 0xe800, 0xffff ) AM_ROM       /* system bios  */
859859
860860/* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */
861861/* 0x20000 - 0x247ff: 18 KB floppy / network ROM controllers */
862     
862
863863/* mess_ram mapping:
864864   0x00000 - 0x03fff: 16 KB video RAM
865865   0x04000 - 0x07fff: 16 KB unbanked base RAM
r1461r1462
876876     ROM_REGION ( 0x24800, REGION_CPU1, 0 )
877877     ROM_LOAD ( "to770.rom", 0xe800, 0x1800, /* BIOS */
878878      CRC(89518862)
879      MD5(61402c35b75faeb4b74b815f323fff3d)
879      MD5(61402c35b75faeb4b74b815f323fff3d)
880880      SHA1(cd34474c0bcc758f6d71c90fbd40cef379d61374) )
881881     ROM_FLOPPY7 ( 0x20000 )
882882     ROM_FILL ( 0x10000, 0x10000, 0x39 )
r1461r1462
886886     ROM_REGION ( 0x24800, REGION_CPU1, 0 )
887887     ROM_LOAD ( "to770a.rom", 0xe800, 0x1800,
888888      CRC(378ea808)
889      MD5(6b63aa135107beee243967a2da0e5453)
889      MD5(6b63aa135107beee243967a2da0e5453)
890890      SHA1(f4575b537dfdb46ff2a0e7cbe8dfe4ba63161b8e) )
891891     ROM_FLOPPY7 ( 0x20000 )
892892     ROM_FILL ( 0x10000, 0x10000, 0x39 )
r1461r1462
984984It has less memory and is less expandable. The MC6846 timer has disapeared.
985985The BIOS has been throughly rewritten and uses a more compact call scheme.
986986This, and the fact that the address map has changed, makes the MO5 completely
987TO7 software incompatible (except for pure BASIC programs).
987TO7 software incompatible (except for pure BASIC programs).
988988Moreover, the MO5 has incompatible cassette and cartridge formats.
989989Unlike the TO7, the BASIC 1.0 is integrated and the MO5 can be used "as-is".
990990
r1461r1462
10011001  - 8 KB color RAM + 8 KB point RAM, bank switched
10021002  - 2 to 8 KB floppy ROM comes with the floppy drive / network extension
10031003
1004* video:
1004* video:
10051005  - as the TO7/70 but with different color encoding,
10061006    320x200 pixels with color constraints, 16-color fixed palette
10071007  - IN 57-001: TV overlay extension (not implemented)
r1461r1462
10361036static ADDRESS_MAP_START ( mo5, ADDRESS_SPACE_PROGRAM, 8 )
10371037
10381038     AM_RANGE ( 0x0000, 0x1fff ) AM_RAMBANK   ( THOM_VRAM_BANK )
1039                                 AM_WRITE     ( to770_vram_w )
1039                                 AM_WRITE     ( to770_vram_w )
10401040     AM_RANGE ( 0x2000, 0x9fff ) AM_RAMBANK   ( THOM_BASE_BANK )
10411041     AM_RANGE ( 0xa000, 0xa7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
10421042     AM_RANGE ( 0xa7c0, 0xa7c3 ) AM_READWRITE ( pia_0_alt_r,  pia_0_alt_w )
r1461r1462
10721072     ROM_REGION ( 0x24800, REGION_CPU1, 0 )
10731073     ROM_LOAD ( "mo5.rom", 0xf000, 0x1000,
10741074      CRC(f0ea9140)
1075      MD5(ab3533a7132f90933acce80e256ae459)
1075      MD5(ab3533a7132f90933acce80e256ae459)
10761076      SHA1(36ce2d3df1866ec2fe368c1c28757e2f5401cf44) )
10771077     ROM_LOAD ( "basic5.rom", 0x11000, 0x3000,
10781078      CRC(c2c11b9d)
1079      MD5(f992a912093d3e8f165f225f74345b57)
1079      MD5(f992a912093d3e8f165f225f74345b57)
10801080      SHA1(512dd40fb45bc2b51a24c84b3723a32bc8e80c06) )
10811081     ROM_FLOPPY5 ( 0x20000 )
10821082ROM_END
r1461r1462
10851085     ROM_REGION ( 0x24800, REGION_CPU1, 0 )
10861086     ROM_LOAD ( "mo5e.rom", 0xf000, 0x1000,
10871087      CRC(6520213a)
1088      MD5(434c42b96c31a341e13085048cdc8eae)
1088      MD5(434c42b96c31a341e13085048cdc8eae)
10891089      SHA1(f17a7a59baf2819ec80991b34b204795536a5e01) )
10901090     ROM_LOAD ( "basic5e.rom", 0x11000, 0x3000,
10911091      CRC(934a72b2)
1092      MD5(6404a7f49ec28937decd905d2a3cbb28)
1092      MD5(6404a7f49ec28937decd905d2a3cbb28)
10931093      SHA1(b37e2b1afbfba368c19be87b3bf61dfe6ad8b0bb) )
10941094     ROM_FLOPPY5 ( 0x20000 )
10951095ROM_END
r1461r1462
11891189optional mouse.
11901190It is also quite compatible with the TO7 and TO7/70 (but not the MO5).
11911191However, it also has many problems. The integrated BASIC 128 can only access
1192128 KB of memory, which forces the 64 KB extension to be managed as a virtual
1193disk. The early versions of the software ROM has many bugs. The integrated
1192128 KB of memory, which forces the 64 KB extension to be managed as a virtual
1193disk. The early versions of the software ROM has many bugs. The integrated
11941194floppy drive is one-sided.
11951195It was replaced quickly with the improved TO9+.
11961196
r1461r1462
12061206  - 112 KB base RAM
12071207  - 64 KB extension RAM (as virtual disk)
12081208  - 6 KB BIOS ROM + 2 KB floppy BIOS
1209  - 128 KB software ROM (BASIC 1, BASIC 128, extended BIOS,
1209  - 128 KB software ROM (BASIC 1, BASIC 128, extended BIOS,
12101210    DOS and configuration GUI, two software: "Paragraphe" and
12111211    "Fiches et dossiers")
12121212  - 16 KB video RAM
r1461r1462
12511251     AM_RANGE ( 0x0000, 0x3fff ) AM_ROMBANK   ( THOM_CART_BANK )/* 12 * 16 KB */
12521252                                 AM_WRITE     ( to9_cartridge_w )
12531253     AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK   ( THOM_VRAM_BANK )
1254                                 AM_WRITE     ( to770_vram_w )
1254                                 AM_WRITE     ( to770_vram_w )
12551255     AM_RANGE ( 0x6000, 0x9fff ) AM_RAMBANK   ( THOM_BASE_BANK ) /* 16 KB */
12561256     AM_RANGE ( 0xa000, 0xdfff ) AM_RAMBANK   ( THOM_RAM_BANK )  /* 10 * 16 KB */
12571257     AM_RANGE ( 0xe000, 0xe7bf ) AM_ROMBANK   ( THOM_FLOP_BANK )
r1461r1462
12611261     AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to9_floppy_r, to9_floppy_w )
12621262     AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to9_vreg_r, to9_vreg_w )
12631263     AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE ( to9_kbd_r, to9_kbd_w )
1264     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to9_gatearray_r,
1264     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to9_gatearray_r,
12651265                  to9_gatearray_w )
12661266     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w )
12671267/*   AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */
12681268     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
12691269     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
1270     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
1270     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
12711271                  to7_modem_mea8000_w )
12721272     AM_RANGE ( 0xe800, 0xffff ) AM_ROM       /* system bios  */
12731273
r1461r1462
12881288/* ------------ ROMS ------------ */
12891289
12901290/* NOT WORKING
1291   these bios seem heavily patched (probably to work with specific emulators
1291   these bios seem heavily patched (probably to work with specific emulators
12921292   that trap some bios calls)
12931293 */
12941294
r1461r1462
12961296     ROM_REGION ( 0x44800, REGION_CPU1, 0 )
12971297     ROM_LOAD ( "to9.rom", 0xe000, 0x2000, /* BIOS & floppy controller */
12981298      CRC(f9278bf7)
1299      MD5(507f0c482462b70b816fd23cf6791179)
1299      MD5(507f0c482462b70b816fd23cf6791179)
13001300      SHA1(9e99e6ae0285950f007b19161de642a4031fe46e) )
13011301
13021302     /* BASIC & software */
13031303     ROM_LOAD ( "basic9-0.rom", 0x20000, 0x4000,
13041304      CRC(c7bac620)
1305      MD5(095d0f94ab506ab5da1e73ae550ee2bc)
1305      MD5(095d0f94ab506ab5da1e73ae550ee2bc)
13061306      SHA1(4b2a8b30cf437858ce978ba7b0dfa2bbd57eb38a) )
13071307     ROM_LOAD ( "basic9-1.rom", 0x24000, 0x4000,
13081308      CRC(ea5f3e43)
1309      MD5(ce29a894c31db083acf6bdf015a02b5e)
1309      MD5(ce29a894c31db083acf6bdf015a02b5e)
13101310      SHA1(5e58a29c2d117fcdb1f5e7ca31dbfffa0f9218f2) )
13111311     ROM_LOAD ( "basic9-2.rom", 0x28000, 0x4000,
13121312      CRC(0f5581b3)
1313      MD5(02279e22b8bfe29e750fb62671e3951d)
1313      MD5(02279e22b8bfe29e750fb62671e3951d)
13141314      SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) )
13151315     ROM_LOAD ( "basic9-3.rom", 0x2c000, 0x4000,
13161316      CRC(6b5b19e3)
1317      MD5(dac4b33a8cbebf64916b35515e0693c8)
1317      MD5(dac4b33a8cbebf64916b35515e0693c8)
13181318      SHA1(0e832670c185694d9abbcebcc3ad90e94eed585d) )
13191319     ROM_LOAD ( "soft9-0a.rom", 0x30000, 0x4000,
13201320      CRC(8cee157e)
1321      MD5(3dab712e800351b4f639790595b12101)
1321      MD5(3dab712e800351b4f639790595b12101)
13221322      SHA1(f32fc39b95890c00571e9f3fbcc2d8e0596fc4a1) )
13231323     ROM_LOAD ( "soft9-1a.rom", 0x34000, 0x4000,
13241324      CRC(cf39ac93)
1325      MD5(bcd744cdbd022cd9e2651e87792cd742)
1325      MD5(bcd744cdbd022cd9e2651e87792cd742)
13261326      SHA1(b97e6b7389398e5706624973c11ee7ddba323ce1) )
13271327     ROM_LOAD ( "soft9-0b.rom", 0x38000, 0x4000,
13281328      CRC(033aee3f)
1329      MD5(1a4d3549c78328479361e867d240f285)
1329      MD5(1a4d3549c78328479361e867d240f285)
13301330      SHA1(f3604e500329ec0489b05dbab05530322e9463c5) )
13311331     ROM_LOAD ( "soft9-1b.rom", 0x3c000, 0x4000,
13321332      CRC(214fe527)
1333      MD5(3dc2820fbe7b81a3936f731b44f23cbe)
1333      MD5(3dc2820fbe7b81a3936f731b44f23cbe)
13341334      SHA1(0d8e3f1ca347026e906c3d00a0371e8238c44a60) )
13351335
13361336     ROM_FLOPPY7( 0x40000 )
r1461r1462
13441344static INPUT_PORTS_START ( to9_keyboard )
13451345     PORT_START_TAG ( "keyboard_0" )
13461346     KEY ( 0, "F2 F7", F2 )           PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F7))
1347     KEY ( 1, "_ 6", 6 )              PORT_CHAR('_') PORT_CHAR('6')
1348     KEY ( 2, "Y", Y )                PORT_CHAR('Y')
1349     KEY ( 3, "H \302\250", H )       PORT_CHAR('H')
1347     KEY ( 1, "_ 6", 6 )              PORT_CHAR('_') PORT_CHAR('6')
1348     KEY ( 2, "Y", Y )                PORT_CHAR('Y')
1349     KEY ( 3, "H \302\250", H )       PORT_CHAR('H')
13501350     KEY ( 4, "\xE2\x86\x91", UP )    PORT_CHAR(UCHAR_MAMEKEY(UP))
13511351     KEY ( 5, "\xE2\x86\x92", RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
13521352     KEY ( 6, "Home Clear", HOME )    PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(UCHAR_MAMEKEY(ESC))
13531353     KEY ( 7, "N", N )                PORT_CHAR('N')
13541354     PORT_START_TAG ( "keyboard_1" )
13551355     KEY ( 0, "F3 F8", F3 )           PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F8))
1356     KEY ( 1, "( 5", 5 )              PORT_CHAR('(') PORT_CHAR('5')
1356     KEY ( 1, "( 5", 5 )              PORT_CHAR('(') PORT_CHAR('5')
13571357     KEY ( 2, "T", T )                PORT_CHAR('T')
13581358     KEY ( 3, "G", G )                PORT_CHAR('G')
1359     KEY ( 4, "= +", EQUALS )         PORT_CHAR('=') PORT_CHAR('+')
1359     KEY ( 4, "= +", EQUALS )         PORT_CHAR('=') PORT_CHAR('+')
13601360     KEY ( 5, "\xE2\x86\x90", LEFT )  PORT_CHAR(UCHAR_MAMEKEY(LEFT))
13611361     KEY ( 6, "Insert", INSERT )      PORT_CHAR(UCHAR_MAMEKEY(INSERT))
13621362     KEY ( 7, "B \302\264", B )       PORT_CHAR('B')
13631363     PORT_START_TAG ( "keyboard_2" )
13641364     KEY ( 0, "F4 F9", F4 )           PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9))
1365     KEY ( 1, "' 4", 4 )              PORT_CHAR('\'') PORT_CHAR('4')
1365     KEY ( 1, "' 4", 4 )              PORT_CHAR('\'') PORT_CHAR('4')
13661366     KEY ( 2, "R", R )                PORT_CHAR('R')
13671367     KEY ( 3, "F", F )                PORT_CHAR('F')
13681368     KEY ( 4, "Accent", END )         PORT_CHAR(UCHAR_MAMEKEY(END))
r1461r1462
13711371     KEY ( 7, "V", V )                PORT_CHAR('V')
13721372     PORT_START_TAG ( "keyboard_3" )
13731373     KEY ( 0, "F5 F10", F5 )          PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F10))
1374     KEY ( 1, "\" 3", 3 )             PORT_CHAR('"') PORT_CHAR('3')
1374     KEY ( 1, "\" 3", 3 )             PORT_CHAR('"') PORT_CHAR('3')
13751375     KEY ( 2, "E", E )                PORT_CHAR('E')
13761376     KEY ( 3, "D", D )                PORT_CHAR('D')
13771377     KEY ( 4, "Keypad 7", 7_PAD )     PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
r1461r1462
13801380     KEY ( 7, "C \136", C )           PORT_CHAR('C')
13811381     PORT_START_TAG ( "keyboard_4" )
13821382     KEY ( 0, "F1 F6", F1 )           PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F6))
1383     KEY ( 1, "\303\251 2", 2 )       PORT_CHAR( 0xe9 ) PORT_CHAR('2')
1383     KEY ( 1, "\303\251 2", 2 )       PORT_CHAR( 0xe9 ) PORT_CHAR('2')
13841384     KEY ( 2, "Z", Z )                PORT_CHAR('Z')
13851385     KEY ( 3, "S", S )                PORT_CHAR('S')
13861386     KEY ( 4, "Keypad 8", 8_PAD )     PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
r1461r1462
13881388     KEY ( 6, "Keypad .", DEL_PAD )   PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
13891389     KEY ( 7, "X", X )                PORT_CHAR('X')
13901390     PORT_START_TAG ( "keyboard_5" )
1391     KEY ( 0, "# @", TILDE )          PORT_CHAR('#') PORT_CHAR('@')
1392     KEY ( 1, "* 1", 1 )              PORT_CHAR('*') PORT_CHAR('1')
1391     KEY ( 0, "# @", TILDE )          PORT_CHAR('#') PORT_CHAR('@')
1392     KEY ( 1, "* 1", 1 )              PORT_CHAR('*') PORT_CHAR('1')
13931393     KEY ( 2, "A \140", A )           PORT_CHAR('A')
13941394     KEY ( 3, "Q", Q )                PORT_CHAR('Q')
1395     KEY ( 4, "[ {", QUOTE )          PORT_CHAR('[') PORT_CHAR('{')
1395     KEY ( 4, "[ {", QUOTE )          PORT_CHAR('[') PORT_CHAR('{')
13961396     KEY ( 5, "Keypad 5", 5_PAD )     PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
13971397     KEY ( 6, "Keypad 6", 6_PAD )     PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
13981398     KEY ( 7, "W", W )                PORT_CHAR('W')
r1461r1462
14041404     KEY ( 4, "Space", SPACE )        PORT_CHAR(' ')
14051405     KEY ( 5, "Keypad 9", 9_PAD )     PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
14061406     KEY ( 6, "Keypad Enter", ENTER_PAD ) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
1407     KEY ( 7, ", ?", COMMA )          PORT_CHAR(',') PORT_CHAR('?')
1407     KEY ( 7, ", ?", COMMA )          PORT_CHAR(',') PORT_CHAR('?')
14081408     PORT_START_TAG ( "keyboard_7" )
14091409     KEY ( 0, "Control", LCONTROL )   PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
1410     KEY ( 1, "! 8", 8 )              PORT_CHAR('!') PORT_CHAR('8')
1410     KEY ( 1, "! 8", 8 )              PORT_CHAR('!') PORT_CHAR('8')
14111411     KEY ( 2, "I", I )                PORT_CHAR('I')
14121412     KEY ( 3, "K", K )                PORT_CHAR('K')
1413     KEY ( 4, "$ &", CLOSEBRACE )     PORT_CHAR('$') PORT_CHAR('&')
1413     KEY ( 4, "$ &", CLOSEBRACE )     PORT_CHAR('$') PORT_CHAR('&')
14141414     KEY ( 5, "\xE2\x86\x93", DOWN )  PORT_CHAR(UCHAR_MAMEKEY(DOWN))
1415     KEY ( 6, "] }", BACKSLASH )      PORT_CHAR(']') PORT_CHAR('}')
1416     KEY ( 7, "; .", STOP )           PORT_CHAR(';') PORT_CHAR('.')
1415     KEY ( 6, "] }", BACKSLASH )      PORT_CHAR(']') PORT_CHAR('}')
1416     KEY ( 7, "; .", STOP )           PORT_CHAR(';') PORT_CHAR('.')
14171417     PORT_START_TAG ( "keyboard_8" )
14181418     KEY ( 0, "Caps-Lock", CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
14191419     KEY ( 1, "\303\247 9", 9 )       PORT_CHAR( 0xe7 ) PORT_CHAR('9')
14201420     KEY ( 2, "O", O )                PORT_CHAR('O')
14211421     KEY ( 3, "L", L )                PORT_CHAR('L')
1422     KEY ( 4, "- \\", BACKSPACE )     PORT_CHAR('-') PORT_CHAR('\\')
1422     KEY ( 4, "- \\", BACKSPACE )     PORT_CHAR('-') PORT_CHAR('\\')
14231423     KEY ( 5, "\303\271 %", COLON )   PORT_CHAR( 0xf9 ) PORT_CHAR('%')
14241424     KEY ( 6, "Enter", ENTER )        PORT_CHAR(13)
1425     KEY ( 7, ": /", SLASH )          PORT_CHAR(':') PORT_CHAR('/')
1425     KEY ( 7, ": /", SLASH )          PORT_CHAR(':') PORT_CHAR('/')
14261426     PORT_START_TAG ( "keyboard_9" )
14271427     KEY ( 0, "Shift", LSHIFT )  PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1)
14281428     KEY ( 1, "\303\240 0", 0 )       PORT_CHAR( 0xe0 ) PORT_CHAR('0')
r1461r1462
14311431     KEY ( 4, ") \302\260", MINUS )   PORT_CHAR(')') PORT_CHAR( 0xb0 )
14321432     KEY ( 5, "\342\206\221 \302\250", OPENBRACE )  PORT_CHAR('^') PORT_CHAR( 0xa8 )
14331433     KEY ( 6, "Keypad 3", 3_PAD )     PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
1434     KEY ( 7, "> <", BACKSLASH2 )     PORT_CHAR('>') PORT_CHAR('<')
1434     KEY ( 7, "> <", BACKSLASH2 )     PORT_CHAR('>') PORT_CHAR('<')
14351435INPUT_PORTS_END
14361436
14371437static INPUT_PORTS_START ( to9_fconfig )
r1461r1462
15231523The TO8 was meant to replace the TO7/70 as a home-computer.
15241524It includes and improves on the technology from the TO9 (improved video,
15251525256 KB of RAM fully managed by the new BASIC 512, more integrated gate-array).
1526It has a more compact Amiga-like look, no separate keyboard, no integrated
1526It has a more compact Amiga-like look, no separate keyboard, no integrated
15271527floppy drive (although the controller is integrated), no software in ROM,
15281528less extension slots. Also, the game & music extension is now integrated.
15291529It is quite compatible with the TO7 and TO7/70, and with the TO9 to some
r1461r1462
15391539  - 2 gate-arrays (system & video, floppy controller)
15401540
15411541* memory:
1542  - 256 KB base RAM
1542  - 256 KB base RAM
15431543    + 256 KB extended RAM (EM 88-256) = 512 KB total RAM emulated
15441544  - 16 KB BIOS ROM
15451545  - 64 KB software ROM (BASIC 1, BASIC 512, extended BIOS)
r1461r1462
15501550  border color has its 4-th index bit inverted
15511551
15521552* devices:
1553  - same keyboard as T09: AZERTY 81-keys
1553  - same keyboard as T09: AZERTY 81-keys
15541554    (but no 6850 controller, the 6804 is directly connected to the 6821 & 6846)
15551555  - cartridge, up to 64 KB, TO7 compatible
15561556  - two-button serial mouse (TO9-incompatible)
r1461r1462
15831583     AM_RANGE ( 0x0000, 0x3fff ) AM_RAMBANK   ( THOM_CART_BANK ) /* 8 * 16 KB */
15841584                                 AM_WRITE     ( to8_cartridge_w )
15851585     AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK   ( THOM_VRAM_BANK )
1586                                 AM_WRITE     ( to770_vram_w )
1586                                 AM_WRITE     ( to770_vram_w )
15871587     AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK   ( TO8_SYS_LO )
15881588                                 AM_WRITE     ( to8_sys_lo_w )
15891589     AM_RANGE ( 0x8000, 0x9fff ) AM_RAMBANK   ( TO8_SYS_HI )
r1461r1462
15981598     AM_RANGE ( 0xe7cc, 0xe7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
15991599     AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to8_floppy_r, to8_floppy_w )
16001600     AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to8_vreg_r, to8_vreg_w )
1601     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r,
1601     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r,
16021602                  to8_gatearray_w )
16031603     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w )
16041604/*   AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */
16051605     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
16061606     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
1607     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
1607     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
16081608                  to7_modem_mea8000_w )
16091609     AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK   ( TO8_BIOS_BANK ) /* 2 * 6 KB */
16101610
r1461r1462
16261626     /* BIOS & floppy */
16271627     ROM_LOAD ( "to8-0.rom", 0x30000, 0x2000,
16281628      CRC(3c4a640a)
1629      MD5(97c9b803305031daf6bffa671f7667c2)
1629      MD5(97c9b803305031daf6bffa671f7667c2)
16301630      SHA1(0a4952f0ca002d82ac83755e1f694d56399413b2) )
16311631     ROM_LOAD ( "to8-1.rom", 0x32000, 0x2000,
16321632      CRC(cb9bae2d)
1633      MD5(6ca0ebe022f9c433373eaed403aaf0ce)
1633      MD5(6ca0ebe022f9c433373eaed403aaf0ce)
16341634      SHA1(a4a55a6e2c74bca15951158c5164970e922fc1c1) )
16351635
16361636     /* BASIC */
16371637     ROM_LOAD ( "basic8-0.rom", 0x20000, 0x4000,
16381638      CRC(e5a00fb3)
1639      MD5(6c33e3cd79bd6c675634b172594bbfec)
1639      MD5(6c33e3cd79bd6c675634b172594bbfec)
16401640      SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) )
16411641     ROM_LOAD ( "basic8-1.rom", 0x24000, 0x4000,
16421642      CRC(4b241e63)
1643      MD5(360cbf42078bf8c80a283828bf6ee4e6)
1643      MD5(360cbf42078bf8c80a283828bf6ee4e6)
16441644      SHA1(ca8941a10db6cc069bf84c773f5e7d7d2c18449e) )
16451645     ROM_LOAD ( "basic8-2.rom", 0x28000, 0x4000,
16461646      CRC(0f5581b3)
1647      MD5(02279e22b8bfe29e750fb62671e3951d)
1647      MD5(02279e22b8bfe29e750fb62671e3951d)
16481648      SHA1(93815ca78d3532192aaa56cbf65b68b0f10f1b8a) )
16491649     ROM_LOAD ( "basic8-3.rom", 0x2c000, 0x4000,
16501650      CRC(f552e7e3)
1651      MD5(56c1e929ef4be6771cac7157d169132f)
1651      MD5(56c1e929ef4be6771cac7157d169132f)
16521652      SHA1(3208e0d7d90241a327ed24e4921303f16e167bd5) )
16531653
16541654     ROM_FLOPPY7( 0x34000 )
r1461r1462
16621662     /* BIOS & floppy */
16631663     ROM_LOAD ( "to8d-0.rom", 0x30000, 0x2000,
16641664      CRC(30ea4950)
1665      MD5(7704c1148b8761e9ce650ef1aa7ded69)
1665      MD5(7704c1148b8761e9ce650ef1aa7ded69)
16661666      SHA1(6705100cd337fffb26ce999302b55fb71557b128) )
16671667     ROM_LOAD ( "to8d-1.rom", 0x32000, 0x2000,
16681668      CRC(926cf0ca)
r1461r1462
17651765
17661766The TO9+ is the direct successor of the T09 as Thomson's high-end
17671767product: desktop look, 512 KB of RAM, integrated floppy drive and
1768modem. Some software integrated in ROM on the TO9 are now supplied on
1768modem. Some software integrated in ROM on the TO9 are now supplied on
17691769floppies.
1770Internally, the TO9+ is based more on TO8 technology than T09
1770Internally, the TO9+ is based more on TO8 technology than T09
17711771(same gate-arrays).
1772It has enhanced communication capabilities by integrating either the
1772It has enhanced communication capabilities by integrating either the
17731773MODEM or the RS232 extension.
17741774It should be compatible with the TO9 and, to some extent, with the TO7, TO7/70
17751775and TO8.
r1461r1462
18001800     AM_RANGE ( 0x0000, 0x3fff ) AM_RAMBANK   ( THOM_CART_BANK ) /* 8 * 16 KB */
18011801                                 AM_WRITE     ( to8_cartridge_w )
18021802     AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK   ( THOM_VRAM_BANK )
1803                                 AM_WRITE     ( to770_vram_w )
1803                                 AM_WRITE     ( to770_vram_w )
18041804     AM_RANGE ( 0x6000, 0x7fff ) AM_RAMBANK   ( TO8_SYS_LO )
18051805                                 AM_WRITE     ( to8_sys_lo_w )
18061806     AM_RANGE ( 0x8000, 0x9fff ) AM_RAMBANK   ( TO8_SYS_HI )
r1461r1462
18161816     AM_RANGE ( 0xe7d0, 0xe7d9 ) AM_READWRITE ( to8_floppy_r, to8_floppy_w )
18171817     AM_RANGE ( 0xe7da, 0xe7dd ) AM_READWRITE ( to8_vreg_r, to8_vreg_w )
18181818     AM_RANGE ( 0xe7de, 0xe7df ) AM_READWRITE ( to9_kbd_r, to9_kbd_w )
1819     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r,
1819     AM_RANGE ( 0xe7e4, 0xe7e7 ) AM_READWRITE ( to8_gatearray_r,
18201820                  to8_gatearray_w )
18211821     AM_RANGE ( 0xe7e8, 0xe7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w )
18221822/*   AM_RANGE ( 0xe7f0, 0xe7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */
18231823     AM_RANGE ( 0xe7f2, 0xe7f3 ) AM_READWRITE ( to7_midi_r, to7_midi_w )
18241824     AM_RANGE ( 0xe7f8, 0xe7fb ) AM_READWRITE ( pia_3_alt_r, pia_3_alt_w )
1825     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
1825     AM_RANGE ( 0xe7fe, 0xe7ff ) AM_READWRITE ( to7_modem_mea8000_r,
18261826                  to7_modem_mea8000_w )
18271827     AM_RANGE ( 0xe800, 0xffff ) AM_ROMBANK   ( TO8_BIOS_BANK ) /* 2 * 6 KB */
18281828
r1461r1462
18541854     /* BASIC */
18551855     ROM_LOAD ( "basicp-0.rom", 0x20000, 0x4000,
18561856      CRC(e5a00fb3)
1857      MD5(6c33e3cd79bd6c675634b172594bbfec)
1857      MD5(6c33e3cd79bd6c675634b172594bbfec)
18581858      SHA1(281e535ed9b0f76e620253e9103292b8ff623d02) )
18591859     ROM_LOAD ( "basicp-1.rom", 0x24000, 0x4000,
18601860      CRC(4b241e63)
r1461r1462
19371937  an MO5-compatible one
19381938
19391939* devices:
1940  - AZERTY keyboard, 69 keys, no keyboard controller (scanning is done
1940  - AZERTY keyboard, 69 keys, no keyboard controller (scanning is done
19411941    periodically by the 6809)
19421942  - MO5-compatible cartridge
19431943  - two-button mouse (TO8-like)
r1461r1462
19611961
19621962Italian version of the MO6, built by Thomson and sold by Olivetti.
19631963Except from the ROM, it is very similar to the MO6.
1964Do not confuse with the Olivetti Prodest PC 128 Systema (or 128s) which is
1964Do not confuse with the Olivetti Prodest PC 128 Systema (or 128s) which is
19651965based on the Acorn BBC Master Compact. Or with the Olivetti PC 1, which is
19661966a PC XT.
19671967
r1461r1462
19711971static ADDRESS_MAP_START ( mo6, ADDRESS_SPACE_PROGRAM, 8 )
19721972
19731973     AM_RANGE ( 0x0000, 0x1fff ) AM_RAMBANK   ( THOM_VRAM_BANK )
1974                                 AM_WRITE     ( to770_vram_w )
1974                                 AM_WRITE     ( to770_vram_w )
19751975     AM_RANGE ( 0x2000, 0x3fff ) AM_RAMBANK   ( TO8_SYS_LO )
19761976                                 AM_WRITE     ( to8_sys_lo_w )
19771977     AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK   ( TO8_SYS_HI )
r1461r1462
19861986     AM_RANGE ( 0xa7cc, 0xa7cf ) AM_READWRITE ( pia_1_alt_r,  pia_1_alt_w )
19871987     AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE ( to7_floppy_r, to7_floppy_w )
19881988     AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE ( mo6_vreg_r, mo6_vreg_w )
1989     AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r,
1989     AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r,
19901990                  mo6_gatearray_w )
19911991     AM_RANGE ( 0xa7e8, 0xa7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w )
19921992/*   AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w )*/
r1461r1462
20942094     PORT_START_TAG ( "keyboard_1" )
20952095     KEY ( 0, "Delete Backspace", DEL )  PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE))
20962096     KEY ( 1, "Insert", INSERT )         PORT_CHAR(UCHAR_MAMEKEY(INSERT))
2097     KEY ( 2, "> <", BACKSLASH2 )        PORT_CHAR('>') PORT_CHAR('<')
2097     KEY ( 2, "> <", BACKSLASH2 )        PORT_CHAR('>') PORT_CHAR('<')
20982098     KEY ( 3, "\xE2\x86\x92", RIGHT )    PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
20992099     KEY ( 4, "\xE2\x86\x93", DOWN )     PORT_CHAR(UCHAR_MAMEKEY(DOWN))
21002100     KEY ( 5, "\xE2\x86\x90", LEFT )     PORT_CHAR(UCHAR_MAMEKEY(LEFT))
r1461r1462
21412141     KEY ( 1, "8 !", 8 )                 PORT_CHAR('8') PORT_CHAR('!')
21422142     KEY ( 2, "9 \303\247", 9 )          PORT_CHAR('9') PORT_CHAR( 0xe7 )
21432143     KEY ( 3, "0 \303\240", 0 )          PORT_CHAR('0') PORT_CHAR( 0xe0 )
2144     KEY ( 4, "- \\", BACKSPACE )        PORT_CHAR('-') PORT_CHAR('\\')
2145     KEY ( 5, "= +", EQUALS )            PORT_CHAR('=') PORT_CHAR('+')
2144     KEY ( 4, "- \\", BACKSPACE )        PORT_CHAR('-') PORT_CHAR('\\')
2145     KEY ( 5, "= +", EQUALS )            PORT_CHAR('=') PORT_CHAR('+')
21462146     KEY ( 6, "Accent", END )            PORT_CHAR(UCHAR_MAMEKEY(END))
21472147     KEY ( 7, "F4 F9", F4 )              PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CHAR(UCHAR_MAMEKEY(F9))
21482148     PORT_START_TAG ( "keyboard_7" )
r1461r1462
22792279* chips:
22802280  - integrated MC 6854 network controller
22812281
2282* memory:
2282* memory:
22832283  - extra 2 KB ROM for the integrated network controller,
22842284    can be masked by the ROM from the external floppy controller
22852285
r1461r1462
22962296static ADDRESS_MAP_START ( mo5nr, ADDRESS_SPACE_PROGRAM, 8 )
22972297
22982298     AM_RANGE ( 0x0000, 0x1fff ) AM_RAMBANK   ( THOM_VRAM_BANK )
2299                                 AM_WRITE     ( to770_vram_w )
2299                                 AM_WRITE     ( to770_vram_w )
23002300     AM_RANGE ( 0x2000, 0x3fff ) AM_RAMBANK   ( TO8_SYS_LO )
23012301                                 AM_WRITE     ( to8_sys_lo_w )
23022302     AM_RANGE ( 0x4000, 0x5fff ) AM_RAMBANK   ( TO8_SYS_HI )
r1461r1462
23122312     AM_RANGE ( 0xa7d0, 0xa7d9 ) AM_READWRITE ( mo5nr_net_r, mo5nr_net_w )
23132313     AM_RANGE ( 0xa7da, 0xa7dd ) AM_READWRITE ( mo6_vreg_r, mo6_vreg_w )
23142314     AM_RANGE ( 0xa7e0, 0xa7e3 ) AM_READWRITE ( mo5nr_prn_r, mo5nr_prn_w )
2315     AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r,
2315     AM_RANGE ( 0xa7e4, 0xa7e7 ) AM_READWRITE ( mo6_gatearray_r,
23162316                  mo6_gatearray_w )
23172317     AM_RANGE ( 0xa7e8, 0xa7eb ) AM_READWRITE ( acia_6551_r, acia_6551_w )
23182318/*   AM_RANGE ( 0xa7f0, 0xa7f7 ) AM_READWRITE ( to9_ieee_r, to9_ieee_w ) */
src/mess/drivers/sym1.c
r1461r1462
9595   PORT_START         /* IN4 */
9696   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEBUG OFF") PORT_CODE(KEYCODE_F6)
9797   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEBUG ON")  PORT_CODE(KEYCODE_F7)
98   
98
9999   PORT_START_TAG("WP")
100100   PORT_DIPNAME(0x01, 0x01, "6532 RAM WP")
101101   PORT_DIPSETTING(0x00, DEF_STR(Off))
src/mess/drivers/cgenie.c
r1461r1462
5555ADDRESS_MAP_END
5656
5757static ADDRESS_MAP_START (cgenie_io, ADDRESS_SPACE_IO, 8)
58   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
58   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
5959   AM_RANGE(0xf8, 0xf8) AM_READWRITE( cgenie_sh_control_port_r, cgenie_sh_control_port_w )
6060   AM_RANGE(0xf9, 0xf9) AM_READWRITE( cgenie_sh_data_port_r, cgenie_sh_data_port_w )
6161   AM_RANGE(0xfa, 0xfa) AM_READWRITE( cgenie_index_r, cgenie_index_w )
r1461r1462
220220   PORT_BIT(0x08, 0x00, IPT_BUTTON2) PORT_NAME("Joy 1 [#]") PORT_CODE(KEYCODE_SLASH_PAD) PORT_CODE(JOYCODE_BUTTON1)
221221   PORT_BIT(0x10, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [2]") PORT_CODE(KEYCODE_2_PAD) PORT_CODE(JOYCODE_BUTTON2)
222222   PORT_BIT(0x20, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [5]") PORT_CODE(KEYCODE_5_PAD) PORT_CODE(JOYCODE_BUTTON5)
223   PORT_BIT(0x40, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [8]") PORT_CODE(KEYCODE_8_PAD)
224   PORT_BIT(0x80, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [0]") PORT_CODE(KEYCODE_0_PAD)
223   PORT_BIT(0x40, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [8]") PORT_CODE(KEYCODE_8_PAD)
224   PORT_BIT(0x80, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [0]") PORT_CODE(KEYCODE_0_PAD)
225225   PORT_START /* IN14 */
226226   PORT_BIT(0x01, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [1]") PORT_CODE(KEYCODE_1_PAD) PORT_CODE(JOYCODE_BUTTON3)
227227   PORT_BIT(0x02, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 1 [4]") PORT_CODE(KEYCODE_4_PAD) PORT_CODE(JOYCODE_BUTTON6)
r1461r1462
229229   PORT_BIT(0x08, 0x00, IPT_BUTTON1) PORT_NAME("Joy 1 [*]") PORT_CODE(KEYCODE_ASTERISK) PORT_CODE(JOYCODE_BUTTON1)
230230   PORT_BIT(0x10, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [3]") PORT_CODE(JOYCODE_BUTTON2)
231231   PORT_BIT(0x20, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [6]") PORT_CODE(JOYCODE_BUTTON5)
232   PORT_BIT(0x40, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [9]")
232   PORT_BIT(0x40, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [9]")
233233   PORT_BIT(0x80, 0x00, IPT_UNKNOWN) PORT_NAME("Joy 2 [#]") PORT_CODE(JOYCODE_BUTTON1)
234234
235235   PORT_START /* IN15 */
r1461r1462
381381   MDRV_INTERLEAVE(4)
382382
383383   MDRV_MACHINE_START( cgenie )
384   
384
385385    /* video hardware */
386386   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
387387   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
r1461r1462
401401   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
402402   MDRV_SOUND_ADD(AY8910, 2000000)
403403   MDRV_SOUND_CONFIG(ay8910_interface)
404   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)   
404   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
405405MACHINE_DRIVER_END
406406
407407/***************************************************************************
src/mess/drivers/pmd85.c
r1461r1462
147147   I/O board
148148   ---------
149149   1xxx11aa   external interfaces connector (K2)
150               
150
151151   0xxx11aa   I/O board interfaces
152152      000111aa   8251 (casette recorder, V24)
153153      010011aa   8255 (GPIO/0, GPIO/1)
src/mess/drivers/abc80.c
r1461r1462
3838   PROM0-2   - Philips Semiconductors N82S129 256x4 TTL Bipolar PROM
3939   PROM3-4   - Philips Semiconductors N82S131 512x4 TTL Bipolar PROM
4040   4116   - Texas Instruments TMS4116-25 16Kx1 Dynamic RAM
41   4045   - Texas Instruments TMS4045-15 1Kx4 General Purpose Static RAM with Multiplexed I/O
42   Z80A   -
43   Z80APIO   -
41   4045   - Texas Instruments TMS4045-15 1Kx4 General Purpose Static RAM with Multiplexed I/O
42   Z80A   -
43   Z80APIO   -
4444   SN76477 - Texas Instruments SN76477N Complex Sound Generator
4545   74S263   - Texas Instruments SN74S263N Row Output Character Generator
4646   MC1488   - Texas Instruments MC1488 Quadruple Line Driver
r1461r1462
5252   CN5      - cassette connector
5353   CN6      - keyboard connector
5454   SW1      - reset switch
55   DIPSW1   -
56   DIPSW2   -
57     
55   DIPSW1   -
56   DIPSW2   -
57
5858*/
5959
6060/*
r1461r1462
122122static const UINT8 abc80_keycodes[7*4][8] =
123123{
124124   // unshift
125   { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 },
126   { 0x39, 0x30, 0x2B, 0x60, 0x3C, 0x71, 0x77, 0x65 },
127   { 0x72, 0x74, 0x79, 0x75, 0x69, 0x6F, 0x70, 0x7D },
128   { 0x7E, 0x0D, 0x61, 0x73, 0x64, 0x66, 0x67, 0x68 },
129   { 0x6A, 0x6B, 0x6C, 0x7C, 0x7B, 0x27, 0x08, 0x7A },
130   { 0x78, 0x63, 0x76, 0x62, 0x6E, 0x6D, 0x2C, 0x2E },
125   { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 },
126   { 0x39, 0x30, 0x2B, 0x60, 0x3C, 0x71, 0x77, 0x65 },
127   { 0x72, 0x74, 0x79, 0x75, 0x69, 0x6F, 0x70, 0x7D },
128   { 0x7E, 0x0D, 0x61, 0x73, 0x64, 0x66, 0x67, 0x68 },
129   { 0x6A, 0x6B, 0x6C, 0x7C, 0x7B, 0x27, 0x08, 0x7A },
130   { 0x78, 0x63, 0x76, 0x62, 0x6E, 0x6D, 0x2C, 0x2E },
131131   { 0x2D, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
132132
133133   // shift
134   { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 },
135   { 0x29, 0x3d, 0x3f, 0x40, 0x3e, 0x51, 0x57, 0x45 },
136   { 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x5d },
137   { 0x5e, 0x0d, 0x41, 0x53, 0x44, 0x46, 0x47, 0x48 },
138   { 0x4a, 0x4b, 0x4c, 0x5c, 0x5b, 0x2a, 0x08, 0x5a },
139   { 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x3b, 0x3a },
140   { 0x5f, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
134   { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 },
135   { 0x29, 0x3d, 0x3f, 0x40, 0x3e, 0x51, 0x57, 0x45 },
136   { 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x5d },
137   { 0x5e, 0x0d, 0x41, 0x53, 0x44, 0x46, 0x47, 0x48 },
138   { 0x4a, 0x4b, 0x4c, 0x5c, 0x5b, 0x2a, 0x08, 0x5a },
139   { 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x3b, 0x3a },
140   { 0x5f, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
141141
142142   // control
143   { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 },
144   { 0x39, 0x30, 0x2b, 0x00, 0x7f, 0x11, 0x17, 0x05 },
145   { 0x12, 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1d },
146   { 0x1e, 0x0d, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08 },
147   { 0x0a, 0x0b, 0x0c, 0x1c, 0x1b, 0x27, 0x08, 0x1a },
148   { 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x2c, 0x2e },
149   { 0x2d, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
143   { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38 },
144   { 0x39, 0x30, 0x2b, 0x00, 0x7f, 0x11, 0x17, 0x05 },
145   { 0x12, 0x14, 0x19, 0x15, 0x09, 0x0f, 0x10, 0x1d },
146   { 0x1e, 0x0d, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08 },
147   { 0x0a, 0x0b, 0x0c, 0x1c, 0x1b, 0x27, 0x08, 0x1a },
148   { 0x18, 0x03, 0x16, 0x02, 0x0e, 0x0d, 0x2c, 0x2e },
149   { 0x2d, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
150150
151151   // control-shift
152   { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 },
153   { 0x29, 0x3d, 0x3f, 0x00, 0x7f, 0x11, 0x17, 0x05 },
154   { 0x12, 0x14, 0x19, 0x15, 0x09, 0x1f, 0x00, 0x1d },
155   { 0x1e, 0x0d, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08 },
156   { 0x0a, 0x1b, 0x1c, 0x1c, 0x1b, 0x2a, 0x08, 0x1a },
157   { 0x18, 0x03, 0x16, 0x02, 0x1e, 0x1d, 0x3b, 0x3a },
152   { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x2f, 0x28 },
153   { 0x29, 0x3d, 0x3f, 0x00, 0x7f, 0x11, 0x17, 0x05 },
154   { 0x12, 0x14, 0x19, 0x15, 0x09, 0x1f, 0x00, 0x1d },
155   { 0x1e, 0x0d, 0x01, 0x13, 0x04, 0x06, 0x07, 0x08 },
156   { 0x0a, 0x1b, 0x1c, 0x1c, 0x1b, 0x2a, 0x08, 0x1a },
157   { 0x18, 0x03, 0x16, 0x02, 0x1e, 0x1d, 0x3b, 0x3a },
158158   { 0x5f, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 }
159159};
160160
r1461r1462
169169   {
170170      table |= 0x01;
171171   }
172   
172
173173   // ctrl
174174   if (readinputport(7) & 0x08)
175175   {
176176      table |= 0x02;
177177   }
178   
178
179179   for (row = 0; row < 7; row++)
180180   {
181181      data = readinputport(row);
r1461r1462
191191               keycode = abc80_keycodes[row + (table * 7)][col];
192192            }
193193            ibit <<= 1;
194         }         
194         }
195195      }
196196   }
197   
197
198198   if (keycode != 0)
199199   {
200200      keylatch = keycode;
r1461r1462
345345   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
346346   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("UPPER CASE") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
347347   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
348   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )   
349   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )   
350   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )   
351   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )   
348   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
349   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
350   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
351   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
352352INPUT_PORTS_END
353353
354354/* Graphics Layout */
r1461r1462
415415   7  R   Keyboard Strobe
416416
417417   PIO Channel B
418   
418
419419   0  R   RS-232C RxD
420420   1  R   RS-232C _CTS
421421   2  R   RS-232C _DCD
r1461r1462
448448/* Machine Drivers */
449449
450450static MACHINE_DRIVER_START( abc80 )
451   
451
452452   // basic machine hardware
453453
454454   MDRV_CPU_ADD(Z80, ABC80_XTAL/2/2)   // 2.9952 MHz
src/mess/drivers/x68k.c
r1461r1462
8888
8989   RTC : Seems to work. (Tested using SX-Windows' Timer application)
9090
91   DMA : FDD reading mostly works, other channels should work for effective memory copying (channel 2, often
91   DMA : FDD reading mostly works, other channels should work for effective memory copying (channel 2, often
9292         used to copy data to video RAM or the palette in the background).
9393
9494   Sound : FM works, ADPCM is unimplemented as yet.
r1461r1462
100100         BG tiles and sprites work, but many games have the sprites offset by a small amount (some by a lot :))
101101
102102   Other issues:
103     Bus error exceptions are a bit late at times.  Currently using a fake bus error for MIDI expansion checks.  These
103     Bus error exceptions are a bit late at times.  Currently using a fake bus error for MIDI expansion checks.  These
104104     are used determine if a piece of expansion hardware is present.
105105     Partial updates don't work at all well, and can be excruciatingly slow.
106106     Keyboard doesn't work well for games.
r1461r1462
155155
156156extern mame_bitmap* x68k_text_bitmap;  // 1024x1024 4x1bpp planes text
157157extern mame_bitmap* x68k_gfx_0_bitmap_16;  // 16 colour, 512x512, 4 pages
158extern mame_bitmap* x68k_gfx_1_bitmap_16;
159extern mame_bitmap* x68k_gfx_2_bitmap_16;
160extern mame_bitmap* x68k_gfx_3_bitmap_16;
158extern mame_bitmap* x68k_gfx_1_bitmap_16;
159extern mame_bitmap* x68k_gfx_2_bitmap_16;
160extern mame_bitmap* x68k_gfx_3_bitmap_16;
161161extern mame_bitmap* x68k_gfx_0_bitmap_256;  // 256 colour, 512x512, 2 pages
162extern mame_bitmap* x68k_gfx_1_bitmap_256;
162extern mame_bitmap* x68k_gfx_1_bitmap_256;
163163extern mame_bitmap* x68k_gfx_0_bitmap_65536;  // 65536 colour, 512x512, 1 page
164164
165165extern tilemap* x68k_bg0_8;  // two 64x64 tilemaps, 8x8 characters
r1461r1462
357357   /* Keyboard control commands:
358358       00xxxxxx - TV Control
359359                 Not of much use as yet
360     
360
361361      01000xxy - y = Mouse control signal
362     
362
363363      01001xxy - y = Keyboard enable
364     
364
365365      010100xy - y = Sharp X1 display compatibility mode
366     
366
367367      010101xx - xx = LED brightness (00 = bright, 11 = dark)
368     
368
369369      010110xy - y = Display control enable
370     
371      010111xy - y = Display control via the Opt. 2 key enable
372     
370
371      010111xy - y = Display control via the Opt. 2 key enable
372
373373      0110xxxx - xxxx = Key delay (default 500ms)
374374                        100 * (delay time) + 200ms
375     
375
376376      0111xxxx - xxxx = Key repeat rate  (default 110ms)
377377                        (repeat rate)^2*5 + 30ms
378                   
378
379379      1xxxxxxx - xxxxxxx = keyboard LED status
380380                 b6 = "full size"
381381              b5 = hiragana
r1461r1462
428428   ret = sys.keyboard.buffer[sys.keyboard.tailpos++];
429429   if(sys.keyboard.tailpos > 15)
430430      sys.keyboard.tailpos = 0;
431   
431
432432   logerror("MFP: Keyboard buffer pop 0x%02x\n",ret);
433433   return ret;
434434}
r1461r1462
459459   int x;
460460   int port = port_tag_to_index("key1");
461461
462   for(x=0;x<0x80;x++) 
463   {   
462   for(x=0;x<0x80;x++)
463   {
464464      // adjust delay/repeat timers
465465      if(sys.keyboard.keytime[x] > 0)
466466      {
r1461r1462
521521{
522522   char val = 0;
523523   char ipt = 0;
524   
524
525525   switch(sys.mouse.inputtype)
526526   {
527527   case 0:
r1461r1462
937937READ16_HANDLER( x68k_mfp_r )
938938{
939939   int ret;
940   // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full,
940   // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full,
941941   // MFP Timer C, and the power switch
942942//   logerror("MFP: [%08x] Reading offset %i\n",activecpu_get_pc(),offset);
943943   switch(offset)
r1461r1462
988988      return sys.mfp.rsr;
989989   case 22:  // TSR
990990      return sys.mfp.tsr | 0x80;  // buffer is typically empty?
991   case 23:
991   case 23:
992992      return x68k_keyboard_pop_scancode();
993993   default:
994994//      logerror("MFP: [%08x] Offset %i read\n",activecpu_get_pc(),offset);
r1461r1462
11701170}
11711171
11721172static READ16_HANDLER( x68k_sram_r )
1173{ 
1173{
11741174   // HACKS!
11751175   if(offset == 0x5a/2)  // 0x5a should be 0 if no SASI HDs are present.
11761176      return 0x0000;
r1461r1462
12821282   int val = param;
12831283
12841284   // rather hacky, but this generally works for programs that check for MIDI hardware
1285   if(mess_ram[0x09] != 0x02)  // normal vector for bus errors points to 02FF0540
1285   if(mess_ram[0x09] != 0x02)  // normal vector for bus errors points to 02FF0540
12861286   {
12871287      int addr = (mess_ram[0x09] << 24) | (mess_ram[0x08] << 16) |(mess_ram[0x0b] << 8) | mess_ram[0x0a];
12881288      int sp = cpunum_get_reg(0,REG_SP);
r1461r1462
13071307
13081308static READ16_HANDLER( x68k_rom0_r )
13091309{
1310   /* this location contains the address of some expansion device ROM, if no ROM exists,
1310   /* this location contains the address of some expansion device ROM, if no ROM exists,
13111311      then access causes a bus error */
13121312   current_vector[2] = 0x02;  // bus error
13131313   current_irq_line = 2;
r1461r1462
13171317
13181318static WRITE16_HANDLER( x68k_rom0_w )
13191319{
1320   /* this location contains the address of some expansion device ROM, if no ROM exists,
1320   /* this location contains the address of some expansion device ROM, if no ROM exists,
13211321      then access causes a bus error */
13221322   current_vector[2] = 0x02;  // bus error
13231323   current_irq_line = 2;
r1461r1462
13911391   {
13921392      sys.mfp.gpio &= ~0x08;
13931393   }
1394   
1394
13951395}
13961396
13971397static READ8_HANDLER(mfp_gpio_r)
13981398{
13991399   UINT8 data = sys.mfp.gpio;
1400   
1400
14011401   data &= ~(sys.crtc.hblank << 7);
14021402   data &= ~(sys.crtc.vblank << 4);
14031403   data |= 0x23;  // GPIP5 is unused, always 1
r1461r1462
15641564   NULL//x68k_scc_ack
15651565};
15661566
1567static const struct rp5c15_interface rtc_intf =
1567static const struct rp5c15_interface rtc_intf =
15681568{
15691569   x68k_rtc_alarm_irq
15701570};
r1461r1462
17311731INPUT_PORTS_END
17321732
17331733static void dimdsk_set_geometry(mess_image* image)
1734{ 
1734{
17351735   // DIM disk image header, most of this is guesswork
17361736   int tracks = 77;
17371737   int heads = 2;
r1461r1462
17511751    * 17 = N88-BASIC (26 sector/track, 256 bytes/sector, GAP#3 = 0x33)
17521752    *             or (26 sector/track, 128 bytes/sector, GAP#3 = 0x1a)
17531753    */
1754   image_fread(image,&format,1); 
1754   image_fread(image,&format,1);
17551755
17561756   switch(format)
17571757   {
r1461r1462
17781778      break;
17791779   }
17801780   tracks = 0;
1781   for (x=0;x<86;x++) 
1781   for (x=0;x<86;x++)
17821782   {
17831783      image_fread(image,&temp,2);
17841784      if(temp == 0x0101)
r1461r1462
18341834   case DEVINFO_INT_COUNT:
18351835      info->i = 4;
18361836      break;
1837   case DEVINFO_PTR_LOAD:                     
1838      info->load = device_load_x68k_floppy;
1837   case DEVINFO_PTR_LOAD:
1838      info->load = device_load_x68k_floppy;
18391839      break;
18401840   case DEVINFO_PTR_UNLOAD:
18411841      info->unload = device_unload_x68k_floppy;
18421842      break;
1843   case DEVINFO_STR_FILE_EXTENSIONS:           
1844      strcpy(info->s = device_temp_str(), "xdf,hdm,2hd,dim");
1843   case DEVINFO_STR_FILE_EXTENSIONS:
1844      strcpy(info->s = device_temp_str(), "xdf,hdm,2hd,dim");
18451845      break;
18461846   default:
1847      legacybasicdsk_device_getinfo(devclass, state, info);
1847      legacybasicdsk_device_getinfo(devclass, state, info);
18481848      break;
18491849   }
18501850}
r1461r1462
18631863   memcpy(mess_ram,romdata,8);
18641864
18651865   // init keyboard
1866   sys.keyboard.delay = 500;  // 3*100+200
1866   sys.keyboard.delay = 500;  // 3*100+200
18671867   sys.keyboard.repeat = 110;  // 4^2*5+30
18681868
18691869   // check for disks
r1461r1462
18951895   sys.crtc.vblank = 1;
18961896   irq_time = video_screen_get_time_until_pos(0,sys.crtc.reg[6],2);
18971897   timer_adjust(vblank_irq,irq_time,0,attotime_never);
1898   
1898
18991899   // start HBlank timer
19001900   timer_adjust(scanline_timer,video_screen_get_scan_period(0),1,attotime_never);
19011901
r1461r1462
19651965   cpunum_set_irq_callback(0, x68k_int_ack);
19661966
19671967   // init keyboard
1968   sys.keyboard.delay = 500;  // 3*100+200
1968   sys.keyboard.delay = 500;  // 3*100+200
19691969   sys.keyboard.repeat = 110;  // 4^2*5+30
19701970   kb_timer = timer_alloc(x68k_keyboard_poll,NULL);
19711971   scanline_timer = timer_alloc(x68k_hsync,NULL);
r1461r1462
20352035   ROM_SYSTEM_BIOS(0, "ipl10",  "IPL-ROM V1.0")
20362036   ROMX_LOAD( "iplrom.dat", 0xfe0000, 0x20000, CRC(72bdf532) SHA1(0ed038ed2133b9f78c6e37256807424e0d927560), ROM_BIOS(1) )
20372037   ROM_SYSTEM_BIOS(1, "ipl11",  "IPL-ROM V1.1")
2038   ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) )
2038   ROMX_LOAD( "iplromxv.dat", 0xfe0000, 0x020000, CRC(00eeb408) SHA1(e33cdcdb69cd257b0b211ef46e7a8b144637db57), ROM_BIOS(2) )
20392039   ROM_SYSTEM_BIOS(2, "ipl12",  "IPL-ROM V1.2")
20402040   ROMX_LOAD( "iplromco.dat", 0xfe0000, 0x020000, CRC(6c7ef608) SHA1(77511fc58798404701f66b6bbc9cbde06596eba7), ROM_BIOS(3) )
20412041   ROM_SYSTEM_BIOS(3, "ipl13",  "IPL-ROM V1.3 (92/11/27)")
r1461r1462
20432043   ROM_REGION(0x8000, REGION_USER1,0)  // For Background/Sprite decoding
20442044   ROM_FILL(0x0000,0x8000,0x00)
20452045   ROM_REGION(0x20000, REGION_USER2, 0)
2046   ROM_FILL(0x000,0x20000,0x00) 
2046   ROM_FILL(0x000,0x20000,0x00)
20472047ROM_END
20482048
20492049
src/mess/drivers/spectrum.c
r1461r1462
8282              Fixed problem with interrupt vector set to 0xffff (much
8383         more 128k games works now).
8484            A useful used trick on the Spectrum is to set
85            interrupt vector to 0xffff (using the table
85            interrupt vector to 0xffff (using the table
8686            which contain 0xff's) and put a byte 0x18 hex,
8787            the opcode for JR, at this address. The first
8888            byte of the ROM is a 0xf3 (DI), so the JR will
r1461r1462
9696            There are 50.08 frames per second for Spectrum
9797            48k what gives 69888 cycles for each frame and
9898            50.021 for Spectrum 128/+2/+2A/+3 what gives
99            70908 cycles for each frame.
99            70908 cycles for each frame.
100100         Remaped some Spectrum+ keys.
101101            Presing F3 to reset was seting 0xf7 on keyboard
102102            input port. Problem occured for snapshots of
r1461r1462
772772
773773      /* the following is not decoded exactly, need to check
774774      what is correct! */
775     
775
776776      if ((offset & 2)==0)
777777      {
778778         switch ((offset>>14) & 0x03)
r1461r1462
794794                  case 1:
795795                     spectrum_plus3_port_1ffd_w(offset, data);
796796                     break;
797                     
797
798798                  /* +3 fdc data */
799799                  case 3:
800800                     spectrum_plus3_port_3ffd_w(offset,data);
r1461r1462
819819            /* 128K AY register */
820820            case 3:
821821               spectrum_128_port_fffd_w(offset, data);
822         
822
823823            default:
824824               break;
825825         }
r1461r1462
20112011   /* sound hardware */
20122012   MDRV_SOUND_ADD(AY8910, 1773400)
20132013   MDRV_SOUND_CONFIG(spectrum_ay_interface)
2014   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)   
2014   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
20152015MACHINE_DRIVER_END
20162016
20172017
src/mess/drivers/mpf1.c
r1461r1462
173173       (contains possible typing/printing errors so I've cited it litteraly)
174174
175175    * D. Input/Output port addressing
176    *   
176    *
177177    *    U96 (74LS139) is an I/O port decoder.
178    *   
178    *
179179    *           IORQ    A7  A6   Selected I/O    Port Address
180    *           
180    *
181181    *            0      0   0       8255          00 - 03
182    *           
182    *
183183    *            0      0   1       CTC           40 - 43
184    *           
184    *
185185    *            0      1   0       PIO           80 - 83
186    *           
186    *
187187    *      Note; I/O port is not fully decoded, e.g. the 16 combinations
188188    *            00 - 03,  04 - 07, 08 - 0B,.....3C - 3F, all select the s
189189    *            8255.  The CTC & PIO are also selected by 16 different
190190    *            combinations.
191   
191
192192       Where the text states ".... , all select the s ...." it probably means
193193       "... ., all select the same ....".
194       
194
195195       So to asure that this "incompleteness" of the hardware does also exist in
196196       this simulator I've expanded the port assignments accordingly. I've also
197197       tested wether this is true for the actual hardware, and it is.
198198    */
199199   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
200   
200
201201   // The 16 I/O port combinations for the 8255 (P8255A-5, 8628LLP, (c) 1981 AMD)
202202   AM_RANGE(0x00, 0x03) AM_READWRITE(ppi8255_0_r, ppi8255_0_w) AM_MIRROR(0x3C)
203203
r1461r1462
374374   logerror("pio irq state: %02x\n",state);
375375}
376376
377static const z80pio_interface pio_intf =
377static const z80pio_interface pio_intf =
378378{
379379   mpf1_pio_interrupt,
380380   NULL,
r1461r1462
445445      F   0x04
446446      G   0x02
447447      H   0x40 (represented by P in original schematics) */
448     
448
449449   /*  Original bit to leddisplay-segment assignment:
450450      (and as such what is written as output to this port)
451451      bit      7 6 5 4 3 2 1 0
r1461r1462
494494   // TONE led & speaker
495495   led_tone = (~data & 0x80) >> 7;
496496   set_led_status(0, led_tone);
497   
497
498498   // speaker
499499   DAC_data_w(0, 0xFF * led_tone);
500500
src/mess/drivers/super80.c
r1461r1462
177177
178178static INPUT_PORTS_START( super80 )
179179   PORT_START   /* line 0 */
180   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE)
181   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
182   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
183   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
184   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
185   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
186   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE)
187   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT)
180   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE)
181   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
182   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
183   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
184   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
185   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
186   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE)
187   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPT") PORT_CODE(KEYCODE_LALT)
188188   PORT_START   /* line 1 */
189   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
190   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
191   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
192   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
193   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
194   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE)
195   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE)
196   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT)
189   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
190   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
191   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
192   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
193   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
194   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE)
195   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE)
196   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT)
197197   PORT_START   /* line 2 */
198   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
199   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
200   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
201   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
202   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
203   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)
204   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB)
198   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
199   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
200   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
201   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
202   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
203   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)
204   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB)
205205   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
206206   PORT_START   /* line 3 */
207   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
208   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
209   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
210   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
211   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
212   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
213   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD)
214   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL)
207   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
208   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
209   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
210   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
211   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
212   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
213   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINEFEED") PORT_CODE(KEYCODE_ENTER_PAD)
214   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL)
215215   PORT_START   /* line 4 */
216   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
217   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
218   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
219   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\")PORT_CODE(KEYCODE_BACKSLASH)
220   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
221   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK)
222   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER)
216   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
217   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
218   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
219   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\")PORT_CODE(KEYCODE_BACKSLASH)
220   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
221   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BRK") PORT_CODE(KEYCODE_NUMLOCK)
222   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER)
223223   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
224224   PORT_START   /* line 5 */
225   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
226   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
227   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
228   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
229   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
230   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
231   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC)
225   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
226   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
227   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
228   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE)
229   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
230   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
231   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC)
232232   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
233233   PORT_START   /* line 6 */
234   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
235   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
236   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
237   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS)
238   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
239   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
240   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL)
234   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
235   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
236   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
237   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS)
238   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
239   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
240   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL)
241241   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
242242   PORT_START   /* line 7 */
243   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
244   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
245   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
246   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
247   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
248   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
249   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK)
243   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
244   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
245   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
246   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
247   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
248   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
249   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LOCK") PORT_CODE(KEYCODE_CAPSLOCK)
250250   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
251251INPUT_PORTS_END
252252
src/mess/drivers/atarist.c
r1461r1462
227227      fdc.dmabase = data & 0xff;
228228      break;
229229   }
230   
230
231231   fdc.dmabytes = ATARIST_FLOPPY_BYTES_PER_SECTOR;
232232}
233233
r1461r1462
268268static READ8_HANDLER( ikbd_port1_r )
269269{
270270   /*
271     
271
272272      bit      description
273     
273
274274      0      Keyboard column input
275275      1      Keyboard column input
276276      2      Keyboard column input
r1461r1462
288288static READ8_HANDLER( ikbd_port2_r )
289289{
290290   /*
291     
291
292292      bit      description
293     
293
294294      0      JOY 1-5
295295      1      JOY 0-6
296296      2      JOY 1-6
r1461r1462
305305static WRITE8_HANDLER( ikbd_port2_w )
306306{
307307   /*
308     
308
309309      bit      description
310     
310
311311      0      JOY 1-5
312312      1      JOY 0-6
313313      2      JOY 1-6
r1461r1462
322322static WRITE8_HANDLER( ikbd_port3_w )
323323{
324324   /*
325     
325
326326      bit      description
327     
327
328328      0      CAPS LOCK LED
329329      1      Keyboard row select
330330      2      Keyboard row select
r1461r1462
350350static READ8_HANDLER( ikbd_port4_r )
351351{
352352   /*
353     
353
354354      bit      description
355     
355
356356      0      JOY 0-1 or mouse XB
357357      1      JOY 0-2 or mouse XA
358358      2      JOY 0-3 or mouse YA
r1461r1462
391391      {
392392         ikbd.mouse_px = IKBD_MOUSE_PHASE_NEGATIVE;
393393      }
394     
394
395395      if (y == ikbd.mouse_y)
396396      {
397397         ikbd.mouse_py = IKBD_MOUSE_PHASE_STATIC;
r1461r1462
431431static WRITE8_HANDLER( ikbd_port4_w )
432432{
433433   /*
434     
434
435435      bit      description
436     
436
437437      0      Keyboard row select
438438      1      Keyboard row select
439439      2      Keyboard row select
r1461r1462
506506         }
507507      }
508508   }
509   
509
510510   if (dmasound.ctrl & 0x80)
511511   {
512512//      logerror("DMA sound left  %i\n", dmasound.fifo[7 - dmasound.samples]);
r1461r1462
772772static READ16_HANDLER( stbook_config_r )
773773{
774774   /*
775     
775
776776      bit      description
777     
777
778778      0      _POWER_SWITCH
779779      1      _TOP_CLOSED
780780      2      _RTC_ALARM
r1461r1462
800800static WRITE16_HANDLER( stbook_lcd_control_w )
801801{
802802   /*
803     
803
804804      bit      description
805     
805
806806      0      Shadow Chip OFF
807807      1      _SHIFTER OFF
808808      2      POWEROFF
r1461r1462
10641064   PORT_START_TAG("P32")
10651065   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_NAME("F1")
10661066   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
1067   PORT_BIT( 0xde, IP_ACTIVE_LOW, IPT_UNUSED )
1067   PORT_BIT( 0xde, IP_ACTIVE_LOW, IPT_UNUSED )
10681068
10691069   PORT_START_TAG("P33")
10701070   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_NAME("F2")
r1461r1462
10831083   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t')
10841084   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
10851085   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
1086   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
1086   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
10871087   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
10881088
10891089   PORT_START_TAG("P36")
r1461r1462
11291129   PORT_START_TAG("P42")
11301130   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_NAME("F9")
11311131   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=')
1132   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
1132   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
11331133   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
11341134   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
11351135   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
1136   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
1136   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
11371137   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
11381138
11391139   PORT_START_TAG("P43")
11401140   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_NAME("F10")
11411141   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00B4) PORT_CHAR('`')
1142   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
1143   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
1144   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
1145   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
1146   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
1142   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
1143   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
1144   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
1145   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
1146   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
11471147   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
11481148
11491149   PORT_START_TAG("P44")
r1461r1462
11511151   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
11521152   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_DEL)
11531153   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT)
1154   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
1154   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
11551155   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
1156   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
1156   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
11571157   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_')
11581158
11591159   PORT_START_TAG("P45")
r1461r1462
12141214   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
12151215
12161216   PORT_START_TAG("IKBD_MOUSEX")
1217   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)   
1217   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)
12181218
12191219   PORT_START_TAG("IKBD_MOUSEY")
1220   PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)   
1220   PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)
12211221INPUT_PORTS_END
12221222
12231223static INPUT_PORTS_START( atariste )
r1461r1462
12991299   {
13001300      wd17xx_set_drive(0);
13011301   }
1302   
1302
13031303   if (!(data & 0x04))
13041304   {
13051305      wd17xx_set_drive(1);
r1461r1462
13661366   /*
13671367
13681368      bit      description
1369     
1369
13701370      0      Centronics BUSY
13711371      1      RS232 DCD
13721372      2      RS232 CTS
r1461r1462
15101510   cpunum_set_irq_callback(0, atarist_int_ack);
15111511}
15121512
1513static const struct rp5c15_interface rtc_intf =
1513static const struct rp5c15_interface rtc_intf =
15141514{
15151515   NULL
15161516};
r1461r1462
15261526   /*
15271527
15281528      bit      description
1529     
1529
15301530      0      Centronics BUSY
15311531      1      RS232 DCD
15321532      2      RS232 CTS
r1461r1462
16421642   {
16431643      wd17xx_set_drive(0);
16441644   }
1645   
1645
16461646   if (!(data & 0x04))
16471647   {
16481648      wd17xx_set_drive(1);
r1461r1462
16841684   /*
16851685
16861686      bit      description
1687     
1687
16881688      0      Centronics BUSY
16891689      1      RS232 DCD
16901690      2      RS232 CTS
r1461r1462
17611761   MDRV_SPEAKER_STANDARD_MONO("mono")
17621762   MDRV_SOUND_ADD(YM2149, Y2/16)
17631763   MDRV_SOUND_CONFIG(ym2149_interface)
1764   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)   
1764   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
17651765MACHINE_DRIVER_END
17661766
17671767static MACHINE_DRIVER_START( megast )
r1461r1462
18411841   MDRV_SPEAKER_STANDARD_MONO("mono")
18421842   MDRV_SOUND_ADD(YM3439, U517/8)
18431843   MDRV_SOUND_CONFIG(stbook_ym2149_interface)
1844   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)   
1844   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
18451845MACHINE_DRIVER_END
18461846
18471847/* ROMs */
r1461r1462
19981998         int sectors = bootsector[0x18];
19991999         int heads = bootsector[0x1a];
20002000         int tracks = (bootsector[0x13] | (bootsector[0x14] << 8)) / sectors / heads;
2001   
2001
20022002         /* drive, tracks, heads, sectors per track, sector length, first sector id, offset track zero, track skipping */
20032003         basicdsk_set_geometry(image, tracks, heads, sectors, 512, 1, 0, FALSE);
20042004
r1461r1462
21852185   CONFIG_DEVICE(megaste_serial_getinfo)
21862186   CONFIG_DEVICE(atarist_cartslot_getinfo)
21872187   // MIDI
2188   // IDE Hard Disk
2188   // IDE Hard Disk
21892189SYSTEM_CONFIG_END
21902190
21912191/* System Drivers */
src/mess/drivers/geneve.c
r1461r1462
9898   address pointer is incremented when the read data and write data ports
9999   are accessed, and when the second byte of the GPL address is written.  A
100100   weird consequence of this is the fact that GPL data is always off by one
101   byte, i.e. GPL bytes 0, 1, 2... are stored in bytes 1, 2, 3... of pages
101   byte, i.e. GPL bytes 0, 1, 2... are stored in bytes 1, 2, 3... of pages
102102   >38->3f (byte 0 of page >38 corresponds to GPL address >ffff).
103103
104104   I think that I have once read that the geneve GROM emulator does not
r1461r1462
464464
465465   MDRV_MACHINE_START( geneve )
466466        MDRV_MACHINE_RESET( geneve )
467       
467
468468   /* video hardware */
469469   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
470470   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mess/drivers/sg1000.c
r1461r1462
154154   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
155155   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
156156   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
157   
157
158158   PORT_START_TAG("PB7")
159159   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
160160   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
r1461r1462
423423      PA0      INT from FDC
424424      PA1      BUSY from Centronics printer
425425      PA2      INDEX from FDD
426      PA3     
427      PA4     
428      PA5     
429      PA6     
430      PA7     
426      PA3
427      PA4
428      PA5
429      PA6
430      PA7
431431   */
432432
433433   int centronics_handshake = centronics_read_handshake(1);
434434   int busy = 0;
435   
435
436436   if ((centronics_handshake & CENTRONICS_NOT_BUSY) == 0)
437437   {
438438      busy = 0x02;
r1461r1462
476476
477477   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), (data & 0x02) ? 0 : 1);
478478   floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0);
479   
479
480480   nec765_set_tc_state(data & 0x04);
481481
482482   if (data & 0x08)
r1461r1462
801801      {
802802         /* image, tracks, sides, sectors per track, sector length, first sector id, offset of track 0, track skipping */
803803         basicdsk_set_geometry(image, 40, 1, 16, 256, 1, 0, FALSE);
804         
804
805805         return INIT_PASS;
806806      }
807807   }
src/mess/drivers/ip22.c
r1461r1462
2929*      linux-2.6.6/include/asm-mips/sgi/hpc3.h
3030*    NetBSD: http://www.netbsd.org/
3131*    gxemul: http://gavare.se/gxemul/
32*
32*
3333* Gentoo LiveCD r5 boot instructions:
3434*     mess -cdrom gentoor5.chd ip225015
35*     enter the command interpreter and type "sashARCS".  press enter and
35*     enter the command interpreter and type "sashARCS".  press enter and
3636*     it'll autoboot.
3737*
3838* IRIX boot instructions:
r1461r1462
13441344         {
13451345            UINT32 wptr, tmpword;
13461346            int words, sptr, twords;
1347     
1347
13481348            words = wd33c93_get_dma_count();
13491349            words /= 4;
13501350
r1461r1462
13701370                  {
13711371                     tmpword = dma_buffer[sptr]<<24 | dma_buffer[sptr+1]<<16 | dma_buffer[sptr+2]<<8 | dma_buffer[sptr+3];
13721372                  }
1373               
1373
13741374                  program_write_dword(wptr, tmpword);
13751375                  wptr += 4;
13761376                  sptr += 4;
r1461r1462
14261426static const SCSIConfigTable dev_table =
14271427{
14281428        1,                                      /* 1 SCSI device */
1429        { { SCSI_ID_4, 0, SCSI_DEVICE_CDROM },  /* SCSI ID 4, using CD 0, and it's a CD-ROM */
1430     { SCSI_ID_2, 0, SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */
1429        { { SCSI_ID_4, 0, SCSI_DEVICE_CDROM },  /* SCSI ID 4, using CD 0, and it's a CD-ROM */
1430     { SCSI_ID_2, 0, SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */
14311431};
14321432
14331433static const struct WD33C93interface scsi_intf =
src/mess/drivers/lviv.c
r1461r1462
3030
3131Notes on emulation status and to do list:
3232-----------------------------------------
331. LIMITATION: Printer is not emulated.
331. LIMITATION: Printer is not emulated.
34342. LIMITATION: Timings are not implemented, due to it emulated machine runs
3535   twice fast as orginal.
36363. LIMITATION: .RSS files are not supported.
r1461r1462
104104---------
105105   Reset - connected to CPU reset line
106106
107                 Port D0             
108   --------T-------T-------T-------T-------T-------T-------T-------¬       
109   |   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
107                 Port D0
108   --------T-------T-------T-------T-------T-------T-------T-------¬
109   |   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
110110   +-------+-------+-------+-------+-------+-------+-------+-------+---¬
111111   | Shift |   ;   |       |  CLS  | Space |   R   |   G   |   6   | 0 |
112112   +-------+-------+-------+-------+-------+-------+-------+-------+---+
src/mess/drivers/exidy.c
r1461r1462
99   ========
1010   input/output:
1111      hd6402 uart data
12   
12
1313   port fd:
1414   ========
15   input: hd6402 uart status
15   input: hd6402 uart status
1616      bit 4: parity error (RPE)
1717      bit 3: framing error (RFE)
1818      bit 2: over-run (RDP)
1919      bit 1: data available (RDA)
2020      bit 0: transmit buffer empty (TPMT)
2121
22   output:
22   output:
2323      bit 4: no parity (NPB)
2424      bit 3: parity type (POE)
2525      bit 2: number of stop bits (NSB)
r1461r1462
3535      bit 6: baud rate (1=1200, 0=300)
3636      bit 5: cassette motor 2
3737      bit 4: cassette motor 1
38      bit 3..0: keyboard line select
38      bit 3..0: keyboard line select
3939
4040   input:
4141      bit 7..6: parallel control (not emulated)
r1461r1462
5454   interface hardware.
5555
5656   The cassette interface hardware converts square-wave pulses into bits which the uart receives.
57   
58   
57
58
5959   Sound:
60   
60
6161   external speaker connected to the parallel port
6262   speaker is connected to all pins. All pins need to be toggled at the same time.
6363
64     
64
6565   Kevin Thacker [MESS driver]
6666
6767 ******************************************************************************
r1461r1462
156156static int cassette_clock_counter;
157157
158158/*   1. the cassette format: "frequency shift" is converted
159   into the uart data format "non-return to zero"
160   
159   into the uart data format "non-return to zero"
160
161161   2. on cassette a 1 data bit is stored as a high frequency
162   and a 0 data bit as a low frequency
162   and a 0 data bit as a low frequency
163163   - At 1200 baud, a logic 1 is 1 cycle of 1200hz and a logic 0 is 1/2 cycle of 600hz.
164164   - At 300 baud, a logic 1 is 8 cycles of 2400hz and a logic 0 is 4 cycles of 1200hz.
165165
r1461r1462
189189      /* previously was 0, now gone 1 */
190190      /* +ve edge detected */
191191      if (cassette_clock_state)
192      {         
192      {
193193         int bit;
194194
195195         /* clock bits into cassette flip flops */
r1461r1462
275275
276276   serial_connection_init(&cassette_serial_connection);
277277   serial_connection_set_in_callback(&cassette_serial_connection, cassette_serial_in);
278   
278
279279   exidy_fe_port_w(0,0);
280280
281281   timer_set(attotime_zero, NULL, 0, exidy_reset_timer_callback);
282   
282
283283   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
284284
285285   /* this is temporary. Normally when a Z80 is reset, it will
286286   execute address 0. The exidy starts executing from 0x0e000 */
287287//   memory_set_opbase_handler(0, exidy_opbaseoverride);
288   
288
289289//   cpunum_write_byte(0,0,0x0c3);
290290//   cpunum_write_byte(0,1,0x000);
291291//   cpunum_write_byte(0,2,0x0e0);
r1461r1462
304304
305305   serial_connection_init(&cassette_serial_connection);
306306   serial_connection_set_in_callback(&cassette_serial_connection, cassette_serial_in);
307   
307
308308   exidy_fe_port_w(0,0);
309309
310310   timer_set(attotime_zero, NULL, 0, exidy_reset_timer_callback);
311   
311
312312   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
313313}
314314
r1461r1462
360360   AM_RANGE(0xbe00, 0xbe03) AM_READWRITE(exidy_wd179x_r, exidy_wd179x_w)
361361
362362   AM_RANGE(0xc000, 0xefff) AM_ROM      /* rom pac */
363   AM_RANGE(0xf000, 0xf7ff) AM_RAM      /* screen ram */   
363   AM_RANGE(0xf000, 0xf7ff) AM_RAM      /* screen ram */
364364   AM_RANGE(0xf800, 0xfbff) AM_ROM      /* char rom */
365365   AM_RANGE(0xfc00, 0xffff) AM_RAM      /* programmable chars */
366366ADDRESS_MAP_END
r1461r1462
369369   ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
370370   AM_RANGE(0x0000, 0xbfff) AM_RAM      /* ram 48k diskless machine */
371371   AM_RANGE(0xc000, 0xefff) AM_ROM      /* rom pac */
372   AM_RANGE(0xf000, 0xf7ff) AM_RAM      /* screen ram */   
372   AM_RANGE(0xf000, 0xf7ff) AM_RAM      /* screen ram */
373373   AM_RANGE(0xf800, 0xfbff) AM_ROM      /* char rom */
374374   AM_RANGE(0xfc00, 0xffff) AM_RAM      /* programmable chars */
375375ADDRESS_MAP_END
r1461r1462
493493      instead of mark (-9v). Fixed in Sorcerer II.
494494      2. When you select a different baud for rs232, it was "remembered" but not
495495      sent to port fe. It only gets sent when motor on was requested. Motor on is
496      only meaningful in a cassette operation.
496      only meaningful in a cassette operation.
497497      3. The monitor software always resets the device to cassette whenever the
498498      keyboard is scanned, motors altered, or an error occurred.
499499      4. The above problems make rs232 communication impractical unless you write
r1461r1462
638638   This fixes those games that use a joystick. */
639639
640640   UINT8 data=0x7f;
641   
641
642642   /* bit 7 = printer busy
643643   0 = printer is not busy */
644644
r1461r1462
652652
653653
654654static ADDRESS_MAP_START( exidy_io , ADDRESS_SPACE_IO, 8)
655   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
655   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
656656   ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
657657   AM_RANGE(0xfc, 0xfc) AM_READWRITE( exidy_fc_port_r, exidy_fc_port_w )
658658   AM_RANGE(0xfd, 0xfd) AM_READWRITE( exidy_fd_port_r, exidy_fd_port_w )
r1461r1462
851851//   ROM_LOAD_OPTIONAL("exsb1-1.dat", 0x0c000, 0x0800, CRC(1dd20d80) SHA1(dd34364ca1a35caa7255b18e6c953f6df664cc74))
852852//   ROM_LOAD_OPTIONAL("exsb1-2.dat", 0x0c800, 0x0800, CRC(1068a3f8) SHA1(6395f2c9829d537d68b75a750acbf27145f1bbad))
853853//   ROM_LOAD_OPTIONAL("exsb1-3.dat", 0x0d000, 0x0800, CRC(e6332518) SHA1(fe27fccc82f86b90453c4fae55371f3a050dd6dc))
854//   ROM_LOAD_OPTIONAL("exsb1-4.dat", 0x0d800, 0x0800, CRC(a370cb19) SHA1(75fffd897aec8c3dbe1a918f5a29485e603004cb))   
854//   ROM_LOAD_OPTIONAL("exsb1-4.dat", 0x0d800, 0x0800, CRC(a370cb19) SHA1(75fffd897aec8c3dbe1a918f5a29485e603004cb))
855855ROM_END
856856
857857ROM_START(exidyd)
src/mess/drivers/pc8801.c
r1461r1462
383383ADDRESS_MAP_END
384384
385385static ADDRESS_MAP_START( pc88sr_io, ADDRESS_SPACE_IO, 8)
386   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
386   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
387387   ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
388388   AM_RANGE(0x00, 0x00) AM_READ( input_port_0_r )  /* keyboard */
389389   AM_RANGE(0x01, 0x01) AM_READ( input_port_1_r )  /* keyboard */
r1461r1462
453453ADDRESS_MAP_END
454454
455455static ADDRESS_MAP_START( pc8801fd_io , ADDRESS_SPACE_IO, 8)
456   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
456   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
457457   AM_RANGE(0xf8, 0xf8) AM_READ( pc8801fd_nec765_tc )
458458   AM_RANGE(0xfa, 0xfa) AM_READ( nec765_status_r )
459459   AM_RANGE(0xfb, 0xfb) AM_READWRITE( nec765_data_r, nec765_data_w )
src/mess/drivers/studio2.c
r1461r1462
201201   beep_set_state(0, level);
202202}
203203
204static const CDP1802_CONFIG studio2_config =
204static const CDP1802_CONFIG studio2_config =
205205{
206206   studio2_mode_r,
207207   studio2_ef_r,
r1461r1462
223223   return ef;
224224}
225225
226static const CDP1802_CONFIG mpt02_config =
226static const CDP1802_CONFIG mpt02_config =
227227{
228228   studio2_mode_r,
229229   mpt02_ef_r,
src/mess/drivers/pcw.c
r1461r1462
712712   AM_RANGE(0x000, 0x07f) AM_READWRITE(pcw_fdc_r,               pcw_fdc_w)
713713   AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r,         pcw_expansion_w)
714714   AM_RANGE(0x0f0, 0x0f3) AM_WRITE(                        pcw_bank_select_w)
715   AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r,   pcw_bank_force_selection_w)   
715   AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r,   pcw_bank_force_selection_w)
716716   AM_RANGE(0x0f5, 0x0f5) AM_WRITE(                        pcw_roller_ram_addr_w)
717717   AM_RANGE(0x0f6, 0x0f6) AM_WRITE(                        pcw_pointer_table_top_scan_w)
718718   AM_RANGE(0x0f7, 0x0f7) AM_WRITE(                        pcw_vdu_video_control_register_w)
r1461r1462
727727   AM_RANGE(0x000, 0x07f) AM_READWRITE(pcw_fdc_r,               pcw_fdc_w)
728728   AM_RANGE(0x080, 0x0ef) AM_READWRITE(pcw_expansion_r,         pcw_expansion_w)
729729   AM_RANGE(0x0f0, 0x0f3) AM_WRITE(                        pcw_bank_select_w)
730   AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r,   pcw_bank_force_selection_w)   
730   AM_RANGE(0x0f4, 0x0f4) AM_READWRITE(pcw_interrupt_counter_r,   pcw_bank_force_selection_w)
731731   AM_RANGE(0x0f5, 0x0f5) AM_WRITE(                        pcw_roller_ram_addr_w)
732732   AM_RANGE(0x0f6, 0x0f6) AM_WRITE(                        pcw_pointer_table_top_scan_w)
733733   AM_RANGE(0x0f7, 0x0f7) AM_WRITE(                        pcw_vdu_video_control_register_w)
src/mess/drivers/mk2.c
r1461r1462
8888   output_set_led_value(1, mk2_led[4]&0x20?1:0);
8989   output_set_led_value(2, mk2_led[4]&0x10?1:0);
9090   output_set_led_value(3, mk2_led[4]&0x10?0:1);
91   
91
9292   mk2_led[0]= mk2_led[1]= mk2_led[2]= mk2_led[3]= mk2_led[4]= 0;
9393}
9494
src/mess/drivers/c16.c
r1461r1462
349349   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TILDE)
350350   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !   BLK   ORNG") PORT_CODE(KEYCODE_1)   PORT_CHAR('1')   PORT_CHAR('!')
351351   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 \"   WHT   BRN") PORT_CODE(KEYCODE_2)   PORT_CHAR('2')   PORT_CHAR('\"')
352   PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #   RED   L GRN") PORT_CODE(KEYCODE_3)   PORT_CHAR('3')   PORT_CHAR('#')   
352   PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #   RED   L GRN") PORT_CODE(KEYCODE_3)   PORT_CHAR('3')   PORT_CHAR('#')
353353   PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 $   CYN   PINK") PORT_CODE(KEYCODE_4)   PORT_CHAR('4')   PORT_CHAR('$')
354354   PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 %   PUR   BL GRN") PORT_CODE(KEYCODE_5)   PORT_CHAR('5')   PORT_CHAR('%')
355355   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 &   GRN   L BLU") PORT_CODE(KEYCODE_6)   PORT_CHAR('6')   PORT_CHAR('&')
r1461r1462
416416   PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE)         PORT_CHAR(' ')
417417   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("f1 f4") PORT_CODE(KEYCODE_F1)            PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F4))
418418   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("f2 f5") PORT_CODE(KEYCODE_F2)            PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CHAR(UCHAR_MAMEKEY(F5))
419   PORT_START
419   PORT_START
420420   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("f3 f6") PORT_CODE(KEYCODE_F3)            PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F6))
421421   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("HELP f7") PORT_CODE(KEYCODE_F4)
422422   PORT_DIPNAME ( 0x2000, 0, "Swap Gameport 1 and 2") PORT_CODE(KEYCODE_NUMLOCK)
r1461r1462
427427   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Drive Play") PORT_CODE(KEYCODE_F5)
428428   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Drive Record") PORT_CODE(KEYCODE_F6)
429429   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tape Drive Stop") PORT_CODE(KEYCODE_F7)
430   PORT_START
430   PORT_START
431431   PORT_DIPNAME ( 0x80, 0x80, "Joystick 1")
432432   PORT_DIPSETTING(  0, DEF_STR( Off ) )
433433   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
src/mess/drivers/osi.c
r1461r1462
5555   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_TAB) PORT_CHAR(27)
5656   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_SHIFT_2)
5757   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REPEAT") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\')
58   
58
5959   PORT_START_TAG("ROW1")
6060   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
6161   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
r1461r1462
6565   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
6666   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
6767   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
68   
68
6969   PORT_START_TAG("ROW2")
7070   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
7171   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
r1461r1462
7575   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
7676   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
7777   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
78   
78
7979   PORT_START_TAG("ROW3")
8080   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
8181   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
r1461r1462
8585   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
8686   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
8787   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
88   
88
8989   PORT_START_TAG("ROW4")
9090   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
9191   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
r1461r1462
105105   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
106106   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
107107   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
108   
108
109109   PORT_START_TAG("ROW6")
110110   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
111111   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
r1461r1462
115115   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
116116   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
117117   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
118   
118
119119   PORT_START_TAG("ROW7")
120120   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
121121   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
r1461r1462
236236   ROM_LOAD( "basus03.u11", 0xb000, 0x0800, CRC(ca25f8c1) SHA1(f5e8ee93a5e0656657d0cc60ef44e8a24b8b0a80) )
237237   ROM_LOAD( "basus04.u12", 0xb800, 0x0800, CRC(8ee6030e) SHA1(71f210163e4268cba2dd78a97c4d8f5dcebf980e) )
238238   ROM_LOAD( "monde01.u13", 0xf800, 0x0800, CRC(95a44d2e) SHA1(4a0241c4015b94c436d0f0f58b3dd9d5207cd847) )
239   
239
240240   ROM_REGION( 0x800, REGION_GFX1,0)
241241   ROM_LOAD( "chgsup2.u41", 0x0000, 0x0800, CRC(735f5e0a) SHA1(87c6271497c5b00a974d905766e91bb965180594) )
242242ROM_END
src/mess/drivers/oric.c
r1461r1462
387387static INPUT_PORTS_START(telstrat)
388388   INPUT_PORT_ORICA
389389
390   PORT_START_TAG("oric_floppy_interface")   
390   PORT_START_TAG("oric_floppy_interface")
391391   /* vsync cable hardware. This is a simple cable connected to the video output
392392   to the monitor/television. The sync signal is connected to the cassette input
393393   allowing interrupts to be generated from the vsync signal. */
r1461r1462
453453
454454   MDRV_MACHINE_START( oric )
455455   MDRV_MACHINE_RESET( oric )
456   
456
457457    /* video hardware */
458458   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
459459   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
r1461r1462
472472   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
473473   MDRV_SOUND_ADD(AY8910, 1000000)
474474   MDRV_SOUND_CONFIG(oric_ay_interface)
475   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)   
475   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
476476MACHINE_DRIVER_END
477477
478478
src/mess/drivers/at.c
r1461r1462
11/***************************************************************************
2   
2
33   IBM AT Compatibles
44
55***************************************************************************/
r1461r1462
5252  adlib (YM3812/OPL2 chip), part of many many soundcards (soundblaster)
5353  soundblaster: YM3812 also accessible at 0x228/9 (address jumperable)
5454  soundblaster pro version 1: 2 YM3812 chips
55   at 0x388 both accessed,
55   at 0x388 both accessed,
5656   at 0x220/1 left?, 0x222/3 right? (jumperable)
5757  soundblaster pro version 2: 1 OPL3 chip
5858
r1461r1462
318318   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
319319   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
320320   PORT_DIPNAME( 0x01, 0x00, "VGA 4")
321   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )   
321   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )
322322   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
323323
324324    PORT_START /* IN1 */
r1461r1462
667667   ROM_REGION32_LE(0x40000, REGION_USER1, 0)
668668    ROM_LOAD("wdbios.rom",  0x08000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a))
669669    ROM_LOAD("at586.bin",   0x20000, 0x20000, CRC(717037f5) SHA1(1d49d1b7a4a40d07d1a897b7f8c827754d76f824))
670   
670
671671   ROM_REGION(0x08100, REGION_GFX1, 0)
672672    ROM_LOAD("cga.chr",     0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd))
673673ROM_END
src/mess/drivers/coleco.c
r1461r1462
2020            A0-BF (W) = Video Chip (TMS9928A), A0=0 -> Write Register 0 , A0=1 -> Write Register 1
2121            A0-BF (R) = Video Chip (TMS9928A), A0=0 -> Read Register 0 , A0=1 -> Read Register 1
2222
23            C0-DF (W) = Set both controllers to joystick mode
23            C0-DF (W) = Set both controllers to joystick mode
2424            C0-DF (R) = Not Connected
2525
2626            E0-FF (W) = Sound Chip (SN76489A)
r1461r1462
3535
3636        -Driving Controller (Expansion Module #2). It consist of a steering wheel and a gas pedal. Only one
3737         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
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
4040         shift, etc.
4141         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
42         and Super Action Controllers so you can use Roller Controller or Super Action Controllers to play
4343         games requiring Driving Controller.
44         
44
4545        -Roller Controller. Basically a trackball with four buttons (the two fire buttons from player 1 and
4646         the two fire buttons from player 2). Only one Roller Controller can be used on a real ColecoVision.
4747    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
48    Controller, it uses the spinner pins of both sockets to generate the X and Y signals (X from controller 1
4949    and the Y from controller 2)
5050
5151        -Super Action Controllers. It is a hand controller with a keypad, four buttons (the two from
r1461r1462
6161#include "devices/cartslot.h"
6262
6363READ8_HANDLER(coleco_video_r)
64{ 
64{
6565    return ((offset & 0x01) ? TMS9928A_register_r(1) : TMS9928A_vram_r(0));
6666}
6767
r1461r1462
207207    else
208208      JoyStat[1] = 1;
209209
210    if (JoyStat[0] || JoyStat[1])
210    if (JoyStat[0] || JoyStat[1])
211211      cpunum_set_input_line(0, 0, HOLD_LINE);
212212}
213213
src/mess/drivers/ex800.c
r1461r1462
11/******************************************************************************
22 Epson EX-800 Dot Matrix printer
3
3
44 Written by Dirk Best, October 2007
5
5
66 --
7
7
88 Main CPU is a UPD7810H6 running at 12 MHz.
9
9
1010 --
11
11
1212 On startup, the ports are initialized as follows:
13
13
1414 Port A lines PA0-PA7 are configured as output
1515 Port B lines PB0-PB7 are configured as output
1616 Port C lines PC2, PC4 and PC5 are configured as output
r1461r1462
2020        PC3: TI input
2121        PC6: CO0 output
2222        PC7: CO1 output
23       
24The I/O lines are connected as follows:       
2523
24The I/O lines are connected as follows:
25
2626PA0: \
2727PA1:  Carriage motor
2828PA2:  driving pulses
r1461r1462
6262AN5: Scanner Unit, Color Home sensor
6363AN6:
6464AN7: Color Home sensor adjust
65   
66INT: Online switch   
6765
66INT: Online switch
6867
68
6969Gate array 5a (parallel port, printer head)
7070
7171IN0-IN7: DATA1 to DATA8 from parallel port
r1461r1462
200200{
201201   /* Setup beep */
202202   beep_set_state(0, 0);
203   beep_set_frequency(0, 4000); /* measured at 4000 hz */   
203   beep_set_frequency(0, 4000); /* measured at 4000 hz */
204204}
205205
206206
r1461r1462
239239{
240240   if (PA6) logerror("BNK0 selected.\n");
241241   if (PA7) logerror("BNK1 selected.\n");
242   
242
243243   logerror("PA W %x @%x\n", data, activecpu_get_pc());
244244}
245245
r1461r1462
263263      logerror("PB3 Paper empty LED on @%x\n", activecpu_get_pc());
264264   else
265265      logerror("PB3 Paper empty LED off @%x\n", activecpu_get_pc());
266   
266
267267//   logerror("PB W %x @%x\n", data, activecpu_get_pc());
268268}
269269
r1461r1462
273273      beep_set_state(0, 0);
274274   else
275275      beep_set_state(0, 1);
276   
276
277277   logerror("PC W %x @%x\n", data, activecpu_get_pc());
278278}
279279
r1461r1462
366366   PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
367367   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FORM FEED") PORT_CODE(KEYCODE_F10)
368368   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F11)
369   
369
370370   PORT_START_TAG("SelecType")
371371   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Draft")          PORT_CODE(KEYCODE_F8)
372372   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Roman")      PORT_CODE(KEYCODE_F7)
r1461r1462
376376   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Proportional")   PORT_CODE(KEYCODE_F3)
377377   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(DEF_STR(Normal))  PORT_CODE(KEYCODE_F2)
378378   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Condensed")      PORT_CODE(KEYCODE_F1)
379   
379
380380   PORT_START_TAG("DSW_1")
381381   PORT_DIPNAME(0x01, 0x00, "Condensed characters")
382382   PORT_DIPSETTING(   0x00, DEF_STR(Off))
r1461r1462
425425   PORT_DIPSETTING(   0x00, "9600")
426426   PORT_DIPSETTING(   0x40, "4800")
427427   PORT_DIPSETTING(   0x80, "1200")
428   PORT_DIPSETTING(   0xc0, "300")   
428   PORT_DIPSETTING(   0xc0, "300")
429429INPUT_PORTS_END
430430
431431
r1461r1462
456456   MDRV_CPU_IO_MAP(ex800_io, 0)
457457
458458   MDRV_MACHINE_START(ex800)
459   
459
460460   /* "video" hardware */
461461   MDRV_SCREEN_REFRESH_RATE(60)
462462   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
463463//   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
464464//   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
465465//   MDRV_SCREEN_SIZE(480, 640)
466//   MDRV_SCREEN_VISIBLE_AREA(0, 479, 0, 639)   
466//   MDRV_SCREEN_VISIBLE_AREA(0, 479, 0, 639)
467467//   MDRV_PALETTE_LENGTH(4)
468468
469469//   MDRV_VIDEO_START(ex800)
src/mess/drivers/snes.c
r1461r1462
150150   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_NAME("Toggle Windows")  PORT_PLAYER(3)
151151
152152   PORT_START   /* IN 11 : debug input */
153   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_NAME("Pal prev")
154   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_NAME("Pal next")
153   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON9) PORT_NAME("Pal prev")
154   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON10) PORT_NAME("Pal next")
155155   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("Toggle Transparency")  PORT_PLAYER(4)
156156#endif
157157INPUT_PORTS_END
r1461r1462
502502   MDRV_IMPORT_FROM(snes)
503503   MDRV_CPU_REPLACE("main", G65816, MCLK_PAL/6)
504504
505   MDRV_SCREEN_MODIFY("main")   
505   MDRV_SCREEN_MODIFY("main")
506506   MDRV_SCREEN_RAW_PARAMS(DOTCLK_PAL, SNES_HTOTAL, 0, SNES_SCR_WIDTH, SNES_VTOTAL_PAL, 0, SNES_SCR_HEIGHT_PAL)
507507MACHINE_DRIVER_END
508508
src/mess/drivers/saturn.c
r1461r1462
432432{
433433   int i, cnt = 0, tmp, res = 0;
434434
435   while (num > 0)
435   while (num > 0)
436436   {
437437      tmp = num;
438438      while (tmp >= 10) tmp %= 10;
r1461r1462
507507   if (offset == 0x77)//PDR2 read
508508      return_data=  0xff; // | EEPROM_read_bit());
509509
510   if (offset == 0x33) return_data = saturn_region;   
510   if (offset == 0x33) return_data = saturn_region;
511511
512512//   if (LOG_SMPC) logerror ("cpu #%d (PC=%08X) SMPC: Read from Byte Offset %02x (%d) Returns %02x\n", cpu_getactivecpu(), activecpu_get_pc(), offset, offset>>1, return_data);
513513
r1461r1462
532532   if ((intback_stage > 0) && (offset == 1) && (((data ^ 0x80)&0x80) == (last&0x80)))
533533   {
534534//      if (LOG_SMPC) logerror("SMPC: CONTINUE request, stage %d\n", intback_stage);
535      if (intback_stage != 3)
535      if (intback_stage != 3)
536536      {
537537         intback_stage = 2;
538538      }
r1461r1462
19111911
19121912static NVRAM_HANDLER(saturn)
19131913{
1914   static UINT32 init[8] =
1914   static UINT32 init[8] =
19151915   {
19161916      0x420061, 0x63006b, 0x550070, 0x520061, 0x6d0020, 0x46006f, 0x72006d, 0x610074,
19171917   };
src/mess/drivers/ql.c
r1461r1462
270270static READ8_HANDLER( zx8302_status_r )
271271{
272272   /*
273     
273
274274      bit      description
275     
275
276276      0      Network port
277277      1      Transmit buffer full
278278      2      Receive buffer full
r1461r1462
283283      7      Latched COMDATA
284284
285285   */
286   
287   UINT8 data = 0;
288286
287   UINT8 data = 0;
288
289289   data |= zx8302.comdata_l << 7;
290290   data |= zx8302.comctl << 6;
291291   data |= zx8302.ser1_cts << 5;
r1461r1462
326326static WRITE8_HANDLER( zx8302_mdv_control_w )
327327{
328328   /*
329     
329
330330      bit      description
331     
331
332332      0      MDSELDH
333333      1      MDSELCKH
334334      2      MDRDWL
335335      3      ERASE
336      4     
337      5     
338      6     
339      7     
336      4
337      5
338      6
339      7
340340
341341   */
342342
r1461r1462
444444static WRITE8_HANDLER( ipc_port1_w )
445445{
446446   /*
447     
447
448448      bit      description
449     
449
450450      0      Keyboard column output (KBO0)
451451      1      Keyboard column output (KBO1)
452452      2      Keyboard column output (KBO2)
r1461r1462
464464static WRITE8_HANDLER( ipc_port2_w )
465465{
466466   /*
467     
467
468468      bit      description
469     
469
470470      0      Serial data input (SER2 RxD, SER1 TxD)
471471      1      Speaker output
472472      2      Interrupt output (IPL0-2)
r1461r1462
520520static READ8_HANDLER( ipc_port2_r )
521521{
522522   /*
523     
523
524524      bit      description
525     
525
526526      0      Serial data input (SER2 RxD, SER1 TxD)
527527      1      Speaker output
528528      2      Interrupt output (IPL0-2)
r1461r1462
549549static READ8_HANDLER( ipc_bus_r )
550550{
551551   /*
552     
552
553553      bit      description
554     
554
555555      0      Keyboard row input (KBI0)
556556      1      Keyboard row input (KBI1)
557557      2      Keyboard row input (KBI2)
r1461r1462
631631   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_NAME("ESC @") PORT_CHAR('\x1b') PORT_CHAR('@')
632632   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_NAME("\xe2\x86\x92")
633633   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
634   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_NAME("SPACE")
634   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_NAME("SPACE")
635635   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_NAME("\xe2\x86\x93")
636636
637637   PORT_START_TAG("ROW2")
r1461r1462
766766
767767   PORT_MODIFY("ROW4")
768768   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_NAME("3 \xc2\xa3") PORT_CHAR('3') PORT_CHAR(0xa7) // 3 £
769   
769
770770   PORT_MODIFY("ROW5")
771771   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
772772   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("\xc3\x9f ?") PORT_CHAR(0xdf) PORT_CHAR('?') // ß ?
r1461r1462
808808   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
809809
810810   PORT_MODIFY("ROW4")
811   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3')
811   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('"') PORT_CHAR('3')
812812   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('#') PORT_CHAR('1')
813813
814814   PORT_MODIFY("ROW5")
src/mess/drivers/abc80x.c
r1461r1462
668668static MACHINE_START( abc802 )
669669{
670670   machine_start_abc800(machine);
671   
671
672672   z80dart_init(0, &abc802_dart_intf);
673673
674674   memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1), 0);
r1461r1462
683683static MACHINE_START( abc806 )
684684{
685685   machine_start_abc800(machine);
686   
686
687687   memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1), 0);
688688   memory_configure_bank(1, 1, 1, mess_ram, 0);
689689}
r1461r1462
726726
727727static MACHINE_DRIVER_START( abc800c )
728728   MDRV_IMPORT_FROM(abc800m)
729   
729
730730   MDRV_SCREEN_SIZE(40*6, 24*10)
731731   MDRV_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*10-1)
732732   MDRV_PALETTE_LENGTH(8)
r1461r1462
741741   MDRV_CPU_PROGRAM_MAP(abc802_map, 0)
742742   MDRV_CPU_IO_MAP(abc802_io_map, 0)
743743   MDRV_CPU_VBLANK_INT(abc802_vblank_interrupt, 1)
744   
744
745745   MDRV_MACHINE_START(abc802)
746746   MDRV_MACHINE_RESET(abc802)
747747
r1461r1462
756756   MDRV_CPU_MODIFY("main")
757757   MDRV_CPU_PROGRAM_MAP(abc806_map, 0)
758758   MDRV_CPU_IO_MAP(abc806_io_map, 0)
759   
759
760760   MDRV_MACHINE_START(abc806)
761761   MDRV_MACHINE_RESET(abc806)
762762MACHINE_DRIVER_END
src/mess/drivers/tmc1800.c
r1461r1462
284284/* Machine Drivers */
285285
286286static MACHINE_DRIVER_START( tmc1800 )
287   
287
288288   // basic system hardware
289289
290290   MDRV_CPU_ADD(CDP1802, 1750000)   // 1.75 MHz
r1461r1462
308308MACHINE_DRIVER_END
309309
310310static MACHINE_DRIVER_START( tmc2000 )
311   
311
312312   // basic system hardware
313313
314314   MDRV_CPU_ADD(CDP1802, CDP1864_CLK_FREQ)   // 1.75 MHz
src/mess/drivers/crvision.c
r1461r1462
3131/* Input Ports */
3232
3333static INPUT_PORTS_START( crvision )
34   
34
3535   // Player 1 Joystick
3636
3737   PORT_START_TAG("PA0-0")
r1461r1462
246246   int i;
247247   UINT8 value;
248248   char portname[10];
249   
249
250250   for (i = 0; i < 8; i++)
251251   {
252252      sprintf(portname, "PA%u-%u", pa, i);
253253      value = readinputportbytag(portname);
254     
254
255255      if (value != 0xff)
256256      {
257257         if (value == 0xff - (1 << i))
r1461r1462
353353   */
354354
355355   SN76496_0_w(0, data);
356   
356
357357   sn76489_ready = 0;
358358
359359   // wait 32 cycles of 2 MHz to synchronize CPU and SN76489
360   timer_set(ATTOTIME_IN_USEC(16), NULL, 0, sn76489_set_ready);
360   timer_set(ATTOTIME_IN_USEC(16), NULL, 0, sn76489_set_ready);
361361}
362362
363363static WRITE8_HANDLER( pia_cb2_w )
src/mess/drivers/nascom1.c
r1461r1462
6969
7070/* port i/o functions */
7171static ADDRESS_MAP_START( nascom1_io , ADDRESS_SPACE_IO, 8)
72   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
72   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
7373   AM_RANGE(0x00, 0x00) AM_READWRITE( nascom1_port_00_r, nascom1_port_00_w )
7474   AM_RANGE(0x01, 0x01) AM_READWRITE( nascom1_port_01_r, nascom1_port_01_w )
7575   AM_RANGE(0x02, 0x02) AM_READ( nascom1_port_02_r )
src/mess/drivers/acrnsys1.c
r1461r1462
11/******************************************************************************
22 Acorn System 1 (Microcomputer Kit)
3
3
44 Skeleton driver
55
66 Written by Dirk Best October 2007
src/mess/drivers/mtx.c
r1461r1462
11/*
22** mtx.c : driver for Memotech MTX512
3**
3**
44** The memory address space of the MTX512 is divided into 8 banks,
55** with a size of 8KB each. These banks are mapped differently based
66** upon the memory model, selected ROM and RAM page, and the amount
r1461r1462
225225   z80ctc_0_trg0_w (0, data ? 0 : 1);
226226}
227227
228static void mtx_set_bank_offsets (unsigned int bank1, unsigned int bank2,
228static void mtx_set_bank_offsets (unsigned int bank1, unsigned int bank2,
229229                             unsigned int bank3, unsigned int bank4,
230230                             unsigned int bank5, unsigned int bank6,
231231                             unsigned int bank7, unsigned int bank8)
r1461r1462
385385
386386   if (ramspace)
387387      return mess_ram[paddress];
388   else
388   else
389389      return romimage[paddress];
390390}
391391
r1461r1462
452452               mtx_rampage, start, mtx_tape_filename, mtx_tape_index);
453453      if (length > bytes_saved)
454454         logerror("wrote too few bytes from '%s'\n", mtx_tape_filename);
455   
455
456456      mame_fclose(tape_file);
457457      mtx_tape_index += length;
458458   }
r1461r1462
499499               mtx_tape_filename, mtx_tape_index, mtx_rampage, start);
500500      if (length > bytes_loaded)
501501         logerror("read too few bytes from '%s'\n", mtx_tape_filename);
502   
502
503503      for (i = 0; i < length; i++)
504504         mtx_poke(start + i, mtx_tape_buf[i]);
505   
505
506506      mame_fclose(tape_file);
507507      mtx_tape_index += length;
508508   }
r1461r1462
612612ADDRESS_MAP_END
613613
614614static ADDRESS_MAP_START( mtx_io, ADDRESS_SPACE_IO, 8)
615   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
615   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
616616   AM_RANGE( 0x00, 0x00) AM_READWRITE( mtx_strobe_r, mtx_bankswitch_w )
617617   AM_RANGE( 0x01, 0x02) AM_READWRITE( mtx_vdp_r, mtx_vdp_w )
618618   AM_RANGE( 0x03, 0x03) AM_READWRITE( mtx_psg_r, mtx_cst_w )
src/mess/drivers/microtan.c
r1461r1462
230230   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
231231   MDRV_SOUND_ADD(AY8910, 1000000)
232232   MDRV_SOUND_CONFIG(ay8910_interface)
233   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)   
233   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
234234   MDRV_SOUND_ADD(AY8910, 1000000)
235235   MDRV_SOUND_CONFIG(ay8910_interface)
236   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)   
236   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
237237MACHINE_DRIVER_END
238238
239239ROM_START( microtan )
src/mess/drivers/einstein.c
r1461r1462
1616      trigger for channel 3 is the terminal count of channel 2
1717
1818   Intel 8251 Serial (2Mhz clock?)
19   
19
2020   WD1770 Floppy Disc controller
2121      density is fixed, 4 drives and double sided supported
2222
2323   AY-3-8910 PSG (2Mhz)
24      port A and port B are connected to the keyboard. Port A is keyboard
24      port A and port B are connected to the keyboard. Port A is keyboard
2525      line select, Port B is data.
2626
2727   printer connected to port A of PIO. /ACK from printer is connected to /ASTB.
r1461r1462
6161/* MISC */
6262/* 0x20 - bit 0 is keyboard int mask; read to get state of some keys and /fire button states;
6363      set to 0 to ENABLE interrupt; 1 to DISABLE interrupt; write to set mask. */
64/* 0x21 - bit 0 is adc int mask; set to 0 to ENABLE interrupt; 1 to DISABLE interrupt;
64/* 0x21 - bit 0 is adc int mask; set to 0 to ENABLE interrupt; 1 to DISABLE interrupt;
6565      write to set mask; read has no effect */
6666/* 0x22 - alph */
6767/* 0x23 - drive select and side select */
r1461r1462
123123#endif
124124
125125/**********************************************************/
126/*
126/*
127127   80 column board has a UM6845,2K ram and a char rom:
128128
129   0x040-0x047 used to access 2K ram. (bits 3-0 define a 256 byte row, bits 15-8 define
129   0x040-0x047 used to access 2K ram. (bits 3-0 define a 256 byte row, bits 15-8 define
130130            the offset in the row)
131    0x048 = crtc register index (w),
131    0x048 = crtc register index (w),
132132   0x049 = crtc data register (w)
133133
134   0x04c
134   0x04c
135135      bit 2 = 50/60hz mode?
136136      bit 1 = 1
137137      bit 0 = vsync state?
r1461r1462
235235   unsigned char data_byte;
236236   int char_code;
237237   int i, x;
238       
238
239239   for ( i = 0, x = 0; i < x_count; i++, x+=8 ) {
240240      int w;
241241      char_code = einstein_80col_ram[(ma + i)&0x07ff];
r1461r1462
447447   centronics_write_handshake(0, handshake, CENTRONICS_STROBE);
448448}
449449
450static const z80pio_interface einstein_pio_intf =
450static const z80pio_interface einstein_pio_intf =
451451{
452452   einstein_pio_interrupt,
453453   einstein_pio_ardy,
r1461r1462
561561{
562562   int reg = offset & 0x03;
563563
564   logerror("fdc w: PC: %04x %04x %02x\n",activecpu_get_pc(),offset,data);
564   logerror("fdc w: PC: %04x %04x %02x\n",activecpu_get_pc(),offset,data);
565565
566566   switch (reg)
567567   {
r1461r1462
570570         wd17xx_command_w(reg, data);
571571      }
572572      break;
573   
573
574574      case 1:
575575      {
576576         wd17xx_track_w(reg, data);
577577      }
578578      break;
579   
579
580580      case 2:
581581      {
582582         wd17xx_sector_w(reg, data);
r1461r1462
596596{
597597   int reg = offset & 0x03;
598598
599   logerror("fdc r: PC: %04x %04x\n",activecpu_get_pc(),offset);
599   logerror("fdc r: PC: %04x %04x\n",activecpu_get_pc(),offset);
600600
601601   switch (reg)
602602   {
r1461r1462
605605         return wd17xx_status_r(reg);
606606      }
607607      break;
608   
608
609609      case 1:
610610      {
611611         return wd17xx_track_r(reg);
612612      }
613613      break;
614   
614
615615      case 2:
616616      {
617617         return wd17xx_sector_r(reg);
r1461r1462
669669
670670static  READ8_HANDLER(einstein_ctc_r)
671671{
672   logerror("ctc r: %04x\n",offset);
673   
672   logerror("ctc r: %04x\n",offset);
673
674674   return z80ctc_0_r(offset & 0x03);
675675}
676676
677677static WRITE8_HANDLER(einstein_ctc_w)
678678{
679   logerror("ctc w: %04x %02x\n",offset,data);
679   logerror("ctc w: %04x %02x\n",offset,data);
680680
681681   z80ctc_0_w(offset & 0x03,data);
682682}
r1461r1462
692692      msm8251_data_w(reg,data);
693693      return;
694694   }
695   
695
696696   msm8251_control_w(reg,data);
697697}
698698
r1461r1462
707707   {
708708      return msm8251_data_r(reg);
709709   }
710   
710
711711   return msm8251_status_r(reg);
712712}
713713
714/*
714/*
715715
716716   AY-3-8912 PSG:
717717
r1461r1462
771771      /* case 0 and 1 are not handled */
772772      case 2:
773773         return AY8910_read_port_0_r(0);
774   
774
775775      default:
776776         break;
777777   }
778778
779779   return 0x0ff;
780780}
781   
782781
782
783783/* int priority */
784784/* keyboard int->ctc/adc->pio */
785785
r1461r1462
814814   /* bit 1: select drive 1 */
815815   /* bit 0: select drive 0 */
816816
817   logerror("drive w: PC: %04x %04x %02x\n",activecpu_get_pc(),offset,data);
817   logerror("drive w: PC: %04x %04x %02x\n",activecpu_get_pc(),offset,data);
818818
819819   wd17xx_set_side((data>>4) & 0x01);
820   
820
821821   if (data & 0x01)
822822   {
823823      wd17xx_set_drive(0);
r1461r1462
889889   if ((centronics_handshake & CENTRONICS_NOT_BUSY)==0)
890890   {
891891      /*  if CENTRONICS_NOT_BUSY flag set then not busy */
892   
892
893893      /* busy */
894894      data |= (1<<2);
895895   }
r1461r1462
13251325   AM_RANGE(0x008, 0x00f) AM_READ( einstein_vdp_r)
13261326   AM_RANGE(0x010, 0x017) AM_READ( einstein_serial_r)
13271327   AM_RANGE(0x018, 0x01f) AM_READ( einstein_fdc_r)
1328   AM_RANGE(0x020, 0x020) AM_READ( einstein_key_int_r)   
1328   AM_RANGE(0x020, 0x020) AM_READ( einstein_key_int_r)
13291329   AM_RANGE(0x028, 0x02f) AM_READ( einstein_ctc_r)
13301330   AM_RANGE(0x030, 0x037) AM_READ( einstein_pio_r)
13311331//   {0x040, 0x0ff, einstein_unmapped_r},
r1461r1462
14741474static INPUT_PORTS_START(einstein)
14751475   /* line 0 */
14761476   PORT_START
1477   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_LALT)
1478   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD)
1479   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1)
1480   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD)
1481   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK)
1482   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER)
1483   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE)
1484   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC)
1477   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("BREAK") PORT_CODE(KEYCODE_LALT)
1478   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_1_PAD)
1479   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F0") PORT_CODE(KEYCODE_F1)
1480   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_3_PAD)
1481   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK)
1482   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER)
1483   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE)
1484   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC)
14851485   /* line 1 */
14861486   PORT_START
1487   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
1488   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
1489   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
1490   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT)
1491   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS)
1492   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN)
1493   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("||") PORT_CODE(KEYCODE_BACKSLASH)
1494   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
1487   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
1488   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
1489   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
1490   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT)
1491   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("_") PORT_CODE(KEYCODE_MINUS)
1492   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN)
1493   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("||") PORT_CODE(KEYCODE_BACKSLASH)
1494   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
14951495   /* line 2 */
14961496   PORT_START
1497   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
1498   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
1499   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)
1500   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE)
1501   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT)
1502   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB)
1503   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
1504   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6)
1497   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
1498   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
1499   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)
1500   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE)
1501   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT)
1502   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB)
1503   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
1504   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F6)
15051505   /* line 3 */
15061506   PORT_START
1507   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
1508   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
1509   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
1510   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
1511   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE)
1512   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS)
1513   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP)
1514   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5)
1507   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA)
1508   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
1509   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
1510   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
1511   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE)
1512   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS)
1513   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP)
1514   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F5)
15151515   /* line 4 */
15161516   PORT_START
1517   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
1518   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
1519   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
1520   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
1521   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
1522   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
1523   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
1524   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4)
1517   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
1518   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
1519   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
1520   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
1521   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
1522   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
1523   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
1524   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F4)
15251525   /* line 5 */
15261526   PORT_START
1527   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
1528   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
1529   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
1530   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
1531   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
1532   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
1533   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
1534   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3)
1527   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
1528   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
1529   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
1530   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
1531   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
1532   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
1533   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
1534   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F3)
15351535   /* line 6 */
15361536   PORT_START
1537   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
1538   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
1539   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
1540   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
1541   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
1542   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
1543   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
1544   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2)
1537   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
1538   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
1539   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
1540   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
1541   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
1542   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
1543   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
1544   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F2)
15451545   /* line 7 */
15461546   PORT_START
1547   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
1548   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
1549   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
1550   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
1551   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
1552   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
1553   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
1554   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7)
1547   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
1548   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
1549   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
1550   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
1551   PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
1552   PORT_BIT(0x020, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
1553   PORT_BIT(0x040, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
1554   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F7)
15551555   /* extra */
15561556   PORT_START
15571557   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_F1)
r1461r1462
15591559   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CONTROL") PORT_CODE(KEYCODE_RCONTROL)
15601560   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT)
15611561   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_RSHIFT)
1562   
1562
15631563   /* fire buttons for analogue joysticks */
15641564   PORT_START
15651565   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Joystick 1 Button 1")
r1461r1462
15701570   PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_REVERSE
15711571
15721572   /* analog joystick 1 y axis */
1573   PORT_START
1573   PORT_START
15741574   PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_REVERSE
15751575
15761576   /* analog joystick 2 x axis */
r1461r1462
15991599
16001600//   logerror("key: %02x\n",einstein_keyboard_data);
16011601
1602   return einstein_keyboard_data;   
1602   return einstein_keyboard_data;
16031603}
16041604
16051605static const struct AY8910interface einstein_ay_interface =
r1461r1462
16391639//      int char_code;
16401640//
16411641//      char_code = einstein_80col_ram[m6845_memory_address_r(0)&0x07ff];
1642//     
1642//
16431643//      data_byte = data[(char_code<<3) + Einstein_6845_RA];
16441644//
16451645//      for (w=0; w<8;w++)
r1461r1462
17291729   MDRV_SPEAKER_STANDARD_MONO("mono")
17301730   MDRV_SOUND_ADD(AY8910, 2000000)
17311731   MDRV_SOUND_CONFIG(einstein_ay_interface)
1732   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)   
1732   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
17331733MACHINE_DRIVER_END
17341734
17351735
src/mess/drivers/intv.c
r1461r1462
370370   MDRV_SPEAKER_STANDARD_MONO("mono")
371371   MDRV_SOUND_ADD(AY8910, 3579545/2)
372372   MDRV_SOUND_CONFIG(ay8910_interface)
373   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)   
373   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
374374MACHINE_DRIVER_END
375375
376376
src/mess/drivers/mephisto.c
r1461r1462
11/******************************************************************************
22 Mephisto 4 + 5 Chess Computer
33 2007 Dirk V.
4
4
55******************************************************************************/
66
77/*
r1461r1462
4545
4646$2400 // Chess Board
4747$2800 // Chess Board
48$3000 // Chess Board
48$3000 // Chess Board
4949
5050$4000-7FFF Opening Modul HG550
5151$8000-$FFF ROM
r1461r1462
6565static UINT8 *mephisto_ram;
6666static UINT8 led7;
6767
68static WRITE8_HANDLER ( write_lcd )
69{
68static WRITE8_HANDLER ( write_lcd )
69{
7070  if (led7==0)output_set_digit_value(lcd_shift_counter,data);    // 0x109 MM IV // 0x040 MM V
71 
71
7272  //output_set_digit_value(lcd_shift_counter,data ^ mephisto_ram[0x165]);    // 0x109 MM IV // 0x040 MM V
7373  lcd_shift_counter--;
74  lcd_shift_counter&=3;
74  lcd_shift_counter&=3;
7575}
7676
7777static READ8_HANDLER(read_keys)
r1461r1462
8888  return 0xff;   // Mephisto needs it for working
8989}
9090
91static WRITE8_HANDLER ( write_led )
91static WRITE8_HANDLER ( write_led )
9292{
9393
9494  data &= 0x80;
r1461r1462
9999}
100100
101101static ADDRESS_MAP_START(rebel5_mem , ADDRESS_SPACE_PROGRAM, 8)
102   AM_RANGE( 0x0000, 0x1fff) AM_RAM // AM_BASE(&mephisto_ram)//
102   AM_RANGE( 0x0000, 0x1fff) AM_RAM // AM_BASE(&mephisto_ram)//
103103  AM_RANGE( 0x5000, 0x5000) AM_WRITE( write_lcd)
104104  AM_RANGE( 0x3000, 0x3007) AM_READ( read_keys)     // Rebel 5.0
105105   AM_RANGE( 0x2000, 0x2007) AM_WRITE( write_led) // Status LEDs+ buzzer
r1461r1462
111111
112112
113113static ADDRESS_MAP_START(mephisto_mem , ADDRESS_SPACE_PROGRAM, 8)
114   AM_RANGE( 0x0000, 0x1fff) AM_RAM AM_BASE(&mephisto_ram)//
114   AM_RANGE( 0x0000, 0x1fff) AM_RAM AM_BASE(&mephisto_ram)//
115115   AM_RANGE( 0x2000, 0x2000) AM_WRITE( write_lcd)
116116   AM_RANGE( 0x2c00, 0x2c07) AM_READ( read_keys)
117117   AM_RANGE( 0x3400, 0x3407) AM_WRITE( write_led) // Status LEDs+ buzzer
r1461r1462
132132  PORT_START //Port $2c01
133133  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2)
134134  PORT_START //Port $2c02
135  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F3) 
135  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F3)
136136  PORT_START //Port $2c03
137137  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INFO") PORT_CODE(KEYCODE_F4)
138138  PORT_START  //Port $2c04
r1461r1462
140140  PORT_START //Port $2c05
141141  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER)
142142  PORT_START //Port $2c06
143  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) 
143  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
144144  PORT_START //Port $2c07
145145  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
146146  // PORT_START_TAG("keyboard_2")
r1461r1462
151151  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
152152  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
153153  PORT_START //Port $2c0a
154  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) 
155  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) 
154  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
155  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
156156  PORT_START //Port $2c0b
157157  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
158158  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
r1461r1462
164164  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
165165  PORT_START //Port $2c0e
166166  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
167  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) 
167  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
168168  PORT_START //Port $2c0f
169169  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
170170  PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
r1461r1462
175175{
176176
177177   cpunum_set_input_line(0, INPUT_LINE_NMI,PULSE_LINE);
178   // DAC_data_w(0,led_status&64?128:0);
178   // DAC_data_w(0,led_status&64?128:0);
179179   beep_set_state(0,led_status&64?1:0);
180180
181181}
r1461r1462
211211   MDRV_SPEAKER_STANDARD_MONO("mono")
212212   MDRV_SOUND_ADD(BEEP, 0)
213213   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
214   
214
215215MACHINE_DRIVER_END
216216
217217static MACHINE_DRIVER_START( rebel5 )
r1461r1462
231231   ROM_REGION(0x10000,REGION_CPU1,0)
232232   ROM_LOAD("mephisto4.rom", 0x8000, 0x8000, CRC(f68a4124) SHA1(d1d03a9aacc291d5cb720d2ee2a209eeba13a36c))
233233  ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
234  ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" )
235   ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(2))
234  ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" )
235   ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(2))
236236ROM_END
237237
238238ROM_START(mm5)
239239  ROM_REGION(0x10000,REGION_CPU1,0)
240240  ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048))
241241  ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
242  ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
243   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2))
242  ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
243   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2))
244244ROM_END
245245
246246ROM_START(mm50)
247247  ROM_REGION(0x10000,REGION_CPU1,0)
248248  ROM_LOAD("mm50.rom", 0x8000, 0x8000, CRC(fcfa7e6e) SHA1(afeac3a8c957ba58cefaa27b11df974f6f2066da))
249249  ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
250  ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
251   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2))
250  ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
251   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2))
252252ROM_END
253253
254254
r1461r1462
256256
257257static DRIVER_INIT( mephisto )
258258{
259  lcd_shift_counter=3;   
259  lcd_shift_counter=3;
260260}
261261
262262/***************************************************************************
src/mess/drivers/ssystem3.c
r1461r1462
3333  port b
3434   bit 0: ??
3535
36    hi speed serial 1
36    hi speed serial 1
3737   bit 1: output data
3838   bit 2: output clock (hi data is taken)
3939
r1461r1462
167167***************************************************************************/
168168
169169/*     YEAR   NAME     PARENT   COMPAT   MACHINE   INPUT      INIT      CONFIG      COMPANY      FULLNAME */
170CONS( 1979,   ssystem3, 0,       0,      ssystem3, ssystem3,   ssystem3,   NULL,      "NOVAG Industries Ltd.",  "Chess Champion Super System III", 0)
170CONS( 1979,   ssystem3, 0,       0,      ssystem3, ssystem3,   ssystem3,   NULL,      "NOVAG Industries Ltd.",  "Chess Champion Super System III", 0)
171171//chess champion MK III in germany
src/mess/drivers/sms.c
r1461r1462
9595static ADDRESS_MAP_START( sms_io, ADDRESS_SPACE_IO, 8 )
9696   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
9797   ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
98   AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_bios_w)
98   AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_bios_w)
9999   AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_WRITE(sms_version_w)
100100   AM_RANGE(0x40, 0x7F)                 AM_READWRITE(sms_count_r, SN76496_0_w)
101101   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE(sms_vdp_data_r, sms_vdp_data_w)
r1461r1462
121121   AM_RANGE(0x01, 0x05)             AM_READWRITE(gg_sio_r, gg_sio_w)
122122   AM_RANGE(0x06, 0x06)             AM_READWRITE(gg_psg_r, gg_psg_w)
123123   AM_RANGE(0x07, 0x07)              AM_WRITE(sms_version_w)
124   AM_RANGE(0x08, 0x08) AM_MIRROR(0x06) AM_WRITE(sms_bios_w)
124   AM_RANGE(0x08, 0x08) AM_MIRROR(0x06) AM_WRITE(sms_bios_w)
125125   AM_RANGE(0x09, 0x09) AM_MIRROR(0x06) AM_WRITE(sms_version_w)
126   AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_WRITE(sms_bios_w)
126   AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_WRITE(sms_bios_w)
127127   AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_WRITE(sms_version_w)
128   AM_RANGE(0x20, 0x20) AM_MIRROR(0x1e) AM_WRITE(sms_bios_w)
128   AM_RANGE(0x20, 0x20) AM_MIRROR(0x1e) AM_WRITE(sms_bios_w)
129129   AM_RANGE(0x21, 0x21) AM_MIRROR(0x1e) AM_WRITE(sms_version_w)
130130   AM_RANGE(0x40, 0x7F)                 AM_READWRITE(sms_count_r, SN76496_0_w)
131131   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE(sms_vdp_data_r, sms_vdp_data_w)
r1461r1462
347347   MDRV_CPU_IO_MAP(sms_io, 0)
348348
349349   MDRV_INTERLEAVE(1)
350       
350
351351   MDRV_MACHINE_START(sms)
352352   MDRV_MACHINE_RESET(sms)
353353
r1461r1462
360360   MDRV_PALETTE_LENGTH(64+16)
361361   MDRV_COLORTABLE_LENGTH(0)
362362   MDRV_PALETTE_INIT(sms)
363
363
364364   MDRV_VIDEO_START(sega_315_5124)
365365   MDRV_VIDEO_UPDATE(sms)
366
366
367367   /* sound hardware */
368368   MDRV_SPEAKER_STANDARD_MONO("mono")
369369   MDRV_SOUND_ADD(SMSIII, MASTER_CLOCK_PAL/15)
src/mess/drivers/a310.c
r1461r1462
11/******************************************************************************
2 *
2 *
33 *   Acorn Archimedes 310
44 *
55 *   Skeleton: Juergen Buchmueller <pullmoll@t-online.de>, Jul 2000
r1461r1462
131131   if (a310_sndcur >= a310_sndend)
132132   {
133133      a310_request_irq_b(A310_IRQB_SOUND_EMPTY);
134   }   
134   }
135135}
136136
137137static TIMER_CALLBACK( a310_vblank )
r1461r1462
157157   // all timers always run
158158   a310_set_timer(param);
159159
160   // but only timers 0 and 1 generate IRQs   
160   // but only timers 0 and 1 generate IRQs
161161   switch (param)
162162   {
163163      case 0:
r1461r1462
167167      case 1:
168168         a310_request_irq_a(A310_IRQA_TIMER1);
169169         break;
170   }   
170   }
171171}
172172
173173static void a310_memc_reset(void)
r1461r1462
199199      case WD17XX_IRQ_SET:
200200         a310_request_fiq(A310_FIQ_FLOPPY);
201201         break;
202         
202
203203      case WD17XX_DRQ_CLR:
204204         a310_iocregs[12] &= ~A310_FIQ_FLOPPY_DRQ;
205205         break;
r1461r1462
238238static READ32_HANDLER(logical_r)
239239{
240240   UINT32 page, poffs;
241   
241
242242   // are we mapping in the boot ROM?
243243   if (a310_latchrom)
244244   {
245245      UINT32 *rom;
246     
246
247247      rom = (UINT32 *)memory_region(REGION_CPU1);
248     
249      return rom[offset & 0x1fffff];     
248
249      return rom[offset & 0x1fffff];
250250   }
251251   else
252252   {
253253      // figure out the page number and offset in the page
254      page = (offset<<2) / page_sizes[a310_pagesize];
254      page = (offset<<2) / page_sizes[a310_pagesize];
255255      poffs = (offset<<2) % page_sizes[a310_pagesize];
256256
257257//      printf("Reading offset %x (addr %x): page %x (size %d %d) offset %x ==> %x %x\n", offset, offset<<2, page, a310_pagesize, page_sizes[a310_pagesize], poffs, a310_pages[page], a310_pages[page]*page_sizes[a310_pagesize]);
r1461r1462
281281   else
282282   {
283283      // figure out the page number and offset in the page
284      page = (offset<<2) / page_sizes[a310_pagesize];
284      page = (offset<<2) / page_sizes[a310_pagesize];
285285      poffs = (offset<<2) % page_sizes[a310_pagesize];
286286
287287//      printf("Writing offset %x (addr %x): page %x (size %d %d) offset %x ==> %x %x\n", offset, offset<<2, page, a310_pagesize, page_sizes[a310_pagesize], poffs, a310_pages[page], a310_pages[page]*page_sizes[a310_pagesize]);
r1461r1462
311311      opcode_mask = 0x1fffff;
312312      opcode_memory_min = 0;
313313      opcode_memory_max = 0x1fffff;
314      opcode_base = opcode_arg_base = memory_region(REGION_CPU1);     
314      opcode_base = opcode_arg_base = memory_region(REGION_CPU1);
315315   }
316316   else   // executing from logical memory
317   {   
318      UINT32 page = address / page_sizes[a310_pagesize]; 
317   {
318      UINT32 page = address / page_sizes[a310_pagesize];
319319
320320      opcode_mask = page_sizes[a310_pagesize]-1;
321321      opcode_memory_min = page * page_sizes[a310_pagesize];
r1461r1462
331331   memory_set_opbase_handler(0, a310_setopbase);
332332}
333333
334static const char *const ioc_regnames[] =
334static const char *const ioc_regnames[] =
335335{
336336   "(rw) Control",               // 0
337337   "(read) Keyboard receive (write) keyboard send",   // 1
r1461r1462
373373
374374   time = attotime_to_double(timer_timeelapsed(timer[tmr]));
375375   time *= 2000000.0;   // find out how many 2 MHz ticks have gone by
376   a310_timerout[tmr] = a310_timercnt[tmr] - (UINT32)time;
376   a310_timerout[tmr] = a310_timercnt[tmr] - (UINT32)time;
377377}
378378
379379static READ32_HANDLER(ioc_r)
r1461r1462
560560{
561561   UINT32 reg = data>>24;
562562   UINT32 val = data & 0xffffff;
563   static const char *vrnames[] =
563   static const char *vrnames[] =
564564   {
565565      "horizontal total",
566566      "horizontal sync width",
r1461r1462
602602         // slightly hacky: fire off a VBL right now.  the BIOS doesn't wait long enough otherwise.
603603         timer_adjust(vbl_timer, attotime_zero, 0, attotime_never);
604604      }
605   
605
606606      a310_vidregs[reg] = val>>12;
607607   }
608608   else
r1461r1462
664664   else
665665   {
666666      logerror("MEMC non-reg: W %x @ %x (mask %08x)\n", data, offset, mem_mask);
667   }   
667   }
668668}
669669
670670/*
r1461r1462
711711         break;
712712
713713      case 1:
714         phys = ((data & 0x7f) >> 1) | (data & 1) ? 0x40 : 0;
714         phys = ((data & 0x7f) >> 1) | (data & 1) ? 0x40 : 0;
715715         log = (data & 0xc00)>>10;
716716         log <<= 23;
717717         log |= (data & 0x7fe000);
src/mess/drivers/avigo.c
r1461r1462
4545#include "sound/speaker.h"
4646
4747static UINT8 avigo_key_line;
48/*
48/*
4949   bit 7:                  ?? high priority. When it occurs, clear this bit.
50   bit 6: pen int           
50   bit 6: pen int
5151    An interrupt when pen is pressed against screen.
5252
5353   bit 5: real time clock
54     
5554
56   bit 4:
57   
58     
59   bit 3: uart int           
60   
61     
55
56   bit 4:
57
58
59   bit 3: uart int
60
61
6262   bit 2: synchronisation link interrupt???keyboard int         ;; check bit 5 of port 1,
63   
63
6464   bit 1: ???      (cleared in nmi, and then set again)
6565
6666*/
r1461r1462
189189      if ((current_input_port_data[3] & 0x01)!=0)
190190      {
191191         /* pen pressed to screen */
192         
192
193193         logerror("pen pressed interrupt\n");
194194         stylus_press_x = stylus_marker_x;
195195         stylus_press_y = stylus_marker_y;
r1461r1462
271271{
272272//#if 0
273273   avigo_irq &=~(1<<5);
274   
274
275275   if (state)
276276   {
277277      avigo_irq |= (1<<5);
r1461r1462
386386static OPBASE_HANDLER( avigo_opbase_handler )
387387{
388388   void *opbase;
389   
389
390390   opbase = avigo_banked_opbase[address / 0x4000];
391391   if (opbase)
392392   {
r1461r1462
632632         /* in the avigo rom, the y coordinate is inverted! */
633633         /* therefore a low value would be near the bottom of the display,
634634         and a high value at the top */
635         
635
636636         /* total valid range 0x044->0x036a */
637637         /* 0x0350 is also checked */
638         
638
639639         /* assumption 0x044->0x0350 is screen area and
640640         0x0350->0x036a is panel at bottom */
641         
641
642642         /* 780 is therefore on-screen range */
643643         /* 3.25 a/d units per pixel */
644644         /* a/d unit * a/d range = total height */
645645         /* 3.25 * 1024.00 = 315.07 */
646         
646
647647         logerror("a/d select y coordinate\n");
648648         logerror("y coord: %d\n",stylus_press_y);
649649
r1461r1462
672672   data = 0;
673673
674674   /* original */
675   
675
676676   /* status AND   11110111 */
677677   /* status OR   01110000 -> C20F */
678   
678
679679   switch (avigo_ad_control_status & 0x078)
680680   {
681681      /* x1110xxx */
682682      /* read upper 4 bits of 10 bit A/D number */
683683      case 0x070:
684684      case 0x078:
685      {     
685      {
686686         /* upper 4 bits of 10 bit A/D number in bits 7-4 of data */
687687         /* bit 0 must be 0, bit 1 must be 0 */
688688         /* bit 3 must be 1. bit 2 can have any value */
689   
689
690690         logerror("a/d read upper 4 bits\n");
691691         data = ((avigo_ad_value>>6) & 0x0f)<<4;
692692         data |= 8;
r1461r1462
713713   /* wait for bit 0 of status to become 1 */
714714   /* read data -> d */
715715
716   
716
717717   /* C20f AND 10111111 */
718718   /* C20f OR  00001000 */
719719   /* x0111xxx */
r1461r1462
763763
764764   logerror("avigo ad read %02x\n",data);
765765
766   return data;   
766   return data;
767767}
768768
769769
r1461r1462
844844    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEMO") PORT_CODE(KEYCODE_M)
845845    PORT_BIT (0x0fe, 0xfe, IPT_UNUSED)
846846
847   PORT_START   
848   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Pen/Stylus pressed") PORT_CODE(KEYCODE_Q) PORT_CODE(JOYCODE_BUTTON1)
849    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?? Causes a NMI") PORT_CODE(KEYCODE_W) PORT_CODE(JOYCODE_BUTTON2)       
847   PORT_START
848   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Pen/Stylus pressed") PORT_CODE(KEYCODE_Q) PORT_CODE(JOYCODE_BUTTON1)
849    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?? Causes a NMI") PORT_CODE(KEYCODE_W) PORT_CODE(JOYCODE_BUTTON2)
850850
851851   /* these two ports are used to emulate the position of the pen/stylus on the screen */
852852   /* a cursor is drawn to indicate the position, so when a click is done, it will occur in the correct place */
853   PORT_START /* Mouse - X AXIS */
853   PORT_START /* Mouse - X AXIS */
854854   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
855855
856856   PORT_START /* Mouse - Y AXIS */
857857   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
858   
858
859859INPUT_PORTS_END
860860
861861
src/mess/drivers/coupe.c
r1461r1462
262262   }
263263}
264264
265static ADDRESS_MAP_START( coupe_io , ADDRESS_SPACE_IO, 8)   
265static ADDRESS_MAP_START( coupe_io , ADDRESS_SPACE_IO, 8)
266266   AM_RANGE( 0x0000, 0x0ffff) AM_READWRITE( coupe_port_r, coupe_port_w )
267267ADDRESS_MAP_END
268268
src/mess/drivers/trs80.c
r1461r1462
4545- bit 4 selects internal cassette player (low) or external unit (high) on a system-80
4646FD:
4747- bit 7 for reading the printer status on a system-80
48- all bits for writing to a printer on a system-80
48- all bits for writing to a printer on a system-80
4949F9:
5050- UART data (write) status (read) on a system-80
5151F8:
r1461r1462
541541COMP( 1981, lnw80,    trs80,    0,      model1,   trs80, trs80,    trs8012,   "LNW Research","LNW-80", GAME_NOT_WORKING )
542542COMP( 1980, trs80m3,  trs80,    0,      model3,   trs80, trs80,    trs8012,   "Tandy Radio Shack",  "TRS-80 Model III", GAME_NOT_WORKING )
543543COMP( 1980, trs80m4,  trs80,    0,      model3,   trs80, trs80,    trs8012,   "Tandy Radio Shack",  "TRS-80 Model 4", GAME_NOT_WORKING )
544                         
544
src/mess/drivers/odyssey2.c
r1461r1462
105105   1,                      /* 1 bits per pixel */
106106   { 0 },                  /* no bitplanes; 1 bit per pixel */
107107   /* x offsets */
108   {
108   {
109109   0,
110110   1,
111111   2,
r1461r1462
128128   1,                      /* 1 bits per pixel */
129129   { 0 },                  /* no bitplanes; 1 bit per pixel */
130130   /* x offsets */
131   {
131   {
132132   7,6,5,4,3,2,1,0
133133   },
134134   /* y offsets */
src/mess/drivers/ti85.c
r1461r1462
9494      4000-7fff ROM 0-15 or RAM 0-7 (switched)
9595      7000-bfff ROM 0-15 or RAM 0-7 (switched)
9696      c000-ffff RAM 0
97     
97
9898Interrupts:
9999
100100   IRQ: 200Hz timer
101        ON key   
101        ON key
102102
103103TI-81 ports:
104104   0: Video buffer offset (write only)
r1461r1462
107107   3: ON status, LCD power
108108   4: Video buffer width, interrupt control (write only)
109109   5: ?
110   6:
110   6:
111111   7: ?
112112
113113TI-85 ports:
r1461r1462
195195   AM_RANGE(0x8000, 0xbfff) AM_READWRITE( MRA8_BANK3, MWA8_BANK7 )
196196   AM_RANGE(0xc000, 0xffff) AM_READWRITE( MRA8_BANK4, MWA8_BANK8 )
197197ADDRESS_MAP_END
198       
198
199199/* keyboard input */
200200static INPUT_PORTS_START (ti81)
201201   PORT_START   /* bit 0 */
r1461r1462
236236      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE") PORT_CODE(KEYCODE_END)
237237      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x^2") PORT_CODE(KEYCODE_COLON)
238238      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y=") PORT_CODE(KEYCODE_F1)
239   PORT_START   /* bit 5 */                                                       
239   PORT_START   /* bit 5 */
240240      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P)
241241      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_PGUP)
242242      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_HOME)
r1461r1462
298298      PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("EE") PORT_CODE(KEYCODE_END)
299299      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LN") PORT_CODE(KEYCODE_BACKSLASH)
300300      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1)
301   PORT_START   /* bit 5 */                                                       
301   PORT_START   /* bit 5 */
302302      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_P)
303303      PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAN") PORT_CODE(KEYCODE_PGUP)
304304      PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("COS") PORT_CODE(KEYCODE_HOME)
src/mess/drivers/svision.c
r1461r1462
271271   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
272272   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
273273   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   )
274   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B")
275   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A")
276   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select")
277   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause")
274   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B")
275   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A")
276   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("Select")
277   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("Start/Pause")
278278INPUT_PORTS_END
279279
280280static INPUT_PORTS_START( svisions )
r1461r1462
292292   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
293293   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
294294   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(2)
295   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("2nd B") PORT_PLAYER(2)
296   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("2nd A") PORT_PLAYER(2)
297   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("2nd Select") PORT_PLAYER(2)
298   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("2nd Start/Pause") PORT_PLAYER(2)
295   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("2nd B") PORT_PLAYER(2)
296   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("2nd A") PORT_PLAYER(2)
297   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("2nd Select") PORT_PLAYER(2)
298   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("2nd Start/Pause") PORT_PLAYER(2)
299299INPUT_PORTS_END
300300
301301/* most games contain their graphics in roms, and have hardware to
r1461r1462
425425   if (svision_channel->count)
426426      svision_channel->count--;
427427   if (svision_channel[1].count)
428      svision_channel[1].count--; 
428      svision_channel[1].count--;
429429   if (svision_noise.count)
430430      svision_noise.count--;
431431}
r1461r1462
444444   svision.timer1 = timer_alloc(svision_timer, NULL);
445445   svision_pet.on = TRUE;
446446   svision_pet.timer = timer_alloc(svision_pet_timer, NULL);
447   timer_pulse(attotime_mul(ATTOTIME_IN_SEC(8), 256/machine->drv->cpu[0].clock), NULL, 0, svision_pet_timer); 
447   timer_pulse(attotime_mul(ATTOTIME_IN_SEC(8), 256/machine->drv->cpu[0].clock), NULL, 0, svision_pet_timer);
448448}
449449
450450static MACHINE_RESET( svision )
src/mess/drivers/c64.c
r1461r1462
152152Discs
153153-----
154154only file load from drive 8 and 9 implemented
155 loads file from rom directory (*.prg,*.p00,*.t64) (must NOT be specified on
155 loads file from rom directory (*.prg,*.p00,*.t64) (must NOT be specified on
156156 commandline)
157157 or file from d64 image (here also directory LOAD"$",8 supported)
158158use LOAD"filename",8
r1461r1462
271271   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Arrow-Up Pi") PORT_CODE(KEYCODE_CLOSEBRACE)
272272    PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR)
273273   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STOP RUN") PORT_CODE(KEYCODE_TAB)
274   PORT_START                                                         
274   PORT_START
275275   PORT_DIPNAME( 0x8000, IP_ACTIVE_HIGH,                                     "SHIFT-LOCK (switch)") PORT_CODE(KEYCODE_CAPSLOCK)
276   PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )                                                     
277   PORT_DIPSETTING( 0x8000, DEF_STR( On ) )                                                     
276   PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
277   PORT_DIPSETTING( 0x8000, DEF_STR( On ) )
278278   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A')
279279   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S')
280280   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D')
r1461r1462
349349   PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Arrow-Up Pi") PORT_CODE(KEYCODE_CLOSEBRACE)
350350    PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR)
351351   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("STOP RUN") PORT_CODE(KEYCODE_TAB)
352   PORT_START
352   PORT_START
353353   PORT_DIPNAME( 0x8000, IP_ACTIVE_HIGH, "SHIFT-LOCK (switch)") PORT_CODE(KEYCODE_CAPSLOCK)
354354   PORT_DIPSETTING(  0, DEF_STR( Off ) )
355355   PORT_DIPSETTING(   0x8000, DEF_STR( On ) )
src/mess/drivers/svi318.c
r1461r1462
8787
8888/*
8989  Keyboard status table
90 
90
9191       Bit#:|  7  |  6  |  5  |  4  |  3  |  2  |  1  |  0  |
9292            |     |     |     |     |     |     |     |     |
9393  Line:     |     |     |     |     |     |     |     |     |
r1461r1462
206206  PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK)
207207  PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SELECT") PORT_CODE(KEYCODE_PAUSE)
208208  PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PRINT") PORT_CODE(KEYCODE_PRTSCR)
209  PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED)
209  PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNUSED)
210210  PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT)
211211INPUT_PORTS_END
212212
r1461r1462
339339   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
340340   MDRV_SOUND_ADD(AY8910, 1789773)
341341   MDRV_SOUND_CONFIG(ay8910_interface)
342   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)   
342   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
343343MACHINE_DRIVER_END
344344
345345static MACHINE_DRIVER_START( svi318n )
src/mess/drivers/genesis.c
r1461r1462
199199      if (!strncmp((char *)&ROM[0x2120], "SUPER STREET FIGHTER2", 20))
200200      {
201201         is_ssf2 = 1;
202      }     
202      }
203203   }
204204
205205   ROM = memory_region(REGION_CPU1);   /* 68000 ROM region */
src/mess/drivers/pc.c
r1461r1462
14181418
14191419#if 0
14201420   //pcjr roms? (incomplete dump, most likely 64 kbyte)
1421   // basic c1.20
1421   // basic c1.20
14221422    ROM_LOAD("basic.rom", 0xf6000, 0x8000, CRC(0c19c1a8))
14231423   // ???
14241424    ROM_LOAD("bios.rom", 0x??000, 0x2000, CRC(98463f95))
src/mess/drivers/compis.c
r1461r1462
1010      - Intel 80186 CPU 8MHz, integrated DMA(8237?), PIC(8259?), PIT(8253?)
1111                - Intel 80130 OSP Operating system processor (PIC 8259, PIT 8254)
1212      - Intel 8274 MPSC Multi-protocol serial communications controller (NEC 7201)
13      - Intel 8255 PPI Programmable peripheral interface
13      - Intel 8255 PPI Programmable peripheral interface
1414      - Intel 8253 PIT Programmable interval timer
1515      - Intel 8251 USART Universal synchronous asynchronous receiver transmitter
1616      - National 58174 Real-time clock (compatible with 58274)
src/mess/drivers/bbcbc.c
r1461r1462
4949};
5050
5151/* TODO */
52static const z80pio_interface pio_intf =
52static const z80pio_interface pio_intf =
5353{
5454   NULL,
5555   NULL,
src/mess/drivers/kc.c
r1461r1462
113113
114114
115115static ADDRESS_MAP_START(kc85_4_io, ADDRESS_SPACE_IO, 8)
116   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
116   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
117117   AM_RANGE(0x0000, 0x0ffff) AM_READWRITE( kc85_4_port_r, kc85_4_port_w )
118118ADDRESS_MAP_END
119119
r1461r1462
298298
299299
300300static ADDRESS_MAP_START(kc85_3_io, ADDRESS_SPACE_IO, 8)
301   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
301   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
302302   AM_RANGE(0x0000, 0x0ffff) AM_READWRITE(kc85_3_port_r, kc85_3_port_w)
303303ADDRESS_MAP_END
304304

Previous 15994 Revisions Next


© 1998-2018 The MESS Team