0% found this document useful (0 votes)
10 views33 pages

ASC Partial 7 Dec

The document outlines foundational concepts in computer architecture and assembly language, focusing on the IA-32 microprocessor architecture, including the executive unit, ALU, and memory organization. It discusses data types, imperative programming, and the use of registers, stack, and flags in operations. Additionally, it covers the significance of 2's complement representation for negative numbers and various flags that indicate the status of operations within the processor.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views33 pages

ASC Partial 7 Dec

The document outlines foundational concepts in computer architecture and assembly language, focusing on the IA-32 microprocessor architecture, including the executive unit, ALU, and memory organization. It discusses data types, imperative programming, and the use of registers, stack, and flags in operations. Additionally, it covers the significance of 2's complement representation for negative numbers and various flags that indicate the status of operations within the processor.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

carte: „Arhitectura calculatoarelor 1086"

Vancea

carte:„The art of Assembly language "

Week 1

- C → first portable programming language


→ most low-level, high-level language

- data type → size of representation in Assembly


→ from oop: structure + associated operations, not in C
can do this ↳ not this

- imperative language → made around instructions

The ✗ 86 microprocessor architecture (IA-32)

- executive unit → EU
- ALU → device
- BIU → bus interface unit

- array, strings → memory, data, bits passed by addresses

- data, commands, addresses → in assembly

- C-BUS in ALU
D- BUS
- a [7] = * •""Docteți în plus la a
at 7)
↳ accesează valoarea
as starting address

- bit
octet

Week2

- ops. execution on 32 bits to be function calls

The ✗ 86 microprocessor architecture (IA-32):

- the 8 general registers of the EU

you can overwrite, transfer, anything

- registers → definition: storage capacities, very small in terms of size 18, 16,32,64 bits),
but very fast as accessed speed, used for temporary store of operands with which the processor
currently works ↳ data, commands codes, addresses
EAXAM A
high

low
E:&:
ES:
AX

- ESP - stack pointer TD order


stalk register (LIFO) → discipline de access
- ET P - base pointer ↳ data structure.

every high-level programming language: memory organisation : segments, addresses

- FIFO-qu&ne
- help-something unorganised

(1) ,(2)"(3) the 3 basic data structures

top ofstack
- SS → stack segment i

e
ESP last el

EBP first el
base of stack

!! • - why 3 are focused on working with a stack and not with queue and heap?

run time stack ⇒ the execution takes place there


⇒ the order of activation of the program is always a LIFO

- exe programs are alive, running programs

- functions and procedurces → abstractizări a lucrurilor ce lefac în program

Laduăm în ianuarie
PA
ESP
MP
EBP >

înregistrarea execuțiilor

4 segments but only one can be active

- ESI → source index


- EDI → -destination index

- a starting address = am array

ex: a [1042]: * la f 10429 4 ⇒ mecanism de


baza/
L index indexare
operator de starting point
referențiere pointer aritmatic
: = → atribuire ×: = ✗ +1
adresa 8 L conținut
E I Ț I E I Ș ă i c a n K ee p th e in d e x h e r e if y o u w o r k w i th 2 a r r ays ⇒ 2 d on a t r ef e r e n c es

t h e g e n er a l r e g i s te r s w il l b e c o n s id e r e d to d o w h a t the r e g i s t er d o es

W eek 3

- E U → e x e c u t iv e u n it

- al w a y s a lo o p in s tr u c t io n u s e s E C X fo r t h e n r . o f r e p e t it io n

- s ta c k s t . r ef l ec t s w h at h a ppe n s a t r u n t im e

- t h e r u n t im e s t a ck → t h e s tr u c t u r e t h a t s ta y s b e h in e d e v e r y h t p l a n g .

- in r e g is t e r s y o u ca n a c c e ss t h e l o w er p a r t L A X , B X .. . ) , b ut y ou ca n n o t a cc e s s t h e h i g h e r p a r t

- w o r k i n g w it h b y tes f or E A X , E B X , E C X ,E D X

„ A N D L O R , X O R , N O T - b it by b i t o p e r a t io n s
- A L U → p r o v id e s a r i t h m e t ic a n d l ogic o p e r a t ion s
C a r i t t m e t ic a n d → b i t - s h i f t in g o p e r a to r s → s hif t in g t h e l o c a tio n o f a b it to t h e m a r e b y a p a r t ic u l a r n u m b er
l o g i c u n it ) → w il l s e t a c c o r d in g l y t h e v alu e s f r o m t he E F L A G S r e g is ter

s o f t w a r e v i s i o n :
t h e s iz e o f t h e w o r d s it l o r r e g is te r s in s i d e th e pr o c e s s o r

- h a r d w a r e v is io n :
t h e s iz e o f t h e c o m m u n ic a t io n c h a n ne l s , b u s e s
u s u a l l y th e b u s e s b ig g e r th a n th e s iz e s o f th e p r o ce s s o r

- in th e l a n g u a g e w o r d d i f f e r e n t
E A G S

- o n l y 9 b it s u s e d o u t o f t h e 3 2

- w h a t e v e r y f l a g is d o in g a n d is g o o d f o r ?

- fla g → in d ic a t o r o n 1 b ie t

1 0 0 1 0 0 11 +
0 1 1 1 0 0 11
1 0 0 0 0 011 0
C F 1
d e s tin a t io n v a lu e o f the c a lcu l ator
L P O ( l a s t p r e f o r m e d o p e ra tio n )
P E - A p e t a b l ă t ot ( t h e co r r ect m a th e m a tica l is o n 9 b its )

S E E

- C E - t r a n s p o rt f l a g if in the L P O w e h a v e o v e r f l o w ( U N S IG N E D )
- c i o b ă n ește f l a g

- P F - p a r it y f la g > t h e l e a s t s ig n i f i ca t b y t e t o h av e a n o d d n u m b er o f cifr e 1

- A F - a u x il i a r y f l a g → tran s p o r t v a l u e f r o m b it 3 to b it u o f t he L P O

b o u n d a r y b e tw e e n t h e n ib b l e o f t h e b y te

↳ h a l f a b y te = s e m i o t e t
- compressed base 2 → base 16
6=262-256
- a binary digits → e hexa digit
unsigned signed
1001 0011 + = 934 + 147T -109 +
0 111 0011
00 00 0110
734 115 115
1 06 4 262 6
OF = O
- zero positive number E- 128, 1273 [0,25-5]
- ZF → zero flag trebuie să știm la bit, word came la signed sau unsigned

a truth value, was the last operation result a 0?


1- True
O- False

ADD opriop, ; ope: oprtop,


ADC ope,op,; op, = op, top, + CF (adds in the next byte which should be o)

- SF -sign flag

the first bit of the result (if it is negative or positive)

- T F - trap flag Lexeption , not a consequence as the others)

important and dangerous


made to be able to have debuggers
1- execution debugging style

- IF - interupt flag Lexeption , nota consequence as the others)

on 32 bits you cannot access the intercept system

IF-o no intercept from now on (numa dacă se ia curentul)


critical [
section IF = 1 interupts are allowed

- DF -direction flag (set by us)

any arrayin ascending order or descending order


can be traversed

DE:O ⇒ passing of the arrays made in asscending order I from small addresses to
big addresses
= 1 ⇒ passing of the arrays made in dessendingorder , inverse
- O F - o v er f l o w f lag ( S IG N E D )

- t he r es u l t c a n o r c a n n o t f it t he s p ace g iv en f o r th e o p e r a tio n

in s i d e co m p u t er → r epr e s e n t a t io n î n b a s e 2
o f t he v alu e in m y m i n d in b a se 10

b a s e 2 → b a s e 16 → b a s e 10
L e a s ie r th is u sa y )

- A r ep r e s en ta t io n in b a s e 2 h a s a l w a y s 2 p o s s i b l e in t e r p r etio n s i n b a se 10

