|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
拖拖拉拉写了一个星期才写完,哎,还是太懒,中间遇到一些问题都通过单步执行分析解决了,问题不大。
以下是源代码:
assume CS:code,DS:data
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 26 dup(" "),0,0
table ends
stack segment
DB 200 dup(0)
stack ends
code segment
start:
MOV AX,stack
MOV SS,AX
MOV sp,200
MOV AX,data
MOV DS,AX
MOV AX,table
MOV ES,AX
MOV AL,5
MOV ES:[28],AL
MOV bx,0
MOV BP,0
MOV CX,21
s:
PUSH CX
MOV SI,0
MOV DI,0
MOV CX,4
;11111111111111111111
s0:
MOV AL,[SI+bx]
MOV ES:[di],AL
INC SI
INC DI
LOOP s0
;22222222222222222222 0034
MOV SI,0
INC DI
MOV AX,[SI+bx+84]
MOV DX,[SI+bx+86]
CALL switch
;333333333333333333333 0044
MOV SI,0
MOV DI,13
MOV AX,DS:[SI+bp+168]
MOV DX,0
CALL switch
;444444444444444444444 0055
MOV DI,19
MOV Ax,[SI+bx+84]
MOV DX,[SI+bx+86]
MOV CX,DS:[SI+bp+168]
CALL divide
CALL switch
MOV DH,ES:[28]
MOV DL,3
MOV CL,2
MOV SI,0
CALL show
MOV dh,ES:[28]
INC DH
MOV ES:[28],dh
ADD bx,4
ADD BP,2
POP CX
LOOP s
MOV AX,4c00h
INT 21h
show:
PUSH DS
PUSH bx
PUSH DX
PUSH AX
PUSH ES
PUSH SI
PUSH DI
PUSH CX
MOV AX,table
MOV DS,AX
SUB DH,1
MOV AL,DH
MOV BL,0A0h
MUL BL
ADD DL,DL
SUB DL,2
MOV DH,0
ADD AX,DX
MOV bx,0b800h
MOV ES,bx
MOV DI,AX
MOV AL,CL
MOV CH,0
s1:
MOV CL,[si]
JCXZ ok
MOV ES:[di],cL
INC DI
MOV ES:[di],AL
INC SI
INC DI
JMP short s1
ok:
POP CX
POP DI
POP SI
POP ES
POP AX
POP DX
POP bx
POP DS
RET
switch:
PUSH SI
PUSH bx
PUSH CX
PUSH AX
MOV si,0
s2:
MOV CX,10
CALL divide
ADD cx,30h
PUSH cx
INC SI
MOV bx,CX
MOV CX,AX
JCXZ s3
JMP short s2
s3:
MOV CX,SI
s4:
POP AX
MOV ES:[di],AL
INC di
LOOP s4
POP ax
POP CX
POP bx
POP SI
ret
divide:
PUSH bx
PUSH AX
MOV AX,DX
MOV DX,0
DIV CX
MOV bx,AX
POP AX
DIV CX
MOV CX,DX
MOV DX,bx
POP bx
RET
code ends
end start |
|