reading/writing to sectors asm

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Locked
ChrisSkura
Member
Member
Posts: 33
Joined: Sat Nov 07, 2009 2:47 am

reading/writing to sectors asm

Post 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.
User avatar
KotuxGuy
Member
Member
Posts: 96
Joined: Wed Nov 25, 2009 1:28 pm
Location: Somewhere within 10ft of my favorite chubby penguin!

Re: reading/writing to sectors asm

Post by KotuxGuy »

Probably because they are the wrong size. I don't much about assembly though, so I could be wrong.
Give a man Linux, you feed the nearest optician ( Been staring at the PC too long again? ).
Give a man OS X, you feed the nearest NVidia outlet ( I need more GPU power!! )
Give a man Windows, you feed the entire Tylenol company ( Self explanatory :D )
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: reading/writing to sectors asm

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: reading/writing to sectors asm

Post 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.
machka
Posts: 9
Joined: Sun Mar 28, 2010 7:50 am

Re: reading/writing to sectors asm

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: reading/writing to sectors asm

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
machka
Posts: 9
Joined: Sun Mar 28, 2010 7:50 am

Re: reading/writing to sectors asm

Post 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
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: reading/writing to sectors asm

Post by bewing »

I'll give you one more hint. Read this:
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: reading/writing to sectors asm

Post 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.
Locked