未分类题

请编制程序,其功能是:内存中连续存放着五个用压缩型(组合型)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......

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

单项选择题
听力原文: A two-day conference to promote trade and investment in Africa will take place in Addis Ababa in Ethiopia in early March. One of the leading figures behind the event is a retired British Professor of international affairs, John Spence. VOA' s Andre Denathena spoke with professor Spence and filed this report from London about the forthcoming conference. 'The conference known as the 'Addis Forum' aims to attract international attention to Africa's economic potential and is an attempt to promote trade and investment in the vast continent of 52 countries. Conference organizers hope the two-day meeting will bring together African businessmen and their counterparts from Europe, North America and the Middle East to explore new investment possibilities in Africa. One of the main organizers of the conference is John Spence, a fellow at London's Royal Institute for International Affairs. Mr. Spence says inevitably investments by overseas companies will have to be selective, given that some African countries are perceived as better risks than others. He says these countries include South Africa, Uganda, Ghana, Ivory Coast and Botswana. John Spence believes that after Latin America and the Far East, Africa will be the next region for major foreign investors. And he hopes his Addis Forum conference will be the first step in getting foreign companies seriously interested in Africa. Andre Denathena, VOA news, London.'A two-day conference to promote trade and investment in Africa will take place in Addis Ababa in Ethiopia in ______.A.FebruaryB.early MarchC.late MarchD.April
A.
B.
C.'
A
D.
A.February
B.early
E.late
F.April