Assembler Directives

Hey CEans i have to make a assembly language program.In this program i will accept the operand in one code segment and and perform the multiplication in another code segment.

Now,I have to use assembler directives in it i.e. public and extern.I dont how to use them.Please help me.

Replies

  • jackisback13
    jackisback13
    .MODEL SMALL ;ASSEMBLER DIRECTIVE
    .DATA ;ASSEMBLER DIRECTIVE

    MULTIPLICAND DB 3H ;DEFINE MULTIPLICAND
    MULTIPLIER DB 4H ;DEFINE MULTIPLIER

    .CODE ;ASSEMBLER DIRECTIVE
    MOV AX,@DATA ;LOAD DATA INTO
    MOV DS,AX ;THE DATA SEGMENT

    MOV AX,0000H ;CLEAR VALUE OF AX

    mov AL, MULTIPLICAND ;LOAD AL WITH MULTIPLICAND
    MOV BL, MULTIPLIER ;LOAD MULTIPLIER WITH BL
    MUL BL ;MULTIPLY THE VALUE IN AL WITH VALUE STORED IN BL

    ;DISPLAY
    MOV CL,04H ;LOAD CL WITH NO. OF BITS TO SHIFT
    MOV CH,02H ;LOAD CH WITH NO. OF DIGITS TO DISPLAY
    MOV BX,AX ;STORE PRODUCT IN BX

    LAB1:
    ROL BL,CL ;SWAP TENS AND UNITS DIGIT
    MOV DL,BL ;MOV THE TEN'S DIGIT TO BE DISPLAYED IN DL
    AND DL,0FH ;MASK UNIT'S DIGIT WHICH IS NOW IN THE 10'S PLACE AFTER SWAPPING
    CMP DL,09H ;CHECK IF IT IS LESS THAN OR EQUAL TO 9

    JBE LAB2
    ADD DL,07 ;IF NOT THEN ADD 7;

    LAB2:
    ADD DL,30H ;ADD 30H TO GET THE ASCII EQIUVALENT OF THE NO. TO BE DISPLAYED
    MOV AH,02H ;DISPLAY NO.
    INT 21H

    DEC CH ;DEC NO. OF DIGITS TO BE DISPLAYED
    JNZ LAB1 ;JUMP TO LAB1 IF CH!=0

    MOV AH,4CH ;TERMINATE PROGRAM
    INT 21H

    END ;END OF CODE SEGMENT ANOTHER ASSEMBLER DIRECTIVE

    Note: The output will be in hex form

    Do you want the directives PUBLIC & EXTRN to be used specifically used in the program?

You are reading an archived discussion.

Related Posts

Hey CEans i need a ISR(Interrupt Service Routine) program in assembly program.Its like i have to enable interrupt on overflow.
What are the points that could give advantage of induction dc motor over induction motor or others as referred to traction system or otherwise?
How to create flash drop down menus and website navigation (tutorial.) If you are like me, always on a hectic schedule between deadlines, you will love In this tutorial. I...
Hi All Can you clear me that "Is there any difference in a tap or a valve or a gate?" Thanks & Regards, Vibhor Mittal
Unveiling plans to hire 30,000 persons this fiscal, IT bellwether Infosys today said it has paid $134 million (nearly Rs 600 crore) in salaries in 2009-10 -- the highest amount...