Back to assembly lang
This presentation is the property of its rightful owner.
Sponsored Links
1 / 22

Back to Assembly lang PowerPoint PPT Presentation


  • 80 Views
  • Uploaded on
  • Presentation posted in: General

Back to Assembly lang. nameoperationoperand(s);comment. START: MOV CX , 5 ; যা ইচ্ছা লিখ! ‘ ; ’ দিও!. name operationoperand(s);comment. Okay  letters, digits, ?, ., @, _, $, % Illegal names – If any blanks – aaa aaa If begin with a digit – 2asad

Download Presentation

Back to Assembly lang

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Back to assembly lang

Back to Assembly lang


Back to assembly lang

nameoperationoperand(s);comment

START:MOVCX, 5;যা ইচ্ছা লিখ! ‘;’ দিও!


Back to assembly lang

nameoperationoperand(s);comment

  • Okay  letters, digits, ?, ., @, _, $, %

  • Illegalnames –

    • If any blanks – aaaaaa

    • If begin with a digit – 2asad

    • If ‘.’ not first char. – aq.12

    • If has illegal char – aa&bb


Back to assembly lang

nameoperationoperand(s);comment

  • For an Instruction: Symbolic operation code [opcode]:

    Assembler translates these codes into Machine lang opcode.

     MOV, ADD, SUB, …

  • For an Directive: pseudo-operation code – pseudo-op, do not translate

     PROC is used to create a procedure


Back to assembly lang

nameoperationoperand(s);comment

  • An instruction may have 0/1/2 operands

    e.g.,

    NOP; no operands – does nothing

    INCAX; 1 op. – adds 1 to contents of AX

    ADDdestination, source


4 2 program data

4.2 Program data

  • Binary – 1011b, 1100B

  • Decimal – 10111, 10111d, -3419D

    1,23 – x

  • Hex – start with a decimal digit, ends with ‘H’ – 3BA3H, 0FFFFH

  • Characters – within ‘aa’ or “aa”


Pseudo ops

Pseudo-ops

  • DB– define data BYTE

  • DW – word

  • DD – doubleword – two consecutive words

  • DQ – quadword – 4 …

  • DT – tenbytes – 10…


4 3 variables

4.3 Variables

nameoperationoperand(s);comment

nameDBinitial value; -128 ~ 127; or 0-255

e.g.,

ALPHADB4 ; variable ALPHA=4

AADB? ; uninitialized byte


4 3 3 array

4.3.3 Array

EktaArrayDB10H, 20H, 22H

SymbolAddressContents

EktaArray 200h10H

EktaArray+1 201h20H

EktaArray+2 202h22H


For dw 2 bytes

For DW – 2 bytes

SymbolAddressContents

EktaArray 200h10H

EktaArray+2 202h20H

EktaArray+4 204h22H


Back to assembly lang

WORD1DW1234H

; low Byte of WORD1 contains 34H

; high Byte of WORD1 contains 12H


4 5 basic instructions

4.5 basic instructions

  • MOV – move; contents of destination is replaced by the contents of source

  • XCHG – exchange; swapping

    Q: exa??


Back to assembly lang

  • ADDW1, AX

    ;W1 = W1 + AX

    ;W1 – changes with added/sum value

    ;AX – unchanged

  • SUBAX, DX

    ;Subtract DX from AX

    ;New value in AX – AX changes

    ; DX unchanged


Direct add sub between memory locations wrong

Direct ADD/SUB between memory locations WRONG!

  • ADD W1, W2

    ; wrong as direct memory location

SourceDestination

General Reg.Memory loc.

Gen Reg.YesYes

Memory Loc.YesNO

ConstantYesYes


Inc increment

INCIncrement

  • INCdestination

    INCW1;e.g., W1=0003

    BeforeW1=0003

    After INC,W1=????

0004


Dec decrement

DECDecrement

  • DECdestination

    DECW1;e.g., W1=FFFF

    BeforeW1=FFFF

    After INC,W1=????

FFFE


Neg negate the contents of destination

NEGnegate the contents of destination

  • NEGdestination ; reg. / mem.

    ; replace the contents by it’s two’s complement

    NEGW1;e.g., W1=0002

    BeforeW1=0002

    After NEG,W1=????

FFFE


Back to assembly lang

  • Note:

  • Both types MUST be the same type

    e.g.,

    MOVAH, ‘A’ ; what is in AH?

    ; ‘A’ = 41H

    MOVAX, ‘A’ ; what is in AX?

41H

0041H


Do high to assembly

Do!High- to Assembly

  • B = A

  • A = 5 – A

  • A = B – 2 x A


1 b a

1. B = A

  • MOVAX, A

  • MOVB, AX

  • A direct mem-to-mem move is illegal


2 a 5 a

2. A = 5 - A

  • MOVAX, 5

  • SUB AX, A

  • MOVA, AX

  • NEG A

  • ADDA, 5


3 a b 2xa

3. A = B – 2xA

  • MOVAX, B;AX = B

  • SUBAX, A;AX=B-A

  • SUBAX, A;AX=B-A – A

    ; AX = B – 2A

  • MOVA, AX; A = AX = B – 2A


  • Login