linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* inside_SUB
@ 2002-09-16  5:15 ssams
  2002-09-16 15:04 ` inside_SUB Maciej Hrebien
  0 siblings, 1 reply; 3+ messages in thread
From: ssams @ 2002-09-16  5:15 UTC (permalink / raw)
  To: linux-assembly

by this code bellow i want print new line with the simple
way
i sub first char "49" with 39. but i did not get output
like what i want
output from this code is
1>>
when i look at ascii code this second char value is 187.
would some body expalin me...?

regard

.data
 msg: .byte 49
.text
.globl _start
_start:
   	mov $msg,%ecx
   	mov $1,%ebx
   	mov $1,%edx
   	mov $4,%eax
	int $0x80

   	mov %ecx,%eax
   	sub $39,%eax
	#ul %ebx
	mov %eax,%ecx
	mov $4,%eax
	int $0x80
	
	mov $1,%eax
   	int $0x80

=========================================================================
Khusus Pelanggan Telepon DIVRE 2, Tekan 166 untuk mendengarkan pesan Anda.
=========================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: inside_SUB
  2002-09-16  5:15 inside_SUB ssams
@ 2002-09-16 15:04 ` Maciej Hrebien
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej Hrebien @ 2002-09-16 15:04 UTC (permalink / raw)
  To: linux-assembly

ssams wrote:
> 
> by this code bellow i want print new line with the simple
> way
> i sub first char "49" with 39. but i did not get output
> like what i want
> output from this code is
> 1>>
> when i look at ascii code this second char value is 187.
> would some body expalin me...?
> 
> regard
> 
> .data
>  msg: .byte 49
> .text
> .globl _start
> _start:
>         mov $msg,%ecx
>         mov $1,%ebx
>         mov $1,%edx
>         mov $4,%eax
>         int $0x80
> 
>         mov %ecx,%eax
>         sub $39,%eax

xchg "sub $39,%eax" with "sub $39,(%eax)". %eax have a ptr value & You
access a memory using this ptr!

>         #ul %ebx
>         mov %eax,%ecx
>         mov $4,%eax
>         int $0x80
> 
>         mov $1,%eax
>         int $0x80

-- 
Maciej Hrebien


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: inside_SUB
       [not found] <web-50089505@m1.plasa.com>
@ 2002-09-19 12:24 ` Maciej Hrebien
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej Hrebien @ 2002-09-19 12:24 UTC (permalink / raw)
  To: linux-assembly

ssams wrote:
> 
> thanks for your replay
> this is make me learning more.
> But when i try to try, i found a new problem when i try to
> read
> the value from ecx after doing syscall read.
> mov $3,%eax
> mov $0,%ebx
> mov $6,%edx
> 
> how can i read input from this code and reprinting it...?
> for example output:
> Enter e number: 4       #we enter 4
> you have number: 4      #reprinting
> 
> help me please
> regard
> ssams

.data

char: .byte 0

.text

.globl _start
_start:
	mov $3,%eax
	xor %ebx,%ebx
	mov $char,%ecx
	mov $1,%edx
	int $0x80

	mov $4,%eax
	inc %ebx
	int $0x80

	mov $1,%eax
	int $0x80

Regards,

PS I recommend to read some tutorial(s) on how to write assembly code
useing Linux's calls.

-- 
Maciej Hrebien


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-19 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-16  5:15 inside_SUB ssams
2002-09-16 15:04 ` inside_SUB Maciej Hrebien
     [not found] <web-50089505@m1.plasa.com>
2002-09-19 12:24 ` inside_SUB Maciej Hrebien

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).