<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.amstrad-cpc.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wokani</id>
	<title>CPCWiki - THE Amstrad CPC encyclopedia! - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.amstrad-cpc.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wokani"/>
	<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/wiki/Special:Contributions/Wokani"/>
	<updated>2026-09-04T05:28:37Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.amstrad-cpc.net/index.php?title=Programming:Bubble_sort&amp;diff=87042</id>
		<title>Programming:Bubble sort</title>
		<link rel="alternate" type="text/html" href="https://wiki.amstrad-cpc.net/index.php?title=Programming:Bubble_sort&amp;diff=87042"/>
		<updated>2019-01-27T09:29:20Z</updated>

		<summary type="html">&lt;p&gt;Wokani: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Does a bubble sort (ascending) on a memory range.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;&lt;br /&gt;
; Usage: HL - address of table, C - number of bytes to sort&lt;br /&gt;
; call bubble&lt;br /&gt;
; Destroys: abcdefhlix&lt;br /&gt;
;&lt;br /&gt;
FLAG EQU 7&lt;br /&gt;
&lt;br /&gt;
bubble	ld	(temp), hl&lt;br /&gt;
again	ld	ix, (temp)&lt;br /&gt;
	res	FLAG, h&lt;br /&gt;
	ld	b, c&lt;br /&gt;
	dec	b&lt;br /&gt;
		&lt;br /&gt;
next	ld	a, (ix)&lt;br /&gt;
	ld	d, a&lt;br /&gt;
	ld	e, (ix + 1)&lt;br /&gt;
	sub	e&lt;br /&gt;
	jr	c, noswitch&lt;br /&gt;
			&lt;br /&gt;
xchange	ld	(ix), e&lt;br /&gt;
	ld	(ix + 1), d&lt;br /&gt;
	set	FLAG, h&lt;br /&gt;
			&lt;br /&gt;
noswitch	inc	ix&lt;br /&gt;
	djnz next&lt;br /&gt;
	bit	FLAG, h&lt;br /&gt;
	jr	nz, again&lt;br /&gt;
	ret&lt;br /&gt;
			&lt;br /&gt;
temp 		db 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;/div&gt;</summary>
		<author><name>Wokani</name></author>
	</entry>
</feed>