↳ n u a r e in t e r p r e t ă r i c a l cu l ato r u l , d o a r r ep r e z e n t ăr i ↳ î n t o t d e a u n a 2
in te r p r e tă r i, c â teo d a t ă
- m e t o d a in t e g r ă r i i î n in t e r v a l e l e d e r e p r e z e n t a r e a d m is i b i l e a ces te a c o in c i d

- b o t h in ter p r e t a t io n th e c o m p g o e s s i m u l t a n eo u s l y S a u d e s e m n e a z ă o p r o s t i
2 situation in which OF = 1.

+ 1- .. .. +
0 1

1- - . 1 O _. _

OF = 11ᵗʰ base • in base 10


CE-O desemnează o CF = a
OF-1 desemnează o prostie.
prostie

2 Categories of flags:

- are an effect of the LPO:

CF, PF, AF, ZF, SF, OF

- have a future effect after set by programmers:

FF, IF, DF, CF


CLC =) CF ⇒
CLI ⇒ IF-0 CLD ⇒ DE ⇒ STC ⇒ CF 21
STI ⇒ IF- n SID ⇒ DE-A
CMC ⇒ CF = CF
complement
CF

Weekn:

21s complement. Discussions and examples

- Mathematically, the 2's comlement REPRESENTATION of a NEGATIVE number is the value 2"-V,
where ✓ is the absolute value of the represented number

- Moto: With the 2's complement," We interpret representations and represent interpretations"
base 2 base 10

- Theresult is never exprimed in 2's complement

- Where do we actually use the 2's complement (in this course)

- 2's complement always involved when working with negative numbers


- mechanism of representing the binary numbers in arch

- we talk about 2's complement only in representation in base 2


- from one binary representation to another
f ie r ep r e z e n t a te p e n b its
c â te cif r e d e o a r e l o c a ț iam . a d o r i p o s ib i le s ă

4 t h m e th o d : S u m a v a l -a b s a l e celo r 2 v a l c o m p l em e n t a r e in b a z a 10 e s te c a r d in a l u l m u l ț im i i
v a l . r ep r ez e n t a te p e a ce a d im e n s i u n e .

- E x a m p l es : W h ich is t h e s ig n e d in te r p r e t a t io n o f > i) 10 0 1 0 0 1 1 a ) 0 1 10 1 10 1 ×
b - 1 0 9
Ii) 9 3 4 c) 6 8 h ×
d ) + 1 4 7
I i 14 7 e ) - 1 4 7
n u a r e in t e r p r et a r e , î i d e ja o in t e r p r e t a r e ! ! !

14 7 a n d - 10 9 co m p lem e n t ar y B U T
N O T - 14 7 a n d 10 9
n o t r epr es e n ta b le o n O N E B Y T E
T h e ↳ s it u a t i o n s p os s ib le :

O X .. . . → s a m e s a n d u

14 .. . . → a l w a y s d if f e r en t

c o n f i g u r aț ia b in a r ă
a l u i - 10 9

- 1 4 7 → 1 .. . . .

0 1 0 0 1 0 0 11 → 14 7
1 0 1 1 0 1 1 0 1
- 14 7 1
↳ in t h e u n s ig n e d C b w
↳ in a s s a m b l y • w it h a d a u g ă b it - u l d e s e m n
T ip u r i d e î n tr e b ă r i p t e x a m e n s c r is și 7 d e c i

e -
W e e k 5 : A d d r ess r e g is t e r s a n d a ddre s s co m p u t a t ion

A D R - a d d r es s co m p uta t io n

÷i : :
C S - co d e seg m e nt → al w a ys
D S - d at a seg m en t
S S - s ta ck s eg m e n t → a lw a y s
E S - e x tr a s e g m en t → a n oth er d ata s e g m e n t ( u s u a lly her e t h e d es tin a tio n a r r a y )

T Ă - F S - ] 3 2 b its p r o g r a m m in g
6 5 -
E IP -

- d e d ic a te d to w o r k w ith a d d r es s es

- w o r k in g w it h a d d r es s e s / p o i n ter s in m o st h ig h l e v el pr ogr a m m in g l an gu a g es

