Subversion Repositories pentevo

Rev

Rev 798 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. #pragma once
  2.  
  3. const int Z80FQ = 3500000; // todo: #define as (conf.frame*conf.intfq)
  4. const int FDD_RPS = 5; // rotation speed
  5.  
  6. const int MAX_TRACK_LEN = 6250;
  7. constexpr unsigned MAX_SEC_DATA_LEN = 6144U;
  8. const int MAX_CYLS = 86;            // don't load images with so many tracks
  9. const int MAX_PHYS_CYL = 86;        // don't seek over it
  10. const int MAX_SEC = 256;
  11.  
  12. struct WD1793
  13. {
  14.    enum WDSTATE
  15.    {
  16.       S_IDLE = 0,
  17.       S_WAIT,
  18.  
  19.       S_DELAY_BEFORE_CMD,
  20.       S_CMD_RW,
  21.       S_FOUND_NEXT_ID,
  22.       S_RDSEC,
  23.       S_READ,
  24.       S_WRSEC,
  25.       S_WRITE,
  26.       S_WRTRACK,
  27.       S_WR_TRACK_DATA,
  28.  
  29.       S_TYPE1_CMD,
  30.       S_STEP,
  31.       S_SEEKSTART,
  32.       S_RESTORE,
  33.       S_SEEK,
  34.       S_VERIFY,
  35.       S_VERIFY2,
  36.  
  37.       S_WAIT_HLT,
  38.       S_WAIT_HLT_RW,
  39.  
  40.       S_EJECT1,
  41.       S_EJECT2
  42.    };
  43.  
  44.    __int64 next, time;
  45.    __int64 idx_tmo;
  46.  
  47.    struct FDD *seldrive;
  48.    unsigned tshift;
  49.  
  50.    WDSTATE state, state2;
  51.  
  52.    unsigned char cmd;
  53.    unsigned char data, track, sector;
  54.    unsigned char rqs, status;
  55.    u8 sign_status; // ┬эх°эшх ёшуэры√ (яюър Єюы№ъю HLD)
  56.  
  57.    unsigned drive, side;                // update this with changing 'system'
  58.  
  59.    signed char stepdirection;
  60.    unsigned char system;                // beta128 system register
  61.  
  62.    unsigned idx_cnt; // idx counter
  63.  
  64.    // read/write sector(s) data
  65.    __int64 end_waiting_am;
  66.    unsigned foundid;                    // index in trkcache.hdr for next encountered ID and bytes before this ID
  67.    unsigned rwptr, rwlen;
  68.  
  69.    // format track data
  70.    unsigned start_crc;
  71.  
  72.    enum CMDBITS
  73.    {
  74.       CMD_SEEK_RATE     = 0x03,
  75.       CMD_SEEK_VERIFY   = 0x04,
  76.       CMD_SEEK_HEADLOAD = 0x08,
  77.       CMD_SEEK_TRKUPD   = 0x10,
  78.       CMD_SEEK_DIR      = 0x20,
  79.  
  80.       CMD_WRITE_DEL     = 0x01,
  81.       CMD_SIDE_CMP_FLAG = 0x02,
  82.       CMD_DELAY         = 0x04,
  83.       CMD_SIDE          = 0x08,
  84.       CMD_SIDE_SHIFT    = 3,
  85.       CMD_MULTIPLE      = 0x10
  86.    };
  87.  
  88.    enum BETA_STATUS
  89.    {
  90.       DRQ   = 0x40,
  91.       INTRQ = 0x80
  92.    };
  93.  
  94.    enum WD_STATUS
  95.    {
  96.       WDS_BUSY      = 0x01,
  97.       WDS_INDEX     = 0x02,
  98.       WDS_DRQ       = 0x02,
  99.       WDS_TRK00     = 0x04,
  100.       WDS_LOST      = 0x04,
  101.       WDS_CRCERR    = 0x08,
  102.       WDS_NOTFOUND  = 0x10,
  103.       WDS_SEEKERR   = 0x10,
  104.       WDS_RECORDT   = 0x20,
  105.       WDS_HEADL     = 0x20,
  106.       WDS_WRFAULT   = 0x20,
  107.       WDS_WRITEP    = 0x40,
  108.       WDS_NOTRDY    = 0x80
  109.    };
  110.  
  111.    enum WD_SYS
  112.    {
  113.       SYS_HLT       = 0x08
  114.    };
  115.  
  116.    enum WD_SIG
  117.    {
  118.        SIG_HLD      = 0x01
  119.    };
  120.  
  121.    unsigned char in(unsigned char port);
  122.    void out(unsigned char port, unsigned char val);
  123.    u8 RdStatus();
  124.  
  125.    void process();
  126.    void find_marker();
  127.    char notready();
  128.    void load();
  129.    void getindex();
  130.    void trdos_traps();
  131.  
  132. //   TRKCACHE trkcache;
  133.  
  134.    bool EjectPending;
  135.    void Eject(unsigned Drive);
  136.  
  137.    WD1793();
  138. };
  139.