【计算机类职业资格】三级PC技术机试-220及答案解析.doc

上传人:tireattitude366 文档编号:1320205 上传时间:2019-10-17 格式:DOC 页数:4 大小:29KB
下载 相关 举报
【计算机类职业资格】三级PC技术机试-220及答案解析.doc_第1页
第1页 / 共4页
【计算机类职业资格】三级PC技术机试-220及答案解析.doc_第2页
第2页 / 共4页
【计算机类职业资格】三级PC技术机试-220及答案解析.doc_第3页
第3页 / 共4页
【计算机类职业资格】三级PC技术机试-220及答案解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、三级 PC技术机试-220 及答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制程序 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开始的内存单元中。运

2、算结果要求从 RESULT开始存放,由过程 SAVE保存到文件 OUTPUT1.DAT 中。填空 BEGIN和 END之间已给出的源程序使其完整(空白已用横线标出,每行空白一般只需一条指令,但采用功能相当的多条指令亦可),或删除 BEGIN和 END之间原有的代码并自行编程来完成要求的功能。对程序必须进行汇编,并与 IO.OBJ链接产生 PROG1.EXE执行文件,最终运行程序产生结果(无结果或结果不正确者均不得分)。调试中若发现整个程序中存在错误之处,请加以修改。试题程序:EXTRN LOAD:FAR, SAVE:FARN EQU 19STAC SEGMENT STACKDB 128 DUP

3、 (?)STAC ENDSDATA SEGMENTSOURCE DB N DUP(0)RESULT DB N+1 DUP(0)NAME0 DB INPUT1. DAT,0NAME1 DB OUTPUT1. DAT,0DATA ENDSCODE SEGMENTASSUME CS:CODE, DS:DATA,ES:DATA, SS:STACSTART PROC FARPUSH DSXOR AX,AXPUSH AXMOV AX,DATAMOV DS,AXMOV ES,AXLEA DX,SOURCE ; 数据区起始地址LEA SI,NAME0 ; 原始数据文件名MOV CX,N ; 字节数CALL L

4、OAD ; 从 INPUT1.DAT中读取数据;* BEGIN *(1) SI,SOURCEMOV BX,OFFSET SOURCELEA DI,RESULTMAXD1: MOV CX,NMOV DX,CXMOV AL, (2) MAXD2: INC BX(3) AL,BX(4) MOV AL, BXMAXD3: DEC DXJNZ (5) MOV DI, ALINC DICLDMREP: LODSBNOT AL(6) LOOP MREP; * END *LEA DX,RESULT ; 结果数据区首址LEA SI,NAME1 ; 结果文件名起始地址MOV CX,N+1 ; 字节数CALL SA

5、VE ; 保存结果到 OUTPUT1.DAT文件中RETSTART ENDPCODE ENDSEND START(分数:100.00)_三级 PC技术机试-220 答案解析(总分:100.00,做题时间:90 分钟)一、上机题(总题数:1,分数:100.00)1.请编制程序 PROG1.ASM,其功能是:以 SOURCE开始的内存区域中存放着 N个字节的有符号数。现找出最大的数,结果存放到 RESULT指示的单元,其后存放原 N个数逻辑取反后的值。例如:数据为:09H,7EH,89H,F3H,17H,67H(N 个数据)结果为:7EH(最大数),F6H,81H,76H,0CH,E8H,98H(

6、原来 N个数的逻辑反)部分程序已给出,其中原始数据由过程 LOAD从文件 INPUT1.DAT中读入 SOURCE开始的内存单元中。运算结果要求从 RESULT开始存放,由过程 SAVE保存到文件 OUTPUT1.DAT 中。填空 BEGIN和 END之间已给出的源程序使其完整(空白已用横线标出,每行空白一般只需一条指令,但采用功能相当的多条指令亦可),或删除 BEGIN和 END之间原有的代码并自行编程来完成要求的功能。对程序必须进行汇编,并与 IO.OBJ链接产生 PROG1.EXE执行文件,最终运行程序产生结果(无结果或结果不正确者均不得分)。调试中若发现整个程序中存在错误之处,请加以修

7、改。试题程序:EXTRN LOAD:FAR, SAVE:FARN EQU 19STAC SEGMENT STACKDB 128 DUP (?)STAC ENDSDATA SEGMENTSOURCE DB N DUP(0)RESULT DB N+1 DUP(0)NAME0 DB INPUT1. DAT,0NAME1 DB OUTPUT1. DAT,0DATA ENDSCODE SEGMENTASSUME CS:CODE, DS:DATA,ES:DATA, SS:STACSTART PROC FARPUSH DSXOR AX,AXPUSH AXMOV AX,DATAMOV DS,AXMOV ES,

8、AXLEA DX,SOURCE ; 数据区起始地址LEA SI,NAME0 ; 原始数据文件名MOV CX,N ; 字节数CALL LOAD ; 从 INPUT1.DAT中读取数据;* BEGIN *(1) SI,SOURCEMOV BX,OFFSET SOURCELEA DI,RESULTMAXD1: MOV CX,NMOV DX,CXMOV AL, (2) MAXD2: INC BX(3) AL,BX(4) MOV AL, BXMAXD3: DEC DXJNZ (5) MOV DI, ALINC DICLDMREP: LODSBNOT AL(6) LOOP MREP; * END *LEA DX,RESULT ; 结果数据区首址LEA SI,NAME1 ; 结果文件名起始地址MOV CX,N+1 ; 字节数CALL SAVE ; 保存结果到 OUTPUT1.DAT文件中RETSTART ENDPCODE ENDSEND START(分数:100.00)_正确答案:(1) LEA (2) BX (3) CMP(4) JGE MAXD3 (5) MAXD2 (6) STOSB)解析:解析 解题思路:在 MAXD2程序段中进行比较,找最大值;在 MAXD3程序段中对非最大值进行逻辑取反。

展开阅读全文
相关资源
猜你喜欢
  • SANS 10120-4 GA-1982 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf SANS 10120-4 GA-1982 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf
  • SANS 10120-4 GE-1984 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf SANS 10120-4 GE-1984 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf
  • SANS 10120-4 GF-1984 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf SANS 10120-4 GF-1984 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf
  • SANS 10120-4 H-1990 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Sectio.pdf SANS 10120-4 H-1990 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Sectio.pdf
  • SANS 10120-4 HA-1990 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf SANS 10120-4 HA-1990 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf
  • SANS 10120-4 HB-1985 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf SANS 10120-4 HB-1985 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf
  • SANS 10120-4 HC-1988 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Sectilw.pdf SANS 10120-4 HC-1988 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Sectilw.pdf
  • SANS 10120-4 HE-1983 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf SANS 10120-4 HE-1983 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities Secti.pdf
  • SANS 10120-4 INTRO-1986 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities In.pdf SANS 10120-4 INTRO-1986 Code of practice for use with standardized specifications for civil engineering construction and contract documents Part 4 Typical schedule of quantities In.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1