- a d d r e s s o f a m e m o r y l o c a t io n : v . o f c o n sec u t ive b y t es f r o m th e b e g in n in g o f t he R A M m e m o ry a n d the


b e g i n n in g o f t h a t m e m o ry l o c a tio n

O 1

- in d e x s tarts f r o m

o f a s eg m e n t 1. t h e f o c u s
23 t h e m a x im u m len g th
- p h i s ica l s e g m e n t ( c e v e d e m i n o l l y d e b u g )
- l o g i c a l s e g m e n t / s ectio n
- s e g m e n t → b a s ic a d d r e s s ( b a z ă )
✓ l im it ( s iz e o f )

t ype ( C s ,D s , S S , E S )

- a d d r e s s s p e c i f ic a ti o n → p a ir o f 2 n u m b e r s ( o f f s e t a n d s eg m e n t s el ect o r )

↳ s t il l 1 6 b it s n u m b er o n 3 2 b it s pr o gr am m in g

s e g m e n t : o ff s e t
↳ to t a ll y c o n tr o l o f it 3 2 b it s

lo b it s o n n o b p r o g . t h e s ta r ti n g a d d r e s s o f th e s e g m e n t
o n 3 26 pr a g s e g m e n t s e lec t o r ( is s u e d b y t he

o p e r a tin g s y s tem )

5 3 5 29 5 0 : 0 7 0 6 0 5 0 4 0 3 0 2 0 10 0

o n 16 b it s C S , D S s h o w e d th e s tar t in g a d d . o f th e s eg m e n t
s e g m e n t b a s ic
L i m it
s e l ect o r a d d r es s

8
5 17 8 2

17
i
27 3 2

17 15 2 c

t h e lim i t
th e o f f s e t
I

in t o B IU ←
↳ n e v er m a n ip u l a te d d ir e c t l y b y th e pr o g r a m m e r

c l ea r in w h ic h se g m e n t y o u w o r k i n
( d a ta ,c a d e , e t c )
o ffs et → a n e a r a d d r ess

→ n o t u s e d f o r a p r a c t ic a l p o i n t o f v ie w
f l at m e m o r y m o d e l : w e w o r k o n l y w it h o f f s e t s
t h e o nly m a n d a to r y o n e !

ly
e x e c u te d

→ s e v ed e l a in s t r u c ț i u n i î n s tâ n g a s u s th e o f fs e t / a d d r e s s

E IP / e x te n d e d in s t r u c t i o n p o in t e r )

C S E IP

1) u s u a l l y t h e s a m e !
D o n ly t h e o f f s e t

im p l i c i t for s o m e v a r i a b l es

W a y s in w h ic h w e ca n s p e cif y t h e o p er a n d s

- 3 w a y s in w h i c h w e ca n ex p r ess a n cep p e r a n d :
% r e g is te r m o d e : m o v e a x 11 7

I i) im m e d i a te m o d e : m o v ea x , 17 D m ea n s f r om m em ory !

Iii) m e m o r y a d d r es s in g m o d e : m o v e a x , [ a c t]
[ a t 7 ]
ju s t 9 + 7↳ th e s t a r t in g ad dres s
↳ th e v alu e
d ef er e n cin g o per a tor !
17 15 2 a d r es a
m o v e a x , e b x
" d u ,2 W
m ov e a x , [ e b x ]
E A X EB X
1 ,2 14 ,8 g o i n g f o r b ,w
( in d ir e c t io n )
Fo h 56 4 3 24 2 3 h
o f f s e t - a d r e s s = [ b a s e ] + [ in d e x * s c a le ] + [ c o n s t an t ] a h /3 2 4 56 4 Fo h

↳ o n e o f t h e a 8 ls o g e ,n "" at â t E i g is te r s EA X 17 1 5 2

în 16 b its
[ B X /B P ] + [ S I /D I ] + [ c o n s t a n t ]

