c128lib Framework
A Commodore 128 software framework for enabling high-level development of C128 programs.
Loading...
Searching...
No Matches
sort.asm File Reference

Namespaces

namespace  Sort
 Sort module.
 

Functions

macro BubbleSort (arrayAddress, arraySize, switchToFastModeWhileRunning)
 This macro implements the Bubble Sort algorithm.
 

Function Documentation

◆ BubbleSort()

macro BubbleSort ( arrayAddress ,
arraySize ,
switchToFastModeWhileRunning  )

This macro implements the Bubble Sort algorithm.

Parameters
[in,out]arrayAddressThe starting address of the array to be sorted.
[in]arraySizeThe size of the array to be sorted.
[in]switchToFastModeWhileRunningIf true, the macro will switch to 8502 fast mode.

This macro sorts an array in ascending order using the Bubble Sort algorithm. If 'switchToFastModeWhileRunning' is true, the macro will switch to 8502 fast mode while running. This can be beneficial for larger arrays.

Note
The sorted array is available at the same memory address as the input array. The macro modifies the .A, .X, and .Y registers. If you're using these registers elsewhere in your code, you'll need to save their values before calling this macro and restore them afterward.
Remarks
Use c128lib_BubbleSort in sort-global.asm
Since
0.1.0