?? lab3_1.asm
字號:
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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -