New demo uploaded: quick sort color demo

All aspects of programming on the Commander X16.
Post Reply
x16tial
Posts: 177
Joined: Sun Feb 07, 2021 8:23 pm

New demo uploaded: quick sort color demo

Post by x16tial »




quick sort color demo




View File






Variation of the quick sort demo, but this one using the 320x240x8bpp mode, which uses double the memory, and is that much cooler to watch ?

Tap any key to progress from:


  • Random


  • Slowed down sort


  • Random


  • Full speed sort


  • Back to Basic


Note: that band of "non random" pixels below the middle of the screen is the default location of character tiles at $0f800 = $0ffff.  This gets moved to right after screen memory at $04000 - $047ff (which is probably where it *should* default to, if you ask me :))






 
User avatar
desertfish
Posts: 1123
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

New demo uploaded: quick sort color demo

Post by desertfish »


what RNG are you using to set everything back to random?

x16tial
Posts: 177
Joined: Sun Feb 07, 2021 8:23 pm

New demo uploaded: quick sort color demo

Post by x16tial »



36 minutes ago, desertfish said:




what RNG are you using to set everything back to random?



entropy_get ($fecf)

then I just use part of the routine in the example in the doc:

JSR entropy_get
STX tmp ; combine 24 bits
EOR tmp ; using exclusive-or
STY tmp ; to get a higher-quality
EOR tmp ; 8 bit random value

Then STA that value into mem

The doc recommends that "this data should be fed into a pseudo-random number generator" but it seems to work well enough.

x16tial
Posts: 177
Joined: Sun Feb 07, 2021 8:23 pm

New demo uploaded: quick sort color demo

Post by x16tial »


Just added "sortdemocolor2.prg"

This one will pause at each "level" of the sort, kinda fun to see how the colors separate at each level.

Will have to be downloaded to use it, as the "Try it now" button in the download dialog runs the original.

Post Reply