Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assembly Language programming

Similar presentations


Presentation on theme: "Assembly Language programming"— Presentation transcript:

1 Assembly Language programming
6/1/2018 Assembly Language programming

2 Assembly Language programming
6/1/2018 Assembly Language programming Assembly language is mnemonic representation of machine code Instruction has mnemonics (text form) Instruction decoder generates opcode Opcode is machine code It helps to learn internal architecture of computer Programs requires less space in assembly language

3 Assembly Language Development
6/1/2018 MOV AX, BX .. Assembler OBJ LIB Errors Linked Modules Loader Linker Main Memory

4 Assembler MASM (Microsofts micro assembler)
6/1/2018 Assembler MASM (Microsofts micro assembler) TASM (Borland Turbo assembler) NASM (Netwide assembler) It converts instructions into binary code It generates two files( .OBJ file and .LST file) Object file contains binary code of instruction and address of instruction List file contains program statements, binary code of each instruction and offset of eachinstruction

5 LINKER It is used to join many object files into one file
6/1/2018 LINKER It is used to join many object files into one file Large programs are divided into smaller files Link file contains binary code of all combined modules It produces .Exe file

6 LOADER It is used to LOAD FILE in memory It assigns specific address
6/1/2018 LOADER It is used to LOAD FILE in memory It assigns specific address It converts .EXE file into .BIN file which has physical address EXE2BIN

7 Assembly Instruction Format
6/1/2018 Assembly Instruction Format Label : Mnemonics Operand1, Operand2 ; Comments Label – Symbolic Name Assigned to First Byte of Instruction Mnemonics – Operation to be performed Operands – Operation to be performed on. Comments – Documentation, Non Executable .

8 6/1/2018 Assembler Directives These are not the part of processor instruction set. Instructions to assembler, linker and loader. Also referred as pseudo-operations. They enable to control the way in which program assembles and lists. Act during assembly of program and do not generate any machine executable code.

9 Classification Segment Simplification Data Allocation Segment Related
6/1/2018 Classification Segment Simplification Data Allocation Segment Related Macros Declarations Code label Scope Declaration Listing Control Miscellaneous

10 Segment Simplification
6/1/2018 Segment Simplification .CODE :beginning of code segment Ex .CODE [name] .DATA : beginning of Data Segment .STACK :used for defining stack Ex .STACK [size] .EXIT .MODEL :used for selecting standard memory model Ex .MODEL [Memory model]

11 Memory Models Model No. of code segments No. of data Small
6/1/2018 Memory Models Model No. of code segments No. of data Small One CS <=64KB One DS<=64KB Medium Any no. and any size Compact Large Huge

12 Data allocation DB :define byte type of variable
6/1/2018 Data allocation DB :define byte type of variable DW :define variable of 1 word length DD :define double word DQ :define quad(4) word DT :define ten bytes (stores no in decimal form) EQU :Equate ORG :originate , it is used to set location pointer at desired location in program e.g. org 500h

13 Segment related SEGMENT :indicates start of logical segment
6/1/2018 Segment related SEGMENT :indicates start of logical segment ENDS : indicates end of segment END :last statement of program ASSUME :used to tell assembler name of logical segment GROUP :collect segment of same type under one name e.g. NAME GROUP SEG1, SEG2

14 scope PUBLIC EXTRN e.g. PUBLIC VAR1, VAR2
6/1/2018 scope PUBLIC e.g. PUBLIC VAR1, VAR2 Var1 and var2 is to be referred from other module EXTRN e.g. EXTRN SQRT : FAR Labels are in other module

15 Listing control PAGE TITLE PAGE [length], [width] e.g. PAGE 10, 35
6/1/2018 Listing control PAGE PAGE [length], [width] e.g. PAGE 10, 35 Maximum no of lines on a page Maximum no of characters in line TITLE TITLE text e.g. TITLE MY FIRST PROGRAM

16 Code Label ALIGN EVEN LABEL PROC ALIGN number e.g. ALIGN 16
6/1/2018 Code Label ALIGN ALIGN number e.g. ALIGN 16 EVEN e.g. EVEN NAME DB 5 DUP(0) LABEL e.g. NEXT LABEL FAR PROC procedure-name PROC type

17 Macro Declarations MACRO and ENDM DISP MACRO ENDM MOV DL, AL
6/1/2018 Macro Declarations MACRO and ENDM DISP MACRO MOV DL, AL MOV AH, 4CH INT 21H ENDM

18 Miscellenous INCLUDE NAME GLOBAL INCLUDE path:file name
6/1/2018 Miscellenous INCLUDE INCLUDE path:file name NAME Assign name to each assembly module GLOBAL GLOBAL variable-name


Download ppt "Assembly Language programming"

Similar presentations


Ads by Google