问题 问答题

请编制程序,其功能是:以SOURCE开始的内存区域存放着若干字节的数据,以’#’作为数据的结束标志。将其中的空格滤除,对每个非空格数据的最高位清0后依次存放到RESULT指示的区域,其后存放一个空格符(20),然后存放原来的空格个数,最后仍以’#’结束。
例如:
内存中有45H,20H,87H,20H,A5H,32H,20H,20H,20H,23H
结果为 45H,07H,25H,32H,20H,05H,23H
部分程序已经给出,其中原始数据由过程LOAD从文件INPUT1.DAT中读入SOURCE开始的内存单元中,转换结果要求从RESULT开始存放,由过程SAVE保存到文件OUTPUT1.DAT中。
请填空BEGIN和END之间已经给出的一段源程序使其完整,需填空处已经用横线标出,每个空白一般只需要填一条指令或指令的一部分(指令助记符或操作数),也可以填入功能相当的多条指令,或删去BEGIN和END之间原有的代码并自行编程来完成所要求的功能。
对程序必须进行汇编,并与IO.OBJ链接产生可执行文件,最终运行程序产生结果。调试中若发现整个程序中存在错误之处,请加以修改。
试题程序:

答案

参考答案:(1)AGN11
(2)’#’
(3)INCDI
(4)JMP AGN1
(5)20H
(6)[DI]

解析:
此程序要实现以下功能:非空格数据最高位清0,以及统计空格符的个数。然后将处理后的数据存储到内存区域,并以"20H",空格符个数及’#’结尾。要读懂程序中的BL是存放空格符的个数。
程序的堆栈段定义了一个128字节的堆栈区。堆栈段下面是数据段。数据段中定义了四个字节型变量,原始数据区SOURCE、结果数据区RESULT、原始数据文件名NAME0、结果数据文件名NAME1。数据 段下面是代码段,告诉汇编程序,代码段、数据段和堆栈段分别属于段寄存器CS、DS、SS。
先将原始数据的偏移地址装入到SI中,结果数据存放的偏移地址装入到DI中。BL清0。接着将SI中内容送AL中。SI地址加1,准备取下一个字节。将AL与空格符比较,若相等,则转向AGN11段;否则,转向AGN2段。所以第(1)空填写"AGN11"。
AGN11段中,BL是记录空格符的个数。当AL为空格符时,BL加1。接着转向AGN1,继续判断下一个字符。
AGN2段的第(2)空中,将AL与’#’比较,若AL=’#’,则数据已经搜索到’#’,搜索完毕,转向DONE段;否则,用指令"AND AL 7FH"将AL字符最高位清0,并将结果AL存入到DI中。DI地址加1,无条件转向AGN1段。所以第(3)空填写“INCDI”,第(4)空填写"JMPAGN1"。DONE这一段,是统计完所有字符后,将空格符存入到DI中。所以第(5)空填写"20H"。接着将空格符个数BL存入到DI中。最后将字符’#’存入到DI中。所以第(6)空填写[DI]。

单项选择题
完形填空

The party began shortly after Mr. Wood, who lived in the flat below, signed to himself as he heard excited voices and the noisy music. Luckily he had  36  some work home from the office,   37  he kept himself busy for a couple of hours, thus managing to pay no attention to the noise  38 . But by eleven o’clock he felt  39  and was ready to go to bed, though from his earlier  experience he knew it was  40  trying to get to sleep. He undressed and lay for a while on the bed, trying to read, but he  41  himself reading the same page over and over again. He then turned off the light and  42  his head in the pillow. But  43  he could not shut  44  the noise, finally, after 45 seemed hours, his 46 was gone.

He jumped out of bed, 47 some clothing, marched 48 up the stairs, and walked into his neighbor’s flat. The owner of the flat, who 49 him in his dressing gown, came 50 the room and, 51 Mr. Wood could say anything, cried, “My dear fellow, come and 52. I know our parties 53 you. I meant to send you 54.” Mr. Wood’s anger disappeared then and there. He said, “I’d better go and get 55.” Minutes later, he returned, properly dressed, only to find that the party was nearly over.

36.A. taken              B. carried                C. brought                 D. fetched

37.A. with which         B. from which                 C. where                 D. when

38.A. outside             B. overhead              C. downstairs            D. nearby

39.A. bad                B. tired                       C. sick                D. hopeless

40.A. useless             B. necessary           C. possible                    D. helpful

41.A. had                B. found                C. caught               D. felt

42.A. buried             B. rested                C. shook                D. turned

43.A. till then             B. worse still            C. strange enough       D. even so

44.A. away               B. off                        C. down                      D. up

45.A. it                     B. what                    C. that                      D. which

46.A. sleep                  B. strength               C. patience               D. anger

47.A. pulled on             B. dressed up                      C. selected               D. wore

48.A. sadly                 B. proudly                C. quietly                        D. firmly

49.A. made fun of          B. stared at              C. was angry with       D. caught sight of

50.A. across               B. around                C. towards              D. by

51.A. as                   B. before                C. though             D. until

52.A. meet as               B. sit here             C. join us               D. scold me

53.A. may trouble          B. would trouble        C. may bother            D. must bother

54.A. a notice              B. a message           C. an invitation         D. an apology

55.A. washed                B. changed                    C. dressed                D. prepared