CSA M1S2

studied byStudied by 0 people
0.0(0)
Get a hint
Hint

data section

bss section

text section

1 / 52

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

53 Terms

1

data section

bss section

text section

3 sections of an assembly program

New cards
2

data section

declaring initialized data or constants

section .data
New cards
3
section .data

syntax for declaring data section

New cards
4

bss section

section used for declaring variables

section .bss	
New cards
5
section .bss

syntax for declaring bss section

New cards
6

text section

section that is used for keeping the actual code

begins with declaration

global _start
New cards
7
global _start

kernel where the program execution begins

New cards
8
section .text
global _start
_start:

syntax for declaring text section

New cards
9

;

comment for assembly language

New cards
10

executable instructions

assembler directives or pseudo-ops

macros

3 types of statements in assembly language

New cards
11

executable instructions

tell the processor what to do

contains an operation code

generates one ML instruction

New cards
12

assembler directives or pseudo-ops

tell the assembler about the various aspects of the assembly process

non executable and do not generate ml instructionsma

New cards
13

macros

text substitution mechanism

New cards
14
<p>[label] mnemonic [operands] [;comment]</p>

[label] mnemonic [operands] [;comment]

format of assembly language statements

mnemonic - name of instruction

operands - parameters of the command

<p>format of assembly language statements</p><p><strong>mnemonic </strong>- name of instruction</p><p><strong>operands </strong>- parameters of the command</p>
New cards
15
New cards
16
nasm -f elf hello.asm

code to assemble the program in nasm

New cards
17
ld -m elf_i386 -o hello hello.o

code to link the object file and create an executable file

New cards
18
./hello

code to execute the program

New cards
19

segmented memory model

divides the system memory into groups of independent segments referenced by pointers located in the segment registers

New cards
20

data segment

code segment

stack

3 assembly memory segments

New cards
21

data segment

.data and .bss

.data - declare the memory region, where data elements are stored for the program

.bss - static memory section that contains buffers for data to be declared later in the program. zero-filled buffer memory

<p><strong>.data </strong>and <strong>.bss</strong></p><p><strong>.data </strong>- declare the memory region, where data elements are stored for the program</p><p><strong>.bss </strong>- static memory section that contains buffers for data to be declared later in the program. zero-filled buffer memory</p>
New cards
22

code segment

.text

defines an area in memory that stores the instruction codes

fixed area

<p><strong>.text</strong></p><p>defines an area in memory that stores the instruction codes</p><p>fixed area</p>
New cards
23

stack

contains data values passed to functions and procedures within the program

<p>contains data values passed to functions and procedures within the program</p>
New cards
24

registers

store data elements for processing without having to access the memory

<p>store data elements for processing without having to access the memory</p>
New cards
25

data registers

4 32-bit data registers are used for arithmetic, logical, and other operations

As complete 32-bit data registers: EAX, EBX, ECX, EDX.

  • Lower halves of the 32-bit registers can be used as four 16-bit data registers: AX, BX, CX and DX.

  • Lower and higher halves of the abovementioned four 16-bit registers can be used as eight 8-bit data registers: AH, AL, BH, BL, CH, CL, DH, and DL.

<p>4 32-bit data registers are used for arithmetic, logical, and other operations</p><p>As complete 32-bit data registers: <strong>EAX, EBX, ECX, EDX. </strong></p><ul><li><p>Lower halves of the 32-bit registers can be used as four 16-bit data registers: <strong>AX, BX, CX and DX. </strong></p></li><li><p>Lower and higher halves of the abovementioned four 16-bit registers can be used as eight 8-bit data registers: <strong>AH, AL, BH, BL, CH, CL, DH, and DL.</strong></p></li></ul>
New cards
26

AX - primary accumulator

used in input/output and most arithmetic instructions

New cards
27

primary accumulator

AX

New cards
28

BX - base register

used in indexed addressing

New cards
29

base register

BX

New cards
30

CX - count register

store the loop count in iterative opreations

New cards
31

DX - data register

also used in i/o operations. also used with AX for multiply and divide operations

New cards
32

pointer registers

32-bit EIP, ESP, and EBP registers and corresponding 16-bit right portions IP, SP, and BP

3 categories":

  1. instruction pointer

  2. stack pointer

  3. base pointer

New cards
33

instruction pointer IP

16bit register

stores the offset address of the next instruction to be executed

in association with the CS register, gives the complete address of the current instruction in the code segment

