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:
00286732197d[FDD ] write access to port 0x03f5, value=0xe6 00286732197d[FDD ] command = 0xe6 00286732197d[FDD ] io_write: diskette controller data 00286732214d[FDD ] read(): during command 0x00, port 0x03f4 returns 0xb0 00286732219d[FDD ] write access to port 0x03f5, value=0x04 00286732219d[FDD ] command = 0x04 00286732219d[FDD ] io_write: diskette controller data 00286732235d[FDD ] read(): during command 0x00, port 0x03f4 returns 0xb0 00286732240d[FDD ] write access to port 0x03f5, value=0x00 00286732240d[FDD ] command = 0x00 00286732240d[FDD ] io_write: diskette controller data 00286732256d[FDD ] read(): during command 0x00, port 0x03f4 returns 0xb0 00286732261d[FDD ] write access to port 0x03f5, value=0x01 00286732261d[FDD ] command = 0x01 00286732261d[FDD ] io_write: diskette controller data 00286732277d[FDD ] read(): during command 0x00, port 0x03f4 returns 0xb0 00286732282d[FDD ] write access to port 0x03f5, value=0x02 00286732282d[FDD ] command = 0x02 00286732282d[FDD ] io_write: diskette controller data 00286732298d[FDD ] read(): during command 0x00, port 0x03f4 returns 0xb0 00286732303d[FDD ] write access to port 0x03f5, value=0x02 00286732303d[FDD ] command = 0x02 00286732303d[FDD ] io_write: diskette controller data 00286732324d[FDD ] read(): during command 0x00, port 0x03f4 returns 0xb0 00286732329d[FDD ] write access to port 0x03f5, value=0x03 00286732329d[FDD ] command = 0x03 00286732329d[FDD ] io_write: diskette controller data 00286732345d[FDD ] read(): during command 0x00, port 0x03f4 returns 0xb0 00286732350d[FDD ] write access to port 0x03f5, value=0x01 00286732350d[FDD ] command = 0x01 00286732350d[FDD ] io_write: diskette controller data 00286732366d[FDD ] read(): during command 0x00, port 0x03f4 returns 0xb0 00286732371d[FDD ] write access to port 0x03f5, value=0xff 00286732371d[FDD ] command = 0xff 00286732371d[FDD ] COMMAND: [e6] [04] [00] [01] [02] [02] [03] [01] [ff] 00286732371d[FDD ] read/write normal data 00286732371d[FDD ] BEFORE 00286732371d[FDD ] drive = 0 00286732371d[FDD ] head = 1 00286732371d[FDD ] cylinder = 0 00286732371d[FDD ] sector = 2 00286732371d[FDD ] eot = 3 00286732371d[FDD ] floppy_xfer: drive=0, offset=9728, bytes=512, direction=from floppy 00286732371d[FDD ] 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 © 2004-2018, Tomasz Grysztar.

Powered by rwasa.