flat assembler
Message board for the users of flat assembler.

flat assembler > OS Construction > Problems with floppy controler in PMode

Author
Thread Post new topic Reply to topic
yupi



Joined: 16 Aug 2017
Posts: 2
Hello,
I am writing a driver to a floppy controller. Unfortunately after the calibration there is no interruption. What could be the reason for this? When I enable the controller everything is ok-an interrupt occurs.
Codes:
Code:
fdc_install
   pushad
   call fdc_initialize_dma
   call fdc_reset ;<==========
;There's nothing going on anymore.
   call fdc_drive_data
   popad
ret


fdc_reset
    pushad
    call fdc_disable_controler
    call fdc_enable_controler
    call fdc_wait_irq

    mov ecx,4
     .fdc_reset1

     call fdc_read_data
     dec ecx
     cmp ecx,0
     jne .fdc_reset1

    mov al,0
    call fdc_write_ccr
    call fdc_drive_data

    call fdc_calibrate ;<============
;There's nothing going on anymore.

    popad
ret 

fdc_calibrate
   pushad
   call fdc_motor_on
   .cal1
    mov bl,7
    call fdc_send_command
    mov bl,0              ;nr napędu num of drive
    call fdc_send_command
    call fdc_wait_irq ;<==========
;There's nothing going on anymore.


    call fdc_check_int
    mov al, fdc_ret_cyl
    cmp al, 0
    jne .cal1
   call fdc_motor_off
   popad
ret 

;=============================
;others
;=============================
fdc_enable_controler
     pushad
     mov al, 4 or 8
     call fdc_write_dor
     popad
ret 

fdc_write_dor
     pushad
     mov dx,0x3f2
     out dx,al
     popad
ret

fdc_wait_irq
     pushad
     .wait2
     mov al,isirq
     cmp al,1
     je .fdc_wait1
     hlt
     jmp .wait2
     .fdc_wait1
     mov isirq,0
     popad
ret

fdc_send_command
   pushad
   mov cx,500
   .loop1
   call fdc_ready_status
   and al,128
   dec cx
   cmp cx,0
   je .fdc_end1
   cmp al,1
   jne .loop1
   ;jest ok
   mov al,bl
   mov dx,0x3f5
   out dx,al
   .fdc_end1

   popad
ret 

fdc_ready_status
   push dx
   mov dx, 0x3f4
   in al,dx
   pop dx
ret 
 
    




Thanks for the answers. Best regards. Smile

-----EDIT 1
After 3 days I found one bug:

Code:
fdc_send_command
   pushad
   mov cx,500
   .loop1
   call fdc_ready_status
   and al,128
   dec cx
   cmp cx,0
   je .fdc_end1
   cmp al,0   ;<==
   je .loop1   ;<====
   ;jest ok
   mov al,bl
   mov dx,0x3f5
   out dx,al
   .fdc_end1

   popad
ret    


Bochs says that, port 0x3f4 return 0x0. 500 times....
Post 16 Aug 2017, 10:12
View user's profile Send private message Reply with quote
yupi



Joined: 16 Aug 2017
Posts: 2
Everything is ok
The error was in another place. I've mistaken function names Very Happy Instead fdc_check_int, I wrote fdc_read_data.
But in Bochs does not work. After reading the sector interrupt does not execute. In VirtualBox everything works fine.
What is wrong?
Output Bochs' console:
Code:
00286732197dFDD   write access to port 0x03f5, value=0xe6
00286732197dFDD   command = 0xe6
00286732197dFDD   io_write diskette controller data
00286732214dFDD   read during command 0x00, port 0x03f4 returns 0xb0
00286732219dFDD   write access to port 0x03f5, value=0x04
00286732219dFDD   command = 0x04
00286732219dFDD   io_write diskette controller data
00286732235dFDD   read during command 0x00, port 0x03f4 returns 0xb0
00286732240dFDD   write access to port 0x03f5, value=0x00
00286732240dFDD   command = 0x00
00286732240dFDD   io_write diskette controller data
00286732256dFDD   read during command 0x00, port 0x03f4 returns 0xb0
00286732261dFDD   write access to port 0x03f5, value=0x01
00286732261dFDD   command = 0x01
00286732261dFDD   io_write diskette controller data
00286732277dFDD   read during command 0x00, port 0x03f4 returns 0xb0
00286732282dFDD   write access to port 0x03f5, value=0x02
00286732282dFDD   command = 0x02
00286732282dFDD   io_write diskette controller data
00286732298dFDD   read during command 0x00, port 0x03f4 returns 0xb0
00286732303dFDD   write access to port 0x03f5, value=0x02
00286732303dFDD   command = 0x02
00286732303dFDD   io_write diskette controller data
00286732324dFDD   read during command 0x00, port 0x03f4 returns 0xb0
00286732329dFDD   write access to port 0x03f5, value=0x03
00286732329dFDD   command = 0x03
00286732329dFDD   io_write diskette controller data
00286732345dFDD   read during command 0x00, port 0x03f4 returns 0xb0
00286732350dFDD   write access to port 0x03f5, value=0x01
00286732350dFDD   command = 0x01
00286732350dFDD   io_write diskette controller data
00286732366dFDD   read during command 0x00, port 0x03f4 returns 0xb0
00286732371dFDD   write access to port 0x03f5, value=0xff
00286732371dFDD   command = 0xff
00286732371dFDD   COMMAND e6 04 00 01 02 02 03 01 ff
00286732371dFDD   read/write normal data
00286732371dFDD   BEFORE
00286732371dFDD     drive    = 0
00286732371dFDD     head     = 1
00286732371dFDD     cylinder = 0
00286732371dFDD     sector   = 2
00286732371dFDD     eot      = 3
00286732371dFDD   floppy_xfer drive=0, offset=9728, bytes=512, direction=from floppy
00286732371dFDD   io_write diskette controller data    
Post 17 Aug 2017, 18:26
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.