Term
| Difference between overflow and carry? |
|
Definition
|
overflow - signed numbers
carry - unsigned numbers
|
|
|
Term
| What is a register and why do we need them? |
|
Definition
|
A register stores memory and it is the only place to put memory in the CPU.
|
|
|
Term
| What does a compiler generate? |
|
Definition
|
|
Term
|
Definition
|
a chunk of the stack to store all items and memory of a function. every process has a stack
|
|
|
Term
| Give two examples of addressing modes |
|
Definition
|
register direct, immediate
|
|
|
Term
| How does an assembler work? |
|
Definition
|
Reads in a line of code, makes a table out of it and turns it into object code. Also has two passes.
|
|
|
Term
| What assembly code do we use to declare an integer in the data segment with initial value 2? |
|
Definition
|
|
Term
| What is memory direct addressing good for? |
|
Definition
|
Good for quickly restoring values.
|
|
|
Term
| What size is the machine language code for movl %esp, %ebp? |
|
Definition
|
|
Term
| Where is the return value for any called function? |
|
Definition
|
|
Term
| Where are the parameters for the read function call, and what is the order of those parameters (in general)? |
|
Definition
|
in the stack:
pushl $#chars
pushl $buffer
pushl $0
call read
addl $12, %esp
|
|
|
Term
| Why would you use scanf/printf instead of read/write? |
|
Definition
|
Runtime is shorter and you don't need to specify the # of chars
|
|
|
Term
| What does the register indirect addressing mode do? |
|
Definition
|
Allows the register to act as a pointer
|
|
|
Term
| How do we specify register indirect for %eax? |
|
Definition
|
Put parentheses around the register: (%eax)
|
|
|
Term
| What instruction would you use to turn off the least significant bit in register %al? |
|
Definition
|
|
Term
|
Definition
|
zero flag
Used to change the zero bit
|
|
|
Term
| Difference between pushl $72 and pushl 72? |
|
Definition
|
pushl 72 = pushes contents of 72 onto stack
pushl $72 = pushes the actual number 72 onto the stack
|
|
|