您的当前位置:首页正文

微机原理作业第4章

2020-10-15 来源:个人技术集锦


1. 程序设计语言:机器语言、汇编语言、高级语言。

汇编语句:①指令性语句——采用指令助记符构成的汇编语言语句,符合汇编语言的语法规则;

②指示性语句——不是真正的指令,而是一种假指令。

3. 定义汇编的开始和终止:ORG/END 定义字符名称:EQU/DATA

定义字节/字/存储空间:DB/DW/DS 定义位地址:BIT

5. 第二次扫描完成对地址偏移量的计算。

7. ORG 0100H MOV A,#00H MOV R0,#20H XCHD A,@R0 MOV B,A MOV A,@R0 SWAP A MUL AB

MOV B,#0AH DIV AB SWAP A ORL A,B MOV 21H,A SJMP $ END

9. ORG 0200H VAR DATA 20H FUNC DATA 21H MOV A,VAR

CJNE A,#50,NEXT1 NEXT1:JNC DONE

CJNE A,#20,NEXT2 NEXT2:JC NEXT3 RL A RL A

ADD A,20H SJMP DONE NEXT3:RL A

DONE:MOV FUNC,A SJMP $ END

11. ORG 0500H SOUCE DATA 30H DIST DATA 30H

MOV R0,#SOUCE MOV R1,#DIST LOOP:MOVX A,#R0

CJNE A,#24H,NEXT MOV @R1,A SJMP $

NEXT:MOV @R1,A INC R0 INC R1

SJMP LOOP END

13. ORG 0500H LEN DATA 40H SOUCE DATA 41H DIST DATA 20H

MOV R1,#DIST MOV R0,@LEN MOVX A,@R0 MOV R2,A

MOV R0,#SOUCE LOOP:MOVX A,@R0

JNB PSW.0,NEXT MOV @R1,A INC R1 NEXT:INC R0

DJNZ R2,LOOP SJMP $ END

15. ORG 0500H

MOV DPTR,#3000H PUSH DPL PUSH DPH

MOV DPTR,#2000H MOV R2,#01H MOV R3,#01H MOVX A,@DPTR INC DPTR

MOV R5,DPH MOV R4,DPL POP DPH POP DPL

MOVX @DPTR,A INC DPTR PUSH DPL PUSH DPH MOV DPH,R5 MOV DPL,R4 CLR C MOV A,R2 SUBB A,#01H MOV R2,A MOV A,R3 SUBB A,#00H MOV R3,A ORL A,R2 JNZ LOOP SJMP $ END

17. ORG 0800H MIN DATA 20H

BLOCK DATA 21H

MOV R0,#BLOCK MOV R2,#100 MOV MIN,#0FFH LOOP:MOV A,@R0

CJNE A,MIN,NEXT1 NEXT1:JNC NEXT2 MOV MIN,A NEXT2:INC R0

DJNZ R2,LOOP SJMP $

END

19. ORG 0A00H LEN DATA 20H BLOCK DATA 21H

MOV R0,#BLOCK LOOP:MOV A,@R0 CLR C

SUBB A,#0AH JNC NEXT1

MOV @R0,#00H SJMP NEXT2 NEXT1:ADD A,#07H

MOVC A,@A+PC MOV @R0,A NEXT2:INC R0

DJNZ LEN,LOOP SJMP $

DB 41H,42H,43H,44H,45H,46H END

21. ORG 0B00H

MOV R0,#BLOCK MOV A,#00H MOV R2,#01H

MOV SUM+1,#00H LOOP:ADD A,@R0 DA A

MOV SUM,A JNC NEXT

MOV A,SUM+1 ADDC A,#00H DA A

MOV SUM+1,A MOV A,SUM NEXT:INC R0

DJNZ R2,LOOP SJMP $ END

23. ORG 0C00H

MDA DATA 20H MDB DATA 21H MDC DATA 22H

MOV MDC+1,#00H MOV A,MDA ACALL SQR MOV MDC,A MOV A,MDB ACALL SQR ADD A,MDC MOV MDC,A MOV A,MDA MOV B,MDB RL A MUL AB ADD A,MDC MOV MDC,A JNC NEXT INC MDC+1 NEXT:SJMP $ END

25. ORG 0D00H

DELAY:MOV R7,#49 DELAY2:MOV R6,#64H DELAY1:DJNZ R6.DELAY1 NOP DJNZ R7.DELAY2 NOP RET 27.

1 1 2 1 2 1 1

因篇幅问题不能全部显示,请点此查看更多更全内容