I have been working on converting a selection sort pseudocode to assembler 370 code. The pseudocode is as follows:
BEGIN initially is a pointer to the first entry END is a pointer to the last entry I and LOW are also pointers 1 is the length of one entry Do While (BEGIN < END) LOW <- BEGIN I <- BEGIN + 1 Do While (I not > END) If Key (LOW) > Key (I) LOW <- I Endif I <- I + 1 Enddo Swap ENTRY (BEGIN) with ENTRY (LOW) BEGIN = BEGIN + 1 Enddo;
I have the following done but dose not have any effect on the table that is to be sorted.
SORT DS 0H * STEP<1> STM 0,15,SORTSAVE LM 2,3,0(1) LOAD PARAMETERS L 3,0(3) LOADING END OF TABLE * REGISTER THREE IS THE END OF TABLE LOOP1 CR 2,3 REGISTER TWO IS THE BEGINNING OF THE TABLE BH ENDLP1 * storage for number values(LOW and I) LA 5,0(2) LOW LA 6,4(2) I * LOOP2 CR 6,3 BH ENDLP2 * CR 5,6 BH SET * B PASS * SET LA 5,0(6) * PASS DS 0H LA 6,4(6) ENDLP2 DS 0H * SWAPING BEGIN WITH LOW LA 7,0(2) HOLDING REGISTER TWO CONTENTS LA 2,0(5) REPLACING BEGIN WITH LOW LA 5,0(7) REPLACING LOW WITH BEGIN * LA 2,4(2) MOVING TO NEXT ENTRY ENDLP1 DS 0H * LM 0,15,SORTSAVE * BR 10 LTORG * SORTSAVE DS 16F STORAGE FOR REGISTERS *;
Does anyone have any suggestions ?
Edited 6 Years Ago by Ca67: n/a