<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=Z80%3AText_Routines</id>
	<title>Z80:Text Routines - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=Z80%3AText_Routines"/>
	<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Text_Routines&amp;action=history"/>
	<updated>2026-07-26T19:58:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=Z80:Text_Routines&amp;diff=133&amp;oldid=prev</id>
		<title>KermMartian: Created page with &quot;One of the easiest ways to communicate with the user is through text. The OS offers a slew of routines, but here are a few more to add to your list of routines:  = PutSI = Sta...&quot;</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Text_Routines&amp;diff=133&amp;oldid=prev"/>
		<updated>2016-02-05T06:35:29Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;One of the easiest ways to communicate with the user is through text. The OS offers a slew of routines, but here are a few more to add to your list of routines:  = PutSI = Sta...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;One of the easiest ways to communicate with the user is through text. The OS offers a slew of routines, but here are a few more to add to your list of routines:&lt;br /&gt;
&lt;br /&gt;
= PutSI =&lt;br /&gt;
Standing for &amp;quot;Put String Immediate,&amp;quot; a routine like this can really add up to be a wonderful way to save memory, especially for programs relying heavily on text. What you do is call this routine with your text data directly following the call. For example:&lt;br /&gt;
&lt;br /&gt;
    call PutSI&lt;br /&gt;
         .db 3,3,&amp;quot;String&amp;quot;,0&lt;br /&gt;
&lt;br /&gt;
Here is the code:&lt;br /&gt;
&lt;br /&gt;
    PutSI:&lt;br /&gt;
         pop hl&lt;br /&gt;
         ld c,(hl)&lt;br /&gt;
         inc hl&lt;br /&gt;
         ld b,(hl)&lt;br /&gt;
         inc hl&lt;br /&gt;
         ld (curRow),bc&lt;br /&gt;
         bcall(_PutS)&lt;br /&gt;
         jp (hl)&lt;br /&gt;
&lt;br /&gt;
To give an idea of how much memory it saves, you save 1 byte after using this routine twice (it makes up for the size of the routine) and saves an additional 7 bytes each time it is used.&lt;br /&gt;
= VPutSI =&lt;br /&gt;
Along the same lines as PutSI:&lt;br /&gt;
&lt;br /&gt;
    VPutSI:&lt;br /&gt;
         pop hl&lt;br /&gt;
         ld c,(hl)&lt;br /&gt;
         inc hl&lt;br /&gt;
         ld b,(hl)&lt;br /&gt;
         inc hl&lt;br /&gt;
         ld (penCol),bc&lt;br /&gt;
         bcall(_VPutS)&lt;br /&gt;
         jp (hl)&lt;br /&gt;
&lt;br /&gt;
= PutS_App =&lt;br /&gt;
To use bcall(_PutS), the string must be in RAM. In Apps, this means you need to copy the string to RAM before displaying it. Or, you could make a routine like this:&lt;br /&gt;
&lt;br /&gt;
    PutS_App:&lt;br /&gt;
    ;Inputs:&lt;br /&gt;
    ;     HL points to the zero-terminated string&lt;br /&gt;
         ld a,(hl)&lt;br /&gt;
         or a&lt;br /&gt;
         ret z&lt;br /&gt;
         inc hl&lt;br /&gt;
         bcall(_PutC)&lt;br /&gt;
         jr PutS_App&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
[[Category:Z80 Assembly]]&lt;br /&gt;
[[Category:Z80 Heaven]]&lt;/div&gt;</summary>
		<author><name>KermMartian</name></author>
	</entry>
</feed>