;; ;; Author: Bill Slough ;; ;; MAT 3670 ;; ;; Example assembly language program with a conditional statement ;; ;; Determines the minimum value of two integers. ;; .ORIG x3000 ; specify the "origin"; i.e., where to load in memory IF LD R0,X ; if (x - y < 0) LD R1,Y ; NOT R2,R1 ; ADD R2,R2,#1 ; ADD R3,R0,R2 ; BRzp ELSE ; then THEN ST R0,MIN ; min = x BRnzp EIF ; else ELSE ST R1,MIN ; min = y EIF ; end if STOP HALT ; X .FILL 6 ; first value Y .FILL 8 ; second value MIN .BLKW 1 ; reserved for min(X, Y) .END