flat assembler
Message board for the users of flat assembler.

Index > OS Construction > int 0x13 ah = 0x02 (Read)

Author
Thread Post new topic Reply to topic
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 12 Dec 2005, 22:57
Hi

This may sound crazy, but I've lost my working code for int 0x13 ah = 0x02 (Read) and now I can't get it to work Embarassed

I think the trouble may be in ch (cylinder #), cl (sector #), and/or dh (head #) - where do these start from 0 or 1?

Here's my rubbish code:

Code:
    @@:

        ; Reset FDD
        xor ax,ax
        mov dl,[DRIVE_ID] ; DRIVE_ID = 0x00 usually
        int 0x13
        jc @b

        ; Read Sectors
        mov ax,0x0202 ; Read | 2 Sectors
        mov bx,0x0200 ;\
        mov es,bx     ; To 0200:0000
        xor bx,bx     ;/
        mov cx,0x010F ; From Cylinder 1, sector 15 ( ??? )
        mov dh,0x00   ; Head 0 ( ??? )
        int 0x13
        jc @b   

    

This code makes the floppy seek infintely Sad Any help would be very appreciated.

Many Thanks,

cod3b453
Post 12 Dec 2005, 22:57
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 12 Dec 2005, 23:13
See this http://www.ctyme.com/intr/rb-0607.htm

[edit] mmmm, but your code works fine, I tried this:
Code:
org 100h
    @@:

        ; Reset FDD 
        xor ax,ax 
        mov dl,[DRIVE_ID] ; DRIVE_ID = 0x00 usually 
        int 0x13 
        jc @b 

        ; Read Sectors 
        mov ax,0x0202 ; Read | 2 Sectors 
        mov bx,buffer ;\
        mov cx,0x010F ; From Cylinder 1, sector 15 ( ??? )
        mov dh,0x00   ; Head 0 ( ??? ) 
        int 0x13 
        jc @b

        int 20h

DRIVE_ID db 0

buffer:    
Worked perfectly, your floppy disk and FDD are healthy?
Ralf Brown wrote:
Notes: Errors on a floppy may be due to the motor failing to spin up quickly enough; the read should be retried at least three times, resetting the disk with AH=00h between attempts
Don't retry Read/Write undefinelity [/edit]
Post 12 Dec 2005, 23:13
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 16 Dec 2005, 13:44
thanks for checking it locodelassembly!

however, i realised it was memory location error Embarassed

this code it executed in real mode hence the memory limit is 0010:0000 Rolling Eyes

i feel so stupid.
Post 16 Dec 2005, 13:44
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Dec 2005, 13:48
no no, if you are in real mode 0200:0000 is the address 2000h and 0010:0000 is the address 100h. Remember that in real mode the effective address is Segment*10h + Offset
Post 16 Dec 2005, 13:48
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 16 Dec 2005, 18:00
so in pmode i would put 0x08:0x2000?
Post 16 Dec 2005, 18:00
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Dec 2005, 18:36
In pmode the things are different, the linear address is calculated as Selector.BaseAddress + Offset, if the base address is 0, then your example will access to the address 0x2000 (supposing the Limit is setted to allow access to this address).

About pmode I can't help you very much, I'd never programmed something that works with pmode (except Windows apps which has no need to worry about this because you can always access the 4 GB). However if you need something about this with the search feature of the forum you will find something, I think
Post 16 Dec 2005, 18:36
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 16 Dec 2005, 19:17
Thanks again for your help locodelassembly!

i'll keep playing around and see what happens...hopefully, sometime in the next decade i'll have something that works Laughing
Post 16 Dec 2005, 19:17
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.