I'm doing this for a school assignment I've been given in Computer Architecture. The topic is on the Von Neuman Machine (The IAS) and we were tasked to create a program that can do whatever we wanted.
I opted for a program that could Check someone's temperature and determine whether it was normal, if they have a fever or hypothermia...Just something simple.
I keep getting the error whenever I try to load the code into the IAS simulator, "Labels can only be used with instructions in the left half of a word at line 8 and column 0." It has given me a headache and I do not know what to do. Please help me.
This is the code:
; Program
_pgm0: ; Average temperature
S(x)->Ac+ _temp1
S(x)->Ah- _temp2
R ; Divide by 2
At->S(x) _avg_temp
Cu->S(x) _pgm1 ; Continue to hypothermia check
_pgm1: ; Hypothermia check
S(x)->Ac+ _avg_temp
S(x)->Ah- _hypo_thresh
Cc->S(x) _pgm2 ; If >= hypothermia threshold, check for low
S(x)->Ac+ _severe_hypo
At->S(x) _hypo_grade
Cu->S(x) _halt_addr
_pgm2: ; Basic low temperature check
S(x)->Ac+ _avg_temp
S(x)->Ah- _low
Cc->S(x) _pgm3 ; If >= low threshold, check for fever
S(x)->Ac+ _toolow
At->S(x) _alert
Cu->S(x) _halt_addr
_pgm3: ; Fever check
S(x)->Ac+ _avg_temp
S(x)->Ah- _high
Cc'->S(x) _normal ; If < high threshold, it's normal
S(x)->Ac+ _toohigh
At->S(x) _alert
Cu->S(x) _halt_addr
_normal: ; Normal temperature
S(x)->Ac+ 0
At->S(x) _alert
Cu->S(x) _halt_addr
; DATA
; Temperature Inputs
_temp1:.data 370 ; First input temperature (e.g. 37.0)
_temp2:.data 380 ; Second input temperature (e.g. 38.0)
; Thresholds (scaled by 10)
_hypo_thresh:.data 355 ; Hypothermia threshold (35.5)
_low:.data 360 ; Low threshold (36.0)
_high:.data 380 ; High threshold (38.0)
; Alert Codes
_toolow:.data 1 ; "Too low" alert code
_toohigh:.data 2 ; "Too high" alert code
_severe_hypo:.data 2 ; Severe hypothermia code
_normal_code:.data 0 ; Normal temperature code
; Output Variables
_avg_temp:.data 0 ; Calculated average temperature
_alert:.data 0 ; 0 = normal, 1 = too low, 2 = fever
_hypo_grade:.data 0 ; 0 = none, 2 = severe hypothermia
; Control
_halt_addr:.data 9 ; Halt loop address
I tried re-formatting some lines and moving them closer to the left but that did not seem to work as well.
I also tried changing the way I structured the Data below but that did not seem to get it running.