Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: Sort array crashing  (Read 10504 times)

0 Members and 1 Guest are viewing this topic.

idrougge

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 12
  • Generic Amiga User
Sort array crashing
« on: May 29, 2014, 09:30:56 PM »

According to the AMOS Pro manual, Sort works like this:

Quote
SORT
instruction: sort all elements in an array
Sort a(0)
Sort a#(0)
Sort a$(0)
The SORT instruction arranges the contents of any array into ascending order, and the array may contain integers,
floating point numbers or strings.

I have an array ENEMY(NUMBER_OF_ENEMIES,2). Now, I wish to sort this array, but I have three problems.

• Calling Sort ENEMY(0) results in a software failure.
• Calling Sort ENEMY(0,0) results in the array being full of zeros.
• How do I specify what field to sort on?
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Sort array crashing
« Reply #1 on: May 30, 2014, 12:47:32 AM »

I think the AmosPro sort command only works on single-dimension arrays.  Thus it is almost completely worthless.
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: Sort array crashing
« Reply #2 on: May 30, 2014, 06:11:42 PM »

Multi dimension arrays really slow the program down though too don't they?
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Sort array crashing
« Reply #3 on: May 31, 2014, 01:45:25 PM »

@Hungry Horace
Yes, but the sort option will always sort one array.  Even if you converted the program to use multiple arrays, it wouldn't apply the same sort order to the other arrays.

@idrougge
If you'd like, I can make an iterative natural merge-sort for you to use.
Logged

idrougge

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 12
  • Generic Amiga User
Re: Sort array crashing
« Reply #4 on: May 31, 2014, 02:38:08 PM »

Multi dimension arrays really slow the program down though too don't they?
Well, we don't have linked lists, we don't have structs, we don't have pointers, so what else can you use? Peeking and poking?

If you'd like, I can make an iterative natural merge-sort for you to use.
I was thinking of going back to what I was taught in programming class in school about sorting routines, but I haven't heard about iterative natural merge-sort before. What does it do?
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Sort array crashing
« Reply #5 on: May 31, 2014, 04:20:05 PM »

Iterative Natural Merge-Sort
The initialization pass of the natural variant of the merge-sort goes through the array and divides the list into regions.  If any number entries are in order already, they are included in the same region.  If an inversion is detected between any two entries, start a new region for the next entry.  Keep track of the number of regions because when the number drops to 1 or 0 (an empty array) the sort is complete and terminates.

The most common way to store the region list is as a one-directional queue (often implemented as a singly-linked list starting with the last entry and keeping an additional node pointer to the first item so that adding to the list at the end is a O(1) operation, as is removing from the beginning of the list).  The cargo entry can be an index in the array so there would be a node-pointer and a long integer.

