This program checks if X < 2*Y. If it is the case, then Answer=0, otherwise Answer=1;
; double the contents of Y [0] LOD 112 ;load [y] into ACC [2] MUL #2 ;ACC now contains 2*Y [4] STO 112 ;store new value back in Y ; store [X]-2*[Y] in Y [6] LOD 110 ;load [X] into ACC [8] SUB 112 ;ACC now contains [X]-2*[Y] [10] STO 112 ;save ACC in [Y] ; set Answer=0 if X < 2*Y, otherwise set Answer=1 [12] CPL 112 ;if X-2Y < 0, set ACC=1, else set ACC=0 [14] NOT ;Invert the value of ACC (swap 0 <-> 1) [16] STO 114 ;store the result in Answer [18] HLT ;stop .... .... [110] ; storage for X [112] ; storage for Y [114] ; storage for Answer |