Fortune Telling Collection - Comprehensive fortune-telling - Try to write an assembly language program to complete the addition of two 1 decimal numbers.

Try to write an assembly language program to complete the addition of two 1 decimal numbers.

; The following program is a 16-bit assembly, which runs correctly after compilation.

; Program name: addition. air-to-ground/air-to-surface guided missile

Additive line segment

Suppose CS: addition, DS: addition.

ORG 100H

Start: JMP starts

First_Num DB' First digit: $'

Second_Num DB' second number: $'

Addi_Sum DB' sum is'

SumASCII DB 2 DUP('0 '),' $ '; Two-digit ASCII number of the sum of two numbers.

Exit_Mark DB 0

; subroutine

GLOBAL Get _ Num:NEAR; Accept a 1 number from the keyboard.

Near Get_Num Proc

MOV, 9

INT 2 1H

Input: MOV AH, 1

INT 2 1H

CMP AL,27; Esc?

JZ set _ exit

CMP AL,' 0 '

JB input hr

CMP AL,' 9 '

JG input

And AL, 0FH

Soak in water to soften

set _ Exit:INC Exit _ Mark; Set exit flag

Soak in water to soften

End of Get_Num

Start: MOV axe, 3

INT 10H; Set the video display mode to 80x25 16 color text mode.

LEA DX, First _ Num prompts for the first 1 numeric string address.

Call Get _ Num to accept a 1 number from the keyboard.

CMP Exit_Mark, 1

JZ exit _ process; If the exit flag is set, the program ends.

MOV· sumasii; Save the first 1 number.

MOV, 3

XOR ltd

INT 10H; Get cursor position

The number of INC DH rows has increased by 1

XOR DL,DL; Zero column number

XOR ltd

MOV, 2

INT 10H; Set the cursor position to the first column of the next row.

LEA DX, Second _ Num prompts for the second 1 numeric string address.

Call Get _ Num to accept the second 1 number on the keyboard.

Add AL, SumASCII and two numbers 1

Chemical and Biological Warfare (chemical and biological warfare)

MOV BL, 10

DIV BL When the sum is divided by 10, the quotient is stored in AL and the remainder is stored in AH.

Or AX, 3030H converts quotient and remainder into ASCII code.

CMP AL,' 0 '

JG Disp _ Sum; Shang Ruo >: 0, displays the sum of two numbers.

MOV· El, "; If quotient =0, ten spaces.

Show total:

MOV text PTR SumASCII, AX

MOV, 3

XOR ltd

INT 10H; Get cursor position

The number of INC DH rows has increased by 1

The number of INC DH rows has increased by 1

XOR DL,DL; Zero column number

XOR ltd

MOV, 2

INT 10H; Set the cursor position to the first column of the next row.

LEA DX, Addi _ Sum shows the sum of two numbers.

MOV, 9

INT 2 1H

Exit_Proc:MOV AX, 4C00H ends the program.

INT 2 1H

End of addition

End start