1 / 14

Assembly Language – Lab 2

Assembly Language – Lab 2. Registers, Instructions, ASCII Table. Registers. Data Registers: Accumulator Register (AX), Base Register (BX), Count Register (CX), Data Register (DX). Address Registers:

max
Download Presentation

Assembly Language – Lab 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assembly Language – Lab 2 Registers, Instructions, ASCII Table

  2. Registers • Data Registers: Accumulator Register (AX), Base Register (BX), Count Register (CX), Data Register (DX). • Address Registers: • Segment Registers: Code Segment (CS), Data Segment (DS), Stack Segment (SS), Extra Segment (ES). • Pointer and Index Registers: Stack Pointer (SP), Base Pointer (BP), Source Index (SI), Destination Index (DI). • Instruction Pointer (IP).

  3. Note: any register can be used except CS & IP Before After 00 00 00 2A DH DLDH DL MOV Instruction • Syntax: MOV destination, source • Example: MOV DL,42 ; 42 in decimal is ‘*’

  4. Legal Combinations of operands for MOV

  5. MOV Syntax – Legal form • list of possible combination of MOV operands:MOV <REG>,<REG>MOV <REG>,<MEM>MOV <MEM>,<REG>MOV <REG>,<CONST>MOV <MEM>,<CONST> • Example: MOV VAR1, AX MOV AX, BX

  6. MOVE-and-FillInstruction (MOVSX-MOVZX)

  7. Before After 3E 00 02 00 AH AL AH AL 00 02 00 3E BH BL BH BL XCHG Instruction • Used to exchange the contents of: • Two registers. • A register and a memory location. • Syntax: XCHG destination, source • Example: XCHG AH, BL

  8. Basic Arithmetic Instruction • ADD • SUB • INC • DEC

  9. Before After Before After 01BD 03C8 01AC 01AC AX AX AX AX 0585 0585 043205DE BXBX WORD1 WORD1 ADD and SUB Instructions • Syntax: ADD destination, source SUB destination, source • Examples ADD WORD1, AX SUB AX, BX

  10. Before After Before After 00070008 FFFFFFFE VAR1 VAR1 VAR2 VAR2 INC and DEC Instructions • Syntax: INC destination DEC destination • Examples: INC VAR1 DEC VAR2

  11. INT Instruction • Invoke a DOS or BIOS routine. When one wants to read from the keyboard or disk or mouse, or write to the screen, an INT (interrupt) is used. • Format: INT interrupt_number

  12. INT 21h • A particular function is requested by placing a function number in the AH register and invoking INT 21h. • Some of the functions are: Function number Routine 1 single-key input 2 single-character output 9 character string output

  13. INT 21h

More Related