DMA and floppy reading/writing 
Author Message
 DMA and floppy reading/writing

I desperately need some information on how to set up the PC to do DMA
transfer to/from the floppy drive.

Please give me some references on where to find easy information on this.
I've studied the old AT bios for a while now, and I get all mixed up in
tests and compability tests and sh** like that.

It does not have to update the FAT or anything like that as I am making
my own disk system. Writing directly to certain blocks and reading directly
from them.

I'm using this on an assignment I have to make for the class I am an
assistant teacher in. Somehow I thought it would be easier to find this
information. All the book i have read up to now, choose not to show this
low level implementation.

And, yes, I can not use any DOS or BIOS functions. I have to go directly
on the hardware (important point of the course).

Please help.... thanks,
John

--
------------------------------------------------------------------------------
  John Christian Lonningdal   |   Computer Science at Molde regional college

    TLF: +47 712 56 075       | Project: Making a great action/strategy game!!
------------------------------------------------------------------------------
  Get JOBE 1.1 a sprite editor at http://www.*-*-*.com/ ~lonning/jobe.htm
  (Update v 1.2 coming soon)



Fri, 27 Feb 1998 03:00:00 GMT  
 DMA and floppy reading/writing

Quote:
> I desperately need some information on how to set up the PC to do DMA
> transfer to/from the floppy drive.

> Please give me some references on where to find easy information on this.
> I've studied the old AT bios for a while now, and I get all mixed up in
> tests and compability tests and sh** like that.

> It does not have to update the FAT or anything like that as I am making
> my own disk system. Writing directly to certain blocks and reading directly
> from them.

> I'm using this on an assignment I have to make for the class I am an
> assistant teacher in. Somehow I thought it would be easier to find this
> information. All the book i have read up to now, choose not to show this
> low level implementation.

> And, yes, I can not use any DOS or BIOS functions. I have to go directly
> on the hardware (important point of the course).

I know how hard it is to get info on this... there may be something on
x2ftp.oulu.fi, I don't know.  Someone posted last week that they had
a demo program that reads/writes the floppy straight to the hardware
that they were giving out, but I don't know where to refer you.  I wrote
my own sourcs for this, in protected mode.  They basically assume a certain
hardware setup (1.44Mb) and don't do all the compatability stuff... you can
change the hardware setup by changing information in an array.  They
also do 1024 byte sectors, there is only a minor change to make it 512 byte
sectors plus a redo of all the math... but you will have to do that anyway
because the thing isn't designed to work in real mode as-is.

e-mail me if you want a copy.

David

- Show quoted text -

Quote:

> Please help.... thanks,
> John

> --
> ------------------------------------------------------------------------------
>   John Christian Lonningdal   |   Computer Science at Molde regional college

>     TLF: +47 712 56 075       | Project: Making a great action/strategy game!!
> ------------------------------------------------------------------------------
>   Get JOBE 1.1 a sprite editor at http://www.himolde.no/~lonning/jobe.htm
>   (Update v 1.2 coming soon)



Fri, 27 Feb 1998 03:00:00 GMT  
 DMA and floppy reading/writing

: And, yes, I can not use any DOS or BIOS functions. I have to go directly
: on the hardware (important point of the course).

Why don't you look at the bios listing found in the IBM Tech Ref. and see
how the bios does it?  The published bios listings were, after all, one
of the reasons the IBM/PC became a hit.
--

                                             CIS: 71774,1731



Sat, 28 Feb 1998 03:00:00 GMT  
 DMA and floppy reading/writing
J> I desperately need some information on how to set up the PC to do DMA
J> transfer to/from the floppy drive.
...
J> And, yes, I can not use any DOS or BIOS functions. I have to go directly
J> on the hardware (important point of the course).

Look into directory fja-gate.fuw.edu.pl:hardware.inf (w/o slash,
there is quite a long initial path: /user/net/ka9q/guest). Most
of the info you need is there (except probably few details on
setting r/w clock frequency or detecting disk change; look BIOS
listing for them, seems need just few more port bits).



Sun, 01 Mar 1998 03:00:00 GMT  
 DMA and floppy reading/writing

Quote:
>Look into directory fja-gate.fuw.edu.pl:hardware.inf (w/o slash,
>there is quite a long initial path: /user/net/ka9q/guest). Most
>of the info you need is there (except probably few details on
>setting r/w clock frequency or detecting disk change; look BIOS
>listing for them, seems need just few more port bits).

Now if that site only had a DNS entry...

SS



Mon, 02 Mar 1998 03:00:00 GMT  
 DMA and floppy reading/writing

Quote:

>> Look into directory fja-gate.fuw.edu.pl:hardware.inf (w/o slash,
>> there is quite a long initial path: /user/net/ka9q/guest). Most
>> of the info you need is there (except probably few details on
>> setting r/w clock frequency or detecting disk change; look BIOS
>> listing for them, seems need just few more port bits).

S> Now if that site only had a DNS entry...

An error in the site name: missing "z" on begin. Internet address



Sat, 07 Mar 1998 03:00:00 GMT  
 DMA and floppy reading/writing


