MOV $0xFF0000,%SP MOV $0x0000,%R0h MOV $DATA,%R0l PUSH %R0 MOV $DATA_END,%R0l PUSH %R0 CALL $QUICKSORT HALT :QUICKSORT #Get parameters from stack MOV %SP,%R0 MOV $0x0000,%R1h MOV $0x0004,%R1l SUB %R1,%R0 SUB %R1,%R0 MOV (%R0),%R2 SUB %R1,%R0 MOV (%R0),%R3 #Compare input and quit if start >= end CMP %R2,%R3 JMP,NS $BAIL ADD %R2,%R3 :BAIL RET :DATA DDW $0x00000000 DDW $0x00000004 DDW $0x00000009 DDW $0x00000031 DDW $0x000000BB DDW $0x0000000e DDW $0x00000002 DDW $0x000000BB DDW $0x01000000 :DATA_END DDW $0xFFFFFFFF