Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Carter P.A.PC assembly language.2005.pdf
Скачиваний:
15
Добавлен:
23.08.2013
Размер:
1.07 Mб
Скачать

Index

ADC, 37, 54

ADD, 13, 36 AND, 50 array1.asm, 99–102 arrays, 95–115

accessing, 96–102 defining, 95–96

local variable, 96 static, 95

multidimensional, 103–106 parameters, 105–106

two dimensional, 103–104 assembler, 11

assembly language, 11–12

binary, 1–2 addition, 2

bit operations AND, 50 assembly, 52–53 C, 56–57

NOT, 51

OR, 50 shifts, 47–50

arithmetic shifts, 48 logical shifts, 47–48 rotates, 49

XOR, 51

branch prediction, 53 bss segment, 21 BSWAP, 59

BYTE, 16 byte, 4

C driver, 19

C++, 150–171

Big int example, 158–163 classes, 156–171

copy constructor, 161 early binding, 168 extern ”C”, 153 inheritance, 166–171 inline functions, 154–156 late binding, 168

member functions, see methods

name mangling, 151–153 polymorphism, 166–171 references, 153–154 typesafe linking, 152 virtual, 166

vtable, 167–171 CALL, 69–70

calling convention, 65, 70–76, 83– 84

cdecl, 84 stdcall, 84

C, 21, 71, 80–84 labels, 82 parameters, 82 registers, 81 return values, 83

Pascal, 71 register, 84 standard call, 84 stdcall, 72, 84, 171

CBW, 31

CDQ, 31

CLC, 37

181

182

CLD, 106 clock, 5 CMP, 37–38 CMPSB, 109 CMPSD, 109

CMPSW, 109 code segment, 21

COM, 171 comment, 12 compiler, 5, 11

Borland, 22, 23

DJGPP, 22, 23 gcc, 22

attribute , 84, 145, 148, 149

Microsoft, 22

pragma pack, 146, 148, 149 Watcom, 83

conditional branch, 39–41 counting bits, 60–64

method one, 60–61 method three, 62–64 method two, 61–62

CPU, 5–7 80x86, 6

CWD, 31

CWDE, 31

data segment, 21 debugging, 16–18 DEC, 13 decimal, 1 directive, 13–15

%define, 14 DX, 14, 95 data, 14–15 DD, 15 DQ, 15 equ, 13 extern, 77

global, 21, 78, 80 RESX, 14, 95 TIMES, 15, 95

INDEX

DIV, 34, 48

do while loop, 43

DWORD, 16

endianess, 24–25, 57–60 invert endian, 59

FABS, 130

FADD, 126

FADDP, 126

FCHS, 130

FCOM, 129

FCOMI, 130 FCOMIP, 130, 140

FCOMP, 129

FCOMPP, 129 FDIV, 128

FDIVP, 128

FDIVR, 128

FDIVRP, 128

FFREE, 126

FIADD, 126

FICOM, 129

FICOMP, 129 FIDIV, 128

FIDIVR, 128

FILD, 125

FIST, 126

FISUB, 127

FISUBR, 127

FLD, 125

FLD1, 125 FLDCW, 126 FLDZ, 125

floating point, 117–139 arithmetic, 122–124 representation, 117–122

denormalized, 121 double precision, 122 hidden one, 120 IEEE, 119–122

single precision, 120–121 floating point coprocessor, 124–139

INDEX

addition and subtraction, 126– 127

comparisons, 128–130 hardware, 124–125

loading and storing data, 125–

126

multiplication and division, 128

FMUL, 128

FMULP, 128 FSCALE, 130, 141 FSQRT, 130 FST, 126 FSTCW, 126 FSTP, 126 FSTSW, 129 FSUB, 127

FSUBP, 127

FSUBR, 127

FSUBRP, 127

FTST, 129

FXCH, 126

gas, 157

hexadecimal, 3–4

