Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
BR or BRnzp ; unconditional branch, i.e.
|
||||
; branch if (result < 0 || result == 0 || result > 0)
|
||||
; ^ this is always true
|
||||
|
||||
BRn ; branch if (result < 0)
|
||||
BRz ; branch if (result == 0)
|
||||
BRp ; branch if (result > 0)
|
||||
|
||||
; or any combination of these condition codes, e.g.
|
||||
BRnz ; branch if (result <= 0)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
.orig x3000
|
||||
LD R1, x ; get x
|
||||
LD R2, y ; get y
|
||||
NOT R0, R2 ; R0 = ~y
|
||||
ADD R0, R0, 1 ; R0 = -y
|
||||
ADD R0, R0, R1 ; R0 = x - y
|
||||
BRZ BRANCH ; if (x == y) { go to BRANCH }
|
||||
LEA R0, nottaken
|
||||
PUTS ; else print "Branch Not Taken!"
|
||||
BR END
|
||||
BRANCH
|
||||
LEA R0, taken
|
||||
PUTS ; print "Branch Taken!"
|
||||
END HALT
|
||||
x .fill 1
|
||||
y .fill 1
|
||||
taken .stringz "Branch Taken!"
|
||||
nottaken .stringz "Branch Not Taken!"
|
||||
.end
|
||||
Loading…
Add table
Add a link
Reference in a new issue