+/EE460N

computer architecture

git clone https://git.julia.blue/+/EE460N

Rahul Butani12 chars -> 7.5 pointsd5b1109

master
495 B17 linesraw
1; Take 2 signed 8 bit values in R0, add them, and store the result at x3050
2    .ORIG x3000
3    RSHFA R1 R0 #8            ; Isolate the values in to R0 and R1, preserving their
4    LSHF  R0 R0 #8            ; signs with arithmetic shifts
5    RSHFA R0 R0 #8
6
7; Now that they're isolated, we can simply do 2's compliment addition
8    ADD R0 R0 R1
9
10; Finally, store the result at the desired memory address
11    LEA R1 ANSWER
12    LDW R1 R1 #0
13    STW R0 R1 #0
14    HALT
15
16ANSWER  .FILL x3050
17    .END