0% found this document useful (0 votes)
96 views2 pages

Write A Program For Read A Character From The Keyboard: Addition

The document contains 5 programs that demonstrate reading and displaying characters, using general purpose registers, displaying strings using library functions, and performing basic arithmetic operations like addition, subtraction, multiplication, and division in assembly language. Each program shows the assembly code instructions used to perform the given task and store results in registers like AL, AX, BX, CX, and DX.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views2 pages

Write A Program For Read A Character From The Keyboard: Addition

The document contains 5 programs that demonstrate reading and displaying characters, using general purpose registers, displaying strings using library functions, and performing basic arithmetic operations like addition, subtraction, multiplication, and division in assembly language. Each program shows the assembly code instructions used to perform the given task and store results in registers like AL, AX, BX, CX, and DX.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Write a Program For Read a Character From The Keyboard

MOV ah, 1h                    //keyboard input subprogram


INT 21h            // character input
// character is stored in al
MOV c, al              //copy character from alto c

Write a Program For Reading and Displaying a Character


MOV ah, 1h            // keyboard input subprogram
INT 21h            //read character into al
MOV dl, al            //copy character to dl
MOV ah, 2h            //character output subprogram
INT 21h            // display character in dl

Write a Program Using General Purpose Registers


ORG 100h
MOV AL, VAR1         // check value of VAR1 by moving it to the AL.
LEA BX, VAR1         //get address of VAR1 in BX.
MOV BYTE PTR [BX], 44h // modify the contents of VAR1.
MOV AL, VAR1         //check value of VAR1 by moving it to the AL.
RET
VAR1 DB 22h
END

Write a Program For Displaying The String Using Library


Functions
include emu8086.inc    //Macro declaration
ORG 100h
PRINT ‘Hello World!’
GOTOXY 10, 5
PUTC 65             // 65 – is an ASCII code for ‘A’
PUTC ‘B’
RET                 //return to the operating system.
END                 //directive to stop the compiler.

Addition
ORG0000h
MOV DX, #07H     // move the value 7 to the register AX//
MOV AX, #09H     // move the value 9 to accumulator AX//
Add AX, 00H         // add CX value with R0 value and stores the result in
AX//
END
Multiplication
ORG0000h
MOV DX, #04H     // move the value 4 to the register DX//
MOV AX, #08H     // move the value 8 to accumulator AX//
MUL AX, 06H         // Multiplied result is stored in the Accumulator AX //
END
Subtraction
ORG 0000h
MOV DX, #02H     // move the value 2 to register DX//
MOV AX, #08H     // move the value 8 to accumulator AX//
SUBB AX, 09H     // Result value is stored in the Accumulator A X//
END
Division
ORG 0000h
MOV DX, #08H     // move the value 3 to register DX//
MOV AX, #19H     // move the value 5 to accumulator AX//
DIV AX, 08H     // final value is stored in the Accumulator AX //
END

You might also like