Quote:
>> Look into directory fja-gate.fuw.edu.pl:hardware.inf (w/o slash,

G> I keep on hearing about your site so I tried to connect to it. I ended
G> up in the long path but there were no files.




Mon, 09 Mar 1998 03:00:00 GMT  
 DMA and floppy reading/writing

: >I desperately need some information on how to set up the PC to do DMA
: >transfer to/from the floppy drive.
: >Please give me some references on where to find easy information on this.

The only book that I have seen that has (relatively) easy information on
floppy IO below the BIOS level (setting up the DMA, etc.) is
Programmer's Problem Solver by Robert Jourdain
It is reasonably complete, except for coverage of port 3F7, for data
transfer rate selection.

Second edition is cleaned up slightly from the first one, but is now
published by the Peter Norton cartel.

--



Fri, 13 Mar 1998 03:00:00 GMT  
 DMA and floppy reading/writing

: >I desperately need some information on how to set up the PC to do DMA
: >transfer to/from the floppy drive.
: >Please give me some references on where to find easy information on this.

Here's some code to perform DMA transfers to/from floppy drives:

;----------------------------------
; DMA controller ports
;----------------------------------

DiskettePage    equ     81h
BaseAddr        equ     4
BaseCount       equ     5
RequestReg      equ     9
MaskRegister    equ     10
ModeRegister    equ     11
LittleEndian    equ     12

;----------------------------------
; Programs the DMA controller to perform a memory->floppy transfer
; On entry:
;  ES:DI->address of buffer to send
;  CX->buffer length in bytes
; On exit:
;  Carry flag=1->if the buffer overruns a page boundary
;----------------------------------

DmaToBus        proc    near
        push    dx

;----------------------------------
; Calculamos la direccin plana de 24 bits para el chip DMA.
;----------------------------------

        call    GetPlanar
        push    di
        add     di,cx
        pop     di


        pop     dx

        mov     dx,ModeRegister
        mov     al,4Ah  ;Indica DMA Memoria->NEC 765
        out     dx,al

;----------------------------------
; El resto de la programacin del chip DMA es idantico para el
; sentido Memoria->NEC 765 que para el sentido NEC 765->Memoria.
;----------------------------------

        jmp     short DmaCode
DmaToBus        endp

;----------------------------------
; Programs the DMA controller to perform a floppy->memory transfer
; On entry:
;  ES:DI->address of buffer to store the bytes sent by the floppy controller
;  CX->length of the transfer in bytes
; On exit:
;  Carry flag=1->DMA transfer overuns a page boundary
;----------------------------------

DmaFromBus      proc    near
        push    dx
        call    GetPlanar       ;Calcular direccin plana
        push    di
        add     di,cx
        pop     di

        pop     dx

        mov     dx,ModeRegister
        mov     al,46h  ;Indica DMA NEC 765->Memoria
        out     dx,al
DmaCode proc    near
        inc     dl
        out     dx,al   ;Indica formato Intel para palabras

;----------------------------------
; Escribimos en el chip DMA y en el Page Register la direccin de
; memoria donde depositar los datos procedentes del NEC 765.
;----------------------------------

        mov     dl,BaseAddr
        mov     ax,di
        out     dx,al   ;Byte bajo de la direccin
        mov     al,ah

        mov     dl,DiskettePage
        mov     ax,es
        out     dx,al   ;Page Register

;----------------------------------
; Escribe en el chip DMA la longitud de la transferencia...
;----------------------------------

        mov     dl,BaseCount
        mov     ax,cx
        out     dx,al   ;Byte bajo
        mov     al,ah

;----------------------------------
; Activamos el c{*filter*}2 del chip DMA.
;----------------------------------

        mov     dl,MaskRegister
        mov     al,2    ;C{*filter*}2
        out     dx,al   ;A currar !
        sti
        pop     dx
        ret
DmaCode endp
DmaFromBus      endp

;----------------------------------
; Converts a segment:offset address to a 24 bits physical address
; On entry:
;  ES:DI->segmented address

; On exit:
;  ES:DI->24 bit linear address
;----------------------------------

GetPlanar       proc    near
        push    ax
        push    bx
        mov     ax,es
        rol     ax,4
        mov     bx,ax
        and     bx,0FFF0h
        and     ax,0Fh
        add     di,bx
        adc     ax,0
        mov     es,ax   ;ES:DI->direccin plana
        pop     bx
        pop     ax
        ret
GetPlanar       endp

The above code is from a TSR that copies dics in the background under DOS. The
code works. Excuse for some text being in Spanish. Please, excuse my bad
English. I hope this could help someone,

Eugenio



Sun, 15 Mar 1998 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Toughie? Floppy read and DMA write problem

2. Read FDD sector via DMA & Floppy Controller

3. Floppy read & write

4. direct read/write to FLOPPY + WIN NT ?

5. How to read/write floppy disk through PORT ?

6. Code to Low-Level read/write to Floppy Disks

7. direct read/write to FLOPPY + WIN NT ?

8. Need help reading/writing boot sector (floppy disk)

9. How to read/write floppy disk through PORT?

10. floppy DMA

11. DMA/Floppy-Controller

12. Floppy Access via I/O and DMA

 

 
Powered by phpBB® Forum Software