linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "ssams" <ssams@telkom.net>
To: linux-assembly@vger.kernel.org
Subject: code-need-to-correct
Date: Thu, 19 Sep 2002 21:40:09 +0700	[thread overview]
Message-ID: <web-50448669@m1.plasa.com> (raw)


 .macro sys_write
	mov $4,%eax
	mov $1,%ebx
	int $0x80
.endm
.macro sys_read
	mov $3,%eax
	mov $2,%edx
	mov $0,%ebx
	int $0x80
.endm
.data
msg1: .ascii "Masukkan Angka: "
jum_masuk: 
	.byte .- msg1
satu: .ascii "Satu Lagi: "
jum_satu: 
	.byte .- satu
spasi: .byte 10
.bss
.lcomm input1,0
.lcomm input2,0
angka: .byte 0
.text 
.globl _start
_start:
	mov $msg1,%ecx
	mov $16,%edx
	sys_write
	sys_read
	mov %eax,input1

	
	mov $satu,%ecx
	mov $11,%edx
	sys_write
	sys_read
	mov %eax,input2


tambah:
	mov (input2),%eax
	add (input1),%eax
	mov $10,%bx
	xor %ecx,%ecx
ulang:
	div %bx
	push %edx
	inc %ecx
	cmp $0,%al
	jne ulang
cetak:
	pop %edx
	add $0x30,%dx
	mov %dx,angka
	push %ecx
	mov $angka,%ecx
	mov $1,%edx
	sys_write
	pop %ecx
	loop cetak	

	mov $spasi,%ecx
	mov $1,%edx
	sys_write

	movl $1,%eax	#exit
	movl $1,%eax	#exit
	movl $0,%ebx
	int  $0x80

output:

Masukkan angka: 4
Satu lagi: 5
2478030160157010470915781817.....

How to read input...?
=========================================================================
Khusus Pelanggan Telepon DIVRE 2, Tekan 166 untuk mendengarkan pesan Anda.
=========================================================================

             reply	other threads:[~2002-09-19 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-19 14:40 ssams [this message]
2002-09-19 20:03 ` code-need-to-correct h-peter recktenwald
2002-09-19 20:14   ` code-need-to-correct lx
  -- strict thread matches above, loose matches on Subject: below --
2002-09-19 14:58 code-need-to-correct Doctor Owl
2002-09-19 15:51 ` code-need-to-correct Robin Miyagi

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=web-50448669@m1.plasa.com \
    --to=ssams@telkom.net \
    --cc=linux-assembly@vger.kernel.org \
    /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).