Why are numbers in the computer represented in 2's complement?
The number of bits available for representing a number is limited; it is not clear how to represent a negative number
2
New cards
A byte is
8 bits
3
New cards
An ASCII length
7 bits and sign bit is always 0
4
New cards
When does overflow happen?
If you add two positives and the leftmost bit turns out negative; If you add two negatives and the leftmost bit turns out positive
5
New cards
How do you know there is a carry?
Extra leftmost bit
6
New cards
How do you know there is borrow?
In a substraction A - B, B is greater than A (need to take 2's complement and do addition A + 2's of B)
7
New cards
What is a BCD?
Binary coded decimal; each decimal digit has a representation of two numbers per byte (that look just like the decimal number) and zeros to fill in the missing bytes
8
New cards
What format is used for floating point numbers?
IEEE Single Point Precision Format
9
New cards
What are the steps for IEEE?
Convert floating point number to binary (for the decimal, multiply the value of the decimal times 2 and only count the number before the decimal point, then multiply the result by 2 and so on until you have an equal amount of results as number of decimals); decide sign bit; move the decimal point to the right of the leftmost bit; do "excess-127" (127 + binary exponent); put it together \= sign bit + exponent + mantissa
10
New cards
What is the binary conversion of 128?
1000 0000
11
New cards
+
OR
12
New cards
*
AND
13
New cards
The hexadecimal system represents numbers using about \____ as many digits as the binary system.
1/4
14
New cards
What is CRLF? (ASCII)
Newline
15
New cards
What are the three basic types of instruction operands?
Constants, CPU register designations, and references to memory locations.
16
New cards
Why do we not use signed magnitude to represent signed numbers in a computer?
We do not use signed magnitude to represent signed numbers in a computer because adding or subtracting two values in sign magnitude does not always lead to the correct result. Another reason is because the left most bit is used to indicate if a value is positive or negative while the magnitude bits indicate a value. This can make interpreting the value in sign magnitude extremely confusing and lead to incorrect interpretations.
17
New cards
What is the difference between a "carry in" and a "carry out"?
"Carry in" means there was a carry into the left most bit (sign bit) while "carry out" means there was a carry out of the left most bit. This occurs when adding two signed values. (In other words. If two values are added such as A + 7 the sum in decimal would be 17. Thus, 17 - 16 \= 1. As a result, you would put down 1 to indicate the difference between the sum and 16 and carry one over to the next numerical place value to indicate a carry of 16.)
18
New cards
What is the difference between the term, "two's complement representation", and "calculating the two's complement of a number"?
The two's complement representation is the signed fixed length representation of a value. Calculating the two's complement of a number is taking a number that is assumed to be in an unsigned form and converting to a signed form within a fixed length.
19
New cards
Justify your agreement or disagreement to the following: "Signed magnitude cannot be used as a means to represent signed numbers in a computer."
Sign magnitude cannot be used to represent signed numbers in a computer because if you add two values in sign magnitude you can get an incorrect answer. Also, it uses the left most bit (sign bit) as a 1 to indicate a negative value whilst all other bits in the magnitude are supposed to indicate an integer representation. This can be incredibly hard to distinguish thus signed magnitude should not be used as a means to represent signed numbers in a computer.
20
New cards
Six (cap, its five) basic components of a computer
CPU, Memory (RAM), input, output, and AUX memory
21
New cards
What are the parts of a CPU?
Control unit, arithmetic logic unit, registers (storage locations)
22
New cards
Is memory linear or a grid?
Linear
23
New cards
What terminates the information stored in RAM?
RAM will lose its memory after the computer is powered off.
24
New cards
What are some examples of input devices?
Keyboard, mouse, microphone
25
New cards
What are examples of output devices?
Monitor, speakers, printer
26
New cards
What are some examples of aux storage?
Harddrive, flashdrive
27
New cards
What does "byte-addresable" mean?
Each byte in memory has its own address
28
New cards
Flat Memory Model
An approach to assigning memory addresses in which memory locations are described by single unsigned integers corresponding to linear positions.
29
New cards
Segmented Memory Model
An approach to assigning memory addresses in which primary storage is divided into equal sized segments called pages, identified by sequential nonnegative integers; each memory address depends on its segment number (chunks of memory)
30
New cards
Paging
A memory management scheme where a computer stores and retrieves data from secondary storage for use in main memory.
31
New cards
What is the instruction pointer?
eip; holds address of the next instruction to be performed.
32
New cards
What are the parts of "add sum, 5"? (Mneumonic + operand)
Add \= mnemonic; sum, 5 \= operand; both \= instruction
33
New cards
Where are the instructions held in the instruction execution cycle?
RAM
34
New cards
Parts of Instruction Execution Cycle
Fetch (find out what is in eip and through address bus go into ram to get the corresponding bytes) Decode (In the control unit) Fetch operands Execute (Into the a/l unit) Store output
35
New cards
What are the 2 buses involved in the Instruction Execution Cycle?
Address and data
36
New cards
How are instructions stored in memory?
One byte has the mnemonic (opcode), the address of dest is stored, and then is source address (or value if it is immediate); information is stored in binary.
37
New cards
The bottleneck for the Instruction Execution Cycle
The system bus; everything we do goes through the system bus (CPU to MEMORY and back); 2^32 binary values at a time.
38
New cards
What does A/L Unit stand for?
Arithmetic/Logic Unit; gets information for memory or register receives data and perform calculation
39
New cards
What is the job of the CPU?
To direct traffic across the system bus.
40
New cards
What is the job of the CPU's control unit?
To interpret an opcode and directs the execution.
41
New cards
What is the control bus?
It tells us who is using the system bus at a point; monitors transmission of memory.
42
New cards
How many GB of data can be in the RAM?
4GB (2^32 \= Address bus is 32-bit)
43
New cards
What is the unsigned range of values that can be addressed?
0 -\> 4,294,967,295 (0 -\> 2^32 - 1)
44
New cards
What are the 4 General Purpose Registers
eax, ebx, ecx, edx (32-bit)
45
New cards
What are the four Index Registers?
ESI (Source Index Registers), EDI (Destination Index Registers), ESP (Stack Pointer), EBP (Base Pointer); (32-bit) for both you can only get to the low orderword
46
New cards
What is the Instruction Pointer?
EIP
47
New cards
Pre-Fetching Instructions
CPU fetches instructions before a prior instruction is executed.
48
New cards
When does a stall in the pipeline occur?
When two instructions attempt to use the same register.
49
New cards
What bit is CF
0
50
New cards
What bit is PF
2
51
New cards
What bit is ZF
6
52
New cards
What bit is SF
7
53
New cards
What bit is DF
10
54
New cards
What bit is OF
11
55
New cards
What is the maximum capacity IN HEX on a 32-bit system bus?
00 00 00 00 -\> FF FF FF FF
56
New cards
The EAX register is sometimes known as the \_________. Why?
Accumulator; because it is the destination of arithmetic results.
57
New cards
What are the three parts of the accumulator?
AX (0-15 bit), AH (8-15), AL (0-7)
58
New cards
What criterion must be satisfied for a value to be stored in Little ENDian?
It must be a numerical value (scaled value), it must be stored in memory, and it must be multibyte.
59
New cards
What is an instruction?
Statement that is translated by the assembler into machine code
60
New cards
What is a directive?
Indicates where to take action but does not result in execution of machine code
61
New cards
What does a macro do?
Calls a chunk of code to be exevuted
62
New cards
What character starts a comment in assembly code?
;
63
New cards
Is .586 an instruction or a directive?
Directive
64
New cards
Is mov eax, val an instruction or a macro?
Instruction
65
New cards
Is input prompt1, string, 40 an instruction or a macro?
Macro
66
New cards
Do all directives start with a '.'?
No
67
New cards
Is DWORD a macro or a directive?
Directive (allocates memory)
68
New cards
What are the main parts of a typical instruction? (4)
Name, mnemonic, operands, comment
69
New cards
If we have EAX \= 0x 00 00 10 04 and the instruction mov sum, eax, how is EAX value stored in sum?
Little ENDian; 04 10 00 00
70
New cards
In Little ENDian, the destination stores the least significant byte (rightmost) from the source in the \________ memory address.
Smallest
71
New cards
How many bytes of memory does a word allocate?
2
72
New cards
How many bytes of memory does a dword allocate?
4
73
New cards
How many bytes of memory does a qword allocate?
8
74
New cards
If in the data segment you declare: char1 BYTE 'q', and in the code segment it says mov ax, char1, what would be the error?
Size mismatch (or size ambiguity; ax is a 16-bit register while char1 is an 8-bit register)