Created
December 25, 2011 17:35
-
-
Save sinannar/1519529 to your computer and use it in GitHub Desktop.
billab-hw-part2-20point
This file contains 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
; | |
;I want to describe my algorithm here cause this is so easig to use in this program | |
;We have got four number as a,b,c and d | |
;I compare firstly a and b and select the bigger one | |
;Next,I compare c and d and select the bigger one | |
;In concluion i compare this two result | |
; | |
;a->R1 , b->R2 ,b->R3 ,d->R4 | |
;compare a and b,move the bigger one to R5 | |
;compare c and d,move the bigger one to R6 | |
;compare values thes stored in R5 and R6 | |
;store 48 in R8 | |
;biggest of these values can detected in this way and printable | |
; | |
LOAD RF,10 | |
LOAD RF,10 | |
LOAD RF,10 | |
LOAD RF,10 | |
LOAD R1,[a] | |
LOAD R2,[b] | |
LOAD R3,[c] | |
LOAD R4,[d] | |
LOAD R8,48 | |
firstCalculation: | |
MOVE R0,R1 | |
jmpLE R2<=R0,first | |
jmp second | |
first: | |
MOVE R5,R1 | |
jmp secondCalculation | |
second: | |
MOVE R5,R2 | |
jmp secondCalculation | |
secondCalculation: | |
MOVE R0,R3 | |
jmpLE R4<=R0,third | |
jmp fourth | |
third: | |
MOVE R6,R3 | |
jmp thirdCalculation | |
fourth: | |
MOVE R6,R4 | |
jmp thirdCalculation | |
thirdCalculation: | |
MOVE R0,R5 | |
jmpLE R6<=R0,conculation1 | |
jmp conculation2 | |
conculation1: | |
ADDI RF,R5,R8 | |
jmp bitir | |
conculation2: | |
ADDI RF,R6,R8 | |
jmp bitir | |
bitir: halt | |
a : db 4 | |
b : db 3 | |
c : db 2 | |
d : db 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment