Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can please help me to do a written description of the algorithm and approach for this program in 68k?? I am not sure how to
Can please help me to do a written description of the algorithm and approach for this program in 68k??
I am not sure how to describe it.
ORG $400 DEFINE VARIABLES FOR ADDRESSES DC.L FIRST DC.L CAP ORG $420 LIST OF NUMBERS TO BE SORTED FIRST DC. L 20, 19, 18, 17, 1 14, 13, 12, 11, 10, 9, 8,7, 6,5, 4, 3, 2, 1 CAP DC.L 999 END CAP NOT A PART OF THE LIST ORG $1000 LEA. L CAP,A LISTLOOP MOVE. B #0, D4 RESETTING COUNTER LEA. L $420 THEN SET POINTER TO BEGINNING OF LIST A0 COMPARELOOP MOVE. L (A0) D1 MOVE. L (A0),D2 CHECK IF LOOP IS AT END OF LIST CMPA. A0 RUN OUTER LOOP IF AT END OF LIST, OTHERWISE PROCEED BEQ CHECKSORTED IF IN MEMORY BEYOND LIST BHI CHECKSORTED CMP L D1, D2 BMI SWAP IF NEG, SWAP BGE COMPARE LOOP IF POS OR EQUAL NO SWAP CHECK SORTED MOVE. B #0, D3 SUBTRACTING COUNTER AND 0 CMP .B D04, D3 BEQ TERM PROG BRANCH TO END IF COUNTER EQUALS 0 BNE LISTLOOP RUN LOOP AGAIN FROM BEGINNING IF SWAPS OCCURED BECAUSE COUNTER IS NONZERO SWAP ADD B #1, D4 COUNTER IS D4, COUNTS SWAPING. WHEN ZERO, WE ARE DONE MOVE. L D2,- (A0) ADDA. #4, A0 MOVE. L D1, (A0) JMP COMPARE LOOP TERMPROG END $1000Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started