From 926e572a53ba6613be585528f0f9f2357c206899 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Sat, 27 Apr 2019 02:34:22 +0200 Subject: [PATCH] Fully unrolled sort-loop --- ucode/sort4.uc | 100 ++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 64 deletions(-) diff --git a/ucode/sort4.uc b/ucode/sort4.uc index c790dce..38b99c4 100644 --- a/ucode/sort4.uc +++ b/ucode/sort4.uc @@ -65,75 +65,46 @@ reset grm // Initialize PC to point at list const LIST_START mov ar pc - -$BUCKET_SORT_START - -// First value to be sorted mov pc asr; incpc + +//$BUCKET_SORT_START +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE mov pm ir; call @JTABLE -// Second value to be sorted -mov pc asr; incpc +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE +mov pm ir; call @JTABLE mov pm ir; call @JTABLE -// Third value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE -// Fourth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Fifth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Sixth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Seventh value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Eighth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Ninth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Tenth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Eleventh value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Twelfth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Thirteenth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Foureenth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Fifteenth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -// Sixteenth value to be sorted -mov pc asr; incpc -mov pm ir; call @JTABLE - -sub LIST_END -bnz @BUCKET_SORT_START +//sub LIST_END +//bnz @BUCKET_SORT_START @@ -270,4 +241,5 @@ $INSERTION_END_BIGGEST mov ir pm $INSERTION_END_NOTBIGGEST -mov hr ar; mov hr pc; ret +mov hr ar; mov hr pc +mov pc asr; incpc; ret