O N L Y A D D IT I O N P O S S IB L E
o n l y t h is is a n
o p ț io n a l it a te a
n ot a d dr es s e s
a d d r es s

in d i r e c t a d d r e s s in g
the offsets are not changed!
A variable is a language element which contents it is variable , the address of it is constant!!!
(variabil)

D the address of v

offset-address = [base] + [index * scale] + [constant] mov eax,[v]

At least one

Alocarea variabilei ⇒ îi dăm locul de alocare în memorie (it's address) /


Week 6:

- [] → operand, deferencing operator

- the offset. address used for arrays

- scale -bytes,words, dwards, qwords

- constant → to ajust your index if needed

[constant]
mov eax,[v3

a constant offset (v) immediate value 117)


v-17 → also a constant!

Pointer arithmetic

→ anything that makes sense

→ useful for parsing certain memory elements

→ to go forth and back in the memory

i) addition of a constant to a pointer ex:p +5 → pointer

Ii) subtraction of a constant to a pointer ex:p-9 → pointer

Iii) subtracting 2 pointers (the number of bytes between them / the size of the area between them)
ex: q-p → SCALAR!

Tested
- every symbol is replaced with the offset
(constant)
address
i. „contents
^

LHS RHS
L-value R-value L-values, R-values

- program = succesiune de instrucțiuni de artibuire

- < identifiers: = < expressim


↳ not the mostgeneral form of accessing a memory address, but the offset-address

- < address-computation-expressions: = < expression >

a', ofbh the address

- mov [ebi +2 * edx + V-7) , a +20

addresses, L-values

Cata? b:C) = xegez

În, Fese
> R-value
(aer? 1:c) -xeyez not good

C + + reference variables (&):


↳ conține în ea ideea de adresa
- 3 kinds of usage

I) passing variables by reference at subprogram calls


float flintox,g)

iis defining ALIASES

intaj-i 11; becomes an ALIAS fori 1790


i j

Iii) Returning L-values as a result of function calls!

rez = fla,7) int&flai) 4.... retum vei]}


↳ vă, L-value returning function, address
(cu int flai))

fla,7) = 79
I
✓ [73 = 79
alt]-* (art) = * (7- + a) Ea]

"Șefa] ⇒ aritmetică de adrese


i-a[7]

mov eax, a
mov ebx, 7 Ea]

Examples:
1-D pointer constant

mov eax, 23 mov eax, [v] value

mov eax, [23]


D ești în boschet

mov eax, [ebxxz]

move ay, [ebx * 3]

mov eax, [ebx * ztebx]

mov eax, [esâit FIE ✗

mov eax, [ebx +2]


mor eax, ebx +2 → syntax error
mov eax, Ta] +2 → nu este determinabilă la momentul asamblarii

mov eax, a + 2 ✓
↳ pointer arithmatic
W e ek 7 :

A s se m b l y L a n g u a g e B a s ic s


A m a s s e m b l er w o r k s w it h :
1) la b le s
2) in s t r u c t i o n s
3 ) d ir ec t iv es
„ l o c a t i o n c o u n t er

• S y m b olic lan g u a g e → s y m b ols : m n e m o n ic s + la b le s


( K en a i : S )
( c o d e l a b le b e c a u s e it is i n c o d e )

la b l e e x : j u m p n a m e
D j u st a n o ffset a n a d d r e s s

n a m e : ← h er e th e n a m e is d e fin e d
a ls o t h e n a m e o f a v a r i a b le / d a t a l a b le )

• d i r e c t iv e s : s e g m e n t d a t a , d b , d d , . .. .

o
a s s e m b l er → t r a n s l a tio n d a t a
→ ch e c k t h e c o r r e c t i on o f t h e c o d e
→ g e n e r a t i n o b j f il es
→ g e n e r a ti n g b y te s
• in s t r u c t i o n s → t o the p r o c e s s o r

