Skip to content

vdrive swaps sd_lba_i[] array members #57

Open
@Rhialto

Description

I was working on integrating the 4040/8250 from https://github.com/eriks5/CBM-II_MiSTer/blob/master/rtl/ieee_drive into my MegaPET core. The drive behaved strangely.

With some analysis, I found out that drive 0 always received the data from track 18, even when it tried to read other tracks. It turned out that drive 1 was set to track 18.

So in my main.vhd file I swap the LBA values for the drives, when I feed them to vdrives_inst. The same for the number of sectors. With that change it works.

   vdrives_inst : entity work.vdrives
      generic map (
         VDNUM                => G_VDNUM,             -- amount of virtual drives
         BLKSZ                => 1                    -- 1 = 256 bytes block size
      )
      port map (
...
         -- MiSTer's "SD block level access" interface, which runs in QNICE's clock domain
         -- using dedicated signal on Mister's side such as "clk_sys"
         -- BUG ??? Swap LBAs of drive 0 and 1
         sd_lba_i         => ( 0 => iec_sd_lba(1), 1 => iec_sd_lba(0) ), -- was iec_sd_lba,
         sd_blk_cnt_i     => ( 0 => iec_sd_blk_cnt(1), 1 => iec_sd_blk_cnt(0) ),-- was iec_sd_blk_cnt, -- number of blocks-1
         sd_rd_i              => iec_sd_rd,
         sd_wr_i              => iec_sd_wr,
         sd_ack_o             => iec_sd_ack,

This swapping I have done here is of course totally un-generic and working for 2 drives only.

I haven't found if the actual bug is in the vhdl for the vdrives or in the QNICE assembly code (at least I assume there is some code involved to copy the disk's data at runtime).

This may explain also why in my earlier attempts to have 2 2031 drives, it didn't work very well.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions