Week One Lectures Flashcards
Hardware refers to:
the tangible physical devices that comprise a computer
system.
Software refers to:
the instructions that control the hardware.
“Caching” is:
moving information from slower storage to faster storage, where it can be accessed more quickly.
A “bus” is:
a set of parallel “wires” for transferring a set of electrical signals simultaneously.
“vonNeumann architecture” refers to computer architectures that:
store programs in memory, and execute them under the control of the instruction execution cycle.
Inside the computer, machine instructions, memory addresses, numbers, characters, etc., are all represented as:
electrical signals.
In the simple CISC architecture, which register holds:
a. the current machine instruction?
b. the current micro-instruction?
a. The Instruction Register (IR).
b. The Control Register.
What is the first step in the instruction execution cycle?
Fetch the instruction at the address in the Instruction Pointer into the Instruction Register.
What is the second step in the instruction execution cycle?
Increment the Instruction Pointer to point to next instruction.
What is the third step in the instruction execution cycle?
Decode the instruction in the Instruction Register.
What is the fourth step in the instruction execution cycle?
If the instruction requires memory access, determine the memory address, and fetch the operand from memory into a CPU register, or send the operand from a CPU register to memory.
What is the fifth step in the instruction execution cycle?
Execute the instruction.
What is the sixth step in the instruction execution cycle?
Repeat from step 1.
Consider the virtual machine levels. At each level (except 0: Digital Logic and 5: High level language), an interpreter accepts an instruction from the level above, converts the instruction to its own language, and passes the resulting instructions to the level below. Note that Level-0 has no interpreter; the instructions from the Micro-architecture level are sent directly to the hardware.
Suppose that the interpreters at each level (levels 1 - 4) generate n instructions in order to represent one instruction from the level above. Suppose also that each Level-0 instruction executes in c nanoseconds.
a. How long does it take to execute a Level-3 instruction?
b. How long does it take to execute a Level-5 instruction?
a. cn^2 ns. Going from level-3 to level-2 creates n instructions. For each of those n instructions, going from level-2 to level-1 creates n instructions, so there will be n^2 micro-instructions, each of which requires c nano-seconds to execute.
b. cn^4 ns.
a. A MASM program must have a procedure named “main.”
b. ‘END main’ is a directive that tells the OS where to begin execution of the program.
a. True
b. True
What's wrong with the following data segment? .data x_value DWORD 5 7Eleven BYTE "My job", 0 X_VALUE DWORD 500 Age ;user's age; DWORD ?
x_value and X_VALUE are the same variable, since MASM is not case-sensitive.
7Eleven is an invalid variable name (can’t start with a digit).
Age ;user’s age; DWORD ? The first semi-colon makes all of the rest of the line into a comment.
The following data segment starts at memory address 1400. What is the address of each variable? .data a. myName BYTE "Elmer Fudd", 0 b. yourName BYTE 30 DUP(0) c. myAge DWORD 45 d. yourAGE DWORD ? e. myScore DWORD ? f. yourScore DWORD ?
a. Address = 1400, size = 11
b. Address = 1400 + 11 = 1411, size = 30
c. Address = 1411+ 30 = 1441, size = 4
d. Address = 1441+ 4 = 1445, size = 4
e. Address = 1445+ 4 = 1449, size = 4
f. Address = 1449+ 4 = 1453, size = 4
How many bits in 35 MiB ?
35 x 2^20 (Bytes) x 8 (bits per Byte) = 293 601 280 bits
What is the width of the internal bus for IA-32 architecture?
32 bits
What is the size of the general-purpose registers for IA-32 architecture?
32 bits
What’s the result of the following code fragment? I.E., what registers are changed?
mov eax, 100
cdq ; convert double to quad
mov ebx, 13
div ebx
Registers changed:
eax contains 7 (integer quotient of 100/13)
ebx contains 13 (assigned, unchanged by division)
edx contains 9 (integer remainder of 100/13)
Given the following constant definition and data segment: MY_CREDITS = 12 .data x DWORD 12 y DWORD 13 z WORD 25
What’s wrong with the following code segment statements?
a. mov ebx, z
b. mov y, x
c. mov ebx, MY_CREDITS
d. mov MY_CREDITS, ebx
a. Size mismatch
b. Can’t move memory to memory
c. Nothing wrong here
d. Can’t assign register to a constant
Given the following data segment: .data intro_1 BYTE "Welcome, " userName BYTE "Fred." intro_2 BYTE "What's up?" count DWORD 0
What is displayed by the following code segment statements? mov edx, OFFSET intro_1 CALL WriteString CALL CrLf mov edx,OFFSET userName CALL WriteString CALL CrLf mov edx, OFFSET intro_2 CALL WriteString CALL CrLf
Welcome, Fred.What’s up?
Fred.What’s up?
What’s up?
Each call to WriteString displays memory until a zero is encountered.
Which two registers are automatically used by integer multiplication and division instructions?
EAX and EDX
Which register is automatically used as a counter for some looping instructions?
ECX
Which register is used for referencing the system stack?
ESP
Most register instructions (for now) reference:
EAX, EBX, ECX, EDX
There is more than one set of registers for the integer unit.
False
Is AL a valid 8-bit register reference?
Yes, AL refers to the 8 low-order bits of EAX
Is DH a valid 8-bit register reference?
Yes, DH refers to the 8 high-order bits of the 16 low-order bits of EDX.
Is SH a valid 8-bit register reference?
No, SH is not allowed. This would be ambiguous, because we have ESP, ESI, and SS registers.
Is EL a valid 8-bit register reference?
No. Can’t divide the ES register.
When instructions have multiple operands, which is usually the source and which is the destination? For example:
mov count, ebx
destination operand, source operand
Count is the destination and ebx is the source.
We are moving EBX to count.
Op1 CANNOT be a literal.
What types of files are produced by the assembler?
Object and listing files
What types of files are produced by the linker?
Executable files
Which operating system component reads and executes programs?
Loader
What are the data types BYTE and SBYTE?
8-bit unsigned and signed integers
What are the data types WORD and SWORD?
16-bit unsigned and signed integers
What are the data types DWORD and SDWORD?
Doubleword. 32-bit unsigned and signed integers
What is the data type FWORD?
48-bit integer (Far pointer in protected mode)
What is the data type QWORD?
Quadword is a 64-bit integer.
What does the MOV operand do?
It copies data from a source operand to a destination operand. Cannot move memory to memory.
What does the ADD operand do?
A source operand is added to a destination operand, and the sum is stored in the destination. Operands must be the same size.
What does the SUB operand do?
Subtracts the source operand from the destination operand. Has two operands.
What does the MUL operand do?
Multiplies AL, AX, or EAX by a source operand. If the source is 8 bits, it is multiplied by AL and the product is stored in AX. If the source is 16 bits, it is multiplied by AX and the product is stored in DX:AX. If the source is 32 bits, it is multiplied by EAX and the product is stored in EDX:EAX.
What does the DIV operand do?
Performs either 8-, 16-, or 32-bit unsigned integer division. If the divisor is 8 bits, the dividend is AX, the quotient is AL, and the remainder is AH.
If the divisor is 16 bits, the dividend is DX:AX, the quotient is AX, and the remainder is DX.
If the divisor is 32 bits, the dividend is EDX:EAX, the quotient is EAX, and the remainder is EDX.
What does the CDQ operand do?
Converts Doubleword to Quadword. Extends the sign bit in EAX throughout the EDX register.
What does the JMP operand do?
Jump Unconditionally to Label. Jump to a code label. A short jump is within −128 to +127 bytes from the current location. A near jump is within the same code segment, and a far jump is outside the current segment.
How many bits are used by Unicode characters in MS-Windows?
16
What values can a signed byte can be equal to?
-128 to 127
A program that combines object files into an executable program is called a _________.
Linker
What is the largest signed integer that may be stored in 32 bits?
2^31 - 1
What is the name of the time delay in a CPU caused by differences between the speed of the CPU, the system bus, and memory circuits?
Wait state
If you wanted to find out whether an integer contained an even number of 1 bits, which status flag would be useful?
Parity
The four parts of a CPU are:
clock, registers, control unit, arithmetic logic unit
How much memory can be addressed in Real-address mode? Protected mode?
1 MB Real-address Mode
4 GB Protected Mode
During which phase of the instruction execution cycle is the program counter incremented?
Fetch
Which internal bus uses binary signals to synchronize actions of all devices attached to the system bus?
Control bus
List the three primary steps of the instruction execution cycle, in sequential order.
Fetch, decode, execute
If a clock oscillates 10 billion times per second, what is the duration of a single clock cycle?
1.0 X 10^-10 seconds
Suppose that you are given the following program. What decimal value does the AX register hold when someProcedure is called??
.data
x DWORD 153461
y BYTE 37
z BYTE 90
.code main PROC mov AH, y mov AL, z call someProcedure inc EAX mov EBX, z xor EAX, EBX exit main ENDP END MAIN
9562.
- Convert higher register of AX from 37d to hex = 25h
- Convert lower register of AX from 90d to hex = 5Ah
- Combine AH + AL = 255Ah
- Convert back to decimal = 9562
Select a data definition statement that creates an array of 500 signed doublewords named myList and initializes each array element to the value -1.
myList SDWORD 500 DUP (-1)
Which utility program reads an assembly language source file and produces an object file?
Assembler
The byte-ordering scheme used by computers to store large integers in memory with the high-order byte at the lowest address is called:
Big endian
Given the following array definition, what’s a valid constant declaration named ArrayCount that automatically calculates the number of elements in the array?
newArray DWORD 10,20,30,40,50
ArrayCount = ($ - newArray) / 4
The basic parts of an instruction, in order from left to right, are:
label, mnemonic, operand(s), comment
When is a directive executed?
When is an instruction executed?
a directive is executed at assembly time
an instruction is executed at runtime
Which of the following defines a text macro named MESSAGE that contains this string data?
“I’m good at this!”,0
MESSAGE TEXTEQU
Which directive identifies the part of a program containing instructions?
.code
The integer range of standard ASCII codes is:
0 to 127
The three types of buses connected to the CPU are:
data, address, control
Which flag is set when an unsigned value is too large to fit into a destination operand?
carry
What is the name of the lowest 8 bits of the EDX register?
DL
What does a listing file contain?
A copy of the program’s source code with line numbers, the numeric address of each instruction, the machine code bytes of each instruction (hex), and program symbols.
The following are both valid data definition statements:
List1 BYTE 10,20
BYTE 30,40
True
The following is a valid data definition statement:
str1 \
BYTE “This string is quite long!”,0
True
Operands can be?
Register name Constant or constant expression Variable name (memory)
In the AddSub program in Section 3.2, the exit statement calls which predefined MS-Windows function to halt the program?
ExitProcess