* code-need-to-correct
@ 2002-09-19 14:40 ssams
2002-09-19 20:03 ` code-need-to-correct h-peter recktenwald
0 siblings, 1 reply; 5+ messages in thread
From: ssams @ 2002-09-19 14:40 UTC (permalink / raw)
To: linux-assembly
.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.
=========================================================================
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: code-need-to-correct
@ 2002-09-19 14:58 Doctor Owl
2002-09-19 15:51 ` code-need-to-correct Robin Miyagi
0 siblings, 1 reply; 5+ messages in thread
From: Doctor Owl @ 2002-09-19 14:58 UTC (permalink / raw)
To: linux-assembly
Do what thou wilt shall be the whole of the Law,
I'd just like to provide my support to anyone that feels the need to fly
into a fit of rage and abuse people who post stupid questions without any
independant thought or research into exactly what they're doing, and most
likely do not even know who or where they are.
Most of you are doing a stand-up job replying to these peoples requests,
but are you going to hold their hands forever? It's not like there is a
lack of information about this stuff floating about the net.
Regards,
DoctorOwl
http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
- Always be connected to your Messenger Friends
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: code-need-to-correct
2002-09-19 14:58 code-need-to-correct Doctor Owl
@ 2002-09-19 15:51 ` Robin Miyagi
0 siblings, 0 replies; 5+ messages in thread
From: Robin Miyagi @ 2002-09-19 15:51 UTC (permalink / raw)
To: linux-assembly
I have been getting rather tired of being asked homework questions. If there
is abundant info out there, I refer that person to this info. This way they
learn to RTFM.
On Thursday 19 September 2002 07:58, Doctor Owl wrote:
> Do what thou wilt shall be the whole of the Law,
>
> I'd just like to provide my support to anyone that feels the need to fly
> into a fit of rage and abuse people who post stupid questions without any
> independant thought or research into exactly what they're doing, and most
> likely do not even know who or where they are.
>
> Most of you are doing a stand-up job replying to these peoples requests,
> but are you going to hold their hands forever? It's not like there is a
> lack of information about this stuff floating about the net.
>
> Regards,
> DoctorOwl
>
>
> http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
> - Always be connected to your Messenger Friends
> -
> 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
--
Robin Miyagi<penguin@dccnet.com>
http://www.geocities.com/SiliconValley/Ridge/2544/asm/assembler.html
The funny thing about brakes, is that when they break, they don't brake.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: code-need-to-correct
2002-09-19 14:40 code-need-to-correct ssams
@ 2002-09-19 20:03 ` h-peter recktenwald
2002-09-19 20:14 ` code-need-to-correct lx
0 siblings, 1 reply; 5+ messages in thread
From: h-peter recktenwald @ 2002-09-19 20:03 UTC (permalink / raw)
To: ssams; +Cc: linux-assembly
On Thu, 19 Sep 2002 21:40:09 +0700
"ssams" <ssams@telkom.net> wrote:
re just below your '_start:' label:
linux program space, '.text' section, by standard is in read/execute memory,
so you cannot input to program memory. define a label and reserve some space
in the '.bss' section which is always writable - but does not contain any
data at program start, filled w. <nul>-s, by the linux loader. the other
commonly used section, '.data' can store nay data as well as may be written
to, but also occupies it's space in the program binary, which .bss does not.
just for completeness, there is also a '.rodata' setion for read-only data
- and several others, used by "ld" which are usually of no concern.
.long 0 etc will work, but no other
data, re '.fill', '.rept' in the manual.
----
.bss
inputmem:
.long 0 # as often as required
----
best,
hp
>
> .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 <== read only memory
> mov $16,%edx
> sys_write
> sys_read <== cannot store to .text section
> 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.
> =========================================================================
> -
> 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
--
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de
software patents http://petition.eurolinux.org/pr/pr17.html
-
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: code-need-to-correct
2002-09-19 20:03 ` code-need-to-correct h-peter recktenwald
@ 2002-09-19 20:14 ` lx
0 siblings, 0 replies; 5+ messages in thread
From: lx @ 2002-09-19 20:14 UTC (permalink / raw)
To: lx; +Cc: ssams, linux-assembly
On Thu, 19 Sep 2002 20:03:15 +0000
h-peter recktenwald <hp@lxhp.in-berlin.de> wrote:
> On Thu, 19 Sep 2002 21:40:09 +0700
> "ssams" <ssams@telkom.net> wrote:
>
> re just below your '_start:' label:
...error, didn't see that i/o already in .bss.
so, i won't be able to help, further, too.
--
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-09-19 20:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-19 14:40 code-need-to-correct ssams
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
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).