My first assembly work!

xiaoxiao2021-03-06  21

topic:

Based on the 8088, 8086 instruction system to complete the following programming:

1. Use only 16-bit registers to achieve the 32-bit hexadecimal addition.

2, plus NUM1 and Dixed NUM2 Please define and initialize in the data segment

3. Please save the variable to the data segment in advance to the data segment.

4, please write the program

5, try to pass the debugging

This program will calculate the two 32bit numbers Num1 and Num2 using a 16 bit number plus, and store the result to the variable result; Author Dragonshard

Date March 31, 2005

DATAS SEGMENT NUM2 DD 010101212H NUM1 DD 0FAFBFBH RESULT DD? GJW DW?; Here is 16-bit carry DataS ends

Codes Segment Assume Cs: Codes, DS: DataS Start:; Initialize The Program Mov AX, Datas MoV DS, AX

Lea Si, Num1 MOV AX, [Si]; deposits the low 16 bits of the variable Num1 in AX MOV CX, [Si 2]; deposit the variable Num1 high 16-bit CX Lea Si, Num2 MOV BX, [Si] Reduce the low 16 bits of the variable Num2 in BX MOV DX, [Si 2]; store the high 16 bits of the variable Num2 into DX ADD AX, BX; add Num1 and Num2 low 16 digits, and save AX ADC CX, DX; adds Num1 and Num2 high 16-bit and plus low 16 bits, and the results are deposited in CX Lea Di, Result Mov [Di], AX MOV AX, 0000H; turn AX and BX to 0 In order to store high 16-bit carry MOV BX, 0000h ADC AX, BX; deposit high 16-bit carry in AX MOV [DI 2], CX MOV [DI 4], Ax Codes End START

转载请注明原文地址:https://www.9cbs.com/read-40561.html

New Post(0)