go to previous page   go to home page   go to next page

Answer:

No.

Absolute Value

Absolute Value Flow Chart

You can build a real rats-nest of code with assembly language. Avoid this by implementing the structures of a high level language. Draw a flowchart of the program or rough it out in C or Java before coding. Put comments in the assembly source program before you add code to show how the code and the flowchart correspond.

The flowchart at right shows a program that calculates the absolute value of the integer at symbolic address "A". Here is a start on a program that follows that logic:

## absVal.asm
##
## Calculate the absolute value of A

    .text
    .globl  main

main: 
# Get A
      lui   $10,0x1000     #  Initialize the
                           #  base register
      lw    $8,___($10)    #  Load A
      ___   $0,$0,0        #  no-op

# Is A Negative?

# Store -A

done:   

    .data
A:  .word   -1

Assume that "A" starts at address 0x10000000. The lui instruction points the base register $10 at that address.

QUESTION 14:

Fill in the blanks.