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