From: hackbard Date: Wed, 30 Apr 2003 16:32:12 +0000 (+0000) Subject: improved 2.1 & 2.2 X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=7184d377183f5278d144a9c9457d439e259b315b;p=info3%2Fasm.git improved 2.1 & 2.2 --- diff --git a/loesung2-1.s b/loesung2-1.s index ff30902..1f74b02 100644 --- a/loesung2-1.s +++ b/loesung2-1.s @@ -12,20 +12,20 @@ text: .asciiz "gimme input: " ; das input zeug tut irgendwie nicht im windlx mit wine :( addi r1,r0,5 ; deshalb mach ich mal das 5er 1x1 -addi r2,r0,19 -addi r3,r0,0 +addi r2,r0,20 +addi r3,r0,0x300 addi r4,r0,0 -J loop +j loop loop: +beqz r2,quit +subi r2,r2,1 add r4,r4,r1 addi r3,r3,4 -sw 0x300(r3),r4 -beqz r2,end -subi r2,r2,1 -J loop +sw (r3),r4 +j loop -end: +quit: trap 0 diff --git a/loesung2-2.s b/loesung2-2.s index 582feaa..034bca4 100644 --- a/loesung2-2.s +++ b/loesung2-2.s @@ -9,23 +9,20 @@ addi r1,r0,1 addi r2,r0,10 addi r3,r0,10 -J loop +j loop loop: -beqz r2,end +beqz r3,quit +beqz r2,decrement subi r2,r2,1 -J innerloop - -innerloop: -beqz r3,refresh -subi r3,r3,1 addi r1,r1,1 -J innerloop +j loop -refresh: -addi r3,r0,10 -J loop +decrement: +subi r3,r3,1 +addi r2,r0,10 +j loop -end: +quit: sw ergebnis,r1 trap 0