问题 问答题

请编制程序PROG1.ASM,其功能是:以SOURCE开始的内存区域中存放着N个字节的有符号数。现找出最大的数,结果存放到RESULT指示的单元,其后存放原N个数逻辑取反后的值。
例如:
数据为:09H,7EH,89H,F3H,17H,……,67H(N个数据)
结果为:7EH(最大数),F6H,81H,76H,0CH,E8H,……,98H(原来N个数的逻辑反)
部分程序已给出,其中原始数据由过程LOAD从文件INPUT1.DAT中读入SOURCE开始的内存单元中。运算结果要求从RESULT开始存放,由过程SAVE保存到文件 OUTPUT1.DAT中。
填空BEGIN和END之间已给出的源程序使其完整(空白已用横线标出,每行空白一般只需一条指令,但采用功能相当的多条指令亦可),或删除BEGIN和END之间原有的代码并自行编程来完成要求的功能。
对程序必须进行汇编,并与IO.OBJ链接产生PROG1.EXE执行文件,最终运行程序产生结果(无结果或结果不正确者均不得分)。调试中若发现整个程序中存在错误之处,请加以修改。
试题程序:
EXTRNLOAD:FAR, SAVE:FAR
N EQU 19
STAC SEGMENT STACK
DB 128 DUP ()
STAC ENDS
DATA SEGMENT
SOURCE DB N DUP(0)
RESULT DB N+1 DUP(0)
NAME0 DB ’INPUT1. DAT’,0
NAME1 DB ’OUTPUT1. DAT’,0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA,ES:DATA, SS:STAC
START PROCFAR
PUSHDS
XOR AX,AX
PUSHAX
MOV AX,DATA
MOV DS,AX
MOV ES,AX
LEA DX,SOURCE; 数据区起始地址
LEA SI,NAME0; 原始数据文件名
MOV CX,N ; 字节数
CALLLOAD ; 从INPUT1.DAT中读取数据
;**** BEGIN ****
(1) SI,SOURCE
MOV BX,OFFSET SOURCE
LEA DI,RESULT
MAXD1: MOV CX,N
MOV DX,CX
MOV AL, (2)
MAXD2: INC BX
(3) AL,[BX]
(4)
MOV AL, [BX]
MAXD3: DEC DX
JNZ (5)
MOV [DI], AL
INC DI
CLD
MREP: LODSB
NOT AL
(6)
LOOPMREP
; **** END ****
LEA DX,RESULT; 结果数据区首址
LEA SI,NAME1; 结果文件名起始地址
MOV CX,N+1 ; 字节数
CALLSAVE ; 保存结果到OUTPUT1.DAT文件中
RET
START ENDP
CODE ENDS
END START

答案

参考答案:(1) LEA (2) [BX] (3) CMP
(4) JGE MAXD3 (5) MAXD2 (6) STOSB

解析: 解题思路:在MAXD2程序段中进行比较,找最大值;在MAXD3程序段中对非最大值进行逻辑取反。

问答题

On Feb. 17, 2009, it could snow all across America. Not outside, but in living rooms, on TV sets. That’s the date when broadcasters will switch to digital transmission, rendering millions of standard analog TVs useless. Consumers can avoid this whiteout, but only if they’re prepared. And there’s the challenge: How to inform the roughly 20 million households relying exclusively on analog sets that pull in their reception for free, through rabbit ears or a rooftop antenna. Analog TVs that receive cable or satellite will not be affected.
Consumers who own these sets don’t necessarily need to know why the federal government is mandating the change (to free up the airwaves for other purposes, such as wireless and public safety communications-though added benefits are better pictures and more channels). But they do need consistent and unbiased information on what to do and they need to be able to act on it. With fewer than 18 months to go, though, 56 percent of viewers with analog sets have never even heard of the switch. The General Accountability Office, the government watchdog, is concerned that with two government agencies involved, "no one is in charge."
The Federal Communications Commission is worried, too. "If we don’t do a better job of planning, we’ll have one of the biggest outrages Congress has ever seen," FCC commissioner Jonathan Adelstein told US senators last month. The options for consumers are fairly straightforward. Starting with the least expensive one, they are:

  • a) buying a converter box using government coupons’
  • b) subscribing to cable or satellite TV services, which will make the transition on their end, or
  • c) buying a digital TV. But sharing this information is anything but simple. Because it has only $ 5 million to get the message out, the government is turning to the private sector for help with public-service announcements and educating consumers in stores. This partnership makes sense, if done right. Certainly, the broadcasting industry wants viewers to keep on watching, However, there’s a danger in their self-interest. Naturally, retailers also want people to buy new digital televisions instead of opting for low-cost converters, and cable and satellite providers want new subscribers. And industry may not have enough of a financial incentive to reach out to certain analog viewing groups, such as the poor or elderly (seniors make up 40 percent of analog households).
    Other serious issues remain. One is whether the converter boxes will be uniformly available in stores. Beginning in January, households should be able to apply to the Commerce Department’s National Telecommunications and Information Administration for up to two $ 40 coupons to offset the costs of converter boxes expected to be priced from $ 50 to $70. But some retailers may not stock the boxes if they don’t have much demand for them.
    And what about recycling analog televisions, of which there are an estimated 70 million More than anything, what’s needed is oversight and coordination of the conversion. Congress should designate one of the two government agencies involved in this project to take the lead, or empower an independent group to oversee the transition.


Why does the author say that "But sharing this information is anything but simple." (para. 3)

单项选择题