### A good answer might be:

With assembly language it is essential to make a plan before coding.

# Start on the Program

The flowchart for the program is at right. The trick of setting a flag to a default value in advance of the test is common. Here is an outline of the program:

    ## tempRange.asm
    ##
    ## Check that   30 <= temp <= 55
    ## Set flag to 1 if in range, to 0 if out of range
    ##
    ## Registers:
    ## $2 --- temperature
    ## $3 --- in/out range indicator flag
    ## $8 --- scratch

          .text
          .globl  main
    # Set range indicator to 1
    main:   ori     $3,$0,1         #  set to 1

    # Test  30 <= temp <= 55
            sltiu   $8,$2,_____     #  $8=1 if temp <= 55
            beq     $8,$_____,_____ #  0? out of range
            sll     $0,$0,0         #  delay

           . . . .                  #  more instructions

    # Out of Range: set range indicator to 0
    out:
           . . . .                  #  set to 0

    # continue
    cont:  sll     $0,$0,0         #  target for the jump

    ## End of file

The range test is in two parts. The first part (in this program) tests if temp is less than or equal to 55. However, the machine instruction is "set on less than". If temp is out of range a branch is taken to `out`. The branch is followed by a no-op for the branch delay.

### QUESTION 6:

Fill in the blanks.