FDC Implementation
FDC Implementation
I've already read the OSdev wiki about it, and the links that the wiki gives, but I can't implement the source code examples, for examlpe, this code:
http://bos.asmhackers.net/docs/floppy/d ... torial.txt
Can anyone give me a source code or a guide that explain me how I code the FDC???
Thanks.
http://bos.asmhackers.net/docs/floppy/d ... torial.txt
Can anyone give me a source code or a guide that explain me how I code the FDC???
Thanks.
download the source code of my OS.
It contains a FDC driver, if this helps you.
It contains a FDC driver, if this helps you.
Keep coding...
...the sky is the limit
AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
...the sky is the limit
AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
- os.hacker64
- Member
- Posts: 149
- Joined: Mon Feb 11, 2008 4:43 pm
- Location: Limbo City,Afterlife
Are you working on another OS? Or just improving DexOS. From my look at DexOS, I wonder what you could do writing a Desktop OS.Dex wrote:If anyone need code for a none bios floppy driver in ASM, i have written a simple OS, that does nothing but goes to pmode and sets up a pmode floppy driver.
If so let me know and i will find it and upload it.
Kanu Operating System
Working on:Paging and Multitasking
BURN /\/\1(40$0|=7
Working on:Paging and Multitasking
BURN /\/\1(40$0|=7
Linux give me everything i need in a desktop OS, But i am alway building electronics projects and robots etc, and i used to use Dos, but i got tied of the 1 MB limit and segmention, plus the low graphics.
So i tried to find a modern pmode Dos like OS, and the only thing that came close was the Xbox, so i decided to code my own Xbox type OS, along with a team of coders. That what Dex stands for "Dos EXtreme".
Now all my robots are controled by DexOS and i even program pic's with it.
So i tried to find a modern pmode Dos like OS, and the only thing that came close was the Xbox, so i decided to code my own Xbox type OS, along with a team of coders. That what Dex stands for "Dos EXtreme".
Now all my robots are controled by DexOS and i even program pic's with it.
Sure, here is the demo that boots to Pmode and sets up a Pmode fdd. http://www.dex4u.com/demos/FddDemo.zipabuashraf wrote:@Dex:
Yes would you please?
Also here is just the fdd driver part (same as the one in the above), but it is much better commentated, also there notes to go with the per-do code from the "Intel floppy controller" PDF.
http://www.dex4u.com/demos/FloppyDriver.zip
PS: If you want the write to floppy code, let me know and i will post it, as that demo, demos read floppy only, it 95% the same code as the write floppy.
That would be great,thanks Dex.Dex wrote: PS: If you want the write to floppy code, let me know and i will post it, as that demo, demos read floppy only, it 95% the same code as the write floppy.
The man who follows the crowd will usually get no further than the crowd.
The man who walks alone is likely to find himself in places
no one has ever been before.
The man who walks alone is likely to find himself in places
no one has ever been before.
Just add this code, under the FddRead function
Code: Select all
;----------------------------------------------------;
; FddWrite ; Pmode write function ;
;----------------------------------------------------;
; ;
; Input: ;
; CH = Track/cylinder ;
; CL = Sector ;
; DH = Head ;
; DL = Drive (only A: drive used 00 ) ;
; ;
; Output: ;
; AH = Status ;
; AL = Sector number read ;
; CF = 0 If successful ;
; = 1 If error ;
; (100%) ;
;....................................................;
FddWrite:
pushad
and dh,00000001b
mov [Head],dh
shl dh,2
mov [DriveHead],dh
mov [FddErrorStatus],0x04
cmp ch,0x51
jae FddWriteErrorT
mov [cTrack],ch
cmp cl,0x13
jae FddWriteErrorT
mov [Sector],cl
mov [FddMTimer],0
and [FddMotorTimer0n],0
test [MotorOn],1
jnz @f
call FddMotorOn
@@:
mov dx,CcrReg
mov al,00000000b
out dx,al
mov [FddErrorStatus],0x80
;call FddRecalibrate
;jc FddWriteError
xor ecx,ecx
mov cx,3
@@:
call FddReadWriteSeek
jnc @f
loop @b
jmp FddWriteErrorT
@@:
mov dx,MsReg
in al,dx
test al,00100000b
jnz FddWriteErrorT
Call Setup_DMA2_Write
;******************************
; 1. Write Sector Command
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,0xe5
out dx,al
;******************************
; 2. Drive
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,[DriveHead]
out dx,al
;******************************
; 3. Cylinder
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,[cTrack]
out dx,al
;******************************
; 4. Head
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,[Head]
out dx,al
;******************************
; 5. Sector
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,[Sector]
out dx,al
;******************************
; 6. Sector Size
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,0x02
out dx,al
;******************************
; 7. Sectors to a track
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,0x12
out dx,al
;******************************
; 8. Gap Length
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,0x1B
out dx,al
;******************************
; 9. Data Length
;******************************
call FdcSendByteReady
jc FddWriteErrorT
mov dx,DtReg
mov al,0xFF
out dx,al
;******************************
; Wait floppy int
;******************************
mov [done],0
call WaitDone
jc FddWriteErrorT
call FdcGetByteReady
jc FddWriteErrorT
mov dx,DtReg
in al,dx
mov [ResultST0],al
call FdcGetByteReady
jc FddWriteErrorT
mov dx,DtReg
in al,dx
mov [ResultST1],al
call FdcGetByteReady
jc FddWriteErrorT
mov dx,DtReg
in al,dx
mov [ResultST2],al
call FdcGetByteReady
jc FddWriteErrorT
mov dx,DtReg
in al,dx
cmp [cTrack],al
jne @f
mov [ResultC],al
@@:
call FdcGetByteReady
jc FddWriteErrorT
mov dx,DtReg
in al,dx
mov [ResultH],al
call FdcGetByteReady
jc FddWriteErrorT
mov dx,DtReg
in al,dx
mov [ResultR],al
call FdcGetByteReady
jc FddWriteErrorT
mov dx,DtReg
in al,dx
mov [ResultN],al
test [ResultST0],11000000b
jnz FddWriteErrorT
mov [FddErrorStatus],0x00
FddWriteSuccsessT:
popad
mov ah,[FddErrorStatus]
mov al,[ResultR]
clc
ret
FddWriteErrorT:
popad
mov ah,[FddErrorStatus]
stc
ret