[计算机类试卷]PC技术机试模拟试卷10及答案与解析.doc

上传人:hopesteam270 文档编号:493421 上传时间:2018-11-28 格式:DOC 页数:3 大小:27.50KB
下载 相关 举报
[计算机类试卷]PC技术机试模拟试卷10及答案与解析.doc_第1页
第1页 / 共3页
[计算机类试卷]PC技术机试模拟试卷10及答案与解析.doc_第2页
第2页 / 共3页
[计算机类试卷]PC技术机试模拟试卷10及答案与解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、PC技术机试模拟试卷 10及答案与解析 一、程序设计题 1 试题要求如下: 请编制程序,其功能是:从 20个有符号字节数据中取出负数并计算其绝对值之和 (字型 ),然后存放在指定的内存区中,多余的空间填 0。 例如: 内存中有: 80H, 02H, 00H, 7CH, 7BH, 81H 结果为: 80H, FEH, FDH, 05H, 00H, 00H 部分程序已给出,其中原始数据由过程 LOAD从文件 INPUT1.DAT中读入SOURCE开始的内存单元中,运算的结果要求从 RESULT开始存放 ,由过程SAVE保存到文件 OUTPUT1.DAT中。补充 BEGIN和 END之间已给出的源程

2、序使其完整 (空白已用横线标出,每行空白一般只需一条指令,但采用功能相当的多条指令亦可 ),或删除 BEGIN和 END之间原有的代码并自行编程来完成要求的功能。 对程序进行汇编,并与 IO.OBJ链接产生执行文件,最终运行程序产生结果。调试中发现整个程序中存在错误之处,请加以修改。 试题程序: EXTRN LOAD: FAR, SAVE: FAR N EQU 20 STAC SEGMENT STACK DB 256 DUP (?) STAC ENDS DATA SEGMENT SOURCE DB N DUP(?) RESULT DB N DUP(0) NAME0 DB INPUT1.DAT,

3、 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 MOV ES, AX LEA DX, SOURCE ; 数据区起始地址 LEA SI, NAME0 ; 原始数据文件名 MOV CX, N ; 字节数 CALL LOAD ; 从 INPUT1.DAW中读取数据 * BEGIN * LEA SI, SOURCE LEA DI, RESULT MO

4、V DX, 0 MOV CX, N CLD CON: LODSB (1) JGE (2) MOV DI, AL INC DI (3) INC DI ADD DL, AL (4) NEXT: LOOP CON MOV DI, DX ADD DI, 2 MOV CX, 40 SUB CX, DI MOV AL, (5) (6) ; * END * LEA DX, RESULT ; 结果数据区首址 LEA SI, NAME1 ; 结果文件名 MOV CX, N ; 结果字节数 CALL SAVE ; 保存结果到文件 RET START ENDP CODE ENDS END START PC技术机试模

5、拟试卷 10答案与解析 一、程序设计题 1 【正确答案】 (1)CMP AL, 0 ; 比较,看 AL中的内容是否为负数 (2) NEXT (3) NEG AL ; 对负数求补 (4) ADC DH, 0 ; 判断是否有进位 (5) 0 (6) REP STOSB 【试题解析】 本程序的功能是从所给的数据中取出负数并计算绝对值之和。CON所完成的是判断数据,如果是负数则取 反加 1,即变为它的绝对值再求和。否则转到 NEXT中,继续循环判断数据,直到所有数据判断完。 NEXT中完成的是多余的空间存入 0。汇编语言中存入串指令用 STOS,当有重复存入时加前缀REP,执行的足把 AL或 AX的内容存入一个长度为 (CX)的缓冲区中。

展开阅读全文
相关资源
猜你喜欢
  • ASD-STAN PREN 4697-2014 Aerospace series General and installation requirements for passenger seat fittings (Edition P 2).pdf ASD-STAN PREN 4697-2014 Aerospace series General and installation requirements for passenger seat fittings (Edition P 2).pdf
  • ASD-STAN PREN 4700-001-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 001 Plate sheet and strip (Edition P 2)《航空航天系列 钢和耐热合金制锻件技.pdf ASD-STAN PREN 4700-001-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 001 Plate sheet and strip (Edition P 2)《航空航天系列 钢和耐热合金制锻件技.pdf
  • ASD-STAN PREN 4700-002-2014 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 002 Bar and section (Edition P 3).pdf ASD-STAN PREN 4700-002-2014 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 002 Bar and section (Edition P 3).pdf
  • ASD-STAN PREN 4700-003-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 003 Tube (Edition P 2)《航空航天系列 钢和耐热合金制锻件技术规范 第003部分 管材 第P2.pdf ASD-STAN PREN 4700-003-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 003 Tube (Edition P 2)《航空航天系列 钢和耐热合金制锻件技术规范 第003部分 管材 第P2.pdf
  • ASD-STAN PREN 4700-004-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 004 Wire (Edition P 2)《航空航天系列 钢和耐热合金锻件的技术规范 第004部分 线材 第P2.pdf ASD-STAN PREN 4700-004-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 004 Wire (Edition P 2)《航空航天系列 钢和耐热合金锻件的技术规范 第004部分 线材 第P2.pdf
  • ASD-STAN PREN 4700-005-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 005 Forging stock (Edition P 1)《航空航天系列 钢和耐热合金锻件的技术规范 第005.pdf ASD-STAN PREN 4700-005-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 005 Forging stock (Edition P 1)《航空航天系列 钢和耐热合金锻件的技术规范 第005.pdf
  • ASD-STAN PREN 4700-006-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 006 Pre-production and production forgings (Edition P 1)《.pdf ASD-STAN PREN 4700-006-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 006 Pre-production and production forgings (Edition P 1)《.pdf
  • ASD-STAN PREN 4700-007-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 007 Remelting stock (Edition P 1)《航空航天系列 钢和耐热合金锻件的技术规范 第0.pdf ASD-STAN PREN 4700-007-2009 Aerospace series Steel and heat resisting alloys Wrought products Technical specification Part 007 Remelting stock (Edition P 1)《航空航天系列 钢和耐热合金锻件的技术规范 第0.pdf
  • ASD-STAN PREN 4700-4-2002 Aerospace Series Steel and Heat Resisting Alloys Wrought Products Technical Specification Part 4 Wire (Edition P1)《航空航天系列 钢和耐热合金锻件的技术规范 第4部分 线材 第P1版》.pdf ASD-STAN PREN 4700-4-2002 Aerospace Series Steel and Heat Resisting Alloys Wrought Products Technical Specification Part 4 Wire (Edition P1)《航空航天系列 钢和耐热合金锻件的技术规范 第4部分 线材 第P1版》.pdf
  • 相关搜索

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

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