我正在尝试使用基本计算机指令编写一个程序,以对100个操作数的数组[selection sort]
进行排序,问题是如何找到数组的MIN
值,然后将其与的第一个位置交换数组?
说明
ORG 100
LDA ADS
STA PTF
STA PTS
LDA NBR
STA CTR
CLA
BSA MIN
ISZ PTF
ISZ PTS
ISC CTR
BUN LOP
HLT
HEX 0
LDA PTS I
CMA
AND PTF I
STA TMP
CLA
LDA PTF I
CMA
STA TMS
CLA
LDA PTS I
CMA
AND TMS
CMA
LDA TMP
CMA
STA TMP
LDA TMS
CMA
AND TMP
CMA
BUN MIN I
HEX 150
HEX 0
HEX 1
-100
HEX 0
HEX ----
HEX ---
ORG 150
DEC 1
.
.
.
.
DEC 33
END