千忆吖 发表于 2018-5-13 11:34:26

汇编语言——课程设计一

拖拖拉拉写了一个星期才写完,哎,还是太懒,中间遇到一些问题都通过单步执行分析解决了,问题不大。


以下是源代码:
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:,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,
MOV ES:,AL
INC SI
INC DI
LOOP s0
;222222222222222222220034
MOV SI,0
INC DI
MOV AX,
MOV DX,
CALL switch
;3333333333333333333330044
MOV SI,0
MOV DI,13
MOV AX,DS:
MOV DX,0
CALL switch
;444444444444444444444   0055
MOV DI,19
MOV Ax,
MOV DX,
MOV CX,DS:
CALL divide
CALL switch

MOV DH,ES:
MOV DL,3
MOV CL,2
MOV SI,0
CALL show
MOV dh,ES:
INC DH
MOV ES:,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,
JCXZ ok
MOV ES:,cL
INC DI
MOV ES:,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:,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
页: [1]
查看完整版本: 汇编语言——课程设计一