New cards
34

stack pointer SP

16bit register

provides the offset value within the program stack

associated with SS register, refers to be current position of data or address within the program stack

New cards
35

base pointer BP

16 bit register

helps in referencing the parameter variables passed to a subroutine

address in SS register is combined with the offset of this register to get the location of the parameter

also can be combined with DI and SI as base register for special addressing

<p>16 bit register</p><p>helps in referencing the parameter variables passed to a subroutine</p><p>address in SS register is combined with the offset of this register to get the <strong>location of the parameter</strong></p><p>also can be combined with DI and SI as base register for special addressing</p>
New cards
36

source index

destination index

2 sets of index pointers

New cards
37

index registers

ESI and EDI, and their 16-bit rightmost portions, SI and DI, are used for indexed addressing and sometimes used in addition and subtraction.

New cards
38

source index

used as source index for string operations

New cards
39

destination index

destination index for string operations

New cards
40

control registers

32 bit instruction pointer register and 32 bit flags register combined to get this

many instructions involve comparisons and mathematical calculations and change the status of the flags and some other conditional instructions test the value of these status flags to take the control flow to other location

New cards
41

overflow flag OF

indicates the overflow of high-order bit (leftmost bit) of data after a signed arithmetic operation

New cards
42

direction flag DF

determines left or right direction for moving or comparing string data

DF set to 0 = string operation takes LtoR direction

DF set to 1 = string operation takes R to L direction

New cards
43

interrupt flag IF

determines whether the external interrupts like keyboard entry, are to be ignored or processed

IF set to 0 = disable interrupt

IF set to 1 = enable interrupt

New cards
44

sign flag SF

shows the sign of the result of an arithmetic operation

set according to the sign of data item following the arithmetic opreation

positive result = clears the value of SF to 0

negative result = sets the value of SF to 1

New cards
45

zero flag ZF

indicates the result of an arithmetic or comparison operation

nonzero result = clears zero flag to 0

zero result = sets to 1

New cards
46

auxiliary carry flag AF

contains the carry from bit 3 to bit 4 following an arithmetic opreation; used for specialized arithmetic

AF set when 1byte arithmetic opreation causes a carry from bit 3 to bit 4

New cards
47

parity flag PF

indicates the total number of 1bits in the result obtained from an airhtmetic opreation

an even number of 1 bits clears the parity flag to 0 and an odd numbre of 1 bits stes the parity flag to 1

New cards
48

carry flag CF

contains the carry of 0 or 1 from a high order bit (leftmost) after an airthmetic opreation

stores the contents of last bit of a shift or rotate opreation

<p>contains the carry of 0 or 1 from a high order bit (leftmost) after an airthmetic opreation</p><p>stores the contents of last bit of a shift or rotate opreation</p>
New cards
49

segments

specific areas defined in a program for containing data, code, and stack

<p>specific areas defined in a program for containing data, code, and stack</p>
New cards
50

code segment

data segment

stack segment

3 main segments

<p>3 main segments</p>
New cards
51

code segments

contains all the instructions to be executed

New cards
52

data segment

contains data, constants and work aras

New cards
53

stack segment

contains data and return addresses of procedures or subroutines. it is implemented as a ‘stack’ data structure

New cards

Explore top notes

note Note
studied byStudied by 83 people
... ago
5.0(1)
note Note
studied byStudied by 16332 people
... ago
4.9(156)
note Note
studied byStudied by 131 people
... ago
5.0(1)
note Note
studied byStudied by 13 people
... ago
5.0(1)
note Note
studied byStudied by 208 people
... ago
5.0(1)
note Note
studied byStudied by 35 people
... ago
5.0(1)
note Note
studied byStudied by 81 people
... ago
5.0(1)
note Note
studied byStudied by 41100 people
... ago
4.9(218)

Explore top flashcards

flashcards Flashcard (85)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (21)
studied byStudied by 13 people
... ago
5.0(1)
flashcards Flashcard (98)
studied byStudied by 26 people
... ago
5.0(1)
flashcards Flashcard (100)
studied byStudied by 10 people
... ago
5.0(1)
flashcards Flashcard (61)
studied byStudied by 6 people
... ago
5.0(1)
flashcards Flashcard (63)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (67)
studied byStudied by 25 people
... ago
5.0(1)
flashcards Flashcard (31)
studied byStudied by 5 people
... ago
5.0(1)
robot