Note that AmosPro CAN do linked-lists the same way a C programmer would do them:  by manually allocating and deallocating memory chunks and using Leek and Loke to modify the entries.  Execall commands to the proper LVO entries for AllocMem and FreeMem are available on version 2.x of the Amiga reference manuals found on the Amiga Developer CD.  (It's found by running the LVO program on the System FD files for Exec.library .)  If you need this information, I'll look it up.  Also there is an LVO Amos command that will do the same thing for you once you configure it.

Further note that the header information for the queue should be stored in a 16-byte work bank or a dynamically allocated memory chunk.  The 3 values contained in it will be the start and end pointers of the linked list and the number of entries in the list.  The nodes in the linked list will contain the next-pointer (initialized to NULL, which is zero), and the first and last index of the region. They thus will also be 12-bytes long since they also contain 3 long values.

The next step is to enter a while loop that iterates when the number of regions is greater than one.  Inside the loop nest a repeat-until loop that reads two entries off the incoming queue and do a merge (described below) into a second queue for output.  Continue repeating through the pairs of input queue entries until there is less than two left.  Before you iterate the outer while loop, be sure to swap the input and output queues and input and output arrays.  (If using banks to hold the queue headers, you can just use a Bank Swap command for them.  I don't remember if this is in normal AmosPro or if you need the AMCAF extension for it.)

To do a merge operation, you advance through the array entries in each region (using two index variables) copying the lighter entry for the sorting order to an identically sized array.  Advance whichever index pointed to the lighter entry and check if you got to the end of that region.  Once you get to the end of one of the regions, the remaining entries of the other region should already be copied to the other array since they will all be heavy values in-order amongst themselves.

Implementation note:  Kickstart 3.1's memory pool allocation routines can be used to minimize the number of allocations of nodes and memory fragmentation.  You never end up with more than one and you never start out with more than N+1 nodes where N is the number of entries since the worst-case is to have a reverse-order list.

The advantage to the natural mergesort over a normal mergesort is that a list or array that is mostly sorted will take less time to sort since it will have fewer regions to process.  The advantage of the mergesort family of sorting algorithms is that they consistently yield O(n*log n) processing time which is the most efficient comparison-based sort.  The only way to go faster (in terms of time complexity) is to use an indexed sort like a radix sort, which requires that the values being sorted be suitable for indexing into an array.

I hope this algorithm description wasn't too detailed for your liking...
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: Sort array crashing
« Reply #6 on: June 02, 2014, 06:45:15 AM »

Well, we don't have linked lists, we don't have structs, we don't have pointers, so what else can you use? Peeking and poking?
Erm, well not quite true.  Just infernally cumbersome.

AMOSPro.Lib has full linked list handling functions, they were just never exposed as AMOS Basic instructions.  Something for the version after bugfix and docs?

Structures can be defined - see AMOSPro_Productivity1:Equates/Equates.Doc and AMOSPro_Productivity1:Equates/AMOSPro_System_Equates.  But it's a cumbersome task to use an assembler and the Make_Equates.AMOS program to make the AMOSPro_System_Equates file.  Easier to edit by hand...  And whatever you happen to need for a particular program effectively becomes global across all your programs.  It would be so much more user friendly to be able to define data structures on the fly.  Another wish list item for after bugfix, etc.

I think the AmosPro sort command only works on single-dimension arrays.  Thus it is almost completely worthless.
Agreed!  The only use I could ever dream up for it is to use a string array where each element is effectively a 'record' using fixed-length 'fields'.  Then use Mid$() to extract the individual 'fields'.  The 'field' at the start of the string can then be reserved as a sort key 'field' and initialised with a value from one of the other fields in the record.  The Sort statement then becomes a little bit useful.  However, changing keys for the sort involves iterating the entire array moving the new sort 'field' to the sort key 'field' at the head of the string.  It would work but a bit cumbersome again.  ;)


For the curious:
The linked list functions in AMOSPro.Lib are these:

All these functions use a very simple list element:

Lst_Next        rs.l            1       ; pointer to next element
Lst_Length      rs.l            1       ; length of user data
Lst_UserData    rs.b|w|l        nnn     ; user data

To use them from assembler code, just load the registers and JJsr L_Lst.xxxx.
(Where L_Lst,xxxx is the name of the function - the assembler picks this up from the +LEqu.s file in the includes.)

To use them from AMOS Basic, you need to load the registers using the Areg() and/or Dreg() statements.  Then emulate what the JJsr macro does:

        G_ADDR=(Leek(Areg(5)+$20)-(FunctionNumber*4)-40)
        Call Leek(G_ADDR)


(Where FunctionNumber is the number in brackets alongside each function below.)

This converts FunctionNumber into the correct offset from the library base:

Leek(Areg(5)+$20) is the base address of AMOSPro.Lib.
-40 is needed to skip over the library's header data.
FunctionNumber*4 indexes into the library's table of longword addresses to get to the entry for FunctionNumber.
Call Leek(G_ADDR) calls the function pointed to at that location.

L_Lst.ChipNew   (89)

Create a new list element in Chip memory (Chip|Clear|Public).
Will be initialised as the head element of an empty list.
IN: D0 = element length in bytes.
OUT: A0 = pointer to element address, D0 = length allocated (0=failed!).

L_Lst.New   (90)

Create a new list element in Fast memory (Clear|Public).
Will be initialised as the head element of an empty list.
IN: D0 = element length in bytes.
OUT: A0 = pointer to element address, D0 = length allocated (0=failed!).

L_Lst.Cree   (91)

Create a new list element in specified memory.
Will be initialised as the head element of an empty list.
IN: D0 = element length in bytes, D1 = memory flags (as for system AllocMem()).
OUT: A0 = pointer to element address, D0 = length allocated (0=failed!).

L_Lst.DelAll   (92)

Delete an entire list.
IN: A0 = pointer to head element.

L_Lst.Del   (93)

Delete a list element and free its memory.
IN: A0 = pointer to head element, A1 = pointer to list element to delete.

L_Lst.Insert   (94)

Insert a list element at the head of an existing list.
IN: A0 = pointer to head element, A1 = pointer to list element to be inserted.

L_Lst.Remove   (95)

Remove a list element (DOES NOT free its memory).
IN: A0 = pointer to head element, A1 = pointer to list element to remove.
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Sort array crashing
« Reply #7 on: June 07, 2014, 08:25:56 PM »

Iterative Natural Merge-Sort
The initialization pass of the natural variant of the merge-sort goes through the array and divides the list into regions.  If any number entries are in order already, they are included in the same region.  If an inversion is detected between any two entries, start a new region for the next entry.  Keep track of the number of regions because when the number drops to 1 or 0 (an empty array) the sort is complete and terminates.
...

I have never heard of this sort method either, but it's a really smart way to sort through the data :)


I hope this algorithm description wasn't too detailed for your liking...

I kinda skipped over the last few paragraphs. I've had a terrible week at work and am rather tired. Even if I did read them, I'm not sure it would have sunk in. I'll come back and read it properly in a few days when I'm not so tired.
Logged

idrougge

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 12
  • Generic Amiga User
Re: Sort array crashing
« Reply #8 on: June 10, 2014, 12:01:36 PM »

Note that AmosPro CAN do linked-lists the same way a C programmer would do them:  by manually allocating and deallocating memory chunks and using Leek and Loke to modify the entries. 

It's not that I haven't thought of that, but I wouldn't say it's the same way a C programmer does it; rather the way a C64 BASIC programmer would have done.

I hope this algorithm description wasn't too detailed for your liking...
I'm afraid it scared me senseless - after all, I'm just a poor AMOS programmer.

In the meantime, I've been trying to just work around the problem by using a system of tags or preliminary sorting. But I know I wouldn't have done it that way if AMOS had list handling as part of the language.
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Sort array crashing
« Reply #9 on: June 11, 2014, 06:28:21 PM »

I'm afraid it scared me senseless - after all, I'm just a poor AMOS programmer.

Oh, I'm sorry.  If I had the time to write my own Natural Merge-Sort for AmosPro I would.  I wonder if the Range extension or EasyLife extension has something for better sorting.  I haven't looked into either of them yet...  I just know that the AMCAF extension doesn't have anything geared toward your specific need right now.

Lonewolf10, do you have a record of the contents of those two extensions I mentioned?
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Sort array crashing
« Reply #10 on: June 11, 2014, 09:05:24 PM »

Lonewolf10, do you have a record of the contents of those two extensions I mentioned?

If you mean a list of their commands, here you go...

AMCAF 1.50beta4  (the last one that was made, I believe??)

Code: [Select]
Andrew D Burton's Extension Examiner - Export File
**************************************************
Export Selection: Commands
Path: ram:/
File: AMOSPro_AMCAF.Lib


Commands & Functions
********************
X=Amcaf Base
X$=Amcaf Version$
X=Amcaf Length
Amcaf Aga Notation On
Amcaf Aga Notation Off
Bank Permanent X
Bank Temporary X
Bank To Chip X
Bank To Fast X
Bank Code Xor.b X,Y
Bank Code Xor.b X,Y To Z
Bank Code Add.b X,Y
Bank Code Add.b X,Y To Z
Bank Code Mix.b X,Y
Bank Code Mix.b X,Y To Z
Bank Code Rol.b X,Y
Bank Code Rol.b X,Y To Z
Bank Code Ror.b X,Y
Bank Code Ror.b X,Y To Z
Bank Code Xor.w X,Y
Bank Code Xor.w X,Y To Z
Bank Code Add.w X,Y
Bank Code Add.w X,Y To Z
Bank Code Mix.w X,Y
Bank Code Mix.w X,Y To Z
Bank Code Rol.w X,Y
Bank Code Rol.w X,Y To Z
Bank Code Ror.w X,Y
Bank Code Ror.w X,Y To Z
Bank Stretch X To Y
Bank Copy X To Y
Bank Copy X,Y To Z
X$=Bank Name$(Y)
Bank Name X,Y$
X=Bank Checksum(Y)
X=Bank Checksum(Y To Z)
X=Disk State(Y$)
X=Disk Type(Y$)
X=Dos Hash(Y$)
X$=Filename$(Y$)
X=Pattern Match(Y$,Z$)
Open Workbench
X=X Raster
X=Y Raster
Raster Wait X
Raster Wait X,Y
Set Ntsc
Set Pal
Turbo Plot X,Y,Z
X=Turbo Point(Y,Z)
X=Red Val(Y)
X=Green Val(Y)
X=Blue Val(Y)
X$=Path$(Y$)
X$=Extpath$(Y$)
Rnc Unpack X To Y
X=Rnp
Reset Computer
X=Rrggbb To Rgb(Y)
X=Rgb To Rrggbb(Y)
Wload X$,Y
Dload X$,Y
Wsave X$,Y
Dsave X$,Y
File Copy X$ To Y$
Nop
X=Nfn
Pptodisk X$,Y
Pptodisk X$,Y,Z
Ppunpack X To Y
Ppfromdisk X$,Y
X=Binexp(Y)
X=Binlog(Y)
X=Extbase(Y)
X$=Io Error$(Y)
X=Io Error
X=Scrn Rastport
X=Scrn Bitmap
X=Scrn Layerinfo
X=Scrn Layer
X=Scrn Region
Change Font X$
Change Font X$,Y
Change Font X$,Y,Z
X=Font Style
Flush Libs
Fcircle X,Y,Z
Fellipse X,Y,Z,A
X=Cpu
X=Fpu
Launch X$
Launch X$,Y
Examine Dir X$
X$=Examine Next$
Examine Stop
Examine Object X$
X=Object Type
X=Object Type(Y$)
X=Object Size
X=Object Size(Y$)
X=Object Blocks
X=Object Blocks(Y$)
X$=Object Name$
X$=Object Name$(Y$)
X=Object Date
X=Object Date(Y$)
X=Object Time
X=Object Time(Y$)
X$=Object Protection$(Y)
X=Object Protection
X=Object Protection(Y$)
X$=Object Comment$
X$=Object Comment$(Y$)
Protect Object X$,Y
Set Object Comment X$,Y$
Set Sprite Priority X
X=Current Date
X=Current Time
X=Cd Year(Y)
X=Cd Month(Y)
X=Cd Day(Y)
X=Cd Weekday(Y)
X=Ct Hour(Y)
X=Ct Minute(Y)
X=Ct Second(Y)
X=Ct Tick(Y)
Mask Copy X To Y,Z
Mask Copy X,Y,Z,A,B To C,D,E,F
Mask Copy X,Y,Z,A,B To C,D,E,F,G
X$=Scanstr$(Y)
X$=Chr.w$(Y)
X$=Chr.l$(Y)
X=Pjoy(Y)
X=Pjleft(Y)
X=Pjright(Y)
X=Pjup(Y)
X=Pjdown(Y)
X=Pfire(Y)
X=Lsl(Y,Z)
X=Lsr(Y,Z)
X=Wordswap(Y)
Audio Lock
Audio Free
Convert Grey X To Y
X=Asc.w(Y$)
X=Asc.l(Y$)
X=Amos Task
X=Amos Cli
X$=Command Name$
X$=Tool Types$(Y$)
X=Ham Colour(Y,Z)
X=Ham Best(Y,Z)
X=Glue Colour(Y,Z,A)
Ptile Bank X
Paste Ptile X,Y,Z
Extdefault X
Extremove X
Extreinit X
Td Stars Bank X,Y
Td Stars Limit
Td Stars Limit X,Y To Z,A
Td Stars Origin X,Y
Td Stars Init
Td Stars Single Do
Td Stars Double Do
Td Stars Single Del
Td Stars Double Del
Td Stars Move
Td Stars Move X
Td Stars Draw
Td Stars Gravity X,Y
Td Stars Accelerate On
Td Stars Accelerate Off
Td Stars Planes X,Y
X=Sdeek(Y)
X=Speek(Y)
Pix Shift Up X,Y,Z,A,B To C,D
Pix Shift Up X,Y,Z,A,B To C,D,E
Pix Shift Down X,Y,Z,A,B To C,D
Pix Shift Down X,Y,Z,A,B To C,D,E
Pix Brighten X,Y,Z,A,B To C,D
Pix Brighten X,Y,Z,A,B To C,D,E
Pix Darken X,Y,Z,A,B To C,D
Pix Darken X,Y,Z,A,B To C,D,E
Make Pix Mask X,Y,Z To A,B,C
X=Count Pixels(Y,Z,A,B To C,D)
Coords Bank X
Coords Bank X,Y
Coords Read X,Y,Z,A To B,C,D,E
Splinters Bank X,Y
Splinters Limit
Splinters Limit X,Y To Z,A
Splinters Gravity X,Y
Splinters Init
Splinters Colour X,Y
Splinters Single Do
Splinters Double Do
Splinters Single Del
Splinters Double Del
Splinters Move
Splinters Draw
Splinters Max X
Splinters Back
Imploder Unpack X To Y
Imploder Load X$,Y
X$=Lzstr$(Y,Z)
X$=Lsstr$(Y,Z)
Write Cli X$
X=Mix Colour(Y,Z)
X=Mix Colour(Y,Z,A To B)
X$=Cd Date$(Y)
X$=Ct Time$(Y)
Splinters Fuel X
X=Splinters Active
Shade Bob Mask X
Shade Bob Planes X
Shade Bob Up X,Y,Z,A
Shade Bob Down X,Y,Z,A
Ham Fade Out X
Bank Delta Encode X
Bank Delta Encode X To Y
Bank Delta Decode X
Bank Delta Decode X To Y
Turbo Draw X,Y To Z,A,B
Turbo Draw X,Y To Z,A,B,C
Blitter Fill X,Y
Blitter Fill X,Y To Z,A
Blitter Fill X,Y,Z,A,B,C
Blitter Fill X,Y,Z,A,B,C To D,E
Pt Play X
Pt Play X,Y
Pt Stop
X=Pt Signal
Pt Volume X
Pt Voice X
X=Pt Vu(Y)
Pt Cia Speed X
X=Qsin(Y,Z)
X=Qcos(Y,Z)
Vec Rot Pos X,Y,Z
Vec Rot Angles X,Y,Z
Vec Rot Precalc
X=Vec Rot X
X=Vec Rot X(Y,Z,A)
X=Vec Rot Y
X=Vec Rot Y(Y,Z,A)
Change Print Font X
X=Qrnd(Y)
X=Vec Rot Z
X=Vec Rot Z(Y,Z,A)
X=Cop Pos
Make Bank Font X
Change Bank Font X
Blitter Clear X,Y
Blitter Clear X,Y,Z,A To B,C
X=Blitter Busy
Blitter Wait
Shade Pix X,Y
Shade Pix X,Y,Z
Blitter Copy Limit X
Blitter Copy Limit X,Y To Z,A
Blitter Copy X,Y To Z,A
Blitter Copy X,Y To Z,A,B
Blitter Copy X,Y,Z,A To B,C
Blitter Copy X,Y,Z,A To B,C,D
Blitter Copy X,Y,Z,A,B,C To D,E
Blitter Copy X,Y,Z,A,B,C To D,E,F
Set Rain Colour X,Y
Rain Fade X,Y
Rain Fade X To Y
X=Qsqr(Y)
Bcircle X,Y,Z,A
X=Pt Data Base
X=Pt Instr Address(Y)
X=Pt Instr Length(Y)
Pt Bank X
Pt Instr Play X
Pt Instr Play X,Y
Pt Instr Play X,Y,Z
Pt Sam Stop X
Pt Raw Play X,Y,Z,A
Pt Sam Bank X
Pt Sam Play X
Pt Sam Play X,Y
Pt Sam Play X,Y,Z
Pt Sam Volume X
Pt Sam Volume X,Y
Pal Get Screen X,Y
Pal Set Screen X,Y
X=Pal Get(Y,Z)
Pal Set X,Y,Z
Exchange Bob X,Y
Exchange Icon X,Y
X=Best Pen(Y)
X=Best Pen(Y,Z To A)
Bzoom X,Y,Z,A,B To C,D,E,F
X=X Smouse
X=Y Smouse
Smouse X X
Smouse Y X
Smouse Speed X
X=Smouse Key
Limit Smouse
Limit Smouse X,Y To Z,A
X=Xfire(Y,Z)
Pt Continue
X=Pt Cpattern
X=Pt Cpos
X=Pt Cinstr(Y)
X=Pt Cnote(Y)
Pt Sam Freq X,Y
X=Vclip(Y,Z To A)
X=Vin(Y,Z To A)
X=Vmod(Y,Z)
X=Vmod(Y,Z To A)
X$=Insstr$(Y$,Z$,A)
X$=Cutstr$(Y$,Z To A)
X$=Replacestr$(Y$,Z$ To A$)
X$=Itemstr$(Y$,Z)
X$=Itemstr$(Y$,Z,A$)
X=Qarc(Y,Z)
X=Even(Y)
X=Odd(Y)
X=Ham Point(Y,Z)
Set Object Date X$,Y,Z
X=Aga Detect
Pal Spread X,Y To Z,A
X=Ct String(Y$)
X=Cd String(Y$)
C2p Convert X,Y,Z To A,B,C
C2p Shift X,Y,Z To A,B
C2p Fire X,Y,Z To A,B
Sload X To Y,Z
Ssave X,Y To Z
X=Pt Free Voice
X=Pt Free Voice(Y)
Alloc Trans Source X
Set Trans Source X
Alloc Trans Map X,Y,Z
Set Trans Map X,Y,Z
Alloc Code Bank X,Y
Trans Screen Runtime X,Y,Z,A
Trans Screen Static X,Y,Z,A
Trans Screen Dynamic X,Y,Z,A
Turbo Text X,Y,Z$
Turbo Text X,Y,Z$,A
Turbo Text X,Y,Z$,A,B



*** End Of File ***

Here's the list for EasyLife 1.44:

Code: [Select]
Andrew D Burton's Extension Examiner - Export File
**************************************************
Export Selection: Commands
Path: ram:/
File: AMOSPro_EasyLife1.44.Lib


Commands & Functions
********************
X=Elznsx(Y)
X=Elznsx(Y,Z)
X=Elznsy(Y)
X=Elznsy(Y,Z)
X=Elznex(Y)
X=Elznex(Y,Z)
X=Elzney(Y)
X=Elzney(Y,Z)
Elzn Shift X,Y,Z
Elzn Shift X,Y,Z,A To B
X=Elf Asc(Y$,Z)
X=Elf Asc(Y$,Z,A)
X=Elf Char(Y$,Z$)
X=Elf Char(Y$,Z$,A)
X=Elf Not Asc(Y$,Z)
X=Elf Not Asc(Y$,Z,A)
X=Elf Not Char(Y$,Z$)
X=Elf Not Char(Y$,Z$,A)
X=Elf Last Asc(Y$,Z)
X=Elf Last Asc(Y$,Z,A)
X=Elf Last Char(Y$,Z$)
X=Elf Last Char(Y$,Z$,A)
X=Elf Last Not Asc(Y$,Z)
X=Elf Last Not Asc(Y$,Z,A)
X=Elf Last Not Char(Y$,Z$)
X=Elf Last Not Char(Y$,Z$,A)
X=Elf Control(Y$)
X=Elf Control(Y$,Z)
Elpp Load X,Y$,Z
X=Elpp Buf(Y)
X=Elpp Len(Y)
Elpp Free X
X=Elpp Crunch(Y$,Z,A,B,C)
Elpp Keep On
Elpp Keep Off
X$=Elmessage$(Y,Z,A)
X$=Elbank Name$(Y)
Els Bank Name X,Y$
X$=Elmem$(Y,Z)
X$=Elmem$(Y,Z,A)
Elreset X
X=Elmem Inc(Y,Z$)
Elmem X,Y$
X=Elwtst(Y,Z)
X=Elltst(Y,Z)
Elwset X,Y
Ellset X,Y
Elwclr X,Y
Ellclr X,Y
Elwchg X,Y
Ellchg X,Y
X=Elextb(Y)
X=Elextw(Y)
Elmz Reserve X
Elmz  Set X,Y,Z,A To B,C
Elmz  Set X,Y
X=Elmznsx(Y,Z)
X=Elmznsy(Y,Z)
X=Elmznex(Y,Z)
X=Elmzney(Y,Z)
Elmz Erase X
X=Elmzoneg
X=Elmzonen
X=Elmzone(Y,Z,A)
X=Elmzone(Y,Z)
Elzb Add X,Y,Z
Elzb Multi Add X,Y
Elzb Multi Add X
X=Elbnk Here(Y)
X=Elprotect(Y$)
Els Protect X$,Y
X=Ellock Font(Y$,Z)
Elunlock Fonts
X=El Base(Y)
X$=Ellong$(Y)
X=Ellong(Y$)
X$=Elword$(Y)
X=Elword(Y$)
X=Elf Num Char(Y$,Z$)
X=Elf Num Asc(Y$,Z)
X=Elwb Open
X=Elwb Close
X=Elwb Test
Elraster Wait X
X=Elf Nth Char(Y$,Z$,A)
X=Elf Nth Asc(Y$,Z,A)
X=Elout Exists
Elout X$
X=Eliconify Amos(Y,Z,A$)
X=Eliconify Begin(Y,Z,A$)
X=Eliconify Test
Eliconify End
Elzqzqzq X,Y To Z,A
Elqqzqzqq X,Y,Z,A To B,C
X=Elin Exists
X$=Elin$(Y)
X$=Elin Get$
X=Elpat Case(Y$,Z$)
X=Elpat Nocase(Y$,Z$)
X=Elpat Def(Y$)
Elpat Set Case X$
Elpat Set Nocase X$
Elpat Free
X=Elpat Test(Y$)
X$=Elpat Escape$(Y$)
X$=Elpat Remove$(Y$)
X=Elexec(Y$)
X$=Elpad Asc$(Y$,Z,A)
X$=Elpad Char$(Y$,Z$,A)
Elpp Allocate X,Y
X=Elmessage Exists(Y,Z,A)
X=Elpro
X=Elcompiled
Elf Fail Start
Elf Fail End
X=El Overlap(Y,Z,A,B To C,D,E,F)
X=El Lapsx
X=El Lapsy
X=El Lapex
X=El Lapey
Elxpk Load X$
Elxpk Load X$,Y
Elxpk Load X$,Y$
Elxpk Load X$,Y$,Z
Elxpk Bload X$,Y
Elxpk Bload X$,Y$,Z
Elxpk Save X$,Y$,Z
Elxpk Save X$,Y$,Z$,A
Elxpk Bsave X$,Y$,Z To A
Elxpk Bsave X$,Y$,Z$,A To B
X=Elxpk Error
X=Elxpk Lof(Y$)



*** End Of File ***

From what I can see, neither seem to have sorting commands. Maybe I missed them??

Edit: Oops, I guess you were referring to Range and EasyLife, not AMCAF. I don't appear to have the Range extension, sorry.
« Last Edit: June 11, 2014, 09:21:14 PM by Lonewolf10 »
Logged

idrougge

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 12
  • Generic Amiga User
Re: Sort array crashing
« Reply #11 on: June 12, 2014, 09:52:58 AM »

Regarding linked lists, there is a (really ugly) set of functions in the Aminet archive Amos_ADTS.lha.
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: Sort array crashing
« Reply #12 on: June 20, 2014, 02:20:20 PM »

A definite severe headache from that sort algorithm SamuraiCrow!
Some list handling functionality in AMOS would help, but not without simple on-the-fly structure definition instructions to support it.
One of the aspects of AMOS than always appealed to me was that it allows the programmer to get right down to the bits, bytes and memory level.  So "Bank = AllocMem()" and "Peek/Poke, etc. = Structure".  Which is an excellent way to prototype and debug (and learn) about data storage and manipulation techniques.  I can then impliment the final code in ASM if speed's an issue.  Too much support kinda spoils the fun in a way  ;) .

I should also correct something I mentioned elsewhere about Deek/Doke and Leek/Loke and word-alignment.  AMOS allows non-word-aligned word and longword use.  It checks for an odd address before it does anything and uses byte-sized memory access if necessary.  So no problem but there's a speed penalty for non-word-aligned Deek/Doke and Leek/Loke.
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Sort array crashing
« Reply #13 on: June 20, 2014, 03:36:44 PM »

A definite severe headache from that sort algorithm SamuraiCrow!
Some list handling functionality in AMOS would help, but not without simple on-the-fly structure definition instructions to support it.
One of the aspects of AMOS than always appealed to me was that it allows the programmer to get right down to the bits, bytes and memory level.  So "Bank = AllocMem()" and "Peek/Poke, etc. = Structure".  Which is an excellent way to prototype and debug (and learn) about data storage and manipulation techniques.  I can then impliment the final code in ASM if speed's an issue.  Too much support kinda spoils the fun in a way  ;) .

I should also correct something I mentioned elsewhere about Deek/Doke and Leek/Loke and word-alignment.  AMOS allows non-word-aligned word and longword use.  It checks for an odd address before it does anything and uses byte-sized memory access if necessary.  So no problem but there's a speed penalty for non-word-aligned Deek/Doke and Leek/Loke.
I could send you the Java source... [emoji1]

Sent from my Prism II

Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Sort array crashing
« Reply #14 on: June 23, 2014, 09:30:53 AM »

Quote
I could send you the Java source... [emoji1]
...or not.  I can't seem to find my data structures and algorithms source codes on my USB memory sticks.
Logged
Pages: [1] 2   Go Up
 

TinyPortal 2.2.2 © 2005-2022