<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://channelf.se/veswiki/index.php?feed=atom&amp;namespace=0&amp;title=Special%3ANewPages</id>
		<title>veswiki - New pages [en]</title>
		<link rel="self" type="application/atom+xml" href="http://channelf.se/veswiki/index.php?feed=atom&amp;namespace=0&amp;title=Special%3ANewPages"/>
		<link rel="alternate" type="text/html" href="http://channelf.se/veswiki/index.php?title=Special:NewPages"/>
		<updated>2026-09-17T03:08:58Z</updated>
		<subtitle>From veswiki</subtitle>
		<generator>MediaWiki 1.28.0</generator>

	<entry>
		<id>http://channelf.se/veswiki/index.php?title=Snippet:KStack</id>
		<title>Snippet:KStack</title>
		<link rel="alternate" type="text/html" href="http://channelf.se/veswiki/index.php?title=Snippet:KStack"/>
				<updated>2026-08-04T22:43:21Z</updated>
		
		<summary type="html">&lt;p&gt;E5frog: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
;===========================================================================&lt;br /&gt;
; KStack Functions&lt;br /&gt;
;===========================================================================&lt;br /&gt;
; the K stack implements a stack using the registers. it uses r63 as a stack&lt;br /&gt;
; pointer that holds the register number of the top of the stack.&lt;br /&gt;
; When called, K is pushed to the first two registers on the stack, and the &lt;br /&gt;
; pointer is increased.&lt;br /&gt;
;&lt;br /&gt;
; at startup, the stack pointer (r63) should be set to 62 ($3E)&lt;br /&gt;
&lt;br /&gt;
;---------------------------------------------------------------------------&lt;br /&gt;
; KStack Push&lt;br /&gt;
;---------------------------------------------------------------------------&lt;br /&gt;
; pushes register K onto the stack using r63 as the stack pointer&lt;br /&gt;
; destroys ISAR data&lt;br /&gt;
&lt;br /&gt;
pushk:&lt;br /&gt;
		lisu	7				; get the top of the stack&lt;br /&gt;
		lisl	7				; r63, stack pointer&lt;br /&gt;
		lr	A,S&lt;br /&gt;
		lr	IS, A				; load the referenced register	&lt;br /&gt;
		lr	A,KU&lt;br /&gt;
		lr	I,A				; push high byte of K&lt;br /&gt;
		lr	A,KL&lt;br /&gt;
		lr	I,A				; push low byte of K&lt;br /&gt;
		lr	A,IS&lt;br /&gt;
		lisu	7&lt;br /&gt;
		lisl	3&lt;br /&gt;
		lr	S,A				; save the register number to the stack pointer&lt;br /&gt;
		pop&lt;br /&gt;
&lt;br /&gt;
;---------------------------------------------------------------------------&lt;br /&gt;
; KStack Pop&lt;br /&gt;
;---------------------------------------------------------------------------&lt;br /&gt;
; pops register K from the stack using r63 as the stack pointer&lt;br /&gt;
; destroys ISAR&lt;br /&gt;
                &lt;br /&gt;
popk:&lt;br /&gt;
		lisu	7				; r63, stack pointer&lt;br /&gt;
		lisl	7&lt;br /&gt;
		lr	A,S				; A = stack pointer, points to next free&lt;br /&gt;
		ai	$ff				; A = last pushed byte, KL&lt;br /&gt;
		lr	IS,A				; ISAR -&amp;gt; KL&lt;br /&gt;
		lr	A,D				; read KL, then ISAR -&amp;gt; KU&lt;br /&gt;
		lr	KL,A&lt;br /&gt;
		lr	A,S				; read KU&lt;br /&gt;
		lr	KU,A&lt;br /&gt;
		lr	A,IS				; ISAR now points to new stack pointer&lt;br /&gt;
		lisu	7&lt;br /&gt;
		lisl	3&lt;br /&gt;
		lr	S,A				; store new stack pointer in r59&lt;br /&gt;
		pop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>E5frog</name></author>	</entry>

	</feed>