HP 64700 User Manual page 83

Emulators terminal interface
Hide thumbs Also See for 64700:
Table of Contents

Advertisement

*----------------------------------------------------
* The QSORT subroutine is passed the high and low
* addresses of some area of bytes to be sorted on
* the stack.
*----------------------------------------------------
QSORT
MOV
MOV
MOV
* The following section splits the area to be sorted
* into two areas.
QSORT will be called to sort each
* of these smaller areas.
* If high index is less than low index, then sort
* is done.
OVER
CMP
JL
* AL = dividing value (from low index).
MOV
* (Increment allows DEC_HIGH loop to work first
* time through.)
*#### The following instruction deleted. ##########
*
INC
*##################################################
* Move low index up until it points to a value
* greater than the dividing value.
INC_LOW
INC
CMP
*#### The following instruction is changed. #######
JLE
*##################################################
CMP
JLE
JMP
*#### The following instruction is new. ###########
NEXT
INC
*##################################################
* Move high index down until it points to a value
* less than or equal to the dividing value.
DEC_HIGH
DEC
CMP
JL
* If high index is less than or equal to low index,
* the area is split; do not swap values.
CMP
JLE
* If high index is greater than low index, swap
* values and move indexes again.
MOV
MOV
MOV
MOV
BP,SP
DI,[BP+4]
; DI = high index.
SI,[BP+2]
; SI = low index.
DI,SI
DONE
AL,[SI]
DI
SI
AL,[SI]
NEXT
DI,SI
OUT
INC_LOW
DI
DI
AL,[DI]
DEC_HIGH
DI,SI
OUT
AH,[SI]
DL,[DI]
[SI],DL
[DI],AH
Accessing Full Analyzer Capability 3-35

Advertisement

Table of Contents
loading

Table of Contents