I'm not guessing.
I'm using nasm, but the gcc output is totally different from anything I 
understand.

Thanks,
Tyler Littlefield
email: [EMAIL PROTECTED]
web: tysdomain-com
Visit for quality software and web design.
skype: st8amnd2005

  ----- Original Message ----- 
  From: Thomas Hruska 
  To: [email protected] 
  Sent: Sunday, October 19, 2008 2:06 PM
  Subject: Re: [c-prog] asm help--not sure where the error is


  Tyler Littlefield wrote:
  > I'm rather new to asm, and started playing around.
  > The purpose of write is to write the string char by char. any ideas why 
this 
  > wouldn't be working? I'm not totally sure how to debug it. it just runs and 
  > stopps--I finally got past the seg fault:
  > section .data
  > buff db "Hello world!",10,0
  > section .text
  > global _start:
  > _start:
  > mov eax,buff
  > call write
  > call exit
  > hlt
  > 
  > write:
  > mov esi,eax
  > ;we'll get the other three registers set up so we don't have to keep 
setting 
  > those:
  > mov eax,4
  > mov ebx,1
  > mov edx,1
  > loop:
  > mov ecx,[esi]
  > cmp ecx,0
  > je end
  > inc esi
  > int 80h
  > jmp loop
  > end:
  > ret
  > 
  > exit:
  > mov eax,1
  > mov ebx,1
  > int 80h
  > ret
  > 
  > Thanks,
  > Tyler Littlefield
  > email: [EMAIL PROTECTED]
  > web: tysdomain-com
  > Visit for quality software and web design.
  > skype: st8amnd2005

  Instead of guessing, why don't you first write the program in C and then 
  use the compiler to generate raw assembler code (most compilers have a 
  switch to do this). Then stare at the generated code, compare to yours, 
  and that should solve the problem.

  Besides, every compiler treats assembler differently. You didn't 
  mention yours.

  -- 
  Thomas Hruska
  CubicleSoft President
  Ph: 517-803-4197

  *NEW* MyTaskFocus 1.1
  Get on task. Stay on task.

  http://www.CubicleSoft.com/MyTaskFocus/



   

[Non-text portions of this message have been removed]

Reply via email to