;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; file: pythagoras.s ;; author: Spring 2020 MCS-178 gang ;; ;; This program reads in three integers a, b, and c from the user and ;; checks whether a^2 + b^2 = c^2 or not. If it is, it writes 10 to ;; the screen; else it writes 20. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; allocate-registers a b c a2 b2 c2 suma2b2 result jump-target ten twenty read a read b read c mul a2 a a mul b2 b b mul c2 c c add suma2b2 a2 b2 seq result suma2b2 c2 li jump-target elseL jeqz result jump-target li ten 10 write ten halt elseL: li twenty 20 write twenty halt