当前位置: 代码迷 >> 汇编语言 >> 弄了很久才搞定<汇编语言>第八章最后的实验七。炫耀炫耀,该怎么解决
  详细解决方案

弄了很久才搞定<汇编语言>第八章最后的实验七。炫耀炫耀,该怎么解决

热度:10378   发布时间:2013-02-26 00:00:00.0
弄了很久才搞定<汇编语言>第八章最后的实验七。炫耀炫耀
Assembly code
assume cs:code,ds:data,es:tabledata 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,45257,17800data endstable segment        db 21 dup('year summ ne ?? ')table endscode segmentstart:mov ax,datamov ds,axsub bx,bxsub si,sisub di,dimov ax,tablemov es,axmov cx,21s:mov ax,[bx]mov es:[si],axmov ax,[bx+2]mov es:[si+2],axmov ax,[bx+84]mov dx,[bx+86]mov es:[si+5],axmov es:[si+7],dxdiv word ptr [di+168]mov es:[si+13],axmov ax,[di+168]mov es:[si+10],axadd bx,4add si,16add di,2loop smov ax,4c00hint 21hcode endsend start

我也是初学,希望对其他初学者有帮助。

------解决方案--------------------------------------------------------
不错~~~
------解决方案--------------------------------------------------------
Assembly code
ssume cs:code, ds:data, ss:tabledata 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'    ; 以上是表示21年的21个字符串        dd 16, 22, 382, 1356, 2390, 8000, 16000, 24486, 50065, 97479, 140417, 197514    dd 345980, 590827, 803530, 1183000, 1843000, 2759000, 3753000, 4649000, 5937000    ; 以上是表示21年公司总收入的21个dword型数据        dw 3, 7, 9, 13, 28, 38, 130, 220, 476, 778, 1001, 1442, 2258, 2793, 4037, 5635, 8226    dw 11542, 14430, 15257, 17800    ; 以上是表示21年公司雇员人数的21个word型数据    data endstable segment    db 21 dup ('year summ ne ??')    table endscode segmentstart:    mov ax, data    mov ds, ax            ; 指定数据段    mov ax, table    mov ss, ax            ; 指定table段        mov bx, 0             ; 指向data    mov bp, 0             ; 指向table    mov si, 84            ; 指向收入    mov di, 168           ; 指向雇员        mov cx, 21s:    mov ax, [bx]    mov dx, [bx + 2]    mov [bp], ax    mov [bp + 2], dx      ; 复制年份        mov ax, [si]    mov dx, [si + 2]    mov [bp + 5], ax    mov [bp + 7], dx      ; 复制收入        mov ax, [di + 0]    mov [bp + 0ah], ax    ; 复制雇员        mov ax, [si]    mov dx, [si + 2]    div word ptr [di]    mov [bp + 0dh], ax    ; 计算人均收入        add bx, 4    add si, 4    add di, 2    add bp, 10h        loop s        mov ax, 4c00h    int 21h    code endsend start
------解决方案--------------------------------------------------------
探讨
Assembly code
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','19……
  相关解决方案