Hilfe zu Floppyzugriff
-
Ich hab folgendes Problem. Ich schreibe mein erstes OS und bin eigendlich schon ziemlich weit gekommen. Jetzt ,möchte ich aber gerne auf die Floppy zugreifen, nachdem ich die Interrupts ausgestellt habe. D.h. direkt über die I/O ports. Bei OSRC gabs leider nur was über IDE HDs. Kann mir mal einer ne gute Seite nennen? Oder mir mal wenigstens einen grundlegenden tipp geben?
MfG mwoidt
-
Hi.
IMHO ist diese Seite recht aufschlussreich: http://debs.future.easyspace.com/Programming/Hardware/FDC/floppy.html
-
oder schau mal auf meiner seite unter hw-programmierung: http://ww.todo-online.de.vu bzw. http://www.geocities.com/tobiasdoerffel/ ist zwar noch nicht komlett, hab aber ein komplettes beispiel in C drinne!
-
Werd mal durcharbeiten..Könntest du vielleicht in den C-Files ein bisschen mehr kommentare reintuhen?
Ach und an Nobuo T hätte ich auch noch mal eine Frage. Ich hab mir mal den Link den du mir gegeben hast durchgeschaut. Das war soweit auch alles klar. Bis auf eine Kleinigkeit. Zum Schluss war da ein Beispielcode. Wenn du mir mal sagen könntest wo denn der eingelesene Block im Memmory dann landet?
Für alle die mir helfen wollen hier der Code:;******************************************************************************* ; This code expects to receive the data buffer address in ES:BX ; ; ES: Buffer segment ; BX: Buffer offset ; ; The address is a 20 bit segmented address, calculated from Segment*16 + Offset ; ; Bits 19-16 of the address form the entry for the DMA page entry ; Bits 15-8 of the address form the high-order byte for the DMA address register ; Bits 7-0 of the address form the low-order byte for the DMA address register ; ; For more information on this, it will be necessary to read other literature ; specifically targetting the DMA controller. ;******************************************************************************* disable_dma1: ; disable DMA 1 mov al, 14h ; output 14h to the command register to disable and out 08h, al ; initialise the DMA controller mode: ; set up DMA transfer mode for channel 2 mov al, 56h ; set up for a single write transfer to main memory out 0bh, al ; using DMA channel 2 ; for a read, output 5ah get_address: ; get the buffer address, and split into component parts ; as required by the DMA controller. mov ax, es ; load buffer segment into AX mov cl, 04h ; shl ax, cl ; shift value in ax left 4 times add ax, bx ; add offest + buffer. AX now contains high and low ; for the DMA address register. jc carry ; if carry is set, jump to carry no_carry: mov bx, es ; load segment of buffer into BX mov cl, 04h ; shr bh, cl ; shift right BH 4 times. BH now contains the value ; for the DMA page segment jmp buffer_address; output the buffer address carry: mov bx, es ; load segment of buffer into BX mov cl, 04h ; shr bh, cl ; shift right BH 4 times. BH now contains the high ; bits of the segment adc bh, 00h buffer_address: ; output the address to the DMA controller out 0ch, al ; reset flip-flop. I am not sure what this does, ; but my reference shows this as necessary. out 04h, al ; output low order address byte to address register mov al, ah ; out 04h, al ; output high-order address byte to address register mov al, bh ; out 81h, al ; load page register with page value count: ; set up count register out 0ch, al ; reset flip-flop mov al, 0ffh ; out 05h, al ; mov al, 01h ; out 05h, al ; load 511 into count register (to read one sector) ; it should be noted that for multiple transfers, the ; second value output to port 05h is equivalent to ; (2*number of sectors)-1 release_channel: mov al, 02h out 0ah, al ; release channel 2 enable_dma1: ; enable DMA 1 mov al, 10h out 08h, al ; this is the value for enabling the DMA for the mode required
jetzt die Frage: Wenn ich das richtig sehe erwartet er an ES:BX den Buffer, wo der Buffer steht in dem die Adresse auf der Floppy (also cylinder head sector) controllerkonform angegeben is. Wo landet denn jetzt der eingelesene Sektor?
-
mwoidt schrieb:
Wenn ich das richtig sehe erwartet er an ES:BX den Buffer, wo der Buffer steht in dem die Adresse auf der Floppy (also cylinder head sector) controllerkonform angegeben is.
Eben nicht.
Dieser Code programmiert lediglich den DMA mit der Zieladdresse, zu der eingelesene Sektoren kopiert werden/von der Daten auf Diskette kopiert werden.Cyl/Head/Sector werden zB. dem "Read Sector" Command direkt via I/O hinterhergeschickt.
-
Ah so is das. Danke für die Hilfe
-
mwoidt schrieb:
Werd mal durcharbeiten..Könntest du vielleicht in den C-Files ein bisschen mehr kommentare reintuhen?
immer diese ansprüche...
naja, bin halt der typisch faule programmier-typ, der von kommentaren nix hält
aber werd mal sehen, was sich machen lässt, jetzt am WE hab ich wieder ein bissl zeit