CSA M1S2

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/52

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

53 Terms

1
New cards

data section

bss section

text section

3 sections of an assembly program

2
New cards

data section

declaring initialized data or constants

section .data
3
New cards
section .data

syntax for declaring data section

4
New cards

bss section

section used for declaring variables

section .bss	
5
New cards
section .bss

syntax for declaring bss section

6
New cards

text section

section that is used for keeping the actual code

begins with declaration

global _start
7
New cards
global _start

kernel where the program execution begins

8
New cards
section .text
global _start
_start:

syntax for declaring text section

9
New cards

;

comment for assembly language

10
New cards

executable instructions

assembler directives or pseudo-ops

macros

3 types of statements in assembly language

11
New cards

executable instructions

tell the processor what to do

contains an operation code

generates one ML instruction

12
New cards

assembler directives or pseudo-ops

tell the assembler about the various aspects of the assembly process

non executable and do not generate ml instructionsma

13
New cards

macros

text substitution mechanism

14
New cards
<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>
15
New cards
16
New cards
nasm -f elf hello.asm

code to assemble the program in nasm

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

code to link the object file and create an executable file

18
New cards
./hello

code to execute the program

19
New cards

segmented memory model

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

20
New cards

data segment

code segment

stack

3 assembly memory segments

21
New cards

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>
22
New cards

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>
23
New cards

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>
24
New cards

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>
25
New cards

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>
26
New cards

AX - primary accumulator

used in input/output and most arithmetic instructions

27
New cards

primary accumulator

AX

28
New cards

BX - base register

used in indexed addressing

29
New cards

base register

BX

30
New cards

CX - count register

store the loop count in iterative opreations

31
New cards

DX - data register

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

32
New cards

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

33
New cards

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

34
New cards

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

35
New cards

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>
36
New cards

source index

destination index

2 sets of index pointers

37
New cards

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.

38
New cards

source index

used as source index for string operations

39
New cards

destination index

destination index for string operations

40
New cards

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

41
New cards

overflow flag OF

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

42
New cards

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

43
New cards

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

44
New cards

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

45
New cards

zero flag ZF

indicates the result of an arithmetic or comparison operation

nonzero result = clears zero flag to 0

zero result = sets to 1

46
New cards

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

47
New cards

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

48
New cards

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>
49
New cards

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>
50
New cards

code segment

data segment

stack segment

3 main segments

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

code segments

contains all the instructions to be executed

52
New cards

data segment

contains data, constants and work aras

53
New cards

stack segment

contains data and return addresses of procedures or subroutines. it is implemented as a ā€˜stackā€™ data structure