i want to sort letters ascendingly in high level assembly language.
can someone please help me?

i created a program that will sort 4 numbers already,
it looks like this:

program iweak;

#include ("stdlib.hhf");

static

a   :int16;
b   :int16;
c   :int16;
d   :int16;
a2  :int16;
b2  :int16;
c2  :int16;
d2  :int16;

begin iweak;

stdout.put(nl,nl,nl,"1st Number: ");
   stdin.get(a);

stdout.put(nl,"2nd Number: ");
   stdin.get(b);

stdout.put(nl,"3rd Number: ");
   stdin.get(c);

stdout.put(nl,"4th Number: ");
   stdin.get(d);

stdout.put(nl,nl,nl,nl);

mov(a,ax);                        //=====1st======//
if(ax<=b && ax<=c && ax<=d)then
   mov(ax,a2);
endif;

mov(b,ax);
if(ax<=a && ax<=c && ax<=d)then
   mov(ax,a2);
endif;

mov(c,ax);
if(ax<=a && ax<=b && ax<=d)then
   mov(ax,a2);
endif;

mov(d,ax);
if(ax<=a && ax<=b && ax<=c)then
   mov(ax,a2);
endif;                          //=====1st======//



mov(a2,ax);                 //=====2nd=====//
if(ax==a)then               //a
   mov(b,ax);
   if(ax<=c && ax<=d)then
      mov(ax,b2);
   endif;
   
   mov(c,ax);
   if(ax<=b && ax<=d)then
      mov(ax,b2);
   endif;
   
   mov(d,ax);
   if(ax<=b && ax<=c)then
      mov(ax,b2);
   endif;
endif;

mov(a2,ax);
if(ax==b)then               //b
   mov(a,ax);
   if(ax<=c && ax<=d)then
      mov(ax,b2);
   endif;
   
   mov(c,ax);
   if(ax<=a && ax<=d)then
      mov(ax,b2);
   endif;
   
   mov(d,ax);
   if(ax<=a && ax<=c)then
      mov(ax,b2);
   endif;
endif;

mov(a2,ax);
if(ax==c)then               //c
   mov(a,ax);
   if(ax<=b && ax<=d)then
      mov(ax,b2);
   endif;
   
   mov(b,ax);
   if(ax<=a && ax<=d)then
      mov(ax,b2);
   endif;
   
   mov(d,ax);
   if(ax<=a && ax<=b)then
      mov(ax,b2);
   endif;
endif;

mov(a2,ax);
if(ax==d)then               //d
   mov(a,ax);
   if(ax<=b && ax<=c)then
      mov(ax,b2);
   endif;
   
   mov(b,ax);
   if(ax<=a && ax<=c)then
      mov(ax,b2);
   endif;
   
   mov(c,ax);
   if(ax<=a && ax<=b)then
      mov(ax,b2);
   endif;
endif;                     //=====2nd=====//



mov(a,ax);                       //==================4th===================//
if(ax>=b && ax>=c && ax>=d)then
   mov(ax,d2);
endif;

mov(b,ax);
if(ax>=a && ax>=c && ax>=d)then
   mov(ax,d2);
endif;

mov(c,ax);
if(ax>=a && ax>=b && ax>=d)then
   mov(ax,d2);
endif;

mov(d,ax);
if(ax>=a && ax>=b && ax>=c)then
   mov(ax,d2);
endif;                           //==================4th===================//




mov(a,ax);                                    //===========3rd============//
   if(ax!=a2 && ax!=b2 && ax<d2)then
      mov(ax,c2);
   endif;

mov(b,ax);
   if(ax!=a2 && ax!=b2 && ax<d2)then
      mov(ax,c2);
   endif;

mov(c,ax);
   if(ax!=a2 && ax!=b2 && ax<d2)then
      mov(ax,c2);
   endif;

mov(d,ax);
   if(ax!=a2 && ax!=b2 && ax<d2)then
      mov(ax,c2);
   endif;
mov(0,ax);
if(c2==ax)then
   mov(d2,c2);
endif;                                       //===========3rd============//




stdout.put(a2," ",b2," ",c2," ",d2);

stdout.put(nl,nl,nl,nl);

end iweak;
This article has been dead for over six months. Start a new discussion instead.