Wang Shuang Teacher "assembly language" P173 page of the Experiment 7 solution of the problem

Source: Internet
Author: User

This problem seems to be upset, in fact, as long as the familiar data structure, or easy to fix. On the night of December 26, I solved it again, and on the morning of December 27, I solved it again to consolidate. The result is slightly different two times, but the effect is the same. Post it for everyone to discuss.

December 26 Version:

Assume Cs:code,ds:data,es:table


Data segment

DB ' 1975 ', ' 1976 ', ' 1977 ', ' 1978 ', ' 1979 ', ' 1980 ', ' 1981 ', ' 1982 ', ' 1983 '

DB ' 1984 ', ' 1985 ', ' 1986 ', ' 1987 ', ' 1988 ', ' 1989 ', ' 1990 ', ' 1991 ', ' 1992 '

DB ' 1993 ', ' 1994 ', ' 1995 '

; The above is the 21 string representing the 21


DD 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514

DD 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000

The above is the 21 DWORD data representing the total revenue of the company in 21


DW 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226

DW 11542,14430,15257,17800

The above is the 21-word data representing the number of employees in the company in 21


Data ends


Table Segment

DB DUP (' Year Summ ne?? ‘)

Table Ends


Code segment

Start:mov AX, data

MOV ds, ax

mov ax, table

MOV es, ax

MOV bx, 0; BX is used to represent the offset address in the data segment

mov si, 0; Si used to represent the offset address in the data segment

mov di, 0;d i is used to represent the offset address in the table segment

MOV dx, 0;d x is used to store the high data of the divisor

MOV cx, 21

S0:mov ax, [bx+0]

mov word ptr es:[di], ax

mov ax, [bx+2]

mov word ptr es:[di+2], ax

mov ax, [bx+84]

mov word ptr es:[di+5], ax

mov ax, [bx+86]

mov word ptr es:[di+7], ax

mov ax, ds:[si+168]

mov word ptr es:[di+10], ax

mov ax, [bx+84]

MOV dx, [bx+86]

div word ptr ds:[si+168]

mov word ptr es:[di+13], ax

Add BX, 4

Add Si, 2

Add Di, 16

Loop S0

mov ax, 4c00h

int 21h

Code ends


End Start



The following is the December 27 version:

Assume Cs:code,ds:data,es:table


Data segment

DB ' 1975 ', ' 1976 ', ' 1977 ', ' 1978 ', ' 1979 ', ' 1980 ', ' 1981 ', ' 1982 ', ' 1983 '

DB ' 1984 ', ' 1985 ', ' 1986 ', ' 1987 ', ' 1988 ', ' 1989 ', ' 1990 ', ' 1991 ', ' 1992 '

DB ' 1993 ', ' 1994 ', ' 1995 '


DD 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514

DD 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000


DW 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226

DW 11542,14430,15257,17800

Data ends


Table Segment

DB DUP (' Year Summ ne?? ‘)

Table Ends


Code segment

Start:mov AX, data

MOV ds, ax

mov ax, table

MOV es, ax

MOV bx, 0

mov si, 0

mov di, 0

MOV cx, 21

S0:mov ax, [Bx+si]

mov word ptr es:[di], ax

mov ax, [bx+si+2]

mov word ptr es:[di+2], ax

mov ax, [bx+si+84]

mov word ptr es:[di+5], ax

mov ax, [bx+si+86]

mov word ptr es:[di+7], ax

mov ax, [bx+168]

mov word ptr es:[di+10], ax

mov ax, [bx+si+84]

MOV dx, [bx+si+86]

div word ptr [bx+168]

mov word ptr es:[di+13], ax

Add BX, 2

Add Si, 2

Add Di, 16

Loop S0

mov ax, 4c00h

int 21h

Code ends


End Start


If your friends have a better solution, welcome to the thread advice!

Wang Shuang Teacher "assembly language" P173 page of the Experiment 7 solution of the problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.