21. gcccommands
gcc -Wall -save-temps hello.c -o hello
The above command saves temporary files generated during
creation of binary file hello in the current directory
24. An assembly language is a low-level
programming language for a computer, or
other programmable device, in which there is
a very strong (generally one-to-one)
correspondence between the language and
the architecture's machine code instructions.
“
”
WhatisAssemblylanguage?
38. Registers
SP
SI DI
AX, BX, CX, DX
IP
General-purpose registers for storing numbers.
Source and destination data index registers.
memory pointers for retrieving and storing
data.
39. Registers
SP
SI DI
AX, BX, CX, DX
IP
General-purpose registers for storing numbers.
Source and destination data index registers.
memory pointers for retrieving and storing
data.
Stack pointer, used to store parameters and
variables on the stack.
40. Registers
SP
SI DI
AX, BX, CX, DX
IP
General-purpose registers for storing numbers.
Source and destination data index registers.
memory pointers for retrieving and storing
data.
Stack pointer, used to store parameters and
variables on the stack.
Instruction pointer, points to next instruction
to execute.
44. Segments
Code Segment
(CS)
Place where assembly code is stored
Data Segment
(DS)
Stack Segment
(SS)
Extra Segment
(ES)
Place where initialized data is stored
Place where stack data is stored
Place kept for extra data handling
62. Examples
● Add AX,05h – Add 05h to AX and stores result
back in AX
● Add AX,BX - Add contents of BX and AX, store
result in AX. Affects flags
● Sub AX,05h – Subtract 05h from AX, store
result in AX. Affects flags
65. Jumpinstructions
● Jump to a different part of the code.
● If label is given then jumps to label section
● Conditional jump happens based on flags.
66. Examples
● Jnz loop; jump to label loop if zero flag is not
zero
● Jmp loop; jump to label loop part of the code
● Jz loop ; jump to label loop if zero flag is set