Created
December 25, 2011 19:15
-
-
Save sinannar/1519630 to your computer and use it in GitHub Desktop.
billab-hw-part4-40point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load rf,10 ;cleaning screen | |
load rf,10 | |
load rf,10 | |
load rf,10 | |
load r1,Array ;loading array first adress | |
load r2,1 ;step | |
load r0,0 ;condition check | |
load r3,0 ;total | |
Next: load r4,[r1] ;getting array elements | |
addi r1,r1,r2 ;next element | |
addi r3,r3,r4 ;calculating total | |
jmpEq r4=r0,Son; ;check the terminator | |
jmp Next | |
Son: | |
LOAD r2,48 ;screen printing necessary | |
MOVE r1,r3 ;total | |
LOAD r0,9 ;check printability | |
jmple r1<=r0,bas1 ;if true means can printable | |
jmp bas2 ;can not printable in first step | |
bas1: | |
addi rf,r1,r2 ;print | |
jmp son2 ;ends | |
bas2: | |
load r3,11111111b ;XOR necessarities | |
load r4,00000001b | |
load r5,10 ;division element | |
xor r5,r5,r3 ;two's complimenting | |
addi r3,r4,r5 | |
load r4,0 ;dividing by 10 | |
load r5,1 | |
load r0,10 | |
bolme: | |
addi r1,r1,r3 | |
addi r4,r4,r5 | |
jmpLE r1<=r0,bas2bas | |
jmp bolme | |
bas2bas: ;printing integer they are bigger than 9 and smaller then 100 | |
addi rf,r2,r4 | |
addi rf,r2,r1 | |
son2: | |
halt | |
Array: db 1 ;array first element | |
db 2 | |
db 3 | |
db 4 | |
db 5 | |
db 6 | |
db 7 | |
db 0 ;array terminator |
İ updated it and it can print numbers like 0 to 99
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in this program,total can be printed if it is 0 to 9
i will rewrite it in these days if i have some tomes,that can print numbers like 12...
and it will have ability to print total from 0 to 99