linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rudolf Marek <MAREKR2@cs.felk.cvut.cz>
To: ssams <ssams@telkom.net>
Cc: linux-assembly@vger.kernel.org
Subject: Re: problem with printchar
Date: Wed, 24 Apr 2002 09:27:16 +0200	[thread overview]
Message-ID: <aa5mop$d8c$2@main.gmane.org> (raw)
In-Reply-To: <web-5620564@m1.plasa.com>


Yes...
Because in ecx should be address (pointer) to char.
Kernel silently ignores bad address so there is no output.
You can use strace utility to watch whats going on

$strace ./program1

execve("./program1", ["./program1"], [/* 30 vars */]) = 0
write(1, ptrace: un: Input/output error
0x61, 1)                       = -1 EFAULT (Bad 
addreexit(0)                                = ?

uh... the solution: you have to declare somewhere in memory a byte where 
you will store that char.

This is not "as" syntax but hope you will get an idea

mov ecx,my_char
mov [ecx],'a' ;you can cachnge it "on-line"

.....

DATASEG
my_char DB 'b' 

Happy assembling,
    
      Regards

		Rudolf


On Wed, 24 Apr 2002, ssams wrote:

> Date: Wed, 24 Apr 2002 14:18:57 +0700
> From: ssams <ssams@telkom.net>
> To: linux-assembly@vger.kernel.org
> Subject: problem with printchar
> 
> i have this code
> .globl mulai
> mulai:
>    movl $4,%eax
>    movl $1,%ebx
>    movl $'a',%ecx
>    movl $1,%edx
>    int   $0x80
>    xorl  %eax,%eax
>    movl  $1,%eax
>    xorl  %ebx,%ebx
>    int   $0x80
> then i compile with
> as program1.s -o program1.o
> ld program1.o -o program1
> 
> by this code i want print one char but there is no output.
> can anybody help me why..?
> 
>  
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 



      parent reply	other threads:[~2002-04-24  7:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-24  7:18 problem with printchar ssams
2002-04-24  7:26 ` Scott Lanning
2002-04-24  7:27 ` Rudolf Marek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='aa5mop$d8c$2@main.gmane.org' \
    --to=marekr2@cs.felk.cvut.cz \
    --cc=linux-assembly@vger.kernel.org \
    --cc=ssams@telkom.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).