Menu

floppy recalibration not getting irq 6 in return

2020-11-14
2020-11-16
  • jimmy zhang

    jimmy zhang - 2020-11-14

    n the init_floppy routine, trying to re-calibrate... I am using the first drive...
    so I send the cmd and drive # to the FDC, got stuck in the infinite loop that is
    supposed to exit upon irq6 interrupt... what could go wrong here?
    I have made a few checks. eflag's irq enable bit is on...
    also the previous times the interrupt and irq routine works... (as I reset FDC by
    writing a zero to DOR)...
    any suggestions??
    My code snippet below, I got stuck in the while loop
    Code:
    int st0, cy1;
    floppy_motor(1);
    print("start the timer \n");
    //magic();
    //exec(run_floppy_timer);

    int i=0;
    for (i=0;i<10;i++){
        floppy_write_cmd(RECALIBERATE); // 7
        floppy_write_cmd(1); // select first drive
        //irq6 = 1;
        //sti();
        while(irq6);
    
     
  • Volker Ruppert

    Volker Ruppert - 2020-11-14

    This is not a Bochs bug, since the recalibrate command raises IRQ 6 as expected. The comment in the code says that you want to select the first drive (Linux /dev/fd0 / DOS/Windows A:), but send the command to drive #1. The values for the drive selection in DOR and floppy command are different. Please change the 1in the command to 0 and try again.

     
  • jimmy zhang

    jimmy zhang - 2020-11-15

    ok, my toy OS has 2 floppy, both 1.44mb, I am trying to initialize the second one...which is formatted as fat12.
    Now DOR's last 2 bits selects the drive.. so the DOR should be set to 0x0d (dma 1, reset 1, dsel 1)
    write 0 to DOR then write 0x0d to it, I received the first interrupt..

    there are a couple of things like setting data rate and specify the step rate and head unload/load

    now I can turn on the motor by writing 0x2d to 0x3f2 (DOR), wait for 500ms, then I issue command recalibrate , first input is 1 (which selects the first drive) ... now I am supposed to receive another interrupt... I am stuck there!!!

     
  • Volker Ruppert

    Volker Ruppert - 2020-11-15

    Do you have a bootable image that I can test here? Otherwise it's hard to find out what's going wrong.

     
  • jimmy zhang

    jimmy zhang - 2020-11-15

    I created a compressed zip file that contains everything I got with my OS, if you have a linux machine, just have to run the bochs script... to do that
    1. unzip
    2. cd into the directory that is generated by the unzip command
    3. run this single command
    (cd src; make clean; make all); ./update_image.sh; ./run_bochs.sh

     

    Last edit: jimmy zhang 2020-11-16
  • jimmy zhang

    jimmy zhang - 2020-11-16

    I have tried to reset fdc twice, both times triggered the interrupt, no interrupt is triggered by recalibrate. I have tried to recalibrate without floppy reset, I got the interrupt!!!

     

    Last edit: jimmy zhang 2020-11-16

Log in to post a comment.