Comp Arch Exam 2

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/62

encourage image

There's no tags or description

Looks like no tags are added yet.

63 Terms

1
New cards
Return register for a 32-bit C function
EAX
2
New cards
STDCALL stack cleanup
Procedure runs ret n (e.g. ret 12)
3
New cards
C convention stack cleanup
Caller runs add esp, n after the call
4
New cards
C convention push order
Right to left, so the first argument is pushed last
5
New cards
PROC parameters must be on one line?
False
6
New cards
Prologue with params and locals
push ebp / mov ebp, esp / sub esp, n
7
New cards
Epilogue with params and locals
mov esp, ebp / pop ebp / ret
8
New cards
ENTER n, 0 equals
push ebp / mov ebp, esp / sub esp, n
9
New cards
LEAVE equals
mov esp, ebp / pop ebp
10
New cards
First C stack parameter
[ebp+8], then [ebp+12], [ebp+16]
11
New cards
Passing 8/16-bit args on the stack
Widen to 32 bits with MOVZX/MOVSX, then push
12
New cards
MASM flags byte-array pointer passed as word-array pointer?
False, MASM can't tell pointer types apart
13
New cards
Calling conventions include preserving registers?
Yes
14
New cards
DW and DUP allowed in inline assembly?
No
15
New cards
Alternative to OFFSET
LEA
16
New cards
Base-index registers in 32-bit mode
Any two 32-bit general-purpose registers (ESP can't be the index)
17
New cards
DF for backward string ops
DF = 1 (STD)
18
New cards
DF for forward string ops
DF = 0 (CLD)
19
New cards
STOSB index step
1
20
New cards
STOSD index step
4
21
New cards
EDI after SCASW match (DF = 0)
Next word, 2 bytes past the match
22
New cards
EDI after SCASD match (DF = 0)
Next doubleword, 4 bytes past the match
23
New cards
Prefix to find first occurrence of a character
REPNE
24
New cards
Prefix to find first nonzero value
REPE
25
New cards
[ESI] into AX
LODSW
26
New cards
EAX into [EDI]
STOSD
27
New cards
Equivalent of JNA
JBE
28
New cards
Multiply EAX by 2^n
shl eax, n
29
New cards
Divide signed EBX by 8
sar ebx, 3 (SAR keeps the sign)
30
New cards
Swap halves of CH
rol ch, 4
31
New cards
Swap halves of DX
rol dx, 8
32
New cards
SHLD top nibble of AX into DX
shld dx, ax, 4
33
New cards
DIV with 8-bit divisor results
AL = quotient, AH = remainder
34
New cards
AND with imm32 in 64-bit mode
imm32 is sign-extended to 64 bits first
35
New cards
Macro can contain data definitions?
Yes (mWrite has code and data)
36
New cards
Struct variable declaration order
Name, then type, e.g. march RentalInvoice <'12345',10,0>
37
New cards
Struct with more initializers than fields
Invalid
38
New cards
Read wMinute into AX
mov ax, sysTime.wMinute
39
New cards
Two NaN types
Quiet NaN, Signaling NaN
40
New cards
Largest FLD operand
REAL10, 80 bits (TBYTE)
41
New cards
FSTP vs FST
FSTP also pops ST(0)
42
New cards
FISUB vs FSUB
FISUB's operand is an integer
43
New cards
Load integer into ST(0)
FILD
44
New cards
Rounding mode field
RC (Rounding Control), control word bits 10 to 11
45
New cards
Four rounding modes
Nearest even (00), down toward -inf (01), up toward +inf (10), truncate toward 0 (11)
46
New cards
Why 0.2 or 0.3 isn't exact in binary
Denominator isn't a power of 2
47
New cards
Single precision layout
1 sign, 8 exponent (bias 127), 23 fraction
48
New cards
Double precision layout
1 sign, 11 exponent (bias 1023), 52 fraction
49
New cards
80-bit extended layout
1 sign, 15 exponent (bias 16383), 1 explicit integer bit, 63 fraction
50
New cards
80-bit register size in hex
20 hex digits, keep trailing zeros
51
New cards
Normalized form
Shift the point so one 1 is left of it, 1.xxx x 2^e
52
New cards
Segment paired with offset
Logical address
53
New cards
Segment base + offset
Linear address
54
New cards
After page translation
Physical address
55
New cards
Get events from OS
GetMessage
56
New cards
GetMessage value that ends the program
0
57
New cards
Send messages to WinProc
DispatchMessage
58
New cards
Popup window function
MessageBox
59
New cards
GUI program entry point
WinMain
60
New cards
WinProc parameters
4 DWORDs, message type is parameter 2
61
New cards
msgPt field type
POINT
62
New cards
Heap allocate / free
HeapAlloc / HeapFree
63
New cards
Default process heap
GetProcessHeap