Presentation is loading. Please wait.

Presentation is loading. Please wait.

Joseph L. Lindo Assembly Programming Sir Joseph Lindo University of the Cordilleras.

Similar presentations


Presentation on theme: "Joseph L. Lindo Assembly Programming Sir Joseph Lindo University of the Cordilleras."— Presentation transcript:

1 Joseph L. Lindo Assembly Programming Sir Joseph Lindo University of the Cordilleras

2 Joseph L. Lindo Data + and - Section 1 Assembly Programming Registers Named storage locations inside the CPU, optimized for speed. High speed storage locations directly inside the MPU Registers

3 Joseph L. Lindo Data + and - Section 1 Assembly Programming Registers There are 8 general purpose registers, 6 segment registers, Eflags registers and instruction pointers. Registers

4 Joseph L. Lindo Data + and - Registers Assembly Programming Instruction Operand Types: Immediate – a constant integer (8, 16, or 32 bits) Register – the name of a register is converted to a number and encoded within the instruction Memory – reference to a location in memory Data

5 Joseph L. Lindo Data + and - Registers Assembly Programming Data Transfer Mnemonics Data

6 Joseph L. Lindo Data + and - Registers Assembly Programming Addition and Subtraction + and -

7 Joseph L. Lindo Assembly Programming --end-- Sir Joseph Lindo University of the Cordilleras

8 Joseph L. Lindo Assembly Programming --end na to-- Sir Joseph Lindo University of the Cordilleras

9 Joseph L. Lindo CPU vs MPU Online Task Provide the differences between CPU and MPU. Post it as comment on our FB Group. (COAL) Due on February 21, 2012

10 Joseph L. Lindo General Purpose Registers Registers Primarily used for arithmetic and data movement. Each register could be addressed as either 8, 16 or 32 bit value.

11 Joseph L. Lindo General Purpose Registers Registers

12 Joseph L. Lindo MOV Data Transfer Moves data fro source to destination Syntax: MOV destination,source Rules: Destination should not be an immediate operand

13 Joseph L. Lindo MOV Data Transfer.data count BYTE 100 wVal WORD 2.code mov bl,count mov al,wVal mov ax,wVal mov count,al mov ax,count mov eax,count

14 Joseph L. Lindo MOV Data Transfer CodeAXBX MOV ah,10 MOV ax,35 MOV bh,al MOV bx,1234 MOV bl,04 MOV bh,55

15 Joseph L. Lindo XCHG Data Transfer XCHG exchanges the values of two operands. Syntax: XCHG operand1,operand2 Rules: At least one operand must be a register. No immediate operands are permitted.

16 Joseph L. Lindo XCHG Data Transfer.data var1 WORD 1000h var2 WORD 2000h.code xchg ax,bx xchg ah,al xchg var1,bx xchg 3,100 xchg eax,ebx xchg var1,var2

17 Joseph L. Lindo XCHG Data Transfer CodeAXBX MOV bx,4810 MOV ax,35 XCHG bh,bl XCHG bh,ah MOV bl,04 XCHG bl,al

18 Joseph L. Lindo INC and DEC Add and Sub Add 1, subtract 1 from destination operand operand may be register or memory INC destination Logic: destination  destination + 1 DEC destination Logic: destination  destination – 1

19 Joseph L. Lindo INC and DEC Add and Sub.data myWord WORD 1000h myDword DWORD 10000000h.code inc myWord dec myWord inc myDword mov ax,00FFh inc ax mov ax,00FFh inc al

20 Joseph L. Lindo INC and DEC Add and Sub CodeAXBX MOV ah,10 MOV al,35 INC al MOV bx,1234 DEC bl INC bh

21 Joseph L. Lindo ADD and SUB Add and Sub ADD destination, source Logic: destination  destination + source SUB destination, source Logic: destination  destination – source Same operand rules as for the MOV instruction

22 Joseph L. Lindo ADD and SUB Add and Sub.data var1 DWORD 10000h var2 DWORD 20000h.code mov eax,var1 add eax,var2 add var2,var1 add ax,0FFFFh sub 1,2 sub var1,var2 add eax,1 sub ax,1

23 Joseph L. Lindo ADD and SUB Add and Sub CodeAXBX MOV ah,10 MOV al,35 ADD ah,al MOV bx,1294 SUB bl,ah ADD ax,bh

24 Joseph L. Lindo MOV and XCHG Comprehension Check

25 Joseph L. Lindo INC, DEC ADD and SUB Comprehension Check

26 Joseph L. Lindo Assembly Programming --end-- Sir Joseph Lindo University of the Cordilleras

27 Joseph L. Lindo Back Integer Expressions

28 Joseph L. Lindo INC and DEC MOV Reserved Word and Identifiers Directives Character and String Constants ADD and SUB More XCHG


Download ppt "Joseph L. Lindo Assembly Programming Sir Joseph Lindo University of the Cordilleras."

Similar presentations


Ads by Google