#Réaliser l'algorithme du tri sélection avec la machine RAM declare: taille ptr i pos max tmp table #chargment de la table LOAD #table STORE ptr debut: READ JUML sortie STORE @ptr INC ptr JUMP debut sortie: #calcul de la taille LOAD ptr STORE max SUB #table STORE taille #tri de la table LOAD #0 STORE i loop: LOAD taille SUB i JUMZ eol #recherche min LOAD #table ADD i STORE pos STORE ptr cherche: LOAD @ptr SUB @pos JUML test LOAD @ptr STORE tmp LOAD @pos STORE @ptr LOAD tmp STORE @pos test: INC ptr LOAD max SUB ptr JUMZ next JUMP cherche next: INC i JUMP loop eol: #Ecriture de la table LOAD #table STORE ptr ecriture: LOAD taille JUMZ fin LOAD @ptr WRITE INC ptr DEC taille JUMP ecriture fin: STOP