1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* The GNO Shell Project
|
|
|
|
*
|
|
|
|
* Developed by:
|
|
|
|
* Jawaid Bazyar
|
|
|
|
* Tim Meekins
|
|
|
|
*
|
1998-08-03 17:30:30 +00:00
|
|
|
* $Id: sv.asm,v 1.5 1998/08/03 17:30:25 tribby Exp $
|
1998-04-24 15:38:47 +00:00
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* SV.ASM
|
|
|
|
* By Tim Meekins
|
1998-07-20 16:23:11 +00:00
|
|
|
* Modified by Dave Tribby for GNO 2.0.6
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
* String Vector routines.
|
|
|
|
*
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
* Note: text set up for tabs at col 16, 22, 41, 49, 57, 65
|
|
|
|
* | | | | | |
|
|
|
|
* ^ ^ ^ ^ ^ ^
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
|
1998-04-24 15:38:47 +00:00
|
|
|
mcopy /obj/gno/bin/gsh/sv.mac
|
1997-11-18 05:31:00 +00:00
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
dummysv start ; ends up in .root
|
1998-04-24 15:38:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
setcom 60
|
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Allocate a string vector array
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
sv_alloc START
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
ptr equ 0
|
|
|
|
space equ ptr+4
|
|
|
|
|
|
|
|
subroutine (2:size),space
|
|
|
|
|
|
|
|
lda size
|
|
|
|
inc a ;for size and count
|
|
|
|
inc a ;at least one null entry
|
1998-07-20 16:23:11 +00:00
|
|
|
asl a Multiply by 4 (bytes/entry).
|
1997-11-18 05:31:00 +00:00
|
|
|
asl a
|
|
|
|
pea 0
|
|
|
|
pha
|
1998-08-03 17:30:30 +00:00
|
|
|
~NEW Allocate the memory
|
1998-07-20 16:23:11 +00:00
|
|
|
sta ptr and save address in
|
|
|
|
stx ptr+2 direct page variable.
|
|
|
|
|
|
|
|
ldy #2 Store number of entries
|
|
|
|
lda size as the value of the
|
|
|
|
sta [ptr],y first entry's high byte
|
|
|
|
lda #0 and zero as the low byte.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta [ptr]
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
ldy #4 Set Y to index to 2nd entry.
|
|
|
|
ldx size X = num of entries following.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
init sta [ptr],y Set all entries
|
|
|
|
iny2 to 0x00000000.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta [ptr],y
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
dex
|
|
|
|
bpl init ;not bne so that extra null at end
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
add4 ptr,#4,ptr Set ptr to point at second entry.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
return 4:ptr
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Add a string to the string vector
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
sv_add START
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
p equ 0
|
|
|
|
base equ p+4
|
|
|
|
space equ base+4
|
|
|
|
|
|
|
|
subroutine (4:vect,4:string,2:allocflag),space
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
sub4 vect,#4,base base points to entry # 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
ldy #2
|
1998-07-20 16:23:11 +00:00
|
|
|
lda [base],y If number of entries in table
|
|
|
|
cmp [base] == number in use,
|
|
|
|
beq exit the vector is full!
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; 1 = allocate memory, 0 = use string as is...
|
|
|
|
;
|
1998-07-20 16:23:11 +00:00
|
|
|
lda allocflag If "allocate memory" flag is set,
|
1997-11-18 05:31:00 +00:00
|
|
|
beq asis
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
pei (string+2) Determine length of
|
|
|
|
pei (string) new string.
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr cstrlen
|
|
|
|
inc a
|
|
|
|
pea 0
|
|
|
|
pha
|
1998-08-03 17:30:30 +00:00
|
|
|
~NEW Allocate memory for it.
|
1998-07-20 16:23:11 +00:00
|
|
|
sta p Store address in p/p+1.
|
1997-11-18 05:31:00 +00:00
|
|
|
stx p+2
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
pei (string+2) Copy the string into
|
|
|
|
pei (string) the new memory.
|
1997-11-18 05:31:00 +00:00
|
|
|
phx
|
|
|
|
pha
|
|
|
|
jsr copycstr
|
1998-07-20 16:23:11 +00:00
|
|
|
bra doit else
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
asis mv4 string,p Just copy address to p/p+1.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
;
|
|
|
|
; p contains address of string to be added to the vector.
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
doit lda [base]
|
1998-07-20 16:23:11 +00:00
|
|
|
tax X = number of entries in use.
|
1997-11-18 05:31:00 +00:00
|
|
|
asl a
|
|
|
|
asl a
|
1998-07-20 16:23:11 +00:00
|
|
|
tay Y = offset to next avail entry.
|
|
|
|
lda p Set entry to address of added string.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta [vect],y
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda p+2
|
|
|
|
sta [vect],y
|
|
|
|
|
|
|
|
txa
|
|
|
|
inc a
|
1998-07-20 16:23:11 +00:00
|
|
|
sta [base] Bump the number of entries in use.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
exit return
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Dispose a string vector
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
sv_dispose START
|
|
|
|
|
|
|
|
p equ 0
|
|
|
|
space equ p+4
|
|
|
|
|
|
|
|
subroutine (4:vect),space
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
sub4 vect,#4,p p points to head of vector
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
lda [p] Get number of entries in use.
|
|
|
|
beq done Done if zero.
|
|
|
|
|
|
|
|
loop asl a
|
1997-11-18 05:31:00 +00:00
|
|
|
asl a
|
1998-07-20 16:23:11 +00:00
|
|
|
tay Y points to last used entry.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [vect],y
|
|
|
|
tax
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [vect],y
|
|
|
|
pha
|
|
|
|
phx
|
1998-07-20 16:23:11 +00:00
|
|
|
jsl nullfree Free memory used by this entry.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [p]
|
|
|
|
dec a
|
1998-07-20 16:23:11 +00:00
|
|
|
sta [p] Number used = number used - 1.
|
|
|
|
bne loop If more to do, stay in loop.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
done pei (p+2) Free the vector itself.
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (p)
|
|
|
|
jsl nullfree
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Column print a string vector
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
sv_colprint START
|
|
|
|
|
|
|
|
numrow equ 0
|
|
|
|
numcol equ numrow+2
|
|
|
|
base equ numcol+2
|
|
|
|
maxlen equ base+4
|
|
|
|
space equ maxlen+2
|
|
|
|
|
|
|
|
subroutine (4:sv),space
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
sub4 sv,#4,base base = ptr to entry 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; Find the maximum string length
|
|
|
|
;
|
|
|
|
lda #1
|
|
|
|
sta maxlen
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
lda #0 Keep track of entry number in Acc.
|
1997-11-18 05:31:00 +00:00
|
|
|
lenloop pha
|
1998-07-20 16:23:11 +00:00
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay Y = offset to entry number.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
tax
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
pha
|
|
|
|
phx
|
1998-07-20 16:23:11 +00:00
|
|
|
jsr cstrlen Get length of entry's string.
|
|
|
|
cmp maxlen If > maxlen,
|
1997-11-18 05:31:00 +00:00
|
|
|
bcc nextlen
|
1998-07-20 16:23:11 +00:00
|
|
|
sta maxlen set maxlen to this length.
|
|
|
|
nextlen pla
|
|
|
|
inc a Bump entry number.
|
|
|
|
cmp [base] If not done,
|
|
|
|
bcc lenloop stay in loop.
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; add one for a space
|
|
|
|
;
|
|
|
|
inc maxlen
|
|
|
|
;
|
|
|
|
; calculate the number of columns....this is probably simpler than doing
|
|
|
|
; a divide..
|
|
|
|
;
|
|
|
|
ldx #0
|
|
|
|
txa
|
|
|
|
dex
|
|
|
|
clc
|
|
|
|
colloop inx
|
|
|
|
adc maxlen
|
|
|
|
cmp #80
|
|
|
|
bcc colloop
|
|
|
|
cpx #6+1
|
|
|
|
bcc okcol
|
|
|
|
ldx #6 ;limit of 6 columns
|
|
|
|
okcol stx numcol
|
|
|
|
;
|
|
|
|
; recalculate the width
|
|
|
|
;
|
|
|
|
UDivide (#80,@x),(maxlen,@a)
|
|
|
|
;
|
|
|
|
; calculate the height
|
|
|
|
;
|
|
|
|
lda [base]
|
|
|
|
UDivide (@a,numcol),(numrow,@x)
|
|
|
|
cpx #0
|
|
|
|
beq foocol
|
|
|
|
inc numrow
|
|
|
|
foocol anop
|
1998-07-20 16:23:11 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; find the index for each column...
|
|
|
|
;
|
|
|
|
lda #0
|
|
|
|
tax
|
|
|
|
clc
|
|
|
|
mkidxloop sta offtbl,x
|
1998-07-20 16:23:11 +00:00
|
|
|
inx2
|
1997-11-18 05:31:00 +00:00
|
|
|
adc numrow
|
|
|
|
cmp [base]
|
|
|
|
bcc mkidxloop
|
|
|
|
;
|
|
|
|
; well....I think we can print now (yay!)
|
|
|
|
;
|
1998-07-20 16:23:11 +00:00
|
|
|
asl numcol Double numcol since it's compared
|
|
|
|
ldx #0 against X to end the loop.
|
1997-11-18 05:31:00 +00:00
|
|
|
printloop lda offtbl,x
|
|
|
|
cmp [base]
|
|
|
|
bcs nextprint0
|
|
|
|
inc a
|
|
|
|
sta offtbl,x
|
|
|
|
phx
|
|
|
|
dec a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
tax
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
pha
|
|
|
|
phx
|
|
|
|
tax
|
|
|
|
lda 1,s
|
|
|
|
jsr puts
|
|
|
|
jsr cstrlen
|
|
|
|
tabit cmp maxlen
|
|
|
|
bcs nextprint
|
|
|
|
pha
|
|
|
|
lda #' '
|
|
|
|
jsr putchar
|
|
|
|
pla
|
|
|
|
inc a
|
|
|
|
bra tabit
|
|
|
|
nextprint plx
|
1998-07-20 16:23:11 +00:00
|
|
|
inx2
|
1997-11-18 05:31:00 +00:00
|
|
|
cpx numcol
|
|
|
|
bcc printloop
|
|
|
|
nextprint0 jsr newline
|
|
|
|
ldx #0
|
|
|
|
dec numrow
|
|
|
|
bne printloop
|
|
|
|
|
|
|
|
doneprint return
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
;
|
|
|
|
; Offset table: one entry for each column
|
|
|
|
;
|
|
|
|
offtbl ds 14
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Sort a string vector
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
sv_sort START
|
|
|
|
|
|
|
|
space equ 0
|
|
|
|
|
|
|
|
subroutine (4:sv),space
|
|
|
|
|
|
|
|
pei (sv+2)
|
|
|
|
pei (sv)
|
|
|
|
sub4 sv,#4,sv
|
|
|
|
pea 0
|
|
|
|
lda [sv]
|
|
|
|
dec a
|
|
|
|
pha
|
|
|
|
jsl _qsort
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
_qsort PRIVATE
|
|
|
|
|
|
|
|
vleft equ 0
|
|
|
|
i equ vleft+4
|
|
|
|
last equ i+2
|
|
|
|
ptr2 equ last+2
|
|
|
|
ptr1 equ ptr2+4
|
|
|
|
idx1 equ ptr1+4
|
|
|
|
space equ idx1+2
|
|
|
|
|
|
|
|
subroutine (4:sv,2:left,2:right),space
|
|
|
|
;
|
|
|
|
; if (left >= right)
|
|
|
|
; return;
|
|
|
|
;
|
|
|
|
lda right ;if one or two elements do nothing
|
|
|
|
jmi exit
|
|
|
|
cmp left
|
|
|
|
jcc exit
|
|
|
|
;
|
|
|
|
; swap(v, left, (left + right)/2);
|
|
|
|
;
|
|
|
|
lda left
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
sta idx1
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
sta ptr1
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
sta ptr1+2
|
|
|
|
add2 left,right,@a
|
|
|
|
lsr a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
sta ptr2
|
|
|
|
lda ptr1
|
|
|
|
sta [sv],y
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
sta ptr2+2
|
|
|
|
lda ptr1+2
|
|
|
|
sta [sv],y
|
|
|
|
ldy idx1
|
|
|
|
lda ptr2
|
|
|
|
sta [sv],y
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda ptr2+2
|
|
|
|
sta [sv],y
|
|
|
|
;
|
|
|
|
; last = left;
|
|
|
|
;
|
|
|
|
lda left
|
|
|
|
sta last
|
|
|
|
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
sta vleft
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
sta vleft+2
|
|
|
|
;
|
|
|
|
; for (i=left+1; i <=right; i++)
|
|
|
|
;
|
|
|
|
lda left
|
|
|
|
inc a
|
|
|
|
sta i
|
|
|
|
forloop lda i
|
|
|
|
cmp right
|
|
|
|
beq okloop
|
|
|
|
bcs endloop
|
|
|
|
okloop anop
|
|
|
|
;
|
|
|
|
; if (strcmp(v[i],v[left]) < 0)
|
|
|
|
;
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
tax
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
pha
|
|
|
|
phx
|
|
|
|
pei (vleft+2)
|
|
|
|
pei (vleft)
|
|
|
|
jsr cmpcstr
|
|
|
|
bpl nextloop
|
|
|
|
;
|
|
|
|
; swap (v, ++last, i)
|
|
|
|
;
|
|
|
|
inc last
|
|
|
|
lda last
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
sta idx1
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
sta ptr1
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
sta ptr1+2
|
|
|
|
lda i
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
sta ptr2
|
|
|
|
lda ptr1
|
|
|
|
sta [sv],y
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
sta ptr2+2
|
|
|
|
lda ptr1+2
|
|
|
|
sta [sv],y
|
|
|
|
ldy idx1
|
|
|
|
lda ptr2
|
|
|
|
sta [sv],y
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda ptr2+2
|
|
|
|
sta [sv],y
|
|
|
|
|
|
|
|
nextloop inc i
|
|
|
|
jmp forloop
|
|
|
|
;
|
|
|
|
; swap(v, left, last)
|
|
|
|
;
|
|
|
|
endloop lda left
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
sta idx1
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
sta ptr1
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
sta ptr1+2
|
|
|
|
lda last
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
tay
|
|
|
|
lda [sv],y
|
|
|
|
sta ptr2
|
|
|
|
lda ptr1
|
|
|
|
sta [sv],y
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda [sv],y
|
|
|
|
sta ptr2+2
|
|
|
|
lda ptr1+2
|
|
|
|
sta [sv],y
|
|
|
|
ldy idx1
|
|
|
|
lda ptr2
|
|
|
|
sta [sv],y
|
1998-07-20 16:23:11 +00:00
|
|
|
iny2
|
1997-11-18 05:31:00 +00:00
|
|
|
lda ptr2+2
|
|
|
|
sta [sv],y
|
|
|
|
;
|
|
|
|
; qsort(v, left, last-1)
|
|
|
|
;
|
|
|
|
pei (sv+2)
|
|
|
|
pei (sv)
|
|
|
|
pei (left)
|
|
|
|
lda last
|
|
|
|
dec a
|
|
|
|
pha
|
|
|
|
jsl _qsort
|
|
|
|
;
|
|
|
|
; qsort(v, last+1, right)
|
|
|
|
;
|
|
|
|
pei (sv+2)
|
|
|
|
pei (sv)
|
|
|
|
lda last
|
|
|
|
inc a
|
|
|
|
pha
|
|
|
|
pei (right)
|
|
|
|
jsl _qsort
|
|
|
|
|
|
|
|
exit return
|
|
|
|
|
|
|
|
END
|