; ; Adds two numbers a and b and places the result in c. ; The inputs are not modified. The input and output values ; are at fixed addresses 6,7, and 8. ; ; Bennet Yee, cs30f, Oct 6, 1997. ; ; The equivalent C code is next to the assembler in the comments. ; 0 ; start addr 9 9 1 ; 0 subz scr,scr,nxt 9 6 2 ; 1 subz scr,a,nxt scr = -a 9 7 3 ; 2 subz scr,b,nxt scr -= b 8 8 4 ; 3 subz c,c,nxt 8 9 5 ; 4 subz c,scr,nxt c = -scr 9 9 5 ; 5 subz scr,scr,this -- terminate program 0 0 65535 ; 6 a 0 1 3 ; 7 b 0 0 0 ; 8 c 0 0 0 ; 9 scr