• l o c a tio n c o u n t e r
↳ n o t s p e c i f ic to y our p r og r a m , b u t w it h e v er y s e g m e n t
( e x 2 o n e fo r d a ta s eg
on e for co d e s e g
• [ ] → s p e c i f ic f o r N A S M
☑ sta ț i a , o d a t a
• $ → t y p e p o in te r → o n l y in N A S M in T A S M : $ - d ata a n o ffset
.
→ t he s ta r tin g a d d r e ss of a d irect iv e S E C T I O N
in N A S M : d a ta → s -a . o f a F A R
$ → t h e b e g in n in g o f th e s e g m e n t if n o t S E C T I O N S a d d res s

e v er y o n e it ' s o p tio n a l , e v e r y o n e c a n m is s

P op tio n a l •
o n ly in N A S M

•| ↳ in t h e en d e v er y o ff s e t h a s to b e co m e a F A R A D D R E S S

in t h e p r o c e s s o f g en er a ti n g b y te s , a n y n a m e w ill b e î n lo cu i t w i th t h e a d d r es s b y t h e
a s s e m b l er
e x e p t io n : t o t h e o f f s e t s p e c i f i c a t io n s for m u la
( + , * )
V op er a t or s

d e s cr i p t or s u b 3 2 b it s

lo a d e r → the s e g m e n t p a r t p u t
b e f o r e r u n t im e in l o a d in g t i n e
→ s c a le in d e x b a s e d

N U E S !! !
o

" Ț
↳ fo r this :
s o u Tre e s t r i n g d e s tin a tio n s tr i n g

i m p l i c t it l y

T h e a s s e m b le r w il l p r e f ix a n y o ff s e t w it h o n e o f t h i s

3 s e g m e n t r eg is te r s

E x a m p le s :
1 . F in d len g th
S e g m e n t d a ta :
a d b 17 ,- 2 , o f f h , 1× 9 2 1 1 . . . . .

Î i : -.

eg a e u Ș i a

d o n 't a c t u a l ly n e e d l a u , y o u c a n d ef i n e it a s a v a r ia b l e
r ă m â n e î n t a b e l a d e co n s ta n te , c a v a r ia b il ă î n s e g m e n tu l d e d ate

↓ a d d r es s

S eg m e n t d a ta :
a d b 17 ,- 2 , o f f h , 1× 9 2 1 1 . . . . .

Î i : "
l g a d o $ - a → n o w l ga a v a r i a b le c a n b e m o d ifi e d

ca d e d a ta :
m o v [ l g a ] , s o m e th in g
Segment data:
a db 17,-2, offh , 1×9211.....

Îi:"
ega du $-$ $ → it works because a the first element
if bdw 15h
then.. ⇒ It would give the
number of bytes
from start until the current element
Segment data:
a db 17,-2, offh , 1×9211.....

Îi:"
- .

lgadu $-data ⇒ ..in NASM syntax error

Segment data:
a db 17,-2, offh , 1×9211.....
db......
dw....
c dd...

lgadw c-a

Segment data:
a db 17,-2, offh , 1×9211.....

Îi:"
lga du ega-a!

already is generating the bytes, alocă 2byte forlga then you can use lga

on the spot

mov eax, [v] • DS will be used mov eax,dword ptr DS:[00401005]


mov eax, [ebx] . DS:[ebx]
base index
mov eax, [ebp] . Ss:(bp]
mov eax, [ebp * 2] ; mov eaxidword edword ptr SS:[ebpiebp]

mov eax, [ebp * 3] ; SS:[ebp + ebp * 2]


mov eax, Eebp#n] ; DS:[ebpxu]

mov eax, [ebx + esp] iesp not as index SS:[ebxeesp]


only base
miov eax, [esptebx]

mov eax, [ebx + esp#2] SYNTAX ERROR


mov eax, [ebx + ebpxa] ; DS

mor eax, lebxtebp] -s astfel de expresii produc ambiguitate


mov eax, [ebptebi] ! Ss

mov eax, febx *2 tebp] ; SS mov eax, Cebportebx * 23:55


mov eax, ebx#neebp] ; SS
chiar îl vrei index
mov eax, [ebpaetebx] ;D
moveax, [ebxxitebpxi] ; 55 ÎNCEARCĂ [ebx * 2 tebpo 2) cred SINTAX ERROR

