Previous 15994 Revisions Next

r6640 Tuesday 15th December, 2009 at 11:45:45 UTC by Dirk Best
Use floppy_wpt_r() instead of floppy_drive_get_flag_state()
[src/mess/devices]flopdrv.c flopdrv.h sonydriv.c thomflop.c
[src/mess/drivers]bw2.c
[src/mess/machine]c1541.c i8271.c mc6843.c smc92x4.c upd765.c wd17xx.c

src/mess/devices/flopdrv.c
r6639r6640
475475
476476   flags |= drive_flags & FLOPPY_DRIVE_HEAD_AT_TRACK_0;
477477
478   /* if disk image is read-only return write protected all the time */
479   if (!image_is_writable(img))
480   {
481      flags |= FLOPPY_DRIVE_DISK_WRITE_PROTECTED;
482   }
483   else
484   {
485      /* return real state of write protected flag */
486      flags |= drive_flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED;
487   }
488
489478   /* drive present not */
490479   if (!image_slotexists(img))
491480   {
492481      /* adjust some flags if drive is not present */
493482      flags &= ~FLOPPY_DRIVE_HEAD_AT_TRACK_0;
494      flags |= FLOPPY_DRIVE_DISK_WRITE_PROTECTED;
495483   }
496484
497485    flags &= flag;
r6639r6640
705693   floppy->drive_id = floppy_get_drive(device);
706694   floppy->active = FALSE;
707695
696   /* by default we are write-protected */
697   floppy->wpt = CLEAR_LINE;
698
708699   /* resolve callbacks */
709700   devcb_resolve_write_line(&floppy->out_idx_func, &floppy->config->out_idx_func, device);
710701   devcb_resolve_read_line(&floppy->in_mon_func, &floppy->config->in_mon_func, device);
r6639r6640
978969READ_LINE_DEVICE_HANDLER( floppy_wpt_r )
979970{
980971   floppy_drive *drive = get_safe_token(device);
972
973   if (image_slotexists(device))
974   {
975      if (image_is_writable(device))
976         drive->wpt = ASSERT_LINE;
977      else
978         drive->wpt = CLEAR_LINE;
979   }
980
981981   return drive->wpt;
982982}
983983
src/mess/devices/sonydriv.c
r6639r6640
292292         break;
293293      case 0x06:   /* Disk is locked 0=locked 1=unlocked */
294294         if (cur_image)
295            result = floppy_drive_get_flag_state(cur_image, FLOPPY_DRIVE_DISK_WRITE_PROTECTED) ? 0 : 1;
295            result = floppy_wpt_r(cur_image);
296296         else
297297            result = 0;
298298         break;
src/mess/devices/flopdrv.h
r6639r6640
6262   unsigned long flags;
6363} chrn_id;
6464
65/* set if disc is write protected - also set if drive is present but no disc in drive */
66#define FLOPPY_DRIVE_DISK_WRITE_PROTECTED      0x0002
6765/* set if drive is connected and head is positioned over track 0 */
6866#define FLOPPY_DRIVE_HEAD_AT_TRACK_0         0x0004
6967/* set if drive is ready */
src/mess/devices/thomflop.c
r6639r6640
546546/* update MC6852 status register */
547547static void to7_qdd_stat_update( running_machine *machine )
548548{
549   int flags = floppy_drive_get_flag_state( to7_qdd_image(machine), -1 );
550
551549   /* byte-ready */
552550   to7qdd->status |= QDD_S_RDA | QDD_S_TDRA;
553551   if ( ! to7qdd->drive )
554552      to7qdd->status |= QDD_S_PE;
555553
556554   /* write-protect */
557   if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
555   if (floppy_wpt_r(to7_qdd_image(machine)) == CLEAR_LINE)
558556      to7qdd->status |= QDD_S_NCTS;
559557
560558   /* sticky reset conditions */
r6639r6640
12391237            UINT8 length = thmfc1->data[7]; /* actually, log length */
12401238            UINT8 filler = 0xe5;            /* standard Thomson filler */
12411239                                chrn_id id;
1242                                if ( thmfc_floppy_find_sector( machine, &id ) )
1243                                {                                       
1240                                if ( thmfc_floppy_find_sector( machine, &id ) )
1241                                {
12441242                                        floppy_drive_format_sector( img, side, thmfc1->sector_id, track, thmfc1->side, sector, length, filler );
12451243                                        thom_floppy_active( machine, 1 );
12461244                                }
r6639r6640
12901288      }
12911289      if ( ! (flags & FLOPPY_DRIVE_MOTOR_ON ) )
12921290         data |= 0x10;
1293      if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
1291      if (!floppy_wpt_r(img))
12941292         data |= 0x04;
12951293      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
12961294      return data;
src/mess/machine/upd765.c
r6639r6640
10601060   const device_config *img = current_image(device);
10611061
10621062   /* write protected? */
1063   if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1063   if (floppy_wpt_r(img) == CLEAR_LINE)
10641064   {
10651065      fdc->upd765_status[1] |= UPD765_ST1_NOT_WRITEABLE;
10661066
r6639r6640
11861186   }
11871187
11881188   /* write protected? */
1189   if (floppy_drive_get_flag_state(current_image(device), FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1189   if (floppy_wpt_r(current_image(device)) == CLEAR_LINE)
11901190   {
11911191      fdc->upd765_status[1] |= UPD765_ST1_NOT_WRITEABLE;
11921192
r6639r6640
18921892
18931893         if (img)
18941894         {
1895            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1896            {
1897               fdc->upd765_status[3] |= 0x40;
1898            }
1895            fdc->upd765_status[3] |= !floppy_wpt_r(img) << 6;
18991896
19001897            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
19011898            {
src/mess/machine/c1541.c
r6639r6640
5656
5757   ...
5858
59   PCB Assy # 1540008-01   
59   PCB Assy # 1540008-01
6060   Schematic # 1540001
6161   Original "Long" Board
6262   Has 4 discreet 2114 RAMs
6363   ALPS Drive only
6464
65   PCB Assy # 1540048   
65   PCB Assy # 1540048
6666   Schematic # 1540049
6767   Referred to as the CR board
6868   Changed to 2048 x 8 bit RAM pkg.
r6639r6640
7070   Alps Drive (-01)
7171   Newtronics Drive (-03)
7272
73   PCB Assy # 250442-01   
73   PCB Assy # 250442-01
7474   Schematic # 251748
7575   Termed the 1541 A
7676   Just one jumper change to accommodate both types of drive
7777
78   PCB Assy # 250446-01   
78   PCB Assy # 250446-01
7979   Schematic # 251748 (See Notes)
8080   Termed the 1541 A-2
8181   Just one jumper change to accommodate both types of drive
r6639r6640
8484
8585   VIC1541 1540001-01   Very early version, long board.
8686         1540001-03   As above, only the ROMs are different.
87         1540008-01   
87         1540008-01
8888
8989   1541    1540048-01   Shorter board with a 40 pin gate array, Alps mech.
9090         1540048-03   As above, but Newtronics mech.
r6639r6640
9999   1541A   250442-01    Alps or Newtronics drive selected by a jumper.
100100   1541A2  250446-01    A 74LS123 replaces the 9602 at UD4.
101101   1541B   250448-01    Same as the 1541C, but in a case like the 1541.
102   1541C   250448-01    Short board, new 40/42 pin gate array, 20 pin gate
102   1541C   250448-01    Short board, new 40/42 pin gate array, 20 pin gate
103103                   array and a R/W hybrid chip replace many components.
104104                   Uses a Newtronics drive with optical trk 0 sensor.
105   1541C   251854       As above, single DOS ROM IC, trk 0 sensor, 30 pin
105   1541C   251854       As above, single DOS ROM IC, trk 0 sensor, 30 pin
106106                   IC for R/W ampl & stepper motor control (like 1571).
107                       
107
108108   1541-II              A complete redesign using the 40 pin gate array
109109                   from the 1451C and a Sony R/W hybrid, but not the
110110                   20 pin gate array, single DOS ROM IC.
r6639r6640
203203   const device_config *via1;
204204   const device_config *serial_bus;
205205   const device_config *image;
206   
206
207207   /* timers */
208208   emu_timer *bit_timer;
209209};
r6639r6640
284284
285285      cpu_set_input_line(c1541->cpu, M6502_SET_OVERFLOW, byte_ready);
286286      via_ca1_w(c1541->via1, 0, byte_ready);
287     
287
288288      c1541->byte = byte;
289289   }
290290}
r6639r6640
442442   */
443443
444444   c1541_t *c1541 = get_safe_token(device->owner);
445   
445
446446   int data_out = BIT(data, 1);
447447   int clk_out = BIT(data, 3);
448448   int atna = BIT(data, 4);
r6639r6640
489489      bit      description
490490
491491      PA0      TR00 SENCE
492      PA1     
493      PA2     
494      PA3     
495      PA4     
496      PA5     
497      PA6     
498      PA7     
492      PA1
493      PA2
494      PA3
495      PA4
496      PA5
497      PA6
498      PA7
499499
500500   */
501   
501
502502   c1541_t *c1541 = get_safe_token(device->owner);
503503
504504   return !(floppy_drive_get_flag_state(c1541->image, FLOPPY_DRIVE_HEAD_AT_TRACK_0) == FLOPPY_DRIVE_HEAD_AT_TRACK_0);
r6639r6640
534534      bit      description
535535
536536      PA0      DI0
537      PA1      DI1   
537      PA1      DI1
538538      PA2      DI2
539539      PA3      DI3
540540      PA4      DI4
r6639r6640
554554      bit      description
555555
556556      PA0      DI0
557      PA1      DI1   
557      PA1      DI1
558558      PA2      DI2
559559      PA3      DI3
560560      PA4      DI4
r6639r6640
700700   UINT8 data = 0;
701701
702702   /* write protect sense */
703   data |= (floppy_drive_get_flag_state(c1541->image, FLOPPY_DRIVE_DISK_WRITE_PROTECTED) == FLOPPY_DRIVE_DISK_WRITE_PROTECTED) << 4;
703   data |= !floppy_wpt_r(c1541->image) << 4;
704704
705705   /* SYNC detect line */
706706   data |= !(c1541->mode && ((c1541->data & SYNC_MARK) == SYNC_MARK)) << 7;
src/mess/machine/wd17xx.c
r6639r6640
560560}
561561
562562
563/*
564   Write an entire track. Formats which do not define a write_track
565   function pointer will cause a silent return.
566*/
563/*
564   Write an entire track. Formats which do not define a write_track
565   function pointer will cause a silent return.
566*/
567567static void write_track(const device_config *device)
568568{
569569   wd1770_state *w = get_safe_token(device);
r6639r6640
10781078   {
10791079
10801080      /* drive write protected? */
1081      if (floppy_drive_get_flag_state(w->drive,FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1081      if (floppy_wpt_r(w->drive) == CLEAR_LINE)
10821082      {
10831083         w->status |= STA_2_WRITE_PRO;
10841084
r6639r6640
15481548         {
15491549
15501550            /* drive write protected? */
1551            if (floppy_drive_get_flag_state(w->drive,FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1551            if (floppy_wpt_r(w->drive) == CLEAR_LINE)
15521552            {
15531553            /* yes */
15541554               w->status |= STA_2_WRITE_PRO;
src/mess/machine/i8271.c
r6639r6640
872872               i8271->drive_control_input = (1<<6) | (1<<2);
873873
874874               /* bit 3 = 0 if write protected */
875               if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
876               {
877                  i8271->drive_control_input |= (1<<3);
878               }
875               i8271->drive_control_input |= floppy_wpt_r(img) << 3;
879876
880877               /* bit 1 = 0 if head at track 0 */
881878               if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_HEAD_AT_TRACK_0))
r6639r6640
10941091         }
10951092
10961093         /* bit 3 = 1 if write protected */
1097         if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1098         {
1099            status |= (1<<3);
1100         }
1094         status |= !floppy_wpt_r(img) << 3;
11011095
11021096         /* bit 1 = 1 if head at track 0 */
11031097         if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_HEAD_AT_TRACK_0))
r6639r6640
12261220         }
12271221         else
12281222         {
1229            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1223            if (floppy_wpt_r(img) == CLEAR_LINE)
12301224            {
12311225               /* Completion type: operation intervention probably required for recovery */
12321226               /* Completion code: Drive write protected */
r6639r6640
12711265         }
12721266         else
12731267         {
1274            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1268            if (floppy_wpt_r(img) == CLEAR_LINE)
12751269            {
12761270               /* Completion type: operation intervention probably required for recovery */
12771271               /* Completion code: Drive write protected */
src/mess/machine/mc6843.c
r6639r6640
514514   {
515515      /* update */
516516      const device_config* img = mc6843_floppy_image( device );
517      int flag = floppy_drive_get_flag_state( img, FLOPPY_DRIVE_READY | FLOPPY_DRIVE_HEAD_AT_TRACK_0 | FLOPPY_DRIVE_DISK_WRITE_PROTECTED );
517      int flag = floppy_drive_get_flag_state( img, FLOPPY_DRIVE_READY | FLOPPY_DRIVE_HEAD_AT_TRACK_0);
518518      mc6843->STRA &= 0xa3;
519519      if ( flag & FLOPPY_DRIVE_READY )
520520         mc6843->STRA |= 0x04;
521521      if ( flag & FLOPPY_DRIVE_HEAD_AT_TRACK_0 )
522522         mc6843->STRA |= 0x08;
523      if ( flag & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
524         mc6843->STRA |= 0x10;
523
524      mc6843->STRA |= !floppy_wpt_r(img) << 4;
525
525526      if ( mc6843->index_pulse )
526527         mc6843->STRA |= 0x40;
527528
src/mess/machine/smc92x4.c
r6639r6640
261261      reply |= DS_INDEX;
262262   if (floppy_drive_get_flag_state(disk_img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) == FLOPPY_DRIVE_HEAD_AT_TRACK_0)
263263      reply |= DS_TRK00;
264   if (floppy_drive_get_flag_state(disk_img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED) == FLOPPY_DRIVE_DISK_WRITE_PROTECTED)
264
265   if (floppy_wpt_r(disk_img) == CLEAR_LINE)
265266      reply |= DS_WRPROT;
266267   if (image_exists(disk_img))
267268      reply |= DS_READY;
src/mess/drivers/bw2.c
r6639r6640
435435   data |= centronics_busy_r(state->centronics) << 4;
436436   data |= state->mfdbk << 5;
437437
438   data |= floppy_drive_get_flag_state(get_floppy_image(device->machine, state->selected_drive), FLOPPY_DRIVE_DISK_WRITE_PROTECTED) ? 0x00 : 0x80;
438   data |= floppy_wpt_r(get_floppy_image(device->machine, state->selected_drive)) << 7;
439439
440440   return data;
441441}
r6639r6640
840840   MDRV_WD179X_ADD("wd179x", bw2_wd17xx_interface )
841841
842842   MDRV_FLOPPY_2_DRIVES_ADD(bw2_floppy_config)
843   
843
844844   /* internal ram */
845845   MDRV_RAM_ADD("messram")
846846   MDRV_RAM_DEFAULT_SIZE("64K")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team