I/O, 16–18

asm io library, 16–18 dump math, 18 dump mem, 17 dump regs, 17 dump stack, 17 print char, 17 print int, 17

print nl, 17 print string, 17 read char, 17 read int, 17

IDIV, 34

if statment, 42 immediate, 12 IMUL, 33–34 INC, 13

183

indirect addressing, 65–66 arrays, 98–102

integer, 27–38 comparisons, 37–38 division, 34

extended precision, 36–37 multiplication, 33–34 representation, 27–33

one’s complement, 28 signed magnitude, 27 two’s complement, 28–30

sign bit, 27, 30

sign extension, 30–33 signed, 27–30, 38 unsigned, 27, 38

interfacing with C, 80–89 interrupt, 10

JC, 39

JE, 41

JG, 41

JGE, 41

JL, 41

JLE, 41

JMP, 38–39

JNC, 39

JNE, 41

JNG, 41

JNGE, 41

JNL, 41

JNLE, 41

JNO, 39

JNP, 39

JNS, 39

JNZ, 39

JO, 39

JP, 39

JS, 39

JZ, 39

label, 14–16 LAHF, 129 LEA, 83, 103

184

linking, 23 listing file, 23–24 locality, 143 LODSB, 107 LODSD, 107

LODSW, 107 LOOP, 41

LOOPE, 41

LOOPNE, 41

LOOPNZ, 41

LOOPZ, 41

machine language, 5, 11

MASM, 12 math.asm, 35–36 memory, 4–5

pages, 10 segments, 9, 10 virtual, 9, 10

memory.asm, 111–115 memory:segments, 9 methods, 156 mnemonic, 11

MOV, 12

MOVSB, 108

MOVSD, 108

MOVSW, 108

MOVSX, 31

MOVZX, 31

MUL, 33–34, 48, 103 multi-module programs, 77–80

NASM, 12 NEG, 34, 55 nibble, 4 NOT, 52

opcode, 11 OR, 51

prime.asm, 43–45 prime2.asm, 135–139 protected mode

16-bit, 9

INDEX

32-bit, 10

quad.asm, 130–133 QWORD, 16

RCL, 49

RCR, 49 read.asm, 133–135 real mode, 8–9 recursion, 89–90 register, 5, 7–8

32-bit, 7

base pointer, 7, 8 EDI, 107

EDX:EAX, 31, 34, 37, 83 EFLAGS, 8

EIP, 8

ESI, 107 FLAGS, 7, 37–38

CF, 38

DF, 106

OF, 38

PF, 39

SF, 38

ZF, 38 index, 7

IP, 7

segment, 7, 8, 107 stack pointer, 7, 8

REP, 108–109 REPE, 110 REPNE, 110

REPNZ, see REPNE REPZ, see REPE RET, 69–70, 72 ROL, 49

ROR, 49

SAHF, 129

SAL, 48

SAR, 48

SBB, 37

SCASB, 109

INDEX

SCASD, 109

SCASW, 109

SCSI, 147–149 SETxx, 54 SETG, 55

SHL, 47

SHR, 47 skeleton file, 25

speculative execution, 53 stack, 68–76

local variables, 75–76, 82–83 parameters, 70–73

startup code, 23

STD, 106 storage types

automatic, 91 global, 91 register, 93 static, 91 volatile, 93

STOSB, 107

STOSD, 107

string instructions, 106–115 structures, 143–150

alignment, 145–146 bit fields, 146–150 o setof(), 144

SUB, 13, 36 subprogram, 66–93

calling, 69–76 reentrant, 89

subroutine, see subprogram

TASM, 12

TCP/IP, 59

TEST, 51

text segment, see code segment two’s complement, 28–30

arithmetic, 33–37 TWORD, 16

UNICODE, 59

while loop, 43

185

WORD, 16 word, 8

XCHG, 60

XOR, 51

Соседние файлы в предмете Электротехника