未分类题

请编制程序,其功能是:内存中连续存放着五个用压缩型(组合型)BCD码表示的2位十进制数,请将它们转换成十个 ASCII字符,高位的BCD码转换后放在较高的地址单元。
例如:
内存中有:21H,43H,(共五个字节)
结果为:31H('1'),32H('2'),33H('3'),34H('4'),…(共十个字节)
部分程序已经给出,其中原始数据由过程LOAD从文件INPUT1.DA丁中读入SOURCE开始的内存单元中,运算结果要求从RESULT开始存放, 由过程SAVE保存到文件OUTPUT1.DAT中。
请填空BEGIN和END之间已给出的源程序使其完整,空白处已用横线标出,每行空白一般只需一条指令,但采用功能相当的多条指令亦可,或删去BEGIN和END之间原有的代码并自行编程来完成所要求的功能。
对程序必须进行汇编,并与IO.OBJ连接产生可执行文件,最终运行程序产生结果。调试中若发现整个程序存在错误之处,请加以修改。
[试题程序]
EXTRN LOAD:FAR,SAVE:FAR
N EQU 5
STAC SEGMENT STACK
DB 128 DUP (?)
STAC ENDS
DATA SEGMENT
SOURCE DB N DUP(?)
RESULT DB N*2 DUP(0)
NAME0 DB 'INPUT1.DAT',0
NAME1 DB 'OUTPUT1.DAT',0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:STAC
START PROC FAR
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATA
MOV DS,AX
LEA DX,SOURCE ;数据区起始地址
LEA SI,NANE0 ;原始数据文件名
MOV CX,N ;字节数
CALL LOAD ;从'INPUT.DAT'中读取数据
; ********* BEGIN **********
LEA SI,SOURCE
LEA DI,RESULT
MOV CX,N
NEXT: MOV (1) ,[SI]
(2)
MOV BL,AL
AND AL, (3)
OR AL,30H
MOV [DI], (4)
(5)
MOV AL, (6)
PUSH (7)
MOV CL, (8)
SHR AL,CL
POP (9) OR AL,30H
MOV [DI],AL
(10)
LOOP NEXT
; ******** END ********
LEA DX,RESULT ; 结果数据区首址
LEA SI,NANE1 ; 结果文件名
MOV CX,N*2 ; 结果字节数
CALL SAVE ; 保存结果到文件
RET
START ENDP
CODE ENDS
END START

A.DA丁中读入SOURCE开始的内存单元中,运算结果要求从RESULT开始存放,
B.DAT中。
C.OBJ连接产生可执行文件,最终运行程序产生结果。调试中若发现整个程序存在错误之处,请加以修改。
D.DAT',0
E.DAT',0
F.DAT'中读取数据


【参考答案】

(1)AL (2)INC SI (3)0FH (4)AL (5)INC DI(6)BL (7)CX (8)4 (9)CX......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
热门 试题

单项选择题
SECTION C NEWS BROADCASTDirections: In this section you will hear everything ONCE ONLY. Listen carefully and then answer the questions that follow. At the end of each news item, you will be given 10 seconds to answer the questions.听力原文: Israel sent in troop reinforcements to combat militants who have killed 13 Israelis this month, the highest monthly toll in nearly four years. An official said Prime Minister Yitzhak Rubin, who ordered an indefinite closure of the West Bank from yesterday, had also decided to ease open-fire regulations for soldiers. The Gaza Strip has been closed since Sunday. Rabin, announcing the new security measures on television on Tuesday night, said he aimed to make Israelis feel more secure. Rabin convened an emergency session of his inner security cabinet after two Arabs shot dead two Israeli traffic policemen on Tuesday as they sat in their patrol car in the town of Hadera, 50 kilometres north of Tel Aviv. The closure of the West Bank and Gaza Strip will stop up to 100,000 Arab day laborers from working inside Israel. Their wages are vital to the economy of the territories, where Palestinians have been in revolt against Israeli occupation for five years. Palestinian leaders condemned the closure. Rubin earlier told parliament's foreign affairs and defence committee that security forces had been authorized to open fire on anyone bearing arms even if he did not threaten to shoot. Previous regulations allowed a soldier to shoot only if he was in immediate danger of his life. Arab-Israeli bloodshed has increased since Rubin expelled 415 Palestinians to smith Lebanon in December after Palestinians killed five Israeli soldiers.Rabin announced new security measures on television ______.A.after an emergency session of his inner security cabinetB.before the emergency meetingC.after two Arabs were shot deadD.before two Israeli policemen were killed
A.
听力原文:
B.
C.
D.
E.
F.
G.
H.
I.
Rabin
J.
A.after
K.before
L.after
M.before
单项选择题
SECTION C NEWS BROADCASTDirections: In this section you will hear everything ONCE ONLY. Listen carefully and then answer the questions that follow. At the end of each news item, you will be given 10 seconds to answer the questions.听力原文: Israel sent in troop reinforcements to combat militants who have killed 13 Israelis this month, the highest monthly toll in nearly four years. An official said Prime Minister Yitzhak Rubin, who ordered an indefinite closure of the West Bank from yesterday, had also decided to ease open-fire regulations for soldiers. The Gaza Strip has been closed since Sunday. Rabin, announcing the new security measures on television on Tuesday night, said he aimed to make Israelis feel more secure. Rabin convened an emergency session of his inner security cabinet after two Arabs shot dead two Israeli traffic policemen on Tuesday as they sat in their patrol car in the town of Hadera, 50 kilometres north of Tel Aviv. The closure of the West Bank and Gaza Strip will stop up to 100,000 Arab day laborers from working inside Israel. Their wages are vital to the economy of the territories, where Palestinians have been in revolt against Israeli occupation for five years. Palestinian leaders condemned the closure. Rubin earlier told parliament's foreign affairs and defence committee that security forces had been authorized to open fire on anyone bearing arms even if he did not threaten to shoot. Previous regulations allowed a soldier to shoot only if he was in immediate danger of his life. Arab-Israeli bloodshed has increased since Rubin expelled 415 Palestinians to smith Lebanon in December after Palestinians killed five Israeli soldiers.Rabin announced new security measures on television ______.A.after an emergency session of his inner security cabinetB.before the emergency meetingC.after two Arabs were shot deadD.before two Israeli policemen were killed
A.
听力原文:
B.
C.
D.
E.
F.
G.
H.
I.
Rabin
J.
A.after
K.before
L.after
M.before