Page 1 of 1
somebody good in assemble please help
Posted: Thu Oct 22, 2009 9:46 pm
by smeezekitty
first this is not homework.
I need help writing a program in nasm assemble that opens a file with fopen not open
and reads the entire contents into a buffer then closes the file.
i know its not directly related to os dev but i am only moderate in ASM and no good with pointers and buffers.
Re: somebody good in assemble please help
Posted: Thu Oct 22, 2009 11:05 pm
by Hangin10
Why don't you just write it in C and look at the compiler output?
Re: somebody good in assemble please help
Posted: Thu Oct 22, 2009 11:12 pm
by smeezekitty
because turbo C++ outputs tasm code
but my operating system only works properly on nasm code
Re: somebody good in assemble please help
Posted: Thu Oct 22, 2009 11:17 pm
by Hangin10
But if you just want to see how it goes, what difference does it make? You could just as easily use your native GCC (read the docs for the Intel output format for AS, I don't remember it off the top of my head).
Re: somebody good in assemble please help
Posted: Thu Oct 22, 2009 11:21 pm
by smeezekitty
Hangin10 wrote:But if you just want to see how it goes, what difference does it make? You could just as easily use your native GCC (read the docs for the Intel output format for AS, I don't remember it off the top of my head).
GCC outputed code is a 32bit mess,
it needs to be real mode code and cleanly written too.
my OS is
VERY unstable if it doesnt like your code it freezes
Re: somebody good in assemble please help
Posted: Thu Oct 22, 2009 11:37 pm
by smeezekitty
the main problem is the strings
Re: somebody good in assemble please help
Posted: Fri Oct 23, 2009 12:59 am
by tantrikwizard
smeezekitty wrote:because turbo C++ outputs tasm code
but my operating system only works properly on nasm code
so convert it to nasm. Whats the problem? TASM is easy enough to convert to nasm. theyre both intel syntax. bcc(32) -s myfile.cpp
Re: somebody good in assemble please help
Posted: Fri Oct 23, 2009 1:10 am
by smeezekitty
i now got it my self but got assemble errors
and BTW it only took 85 instructions]
the error is Invalid effective address on this line:
Code: Select all
mov di,42
data:
mov ah,0x0E
mov al,[bp-di] ;Error
mov bl,0x0F
int 0x10
dec di
cmp di,0
jle stoploop
cmp 0,[bp-di]
jne data
stoploop:
Re: somebody good in assemble please help
Posted: Fri Oct 23, 2009 1:25 am
by tantrikwizard
this is a compilation problem, not a run time problem, which means you dont have a basic understanding of your tools and this is not the place to learn it (unless some other members are more gracious that I am...if they are more gracious and answer your question then theyre wasting my time as much as you are.)
Re: somebody good in assemble please help
Posted: Fri Oct 23, 2009 1:32 am
by smeezekitty
tantrikwizard wrote:this is a compilation problem, not a run time problem, which means you dont have a basic understanding of your tools and this is not the place to learn it (unless some other members are more gracious that I am...if they are more gracious and answer your question then theyre wasting my time as much as you are.)
i am used to TASM syntax and this is NASM syntax,
if this were tasm that line would assemble.
but only nasm can make kernel calls.
Re: somebody good in assemble please help
Posted: Fri Oct 23, 2009 2:09 am
by AJ
Hi,
I am locking this thread because from the last 2 posts (that I have deleted), it was going to become a flame war.
@smeezekitty: You will find that on specific points you will often get very good help on these forums. However, if it looks like you do not know how to use a toolchain, you'll get the kind of response you saw. OSDev is pretty complicated and a good understanding of the toolchain is essential.
Before continuing, please do some good background reading on your toolchain, along with NASM and TASM differences. You may find some help on our wiki, it may be worth Googling for some manuals / tutorials.
After doing this, if you are stuck on a specific point, please come back and ask and I think you should get some helpful answers.
Cheers,
Adam