lab3_1.asm

来自「This is an program for the 8051 for time」· 汇编 代码 · 共 32 行

ASM
32
字号
		ORG 0000H
		SJMP MAIN

		ORG 0030H
MAIN:	MOV R4, #0AH		;COUNTER1 for no. of pass required	

BACK11:
		MOV R0, #30H		;ARRAY POINTER1
		MOV R1, #31H		;ARRAY POINTER2
		MOV R3, #09H		;COUNTER2 for no. of comparison required

BACK22:
		MOV 05H,@R0		;Save first position no. in 05h location.
		MOV A,@R1		;Take second position no. in A
		CJNE A, 05H, NEXT11		;Comparison of 1st & 2nd position nos. In this 					;instruction comparison of A & 05h location 						;will be done & if both will not equal then PC 						;will jump to NEXT11 location
		Sjmp NEXT22		;If both A & 05h will equal then PC will 							;execute this instruction
NEXT11:
		JNC NEXT22		;If A(2nd position no.) is greater than 05h (1st  no.) 					;then no need to change their positions.
		XCH A,@R0		;If A(2nd position no.) is less than 05h (1st  no.) 		MOV @R1,05H		;then change their positions.
		MOV @R1,A

NEXT22:
		INC R0			;Increment both pointers
		INC R1
		DJNZ R3,BACK22	;Decrement counter of comparison

		DJNZ R4,BACK11	; Decrement counter of pass

LAST: SJMP LAST
	
		END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?