somebody good in assemble please help

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
smeezekitty
Member
Member
Posts: 50
Joined: Sat Mar 21, 2009 9:42 pm

somebody good in assemble please help

Post 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.
Hangin10
Member
Member
Posts: 162
Joined: Wed Feb 27, 2008 12:40 am

Re: somebody good in assemble please help

Post by Hangin10 »

Why don't you just write it in C and look at the compiler output?
smeezekitty
Member
Member
Posts: 50
Joined: Sat Mar 21, 2009 9:42 pm

Re: somebody good in assemble please help

Post by smeezekitty »

because turbo C++ outputs tasm code
but my operating system only works properly on nasm code
Hangin10
Member
Member
Posts: 162
Joined: Wed Feb 27, 2008 12:40 am

Re: somebody good in assemble please help

Post 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).
smeezekitty
Member
Member
Posts: 50
Joined: Sat Mar 21, 2009 9:42 pm

Re: somebody good in assemble please help

Post 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
smeezekitty
Member
Member
Posts: 50
Joined: Sat Mar 21, 2009 9:42 pm

Re: somebody good in assemble please help

Post by smeezekitty »

the main problem is the strings
tantrikwizard
Member
Member
Posts: 153
Joined: Sun Jan 07, 2007 9:40 am
Contact:

Re: somebody good in assemble please help

Post 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
smeezekitty
Member
Member
Posts: 50
Joined: Sat Mar 21, 2009 9:42 pm

Re: somebody good in assemble please help

Post 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:

tantrikwizard
Member
Member
Posts: 153
Joined: Sun Jan 07, 2007 9:40 am
Contact:

Re: somebody good in assemble please help

Post 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.)
smeezekitty
Member
Member
Posts: 50
Joined: Sat Mar 21, 2009 9:42 pm

Re: somebody good in assemble please help

Post 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.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: somebody good in assemble please help

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