ptcpămenal index ii.%

[ebp#e + ebx * 1]; 55


l ea → l o a d C I T I es

Î N C Ă UN S L ID E !

pr e ț in e

NO T

m o v e a x , a + 2 ✓
m o v e a x , [ a ta ] ✓
m o v e b x , e b x ← 2 ✗
a d d e b x " , 2 " o p er a tor
↳ in s t r u c t io n s

e v a l u at p e s u b it s
N U LA
E X A M E N CA S Ă
Ș TIU E V A L U A R E A
DA R T R E B E S Ă Ș T II C E F A C
P l ea s e p r o v i d e m in i m u m 2 0 w a y s to in i t i aliz e ◦ o f a r e g i s ter

V O R a x ,a x
m ov a x , o
a n d a x o

W e e k 8 : c o n t in u in g w it h o p er a tor s

y pe o p e r a t or s :
data segment:
example: i. • d?.... EXPLICIT OPERANDS AND IMPLICIT OPERANDS
ad? ex: old DF and o
bd?...... 2 operands

code segment:
push o puts the offset of ✓ at the top of the stack
L am offset on 32 bits
Lobey of. spes. formula
L cannot determine at assembly time
2 operands destination (the stack)
the offset poitier * pe constant

push [v] → SYNTAX ERROR operation size not specified

memoryadd. operand YOU CANNOT PUSH ABYTE ONLY A W AND DU

you can damage the stack DIALINING THE STACK ERROR

push dword [v]


push WordEv]
push byte Eu] → ALSO SE

mov eax, o → the offset

mov eax, [v] • mov eax, dword ptr EDS: 00401008]

fixed size so no ambiguity


push dwordleax] or push word [eax]
push [eax] SYNTAX ERROR something from memory

push eax → the offset

GOOD
push 15 i push DWORD 15 (in olly even)
↳ inconsistency ⇒ the assembler puts it on 32 bits
word,dword
pop [v] SYNTAX ERROR

dest. the memory operand which starts atu

pop o →STIE. offset is a constant value det.at assembly time

„ ✓ asa pointer type constant is always a R-value, never a L-value

pop dword ⑤ SE. b- R-value

dword,word
pop ↓ [eax]
↳ memory address operand

S. E.
POP '5- ☐ constant of immediate type
↳notevalue!!
dword

pop" [15]
byte, word, dword

mov [v], o S.E.cep.sis-enotsp.es


mov byte [v3, o ✓
mov [v3, byte o ✓

word,doar, „te TYPE EXPRESION not TYPE MEMORCI ⇒ GOOD even if o is an immediate
value
din [o] SE.
II
imul [v2] SE.
but this is good

mov a, b S.E. a NOT A L-VALUE


word,dward tobe good
mor [a], b orhere
↳ offset > YOU CAN USE segmented offset of 16 bits
is a L-VALUE

moobytelabb mov ah, b S.E.


morsă,byteb mov ax, b
mov eax, b) OK ✓

mov a, [b] S-E.

an R-value!

mov [a3, [b] SE.!!! NOT BOTH EXPLICIT OPERANDS FROM MEMORY
maxim unul explicit

the same mul 15


mul o • mul mg/mem
'SE.
dword, word, byte
mul [v] SE.

mul eax good


dword, wordibyte
mul [ea] 5.E

pop byte [v] BĂ GOOD: INVALID operation

pop qword [V] G. E. : INSTRUCTION NOT VALID ON 32 bits programming


1- D A LS O
M E M O R Y V IO L A T I O N ER R O R
A N D D IV IS IO N B Y

S Y N T A X E R R O R = A S S E M B LY E R R O R ( o n 7- d e a )
D IR E C T I V E S N O T O N TH E EX A M
TIMES 32 add EAX, EDX jas effect EAX-EAX + 3IEDX

→ EQU → it is a constant
→ it ism'tin memory

[128, 255] 1 / /
• ..

You might also like