Page 1 of 1

reading/writing to sectors asm

Posted: Thu Feb 25, 2010 11:12 pm
by ChrisSkura
this is what I have for writing:

Code: Select all

    mov ah, 03h
    mov al, 1
    mov cl, 18
    mov ch, 79
    mov dh, 1
    mov dl,  0
    mov bx, sector

    int 13h
and this is how I read:

Code: Select all

    mov ah, 02h
    mov al,  1
    mov cl,  18
    mov ch, 79
    mov dh, 1
    mov dl,  0
    mov bx, sector

    int 13h
but I don't know how to output the read sector or even if it's reading.
I tried this

Code: Select all

    mov ah, 13h
    mov bh, 0
    mov bl, 1010b
    mov cx, 20
    mov bp, sector
    mov dl, 0
    mov dh, 0

    int 10h
but it didn't work. then I tried to copy [sector+0] to a variable named string, but whenever I tried it would say that it has the wrong combination of opcode and operand.

Re: reading/writing to sectors asm

Posted: Fri Feb 26, 2010 12:22 am
by KotuxGuy
Probably because they are the wrong size. I don't much about assembly though, so I could be wrong.

Re: reading/writing to sectors asm

Posted: Fri Feb 26, 2010 2:27 am
by Combuster
You are not setting all registers properly before calling the bios - all calls miss ES being set up. You also use a bios function that's not common use for outputting graphics. Read the wiki for better ways of displaying text.
but whenever I tried it would say that it has the wrong combination of opcode and operand.
The processor can't do infinitely complex instructions. Read the manual and consider breaking it up into more instructions.

Re: reading/writing to sectors asm

Posted: Sat Feb 27, 2010 9:19 pm
by bewing
As combuster says, you need to set at least one more thing. ES:BX is supposed to be a pointer to the buffer where the data is stored.

Re: reading/writing to sectors asm

Posted: Sun Mar 28, 2010 8:24 am
by machka
bewing wrote:As combuster says, you need to set at least one more thing. ES:BX is supposed to be a pointer to the buffer where the data is stored.
hello, i also try to access hard drive,

do you mean that before the calling bios call i have to point memory locations which contains data to be written hdd or vice versa?

and is these bios calls work my own boot loader or am i have to setup something to get bios calls work?

(i just have the boot loader "hello world" )


regards
fish

Re: reading/writing to sectors asm

Posted: Sun Mar 28, 2010 10:30 am
by Combuster
thepowersgang (in another thread) wrote:3. See that link in the top - center of this page? "The OSDev.org Wiki - Got a question? Search this first", that one. Try clicking on it. It will do you a world of good. If you can't understand what's written in there, then you should search the web until you do.
Really, you can't have sniffed out the entire wiki between the time you found that post and writing this one. You can get the answers from there, and if you're still stuck please do read this excellent tutorial before posting anything else.

Re: reading/writing to sectors asm

Posted: Sun Mar 28, 2010 12:29 pm
by machka
Combuster wrote:
thepowersgang (in another thread) wrote:3. See that link in the top - center of this page? "The OSDev.org Wiki - Got a question? Search this first", that one. Try clicking on it. It will do you a world of good. If you can't understand what's written in there, then you should search the web until you do.
Really, you can't have sniffed out the entire wiki between the time you found that post and writing this one. You can get the answers from there, and if you're still stuck please do read this excellent tutorial before posting anything else.

this is just a little boring answer to me. but stay calm please as you see at my sing. i am just a fish. so you are right. i stuck in the code and can't find the solution. i tried many things to print something from bios call. but it didn't work. so i think "may i can get some help from here". my question may looks stupid one, but i hape to get some trink that complete this issue more easly.


regards
Fish

Re: reading/writing to sectors asm

Posted: Sun Mar 28, 2010 12:50 pm
by bewing
I'll give you one more hint. Read this:

Re: reading/writing to sectors asm

Posted: Sun Mar 28, 2010 5:15 pm
by JamesM
machka wrote:
Combuster wrote:
thepowersgang (in another thread) wrote:3. See that link in the top - center of this page? "The OSDev.org Wiki - Got a question? Search this first", that one. Try clicking on it. It will do you a world of good. If you can't understand what's written in there, then you should search the web until you do.
Really, you can't have sniffed out the entire wiki between the time you found that post and writing this one. You can get the answers from there, and if you're still stuck please do read this excellent tutorial before posting anything else.

this is just a little boring answer to me. but stay calm please as you see at my sing. i am just a fish. so you are right. i stuck in the code and can't find the solution. i tried many things to print something from bios call. but it didn't work. so i think "may i can get some help from here". my question may looks stupid one, but i hape to get some trink that complete this issue more easly.


regards
Fish
Hi,

I'm locking this post and will be monitoring all future posts from your account. It looks like a troll's account, although I'm not 100% which is why you're not banned yet.

Learn to use a spell checker too.