Previous 199869 Revisions Next

r26370 Saturday 23rd November, 2013 at 08:25:26 UTC by Jürgen Buchmüller
Modify the interface to the Diablo drive to match the bus lines more closely.
[/branches/alto2/src/emu/cpu/alto2]a2disk.c
[/branches/alto2/src/emu/machine]diablo_hd.c diablo_hd.h

branches/alto2/src/emu/machine/diablo_hd.c
r26369r26370
8484   m_rdgate_0(1),
8585   m_cylinders(DIABLO_CYLINDERS),
8686   m_pages(DIABLO_PAGES),
87   m_seekto(0),
88   m_restore(0),
8789   m_cylinder(-1),
8890   m_head(-1),
8991   m_sector(-1),
r26369r26370
905907/**
906908 * @brief return the current cylinder of a drive unit
907909 *
910 * This is a convenience function.
911 * There is no such signal on the BUS.
912 *
908913 * Note: The bus lines are active low
909914 * The value on the BUS needs an XOR with DIABLO_CYLINDER_MASK
910915 * to resemble the physical line levels.
r26369r26370
919924/**
920925 * @brief return the current head of a drive unit
921926 *
927 * This is a convenience function.
928 * There is no such signal on the BUS.
929 *
922930 * Note: The bus lines are active low
923931 * The value on the BUS needs an XOR with DIABLO_HEAD_MASK
924932 * to resemble the physical line levels.
r26369r26370
951959/**
952960 * @brief return the current page of a drive unit
953961 *
954 * The current page number is derived from the cylinder, head, and sector numbers.
955962 * This is a convenience function.
956963 * There is no such signal on the BUS.
957964 *
965 * The current page number is derived from the cylinder,
966 * head, and sector numbers.
967 *
958968 * @return the current page for the drive
959969 */
960970int diablo_hd_device::get_page() const
r26369r26370
963973}
964974
965975/**
966 * @brief select a drive unit and head
976 * @brief select a drive unit
967977 *
978 * Selecting a drive unit updates the ready status
979 *
968980 * @param unit unit number
969 * @param head head number
970981 */
971void diablo_hd_device::select(int unit, int head)
982void diablo_hd_device::select(int unit)
972983{
973   assert(unit == m_unit);
974   /* this drive is selected */
975   if ((head & DIABLO_HEAD_MASK) != m_head) {
976      m_head = head & DIABLO_HEAD_MASK;
977      LOG_DRIVE((0,"[DHD%u]   select unit:%d head:%d\n", m_unit, unit, head));
978   }
984   assert(unit == m_unit);   // this drive is selected
979985
980986   if (m_disk) {
981987      m_ready_0 = 0;               // it is ready
r26369r26370
9941000}
9951001
9961002/**
1003 * @brief set the selected head
1004 * @param head head number
1005 */
1006void diablo_hd_device::set_head(int head)
1007{
1008   if ((head & DIABLO_HEAD_MASK) != m_head) {
1009      m_head = head & DIABLO_HEAD_MASK;
1010      LOG_DRIVE((0,"[DHD%u]   select head:%d\n", m_unit, m_head));
1011   }
1012}
1013
1014/**
1015 * @brief set the cylinder number to seek to
1016 *
1017 * This defines the cylinder to seek when the
1018 * STROBE line is pulsed.
1019 *
1020 * @param cylinder cylinder number (bus lines CYL[0-9])
1021 */
1022void diablo_hd_device::set_cylinder(int cylinder)
1023{
1024   if ((cylinder & DIABLO_CYLINDER_MASK) != m_seekto) {
1025      m_seekto = cylinder & DIABLO_CYLINDER_MASK;
1026      LOG_DRIVE((0,"[DHD%u]   seek to cylinder:%d\n", m_unit, m_seekto));
1027   }
1028}
1029
1030/**
1031 * @brief set the restore line
1032 *
1033 * If the restore line is asserted when the
1034 * STROBE line is pulsed, the drive seeks
1035 * towards cylinder 0.
1036 *
1037 * @param restore state of the restore line
1038 */
1039void diablo_hd_device::set_restore(int restore)
1040{
1041   if ((restore & 1) != m_restore) {
1042      m_restore = restore & 1;
1043      LOG_DRIVE((0,"[DHD%u]   restore:%d\n", m_unit, m_restore));
1044   }
1045}
1046
1047/**
9971048 * @brief strobe a seek operation
9981049 *
999 * Seek to the cylinder %cylinder, or restore to cylinder 0.
1050 * Seek to the specified cylinder m_seekto,
1051 * or restore to cylinder 0, if m_restore is set.
10001052 *
1001 * @param unit unit number
1002 * @param cylinder cylinder number to seek to
1003 * @param restore true, if the drive should restore to cylinder 0
10041053 * @param strobe current level of the strobe signal (for edge detection)
10051054 */
1006void diablo_hd_device::set_strobe(int cylinder, bool restore, int strobe)
1055void diablo_hd_device::set_strobe(int strobe)
10071056{
1008   int seekto = restore ? 0 : cylinder;
1057   int seekto = m_restore ? 0 : m_seekto;
10091058   if (strobe) {
10101059      LOG_DRIVE((1,"[DHD%u]   STROBE end of interlock\n", m_unit));
10111060      // deassert the log address interlock
r26369r26370
13181367   m_log_addx_interlock_0 = 1;      // deassert drive log address interlock
13191368   m_seek_incomplete_0 = 1;      // deassert drive seek incomplete
13201369
1370   // reset the disk drive's strobe info
1371   m_seekto = 0;
1372   m_restore = 0;
13211373   // reset the disk drive's address
13221374   m_cylinder = 0;
13231375   m_head = 0;
branches/alto2/src/emu/machine/diablo_hd.h
r26369r26370
5757   int get_head() const;
5858   int get_sector() const;
5959   int get_page() const;
60   void select(int unit, int head);
61   void set_strobe(int cylinder, bool restore, int strobe);
60   void select(int unit);
61   void set_head(int head);
62   void set_cylinder(int cylinder);
63   void set_restore(int restore);
64   void set_strobe(int strobe);
6265   void set_egate(int gate);
6366   void set_wrgate(int gate);
6467   void set_rdgate(int gate);
r26369r26370
101104   int m_rdgate_0;                     //!< read gate
102105   int m_cylinders;                  //!< total number of cylinders
103106   int m_pages;                     //!< total number of pages
107   int m_seekto;                     //!< seek to cylinder number
108   int m_restore;                     //!< restore to cylinder 0 flag
104109   int m_cylinder;                     //!< current cylinder number
105110   int m_head;                        //!< current head (track) number on cylinder
106111   int m_sector;                     //!< current sector number in track
branches/alto2/src/emu/cpu/alto2/a2disk.c
r26369r26370
844844void alto2_cpu_device::disk_strobon(void* ptr, INT32 arg)
845845{
846846   (void)ptr;
847   UINT8 unit = arg % 2;
848   UINT8 restore = (arg / 2) % 2;
849   INT32 cylinder = arg / 4;
850   int seekok;
851   int lai;
852   int strobe;
847   int unit = arg % 2;
848   int restore = (arg / 2) % 2;
849   int cylinder = arg / 4;
853850
854851   diablo_hd_device* dhd = m_drive[unit];
855852   LOG((LOG_DISK,2,"   STROBE #%d restore:%d cylinder:%d dhd:%p\n", unit, restore, cylinder, dhd));
856853
857   /* This is really monoflop 52a generating a very short 0 pulse */
858   for (strobe = 0; strobe < 2; strobe++) {
854   //
855   dhd->set_cylinder(cylinder);
856   dhd->set_restore(restore);
857   // This is really monoflop 52a generating a very short 0 pulse
858   for (int strobe = 0; strobe < 2; strobe++) {
859859      UINT8 s0, s1;
860      /* pulse the strobe signal to the unit */
861      dhd->set_strobe(cylinder, restore, strobe);
860      dhd->set_strobe(strobe);   // pulse the strobe signal to the unit
862861
863      lai = dhd->get_log_addx_interlock_0();
862      int lai = dhd->get_log_addx_interlock_0();
864863      LOG((LOG_DISK,6,"      LAI':%d\n", lai));
865864      /**
866865       * JK flip-flop 44a (LAI' clocked)
r26369r26370
895894      /* clear the monoflop 52b, i.e. no timer restart */
896895      LOG((LOG_DISK,2,"      STROBON:%d\n", m_dsk.strobe));
897896      /* update the seekok status: SKINC' && LAI' && Q' of FF 44a */
898      seekok = dhd->get_seek_incomplete_0();
897      int seekok = dhd->get_seek_incomplete_0();
899898      if (seekok != m_dsk.seekok) {
900899         m_dsk.seekok = seekok;
901900         LOG((LOG_DISK,2,"      SEEKOK:%d\n", m_dsk.seekok));
r26369r26370
13101309 */
13111310void alto2_cpu_device::f1_late_load_kadr()
13121311{
1313   int unit, head;
1314
13151312   /* store into the separate fields of KADR */
13161313   PUT_KADR_SEAL(m_dsk.kadr, GET_KADR_SEAL(m_bus));
13171314   PUT_KADR_HEADER(m_dsk.kadr, GET_KADR_HEADER(m_bus));
r26369r26370
13201317   PUT_KADR_NOXFER(m_dsk.kadr, GET_KADR_NOXFER(m_bus));
13211318   PUT_KADR_UNUSED(m_dsk.kadr, GET_KADR_UNUSED(m_bus));
13221319
1323   unit = GET_KADDR_DRIVE(m_dsk.kaddr);   // get selected drive from DATA[14] output (FF 67a really)
1324   head = GET_KADDR_HEAD(m_dsk.dataout);   // latch head from DATA[13]
1325   PUT_KADDR_HEAD(m_dsk.kaddr, head);      // store in KADDR
1320   int unit = GET_KADDR_DRIVE(m_dsk.kaddr);   // get selected drive from DATA[14] output (FF 67a really)
1321   int head = GET_KADDR_HEAD(m_dsk.dataout);   // latch head from DATA[13]
1322   PUT_KADDR_HEAD(m_dsk.kaddr, head);         // store in KADDR
13261323
1327   /* take the selected head and select drive unit and head in the DIABLO HD */
1324   // select drive unit
13281325   diablo_hd_device* dhd = m_drive[unit];
1329   dhd->select(unit, head);
1326   dhd->select(unit);
1327   // set selected head
1328   dhd->set_head(head);
13301329
1331   /* On KDAR← load bit 0 of parts #36 and #37 is reset to 0, i.e. recno = 0 */
1330   // On KDAR← load bit 0 of parts #36 and #37 is reset to 0, i.e. recno = 0
13321331   m_dsk.krecno = 0;
1333   /* current read/write/check is that for the header */
1332   // current read/write/check is that for the header
13341333   m_dsk.krwc = GET_KADR_HEADER(m_dsk.kadr);
13351334
13361335   LOG((LOG_DISK,1,"   KADR←; BUS[8-14] #%o\n", m_dsk.kadr));

Previous 199869 Revisions Next


© 1997-2024 The MAME Team