CPSC 2310 - DAY 4 AUGUST 24, 2016 ================================================================================ ACCUMULATOR MACHINE ------------------- Control Structure in assembly language. int x; int y; if(x == 0) y = 1; Don't use branches if you don't need to (introduces delays) load(x) bne0 else label(true) load(one) store(y) label(false) All comparisons within accumulator machine are based on zero. To compare, subtract two numbers and then compare to see if greater/less 0 Loops Implementing loops load(x) label(loop) sub(ten) -| test condition exit loop if false bgt0(done) -| load(x) -| add(y) -| body of loop, also updates lcv store(x) -| ba(loop) ** process for true part, drop out if false